Merge "Partial revert to not flip the default of extractNativeLibs"
diff --git a/Android.bp b/Android.bp
index 4b22f9e..4e7aa5f 100644
--- a/Android.bp
+++ b/Android.bp
@@ -108,8 +108,8 @@
         "core/java/android/app/prediction/IPredictionCallback.aidl",
         "core/java/android/app/prediction/IPredictionManager.aidl",
         "core/java/android/app/role/IOnRoleHoldersChangedListener.aidl",
+        "core/java/android/app/role/IRoleController.aidl",
         "core/java/android/app/role/IRoleManager.aidl",
-        "core/java/android/app/role/IRoleManagerCallback.aidl",
         "core/java/android/app/slice/ISliceManager.aidl",
         "core/java/android/app/slice/ISliceListener.aidl",
         "core/java/android/app/timedetector/ITimeDetectorService.aidl",
@@ -225,6 +225,8 @@
         "core/java/android/net/INetworkScoreService.aidl",
         "core/java/android/net/INetworkStatsService.aidl",
         "core/java/android/net/INetworkStatsSession.aidl",
+        "core/java/android/net/ITestNetworkManager.aidl",
+        "core/java/android/net/ITetheringEventCallback.aidl",
         "core/java/android/net/ITetheringStatsProvider.aidl",
         "core/java/android/net/nsd/INsdManager.aidl",
         "core/java/android/nfc/IAppCallback.aidl",
@@ -274,7 +276,6 @@
         "core/java/android/os/storage/IStorageShutdownObserver.aidl",
         "core/java/android/os/storage/IObbActionListener.aidl",
         "core/java/android/permission/IPermissionController.aidl",
-        "core/java/android/rolecontrollerservice/IRoleControllerService.aidl",
         ":keystore_aidl",
         "core/java/android/security/keymaster/IKeyAttestationApplicationIdProvider.aidl",
         "core/java/android/service/appprediction/IPredictionService.aidl",
@@ -352,12 +353,8 @@
         "core/java/android/service/chooser/IChooserTargetResult.aidl",
         "core/java/android/service/resolver/IResolverRankerService.aidl",
         "core/java/android/service/resolver/IResolverRankerResult.aidl",
-        "core/java/android/service/textclassifier/IConversationActionsCallback.aidl",
-        "core/java/android/service/textclassifier/ITextClassificationCallback.aidl",
+        "core/java/android/service/textclassifier/ITextClassifierCallback.aidl",
         "core/java/android/service/textclassifier/ITextClassifierService.aidl",
-        "core/java/android/service/textclassifier/ITextLanguageCallback.aidl",
-        "core/java/android/service/textclassifier/ITextLinksCallback.aidl",
-        "core/java/android/service/textclassifier/ITextSelectionCallback.aidl",
         "core/java/android/service/attention/IAttentionService.aidl",
         "core/java/android/service/attention/IAttentionCallback.aidl",
         "core/java/android/view/accessibility/IAccessibilityInteractionConnection.aidl",
@@ -608,6 +605,7 @@
         "telephony/java/com/android/internal/telephony/IOns.aidl",
         "telephony/java/com/android/internal/telephony/ITelephony.aidl",
         "telephony/java/com/android/internal/telephony/ITelephonyRegistry.aidl",
+        "telephony/java/com/android/internal/telephony/IUpdateAvailableNetworksCallback.aidl",
         "telephony/java/com/android/internal/telephony/IWapPushManager.aidl",
         "telephony/java/com/android/internal/telephony/euicc/IAuthenticateServerCallback.aidl",
         "telephony/java/com/android/internal/telephony/euicc/ICancelSessionCallback.aidl",
@@ -1125,6 +1123,7 @@
         "core/java/android/os/HidlSupport.java",
         "core/java/android/annotation/IntDef.java",
         "core/java/android/annotation/NonNull.java",
+        "core/java/android/annotation/Nullable.java",
         "core/java/android/annotation/SystemApi.java",
         "core/java/android/annotation/TestApi.java",
         "core/java/android/os/HwBinder.java",
@@ -1788,3 +1787,10 @@
     ],
 }
 
+// Creates an index of AIDL methods; used for adding UnsupportedAppUsage
+// annotations to private apis
+aidl_mapping {
+    name: "framework-aidl-mappings",
+    srcs: [":framework-defaults"],
+    output: "framework-aidl-mappings.txt"
+}
\ No newline at end of file
diff --git a/api/current.txt b/api/current.txt
index 32747e7..0176c68 100644
--- a/api/current.txt
+++ b/api/current.txt
@@ -287,6 +287,7 @@
     field public static final int alertDialogTheme = 16843529; // 0x1010309
     field public static final int alignmentMode = 16843642; // 0x101037a
     field public static final int allContactsName = 16843468; // 0x10102cc
+    field public static final int allowAudioPlaybackCapture = 16844199; // 0x10105a7
     field public static final int allowBackup = 16843392; // 0x1010280
     field public static final int allowClearUserData = 16842757; // 0x1010005
     field public static final int allowEmbedded = 16843765; // 0x10103f5
@@ -767,6 +768,7 @@
     field public static final int indicatorRight = 16843022; // 0x101010e
     field public static final int indicatorStart = 16843729; // 0x10103d1
     field public static final int inflatedId = 16842995; // 0x10100f3
+    field public static final int inheritShowWhenLocked = 16844194; // 0x10105a2
     field public static final int initOrder = 16842778; // 0x101001a
     field public static final int initialKeyguardLayout = 16843714; // 0x10103c2
     field public static final int initialLayout = 16843345; // 0x1010251
@@ -1202,6 +1204,7 @@
     field public static final int secondaryProgress = 16843064; // 0x1010138
     field public static final int secondaryProgressTint = 16843879; // 0x1010467
     field public static final int secondaryProgressTintMode = 16843880; // 0x1010468
+    field public static final int secureElementName = 16844200; // 0x10105a8
     field public static final int seekBarStyle = 16842875; // 0x101007b
     field public static final int segmentedButtonStyle = 16843568; // 0x1010330
     field public static final int selectAllOnFocus = 16843102; // 0x101015e
@@ -2925,7 +2928,7 @@
     field public static final int CAPABILITY_CAN_REQUEST_FINGERPRINT_GESTURES = 64; // 0x40
     field public static final int CAPABILITY_CAN_REQUEST_TOUCH_EXPLORATION = 2; // 0x2
     field public static final int CAPABILITY_CAN_RETRIEVE_WINDOW_CONTENT = 1; // 0x1
-    field public static final android.os.Parcelable.Creator<android.accessibilityservice.AccessibilityServiceInfo> CREATOR;
+    field @NonNull public static final android.os.Parcelable.Creator<android.accessibilityservice.AccessibilityServiceInfo> CREATOR;
     field public static final int DEFAULT = 1; // 0x1
     field public static final int FEEDBACK_ALL_MASK = -1; // 0xffffffff
     field public static final int FEEDBACK_AUDIBLE = 4; // 0x4
@@ -3019,7 +3022,7 @@
     ctor public Account(android.os.Parcel);
     method public int describeContents();
     method public void writeToParcel(android.os.Parcel, int);
-    field public static final android.os.Parcelable.Creator<android.accounts.Account> CREATOR;
+    field @NonNull public static final android.os.Parcelable.Creator<android.accounts.Account> CREATOR;
     field public final String name;
     field public final String type;
   }
@@ -3036,7 +3039,7 @@
     method public void onRequestContinued();
     method public void onResult(android.os.Bundle);
     method public void writeToParcel(android.os.Parcel, int);
-    field public static final android.os.Parcelable.Creator<android.accounts.AccountAuthenticatorResponse> CREATOR;
+    field @NonNull public static final android.os.Parcelable.Creator<android.accounts.AccountAuthenticatorResponse> CREATOR;
   }
 
   public class AccountManager {
@@ -3153,7 +3156,7 @@
     method public int describeContents();
     method public static android.accounts.AuthenticatorDescription newKey(String);
     method public void writeToParcel(android.os.Parcel, int);
-    field public static final android.os.Parcelable.Creator<android.accounts.AuthenticatorDescription> CREATOR;
+    field @NonNull public static final android.os.Parcelable.Creator<android.accounts.AuthenticatorDescription> CREATOR;
     field public final int accountPreferencesId;
     field public final boolean customTokens;
     field public final int iconId;
@@ -3849,6 +3852,7 @@
     method public final void setFeatureDrawableUri(int, android.net.Uri);
     method public void setFinishOnTouchOutside(boolean);
     method public void setImmersive(boolean);
+    method public void setInheritShowWhenLocked(boolean);
     method public void setIntent(android.content.Intent);
     method public final void setMediaController(android.media.session.MediaController);
     method public void setPictureInPictureParams(@NonNull android.app.PictureInPictureParams);
@@ -3943,7 +3947,7 @@
     method public android.app.PendingIntent getRunningServiceControlPanel(android.content.ComponentName) throws java.lang.SecurityException;
     method @Deprecated public java.util.List<android.app.ActivityManager.RunningServiceInfo> getRunningServices(int) throws java.lang.SecurityException;
     method @Deprecated public java.util.List<android.app.ActivityManager.RunningTaskInfo> getRunningTasks(int) throws java.lang.SecurityException;
-    method public boolean isActivityStartAllowedOnDisplay(android.content.Context, int, android.content.Intent);
+    method public boolean isActivityStartAllowedOnDisplay(@NonNull android.content.Context, int, @NonNull android.content.Intent);
     method public boolean isBackgroundRestricted();
     method @Deprecated public boolean isInLockTaskMode();
     method public boolean isLowRamDevice();
@@ -3980,7 +3984,7 @@
     method public int describeContents();
     method public void readFromParcel(android.os.Parcel);
     method public void writeToParcel(android.os.Parcel, int);
-    field public static final android.os.Parcelable.Creator<android.app.ActivityManager.MemoryInfo> CREATOR;
+    field @NonNull public static final android.os.Parcelable.Creator<android.app.ActivityManager.MemoryInfo> CREATOR;
     field public long availMem;
     field public boolean lowMemory;
     field public long threshold;
@@ -3993,7 +3997,7 @@
     method public void readFromParcel(android.os.Parcel);
     method public void writeToParcel(android.os.Parcel, int);
     field public static final int CRASHED = 1; // 0x1
-    field public static final android.os.Parcelable.Creator<android.app.ActivityManager.ProcessErrorStateInfo> CREATOR;
+    field @NonNull public static final android.os.Parcelable.Creator<android.app.ActivityManager.ProcessErrorStateInfo> CREATOR;
     field public static final int NOT_RESPONDING = 2; // 0x2
     field public static final int NO_ERROR = 0; // 0x0
     field public int condition;
@@ -4012,7 +4016,7 @@
     method public int describeContents();
     method public void readFromParcel(android.os.Parcel);
     method public void writeToParcel(android.os.Parcel, int);
-    field public static final android.os.Parcelable.Creator<android.app.ActivityManager.RecentTaskInfo> CREATOR;
+    field @NonNull public static final android.os.Parcelable.Creator<android.app.ActivityManager.RecentTaskInfo> CREATOR;
     field @Deprecated public int affiliatedTaskId;
     field @Deprecated public CharSequence description;
     field @Deprecated public int id;
@@ -4025,7 +4029,7 @@
     method public int describeContents();
     method public void readFromParcel(android.os.Parcel);
     method public void writeToParcel(android.os.Parcel, int);
-    field public static final android.os.Parcelable.Creator<android.app.ActivityManager.RunningAppProcessInfo> CREATOR;
+    field @NonNull public static final android.os.Parcelable.Creator<android.app.ActivityManager.RunningAppProcessInfo> CREATOR;
     field @Deprecated public static final int IMPORTANCE_BACKGROUND = 400; // 0x190
     field public static final int IMPORTANCE_CACHED = 400; // 0x190
     field public static final int IMPORTANCE_CANT_SAVE_STATE = 350; // 0x15e
@@ -4059,7 +4063,7 @@
     method public int describeContents();
     method public void readFromParcel(android.os.Parcel);
     method public void writeToParcel(android.os.Parcel, int);
-    field public static final android.os.Parcelable.Creator<android.app.ActivityManager.RunningServiceInfo> CREATOR;
+    field @NonNull public static final android.os.Parcelable.Creator<android.app.ActivityManager.RunningServiceInfo> CREATOR;
     field public static final int FLAG_FOREGROUND = 2; // 0x2
     field public static final int FLAG_PERSISTENT_PROCESS = 8; // 0x8
     field public static final int FLAG_STARTED = 1; // 0x1
@@ -4085,7 +4089,7 @@
     method public int describeContents();
     method public void readFromParcel(android.os.Parcel);
     method public void writeToParcel(android.os.Parcel, int);
-    field public static final android.os.Parcelable.Creator<android.app.ActivityManager.RunningTaskInfo> CREATOR;
+    field @NonNull public static final android.os.Parcelable.Creator<android.app.ActivityManager.RunningTaskInfo> CREATOR;
     field @Deprecated public CharSequence description;
     field @Deprecated public int id;
     field @Deprecated public int numRunning;
@@ -4106,7 +4110,7 @@
     method public int getPrimaryColor();
     method public void readFromParcel(android.os.Parcel);
     method public void writeToParcel(android.os.Parcel, int);
-    field public static final android.os.Parcelable.Creator<android.app.ActivityManager.TaskDescription> CREATOR;
+    field @NonNull public static final android.os.Parcelable.Creator<android.app.ActivityManager.TaskDescription> CREATOR;
   }
 
   public class ActivityOptions {
@@ -4167,7 +4171,7 @@
     method public android.app.PendingIntent getShowIntent();
     method public long getTriggerTime();
     method public void writeToParcel(android.os.Parcel, int);
-    field public static final android.os.Parcelable.Creator<android.app.AlarmManager.AlarmClockInfo> CREATOR;
+    field @NonNull public static final android.os.Parcelable.Creator<android.app.AlarmManager.AlarmClockInfo> CREATOR;
   }
 
   public static interface AlarmManager.OnAlarmListener {
@@ -4250,10 +4254,9 @@
 
   public class AppComponentFactory {
     ctor public AppComponentFactory();
-    method public android.content.pm.ApplicationInfo getApplicationInfo();
     method @NonNull public android.app.Activity instantiateActivity(@NonNull ClassLoader, @NonNull String, @Nullable android.content.Intent) throws java.lang.ClassNotFoundException, java.lang.IllegalAccessException, java.lang.InstantiationException;
     method @NonNull public android.app.Application instantiateApplication(@NonNull ClassLoader, @NonNull String) throws java.lang.ClassNotFoundException, java.lang.IllegalAccessException, java.lang.InstantiationException;
-    method @NonNull public ClassLoader instantiateClassLoader(@NonNull ClassLoader);
+    method @NonNull public ClassLoader instantiateClassLoader(@NonNull ClassLoader, @NonNull android.content.pm.ApplicationInfo);
     method @NonNull public android.content.ContentProvider instantiateProvider(@NonNull ClassLoader, @NonNull String) throws java.lang.ClassNotFoundException, java.lang.IllegalAccessException, java.lang.InstantiationException;
     method @NonNull public android.content.BroadcastReceiver instantiateReceiver(@NonNull ClassLoader, @NonNull String, @Nullable android.content.Intent) throws java.lang.ClassNotFoundException, java.lang.IllegalAccessException, java.lang.InstantiationException;
     method @NonNull public android.app.Service instantiateService(@NonNull ClassLoader, @NonNull String, @Nullable android.content.Intent) throws java.lang.ClassNotFoundException, java.lang.IllegalAccessException, java.lang.InstantiationException;
@@ -4268,6 +4271,7 @@
     method public int noteOpNoThrow(String, int, String);
     method public int noteProxyOp(String, String);
     method public int noteProxyOpNoThrow(String, String);
+    method public int noteProxyOpNoThrow(@NonNull String, @Nullable String, int);
     method public static String permissionToOp(String);
     method public int startOp(String, int, String);
     method public int startOpNoThrow(String, int, String);
@@ -4276,7 +4280,8 @@
     method public void stopWatchingMode(android.app.AppOpsManager.OnOpChangedListener);
     method public int unsafeCheckOp(String, int, String);
     method public int unsafeCheckOpNoThrow(String, int, String);
-    method public int unsafeCheckOpRaw(String, int, String);
+    method public int unsafeCheckOpRaw(@NonNull String, int, String);
+    method public int unsafeCheckOpRawNoThrow(@NonNull String, int, @NonNull String);
     field public static final int MODE_ALLOWED = 0; // 0x0
     field public static final int MODE_DEFAULT = 3; // 0x3
     field public static final int MODE_ERRORED = 2; // 0x2
@@ -4372,7 +4377,7 @@
     method public static android.content.ComponentName getErrorReportReceiver(android.content.Context, String, int);
     method public void readFromParcel(android.os.Parcel);
     method public void writeToParcel(android.os.Parcel, int);
-    field public static final android.os.Parcelable.Creator<android.app.ApplicationErrorReport> CREATOR;
+    field @NonNull public static final android.os.Parcelable.Creator<android.app.ApplicationErrorReport> CREATOR;
     field public static final int TYPE_ANR = 2; // 0x2
     field public static final int TYPE_BATTERY = 3; // 0x3
     field public static final int TYPE_CRASH = 1; // 0x1
@@ -4440,16 +4445,16 @@
     method public int describeContents();
     method public android.app.PendingIntent getUserAction();
     method public void writeToParcel(android.os.Parcel, int);
-    field public static final android.os.Parcelable.Creator<android.app.AuthenticationRequiredException> CREATOR;
+    field @NonNull public static final android.os.Parcelable.Creator<android.app.AuthenticationRequiredException> CREATOR;
   }
 
   public final class AutomaticZenRule implements android.os.Parcelable {
     ctor @Deprecated public AutomaticZenRule(String, android.content.ComponentName, android.net.Uri, int, boolean);
-    ctor public AutomaticZenRule(String, android.content.ComponentName, android.content.ComponentName, android.net.Uri, android.service.notification.ZenPolicy, int, boolean);
+    ctor public AutomaticZenRule(@NonNull String, @Nullable android.content.ComponentName, @Nullable android.content.ComponentName, @NonNull android.net.Uri, @Nullable android.service.notification.ZenPolicy, int, boolean);
     ctor public AutomaticZenRule(android.os.Parcel);
     method public int describeContents();
     method public android.net.Uri getConditionId();
-    method public android.content.ComponentName getConfigurationActivity();
+    method @Nullable public android.content.ComponentName getConfigurationActivity();
     method public long getCreationTime();
     method public int getInterruptionFilter();
     method public String getName();
@@ -4457,13 +4462,13 @@
     method public android.service.notification.ZenPolicy getZenPolicy();
     method public boolean isEnabled();
     method public void setConditionId(android.net.Uri);
-    method public void setConfigurationActivity(android.content.ComponentName);
+    method public void setConfigurationActivity(@Nullable android.content.ComponentName);
     method public void setEnabled(boolean);
     method public void setInterruptionFilter(int);
     method public void setName(String);
     method public void setZenPolicy(android.service.notification.ZenPolicy);
     method public void writeToParcel(android.os.Parcel, int);
-    field public static final android.os.Parcelable.Creator<android.app.AutomaticZenRule> CREATOR;
+    field @NonNull public static final android.os.Parcelable.Creator<android.app.AutomaticZenRule> CREATOR;
   }
 
   public class DatePickerDialog extends android.app.AlertDialog implements android.widget.DatePicker.OnDateChangedListener android.content.DialogInterface.OnClickListener {
@@ -5262,6 +5267,7 @@
     method public String getGroup();
     method public int getGroupAlertBehavior();
     method public android.graphics.drawable.Icon getLargeIcon();
+    method @Nullable public android.content.LocusId getLocusId();
     method public CharSequence getSettingsText();
     method public String getShortcutId();
     method public android.graphics.drawable.Icon getSmallIcon();
@@ -5289,7 +5295,7 @@
     field public static final String CATEGORY_SYSTEM = "sys";
     field public static final String CATEGORY_TRANSPORT = "transport";
     field @ColorInt public static final int COLOR_DEFAULT = 0; // 0x0
-    field public static final android.os.Parcelable.Creator<android.app.Notification> CREATOR;
+    field @NonNull public static final android.os.Parcelable.Creator<android.app.Notification> CREATOR;
     field public static final int DEFAULT_ALL = -1; // 0xffffffff
     field public static final int DEFAULT_LIGHTS = 4; // 0x4
     field public static final int DEFAULT_SOUND = 1; // 0x1
@@ -5398,7 +5404,7 @@
     method public int getSemanticAction();
     method public boolean isContextual();
     method public void writeToParcel(android.os.Parcel, int);
-    field public static final android.os.Parcelable.Creator<android.app.Notification.Action> CREATOR;
+    field @NonNull public static final android.os.Parcelable.Creator<android.app.Notification.Action> CREATOR;
     field public static final int SEMANTIC_ACTION_ARCHIVE = 5; // 0x5
     field public static final int SEMANTIC_ACTION_CALL = 10; // 0xa
     field public static final int SEMANTIC_ACTION_DELETE = 4; // 0x4
@@ -5419,14 +5425,14 @@
     ctor @Deprecated public Notification.Action.Builder(int, CharSequence, android.app.PendingIntent);
     ctor public Notification.Action.Builder(android.graphics.drawable.Icon, CharSequence, android.app.PendingIntent);
     ctor public Notification.Action.Builder(android.app.Notification.Action);
-    method public android.app.Notification.Action.Builder addExtras(android.os.Bundle);
-    method public android.app.Notification.Action.Builder addRemoteInput(android.app.RemoteInput);
-    method public android.app.Notification.Action build();
-    method public android.app.Notification.Action.Builder extend(android.app.Notification.Action.Extender);
+    method @NonNull public android.app.Notification.Action.Builder addExtras(android.os.Bundle);
+    method @NonNull public android.app.Notification.Action.Builder addRemoteInput(android.app.RemoteInput);
+    method @NonNull public android.app.Notification.Action build();
+    method @NonNull public android.app.Notification.Action.Builder extend(android.app.Notification.Action.Extender);
     method public android.os.Bundle getExtras();
-    method public android.app.Notification.Action.Builder setAllowGeneratedReplies(boolean);
-    method public android.app.Notification.Action.Builder setContextual(boolean);
-    method public android.app.Notification.Action.Builder setSemanticAction(int);
+    method @NonNull public android.app.Notification.Action.Builder setAllowGeneratedReplies(boolean);
+    method @NonNull public android.app.Notification.Action.Builder setContextual(boolean);
+    method @NonNull public android.app.Notification.Action.Builder setSemanticAction(int);
   }
 
   public static interface Notification.Action.Extender {
@@ -5480,7 +5486,7 @@
     method public boolean getSuppressInitialNotification();
     method @Deprecated public CharSequence getTitle();
     method public void writeToParcel(android.os.Parcel, int);
-    field public static final android.os.Parcelable.Creator<android.app.Notification.BubbleMetadata> CREATOR;
+    field @NonNull public static final android.os.Parcelable.Creator<android.app.Notification.BubbleMetadata> CREATOR;
   }
 
   public static class Notification.BubbleMetadata.Builder {
@@ -5499,74 +5505,75 @@
     ctor public Notification.Builder(android.content.Context, String);
     ctor @Deprecated public Notification.Builder(android.content.Context);
     method @Deprecated public android.app.Notification.Builder addAction(int, CharSequence, android.app.PendingIntent);
-    method public android.app.Notification.Builder addAction(android.app.Notification.Action);
-    method public android.app.Notification.Builder addExtras(android.os.Bundle);
+    method @NonNull public android.app.Notification.Builder addAction(android.app.Notification.Action);
+    method @NonNull public android.app.Notification.Builder addExtras(android.os.Bundle);
     method @Deprecated public android.app.Notification.Builder addPerson(String);
-    method public android.app.Notification.Builder addPerson(android.app.Person);
-    method public android.app.Notification build();
+    method @NonNull public android.app.Notification.Builder addPerson(android.app.Person);
+    method @NonNull public android.app.Notification build();
     method public android.widget.RemoteViews createBigContentView();
     method public android.widget.RemoteViews createContentView();
     method public android.widget.RemoteViews createHeadsUpContentView();
-    method public android.app.Notification.Builder extend(android.app.Notification.Extender);
+    method @NonNull public android.app.Notification.Builder extend(android.app.Notification.Extender);
     method public android.os.Bundle getExtras();
     method @Deprecated public android.app.Notification getNotification();
     method public android.app.Notification.Style getStyle();
-    method public static android.app.Notification.Builder recoverBuilder(android.content.Context, android.app.Notification);
-    method public android.app.Notification.Builder setActions(android.app.Notification.Action...);
-    method public android.app.Notification.Builder setAllowSystemGeneratedContextualActions(boolean);
-    method public android.app.Notification.Builder setAutoCancel(boolean);
-    method public android.app.Notification.Builder setBadgeIconType(int);
-    method public android.app.Notification.Builder setBubbleMetadata(android.app.Notification.BubbleMetadata);
-    method public android.app.Notification.Builder setCategory(String);
-    method public android.app.Notification.Builder setChannelId(String);
-    method public android.app.Notification.Builder setChronometerCountDown(boolean);
-    method public android.app.Notification.Builder setColor(@ColorInt int);
-    method public android.app.Notification.Builder setColorized(boolean);
+    method @NonNull public static android.app.Notification.Builder recoverBuilder(android.content.Context, android.app.Notification);
+    method @NonNull public android.app.Notification.Builder setActions(android.app.Notification.Action...);
+    method @NonNull public android.app.Notification.Builder setAllowSystemGeneratedContextualActions(boolean);
+    method @NonNull public android.app.Notification.Builder setAutoCancel(boolean);
+    method @NonNull public android.app.Notification.Builder setBadgeIconType(int);
+    method @NonNull public android.app.Notification.Builder setBubbleMetadata(android.app.Notification.BubbleMetadata);
+    method @NonNull public android.app.Notification.Builder setCategory(String);
+    method @NonNull public android.app.Notification.Builder setChannelId(String);
+    method @NonNull public android.app.Notification.Builder setChronometerCountDown(boolean);
+    method @NonNull public android.app.Notification.Builder setColor(@ColorInt int);
+    method @NonNull public android.app.Notification.Builder setColorized(boolean);
     method @Deprecated public android.app.Notification.Builder setContent(android.widget.RemoteViews);
     method @Deprecated public android.app.Notification.Builder setContentInfo(CharSequence);
-    method public android.app.Notification.Builder setContentIntent(android.app.PendingIntent);
-    method public android.app.Notification.Builder setContentText(CharSequence);
-    method public android.app.Notification.Builder setContentTitle(CharSequence);
-    method public android.app.Notification.Builder setCustomBigContentView(android.widget.RemoteViews);
-    method public android.app.Notification.Builder setCustomContentView(android.widget.RemoteViews);
-    method public android.app.Notification.Builder setCustomHeadsUpContentView(android.widget.RemoteViews);
+    method @NonNull public android.app.Notification.Builder setContentIntent(android.app.PendingIntent);
+    method @NonNull public android.app.Notification.Builder setContentText(CharSequence);
+    method @NonNull public android.app.Notification.Builder setContentTitle(CharSequence);
+    method @NonNull public android.app.Notification.Builder setCustomBigContentView(android.widget.RemoteViews);
+    method @NonNull public android.app.Notification.Builder setCustomContentView(android.widget.RemoteViews);
+    method @NonNull public android.app.Notification.Builder setCustomHeadsUpContentView(android.widget.RemoteViews);
     method @Deprecated public android.app.Notification.Builder setDefaults(int);
-    method public android.app.Notification.Builder setDeleteIntent(android.app.PendingIntent);
-    method public android.app.Notification.Builder setExtras(android.os.Bundle);
-    method public android.app.Notification.Builder setFullScreenIntent(android.app.PendingIntent, boolean);
-    method public android.app.Notification.Builder setGroup(String);
-    method public android.app.Notification.Builder setGroupAlertBehavior(int);
-    method public android.app.Notification.Builder setGroupSummary(boolean);
-    method public android.app.Notification.Builder setLargeIcon(android.graphics.Bitmap);
-    method public android.app.Notification.Builder setLargeIcon(android.graphics.drawable.Icon);
+    method @NonNull public android.app.Notification.Builder setDeleteIntent(android.app.PendingIntent);
+    method @NonNull public android.app.Notification.Builder setExtras(android.os.Bundle);
+    method @NonNull public android.app.Notification.Builder setFullScreenIntent(android.app.PendingIntent, boolean);
+    method @NonNull public android.app.Notification.Builder setGroup(String);
+    method @NonNull public android.app.Notification.Builder setGroupAlertBehavior(int);
+    method @NonNull public android.app.Notification.Builder setGroupSummary(boolean);
+    method @NonNull public android.app.Notification.Builder setLargeIcon(android.graphics.Bitmap);
+    method @NonNull public android.app.Notification.Builder setLargeIcon(android.graphics.drawable.Icon);
     method @Deprecated public android.app.Notification.Builder setLights(@ColorInt int, int, int);
-    method public android.app.Notification.Builder setLocalOnly(boolean);
-    method public android.app.Notification.Builder setNumber(int);
-    method public android.app.Notification.Builder setOngoing(boolean);
-    method public android.app.Notification.Builder setOnlyAlertOnce(boolean);
+    method @NonNull public android.app.Notification.Builder setLocalOnly(boolean);
+    method @NonNull public android.app.Notification.Builder setLocusId(@Nullable android.content.LocusId);
+    method @NonNull public android.app.Notification.Builder setNumber(int);
+    method @NonNull public android.app.Notification.Builder setOngoing(boolean);
+    method @NonNull public android.app.Notification.Builder setOnlyAlertOnce(boolean);
     method @Deprecated public android.app.Notification.Builder setPriority(int);
-    method public android.app.Notification.Builder setProgress(int, int, boolean);
-    method public android.app.Notification.Builder setPublicVersion(android.app.Notification);
-    method public android.app.Notification.Builder setRemoteInputHistory(CharSequence[]);
-    method public android.app.Notification.Builder setSettingsText(CharSequence);
-    method public android.app.Notification.Builder setShortcutId(String);
-    method public android.app.Notification.Builder setShowWhen(boolean);
-    method public android.app.Notification.Builder setSmallIcon(@DrawableRes int);
-    method public android.app.Notification.Builder setSmallIcon(@DrawableRes int, int);
-    method public android.app.Notification.Builder setSmallIcon(android.graphics.drawable.Icon);
-    method public android.app.Notification.Builder setSortKey(String);
+    method @NonNull public android.app.Notification.Builder setProgress(int, int, boolean);
+    method @NonNull public android.app.Notification.Builder setPublicVersion(android.app.Notification);
+    method @NonNull public android.app.Notification.Builder setRemoteInputHistory(CharSequence[]);
+    method @NonNull public android.app.Notification.Builder setSettingsText(CharSequence);
+    method @NonNull public android.app.Notification.Builder setShortcutId(String);
+    method @NonNull public android.app.Notification.Builder setShowWhen(boolean);
+    method @NonNull public android.app.Notification.Builder setSmallIcon(@DrawableRes int);
+    method @NonNull public android.app.Notification.Builder setSmallIcon(@DrawableRes int, int);
+    method @NonNull public android.app.Notification.Builder setSmallIcon(android.graphics.drawable.Icon);
+    method @NonNull public android.app.Notification.Builder setSortKey(String);
     method @Deprecated public android.app.Notification.Builder setSound(android.net.Uri);
     method @Deprecated public android.app.Notification.Builder setSound(android.net.Uri, int);
     method @Deprecated public android.app.Notification.Builder setSound(android.net.Uri, android.media.AudioAttributes);
-    method public android.app.Notification.Builder setStyle(android.app.Notification.Style);
-    method public android.app.Notification.Builder setSubText(CharSequence);
-    method public android.app.Notification.Builder setTicker(CharSequence);
+    method @NonNull public android.app.Notification.Builder setStyle(android.app.Notification.Style);
+    method @NonNull public android.app.Notification.Builder setSubText(CharSequence);
+    method @NonNull public android.app.Notification.Builder setTicker(CharSequence);
     method @Deprecated public android.app.Notification.Builder setTicker(CharSequence, android.widget.RemoteViews);
-    method public android.app.Notification.Builder setTimeoutAfter(long);
-    method public android.app.Notification.Builder setUsesChronometer(boolean);
+    method @NonNull public android.app.Notification.Builder setTimeoutAfter(long);
+    method @NonNull public android.app.Notification.Builder setUsesChronometer(boolean);
     method @Deprecated public android.app.Notification.Builder setVibrate(long[]);
-    method public android.app.Notification.Builder setVisibility(int);
-    method public android.app.Notification.Builder setWhen(long);
+    method @NonNull public android.app.Notification.Builder setVisibility(int);
+    method @NonNull public android.app.Notification.Builder setWhen(long);
   }
 
   public static final class Notification.CarExtender implements android.app.Notification.Extender {
@@ -5762,7 +5769,7 @@
     method public boolean shouldShowLights();
     method public boolean shouldVibrate();
     method public void writeToParcel(android.os.Parcel, int);
-    field public static final android.os.Parcelable.Creator<android.app.NotificationChannel> CREATOR;
+    field @NonNull public static final android.os.Parcelable.Creator<android.app.NotificationChannel> CREATOR;
     field public static final String DEFAULT_CHANNEL_ID = "miscellaneous";
   }
 
@@ -5777,7 +5784,7 @@
     method public boolean isBlocked();
     method public void setDescription(String);
     method public void writeToParcel(android.os.Parcel, int);
-    field public static final android.os.Parcelable.Creator<android.app.NotificationChannelGroup> CREATOR;
+    field @NonNull public static final android.os.Parcelable.Creator<android.app.NotificationChannelGroup> CREATOR;
   }
 
   public class NotificationManager {
@@ -5785,7 +5792,7 @@
     method public boolean areBubblesAllowed();
     method public boolean areNotificationsEnabled();
     method public boolean areNotificationsPaused();
-    method public boolean canNotifyAsPackage(String);
+    method public boolean canNotifyAsPackage(@NonNull String);
     method public void cancel(int);
     method public void cancel(String, int);
     method public void cancelAll();
@@ -5806,17 +5813,15 @@
     method public java.util.List<android.app.NotificationChannel> getNotificationChannels();
     method @Nullable public String getNotificationDelegate();
     method public android.app.NotificationManager.Policy getNotificationPolicy();
-    method public boolean isNotificationAssistantAccessGranted(android.content.ComponentName);
     method public boolean isNotificationListenerAccessGranted(android.content.ComponentName);
     method public boolean isNotificationPolicyAccessGranted();
     method public void notify(int, android.app.Notification);
     method public void notify(String, int, android.app.Notification);
-    method public void notifyAsPackage(@NonNull String, @NonNull String, int, android.app.Notification);
+    method public void notifyAsPackage(@NonNull String, @NonNull String, int, @NonNull android.app.Notification);
     method public boolean removeAutomaticZenRule(String);
-    method public void revokeNotificationDelegate();
-    method public void setAutomaticZenRuleState(String, android.service.notification.Condition);
+    method public void setAutomaticZenRuleState(@NonNull String, @NonNull android.service.notification.Condition);
     method public final void setInterruptionFilter(int);
-    method public void setNotificationDelegate(@NonNull String);
+    method public void setNotificationDelegate(@Nullable String);
     method public void setNotificationPolicy(@NonNull android.app.NotificationManager.Policy);
     method public boolean shouldHideSilentStatusBarIcons();
     method public boolean updateAutomaticZenRule(String, android.app.AutomaticZenRule);
@@ -5855,7 +5860,7 @@
     method public static String prioritySendersToString(int);
     method public static String suppressedEffectsToString(int);
     method public void writeToParcel(android.os.Parcel, int);
-    field public static final android.os.Parcelable.Creator<android.app.NotificationManager.Policy> CREATOR;
+    field @NonNull public static final android.os.Parcelable.Creator<android.app.NotificationManager.Policy> CREATOR;
     field public static final int PRIORITY_CATEGORY_ALARMS = 32; // 0x20
     field public static final int PRIORITY_CATEGORY_CALLS = 8; // 0x8
     field public static final int PRIORITY_CATEGORY_EVENTS = 2; // 0x2
@@ -5907,7 +5912,7 @@
     method public void send(android.content.Context, int, @Nullable android.content.Intent, @Nullable android.app.PendingIntent.OnFinished, @Nullable android.os.Handler, @Nullable String, @Nullable android.os.Bundle) throws android.app.PendingIntent.CanceledException;
     method public static void writePendingIntentOrNullToParcel(@Nullable android.app.PendingIntent, @NonNull android.os.Parcel);
     method public void writeToParcel(android.os.Parcel, int);
-    field public static final android.os.Parcelable.Creator<android.app.PendingIntent> CREATOR;
+    field @NonNull public static final android.os.Parcelable.Creator<android.app.PendingIntent> CREATOR;
     field public static final int FLAG_CANCEL_CURRENT = 268435456; // 0x10000000
     field public static final int FLAG_IMMUTABLE = 67108864; // 0x4000000
     field public static final int FLAG_NO_CREATE = 536870912; // 0x20000000
@@ -5935,7 +5940,7 @@
     method public boolean isImportant();
     method public android.app.Person.Builder toBuilder();
     method public void writeToParcel(android.os.Parcel, int);
-    field public static final android.os.Parcelable.Creator<android.app.Person> CREATOR;
+    field @NonNull public static final android.os.Parcelable.Creator<android.app.Person> CREATOR;
   }
 
   public static class Person.Builder {
@@ -5952,7 +5957,7 @@
   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 @NonNull public static final android.os.Parcelable.Creator<android.app.PictureInPictureParams> CREATOR;
   }
 
   public static class PictureInPictureParams.Builder {
@@ -6005,7 +6010,7 @@
     method @NonNull public android.app.RemoteAction getUserAction();
     method @NonNull public CharSequence getUserMessage();
     method public void writeToParcel(android.os.Parcel, int);
-    field public static final android.os.Parcelable.Creator<android.app.RecoverableSecurityException> CREATOR;
+    field @NonNull public static final android.os.Parcelable.Creator<android.app.RecoverableSecurityException> CREATOR;
   }
 
   public final class RemoteAction implements android.os.Parcelable {
@@ -6022,7 +6027,7 @@
     method public void setShouldShowIcon(boolean);
     method public boolean shouldShowIcon();
     method public void writeToParcel(android.os.Parcel, int);
-    field public static final android.os.Parcelable.Creator<android.app.RemoteAction> CREATOR;
+    field @NonNull public static final android.os.Parcelable.Creator<android.app.RemoteAction> CREATOR;
   }
 
   public final class RemoteInput implements android.os.Parcelable {
@@ -6042,7 +6047,7 @@
     method public boolean isDataOnly();
     method public static void setResultsSource(android.content.Intent, int);
     method public void writeToParcel(android.os.Parcel, int);
-    field public static final android.os.Parcelable.Creator<android.app.RemoteInput> CREATOR;
+    field @NonNull public static final android.os.Parcelable.Creator<android.app.RemoteInput> CREATOR;
     field public static final int EDIT_CHOICES_BEFORE_SENDING_AUTO = 0; // 0x0
     field public static final int EDIT_CHOICES_BEFORE_SENDING_DISABLED = 1; // 0x1
     field public static final int EDIT_CHOICES_BEFORE_SENDING_ENABLED = 2; // 0x2
@@ -6164,13 +6169,14 @@
     method public boolean shouldRewriteQueryFromData();
     method public boolean shouldRewriteQueryFromText();
     method public void writeToParcel(android.os.Parcel, int);
-    field public static final android.os.Parcelable.Creator<android.app.SearchableInfo> CREATOR;
+    field @NonNull public static final android.os.Parcelable.Creator<android.app.SearchableInfo> CREATOR;
   }
 
   public abstract class Service extends android.content.ContextWrapper implements android.content.ComponentCallbacks2 {
     ctor public Service();
     method protected void dump(java.io.FileDescriptor, java.io.PrintWriter, String[]);
     method public final android.app.Application getApplication();
+    method public final int getForegroundServiceType();
     method @Nullable public abstract android.os.IBinder onBind(android.content.Intent);
     method public void onConfigurationChanged(android.content.res.Configuration);
     method public void onCreate();
@@ -6370,7 +6376,7 @@
     method public CharSequence getSynonymAt(int);
     method public void setExtras(android.os.Bundle);
     method public void writeToParcel(android.os.Parcel, int);
-    field public static final android.os.Parcelable.Creator<android.app.VoiceInteractor.PickOptionRequest.Option> CREATOR;
+    field @NonNull public static final android.os.Parcelable.Creator<android.app.VoiceInteractor.PickOptionRequest.Option> CREATOR;
   }
 
   public static class VoiceInteractor.Prompt implements android.os.Parcelable {
@@ -6381,7 +6387,7 @@
     method @NonNull public CharSequence getVisualPrompt();
     method @NonNull public CharSequence getVoicePromptAt(int);
     method public void writeToParcel(android.os.Parcel, int);
-    field public static final android.os.Parcelable.Creator<android.app.VoiceInteractor.Prompt> CREATOR;
+    field @NonNull public static final android.os.Parcelable.Creator<android.app.VoiceInteractor.Prompt> CREATOR;
   }
 
   public abstract static class VoiceInteractor.Request {
@@ -6404,7 +6410,7 @@
     method @Nullable public android.graphics.Color getSecondaryColor();
     method @Nullable public android.graphics.Color getTertiaryColor();
     method public void writeToParcel(android.os.Parcel, int);
-    field public static final android.os.Parcelable.Creator<android.app.WallpaperColors> CREATOR;
+    field @NonNull public static final android.os.Parcelable.Creator<android.app.WallpaperColors> CREATOR;
   }
 
   public final class WallpaperInfo implements android.os.Parcelable {
@@ -6416,7 +6422,7 @@
     method public android.content.pm.ServiceInfo getServiceInfo();
     method public String getServiceName();
     method public String getSettingsActivity();
-    method public android.net.Uri getSettingsSliceUri();
+    method @Nullable public android.net.Uri getSettingsSliceUri();
     method public boolean getShowMetadataInPreview();
     method public CharSequence loadAuthor(android.content.pm.PackageManager) throws android.content.res.Resources.NotFoundException;
     method public CharSequence loadContextDescription(android.content.pm.PackageManager) throws android.content.res.Resources.NotFoundException;
@@ -6427,7 +6433,7 @@
     method public android.graphics.drawable.Drawable loadThumbnail(android.content.pm.PackageManager);
     method public boolean supportsMultipleDisplays();
     method public void writeToParcel(android.os.Parcel, int);
-    field public static final android.os.Parcelable.Creator<android.app.WallpaperInfo> CREATOR;
+    field @NonNull public static final android.os.Parcelable.Creator<android.app.WallpaperInfo> CREATOR;
   }
 
   public class WallpaperManager {
@@ -6487,7 +6493,7 @@
   }
 
   public interface ZygotePreload {
-    method public void doPreload(android.content.pm.ApplicationInfo);
+    method public void doPreload(@NonNull android.content.pm.ApplicationInfo);
   }
 
 }
@@ -6498,7 +6504,7 @@
     method public java.net.InetAddress getInetAddress();
     method public int getPort();
     method public void writeToParcel(android.os.Parcel, int);
-    field public static final android.os.Parcelable.Creator<android.app.admin.ConnectEvent> CREATOR;
+    field @NonNull public static final android.os.Parcelable.Creator<android.app.admin.ConnectEvent> CREATOR;
   }
 
   public class DelegatedAdminReceiver extends android.content.BroadcastReceiver {
@@ -6524,7 +6530,7 @@
     method public boolean supportsTransferOwnership();
     method public boolean usesPolicy(int);
     method public void writeToParcel(android.os.Parcel, int);
-    field public static final android.os.Parcelable.Creator<android.app.admin.DeviceAdminInfo> CREATOR;
+    field @NonNull public static final android.os.Parcelable.Creator<android.app.admin.DeviceAdminInfo> CREATOR;
     field public static final int USES_ENCRYPTED_STORAGE = 7; // 0x7
     field public static final int USES_POLICY_DISABLE_CAMERA = 8; // 0x8
     field public static final int USES_POLICY_DISABLE_KEYGUARD_FEATURES = 9; // 0x9
@@ -6746,7 +6752,8 @@
     method public void setDelegatedScopes(@NonNull android.content.ComponentName, @NonNull String, @NonNull java.util.List<java.lang.String>);
     method public void setDeviceOwnerLockScreenInfo(@NonNull android.content.ComponentName, CharSequence);
     method public void setEndUserSessionMessage(@NonNull android.content.ComponentName, @Nullable CharSequence);
-    method public int setGlobalPrivateDns(@NonNull android.content.ComponentName, int, @Nullable String);
+    method public int setGlobalPrivateDnsModeOpportunistic(@NonNull android.content.ComponentName);
+    method @WorkerThread public int setGlobalPrivateDnsModeSpecifiedHost(@NonNull android.content.ComponentName, @NonNull String);
     method public void setGlobalSetting(@NonNull android.content.ComponentName, String, String);
     method public void setKeepUninstalledPackages(@Nullable android.content.ComponentName, @NonNull java.util.List<java.lang.String>);
     method public boolean setKeyPairCertificate(@Nullable android.content.ComponentName, @NonNull String, @NonNull java.util.List<java.security.cert.Certificate>, boolean);
@@ -6974,7 +6981,7 @@
     method public java.util.List<java.net.InetAddress> getInetAddresses();
     method public int getTotalResolvedAddressCount();
     method public void writeToParcel(android.os.Parcel, int);
-    field public static final android.os.Parcelable.Creator<android.app.admin.DnsEvent> CREATOR;
+    field @NonNull public static final android.os.Parcelable.Creator<android.app.admin.DnsEvent> CREATOR;
   }
 
   public class FreezePeriod {
@@ -6988,7 +6995,7 @@
     method public long getId();
     method public String getPackageName();
     method public long getTimestamp();
-    field public static final android.os.Parcelable.Creator<android.app.admin.NetworkEvent> CREATOR;
+    field @NonNull public static final android.os.Parcelable.Creator<android.app.admin.NetworkEvent> CREATOR;
   }
 
   public class SecurityLog {
@@ -7039,7 +7046,7 @@
     method public int getTag();
     method public long getTimeNanos();
     method public void writeToParcel(android.os.Parcel, int);
-    field public static final android.os.Parcelable.Creator<android.app.admin.SecurityLog.SecurityEvent> CREATOR;
+    field @NonNull public static final android.os.Parcelable.Creator<android.app.admin.SecurityLog.SecurityEvent> CREATOR;
   }
 
   public final class SystemUpdateInfo implements android.os.Parcelable {
@@ -7047,7 +7054,7 @@
     method public long getReceivedTime();
     method public int getSecurityPatchState();
     method public void writeToParcel(android.os.Parcel, int);
-    field public static final android.os.Parcelable.Creator<android.app.admin.SystemUpdateInfo> CREATOR;
+    field @NonNull public static final android.os.Parcelable.Creator<android.app.admin.SystemUpdateInfo> CREATOR;
     field public static final int SECURITY_PATCH_STATE_FALSE = 1; // 0x1
     field public static final int SECURITY_PATCH_STATE_TRUE = 2; // 0x2
     field public static final int SECURITY_PATCH_STATE_UNKNOWN = 0; // 0x0
@@ -7064,7 +7071,7 @@
     method public int getPolicyType();
     method public android.app.admin.SystemUpdatePolicy setFreezePeriods(java.util.List<android.app.admin.FreezePeriod>);
     method public void writeToParcel(android.os.Parcel, int);
-    field public static final android.os.Parcelable.Creator<android.app.admin.SystemUpdatePolicy> CREATOR;
+    field @NonNull public static final android.os.Parcelable.Creator<android.app.admin.SystemUpdatePolicy> CREATOR;
     field public static final int TYPE_INSTALL_AUTOMATIC = 1; // 0x1
     field public static final int TYPE_INSTALL_WINDOWED = 2; // 0x2
     field public static final int TYPE_POSTPONE = 3; // 0x3
@@ -7074,7 +7081,7 @@
     method public int describeContents();
     method public int getErrorCode();
     method public void writeToParcel(android.os.Parcel, int);
-    field public static final android.os.Parcelable.Creator<android.app.admin.SystemUpdatePolicy.ValidationFailedException> CREATOR;
+    field @NonNull public static final android.os.Parcelable.Creator<android.app.admin.SystemUpdatePolicy.ValidationFailedException> CREATOR;
     field public static final int ERROR_COMBINED_FREEZE_PERIOD_TOO_CLOSE = 6; // 0x6
     field public static final int ERROR_COMBINED_FREEZE_PERIOD_TOO_LONG = 5; // 0x5
     field public static final int ERROR_DUPLICATE_OR_OVERLAP = 2; // 0x2
@@ -7102,7 +7109,7 @@
     method public void setStructuredData(String);
     method public void setWebUri(android.net.Uri);
     method public void writeToParcel(android.os.Parcel, int);
-    field public static final android.os.Parcelable.Creator<android.app.assist.AssistContent> CREATOR;
+    field @NonNull public static final android.os.Parcelable.Creator<android.app.assist.AssistContent> CREATOR;
   }
 
   public class AssistStructure implements android.os.Parcelable {
@@ -7115,7 +7122,7 @@
     method public int getWindowNodeCount();
     method public boolean isHomeActivity();
     method public void writeToParcel(android.os.Parcel, int);
-    field public static final android.os.Parcelable.Creator<android.app.assist.AssistStructure> CREATOR;
+    field @NonNull public static final android.os.Parcelable.Creator<android.app.assist.AssistStructure> CREATOR;
   }
 
   public static class AssistStructure.ViewNode {
@@ -7321,7 +7328,7 @@
     method public void writeToParcel(android.os.Parcel, int);
     field public static final int BACKOFF_POLICY_EXPONENTIAL = 1; // 0x1
     field public static final int BACKOFF_POLICY_LINEAR = 0; // 0x0
-    field public static final android.os.Parcelable.Creator<android.app.job.JobInfo> CREATOR;
+    field @NonNull public static final android.os.Parcelable.Creator<android.app.job.JobInfo> CREATOR;
     field public static final long DEFAULT_INITIAL_BACKOFF_MILLIS = 30000L; // 0x7530L
     field public static final long MAX_BACKOFF_DELAY_MILLIS = 18000000L; // 0x112a880L
     field public static final int NETWORK_BYTES_UNKNOWN = -1; // 0xffffffff
@@ -7365,7 +7372,7 @@
     method public int getFlags();
     method public android.net.Uri getUri();
     method public void writeToParcel(android.os.Parcel, int);
-    field public static final android.os.Parcelable.Creator<android.app.job.JobInfo.TriggerContentUri> CREATOR;
+    field @NonNull public static final android.os.Parcelable.Creator<android.app.job.JobInfo.TriggerContentUri> CREATOR;
     field public static final int FLAG_NOTIFY_FOR_DESCENDANTS = 1; // 0x1
   }
 
@@ -7383,7 +7390,7 @@
     method @Nullable public android.net.Uri[] getTriggeredContentUris();
     method public boolean isOverrideDeadlineExpired();
     method public void writeToParcel(android.os.Parcel, int);
-    field public static final android.os.Parcelable.Creator<android.app.job.JobParameters> CREATOR;
+    field @NonNull public static final android.os.Parcelable.Creator<android.app.job.JobParameters> CREATOR;
   }
 
   public abstract class JobScheduler {
@@ -7424,7 +7431,7 @@
     method public long getEstimatedNetworkUploadBytes();
     method public android.content.Intent getIntent();
     method public void writeToParcel(android.os.Parcel, int);
-    field public static final android.os.Parcelable.Creator<android.app.job.JobWorkItem> CREATOR;
+    field @NonNull public static final android.os.Parcelable.Creator<android.app.job.JobWorkItem> CREATOR;
   }
 
 }
@@ -7460,7 +7467,7 @@
     method public android.net.Uri getUri();
     method public boolean isCallerNeeded();
     method public void writeToParcel(android.os.Parcel, int);
-    field public static final android.os.Parcelable.Creator<android.app.slice.Slice> CREATOR;
+    field @NonNull public static final android.os.Parcelable.Creator<android.app.slice.Slice> CREATOR;
     field public static final String EXTRA_RANGE_VALUE = "android.app.slice.extra.RANGE_VALUE";
     field public static final String EXTRA_TOGGLE_STATE = "android.app.slice.extra.TOGGLE_STATE";
     field public static final String HINT_ACTIONS = "actions";
@@ -7524,7 +7531,7 @@
     method public CharSequence getText();
     method public boolean hasHint(String);
     method public void writeToParcel(android.os.Parcel, int);
-    field public static final android.os.Parcelable.Creator<android.app.slice.SliceItem> CREATOR;
+    field @NonNull public static final android.os.Parcelable.Creator<android.app.slice.SliceItem> CREATOR;
     field public static final String FORMAT_ACTION = "action";
     field public static final String FORMAT_BUNDLE = "bundle";
     field public static final String FORMAT_IMAGE = "image";
@@ -7584,7 +7591,7 @@
     method public int getRevision();
     method public String getType();
     method public void writeToParcel(android.os.Parcel, int);
-    field public static final android.os.Parcelable.Creator<android.app.slice.SliceSpec> CREATOR;
+    field @NonNull public static final android.os.Parcelable.Creator<android.app.slice.SliceSpec> CREATOR;
   }
 
 }
@@ -7601,7 +7608,7 @@
     method public long getLastTimeStamp();
     method public long getTotalTimeActive();
     method public void writeToParcel(android.os.Parcel, int);
-    field public static final android.os.Parcelable.Creator<android.app.usage.ConfigurationStats> CREATOR;
+    field @NonNull public static final android.os.Parcelable.Creator<android.app.usage.ConfigurationStats> CREATOR;
   }
 
   public final class EventStats implements android.os.Parcelable {
@@ -7615,7 +7622,7 @@
     method public long getLastTimeStamp();
     method public long getTotalTime();
     method public void writeToParcel(android.os.Parcel, int);
-    field public static final android.os.Parcelable.Creator<android.app.usage.EventStats> CREATOR;
+    field @NonNull public static final android.os.Parcelable.Creator<android.app.usage.EventStats> CREATOR;
   }
 
   public final class ExternalStorageStats implements android.os.Parcelable {
@@ -7626,7 +7633,7 @@
     method public long getTotalBytes();
     method public long getVideoBytes();
     method public void writeToParcel(android.os.Parcel, int);
-    field public static final android.os.Parcelable.Creator<android.app.usage.ExternalStorageStats> CREATOR;
+    field @NonNull public static final android.os.Parcelable.Creator<android.app.usage.ExternalStorageStats> CREATOR;
   }
 
   public final class NetworkStats implements java.lang.AutoCloseable {
@@ -7691,7 +7698,7 @@
     method public long getCacheBytes();
     method public long getDataBytes();
     method public void writeToParcel(android.os.Parcel, int);
-    field public static final android.os.Parcelable.Creator<android.app.usage.StorageStats> CREATOR;
+    field @NonNull public static final android.os.Parcelable.Creator<android.app.usage.StorageStats> CREATOR;
   }
 
   public class StorageStatsManager {
@@ -7708,7 +7715,7 @@
     method public boolean getNextEvent(android.app.usage.UsageEvents.Event);
     method public boolean hasNextEvent();
     method public void writeToParcel(android.os.Parcel, int);
-    field public static final android.os.Parcelable.Creator<android.app.usage.UsageEvents> CREATOR;
+    field @NonNull public static final android.os.Parcelable.Creator<android.app.usage.UsageEvents> CREATOR;
   }
 
   public static final class UsageEvents.Event {
@@ -7725,6 +7732,7 @@
     field public static final int ACTIVITY_STOPPED = 23; // 0x17
     field public static final int CONFIGURATION_CHANGE = 5; // 0x5
     field public static final int DEVICE_SHUTDOWN = 26; // 0x1a
+    field public static final int DEVICE_STARTUP = 27; // 0x1b
     field public static final int FOREGROUND_SERVICE_START = 19; // 0x13
     field public static final int FOREGROUND_SERVICE_STOP = 20; // 0x14
     field public static final int KEYGUARD_HIDDEN = 18; // 0x12
@@ -7753,7 +7761,7 @@
     method public long getTotalTimeInForeground();
     method public long getTotalTimeVisible();
     method public void writeToParcel(android.os.Parcel, int);
-    field public static final android.os.Parcelable.Creator<android.app.usage.UsageStats> CREATOR;
+    field @NonNull public static final android.os.Parcelable.Creator<android.app.usage.UsageStats> CREATOR;
   }
 
   public final class UsageStatsManager {
@@ -7886,7 +7894,7 @@
     method public final String loadLabel(android.content.pm.PackageManager);
     method public final android.graphics.drawable.Drawable loadPreviewImage(@NonNull android.content.Context, int);
     method public void writeToParcel(android.os.Parcel, int);
-    field public static final android.os.Parcelable.Creator<android.appwidget.AppWidgetProviderInfo> CREATOR;
+    field @NonNull public static final android.os.Parcelable.Creator<android.appwidget.AppWidgetProviderInfo> CREATOR;
     field public static final int RESIZE_BOTH = 3; // 0x3
     field public static final int RESIZE_HORIZONTAL = 1; // 0x1
     field public static final int RESIZE_NONE = 0; // 0x0
@@ -8237,7 +8245,7 @@
     method public int getMajorDeviceClass();
     method public boolean hasService(int);
     method public void writeToParcel(android.os.Parcel, int);
-    field public static final android.os.Parcelable.Creator<android.bluetooth.BluetoothClass> CREATOR;
+    field @NonNull public static final android.os.Parcelable.Creator<android.bluetooth.BluetoothClass> CREATOR;
   }
 
   public static class BluetoothClass.Device {
@@ -8355,7 +8363,7 @@
     field public static final int BOND_BONDED = 12; // 0xc
     field public static final int BOND_BONDING = 11; // 0xb
     field public static final int BOND_NONE = 10; // 0xa
-    field public static final android.os.Parcelable.Creator<android.bluetooth.BluetoothDevice> CREATOR;
+    field @NonNull public static final android.os.Parcelable.Creator<android.bluetooth.BluetoothDevice> CREATOR;
     field public static final int DEVICE_TYPE_CLASSIC = 1; // 0x1
     field public static final int DEVICE_TYPE_DUAL = 3; // 0x3
     field public static final int DEVICE_TYPE_LE = 2; // 0x2
@@ -8464,7 +8472,7 @@
     method public boolean setValue(String);
     method public void setWriteType(int);
     method public void writeToParcel(android.os.Parcel, int);
-    field public static final android.os.Parcelable.Creator<android.bluetooth.BluetoothGattCharacteristic> CREATOR;
+    field @NonNull public static final android.os.Parcelable.Creator<android.bluetooth.BluetoothGattCharacteristic> CREATOR;
     field public static final int FORMAT_FLOAT = 52; // 0x34
     field public static final int FORMAT_SFLOAT = 50; // 0x32
     field public static final int FORMAT_SINT16 = 34; // 0x22
@@ -8504,7 +8512,7 @@
     method public byte[] getValue();
     method public boolean setValue(byte[]);
     method public void writeToParcel(android.os.Parcel, int);
-    field public static final android.os.Parcelable.Creator<android.bluetooth.BluetoothGattDescriptor> CREATOR;
+    field @NonNull public static final android.os.Parcelable.Creator<android.bluetooth.BluetoothGattDescriptor> CREATOR;
     field public static final byte[] DISABLE_NOTIFICATION_VALUE;
     field public static final byte[] ENABLE_INDICATION_VALUE;
     field public static final byte[] ENABLE_NOTIFICATION_VALUE;
@@ -8563,7 +8571,7 @@
     method public int getType();
     method public java.util.UUID getUuid();
     method public void writeToParcel(android.os.Parcel, int);
-    field public static final android.os.Parcelable.Creator<android.bluetooth.BluetoothGattService> CREATOR;
+    field @NonNull public static final android.os.Parcelable.Creator<android.bluetooth.BluetoothGattService> CREATOR;
     field public static final int SERVICE_TYPE_PRIMARY = 0; // 0x0
     field public static final int SERVICE_TYPE_SECONDARY = 1; // 0x1
     field protected java.util.List<android.bluetooth.BluetoothGattCharacteristic> mCharacteristics;
@@ -8627,7 +8635,7 @@
     method @Deprecated public String getName();
     method @Deprecated public int getRole();
     method @Deprecated public void writeToParcel(android.os.Parcel, int);
-    field @Deprecated public static final android.os.Parcelable.Creator<android.bluetooth.BluetoothHealthAppConfiguration> CREATOR;
+    field @Deprecated @NonNull public static final android.os.Parcelable.Creator<android.bluetooth.BluetoothHealthAppConfiguration> CREATOR;
   }
 
   @Deprecated public abstract class BluetoothHealthCallback {
@@ -8637,9 +8645,9 @@
   }
 
   public final class BluetoothHearingAid implements android.bluetooth.BluetoothProfile {
-    method public java.util.List<android.bluetooth.BluetoothDevice> getConnectedDevices();
-    method public int getConnectionState(android.bluetooth.BluetoothDevice);
-    method public java.util.List<android.bluetooth.BluetoothDevice> getDevicesMatchingConnectionStates(int[]);
+    method @NonNull public java.util.List<android.bluetooth.BluetoothDevice> getConnectedDevices();
+    method public int getConnectionState(@NonNull android.bluetooth.BluetoothDevice);
+    method @NonNull public java.util.List<android.bluetooth.BluetoothDevice> getDevicesMatchingConnectionStates(@NonNull int[]);
     field public static final String ACTION_CONNECTION_STATE_CHANGED = "android.bluetooth.hearingaid.profile.action.CONNECTION_STATE_CHANGED";
   }
 
@@ -8700,7 +8708,7 @@
     method public int getTokenBucketSize();
     method public int getTokenRate();
     method public void writeToParcel(android.os.Parcel, int);
-    field public static final android.os.Parcelable.Creator<android.bluetooth.BluetoothHidDeviceAppQosSettings> CREATOR;
+    field @NonNull public static final android.os.Parcelable.Creator<android.bluetooth.BluetoothHidDeviceAppQosSettings> CREATOR;
     field public static final int MAX = -1; // 0xffffffff
     field public static final int SERVICE_BEST_EFFORT = 1; // 0x1
     field public static final int SERVICE_GUARANTEED = 2; // 0x2
@@ -8716,7 +8724,7 @@
     method public String getProvider();
     method public byte getSubclass();
     method public void writeToParcel(android.os.Parcel, int);
-    field public static final android.os.Parcelable.Creator<android.bluetooth.BluetoothHidDeviceAppSdpSettings> CREATOR;
+    field @NonNull public static final android.os.Parcelable.Creator<android.bluetooth.BluetoothHidDeviceAppSdpSettings> CREATOR;
   }
 
   public final class BluetoothManager {
@@ -8797,7 +8805,7 @@
     method public java.util.Map<android.os.ParcelUuid,byte[]> getServiceData();
     method public java.util.List<android.os.ParcelUuid> getServiceUuids();
     method public void writeToParcel(android.os.Parcel, int);
-    field public static final android.os.Parcelable.Creator<android.bluetooth.le.AdvertiseData> CREATOR;
+    field @NonNull public static final android.os.Parcelable.Creator<android.bluetooth.le.AdvertiseData> CREATOR;
   }
 
   public static final class AdvertiseData.Builder {
@@ -8824,7 +8832,7 @@
     field public static final int ADVERTISE_TX_POWER_LOW = 1; // 0x1
     field public static final int ADVERTISE_TX_POWER_MEDIUM = 2; // 0x2
     field public static final int ADVERTISE_TX_POWER_ULTRA_LOW = 0; // 0x0
-    field public static final android.os.Parcelable.Creator<android.bluetooth.le.AdvertiseSettings> CREATOR;
+    field @NonNull public static final android.os.Parcelable.Creator<android.bluetooth.le.AdvertiseSettings> CREATOR;
   }
 
   public static final class AdvertiseSettings.Builder {
@@ -8877,7 +8885,7 @@
     method public boolean isLegacy();
     method public boolean isScannable();
     method public void writeToParcel(android.os.Parcel, int);
-    field public static final android.os.Parcelable.Creator<android.bluetooth.le.AdvertisingSetParameters> CREATOR;
+    field @NonNull public static final android.os.Parcelable.Creator<android.bluetooth.le.AdvertisingSetParameters> CREATOR;
     field public static final int INTERVAL_HIGH = 1600; // 0x640
     field public static final int INTERVAL_LOW = 160; // 0xa0
     field public static final int INTERVAL_MAX = 16777215; // 0xffffff
@@ -8970,7 +8978,7 @@
     method @Nullable public android.os.ParcelUuid getServiceUuidMask();
     method public boolean matches(android.bluetooth.le.ScanResult);
     method public void writeToParcel(android.os.Parcel, int);
-    field public static final android.os.Parcelable.Creator<android.bluetooth.le.ScanFilter> CREATOR;
+    field @NonNull public static final android.os.Parcelable.Creator<android.bluetooth.le.ScanFilter> CREATOR;
   }
 
   public static final class ScanFilter.Builder {
@@ -9018,7 +9026,7 @@
     method public boolean isConnectable();
     method public boolean isLegacy();
     method public void writeToParcel(android.os.Parcel, int);
-    field public static final android.os.Parcelable.Creator<android.bluetooth.le.ScanResult> CREATOR;
+    field @NonNull public static final android.os.Parcelable.Creator<android.bluetooth.le.ScanResult> CREATOR;
     field public static final int DATA_COMPLETE = 0; // 0x0
     field public static final int DATA_TRUNCATED = 2; // 0x2
     field public static final int PERIODIC_INTERVAL_NOT_PRESENT = 0; // 0x0
@@ -9039,7 +9047,7 @@
     field public static final int CALLBACK_TYPE_ALL_MATCHES = 1; // 0x1
     field public static final int CALLBACK_TYPE_FIRST_MATCH = 2; // 0x2
     field public static final int CALLBACK_TYPE_MATCH_LOST = 4; // 0x4
-    field public static final android.os.Parcelable.Creator<android.bluetooth.le.ScanSettings> CREATOR;
+    field @NonNull public static final android.os.Parcelable.Creator<android.bluetooth.le.ScanSettings> CREATOR;
     field public static final int MATCH_MODE_AGGRESSIVE = 1; // 0x1
     field public static final int MATCH_MODE_STICKY = 2; // 0x2
     field public static final int MATCH_NUM_FEW_ADVERTISEMENT = 2; // 0x2
@@ -9071,7 +9079,7 @@
   public final class AssociationRequest 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.companion.AssociationRequest> CREATOR;
+    field @NonNull public static final android.os.Parcelable.Creator<android.companion.AssociationRequest> CREATOR;
   }
 
   public static final class AssociationRequest.Builder {
@@ -9084,7 +9092,7 @@
   public final class BluetoothDeviceFilter implements android.companion.DeviceFilter<android.bluetooth.BluetoothDevice> {
     method public int describeContents();
     method public void writeToParcel(android.os.Parcel, int);
-    field public static final android.os.Parcelable.Creator<android.companion.BluetoothDeviceFilter> CREATOR;
+    field @NonNull public static final android.os.Parcelable.Creator<android.companion.BluetoothDeviceFilter> CREATOR;
   }
 
   public static final class BluetoothDeviceFilter.Builder {
@@ -9099,7 +9107,7 @@
     method public int describeContents();
     method public static int getRenamePrefixLengthLimit();
     method public void writeToParcel(android.os.Parcel, int);
-    field public static final android.os.Parcelable.Creator<android.companion.BluetoothLeDeviceFilter> CREATOR;
+    field @NonNull public static final android.os.Parcelable.Creator<android.companion.BluetoothLeDeviceFilter> CREATOR;
   }
 
   public static final class BluetoothLeDeviceFilter.Builder {
@@ -9133,7 +9141,7 @@
   public final class WifiDeviceFilter implements android.companion.DeviceFilter<android.net.wifi.ScanResult> {
     method public int describeContents();
     method public void writeToParcel(android.os.Parcel, int);
-    field public static final android.os.Parcelable.Creator<android.companion.WifiDeviceFilter> CREATOR;
+    field @NonNull public static final android.os.Parcelable.Creator<android.companion.WifiDeviceFilter> CREATOR;
   }
 
   public static final class WifiDeviceFilter.Builder {
@@ -9257,7 +9265,7 @@
     method public static android.content.ClipData newRawUri(CharSequence, android.net.Uri);
     method public static android.content.ClipData newUri(android.content.ContentResolver, CharSequence, android.net.Uri);
     method public void writeToParcel(android.os.Parcel, int);
-    field public static final android.os.Parcelable.Creator<android.content.ClipData> CREATOR;
+    field @NonNull public static final android.os.Parcelable.Creator<android.content.ClipData> CREATOR;
   }
 
   public static class ClipData.Item {
@@ -9290,7 +9298,7 @@
     method public boolean hasMimeType(String);
     method public void setExtras(android.os.PersistableBundle);
     method public void writeToParcel(android.os.Parcel, int);
-    field public static final android.os.Parcelable.Creator<android.content.ClipDescription> CREATOR;
+    field @NonNull public static final android.os.Parcelable.Creator<android.content.ClipDescription> CREATOR;
     field public static final String MIMETYPE_TEXT_HTML = "text/html";
     field public static final String MIMETYPE_TEXT_INTENT = "text/vnd.android.intent";
     field public static final String MIMETYPE_TEXT_PLAIN = "text/plain";
@@ -9350,7 +9358,7 @@
     method @Nullable public static android.content.ComponentName unflattenFromString(@NonNull String);
     method public void writeToParcel(android.os.Parcel, int);
     method public static void writeToParcel(android.content.ComponentName, android.os.Parcel);
-    field public static final android.os.Parcelable.Creator<android.content.ComponentName> CREATOR;
+    field @NonNull public static final android.os.Parcelable.Creator<android.content.ComponentName> CREATOR;
   }
 
   public abstract class ContentProvider implements android.content.ComponentCallbacks2 {
@@ -9453,7 +9461,7 @@
     method public String[] resolveSelectionArgsBackReferences(android.content.ContentProviderResult[], int);
     method public android.content.ContentValues resolveValueBackReferences(android.content.ContentProviderResult[], int);
     method public void writeToParcel(android.os.Parcel, int);
-    field public static final android.os.Parcelable.Creator<android.content.ContentProviderOperation> CREATOR;
+    field @NonNull public static final android.os.Parcelable.Creator<android.content.ContentProviderOperation> CREATOR;
   }
 
   public static class ContentProviderOperation.Builder {
@@ -9474,7 +9482,7 @@
     ctor public ContentProviderResult(android.os.Parcel);
     method public int describeContents();
     method public void writeToParcel(android.os.Parcel, int);
-    field public static final android.os.Parcelable.Creator<android.content.ContentProviderResult> CREATOR;
+    field @NonNull public static final android.os.Parcelable.Creator<android.content.ContentProviderResult> CREATOR;
     field public final Integer count;
     field public final android.net.Uri uri;
   }
@@ -9555,8 +9563,8 @@
     method public final void unregisterContentObserver(@NonNull android.database.ContentObserver);
     method public final int update(@RequiresPermission.Write @NonNull android.net.Uri, @Nullable android.content.ContentValues, @Nullable String, @Nullable String[]);
     method public static void validateSyncExtrasBundle(android.os.Bundle);
-    method public static android.content.ContentResolver wrap(@NonNull android.content.ContentProvider);
-    method public static android.content.ContentResolver wrap(@NonNull android.content.ContentProviderClient);
+    method @NonNull public static android.content.ContentResolver wrap(@NonNull android.content.ContentProvider);
+    method @NonNull public static android.content.ContentResolver wrap(@NonNull android.content.ContentProviderClient);
     field public static final String ANY_CURSOR_ITEM_TYPE = "vnd.android.cursor.item/*";
     field public static final String CURSOR_DIR_BASE_TYPE = "vnd.android.cursor.dir";
     field public static final String CURSOR_ITEM_BASE_TYPE = "vnd.android.cursor.item";
@@ -9643,14 +9651,15 @@
     method public int size();
     method public java.util.Set<java.util.Map.Entry<java.lang.String,java.lang.Object>> valueSet();
     method public void writeToParcel(android.os.Parcel, int);
-    field public static final android.os.Parcelable.Creator<android.content.ContentValues> CREATOR;
+    field @NonNull public static final android.os.Parcelable.Creator<android.content.ContentValues> CREATOR;
     field public static final String TAG = "ContentValues";
   }
 
   public abstract class Context {
     ctor public Context();
-    method public boolean bindIsolatedService(@RequiresPermission android.content.Intent, @NonNull android.content.ServiceConnection, int, @NonNull String);
+    method public boolean bindIsolatedService(@RequiresPermission @NonNull android.content.Intent, int, @NonNull String, @NonNull java.util.concurrent.Executor, @NonNull android.content.ServiceConnection);
     method public abstract boolean bindService(@RequiresPermission android.content.Intent, @NonNull android.content.ServiceConnection, int);
+    method public boolean bindService(@RequiresPermission @NonNull android.content.Intent, int, @NonNull java.util.concurrent.Executor, @NonNull android.content.ServiceConnection);
     method @CheckResult(suggest="#enforceCallingOrSelfPermission(String,String)") public abstract int checkCallingOrSelfPermission(@NonNull String);
     method @CheckResult(suggest="#enforceCallingOrSelfUriPermission(Uri,int,String)") public abstract int checkCallingOrSelfUriPermission(android.net.Uri, int);
     method @CheckResult(suggest="#enforceCallingPermission(String,String)") public abstract int checkCallingPermission(@NonNull String);
@@ -9702,7 +9711,7 @@
     method public abstract java.io.File getNoBackupFilesDir();
     method public abstract java.io.File getObbDir();
     method public abstract java.io.File[] getObbDirs();
-    method public String getOpPackageName();
+    method @NonNull public String getOpPackageName();
     method public abstract String getPackageCodePath();
     method public abstract android.content.pm.PackageManager getPackageManager();
     method public abstract String getPackageName();
@@ -10337,7 +10346,7 @@
     field public static final String CATEGORY_UNIT_TEST = "android.intent.category.UNIT_TEST";
     field public static final String CATEGORY_VOICE = "android.intent.category.VOICE";
     field public static final String CATEGORY_VR_HOME = "android.intent.category.VR_HOME";
-    field public static final android.os.Parcelable.Creator<android.content.Intent> CREATOR;
+    field @NonNull public static final android.os.Parcelable.Creator<android.content.Intent> CREATOR;
     field public static final String EXTRA_ALARM_COUNT = "android.intent.extra.ALARM_COUNT";
     field public static final String EXTRA_ALLOW_MULTIPLE = "android.intent.extra.ALLOW_MULTIPLE";
     field @Deprecated public static final String EXTRA_ALLOW_REPLACE = "android.intent.extra.ALLOW_REPLACE";
@@ -10475,7 +10484,7 @@
     method public int describeContents();
     method public static android.content.Intent.ShortcutIconResource fromContext(android.content.Context, @AnyRes int);
     method public void writeToParcel(android.os.Parcel, int);
-    field public static final android.os.Parcelable.Creator<android.content.Intent.ShortcutIconResource> CREATOR;
+    field @NonNull public static final android.os.Parcelable.Creator<android.content.Intent.ShortcutIconResource> CREATOR;
     field public String packageName;
     field public String resourceName;
   }
@@ -10534,7 +10543,7 @@
     method public final java.util.Iterator<java.lang.String> typesIterator();
     method public final void writeToParcel(android.os.Parcel, int);
     method public void writeToXml(org.xmlpull.v1.XmlSerializer) throws java.io.IOException;
-    field public static final android.os.Parcelable.Creator<android.content.IntentFilter> CREATOR;
+    field @NonNull public static final android.os.Parcelable.Creator<android.content.IntentFilter> CREATOR;
     field public static final int MATCH_ADJUSTMENT_MASK = 65535; // 0xffff
     field public static final int MATCH_ADJUSTMENT_NORMAL = 32768; // 0x8000
     field public static final int MATCH_CATEGORY_EMPTY = 1048576; // 0x100000
@@ -10576,7 +10585,7 @@
     method public void sendIntent(android.content.Context, int, android.content.Intent, android.content.IntentSender.OnFinished, android.os.Handler, String) throws android.content.IntentSender.SendIntentException;
     method public static void writeIntentSenderOrNullToParcel(android.content.IntentSender, android.os.Parcel);
     method public void writeToParcel(android.os.Parcel, int);
-    field public static final android.os.Parcelable.Creator<android.content.IntentSender> CREATOR;
+    field @NonNull public static final android.os.Parcelable.Creator<android.content.IntentSender> CREATOR;
   }
 
   public static interface IntentSender.OnFinished {
@@ -10635,11 +10644,11 @@
   }
 
   public final class LocusId implements android.os.Parcelable {
-    ctor public LocusId(@NonNull android.net.Uri);
+    ctor public LocusId(@NonNull String);
     method public int describeContents();
-    method @NonNull public android.net.Uri getUri();
+    method @NonNull public String getId();
     method public void writeToParcel(android.os.Parcel, int);
-    field public static final android.os.Parcelable.Creator<android.content.LocusId> CREATOR;
+    field @NonNull public static final android.os.Parcelable.Creator<android.content.LocusId> CREATOR;
   }
 
   public class MutableContextWrapper extends android.content.ContextWrapper {
@@ -10661,7 +10670,7 @@
     ctor public PeriodicSync(android.accounts.Account, String, android.os.Bundle, long);
     method public int describeContents();
     method public void writeToParcel(android.os.Parcel, int);
-    field public static final android.os.Parcelable.Creator<android.content.PeriodicSync> CREATOR;
+    field @NonNull public static final android.os.Parcelable.Creator<android.content.PeriodicSync> CREATOR;
     field public final android.accounts.Account account;
     field public final String authority;
     field public final android.os.Bundle extras;
@@ -10715,7 +10724,7 @@
     method public void setTitle(String);
     method public void setType(int);
     method public void writeToParcel(android.os.Parcel, int);
-    field public static final android.os.Parcelable.Creator<android.content.RestrictionEntry> CREATOR;
+    field @NonNull public static final android.os.Parcelable.Creator<android.content.RestrictionEntry> CREATOR;
     field public static final int TYPE_BOOLEAN = 1; // 0x1
     field public static final int TYPE_BUNDLE = 7; // 0x7
     field public static final int TYPE_BUNDLE_ARRAY = 8; // 0x8
@@ -10828,7 +10837,7 @@
     method public static android.content.SyncAdapterType newKey(String, String);
     method public boolean supportsUploading();
     method public void writeToParcel(android.os.Parcel, int);
-    field public static final android.os.Parcelable.Creator<android.content.SyncAdapterType> CREATOR;
+    field @NonNull public static final android.os.Parcelable.Creator<android.content.SyncAdapterType> CREATOR;
     field public final String accountType;
     field public final String authority;
     field public final boolean isKey;
@@ -10850,7 +10859,7 @@
   public class SyncRequest 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.content.SyncRequest> CREATOR;
+    field @NonNull public static final android.os.Parcelable.Creator<android.content.SyncRequest> CREATOR;
   }
 
   public static class SyncRequest.Builder {
@@ -10880,7 +10889,7 @@
     method public String toDebugString();
     method public void writeToParcel(android.os.Parcel, int);
     field public static final android.content.SyncResult ALREADY_IN_PROGRESS;
-    field public static final android.os.Parcelable.Creator<android.content.SyncResult> CREATOR;
+    field @NonNull public static final android.os.Parcelable.Creator<android.content.SyncResult> CREATOR;
     field public boolean databaseError;
     field public long delayUntil;
     field public boolean fullSyncRequested;
@@ -10898,7 +10907,7 @@
     method public void clear();
     method public int describeContents();
     method public void writeToParcel(android.os.Parcel, int);
-    field public static final android.os.Parcelable.Creator<android.content.SyncStats> CREATOR;
+    field @NonNull public static final android.os.Parcelable.Creator<android.content.SyncStats> CREATOR;
     field public long numAuthExceptions;
     field public long numConflictDetectedExceptions;
     field public long numDeletes;
@@ -10928,7 +10937,7 @@
     method public boolean isReadPermission();
     method public boolean isWritePermission();
     method public void writeToParcel(android.os.Parcel, int);
-    field public static final android.os.Parcelable.Creator<android.content.UriPermission> CREATOR;
+    field @NonNull public static final android.os.Parcelable.Creator<android.content.UriPermission> CREATOR;
     field public static final long INVALID_TIME = -9223372036854775808L; // 0x8000000000000000L
   }
 
@@ -10961,7 +10970,7 @@
     field public static final int CONFIG_SMALLEST_SCREEN_SIZE = 2048; // 0x800
     field public static final int CONFIG_TOUCHSCREEN = 8; // 0x8
     field public static final int CONFIG_UI_MODE = 512; // 0x200
-    field public static final android.os.Parcelable.Creator<android.content.pm.ActivityInfo> CREATOR;
+    field @NonNull public static final android.os.Parcelable.Creator<android.content.pm.ActivityInfo> CREATOR;
     field public static final int DOCUMENT_LAUNCH_ALWAYS = 2; // 0x2
     field public static final int DOCUMENT_LAUNCH_INTO_EXISTING = 1; // 0x1
     field public static final int DOCUMENT_LAUNCH_NEVER = 3; // 0x3
@@ -11053,7 +11062,7 @@
     field public static final int CATEGORY_SOCIAL = 4; // 0x4
     field public static final int CATEGORY_UNDEFINED = -1; // 0xffffffff
     field public static final int CATEGORY_VIDEO = 2; // 0x2
-    field public static final android.os.Parcelable.Creator<android.content.pm.ApplicationInfo> CREATOR;
+    field @NonNull public static final android.os.Parcelable.Creator<android.content.pm.ApplicationInfo> CREATOR;
     field public static final int FLAG_ALLOW_BACKUP = 32768; // 0x8000
     field public static final int FLAG_ALLOW_CLEAR_USER_DATA = 64; // 0x40
     field public static final int FLAG_ALLOW_TASK_REPARENTING = 32; // 0x20
@@ -11128,7 +11137,7 @@
     method @NonNull public java.util.List<java.lang.String> getPackageNames();
     method public int getSequenceNumber();
     method public void writeToParcel(android.os.Parcel, int);
-    field public static final android.os.Parcelable.Creator<android.content.pm.ChangedPackages> CREATOR;
+    field @NonNull public static final android.os.Parcelable.Creator<android.content.pm.ChangedPackages> CREATOR;
   }
 
   public class ComponentInfo extends android.content.pm.PackageItemInfo {
@@ -11154,7 +11163,7 @@
     method public int describeContents();
     method public String getGlEsVersion();
     method public void writeToParcel(android.os.Parcel, int);
-    field public static final android.os.Parcelable.Creator<android.content.pm.ConfigurationInfo> CREATOR;
+    field @NonNull public static final android.os.Parcelable.Creator<android.content.pm.ConfigurationInfo> CREATOR;
     field public static final int GL_ES_VERSION_UNDEFINED = 0; // 0x0
     field public static final int INPUT_FEATURE_FIVE_WAY_NAV = 2; // 0x2
     field public static final int INPUT_FEATURE_HARD_KEYBOARD = 1; // 0x1
@@ -11177,7 +11186,7 @@
     ctor public FeatureGroupInfo(android.content.pm.FeatureGroupInfo);
     method public int describeContents();
     method public void writeToParcel(android.os.Parcel, int);
-    field public static final android.os.Parcelable.Creator<android.content.pm.FeatureGroupInfo> CREATOR;
+    field @NonNull public static final android.os.Parcelable.Creator<android.content.pm.FeatureGroupInfo> CREATOR;
     field public android.content.pm.FeatureInfo[] features;
   }
 
@@ -11187,7 +11196,7 @@
     method public int describeContents();
     method public String getGlEsVersion();
     method public void writeToParcel(android.os.Parcel, int);
-    field public static final android.os.Parcelable.Creator<android.content.pm.FeatureInfo> CREATOR;
+    field @NonNull public static final android.os.Parcelable.Creator<android.content.pm.FeatureInfo> CREATOR;
     field public static final int FLAG_REQUIRED = 1; // 0x1
     field public static final int GL_ES_VERSION_UNDEFINED = 0; // 0x0
     field public int flags;
@@ -11200,7 +11209,7 @@
     ctor public InstrumentationInfo();
     ctor public InstrumentationInfo(android.content.pm.InstrumentationInfo);
     method public int describeContents();
-    field public static final android.os.Parcelable.Creator<android.content.pm.InstrumentationInfo> CREATOR;
+    field @NonNull public static final android.os.Parcelable.Creator<android.content.pm.InstrumentationInfo> CREATOR;
     field public String dataDir;
     field public boolean functionalTest;
     field public boolean handleProfiling;
@@ -11224,7 +11233,7 @@
     method public String getSourcePackage();
     method public android.graphics.drawable.Drawable loadIcon(android.content.pm.PackageManager);
     method public CharSequence loadLabel(android.content.pm.PackageManager);
-    field public static final android.os.Parcelable.Creator<android.content.pm.LabeledIntent> CREATOR;
+    field @NonNull public static final android.os.Parcelable.Creator<android.content.pm.LabeledIntent> CREATOR;
   }
 
   public class LauncherActivityInfo {
@@ -11277,7 +11286,7 @@
     method public long getTotalUsageLimit();
     method public long getUsageRemaining();
     method public void writeToParcel(android.os.Parcel, int);
-    field public static final android.os.Parcelable.Creator<android.content.pm.LauncherApps.AppUsageLimit> CREATOR;
+    field @NonNull public static final android.os.Parcelable.Creator<android.content.pm.LauncherApps.AppUsageLimit> CREATOR;
   }
 
   public abstract static class LauncherApps.Callback {
@@ -11303,7 +11312,7 @@
     method @Nullable public android.content.pm.ShortcutInfo getShortcutInfo();
     method public boolean isValid();
     method public void writeToParcel(android.os.Parcel, int);
-    field public static final android.os.Parcelable.Creator<android.content.pm.LauncherApps.PinItemRequest> CREATOR;
+    field @NonNull public static final android.os.Parcelable.Creator<android.content.pm.LauncherApps.PinItemRequest> CREATOR;
     field public static final int REQUEST_TYPE_APPWIDGET = 2; // 0x2
     field public static final int REQUEST_TYPE_SHORTCUT = 1; // 0x1
   }
@@ -11328,7 +11337,7 @@
     method @Nullable public String getPackageName();
     method public boolean isHidden();
     method public void writeToParcel(android.os.Parcel, int);
-    field public static final android.os.Parcelable.Creator<android.content.pm.ModuleInfo> CREATOR;
+    field @NonNull public static final android.os.Parcelable.Creator<android.content.pm.ModuleInfo> CREATOR;
   }
 
   public class PackageInfo implements android.os.Parcelable {
@@ -11337,7 +11346,7 @@
     method public long getLongVersionCode();
     method public void setLongVersionCode(long);
     method public void writeToParcel(android.os.Parcel, int);
-    field public static final android.os.Parcelable.Creator<android.content.pm.PackageInfo> CREATOR;
+    field @NonNull public static final android.os.Parcelable.Creator<android.content.pm.PackageInfo> CREATOR;
     field public static final int INSTALL_LOCATION_AUTO = 0; // 0x0
     field public static final int INSTALL_LOCATION_INTERNAL_ONLY = 1; // 0x1
     field public static final int INSTALL_LOCATION_PREFER_EXTERNAL = 2; // 0x2
@@ -11455,7 +11464,7 @@
     method public int getSessionId();
     method public long getSize();
     method public int getStagedSessionErrorCode();
-    method public String getStagedSessionErrorMessage();
+    method @NonNull public String getStagedSessionErrorMessage();
     method public android.os.UserHandle getUser();
     method public boolean isActive();
     method public boolean isMultiPackage();
@@ -11801,7 +11810,7 @@
     ctor @Deprecated public PackageStats(android.content.pm.PackageStats);
     method @Deprecated public int describeContents();
     method @Deprecated public void writeToParcel(android.os.Parcel, int);
-    field @Deprecated public static final android.os.Parcelable.Creator<android.content.pm.PackageStats> CREATOR;
+    field @Deprecated @NonNull public static final android.os.Parcelable.Creator<android.content.pm.PackageStats> CREATOR;
     field @Deprecated public long cacheSize;
     field @Deprecated public long codeSize;
     field @Deprecated public long dataSize;
@@ -11818,30 +11827,30 @@
     ctor public PathPermission(android.os.Parcel);
     method public String getReadPermission();
     method public String getWritePermission();
-    field public static final android.os.Parcelable.Creator<android.content.pm.PathPermission> CREATOR;
+    field @NonNull public static final android.os.Parcelable.Creator<android.content.pm.PathPermission> CREATOR;
   }
 
   public class PermissionGroupInfo extends android.content.pm.PackageItemInfo implements android.os.Parcelable {
-    ctor public PermissionGroupInfo();
-    ctor public PermissionGroupInfo(android.content.pm.PermissionGroupInfo);
+    ctor @Deprecated public PermissionGroupInfo();
+    ctor @Deprecated public PermissionGroupInfo(@NonNull android.content.pm.PermissionGroupInfo);
     method public int describeContents();
-    method public CharSequence loadDescription(android.content.pm.PackageManager);
-    field public static final android.os.Parcelable.Creator<android.content.pm.PermissionGroupInfo> CREATOR;
+    method @Nullable public CharSequence loadDescription(@NonNull android.content.pm.PackageManager);
+    field @NonNull public static final android.os.Parcelable.Creator<android.content.pm.PermissionGroupInfo> CREATOR;
     field public static final int FLAG_PERSONAL_INFO = 1; // 0x1
-    field public int descriptionRes;
+    field @StringRes public int descriptionRes;
     field public int flags;
-    field public CharSequence nonLocalizedDescription;
+    field @Nullable public CharSequence nonLocalizedDescription;
     field public int priority;
   }
 
   public class PermissionInfo extends android.content.pm.PackageItemInfo implements android.os.Parcelable {
-    ctor public PermissionInfo();
-    ctor public PermissionInfo(android.content.pm.PermissionInfo);
+    ctor @Deprecated public PermissionInfo();
+    ctor @Deprecated public PermissionInfo(@NonNull android.content.pm.PermissionInfo);
     method public int describeContents();
     method public int getProtection();
     method public int getProtectionFlags();
-    method public CharSequence loadDescription(android.content.pm.PackageManager);
-    field public static final android.os.Parcelable.Creator<android.content.pm.PermissionInfo> CREATOR;
+    method @Nullable public CharSequence loadDescription(@NonNull android.content.pm.PackageManager);
+    field @NonNull public static final android.os.Parcelable.Creator<android.content.pm.PermissionInfo> CREATOR;
     field public static final int FLAG_COSTS_MONEY = 1; // 0x1
     field public static final int FLAG_INSTALLED = 1073741824; // 0x40000000
     field public static final int PROTECTION_DANGEROUS = 1; // 0x1
@@ -11861,10 +11870,10 @@
     field public static final int PROTECTION_NORMAL = 0; // 0x0
     field public static final int PROTECTION_SIGNATURE = 2; // 0x2
     field @Deprecated public static final int PROTECTION_SIGNATURE_OR_SYSTEM = 3; // 0x3
-    field public int descriptionRes;
+    field @StringRes public int descriptionRes;
     field public int flags;
-    field public String group;
-    field public CharSequence nonLocalizedDescription;
+    field @Nullable public String group;
+    field @Nullable public CharSequence nonLocalizedDescription;
     field @Deprecated public int protectionLevel;
   }
 
@@ -11873,7 +11882,7 @@
     ctor public ProviderInfo(android.content.pm.ProviderInfo);
     method public int describeContents();
     method public void dump(android.util.Printer, String);
-    field public static final android.os.Parcelable.Creator<android.content.pm.ProviderInfo> CREATOR;
+    field @NonNull public static final android.os.Parcelable.Creator<android.content.pm.ProviderInfo> CREATOR;
     field public static final int FLAG_SINGLE_USER = 1073741824; // 0x40000000
     field public String authority;
     field public int flags;
@@ -11897,7 +11906,7 @@
     method public android.graphics.drawable.Drawable loadIcon(android.content.pm.PackageManager);
     method public CharSequence loadLabel(android.content.pm.PackageManager);
     method public void writeToParcel(android.os.Parcel, int);
-    field public static final android.os.Parcelable.Creator<android.content.pm.ResolveInfo> CREATOR;
+    field @NonNull public static final android.os.Parcelable.Creator<android.content.pm.ResolveInfo> CREATOR;
     field public android.content.pm.ActivityInfo activityInfo;
     field public android.content.IntentFilter filter;
     field public int icon;
@@ -11925,7 +11934,7 @@
     method public int describeContents();
     method public void dump(android.util.Printer, String);
     method public int getForegroundServiceType();
-    field public static final android.os.Parcelable.Creator<android.content.pm.ServiceInfo> CREATOR;
+    field @NonNull public static final android.os.Parcelable.Creator<android.content.pm.ServiceInfo> CREATOR;
     field public static final int FLAG_EXTERNAL_SERVICE = 4; // 0x4
     field public static final int FLAG_ISOLATED_PROCESS = 2; // 0x2
     field public static final int FLAG_SINGLE_USER = 1073741824; // 0x40000000
@@ -11951,7 +11960,7 @@
     method public int getType();
     method @Deprecated @IntRange(from=0xffffffff) 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 @NonNull public static final android.os.Parcelable.Creator<android.content.pm.SharedLibraryInfo> CREATOR;
     field public static final int TYPE_BUILTIN = 0; // 0x0
     field public static final int TYPE_DYNAMIC = 1; // 0x1
     field public static final int TYPE_STATIC = 2; // 0x2
@@ -11969,6 +11978,7 @@
     method @Nullable public android.content.Intent getIntent();
     method @Nullable public android.content.Intent[] getIntents();
     method public long getLastChangedTimestamp();
+    method @Nullable public android.content.LocusId getLocusId();
     method @Nullable public CharSequence getLongLabel();
     method @NonNull public String getPackage();
     method public int getRank();
@@ -11981,7 +11991,7 @@
     method public boolean isImmutable();
     method public boolean isPinned();
     method public void writeToParcel(android.os.Parcel, int);
-    field public static final android.os.Parcelable.Creator<android.content.pm.ShortcutInfo> CREATOR;
+    field @NonNull public static final android.os.Parcelable.Creator<android.content.pm.ShortcutInfo> CREATOR;
     field public static final int DISABLED_REASON_APP_CHANGED = 2; // 0x2
     field public static final int DISABLED_REASON_BACKUP_NOT_SUPPORTED = 101; // 0x65
     field public static final int DISABLED_REASON_BY_APP = 1; // 0x1
@@ -12003,6 +12013,7 @@
     method @NonNull public android.content.pm.ShortcutInfo.Builder setIcon(android.graphics.drawable.Icon);
     method @NonNull public android.content.pm.ShortcutInfo.Builder setIntent(@NonNull android.content.Intent);
     method @NonNull public android.content.pm.ShortcutInfo.Builder setIntents(@NonNull android.content.Intent[]);
+    method @NonNull public android.content.pm.ShortcutInfo.Builder setLocusId(@NonNull android.content.LocusId);
     method @NonNull public android.content.pm.ShortcutInfo.Builder setLongLabel(@NonNull CharSequence);
     method @NonNull public android.content.pm.ShortcutInfo.Builder setLongLived();
     method @NonNull public android.content.pm.ShortcutInfo.Builder setPerson(@NonNull android.app.Person);
@@ -12042,7 +12053,7 @@
     method public char[] toChars(char[], int[]);
     method public String toCharsString();
     method public void writeToParcel(android.os.Parcel, int);
-    field public static final android.os.Parcelable.Creator<android.content.pm.Signature> CREATOR;
+    field @NonNull public static final android.os.Parcelable.Creator<android.content.pm.Signature> CREATOR;
   }
 
   public final class SigningInfo implements android.os.Parcelable {
@@ -12054,7 +12065,7 @@
     method public boolean hasMultipleSigners();
     method public boolean hasPastSigningCertificates();
     method public void writeToParcel(android.os.Parcel, int);
-    field public static final android.os.Parcelable.Creator<android.content.pm.SigningInfo> CREATOR;
+    field @NonNull public static final android.os.Parcelable.Creator<android.content.pm.SigningInfo> CREATOR;
   }
 
   public final class VersionedPackage implements android.os.Parcelable {
@@ -12065,7 +12076,7 @@
     method @NonNull public String getPackageName();
     method @Deprecated public int getVersionCode();
     method public void writeToParcel(android.os.Parcel, int);
-    field public static final android.os.Parcelable.Creator<android.content.pm.VersionedPackage> CREATOR;
+    field @NonNull public static final android.os.Parcelable.Creator<android.content.pm.VersionedPackage> CREATOR;
   }
 
 }
@@ -12086,7 +12097,7 @@
     method public android.os.ParcelFileDescriptor getParcelFileDescriptor();
     method public long getStartOffset();
     method public void writeToParcel(android.os.Parcel, int);
-    field public static final android.os.Parcelable.Creator<android.content.res.AssetFileDescriptor> CREATOR;
+    field @NonNull public static final android.os.Parcelable.Creator<android.content.res.AssetFileDescriptor> CREATOR;
     field public static final long UNKNOWN_LENGTH = -1L; // 0xffffffffffffffffL
   }
 
@@ -12132,7 +12143,7 @@
     method @NonNull public static android.content.res.ColorStateList valueOf(@ColorInt int);
     method @NonNull public android.content.res.ColorStateList withAlpha(int);
     method public void writeToParcel(android.os.Parcel, int);
-    field public static final android.os.Parcelable.Creator<android.content.res.ColorStateList> CREATOR;
+    field @NonNull public static final android.os.Parcelable.Creator<android.content.res.ColorStateList> CREATOR;
   }
 
   public final class Configuration implements java.lang.Comparable<android.content.res.Configuration> android.os.Parcelable {
@@ -12167,7 +12178,7 @@
     field public static final int COLOR_MODE_WIDE_COLOR_GAMUT_NO = 1; // 0x1
     field public static final int COLOR_MODE_WIDE_COLOR_GAMUT_UNDEFINED = 0; // 0x0
     field public static final int COLOR_MODE_WIDE_COLOR_GAMUT_YES = 2; // 0x2
-    field public static final android.os.Parcelable.Creator<android.content.res.Configuration> CREATOR;
+    field @NonNull public static final android.os.Parcelable.Creator<android.content.res.Configuration> CREATOR;
     field public static final int DENSITY_DPI_UNDEFINED = 0; // 0x0
     field public static final int HARDKEYBOARDHIDDEN_NO = 1; // 0x1
     field public static final int HARDKEYBOARDHIDDEN_UNDEFINED = 0; // 0x0
@@ -12255,7 +12266,7 @@
   public class ObbInfo 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.content.res.ObbInfo> CREATOR;
+    field @NonNull public static final android.os.Parcelable.Creator<android.content.res.ObbInfo> CREATOR;
     field public static final int OBB_OVERLAY = 1; // 0x1
     field public String filename;
     field public int flags;
@@ -12334,7 +12345,7 @@
   public final class Resources.Theme {
     method public void applyStyle(int, boolean);
     method public void dump(int, String, String);
-    method public int[] getAttributeResolutionStack(@AttrRes int, @StyleRes int, @StyleRes int);
+    method @NonNull public int[] getAttributeResolutionStack(@AttrRes int, @StyleRes int, @StyleRes int);
     method public int getChangingConfigurations();
     method public android.graphics.drawable.Drawable getDrawable(@DrawableRes int) throws android.content.res.Resources.NotFoundException;
     method @StyleRes public int getExplicitStyle(@Nullable android.util.AttributeSet);
@@ -12368,7 +12379,7 @@
     method public String getPositionDescription();
     method @AnyRes public int getResourceId(@StyleableRes int, int);
     method public android.content.res.Resources getResources();
-    method @StyleRes public int getSourceResourceId(@StyleableRes int, @StyleRes int);
+    method @AnyRes public int getSourceResourceId(@StyleableRes int, @AnyRes int);
     method @Nullable public String getString(@StyleableRes int);
     method public CharSequence getText(@StyleableRes int);
     method public CharSequence[] getTextArray(@StyleableRes int);
@@ -12512,7 +12523,7 @@
     method public int getInt(int);
     method public long getLong(int);
     method public android.net.Uri getNotificationUri();
-    method public default java.util.List<android.net.Uri> getNotificationUris();
+    method @Nullable public default java.util.List<android.net.Uri> getNotificationUris();
     method public int getPosition();
     method public short getShort(int);
     method public String getString(int);
@@ -12598,7 +12609,7 @@
     method public boolean setNumColumns(int);
     method public void setStartPosition(int);
     method public void writeToParcel(android.os.Parcel, int);
-    field public static final android.os.Parcelable.Creator<android.database.CursorWindow> CREATOR;
+    field @NonNull public static final android.os.Parcelable.Creator<android.database.CursorWindow> CREATOR;
   }
 
   public class CursorWrapper implements android.database.Cursor {
@@ -13071,19 +13082,19 @@
     method public String buildUnionSubQuery(String, String[], java.util.Set<java.lang.String>, int, String, String, String, String);
     method @Deprecated public String buildUnionSubQuery(String, String[], java.util.Set<java.lang.String>, int, String, String, String[], String, String);
     method public int delete(@NonNull android.database.sqlite.SQLiteDatabase, @Nullable String, @Nullable String[]);
-    method public android.database.sqlite.SQLiteDatabase.CursorFactory getCursorFactory();
+    method @Nullable public android.database.sqlite.SQLiteDatabase.CursorFactory getCursorFactory();
     method public boolean getDistinct();
-    method public java.util.Map<java.lang.String,java.lang.String> getProjectionMap();
+    method @Nullable public java.util.Map<java.lang.String,java.lang.String> getProjectionMap();
     method public boolean getStrict();
-    method public String getTables();
+    method @Nullable public String getTables();
     method public android.database.Cursor query(android.database.sqlite.SQLiteDatabase, String[], String, String[], String, String, String);
     method public android.database.Cursor query(android.database.sqlite.SQLiteDatabase, String[], String, String[], String, String, String, String);
     method public android.database.Cursor query(android.database.sqlite.SQLiteDatabase, String[], String, String[], String, String, String, String, android.os.CancellationSignal);
-    method public void setCursorFactory(android.database.sqlite.SQLiteDatabase.CursorFactory);
+    method public void setCursorFactory(@Nullable android.database.sqlite.SQLiteDatabase.CursorFactory);
     method public void setDistinct(boolean);
-    method public void setProjectionMap(java.util.Map<java.lang.String,java.lang.String>);
+    method public void setProjectionMap(@Nullable java.util.Map<java.lang.String,java.lang.String>);
     method public void setStrict(boolean);
-    method public void setTables(String);
+    method public void setTables(@Nullable String);
     method public int update(@NonNull android.database.sqlite.SQLiteDatabase, @NonNull android.content.ContentValues, @Nullable String, @Nullable String[]);
   }
 
@@ -13359,7 +13370,7 @@
     method public android.graphics.Path toPath(int, int, int, int);
     method public android.graphics.Path toPath(android.graphics.Path, int, int, int, int);
     method public void writeToParcel(android.os.Parcel, int);
-    field public static final android.os.Parcelable.Creator<android.gesture.Gesture> CREATOR;
+    field @NonNull public static final android.os.Parcelable.Creator<android.gesture.Gesture> CREATOR;
   }
 
   public final class GestureLibraries {
@@ -13553,7 +13564,7 @@
     method @CheckResult public android.graphics.Bitmap extractAlpha(android.graphics.Paint, int[]);
     method public int getAllocationByteCount();
     method public int getByteCount();
-    method public android.graphics.Color getColor(int, int);
+    method @NonNull public android.graphics.Color getColor(int, int);
     method @Nullable public android.graphics.ColorSpace getColorSpace();
     method public android.graphics.Bitmap.Config getConfig();
     method public int getDensity();
@@ -13591,7 +13602,7 @@
     method public void setWidth(int);
     method @Nullable public static android.graphics.Bitmap wrapHardwareBuffer(@NonNull android.hardware.HardwareBuffer, @Nullable android.graphics.ColorSpace);
     method public void writeToParcel(android.os.Parcel, int);
-    field public static final android.os.Parcelable.Creator<android.graphics.Bitmap> CREATOR;
+    field @NonNull public static final android.os.Parcelable.Creator<android.graphics.Bitmap> CREATOR;
     field public static final int DENSITY_NONE = 0; // 0x0
   }
 
@@ -13771,7 +13782,7 @@
     method public void drawColor(@ColorInt int, @NonNull android.graphics.BlendMode);
     method public void drawColor(@ColorLong long, @NonNull android.graphics.BlendMode);
     method public void drawDoubleRoundRect(@NonNull android.graphics.RectF, float, float, @NonNull android.graphics.RectF, float, float, @NonNull android.graphics.Paint);
-    method public void drawDoubleRoundRect(@NonNull android.graphics.RectF, float[], @NonNull android.graphics.RectF, float[], @NonNull android.graphics.Paint);
+    method public void drawDoubleRoundRect(@NonNull android.graphics.RectF, @NonNull float[], @NonNull android.graphics.RectF, @NonNull float[], @NonNull android.graphics.Paint);
     method public void drawLine(float, float, float, float, @NonNull android.graphics.Paint);
     method public void drawLines(@Size(multiple=4) @NonNull float[], int, int, @NonNull android.graphics.Paint);
     method public void drawLines(@Size(multiple=4) @NonNull float[], @NonNull android.graphics.Paint);
@@ -14110,17 +14121,18 @@
   public class HardwareRenderer {
     ctor public HardwareRenderer();
     method public void clearContent();
-    method public android.graphics.HardwareRenderer.FrameRenderRequest createRenderRequest();
+    method @NonNull public android.graphics.HardwareRenderer.FrameRenderRequest createRenderRequest();
     method public void destroy();
     method public boolean isOpaque();
     method public void notifyFramePending();
     method public void setContentRoot(@Nullable android.graphics.RenderNode);
     method public void setLightSourceAlpha(@FloatRange(from=0.0f, to=1.0f) float, @FloatRange(from=0.0f, to=1.0f) float);
     method public void setLightSourceGeometry(float, float, float, float);
-    method public void setName(String);
+    method public void setName(@NonNull String);
     method public void setOpaque(boolean);
-    method public void setStopped(boolean);
     method public void setSurface(@Nullable android.view.Surface);
+    method public void start();
+    method public void stop();
     field public static final int SYNC_CONTEXT_IS_STOPPED = 4; // 0x4
     field public static final int SYNC_FRAME_DROPPED = 8; // 0x8
     field public static final int SYNC_LOST_SURFACE_REWARD_IF_FOUND = 2; // 0x2
@@ -14129,9 +14141,9 @@
   }
 
   public final class HardwareRenderer.FrameRenderRequest {
-    method public android.graphics.HardwareRenderer.FrameRenderRequest setFrameCommitCallback(@NonNull java.util.concurrent.Executor, @NonNull Runnable);
-    method public android.graphics.HardwareRenderer.FrameRenderRequest setVsyncTime(long);
-    method public android.graphics.HardwareRenderer.FrameRenderRequest setWaitForPresent(boolean);
+    method @NonNull public android.graphics.HardwareRenderer.FrameRenderRequest setFrameCommitCallback(@NonNull java.util.concurrent.Executor, @NonNull Runnable);
+    method @NonNull public android.graphics.HardwareRenderer.FrameRenderRequest setVsyncTime(long);
+    method @NonNull public android.graphics.HardwareRenderer.FrameRenderRequest setWaitForPresent(boolean);
     method public int syncAndDraw();
   }
 
@@ -14153,6 +14165,7 @@
     method @Nullable public android.graphics.ImageDecoder.OnPartialImageListener getOnPartialImageListener();
     method @Nullable public android.graphics.PostProcessor getPostProcessor();
     method public boolean isDecodeAsAlphaMaskEnabled();
+    method public static boolean isMimeTypeSupported(@NonNull String);
     method public boolean isMutableRequired();
     method public boolean isUnpremultipliedRequired();
     method public void setAllocator(int);
@@ -14236,8 +14249,8 @@
     method @NonNull public static android.graphics.Insets of(@Nullable android.graphics.Rect);
     method @NonNull public static android.graphics.Insets subtract(@NonNull android.graphics.Insets, @NonNull android.graphics.Insets);
     method public void writeToParcel(android.os.Parcel, int);
-    field public static final android.os.Parcelable.Creator<android.graphics.Insets> CREATOR;
-    field public static final android.graphics.Insets NONE;
+    field @NonNull public static final android.os.Parcelable.Creator<android.graphics.Insets> CREATOR;
+    field @NonNull public static final android.graphics.Insets NONE;
     field public final int bottom;
     field public final int left;
     field public final int right;
@@ -14449,7 +14462,7 @@
     method public android.graphics.Paint.Style getStyle();
     method public android.graphics.Paint.Align getTextAlign();
     method public void getTextBounds(String, int, int, android.graphics.Rect);
-    method public void getTextBounds(CharSequence, int, int, android.graphics.Rect);
+    method public void getTextBounds(@NonNull CharSequence, int, int, @NonNull android.graphics.Rect);
     method public void getTextBounds(char[], int, int, android.graphics.Rect);
     method @NonNull public java.util.Locale getTextLocale();
     method @NonNull @Size(min=1) public android.os.LocaleList getTextLocales();
@@ -14468,7 +14481,7 @@
     method public android.graphics.Typeface getTypeface();
     method @Px public float getUnderlinePosition();
     method @Px public float getUnderlineThickness();
-    method public float getWordSpacing();
+    method @Px public float getWordSpacing();
     method @Deprecated public android.graphics.Xfermode getXfermode();
     method public boolean hasGlyph(String);
     method public final boolean isAntiAlias();
@@ -14524,7 +14537,7 @@
     method public void setTextSkewX(float);
     method public android.graphics.Typeface setTypeface(android.graphics.Typeface);
     method public void setUnderlineText(boolean);
-    method public void setWordSpacing(float);
+    method public void setWordSpacing(@Px float);
     method @Deprecated public android.graphics.Xfermode setXfermode(android.graphics.Xfermode);
     field public static final int ANTI_ALIAS_FLAG = 1; // 0x1
     field public static final int CURSOR_AFTER = 0; // 0x0
@@ -14740,7 +14753,7 @@
     method public void readFromParcel(@NonNull android.os.Parcel);
     method public void set(int, int);
     method public void writeToParcel(android.os.Parcel, int);
-    field public static final android.os.Parcelable.Creator<android.graphics.Point> CREATOR;
+    field @NonNull public static final android.os.Parcelable.Creator<android.graphics.Point> CREATOR;
     field public int x;
     field public int y;
   }
@@ -14759,7 +14772,7 @@
     method public final void set(float, float);
     method public final void set(@NonNull android.graphics.PointF);
     method public void writeToParcel(android.os.Parcel, int);
-    field public static final android.os.Parcelable.Creator<android.graphics.PointF> CREATOR;
+    field @NonNull public static final android.os.Parcelable.Creator<android.graphics.PointF> CREATOR;
     field public float x;
     field public float y;
   }
@@ -14848,7 +14861,7 @@
     method public void union(int, int);
     method public int width();
     method public void writeToParcel(android.os.Parcel, int);
-    field public static final android.os.Parcelable.Creator<android.graphics.Rect> CREATOR;
+    field @NonNull public static final android.os.Parcelable.Creator<android.graphics.Rect> CREATOR;
     field public int bottom;
     field public int left;
     field public int right;
@@ -14890,7 +14903,7 @@
     method public void union(float, float);
     method public final float width();
     method public void writeToParcel(android.os.Parcel, int);
-    field public static final android.os.Parcelable.Creator<android.graphics.RectF> CREATOR;
+    field @NonNull public static final android.os.Parcelable.Creator<android.graphics.RectF> CREATOR;
     field public float bottom;
     field public float left;
     field public float right;
@@ -14930,7 +14943,7 @@
     method public void translate(int, int, android.graphics.Region);
     method public final boolean union(@NonNull android.graphics.Rect);
     method public void writeToParcel(android.os.Parcel, int);
-    field public static final android.os.Parcelable.Creator<android.graphics.Region> CREATOR;
+    field @NonNull public static final android.os.Parcelable.Creator<android.graphics.Region> CREATOR;
   }
 
   public enum Region.Op {
@@ -14949,8 +14962,8 @@
 
   public final class RenderNode {
     ctor public RenderNode(@Nullable String);
-    method public android.graphics.RecordingCanvas beginRecording(int, int);
-    method public android.graphics.RecordingCanvas beginRecording();
+    method @NonNull public android.graphics.RecordingCanvas beginRecording(int, int);
+    method @NonNull public android.graphics.RecordingCanvas beginRecording();
     method public long computeApproximateMemoryUsage();
     method public void discardDisplayList();
     method public void endRecording();
@@ -15003,7 +15016,7 @@
     method public boolean setPivotX(float);
     method public boolean setPivotY(float);
     method public boolean setPosition(int, int, int, int);
-    method public boolean setPosition(android.graphics.Rect);
+    method public boolean setPosition(@NonNull android.graphics.Rect);
     method public boolean setProjectBackwards(boolean);
     method public boolean setProjectionReceiver(boolean);
     method public boolean setRotationX(float);
@@ -15104,13 +15117,13 @@
     method public android.graphics.Typeface.Builder setWeight(@IntRange(from=1, to=1000) int);
   }
 
-  public static class Typeface.CustomFallbackBuilder {
+  public static final class Typeface.CustomFallbackBuilder {
     ctor public Typeface.CustomFallbackBuilder(@NonNull android.graphics.fonts.FontFamily);
-    method public android.graphics.Typeface.CustomFallbackBuilder addCustomFallback(@NonNull android.graphics.fonts.FontFamily);
-    method public android.graphics.Typeface build();
+    method @NonNull public android.graphics.Typeface.CustomFallbackBuilder addCustomFallback(@NonNull android.graphics.fonts.FontFamily);
+    method @NonNull public android.graphics.Typeface build();
     method @IntRange(from=64) public static int getMaxCustomFallbackCount();
-    method public android.graphics.Typeface.CustomFallbackBuilder setStyle(@NonNull android.graphics.fonts.FontStyle);
-    method public android.graphics.Typeface.CustomFallbackBuilder setSystemFallback(@NonNull String);
+    method @NonNull public android.graphics.Typeface.CustomFallbackBuilder setStyle(@NonNull android.graphics.fonts.FontStyle);
+    method @NonNull public android.graphics.Typeface.CustomFallbackBuilder setSystemFallback(@NonNull String);
   }
 
   public class Xfermode {
@@ -15272,18 +15285,18 @@
 
   public class ColorStateListDrawable extends android.graphics.drawable.Drawable implements android.graphics.drawable.Drawable.Callback {
     ctor public ColorStateListDrawable();
-    ctor public ColorStateListDrawable(android.content.res.ColorStateList);
+    ctor public ColorStateListDrawable(@NonNull android.content.res.ColorStateList);
     method public void clearAlpha();
-    method public void draw(android.graphics.Canvas);
+    method public void draw(@NonNull android.graphics.Canvas);
     method @NonNull public android.content.res.ColorStateList getColorStateList();
     method public int getOpacity();
     method public boolean hasFocusStateSpecified();
-    method public void invalidateDrawable(android.graphics.drawable.Drawable);
-    method public void scheduleDrawable(android.graphics.drawable.Drawable, Runnable, long);
+    method public void invalidateDrawable(@NonNull android.graphics.drawable.Drawable);
+    method public void scheduleDrawable(@NonNull android.graphics.drawable.Drawable, @NonNull Runnable, long);
     method public void setAlpha(@IntRange(from=0, to=255) int);
-    method public void setColorFilter(android.graphics.ColorFilter);
-    method public void setColorStateList(android.content.res.ColorStateList);
-    method public void unscheduleDrawable(android.graphics.drawable.Drawable, Runnable);
+    method public void setColorFilter(@Nullable android.graphics.ColorFilter);
+    method public void setColorStateList(@NonNull android.content.res.ColorStateList);
+    method public void unscheduleDrawable(@NonNull android.graphics.drawable.Drawable, @NonNull Runnable);
   }
 
   public abstract class Drawable {
@@ -15442,38 +15455,38 @@
     method public float getGradientCenterY();
     method public float getGradientRadius();
     method public int getGradientType();
-    method public int getInnerRadius();
+    method @Px public int getInnerRadius();
     method public float getInnerRadiusRatio();
     method public int getOpacity();
     method public android.graphics.drawable.GradientDrawable.Orientation getOrientation();
     method public int getShape();
-    method public int getThickness();
+    method @Px public int getThickness();
     method public float getThicknessRatio();
     method public boolean getUseLevel();
     method public void setAlpha(int);
     method public void setColor(@ColorInt int);
     method public void setColor(@Nullable android.content.res.ColorStateList);
     method public void setColorFilter(@Nullable android.graphics.ColorFilter);
-    method public void setColors(@ColorInt int[]);
-    method public void setColors(@ColorInt int[], @Nullable float[]);
+    method public void setColors(@Nullable @ColorInt int[]);
+    method public void setColors(@Nullable @ColorInt int[], @Nullable float[]);
     method public void setCornerRadii(@Nullable float[]);
     method public void setCornerRadius(float);
     method public void setDither(boolean);
     method public void setGradientCenter(float, float);
     method public void setGradientRadius(float);
     method public void setGradientType(int);
-    method public void setInnerRadius(int);
-    method public void setInnerRadiusRatio(float);
+    method public void setInnerRadius(@Px int);
+    method public void setInnerRadiusRatio(@FloatRange(from=0.0f, fromInclusive=false) float);
     method public void setOrientation(android.graphics.drawable.GradientDrawable.Orientation);
-    method public void setPadding(int, int, int, int);
+    method public void setPadding(@Px int, @Px int, @Px int, @Px int);
     method public void setShape(int);
     method public void setSize(int, int);
     method public void setStroke(int, @ColorInt int);
     method public void setStroke(int, android.content.res.ColorStateList);
     method public void setStroke(int, @ColorInt int, float, float);
     method public void setStroke(int, android.content.res.ColorStateList, float, float);
-    method public void setThickness(int);
-    method public void setThicknessRatio(float);
+    method public void setThickness(@Px int);
+    method public void setThicknessRatio(@FloatRange(from=0.0f, fromInclusive=false) float);
     method public void setUseLevel(boolean);
     field public static final int LINE = 2; // 0x2
     field public static final int LINEAR_GRADIENT = 0; // 0x0
@@ -15516,7 +15529,7 @@
     method public android.graphics.drawable.Icon setTintList(android.content.res.ColorStateList);
     method public android.graphics.drawable.Icon setTintMode(android.graphics.PorterDuff.Mode);
     method public void writeToParcel(android.os.Parcel, int);
-    field public static final android.os.Parcelable.Creator<android.graphics.drawable.Icon> CREATOR;
+    field @NonNull public static final android.os.Parcelable.Creator<android.graphics.drawable.Icon> CREATOR;
     field public static final int TYPE_ADAPTIVE_BITMAP = 5; // 0x5
     field public static final int TYPE_BITMAP = 1; // 0x1
     field public static final int TYPE_DATA = 3; // 0x3
@@ -15686,10 +15699,10 @@
   public class StateListDrawable extends android.graphics.drawable.DrawableContainer {
     ctor public StateListDrawable();
     method public void addState(int[], android.graphics.drawable.Drawable);
-    method public int findStateDrawableIndex(int[]);
+    method public int findStateDrawableIndex(@NonNull int[]);
     method public int getStateCount();
-    method public android.graphics.drawable.Drawable getStateDrawable(int);
-    method public int[] getStateSet(int);
+    method @Nullable public android.graphics.drawable.Drawable getStateDrawable(int);
+    method @NonNull public int[] getStateSet(int);
   }
 
   public class TransitionDrawable extends android.graphics.drawable.LayerDrawable implements android.graphics.drawable.Drawable.Callback {
@@ -15764,15 +15777,15 @@
     method @NonNull public java.nio.ByteBuffer getBuffer();
     method @Nullable public java.io.File getFile();
     method @NonNull public android.os.LocaleList getLocaleList();
-    method public android.graphics.fonts.FontStyle getStyle();
+    method @NonNull public android.graphics.fonts.FontStyle getStyle();
     method @IntRange(from=0) public int getTtcIndex();
   }
 
-  public static class Font.Builder {
+  public static final class Font.Builder {
     ctor public Font.Builder(@NonNull java.nio.ByteBuffer);
     ctor public Font.Builder(@NonNull java.io.File);
-    ctor public Font.Builder(@NonNull java.io.FileDescriptor);
-    ctor public Font.Builder(@NonNull java.io.FileDescriptor, @IntRange(from=0) long, @IntRange(from=0xffffffff) long);
+    ctor public Font.Builder(@NonNull android.os.ParcelFileDescriptor);
+    ctor public Font.Builder(@NonNull android.os.ParcelFileDescriptor, @IntRange(from=0) long, @IntRange(from=0xffffffff) long);
     ctor public Font.Builder(@NonNull android.content.res.AssetManager, @NonNull String);
     ctor public Font.Builder(@NonNull android.content.res.Resources, int);
     method @Nullable public android.graphics.fonts.Font build() throws java.io.IOException;
@@ -15784,11 +15797,11 @@
   }
 
   public final class FontFamily {
-    method public android.graphics.fonts.Font getFont(@IntRange(from=0) int);
-    method public int getSize();
+    method @NonNull public android.graphics.fonts.Font getFont(@IntRange(from=0) int);
+    method @IntRange(from=1) public int getSize();
   }
 
-  public static class FontFamily.Builder {
+  public static final class FontFamily.Builder {
     ctor public FontFamily.Builder(@NonNull android.graphics.fonts.Font);
     method @NonNull public android.graphics.fonts.FontFamily.Builder addFont(@NonNull android.graphics.fonts.Font);
     method @NonNull public android.graphics.fonts.FontFamily build();
@@ -15880,7 +15893,7 @@
 package android.graphics.text {
 
   public class LineBreaker {
-    method public android.graphics.text.LineBreaker.Result computeLineBreaks(@NonNull android.graphics.text.MeasuredText, @NonNull android.graphics.text.LineBreaker.ParagraphConstraints, @IntRange(from=0) int);
+    method @NonNull public android.graphics.text.LineBreaker.Result computeLineBreaks(@NonNull android.graphics.text.MeasuredText, @NonNull android.graphics.text.LineBreaker.ParagraphConstraints, @IntRange(from=0) int);
     field public static final int BREAK_STRATEGY_BALANCED = 2; // 0x2
     field public static final int BREAK_STRATEGY_HIGH_QUALITY = 1; // 0x1
     field public static final int BREAK_STRATEGY_SIMPLE = 0; // 0x0
@@ -15891,13 +15904,13 @@
     field public static final int JUSTIFICATION_MODE_NONE = 0; // 0x0
   }
 
-  public static class LineBreaker.Builder {
+  public static final class LineBreaker.Builder {
     ctor public LineBreaker.Builder();
-    method public android.graphics.text.LineBreaker build();
-    method public android.graphics.text.LineBreaker.Builder setBreakStrategy(int);
-    method public android.graphics.text.LineBreaker.Builder setHyphenationFrequency(int);
-    method public android.graphics.text.LineBreaker.Builder setIndents(@Nullable int[]);
-    method public android.graphics.text.LineBreaker.Builder setJustified(int);
+    method @NonNull public android.graphics.text.LineBreaker build();
+    method @NonNull public android.graphics.text.LineBreaker.Builder setBreakStrategy(int);
+    method @NonNull public android.graphics.text.LineBreaker.Builder setHyphenationFrequency(int);
+    method @NonNull public android.graphics.text.LineBreaker.Builder setIndents(@Nullable int[]);
+    method @NonNull public android.graphics.text.LineBreaker.Builder setJustificationMode(int);
   }
 
   public static class LineBreaker.ParagraphConstraints {
@@ -15929,14 +15942,14 @@
     method @FloatRange(from=0.0) @Px public float getWidth(@IntRange(from=0) int, @IntRange(from=0) int);
   }
 
-  public static class MeasuredText.Builder {
+  public static final class MeasuredText.Builder {
     ctor public MeasuredText.Builder(@NonNull char[]);
     ctor public MeasuredText.Builder(@NonNull android.graphics.text.MeasuredText);
-    method public android.graphics.text.MeasuredText.Builder appendReplacementRun(@NonNull android.graphics.Paint, @IntRange(from=0) int, @FloatRange(from=0) float);
-    method public android.graphics.text.MeasuredText.Builder appendStyleRun(@NonNull android.graphics.Paint, @IntRange(from=0) int, boolean);
-    method public android.graphics.text.MeasuredText build();
-    method public android.graphics.text.MeasuredText.Builder setComputeHyphenation(boolean);
-    method public android.graphics.text.MeasuredText.Builder setComputeLayout(boolean);
+    method @NonNull public android.graphics.text.MeasuredText.Builder appendReplacementRun(@NonNull android.graphics.Paint, @IntRange(from=0) int, @Px @FloatRange(from=0) float);
+    method @NonNull public android.graphics.text.MeasuredText.Builder appendStyleRun(@NonNull android.graphics.Paint, @IntRange(from=0) int, boolean);
+    method @NonNull public android.graphics.text.MeasuredText build();
+    method @NonNull public android.graphics.text.MeasuredText.Builder setComputeHyphenation(boolean);
+    method @NonNull public android.graphics.text.MeasuredText.Builder setComputeLayout(boolean);
   }
 
 }
@@ -16233,7 +16246,7 @@
     method public static boolean isSupported(@IntRange(from=1) int, @IntRange(from=1) int, int, @IntRange(from=1) int, long);
     method public void writeToParcel(android.os.Parcel, int);
     field public static final int BLOB = 33; // 0x21
-    field public static final android.os.Parcelable.Creator<android.hardware.HardwareBuffer> CREATOR;
+    field @NonNull public static final android.os.Parcelable.Creator<android.hardware.HardwareBuffer> CREATOR;
     field public static final int DS_24UI8 = 50; // 0x32
     field public static final int DS_FP32UI8 = 52; // 0x34
     field public static final int D_16 = 48; // 0x30
@@ -16557,13 +16570,13 @@
 
   public static class BiometricPrompt.Builder {
     ctor public BiometricPrompt.Builder(android.content.Context);
-    method public android.hardware.biometrics.BiometricPrompt build();
-    method public android.hardware.biometrics.BiometricPrompt.Builder setAllowDeviceCredential(boolean);
-    method public android.hardware.biometrics.BiometricPrompt.Builder setDescription(@NonNull CharSequence);
-    method public android.hardware.biometrics.BiometricPrompt.Builder setNegativeButton(@NonNull CharSequence, @NonNull java.util.concurrent.Executor, @NonNull android.content.DialogInterface.OnClickListener);
-    method public android.hardware.biometrics.BiometricPrompt.Builder setRequireConfirmation(boolean);
-    method public android.hardware.biometrics.BiometricPrompt.Builder setSubtitle(@NonNull CharSequence);
-    method public android.hardware.biometrics.BiometricPrompt.Builder setTitle(@NonNull CharSequence);
+    method @NonNull public android.hardware.biometrics.BiometricPrompt build();
+    method @NonNull public android.hardware.biometrics.BiometricPrompt.Builder setConfirmationRequired(boolean);
+    method @NonNull public android.hardware.biometrics.BiometricPrompt.Builder setDescription(@NonNull CharSequence);
+    method @NonNull public android.hardware.biometrics.BiometricPrompt.Builder setDeviceCredentialAllowed(boolean);
+    method @NonNull public android.hardware.biometrics.BiometricPrompt.Builder setNegativeButton(@NonNull CharSequence, @NonNull java.util.concurrent.Executor, @NonNull android.content.DialogInterface.OnClickListener);
+    method @NonNull public android.hardware.biometrics.BiometricPrompt.Builder setSubtitle(@NonNull CharSequence);
+    method @NonNull public android.hardware.biometrics.BiometricPrompt.Builder setTitle(@NonNull CharSequence);
   }
 
   public static final class BiometricPrompt.CryptoObject {
@@ -16642,100 +16655,100 @@
     method public java.util.List<android.hardware.camera2.CaptureRequest.Key<?>> getAvailablePhysicalCameraRequestKeys();
     method public java.util.List<android.hardware.camera2.CaptureRequest.Key<?>> getAvailableSessionKeys();
     method @NonNull public java.util.List<android.hardware.camera2.CameraCharacteristics.Key<?>> getKeys();
-    method public java.util.List<android.hardware.camera2.CameraCharacteristics.Key<?>> getKeysNeedingPermission();
+    method @NonNull public java.util.List<android.hardware.camera2.CameraCharacteristics.Key<?>> getKeysNeedingPermission();
     method @NonNull public java.util.Set<java.lang.String> getPhysicalCameraIds();
     method @Nullable public android.hardware.camera2.params.RecommendedStreamConfigurationMap getRecommendedStreamConfigurationMap(int);
-    field public static final android.hardware.camera2.CameraCharacteristics.Key<int[]> COLOR_CORRECTION_AVAILABLE_ABERRATION_MODES;
-    field public static final android.hardware.camera2.CameraCharacteristics.Key<int[]> CONTROL_AE_AVAILABLE_ANTIBANDING_MODES;
-    field public static final android.hardware.camera2.CameraCharacteristics.Key<int[]> CONTROL_AE_AVAILABLE_MODES;
-    field public static final android.hardware.camera2.CameraCharacteristics.Key<android.util.Range<java.lang.Integer>[]> CONTROL_AE_AVAILABLE_TARGET_FPS_RANGES;
-    field public static final android.hardware.camera2.CameraCharacteristics.Key<android.util.Range<java.lang.Integer>> CONTROL_AE_COMPENSATION_RANGE;
-    field public static final android.hardware.camera2.CameraCharacteristics.Key<android.util.Rational> CONTROL_AE_COMPENSATION_STEP;
-    field public static final android.hardware.camera2.CameraCharacteristics.Key<java.lang.Boolean> CONTROL_AE_LOCK_AVAILABLE;
-    field public static final android.hardware.camera2.CameraCharacteristics.Key<int[]> CONTROL_AF_AVAILABLE_MODES;
-    field public static final android.hardware.camera2.CameraCharacteristics.Key<int[]> CONTROL_AVAILABLE_EFFECTS;
-    field public static final android.hardware.camera2.CameraCharacteristics.Key<int[]> CONTROL_AVAILABLE_MODES;
-    field public static final android.hardware.camera2.CameraCharacteristics.Key<int[]> CONTROL_AVAILABLE_SCENE_MODES;
-    field public static final android.hardware.camera2.CameraCharacteristics.Key<int[]> CONTROL_AVAILABLE_VIDEO_STABILIZATION_MODES;
-    field public static final android.hardware.camera2.CameraCharacteristics.Key<int[]> CONTROL_AWB_AVAILABLE_MODES;
-    field public static final android.hardware.camera2.CameraCharacteristics.Key<java.lang.Boolean> CONTROL_AWB_LOCK_AVAILABLE;
-    field public static final android.hardware.camera2.CameraCharacteristics.Key<java.lang.Integer> CONTROL_MAX_REGIONS_AE;
-    field public static final android.hardware.camera2.CameraCharacteristics.Key<java.lang.Integer> CONTROL_MAX_REGIONS_AF;
-    field public static final android.hardware.camera2.CameraCharacteristics.Key<java.lang.Integer> CONTROL_MAX_REGIONS_AWB;
-    field public static final android.hardware.camera2.CameraCharacteristics.Key<android.util.Range<java.lang.Integer>> CONTROL_POST_RAW_SENSITIVITY_BOOST_RANGE;
-    field public static final android.hardware.camera2.CameraCharacteristics.Key<java.lang.Boolean> DEPTH_DEPTH_IS_EXCLUSIVE;
-    field public static final android.hardware.camera2.CameraCharacteristics.Key<int[]> DISTORTION_CORRECTION_AVAILABLE_MODES;
-    field public static final android.hardware.camera2.CameraCharacteristics.Key<int[]> EDGE_AVAILABLE_EDGE_MODES;
-    field public static final android.hardware.camera2.CameraCharacteristics.Key<java.lang.Boolean> FLASH_INFO_AVAILABLE;
-    field public static final android.hardware.camera2.CameraCharacteristics.Key<int[]> HOT_PIXEL_AVAILABLE_HOT_PIXEL_MODES;
-    field public static final android.hardware.camera2.CameraCharacteristics.Key<java.lang.Integer> INFO_SUPPORTED_HARDWARE_LEVEL;
-    field public static final android.hardware.camera2.CameraCharacteristics.Key<java.lang.String> INFO_VERSION;
-    field public static final android.hardware.camera2.CameraCharacteristics.Key<android.util.Size[]> JPEG_AVAILABLE_THUMBNAIL_SIZES;
-    field public static final android.hardware.camera2.CameraCharacteristics.Key<float[]> LENS_DISTORTION;
-    field public static final android.hardware.camera2.CameraCharacteristics.Key<java.lang.Integer> LENS_FACING;
-    field public static final android.hardware.camera2.CameraCharacteristics.Key<float[]> LENS_INFO_AVAILABLE_APERTURES;
-    field public static final android.hardware.camera2.CameraCharacteristics.Key<float[]> LENS_INFO_AVAILABLE_FILTER_DENSITIES;
-    field public static final android.hardware.camera2.CameraCharacteristics.Key<float[]> LENS_INFO_AVAILABLE_FOCAL_LENGTHS;
-    field public static final android.hardware.camera2.CameraCharacteristics.Key<int[]> LENS_INFO_AVAILABLE_OPTICAL_STABILIZATION;
-    field public static final android.hardware.camera2.CameraCharacteristics.Key<java.lang.Integer> LENS_INFO_FOCUS_DISTANCE_CALIBRATION;
-    field public static final android.hardware.camera2.CameraCharacteristics.Key<java.lang.Float> LENS_INFO_HYPERFOCAL_DISTANCE;
-    field public static final android.hardware.camera2.CameraCharacteristics.Key<java.lang.Float> LENS_INFO_MINIMUM_FOCUS_DISTANCE;
-    field public static final android.hardware.camera2.CameraCharacteristics.Key<float[]> LENS_INTRINSIC_CALIBRATION;
-    field public static final android.hardware.camera2.CameraCharacteristics.Key<java.lang.Integer> LENS_POSE_REFERENCE;
-    field public static final android.hardware.camera2.CameraCharacteristics.Key<float[]> LENS_POSE_ROTATION;
-    field public static final android.hardware.camera2.CameraCharacteristics.Key<float[]> LENS_POSE_TRANSLATION;
-    field @Deprecated public static final android.hardware.camera2.CameraCharacteristics.Key<float[]> LENS_RADIAL_DISTORTION;
-    field public static final android.hardware.camera2.CameraCharacteristics.Key<java.lang.Integer> LOGICAL_MULTI_CAMERA_SENSOR_SYNC_TYPE;
-    field public static final android.hardware.camera2.CameraCharacteristics.Key<int[]> NOISE_REDUCTION_AVAILABLE_NOISE_REDUCTION_MODES;
-    field public static final android.hardware.camera2.CameraCharacteristics.Key<java.lang.Integer> REPROCESS_MAX_CAPTURE_STALL;
-    field public static final android.hardware.camera2.CameraCharacteristics.Key<int[]> REQUEST_AVAILABLE_CAPABILITIES;
-    field public static final android.hardware.camera2.CameraCharacteristics.Key<java.lang.Integer> REQUEST_MAX_NUM_INPUT_STREAMS;
-    field public static final android.hardware.camera2.CameraCharacteristics.Key<java.lang.Integer> REQUEST_MAX_NUM_OUTPUT_PROC;
-    field public static final android.hardware.camera2.CameraCharacteristics.Key<java.lang.Integer> REQUEST_MAX_NUM_OUTPUT_PROC_STALLING;
-    field public static final android.hardware.camera2.CameraCharacteristics.Key<java.lang.Integer> REQUEST_MAX_NUM_OUTPUT_RAW;
-    field public static final android.hardware.camera2.CameraCharacteristics.Key<java.lang.Integer> REQUEST_PARTIAL_RESULT_COUNT;
-    field public static final android.hardware.camera2.CameraCharacteristics.Key<java.lang.Byte> REQUEST_PIPELINE_MAX_DEPTH;
-    field public static final android.hardware.camera2.CameraCharacteristics.Key<java.lang.Float> SCALER_AVAILABLE_MAX_DIGITAL_ZOOM;
-    field public static final android.hardware.camera2.CameraCharacteristics.Key<java.lang.Integer> SCALER_CROPPING_TYPE;
-    field public static final android.hardware.camera2.CameraCharacteristics.Key<android.hardware.camera2.params.MandatoryStreamCombination[]> SCALER_MANDATORY_STREAM_COMBINATIONS;
-    field public static final android.hardware.camera2.CameraCharacteristics.Key<android.hardware.camera2.params.StreamConfigurationMap> SCALER_STREAM_CONFIGURATION_MAP;
-    field public static final android.hardware.camera2.CameraCharacteristics.Key<int[]> SENSOR_AVAILABLE_TEST_PATTERN_MODES;
-    field public static final android.hardware.camera2.CameraCharacteristics.Key<android.hardware.camera2.params.BlackLevelPattern> SENSOR_BLACK_LEVEL_PATTERN;
-    field public static final android.hardware.camera2.CameraCharacteristics.Key<android.hardware.camera2.params.ColorSpaceTransform> SENSOR_CALIBRATION_TRANSFORM1;
-    field public static final android.hardware.camera2.CameraCharacteristics.Key<android.hardware.camera2.params.ColorSpaceTransform> SENSOR_CALIBRATION_TRANSFORM2;
-    field public static final android.hardware.camera2.CameraCharacteristics.Key<android.hardware.camera2.params.ColorSpaceTransform> SENSOR_COLOR_TRANSFORM1;
-    field public static final android.hardware.camera2.CameraCharacteristics.Key<android.hardware.camera2.params.ColorSpaceTransform> SENSOR_COLOR_TRANSFORM2;
-    field public static final android.hardware.camera2.CameraCharacteristics.Key<android.hardware.camera2.params.ColorSpaceTransform> SENSOR_FORWARD_MATRIX1;
-    field public static final android.hardware.camera2.CameraCharacteristics.Key<android.hardware.camera2.params.ColorSpaceTransform> SENSOR_FORWARD_MATRIX2;
-    field public static final android.hardware.camera2.CameraCharacteristics.Key<android.graphics.Rect> SENSOR_INFO_ACTIVE_ARRAY_SIZE;
-    field public static final android.hardware.camera2.CameraCharacteristics.Key<java.lang.Integer> SENSOR_INFO_COLOR_FILTER_ARRANGEMENT;
-    field public static final android.hardware.camera2.CameraCharacteristics.Key<android.util.Range<java.lang.Long>> SENSOR_INFO_EXPOSURE_TIME_RANGE;
-    field public static final android.hardware.camera2.CameraCharacteristics.Key<java.lang.Boolean> SENSOR_INFO_LENS_SHADING_APPLIED;
-    field public static final android.hardware.camera2.CameraCharacteristics.Key<java.lang.Long> SENSOR_INFO_MAX_FRAME_DURATION;
-    field public static final android.hardware.camera2.CameraCharacteristics.Key<android.util.SizeF> SENSOR_INFO_PHYSICAL_SIZE;
-    field public static final android.hardware.camera2.CameraCharacteristics.Key<android.util.Size> SENSOR_INFO_PIXEL_ARRAY_SIZE;
-    field public static final android.hardware.camera2.CameraCharacteristics.Key<android.graphics.Rect> SENSOR_INFO_PRE_CORRECTION_ACTIVE_ARRAY_SIZE;
-    field public static final android.hardware.camera2.CameraCharacteristics.Key<android.util.Range<java.lang.Integer>> SENSOR_INFO_SENSITIVITY_RANGE;
-    field public static final android.hardware.camera2.CameraCharacteristics.Key<java.lang.Integer> SENSOR_INFO_TIMESTAMP_SOURCE;
-    field public static final android.hardware.camera2.CameraCharacteristics.Key<java.lang.Integer> SENSOR_INFO_WHITE_LEVEL;
-    field public static final android.hardware.camera2.CameraCharacteristics.Key<java.lang.Integer> SENSOR_MAX_ANALOG_SENSITIVITY;
-    field public static final android.hardware.camera2.CameraCharacteristics.Key<android.graphics.Rect[]> SENSOR_OPTICAL_BLACK_REGIONS;
-    field public static final android.hardware.camera2.CameraCharacteristics.Key<java.lang.Integer> SENSOR_ORIENTATION;
-    field public static final android.hardware.camera2.CameraCharacteristics.Key<java.lang.Integer> SENSOR_REFERENCE_ILLUMINANT1;
-    field public static final android.hardware.camera2.CameraCharacteristics.Key<java.lang.Byte> SENSOR_REFERENCE_ILLUMINANT2;
-    field public static final android.hardware.camera2.CameraCharacteristics.Key<int[]> SHADING_AVAILABLE_MODES;
-    field public static final android.hardware.camera2.CameraCharacteristics.Key<int[]> STATISTICS_INFO_AVAILABLE_FACE_DETECT_MODES;
-    field public static final android.hardware.camera2.CameraCharacteristics.Key<boolean[]> STATISTICS_INFO_AVAILABLE_HOT_PIXEL_MAP_MODES;
-    field public static final android.hardware.camera2.CameraCharacteristics.Key<int[]> STATISTICS_INFO_AVAILABLE_LENS_SHADING_MAP_MODES;
-    field public static final android.hardware.camera2.CameraCharacteristics.Key<int[]> STATISTICS_INFO_AVAILABLE_OIS_DATA_MODES;
-    field public static final android.hardware.camera2.CameraCharacteristics.Key<java.lang.Integer> STATISTICS_INFO_MAX_FACE_COUNT;
-    field public static final android.hardware.camera2.CameraCharacteristics.Key<java.lang.Integer> SYNC_MAX_LATENCY;
-    field public static final android.hardware.camera2.CameraCharacteristics.Key<int[]> TONEMAP_AVAILABLE_TONE_MAP_MODES;
-    field public static final android.hardware.camera2.CameraCharacteristics.Key<java.lang.Integer> TONEMAP_MAX_CURVE_POINTS;
+    field @NonNull public static final android.hardware.camera2.CameraCharacteristics.Key<int[]> COLOR_CORRECTION_AVAILABLE_ABERRATION_MODES;
+    field @NonNull public static final android.hardware.camera2.CameraCharacteristics.Key<int[]> CONTROL_AE_AVAILABLE_ANTIBANDING_MODES;
+    field @NonNull public static final android.hardware.camera2.CameraCharacteristics.Key<int[]> CONTROL_AE_AVAILABLE_MODES;
+    field @NonNull public static final android.hardware.camera2.CameraCharacteristics.Key<android.util.Range<java.lang.Integer>[]> CONTROL_AE_AVAILABLE_TARGET_FPS_RANGES;
+    field @NonNull public static final android.hardware.camera2.CameraCharacteristics.Key<android.util.Range<java.lang.Integer>> CONTROL_AE_COMPENSATION_RANGE;
+    field @NonNull public static final android.hardware.camera2.CameraCharacteristics.Key<android.util.Rational> CONTROL_AE_COMPENSATION_STEP;
+    field @NonNull public static final android.hardware.camera2.CameraCharacteristics.Key<java.lang.Boolean> CONTROL_AE_LOCK_AVAILABLE;
+    field @NonNull public static final android.hardware.camera2.CameraCharacteristics.Key<int[]> CONTROL_AF_AVAILABLE_MODES;
+    field @NonNull public static final android.hardware.camera2.CameraCharacteristics.Key<int[]> CONTROL_AVAILABLE_EFFECTS;
+    field @NonNull public static final android.hardware.camera2.CameraCharacteristics.Key<int[]> CONTROL_AVAILABLE_MODES;
+    field @NonNull public static final android.hardware.camera2.CameraCharacteristics.Key<int[]> CONTROL_AVAILABLE_SCENE_MODES;
+    field @NonNull public static final android.hardware.camera2.CameraCharacteristics.Key<int[]> CONTROL_AVAILABLE_VIDEO_STABILIZATION_MODES;
+    field @NonNull public static final android.hardware.camera2.CameraCharacteristics.Key<int[]> CONTROL_AWB_AVAILABLE_MODES;
+    field @NonNull public static final android.hardware.camera2.CameraCharacteristics.Key<java.lang.Boolean> CONTROL_AWB_LOCK_AVAILABLE;
+    field @NonNull public static final android.hardware.camera2.CameraCharacteristics.Key<java.lang.Integer> CONTROL_MAX_REGIONS_AE;
+    field @NonNull public static final android.hardware.camera2.CameraCharacteristics.Key<java.lang.Integer> CONTROL_MAX_REGIONS_AF;
+    field @NonNull public static final android.hardware.camera2.CameraCharacteristics.Key<java.lang.Integer> CONTROL_MAX_REGIONS_AWB;
+    field @NonNull public static final android.hardware.camera2.CameraCharacteristics.Key<android.util.Range<java.lang.Integer>> CONTROL_POST_RAW_SENSITIVITY_BOOST_RANGE;
+    field @NonNull public static final android.hardware.camera2.CameraCharacteristics.Key<java.lang.Boolean> DEPTH_DEPTH_IS_EXCLUSIVE;
+    field @NonNull public static final android.hardware.camera2.CameraCharacteristics.Key<int[]> DISTORTION_CORRECTION_AVAILABLE_MODES;
+    field @NonNull public static final android.hardware.camera2.CameraCharacteristics.Key<int[]> EDGE_AVAILABLE_EDGE_MODES;
+    field @NonNull public static final android.hardware.camera2.CameraCharacteristics.Key<java.lang.Boolean> FLASH_INFO_AVAILABLE;
+    field @NonNull public static final android.hardware.camera2.CameraCharacteristics.Key<int[]> HOT_PIXEL_AVAILABLE_HOT_PIXEL_MODES;
+    field @NonNull public static final android.hardware.camera2.CameraCharacteristics.Key<java.lang.Integer> INFO_SUPPORTED_HARDWARE_LEVEL;
+    field @NonNull public static final android.hardware.camera2.CameraCharacteristics.Key<java.lang.String> INFO_VERSION;
+    field @NonNull public static final android.hardware.camera2.CameraCharacteristics.Key<android.util.Size[]> JPEG_AVAILABLE_THUMBNAIL_SIZES;
+    field @NonNull public static final android.hardware.camera2.CameraCharacteristics.Key<float[]> LENS_DISTORTION;
+    field @NonNull public static final android.hardware.camera2.CameraCharacteristics.Key<java.lang.Integer> LENS_FACING;
+    field @NonNull public static final android.hardware.camera2.CameraCharacteristics.Key<float[]> LENS_INFO_AVAILABLE_APERTURES;
+    field @NonNull public static final android.hardware.camera2.CameraCharacteristics.Key<float[]> LENS_INFO_AVAILABLE_FILTER_DENSITIES;
+    field @NonNull public static final android.hardware.camera2.CameraCharacteristics.Key<float[]> LENS_INFO_AVAILABLE_FOCAL_LENGTHS;
+    field @NonNull public static final android.hardware.camera2.CameraCharacteristics.Key<int[]> LENS_INFO_AVAILABLE_OPTICAL_STABILIZATION;
+    field @NonNull public static final android.hardware.camera2.CameraCharacteristics.Key<java.lang.Integer> LENS_INFO_FOCUS_DISTANCE_CALIBRATION;
+    field @NonNull public static final android.hardware.camera2.CameraCharacteristics.Key<java.lang.Float> LENS_INFO_HYPERFOCAL_DISTANCE;
+    field @NonNull public static final android.hardware.camera2.CameraCharacteristics.Key<java.lang.Float> LENS_INFO_MINIMUM_FOCUS_DISTANCE;
+    field @NonNull public static final android.hardware.camera2.CameraCharacteristics.Key<float[]> LENS_INTRINSIC_CALIBRATION;
+    field @NonNull public static final android.hardware.camera2.CameraCharacteristics.Key<java.lang.Integer> LENS_POSE_REFERENCE;
+    field @NonNull public static final android.hardware.camera2.CameraCharacteristics.Key<float[]> LENS_POSE_ROTATION;
+    field @NonNull public static final android.hardware.camera2.CameraCharacteristics.Key<float[]> LENS_POSE_TRANSLATION;
+    field @Deprecated @NonNull public static final android.hardware.camera2.CameraCharacteristics.Key<float[]> LENS_RADIAL_DISTORTION;
+    field @NonNull public static final android.hardware.camera2.CameraCharacteristics.Key<java.lang.Integer> LOGICAL_MULTI_CAMERA_SENSOR_SYNC_TYPE;
+    field @NonNull public static final android.hardware.camera2.CameraCharacteristics.Key<int[]> NOISE_REDUCTION_AVAILABLE_NOISE_REDUCTION_MODES;
+    field @NonNull public static final android.hardware.camera2.CameraCharacteristics.Key<java.lang.Integer> REPROCESS_MAX_CAPTURE_STALL;
+    field @NonNull public static final android.hardware.camera2.CameraCharacteristics.Key<int[]> REQUEST_AVAILABLE_CAPABILITIES;
+    field @NonNull public static final android.hardware.camera2.CameraCharacteristics.Key<java.lang.Integer> REQUEST_MAX_NUM_INPUT_STREAMS;
+    field @NonNull public static final android.hardware.camera2.CameraCharacteristics.Key<java.lang.Integer> REQUEST_MAX_NUM_OUTPUT_PROC;
+    field @NonNull public static final android.hardware.camera2.CameraCharacteristics.Key<java.lang.Integer> REQUEST_MAX_NUM_OUTPUT_PROC_STALLING;
+    field @NonNull public static final android.hardware.camera2.CameraCharacteristics.Key<java.lang.Integer> REQUEST_MAX_NUM_OUTPUT_RAW;
+    field @NonNull public static final android.hardware.camera2.CameraCharacteristics.Key<java.lang.Integer> REQUEST_PARTIAL_RESULT_COUNT;
+    field @NonNull public static final android.hardware.camera2.CameraCharacteristics.Key<java.lang.Byte> REQUEST_PIPELINE_MAX_DEPTH;
+    field @NonNull public static final android.hardware.camera2.CameraCharacteristics.Key<java.lang.Float> SCALER_AVAILABLE_MAX_DIGITAL_ZOOM;
+    field @NonNull public static final android.hardware.camera2.CameraCharacteristics.Key<java.lang.Integer> SCALER_CROPPING_TYPE;
+    field @NonNull public static final android.hardware.camera2.CameraCharacteristics.Key<android.hardware.camera2.params.MandatoryStreamCombination[]> SCALER_MANDATORY_STREAM_COMBINATIONS;
+    field @NonNull public static final android.hardware.camera2.CameraCharacteristics.Key<android.hardware.camera2.params.StreamConfigurationMap> SCALER_STREAM_CONFIGURATION_MAP;
+    field @NonNull public static final android.hardware.camera2.CameraCharacteristics.Key<int[]> SENSOR_AVAILABLE_TEST_PATTERN_MODES;
+    field @NonNull public static final android.hardware.camera2.CameraCharacteristics.Key<android.hardware.camera2.params.BlackLevelPattern> SENSOR_BLACK_LEVEL_PATTERN;
+    field @NonNull public static final android.hardware.camera2.CameraCharacteristics.Key<android.hardware.camera2.params.ColorSpaceTransform> SENSOR_CALIBRATION_TRANSFORM1;
+    field @NonNull public static final android.hardware.camera2.CameraCharacteristics.Key<android.hardware.camera2.params.ColorSpaceTransform> SENSOR_CALIBRATION_TRANSFORM2;
+    field @NonNull public static final android.hardware.camera2.CameraCharacteristics.Key<android.hardware.camera2.params.ColorSpaceTransform> SENSOR_COLOR_TRANSFORM1;
+    field @NonNull public static final android.hardware.camera2.CameraCharacteristics.Key<android.hardware.camera2.params.ColorSpaceTransform> SENSOR_COLOR_TRANSFORM2;
+    field @NonNull public static final android.hardware.camera2.CameraCharacteristics.Key<android.hardware.camera2.params.ColorSpaceTransform> SENSOR_FORWARD_MATRIX1;
+    field @NonNull public static final android.hardware.camera2.CameraCharacteristics.Key<android.hardware.camera2.params.ColorSpaceTransform> SENSOR_FORWARD_MATRIX2;
+    field @NonNull public static final android.hardware.camera2.CameraCharacteristics.Key<android.graphics.Rect> SENSOR_INFO_ACTIVE_ARRAY_SIZE;
+    field @NonNull public static final android.hardware.camera2.CameraCharacteristics.Key<java.lang.Integer> SENSOR_INFO_COLOR_FILTER_ARRANGEMENT;
+    field @NonNull public static final android.hardware.camera2.CameraCharacteristics.Key<android.util.Range<java.lang.Long>> SENSOR_INFO_EXPOSURE_TIME_RANGE;
+    field @NonNull public static final android.hardware.camera2.CameraCharacteristics.Key<java.lang.Boolean> SENSOR_INFO_LENS_SHADING_APPLIED;
+    field @NonNull public static final android.hardware.camera2.CameraCharacteristics.Key<java.lang.Long> SENSOR_INFO_MAX_FRAME_DURATION;
+    field @NonNull public static final android.hardware.camera2.CameraCharacteristics.Key<android.util.SizeF> SENSOR_INFO_PHYSICAL_SIZE;
+    field @NonNull public static final android.hardware.camera2.CameraCharacteristics.Key<android.util.Size> SENSOR_INFO_PIXEL_ARRAY_SIZE;
+    field @NonNull public static final android.hardware.camera2.CameraCharacteristics.Key<android.graphics.Rect> SENSOR_INFO_PRE_CORRECTION_ACTIVE_ARRAY_SIZE;
+    field @NonNull public static final android.hardware.camera2.CameraCharacteristics.Key<android.util.Range<java.lang.Integer>> SENSOR_INFO_SENSITIVITY_RANGE;
+    field @NonNull public static final android.hardware.camera2.CameraCharacteristics.Key<java.lang.Integer> SENSOR_INFO_TIMESTAMP_SOURCE;
+    field @NonNull public static final android.hardware.camera2.CameraCharacteristics.Key<java.lang.Integer> SENSOR_INFO_WHITE_LEVEL;
+    field @NonNull public static final android.hardware.camera2.CameraCharacteristics.Key<java.lang.Integer> SENSOR_MAX_ANALOG_SENSITIVITY;
+    field @NonNull public static final android.hardware.camera2.CameraCharacteristics.Key<android.graphics.Rect[]> SENSOR_OPTICAL_BLACK_REGIONS;
+    field @NonNull public static final android.hardware.camera2.CameraCharacteristics.Key<java.lang.Integer> SENSOR_ORIENTATION;
+    field @NonNull public static final android.hardware.camera2.CameraCharacteristics.Key<java.lang.Integer> SENSOR_REFERENCE_ILLUMINANT1;
+    field @NonNull public static final android.hardware.camera2.CameraCharacteristics.Key<java.lang.Byte> SENSOR_REFERENCE_ILLUMINANT2;
+    field @NonNull public static final android.hardware.camera2.CameraCharacteristics.Key<int[]> SHADING_AVAILABLE_MODES;
+    field @NonNull public static final android.hardware.camera2.CameraCharacteristics.Key<int[]> STATISTICS_INFO_AVAILABLE_FACE_DETECT_MODES;
+    field @NonNull public static final android.hardware.camera2.CameraCharacteristics.Key<boolean[]> STATISTICS_INFO_AVAILABLE_HOT_PIXEL_MAP_MODES;
+    field @NonNull public static final android.hardware.camera2.CameraCharacteristics.Key<int[]> STATISTICS_INFO_AVAILABLE_LENS_SHADING_MAP_MODES;
+    field @NonNull public static final android.hardware.camera2.CameraCharacteristics.Key<int[]> STATISTICS_INFO_AVAILABLE_OIS_DATA_MODES;
+    field @NonNull public static final android.hardware.camera2.CameraCharacteristics.Key<java.lang.Integer> STATISTICS_INFO_MAX_FACE_COUNT;
+    field @NonNull public static final android.hardware.camera2.CameraCharacteristics.Key<java.lang.Integer> SYNC_MAX_LATENCY;
+    field @NonNull public static final android.hardware.camera2.CameraCharacteristics.Key<int[]> TONEMAP_AVAILABLE_TONE_MAP_MODES;
+    field @NonNull public static final android.hardware.camera2.CameraCharacteristics.Key<java.lang.Integer> TONEMAP_MAX_CURVE_POINTS;
   }
 
   public static final class CameraCharacteristics.Key<T> {
-    ctor public CameraCharacteristics.Key(String, Class<T>);
+    ctor public CameraCharacteristics.Key(@NonNull String, @NonNull Class<T>);
     method @NonNull public String getName();
   }
 
@@ -16794,6 +16807,7 @@
 
   public abstract static class CameraManager.AvailabilityCallback {
     ctor public CameraManager.AvailabilityCallback();
+    method public void onCameraAccessPrioritiesChanged();
     method public void onCameraAvailable(@NonNull String);
     method public void onCameraUnavailable(@NonNull String);
   }
@@ -17037,63 +17051,63 @@
     method @Nullable public Object getTag();
     method public boolean isReprocess();
     method public void writeToParcel(android.os.Parcel, int);
-    field public static final android.hardware.camera2.CaptureRequest.Key<java.lang.Boolean> BLACK_LEVEL_LOCK;
-    field public static final android.hardware.camera2.CaptureRequest.Key<java.lang.Integer> COLOR_CORRECTION_ABERRATION_MODE;
-    field public static final android.hardware.camera2.CaptureRequest.Key<android.hardware.camera2.params.RggbChannelVector> COLOR_CORRECTION_GAINS;
-    field public static final android.hardware.camera2.CaptureRequest.Key<java.lang.Integer> COLOR_CORRECTION_MODE;
-    field public static final android.hardware.camera2.CaptureRequest.Key<android.hardware.camera2.params.ColorSpaceTransform> COLOR_CORRECTION_TRANSFORM;
-    field public static final android.hardware.camera2.CaptureRequest.Key<java.lang.Integer> CONTROL_AE_ANTIBANDING_MODE;
-    field public static final android.hardware.camera2.CaptureRequest.Key<java.lang.Integer> CONTROL_AE_EXPOSURE_COMPENSATION;
-    field public static final android.hardware.camera2.CaptureRequest.Key<java.lang.Boolean> CONTROL_AE_LOCK;
-    field public static final android.hardware.camera2.CaptureRequest.Key<java.lang.Integer> CONTROL_AE_MODE;
-    field public static final android.hardware.camera2.CaptureRequest.Key<java.lang.Integer> CONTROL_AE_PRECAPTURE_TRIGGER;
-    field public static final android.hardware.camera2.CaptureRequest.Key<android.hardware.camera2.params.MeteringRectangle[]> CONTROL_AE_REGIONS;
-    field public static final android.hardware.camera2.CaptureRequest.Key<android.util.Range<java.lang.Integer>> CONTROL_AE_TARGET_FPS_RANGE;
-    field public static final android.hardware.camera2.CaptureRequest.Key<java.lang.Integer> CONTROL_AF_MODE;
-    field public static final android.hardware.camera2.CaptureRequest.Key<android.hardware.camera2.params.MeteringRectangle[]> CONTROL_AF_REGIONS;
-    field public static final android.hardware.camera2.CaptureRequest.Key<java.lang.Integer> CONTROL_AF_TRIGGER;
-    field public static final android.hardware.camera2.CaptureRequest.Key<java.lang.Boolean> CONTROL_AWB_LOCK;
-    field public static final android.hardware.camera2.CaptureRequest.Key<java.lang.Integer> CONTROL_AWB_MODE;
-    field public static final android.hardware.camera2.CaptureRequest.Key<android.hardware.camera2.params.MeteringRectangle[]> CONTROL_AWB_REGIONS;
-    field public static final android.hardware.camera2.CaptureRequest.Key<java.lang.Integer> CONTROL_CAPTURE_INTENT;
-    field public static final android.hardware.camera2.CaptureRequest.Key<java.lang.Integer> CONTROL_EFFECT_MODE;
-    field public static final android.hardware.camera2.CaptureRequest.Key<java.lang.Boolean> CONTROL_ENABLE_ZSL;
-    field public static final android.hardware.camera2.CaptureRequest.Key<java.lang.Integer> CONTROL_MODE;
-    field public static final android.hardware.camera2.CaptureRequest.Key<java.lang.Integer> CONTROL_POST_RAW_SENSITIVITY_BOOST;
-    field public static final android.hardware.camera2.CaptureRequest.Key<java.lang.Integer> CONTROL_SCENE_MODE;
-    field public static final android.hardware.camera2.CaptureRequest.Key<java.lang.Integer> CONTROL_VIDEO_STABILIZATION_MODE;
-    field public static final android.os.Parcelable.Creator<android.hardware.camera2.CaptureRequest> CREATOR;
-    field public static final android.hardware.camera2.CaptureRequest.Key<java.lang.Integer> DISTORTION_CORRECTION_MODE;
-    field public static final android.hardware.camera2.CaptureRequest.Key<java.lang.Integer> EDGE_MODE;
-    field public static final android.hardware.camera2.CaptureRequest.Key<java.lang.Integer> FLASH_MODE;
-    field public static final android.hardware.camera2.CaptureRequest.Key<java.lang.Integer> HOT_PIXEL_MODE;
-    field public static final android.hardware.camera2.CaptureRequest.Key<android.location.Location> JPEG_GPS_LOCATION;
-    field public static final android.hardware.camera2.CaptureRequest.Key<java.lang.Integer> JPEG_ORIENTATION;
-    field public static final android.hardware.camera2.CaptureRequest.Key<java.lang.Byte> JPEG_QUALITY;
-    field public static final android.hardware.camera2.CaptureRequest.Key<java.lang.Byte> JPEG_THUMBNAIL_QUALITY;
-    field public static final android.hardware.camera2.CaptureRequest.Key<android.util.Size> JPEG_THUMBNAIL_SIZE;
-    field public static final android.hardware.camera2.CaptureRequest.Key<java.lang.Float> LENS_APERTURE;
-    field public static final android.hardware.camera2.CaptureRequest.Key<java.lang.Float> LENS_FILTER_DENSITY;
-    field public static final android.hardware.camera2.CaptureRequest.Key<java.lang.Float> LENS_FOCAL_LENGTH;
-    field public static final android.hardware.camera2.CaptureRequest.Key<java.lang.Float> LENS_FOCUS_DISTANCE;
-    field public static final android.hardware.camera2.CaptureRequest.Key<java.lang.Integer> LENS_OPTICAL_STABILIZATION_MODE;
-    field public static final android.hardware.camera2.CaptureRequest.Key<java.lang.Integer> NOISE_REDUCTION_MODE;
-    field public static final android.hardware.camera2.CaptureRequest.Key<java.lang.Float> REPROCESS_EFFECTIVE_EXPOSURE_FACTOR;
-    field public static final android.hardware.camera2.CaptureRequest.Key<android.graphics.Rect> SCALER_CROP_REGION;
-    field public static final android.hardware.camera2.CaptureRequest.Key<java.lang.Long> SENSOR_EXPOSURE_TIME;
-    field public static final android.hardware.camera2.CaptureRequest.Key<java.lang.Long> SENSOR_FRAME_DURATION;
-    field public static final android.hardware.camera2.CaptureRequest.Key<java.lang.Integer> SENSOR_SENSITIVITY;
-    field public static final android.hardware.camera2.CaptureRequest.Key<int[]> SENSOR_TEST_PATTERN_DATA;
-    field public static final android.hardware.camera2.CaptureRequest.Key<java.lang.Integer> SENSOR_TEST_PATTERN_MODE;
-    field public static final android.hardware.camera2.CaptureRequest.Key<java.lang.Integer> SHADING_MODE;
-    field public static final android.hardware.camera2.CaptureRequest.Key<java.lang.Integer> STATISTICS_FACE_DETECT_MODE;
-    field public static final android.hardware.camera2.CaptureRequest.Key<java.lang.Boolean> STATISTICS_HOT_PIXEL_MAP_MODE;
-    field public static final android.hardware.camera2.CaptureRequest.Key<java.lang.Integer> STATISTICS_LENS_SHADING_MAP_MODE;
-    field public static final android.hardware.camera2.CaptureRequest.Key<java.lang.Integer> STATISTICS_OIS_DATA_MODE;
-    field public static final android.hardware.camera2.CaptureRequest.Key<android.hardware.camera2.params.TonemapCurve> TONEMAP_CURVE;
-    field public static final android.hardware.camera2.CaptureRequest.Key<java.lang.Float> TONEMAP_GAMMA;
-    field public static final android.hardware.camera2.CaptureRequest.Key<java.lang.Integer> TONEMAP_MODE;
-    field public static final android.hardware.camera2.CaptureRequest.Key<java.lang.Integer> TONEMAP_PRESET_CURVE;
+    field @NonNull public static final android.hardware.camera2.CaptureRequest.Key<java.lang.Boolean> BLACK_LEVEL_LOCK;
+    field @NonNull public static final android.hardware.camera2.CaptureRequest.Key<java.lang.Integer> COLOR_CORRECTION_ABERRATION_MODE;
+    field @NonNull public static final android.hardware.camera2.CaptureRequest.Key<android.hardware.camera2.params.RggbChannelVector> COLOR_CORRECTION_GAINS;
+    field @NonNull public static final android.hardware.camera2.CaptureRequest.Key<java.lang.Integer> COLOR_CORRECTION_MODE;
+    field @NonNull public static final android.hardware.camera2.CaptureRequest.Key<android.hardware.camera2.params.ColorSpaceTransform> COLOR_CORRECTION_TRANSFORM;
+    field @NonNull public static final android.hardware.camera2.CaptureRequest.Key<java.lang.Integer> CONTROL_AE_ANTIBANDING_MODE;
+    field @NonNull public static final android.hardware.camera2.CaptureRequest.Key<java.lang.Integer> CONTROL_AE_EXPOSURE_COMPENSATION;
+    field @NonNull public static final android.hardware.camera2.CaptureRequest.Key<java.lang.Boolean> CONTROL_AE_LOCK;
+    field @NonNull public static final android.hardware.camera2.CaptureRequest.Key<java.lang.Integer> CONTROL_AE_MODE;
+    field @NonNull public static final android.hardware.camera2.CaptureRequest.Key<java.lang.Integer> CONTROL_AE_PRECAPTURE_TRIGGER;
+    field @NonNull public static final android.hardware.camera2.CaptureRequest.Key<android.hardware.camera2.params.MeteringRectangle[]> CONTROL_AE_REGIONS;
+    field @NonNull public static final android.hardware.camera2.CaptureRequest.Key<android.util.Range<java.lang.Integer>> CONTROL_AE_TARGET_FPS_RANGE;
+    field @NonNull public static final android.hardware.camera2.CaptureRequest.Key<java.lang.Integer> CONTROL_AF_MODE;
+    field @NonNull public static final android.hardware.camera2.CaptureRequest.Key<android.hardware.camera2.params.MeteringRectangle[]> CONTROL_AF_REGIONS;
+    field @NonNull public static final android.hardware.camera2.CaptureRequest.Key<java.lang.Integer> CONTROL_AF_TRIGGER;
+    field @NonNull public static final android.hardware.camera2.CaptureRequest.Key<java.lang.Boolean> CONTROL_AWB_LOCK;
+    field @NonNull public static final android.hardware.camera2.CaptureRequest.Key<java.lang.Integer> CONTROL_AWB_MODE;
+    field @NonNull public static final android.hardware.camera2.CaptureRequest.Key<android.hardware.camera2.params.MeteringRectangle[]> CONTROL_AWB_REGIONS;
+    field @NonNull public static final android.hardware.camera2.CaptureRequest.Key<java.lang.Integer> CONTROL_CAPTURE_INTENT;
+    field @NonNull public static final android.hardware.camera2.CaptureRequest.Key<java.lang.Integer> CONTROL_EFFECT_MODE;
+    field @NonNull public static final android.hardware.camera2.CaptureRequest.Key<java.lang.Boolean> CONTROL_ENABLE_ZSL;
+    field @NonNull public static final android.hardware.camera2.CaptureRequest.Key<java.lang.Integer> CONTROL_MODE;
+    field @NonNull public static final android.hardware.camera2.CaptureRequest.Key<java.lang.Integer> CONTROL_POST_RAW_SENSITIVITY_BOOST;
+    field @NonNull public static final android.hardware.camera2.CaptureRequest.Key<java.lang.Integer> CONTROL_SCENE_MODE;
+    field @NonNull public static final android.hardware.camera2.CaptureRequest.Key<java.lang.Integer> CONTROL_VIDEO_STABILIZATION_MODE;
+    field @NonNull public static final android.os.Parcelable.Creator<android.hardware.camera2.CaptureRequest> CREATOR;
+    field @NonNull public static final android.hardware.camera2.CaptureRequest.Key<java.lang.Integer> DISTORTION_CORRECTION_MODE;
+    field @NonNull public static final android.hardware.camera2.CaptureRequest.Key<java.lang.Integer> EDGE_MODE;
+    field @NonNull public static final android.hardware.camera2.CaptureRequest.Key<java.lang.Integer> FLASH_MODE;
+    field @NonNull public static final android.hardware.camera2.CaptureRequest.Key<java.lang.Integer> HOT_PIXEL_MODE;
+    field @NonNull public static final android.hardware.camera2.CaptureRequest.Key<android.location.Location> JPEG_GPS_LOCATION;
+    field @NonNull public static final android.hardware.camera2.CaptureRequest.Key<java.lang.Integer> JPEG_ORIENTATION;
+    field @NonNull public static final android.hardware.camera2.CaptureRequest.Key<java.lang.Byte> JPEG_QUALITY;
+    field @NonNull public static final android.hardware.camera2.CaptureRequest.Key<java.lang.Byte> JPEG_THUMBNAIL_QUALITY;
+    field @NonNull public static final android.hardware.camera2.CaptureRequest.Key<android.util.Size> JPEG_THUMBNAIL_SIZE;
+    field @NonNull public static final android.hardware.camera2.CaptureRequest.Key<java.lang.Float> LENS_APERTURE;
+    field @NonNull public static final android.hardware.camera2.CaptureRequest.Key<java.lang.Float> LENS_FILTER_DENSITY;
+    field @NonNull public static final android.hardware.camera2.CaptureRequest.Key<java.lang.Float> LENS_FOCAL_LENGTH;
+    field @NonNull public static final android.hardware.camera2.CaptureRequest.Key<java.lang.Float> LENS_FOCUS_DISTANCE;
+    field @NonNull public static final android.hardware.camera2.CaptureRequest.Key<java.lang.Integer> LENS_OPTICAL_STABILIZATION_MODE;
+    field @NonNull public static final android.hardware.camera2.CaptureRequest.Key<java.lang.Integer> NOISE_REDUCTION_MODE;
+    field @NonNull public static final android.hardware.camera2.CaptureRequest.Key<java.lang.Float> REPROCESS_EFFECTIVE_EXPOSURE_FACTOR;
+    field @NonNull public static final android.hardware.camera2.CaptureRequest.Key<android.graphics.Rect> SCALER_CROP_REGION;
+    field @NonNull public static final android.hardware.camera2.CaptureRequest.Key<java.lang.Long> SENSOR_EXPOSURE_TIME;
+    field @NonNull public static final android.hardware.camera2.CaptureRequest.Key<java.lang.Long> SENSOR_FRAME_DURATION;
+    field @NonNull public static final android.hardware.camera2.CaptureRequest.Key<java.lang.Integer> SENSOR_SENSITIVITY;
+    field @NonNull public static final android.hardware.camera2.CaptureRequest.Key<int[]> SENSOR_TEST_PATTERN_DATA;
+    field @NonNull public static final android.hardware.camera2.CaptureRequest.Key<java.lang.Integer> SENSOR_TEST_PATTERN_MODE;
+    field @NonNull public static final android.hardware.camera2.CaptureRequest.Key<java.lang.Integer> SHADING_MODE;
+    field @NonNull public static final android.hardware.camera2.CaptureRequest.Key<java.lang.Integer> STATISTICS_FACE_DETECT_MODE;
+    field @NonNull public static final android.hardware.camera2.CaptureRequest.Key<java.lang.Boolean> STATISTICS_HOT_PIXEL_MAP_MODE;
+    field @NonNull public static final android.hardware.camera2.CaptureRequest.Key<java.lang.Integer> STATISTICS_LENS_SHADING_MAP_MODE;
+    field @NonNull public static final android.hardware.camera2.CaptureRequest.Key<java.lang.Integer> STATISTICS_OIS_DATA_MODE;
+    field @NonNull public static final android.hardware.camera2.CaptureRequest.Key<android.hardware.camera2.params.TonemapCurve> TONEMAP_CURVE;
+    field @NonNull public static final android.hardware.camera2.CaptureRequest.Key<java.lang.Float> TONEMAP_GAMMA;
+    field @NonNull public static final android.hardware.camera2.CaptureRequest.Key<java.lang.Integer> TONEMAP_MODE;
+    field @NonNull public static final android.hardware.camera2.CaptureRequest.Key<java.lang.Integer> TONEMAP_PRESET_CURVE;
   }
 
   public static final class CaptureRequest.Builder {
@@ -17108,7 +17122,7 @@
   }
 
   public static final class CaptureRequest.Key<T> {
-    ctor public CaptureRequest.Key(String, Class<T>);
+    ctor public CaptureRequest.Key(@NonNull String, @NonNull Class<T>);
     method @NonNull public String getName();
   }
 
@@ -17118,92 +17132,92 @@
     method @NonNull public java.util.List<android.hardware.camera2.CaptureResult.Key<?>> getKeys();
     method @NonNull public android.hardware.camera2.CaptureRequest getRequest();
     method public int getSequenceId();
-    field public static final android.hardware.camera2.CaptureResult.Key<java.lang.Boolean> BLACK_LEVEL_LOCK;
-    field public static final android.hardware.camera2.CaptureResult.Key<java.lang.Integer> COLOR_CORRECTION_ABERRATION_MODE;
-    field public static final android.hardware.camera2.CaptureResult.Key<android.hardware.camera2.params.RggbChannelVector> COLOR_CORRECTION_GAINS;
-    field public static final android.hardware.camera2.CaptureResult.Key<java.lang.Integer> COLOR_CORRECTION_MODE;
-    field public static final android.hardware.camera2.CaptureResult.Key<android.hardware.camera2.params.ColorSpaceTransform> COLOR_CORRECTION_TRANSFORM;
-    field public static final android.hardware.camera2.CaptureResult.Key<java.lang.Integer> CONTROL_AE_ANTIBANDING_MODE;
-    field public static final android.hardware.camera2.CaptureResult.Key<java.lang.Integer> CONTROL_AE_EXPOSURE_COMPENSATION;
-    field public static final android.hardware.camera2.CaptureResult.Key<java.lang.Boolean> CONTROL_AE_LOCK;
-    field public static final android.hardware.camera2.CaptureResult.Key<java.lang.Integer> CONTROL_AE_MODE;
-    field public static final android.hardware.camera2.CaptureResult.Key<java.lang.Integer> CONTROL_AE_PRECAPTURE_TRIGGER;
-    field public static final android.hardware.camera2.CaptureResult.Key<android.hardware.camera2.params.MeteringRectangle[]> CONTROL_AE_REGIONS;
-    field public static final android.hardware.camera2.CaptureResult.Key<java.lang.Integer> CONTROL_AE_STATE;
-    field public static final android.hardware.camera2.CaptureResult.Key<android.util.Range<java.lang.Integer>> CONTROL_AE_TARGET_FPS_RANGE;
-    field public static final android.hardware.camera2.CaptureResult.Key<java.lang.Integer> CONTROL_AF_MODE;
-    field public static final android.hardware.camera2.CaptureResult.Key<android.hardware.camera2.params.MeteringRectangle[]> CONTROL_AF_REGIONS;
-    field public static final android.hardware.camera2.CaptureResult.Key<java.lang.Integer> CONTROL_AF_SCENE_CHANGE;
-    field public static final android.hardware.camera2.CaptureResult.Key<java.lang.Integer> CONTROL_AF_STATE;
-    field public static final android.hardware.camera2.CaptureResult.Key<java.lang.Integer> CONTROL_AF_TRIGGER;
-    field public static final android.hardware.camera2.CaptureResult.Key<java.lang.Boolean> CONTROL_AWB_LOCK;
-    field public static final android.hardware.camera2.CaptureResult.Key<java.lang.Integer> CONTROL_AWB_MODE;
-    field public static final android.hardware.camera2.CaptureResult.Key<android.hardware.camera2.params.MeteringRectangle[]> CONTROL_AWB_REGIONS;
-    field public static final android.hardware.camera2.CaptureResult.Key<java.lang.Integer> CONTROL_AWB_STATE;
-    field public static final android.hardware.camera2.CaptureResult.Key<java.lang.Integer> CONTROL_CAPTURE_INTENT;
-    field public static final android.hardware.camera2.CaptureResult.Key<java.lang.Integer> CONTROL_EFFECT_MODE;
-    field public static final android.hardware.camera2.CaptureResult.Key<java.lang.Boolean> CONTROL_ENABLE_ZSL;
-    field public static final android.hardware.camera2.CaptureResult.Key<java.lang.Integer> CONTROL_MODE;
-    field public static final android.hardware.camera2.CaptureResult.Key<java.lang.Integer> CONTROL_POST_RAW_SENSITIVITY_BOOST;
-    field public static final android.hardware.camera2.CaptureResult.Key<java.lang.Integer> CONTROL_SCENE_MODE;
-    field public static final android.hardware.camera2.CaptureResult.Key<java.lang.Integer> CONTROL_VIDEO_STABILIZATION_MODE;
-    field public static final android.hardware.camera2.CaptureResult.Key<java.lang.Integer> DISTORTION_CORRECTION_MODE;
-    field public static final android.hardware.camera2.CaptureResult.Key<java.lang.Integer> EDGE_MODE;
-    field public static final android.hardware.camera2.CaptureResult.Key<java.lang.Integer> FLASH_MODE;
-    field public static final android.hardware.camera2.CaptureResult.Key<java.lang.Integer> FLASH_STATE;
-    field public static final android.hardware.camera2.CaptureResult.Key<java.lang.Integer> HOT_PIXEL_MODE;
-    field public static final android.hardware.camera2.CaptureResult.Key<android.location.Location> JPEG_GPS_LOCATION;
-    field public static final android.hardware.camera2.CaptureResult.Key<java.lang.Integer> JPEG_ORIENTATION;
-    field public static final android.hardware.camera2.CaptureResult.Key<java.lang.Byte> JPEG_QUALITY;
-    field public static final android.hardware.camera2.CaptureResult.Key<java.lang.Byte> JPEG_THUMBNAIL_QUALITY;
-    field public static final android.hardware.camera2.CaptureResult.Key<android.util.Size> JPEG_THUMBNAIL_SIZE;
-    field public static final android.hardware.camera2.CaptureResult.Key<java.lang.Float> LENS_APERTURE;
-    field public static final android.hardware.camera2.CaptureResult.Key<float[]> LENS_DISTORTION;
-    field public static final android.hardware.camera2.CaptureResult.Key<java.lang.Float> LENS_FILTER_DENSITY;
-    field public static final android.hardware.camera2.CaptureResult.Key<java.lang.Float> LENS_FOCAL_LENGTH;
-    field public static final android.hardware.camera2.CaptureResult.Key<java.lang.Float> LENS_FOCUS_DISTANCE;
-    field public static final android.hardware.camera2.CaptureResult.Key<android.util.Pair<java.lang.Float,java.lang.Float>> LENS_FOCUS_RANGE;
-    field public static final android.hardware.camera2.CaptureResult.Key<float[]> LENS_INTRINSIC_CALIBRATION;
-    field public static final android.hardware.camera2.CaptureResult.Key<java.lang.Integer> LENS_OPTICAL_STABILIZATION_MODE;
-    field public static final android.hardware.camera2.CaptureResult.Key<float[]> LENS_POSE_ROTATION;
-    field public static final android.hardware.camera2.CaptureResult.Key<float[]> LENS_POSE_TRANSLATION;
-    field @Deprecated public static final android.hardware.camera2.CaptureResult.Key<float[]> LENS_RADIAL_DISTORTION;
-    field public static final android.hardware.camera2.CaptureResult.Key<java.lang.Integer> LENS_STATE;
-    field public static final android.hardware.camera2.CaptureResult.Key<java.lang.String> LOGICAL_MULTI_CAMERA_ACTIVE_PHYSICAL_ID;
-    field public static final android.hardware.camera2.CaptureResult.Key<java.lang.Integer> NOISE_REDUCTION_MODE;
-    field public static final android.hardware.camera2.CaptureResult.Key<java.lang.Float> REPROCESS_EFFECTIVE_EXPOSURE_FACTOR;
-    field public static final android.hardware.camera2.CaptureResult.Key<java.lang.Byte> REQUEST_PIPELINE_DEPTH;
-    field public static final android.hardware.camera2.CaptureResult.Key<android.graphics.Rect> SCALER_CROP_REGION;
-    field public static final android.hardware.camera2.CaptureResult.Key<float[]> SENSOR_DYNAMIC_BLACK_LEVEL;
-    field public static final android.hardware.camera2.CaptureResult.Key<java.lang.Integer> SENSOR_DYNAMIC_WHITE_LEVEL;
-    field public static final android.hardware.camera2.CaptureResult.Key<java.lang.Long> SENSOR_EXPOSURE_TIME;
-    field public static final android.hardware.camera2.CaptureResult.Key<java.lang.Long> SENSOR_FRAME_DURATION;
-    field public static final android.hardware.camera2.CaptureResult.Key<java.lang.Float> SENSOR_GREEN_SPLIT;
-    field public static final android.hardware.camera2.CaptureResult.Key<android.util.Rational[]> SENSOR_NEUTRAL_COLOR_POINT;
-    field public static final android.hardware.camera2.CaptureResult.Key<android.util.Pair<java.lang.Double,java.lang.Double>[]> SENSOR_NOISE_PROFILE;
-    field public static final android.hardware.camera2.CaptureResult.Key<java.lang.Long> SENSOR_ROLLING_SHUTTER_SKEW;
-    field public static final android.hardware.camera2.CaptureResult.Key<java.lang.Integer> SENSOR_SENSITIVITY;
-    field public static final android.hardware.camera2.CaptureResult.Key<int[]> SENSOR_TEST_PATTERN_DATA;
-    field public static final android.hardware.camera2.CaptureResult.Key<java.lang.Integer> SENSOR_TEST_PATTERN_MODE;
-    field public static final android.hardware.camera2.CaptureResult.Key<java.lang.Long> SENSOR_TIMESTAMP;
-    field public static final android.hardware.camera2.CaptureResult.Key<java.lang.Integer> SHADING_MODE;
-    field public static final android.hardware.camera2.CaptureResult.Key<android.hardware.camera2.params.Face[]> STATISTICS_FACES;
-    field public static final android.hardware.camera2.CaptureResult.Key<java.lang.Integer> STATISTICS_FACE_DETECT_MODE;
-    field public static final android.hardware.camera2.CaptureResult.Key<android.graphics.Point[]> STATISTICS_HOT_PIXEL_MAP;
-    field public static final android.hardware.camera2.CaptureResult.Key<java.lang.Boolean> STATISTICS_HOT_PIXEL_MAP_MODE;
-    field public static final android.hardware.camera2.CaptureResult.Key<android.hardware.camera2.params.LensShadingMap> STATISTICS_LENS_SHADING_CORRECTION_MAP;
-    field public static final android.hardware.camera2.CaptureResult.Key<java.lang.Integer> STATISTICS_LENS_SHADING_MAP_MODE;
-    field public static final android.hardware.camera2.CaptureResult.Key<java.lang.Integer> STATISTICS_OIS_DATA_MODE;
-    field public static final android.hardware.camera2.CaptureResult.Key<android.hardware.camera2.params.OisSample[]> STATISTICS_OIS_SAMPLES;
-    field public static final android.hardware.camera2.CaptureResult.Key<java.lang.Integer> STATISTICS_SCENE_FLICKER;
-    field public static final android.hardware.camera2.CaptureResult.Key<android.hardware.camera2.params.TonemapCurve> TONEMAP_CURVE;
-    field public static final android.hardware.camera2.CaptureResult.Key<java.lang.Float> TONEMAP_GAMMA;
-    field public static final android.hardware.camera2.CaptureResult.Key<java.lang.Integer> TONEMAP_MODE;
-    field public static final android.hardware.camera2.CaptureResult.Key<java.lang.Integer> TONEMAP_PRESET_CURVE;
+    field @NonNull public static final android.hardware.camera2.CaptureResult.Key<java.lang.Boolean> BLACK_LEVEL_LOCK;
+    field @NonNull public static final android.hardware.camera2.CaptureResult.Key<java.lang.Integer> COLOR_CORRECTION_ABERRATION_MODE;
+    field @NonNull public static final android.hardware.camera2.CaptureResult.Key<android.hardware.camera2.params.RggbChannelVector> COLOR_CORRECTION_GAINS;
+    field @NonNull public static final android.hardware.camera2.CaptureResult.Key<java.lang.Integer> COLOR_CORRECTION_MODE;
+    field @NonNull public static final android.hardware.camera2.CaptureResult.Key<android.hardware.camera2.params.ColorSpaceTransform> COLOR_CORRECTION_TRANSFORM;
+    field @NonNull public static final android.hardware.camera2.CaptureResult.Key<java.lang.Integer> CONTROL_AE_ANTIBANDING_MODE;
+    field @NonNull public static final android.hardware.camera2.CaptureResult.Key<java.lang.Integer> CONTROL_AE_EXPOSURE_COMPENSATION;
+    field @NonNull public static final android.hardware.camera2.CaptureResult.Key<java.lang.Boolean> CONTROL_AE_LOCK;
+    field @NonNull public static final android.hardware.camera2.CaptureResult.Key<java.lang.Integer> CONTROL_AE_MODE;
+    field @NonNull public static final android.hardware.camera2.CaptureResult.Key<java.lang.Integer> CONTROL_AE_PRECAPTURE_TRIGGER;
+    field @NonNull public static final android.hardware.camera2.CaptureResult.Key<android.hardware.camera2.params.MeteringRectangle[]> CONTROL_AE_REGIONS;
+    field @NonNull public static final android.hardware.camera2.CaptureResult.Key<java.lang.Integer> CONTROL_AE_STATE;
+    field @NonNull public static final android.hardware.camera2.CaptureResult.Key<android.util.Range<java.lang.Integer>> CONTROL_AE_TARGET_FPS_RANGE;
+    field @NonNull public static final android.hardware.camera2.CaptureResult.Key<java.lang.Integer> CONTROL_AF_MODE;
+    field @NonNull public static final android.hardware.camera2.CaptureResult.Key<android.hardware.camera2.params.MeteringRectangle[]> CONTROL_AF_REGIONS;
+    field @NonNull public static final android.hardware.camera2.CaptureResult.Key<java.lang.Integer> CONTROL_AF_SCENE_CHANGE;
+    field @NonNull public static final android.hardware.camera2.CaptureResult.Key<java.lang.Integer> CONTROL_AF_STATE;
+    field @NonNull public static final android.hardware.camera2.CaptureResult.Key<java.lang.Integer> CONTROL_AF_TRIGGER;
+    field @NonNull public static final android.hardware.camera2.CaptureResult.Key<java.lang.Boolean> CONTROL_AWB_LOCK;
+    field @NonNull public static final android.hardware.camera2.CaptureResult.Key<java.lang.Integer> CONTROL_AWB_MODE;
+    field @NonNull public static final android.hardware.camera2.CaptureResult.Key<android.hardware.camera2.params.MeteringRectangle[]> CONTROL_AWB_REGIONS;
+    field @NonNull public static final android.hardware.camera2.CaptureResult.Key<java.lang.Integer> CONTROL_AWB_STATE;
+    field @NonNull public static final android.hardware.camera2.CaptureResult.Key<java.lang.Integer> CONTROL_CAPTURE_INTENT;
+    field @NonNull public static final android.hardware.camera2.CaptureResult.Key<java.lang.Integer> CONTROL_EFFECT_MODE;
+    field @NonNull public static final android.hardware.camera2.CaptureResult.Key<java.lang.Boolean> CONTROL_ENABLE_ZSL;
+    field @NonNull public static final android.hardware.camera2.CaptureResult.Key<java.lang.Integer> CONTROL_MODE;
+    field @NonNull public static final android.hardware.camera2.CaptureResult.Key<java.lang.Integer> CONTROL_POST_RAW_SENSITIVITY_BOOST;
+    field @NonNull public static final android.hardware.camera2.CaptureResult.Key<java.lang.Integer> CONTROL_SCENE_MODE;
+    field @NonNull public static final android.hardware.camera2.CaptureResult.Key<java.lang.Integer> CONTROL_VIDEO_STABILIZATION_MODE;
+    field @NonNull public static final android.hardware.camera2.CaptureResult.Key<java.lang.Integer> DISTORTION_CORRECTION_MODE;
+    field @NonNull public static final android.hardware.camera2.CaptureResult.Key<java.lang.Integer> EDGE_MODE;
+    field @NonNull public static final android.hardware.camera2.CaptureResult.Key<java.lang.Integer> FLASH_MODE;
+    field @NonNull public static final android.hardware.camera2.CaptureResult.Key<java.lang.Integer> FLASH_STATE;
+    field @NonNull public static final android.hardware.camera2.CaptureResult.Key<java.lang.Integer> HOT_PIXEL_MODE;
+    field @NonNull public static final android.hardware.camera2.CaptureResult.Key<android.location.Location> JPEG_GPS_LOCATION;
+    field @NonNull public static final android.hardware.camera2.CaptureResult.Key<java.lang.Integer> JPEG_ORIENTATION;
+    field @NonNull public static final android.hardware.camera2.CaptureResult.Key<java.lang.Byte> JPEG_QUALITY;
+    field @NonNull public static final android.hardware.camera2.CaptureResult.Key<java.lang.Byte> JPEG_THUMBNAIL_QUALITY;
+    field @NonNull public static final android.hardware.camera2.CaptureResult.Key<android.util.Size> JPEG_THUMBNAIL_SIZE;
+    field @NonNull public static final android.hardware.camera2.CaptureResult.Key<java.lang.Float> LENS_APERTURE;
+    field @NonNull public static final android.hardware.camera2.CaptureResult.Key<float[]> LENS_DISTORTION;
+    field @NonNull public static final android.hardware.camera2.CaptureResult.Key<java.lang.Float> LENS_FILTER_DENSITY;
+    field @NonNull public static final android.hardware.camera2.CaptureResult.Key<java.lang.Float> LENS_FOCAL_LENGTH;
+    field @NonNull public static final android.hardware.camera2.CaptureResult.Key<java.lang.Float> LENS_FOCUS_DISTANCE;
+    field @NonNull public static final android.hardware.camera2.CaptureResult.Key<android.util.Pair<java.lang.Float,java.lang.Float>> LENS_FOCUS_RANGE;
+    field @NonNull public static final android.hardware.camera2.CaptureResult.Key<float[]> LENS_INTRINSIC_CALIBRATION;
+    field @NonNull public static final android.hardware.camera2.CaptureResult.Key<java.lang.Integer> LENS_OPTICAL_STABILIZATION_MODE;
+    field @NonNull public static final android.hardware.camera2.CaptureResult.Key<float[]> LENS_POSE_ROTATION;
+    field @NonNull public static final android.hardware.camera2.CaptureResult.Key<float[]> LENS_POSE_TRANSLATION;
+    field @Deprecated @NonNull public static final android.hardware.camera2.CaptureResult.Key<float[]> LENS_RADIAL_DISTORTION;
+    field @NonNull public static final android.hardware.camera2.CaptureResult.Key<java.lang.Integer> LENS_STATE;
+    field @NonNull public static final android.hardware.camera2.CaptureResult.Key<java.lang.String> LOGICAL_MULTI_CAMERA_ACTIVE_PHYSICAL_ID;
+    field @NonNull public static final android.hardware.camera2.CaptureResult.Key<java.lang.Integer> NOISE_REDUCTION_MODE;
+    field @NonNull public static final android.hardware.camera2.CaptureResult.Key<java.lang.Float> REPROCESS_EFFECTIVE_EXPOSURE_FACTOR;
+    field @NonNull public static final android.hardware.camera2.CaptureResult.Key<java.lang.Byte> REQUEST_PIPELINE_DEPTH;
+    field @NonNull public static final android.hardware.camera2.CaptureResult.Key<android.graphics.Rect> SCALER_CROP_REGION;
+    field @NonNull public static final android.hardware.camera2.CaptureResult.Key<float[]> SENSOR_DYNAMIC_BLACK_LEVEL;
+    field @NonNull public static final android.hardware.camera2.CaptureResult.Key<java.lang.Integer> SENSOR_DYNAMIC_WHITE_LEVEL;
+    field @NonNull public static final android.hardware.camera2.CaptureResult.Key<java.lang.Long> SENSOR_EXPOSURE_TIME;
+    field @NonNull public static final android.hardware.camera2.CaptureResult.Key<java.lang.Long> SENSOR_FRAME_DURATION;
+    field @NonNull public static final android.hardware.camera2.CaptureResult.Key<java.lang.Float> SENSOR_GREEN_SPLIT;
+    field @NonNull public static final android.hardware.camera2.CaptureResult.Key<android.util.Rational[]> SENSOR_NEUTRAL_COLOR_POINT;
+    field @NonNull public static final android.hardware.camera2.CaptureResult.Key<android.util.Pair<java.lang.Double,java.lang.Double>[]> SENSOR_NOISE_PROFILE;
+    field @NonNull public static final android.hardware.camera2.CaptureResult.Key<java.lang.Long> SENSOR_ROLLING_SHUTTER_SKEW;
+    field @NonNull public static final android.hardware.camera2.CaptureResult.Key<java.lang.Integer> SENSOR_SENSITIVITY;
+    field @NonNull public static final android.hardware.camera2.CaptureResult.Key<int[]> SENSOR_TEST_PATTERN_DATA;
+    field @NonNull public static final android.hardware.camera2.CaptureResult.Key<java.lang.Integer> SENSOR_TEST_PATTERN_MODE;
+    field @NonNull public static final android.hardware.camera2.CaptureResult.Key<java.lang.Long> SENSOR_TIMESTAMP;
+    field @NonNull public static final android.hardware.camera2.CaptureResult.Key<java.lang.Integer> SHADING_MODE;
+    field @NonNull public static final android.hardware.camera2.CaptureResult.Key<android.hardware.camera2.params.Face[]> STATISTICS_FACES;
+    field @NonNull public static final android.hardware.camera2.CaptureResult.Key<java.lang.Integer> STATISTICS_FACE_DETECT_MODE;
+    field @NonNull public static final android.hardware.camera2.CaptureResult.Key<android.graphics.Point[]> STATISTICS_HOT_PIXEL_MAP;
+    field @NonNull public static final android.hardware.camera2.CaptureResult.Key<java.lang.Boolean> STATISTICS_HOT_PIXEL_MAP_MODE;
+    field @NonNull public static final android.hardware.camera2.CaptureResult.Key<android.hardware.camera2.params.LensShadingMap> STATISTICS_LENS_SHADING_CORRECTION_MAP;
+    field @NonNull public static final android.hardware.camera2.CaptureResult.Key<java.lang.Integer> STATISTICS_LENS_SHADING_MAP_MODE;
+    field @NonNull public static final android.hardware.camera2.CaptureResult.Key<java.lang.Integer> STATISTICS_OIS_DATA_MODE;
+    field @NonNull public static final android.hardware.camera2.CaptureResult.Key<android.hardware.camera2.params.OisSample[]> STATISTICS_OIS_SAMPLES;
+    field @NonNull public static final android.hardware.camera2.CaptureResult.Key<java.lang.Integer> STATISTICS_SCENE_FLICKER;
+    field @NonNull public static final android.hardware.camera2.CaptureResult.Key<android.hardware.camera2.params.TonemapCurve> TONEMAP_CURVE;
+    field @NonNull public static final android.hardware.camera2.CaptureResult.Key<java.lang.Float> TONEMAP_GAMMA;
+    field @NonNull public static final android.hardware.camera2.CaptureResult.Key<java.lang.Integer> TONEMAP_MODE;
+    field @NonNull public static final android.hardware.camera2.CaptureResult.Key<java.lang.Integer> TONEMAP_PRESET_CURVE;
   }
 
   public static final class CaptureResult.Key<T> {
-    ctor public CaptureResult.Key(String, Class<T>);
+    ctor public CaptureResult.Key(@NonNull String, @NonNull Class<T>);
     method @NonNull public String getName();
   }
 
@@ -17274,13 +17288,13 @@
   }
 
   public final class MandatoryStreamCombination {
-    method public String getDescription();
-    method public java.util.List<android.hardware.camera2.params.MandatoryStreamCombination.MandatoryStreamInformation> getStreamsInformation();
+    method @NonNull public CharSequence getDescription();
+    method @NonNull public java.util.List<android.hardware.camera2.params.MandatoryStreamCombination.MandatoryStreamInformation> getStreamsInformation();
     method public boolean isReprocessable();
   }
 
   public static final class MandatoryStreamCombination.MandatoryStreamInformation {
-    method public java.util.List<android.util.Size> getAvailableSizes();
+    method @NonNull public java.util.List<android.util.Size> getAvailableSizes();
     method public int getFormat();
     method public boolean isInput();
   }
@@ -17324,7 +17338,7 @@
     method public void removeSurface(@NonNull android.view.Surface);
     method public void setPhysicalCameraId(@Nullable String);
     method public void writeToParcel(android.os.Parcel, int);
-    field public static final android.os.Parcelable.Creator<android.hardware.camera2.params.OutputConfiguration> CREATOR;
+    field @NonNull public static final android.os.Parcelable.Creator<android.hardware.camera2.params.OutputConfiguration> CREATOR;
     field public static final int SURFACE_GROUP_ID_NONE = -1; // 0xffffffff
   }
 
@@ -17382,7 +17396,7 @@
     method public void setInputConfiguration(@NonNull android.hardware.camera2.params.InputConfiguration);
     method public void setSessionParameters(android.hardware.camera2.CaptureRequest);
     method public void writeToParcel(android.os.Parcel, int);
-    field public static final android.os.Parcelable.Creator<android.hardware.camera2.params.SessionConfiguration> CREATOR;
+    field @NonNull public static final android.os.Parcelable.Creator<android.hardware.camera2.params.SessionConfiguration> CREATOR;
     field public static final int SESSION_HIGH_SPEED = 1; // 0x1
     field public static final int SESSION_REGULAR = 0; // 0x0
   }
@@ -17542,7 +17556,7 @@
     method @Nullable public String getUri();
     method @Nullable public String getVersion();
     method public void writeToParcel(android.os.Parcel, int);
-    field public static final android.os.Parcelable.Creator<android.hardware.usb.UsbAccessory> CREATOR;
+    field @NonNull public static final android.os.Parcelable.Creator<android.hardware.usb.UsbAccessory> CREATOR;
   }
 
   public class UsbConfiguration implements android.os.Parcelable {
@@ -17555,7 +17569,7 @@
     method public boolean isRemoteWakeup();
     method public boolean isSelfPowered();
     method public void writeToParcel(android.os.Parcel, int);
-    field public static final android.os.Parcelable.Creator<android.hardware.usb.UsbConfiguration> CREATOR;
+    field @NonNull public static final android.os.Parcelable.Creator<android.hardware.usb.UsbConfiguration> CREATOR;
   }
 
   public final class UsbConstants {
@@ -17615,7 +17629,7 @@
     method public int getVendorId();
     method @NonNull public String getVersion();
     method public void writeToParcel(android.os.Parcel, int);
-    field public static final android.os.Parcelable.Creator<android.hardware.usb.UsbDevice> CREATOR;
+    field @NonNull public static final android.os.Parcelable.Creator<android.hardware.usb.UsbDevice> CREATOR;
   }
 
   public class UsbDeviceConnection {
@@ -17645,7 +17659,7 @@
     method public int getMaxPacketSize();
     method public int getType();
     method public void writeToParcel(android.os.Parcel, int);
-    field public static final android.os.Parcelable.Creator<android.hardware.usb.UsbEndpoint> CREATOR;
+    field @NonNull public static final android.os.Parcelable.Creator<android.hardware.usb.UsbEndpoint> CREATOR;
   }
 
   public class UsbInterface implements android.os.Parcelable {
@@ -17659,7 +17673,7 @@
     method public int getInterfaceSubclass();
     method @Nullable public String getName();
     method public void writeToParcel(android.os.Parcel, int);
-    field public static final android.os.Parcelable.Creator<android.hardware.usb.UsbInterface> CREATOR;
+    field @NonNull public static final android.os.Parcelable.Creator<android.hardware.usb.UsbInterface> CREATOR;
   }
 
   public class UsbManager {
@@ -22582,7 +22596,7 @@
     method public void setThoroughfare(String);
     method public void setUrl(String);
     method public void writeToParcel(android.os.Parcel, int);
-    field public static final android.os.Parcelable.Creator<android.location.Address> CREATOR;
+    field @NonNull public static final android.os.Parcelable.Creator<android.location.Address> CREATOR;
   }
 
   public class Criteria implements android.os.Parcelable {
@@ -22615,7 +22629,7 @@
     field public static final int ACCURACY_HIGH = 3; // 0x3
     field public static final int ACCURACY_LOW = 1; // 0x1
     field public static final int ACCURACY_MEDIUM = 2; // 0x2
-    field public static final android.os.Parcelable.Creator<android.location.Criteria> CREATOR;
+    field @NonNull public static final android.os.Parcelable.Creator<android.location.Criteria> CREATOR;
     field public static final int NO_REQUIREMENT = 0; // 0x0
     field public static final int POWER_HIGH = 3; // 0x3
     field public static final int POWER_LOW = 1; // 0x1
@@ -22650,7 +22664,7 @@
     method public boolean hasLeapSecond();
     method public boolean hasTimeUncertaintyNanos();
     method public void writeToParcel(android.os.Parcel, int);
-    field public static final android.os.Parcelable.Creator<android.location.GnssClock> CREATOR;
+    field @NonNull public static final android.os.Parcelable.Creator<android.location.GnssClock> CREATOR;
   }
 
   public final class GnssMeasurement implements android.os.Parcelable {
@@ -22706,7 +22720,7 @@
     field public static final int CODE_TYPE_X = 10; // 0xa
     field public static final int CODE_TYPE_Y = 11; // 0xb
     field public static final int CODE_TYPE_Z = 12; // 0xc
-    field public static final android.os.Parcelable.Creator<android.location.GnssMeasurement> CREATOR;
+    field @NonNull public static final android.os.Parcelable.Creator<android.location.GnssMeasurement> CREATOR;
     field public static final int MULTIPATH_INDICATOR_DETECTED = 1; // 0x1
     field public static final int MULTIPATH_INDICATOR_NOT_DETECTED = 2; // 0x2
     field public static final int MULTIPATH_INDICATOR_UNKNOWN = 0; // 0x0
@@ -22735,7 +22749,7 @@
     method @NonNull public android.location.GnssClock getClock();
     method @NonNull public java.util.Collection<android.location.GnssMeasurement> getMeasurements();
     method public void writeToParcel(android.os.Parcel, int);
-    field public static final android.os.Parcelable.Creator<android.location.GnssMeasurementsEvent> CREATOR;
+    field @NonNull public static final android.os.Parcelable.Creator<android.location.GnssMeasurementsEvent> CREATOR;
   }
 
   public abstract static class GnssMeasurementsEvent.Callback {
@@ -22757,7 +22771,7 @@
     method public int getSvid();
     method public int getType();
     method public void writeToParcel(android.os.Parcel, int);
-    field public static final android.os.Parcelable.Creator<android.location.GnssNavigationMessage> CREATOR;
+    field @NonNull public static final android.os.Parcelable.Creator<android.location.GnssNavigationMessage> CREATOR;
     field public static final int STATUS_PARITY_PASSED = 1; // 0x1
     field public static final int STATUS_PARITY_REBUILT = 2; // 0x2
     field public static final int STATUS_UNKNOWN = 0; // 0x0
@@ -22821,24 +22835,6 @@
     method @Deprecated public boolean usedInFix();
   }
 
-  @Deprecated public final class GpsStatus {
-    method @Deprecated public int getMaxSatellites();
-    method @Deprecated public Iterable<android.location.GpsSatellite> getSatellites();
-    method @Deprecated public int getTimeToFirstFix();
-    field @Deprecated public static final int GPS_EVENT_FIRST_FIX = 3; // 0x3
-    field @Deprecated public static final int GPS_EVENT_SATELLITE_STATUS = 4; // 0x4
-    field @Deprecated public static final int GPS_EVENT_STARTED = 1; // 0x1
-    field @Deprecated public static final int GPS_EVENT_STOPPED = 2; // 0x2
-  }
-
-  @Deprecated public static interface GpsStatus.Listener {
-    method @Deprecated public void onGpsStatusChanged(int);
-  }
-
-  @Deprecated public static interface GpsStatus.NmeaListener {
-    method @Deprecated public void onNmeaReceived(long, String);
-  }
-
   public class Location implements android.os.Parcelable {
     ctor public Location(String);
     ctor public Location(android.location.Location);
@@ -22854,6 +22850,7 @@
     method public float getBearing();
     method public float getBearingAccuracyDegrees();
     method public long getElapsedRealtimeNanos();
+    method public long getElapsedRealtimeUncertaintyNanos();
     method public android.os.Bundle getExtras();
     method public double getLatitude();
     method public double getLongitude();
@@ -22866,6 +22863,7 @@
     method public boolean hasAltitude();
     method public boolean hasBearing();
     method public boolean hasBearingAccuracy();
+    method public boolean hasElapsedRealtimeUncertaintyNanos();
     method public boolean hasSpeed();
     method public boolean hasSpeedAccuracy();
     method public boolean hasVerticalAccuracy();
@@ -22881,6 +22879,7 @@
     method public void setBearing(float);
     method public void setBearingAccuracyDegrees(float);
     method public void setElapsedRealtimeNanos(long);
+    method public void setElapsedRealtimeUncertaintyNanos(long);
     method public void setExtras(android.os.Bundle);
     method public void setLatitude(double);
     method public void setLongitude(double);
@@ -22890,7 +22889,7 @@
     method public void setTime(long);
     method public void setVerticalAccuracyMeters(float);
     method public void writeToParcel(android.os.Parcel, int);
-    field public static final android.os.Parcelable.Creator<android.location.Location> CREATOR;
+    field @NonNull public static final android.os.Parcelable.Creator<android.location.Location> CREATOR;
     field public static final int FORMAT_DEGREES = 0; // 0x0
     field public static final int FORMAT_MINUTES = 1; // 0x1
     field public static final int FORMAT_SECONDS = 2; // 0x2
@@ -22904,55 +22903,50 @@
   }
 
   public class LocationManager {
-    method @Deprecated @RequiresPermission(android.Manifest.permission.ACCESS_FINE_LOCATION) public boolean addGpsStatusListener(android.location.GpsStatus.Listener);
-    method @Deprecated @RequiresPermission(android.Manifest.permission.ACCESS_FINE_LOCATION) public boolean addNmeaListener(android.location.GpsStatus.NmeaListener);
-    method @RequiresPermission(android.Manifest.permission.ACCESS_FINE_LOCATION) public boolean addNmeaListener(android.location.OnNmeaMessageListener);
-    method @RequiresPermission(android.Manifest.permission.ACCESS_FINE_LOCATION) public boolean addNmeaListener(android.location.OnNmeaMessageListener, android.os.Handler);
-    method @RequiresPermission(anyOf={android.Manifest.permission.ACCESS_COARSE_LOCATION, android.Manifest.permission.ACCESS_FINE_LOCATION}) public void addProximityAlert(double, double, float, long, android.app.PendingIntent);
-    method public void addTestProvider(String, boolean, boolean, boolean, boolean, boolean, boolean, boolean, int, int);
-    method @Deprecated public void clearTestProviderEnabled(String);
-    method @Deprecated public void clearTestProviderLocation(String);
-    method @Deprecated public void clearTestProviderStatus(String);
-    method public java.util.List<java.lang.String> getAllProviders();
-    method public String getBestProvider(android.location.Criteria, boolean);
+    method @RequiresPermission(android.Manifest.permission.ACCESS_FINE_LOCATION) public boolean addNmeaListener(@NonNull android.location.OnNmeaMessageListener);
+    method @RequiresPermission(android.Manifest.permission.ACCESS_FINE_LOCATION) public boolean addNmeaListener(@NonNull android.location.OnNmeaMessageListener, @Nullable android.os.Handler);
+    method @RequiresPermission(anyOf={android.Manifest.permission.ACCESS_COARSE_LOCATION, android.Manifest.permission.ACCESS_FINE_LOCATION}) public void addProximityAlert(double, double, float, long, @NonNull android.app.PendingIntent);
+    method public void addTestProvider(@NonNull String, boolean, boolean, boolean, boolean, boolean, boolean, boolean, int, int);
+    method @Deprecated public void clearTestProviderEnabled(@NonNull String);
+    method @Deprecated public void clearTestProviderLocation(@NonNull String);
+    method @Deprecated public void clearTestProviderStatus(@NonNull String);
+    method @NonNull public java.util.List<java.lang.String> getAllProviders();
+    method @Nullable public String getBestProvider(@NonNull android.location.Criteria, boolean);
     method @Nullable public String getGnssHardwareModelName();
     method public int getGnssYearOfHardware();
-    method @Deprecated @RequiresPermission(android.Manifest.permission.ACCESS_FINE_LOCATION) public android.location.GpsStatus getGpsStatus(android.location.GpsStatus);
-    method @RequiresPermission(anyOf={android.Manifest.permission.ACCESS_COARSE_LOCATION, android.Manifest.permission.ACCESS_FINE_LOCATION}) public android.location.Location getLastKnownLocation(String);
-    method public android.location.LocationProvider getProvider(String);
-    method public java.util.List<java.lang.String> getProviders(boolean);
-    method public java.util.List<java.lang.String> getProviders(android.location.Criteria, boolean);
+    method @RequiresPermission(anyOf={android.Manifest.permission.ACCESS_COARSE_LOCATION, android.Manifest.permission.ACCESS_FINE_LOCATION}) @Nullable public android.location.Location getLastKnownLocation(@NonNull String);
+    method @Nullable public android.location.LocationProvider getProvider(@NonNull String);
+    method @NonNull public java.util.List<java.lang.String> getProviders(boolean);
+    method @NonNull public java.util.List<java.lang.String> getProviders(@NonNull android.location.Criteria, boolean);
     method public boolean isLocationEnabled();
-    method public boolean isProviderEnabled(String);
-    method @RequiresPermission(android.Manifest.permission.ACCESS_FINE_LOCATION) public boolean registerGnssMeasurementsCallback(android.location.GnssMeasurementsEvent.Callback);
-    method @RequiresPermission(android.Manifest.permission.ACCESS_FINE_LOCATION) public boolean registerGnssMeasurementsCallback(android.location.GnssMeasurementsEvent.Callback, android.os.Handler);
-    method public boolean registerGnssNavigationMessageCallback(android.location.GnssNavigationMessage.Callback);
-    method @RequiresPermission(android.Manifest.permission.ACCESS_FINE_LOCATION) public boolean registerGnssNavigationMessageCallback(android.location.GnssNavigationMessage.Callback, android.os.Handler);
-    method @RequiresPermission(android.Manifest.permission.ACCESS_FINE_LOCATION) public boolean registerGnssStatusCallback(android.location.GnssStatus.Callback);
-    method @RequiresPermission(android.Manifest.permission.ACCESS_FINE_LOCATION) public boolean registerGnssStatusCallback(android.location.GnssStatus.Callback, android.os.Handler);
-    method @Deprecated public void removeGpsStatusListener(android.location.GpsStatus.Listener);
-    method @Deprecated public void removeNmeaListener(android.location.GpsStatus.NmeaListener);
-    method public void removeNmeaListener(android.location.OnNmeaMessageListener);
-    method @RequiresPermission(anyOf={"android.permission.ACCESS_COARSE_LOCATION", "android.permission.ACCESS_FINE_LOCATION"}, apis="..22") public void removeProximityAlert(android.app.PendingIntent);
-    method public void removeTestProvider(String);
-    method @RequiresPermission(anyOf={"android.permission.ACCESS_COARSE_LOCATION", "android.permission.ACCESS_FINE_LOCATION"}, apis="..22") public void removeUpdates(android.location.LocationListener);
-    method public void removeUpdates(android.app.PendingIntent);
-    method @RequiresPermission(anyOf={android.Manifest.permission.ACCESS_COARSE_LOCATION, android.Manifest.permission.ACCESS_FINE_LOCATION}) public void requestLocationUpdates(String, long, float, android.location.LocationListener);
-    method @RequiresPermission(anyOf={android.Manifest.permission.ACCESS_COARSE_LOCATION, android.Manifest.permission.ACCESS_FINE_LOCATION}) public void requestLocationUpdates(String, long, float, android.location.LocationListener, android.os.Looper);
-    method @RequiresPermission(anyOf={android.Manifest.permission.ACCESS_COARSE_LOCATION, android.Manifest.permission.ACCESS_FINE_LOCATION}) public void requestLocationUpdates(long, float, android.location.Criteria, android.location.LocationListener, android.os.Looper);
-    method @RequiresPermission(anyOf={android.Manifest.permission.ACCESS_COARSE_LOCATION, android.Manifest.permission.ACCESS_FINE_LOCATION}) public void requestLocationUpdates(String, long, float, android.app.PendingIntent);
-    method @RequiresPermission(anyOf={android.Manifest.permission.ACCESS_COARSE_LOCATION, android.Manifest.permission.ACCESS_FINE_LOCATION}) public void requestLocationUpdates(long, float, android.location.Criteria, android.app.PendingIntent);
-    method @RequiresPermission(anyOf={android.Manifest.permission.ACCESS_COARSE_LOCATION, android.Manifest.permission.ACCESS_FINE_LOCATION}) public void requestSingleUpdate(String, android.location.LocationListener, android.os.Looper);
-    method @RequiresPermission(anyOf={android.Manifest.permission.ACCESS_COARSE_LOCATION, android.Manifest.permission.ACCESS_FINE_LOCATION}) public void requestSingleUpdate(android.location.Criteria, android.location.LocationListener, android.os.Looper);
-    method @RequiresPermission(anyOf={android.Manifest.permission.ACCESS_COARSE_LOCATION, android.Manifest.permission.ACCESS_FINE_LOCATION}) public void requestSingleUpdate(String, android.app.PendingIntent);
-    method @RequiresPermission(anyOf={android.Manifest.permission.ACCESS_COARSE_LOCATION, android.Manifest.permission.ACCESS_FINE_LOCATION}) public void requestSingleUpdate(android.location.Criteria, android.app.PendingIntent);
-    method public boolean sendExtraCommand(String, String, android.os.Bundle);
-    method public void setTestProviderEnabled(String, boolean);
-    method public void setTestProviderLocation(String, android.location.Location);
-    method @Deprecated public void setTestProviderStatus(String, int, android.os.Bundle, long);
-    method public void unregisterGnssMeasurementsCallback(android.location.GnssMeasurementsEvent.Callback);
-    method public void unregisterGnssNavigationMessageCallback(android.location.GnssNavigationMessage.Callback);
-    method public void unregisterGnssStatusCallback(android.location.GnssStatus.Callback);
+    method public boolean isProviderEnabled(@NonNull String);
+    method @RequiresPermission(android.Manifest.permission.ACCESS_FINE_LOCATION) public boolean registerGnssMeasurementsCallback(@NonNull android.location.GnssMeasurementsEvent.Callback);
+    method @RequiresPermission(android.Manifest.permission.ACCESS_FINE_LOCATION) public boolean registerGnssMeasurementsCallback(@NonNull android.location.GnssMeasurementsEvent.Callback, @Nullable android.os.Handler);
+    method public boolean registerGnssNavigationMessageCallback(@NonNull android.location.GnssNavigationMessage.Callback);
+    method @RequiresPermission(android.Manifest.permission.ACCESS_FINE_LOCATION) public boolean registerGnssNavigationMessageCallback(@NonNull android.location.GnssNavigationMessage.Callback, @Nullable android.os.Handler);
+    method @RequiresPermission(android.Manifest.permission.ACCESS_FINE_LOCATION) public boolean registerGnssStatusCallback(@NonNull android.location.GnssStatus.Callback);
+    method @RequiresPermission(android.Manifest.permission.ACCESS_FINE_LOCATION) public boolean registerGnssStatusCallback(@NonNull android.location.GnssStatus.Callback, @Nullable android.os.Handler);
+    method public void removeNmeaListener(@NonNull android.location.OnNmeaMessageListener);
+    method @RequiresPermission(anyOf={"android.permission.ACCESS_COARSE_LOCATION", "android.permission.ACCESS_FINE_LOCATION"}, apis="..22") public void removeProximityAlert(@NonNull android.app.PendingIntent);
+    method public void removeTestProvider(@NonNull String);
+    method @RequiresPermission(anyOf={"android.permission.ACCESS_COARSE_LOCATION", "android.permission.ACCESS_FINE_LOCATION"}, apis="..22") public void removeUpdates(@NonNull android.location.LocationListener);
+    method public void removeUpdates(@NonNull android.app.PendingIntent);
+    method @RequiresPermission(anyOf={android.Manifest.permission.ACCESS_COARSE_LOCATION, android.Manifest.permission.ACCESS_FINE_LOCATION}) public void requestLocationUpdates(@NonNull String, long, float, @NonNull android.location.LocationListener);
+    method @RequiresPermission(anyOf={android.Manifest.permission.ACCESS_COARSE_LOCATION, android.Manifest.permission.ACCESS_FINE_LOCATION}) public void requestLocationUpdates(@NonNull String, long, float, @NonNull android.location.LocationListener, @Nullable android.os.Looper);
+    method @RequiresPermission(anyOf={android.Manifest.permission.ACCESS_COARSE_LOCATION, android.Manifest.permission.ACCESS_FINE_LOCATION}) public void requestLocationUpdates(long, float, @NonNull android.location.Criteria, @NonNull android.location.LocationListener, @Nullable android.os.Looper);
+    method @RequiresPermission(anyOf={android.Manifest.permission.ACCESS_COARSE_LOCATION, android.Manifest.permission.ACCESS_FINE_LOCATION}) public void requestLocationUpdates(@NonNull String, long, float, @NonNull android.app.PendingIntent);
+    method @RequiresPermission(anyOf={android.Manifest.permission.ACCESS_COARSE_LOCATION, android.Manifest.permission.ACCESS_FINE_LOCATION}) public void requestLocationUpdates(long, float, @NonNull android.location.Criteria, @NonNull android.app.PendingIntent);
+    method @RequiresPermission(anyOf={android.Manifest.permission.ACCESS_COARSE_LOCATION, android.Manifest.permission.ACCESS_FINE_LOCATION}) public void requestSingleUpdate(@NonNull String, @NonNull android.location.LocationListener, @Nullable android.os.Looper);
+    method @RequiresPermission(anyOf={android.Manifest.permission.ACCESS_COARSE_LOCATION, android.Manifest.permission.ACCESS_FINE_LOCATION}) public void requestSingleUpdate(@NonNull android.location.Criteria, @NonNull android.location.LocationListener, @Nullable android.os.Looper);
+    method @RequiresPermission(anyOf={android.Manifest.permission.ACCESS_COARSE_LOCATION, android.Manifest.permission.ACCESS_FINE_LOCATION}) public void requestSingleUpdate(@NonNull String, @NonNull android.app.PendingIntent);
+    method @RequiresPermission(anyOf={android.Manifest.permission.ACCESS_COARSE_LOCATION, android.Manifest.permission.ACCESS_FINE_LOCATION}) public void requestSingleUpdate(@NonNull android.location.Criteria, @NonNull android.app.PendingIntent);
+    method public boolean sendExtraCommand(@NonNull String, @NonNull String, @Nullable android.os.Bundle);
+    method public void setTestProviderEnabled(@NonNull String, boolean);
+    method public void setTestProviderLocation(@NonNull String, @NonNull android.location.Location);
+    method @Deprecated public void setTestProviderStatus(@NonNull String, int, @Nullable android.os.Bundle, long);
+    method public void unregisterGnssMeasurementsCallback(@NonNull android.location.GnssMeasurementsEvent.Callback);
+    method public void unregisterGnssNavigationMessageCallback(@NonNull android.location.GnssNavigationMessage.Callback);
+    method public void unregisterGnssStatusCallback(@NonNull android.location.GnssStatus.Callback);
     field public static final String GPS_PROVIDER = "gps";
     field public static final String KEY_LOCATION_CHANGED = "location";
     field public static final String KEY_PROVIDER_ENABLED = "providerEnabled";
@@ -23011,6 +23005,7 @@
   }
 
   public final class AudioAttributes implements android.os.Parcelable {
+    method public boolean areHapticChannelsMuted();
     method public int describeContents();
     method public int getContentType();
     method public int getFlags();
@@ -23022,7 +23017,7 @@
     field public static final int CONTENT_TYPE_SONIFICATION = 4; // 0x4
     field public static final int CONTENT_TYPE_SPEECH = 1; // 0x1
     field public static final int CONTENT_TYPE_UNKNOWN = 0; // 0x0
-    field public static final android.os.Parcelable.Creator<android.media.AudioAttributes> CREATOR;
+    field @NonNull public static final android.os.Parcelable.Creator<android.media.AudioAttributes> CREATOR;
     field public static final int FLAG_AUDIBILITY_ENFORCED = 1; // 0x1
     field public static final int FLAG_HW_AV_SYNC = 16; // 0x10
     field @Deprecated public static final int FLAG_LOW_LATENCY = 256; // 0x100
@@ -23048,10 +23043,11 @@
     ctor public AudioAttributes.Builder();
     ctor public AudioAttributes.Builder(android.media.AudioAttributes);
     method public android.media.AudioAttributes build();
-    method public android.media.AudioAttributes.Builder setAllowCapture(boolean);
+    method @NonNull public android.media.AudioAttributes.Builder setAllowCapture(boolean);
     method public android.media.AudioAttributes.Builder setContentType(int);
     method public android.media.AudioAttributes.Builder setFlags(int);
     method public android.media.AudioAttributes.Builder setLegacyStreamType(int);
+    method public android.media.AudioAttributes.Builder setMuteHapticChannels(boolean);
     method public android.media.AudioAttributes.Builder setUsage(int);
   }
 
@@ -23169,7 +23165,7 @@
     field public static final int CHANNEL_OUT_SIDE_RIGHT = 4096; // 0x1000
     field public static final int CHANNEL_OUT_STEREO = 12; // 0xc
     field public static final int CHANNEL_OUT_SURROUND = 1052; // 0x41c
-    field public static final android.os.Parcelable.Creator<android.media.AudioFormat> CREATOR;
+    field @NonNull public static final android.os.Parcelable.Creator<android.media.AudioFormat> CREATOR;
     field public static final int ENCODING_AAC_ELD = 15; // 0xf
     field public static final int ENCODING_AAC_HE_V1 = 11; // 0xb
     field public static final int ENCODING_AAC_HE_V2 = 12; // 0xc
@@ -23387,18 +23383,18 @@
 
   public static final class AudioPlaybackCaptureConfiguration.Builder {
     ctor public AudioPlaybackCaptureConfiguration.Builder(@NonNull android.media.projection.MediaProjection);
-    method public android.media.AudioPlaybackCaptureConfiguration.Builder addMatchingUid(int);
-    method public android.media.AudioPlaybackCaptureConfiguration.Builder addMatchingUsage(@NonNull android.media.AudioAttributes);
-    method public android.media.AudioPlaybackCaptureConfiguration build();
-    method public android.media.AudioPlaybackCaptureConfiguration.Builder excludeUid(int);
-    method public android.media.AudioPlaybackCaptureConfiguration.Builder excludeUsage(@NonNull android.media.AudioAttributes);
+    method @NonNull public android.media.AudioPlaybackCaptureConfiguration.Builder addMatchingUid(int);
+    method @NonNull public android.media.AudioPlaybackCaptureConfiguration.Builder addMatchingUsage(@NonNull android.media.AudioAttributes);
+    method @NonNull public android.media.AudioPlaybackCaptureConfiguration build();
+    method @NonNull public android.media.AudioPlaybackCaptureConfiguration.Builder excludeUid(int);
+    method @NonNull public android.media.AudioPlaybackCaptureConfiguration.Builder excludeUsage(@NonNull android.media.AudioAttributes);
   }
 
   public final class AudioPlaybackConfiguration implements android.os.Parcelable {
     method public int describeContents();
     method public android.media.AudioAttributes getAudioAttributes();
     method public void writeToParcel(android.os.Parcel, int);
-    field public static final android.os.Parcelable.Creator<android.media.AudioPlaybackConfiguration> CREATOR;
+    field @NonNull public static final android.os.Parcelable.Creator<android.media.AudioPlaybackConfiguration> CREATOR;
   }
 
   public final class AudioPresentation {
@@ -23417,14 +23413,14 @@
     field public static final int MASTERING_NOT_INDICATED = 0; // 0x0
   }
 
-  public static class AudioPresentation.Builder {
+  public static final class AudioPresentation.Builder {
     ctor public AudioPresentation.Builder(int);
     method @NonNull public android.media.AudioPresentation build();
     method @NonNull public android.media.AudioPresentation.Builder setHasAudioDescription(boolean);
     method @NonNull public android.media.AudioPresentation.Builder setHasDialogueEnhancement(boolean);
     method @NonNull public android.media.AudioPresentation.Builder setHasSpokenSubtitles(boolean);
-    method @NonNull public android.media.AudioPresentation.Builder setLabels(@NonNull java.util.Map<android.icu.util.ULocale,java.lang.String>);
-    method @NonNull public android.media.AudioPresentation.Builder setLocale(android.icu.util.ULocale);
+    method @NonNull public android.media.AudioPresentation.Builder setLabels(@NonNull java.util.Map<android.icu.util.ULocale,java.lang.CharSequence>);
+    method @NonNull public android.media.AudioPresentation.Builder setLocale(@NonNull android.icu.util.ULocale);
     method @NonNull public android.media.AudioPresentation.Builder setMasteringIndication(int);
     method @NonNull public android.media.AudioPresentation.Builder setProgramId(int);
   }
@@ -23492,7 +23488,7 @@
     ctor public AudioRecord.Builder();
     method public android.media.AudioRecord build() throws java.lang.UnsupportedOperationException;
     method public android.media.AudioRecord.Builder setAudioFormat(@NonNull android.media.AudioFormat) throws java.lang.IllegalArgumentException;
-    method public android.media.AudioRecord.Builder setAudioPlaybackCaptureConfig(@NonNull android.media.AudioPlaybackCaptureConfiguration);
+    method @NonNull public android.media.AudioRecord.Builder setAudioPlaybackCaptureConfig(@NonNull android.media.AudioPlaybackCaptureConfiguration);
     method public android.media.AudioRecord.Builder setAudioSource(int) throws java.lang.IllegalArgumentException;
     method public android.media.AudioRecord.Builder setBufferSizeInBytes(int) throws java.lang.IllegalArgumentException;
   }
@@ -23500,7 +23496,7 @@
   public static final class AudioRecord.MetricsConstants {
     field public static final String CHANNELS = "android.media.audiorecord.channels";
     field public static final String ENCODING = "android.media.audiorecord.encoding";
-    field public static final String LATENCY = "android.media.audiorecord.latency";
+    field @Deprecated public static final String LATENCY = "android.media.audiorecord.latency";
     field public static final String SAMPLERATE = "android.media.audiorecord.samplerate";
     field public static final String SOURCE = "android.media.audiorecord.source";
   }
@@ -23527,7 +23523,7 @@
     method public android.media.AudioFormat getFormat();
     method public boolean isClientSilenced();
     method public void writeToParcel(android.os.Parcel, int);
-    field public static final android.os.Parcelable.Creator<android.media.AudioRecordingConfiguration> CREATOR;
+    field @NonNull public static final android.os.Parcelable.Creator<android.media.AudioRecordingConfiguration> CREATOR;
   }
 
   public interface AudioRecordingMonitor {
@@ -23564,14 +23560,13 @@
     method @Deprecated public void addOnRoutingChangedListener(android.media.AudioTrack.OnRoutingChangedListener, android.os.Handler);
     method public int attachAuxEffect(int);
     method @NonNull public android.media.VolumeShaper createVolumeShaper(@NonNull android.media.VolumeShaper.Configuration);
-    method public static void deprecateStreamTypeForPlayback(int, String, String) throws java.lang.IllegalArgumentException;
     method protected void finalize();
     method public void flush();
     method @NonNull public android.media.AudioAttributes getAudioAttributes();
     method public int getAudioFormat();
     method public int getAudioSessionId();
-    method public int getBufferCapacityInFrames();
-    method public int getBufferSizeInFrames();
+    method @IntRange(from=0) public int getBufferCapacityInFrames();
+    method @IntRange(from=0) public int getBufferSizeInFrames();
     method public int getChannelConfiguration();
     method public int getChannelCount();
     method @NonNull public android.media.AudioFormat getFormat();
@@ -23582,6 +23577,8 @@
     method @Deprecated protected int getNativeFrameCount();
     method public static int getNativeOutputSampleRate(int);
     method public int getNotificationMarkerPosition();
+    method @IntRange(from=0) public int getOffloadDelay();
+    method @IntRange(from=0) public int getOffloadPadding();
     method public int getPerformanceMode();
     method public int getPlayState();
     method public int getPlaybackHeadPosition();
@@ -23596,6 +23593,7 @@
     method public boolean getTimestamp(android.media.AudioTimestamp);
     method public int getUnderrunCount();
     method public static boolean isDirectPlaybackSupported(@NonNull android.media.AudioFormat, @NonNull android.media.AudioAttributes);
+    method public boolean isOffloadedPlayback();
     method public void pause() throws java.lang.IllegalStateException;
     method public void play() throws java.lang.IllegalStateException;
     method public void registerStreamEventCallback(@NonNull java.util.concurrent.Executor, @NonNull android.media.AudioTrack.StreamEventCallback);
@@ -23603,13 +23601,13 @@
     method public int reloadStaticData();
     method public void removeOnRoutingChangedListener(android.media.AudioRouting.OnRoutingChangedListener);
     method @Deprecated public void removeOnRoutingChangedListener(android.media.AudioTrack.OnRoutingChangedListener);
-    method public int setAuxEffectSendLevel(float);
-    method public int setBufferSizeInFrames(int);
-    method public int setLoopPoints(int, int, int);
+    method public int setAuxEffectSendLevel(@FloatRange(from=0.0) float);
+    method public int setBufferSizeInFrames(@IntRange(from=0) int);
+    method public int setLoopPoints(@IntRange(from=0) int, @IntRange(from=0) int, @IntRange(from=0xffffffff) int);
     method public int setNotificationMarkerPosition(int);
-    method public void setOffloadDelayPadding(int, int);
+    method public void setOffloadDelayPadding(@IntRange(from=0) int, @IntRange(from=0) int);
     method public void setOffloadEndOfStream();
-    method public int setPlaybackHeadPosition(int);
+    method public int setPlaybackHeadPosition(@IntRange(from=0) int);
     method public void setPlaybackParams(@NonNull android.media.PlaybackParams);
     method public void setPlaybackPositionUpdateListener(android.media.AudioTrack.OnPlaybackPositionUpdateListener);
     method public void setPlaybackPositionUpdateListener(android.media.AudioTrack.OnPlaybackPositionUpdateListener, android.os.Handler);
@@ -23654,17 +23652,17 @@
     method @NonNull public android.media.AudioTrack build() throws java.lang.UnsupportedOperationException;
     method @NonNull public android.media.AudioTrack.Builder setAudioAttributes(@NonNull android.media.AudioAttributes) throws java.lang.IllegalArgumentException;
     method @NonNull public android.media.AudioTrack.Builder setAudioFormat(@NonNull android.media.AudioFormat) throws java.lang.IllegalArgumentException;
-    method @NonNull public android.media.AudioTrack.Builder setBufferSizeInBytes(int) throws java.lang.IllegalArgumentException;
+    method @NonNull public android.media.AudioTrack.Builder setBufferSizeInBytes(@IntRange(from=0) int) throws java.lang.IllegalArgumentException;
     method @NonNull public android.media.AudioTrack.Builder setOffloadedPlayback(boolean);
     method @NonNull public android.media.AudioTrack.Builder setPerformanceMode(int);
-    method @NonNull public android.media.AudioTrack.Builder setSessionId(int) throws java.lang.IllegalArgumentException;
+    method @NonNull public android.media.AudioTrack.Builder setSessionId(@IntRange(from=1) int) throws java.lang.IllegalArgumentException;
     method @NonNull public android.media.AudioTrack.Builder setTransferMode(int) throws java.lang.IllegalArgumentException;
   }
 
   public static final class AudioTrack.MetricsConstants {
-    field public static final String CHANNELMASK = "android.media.audiorecord.channelmask";
+    field @Deprecated public static final String CHANNELMASK = "android.media.audiorecord.channelmask";
     field public static final String CONTENTTYPE = "android.media.audiotrack.type";
-    field public static final String SAMPLERATE = "android.media.audiorecord.samplerate";
+    field @Deprecated public static final String SAMPLERATE = "android.media.audiorecord.samplerate";
     field public static final String STREAMTYPE = "android.media.audiotrack.streamtype";
     field public static final String USAGE = "android.media.audiotrack.usage";
   }
@@ -23681,18 +23679,18 @@
 
   public abstract static class AudioTrack.StreamEventCallback {
     ctor public AudioTrack.StreamEventCallback();
-    method public void onDataRequest(android.media.AudioTrack, int);
-    method public void onPresentationEnded(android.media.AudioTrack);
-    method public void onTearDown(android.media.AudioTrack);
+    method public void onDataRequest(@NonNull android.media.AudioTrack, @IntRange(from=0) int);
+    method public void onPresentationEnded(@NonNull android.media.AudioTrack);
+    method public void onTearDown(@NonNull android.media.AudioTrack);
   }
 
   public class CallbackDataSourceDesc extends android.media.DataSourceDesc {
-    method public android.media.DataSourceCallback getDataSourceCallback();
+    method @NonNull public android.media.DataSourceCallback getDataSourceCallback();
   }
 
   public static class CallbackDataSourceDesc.Builder extends android.media.DataSourceDesc.BuilderBase<android.media.CallbackDataSourceDesc.Builder> {
     ctor public CallbackDataSourceDesc.Builder();
-    ctor public CallbackDataSourceDesc.Builder(android.media.CallbackDataSourceDesc);
+    ctor public CallbackDataSourceDesc.Builder(@Nullable android.media.CallbackDataSourceDesc);
     method @NonNull public android.media.CallbackDataSourceDesc build();
     method @NonNull public android.media.CallbackDataSourceDesc.Builder setDataSource(@NonNull android.media.DataSourceCallback);
   }
@@ -23752,12 +23750,12 @@
   public abstract class DataSourceCallback implements java.io.Closeable {
     ctor public DataSourceCallback();
     method public abstract long getSize() throws java.io.IOException;
-    method public abstract int readAt(long, byte[], int, int) throws java.io.IOException;
+    method public abstract int readAt(long, @NonNull byte[], int, int) throws java.io.IOException;
   }
 
   public class DataSourceDesc {
     method public long getEndPosition();
-    method public String getMediaId();
+    method @Nullable public String getMediaId();
     method public long getStartPosition();
     field public static final long LONG_MAX_TIME_MS = 576460752303423L; // 0x20c49ba5e353fL
     field public static final long POSITION_UNKNOWN = 576460752303423L; // 0x20c49ba5e353fL
@@ -23765,7 +23763,7 @@
 
   protected static class DataSourceDesc.BuilderBase<T extends android.media.DataSourceDesc.BuilderBase> {
     method @NonNull public T setEndPosition(long);
-    method @NonNull public T setMediaId(String);
+    method @NonNull public T setMediaId(@Nullable String);
     method @NonNull public T setStartPosition(long);
   }
 
@@ -23798,7 +23796,7 @@
     method public android.graphics.Bitmap getThumbnailBitmap();
     method public byte[] getThumbnailBytes();
     method @Nullable public long[] getThumbnailRange();
-    method public boolean hasAttribute(String);
+    method public boolean hasAttribute(@NonNull String);
     method public boolean hasThumbnail();
     method public boolean isThumbnailCompressed();
     method public void saveAttributes() throws java.io.IOException;
@@ -23974,13 +23972,13 @@
   public class FileDataSourceDesc extends android.media.DataSourceDesc {
     method public long getLength();
     method public long getOffset();
-    method public android.os.ParcelFileDescriptor getParcelFileDescriptor();
+    method @NonNull public android.os.ParcelFileDescriptor getParcelFileDescriptor();
     field public static final long FD_LENGTH_UNKNOWN = 576460752303423487L; // 0x7ffffffffffffffL
   }
 
   public static class FileDataSourceDesc.Builder extends android.media.DataSourceDesc.BuilderBase<android.media.FileDataSourceDesc.Builder> {
     ctor public FileDataSourceDesc.Builder();
-    ctor public FileDataSourceDesc.Builder(android.media.FileDataSourceDesc);
+    ctor public FileDataSourceDesc.Builder(@Nullable android.media.FileDataSourceDesc);
     method @NonNull public android.media.FileDataSourceDesc build();
     method @NonNull public android.media.FileDataSourceDesc.Builder setDataSource(@NonNull android.os.ParcelFileDescriptor);
     method @NonNull public android.media.FileDataSourceDesc.Builder setDataSource(@NonNull android.os.ParcelFileDescriptor, long, long);
@@ -24656,7 +24654,7 @@
     ctor public MediaController2(@NonNull android.content.Context, @NonNull android.media.Session2Token, @NonNull java.util.concurrent.Executor, @NonNull android.media.MediaController2.ControllerCallback);
     method public void cancelSessionCommand(@NonNull Object);
     method public void close();
-    method public android.media.Session2Token getConnectedSessionToken();
+    method @Nullable public android.media.Session2Token getConnectedSessionToken();
     method public boolean isPlaybackActive();
     method @NonNull public Object sendSessionCommand(@NonNull android.media.Session2Command, @Nullable android.os.Bundle);
   }
@@ -24721,7 +24719,7 @@
     field public static final long BT_FOLDER_TYPE_PLAYLISTS = 5L; // 0x5L
     field public static final long BT_FOLDER_TYPE_TITLES = 1L; // 0x1L
     field public static final long BT_FOLDER_TYPE_YEARS = 6L; // 0x6L
-    field public static final android.os.Parcelable.Creator<android.media.MediaDescription> CREATOR;
+    field @NonNull public static final android.os.Parcelable.Creator<android.media.MediaDescription> CREATOR;
     field public static final String EXTRA_BT_FOLDER_TYPE = "android.media.extra.BT_FOLDER_TYPE";
   }
 
@@ -25126,11 +25124,11 @@
     method public long getStartPosition();
     method public void setMetadata(@Nullable android.media.MediaMetadata);
     method public void writeToParcel(android.os.Parcel, int);
-    field public static final android.os.Parcelable.Creator<android.media.MediaItem2> CREATOR;
+    field @NonNull public static final android.os.Parcelable.Creator<android.media.MediaItem2> CREATOR;
     field public static final long POSITION_UNKNOWN = 576460752303423487L; // 0x7ffffffffffffffL
   }
 
-  public static class MediaItem2.Builder {
+  public static final class MediaItem2.Builder {
     ctor public MediaItem2.Builder();
     method @NonNull public android.media.MediaItem2 build();
     method @NonNull public android.media.MediaItem2.Builder setEndPosition(long);
@@ -25150,7 +25148,7 @@
     method public java.util.Set<java.lang.String> keySet();
     method public int size();
     method public void writeToParcel(android.os.Parcel, int);
-    field public static final android.os.Parcelable.Creator<android.media.MediaMetadata> CREATOR;
+    field @NonNull public static final android.os.Parcelable.Creator<android.media.MediaMetadata> CREATOR;
     field public static final String METADATA_KEY_ALBUM = "android.media.metadata.ALBUM";
     field public static final String METADATA_KEY_ALBUM_ART = "android.media.metadata.ALBUM_ART";
     field public static final String METADATA_KEY_ALBUM_ARTIST = "android.media.metadata.ALBUM_ARTIST";
@@ -25318,7 +25316,6 @@
     method public static android.media.MediaPlayer create(android.content.Context, int);
     method public static android.media.MediaPlayer create(android.content.Context, int, android.media.AudioAttributes, int);
     method @NonNull public android.media.VolumeShaper createVolumeShaper(@NonNull android.media.VolumeShaper.Configuration);
-    method public static void deprecateStreamTypeForPlayback(int, String, String) throws java.lang.IllegalArgumentException;
     method public void deselectTrack(int) throws java.lang.IllegalStateException;
     method protected void finalize();
     method public int getAudioSessionId();
@@ -25532,16 +25529,16 @@
   }
 
   public class MediaPlayer2 implements android.media.AudioRouting java.lang.AutoCloseable {
-    ctor public MediaPlayer2(android.content.Context);
-    method public void addOnRoutingChangedListener(android.media.AudioRouting.OnRoutingChangedListener, android.os.Handler);
-    method public Object attachAuxEffect(int);
+    ctor public MediaPlayer2(@NonNull android.content.Context);
+    method public void addOnRoutingChangedListener(@NonNull android.media.AudioRouting.OnRoutingChangedListener, @Nullable android.os.Handler);
+    method @NonNull public Object attachAuxEffect(int);
     method public boolean cancelCommand(@NonNull Object);
     method public void clearDrmEventCallback();
-    method public Object clearNextDataSources();
+    method @NonNull public Object clearNextDataSources();
     method public void clearPendingCommands();
     method public void close();
-    method public Object deselectTrack(int);
-    method public Object deselectTrack(@NonNull android.media.DataSourceDesc, int);
+    method @NonNull public Object deselectTrack(int);
+    method @NonNull public Object deselectTrack(@NonNull android.media.DataSourceDesc, int);
     method @NonNull public android.media.AudioAttributes getAudioAttributes();
     method public int getAudioSessionId();
     method public long getBufferedPosition();
@@ -25551,11 +25548,11 @@
     method public long getDuration();
     method public long getDuration(@NonNull android.media.DataSourceDesc);
     method public float getMaxPlayerVolume();
-    method public android.os.PersistableBundle getMetrics();
+    method @Nullable public android.os.PersistableBundle getMetrics();
     method @NonNull public android.media.PlaybackParams getPlaybackParams();
     method public float getPlayerVolume();
-    method public android.media.AudioDeviceInfo getPreferredDevice();
-    method public android.media.AudioDeviceInfo getRoutedDevice();
+    method @Nullable public android.media.AudioDeviceInfo getPreferredDevice();
+    method @Nullable public android.media.AudioDeviceInfo getRoutedDevice();
     method public int getSelectedTrack(int);
     method public int getSelectedTrack(@NonNull android.media.DataSourceDesc, int);
     method public int getState();
@@ -25563,37 +25560,37 @@
     method @Nullable public android.media.MediaTimestamp getTimestamp();
     method @NonNull public java.util.List<android.media.MediaPlayer2.TrackInfo> getTrackInfo();
     method @NonNull public java.util.List<android.media.MediaPlayer2.TrackInfo> getTrackInfo(@NonNull android.media.DataSourceDesc);
-    method public android.util.Size getVideoSize();
+    method @NonNull public android.util.Size getVideoSize();
     method public boolean isLooping();
-    method public Object loopCurrent(boolean);
-    method public Object notifyWhenCommandLabelReached(@NonNull Object);
-    method public Object pause();
-    method public Object play();
-    method public Object prepare();
+    method @NonNull public Object loopCurrent(boolean);
+    method @NonNull public Object notifyWhenCommandLabelReached(@NonNull Object);
+    method @NonNull public Object pause();
+    method @NonNull public Object play();
+    method @NonNull public Object prepare();
     method public void registerEventCallback(@NonNull java.util.concurrent.Executor, @NonNull android.media.MediaPlayer2.EventCallback);
-    method public void removeOnRoutingChangedListener(android.media.AudioRouting.OnRoutingChangedListener);
+    method public void removeOnRoutingChangedListener(@NonNull android.media.AudioRouting.OnRoutingChangedListener);
     method public void reset();
-    method public Object seekTo(long);
-    method public Object seekTo(long, int);
-    method public Object selectTrack(int);
-    method public Object selectTrack(@NonNull android.media.DataSourceDesc, int);
-    method public Object setAudioAttributes(@NonNull android.media.AudioAttributes);
-    method public Object setAudioSessionId(int);
-    method public Object setAuxEffectSendLevel(float);
-    method public Object setDataSource(@NonNull android.media.DataSourceDesc);
-    method public Object setDisplay(android.view.SurfaceHolder);
+    method @NonNull public Object seekTo(long);
+    method @NonNull public Object seekTo(long, int);
+    method @NonNull public Object selectTrack(int);
+    method @NonNull public Object selectTrack(@NonNull android.media.DataSourceDesc, int);
+    method @NonNull public Object setAudioAttributes(@NonNull android.media.AudioAttributes);
+    method @NonNull public Object setAudioSessionId(int);
+    method @NonNull public Object setAuxEffectSendLevel(float);
+    method @NonNull public Object setDataSource(@NonNull android.media.DataSourceDesc);
+    method @NonNull public Object setDisplay(@Nullable android.view.SurfaceHolder);
     method public void setDrmEventCallback(@NonNull java.util.concurrent.Executor, @NonNull android.media.MediaPlayer2.DrmEventCallback);
-    method public Object setNextDataSource(@NonNull android.media.DataSourceDesc);
-    method public Object setNextDataSources(@NonNull java.util.List<android.media.DataSourceDesc>);
-    method public Object setPlaybackParams(@NonNull android.media.PlaybackParams);
-    method public Object setPlayerVolume(float);
-    method public boolean setPreferredDevice(android.media.AudioDeviceInfo);
-    method public Object setScreenOnWhilePlaying(boolean);
-    method public Object setSurface(android.view.Surface);
-    method public Object setSyncParams(@NonNull android.media.SyncParams);
-    method public Object setWakeLock(@NonNull android.os.PowerManager.WakeLock);
-    method public Object skipToNext();
-    method public void unregisterEventCallback(android.media.MediaPlayer2.EventCallback);
+    method @NonNull public Object setNextDataSource(@NonNull android.media.DataSourceDesc);
+    method @NonNull public Object setNextDataSources(@NonNull java.util.List<android.media.DataSourceDesc>);
+    method @NonNull public Object setPlaybackParams(@NonNull android.media.PlaybackParams);
+    method @NonNull public Object setPlayerVolume(float);
+    method public boolean setPreferredDevice(@Nullable android.media.AudioDeviceInfo);
+    method @NonNull public Object setScreenOnWhilePlaying(boolean);
+    method @NonNull public Object setSurface(@Nullable android.view.Surface);
+    method @NonNull public Object setSyncParams(@NonNull android.media.SyncParams);
+    method @NonNull public Object setWakeLock(@NonNull android.os.PowerManager.WakeLock);
+    method @NonNull public Object skipToNext();
+    method public void unregisterEventCallback(@NonNull android.media.MediaPlayer2.EventCallback);
     field public static final int CALL_COMPLETED_ATTACH_AUX_EFFECT = 1; // 0x1
     field public static final int CALL_COMPLETED_CLEAR_NEXT_DATA_SOURCES = 30; // 0x1e
     field public static final int CALL_COMPLETED_DESELECT_TRACK = 2; // 0x2
@@ -25728,8 +25725,8 @@
   }
 
   public static class MediaPlayer2.TrackInfo {
-    method public android.media.MediaFormat getFormat();
-    method public String getLanguage();
+    method @Nullable public android.media.MediaFormat getFormat();
+    method @NonNull public String getLanguage();
     method public int getTrackType();
     field public static final int MEDIA_TRACK_TYPE_AUDIO = 2; // 0x2
     field public static final int MEDIA_TRACK_TYPE_METADATA = 5; // 0x5
@@ -25738,7 +25735,7 @@
     field public static final int MEDIA_TRACK_TYPE_VIDEO = 1; // 0x1
   }
 
-  public class MediaRecorder implements android.media.AudioRecordingMonitor android.media.AudioRouting {
+  public class MediaRecorder implements android.media.AudioRecordingMonitor android.media.AudioRouting android.media.MicrophoneDirection {
     ctor public MediaRecorder();
     method public void addOnRoutingChangedListener(android.media.AudioRouting.OnRoutingChangedListener, android.os.Handler);
     method protected void finalize();
@@ -25768,6 +25765,8 @@
     method public void setLocation(float, float);
     method public void setMaxDuration(int) throws java.lang.IllegalArgumentException;
     method public void setMaxFileSize(long) throws java.lang.IllegalArgumentException;
+    method public boolean setMicrophoneDirection(int);
+    method public boolean setMicrophoneFieldDimension(@FloatRange(from=-1.0, to=1.0) float);
     method public void setNextOutputFile(java.io.FileDescriptor) throws java.io.IOException;
     method public void setNextOutputFile(java.io.File) throws java.io.IOException;
     method public void setOnErrorListener(android.media.MediaRecorder.OnErrorListener);
@@ -26188,7 +26187,7 @@
     field public static final int AUDIO_FALLBACK_MODE_DEFAULT = 0; // 0x0
     field public static final int AUDIO_FALLBACK_MODE_FAIL = 2; // 0x2
     field public static final int AUDIO_FALLBACK_MODE_MUTE = 1; // 0x1
-    field public static final android.os.Parcelable.Creator<android.media.PlaybackParams> CREATOR;
+    field @NonNull public static final android.os.Parcelable.Creator<android.media.PlaybackParams> CREATOR;
   }
 
   public final class Rating implements android.os.Parcelable {
@@ -26205,7 +26204,7 @@
     method public static android.media.Rating newThumbRating(boolean);
     method public static android.media.Rating newUnratedRating(int);
     method public void writeToParcel(android.os.Parcel, int);
-    field public static final android.os.Parcelable.Creator<android.media.Rating> CREATOR;
+    field @NonNull public static final android.os.Parcelable.Creator<android.media.Rating> CREATOR;
     field public static final int RATING_3_STARS = 3; // 0x3
     field public static final int RATING_4_STARS = 4; // 0x4
     field public static final int RATING_5_STARS = 5; // 0x5
@@ -26364,7 +26363,7 @@
     method @Nullable public android.os.Bundle getExtras();
     method public void writeToParcel(@NonNull android.os.Parcel, int);
     field public static final int COMMAND_CODE_CUSTOM = 0; // 0x0
-    field public static final android.os.Parcelable.Creator<android.media.Session2Command> CREATOR;
+    field @NonNull public static final android.os.Parcelable.Creator<android.media.Session2Command> CREATOR;
     field public static final int RESULT_ERROR_UNKNOWN_ERROR = -1; // 0xffffffff
     field public static final int RESULT_INFO_SKIPPED = 1; // 0x1
     field public static final int RESULT_SUCCESS = 0; // 0x0
@@ -26382,7 +26381,7 @@
     method public boolean hasCommand(@NonNull android.media.Session2Command);
     method public boolean hasCommand(int);
     method public void writeToParcel(@NonNull android.os.Parcel, int);
-    field public static final android.os.Parcelable.Creator<android.media.Session2CommandGroup> CREATOR;
+    field @NonNull public static final android.os.Parcelable.Creator<android.media.Session2CommandGroup> CREATOR;
   }
 
   public static final class Session2CommandGroup.Builder {
@@ -26404,7 +26403,7 @@
     method public int getType();
     method public int getUid();
     method public void writeToParcel(android.os.Parcel, int);
-    field public static final android.os.Parcelable.Creator<android.media.Session2Token> CREATOR;
+    field @NonNull public static final android.os.Parcelable.Creator<android.media.Session2Token> CREATOR;
     field public static final int TYPE_SESSION = 0; // 0x0
     field public static final int TYPE_SESSION_SERVICE = 1; // 0x1
   }
@@ -26413,7 +26412,6 @@
     ctor @Deprecated public SoundPool(int, int, int);
     method public final void autoPause();
     method public final void autoResume();
-    method public static void deprecateStreamTypeForPlayback(int, String, String) throws java.lang.IllegalArgumentException;
     method protected void finalize();
     method public int load(String, int);
     method public int load(android.content.Context, int, int);
@@ -26609,15 +26607,15 @@
   }
 
   public class UriDataSourceDesc extends android.media.DataSourceDesc {
-    method public android.content.Context getContext();
-    method public java.util.List<java.net.HttpCookie> getCookies();
-    method public java.util.Map<java.lang.String,java.lang.String> getHeaders();
-    method public android.net.Uri getUri();
+    method @NonNull public android.content.Context getContext();
+    method @Nullable public java.util.List<java.net.HttpCookie> getCookies();
+    method @Nullable public java.util.Map<java.lang.String,java.lang.String> getHeaders();
+    method @NonNull public android.net.Uri getUri();
   }
 
   public static class UriDataSourceDesc.Builder extends android.media.DataSourceDesc.BuilderBase<android.media.UriDataSourceDesc.Builder> {
     ctor public UriDataSourceDesc.Builder();
-    ctor public UriDataSourceDesc.Builder(android.media.UriDataSourceDesc);
+    ctor public UriDataSourceDesc.Builder(@Nullable android.media.UriDataSourceDesc);
     method @NonNull public android.media.UriDataSourceDesc build();
     method @NonNull public android.media.UriDataSourceDesc.Builder setDataSource(@NonNull android.content.Context, @NonNull android.net.Uri);
     method @NonNull public android.media.UriDataSourceDesc.Builder setDataSource(@NonNull android.content.Context, @NonNull android.net.Uri, @Nullable java.util.Map<java.lang.String,java.lang.String>, @Nullable java.util.List<java.net.HttpCookie>);
@@ -26656,7 +26654,7 @@
     method public float[] getTimes();
     method public float[] getVolumes();
     method public void writeToParcel(android.os.Parcel, int);
-    field public static final android.os.Parcelable.Creator<android.media.VolumeShaper.Configuration> CREATOR;
+    field @NonNull public static final android.os.Parcelable.Creator<android.media.VolumeShaper.Configuration> CREATOR;
     field public static final android.media.VolumeShaper.Configuration CUBIC_RAMP;
     field public static final int INTERPOLATOR_TYPE_CUBIC = 2; // 0x2
     field public static final int INTERPOLATOR_TYPE_CUBIC_MONOTONIC = 3; // 0x3
@@ -26683,7 +26681,7 @@
   public static final class VolumeShaper.Operation 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.media.VolumeShaper.Operation> CREATOR;
+    field @NonNull public static final android.os.Parcelable.Creator<android.media.VolumeShaper.Operation> CREATOR;
     field public static final android.media.VolumeShaper.Operation PLAY;
     field public static final android.media.VolumeShaper.Operation REVERSE;
   }
@@ -27236,7 +27234,7 @@
     method public boolean isBrowsable();
     method public boolean isPlayable();
     method public void writeToParcel(android.os.Parcel, int);
-    field public static final android.os.Parcelable.Creator<android.media.browse.MediaBrowser.MediaItem> CREATOR;
+    field @NonNull public static final android.os.Parcelable.Creator<android.media.browse.MediaBrowser.MediaItem> CREATOR;
     field public static final int FLAG_BROWSABLE = 1; // 0x1
     field public static final int FLAG_PLAYABLE = 2; // 0x2
   }
@@ -27330,7 +27328,7 @@
     method public int getType();
     method public boolean isPrivate();
     method public void writeToParcel(android.os.Parcel, int);
-    field public static final android.os.Parcelable.Creator<android.media.midi.MidiDeviceInfo> CREATOR;
+    field @NonNull public static final android.os.Parcelable.Creator<android.media.midi.MidiDeviceInfo> CREATOR;
     field public static final String PROPERTY_BLUETOOTH_DEVICE = "bluetooth_device";
     field public static final String PROPERTY_MANUFACTURER = "manufacturer";
     field public static final String PROPERTY_NAME = "name";
@@ -27368,7 +27366,7 @@
     method public int getOutputPortOpenCount(int);
     method public boolean isInputPortOpen(int);
     method public void writeToParcel(android.os.Parcel, int);
-    field public static final android.os.Parcelable.Creator<android.media.midi.MidiDeviceStatus> CREATOR;
+    field @NonNull public static final android.os.Parcelable.Creator<android.media.midi.MidiDeviceStatus> CREATOR;
   }
 
   public final class MidiInputPort extends android.media.midi.MidiReceiver implements java.io.Closeable {
@@ -27491,7 +27489,7 @@
     method public int getPlaybackType();
     method public int getVolumeControl();
     method public void writeToParcel(android.os.Parcel, int);
-    field public static final android.os.Parcelable.Creator<android.media.session.MediaController.PlaybackInfo> CREATOR;
+    field @NonNull public static final android.os.Parcelable.Creator<android.media.session.MediaController.PlaybackInfo> CREATOR;
     field public static final int PLAYBACK_TYPE_LOCAL = 1; // 0x1
     field public static final int PLAYBACK_TYPE_REMOTE = 2; // 0x2
   }
@@ -27577,14 +27575,14 @@
     method public android.media.MediaDescription getDescription();
     method public long getQueueId();
     method public void writeToParcel(android.os.Parcel, int);
-    field public static final android.os.Parcelable.Creator<android.media.session.MediaSession.QueueItem> CREATOR;
+    field @NonNull public static final android.os.Parcelable.Creator<android.media.session.MediaSession.QueueItem> CREATOR;
     field public static final int UNKNOWN_ID = -1; // 0xffffffff
   }
 
   public static final class MediaSession.Token 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.media.session.MediaSession.Token> CREATOR;
+    field @NonNull public static final android.os.Parcelable.Creator<android.media.session.MediaSession.Token> CREATOR;
   }
 
   public final class MediaSessionManager {
@@ -27646,7 +27644,7 @@
     field public static final long ACTION_SKIP_TO_PREVIOUS = 16L; // 0x10L
     field public static final long ACTION_SKIP_TO_QUEUE_ITEM = 4096L; // 0x1000L
     field public static final long ACTION_STOP = 1L; // 0x1L
-    field public static final android.os.Parcelable.Creator<android.media.session.PlaybackState> CREATOR;
+    field @NonNull public static final android.os.Parcelable.Creator<android.media.session.PlaybackState> CREATOR;
     field public static final long PLAYBACK_POSITION_UNKNOWN = -1L; // 0xffffffffffffffffL
     field public static final int STATE_BUFFERING = 6; // 0x6
     field public static final int STATE_CONNECTING = 8; // 0x8
@@ -27684,7 +27682,7 @@
     method public int getIcon();
     method public CharSequence getName();
     method public void writeToParcel(android.os.Parcel, int);
-    field public static final android.os.Parcelable.Creator<android.media.session.PlaybackState.CustomAction> CREATOR;
+    field @NonNull public static final android.os.Parcelable.Creator<android.media.session.PlaybackState.CustomAction> CREATOR;
   }
 
   public static final class PlaybackState.CustomAction.Builder {
@@ -28122,7 +28120,7 @@
     method public android.graphics.drawable.Drawable loadIcon(@NonNull android.content.Context);
     method public CharSequence loadLabel(@NonNull android.content.Context);
     method public void writeToParcel(@NonNull android.os.Parcel, int);
-    field public static final android.os.Parcelable.Creator<android.media.tv.TvInputInfo> CREATOR;
+    field @NonNull public static final android.os.Parcelable.Creator<android.media.tv.TvInputInfo> CREATOR;
     field public static final String EXTRA_INPUT_ID = "android.media.tv.extra.INPUT_ID";
     field public static final int TYPE_COMPONENT = 1004; // 0x3ec
     field public static final int TYPE_COMPOSITE = 1001; // 0x3e9
@@ -28291,7 +28289,7 @@
     method public float getVideoPixelAspectRatio();
     method public int getVideoWidth();
     method public void writeToParcel(android.os.Parcel, int);
-    field public static final android.os.Parcelable.Creator<android.media.tv.TvTrackInfo> CREATOR;
+    field @NonNull public static final android.os.Parcelable.Creator<android.media.tv.TvTrackInfo> CREATOR;
     field public static final int TYPE_AUDIO = 0; // 0x0
     field public static final int TYPE_SUBTITLE = 2; // 0x2
     field public static final int TYPE_VIDEO = 1; // 0x1
@@ -28613,7 +28611,7 @@
     method public void ignoreNetwork();
     method public void reportCaptivePortalDismissed();
     method public void writeToParcel(android.os.Parcel, int);
-    field public static final android.os.Parcelable.Creator<android.net.CaptivePortal> CREATOR;
+    field @NonNull public static final android.os.Parcelable.Creator<android.net.CaptivePortal> CREATOR;
   }
 
   public class ConnectivityManager {
@@ -28752,8 +28750,8 @@
   }
 
   public class InetAddresses {
-    method public static boolean isNumericAddress(String);
-    method public static java.net.InetAddress parseNumericAddress(String);
+    method public static boolean isNumericAddress(@NonNull String);
+    method @NonNull public static java.net.InetAddress parseNumericAddress(@NonNull String);
   }
 
   public final class IpPrefix implements android.os.Parcelable {
@@ -28763,7 +28761,7 @@
     method public int getPrefixLength();
     method public byte[] getRawAddress();
     method public void writeToParcel(android.os.Parcel, int);
-    field public static final android.os.Parcelable.Creator<android.net.IpPrefix> CREATOR;
+    field @NonNull public static final android.os.Parcelable.Creator<android.net.IpPrefix> CREATOR;
   }
 
   public final class IpSecAlgorithm implements android.os.Parcelable {
@@ -28780,7 +28778,7 @@
     field public static final String AUTH_HMAC_SHA256 = "hmac(sha256)";
     field public static final String AUTH_HMAC_SHA384 = "hmac(sha384)";
     field public static final String AUTH_HMAC_SHA512 = "hmac(sha512)";
-    field public static final android.os.Parcelable.Creator<android.net.IpSecAlgorithm> CREATOR;
+    field @NonNull public static final android.os.Parcelable.Creator<android.net.IpSecAlgorithm> CREATOR;
     field public static final String CRYPT_AES_CBC = "cbc(aes)";
   }
 
@@ -28837,7 +28835,7 @@
     method public int getPrefixLength();
     method public int getScope();
     method public void writeToParcel(android.os.Parcel, int);
-    field public static final android.os.Parcelable.Creator<android.net.LinkAddress> CREATOR;
+    field @NonNull public static final android.os.Parcelable.Creator<android.net.LinkAddress> CREATOR;
   }
 
   public final class LinkProperties implements android.os.Parcelable {
@@ -28852,7 +28850,7 @@
     method public java.util.List<android.net.RouteInfo> getRoutes();
     method public boolean isPrivateDnsActive();
     method public void writeToParcel(android.os.Parcel, int);
-    field public static final android.os.Parcelable.Creator<android.net.LinkProperties> CREATOR;
+    field @NonNull public static final android.os.Parcelable.Creator<android.net.LinkProperties> CREATOR;
   }
 
   public class LocalServerSocket implements java.io.Closeable {
@@ -28920,7 +28918,7 @@
     method @NonNull public String toOuiString();
     method public void writeToParcel(android.os.Parcel, int);
     field public static final android.net.MacAddress BROADCAST_ADDRESS;
-    field public static final android.os.Parcelable.Creator<android.net.MacAddress> CREATOR;
+    field @NonNull public static final android.os.Parcelable.Creator<android.net.MacAddress> CREATOR;
     field public static final int TYPE_BROADCAST = 3; // 0x3
     field public static final int TYPE_MULTICAST = 2; // 0x2
     field public static final int TYPE_UNICAST = 1; // 0x1
@@ -28950,7 +28948,7 @@
     method public java.net.URLConnection openConnection(java.net.URL) throws java.io.IOException;
     method public java.net.URLConnection openConnection(java.net.URL, java.net.Proxy) throws java.io.IOException;
     method public void writeToParcel(android.os.Parcel, int);
-    field public static final android.os.Parcelable.Creator<android.net.Network> CREATOR;
+    field @NonNull public static final android.os.Parcelable.Creator<android.net.Network> CREATOR;
   }
 
   public final class NetworkCapabilities implements android.os.Parcelable {
@@ -28962,7 +28960,7 @@
     method public boolean hasCapability(int);
     method public boolean hasTransport(int);
     method public void writeToParcel(android.os.Parcel, int);
-    field public static final android.os.Parcelable.Creator<android.net.NetworkCapabilities> CREATOR;
+    field @NonNull public static final android.os.Parcelable.Creator<android.net.NetworkCapabilities> CREATOR;
     field public static final int NET_CAPABILITY_CAPTIVE_PORTAL = 17; // 0x11
     field public static final int NET_CAPABILITY_CBS = 5; // 0x5
     field public static final int NET_CAPABILITY_DUN = 2; // 0x2
@@ -28972,6 +28970,7 @@
     field public static final int NET_CAPABILITY_IA = 7; // 0x7
     field public static final int NET_CAPABILITY_IMS = 4; // 0x4
     field public static final int NET_CAPABILITY_INTERNET = 12; // 0xc
+    field public static final int NET_CAPABILITY_MCX = 23; // 0x17
     field public static final int NET_CAPABILITY_MMS = 0; // 0x0
     field public static final int NET_CAPABILITY_NOT_CONGESTED = 20; // 0x14
     field public static final int NET_CAPABILITY_NOT_METERED = 11; // 0xb
@@ -29010,7 +29009,7 @@
     method @Deprecated public boolean isFailover();
     method @Deprecated public boolean isRoaming();
     method @Deprecated public void writeToParcel(android.os.Parcel, int);
-    field @Deprecated public static final android.os.Parcelable.Creator<android.net.NetworkInfo> CREATOR;
+    field @Deprecated @NonNull public static final android.os.Parcelable.Creator<android.net.NetworkInfo> CREATOR;
   }
 
   @Deprecated public enum NetworkInfo.DetailedState {
@@ -29043,7 +29042,7 @@
     method public boolean hasCapability(int);
     method public boolean hasTransport(int);
     method public void writeToParcel(android.os.Parcel, int);
-    field public static final android.os.Parcelable.Creator<android.net.NetworkRequest> CREATOR;
+    field @NonNull public static final android.os.Parcelable.Creator<android.net.NetworkRequest> CREATOR;
   }
 
   public static class NetworkRequest.Builder {
@@ -29085,7 +29084,7 @@
     method public android.net.Uri getPacFileUrl();
     method public int getPort();
     method public void writeToParcel(android.os.Parcel, int);
-    field public static final android.os.Parcelable.Creator<android.net.ProxyInfo> CREATOR;
+    field @NonNull public static final android.os.Parcelable.Creator<android.net.ProxyInfo> CREATOR;
   }
 
   public final class RouteInfo implements android.os.Parcelable {
@@ -29097,7 +29096,7 @@
     method public boolean isDefaultRoute();
     method public boolean matches(java.net.InetAddress);
     method public void writeToParcel(android.os.Parcel, int);
-    field public static final android.os.Parcelable.Creator<android.net.RouteInfo> CREATOR;
+    field @NonNull public static final android.os.Parcelable.Creator<android.net.RouteInfo> CREATOR;
   }
 
   @Deprecated public class SSLCertificateSocketFactory extends javax.net.ssl.SSLSocketFactory {
@@ -29230,7 +29229,7 @@
     method public abstract String toString();
     method public static android.net.Uri withAppendedPath(android.net.Uri, String);
     method public static void writeToParcel(android.os.Parcel, android.net.Uri);
-    field public static final android.os.Parcelable.Creator<android.net.Uri> CREATOR;
+    field @NonNull public static final android.os.Parcelable.Creator<android.net.Uri> CREATOR;
     field public static final android.net.Uri EMPTY;
   }
 
@@ -29344,25 +29343,25 @@
 
   public class VpnService.Builder {
     ctor public VpnService.Builder();
-    method public android.net.VpnService.Builder addAddress(java.net.InetAddress, int);
-    method public android.net.VpnService.Builder addAddress(String, int);
-    method public android.net.VpnService.Builder addAllowedApplication(String) throws android.content.pm.PackageManager.NameNotFoundException;
-    method public android.net.VpnService.Builder addDisallowedApplication(String) throws android.content.pm.PackageManager.NameNotFoundException;
-    method public android.net.VpnService.Builder addDnsServer(java.net.InetAddress);
-    method public android.net.VpnService.Builder addDnsServer(String);
-    method public android.net.VpnService.Builder addRoute(java.net.InetAddress, int);
-    method public android.net.VpnService.Builder addRoute(String, int);
-    method public android.net.VpnService.Builder addSearchDomain(String);
-    method public android.net.VpnService.Builder allowBypass();
-    method public android.net.VpnService.Builder allowFamily(int);
-    method public android.os.ParcelFileDescriptor establish();
-    method public android.net.VpnService.Builder setBlocking(boolean);
-    method public android.net.VpnService.Builder setConfigureIntent(android.app.PendingIntent);
-    method public android.net.VpnService.Builder setHttpProxy(@NonNull android.net.ProxyInfo);
-    method public android.net.VpnService.Builder setMetered(boolean);
-    method public android.net.VpnService.Builder setMtu(int);
-    method public android.net.VpnService.Builder setSession(String);
-    method public android.net.VpnService.Builder setUnderlyingNetworks(android.net.Network[]);
+    method @NonNull public android.net.VpnService.Builder addAddress(@NonNull java.net.InetAddress, int);
+    method @NonNull public android.net.VpnService.Builder addAddress(@NonNull String, int);
+    method @NonNull public android.net.VpnService.Builder addAllowedApplication(@NonNull String) throws android.content.pm.PackageManager.NameNotFoundException;
+    method @NonNull public android.net.VpnService.Builder addDisallowedApplication(@NonNull String) throws android.content.pm.PackageManager.NameNotFoundException;
+    method @NonNull public android.net.VpnService.Builder addDnsServer(@NonNull java.net.InetAddress);
+    method @NonNull public android.net.VpnService.Builder addDnsServer(@NonNull String);
+    method @NonNull public android.net.VpnService.Builder addRoute(@NonNull java.net.InetAddress, int);
+    method @NonNull public android.net.VpnService.Builder addRoute(@NonNull String, int);
+    method @NonNull public android.net.VpnService.Builder addSearchDomain(@NonNull String);
+    method @NonNull public android.net.VpnService.Builder allowBypass();
+    method @NonNull public android.net.VpnService.Builder allowFamily(int);
+    method @Nullable public android.os.ParcelFileDescriptor establish();
+    method @NonNull public android.net.VpnService.Builder setBlocking(boolean);
+    method @NonNull public android.net.VpnService.Builder setConfigureIntent(@NonNull android.app.PendingIntent);
+    method @NonNull public android.net.VpnService.Builder setHttpProxy(@NonNull android.net.ProxyInfo);
+    method @NonNull public android.net.VpnService.Builder setMetered(boolean);
+    method @NonNull public android.net.VpnService.Builder setMtu(int);
+    method @NonNull public android.net.VpnService.Builder setSession(@NonNull String);
+    method @NonNull public android.net.VpnService.Builder setUnderlyingNetworks(@Nullable android.net.Network[]);
   }
 
 }
@@ -29394,7 +29393,7 @@
     method public java.util.Date getValidNotAfterDate();
     method @Deprecated public String getValidNotBefore();
     method public java.util.Date getValidNotBeforeDate();
-    method public java.security.cert.X509Certificate getX509Certificate();
+    method @Nullable public java.security.cert.X509Certificate getX509Certificate();
     method public static android.net.http.SslCertificate restoreState(android.os.Bundle);
     method public static android.os.Bundle saveState(android.net.http.SslCertificate);
   }
@@ -29489,7 +29488,7 @@
     method public void setServiceName(String);
     method public void setServiceType(String);
     method public void writeToParcel(android.os.Parcel, int);
-    field public static final android.os.Parcelable.Creator<android.net.nsd.NsdServiceInfo> CREATOR;
+    field @NonNull public static final android.os.Parcelable.Creator<android.net.nsd.NsdServiceInfo> CREATOR;
   }
 
 }
@@ -29797,13 +29796,13 @@
     field @Deprecated public String BSSID;
     field @Deprecated public String FQDN;
     field @Deprecated public String SSID;
-    field @Deprecated public java.util.BitSet allowedAuthAlgorithms;
-    field @Deprecated public java.util.BitSet allowedGroupCiphers;
-    field @Deprecated public java.util.BitSet allowedGroupManagementCiphers;
-    field @Deprecated public java.util.BitSet allowedKeyManagement;
-    field @Deprecated public java.util.BitSet allowedPairwiseCiphers;
-    field @Deprecated public java.util.BitSet allowedProtocols;
-    field @Deprecated public java.util.BitSet allowedSuiteBCiphers;
+    field @Deprecated @NonNull public java.util.BitSet allowedAuthAlgorithms;
+    field @Deprecated @NonNull public java.util.BitSet allowedGroupCiphers;
+    field @Deprecated @NonNull public java.util.BitSet allowedGroupManagementCiphers;
+    field @Deprecated @NonNull public java.util.BitSet allowedKeyManagement;
+    field @Deprecated @NonNull public java.util.BitSet allowedPairwiseCiphers;
+    field @Deprecated @NonNull public java.util.BitSet allowedProtocols;
+    field @Deprecated @NonNull public java.util.BitSet allowedSuiteBCiphers;
     field @Deprecated public android.net.wifi.WifiEnterpriseConfig enterpriseConfig;
     field @Deprecated public boolean hiddenSSID;
     field @Deprecated public boolean isHomeProviderNetwork;
@@ -29909,7 +29908,7 @@
     method public void setRealm(String);
     method @Deprecated public void setSubjectMatch(String);
     method public void writeToParcel(android.os.Parcel, int);
-    field public static final android.os.Parcelable.Creator<android.net.wifi.WifiEnterpriseConfig> CREATOR;
+    field @NonNull public static final android.os.Parcelable.Creator<android.net.wifi.WifiEnterpriseConfig> CREATOR;
   }
 
   public static final class WifiEnterpriseConfig.Eap {
@@ -29946,13 +29945,14 @@
     method public String getMacAddress();
     method public int getNetworkId();
     method public int getRssi();
-    method public int getRxLinkSpeedMbps();
+    method @IntRange(from=0xffffffff) public int getRxLinkSpeedMbps();
     method public String getSSID();
     method public android.net.wifi.SupplicantState getSupplicantState();
-    method public int getTxLinkSpeedMbps();
+    method @IntRange(from=0xffffffff) public int getTxLinkSpeedMbps();
     method public void writeToParcel(android.os.Parcel, int);
     field public static final String FREQUENCY_UNITS = "MHz";
     field public static final String LINK_SPEED_UNITS = "Mbps";
+    field public static final int LINK_SPEED_UNKNOWN = -1; // 0xffffffff
   }
 
   public class WifiManager {
@@ -29978,8 +29978,8 @@
     method public boolean is5GHzBandSupported();
     method @Deprecated public boolean isDeviceToApRttSupported();
     method public boolean isEasyConnectSupported();
+    method public boolean isEnhancedOpenSupported();
     method public boolean isEnhancedPowerReportingSupported();
-    method public boolean isOweSupported();
     method public boolean isP2pSupported();
     method public boolean isPreferredNetworkOffloadSupported();
     method @Deprecated public boolean isScanAlwaysAvailable();
@@ -30086,45 +30086,45 @@
   public final class WifiNetworkSpecifier extends android.net.NetworkSpecifier 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.net.wifi.WifiNetworkSpecifier> CREATOR;
+    field @NonNull public static final android.os.Parcelable.Creator<android.net.wifi.WifiNetworkSpecifier> CREATOR;
   }
 
-  public static class WifiNetworkSpecifier.Builder {
+  public static final class WifiNetworkSpecifier.Builder {
     ctor public WifiNetworkSpecifier.Builder();
-    method public android.net.NetworkSpecifier build();
-    method public android.net.wifi.WifiNetworkSpecifier.Builder setBssid(@NonNull android.net.MacAddress);
-    method public android.net.wifi.WifiNetworkSpecifier.Builder setBssidPattern(@NonNull android.net.MacAddress, @NonNull android.net.MacAddress);
-    method public android.net.wifi.WifiNetworkSpecifier.Builder setIsEnhancedOpen();
-    method public android.net.wifi.WifiNetworkSpecifier.Builder setIsHiddenSsid();
-    method public android.net.wifi.WifiNetworkSpecifier.Builder setSsid(@NonNull String);
-    method public android.net.wifi.WifiNetworkSpecifier.Builder setSsidPattern(@NonNull android.os.PatternMatcher);
-    method public android.net.wifi.WifiNetworkSpecifier.Builder setWpa2EnterpriseConfig(@NonNull android.net.wifi.WifiEnterpriseConfig);
-    method public android.net.wifi.WifiNetworkSpecifier.Builder setWpa2Passphrase(@NonNull String);
-    method public android.net.wifi.WifiNetworkSpecifier.Builder setWpa3EnterpriseConfig(@NonNull android.net.wifi.WifiEnterpriseConfig);
-    method public android.net.wifi.WifiNetworkSpecifier.Builder setWpa3Passphrase(@NonNull String);
+    method @NonNull public android.net.wifi.WifiNetworkSpecifier build();
+    method @NonNull public android.net.wifi.WifiNetworkSpecifier.Builder setBssid(@NonNull android.net.MacAddress);
+    method @NonNull public android.net.wifi.WifiNetworkSpecifier.Builder setBssidPattern(@NonNull android.net.MacAddress, @NonNull android.net.MacAddress);
+    method @NonNull public android.net.wifi.WifiNetworkSpecifier.Builder setIsEnhancedOpen();
+    method @NonNull public android.net.wifi.WifiNetworkSpecifier.Builder setIsHiddenSsid();
+    method @NonNull public android.net.wifi.WifiNetworkSpecifier.Builder setSsid(@NonNull String);
+    method @NonNull public android.net.wifi.WifiNetworkSpecifier.Builder setSsidPattern(@NonNull android.os.PatternMatcher);
+    method @NonNull public android.net.wifi.WifiNetworkSpecifier.Builder setWpa2EnterpriseConfig(@NonNull android.net.wifi.WifiEnterpriseConfig);
+    method @NonNull public android.net.wifi.WifiNetworkSpecifier.Builder setWpa2Passphrase(@NonNull String);
+    method @NonNull public android.net.wifi.WifiNetworkSpecifier.Builder setWpa3EnterpriseConfig(@NonNull android.net.wifi.WifiEnterpriseConfig);
+    method @NonNull public android.net.wifi.WifiNetworkSpecifier.Builder setWpa3Passphrase(@NonNull String);
   }
 
   public final class WifiNetworkSuggestion 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.net.wifi.WifiNetworkSuggestion> CREATOR;
+    field @NonNull public static final android.os.Parcelable.Creator<android.net.wifi.WifiNetworkSuggestion> CREATOR;
   }
 
-  public static class WifiNetworkSuggestion.Builder {
+  public static final class WifiNetworkSuggestion.Builder {
     ctor public WifiNetworkSuggestion.Builder();
-    method public android.net.wifi.WifiNetworkSuggestion build();
-    method public android.net.wifi.WifiNetworkSuggestion.Builder setBssid(@NonNull android.net.MacAddress);
-    method public android.net.wifi.WifiNetworkSuggestion.Builder setIsAppInteractionRequired();
-    method public android.net.wifi.WifiNetworkSuggestion.Builder setIsEnhancedOpen();
-    method public android.net.wifi.WifiNetworkSuggestion.Builder setIsHiddenSsid();
-    method public android.net.wifi.WifiNetworkSuggestion.Builder setIsMetered();
-    method public android.net.wifi.WifiNetworkSuggestion.Builder setIsUserInteractionRequired();
-    method public android.net.wifi.WifiNetworkSuggestion.Builder setPriority(int);
-    method public android.net.wifi.WifiNetworkSuggestion.Builder setSsid(@NonNull String);
-    method public android.net.wifi.WifiNetworkSuggestion.Builder setWpa2EnterpriseConfig(@NonNull android.net.wifi.WifiEnterpriseConfig);
-    method public android.net.wifi.WifiNetworkSuggestion.Builder setWpa2Passphrase(@NonNull String);
-    method public android.net.wifi.WifiNetworkSuggestion.Builder setWpa3EnterpriseConfig(@NonNull android.net.wifi.WifiEnterpriseConfig);
-    method public android.net.wifi.WifiNetworkSuggestion.Builder setWpa3Passphrase(@NonNull String);
+    method @NonNull public android.net.wifi.WifiNetworkSuggestion build();
+    method @NonNull public android.net.wifi.WifiNetworkSuggestion.Builder setBssid(@NonNull android.net.MacAddress);
+    method @NonNull public android.net.wifi.WifiNetworkSuggestion.Builder setIsAppInteractionRequired();
+    method @NonNull public android.net.wifi.WifiNetworkSuggestion.Builder setIsEnhancedOpen();
+    method @NonNull public android.net.wifi.WifiNetworkSuggestion.Builder setIsHiddenSsid();
+    method @NonNull public android.net.wifi.WifiNetworkSuggestion.Builder setIsMetered();
+    method @NonNull public android.net.wifi.WifiNetworkSuggestion.Builder setIsUserInteractionRequired();
+    method @NonNull public android.net.wifi.WifiNetworkSuggestion.Builder setPriority(int);
+    method @NonNull public android.net.wifi.WifiNetworkSuggestion.Builder setSsid(@NonNull String);
+    method @NonNull public android.net.wifi.WifiNetworkSuggestion.Builder setWpa2EnterpriseConfig(@NonNull android.net.wifi.WifiEnterpriseConfig);
+    method @NonNull public android.net.wifi.WifiNetworkSuggestion.Builder setWpa2Passphrase(@NonNull String);
+    method @NonNull public android.net.wifi.WifiNetworkSuggestion.Builder setWpa3EnterpriseConfig(@NonNull android.net.wifi.WifiEnterpriseConfig);
+    method @NonNull public android.net.wifi.WifiNetworkSuggestion.Builder setWpa3Passphrase(@NonNull String);
   }
 
   public class WpsInfo implements android.os.Parcelable {
@@ -30133,7 +30133,7 @@
     method public int describeContents();
     method public void writeToParcel(android.os.Parcel, int);
     field public String BSSID;
-    field public static final android.os.Parcelable.Creator<android.net.wifi.WpsInfo> CREATOR;
+    field @NonNull public static final android.os.Parcelable.Creator<android.net.wifi.WpsInfo> CREATOR;
     field public static final int DISPLAY = 1; // 0x1
     field public static final int INVALID = 4; // 0x4
     field public static final int KEYPAD = 2; // 0x2
@@ -30159,7 +30159,7 @@
     method public int getMaxServiceNameLength();
     method public int getMaxServiceSpecificInfoLength();
     method public void writeToParcel(android.os.Parcel, int);
-    field public static final android.os.Parcelable.Creator<android.net.wifi.aware.Characteristics> CREATOR;
+    field @NonNull public static final android.os.Parcelable.Creator<android.net.wifi.aware.Characteristics> CREATOR;
   }
 
   public class DiscoverySession implements java.lang.AutoCloseable {
@@ -30189,10 +30189,10 @@
   }
 
   public final class ParcelablePeerHandle extends android.net.wifi.aware.PeerHandle implements android.os.Parcelable {
-    ctor public ParcelablePeerHandle(android.net.wifi.aware.PeerHandle);
+    ctor public ParcelablePeerHandle(@NonNull android.net.wifi.aware.PeerHandle);
     method public int describeContents();
     method public void writeToParcel(android.os.Parcel, int);
-    field public static final android.os.Parcelable.Creator<android.net.wifi.aware.ParcelablePeerHandle> CREATOR;
+    field @NonNull public static final android.os.Parcelable.Creator<android.net.wifi.aware.ParcelablePeerHandle> CREATOR;
   }
 
   public class PeerHandle {
@@ -30201,7 +30201,7 @@
   public final class PublishConfig 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.net.wifi.aware.PublishConfig> CREATOR;
+    field @NonNull public static final android.os.Parcelable.Creator<android.net.wifi.aware.PublishConfig> CREATOR;
     field public static final int PUBLISH_TYPE_SOLICITED = 1; // 0x1
     field public static final int PUBLISH_TYPE_UNSOLICITED = 0; // 0x0
   }
@@ -30225,7 +30225,7 @@
   public final class SubscribeConfig 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.net.wifi.aware.SubscribeConfig> CREATOR;
+    field @NonNull public static final android.os.Parcelable.Creator<android.net.wifi.aware.SubscribeConfig> CREATOR;
     field public static final int SUBSCRIBE_TYPE_ACTIVE = 1; // 0x1
     field public static final int SUBSCRIBE_TYPE_PASSIVE = 0; // 0x0
   }
@@ -30257,23 +30257,29 @@
     field public static final int WIFI_AWARE_DATA_PATH_ROLE_RESPONDER = 1; // 0x1
   }
 
-  public static class WifiAwareManager.NetworkSpecifierBuilder {
-    ctor public WifiAwareManager.NetworkSpecifierBuilder();
-    method @NonNull public android.net.NetworkSpecifier build();
-    method @NonNull public android.net.wifi.aware.WifiAwareManager.NetworkSpecifierBuilder setDiscoverySession(@NonNull android.net.wifi.aware.DiscoverySession);
-    method @NonNull public android.net.wifi.aware.WifiAwareManager.NetworkSpecifierBuilder setPeerHandle(@NonNull android.net.wifi.aware.PeerHandle);
-    method @NonNull public android.net.wifi.aware.WifiAwareManager.NetworkSpecifierBuilder setPort(int);
-    method @NonNull public android.net.wifi.aware.WifiAwareManager.NetworkSpecifierBuilder setPskPassphrase(@NonNull String);
-    method @NonNull public android.net.wifi.aware.WifiAwareManager.NetworkSpecifierBuilder setTransportProtocol(int);
-  }
-
   public final class WifiAwareNetworkInfo implements android.os.Parcelable android.net.TransportInfo {
     method public int describeContents();
     method @Nullable public java.net.Inet6Address getPeerIpv6Addr();
     method public int getPort();
     method public int getTransportProtocol();
     method public void writeToParcel(android.os.Parcel, int);
-    field public static final android.os.Parcelable.Creator<android.net.wifi.aware.WifiAwareNetworkInfo> CREATOR;
+    field @NonNull public static final android.os.Parcelable.Creator<android.net.wifi.aware.WifiAwareNetworkInfo> CREATOR;
+  }
+
+  public final class WifiAwareNetworkSpecifier extends android.net.NetworkSpecifier implements android.os.Parcelable {
+    method public int describeContents();
+    method public void writeToParcel(android.os.Parcel, int);
+    field @NonNull public static final android.os.Parcelable.Creator<android.net.wifi.aware.WifiAwareNetworkSpecifier> CREATOR;
+  }
+
+  public static final class WifiAwareNetworkSpecifier.Builder {
+    ctor public WifiAwareNetworkSpecifier.Builder();
+    method @NonNull public android.net.wifi.aware.WifiAwareNetworkSpecifier build();
+    method @NonNull public android.net.wifi.aware.WifiAwareNetworkSpecifier.Builder setDiscoverySession(@NonNull android.net.wifi.aware.DiscoverySession);
+    method @NonNull public android.net.wifi.aware.WifiAwareNetworkSpecifier.Builder setPeerHandle(@NonNull android.net.wifi.aware.PeerHandle);
+    method @NonNull public android.net.wifi.aware.WifiAwareNetworkSpecifier.Builder setPort(int);
+    method @NonNull public android.net.wifi.aware.WifiAwareNetworkSpecifier.Builder setPskPassphrase(@NonNull String);
+    method @NonNull public android.net.wifi.aware.WifiAwareNetworkSpecifier.Builder setTransportProtocol(int);
   }
 
   public class WifiAwareSession implements java.lang.AutoCloseable {
@@ -30301,7 +30307,7 @@
     method public void setCredential(android.net.wifi.hotspot2.pps.Credential);
     method public void setHomeSp(android.net.wifi.hotspot2.pps.HomeSp);
     method public void writeToParcel(android.os.Parcel, int);
-    field public static final android.os.Parcelable.Creator<android.net.wifi.hotspot2.PasspointConfiguration> CREATOR;
+    field @NonNull public static final android.os.Parcelable.Creator<android.net.wifi.hotspot2.PasspointConfiguration> CREATOR;
   }
 
 }
@@ -30335,7 +30341,7 @@
     method public void setSimCredential(android.net.wifi.hotspot2.pps.Credential.SimCredential);
     method public void setUserCredential(android.net.wifi.hotspot2.pps.Credential.UserCredential);
     method public void writeToParcel(android.os.Parcel, int);
-    field public static final android.os.Parcelable.Creator<android.net.wifi.hotspot2.pps.Credential> CREATOR;
+    field @NonNull public static final android.os.Parcelable.Creator<android.net.wifi.hotspot2.pps.Credential> CREATOR;
   }
 
   public static final class Credential.CertificateCredential implements android.os.Parcelable {
@@ -30347,7 +30353,7 @@
     method public void setCertSha256Fingerprint(byte[]);
     method public void setCertType(String);
     method public void writeToParcel(android.os.Parcel, int);
-    field public static final android.os.Parcelable.Creator<android.net.wifi.hotspot2.pps.Credential.CertificateCredential> CREATOR;
+    field @NonNull public static final android.os.Parcelable.Creator<android.net.wifi.hotspot2.pps.Credential.CertificateCredential> CREATOR;
   }
 
   public static final class Credential.SimCredential implements android.os.Parcelable {
@@ -30359,7 +30365,7 @@
     method public void setEapType(int);
     method public void setImsi(String);
     method public void writeToParcel(android.os.Parcel, int);
-    field public static final android.os.Parcelable.Creator<android.net.wifi.hotspot2.pps.Credential.SimCredential> CREATOR;
+    field @NonNull public static final android.os.Parcelable.Creator<android.net.wifi.hotspot2.pps.Credential.SimCredential> CREATOR;
   }
 
   public static final class Credential.UserCredential implements android.os.Parcelable {
@@ -30375,7 +30381,7 @@
     method public void setPassword(String);
     method public void setUsername(String);
     method public void writeToParcel(android.os.Parcel, int);
-    field public static final android.os.Parcelable.Creator<android.net.wifi.hotspot2.pps.Credential.UserCredential> CREATOR;
+    field @NonNull public static final android.os.Parcelable.Creator<android.net.wifi.hotspot2.pps.Credential.UserCredential> CREATOR;
   }
 
   public final class HomeSp implements android.os.Parcelable {
@@ -30389,7 +30395,7 @@
     method public void setFriendlyName(String);
     method public void setRoamingConsortiumOis(long[]);
     method public void writeToParcel(android.os.Parcel, int);
-    field public static final android.os.Parcelable.Creator<android.net.wifi.hotspot2.pps.HomeSp> CREATOR;
+    field @NonNull public static final android.os.Parcelable.Creator<android.net.wifi.hotspot2.pps.HomeSp> CREATOR;
   }
 
 }
@@ -30401,7 +30407,7 @@
     ctor public WifiP2pConfig(android.net.wifi.p2p.WifiP2pConfig);
     method public int describeContents();
     method public void writeToParcel(android.os.Parcel, int);
-    field public static final android.os.Parcelable.Creator<android.net.wifi.p2p.WifiP2pConfig> CREATOR;
+    field @NonNull public static final android.os.Parcelable.Creator<android.net.wifi.p2p.WifiP2pConfig> CREATOR;
     field public static final int GROUP_OWNER_BAND_2GHZ = 1; // 0x1
     field public static final int GROUP_OWNER_BAND_5GHZ = 2; // 0x2
     field public static final int GROUP_OWNER_BAND_AUTO = 0; // 0x0
@@ -30412,13 +30418,13 @@
 
   public static final class WifiP2pConfig.Builder {
     ctor public WifiP2pConfig.Builder();
-    method public android.net.wifi.p2p.WifiP2pConfig build();
-    method public android.net.wifi.p2p.WifiP2pConfig.Builder enablePersistentMode(boolean);
-    method public android.net.wifi.p2p.WifiP2pConfig.Builder setDeviceAddress(android.net.MacAddress);
-    method public android.net.wifi.p2p.WifiP2pConfig.Builder setGroupOperatingBand(int);
-    method public android.net.wifi.p2p.WifiP2pConfig.Builder setGroupOperatingFrequency(int);
-    method public android.net.wifi.p2p.WifiP2pConfig.Builder setNetworkName(String);
-    method public android.net.wifi.p2p.WifiP2pConfig.Builder setPassphrase(String);
+    method @NonNull public android.net.wifi.p2p.WifiP2pConfig build();
+    method @NonNull public android.net.wifi.p2p.WifiP2pConfig.Builder enablePersistentMode(boolean);
+    method @NonNull public android.net.wifi.p2p.WifiP2pConfig.Builder setDeviceAddress(@Nullable android.net.MacAddress);
+    method @NonNull public android.net.wifi.p2p.WifiP2pConfig.Builder setGroupOperatingBand(int);
+    method @NonNull public android.net.wifi.p2p.WifiP2pConfig.Builder setGroupOperatingFrequency(int);
+    method @NonNull public android.net.wifi.p2p.WifiP2pConfig.Builder setNetworkName(@NonNull String);
+    method @NonNull public android.net.wifi.p2p.WifiP2pConfig.Builder setPassphrase(@NonNull String);
   }
 
   public class WifiP2pDevice implements android.os.Parcelable {
@@ -30433,7 +30439,7 @@
     method public void writeToParcel(android.os.Parcel, int);
     field public static final int AVAILABLE = 3; // 0x3
     field public static final int CONNECTED = 0; // 0x0
-    field public static final android.os.Parcelable.Creator<android.net.wifi.p2p.WifiP2pDevice> CREATOR;
+    field @NonNull public static final android.os.Parcelable.Creator<android.net.wifi.p2p.WifiP2pDevice> CREATOR;
     field public static final int FAILED = 2; // 0x2
     field public static final int INVITED = 1; // 0x1
     field public static final int UNAVAILABLE = 4; // 0x4
@@ -30451,7 +30457,7 @@
     method public android.net.wifi.p2p.WifiP2pDevice get(String);
     method public java.util.Collection<android.net.wifi.p2p.WifiP2pDevice> getDeviceList();
     method public void writeToParcel(android.os.Parcel, int);
-    field public static final android.os.Parcelable.Creator<android.net.wifi.p2p.WifiP2pDeviceList> CREATOR;
+    field @NonNull public static final android.os.Parcelable.Creator<android.net.wifi.p2p.WifiP2pDeviceList> CREATOR;
   }
 
   public class WifiP2pGroup implements android.os.Parcelable {
@@ -30466,7 +30472,7 @@
     method public String getPassphrase();
     method public boolean isGroupOwner();
     method public void writeToParcel(android.os.Parcel, int);
-    field public static final android.os.Parcelable.Creator<android.net.wifi.p2p.WifiP2pGroup> CREATOR;
+    field @NonNull public static final android.os.Parcelable.Creator<android.net.wifi.p2p.WifiP2pGroup> CREATOR;
   }
 
   public class WifiP2pInfo implements android.os.Parcelable {
@@ -30474,7 +30480,7 @@
     ctor public WifiP2pInfo(android.net.wifi.p2p.WifiP2pInfo);
     method public int describeContents();
     method public void writeToParcel(android.os.Parcel, int);
-    field public static final android.os.Parcelable.Creator<android.net.wifi.p2p.WifiP2pInfo> CREATOR;
+    field @NonNull public static final android.os.Parcelable.Creator<android.net.wifi.p2p.WifiP2pInfo> CREATOR;
     field public boolean groupFormed;
     field public java.net.InetAddress groupOwnerAddress;
     field public boolean isGroupOwner;
@@ -30546,7 +30552,7 @@
   }
 
   public static interface WifiP2pManager.DeviceInfoListener {
-    method public void onDeviceInfoAvailable(android.net.wifi.p2p.WifiP2pDevice);
+    method public void onDeviceInfoAvailable(@Nullable android.net.wifi.p2p.WifiP2pDevice);
   }
 
   public static interface WifiP2pManager.DiscoveryStateListener {
@@ -30566,7 +30572,7 @@
   }
 
   public static interface WifiP2pManager.NetworkInfoListener {
-    method public void onNetworkInfoAvailable(android.net.NetworkInfo);
+    method public void onNetworkInfoAvailable(@NonNull android.net.NetworkInfo);
   }
 
   public static interface WifiP2pManager.P2pStateListener {
@@ -30628,11 +30634,46 @@
 
 package android.net.wifi.rtt {
 
+  public class CivicLocationKeys {
+    field public static final int ADDITIONAL_CODE = 32; // 0x20
+    field public static final int APT = 26; // 0x1a
+    field public static final int BOROUGH = 4; // 0x4
+    field public static final int BRANCH_ROAD_NAME = 36; // 0x24
+    field public static final int BUILDING = 25; // 0x19
+    field public static final int CITY = 3; // 0x3
+    field public static final int COUNTY = 2; // 0x2
+    field public static final int DESK = 33; // 0x21
+    field public static final int FLOOR = 27; // 0x1b
+    field public static final int GROUP_OF_STREETS = 6; // 0x6
+    field public static final int HNO = 19; // 0x13
+    field public static final int HNS = 20; // 0x14
+    field public static final int LANGUAGE = 0; // 0x0
+    field public static final int LMK = 21; // 0x15
+    field public static final int LOC = 22; // 0x16
+    field public static final int NAM = 23; // 0x17
+    field public static final int NEIGHBORHOOD = 5; // 0x5
+    field public static final int PCN = 30; // 0x1e
+    field public static final int POD = 17; // 0x11
+    field public static final int POSTAL_CODE = 24; // 0x18
+    field public static final int PO_BOX = 31; // 0x1f
+    field public static final int PRD = 16; // 0x10
+    field public static final int PRIMARY_ROAD_NAME = 34; // 0x22
+    field public static final int ROAD_SECTION = 35; // 0x23
+    field public static final int ROOM = 28; // 0x1c
+    field public static final int SCRIPT = 128; // 0x80
+    field public static final int STATE = 1; // 0x1
+    field public static final int STREET_NAME_POST_MODIFIER = 39; // 0x27
+    field public static final int STREET_NAME_PRE_MODIFIER = 38; // 0x26
+    field public static final int STS = 18; // 0x12
+    field public static final int SUBBRANCH_ROAD_NAME = 37; // 0x25
+    field public static final int TYPE_OF_PLACE = 29; // 0x1d
+  }
+
   public final class RangingRequest implements android.os.Parcelable {
     method public int describeContents();
     method public static int getMaxPeers();
     method public void writeToParcel(android.os.Parcel, int);
-    field public static final android.os.Parcelable.Creator<android.net.wifi.rtt.RangingRequest> CREATOR;
+    field @NonNull public static final android.os.Parcelable.Creator<android.net.wifi.rtt.RangingRequest> CREATOR;
   }
 
   public static final class RangingRequest.Builder {
@@ -30653,11 +30694,11 @@
     method public int getNumSuccessfulMeasurements();
     method @Nullable public android.net.wifi.aware.PeerHandle getPeerHandle();
     method public long getRangingTimestampMillis();
-    method @Nullable public android.net.wifi.rtt.ResponderLocation getResponderLocation();
     method public int getRssi();
     method public int getStatus();
+    method @Nullable public android.net.wifi.rtt.ResponderLocation getUnverifiedResponderLocation();
     method public void writeToParcel(android.os.Parcel, int);
-    field public static final android.os.Parcelable.Creator<android.net.wifi.rtt.RangingResult> CREATOR;
+    field @NonNull public static final android.os.Parcelable.Creator<android.net.wifi.rtt.RangingResult> CREATOR;
     field public static final int STATUS_FAIL = 1; // 0x1
     field public static final int STATUS_RESPONDER_DOES_NOT_SUPPORT_IEEE80211MC = 2; // 0x2
     field public static final int STATUS_SUCCESS = 0; // 0x0
@@ -30678,55 +30719,39 @@
     method public double getAltitudeUncertainty();
     method public java.util.List<android.net.MacAddress> getColocatedBssids();
     method public int getDatum();
+    method public boolean getDependentStationIndication();
     method public int getExpectedToMove();
+    method public double getFloorNumber();
+    method public double getHeightAboveFloorMeters();
+    method public double getHeightAboveFloorUncertaintyMeters();
     method public double getLatitude();
     method public double getLatitudeUncertainty();
-    method public int getLciFlags();
+    method public int getLciVersion();
     method public double getLongitude();
     method public double getLongitudeUncertainty();
-    method public int getMapImageType();
-    method @Nullable public java.net.URL getMapImageUrl();
-    method public double getStaFloorNumber();
-    method public double getStaHeightAboveFloorMeters();
-    method public double getStaHeightAboveFloorUncertaintyMeters();
+    method @Nullable public String getMapImageMimeType();
+    method @Nullable public android.net.Uri getMapImageUri();
+    method public boolean getRegisteredLocationAgreementIndication();
+    method public boolean getRegisteredLocationDseIndication();
     method public boolean isLciSubelementValid();
-    method public boolean isZsubelementValid();
+    method public boolean isZaxisSubelementValid();
+    method @Nullable public android.location.Address toCivicLocationAddress();
+    method @Nullable public android.util.SparseArray toCivicLocationSparseArray();
+    method @NonNull public android.location.Location toLocation();
     method public void writeToParcel(android.os.Parcel, int);
     field public static final int ALTITUDE_FLOORS = 2; // 0x2
     field public static final int ALTITUDE_METERS = 1; // 0x1
     field public static final int ALTITUDE_UNDEFINED = 0; // 0x0
-    field public static final android.os.Parcelable.Creator<android.net.wifi.rtt.ResponderLocation> CREATOR;
+    field @NonNull public static final android.os.Parcelable.Creator<android.net.wifi.rtt.ResponderLocation> CREATOR;
     field public static final int DATUM_NAD83_MLLW = 3; // 0x3
     field public static final int DATUM_NAD83_NAV88 = 2; // 0x2
     field public static final int DATUM_UNDEFINED = 0; // 0x0
     field public static final int DATUM_WGS84 = 1; // 0x1
-    field public static final int LCI_FLAGS_MASK_DEPENDENT_STA = 4; // 0x4
-    field public static final int LCI_FLAGS_MASK_REGLOC_AGREEMENT = 16; // 0x10
-    field public static final int LCI_FLAGS_MASK_REGLOC_DSE = 8; // 0x8
-    field public static final int LCI_FLAGS_MASK_VERSION = 3; // 0x3
     field public static final int LCI_VERSION_1 = 1; // 0x1
     field public static final int LOCATION_FIXED = 0; // 0x0
     field public static final int LOCATION_MOVEMENT_UNKNOWN = 2; // 0x2
     field public static final int LOCATION_RESERVED = 3; // 0x3
     field public static final int LOCATION_VARIABLE = 1; // 0x1
-    field public static final int MAP_TYPE_BMP = 12; // 0xc
-    field public static final int MAP_TYPE_CAD = 8; // 0x8
-    field public static final int MAP_TYPE_DWF = 7; // 0x7
-    field public static final int MAP_TYPE_DWG = 6; // 0x6
-    field public static final int MAP_TYPE_DXF = 5; // 0x5
-    field public static final int MAP_TYPE_GIF = 2; // 0x2
-    field public static final int MAP_TYPE_GML = 10; // 0xa
-    field public static final int MAP_TYPE_ICO = 17; // 0x11
-    field public static final int MAP_TYPE_JPG = 3; // 0x3
-    field public static final int MAP_TYPE_KML = 11; // 0xb
-    field public static final int MAP_TYPE_PGM = 13; // 0xd
-    field public static final int MAP_TYPE_PNG = 1; // 0x1
-    field public static final int MAP_TYPE_PPM = 14; // 0xe
-    field public static final int MAP_TYPE_SVG = 4; // 0x4
-    field public static final int MAP_TYPE_TIFF = 9; // 0x9
-    field public static final int MAP_TYPE_URL_DEFINED = 0; // 0x0
-    field public static final int MAP_TYPE_XBM = 15; // 0xf
-    field public static final int MAP_TYPE_XPM = 16; // 0x10
   }
 
   public class WifiRttManager {
@@ -30754,7 +30779,7 @@
     method public android.nfc.NdefRecord[] getRecords();
     method public byte[] toByteArray();
     method public void writeToParcel(android.os.Parcel, int);
-    field public static final android.os.Parcelable.Creator<android.nfc.NdefMessage> CREATOR;
+    field @NonNull public static final android.os.Parcelable.Creator<android.nfc.NdefMessage> CREATOR;
   }
 
   public final class NdefRecord implements android.os.Parcelable {
@@ -30775,7 +30800,7 @@
     method public String toMimeType();
     method public android.net.Uri toUri();
     method public void writeToParcel(android.os.Parcel, int);
-    field public static final android.os.Parcelable.Creator<android.nfc.NdefRecord> CREATOR;
+    field @NonNull public static final android.os.Parcelable.Creator<android.nfc.NdefRecord> CREATOR;
     field public static final byte[] RTD_ALTERNATIVE_CARRIER;
     field public static final byte[] RTD_HANDOVER_CARRIER;
     field public static final byte[] RTD_HANDOVER_REQUEST;
@@ -30793,7 +30818,6 @@
   }
 
   public final class NfcAdapter {
-    method public boolean deviceSupportsNfcSecure();
     method public void disableForegroundDispatch(android.app.Activity);
     method @Deprecated public void disableForegroundNdefPush(android.app.Activity);
     method public void disableReaderMode(android.app.Activity);
@@ -30806,7 +30830,8 @@
     method @Deprecated public boolean invokeBeam(android.app.Activity);
     method public boolean isEnabled();
     method @Deprecated public boolean isNdefPushEnabled();
-    method public boolean isNfcSecureEnabled();
+    method public boolean isSecureNfcEnabled();
+    method public boolean isSecureNfcSupported();
     method @Deprecated public void setBeamPushUris(android.net.Uri[], android.app.Activity);
     method @Deprecated public void setBeamPushUrisCallback(android.nfc.NfcAdapter.CreateBeamUrisCallback, android.app.Activity);
     method @Deprecated public void setNdefPushMessage(android.nfc.NdefMessage, android.app.Activity, android.app.Activity...);
@@ -30873,7 +30898,7 @@
     method public byte[] getId();
     method public String[] getTechList();
     method public void writeToParcel(android.os.Parcel, int);
-    field public static final android.os.Parcelable.Creator<android.nfc.Tag> CREATOR;
+    field @NonNull public static final android.os.Parcelable.Creator<android.nfc.Tag> CREATOR;
   }
 
   public class TagLostException extends java.io.IOException {
@@ -30894,10 +30919,10 @@
     method public boolean isDefaultServiceForCategory(android.content.ComponentName, String);
     method public boolean registerAidsForService(android.content.ComponentName, String, java.util.List<java.lang.String>);
     method public boolean removeAidsForService(android.content.ComponentName, String);
-    method public boolean setOffHostForService(android.content.ComponentName, String);
+    method public boolean setOffHostForService(@NonNull android.content.ComponentName, @NonNull String);
     method public boolean setPreferredService(android.app.Activity, android.content.ComponentName);
     method public boolean supportsAidPrefixRegistration();
-    method public boolean unsetOffHostForService(android.content.ComponentName);
+    method public boolean unsetOffHostForService(@NonNull android.content.ComponentName);
     method public boolean unsetPreferredService(android.app.Activity);
     field public static final String ACTION_CHANGE_DEFAULT = "android.nfc.cardemulation.action.ACTION_CHANGE_DEFAULT";
     field public static final String CATEGORY_OTHER = "other";
@@ -34385,7 +34410,7 @@
     method public void readFromParcel(android.os.Parcel);
     method public void setClassLoader(ClassLoader);
     method public void writeToParcel(android.os.Parcel, int);
-    field public static final android.os.Parcelable.Creator<android.os.Bundle> CREATOR;
+    field @NonNull public static final android.os.Parcelable.Creator<android.os.Bundle> CREATOR;
     field public static final android.os.Bundle EMPTY;
   }
 
@@ -34423,7 +34448,7 @@
     method public long getActive();
     method public long getTotal();
     method public void writeToParcel(android.os.Parcel, int);
-    field public static final android.os.Parcelable.Creator<android.os.CpuUsageInfo> CREATOR;
+    field @NonNull public static final android.os.Parcelable.Creator<android.os.CpuUsageInfo> CREATOR;
   }
 
   public class DeadObjectException extends android.os.RemoteException {
@@ -34531,7 +34556,7 @@
     method public int getTotalSwappablePss();
     method public void readFromParcel(android.os.Parcel);
     method public void writeToParcel(android.os.Parcel, int);
-    field public static final android.os.Parcelable.Creator<android.os.Debug.MemoryInfo> CREATOR;
+    field @NonNull public static final android.os.Parcelable.Creator<android.os.Debug.MemoryInfo> CREATOR;
     field public int dalvikPrivateDirty;
     field public int dalvikPss;
     field public int dalvikSharedDirty;
@@ -34572,7 +34597,7 @@
     method public String getText(int);
     method public long getTimeMillis();
     method public void writeToParcel(android.os.Parcel, int);
-    field public static final android.os.Parcelable.Creator<android.os.DropBoxManager.Entry> CREATOR;
+    field @NonNull public static final android.os.Parcelable.Creator<android.os.DropBoxManager.Entry> CREATOR;
   }
 
   public class Environment {
@@ -34583,7 +34608,7 @@
     method public static java.io.File getExternalStoragePublicDirectory(String);
     method public static String getExternalStorageState();
     method public static String getExternalStorageState(java.io.File);
-    method public static java.io.File getRootDirectory();
+    method @NonNull public static java.io.File getRootDirectory();
     method @Deprecated public static String getStorageState(java.io.File);
     method public static boolean isExternalStorageEmulated();
     method public static boolean isExternalStorageEmulated(java.io.File);
@@ -34659,46 +34684,46 @@
 
   public class Handler {
     ctor public Handler();
-    ctor public Handler(android.os.Handler.Callback);
-    ctor public Handler(android.os.Looper);
-    ctor public Handler(android.os.Looper, android.os.Handler.Callback);
+    ctor public Handler(@Nullable android.os.Handler.Callback);
+    ctor public Handler(@NonNull android.os.Looper);
+    ctor public Handler(@NonNull android.os.Looper, @Nullable android.os.Handler.Callback);
     method @NonNull public static android.os.Handler createAsync(@NonNull android.os.Looper);
     method @NonNull public static android.os.Handler createAsync(@NonNull android.os.Looper, @NonNull android.os.Handler.Callback);
-    method public void dispatchMessage(android.os.Message);
-    method public final void dump(android.util.Printer, String);
-    method public final android.os.Looper getLooper();
-    method public String getMessageName(android.os.Message);
-    method public void handleMessage(android.os.Message);
-    method public final boolean hasCallbacks(Runnable);
+    method public void dispatchMessage(@NonNull android.os.Message);
+    method public final void dump(@NonNull android.util.Printer, @NonNull String);
+    method @NonNull public final android.os.Looper getLooper();
+    method @NonNull public String getMessageName(@NonNull android.os.Message);
+    method public void handleMessage(@NonNull android.os.Message);
+    method public final boolean hasCallbacks(@NonNull Runnable);
     method public final boolean hasMessages(int);
-    method public final boolean hasMessages(int, Object);
-    method public final android.os.Message obtainMessage();
-    method public final android.os.Message obtainMessage(int);
-    method public final android.os.Message obtainMessage(int, Object);
-    method public final android.os.Message obtainMessage(int, int, int);
-    method public final android.os.Message obtainMessage(int, int, int, Object);
-    method public final boolean post(Runnable);
-    method public final boolean postAtFrontOfQueue(Runnable);
-    method public final boolean postAtTime(Runnable, long);
-    method public final boolean postAtTime(Runnable, Object, long);
-    method public final boolean postDelayed(Runnable, long);
-    method public final boolean postDelayed(Runnable, Object, long);
-    method public final void removeCallbacks(Runnable);
-    method public final void removeCallbacks(Runnable, Object);
-    method public final void removeCallbacksAndMessages(Object);
+    method public final boolean hasMessages(int, @Nullable Object);
+    method @NonNull public final android.os.Message obtainMessage();
+    method @NonNull public final android.os.Message obtainMessage(int);
+    method @NonNull public final android.os.Message obtainMessage(int, @Nullable Object);
+    method @NonNull public final android.os.Message obtainMessage(int, int, int);
+    method @NonNull public final android.os.Message obtainMessage(int, int, int, @Nullable Object);
+    method public final boolean post(@NonNull Runnable);
+    method public final boolean postAtFrontOfQueue(@NonNull Runnable);
+    method public final boolean postAtTime(@NonNull Runnable, long);
+    method public final boolean postAtTime(@NonNull Runnable, @Nullable Object, long);
+    method public final boolean postDelayed(@NonNull Runnable, long);
+    method public final boolean postDelayed(@NonNull Runnable, @Nullable Object, long);
+    method public final void removeCallbacks(@NonNull Runnable);
+    method public final void removeCallbacks(@NonNull Runnable, @Nullable Object);
+    method public final void removeCallbacksAndMessages(@Nullable Object);
     method public final void removeMessages(int);
-    method public final void removeMessages(int, Object);
+    method public final void removeMessages(int, @Nullable Object);
     method public final boolean sendEmptyMessage(int);
     method public final boolean sendEmptyMessageAtTime(int, long);
     method public final boolean sendEmptyMessageDelayed(int, long);
-    method public final boolean sendMessage(android.os.Message);
-    method public final boolean sendMessageAtFrontOfQueue(android.os.Message);
-    method public boolean sendMessageAtTime(android.os.Message, long);
-    method public final boolean sendMessageDelayed(android.os.Message, long);
+    method public final boolean sendMessage(@NonNull android.os.Message);
+    method public final boolean sendMessageAtFrontOfQueue(@NonNull android.os.Message);
+    method public boolean sendMessageAtTime(@NonNull android.os.Message, long);
+    method public final boolean sendMessageDelayed(@NonNull android.os.Message, long);
   }
 
   public static interface Handler.Callback {
-    method public boolean handleMessage(android.os.Message);
+    method public boolean handleMessage(@NonNull android.os.Message);
   }
 
   public class HandlerThread extends java.lang.Thread {
@@ -34769,7 +34794,7 @@
     method @IntRange(from=0) public int size();
     method @NonNull public String toLanguageTags();
     method public void writeToParcel(android.os.Parcel, int);
-    field public static final android.os.Parcelable.Creator<android.os.LocaleList> CREATOR;
+    field @NonNull public static final android.os.Parcelable.Creator<android.os.LocaleList> CREATOR;
   }
 
   public final class Looper {
@@ -34824,7 +34849,7 @@
     method public void setData(android.os.Bundle);
     method public void setTarget(android.os.Handler);
     method public void writeToParcel(android.os.Parcel, int);
-    field public static final android.os.Parcelable.Creator<android.os.Message> CREATOR;
+    field @NonNull public static final android.os.Parcelable.Creator<android.os.Message> CREATOR;
     field public int arg1;
     field public int arg2;
     field public Object obj;
@@ -34861,7 +34886,7 @@
     method public void send(android.os.Message) throws android.os.RemoteException;
     method public static void writeMessengerOrNullToParcel(android.os.Messenger, android.os.Parcel);
     method public void writeToParcel(android.os.Parcel, int);
-    field public static final android.os.Parcelable.Creator<android.os.Messenger> CREATOR;
+    field @NonNull public static final android.os.Parcelable.Creator<android.os.Messenger> CREATOR;
   }
 
   public class NetworkOnMainThreadException extends java.lang.RuntimeException {
@@ -35018,7 +35043,7 @@
     method public static android.os.ParcelFileDescriptor open(java.io.File, int, android.os.Handler, android.os.ParcelFileDescriptor.OnCloseListener) throws java.io.IOException;
     method public static int parseMode(String);
     method public void writeToParcel(android.os.Parcel, int);
-    field public static final android.os.Parcelable.Creator<android.os.ParcelFileDescriptor> CREATOR;
+    field @NonNull public static final android.os.Parcelable.Creator<android.os.ParcelFileDescriptor> CREATOR;
     field public static final int MODE_APPEND = 33554432; // 0x2000000
     field public static final int MODE_CREATE = 134217728; // 0x8000000
     field public static final int MODE_READ_ONLY = 268435456; // 0x10000000
@@ -35056,7 +35081,7 @@
     method public static android.os.ParcelUuid fromString(String);
     method public java.util.UUID getUuid();
     method public void writeToParcel(android.os.Parcel, int);
-    field public static final android.os.Parcelable.Creator<android.os.ParcelUuid> CREATOR;
+    field @NonNull public static final android.os.Parcelable.Creator<android.os.ParcelUuid> CREATOR;
   }
 
   public interface Parcelable {
@@ -35083,7 +35108,7 @@
     method public final int getType();
     method public boolean match(String);
     method public void writeToParcel(android.os.Parcel, int);
-    field public static final android.os.Parcelable.Creator<android.os.PatternMatcher> CREATOR;
+    field @NonNull public static final android.os.Parcelable.Creator<android.os.PatternMatcher> CREATOR;
     field public static final int PATTERN_ADVANCED_GLOB = 3; // 0x3
     field public static final int PATTERN_LITERAL = 0; // 0x0
     field public static final int PATTERN_PREFIX = 1; // 0x1
@@ -35100,11 +35125,13 @@
     method @Nullable public android.os.PersistableBundle getPersistableBundle(@Nullable String);
     method public void putPersistableBundle(@Nullable String, @Nullable android.os.PersistableBundle);
     method public void writeToParcel(android.os.Parcel, int);
-    field public static final android.os.Parcelable.Creator<android.os.PersistableBundle> CREATOR;
+    field @NonNull public static final android.os.Parcelable.Creator<android.os.PersistableBundle> CREATOR;
     field public static final android.os.PersistableBundle EMPTY;
   }
 
   public final class PowerManager {
+    method public void addThermalStatusListener(@NonNull android.os.PowerManager.OnThermalStatusChangedListener);
+    method public void addThermalStatusListener(@NonNull java.util.concurrent.Executor, @NonNull android.os.PowerManager.OnThermalStatusChangedListener);
     method public int getCurrentThermalStatus();
     method public int getLocationPowerSaveMode();
     method public boolean isDeviceIdleMode();
@@ -35116,8 +35143,7 @@
     method public boolean isWakeLockLevelSupported(int);
     method public android.os.PowerManager.WakeLock newWakeLock(int, String);
     method public void reboot(String);
-    method public void registerThermalStatusCallback(@NonNull android.os.PowerManager.ThermalStatusCallback, @NonNull java.util.concurrent.Executor);
-    method public void unregisterThermalStatusCallback(@NonNull android.os.PowerManager.ThermalStatusCallback);
+    method public void removeThermalStatusListener(@NonNull android.os.PowerManager.OnThermalStatusChangedListener);
     field public static final int ACQUIRE_CAUSES_WAKEUP = 268435456; // 0x10000000
     field public static final String ACTION_DEVICE_IDLE_MODE_CHANGED = "android.os.action.DEVICE_IDLE_MODE_CHANGED";
     field public static final String ACTION_POWER_SAVE_MODE_CHANGED = "android.os.action.POWER_SAVE_MODE_CHANGED";
@@ -35126,6 +35152,7 @@
     field public static final int LOCATION_MODE_FOREGROUND_ONLY = 3; // 0x3
     field public static final int LOCATION_MODE_GPS_DISABLED_WHEN_SCREEN_OFF = 1; // 0x1
     field public static final int LOCATION_MODE_NO_CHANGE = 0; // 0x0
+    field public static final int LOCATION_MODE_THROTTLE_REQUESTS_WHEN_SCREEN_OFF = 4; // 0x4
     field public static final int ON_AFTER_RELEASE = 536870912; // 0x20000000
     field public static final int PARTIAL_WAKE_LOCK = 1; // 0x1
     field public static final int PROXIMITY_SCREEN_OFF_WAKE_LOCK = 32; // 0x20
@@ -35141,9 +35168,8 @@
     field public static final int THERMAL_STATUS_SHUTDOWN = 6; // 0x6
   }
 
-  public abstract static class PowerManager.ThermalStatusCallback {
-    ctor public PowerManager.ThermalStatusCallback();
-    method public void onStatusChange(int);
+  public static interface PowerManager.OnThermalStatusChangedListener {
+    method public void onThermalStatusChanged(int);
   }
 
   public final class PowerManager.WakeLock {
@@ -35249,7 +35275,7 @@
     method protected void onReceiveResult(int, android.os.Bundle);
     method public void send(int, android.os.Bundle);
     method public void writeToParcel(android.os.Parcel, int);
-    field public static final android.os.Parcelable.Creator<android.os.ResultReceiver> CREATOR;
+    field @NonNull public static final android.os.Parcelable.Creator<android.os.ResultReceiver> CREATOR;
   }
 
   public final class SharedMemory implements java.io.Closeable android.os.Parcelable {
@@ -35263,7 +35289,7 @@
     method public boolean setProtect(int);
     method public static void unmap(@NonNull java.nio.ByteBuffer);
     method public void writeToParcel(@NonNull android.os.Parcel, int);
-    field public static final android.os.Parcelable.Creator<android.os.SharedMemory> CREATOR;
+    field @NonNull public static final android.os.Parcelable.Creator<android.os.SharedMemory> CREATOR;
   }
 
   public class StatFs {
@@ -35309,27 +35335,27 @@
     ctor public StrictMode.ThreadPolicy.Builder();
     ctor public StrictMode.ThreadPolicy.Builder(android.os.StrictMode.ThreadPolicy);
     method public android.os.StrictMode.ThreadPolicy build();
-    method public android.os.StrictMode.ThreadPolicy.Builder detectAll();
-    method public android.os.StrictMode.ThreadPolicy.Builder detectCustomSlowCalls();
-    method public android.os.StrictMode.ThreadPolicy.Builder detectDiskReads();
-    method public android.os.StrictMode.ThreadPolicy.Builder detectDiskWrites();
-    method public android.os.StrictMode.ThreadPolicy.Builder detectNetwork();
-    method public android.os.StrictMode.ThreadPolicy.Builder detectResourceMismatches();
-    method public android.os.StrictMode.ThreadPolicy.Builder detectUnbufferedIo();
-    method public android.os.StrictMode.ThreadPolicy.Builder penaltyDeath();
-    method public android.os.StrictMode.ThreadPolicy.Builder penaltyDeathOnNetwork();
-    method public android.os.StrictMode.ThreadPolicy.Builder penaltyDialog();
-    method public android.os.StrictMode.ThreadPolicy.Builder penaltyDropBox();
-    method public android.os.StrictMode.ThreadPolicy.Builder penaltyFlashScreen();
-    method public android.os.StrictMode.ThreadPolicy.Builder penaltyListener(@NonNull java.util.concurrent.Executor, @NonNull android.os.StrictMode.OnThreadViolationListener);
-    method public android.os.StrictMode.ThreadPolicy.Builder penaltyLog();
-    method public android.os.StrictMode.ThreadPolicy.Builder permitAll();
-    method public android.os.StrictMode.ThreadPolicy.Builder permitCustomSlowCalls();
-    method public android.os.StrictMode.ThreadPolicy.Builder permitDiskReads();
-    method public android.os.StrictMode.ThreadPolicy.Builder permitDiskWrites();
-    method public android.os.StrictMode.ThreadPolicy.Builder permitNetwork();
-    method public android.os.StrictMode.ThreadPolicy.Builder permitResourceMismatches();
-    method public android.os.StrictMode.ThreadPolicy.Builder permitUnbufferedIo();
+    method @NonNull public android.os.StrictMode.ThreadPolicy.Builder detectAll();
+    method @NonNull public android.os.StrictMode.ThreadPolicy.Builder detectCustomSlowCalls();
+    method @NonNull public android.os.StrictMode.ThreadPolicy.Builder detectDiskReads();
+    method @NonNull public android.os.StrictMode.ThreadPolicy.Builder detectDiskWrites();
+    method @NonNull public android.os.StrictMode.ThreadPolicy.Builder detectNetwork();
+    method @NonNull public android.os.StrictMode.ThreadPolicy.Builder detectResourceMismatches();
+    method @NonNull public android.os.StrictMode.ThreadPolicy.Builder detectUnbufferedIo();
+    method @NonNull public android.os.StrictMode.ThreadPolicy.Builder penaltyDeath();
+    method @NonNull public android.os.StrictMode.ThreadPolicy.Builder penaltyDeathOnNetwork();
+    method @NonNull public android.os.StrictMode.ThreadPolicy.Builder penaltyDialog();
+    method @NonNull public android.os.StrictMode.ThreadPolicy.Builder penaltyDropBox();
+    method @NonNull public android.os.StrictMode.ThreadPolicy.Builder penaltyFlashScreen();
+    method @NonNull public android.os.StrictMode.ThreadPolicy.Builder penaltyListener(@NonNull java.util.concurrent.Executor, @NonNull android.os.StrictMode.OnThreadViolationListener);
+    method @NonNull public android.os.StrictMode.ThreadPolicy.Builder penaltyLog();
+    method @NonNull public android.os.StrictMode.ThreadPolicy.Builder permitAll();
+    method @NonNull public android.os.StrictMode.ThreadPolicy.Builder permitCustomSlowCalls();
+    method @NonNull public android.os.StrictMode.ThreadPolicy.Builder permitDiskReads();
+    method @NonNull public android.os.StrictMode.ThreadPolicy.Builder permitDiskWrites();
+    method @NonNull public android.os.StrictMode.ThreadPolicy.Builder permitNetwork();
+    method @NonNull public android.os.StrictMode.ThreadPolicy.Builder permitResourceMismatches();
+    method @NonNull public android.os.StrictMode.ThreadPolicy.Builder permitUnbufferedIo();
   }
 
   public static final class StrictMode.VmPolicy {
@@ -35340,26 +35366,26 @@
     ctor public StrictMode.VmPolicy.Builder();
     ctor public StrictMode.VmPolicy.Builder(android.os.StrictMode.VmPolicy);
     method public android.os.StrictMode.VmPolicy build();
-    method public android.os.StrictMode.VmPolicy.Builder detectActivityLeaks();
-    method public android.os.StrictMode.VmPolicy.Builder detectAll();
-    method public android.os.StrictMode.VmPolicy.Builder detectCleartextNetwork();
-    method public android.os.StrictMode.VmPolicy.Builder detectContentUriWithoutPermission();
-    method public android.os.StrictMode.VmPolicy.Builder detectCredentialProtectedWhileLocked();
-    method public android.os.StrictMode.VmPolicy.Builder detectFileUriExposure();
-    method public android.os.StrictMode.VmPolicy.Builder detectImplicitDirectBoot();
-    method public android.os.StrictMode.VmPolicy.Builder detectLeakedClosableObjects();
-    method public android.os.StrictMode.VmPolicy.Builder detectLeakedRegistrationObjects();
-    method public android.os.StrictMode.VmPolicy.Builder detectLeakedSqlLiteObjects();
-    method public android.os.StrictMode.VmPolicy.Builder detectNonSdkApiUsage();
-    method public android.os.StrictMode.VmPolicy.Builder detectUntaggedSockets();
-    method public android.os.StrictMode.VmPolicy.Builder penaltyDeath();
-    method public android.os.StrictMode.VmPolicy.Builder penaltyDeathOnCleartextNetwork();
-    method public android.os.StrictMode.VmPolicy.Builder penaltyDeathOnFileUriExposure();
-    method public android.os.StrictMode.VmPolicy.Builder penaltyDropBox();
-    method public android.os.StrictMode.VmPolicy.Builder penaltyListener(@NonNull java.util.concurrent.Executor, @NonNull android.os.StrictMode.OnVmViolationListener);
-    method public android.os.StrictMode.VmPolicy.Builder penaltyLog();
-    method public android.os.StrictMode.VmPolicy.Builder permitNonSdkApiUsage();
-    method public android.os.StrictMode.VmPolicy.Builder setClassInstanceLimit(Class, int);
+    method @NonNull public android.os.StrictMode.VmPolicy.Builder detectActivityLeaks();
+    method @NonNull public android.os.StrictMode.VmPolicy.Builder detectAll();
+    method @NonNull public android.os.StrictMode.VmPolicy.Builder detectCleartextNetwork();
+    method @NonNull public android.os.StrictMode.VmPolicy.Builder detectContentUriWithoutPermission();
+    method @NonNull public android.os.StrictMode.VmPolicy.Builder detectCredentialProtectedWhileLocked();
+    method @NonNull public android.os.StrictMode.VmPolicy.Builder detectFileUriExposure();
+    method @NonNull public android.os.StrictMode.VmPolicy.Builder detectImplicitDirectBoot();
+    method @NonNull public android.os.StrictMode.VmPolicy.Builder detectLeakedClosableObjects();
+    method @NonNull public android.os.StrictMode.VmPolicy.Builder detectLeakedRegistrationObjects();
+    method @NonNull public android.os.StrictMode.VmPolicy.Builder detectLeakedSqlLiteObjects();
+    method @NonNull public android.os.StrictMode.VmPolicy.Builder detectNonSdkApiUsage();
+    method @NonNull public android.os.StrictMode.VmPolicy.Builder detectUntaggedSockets();
+    method @NonNull public android.os.StrictMode.VmPolicy.Builder penaltyDeath();
+    method @NonNull public android.os.StrictMode.VmPolicy.Builder penaltyDeathOnCleartextNetwork();
+    method @NonNull public android.os.StrictMode.VmPolicy.Builder penaltyDeathOnFileUriExposure();
+    method @NonNull public android.os.StrictMode.VmPolicy.Builder penaltyDropBox();
+    method @NonNull public android.os.StrictMode.VmPolicy.Builder penaltyListener(@NonNull java.util.concurrent.Executor, @NonNull android.os.StrictMode.OnVmViolationListener);
+    method @NonNull public android.os.StrictMode.VmPolicy.Builder penaltyLog();
+    method @NonNull public android.os.StrictMode.VmPolicy.Builder permitNonSdkApiUsage();
+    method @NonNull public android.os.StrictMode.VmPolicy.Builder setClassInstanceLimit(Class, int);
   }
 
   public final class SystemClock {
@@ -35414,7 +35440,7 @@
     method public static android.os.UserHandle readFromParcel(android.os.Parcel);
     method public void writeToParcel(android.os.Parcel, int);
     method public static void writeToParcel(android.os.UserHandle, android.os.Parcel);
-    field public static final android.os.Parcelable.Creator<android.os.UserHandle> CREATOR;
+    field @NonNull public static final android.os.Parcelable.Creator<android.os.UserHandle> CREATOR;
   }
 
   public class UserManager {
@@ -35515,11 +35541,11 @@
 
   public abstract class VibrationEffect implements android.os.Parcelable {
     method public static android.os.VibrationEffect createOneShot(long, int);
-    method public static android.os.VibrationEffect createPrebaked(int);
+    method @NonNull public static android.os.VibrationEffect createPredefined(int);
     method public static android.os.VibrationEffect createWaveform(long[], int);
     method public static android.os.VibrationEffect createWaveform(long[], int[], int);
     method public int describeContents();
-    field public static final android.os.Parcelable.Creator<android.os.VibrationEffect> CREATOR;
+    field @NonNull public static final android.os.Parcelable.Creator<android.os.VibrationEffect> CREATOR;
     field public static final int DEFAULT_AMPLITUDE = -1; // 0xffffffff
     field public static final int EFFECT_CLICK = 0; // 0x0
     field public static final int EFFECT_DOUBLE_CLICK = 1; // 0x1
@@ -35549,7 +35575,7 @@
     method public boolean remove(android.os.WorkSource);
     method public void set(android.os.WorkSource);
     method public void writeToParcel(android.os.Parcel, int);
-    field public static final android.os.Parcelable.Creator<android.os.WorkSource> CREATOR;
+    field @NonNull public static final android.os.Parcelable.Creator<android.os.WorkSource> CREATOR;
   }
 
 }
@@ -35623,7 +35649,7 @@
     method public void setCount(int);
     method public void setTime(long);
     method public void writeToParcel(android.os.Parcel, int);
-    field public static final android.os.Parcelable.Creator<android.os.health.TimerStat> CREATOR;
+    field @NonNull public static final android.os.Parcelable.Creator<android.os.health.TimerStat> CREATOR;
   }
 
   public final class UidHealthStats {
@@ -35748,7 +35774,7 @@
     method public boolean isPrimary();
     method public boolean isRemovable();
     method public void writeToParcel(android.os.Parcel, int);
-    field public static final android.os.Parcelable.Creator<android.os.storage.StorageVolume> CREATOR;
+    field @NonNull public static final android.os.Parcelable.Creator<android.os.storage.StorageVolume> CREATOR;
     field public static final String EXTRA_STORAGE_VOLUME = "android.os.storage.extra.STORAGE_VOLUME";
   }
 
@@ -36006,7 +36032,7 @@
   @Deprecated public static class Preference.BaseSavedState extends android.view.AbsSavedState {
     ctor @Deprecated public Preference.BaseSavedState(android.os.Parcel);
     ctor @Deprecated public Preference.BaseSavedState(android.os.Parcelable);
-    field @Deprecated public static final android.os.Parcelable.Creator<android.preference.Preference.BaseSavedState> CREATOR;
+    field @Deprecated @NonNull public static final android.os.Parcelable.Creator<android.preference.Preference.BaseSavedState> CREATOR;
   }
 
   @Deprecated public static interface Preference.OnPreferenceChangeListener {
@@ -36066,7 +36092,7 @@
     method @Deprecated public CharSequence getTitle(android.content.res.Resources);
     method @Deprecated public void readFromParcel(android.os.Parcel);
     method @Deprecated public void writeToParcel(android.os.Parcel, int);
-    field @Deprecated public static final android.os.Parcelable.Creator<android.preference.PreferenceActivity.Header> CREATOR;
+    field @Deprecated @NonNull public static final android.os.Parcelable.Creator<android.preference.PreferenceActivity.Header> CREATOR;
     field @Deprecated public CharSequence breadCrumbShortTitle;
     field @Deprecated @StringRes public int breadCrumbShortTitleRes;
     field @Deprecated public CharSequence breadCrumbTitle;
@@ -36240,7 +36266,7 @@
     method @IntRange(from=0) public int getStart();
     method public void writeToParcel(android.os.Parcel, int);
     field public static final android.print.PageRange ALL_PAGES;
-    field public static final android.os.Parcelable.Creator<android.print.PageRange> CREATOR;
+    field @NonNull public static final android.os.Parcelable.Creator<android.print.PageRange> CREATOR;
   }
 
   public final class PrintAttributes implements android.os.Parcelable {
@@ -36253,7 +36279,7 @@
     method public void writeToParcel(android.os.Parcel, int);
     field public static final int COLOR_MODE_COLOR = 2; // 0x2
     field public static final int COLOR_MODE_MONOCHROME = 1; // 0x1
-    field public static final android.os.Parcelable.Creator<android.print.PrintAttributes> CREATOR;
+    field @NonNull public static final android.os.Parcelable.Creator<android.print.PrintAttributes> CREATOR;
     field public static final int DUPLEX_MODE_LONG_EDGE = 2; // 0x2
     field public static final int DUPLEX_MODE_NONE = 1; // 0x1
     field public static final int DUPLEX_MODE_SHORT_EDGE = 4; // 0x4
@@ -36411,7 +36437,7 @@
     field public static final int CONTENT_TYPE_DOCUMENT = 0; // 0x0
     field public static final int CONTENT_TYPE_PHOTO = 1; // 0x1
     field public static final int CONTENT_TYPE_UNKNOWN = -1; // 0xffffffff
-    field public static final android.os.Parcelable.Creator<android.print.PrintDocumentInfo> CREATOR;
+    field @NonNull public static final android.os.Parcelable.Creator<android.print.PrintDocumentInfo> CREATOR;
     field public static final int PAGE_COUNT_UNKNOWN = -1; // 0xffffffff
   }
 
@@ -36438,7 +36464,7 @@
   public final class PrintJobId 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.print.PrintJobId> CREATOR;
+    field @NonNull public static final android.os.Parcelable.Creator<android.print.PrintJobId> CREATOR;
   }
 
   public final class PrintJobInfo implements android.os.Parcelable {
@@ -36455,7 +36481,7 @@
     method public int getState();
     method public boolean hasAdvancedOption(String);
     method public void writeToParcel(android.os.Parcel, int);
-    field public static final android.os.Parcelable.Creator<android.print.PrintJobInfo> CREATOR;
+    field @NonNull public static final android.os.Parcelable.Creator<android.print.PrintJobInfo> CREATOR;
     field public static final int STATE_BLOCKED = 4; // 0x4
     field public static final int STATE_CANCELED = 7; // 0x7
     field public static final int STATE_COMPLETED = 5; // 0x5
@@ -36489,7 +36515,7 @@
     method @NonNull public android.print.PrintAttributes.Margins getMinMargins();
     method @NonNull public java.util.List<android.print.PrintAttributes.Resolution> getResolutions();
     method public void writeToParcel(android.os.Parcel, int);
-    field public static final android.os.Parcelable.Creator<android.print.PrinterCapabilitiesInfo> CREATOR;
+    field @NonNull public static final android.os.Parcelable.Creator<android.print.PrinterCapabilitiesInfo> CREATOR;
   }
 
   public static final class PrinterCapabilitiesInfo.Builder {
@@ -36506,7 +36532,7 @@
     method public int describeContents();
     method @NonNull public String getLocalId();
     method public void writeToParcel(android.os.Parcel, int);
-    field public static final android.os.Parcelable.Creator<android.print.PrinterId> CREATOR;
+    field @NonNull public static final android.os.Parcelable.Creator<android.print.PrinterId> CREATOR;
   }
 
   public final class PrinterInfo implements android.os.Parcelable {
@@ -36517,7 +36543,7 @@
     method @NonNull public String getName();
     method public int getStatus();
     method public void writeToParcel(android.os.Parcel, int);
-    field public static final android.os.Parcelable.Creator<android.print.PrinterInfo> CREATOR;
+    field @NonNull public static final android.os.Parcelable.Creator<android.print.PrinterInfo> CREATOR;
     field public static final int STATUS_BUSY = 2; // 0x2
     field public static final int STATUS_IDLE = 1; // 0x1
     field public static final int STATUS_UNAVAILABLE = 3; // 0x3
@@ -38264,7 +38290,7 @@
     method public java.util.List<java.lang.String> getPath();
     method @Nullable public String getRootId();
     method public void writeToParcel(android.os.Parcel, int);
-    field public static final android.os.Parcelable.Creator<android.provider.DocumentsContract.Path> CREATOR;
+    field @NonNull public static final android.os.Parcelable.Creator<android.provider.DocumentsContract.Path> CREATOR;
   }
 
   public static final class DocumentsContract.Root {
@@ -38319,10 +38345,10 @@
     method public android.database.Cursor queryChildDocuments(String, @Nullable String[], @Nullable android.os.Bundle) throws java.io.FileNotFoundException;
     method public abstract android.database.Cursor queryDocument(String, String[]) throws java.io.FileNotFoundException;
     method public android.database.Cursor queryRecentDocuments(String, String[]) throws java.io.FileNotFoundException;
-    method public android.database.Cursor queryRecentDocuments(String, String[], @Nullable android.os.Bundle, @Nullable android.os.CancellationSignal) throws java.io.FileNotFoundException;
+    method @Nullable public android.database.Cursor queryRecentDocuments(@NonNull String, @Nullable String[], @Nullable android.os.Bundle, @Nullable android.os.CancellationSignal) throws java.io.FileNotFoundException;
     method public abstract android.database.Cursor queryRoots(String[]) throws java.io.FileNotFoundException;
     method public android.database.Cursor querySearchDocuments(String, String, String[]) throws java.io.FileNotFoundException;
-    method public android.database.Cursor querySearchDocuments(@NonNull String, @Nullable String[], @NonNull android.os.Bundle) throws java.io.FileNotFoundException;
+    method @Nullable public android.database.Cursor querySearchDocuments(@NonNull String, @Nullable String[], @NonNull android.os.Bundle) throws java.io.FileNotFoundException;
     method public void removeDocument(String, String) throws java.io.FileNotFoundException;
     method public String renameDocument(String, String) throws java.io.FileNotFoundException;
     method public final void revokeDocumentPermission(String);
@@ -38405,14 +38431,13 @@
 
   public final class MediaStore {
     ctor public MediaStore();
-    method @NonNull public static android.net.Uri createPending(@NonNull android.content.Context, @NonNull android.provider.MediaStore.PendingParams);
-    method @NonNull public static java.util.Set<java.lang.String> getAllVolumeNames(android.content.Context);
-    method public static android.net.Uri getDocumentUri(android.content.Context, android.net.Uri);
+    method @NonNull public static java.util.Set<java.lang.String> getAllVolumeNames(@NonNull android.content.Context);
+    method @Nullable public static android.net.Uri getDocumentUri(@NonNull android.content.Context, @NonNull android.net.Uri);
     method public static android.net.Uri getMediaScannerUri();
-    method public static android.net.Uri getMediaUri(android.content.Context, android.net.Uri);
-    method public static String getVersion(android.content.Context);
+    method @Nullable public static android.net.Uri getMediaUri(@NonNull android.content.Context, @NonNull android.net.Uri);
+    method @NonNull public static String getVersion(@NonNull android.content.Context);
+    method @NonNull public static String getVersion(@NonNull android.content.Context, @NonNull String);
     method @NonNull public static String getVolumeName(@NonNull android.net.Uri);
-    method @NonNull public static android.provider.MediaStore.PendingSession openPending(@NonNull android.content.Context, @NonNull android.net.Uri);
     method @NonNull public static android.net.Uri setIncludePending(@NonNull android.net.Uri);
     method @NonNull public static android.net.Uri setRequireOriginal(@NonNull android.net.Uri);
     field public static final String ACTION_IMAGE_CAPTURE = "android.media.action.IMAGE_CAPTURE";
@@ -38421,7 +38446,7 @@
     field public static final String ACTION_REVIEW_SECURE = "android.provider.action.REVIEW_SECURE";
     field public static final String ACTION_VIDEO_CAPTURE = "android.media.action.VIDEO_CAPTURE";
     field public static final String AUTHORITY = "media";
-    field public static final android.net.Uri AUTHORITY_URI;
+    field @NonNull public static final android.net.Uri AUTHORITY_URI;
     field public static final String EXTRA_BRIGHTNESS = "android.provider.extra.BRIGHTNESS";
     field public static final String EXTRA_DURATION_LIMIT = "android.intent.extra.durationLimit";
     field public static final String EXTRA_FINISH_ON_COMPLETION = "android.intent.extra.finishOnCompletion";
@@ -38601,10 +38626,10 @@
   }
 
   public static final class MediaStore.Downloads implements android.provider.MediaStore.DownloadColumns {
-    method public static android.net.Uri getContentUri(String);
+    method @NonNull public static android.net.Uri getContentUri(@NonNull String);
     field public static final String CONTENT_TYPE = "vnd.android.cursor.dir/download";
-    field public static final android.net.Uri EXTERNAL_CONTENT_URI;
-    field public static final android.net.Uri INTERNAL_CONTENT_URI;
+    field @NonNull public static final android.net.Uri EXTERNAL_CONTENT_URI;
+    field @NonNull public static final android.net.Uri INTERNAL_CONTENT_URI;
   }
 
   public static final class MediaStore.Files {
@@ -38685,6 +38710,7 @@
   public static interface MediaStore.MediaColumns extends android.provider.BaseColumns {
     field @Deprecated public static final String DATA = "_data";
     field public static final String DATE_ADDED = "date_added";
+    field public static final String DATE_EXPIRES = "date_expires";
     field public static final String DATE_MODIFIED = "date_modified";
     field public static final String DISPLAY_NAME = "_display_name";
     field public static final String DOCUMENT_ID = "document_id";
@@ -38701,23 +38727,6 @@
     field public static final String WIDTH = "width";
   }
 
-  public static class MediaStore.PendingParams {
-    ctor public MediaStore.PendingParams(@NonNull android.net.Uri, @NonNull String, @NonNull String);
-    method public void setDownloadUri(@Nullable android.net.Uri);
-    method public void setPrimaryDirectory(@Nullable String);
-    method public void setRefererUri(@Nullable android.net.Uri);
-    method public void setSecondaryDirectory(@Nullable String);
-  }
-
-  public static class MediaStore.PendingSession implements java.lang.AutoCloseable {
-    method public void abandon();
-    method public void close();
-    method public void notifyProgress(@IntRange(from=0, to=100) int);
-    method @NonNull public android.os.ParcelFileDescriptor open() throws java.io.FileNotFoundException;
-    method @NonNull public java.io.OutputStream openOutputStream() throws java.io.FileNotFoundException;
-    method @NonNull public android.net.Uri publish();
-  }
-
   public static final class MediaStore.Video {
     ctor public MediaStore.Video();
     method @Deprecated public static android.database.Cursor query(android.content.ContentResolver, android.net.Uri, String[]);
@@ -38842,7 +38851,7 @@
     field public static final String ACTION_NOTIFICATION_POLICY_ACCESS_SETTINGS = "android.settings.NOTIFICATION_POLICY_ACCESS_SETTINGS";
     field public static final String ACTION_PRINT_SETTINGS = "android.settings.ACTION_PRINT_SETTINGS";
     field public static final String ACTION_PRIVACY_SETTINGS = "android.settings.PRIVACY_SETTINGS";
-    field public static final String ACTION_PROCESS_WIFI_EASY_CONNECT_QR_CODE = "android.settings.PROCESS_WIFI_EASY_CONNECT_QR_CODE";
+    field public static final String ACTION_PROCESS_WIFI_EASY_CONNECT_URI = "android.settings.PROCESS_WIFI_EASY_CONNECT_URI";
     field public static final String ACTION_QUICK_LAUNCH_SETTINGS = "android.settings.QUICK_LAUNCH_SETTINGS";
     field public static final String ACTION_REQUEST_IGNORE_BATTERY_OPTIMIZATIONS = "android.settings.REQUEST_IGNORE_BATTERY_OPTIMIZATIONS";
     field public static final String ACTION_REQUEST_SET_AUTOFILL_SERVICE = "android.settings.REQUEST_SET_AUTOFILL_SERVICE";
@@ -38876,7 +38885,6 @@
     field public static final String EXTRA_DO_NOT_DISTURB_MODE_ENABLED = "android.settings.extra.do_not_disturb_mode_enabled";
     field public static final String EXTRA_DO_NOT_DISTURB_MODE_MINUTES = "android.settings.extra.do_not_disturb_mode_minutes";
     field public static final String EXTRA_INPUT_METHOD_ID = "input_method_id";
-    field public static final String EXTRA_QR_CODE = "android.provider.extra.QR_CODE";
     field public static final String EXTRA_SUB_ID = "android.provider.extra.SUB_ID";
     field public static final String INTENT_CATEGORY_USAGE_ACCESS_CONFIG = "android.intent.category.USAGE_ACCESS_CONFIG";
     field public static final String METADATA_USAGE_ACCESS_REASON = "android.settings.metadata.USAGE_ACCESS_REASON";
@@ -38954,6 +38962,7 @@
     field public static final String ACTION_INTERNET_CONNECTIVITY = "android.settings.panel.action.INTERNET_CONNECTIVITY";
     field public static final String ACTION_NFC = "android.settings.panel.action.NFC";
     field public static final String ACTION_VOLUME = "android.settings.panel.action.VOLUME";
+    field public static final String ACTION_WIFI = "android.settings.panel.action.WIFI";
   }
 
   public static final class Settings.Secure extends android.provider.Settings.NameValueTable {
@@ -39256,13 +39265,13 @@
   }
 
   public static final class Telephony.CarrierId implements android.provider.BaseColumns {
-    method public static android.net.Uri getPreciseCarrierIdUriForSubscriptionId(int);
+    method @NonNull public static android.net.Uri getSpecificCarrierIdUriForSubscriptionId(int);
     method public static android.net.Uri getUriForSubscriptionId(int);
     field public static final String CARRIER_ID = "carrier_id";
     field public static final String CARRIER_NAME = "carrier_name";
     field public static final android.net.Uri CONTENT_URI;
-    field public static final String PRECISE_CARRIER_ID = "precise_carrier_id";
-    field public static final String PRECISE_CARRIER_ID_NAME = "precise_carrier_id_name";
+    field public static final String SPECIFIC_CARRIER_ID = "specific_carrier_id";
+    field public static final String SPECIFIC_CARRIER_ID_NAME = "specific_carrier_id_name";
   }
 
   public static final class Telephony.Carriers implements android.provider.BaseColumns {
@@ -41107,7 +41116,7 @@
   public final class BatchUpdates 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.service.autofill.BatchUpdates> CREATOR;
+    field @NonNull public static final android.os.Parcelable.Creator<android.service.autofill.BatchUpdates> CREATOR;
   }
 
   public static class BatchUpdates.Builder {
@@ -41120,7 +41129,7 @@
   public final class CharSequenceTransformation implements android.os.Parcelable android.service.autofill.Transformation {
     method public int describeContents();
     method public void writeToParcel(android.os.Parcel, int);
-    field public static final android.os.Parcelable.Creator<android.service.autofill.CharSequenceTransformation> CREATOR;
+    field @NonNull public static final android.os.Parcelable.Creator<android.service.autofill.CharSequenceTransformation> CREATOR;
   }
 
   public static class CharSequenceTransformation.Builder {
@@ -41132,21 +41141,21 @@
   public final class CustomDescription 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.service.autofill.CustomDescription> CREATOR;
+    field @NonNull public static final android.os.Parcelable.Creator<android.service.autofill.CustomDescription> CREATOR;
   }
 
   public static class CustomDescription.Builder {
     ctor public CustomDescription.Builder(@NonNull android.widget.RemoteViews);
-    method public android.service.autofill.CustomDescription.Builder addChild(int, @NonNull android.service.autofill.Transformation);
-    method public android.service.autofill.CustomDescription.Builder addOnClickAction(int, @NonNull android.service.autofill.OnClickAction);
-    method public android.service.autofill.CustomDescription.Builder batchUpdate(@NonNull android.service.autofill.Validator, @NonNull android.service.autofill.BatchUpdates);
-    method public android.service.autofill.CustomDescription build();
+    method @NonNull public android.service.autofill.CustomDescription.Builder addChild(int, @NonNull android.service.autofill.Transformation);
+    method @NonNull public android.service.autofill.CustomDescription.Builder addOnClickAction(int, @NonNull android.service.autofill.OnClickAction);
+    method @NonNull public android.service.autofill.CustomDescription.Builder batchUpdate(@NonNull android.service.autofill.Validator, @NonNull android.service.autofill.BatchUpdates);
+    method @NonNull public android.service.autofill.CustomDescription build();
   }
 
   public final class Dataset 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.service.autofill.Dataset> CREATOR;
+    field @NonNull public static final android.os.Parcelable.Creator<android.service.autofill.Dataset> CREATOR;
   }
 
   public static final class Dataset.Builder {
@@ -41165,14 +41174,14 @@
     ctor public DateTransformation(@NonNull android.view.autofill.AutofillId, @NonNull android.icu.text.DateFormat);
     method public int describeContents();
     method public void writeToParcel(android.os.Parcel, int);
-    field public static final android.os.Parcelable.Creator<android.service.autofill.DateTransformation> CREATOR;
+    field @NonNull public static final android.os.Parcelable.Creator<android.service.autofill.DateTransformation> CREATOR;
   }
 
   public final class DateValueSanitizer implements android.os.Parcelable android.service.autofill.Sanitizer {
     ctor public DateValueSanitizer(@NonNull android.icu.text.DateFormat);
     method public int describeContents();
     method public void writeToParcel(android.os.Parcel, int);
-    field public static final android.os.Parcelable.Creator<android.service.autofill.DateValueSanitizer> CREATOR;
+    field @NonNull public static final android.os.Parcelable.Creator<android.service.autofill.DateValueSanitizer> CREATOR;
   }
 
   public final class FieldClassification {
@@ -41191,10 +41200,11 @@
 
   public final class FillContext implements android.os.Parcelable {
     method public int describeContents();
+    method @NonNull public android.view.autofill.AutofillId getFocusedId();
     method public int getRequestId();
-    method public android.app.assist.AssistStructure getStructure();
+    method @NonNull public android.app.assist.AssistStructure getStructure();
     method public void writeToParcel(android.os.Parcel, int);
-    field public static final android.os.Parcelable.Creator<android.service.autofill.FillContext> CREATOR;
+    field @NonNull public static final android.os.Parcelable.Creator<android.service.autofill.FillContext> CREATOR;
   }
 
   public final class FillEventHistory implements android.os.Parcelable {
@@ -41202,7 +41212,7 @@
     method @Deprecated @Nullable public android.os.Bundle getClientState();
     method @Nullable public java.util.List<android.service.autofill.FillEventHistory.Event> getEvents();
     method public void writeToParcel(android.os.Parcel, int);
-    field public static final android.os.Parcelable.Creator<android.service.autofill.FillEventHistory> CREATOR;
+    field @NonNull public static final android.os.Parcelable.Creator<android.service.autofill.FillEventHistory> CREATOR;
   }
 
   public static final class FillEventHistory.Event {
@@ -41228,7 +41238,7 @@
     method public int getFlags();
     method public int getId();
     method public void writeToParcel(android.os.Parcel, int);
-    field public static final android.os.Parcelable.Creator<android.service.autofill.FillRequest> CREATOR;
+    field @NonNull public static final android.os.Parcelable.Creator<android.service.autofill.FillRequest> CREATOR;
     field public static final int FLAG_COMPATIBILITY_MODE_REQUEST = 2; // 0x2
     field public static final int FLAG_MANUAL_REQUEST = 1; // 0x1
   }
@@ -41236,7 +41246,7 @@
   public final class FillResponse 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.service.autofill.FillResponse> CREATOR;
+    field @NonNull public static final android.os.Parcelable.Creator<android.service.autofill.FillResponse> CREATOR;
     field public static final int FLAG_DISABLE_ACTIVITY_ONLY = 2; // 0x2
     field public static final int FLAG_TRACK_CONTEXT_COMMITED = 1; // 0x1
   }
@@ -41244,23 +41254,23 @@
   public static final class FillResponse.Builder {
     ctor public FillResponse.Builder();
     method @NonNull public android.service.autofill.FillResponse.Builder addDataset(@Nullable android.service.autofill.Dataset);
-    method public android.service.autofill.FillResponse build();
-    method public android.service.autofill.FillResponse.Builder disableAutofill(long);
+    method @NonNull public android.service.autofill.FillResponse build();
+    method @NonNull public android.service.autofill.FillResponse.Builder disableAutofill(long);
     method @NonNull public android.service.autofill.FillResponse.Builder setAuthentication(@NonNull android.view.autofill.AutofillId[], @Nullable android.content.IntentSender, @Nullable android.widget.RemoteViews);
-    method public android.service.autofill.FillResponse.Builder setClientState(@Nullable android.os.Bundle);
-    method public android.service.autofill.FillResponse.Builder setFieldClassificationIds(@NonNull android.view.autofill.AutofillId...);
-    method public android.service.autofill.FillResponse.Builder setFlags(int);
-    method public android.service.autofill.FillResponse.Builder setFooter(@NonNull android.widget.RemoteViews);
-    method public android.service.autofill.FillResponse.Builder setHeader(@NonNull android.widget.RemoteViews);
-    method public android.service.autofill.FillResponse.Builder setIgnoredIds(android.view.autofill.AutofillId...);
+    method @NonNull public android.service.autofill.FillResponse.Builder setClientState(@Nullable android.os.Bundle);
+    method @NonNull public android.service.autofill.FillResponse.Builder setFieldClassificationIds(@NonNull android.view.autofill.AutofillId...);
+    method @NonNull public android.service.autofill.FillResponse.Builder setFlags(int);
+    method @NonNull public android.service.autofill.FillResponse.Builder setFooter(@NonNull android.widget.RemoteViews);
+    method @NonNull public android.service.autofill.FillResponse.Builder setHeader(@NonNull android.widget.RemoteViews);
+    method @NonNull public android.service.autofill.FillResponse.Builder setIgnoredIds(android.view.autofill.AutofillId...);
     method @NonNull public android.service.autofill.FillResponse.Builder setSaveInfo(@NonNull android.service.autofill.SaveInfo);
-    method public android.service.autofill.FillResponse.Builder setUserData(@NonNull android.service.autofill.UserData);
+    method @NonNull public android.service.autofill.FillResponse.Builder setUserData(@NonNull android.service.autofill.UserData);
   }
 
   public final class ImageTransformation implements android.os.Parcelable android.service.autofill.Transformation {
     method public int describeContents();
     method public void writeToParcel(android.os.Parcel, int);
-    field public static final android.os.Parcelable.Creator<android.service.autofill.ImageTransformation> CREATOR;
+    field @NonNull public static final android.os.Parcelable.Creator<android.service.autofill.ImageTransformation> CREATOR;
   }
 
   public static class ImageTransformation.Builder {
@@ -41275,7 +41285,7 @@
     ctor public LuhnChecksumValidator(@NonNull android.view.autofill.AutofillId...);
     method public int describeContents();
     method public void writeToParcel(android.os.Parcel, int);
-    field public static final android.os.Parcelable.Creator<android.service.autofill.LuhnChecksumValidator> CREATOR;
+    field @NonNull public static final android.os.Parcelable.Creator<android.service.autofill.LuhnChecksumValidator> CREATOR;
   }
 
   public interface OnClickAction {
@@ -41285,7 +41295,7 @@
     ctor public RegexValidator(@NonNull android.view.autofill.AutofillId, @NonNull java.util.regex.Pattern);
     method public int describeContents();
     method public void writeToParcel(android.os.Parcel, int);
-    field public static final android.os.Parcelable.Creator<android.service.autofill.RegexValidator> CREATOR;
+    field @NonNull public static final android.os.Parcelable.Creator<android.service.autofill.RegexValidator> CREATOR;
   }
 
   public interface Sanitizer {
@@ -41300,7 +41310,7 @@
   public final class SaveInfo 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.service.autofill.SaveInfo> CREATOR;
+    field @NonNull public static final android.os.Parcelable.Creator<android.service.autofill.SaveInfo> CREATOR;
     field public static final int FLAG_DELAY_SAVE = 4; // 0x4
     field public static final int FLAG_DONT_SAVE_ON_FINISH = 2; // 0x2
     field public static final int FLAG_SAVE_ON_ALL_VIEWS_INVISIBLE = 1; // 0x1
@@ -41334,14 +41344,14 @@
     method @Nullable public java.util.List<java.lang.String> getDatasetIds();
     method @NonNull public java.util.List<android.service.autofill.FillContext> getFillContexts();
     method public void writeToParcel(android.os.Parcel, int);
-    field public static final android.os.Parcelable.Creator<android.service.autofill.SaveRequest> CREATOR;
+    field @NonNull public static final android.os.Parcelable.Creator<android.service.autofill.SaveRequest> CREATOR;
   }
 
   public final class TextValueSanitizer implements android.os.Parcelable android.service.autofill.Sanitizer {
     ctor public TextValueSanitizer(@NonNull java.util.regex.Pattern, @NonNull String);
     method public int describeContents();
     method public void writeToParcel(android.os.Parcel, int);
-    field public static final android.os.Parcelable.Creator<android.service.autofill.TextValueSanitizer> CREATOR;
+    field @NonNull public static final android.os.Parcelable.Creator<android.service.autofill.TextValueSanitizer> CREATOR;
   }
 
   public interface Transformation {
@@ -41358,15 +41368,15 @@
     method public static int getMaxValueLength();
     method public static int getMinValueLength();
     method public void writeToParcel(android.os.Parcel, int);
-    field public static final android.os.Parcelable.Creator<android.service.autofill.UserData> CREATOR;
+    field @NonNull public static final android.os.Parcelable.Creator<android.service.autofill.UserData> CREATOR;
   }
 
   public static final class UserData.Builder {
     ctor public UserData.Builder(@NonNull String, @NonNull String, @NonNull String);
-    method public android.service.autofill.UserData.Builder add(@NonNull String, @NonNull String);
-    method public android.service.autofill.UserData build();
-    method public android.service.autofill.UserData.Builder setFieldClassificationAlgorithm(@Nullable String, @Nullable android.os.Bundle);
-    method public android.service.autofill.UserData.Builder setFieldClassificationAlgorithmForCategory(@NonNull String, @Nullable String, @Nullable android.os.Bundle);
+    method @NonNull public android.service.autofill.UserData.Builder add(@NonNull String, @NonNull String);
+    method @NonNull public android.service.autofill.UserData build();
+    method @NonNull public android.service.autofill.UserData.Builder setFieldClassificationAlgorithm(@Nullable String, @Nullable android.os.Bundle);
+    method @NonNull public android.service.autofill.UserData.Builder setFieldClassificationAlgorithmForCategory(@NonNull String, @Nullable String, @Nullable android.os.Bundle);
   }
 
   public interface Validator {
@@ -41381,13 +41391,13 @@
   public final class VisibilitySetterAction implements android.service.autofill.OnClickAction android.os.Parcelable {
     method public int describeContents();
     method public void writeToParcel(android.os.Parcel, int);
-    field public static final android.os.Parcelable.Creator<android.service.autofill.VisibilitySetterAction> CREATOR;
+    field @NonNull public static final android.os.Parcelable.Creator<android.service.autofill.VisibilitySetterAction> CREATOR;
   }
 
-  public static class VisibilitySetterAction.Builder {
+  public static final class VisibilitySetterAction.Builder {
     ctor public VisibilitySetterAction.Builder(@IdRes int, int);
-    method public android.service.autofill.VisibilitySetterAction build();
-    method public android.service.autofill.VisibilitySetterAction.Builder setVisibility(@IdRes int, int);
+    method @NonNull public android.service.autofill.VisibilitySetterAction build();
+    method @NonNull public android.service.autofill.VisibilitySetterAction.Builder setVisibility(@IdRes int, int);
   }
 
 }
@@ -41396,7 +41406,7 @@
 
   public class CarrierIdentifier implements android.os.Parcelable {
     ctor public CarrierIdentifier(String, String, @Nullable String, @Nullable String, @Nullable String, @Nullable String);
-    ctor public CarrierIdentifier(String, String, @Nullable String, @Nullable String, @Nullable String, @Nullable String, int, int);
+    ctor public CarrierIdentifier(@NonNull String, @NonNull String, @Nullable String, @Nullable String, @Nullable String, @Nullable String, int, int);
     ctor public CarrierIdentifier(byte[], @Nullable String, @Nullable String);
     method public int describeContents();
     method public int getCarrierId();
@@ -41405,15 +41415,15 @@
     method @Nullable public String getImsi();
     method public String getMcc();
     method public String getMnc();
-    method public int getPreciseCarrierId();
+    method public int getSpecificCarrierId();
     method @Nullable public String getSpn();
     method public void writeToParcel(android.os.Parcel, int);
-    field public static final android.os.Parcelable.Creator<android.service.carrier.CarrierIdentifier> CREATOR;
+    field @NonNull public static final android.os.Parcelable.Creator<android.service.carrier.CarrierIdentifier> CREATOR;
   }
 
   public class CarrierMessagingClientService extends android.app.Service {
     ctor public CarrierMessagingClientService();
-    method public final android.os.IBinder onBind(android.content.Intent);
+    method @NonNull public final android.os.IBinder onBind(@Nullable android.content.Intent);
   }
 
   public abstract class CarrierMessagingService extends android.app.Service {
@@ -41477,7 +41487,7 @@
     method public int describeContents();
     method @NonNull public java.util.List<byte[]> getPdus();
     method public void writeToParcel(android.os.Parcel, int);
-    field public static final android.os.Parcelable.Creator<android.service.carrier.MessagePdu> CREATOR;
+    field @NonNull public static final android.os.Parcelable.Creator<android.service.carrier.MessagePdu> CREATOR;
   }
 
 }
@@ -41493,7 +41503,7 @@
     method public float getScore();
     method public CharSequence getTitle();
     method public void writeToParcel(android.os.Parcel, int);
-    field public static final android.os.Parcelable.Creator<android.service.chooser.ChooserTarget> CREATOR;
+    field @NonNull public static final android.os.Parcelable.Creator<android.service.chooser.ChooserTarget> CREATOR;
   }
 
   public abstract class ChooserTargetService extends android.app.Service {
@@ -41604,23 +41614,6 @@
 
 package android.service.notification {
 
-  public final class Adjustment implements android.os.Parcelable {
-    ctor public Adjustment(String, String, android.os.Bundle, CharSequence, android.os.UserHandle);
-    method public int describeContents();
-    method public CharSequence getExplanation();
-    method public String getKey();
-    method public String getPackage();
-    method public android.os.Bundle getSignals();
-    method public android.os.UserHandle getUserHandle();
-    method public void writeToParcel(android.os.Parcel, int);
-    field public static final android.os.Parcelable.Creator<android.service.notification.Adjustment> CREATOR;
-    field public static final String KEY_CONTEXTUAL_ACTIONS = "key_contextual_actions";
-    field public static final String KEY_IMPORTANCE = "key_importance";
-    field public static final String KEY_SNOOZE_CRITERIA = "key_snooze_criteria";
-    field public static final String KEY_TEXT_REPLIES = "key_text_replies";
-    field public static final String KEY_USER_SENTIMENT = "key_user_sentiment";
-  }
-
   public final class Condition implements android.os.Parcelable {
     ctor public Condition(android.net.Uri, String, int);
     ctor public Condition(android.net.Uri, String, String, String, int, int, int);
@@ -41632,7 +41625,7 @@
     method public static String relevanceToString(int);
     method public static String stateToString(int);
     method public void writeToParcel(android.os.Parcel, int);
-    field public static final android.os.Parcelable.Creator<android.service.notification.Condition> CREATOR;
+    field @NonNull public static final android.os.Parcelable.Creator<android.service.notification.Condition> CREATOR;
     field public static final int FLAG_RELEVANT_ALWAYS = 2; // 0x2
     field public static final int FLAG_RELEVANT_NOW = 1; // 0x1
     field public static final String SCHEME = "condition";
@@ -41667,26 +41660,6 @@
     field @Deprecated public static final String SERVICE_INTERFACE = "android.service.notification.ConditionProviderService";
   }
 
-  public abstract class NotificationAssistantService extends android.service.notification.NotificationListenerService {
-    ctor public NotificationAssistantService();
-    method public final void adjustNotification(android.service.notification.Adjustment);
-    method public final void adjustNotifications(java.util.List<android.service.notification.Adjustment>);
-    method public void onActionInvoked(@NonNull String, @NonNull android.app.Notification.Action, int);
-    method public final android.os.IBinder onBind(android.content.Intent);
-    method public void onNotificationDirectReplied(@NonNull String);
-    method public abstract android.service.notification.Adjustment onNotificationEnqueued(android.service.notification.StatusBarNotification);
-    method public android.service.notification.Adjustment onNotificationEnqueued(android.service.notification.StatusBarNotification, android.app.NotificationChannel);
-    method public void onNotificationExpansionChanged(@NonNull String, boolean, boolean);
-    method public void onNotificationRemoved(android.service.notification.StatusBarNotification, android.service.notification.NotificationListenerService.RankingMap, android.service.notification.NotificationStats, int);
-    method public abstract void onNotificationSnoozedUntilContext(android.service.notification.StatusBarNotification, String);
-    method public void onNotificationsSeen(java.util.List<java.lang.String>);
-    method public void onSuggestedReplySent(@NonNull String, @NonNull CharSequence, int);
-    method public final void unsnoozeNotification(String);
-    field public static final String SERVICE_INTERFACE = "android.service.notification.NotificationAssistantService";
-    field public static final int SOURCE_FROM_APP = 0; // 0x0
-    field public static final int SOURCE_FROM_ASSISTANT = 1; // 0x1
-  }
-
   public abstract class NotificationListenerService extends android.app.Service {
     ctor public NotificationListenerService();
     method public final void cancelAllNotifications();
@@ -41769,8 +41742,8 @@
     method public long getLastAudiblyAlertedMillis();
     method public String getOverrideGroupKey();
     method public int getRank();
-    method public java.util.List<android.app.Notification.Action> getSmartActions();
-    method public java.util.List<java.lang.CharSequence> getSmartReplies();
+    method @NonNull public java.util.List<android.app.Notification.Action> getSmartActions();
+    method @NonNull public java.util.List<java.lang.CharSequence> getSmartReplies();
     method public int getSuppressedVisualEffects();
     method public int getUserSentiment();
     method public boolean isAmbient();
@@ -41786,38 +41759,7 @@
     method public String[] getOrderedKeys();
     method public boolean getRanking(String, android.service.notification.NotificationListenerService.Ranking);
     method public void writeToParcel(android.os.Parcel, int);
-    field public static final android.os.Parcelable.Creator<android.service.notification.NotificationListenerService.RankingMap> CREATOR;
-  }
-
-  public final class NotificationStats implements android.os.Parcelable {
-    ctor public NotificationStats();
-    method public int describeContents();
-    method public int getDismissalSentiment();
-    method public int getDismissalSurface();
-    method public boolean hasDirectReplied();
-    method public boolean hasExpanded();
-    method public boolean hasInteracted();
-    method public boolean hasSeen();
-    method public boolean hasSnoozed();
-    method public boolean hasViewedSettings();
-    method public void setDirectReplied();
-    method public void setDismissalSentiment(int);
-    method public void setDismissalSurface(int);
-    method public void setExpanded();
-    method public void setSeen();
-    method public void setSnoozed();
-    method public void setViewedSettings();
-    method public void writeToParcel(android.os.Parcel, int);
-    field public static final android.os.Parcelable.Creator<android.service.notification.NotificationStats> CREATOR;
-    field public static final int DISMISSAL_AOD = 2; // 0x2
-    field public static final int DISMISSAL_NOT_DISMISSED = -1; // 0xffffffff
-    field public static final int DISMISSAL_OTHER = 0; // 0x0
-    field public static final int DISMISSAL_PEEK = 1; // 0x1
-    field public static final int DISMISSAL_SHADE = 3; // 0x3
-    field public static final int DISMISS_SENTIMENT_NEGATIVE = 0; // 0x0
-    field public static final int DISMISS_SENTIMENT_NEUTRAL = 1; // 0x1
-    field public static final int DISMISS_SENTIMENT_POSITIVE = 2; // 0x2
-    field public static final int DISMISS_SENTIMENT_UNKNOWN = -1000; // 0xfffffc18
+    field @NonNull public static final android.os.Parcelable.Creator<android.service.notification.NotificationListenerService.RankingMap> CREATOR;
   }
 
   public class StatusBarNotification implements android.os.Parcelable {
@@ -41829,7 +41771,7 @@
     method public int getId();
     method public String getKey();
     method public android.app.Notification getNotification();
-    method public String getOpPkg();
+    method @NonNull public String getOpPkg();
     method public String getOverrideGroupKey();
     method public String getPackageName();
     method public long getPostTime();
@@ -41842,7 +41784,7 @@
     method public boolean isOngoing();
     method public void setOverrideGroupKey(String);
     method public void writeToParcel(android.os.Parcel, int);
-    field public static final android.os.Parcelable.Creator<android.service.notification.StatusBarNotification> CREATOR;
+    field @NonNull public static final android.os.Parcelable.Creator<android.service.notification.StatusBarNotification> CREATOR;
   }
 
   public final class ZenPolicy implements android.os.Parcelable {
@@ -41865,7 +41807,7 @@
     method public int getVisualEffectPeek();
     method public int getVisualEffectStatusBar();
     method public void writeToParcel(android.os.Parcel, int);
-    field public static final android.os.Parcelable.Creator<android.service.notification.ZenPolicy> CREATOR;
+    field @NonNull public static final android.os.Parcelable.Creator<android.service.notification.ZenPolicy> CREATOR;
     field public static final int PEOPLE_TYPE_ANYONE = 1; // 0x1
     field public static final int PEOPLE_TYPE_CONTACTS = 2; // 0x2
     field public static final int PEOPLE_TYPE_NONE = 4; // 0x4
@@ -41876,28 +41818,28 @@
     field public static final int STATE_UNSET = 0; // 0x0
   }
 
-  public static class ZenPolicy.Builder {
+  public static final class ZenPolicy.Builder {
     ctor public ZenPolicy.Builder();
-    method public android.service.notification.ZenPolicy.Builder allowAlarms(boolean);
-    method public android.service.notification.ZenPolicy.Builder allowAllSounds();
-    method public android.service.notification.ZenPolicy.Builder allowCalls(int);
-    method public android.service.notification.ZenPolicy.Builder allowEvents(boolean);
-    method public android.service.notification.ZenPolicy.Builder allowMedia(boolean);
-    method public android.service.notification.ZenPolicy.Builder allowMessages(int);
-    method public android.service.notification.ZenPolicy.Builder allowReminders(boolean);
-    method public android.service.notification.ZenPolicy.Builder allowRepeatCallers(boolean);
-    method public android.service.notification.ZenPolicy.Builder allowSystem(boolean);
-    method public android.service.notification.ZenPolicy build();
-    method public android.service.notification.ZenPolicy.Builder disallowAllSounds();
-    method public android.service.notification.ZenPolicy.Builder hideAllVisualEffects();
-    method public android.service.notification.ZenPolicy.Builder showAllVisualEffects();
-    method public android.service.notification.ZenPolicy.Builder showBadges(boolean);
-    method public android.service.notification.ZenPolicy.Builder showFullScreenIntent(boolean);
-    method public android.service.notification.ZenPolicy.Builder showInAmbientDisplay(boolean);
-    method public android.service.notification.ZenPolicy.Builder showInNotificationList(boolean);
-    method public android.service.notification.ZenPolicy.Builder showLights(boolean);
-    method public android.service.notification.ZenPolicy.Builder showPeeking(boolean);
-    method public android.service.notification.ZenPolicy.Builder showStatusBarIcons(boolean);
+    method @NonNull public android.service.notification.ZenPolicy.Builder allowAlarms(boolean);
+    method @NonNull public android.service.notification.ZenPolicy.Builder allowAllSounds();
+    method @NonNull public android.service.notification.ZenPolicy.Builder allowCalls(int);
+    method @NonNull public android.service.notification.ZenPolicy.Builder allowEvents(boolean);
+    method @NonNull public android.service.notification.ZenPolicy.Builder allowMedia(boolean);
+    method @NonNull public android.service.notification.ZenPolicy.Builder allowMessages(int);
+    method @NonNull public android.service.notification.ZenPolicy.Builder allowReminders(boolean);
+    method @NonNull public android.service.notification.ZenPolicy.Builder allowRepeatCallers(boolean);
+    method @NonNull public android.service.notification.ZenPolicy.Builder allowSystem(boolean);
+    method @NonNull public android.service.notification.ZenPolicy build();
+    method @NonNull public android.service.notification.ZenPolicy.Builder disallowAllSounds();
+    method @NonNull public android.service.notification.ZenPolicy.Builder hideAllVisualEffects();
+    method @NonNull public android.service.notification.ZenPolicy.Builder showAllVisualEffects();
+    method @NonNull public android.service.notification.ZenPolicy.Builder showBadges(boolean);
+    method @NonNull public android.service.notification.ZenPolicy.Builder showFullScreenIntent(boolean);
+    method @NonNull public android.service.notification.ZenPolicy.Builder showInAmbientDisplay(boolean);
+    method @NonNull public android.service.notification.ZenPolicy.Builder showInNotificationList(boolean);
+    method @NonNull public android.service.notification.ZenPolicy.Builder showLights(boolean);
+    method @NonNull public android.service.notification.ZenPolicy.Builder showPeeking(boolean);
+    method @NonNull public android.service.notification.ZenPolicy.Builder showStatusBarIcons(boolean);
   }
 
 }
@@ -41918,7 +41860,7 @@
     method public void setSubtitle(@Nullable CharSequence);
     method public void updateTile();
     method public void writeToParcel(android.os.Parcel, int);
-    field public static final android.os.Parcelable.Creator<android.service.quicksettings.Tile> CREATOR;
+    field @NonNull public static final android.os.Parcelable.Creator<android.service.quicksettings.Tile> CREATOR;
     field public static final int STATE_ACTIVE = 2; // 0x2
     field public static final int STATE_INACTIVE = 1; // 0x1
     field public static final int STATE_UNAVAILABLE = 0; // 0x0
@@ -42480,7 +42422,7 @@
     method public int getQuality();
     method public boolean isNetworkConnectionRequired();
     method public void writeToParcel(android.os.Parcel, int);
-    field public static final android.os.Parcelable.Creator<android.speech.tts.Voice> CREATOR;
+    field @NonNull public static final android.os.Parcelable.Creator<android.speech.tts.Voice> CREATOR;
     field public static final int LATENCY_HIGH = 400; // 0x190
     field public static final int LATENCY_LOW = 200; // 0xc8
     field public static final int LATENCY_NORMAL = 300; // 0x12c
@@ -42517,6 +42459,7 @@
     method public static void chown(String, int, int) throws android.system.ErrnoException;
     method public static void close(java.io.FileDescriptor) throws android.system.ErrnoException;
     method public static void connect(java.io.FileDescriptor, java.net.InetAddress, int) throws android.system.ErrnoException, java.net.SocketException;
+    method public static void connect(java.io.FileDescriptor, java.net.SocketAddress) throws android.system.ErrnoException, java.net.SocketException;
     method public static java.io.FileDescriptor dup(java.io.FileDescriptor) throws android.system.ErrnoException;
     method public static java.io.FileDescriptor dup2(java.io.FileDescriptor, int) throws android.system.ErrnoException;
     method public static String[] environ();
@@ -43336,7 +43279,7 @@
     method public int getSupportedRouteMask();
     method public boolean isMuted();
     method public void writeToParcel(android.os.Parcel, int);
-    field public static final android.os.Parcelable.Creator<android.telecom.CallAudioState> CREATOR;
+    field @NonNull public static final android.os.Parcelable.Creator<android.telecom.CallAudioState> CREATOR;
     field public static final int ROUTE_BLUETOOTH = 2; // 0x2
     field public static final int ROUTE_EARPIECE = 1; // 0x1
     field public static final int ROUTE_SPEAKER = 8; // 0x8
@@ -43359,17 +43302,17 @@
     field public static final int CONFIDENCE_NOT_NUISANCE = -2; // 0xfffffffe
     field public static final int CONFIDENCE_NUISANCE = 2; // 0x2
     field public static final int CONFIDENCE_UNKNOWN = 0; // 0x0
-    field public static final android.os.Parcelable.Creator<android.telecom.CallIdentification> CREATOR;
+    field @NonNull public static final android.os.Parcelable.Creator<android.telecom.CallIdentification> CREATOR;
   }
 
-  public static class CallIdentification.Builder {
+  public static final class CallIdentification.Builder {
     ctor public CallIdentification.Builder();
-    method public android.telecom.CallIdentification build();
-    method public android.telecom.CallIdentification.Builder setDescription(@Nullable CharSequence);
-    method public android.telecom.CallIdentification.Builder setDetails(@Nullable CharSequence);
-    method public android.telecom.CallIdentification.Builder setName(@Nullable CharSequence);
-    method public android.telecom.CallIdentification.Builder setNuisanceConfidence(int);
-    method public android.telecom.CallIdentification.Builder setPhoto(@Nullable android.graphics.drawable.Icon);
+    method @NonNull public android.telecom.CallIdentification build();
+    method @NonNull public android.telecom.CallIdentification.Builder setDescription(@Nullable CharSequence);
+    method @NonNull public android.telecom.CallIdentification.Builder setDetails(@Nullable CharSequence);
+    method @NonNull public android.telecom.CallIdentification.Builder setName(@Nullable CharSequence);
+    method @NonNull public android.telecom.CallIdentification.Builder setNuisanceConfidence(int);
+    method @NonNull public android.telecom.CallIdentification.Builder setPhoto(@Nullable android.graphics.drawable.Icon);
   }
 
   public abstract class CallRedirectionService extends android.app.Service {
@@ -43652,7 +43595,7 @@
     method public int getVideoState();
     method public boolean isRequestingRtt();
     method public void writeToParcel(android.os.Parcel, int);
-    field public static final android.os.Parcelable.Creator<android.telecom.ConnectionRequest> CREATOR;
+    field @NonNull public static final android.os.Parcelable.Creator<android.telecom.ConnectionRequest> CREATOR;
   }
 
   public abstract class ConnectionService extends android.app.Service {
@@ -43698,7 +43641,7 @@
     field public static final int CALL_PULLED = 12; // 0xc
     field public static final int CANCELED = 4; // 0x4
     field public static final int CONNECTION_MANAGER_NOT_SUPPORTED = 10; // 0xa
-    field public static final android.os.Parcelable.Creator<android.telecom.DisconnectCause> CREATOR;
+    field @NonNull public static final android.os.Parcelable.Creator<android.telecom.DisconnectCause> CREATOR;
     field public static final int ERROR = 1; // 0x1
     field public static final int LOCAL = 2; // 0x2
     field public static final int MISSED = 5; // 0x5
@@ -43717,7 +43660,7 @@
     method public android.net.Uri getOriginalAddress();
     method public boolean isEmpty();
     method public void writeToParcel(android.os.Parcel, int);
-    field public static final android.os.Parcelable.Creator<android.telecom.GatewayInfo> CREATOR;
+    field @NonNull public static final android.os.Parcelable.Creator<android.telecom.GatewayInfo> CREATOR;
   }
 
   public abstract class InCallService extends android.app.Service {
@@ -43795,7 +43738,7 @@
     field public static final int CAPABILITY_SUPPORTS_VIDEO_CALLING = 1024; // 0x400
     field public static final int CAPABILITY_VIDEO_CALLING = 8; // 0x8
     field public static final int CAPABILITY_VIDEO_CALLING_RELIES_ON_PRESENCE = 256; // 0x100
-    field public static final android.os.Parcelable.Creator<android.telecom.PhoneAccount> CREATOR;
+    field @NonNull public static final android.os.Parcelable.Creator<android.telecom.PhoneAccount> CREATOR;
     field public static final String EXTRA_CALL_SUBJECT_CHARACTER_ENCODING = "android.telecom.extra.CALL_SUBJECT_CHARACTER_ENCODING";
     field public static final String EXTRA_CALL_SUBJECT_MAX_LENGTH = "android.telecom.extra.CALL_SUBJECT_MAX_LENGTH";
     field public static final String EXTRA_LOG_SELF_MANAGED_CALLS = "android.telecom.extra.LOG_SELF_MANAGED_CALLS";
@@ -43831,16 +43774,17 @@
     method public String getId();
     method public android.os.UserHandle getUserHandle();
     method public void writeToParcel(android.os.Parcel, int);
-    field public static final android.os.Parcelable.Creator<android.telecom.PhoneAccountHandle> CREATOR;
+    field @NonNull public static final android.os.Parcelable.Creator<android.telecom.PhoneAccountHandle> CREATOR;
   }
 
   public final class PhoneAccountSuggestion implements android.os.Parcelable {
+    ctor public PhoneAccountSuggestion(@NonNull android.telecom.PhoneAccountHandle, int, boolean);
     method public int describeContents();
-    method public android.telecom.PhoneAccountHandle getPhoneAccountHandle();
+    method @NonNull public android.telecom.PhoneAccountHandle getPhoneAccountHandle();
     method public int getReason();
     method public boolean shouldAutoSelect();
     method public void writeToParcel(android.os.Parcel, int);
-    field public static final android.os.Parcelable.Creator<android.telecom.PhoneAccountSuggestion> CREATOR;
+    field @NonNull public static final android.os.Parcelable.Creator<android.telecom.PhoneAccountSuggestion> CREATOR;
     field public static final int REASON_FREQUENT = 2; // 0x2
     field public static final int REASON_INTRA_CARRIER = 1; // 0x1
     field public static final int REASON_NONE = 0; // 0x0
@@ -43971,7 +43915,7 @@
     method public android.graphics.drawable.Icon getIcon();
     method public CharSequence getLabel();
     method public void writeToParcel(android.os.Parcel, int);
-    field public static final android.os.Parcelable.Creator<android.telecom.StatusHints> CREATOR;
+    field @NonNull public static final android.os.Parcelable.Creator<android.telecom.StatusHints> CREATOR;
   }
 
   public class TelecomManager {
@@ -43990,8 +43934,8 @@
     method public android.telecom.PhoneAccount getPhoneAccount(android.telecom.PhoneAccountHandle);
     method @RequiresPermission(android.Manifest.permission.READ_PHONE_STATE) public java.util.List<android.telecom.PhoneAccountHandle> getSelfManagedPhoneAccounts();
     method public android.telecom.PhoneAccountHandle getSimCallManager();
-    method public String getSystemDialerPackage();
-    method @RequiresPermission(android.Manifest.permission.READ_PHONE_STATE) public android.telecom.PhoneAccountHandle getUserSelectedOutgoingPhoneAccount();
+    method @Nullable public String getSystemDialerPackage();
+    method @RequiresPermission(android.Manifest.permission.READ_PHONE_STATE) @Nullable public android.telecom.PhoneAccountHandle getUserSelectedOutgoingPhoneAccount();
     method @RequiresPermission(android.Manifest.permission.READ_PHONE_STATE) public String getVoiceMailNumber(android.telecom.PhoneAccountHandle);
     method @RequiresPermission(android.Manifest.permission.MODIFY_PHONE_STATE) public boolean handleMmi(String);
     method @RequiresPermission(android.Manifest.permission.MODIFY_PHONE_STATE) public boolean handleMmi(String, android.telecom.PhoneAccountHandle);
@@ -44032,7 +43976,6 @@
     field public static final String EXTRA_INCOMING_CALL_EXTRAS = "android.telecom.extra.INCOMING_CALL_EXTRAS";
     field public static final String EXTRA_INCOMING_VIDEO_STATE = "android.telecom.extra.INCOMING_VIDEO_STATE";
     field public static final String EXTRA_IS_DEFAULT_CALL_SCREENING_APP = "android.telecom.extra.IS_DEFAULT_CALL_SCREENING_APP";
-    field public static final String EXTRA_IS_ENABLED = "android.telecom.extra.IS_ENABLED";
     field public static final String EXTRA_NOTIFICATION_COUNT = "android.telecom.extra.NOTIFICATION_COUNT";
     field public static final String EXTRA_NOTIFICATION_PHONE_NUMBER = "android.telecom.extra.NOTIFICATION_PHONE_NUMBER";
     field public static final String EXTRA_OUTGOING_CALL_EXTRAS = "android.telecom.extra.OUTGOING_CALL_EXTRAS";
@@ -44067,7 +44010,7 @@
     method public static boolean isVideo(int);
     method public static String videoStateToString(int);
     method public void writeToParcel(android.os.Parcel, int);
-    field public static final android.os.Parcelable.Creator<android.telecom.VideoProfile> CREATOR;
+    field @NonNull public static final android.os.Parcelable.Creator<android.telecom.VideoProfile> CREATOR;
     field public static final int QUALITY_DEFAULT = 4; // 0x4
     field public static final int QUALITY_HIGH = 1; // 0x1
     field public static final int QUALITY_LOW = 3; // 0x3
@@ -44088,7 +44031,7 @@
     method public int getWidth();
     method public boolean isZoomSupported();
     method public void writeToParcel(android.os.Parcel, int);
-    field public static final android.os.Parcelable.Creator<android.telecom.VideoProfile.CameraCapabilities> CREATOR;
+    field @NonNull public static final android.os.Parcelable.Creator<android.telecom.VideoProfile.CameraCapabilities> CREATOR;
   }
 
 }
@@ -44199,13 +44142,14 @@
   }
 
   public final class AvailableNetworkInfo implements android.os.Parcelable {
-    ctor public AvailableNetworkInfo(int, int, java.util.List<java.lang.String>);
+    ctor public AvailableNetworkInfo(int, int, @NonNull java.util.List<java.lang.String>, @NonNull java.util.List<java.lang.Integer>);
     method public int describeContents();
-    method public java.util.List<java.lang.String> getMccMncs();
+    method @NonNull public java.util.List<java.lang.Integer> getBands();
+    method @NonNull public java.util.List<java.lang.String> getMccMncs();
     method public int getPriority();
     method public int getSubId();
     method public void writeToParcel(android.os.Parcel, int);
-    field public static final android.os.Parcelable.Creator<android.telephony.AvailableNetworkInfo> CREATOR;
+    field @NonNull public static final android.os.Parcelable.Creator<android.telephony.AvailableNetworkInfo> CREATOR;
     field public static final int PRIORITY_HIGH = 1; // 0x1
     field public static final int PRIORITY_LOW = 3; // 0x3
     field public static final int PRIORITY_MED = 2; // 0x2
@@ -44371,6 +44315,7 @@
     field public static final String KEY_SUPPORT_PAUSE_IMS_VIDEO_CALLS_BOOL = "support_pause_ims_video_calls_bool";
     field public static final String KEY_SUPPORT_SWAP_AFTER_MERGE_BOOL = "support_swap_after_merge_bool";
     field public static final String KEY_TREAT_DOWNGRADED_VIDEO_CALLS_AS_VIDEO_CALLS_BOOL = "treat_downgraded_video_calls_as_video_calls_bool";
+    field public static final String KEY_TTY_SUPPORTED_BOOL = "tty_supported_bool";
     field public static final String KEY_USE_HFA_FOR_PROVISIONING_BOOL = "use_hfa_for_provisioning_bool";
     field public static final String KEY_USE_OTASP_FOR_PROVISIONING_BOOL = "use_otasp_for_provisioning_bool";
     field public static final String KEY_USE_RCS_PRESENCE_BOOL = "use_rcs_presence_bool";
@@ -44394,7 +44339,7 @@
     method @Nullable public CharSequence getOperatorAlphaLong();
     method @Nullable public CharSequence getOperatorAlphaShort();
     method @CallSuper public void writeToParcel(android.os.Parcel, int);
-    field public static final android.os.Parcelable.Creator<android.telephony.CellIdentity> CREATOR;
+    field @NonNull public static final android.os.Parcelable.Creator<android.telephony.CellIdentity> CREATOR;
   }
 
   public final class CellIdentityCdma extends android.telephony.CellIdentity {
@@ -44404,7 +44349,7 @@
     method public int getNetworkId();
     method public int getSystemId();
     method public void writeToParcel(android.os.Parcel, int);
-    field public static final android.os.Parcelable.Creator<android.telephony.CellIdentityCdma> CREATOR;
+    field @NonNull public static final android.os.Parcelable.Creator<android.telephony.CellIdentityCdma> CREATOR;
   }
 
   public final class CellIdentityGsm extends android.telephony.CellIdentity {
@@ -44419,7 +44364,7 @@
     method @Nullable public String getMobileNetworkOperator();
     method @Deprecated public int getPsc();
     method public void writeToParcel(android.os.Parcel, int);
-    field public static final android.os.Parcelable.Creator<android.telephony.CellIdentityGsm> CREATOR;
+    field @NonNull public static final android.os.Parcelable.Creator<android.telephony.CellIdentityGsm> CREATOR;
   }
 
   public final class CellIdentityLte extends android.telephony.CellIdentity {
@@ -44434,18 +44379,18 @@
     method public int getPci();
     method public int getTac();
     method public void writeToParcel(android.os.Parcel, int);
-    field public static final android.os.Parcelable.Creator<android.telephony.CellIdentityLte> CREATOR;
+    field @NonNull public static final android.os.Parcelable.Creator<android.telephony.CellIdentityLte> CREATOR;
   }
 
   public final class CellIdentityNr extends android.telephony.CellIdentity {
-    method public int getChannelNumber();
     method public String getMccString();
     method public String getMncString();
     method public long getNci();
+    method public int getNrarfcn();
     method public int getPci();
     method public int getTac();
     method public void writeToParcel(android.os.Parcel, int);
-    field public static final android.os.Parcelable.Creator<android.telephony.CellIdentityNr> CREATOR;
+    field @NonNull public static final android.os.Parcelable.Creator<android.telephony.CellIdentityNr> CREATOR;
   }
 
   public final class CellIdentityTdscdma extends android.telephony.CellIdentity {
@@ -44457,7 +44402,7 @@
     method @Nullable public String getMobileNetworkOperator();
     method public int getUarfcn();
     method public void writeToParcel(android.os.Parcel, int);
-    field public static final android.os.Parcelable.Creator<android.telephony.CellIdentityTdscdma> CREATOR;
+    field @NonNull public static final android.os.Parcelable.Creator<android.telephony.CellIdentityTdscdma> CREATOR;
   }
 
   public final class CellIdentityWcdma extends android.telephony.CellIdentity {
@@ -44471,7 +44416,7 @@
     method public int getPsc();
     method public int getUarfcn();
     method public void writeToParcel(android.os.Parcel, int);
-    field public static final android.os.Parcelable.Creator<android.telephony.CellIdentityWcdma> CREATOR;
+    field @NonNull public static final android.os.Parcelable.Creator<android.telephony.CellIdentityWcdma> CREATOR;
   }
 
   public abstract class CellInfo implements android.os.Parcelable {
@@ -44483,43 +44428,44 @@
     field public static final int CONNECTION_PRIMARY_SERVING = 1; // 0x1
     field public static final int CONNECTION_SECONDARY_SERVING = 2; // 0x2
     field public static final int CONNECTION_UNKNOWN = 2147483647; // 0x7fffffff
-    field public static final android.os.Parcelable.Creator<android.telephony.CellInfo> CREATOR;
+    field @NonNull public static final android.os.Parcelable.Creator<android.telephony.CellInfo> CREATOR;
     field public static final int UNAVAILABLE = 2147483647; // 0x7fffffff
+    field public static final long UNAVAILABLE_LONG = 9223372036854775807L; // 0x7fffffffffffffffL
   }
 
   public final class CellInfoCdma extends android.telephony.CellInfo implements android.os.Parcelable {
     method public android.telephony.CellIdentityCdma getCellIdentity();
     method public android.telephony.CellSignalStrengthCdma getCellSignalStrength();
     method public void writeToParcel(android.os.Parcel, int);
-    field public static final android.os.Parcelable.Creator<android.telephony.CellInfoCdma> CREATOR;
+    field @NonNull public static final android.os.Parcelable.Creator<android.telephony.CellInfoCdma> CREATOR;
   }
 
   public final class CellInfoGsm extends android.telephony.CellInfo implements android.os.Parcelable {
     method public android.telephony.CellIdentityGsm getCellIdentity();
     method public android.telephony.CellSignalStrengthGsm getCellSignalStrength();
     method public void writeToParcel(android.os.Parcel, int);
-    field public static final android.os.Parcelable.Creator<android.telephony.CellInfoGsm> CREATOR;
+    field @NonNull public static final android.os.Parcelable.Creator<android.telephony.CellInfoGsm> CREATOR;
   }
 
   public final class CellInfoLte extends android.telephony.CellInfo implements android.os.Parcelable {
     method public android.telephony.CellIdentityLte getCellIdentity();
     method public android.telephony.CellSignalStrengthLte getCellSignalStrength();
     method public void writeToParcel(android.os.Parcel, int);
-    field public static final android.os.Parcelable.Creator<android.telephony.CellInfoLte> CREATOR;
+    field @NonNull public static final android.os.Parcelable.Creator<android.telephony.CellInfoLte> CREATOR;
   }
 
   public final class CellInfoNr extends android.telephony.CellInfo {
     method public android.telephony.CellIdentity getCellIdentity();
     method public android.telephony.CellSignalStrength getCellSignalStrength();
     method public void writeToParcel(android.os.Parcel, int);
-    field public static final android.os.Parcelable.Creator<android.telephony.CellInfoNr> CREATOR;
+    field @NonNull public static final android.os.Parcelable.Creator<android.telephony.CellInfoNr> CREATOR;
   }
 
   public final class CellInfoWcdma extends android.telephony.CellInfo implements android.os.Parcelable {
     method public android.telephony.CellIdentityWcdma getCellIdentity();
     method public android.telephony.CellSignalStrengthWcdma getCellSignalStrength();
     method public void writeToParcel(android.os.Parcel, int);
-    field public static final android.os.Parcelable.Creator<android.telephony.CellInfoWcdma> CREATOR;
+    field @NonNull public static final android.os.Parcelable.Creator<android.telephony.CellInfoWcdma> CREATOR;
   }
 
   public abstract class CellLocation {
@@ -44554,7 +44500,7 @@
     method public int getEvdoSnr();
     method public int getLevel();
     method public void writeToParcel(android.os.Parcel, int);
-    field public static final android.os.Parcelable.Creator<android.telephony.CellSignalStrengthCdma> CREATOR;
+    field @NonNull public static final android.os.Parcelable.Creator<android.telephony.CellSignalStrengthCdma> CREATOR;
   }
 
   public final class CellSignalStrengthGsm extends android.telephony.CellSignalStrength implements android.os.Parcelable {
@@ -44565,7 +44511,7 @@
     method public int getLevel();
     method public int getTimingAdvance();
     method public void writeToParcel(android.os.Parcel, int);
-    field public static final android.os.Parcelable.Creator<android.telephony.CellSignalStrengthGsm> CREATOR;
+    field @NonNull public static final android.os.Parcelable.Creator<android.telephony.CellSignalStrengthGsm> CREATOR;
   }
 
   public final class CellSignalStrengthLte extends android.telephony.CellSignalStrength implements android.os.Parcelable {
@@ -44580,7 +44526,7 @@
     method public int getRssnr();
     method public int getTimingAdvance();
     method public void writeToParcel(android.os.Parcel, int);
-    field public static final android.os.Parcelable.Creator<android.telephony.CellSignalStrengthLte> CREATOR;
+    field @NonNull public static final android.os.Parcelable.Creator<android.telephony.CellSignalStrengthLte> CREATOR;
   }
 
   public final class CellSignalStrengthNr extends android.telephony.CellSignalStrength implements android.os.Parcelable {
@@ -44595,7 +44541,7 @@
     method public int getSsRsrq();
     method public int getSsSinr();
     method public void writeToParcel(android.os.Parcel, int);
-    field public static final android.os.Parcelable.Creator<android.telephony.CellSignalStrengthNr> CREATOR;
+    field @NonNull public static final android.os.Parcelable.Creator<android.telephony.CellSignalStrengthNr> CREATOR;
   }
 
   public final class CellSignalStrengthWcdma extends android.telephony.CellSignalStrength implements android.os.Parcelable {
@@ -44604,7 +44550,7 @@
     method public int getDbm();
     method public int getLevel();
     method public void writeToParcel(android.os.Parcel, int);
-    field public static final android.os.Parcelable.Creator<android.telephony.CellSignalStrengthWcdma> CREATOR;
+    field @NonNull public static final android.os.Parcelable.Creator<android.telephony.CellSignalStrengthWcdma> CREATOR;
   }
 
   public class IccOpenLogicalChannelResponse implements android.os.Parcelable {
@@ -44613,7 +44559,7 @@
     method public byte[] getSelectResponse();
     method public int getStatus();
     method public void writeToParcel(android.os.Parcel, int);
-    field public static final android.os.Parcelable.Creator<android.telephony.IccOpenLogicalChannelResponse> CREATOR;
+    field @NonNull public static final android.os.Parcelable.Creator<android.telephony.IccOpenLogicalChannelResponse> CREATOR;
     field public static final int INVALID_CHANNEL = -1; // 0xffffffff
     field public static final int STATUS_MISSING_RESOURCE = 2; // 0x2
     field public static final int STATUS_NO_ERROR = 1; // 0x1
@@ -44660,7 +44606,7 @@
   public class MbmsGroupCallSession implements java.lang.AutoCloseable {
     method public void close();
     method @Nullable public static android.telephony.MbmsGroupCallSession create(@NonNull android.content.Context, int, @NonNull java.util.concurrent.Executor, @NonNull android.telephony.mbms.MbmsGroupCallSessionCallback);
-    method public static android.telephony.MbmsGroupCallSession create(@NonNull android.content.Context, @NonNull java.util.concurrent.Executor, @NonNull android.telephony.mbms.MbmsGroupCallSessionCallback);
+    method @Nullable public static android.telephony.MbmsGroupCallSession create(@NonNull android.content.Context, @NonNull java.util.concurrent.Executor, @NonNull android.telephony.mbms.MbmsGroupCallSessionCallback);
     method @Nullable public android.telephony.mbms.GroupCall startGroupCall(long, @NonNull java.util.List<java.lang.Integer>, @NonNull java.util.List<java.lang.Integer>, @NonNull java.util.concurrent.Executor, @NonNull android.telephony.mbms.GroupCallCallback);
   }
 
@@ -44686,7 +44632,7 @@
     method @Deprecated public void setCid(int);
     method @Deprecated public void setRssi(int);
     method @Deprecated public void writeToParcel(android.os.Parcel, int);
-    field @Deprecated public static final android.os.Parcelable.Creator<android.telephony.NeighboringCellInfo> CREATOR;
+    field @Deprecated @NonNull public static final android.os.Parcelable.Creator<android.telephony.NeighboringCellInfo> CREATOR;
     field @Deprecated public static final int UNKNOWN_CID = -1; // 0xffffffff
     field @Deprecated public static final int UNKNOWN_RSSI = 99; // 0x63
   }
@@ -44714,7 +44660,7 @@
     method public int getSearchPeriodicity();
     method public android.telephony.RadioAccessSpecifier[] getSpecifiers();
     method public void writeToParcel(android.os.Parcel, int);
-    field public static final android.os.Parcelable.Creator<android.telephony.NetworkScanRequest> CREATOR;
+    field @NonNull public static final android.os.Parcelable.Creator<android.telephony.NetworkScanRequest> CREATOR;
     field public static final int SCAN_TYPE_ONE_SHOT = 0; // 0x0
     field public static final int SCAN_TYPE_PERIODIC = 1; // 0x1
   }
@@ -44788,6 +44734,7 @@
   public class PhoneStateListener {
     ctor public PhoneStateListener();
     ctor public PhoneStateListener(@NonNull java.util.concurrent.Executor);
+    method public void onActiveDataSubscriptionIdChanged(int);
     method public void onCallForwardingIndicatorChanged(boolean);
     method public void onCallStateChanged(int, String);
     method public void onCellInfoChanged(java.util.List<android.telephony.CellInfo>);
@@ -44800,6 +44747,7 @@
     method @Deprecated public void onSignalStrengthChanged(int);
     method public void onSignalStrengthsChanged(android.telephony.SignalStrength);
     method public void onUserMobileDataStateChanged(boolean);
+    field public static final int LISTEN_ACTIVE_DATA_SUBSCRIPTION_ID_CHANGE = 4194304; // 0x400000
     field public static final int LISTEN_CALL_FORWARDING_INDICATOR = 8; // 0x8
     field public static final int LISTEN_CALL_STATE = 32; // 0x20
     field public static final int LISTEN_CELL_INFO = 1024; // 0x400
@@ -44822,13 +44770,13 @@
     method public int[] getChannels();
     method public int getRadioAccessNetwork();
     method public void writeToParcel(android.os.Parcel, int);
-    field public static final android.os.Parcelable.Creator<android.telephony.RadioAccessSpecifier> CREATOR;
+    field @NonNull public static final android.os.Parcelable.Creator<android.telephony.RadioAccessSpecifier> CREATOR;
   }
 
   public class ServiceState implements android.os.Parcelable {
     ctor public ServiceState();
     ctor public ServiceState(android.telephony.ServiceState);
-    ctor public ServiceState(android.os.Parcel);
+    ctor @Deprecated public ServiceState(android.os.Parcel);
     method protected void copyFrom(android.telephony.ServiceState);
     method public int describeContents();
     method public int getCdmaNetworkId();
@@ -44849,7 +44797,7 @@
     method public void setStateOff();
     method public void setStateOutOfService();
     method public void writeToParcel(android.os.Parcel, int);
-    field public static final android.os.Parcelable.Creator<android.telephony.ServiceState> CREATOR;
+    field @NonNull public static final android.os.Parcelable.Creator<android.telephony.ServiceState> CREATOR;
     field public static final int DUPLEX_MODE_FDD = 1; // 0x1
     field public static final int DUPLEX_MODE_TDD = 2; // 0x2
     field public static final int DUPLEX_MODE_UNKNOWN = 0; // 0x0
@@ -44865,7 +44813,7 @@
     method @Deprecated public int getCdmaDbm();
     method @Deprecated public int getCdmaEcio();
     method @NonNull public java.util.List<android.telephony.CellSignalStrength> getCellSignalStrengths();
-    method public <T extends android.telephony.CellSignalStrength> java.util.List<T> getCellSignalStrengths(@NonNull Class<T>);
+    method @NonNull public <T extends android.telephony.CellSignalStrength> java.util.List<T> getCellSignalStrengths(@NonNull Class<T>);
     method @Deprecated public int getEvdoDbm();
     method @Deprecated public int getEvdoEcio();
     method @Deprecated public int getEvdoSnr();
@@ -45022,13 +44970,13 @@
     method public String getCountryIso();
     method public int getDataRoaming();
     method public CharSequence getDisplayName();
-    method public String getGroupUuid();
+    method @Nullable public String getGroupUuid();
     method public String getIccId();
     method public int getIconTint();
     method @Deprecated public int getMcc();
-    method public String getMccString();
+    method @Nullable public String getMccString();
     method @Deprecated public int getMnc();
-    method public String getMncString();
+    method @Nullable public String getMncString();
     method public String getNumber();
     method public int getSimSlotIndex();
     method public int getSubscriptionId();
@@ -45036,7 +44984,7 @@
     method public boolean isEmbedded();
     method public boolean isOpportunistic();
     method public void writeToParcel(android.os.Parcel, int);
-    field public static final android.os.Parcelable.Creator<android.telephony.SubscriptionInfo> CREATOR;
+    field @NonNull public static final android.os.Parcelable.Creator<android.telephony.SubscriptionInfo> CREATOR;
   }
 
   public class SubscriptionManager {
@@ -45063,7 +45011,7 @@
     method public boolean isNetworkRoaming(int);
     method public static boolean isUsableSubscriptionId(int);
     method public static boolean isValidSubscriptionId(int);
-    method public void removeOnOpportunisticSubscriptionsChangedListener(android.telephony.SubscriptionManager.OnOpportunisticSubscriptionsChangedListener);
+    method public void removeOnOpportunisticSubscriptionsChangedListener(@NonNull android.telephony.SubscriptionManager.OnOpportunisticSubscriptionsChangedListener);
     method public void removeOnSubscriptionsChangedListener(android.telephony.SubscriptionManager.OnSubscriptionsChangedListener);
     method @RequiresPermission(android.Manifest.permission.MODIFY_PHONE_STATE) public boolean removeSubscriptionsFromGroup(@NonNull int[]);
     method @RequiresPermission(android.Manifest.permission.MODIFY_PHONE_STATE) public boolean setMetered(boolean, int);
@@ -45072,7 +45020,7 @@
     method public void setSubscriptionOverrideCongested(int, boolean, long);
     method public void setSubscriptionOverrideUnmetered(int, boolean, long);
     method public void setSubscriptionPlans(int, @NonNull java.util.List<android.telephony.SubscriptionPlan>);
-    method @RequiresPermission("android.permission.WRITE_EMBEDDED_SUBSCRIPTIONS") public void switchToSubscription(int, android.app.PendingIntent);
+    method @RequiresPermission("android.permission.WRITE_EMBEDDED_SUBSCRIPTIONS") public void switchToSubscription(int, @NonNull android.app.PendingIntent);
     field public static final String ACTION_DEFAULT_SMS_SUBSCRIPTION_CHANGED = "android.telephony.action.DEFAULT_SMS_SUBSCRIPTION_CHANGED";
     field public static final String ACTION_DEFAULT_SUBSCRIPTION_CHANGED = "android.telephony.action.DEFAULT_SUBSCRIPTION_CHANGED";
     field public static final String ACTION_MANAGE_SUBSCRIPTION_PLANS = "android.telephony.action.MANAGE_SUBSCRIPTION_PLANS";
@@ -45109,7 +45057,7 @@
     method public void writeToParcel(android.os.Parcel, int);
     field public static final long BYTES_UNKNOWN = -1L; // 0xffffffffffffffffL
     field public static final long BYTES_UNLIMITED = 9223372036854775807L; // 0x7fffffffffffffffL
-    field public static final android.os.Parcelable.Creator<android.telephony.SubscriptionPlan> CREATOR;
+    field @NonNull public static final android.os.Parcelable.Creator<android.telephony.SubscriptionPlan> CREATOR;
     field public static final int LIMIT_BEHAVIOR_BILLED = 1; // 0x1
     field public static final int LIMIT_BEHAVIOR_DISABLED = 0; // 0x0
     field public static final int LIMIT_BEHAVIOR_THROTTLED = 2; // 0x2
@@ -45137,22 +45085,22 @@
     method @RequiresPermission(android.Manifest.permission.READ_PHONE_STATE) @WorkerThread public android.os.PersistableBundle getCarrierConfig();
     method public int getCarrierIdFromSimMccMnc();
     method @Deprecated @RequiresPermission(android.Manifest.permission.ACCESS_FINE_LOCATION) public android.telephony.CellLocation getCellLocation();
-    method @RequiresPermission(android.Manifest.permission.READ_PHONE_STATE) @Nullable public java.util.Map<java.lang.Integer,java.util.List<android.telephony.emergency.EmergencyNumber>> getCurrentEmergencyNumberList();
-    method @RequiresPermission(android.Manifest.permission.READ_PHONE_STATE) @Nullable public java.util.Map<java.lang.Integer,java.util.List<android.telephony.emergency.EmergencyNumber>> getCurrentEmergencyNumberList(int);
     method public int getDataActivity();
     method @RequiresPermission(android.Manifest.permission.READ_PHONE_STATE) public int getDataNetworkType();
     method public int getDataState();
     method @Deprecated @RequiresPermission("android.permission.READ_PRIVILEGED_PHONE_STATE") public String getDeviceId();
     method @Deprecated @RequiresPermission("android.permission.READ_PRIVILEGED_PHONE_STATE") public String getDeviceId(int);
     method @RequiresPermission(android.Manifest.permission.READ_PHONE_STATE) public String getDeviceSoftwareVersion();
+    method @RequiresPermission(android.Manifest.permission.READ_PHONE_STATE) @NonNull public java.util.Map<java.lang.Integer,java.util.List<android.telephony.emergency.EmergencyNumber>> getEmergencyNumberList();
+    method @RequiresPermission(android.Manifest.permission.READ_PHONE_STATE) @NonNull public java.util.Map<java.lang.Integer,java.util.List<android.telephony.emergency.EmergencyNumber>> getEmergencyNumberList(int);
     method @RequiresPermission(android.Manifest.permission.READ_PHONE_STATE) public String[] getForbiddenPlmns();
     method @RequiresPermission(android.Manifest.permission.READ_PHONE_STATE) public String getGroupIdLevel1();
     method public String getIccAuthentication(int, int, String);
     method @RequiresPermission("android.permission.READ_PRIVILEGED_PHONE_STATE") public String getImei();
     method @RequiresPermission("android.permission.READ_PRIVILEGED_PHONE_STATE") public String getImei(int);
     method @RequiresPermission(anyOf={android.Manifest.permission.READ_PHONE_STATE, android.Manifest.permission.READ_SMS, android.Manifest.permission.READ_PHONE_NUMBERS}) public String getLine1Number();
-    method public String getManufacturerCode();
-    method public String getManufacturerCode(int);
+    method @Nullable public String getManufacturerCode();
+    method @Nullable public String getManufacturerCode(int);
     method @RequiresPermission("android.permission.READ_PRIVILEGED_PHONE_STATE") public String getMeid();
     method @RequiresPermission("android.permission.READ_PRIVILEGED_PHONE_STATE") public String getMeid(int);
     method public String getMmsUAProfUrl();
@@ -45173,15 +45121,15 @@
     method public String getSimCountryIso();
     method public String getSimOperator();
     method public String getSimOperatorName();
-    method public int getSimPreciseCarrierId();
-    method @Nullable public CharSequence getSimPreciseCarrierIdName();
     method @RequiresPermission("android.permission.READ_PRIVILEGED_PHONE_STATE") public String getSimSerialNumber();
+    method public int getSimSpecificCarrierId();
+    method @Nullable public CharSequence getSimSpecificCarrierIdName();
     method public int getSimState();
     method public int getSimState(int);
     method @RequiresPermission("android.permission.READ_PRIVILEGED_PHONE_STATE") public String getSubscriberId();
-    method public String getTypeAllocationCode();
-    method public String getTypeAllocationCode(int);
-    method @RequiresPermission("android.permission.READ_PRIVILEGED_PHONE_STATE") public java.util.List<android.telephony.UiccCardInfo> getUiccCardsInfo();
+    method @Nullable public String getTypeAllocationCode();
+    method @Nullable public String getTypeAllocationCode(int);
+    method @RequiresPermission("android.permission.READ_PRIVILEGED_PHONE_STATE") @NonNull public java.util.List<android.telephony.UiccCardInfo> getUiccCardsInfo();
     method @Nullable @RequiresPermission(android.Manifest.permission.READ_PHONE_STATE) public String getVisualVoicemailPackageName();
     method @RequiresPermission(android.Manifest.permission.READ_PHONE_STATE) public String getVoiceMailAlphaTag();
     method @RequiresPermission(android.Manifest.permission.READ_PHONE_STATE) public String getVoiceMailNumber();
@@ -45196,9 +45144,9 @@
     method public String iccTransmitApduBasicChannel(int, int, int, int, int, String);
     method public String iccTransmitApduLogicalChannel(int, int, int, int, int, int, String);
     method public boolean isConcurrentVoiceAndDataSupported();
-    method public boolean isCurrentEmergencyNumber(@NonNull String);
     method @RequiresPermission(anyOf={android.Manifest.permission.ACCESS_NETWORK_STATE, android.Manifest.permission.MODIFY_PHONE_STATE}) public boolean isDataEnabled();
     method @RequiresPermission(anyOf={android.Manifest.permission.ACCESS_NETWORK_STATE, android.Manifest.permission.READ_PHONE_STATE}) public boolean isDataRoamingEnabled();
+    method public boolean isEmergencyNumber(@NonNull String);
     method public boolean isHearingAidCompatibilitySupported();
     method @RequiresPermission(android.Manifest.permission.READ_PHONE_STATE) public boolean isMultisimSupported();
     method public boolean isNetworkRoaming();
@@ -45221,13 +45169,13 @@
     method @RequiresPermission(android.Manifest.permission.MODIFY_PHONE_STATE) public boolean setNetworkSelectionModeManual(String, boolean);
     method public boolean setOperatorBrandOverride(String);
     method public boolean setPreferredNetworkTypeToGlobal();
-    method public boolean setPreferredOpportunisticDataSubscription(int);
+    method public void setPreferredOpportunisticDataSubscription(int, boolean, @Nullable java.util.concurrent.Executor, @Nullable java.util.function.Consumer<java.lang.Integer>);
     method public void setVisualVoicemailSmsFilterSettings(android.telephony.VisualVoicemailSmsFilterSettings);
     method public boolean setVoiceMailNumber(String, String);
     method @Deprecated public void setVoicemailRingtoneUri(android.telecom.PhoneAccountHandle, android.net.Uri);
     method @Deprecated public void setVoicemailVibrationEnabled(android.telecom.PhoneAccountHandle, boolean);
     method @RequiresPermission(android.Manifest.permission.MODIFY_PHONE_STATE) public void switchMultiSimConfig(int);
-    method public boolean updateAvailableNetworks(java.util.List<android.telephony.AvailableNetworkInfo>);
+    method public void updateAvailableNetworks(@NonNull java.util.List<android.telephony.AvailableNetworkInfo>, @Nullable java.util.concurrent.Executor, @Nullable java.util.function.Consumer<java.lang.Integer>);
     field public static final String ACTION_CARRIER_MESSAGING_CLIENT_SERVICE = "android.telephony.action.CARRIER_MESSAGING_CLIENT_SERVICE";
     field public static final String ACTION_CONFIGURE_VOICEMAIL = "android.telephony.action.CONFIGURE_VOICEMAIL";
     field public static final String ACTION_NETWORK_COUNTRY_CHANGED = "android.telephony.action.NETWORK_COUNTRY_CHANGED";
@@ -45236,7 +45184,7 @@
     field public static final String ACTION_SECRET_CODE = "android.telephony.action.SECRET_CODE";
     field public static final String ACTION_SHOW_VOICEMAIL_NOTIFICATION = "android.telephony.action.SHOW_VOICEMAIL_NOTIFICATION";
     field public static final String ACTION_SUBSCRIPTION_CARRIER_IDENTITY_CHANGED = "android.telephony.action.SUBSCRIPTION_CARRIER_IDENTITY_CHANGED";
-    field public static final String ACTION_SUBSCRIPTION_PRECISE_CARRIER_IDENTITY_CHANGED = "android.telephony.action.SUBSCRIPTION_PRECISE_CARRIER_IDENTITY_CHANGED";
+    field public static final String ACTION_SUBSCRIPTION_SPECIFIC_CARRIER_IDENTITY_CHANGED = "android.telephony.action.SUBSCRIPTION_SPECIFIC_CARRIER_IDENTITY_CHANGED";
     field public static final int APPTYPE_CSIM = 4; // 0x4
     field public static final int APPTYPE_ISIM = 5; // 0x5
     field public static final int APPTYPE_RUIM = 3; // 0x3
@@ -45271,8 +45219,8 @@
     field public static final String EXTRA_NETWORK_COUNTRY = "android.telephony.extra.NETWORK_COUNTRY";
     field public static final String EXTRA_NOTIFICATION_COUNT = "android.telephony.extra.NOTIFICATION_COUNT";
     field public static final String EXTRA_PHONE_ACCOUNT_HANDLE = "android.telephony.extra.PHONE_ACCOUNT_HANDLE";
-    field public static final String EXTRA_PRECISE_CARRIER_ID = "android.telephony.extra.PRECISE_CARRIER_ID";
-    field public static final String EXTRA_PRECISE_CARRIER_NAME = "android.telephony.extra.PRECISE_CARRIER_NAME";
+    field public static final String EXTRA_SPECIFIC_CARRIER_ID = "android.telephony.extra.SPECIFIC_CARRIER_ID";
+    field public static final String EXTRA_SPECIFIC_CARRIER_NAME = "android.telephony.extra.SPECIFIC_CARRIER_NAME";
     field public static final String EXTRA_STATE = "state";
     field public static final String EXTRA_STATE_IDLE;
     field public static final String EXTRA_STATE_OFFHOOK;
@@ -45320,6 +45268,11 @@
     field public static final int UNINITIALIZED_CARD_ID = -2; // 0xfffffffe
     field public static final int UNKNOWN_CARRIER_ID = -1; // 0xffffffff
     field public static final int UNSUPPORTED_CARD_ID = -1; // 0xffffffff
+    field public static final int UPDATE_AVAILABLE_NETWORKS_ABORTED = 2; // 0x2
+    field public static final int UPDATE_AVAILABLE_NETWORKS_INVALID_ARGUMENTS = 3; // 0x3
+    field public static final int UPDATE_AVAILABLE_NETWORKS_NO_CARRIER_PRIVILEGE = 4; // 0x4
+    field public static final int UPDATE_AVAILABLE_NETWORKS_SUCCESS = 0; // 0x0
+    field public static final int UPDATE_AVAILABLE_NETWORKS_UNKNOWN_FAILURE = 1; // 0x1
     field public static final int USSD_ERROR_SERVICE_UNAVAIL = -2; // 0xfffffffe
     field public static final int USSD_RETURN_FAILURE = -1; // 0xffffffff
     field public static final String VVM_TYPE_CVVM = "vvm_type_cvvm";
@@ -45354,13 +45307,13 @@
   public final class UiccCardInfo implements android.os.Parcelable {
     method public int describeContents();
     method public int getCardId();
-    method public String getEid();
-    method public String getIccId();
+    method @Nullable public String getEid();
+    method @Nullable public String getIccId();
     method public int getSlotIndex();
     method public boolean isEuicc();
     method public boolean isRemovable();
     method public void writeToParcel(android.os.Parcel, int);
-    field public static final android.os.Parcelable.Creator<android.telephony.UiccCardInfo> CREATOR;
+    field @NonNull public static final android.os.Parcelable.Creator<android.telephony.UiccCardInfo> CREATOR;
   }
 
   public abstract class VisualVoicemailService extends android.app.Service {
@@ -45384,13 +45337,13 @@
     method public android.telecom.PhoneAccountHandle getPhoneAccountHandle();
     method public String getPrefix();
     method public void writeToParcel(android.os.Parcel, int);
-    field public static final android.os.Parcelable.Creator<android.telephony.VisualVoicemailSms> CREATOR;
+    field @NonNull public static final android.os.Parcelable.Creator<android.telephony.VisualVoicemailSms> CREATOR;
   }
 
   public final class VisualVoicemailSmsFilterSettings 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.telephony.VisualVoicemailSmsFilterSettings> CREATOR;
+    field @NonNull public static final android.os.Parcelable.Creator<android.telephony.VisualVoicemailSmsFilterSettings> CREATOR;
     field public static final int DESTINATION_PORT_ANY = -1; // 0xffffffff
     field public static final int DESTINATION_PORT_DATA_SMS = -2; // 0xfffffffe
     field public final String clientPrefix;
@@ -45457,7 +45410,7 @@
     field public static final int AUTH_TYPE_NONE = 0; // 0x0
     field public static final int AUTH_TYPE_PAP = 1; // 0x1
     field public static final int AUTH_TYPE_PAP_OR_CHAP = 3; // 0x3
-    field public static final android.os.Parcelable.Creator<android.telephony.data.ApnSetting> CREATOR;
+    field @NonNull public static final android.os.Parcelable.Creator<android.telephony.data.ApnSetting> CREATOR;
     field public static final int MVNO_TYPE_GID = 2; // 0x2
     field public static final int MVNO_TYPE_ICCID = 3; // 0x3
     field public static final int MVNO_TYPE_IMSI = 1; // 0x1
@@ -45476,6 +45429,7 @@
     field public static final int TYPE_HIPRI = 16; // 0x10
     field public static final int TYPE_IA = 256; // 0x100
     field public static final int TYPE_IMS = 64; // 0x40
+    field public static final int TYPE_MCX = 1024; // 0x400
     field public static final int TYPE_MMS = 2; // 0x2
     field public static final int TYPE_SUPL = 4; // 0x4
   }
@@ -45487,7 +45441,7 @@
     method public android.telephony.data.ApnSetting.Builder setApnTypeBitmask(int);
     method public android.telephony.data.ApnSetting.Builder setAuthType(int);
     method public android.telephony.data.ApnSetting.Builder setCarrierEnabled(boolean);
-    method public android.telephony.data.ApnSetting.Builder setCarrierId(int);
+    method @NonNull public android.telephony.data.ApnSetting.Builder setCarrierId(int);
     method public android.telephony.data.ApnSetting.Builder setEntryName(String);
     method @Deprecated public android.telephony.data.ApnSetting.Builder setMmsProxyAddress(java.net.InetAddress);
     method public android.telephony.data.ApnSetting.Builder setMmsProxyAddress(String);
@@ -45512,19 +45466,17 @@
   public final class EmergencyNumber implements java.lang.Comparable<android.telephony.emergency.EmergencyNumber> android.os.Parcelable {
     method public int compareTo(@NonNull android.telephony.emergency.EmergencyNumber);
     method public int describeContents();
-    method public String getCountryIso();
+    method @NonNull public String getCountryIso();
     method public int getEmergencyCallRouting();
-    method public int getEmergencyNumberSourceBitmask();
-    method public java.util.List<java.lang.Integer> getEmergencyNumberSources();
-    method public java.util.List<java.lang.Integer> getEmergencyServiceCategories();
-    method public int getEmergencyServiceCategoryBitmask();
+    method @NonNull public java.util.List<java.lang.Integer> getEmergencyNumberSources();
+    method @NonNull public java.util.List<java.lang.Integer> getEmergencyServiceCategories();
     method @NonNull public java.util.List<java.lang.String> getEmergencyUrns();
-    method public String getMnc();
-    method public String getNumber();
+    method @NonNull public String getMnc();
+    method @NonNull public String getNumber();
     method public boolean isFromSources(int);
     method public boolean isInEmergencyServiceCategories(int);
     method public void writeToParcel(android.os.Parcel, int);
-    field public static final android.os.Parcelable.Creator<android.telephony.emergency.EmergencyNumber> CREATOR;
+    field @NonNull public static final android.os.Parcelable.Creator<android.telephony.emergency.EmergencyNumber> CREATOR;
     field public static final int EMERGENCY_CALL_ROUTING_EMERGENCY = 1; // 0x1
     field public static final int EMERGENCY_CALL_ROUTING_NORMAL = 2; // 0x2
     field public static final int EMERGENCY_CALL_ROUTING_UNKNOWN = 0; // 0x0
@@ -45553,7 +45505,7 @@
     method @Nullable public String getConfirmationCode();
     method @Nullable public String getEncodedActivationCode();
     method public void writeToParcel(android.os.Parcel, int);
-    field public static final android.os.Parcelable.Creator<android.telephony.euicc.DownloadableSubscription> CREATOR;
+    field @NonNull public static final android.os.Parcelable.Creator<android.telephony.euicc.DownloadableSubscription> CREATOR;
   }
 
   public final class EuiccInfo implements android.os.Parcelable {
@@ -45561,11 +45513,11 @@
     method public int describeContents();
     method @Nullable public String getOsVersion();
     method public void writeToParcel(android.os.Parcel, int);
-    field public static final android.os.Parcelable.Creator<android.telephony.euicc.EuiccInfo> CREATOR;
+    field @NonNull public static final android.os.Parcelable.Creator<android.telephony.euicc.EuiccInfo> CREATOR;
   }
 
   public class EuiccManager {
-    method public android.telephony.euicc.EuiccManager createForCardId(int);
+    method @NonNull public android.telephony.euicc.EuiccManager createForCardId(int);
     method @RequiresPermission("android.permission.WRITE_EMBEDDED_SUBSCRIPTIONS") public void deleteSubscription(int, android.app.PendingIntent);
     method @RequiresPermission("android.permission.WRITE_EMBEDDED_SUBSCRIPTIONS") public void downloadSubscription(android.telephony.euicc.DownloadableSubscription, boolean, android.app.PendingIntent);
     method @Nullable public String getEid();
@@ -45690,7 +45642,7 @@
     method public int getSubscriptionId();
     method public byte[] toByteArray();
     method public void writeToParcel(android.os.Parcel, int);
-    field public static final android.os.Parcelable.Creator<android.telephony.mbms.DownloadRequest> CREATOR;
+    field @NonNull public static final android.os.Parcelable.Creator<android.telephony.mbms.DownloadRequest> CREATOR;
   }
 
   public static class DownloadRequest.Builder {
@@ -45713,14 +45665,14 @@
     method public String getMimeType();
     method public android.net.Uri getUri();
     method public void writeToParcel(android.os.Parcel, int);
-    field public static final android.os.Parcelable.Creator<android.telephony.mbms.FileInfo> CREATOR;
+    field @NonNull public static final android.os.Parcelable.Creator<android.telephony.mbms.FileInfo> CREATOR;
   }
 
   public final class FileServiceInfo extends android.telephony.mbms.ServiceInfo implements android.os.Parcelable {
     method public int describeContents();
     method public java.util.List<android.telephony.mbms.FileInfo> getFiles();
     method public void writeToParcel(android.os.Parcel, int);
-    field public static final android.os.Parcelable.Creator<android.telephony.mbms.FileServiceInfo> CREATOR;
+    field @NonNull public static final android.os.Parcelable.Creator<android.telephony.mbms.FileServiceInfo> CREATOR;
   }
 
   public class GroupCall implements java.lang.AutoCloseable {
@@ -45853,7 +45805,7 @@
   public final class StreamingServiceInfo extends android.telephony.mbms.ServiceInfo 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.telephony.mbms.StreamingServiceInfo> CREATOR;
+    field @NonNull public static final android.os.Parcelable.Creator<android.telephony.mbms.StreamingServiceInfo> CREATOR;
   }
 
 }
@@ -47118,7 +47070,7 @@
 
   public static class LineHeightSpan.Standard implements android.text.style.LineHeightSpan android.text.ParcelableSpan {
     ctor public LineHeightSpan.Standard(@Px @IntRange(from=1) int);
-    ctor public LineHeightSpan.Standard(android.os.Parcel);
+    ctor public LineHeightSpan.Standard(@NonNull android.os.Parcel);
     method public void chooseHeight(@NonNull CharSequence, int, int, int, int, @NonNull android.graphics.Paint.FontMetricsInt);
     method public int describeContents();
     method @Px public int getHeight();
@@ -47252,7 +47204,7 @@
     method public void updateDrawState(android.text.TextPaint);
     method public void writeToParcel(android.os.Parcel, int);
     field @Deprecated public static final String ACTION_SUGGESTION_PICKED = "android.text.style.SUGGESTION_PICKED";
-    field public static final android.os.Parcelable.Creator<android.text.style.SuggestionSpan> CREATOR;
+    field @NonNull public static final android.os.Parcelable.Creator<android.text.style.SuggestionSpan> CREATOR;
     field public static final int FLAG_AUTO_CORRECTION = 4; // 0x4
     field public static final int FLAG_EASY_CORRECT = 1; // 0x1
     field public static final int FLAG_MISSPELLED = 2; // 0x2
@@ -48709,7 +48661,7 @@
     method public int describeContents();
     method public final android.os.Parcelable getSuperState();
     method public void writeToParcel(android.os.Parcel, int);
-    field public static final android.os.Parcelable.Creator<android.view.AbsSavedState> CREATOR;
+    field @NonNull public static final android.os.Parcelable.Creator<android.view.AbsSavedState> CREATOR;
     field public static final android.view.AbsSavedState EMPTY_STATE;
   }
 
@@ -48859,7 +48811,7 @@
     method public float getDesiredMinLuminance();
     method public int[] getSupportedHdrTypes();
     method public void writeToParcel(android.os.Parcel, int);
-    field public static final android.os.Parcelable.Creator<android.view.Display.HdrCapabilities> CREATOR;
+    field @NonNull public static final android.os.Parcelable.Creator<android.view.Display.HdrCapabilities> CREATOR;
     field public static final int HDR_TYPE_DOLBY_VISION = 1; // 0x1
     field public static final int HDR_TYPE_HDR10 = 2; // 0x2
     field public static final int HDR_TYPE_HDR10_PLUS = 4; // 0x4
@@ -48874,7 +48826,7 @@
     method public int getPhysicalWidth();
     method public float getRefreshRate();
     method public void writeToParcel(android.os.Parcel, int);
-    field public static final android.os.Parcelable.Creator<android.view.Display.Mode> CREATOR;
+    field @NonNull public static final android.os.Parcelable.Creator<android.view.Display.Mode> CREATOR;
   }
 
   public final class DisplayCutout {
@@ -48895,7 +48847,7 @@
     method public int describeContents();
     method public void release();
     method public void writeToParcel(android.os.Parcel, int);
-    field public static final android.os.Parcelable.Creator<android.view.DragAndDropPermissions> CREATOR;
+    field @NonNull public static final android.os.Parcelable.Creator<android.view.DragAndDropPermissions> CREATOR;
   }
 
   public class DragEvent implements android.os.Parcelable {
@@ -48914,7 +48866,7 @@
     field public static final int ACTION_DRAG_LOCATION = 2; // 0x2
     field public static final int ACTION_DRAG_STARTED = 1; // 0x1
     field public static final int ACTION_DROP = 3; // 0x3
-    field public static final android.os.Parcelable.Creator<android.view.DragEvent> CREATOR;
+    field @NonNull public static final android.os.Parcelable.Creator<android.view.DragEvent> CREATOR;
   }
 
   public class FocusFinder {
@@ -49084,7 +49036,7 @@
     method public boolean isVirtual();
     method public boolean supportsSource(int);
     method public void writeToParcel(android.os.Parcel, int);
-    field public static final android.os.Parcelable.Creator<android.view.InputDevice> CREATOR;
+    field @NonNull public static final android.os.Parcelable.Creator<android.view.InputDevice> CREATOR;
     field public static final int KEYBOARD_TYPE_ALPHABETIC = 2; // 0x2
     field public static final int KEYBOARD_TYPE_NONE = 0; // 0x0
     field public static final int KEYBOARD_TYPE_NON_ALPHABETIC = 1; // 0x1
@@ -49141,7 +49093,7 @@
     method public abstract long getEventTime();
     method public abstract int getSource();
     method public boolean isFromSource(int);
-    field public static final android.os.Parcelable.Creator<android.view.InputEvent> CREATOR;
+    field @NonNull public static final android.os.Parcelable.Creator<android.view.InputEvent> CREATOR;
   }
 
   public final class InputQueue {
@@ -49173,7 +49125,7 @@
     field @Deprecated public static final int BUILT_IN_KEYBOARD = 0; // 0x0
     field public static final int COMBINING_ACCENT = -2147483648; // 0x80000000
     field public static final int COMBINING_ACCENT_MASK = 2147483647; // 0x7fffffff
-    field public static final android.os.Parcelable.Creator<android.view.KeyCharacterMap> CREATOR;
+    field @NonNull public static final android.os.Parcelable.Creator<android.view.KeyCharacterMap> CREATOR;
     field public static final int FULL = 4; // 0x4
     field public static final char HEX_INPUT = 61184; // 0xef00 '\uef00'
     field public static final int MODIFIER_BEHAVIOR_CHORDED = 0; // 0x0
@@ -49266,7 +49218,7 @@
     field public static final int ACTION_DOWN = 0; // 0x0
     field @Deprecated public static final int ACTION_MULTIPLE = 2; // 0x2
     field public static final int ACTION_UP = 1; // 0x1
-    field public static final android.os.Parcelable.Creator<android.view.KeyEvent> CREATOR;
+    field @NonNull public static final android.os.Parcelable.Creator<android.view.KeyEvent> CREATOR;
     field public static final int FLAG_CANCELED = 32; // 0x20
     field public static final int FLAG_CANCELED_LONG_PRESS = 256; // 0x100
     field public static final int FLAG_EDITOR_ACTION = 16; // 0x10
@@ -49616,7 +49568,7 @@
     method public java.util.List<android.view.KeyboardShortcutInfo> getItems();
     method public CharSequence getLabel();
     method public void writeToParcel(android.os.Parcel, int);
-    field public static final android.os.Parcelable.Creator<android.view.KeyboardShortcutGroup> CREATOR;
+    field @NonNull public static final android.os.Parcelable.Creator<android.view.KeyboardShortcutGroup> CREATOR;
   }
 
   public final class KeyboardShortcutInfo implements android.os.Parcelable {
@@ -49628,7 +49580,7 @@
     method @Nullable public CharSequence getLabel();
     method public int getModifiers();
     method public void writeToParcel(android.os.Parcel, int);
-    field public static final android.os.Parcelable.Creator<android.view.KeyboardShortcutInfo> CREATOR;
+    field @NonNull public static final android.os.Parcelable.Creator<android.view.KeyboardShortcutInfo> CREATOR;
   }
 
   public abstract class LayoutInflater {
@@ -49949,7 +49901,7 @@
     field public static final int CLASSIFICATION_AMBIGUOUS_GESTURE = 1; // 0x1
     field public static final int CLASSIFICATION_DEEP_PRESS = 2; // 0x2
     field public static final int CLASSIFICATION_NONE = 0; // 0x0
-    field public static final android.os.Parcelable.Creator<android.view.MotionEvent> CREATOR;
+    field @NonNull public static final android.os.Parcelable.Creator<android.view.MotionEvent> CREATOR;
     field public static final int EDGE_BOTTOM = 2; // 0x2
     field public static final int EDGE_LEFT = 4; // 0x4
     field public static final int EDGE_RIGHT = 8; // 0x8
@@ -50037,7 +49989,7 @@
     method public static android.view.PointerIcon getSystemIcon(@NonNull android.content.Context, int);
     method public static android.view.PointerIcon load(@NonNull android.content.res.Resources, @XmlRes int);
     method public void writeToParcel(android.os.Parcel, int);
-    field public static final android.os.Parcelable.Creator<android.view.PointerIcon> CREATOR;
+    field @NonNull public static final android.os.Parcelable.Creator<android.view.PointerIcon> CREATOR;
     field public static final int TYPE_ALIAS = 1010; // 0x3f2
     field public static final int TYPE_ALL_SCROLL = 1013; // 0x3f5
     field public static final int TYPE_ARROW = 1000; // 0x3e8
@@ -50136,7 +50088,7 @@
     method @Deprecated public void unlockCanvas(android.graphics.Canvas);
     method public void unlockCanvasAndPost(android.graphics.Canvas);
     method public void writeToParcel(android.os.Parcel, int);
-    field public static final android.os.Parcelable.Creator<android.view.Surface> CREATOR;
+    field @NonNull public static final android.os.Parcelable.Creator<android.view.Surface> CREATOR;
     field public static final int ROTATION_0 = 0; // 0x0
     field public static final int ROTATION_180 = 2; // 0x2
     field public static final int ROTATION_270 = 3; // 0x3
@@ -50154,7 +50106,7 @@
     method public void readFromParcel(android.os.Parcel);
     method public void release();
     method public void writeToParcel(android.os.Parcel, int);
-    field public static final android.os.Parcelable.Creator<android.view.SurfaceControl> CREATOR;
+    field @NonNull public static final android.os.Parcelable.Creator<android.view.SurfaceControl> CREATOR;
   }
 
   public static class SurfaceControl.Builder {
@@ -50389,12 +50341,12 @@
     method public int getAccessibilityLiveRegion();
     method public android.view.accessibility.AccessibilityNodeProvider getAccessibilityNodeProvider();
     method @Nullable public CharSequence getAccessibilityPaneTitle();
-    method public int getAccessibilityTraversalAfter();
-    method public int getAccessibilityTraversalBefore();
+    method @IdRes public int getAccessibilityTraversalAfter();
+    method @IdRes public int getAccessibilityTraversalBefore();
     method @android.view.ViewDebug.ExportedProperty(category="drawing") public float getAlpha();
     method public android.view.animation.Animation getAnimation();
     method public android.os.IBinder getApplicationWindowToken();
-    method @NonNull public java.util.List<java.lang.Integer> getAttributeResolutionStack(@AttrRes int);
+    method @NonNull public int[] getAttributeResolutionStack(@AttrRes int);
     method @NonNull public java.util.Map<java.lang.Integer,java.lang.Integer> getAttributeSourceResourceMap();
     method @android.view.ViewDebug.ExportedProperty @Nullable public String[] getAutofillHints();
     method public final android.view.autofill.AutofillId getAutofillId();
@@ -50452,7 +50404,7 @@
     method @android.view.ViewDebug.ExportedProperty(mapping={@android.view.ViewDebug.IntToString(from=android.view.View.IMPORTANT_FOR_CONTENT_CAPTURE_AUTO, to="auto"), @android.view.ViewDebug.IntToString(from=android.view.View.IMPORTANT_FOR_CONTENT_CAPTURE_YES, to="yes"), @android.view.ViewDebug.IntToString(from=android.view.View.IMPORTANT_FOR_CONTENT_CAPTURE_NO, to="no"), @android.view.ViewDebug.IntToString(from=android.view.View.IMPORTANT_FOR_CONTENT_CAPTURE_YES_EXCLUDE_DESCENDANTS, to="yesExcludeDescendants"), @android.view.ViewDebug.IntToString(from=android.view.View.IMPORTANT_FOR_CONTENT_CAPTURE_NO_EXCLUDE_DESCENDANTS, to="noExcludeDescendants")}) public int getImportantForContentCapture();
     method public boolean getKeepScreenOn();
     method public android.view.KeyEvent.DispatcherState getKeyDispatcherState();
-    method @android.view.ViewDebug.ExportedProperty(category="accessibility") public int getLabelFor();
+    method @android.view.ViewDebug.ExportedProperty(category="accessibility") @IdRes public int getLabelFor();
     method public int getLayerType();
     method @android.view.ViewDebug.ExportedProperty(category="layout", mapping={@android.view.ViewDebug.IntToString(from=android.view.View.LAYOUT_DIRECTION_LTR, to="RESOLVED_DIRECTION_LTR"), @android.view.ViewDebug.IntToString(from=android.view.View.LAYOUT_DIRECTION_RTL, to="RESOLVED_DIRECTION_RTL")}) public int getLayoutDirection();
     method @android.view.ViewDebug.ExportedProperty(deepExport=true, prefix="layout_") public android.view.ViewGroup.LayoutParams getLayoutParams();
@@ -50470,12 +50422,12 @@
     method @android.view.ViewDebug.ExportedProperty(category="measurement", flagMapping={@android.view.ViewDebug.FlagToString(mask=android.view.View.MEASURED_STATE_MASK, equals=android.view.View.MEASURED_STATE_TOO_SMALL, name="MEASURED_STATE_TOO_SMALL")}) public final int getMeasuredWidthAndState();
     method public int getMinimumHeight();
     method public int getMinimumWidth();
-    method public int getNextClusterForwardId();
-    method public int getNextFocusDownId();
-    method public int getNextFocusForwardId();
-    method public int getNextFocusLeftId();
-    method public int getNextFocusRightId();
-    method public int getNextFocusUpId();
+    method @IdRes public int getNextClusterForwardId();
+    method @IdRes public int getNextFocusDownId();
+    method @IdRes public int getNextFocusForwardId();
+    method @IdRes public int getNextFocusLeftId();
+    method @IdRes public int getNextFocusRightId();
+    method @IdRes public int getNextFocusUpId();
     method public android.view.View.OnFocusChangeListener getOnFocusChangeListener();
     method @ColorInt public int getOutlineAmbientShadowColor();
     method public android.view.ViewOutlineProvider getOutlineProvider();
@@ -50517,6 +50469,7 @@
     method public android.animation.StateListAnimator getStateListAnimator();
     method protected int getSuggestedMinimumHeight();
     method protected int getSuggestedMinimumWidth();
+    method @NonNull public java.util.List<android.graphics.Rect> getSystemGestureExclusionRects();
     method public int getSystemUiVisibility();
     method @android.view.ViewDebug.ExportedProperty public Object getTag();
     method public Object getTag(int);
@@ -50736,8 +50689,8 @@
     method public void setAccessibilityHeading(boolean);
     method public void setAccessibilityLiveRegion(int);
     method public void setAccessibilityPaneTitle(@Nullable CharSequence);
-    method public void setAccessibilityTraversalAfter(int);
-    method public void setAccessibilityTraversalBefore(int);
+    method public void setAccessibilityTraversalAfter(@IdRes int);
+    method public void setAccessibilityTraversalBefore(@IdRes int);
     method public void setActivated(boolean);
     method public void setAlpha(@FloatRange(from=0.0, to=1.0) float);
     method public void setAnimation(android.view.animation.Animation);
@@ -50802,12 +50755,12 @@
     method public void setMinimumHeight(int);
     method public void setMinimumWidth(int);
     method public void setNestedScrollingEnabled(boolean);
-    method public void setNextClusterForwardId(int);
-    method public void setNextFocusDownId(int);
-    method public void setNextFocusForwardId(int);
-    method public void setNextFocusLeftId(int);
-    method public void setNextFocusRightId(int);
-    method public void setNextFocusUpId(int);
+    method public void setNextClusterForwardId(@IdRes int);
+    method public void setNextFocusDownId(@IdRes int);
+    method public void setNextFocusForwardId(@IdRes int);
+    method public void setNextFocusLeftId(@IdRes int);
+    method public void setNextFocusRightId(@IdRes int);
+    method public void setNextFocusUpId(@IdRes int);
     method public void setOnApplyWindowInsetsListener(android.view.View.OnApplyWindowInsetsListener);
     method public void setOnCapturedPointerListener(android.view.View.OnCapturedPointerListener);
     method public void setOnClickListener(@Nullable android.view.View.OnClickListener);
@@ -50855,6 +50808,7 @@
     method public void setSelected(boolean);
     method public void setSoundEffectsEnabled(boolean);
     method public void setStateListAnimator(android.animation.StateListAnimator);
+    method public void setSystemGestureExclusionRects(@NonNull java.util.List<android.graphics.Rect>);
     method public void setSystemUiVisibility(int);
     method public void setTag(Object);
     method public void setTag(int, Object);
@@ -50889,8 +50843,8 @@
     method public final boolean startDragAndDrop(android.content.ClipData, android.view.View.DragShadowBuilder, Object, int);
     method public boolean startNestedScroll(int);
     method public void stopNestedScroll();
-    method public void transformMatrixToGlobal(android.graphics.Matrix);
-    method public void transformMatrixToLocal(android.graphics.Matrix);
+    method public void transformMatrixToGlobal(@NonNull android.graphics.Matrix);
+    method public void transformMatrixToLocal(@NonNull android.graphics.Matrix);
     method public void unscheduleDrawable(@NonNull android.graphics.drawable.Drawable, @NonNull Runnable);
     method public void unscheduleDrawable(android.graphics.drawable.Drawable);
     method public final void updateDragShadow(android.view.View.DragShadowBuilder);
@@ -51088,7 +51042,7 @@
     ctor public View.BaseSavedState(android.os.Parcel);
     ctor public View.BaseSavedState(android.os.Parcel, ClassLoader);
     ctor public View.BaseSavedState(android.os.Parcelable);
-    field public static final android.os.Parcelable.Creator<android.view.View.BaseSavedState> CREATOR;
+    field @NonNull public static final android.os.Parcelable.Creator<android.view.View.BaseSavedState> CREATOR;
   }
 
   public static class View.DragShadowBuilder {
@@ -51683,6 +51637,7 @@
     method public void addOnGlobalLayoutListener(android.view.ViewTreeObserver.OnGlobalLayoutListener);
     method public void addOnPreDrawListener(android.view.ViewTreeObserver.OnPreDrawListener);
     method public void addOnScrollChangedListener(android.view.ViewTreeObserver.OnScrollChangedListener);
+    method public void addOnSystemGestureExclusionRectsChangedListener(java.util.function.Consumer<java.util.List<android.graphics.Rect>>);
     method public void addOnTouchModeChangeListener(android.view.ViewTreeObserver.OnTouchModeChangeListener);
     method public void addOnWindowAttachListener(android.view.ViewTreeObserver.OnWindowAttachListener);
     method public void addOnWindowFocusChangeListener(android.view.ViewTreeObserver.OnWindowFocusChangeListener);
@@ -51697,6 +51652,7 @@
     method public void removeOnGlobalLayoutListener(android.view.ViewTreeObserver.OnGlobalLayoutListener);
     method public void removeOnPreDrawListener(android.view.ViewTreeObserver.OnPreDrawListener);
     method public void removeOnScrollChangedListener(android.view.ViewTreeObserver.OnScrollChangedListener);
+    method public void removeOnSystemGestureExclusionRectsChangedListener(java.util.function.Consumer<java.util.List<android.graphics.Rect>>);
     method public void removeOnTouchModeChangeListener(android.view.ViewTreeObserver.OnTouchModeChangeListener);
     method public void removeOnWindowAttachListener(android.view.ViewTreeObserver.OnWindowAttachListener);
     method public void removeOnWindowFocusChangeListener(android.view.ViewTreeObserver.OnWindowFocusChangeListener);
@@ -51937,7 +51893,7 @@
   public final class WindowAnimationFrameStats extends android.view.FrameStats 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.view.WindowAnimationFrameStats> CREATOR;
+    field @NonNull public static final android.os.Parcelable.Creator<android.view.WindowAnimationFrameStats> CREATOR;
   }
 
   public final class WindowContentFrameStats extends android.view.FrameStats implements android.os.Parcelable {
@@ -51945,7 +51901,7 @@
     method public long getFramePostedTimeNano(int);
     method public long getFrameReadyTimeNano(int);
     method public void writeToParcel(android.os.Parcel, int);
-    field public static final android.os.Parcelable.Creator<android.view.WindowContentFrameStats> CREATOR;
+    field @NonNull public static final android.os.Parcelable.Creator<android.view.WindowContentFrameStats> CREATOR;
   }
 
   public class WindowId implements android.os.Parcelable {
@@ -51954,7 +51910,7 @@
     method public void registerFocusObserver(android.view.WindowId.FocusObserver);
     method public void unregisterFocusObserver(android.view.WindowId.FocusObserver);
     method public void writeToParcel(android.os.Parcel, int);
-    field public static final android.os.Parcelable.Creator<android.view.WindowId> CREATOR;
+    field @NonNull public static final android.os.Parcelable.Creator<android.view.WindowId> CREATOR;
   }
 
   public abstract static class WindowId.FocusObserver {
@@ -51974,6 +51930,7 @@
     method public int getStableInsetRight();
     method public int getStableInsetTop();
     method @NonNull public android.graphics.Insets getStableInsets();
+    method @NonNull public android.graphics.Insets getSystemGestureInsets();
     method public int getSystemWindowInsetBottom();
     method public int getSystemWindowInsetLeft();
     method public int getSystemWindowInsetRight();
@@ -51995,6 +51952,7 @@
     method @NonNull public android.view.WindowInsets build();
     method @NonNull public android.view.WindowInsets.Builder setDisplayCutout(@Nullable android.view.DisplayCutout);
     method @NonNull public android.view.WindowInsets.Builder setStableInsets(@NonNull android.graphics.Insets);
+    method @NonNull public android.view.WindowInsets.Builder setSystemGestureInsets(@NonNull android.graphics.Insets);
     method @NonNull public android.view.WindowInsets.Builder setSystemWindowInsets(@NonNull android.graphics.Insets);
   }
 
@@ -52035,7 +51993,7 @@
     field public static final float BRIGHTNESS_OVERRIDE_FULL = 1.0f;
     field public static final float BRIGHTNESS_OVERRIDE_NONE = -1.0f;
     field public static final float BRIGHTNESS_OVERRIDE_OFF = 0.0f;
-    field public static final android.os.Parcelable.Creator<android.view.WindowManager.LayoutParams> CREATOR;
+    field @NonNull public static final android.os.Parcelable.Creator<android.view.WindowManager.LayoutParams> CREATOR;
     field public static final int DIM_AMOUNT_CHANGED = 32; // 0x20
     field public static final int FIRST_APPLICATION_WINDOW = 1; // 0x1
     field public static final int FIRST_SUB_WINDOW = 1000; // 0x3e8
@@ -52195,7 +52153,7 @@
     field public static final int CONTENT_CHANGE_TYPE_SUBTREE = 1; // 0x1
     field public static final int CONTENT_CHANGE_TYPE_TEXT = 2; // 0x2
     field public static final int CONTENT_CHANGE_TYPE_UNDEFINED = 0; // 0x0
-    field public static final android.os.Parcelable.Creator<android.view.accessibility.AccessibilityEvent> CREATOR;
+    field @NonNull public static final android.os.Parcelable.Creator<android.view.accessibility.AccessibilityEvent> CREATOR;
     field public static final int INVALID_POSITION = -1; // 0xffffffff
     field @Deprecated public static final int MAX_TEXT_LENGTH = 500; // 0x1f4
     field public static final int TYPES_ALL_MASK = -1; // 0xffffffff
@@ -52445,7 +52403,7 @@
     field public static final int ACTION_SELECT = 4; // 0x4
     field public static final int ACTION_SET_SELECTION = 131072; // 0x20000
     field public static final int ACTION_SET_TEXT = 2097152; // 0x200000
-    field public static final android.os.Parcelable.Creator<android.view.accessibility.AccessibilityNodeInfo> CREATOR;
+    field @NonNull public static final android.os.Parcelable.Creator<android.view.accessibility.AccessibilityNodeInfo> CREATOR;
     field public static final String EXTRA_DATA_TEXT_CHARACTER_LOCATION_ARG_LENGTH = "android.view.accessibility.extra.DATA_TEXT_CHARACTER_LOCATION_ARG_LENGTH";
     field public static final String EXTRA_DATA_TEXT_CHARACTER_LOCATION_ARG_START_INDEX = "android.view.accessibility.extra.DATA_TEXT_CHARACTER_LOCATION_ARG_START_INDEX";
     field public static final String EXTRA_DATA_TEXT_CHARACTER_LOCATION_KEY = "android.view.accessibility.extra.DATA_TEXT_CHARACTER_LOCATION_KEY";
@@ -52542,7 +52500,7 @@
     method public int getRegionCount();
     method @Nullable public android.view.accessibility.AccessibilityNodeInfo getTargetForRegion(@NonNull android.graphics.Region);
     method public void writeToParcel(android.os.Parcel, int);
-    field public static final android.os.Parcelable.Creator<android.view.accessibility.AccessibilityNodeInfo.TouchDelegateInfo> CREATOR;
+    field @NonNull public static final android.os.Parcelable.Creator<android.view.accessibility.AccessibilityNodeInfo.TouchDelegateInfo> CREATOR;
   }
 
   public abstract class AccessibilityNodeProvider {
@@ -52635,7 +52593,7 @@
     method public static android.view.accessibility.AccessibilityWindowInfo obtain(android.view.accessibility.AccessibilityWindowInfo);
     method public void recycle();
     method public void writeToParcel(android.os.Parcel, int);
-    field public static final android.os.Parcelable.Creator<android.view.accessibility.AccessibilityWindowInfo> CREATOR;
+    field @NonNull public static final android.os.Parcelable.Creator<android.view.accessibility.AccessibilityWindowInfo> CREATOR;
     field public static final int TYPE_ACCESSIBILITY_OVERLAY = 4; // 0x4
     field public static final int TYPE_APPLICATION = 1; // 0x1
     field public static final int TYPE_INPUT_METHOD = 2; // 0x2
@@ -52968,7 +52926,7 @@
   public final class AutofillId 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.view.autofill.AutofillId> CREATOR;
+    field @NonNull public static final android.os.Parcelable.Creator<android.view.autofill.AutofillId> CREATOR;
   }
 
   public final class AutofillManager {
@@ -53029,7 +52987,7 @@
     method public boolean isText();
     method public boolean isToggle();
     method public void writeToParcel(android.os.Parcel, int);
-    field public static final android.os.Parcelable.Creator<android.view.autofill.AutofillValue> CREATOR;
+    field @NonNull public static final android.os.Parcelable.Creator<android.view.autofill.AutofillValue> CREATOR;
   }
 
 }
@@ -53038,16 +52996,16 @@
 
   public final class ContentCaptureContext implements android.os.Parcelable {
     method public int describeContents();
-    method public static android.view.contentcapture.ContentCaptureContext forLocusId(@NonNull android.net.Uri);
+    method @NonNull public static android.view.contentcapture.ContentCaptureContext forLocusId(@NonNull String);
     method @Nullable public android.os.Bundle getExtras();
     method @NonNull public android.content.LocusId getLocusId();
     method public void writeToParcel(android.os.Parcel, int);
-    field public static final android.os.Parcelable.Creator<android.view.contentcapture.ContentCaptureContext> CREATOR;
+    field @NonNull public static final android.os.Parcelable.Creator<android.view.contentcapture.ContentCaptureContext> CREATOR;
   }
 
   public static final class ContentCaptureContext.Builder {
     ctor public ContentCaptureContext.Builder(@NonNull android.content.LocusId);
-    method public android.view.contentcapture.ContentCaptureContext build();
+    method @NonNull public android.view.contentcapture.ContentCaptureContext build();
     method @NonNull public android.view.contentcapture.ContentCaptureContext.Builder setExtras(@NonNull android.os.Bundle);
   }
 
@@ -53063,7 +53021,7 @@
     method @NonNull public final android.view.contentcapture.ContentCaptureSession createContentCaptureSession(@NonNull android.view.contentcapture.ContentCaptureContext);
     method public final void destroy();
     method @Nullable public final android.view.contentcapture.ContentCaptureContext getContentCaptureContext();
-    method public final android.view.contentcapture.ContentCaptureSessionId getContentCaptureSessionId();
+    method @NonNull public final android.view.contentcapture.ContentCaptureSessionId getContentCaptureSessionId();
     method @NonNull public android.view.autofill.AutofillId newAutofillId(@NonNull android.view.autofill.AutofillId, long);
     method @NonNull public final android.view.ViewStructure newVirtualViewStructure(@NonNull android.view.autofill.AutofillId, long);
     method public final void notifyViewAppeared(@NonNull android.view.ViewStructure);
@@ -53076,7 +53034,7 @@
   public final class ContentCaptureSessionId 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.view.contentcapture.ContentCaptureSessionId> CREATOR;
+    field @NonNull public static final android.os.Parcelable.Creator<android.view.contentcapture.ContentCaptureSessionId> CREATOR;
   }
 
   public final class UserDataRemovalRequest implements android.os.Parcelable {
@@ -53085,19 +53043,20 @@
     method @NonNull public String getPackageName();
     method public boolean isForEverything();
     method public void writeToParcel(android.os.Parcel, int);
-    field public static final android.os.Parcelable.Creator<android.view.contentcapture.UserDataRemovalRequest> CREATOR;
+    field @NonNull public static final android.os.Parcelable.Creator<android.view.contentcapture.UserDataRemovalRequest> CREATOR;
+    field public static final int FLAG_IS_PREFIX = 1; // 0x1
   }
 
   public static final class UserDataRemovalRequest.Builder {
     ctor public UserDataRemovalRequest.Builder();
-    method public android.view.contentcapture.UserDataRemovalRequest.Builder addLocusId(@NonNull android.content.LocusId, boolean);
+    method @NonNull public android.view.contentcapture.UserDataRemovalRequest.Builder addLocusId(@NonNull android.content.LocusId, int);
     method @NonNull public android.view.contentcapture.UserDataRemovalRequest build();
     method @NonNull public android.view.contentcapture.UserDataRemovalRequest.Builder forEverything();
   }
 
   public final class UserDataRemovalRequest.LocusIdRequest {
+    method @NonNull public int getFlags();
     method @NonNull public android.content.LocusId getLocusId();
-    method @NonNull public boolean isRecursive();
   }
 
 }
@@ -53148,7 +53107,7 @@
     method public int getPosition();
     method public CharSequence getText();
     method public void writeToParcel(android.os.Parcel, int);
-    field public static final android.os.Parcelable.Creator<android.view.inputmethod.CompletionInfo> CREATOR;
+    field @NonNull public static final android.os.Parcelable.Creator<android.view.inputmethod.CompletionInfo> CREATOR;
   }
 
   public final class CorrectionInfo implements android.os.Parcelable {
@@ -53158,7 +53117,7 @@
     method public int getOffset();
     method public CharSequence getOldText();
     method public void writeToParcel(android.os.Parcel, int);
-    field public static final android.os.Parcelable.Creator<android.view.inputmethod.CorrectionInfo> CREATOR;
+    field @NonNull public static final android.os.Parcelable.Creator<android.view.inputmethod.CorrectionInfo> CREATOR;
   }
 
   public final class CursorAnchorInfo implements android.os.Parcelable {
@@ -53177,7 +53136,7 @@
     method public int getSelectionEnd();
     method public int getSelectionStart();
     method public void writeToParcel(android.os.Parcel, int);
-    field public static final android.os.Parcelable.Creator<android.view.inputmethod.CursorAnchorInfo> CREATOR;
+    field @NonNull public static final android.os.Parcelable.Creator<android.view.inputmethod.CursorAnchorInfo> CREATOR;
     field public static final int FLAG_HAS_INVISIBLE_REGION = 2; // 0x2
     field public static final int FLAG_HAS_VISIBLE_REGION = 1; // 0x1
     field public static final int FLAG_IS_RTL = 4; // 0x4
@@ -53200,7 +53159,7 @@
     method public void dump(android.util.Printer, String);
     method public final void makeCompatible(int);
     method public void writeToParcel(android.os.Parcel, int);
-    field public static final android.os.Parcelable.Creator<android.view.inputmethod.EditorInfo> CREATOR;
+    field @NonNull public static final android.os.Parcelable.Creator<android.view.inputmethod.EditorInfo> CREATOR;
     field public static final int IME_ACTION_DONE = 6; // 0x6
     field public static final int IME_ACTION_GO = 2; // 0x2
     field public static final int IME_ACTION_NEXT = 5; // 0x5
@@ -53241,7 +53200,7 @@
     ctor public ExtractedText();
     method public int describeContents();
     method public void writeToParcel(android.os.Parcel, int);
-    field public static final android.os.Parcelable.Creator<android.view.inputmethod.ExtractedText> CREATOR;
+    field @NonNull public static final android.os.Parcelable.Creator<android.view.inputmethod.ExtractedText> CREATOR;
     field public static final int FLAG_SELECTING = 2; // 0x2
     field public static final int FLAG_SINGLE_LINE = 1; // 0x1
     field public int flags;
@@ -53258,7 +53217,7 @@
     ctor public ExtractedTextRequest();
     method public int describeContents();
     method public void writeToParcel(android.os.Parcel, int);
-    field public static final android.os.Parcelable.Creator<android.view.inputmethod.ExtractedTextRequest> CREATOR;
+    field @NonNull public static final android.os.Parcelable.Creator<android.view.inputmethod.ExtractedTextRequest> CREATOR;
     field public int flags;
     field public int hintMaxChars;
     field public int hintMaxLines;
@@ -53274,7 +53233,7 @@
     method public int getPid();
     method public int getUid();
     method public void writeToParcel(android.os.Parcel, int);
-    field public static final android.os.Parcelable.Creator<android.view.inputmethod.InputBinding> CREATOR;
+    field @NonNull public static final android.os.Parcelable.Creator<android.view.inputmethod.InputBinding> CREATOR;
   }
 
   public interface InputConnection {
@@ -53352,7 +53311,7 @@
     method public void releasePermission();
     method public void requestPermission();
     method public void writeToParcel(android.os.Parcel, int);
-    field public static final android.os.Parcelable.Creator<android.view.inputmethod.InputContentInfo> CREATOR;
+    field @NonNull public static final android.os.Parcelable.Creator<android.view.inputmethod.InputContentInfo> CREATOR;
   }
 
   public interface InputMethod {
@@ -53394,7 +53353,7 @@
     method public android.graphics.drawable.Drawable loadIcon(android.content.pm.PackageManager);
     method public CharSequence loadLabel(android.content.pm.PackageManager);
     method public void writeToParcel(android.os.Parcel, int);
-    field public static final android.os.Parcelable.Creator<android.view.inputmethod.InputMethodInfo> CREATOR;
+    field @NonNull public static final android.os.Parcelable.Creator<android.view.inputmethod.InputMethodInfo> CREATOR;
   }
 
   public final class InputMethodManager {
@@ -53483,7 +53442,7 @@
     method public boolean isAuxiliary();
     method public boolean overridesImplicitlyEnabledSubtype();
     method public void writeToParcel(android.os.Parcel, int);
-    field public static final android.os.Parcelable.Creator<android.view.inputmethod.InputMethodSubtype> CREATOR;
+    field @NonNull public static final android.os.Parcelable.Creator<android.view.inputmethod.InputMethodSubtype> CREATOR;
   }
 
   public static class InputMethodSubtype.InputMethodSubtypeBuilder {
@@ -53505,11 +53464,6 @@
 
 package android.view.inspector {
 
-  public class GeneratedInspectionCompanionProvider implements android.view.inspector.InspectionCompanionProvider {
-    ctor public GeneratedInspectionCompanionProvider();
-    method @Nullable public <T> android.view.inspector.InspectionCompanion<T> provide(@NonNull Class<T>);
-  }
-
   public interface InspectionCompanion<T> {
     method @Nullable public default String getNodeName();
     method public void mapProperties(@NonNull android.view.inspector.PropertyMapper);
@@ -53558,6 +53512,7 @@
     method public int mapIntFlag(@NonNull String, @AttrRes int, @NonNull android.view.inspector.IntFlagMapping);
     method public int mapLong(@NonNull String, @AttrRes int);
     method public int mapObject(@NonNull String, @AttrRes int);
+    method public int mapResourceId(@NonNull String, @AttrRes int);
     method public int mapShort(@NonNull String, @AttrRes int);
   }
 
@@ -53580,6 +53535,7 @@
     method public void readIntFlag(int, int);
     method public void readLong(int, long);
     method public void readObject(int, @Nullable Object);
+    method public void readResourceId(int, @AnyRes int);
     method public void readShort(int, short);
   }
 
@@ -53588,6 +53544,11 @@
     ctor public PropertyReader.PropertyTypeMismatchException(int, @NonNull String, @NonNull String);
   }
 
+  public class StaticInspectionCompanionProvider implements android.view.inspector.InspectionCompanionProvider {
+    ctor public StaticInspectionCompanionProvider();
+    method @Nullable public <T> android.view.inspector.InspectionCompanion<T> provide(@NonNull Class<T>);
+  }
+
   public final class WindowInspector {
     method @NonNull public static java.util.List<android.view.View> getGlobalWindowViews();
   }
@@ -53604,7 +53565,7 @@
     method @Nullable public CharSequence getTextReply();
     method @NonNull public String getType();
     method public void writeToParcel(android.os.Parcel, int);
-    field public static final android.os.Parcelable.Creator<android.view.textclassifier.ConversationAction> CREATOR;
+    field @NonNull public static final android.os.Parcelable.Creator<android.view.textclassifier.ConversationAction> CREATOR;
     field public static final String TYPE_CALL_PHONE = "call_phone";
     field public static final String TYPE_CREATE_REMINDER = "create_reminder";
     field public static final String TYPE_OPEN_URL = "open_url";
@@ -53632,7 +53593,7 @@
     method @NonNull public java.util.List<android.view.textclassifier.ConversationAction> getConversationActions();
     method @Nullable public String getId();
     method public void writeToParcel(android.os.Parcel, int);
-    field public static final android.os.Parcelable.Creator<android.view.textclassifier.ConversationActions> CREATOR;
+    field @NonNull public static final android.os.Parcelable.Creator<android.view.textclassifier.ConversationActions> CREATOR;
   }
 
   public static final class ConversationActions.Message implements android.os.Parcelable {
@@ -53642,9 +53603,9 @@
     method @Nullable public java.time.ZonedDateTime getReferenceTime();
     method @Nullable public CharSequence getText();
     method public void writeToParcel(android.os.Parcel, int);
-    field public static final android.os.Parcelable.Creator<android.view.textclassifier.ConversationActions.Message> CREATOR;
-    field public static final android.app.Person PERSON_USER_OTHERS;
-    field public static final android.app.Person PERSON_USER_SELF;
+    field @NonNull public static final android.os.Parcelable.Creator<android.view.textclassifier.ConversationActions.Message> CREATOR;
+    field @NonNull public static final android.app.Person PERSON_USER_OTHERS;
+    field @NonNull public static final android.app.Person PERSON_USER_SELF;
   }
 
   public static final class ConversationActions.Message.Builder {
@@ -53659,12 +53620,11 @@
     method public int describeContents();
     method @Nullable public String getCallingPackageName();
     method @NonNull public java.util.List<android.view.textclassifier.ConversationActions.Message> getConversation();
-    method @Nullable public String getConversationId();
     method @Nullable public java.util.List<java.lang.String> getHints();
     method @IntRange(from=0xffffffff) public int getMaxSuggestions();
     method @NonNull public android.view.textclassifier.TextClassifier.EntityConfig getTypeConfig();
     method public void writeToParcel(android.os.Parcel, int);
-    field public static final android.os.Parcelable.Creator<android.view.textclassifier.ConversationActions.Request> CREATOR;
+    field @NonNull public static final android.os.Parcelable.Creator<android.view.textclassifier.ConversationActions.Request> CREATOR;
     field public static final String HINT_FOR_IN_APP = "in_app";
     field public static final String HINT_FOR_NOTIFICATION = "notification";
   }
@@ -53672,8 +53632,7 @@
   public static final class ConversationActions.Request.Builder {
     ctor public ConversationActions.Request.Builder(@NonNull java.util.List<android.view.textclassifier.ConversationActions.Message>);
     method @NonNull public android.view.textclassifier.ConversationActions.Request build();
-    method @NonNull public android.view.textclassifier.ConversationActions.Request.Builder setConversationId(@Nullable String);
-    method public android.view.textclassifier.ConversationActions.Request.Builder setHints(@Nullable java.util.List<java.lang.String>);
+    method @NonNull public android.view.textclassifier.ConversationActions.Request.Builder setHints(@Nullable java.util.List<java.lang.String>);
     method @NonNull public android.view.textclassifier.ConversationActions.Request.Builder setMaxSuggestions(@IntRange(from=0xffffffff) int);
     method @NonNull public android.view.textclassifier.ConversationActions.Request.Builder setTypeConfig(@Nullable android.view.textclassifier.TextClassifier.EntityConfig);
   }
@@ -53715,7 +53674,7 @@
     field public static final int ACTION_SELECT_ALL = 200; // 0xc8
     field public static final int ACTION_SHARE = 104; // 0x68
     field public static final int ACTION_SMART_SHARE = 105; // 0x69
-    field public static final android.os.Parcelable.Creator<android.view.textclassifier.SelectionEvent> CREATOR;
+    field @NonNull public static final android.os.Parcelable.Creator<android.view.textclassifier.SelectionEvent> CREATOR;
     field public static final int EVENT_AUTO_SELECTION = 5; // 0x5
     field public static final int EVENT_SELECTION_MODIFIED = 2; // 0x2
     field public static final int EVENT_SELECTION_STARTED = 1; // 0x1
@@ -53740,7 +53699,7 @@
     method @Deprecated @Nullable public android.view.View.OnClickListener getOnClickListener();
     method @Nullable public String getText();
     method public void writeToParcel(android.os.Parcel, int);
-    field public static final android.os.Parcelable.Creator<android.view.textclassifier.TextClassification> CREATOR;
+    field @NonNull public static final android.os.Parcelable.Creator<android.view.textclassifier.TextClassification> CREATOR;
   }
 
   public static final class TextClassification.Builder {
@@ -53767,7 +53726,7 @@
     method @IntRange(from=0) public int getStartIndex();
     method @NonNull public CharSequence getText();
     method public void writeToParcel(android.os.Parcel, int);
-    field public static final android.os.Parcelable.Creator<android.view.textclassifier.TextClassification.Request> CREATOR;
+    field @NonNull public static final android.os.Parcelable.Creator<android.view.textclassifier.TextClassification.Request> CREATOR;
   }
 
   public static final class TextClassification.Request.Builder {
@@ -53784,7 +53743,7 @@
     method @NonNull public String getWidgetType();
     method @Nullable public String getWidgetVersion();
     method public void writeToParcel(android.os.Parcel, int);
-    field public static final android.os.Parcelable.Creator<android.view.textclassifier.TextClassificationContext> CREATOR;
+    field @NonNull public static final android.os.Parcelable.Creator<android.view.textclassifier.TextClassificationContext> CREATOR;
   }
 
   public static final class TextClassificationContext.Builder {
@@ -53807,7 +53766,7 @@
   public final class TextClassificationSessionId 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.view.textclassifier.TextClassificationSessionId> CREATOR;
+    field @NonNull public static final android.os.Parcelable.Creator<android.view.textclassifier.TextClassificationSessionId> CREATOR;
   }
 
   public interface TextClassifier {
@@ -53820,7 +53779,7 @@
     method public default boolean isDestroyed();
     method public default void onSelectionEvent(@NonNull android.view.textclassifier.SelectionEvent);
     method public default void onTextClassifierEvent(@NonNull android.view.textclassifier.TextClassifierEvent);
-    method @WorkerThread public default android.view.textclassifier.ConversationActions suggestConversationActions(@NonNull android.view.textclassifier.ConversationActions.Request);
+    method @WorkerThread @NonNull public default android.view.textclassifier.ConversationActions suggestConversationActions(@NonNull android.view.textclassifier.ConversationActions.Request);
     method @WorkerThread @NonNull public default android.view.textclassifier.TextSelection suggestSelection(@NonNull android.view.textclassifier.TextSelection.Request);
     method @WorkerThread @NonNull public default android.view.textclassifier.TextSelection suggestSelection(@NonNull CharSequence, @IntRange(from=0) int, @IntRange(from=0) int, @Nullable android.os.LocaleList);
     field public static final String EXTRA_FROM_TEXT_CLASSIFIER = "android.view.textclassifier.extra.FROM_TEXT_CLASSIFIER";
@@ -53857,7 +53816,7 @@
     method public java.util.Collection<java.lang.String> resolveEntityListModifications(@NonNull java.util.Collection<java.lang.String>);
     method public boolean shouldIncludeTypesFromTextClassifier();
     method public void writeToParcel(android.os.Parcel, int);
-    field public static final android.os.Parcelable.Creator<android.view.textclassifier.TextClassifier.EntityConfig> CREATOR;
+    field @NonNull public static final android.os.Parcelable.Creator<android.view.textclassifier.TextClassifier.EntityConfig> CREATOR;
   }
 
   public static final class TextClassifier.EntityConfig.Builder {
@@ -53865,7 +53824,7 @@
     method @NonNull public android.view.textclassifier.TextClassifier.EntityConfig build();
     method @NonNull public android.view.textclassifier.TextClassifier.EntityConfig.Builder includeTypesFromTextClassifier(boolean);
     method @NonNull public android.view.textclassifier.TextClassifier.EntityConfig.Builder setExcludedTypes(@Nullable java.util.Collection<java.lang.String>);
-    method public android.view.textclassifier.TextClassifier.EntityConfig.Builder setHints(java.util.Collection<java.lang.String>);
+    method @NonNull public android.view.textclassifier.TextClassifier.EntityConfig.Builder setHints(@Nullable java.util.Collection<java.lang.String>);
     method @NonNull public android.view.textclassifier.TextClassifier.EntityConfig.Builder setIncludedTypes(@Nullable java.util.Collection<java.lang.String>);
   }
 
@@ -53892,7 +53851,7 @@
     field public static final int CATEGORY_LINKIFY = 2; // 0x2
     field public static final int CATEGORY_SELECTION = 1; // 0x1
     field public static final int CATEGORY_UNDEFINED = 0; // 0x0
-    field public static final android.os.Parcelable.Creator<android.view.textclassifier.TextClassifierEvent> CREATOR;
+    field @NonNull public static final android.os.Parcelable.Creator<android.view.textclassifier.TextClassifierEvent> CREATOR;
     field public static final int TYPE_ACTIONS_GENERATED = 20; // 0x14
     field public static final int TYPE_ACTIONS_SHOWN = 6; // 0x6
     field public static final int TYPE_AUTO_SELECTION = 5; // 0x5
@@ -53942,7 +53901,7 @@
     method @NonNull public android.icu.util.ULocale getLocale(int);
     method @IntRange(from=0) public int getLocaleHypothesisCount();
     method public void writeToParcel(android.os.Parcel, int);
-    field public static final android.os.Parcelable.Creator<android.view.textclassifier.TextLanguage> CREATOR;
+    field @NonNull public static final android.os.Parcelable.Creator<android.view.textclassifier.TextLanguage> CREATOR;
   }
 
   public static final class TextLanguage.Builder {
@@ -53959,7 +53918,7 @@
     method @NonNull public android.os.Bundle getExtras();
     method @NonNull public CharSequence getText();
     method public void writeToParcel(android.os.Parcel, int);
-    field public static final android.os.Parcelable.Creator<android.view.textclassifier.TextLanguage.Request> CREATOR;
+    field @NonNull public static final android.os.Parcelable.Creator<android.view.textclassifier.TextLanguage.Request> CREATOR;
   }
 
   public static final class TextLanguage.Request.Builder {
@@ -53976,7 +53935,7 @@
     method public void writeToParcel(android.os.Parcel, int);
     field public static final int APPLY_STRATEGY_IGNORE = 0; // 0x0
     field public static final int APPLY_STRATEGY_REPLACE = 1; // 0x1
-    field public static final android.os.Parcelable.Creator<android.view.textclassifier.TextLinks> CREATOR;
+    field @NonNull public static final android.os.Parcelable.Creator<android.view.textclassifier.TextLinks> CREATOR;
     field public static final int STATUS_DIFFERENT_TEXT = 3; // 0x3
     field public static final int STATUS_LINKS_APPLIED = 0; // 0x0
     field public static final int STATUS_NO_LINKS_APPLIED = 2; // 0x2
@@ -53990,7 +53949,7 @@
     method @NonNull public android.view.textclassifier.TextLinks.Builder addLink(int, int, @NonNull java.util.Map<java.lang.String,java.lang.Float>, @NonNull android.os.Bundle);
     method @NonNull public android.view.textclassifier.TextLinks build();
     method @NonNull public android.view.textclassifier.TextLinks.Builder clearTextLinks();
-    method public android.view.textclassifier.TextLinks.Builder setExtras(@Nullable android.os.Bundle);
+    method @NonNull public android.view.textclassifier.TextLinks.Builder setExtras(@Nullable android.os.Bundle);
   }
 
   public static final class TextLinks.Request implements android.os.Parcelable {
@@ -54001,7 +53960,7 @@
     method @NonNull public android.os.Bundle getExtras();
     method @NonNull public CharSequence getText();
     method public void writeToParcel(android.os.Parcel, int);
-    field public static final android.os.Parcelable.Creator<android.view.textclassifier.TextLinks.Request> CREATOR;
+    field @NonNull public static final android.os.Parcelable.Creator<android.view.textclassifier.TextLinks.Request> CREATOR;
   }
 
   public static final class TextLinks.Request.Builder {
@@ -54021,7 +53980,7 @@
     method public android.os.Bundle getExtras();
     method public int getStart();
     method public void writeToParcel(android.os.Parcel, int);
-    field public static final android.os.Parcelable.Creator<android.view.textclassifier.TextLinks.TextLink> CREATOR;
+    field @NonNull public static final android.os.Parcelable.Creator<android.view.textclassifier.TextLinks.TextLink> CREATOR;
   }
 
   public static class TextLinks.TextLinkSpan extends android.text.style.ClickableSpan {
@@ -54040,14 +53999,14 @@
     method public int getSelectionEndIndex();
     method public int getSelectionStartIndex();
     method public void writeToParcel(android.os.Parcel, int);
-    field public static final android.os.Parcelable.Creator<android.view.textclassifier.TextSelection> CREATOR;
+    field @NonNull public static final android.os.Parcelable.Creator<android.view.textclassifier.TextSelection> CREATOR;
   }
 
   public static final class TextSelection.Builder {
     ctor public TextSelection.Builder(@IntRange(from=0) int, @IntRange(from=0) int);
     method @NonNull public android.view.textclassifier.TextSelection build();
     method @NonNull public android.view.textclassifier.TextSelection.Builder setEntityType(@NonNull String, @FloatRange(from=0.0, to=1.0) float);
-    method public android.view.textclassifier.TextSelection.Builder setExtras(@Nullable android.os.Bundle);
+    method @NonNull public android.view.textclassifier.TextSelection.Builder setExtras(@Nullable android.os.Bundle);
     method @NonNull public android.view.textclassifier.TextSelection.Builder setId(@Nullable String);
   }
 
@@ -54060,14 +54019,14 @@
     method @IntRange(from=0) public int getStartIndex();
     method @NonNull public CharSequence getText();
     method public void writeToParcel(android.os.Parcel, int);
-    field public static final android.os.Parcelable.Creator<android.view.textclassifier.TextSelection.Request> CREATOR;
+    field @NonNull public static final android.os.Parcelable.Creator<android.view.textclassifier.TextSelection.Request> CREATOR;
   }
 
   public static final class TextSelection.Request.Builder {
     ctor public TextSelection.Request.Builder(@NonNull CharSequence, @IntRange(from=0) int, @IntRange(from=0) int);
     method @NonNull public android.view.textclassifier.TextSelection.Request build();
     method @NonNull public android.view.textclassifier.TextSelection.Request.Builder setDefaultLocales(@Nullable android.os.LocaleList);
-    method public android.view.textclassifier.TextSelection.Request.Builder setExtras(@Nullable android.os.Bundle);
+    method @NonNull public android.view.textclassifier.TextSelection.Request.Builder setExtras(@Nullable android.os.Bundle);
   }
 
 }
@@ -54083,7 +54042,7 @@
     method public int getSuggestionsCount();
     method public android.view.textservice.SuggestionsInfo getSuggestionsInfoAt(int);
     method public void writeToParcel(android.os.Parcel, int);
-    field public static final android.os.Parcelable.Creator<android.view.textservice.SentenceSuggestionsInfo> CREATOR;
+    field @NonNull public static final android.os.Parcelable.Creator<android.view.textservice.SentenceSuggestionsInfo> CREATOR;
   }
 
   public final class SpellCheckerInfo implements android.os.Parcelable {
@@ -54098,7 +54057,7 @@
     method public android.graphics.drawable.Drawable loadIcon(android.content.pm.PackageManager);
     method public CharSequence loadLabel(android.content.pm.PackageManager);
     method public void writeToParcel(android.os.Parcel, int);
-    field public static final android.os.Parcelable.Creator<android.view.textservice.SpellCheckerInfo> CREATOR;
+    field @NonNull public static final android.os.Parcelable.Creator<android.view.textservice.SpellCheckerInfo> CREATOR;
   }
 
   public class SpellCheckerSession {
@@ -54128,7 +54087,7 @@
     method @Deprecated @NonNull public String getLocale();
     method public int getNameResId();
     method public void writeToParcel(android.os.Parcel, int);
-    field public static final android.os.Parcelable.Creator<android.view.textservice.SpellCheckerSubtype> CREATOR;
+    field @NonNull public static final android.os.Parcelable.Creator<android.view.textservice.SpellCheckerSubtype> CREATOR;
   }
 
   public final class SuggestionsInfo implements android.os.Parcelable {
@@ -54143,7 +54102,7 @@
     method public int getSuggestionsCount();
     method public void setCookieAndSequence(int, int);
     method public void writeToParcel(android.os.Parcel, int);
-    field public static final android.os.Parcelable.Creator<android.view.textservice.SuggestionsInfo> CREATOR;
+    field @NonNull public static final android.os.Parcelable.Creator<android.view.textservice.SuggestionsInfo> CREATOR;
     field public static final int RESULT_ATTR_HAS_RECOMMENDED_SUGGESTIONS = 4; // 0x4
     field public static final int RESULT_ATTR_IN_THE_DICTIONARY = 1; // 0x1
     field public static final int RESULT_ATTR_LOOKS_LIKE_TYPO = 2; // 0x2
@@ -54160,7 +54119,7 @@
     method public int getSequence();
     method public String getText();
     method public void writeToParcel(android.os.Parcel, int);
-    field public static final android.os.Parcelable.Creator<android.view.textservice.TextInfo> CREATOR;
+    field @NonNull public static final android.os.Parcelable.Creator<android.view.textservice.TextInfo> CREATOR;
   }
 
   public final class TextServicesManager {
@@ -54958,7 +54917,6 @@
     method public int getCheckedItemPosition();
     method public android.util.SparseBooleanArray getCheckedItemPositions();
     method public int getChoiceMode();
-    method public boolean getDrawSelectorOnTop();
     method public int getListPaddingBottom();
     method public int getListPaddingLeft();
     method public int getListPaddingRight();
@@ -54971,6 +54929,7 @@
     method protected void handleDataChanged();
     method public boolean hasTextFilter();
     method public void invalidateViews();
+    method public boolean isDrawSelectorOnTop();
     method public boolean isFastScrollAlwaysVisible();
     method @android.view.ViewDebug.ExportedProperty public boolean isFastScrollEnabled();
     method protected boolean isInFilterMode();
@@ -56238,7 +56197,7 @@
     field public static final int SOURCE_BOUND_MAX_VISIBLE = 1; // 0x1
   }
 
-  public static class Magnifier.Builder {
+  public static final class Magnifier.Builder {
     ctor public Magnifier.Builder(@NonNull android.view.View);
     method @NonNull public android.widget.Magnifier build();
     method @NonNull public android.widget.Magnifier.Builder setClippingEnabled(boolean);
@@ -56309,7 +56268,7 @@
     method public String[] getDisplayedValues();
     method public int getMaxValue();
     method public int getMinValue();
-    method public int getSelectionDividerHeight();
+    method @Px public int getSelectionDividerHeight();
     method @ColorInt public int getTextColor();
     method @FloatRange(from=0.0, fromInclusive=false) public float getTextSize();
     method public int getValue();
@@ -56697,7 +56656,7 @@
     method public void setLong(int, String, long);
     method public void setOnClickFillInIntent(int, android.content.Intent);
     method public void setOnClickPendingIntent(int, android.app.PendingIntent);
-    method public void setOnClickResponse(int, android.widget.RemoteViews.RemoteResponse);
+    method public void setOnClickResponse(int, @NonNull android.widget.RemoteViews.RemoteResponse);
     method public void setPendingIntentTemplate(int, android.app.PendingIntent);
     method public void setProgressBar(int, int, int, boolean);
     method public void setRelativeScrollPosition(int, int);
@@ -56717,7 +56676,7 @@
     method public void showNext(int);
     method public void showPrevious(int);
     method public void writeToParcel(android.os.Parcel, int);
-    field public static final android.os.Parcelable.Creator<android.widget.RemoteViews> CREATOR;
+    field @NonNull public static final android.os.Parcelable.Creator<android.widget.RemoteViews> CREATOR;
     field public static final String EXTRA_SHARED_ELEMENT_BOUNDS = "android.widget.extra.SHARED_ELEMENT_BOUNDS";
   }
 
@@ -56728,9 +56687,9 @@
 
   public static class RemoteViews.RemoteResponse {
     ctor public RemoteViews.RemoteResponse();
-    method public android.widget.RemoteViews.RemoteResponse addSharedElement(int, String);
-    method public static android.widget.RemoteViews.RemoteResponse fromFillInIntent(android.content.Intent);
-    method public static android.widget.RemoteViews.RemoteResponse fromPendingIntent(android.app.PendingIntent);
+    method @NonNull public android.widget.RemoteViews.RemoteResponse addSharedElement(int, @NonNull String);
+    method @NonNull public static android.widget.RemoteViews.RemoteResponse fromFillInIntent(@NonNull android.content.Intent);
+    method @NonNull public static android.widget.RemoteViews.RemoteResponse fromPendingIntent(@NonNull android.app.PendingIntent);
   }
 
   @java.lang.annotation.Target({java.lang.annotation.ElementType.TYPE}) @java.lang.annotation.Retention(java.lang.annotation.RetentionPolicy.RUNTIME) public static @interface RemoteViews.RemoteView {
@@ -56787,7 +56746,7 @@
     method public boolean isFillViewport();
     method public boolean isSmoothScrollingEnabled();
     method public boolean pageScroll(int);
-    method public void scrollToDescendant(android.view.View);
+    method public void scrollToDescendant(@NonNull android.view.View);
     method public void setBottomEdgeEffectColor(@ColorInt int);
     method public void setEdgeEffectColor(@ColorInt int);
     method public void setFillViewport(boolean);
@@ -57333,7 +57292,7 @@
     method @NonNull public android.view.textclassifier.TextClassifier getTextClassifier();
     method public final android.content.res.ColorStateList getTextColors();
     method @Nullable public android.graphics.drawable.Drawable getTextCursorDrawable();
-    method public android.text.TextDirectionHeuristic getTextDirectionHeuristic();
+    method @NonNull public android.text.TextDirectionHeuristic getTextDirectionHeuristic();
     method @NonNull public java.util.Locale getTextLocale();
     method @NonNull @Size(min=1) public android.os.LocaleList getTextLocales();
     method @NonNull public android.text.PrecomputedText.Params getTextMetricsParams();
@@ -57500,7 +57459,7 @@
   }
 
   public static class TextView.SavedState extends android.view.View.BaseSavedState {
-    field public static final android.os.Parcelable.Creator<android.widget.TextView.SavedState> CREATOR;
+    field @NonNull public static final android.os.Parcelable.Creator<android.widget.TextView.SavedState> CREATOR;
   }
 
   public interface ThemedSpinnerAdapter extends android.widget.SpinnerAdapter {
@@ -57559,7 +57518,7 @@
     ctor public ToggleButton(android.content.Context, android.util.AttributeSet, int);
     ctor public ToggleButton(android.content.Context, android.util.AttributeSet);
     ctor public ToggleButton(android.content.Context);
-    method public float getDisabledAlpha();
+    method @FloatRange(from=0.0, to=1.0) public float getDisabledAlpha();
     method public CharSequence getTextOff();
     method public CharSequence getTextOn();
     method public void setBackgroundDrawable(android.graphics.drawable.Drawable);
@@ -57720,11 +57679,11 @@
   @android.widget.RemoteViews.RemoteView public class ViewFlipper extends android.widget.ViewAnimator {
     ctor public ViewFlipper(android.content.Context);
     ctor public ViewFlipper(android.content.Context, android.util.AttributeSet);
-    method public int getFlipInterval();
+    method @IntRange(from=0) public int getFlipInterval();
     method public boolean isAutoStart();
     method public boolean isFlipping();
     method public void setAutoStart(boolean);
-    method public void setFlipInterval(int);
+    method public void setFlipInterval(@IntRange(from=0) int);
     method public void startFlipping();
     method public void stopFlipping();
   }
@@ -57775,16 +57734,16 @@
     method @Deprecated public void onZoom(boolean);
   }
 
-  public class ZoomControls extends android.widget.LinearLayout {
-    ctor public ZoomControls(android.content.Context);
-    ctor public ZoomControls(android.content.Context, android.util.AttributeSet);
-    method public void hide();
-    method public void setIsZoomInEnabled(boolean);
-    method public void setIsZoomOutEnabled(boolean);
-    method public void setOnZoomInClickListener(android.view.View.OnClickListener);
-    method public void setOnZoomOutClickListener(android.view.View.OnClickListener);
-    method public void setZoomSpeed(long);
-    method public void show();
+  @Deprecated public class ZoomControls extends android.widget.LinearLayout {
+    ctor @Deprecated public ZoomControls(android.content.Context);
+    ctor @Deprecated public ZoomControls(android.content.Context, android.util.AttributeSet);
+    method @Deprecated public void hide();
+    method @Deprecated public void setIsZoomInEnabled(boolean);
+    method @Deprecated public void setIsZoomOutEnabled(boolean);
+    method @Deprecated public void setOnZoomInClickListener(android.view.View.OnClickListener);
+    method @Deprecated public void setOnZoomOutClickListener(android.view.View.OnClickListener);
+    method @Deprecated public void setZoomSpeed(long);
+    method @Deprecated public void show();
   }
 
 }
@@ -58108,7 +58067,7 @@
   public final class DelegateLastClassLoader extends dalvik.system.PathClassLoader {
     ctor public DelegateLastClassLoader(String, ClassLoader);
     ctor public DelegateLastClassLoader(String, String, ClassLoader);
-    ctor public DelegateLastClassLoader(String, String, ClassLoader, boolean);
+    ctor public DelegateLastClassLoader(@NonNull String, @Nullable String, @Nullable ClassLoader, boolean);
   }
 
   public class DexClassLoader extends dalvik.system.BaseDexClassLoader {
diff --git a/api/removed.txt b/api/removed.txt
index c4ed871..93d06928 100644
--- a/api/removed.txt
+++ b/api/removed.txt
@@ -32,7 +32,7 @@
     method public int describeContents();
     method public void writeToParcel(android.os.Parcel, int);
     field public static final int CONTENTS_FILE_DESCRIPTOR = 1; // 0x1
-    field public static final android.os.Parcelable.Creator<android.app.PictureInPictureArgs> CREATOR;
+    field @NonNull public static final android.os.Parcelable.Creator<android.app.PictureInPictureArgs> CREATOR;
     field public static final int PARCELABLE_WRITE_RETURN_VALUE = 1; // 0x1
   }
 
@@ -282,12 +282,38 @@
 
 package android.location {
 
+  @Deprecated public final class GpsStatus {
+    method public int getMaxSatellites();
+    method public Iterable<android.location.GpsSatellite> getSatellites();
+    method public int getTimeToFirstFix();
+    field public static final int GPS_EVENT_FIRST_FIX = 3; // 0x3
+    field public static final int GPS_EVENT_SATELLITE_STATUS = 4; // 0x4
+    field public static final int GPS_EVENT_STARTED = 1; // 0x1
+    field public static final int GPS_EVENT_STOPPED = 2; // 0x2
+  }
+
+  @Deprecated public static interface GpsStatus.Listener {
+    method public void onGpsStatusChanged(int);
+  }
+
+  @Deprecated public static interface GpsStatus.NmeaListener {
+    method public void onNmeaReceived(long, String);
+  }
+
   public class Location implements android.os.Parcelable {
     method @Deprecated public void removeBearingAccuracy();
     method @Deprecated public void removeSpeedAccuracy();
     method @Deprecated public void removeVerticalAccuracy();
   }
 
+  public class LocationManager {
+    method @Deprecated @RequiresPermission(android.Manifest.permission.ACCESS_FINE_LOCATION) public boolean addGpsStatusListener(android.location.GpsStatus.Listener);
+    method @Deprecated @RequiresPermission(android.Manifest.permission.ACCESS_FINE_LOCATION) public boolean addNmeaListener(android.location.GpsStatus.NmeaListener);
+    method @Deprecated @Nullable @RequiresPermission(android.Manifest.permission.ACCESS_FINE_LOCATION) public android.location.GpsStatus getGpsStatus(@Nullable android.location.GpsStatus);
+    method @Deprecated public void removeGpsStatusListener(android.location.GpsStatus.Listener);
+    method @Deprecated public void removeNmeaListener(android.location.GpsStatus.NmeaListener);
+  }
+
 }
 
 package android.media {
@@ -309,11 +335,17 @@
 package android.net {
 
   public class ConnectivityManager {
+    method @Deprecated public void getLatestTetheringEntitlementValue(int, boolean, @NonNull android.net.ConnectivityManager.TetheringEntitlementValueListener, @Nullable android.os.Handler);
     method @Deprecated public boolean requestRouteToHost(int, int);
     method @Deprecated public int startUsingNetworkFeature(int, String);
     method @Deprecated public int stopUsingNetworkFeature(int, String);
   }
 
+  @Deprecated public abstract static class ConnectivityManager.TetheringEntitlementValueListener {
+    ctor public ConnectivityManager.TetheringEntitlementValueListener();
+    method public void onEntitlementResult(int);
+  }
+
   @Deprecated public class NetworkBadging {
     method @NonNull public static android.graphics.drawable.Drawable getWifiIcon(@IntRange(from=0, to=4) int, int, @Nullable android.content.res.Resources.Theme);
     field public static final int BADGING_4K = 30; // 0x1e
@@ -352,11 +384,11 @@
   }
 
   public static final class StrictMode.ThreadPolicy.Builder {
-    method public android.os.StrictMode.ThreadPolicy.Builder penaltyListener(@NonNull android.os.StrictMode.OnThreadViolationListener, @NonNull java.util.concurrent.Executor);
+    method @NonNull public android.os.StrictMode.ThreadPolicy.Builder penaltyListener(@NonNull android.os.StrictMode.OnThreadViolationListener, @NonNull java.util.concurrent.Executor);
   }
 
   public static final class StrictMode.VmPolicy.Builder {
-    method public android.os.StrictMode.VmPolicy.Builder penaltyListener(@NonNull android.os.StrictMode.OnVmViolationListener, @NonNull java.util.concurrent.Executor);
+    method @NonNull public android.os.StrictMode.VmPolicy.Builder penaltyListener(@NonNull android.os.StrictMode.OnVmViolationListener, @NonNull java.util.concurrent.Executor);
   }
 
   public final class SystemClock {
@@ -508,6 +540,8 @@
   }
 
   public final class MediaStore {
+    method @Deprecated @NonNull public static android.net.Uri createPending(@NonNull android.content.Context, @NonNull android.provider.MediaStore.PendingParams);
+    method @Deprecated @NonNull public static android.provider.MediaStore.PendingSession openPending(@NonNull android.content.Context, @NonNull android.net.Uri);
     method @Deprecated @NonNull public static android.net.Uri setIncludeTrashed(@NonNull android.net.Uri);
     method @Deprecated public static void trash(@NonNull android.content.Context, @NonNull android.net.Uri);
     method @Deprecated public static void trash(@NonNull android.content.Context, @NonNull android.net.Uri, long);
@@ -515,11 +549,27 @@
   }
 
   public static interface MediaStore.MediaColumns extends android.provider.BaseColumns {
-    field @Deprecated public static final String DATE_EXPIRES = "date_expires";
     field @Deprecated public static final String HASH = "_hash";
     field @Deprecated public static final String IS_TRASHED = "is_trashed";
   }
 
+  @Deprecated public static class MediaStore.PendingParams {
+    ctor public MediaStore.PendingParams(@NonNull android.net.Uri, @NonNull String, @NonNull String);
+    method public void setDownloadUri(@Nullable android.net.Uri);
+    method public void setPrimaryDirectory(@Nullable String);
+    method public void setRefererUri(@Nullable android.net.Uri);
+    method public void setSecondaryDirectory(@Nullable String);
+  }
+
+  @Deprecated public static class MediaStore.PendingSession implements java.lang.AutoCloseable {
+    method public void abandon();
+    method public void close();
+    method public void notifyProgress(@IntRange(from=0, to=100) int);
+    method @NonNull public android.os.ParcelFileDescriptor open() throws java.io.FileNotFoundException;
+    method @NonNull public java.io.OutputStream openOutputStream() throws java.io.FileNotFoundException;
+    method @NonNull public android.net.Uri publish();
+  }
+
   public static final class Settings.Global extends android.provider.Settings.NameValueTable {
     field @Deprecated public static final String CONTACT_METADATA_SYNC = "contact_metadata_sync";
   }
diff --git a/api/system-current.txt b/api/system-current.txt
index b5d9f3c..232144f 100644
--- a/api/system-current.txt
+++ b/api/system-current.txt
@@ -25,6 +25,7 @@
     field public static final String BIND_AUGMENTED_AUTOFILL_SERVICE = "android.permission.BIND_AUGMENTED_AUTOFILL_SERVICE";
     field @Deprecated public static final String BIND_CONNECTION_SERVICE = "android.permission.BIND_CONNECTION_SERVICE";
     field public static final String BIND_CONTENT_CAPTURE_SERVICE = "android.permission.BIND_CONTENT_CAPTURE_SERVICE";
+    field public static final String BIND_CONTENT_SUGGESTIONS_SERVICE = "android.permission.BIND_CONTENT_SUGGESTIONS_SERVICE";
     field public static final String BIND_DIRECTORY_SEARCH = "android.permission.BIND_DIRECTORY_SEARCH";
     field public static final String BIND_EUICC_SERVICE = "android.permission.BIND_EUICC_SERVICE";
     field public static final String BIND_IMS_SERVICE = "android.permission.BIND_IMS_SERVICE";
@@ -121,6 +122,7 @@
     field public static final String NOTIFY_TV_INPUTS = "android.permission.NOTIFY_TV_INPUTS";
     field public static final String OBSERVE_APP_USAGE = "android.permission.OBSERVE_APP_USAGE";
     field public static final String OBSERVE_ROLE_HOLDERS = "android.permission.OBSERVE_ROLE_HOLDERS";
+    field public static final String OPEN_ACCESSIBILITY_DETAILS_SETTINGS = "android.permission.OPEN_ACCESSIBILITY_DETAILS_SETTINGS";
     field public static final String OVERRIDE_WIFI_CONFIG = "android.permission.OVERRIDE_WIFI_CONFIG";
     field public static final String PACKAGE_VERIFICATION_AGENT = "android.permission.PACKAGE_VERIFICATION_AGENT";
     field public static final String PACKET_KEEPALIVE_OFFLOAD = "android.permission.PACKET_KEEPALIVE_OFFLOAD";
@@ -159,9 +161,11 @@
     field public static final String REMOTE_DISPLAY_PROVIDER = "android.permission.REMOTE_DISPLAY_PROVIDER";
     field public static final String REMOVE_DRM_CERTIFICATES = "android.permission.REMOVE_DRM_CERTIFICATES";
     field public static final String REMOVE_TASKS = "android.permission.REMOVE_TASKS";
+    field public static final String REQUEST_NOTIFICATION_ASSISTANT_SERVICE = "android.permission.REQUEST_NOTIFICATION_ASSISTANT_SERVICE";
     field public static final String RESET_PASSWORD = "android.permission.RESET_PASSWORD";
     field public static final String RESTRICTED_VR_ACCESS = "android.permission.RESTRICTED_VR_ACCESS";
     field public static final String RETRIEVE_WINDOW_CONTENT = "android.permission.RETRIEVE_WINDOW_CONTENT";
+    field public static final String REVIEW_ACCESSIBILITY_SERVICES = "android.permission.REVIEW_ACCESSIBILITY_SERVICES";
     field public static final String REVOKE_RUNTIME_PERMISSIONS = "android.permission.REVOKE_RUNTIME_PERMISSIONS";
     field public static final String SCORE_NETWORKS = "android.permission.SCORE_NETWORKS";
     field public static final String SEND_DEVICE_CUSTOMIZATION_READY = "android.permission.SEND_DEVICE_CUSTOMIZATION_READY";
@@ -180,6 +184,7 @@
     field public static final String SHUTDOWN = "android.permission.SHUTDOWN";
     field public static final String STOP_APP_SWITCHES = "android.permission.STOP_APP_SWITCHES";
     field public static final String SUBSTITUTE_NOTIFICATION_APP_NAME = "android.permission.SUBSTITUTE_NOTIFICATION_APP_NAME";
+    field public static final String SUBSTITUTE_SHARE_TARGET_APP_NAME_AND_ICON = "android.permission.SUBSTITUTE_SHARE_TARGET_APP_NAME_AND_ICON";
     field public static final String SUSPEND_APPS = "android.permission.SUSPEND_APPS";
     field public static final String TETHER_PRIVILEGED = "android.permission.TETHER_PRIVILEGED";
     field public static final String TV_INPUT_HARDWARE = "android.permission.TV_INPUT_HARDWARE";
@@ -207,7 +212,6 @@
 
   public static final class R.attr {
     field public static final int allowClearUserDataOnFailedRestore = 16844198; // 0x10105a6
-    field public static final int inheritShowWhenLocked = 16844194; // 0x10105a2
     field public static final int isVrOnly = 16844152; // 0x1010578
     field public static final int requiredSystemPropertyName = 16844133; // 0x1010565
     field public static final int requiredSystemPropertyValue = 16844134; // 0x1010566
@@ -277,7 +281,6 @@
     method public boolean convertToTranslucent(android.app.Activity.TranslucentConversionListener, android.app.ActivityOptions);
     method @Deprecated public boolean isBackgroundVisibleBehind();
     method @Deprecated public void onBackgroundVisibleBehindChanged(boolean);
-    method public void setInheritShowWhenLocked(boolean);
   }
 
   public static interface Activity.TranslucentConversionListener {
@@ -313,7 +316,6 @@
     method @Deprecated @RequiresPermission(android.Manifest.permission.GET_APP_OPS_STATS) public java.util.List<android.app.AppOpsManager.PackageOps> getOpsForPackage(int, String, int[]);
     method @NonNull @RequiresPermission(android.Manifest.permission.GET_APP_OPS_STATS) public java.util.List<android.app.AppOpsManager.PackageOps> getOpsForPackage(int, @NonNull String, @Nullable java.lang.String...);
     method @NonNull @RequiresPermission(android.Manifest.permission.GET_APP_OPS_STATS) public java.util.List<android.app.AppOpsManager.PackageOps> getPackagesForOps(@Nullable String[]);
-    method public int noteProxyOpNoThrow(@NonNull String, @Nullable String, int);
     method public static int opToDefaultMode(@NonNull String);
     method @Nullable public static String opToPermission(@NonNull String);
     method @RequiresPermission("android.permission.MANAGE_APP_OPS_MODES") public void setMode(String, int, String, int);
@@ -362,29 +364,36 @@
     field public static final String OPSTR_WRITE_ICC_SMS = "android:write_icc_sms";
     field public static final String OPSTR_WRITE_SMS = "android:write_sms";
     field public static final String OPSTR_WRITE_WALLPAPER = "android:write_wallpaper";
-    field public static final int UID_STATE_BACKGROUND = 5; // 0x5
-    field public static final int UID_STATE_CACHED = 6; // 0x6
-    field public static final int UID_STATE_FOREGROUND = 4; // 0x4
-    field public static final int UID_STATE_FOREGROUND_SERVICE = 3; // 0x3
-    field public static final int UID_STATE_FOREGROUND_SERVICE_LOCATION = 2; // 0x2
-    field public static final int UID_STATE_PERSISTENT = 0; // 0x0
-    field public static final int UID_STATE_TOP = 1; // 0x1
+    field public static final int OP_FLAGS_ALL = 31; // 0x1f
+    field public static final int OP_FLAGS_ALL_TRUSTED = 13; // 0xd
+    field public static final int OP_FLAG_SELF = 1; // 0x1
+    field public static final int OP_FLAG_TRUSTED_PROXIED = 8; // 0x8
+    field public static final int OP_FLAG_TRUSTED_PROXY = 2; // 0x2
+    field public static final int OP_FLAG_UNTRUSTED_PROXIED = 16; // 0x10
+    field public static final int OP_FLAG_UNTRUSTED_PROXY = 4; // 0x4
+    field public static final int UID_STATE_BACKGROUND = 600; // 0x258
+    field public static final int UID_STATE_CACHED = 700; // 0x2bc
+    field public static final int UID_STATE_FOREGROUND = 500; // 0x1f4
+    field public static final int UID_STATE_FOREGROUND_SERVICE = 400; // 0x190
+    field public static final int UID_STATE_FOREGROUND_SERVICE_LOCATION = 300; // 0x12c
+    field public static final int UID_STATE_PERSISTENT = 100; // 0x64
+    field public static final int UID_STATE_TOP = 200; // 0xc8
   }
 
   public static final class AppOpsManager.HistoricalOp implements android.os.Parcelable {
     method public int describeContents();
-    method public long getAccessCount(int);
-    method public long getAccessDuration(int);
-    method public long getBackgroundAccessCount();
-    method public long getBackgroundAccessDuration();
-    method public long getBackgroundRejectCount();
-    method public long getForegroundAccessCount();
-    method public long getForegroundAccessDuration();
-    method public long getForegroundRejectCount();
+    method public long getAccessCount(int, int, int);
+    method public long getAccessDuration(int, int, int);
+    method public long getBackgroundAccessCount(int);
+    method public long getBackgroundAccessDuration(int);
+    method public long getBackgroundRejectCount(int);
+    method public long getForegroundAccessCount(int);
+    method public long getForegroundAccessDuration(int);
+    method public long getForegroundRejectCount(int);
     method @NonNull public String getOpName();
-    method public long getRejectCount(int);
+    method public long getRejectCount(int, int, int);
     method public void writeToParcel(android.os.Parcel, int);
-    field public static final android.os.Parcelable.Creator<android.app.AppOpsManager.HistoricalOp> CREATOR;
+    field @NonNull public static final android.os.Parcelable.Creator<android.app.AppOpsManager.HistoricalOp> CREATOR;
   }
 
   public static final class AppOpsManager.HistoricalOps implements android.os.Parcelable {
@@ -395,7 +404,7 @@
     method @Nullable public android.app.AppOpsManager.HistoricalUidOps getUidOps(int);
     method @NonNull public android.app.AppOpsManager.HistoricalUidOps getUidOpsAt(int);
     method public void writeToParcel(android.os.Parcel, int);
-    field public static final android.os.Parcelable.Creator<android.app.AppOpsManager.HistoricalOps> CREATOR;
+    field @NonNull public static final android.os.Parcelable.Creator<android.app.AppOpsManager.HistoricalOps> CREATOR;
   }
 
   public static final class AppOpsManager.HistoricalOpsRequest {
@@ -404,6 +413,7 @@
   public static final class AppOpsManager.HistoricalOpsRequest.Builder {
     ctor public AppOpsManager.HistoricalOpsRequest.Builder(long, long);
     method @NonNull public android.app.AppOpsManager.HistoricalOpsRequest build();
+    method @NonNull public android.app.AppOpsManager.HistoricalOpsRequest.Builder setFlags(int);
     method @NonNull public android.app.AppOpsManager.HistoricalOpsRequest.Builder setOpNames(@Nullable java.util.List<java.lang.String>);
     method @NonNull public android.app.AppOpsManager.HistoricalOpsRequest.Builder setPackageName(@Nullable String);
     method @NonNull public android.app.AppOpsManager.HistoricalOpsRequest.Builder setUid(int);
@@ -416,7 +426,7 @@
     method public int getOpCount();
     method @NonNull public String getPackageName();
     method public void writeToParcel(@NonNull android.os.Parcel, int);
-    field public static final android.os.Parcelable.Creator<android.app.AppOpsManager.HistoricalPackageOps> CREATOR;
+    field @NonNull public static final android.os.Parcelable.Creator<android.app.AppOpsManager.HistoricalPackageOps> CREATOR;
   }
 
   public static final class AppOpsManager.HistoricalUidOps implements android.os.Parcelable {
@@ -426,39 +436,46 @@
     method @NonNull public android.app.AppOpsManager.HistoricalPackageOps getPackageOpsAt(int);
     method public int getUid();
     method public void writeToParcel(android.os.Parcel, int);
-    field public static final android.os.Parcelable.Creator<android.app.AppOpsManager.HistoricalUidOps> CREATOR;
+    field @NonNull public static final android.os.Parcelable.Creator<android.app.AppOpsManager.HistoricalUidOps> CREATOR;
   }
 
   public static final class AppOpsManager.OpEntry implements android.os.Parcelable {
     method public int describeContents();
-    method public int getDuration();
-    method public long getLastAccessBackgroundTime();
-    method public long getLastAccessForegroundTime();
-    method public long getLastAccessTime();
-    method public long getLastRejectBackgroundTime();
-    method public long getLastRejectForegroundTime();
-    method public long getLastRejectTime();
+    method public long getDuration();
+    method public long getLastAccessBackgroundTime(int);
+    method public long getLastAccessForegroundTime(int);
+    method public long getLastAccessTime(int);
+    method public long getLastAccessTime(int, int, int);
+    method public long getLastBackgroundDuration(int);
+    method public long getLastDuration(int, int, int);
+    method public long getLastForegroundDuration(int);
+    method public long getLastRejectBackgroundTime(int);
+    method public long getLastRejectForegroundTime(int);
+    method public long getLastRejectTime(int);
+    method public long getLastRejectTime(int, int, int);
     method public int getMode();
-    method public String getOpStr();
-    method public String getProxyPackageName();
+    method @NonNull public String getOpStr();
+    method @Nullable public String getProxyPackageName();
+    method @Nullable public String getProxyPackageName(int, int);
     method public int getProxyUid();
+    method public int getProxyUid(int, int);
     method public boolean isRunning();
     method public void writeToParcel(android.os.Parcel, int);
-    field public static final android.os.Parcelable.Creator<android.app.AppOpsManager.OpEntry> CREATOR;
+    field @NonNull public static final android.os.Parcelable.Creator<android.app.AppOpsManager.OpEntry> CREATOR;
   }
 
   public static final class AppOpsManager.PackageOps implements android.os.Parcelable {
     method public int describeContents();
     method public java.util.List<android.app.AppOpsManager.OpEntry> getOps();
-    method public String getPackageName();
+    method @NonNull public String getPackageName();
     method public int getUid();
     method public void writeToParcel(android.os.Parcel, int);
-    field public static final android.os.Parcelable.Creator<android.app.AppOpsManager.PackageOps> CREATOR;
+    field @NonNull public static final android.os.Parcelable.Creator<android.app.AppOpsManager.PackageOps> CREATOR;
   }
 
   public class BroadcastOptions {
     method public static android.app.BroadcastOptions makeBasic();
-    method @RequiresPermission("android.permission.START_ACTIVITIES_FROM_BACKGROUND") public void setAllowBackgroundActivityStarts(boolean);
+    method @RequiresPermission("android.permission.START_ACTIVITIES_FROM_BACKGROUND") public void setBackgroundActivityStartsAllowed(boolean);
     method public void setDontSendToRestrictedApps(boolean);
     method @RequiresPermission(android.Manifest.permission.CHANGE_DEVICE_IDLE_TEMP_WHITELIST) public void setTemporaryAppWhitelistDuration(long);
     method public android.os.Bundle toBundle();
@@ -531,6 +548,7 @@
   public class NotificationManager {
     method @Nullable public android.content.ComponentName getAllowedNotificationAssistant();
     method @Nullable public android.content.ComponentName getAllowedNotificationAssistantForUser(android.os.UserHandle);
+    method public boolean isNotificationAssistantAccessGranted(@NonNull android.content.ComponentName);
     method public void setNotificationAssistantAccessGranted(android.content.ComponentName, boolean);
     method public void setNotificationAssistantAccessGrantedForUser(android.content.ComponentName, android.os.UserHandle, boolean);
   }
@@ -565,12 +583,12 @@
   }
 
   public class StatusBarManager {
-    method public android.app.StatusBarManager.DisableInfo getDisableInfo();
-    method public void setDisabledForSetup(boolean);
+    method @NonNull @RequiresPermission(android.Manifest.permission.STATUS_BAR) public android.app.StatusBarManager.DisableInfo getDisableInfo();
+    method @RequiresPermission(android.Manifest.permission.STATUS_BAR) public void setDisabledForSetup(boolean);
   }
 
   public static final class StatusBarManager.DisableInfo {
-    method public boolean areNoComponentsDisabled();
+    method public boolean areAllComponentsEnabled();
     method public boolean isNavigateToHomeDisabled();
     method public boolean isNotificationPeekingDisabled();
     method public boolean isRecentsDisabled();
@@ -588,7 +606,7 @@
     method public int getRemovedFlags();
     method public int getWidth();
     method public void writeToParcel(android.os.Parcel, int);
-    field public static final android.os.Parcelable.Creator<android.app.Vr2dDisplayProperties> CREATOR;
+    field @NonNull public static final android.os.Parcelable.Creator<android.app.Vr2dDisplayProperties> CREATOR;
     field public static final int FLAG_VIRTUAL_DISPLAY_ENABLED = 1; // 0x1
   }
 
@@ -833,7 +851,7 @@
     ctor public BackupProgress(long, long);
     method public int describeContents();
     method public void writeToParcel(android.os.Parcel, int);
-    field public static final android.os.Parcelable.Creator<android.app.backup.BackupProgress> CREATOR;
+    field @NonNull public static final android.os.Parcelable.Creator<android.app.backup.BackupProgress> CREATOR;
     field public final long bytesExpected;
     field public final long bytesTransferred;
   }
@@ -891,7 +909,7 @@
     method public int getDataType();
     method public String getPackageName();
     method public void writeToParcel(android.os.Parcel, int);
-    field public static final android.os.Parcelable.Creator<android.app.backup.RestoreDescription> CREATOR;
+    field @NonNull public static final android.os.Parcelable.Creator<android.app.backup.RestoreDescription> CREATOR;
     field public static final android.app.backup.RestoreDescription NO_MORE_PACKAGES;
     field public static final int TYPE_FULL_STREAM = 2; // 0x2
     field public static final int TYPE_KEY_VALUE = 1; // 0x1
@@ -918,7 +936,7 @@
     ctor public RestoreSet(String, String, long);
     method public int describeContents();
     method public void writeToParcel(android.os.Parcel, int);
-    field public static final android.os.Parcelable.Creator<android.app.backup.RestoreSet> CREATOR;
+    field @NonNull public static final android.os.Parcelable.Creator<android.app.backup.RestoreSet> CREATOR;
     field public String device;
     field public String name;
     field public long token;
@@ -936,16 +954,16 @@
 
   public final class ClassificationsRequest implements android.os.Parcelable {
     method public int describeContents();
-    method @Nullable public android.os.Bundle getExtras();
+    method @NonNull public android.os.Bundle getExtras();
     method @NonNull public java.util.List<android.app.contentsuggestions.ContentSelection> getSelections();
     method public void writeToParcel(android.os.Parcel, int);
-    field public static final android.os.Parcelable.Creator<android.app.contentsuggestions.ClassificationsRequest> CREATOR;
+    field @NonNull public static final android.os.Parcelable.Creator<android.app.contentsuggestions.ClassificationsRequest> CREATOR;
   }
 
   public static final class ClassificationsRequest.Builder {
     ctor public ClassificationsRequest.Builder(@NonNull java.util.List<android.app.contentsuggestions.ContentSelection>);
-    method public android.app.contentsuggestions.ClassificationsRequest build();
-    method public android.app.contentsuggestions.ClassificationsRequest.Builder setExtras(@NonNull android.os.Bundle);
+    method @NonNull public android.app.contentsuggestions.ClassificationsRequest build();
+    method @NonNull public android.app.contentsuggestions.ClassificationsRequest.Builder setExtras(@NonNull android.os.Bundle);
   }
 
   public final class ContentClassification implements android.os.Parcelable {
@@ -954,7 +972,7 @@
     method @NonNull public android.os.Bundle getExtras();
     method @NonNull public String getId();
     method public void writeToParcel(android.os.Parcel, int);
-    field public static final android.os.Parcelable.Creator<android.app.contentsuggestions.ContentClassification> CREATOR;
+    field @NonNull public static final android.os.Parcelable.Creator<android.app.contentsuggestions.ContentClassification> CREATOR;
   }
 
   public final class ContentSelection implements android.os.Parcelable {
@@ -963,7 +981,7 @@
     method @NonNull public android.os.Bundle getExtras();
     method @NonNull public String getId();
     method public void writeToParcel(android.os.Parcel, int);
-    field public static final android.os.Parcelable.Creator<android.app.contentsuggestions.ContentSelection> CREATOR;
+    field @NonNull public static final android.os.Parcelable.Creator<android.app.contentsuggestions.ContentSelection> CREATOR;
   }
 
   public final class ContentSuggestionsManager {
@@ -983,18 +1001,18 @@
 
   public final class SelectionsRequest implements android.os.Parcelable {
     method public int describeContents();
-    method @Nullable public android.os.Bundle getExtras();
+    method @NonNull public android.os.Bundle getExtras();
     method @Nullable public android.graphics.Point getInterestPoint();
     method public int getTaskId();
     method public void writeToParcel(android.os.Parcel, int);
-    field public static final android.os.Parcelable.Creator<android.app.contentsuggestions.SelectionsRequest> CREATOR;
+    field @NonNull public static final android.os.Parcelable.Creator<android.app.contentsuggestions.SelectionsRequest> CREATOR;
   }
 
   public static final class SelectionsRequest.Builder {
     ctor public SelectionsRequest.Builder(int);
-    method public android.app.contentsuggestions.SelectionsRequest build();
-    method public android.app.contentsuggestions.SelectionsRequest.Builder setExtras(@NonNull android.os.Bundle);
-    method public android.app.contentsuggestions.SelectionsRequest.Builder setInterestPoint(@NonNull android.graphics.Point);
+    method @NonNull public android.app.contentsuggestions.SelectionsRequest build();
+    method @NonNull public android.app.contentsuggestions.SelectionsRequest.Builder setExtras(@NonNull android.os.Bundle);
+    method @NonNull public android.app.contentsuggestions.SelectionsRequest.Builder setInterestPoint(@NonNull android.graphics.Point);
   }
 
 }
@@ -1016,7 +1034,7 @@
     method public int getPredictedTargetCount();
     method public String getUiSurface();
     method public void writeToParcel(android.os.Parcel, int);
-    field public static final android.os.Parcelable.Creator<android.app.prediction.AppPredictionContext> CREATOR;
+    field @NonNull public static final android.os.Parcelable.Creator<android.app.prediction.AppPredictionContext> CREATOR;
   }
 
   public static final class AppPredictionContext.Builder {
@@ -1034,7 +1052,7 @@
   public final class AppPredictionSessionId 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.prediction.AppPredictionSessionId> CREATOR;
+    field @NonNull public static final android.os.Parcelable.Creator<android.app.prediction.AppPredictionSessionId> CREATOR;
   }
 
   public final class AppPredictor {
@@ -1062,7 +1080,7 @@
     method @Nullable public android.content.pm.ShortcutInfo getShortcutInfo();
     method @NonNull public android.os.UserHandle getUser();
     method public void writeToParcel(android.os.Parcel, int);
-    field public static final android.os.Parcelable.Creator<android.app.prediction.AppTarget> CREATOR;
+    field @NonNull public static final android.os.Parcelable.Creator<android.app.prediction.AppTarget> CREATOR;
   }
 
   public final class AppTargetEvent implements android.os.Parcelable {
@@ -1074,7 +1092,7 @@
     field public static final int ACTION_DISMISS = 2; // 0x2
     field public static final int ACTION_LAUNCH = 1; // 0x1
     field public static final int ACTION_PIN = 3; // 0x3
-    field public static final android.os.Parcelable.Creator<android.app.prediction.AppTargetEvent> CREATOR;
+    field @NonNull public static final android.os.Parcelable.Creator<android.app.prediction.AppTargetEvent> CREATOR;
   }
 
   public static final class AppTargetEvent.Builder {
@@ -1087,7 +1105,7 @@
     ctor public AppTargetId(@NonNull String);
     method public int describeContents();
     method public void writeToParcel(android.os.Parcel, int);
-    field public static final android.os.Parcelable.Creator<android.app.prediction.AppTargetId> CREATOR;
+    field @NonNull public static final android.os.Parcelable.Creator<android.app.prediction.AppTargetId> CREATOR;
   }
 
 }
@@ -1098,26 +1116,33 @@
     method public void onRoleHoldersChanged(@NonNull String, @NonNull android.os.UserHandle);
   }
 
+  public abstract class RoleControllerService extends android.app.Service {
+    ctor public RoleControllerService();
+    method @WorkerThread public abstract boolean onAddRoleHolder(@NonNull String, @NonNull String, int);
+    method @Nullable public final android.os.IBinder onBind(@Nullable android.content.Intent);
+    method @WorkerThread public abstract boolean onClearRoleHolders(@NonNull String, int);
+    method @WorkerThread public abstract boolean onGrantDefaultRoles();
+    method public abstract boolean onIsApplicationQualifiedForRole(@NonNull String, @NonNull String);
+    method public abstract boolean onIsRoleVisible(@NonNull String);
+    method @WorkerThread public abstract boolean onRemoveRoleHolder(@NonNull String, @NonNull String, int);
+    field public static final String SERVICE_INTERFACE = "android.app.role.RoleControllerService";
+  }
+
   public final class RoleManager {
     method @RequiresPermission(android.Manifest.permission.OBSERVE_ROLE_HOLDERS) public void addOnRoleHoldersChangedListenerAsUser(@NonNull java.util.concurrent.Executor, @NonNull android.app.role.OnRoleHoldersChangedListener, @NonNull android.os.UserHandle);
-    method @RequiresPermission(android.Manifest.permission.MANAGE_ROLE_HOLDERS) public void addRoleHolderAsUser(@NonNull String, @NonNull String, int, @NonNull android.os.UserHandle, @NonNull java.util.concurrent.Executor, @NonNull android.app.role.RoleManagerCallback);
+    method @RequiresPermission(android.Manifest.permission.MANAGE_ROLE_HOLDERS) public void addRoleHolderAsUser(@NonNull String, @NonNull String, int, @NonNull android.os.UserHandle, @NonNull java.util.concurrent.Executor, @NonNull java.util.function.Consumer<java.lang.Boolean>);
     method @RequiresPermission("com.android.permissioncontroller.permission.MANAGE_ROLES_FROM_CONTROLLER") public boolean addRoleHolderFromController(@NonNull String, @NonNull String);
-    method @RequiresPermission(android.Manifest.permission.MANAGE_ROLE_HOLDERS) public void clearRoleHoldersAsUser(@NonNull String, int, @NonNull android.os.UserHandle, @NonNull java.util.concurrent.Executor, @NonNull android.app.role.RoleManagerCallback);
+    method @RequiresPermission(android.Manifest.permission.MANAGE_ROLE_HOLDERS) public void clearRoleHoldersAsUser(@NonNull String, int, @NonNull android.os.UserHandle, @NonNull java.util.concurrent.Executor, @NonNull java.util.function.Consumer<java.lang.Boolean>);
     method @NonNull @RequiresPermission("com.android.permissioncontroller.permission.MANAGE_ROLES_FROM_CONTROLLER") public java.util.List<java.lang.String> getHeldRolesFromController(@NonNull String);
     method @NonNull @RequiresPermission(android.Manifest.permission.MANAGE_ROLE_HOLDERS) public java.util.List<java.lang.String> getRoleHolders(@NonNull String);
     method @NonNull @RequiresPermission(android.Manifest.permission.MANAGE_ROLE_HOLDERS) public java.util.List<java.lang.String> getRoleHoldersAsUser(@NonNull String, @NonNull android.os.UserHandle);
     method @RequiresPermission(android.Manifest.permission.OBSERVE_ROLE_HOLDERS) public void removeOnRoleHoldersChangedListenerAsUser(@NonNull android.app.role.OnRoleHoldersChangedListener, @NonNull android.os.UserHandle);
-    method @RequiresPermission(android.Manifest.permission.MANAGE_ROLE_HOLDERS) public void removeRoleHolderAsUser(@NonNull String, @NonNull String, int, @NonNull android.os.UserHandle, @NonNull java.util.concurrent.Executor, @NonNull android.app.role.RoleManagerCallback);
+    method @RequiresPermission(android.Manifest.permission.MANAGE_ROLE_HOLDERS) public void removeRoleHolderAsUser(@NonNull String, @NonNull String, int, @NonNull android.os.UserHandle, @NonNull java.util.concurrent.Executor, @NonNull java.util.function.Consumer<java.lang.Boolean>);
     method @RequiresPermission("com.android.permissioncontroller.permission.MANAGE_ROLES_FROM_CONTROLLER") public boolean removeRoleHolderFromController(@NonNull String, @NonNull String);
     method @RequiresPermission("com.android.permissioncontroller.permission.MANAGE_ROLES_FROM_CONTROLLER") public void setRoleNamesFromController(@NonNull java.util.List<java.lang.String>);
     field public static final int MANAGE_HOLDERS_FLAG_DONT_KILL_APP = 1; // 0x1
   }
 
-  public interface RoleManagerCallback {
-    method public void onFailure();
-    method public void onSuccess();
-  }
-
 }
 
 package android.app.usage {
@@ -1130,7 +1155,7 @@
     method public android.app.usage.UsageStats getUsageStats();
     method public String getVolumeUuid();
     method public void writeToParcel(android.os.Parcel, int);
-    field public static final android.os.Parcelable.Creator<android.app.usage.CacheQuotaHint> CREATOR;
+    field @NonNull public static final android.os.Parcelable.Creator<android.app.usage.CacheQuotaHint> CREATOR;
     field public static final long QUOTA_NOT_SET = -1L; // 0xffffffffffffffffL
   }
 
@@ -1172,7 +1197,7 @@
     method @RequiresPermission(android.Manifest.permission.PACKAGE_USAGE_STATS) public int getAppStandbyBucket(String);
     method @RequiresPermission(android.Manifest.permission.PACKAGE_USAGE_STATS) public java.util.Map<java.lang.String,java.lang.Integer> getAppStandbyBuckets();
     method public int getUsageSource();
-    method @RequiresPermission(allOf={android.Manifest.permission.SUSPEND_APPS, android.Manifest.permission.OBSERVE_APP_USAGE}) public void registerAppUsageLimitObserver(int, @NonNull String[], long, @NonNull java.util.concurrent.TimeUnit, @Nullable android.app.PendingIntent);
+    method @RequiresPermission(allOf={android.Manifest.permission.SUSPEND_APPS, android.Manifest.permission.OBSERVE_APP_USAGE}) public void registerAppUsageLimitObserver(int, @NonNull String[], @NonNull java.time.Duration, @NonNull java.time.Duration, @Nullable android.app.PendingIntent);
     method @RequiresPermission(android.Manifest.permission.OBSERVE_APP_USAGE) public void registerAppUsageObserver(int, @NonNull String[], long, @NonNull java.util.concurrent.TimeUnit, @NonNull android.app.PendingIntent);
     method @RequiresPermission(android.Manifest.permission.OBSERVE_APP_USAGE) public void registerUsageSessionObserver(int, @NonNull String[], long, @NonNull java.util.concurrent.TimeUnit, long, @NonNull java.util.concurrent.TimeUnit, @NonNull android.app.PendingIntent, @Nullable android.app.PendingIntent);
     method public void reportUsageStart(@NonNull android.app.Activity, @NonNull String);
@@ -1277,7 +1302,7 @@
     method public int getOffset();
     method public int getType();
     method public void writeToParcel(android.os.Parcel, int);
-    field public static final android.os.Parcelable.Creator<android.bluetooth.le.ResultStorageDescriptor> CREATOR;
+    field @NonNull public static final android.os.Parcelable.Creator<android.bluetooth.le.ResultStorageDescriptor> CREATOR;
   }
 
   public final class ScanSettings implements android.os.Parcelable {
@@ -1317,7 +1342,7 @@
     method public abstract void sendBroadcast(android.content.Intent, @Nullable String, @Nullable android.os.Bundle);
     method @RequiresPermission(android.Manifest.permission.INTERACT_ACROSS_USERS) public abstract void sendBroadcastAsUser(@RequiresPermission android.content.Intent, android.os.UserHandle, @Nullable String, @Nullable android.os.Bundle);
     method public abstract void sendOrderedBroadcast(@NonNull android.content.Intent, @Nullable String, @Nullable android.os.Bundle, @Nullable android.content.BroadcastReceiver, @Nullable android.os.Handler, int, @Nullable String, @Nullable android.os.Bundle);
-    method @RequiresPermission(android.Manifest.permission.INTERACT_ACROSS_USERS_FULL) public void startActivityAsUser(@RequiresPermission android.content.Intent, android.os.UserHandle);
+    method @RequiresPermission(android.Manifest.permission.INTERACT_ACROSS_USERS_FULL) public void startActivityAsUser(@RequiresPermission @NonNull android.content.Intent, @NonNull android.os.UserHandle);
     field public static final String APP_PREDICTION_SERVICE = "app_prediction";
     field public static final String BACKUP_SERVICE = "backup";
     field public static final String CONTENT_SUGGESTIONS_SERVICE = "content_suggestions";
@@ -1397,7 +1422,7 @@
     field public static final String ACTION_PRE_BOOT_COMPLETED = "android.intent.action.PRE_BOOT_COMPLETED";
     field public static final String ACTION_QUERY_PACKAGE_RESTART = "android.intent.action.QUERY_PACKAGE_RESTART";
     field public static final String ACTION_RESOLVE_INSTANT_APP_PACKAGE = "android.intent.action.RESOLVE_INSTANT_APP_PACKAGE";
-    field public static final String ACTION_REVIEW_ACCESSIBILITY_SERVICES = "android.intent.action.REVIEW_ACCESSIBILITY_SERVICES";
+    field @RequiresPermission(android.Manifest.permission.REVIEW_ACCESSIBILITY_SERVICES) public static final String ACTION_REVIEW_ACCESSIBILITY_SERVICES = "android.intent.action.REVIEW_ACCESSIBILITY_SERVICES";
     field @RequiresPermission(android.Manifest.permission.GRANT_RUNTIME_PERMISSIONS) public static final String ACTION_REVIEW_APP_PERMISSION_USAGE = "android.intent.action.REVIEW_APP_PERMISSION_USAGE";
     field public static final String ACTION_REVIEW_PERMISSIONS = "android.intent.action.REVIEW_PERMISSIONS";
     field public static final String ACTION_REVIEW_PERMISSION_USAGE = "android.intent.action.REVIEW_PERMISSION_USAGE";
@@ -1445,7 +1470,7 @@
     method public int describeContents();
     method public boolean isEnabled();
     method public void writeToParcel(android.os.Parcel, int);
-    field public static final android.os.Parcelable.Creator<android.content.om.OverlayInfo> CREATOR;
+    field @NonNull public static final android.os.Parcelable.Creator<android.content.om.OverlayInfo> CREATOR;
     field public final String category;
     field public final String packageName;
     field public final String targetPackageName;
@@ -1484,7 +1509,7 @@
     method @NonNull public android.graphics.drawable.Drawable loadIcon(@NonNull android.content.pm.PackageManager);
     method @NonNull public CharSequence loadLabel(@NonNull android.content.pm.PackageManager);
     method public void writeToParcel(android.os.Parcel, int);
-    field public static final android.os.Parcelable.Creator<android.content.pm.InstantAppInfo> CREATOR;
+    field @NonNull public static final android.os.Parcelable.Creator<android.content.pm.InstantAppInfo> CREATOR;
   }
 
   public final class InstantAppIntentFilter implements android.os.Parcelable {
@@ -1493,7 +1518,7 @@
     method public java.util.List<android.content.IntentFilter> getFilters();
     method public String getSplitName();
     method public void writeToParcel(android.os.Parcel, int);
-    field public static final android.os.Parcelable.Creator<android.content.pm.InstantAppIntentFilter> CREATOR;
+    field @NonNull public static final android.os.Parcelable.Creator<android.content.pm.InstantAppIntentFilter> CREATOR;
   }
 
   public final class InstantAppResolveInfo implements android.os.Parcelable {
@@ -1511,7 +1536,7 @@
     method @Deprecated public int getVersionCode();
     method public boolean shouldLetInstallerDecide();
     method public void writeToParcel(android.os.Parcel, int);
-    field public static final android.os.Parcelable.Creator<android.content.pm.InstantAppResolveInfo> CREATOR;
+    field @NonNull public static final android.os.Parcelable.Creator<android.content.pm.InstantAppResolveInfo> CREATOR;
   }
 
   public static final class InstantAppResolveInfo.InstantAppDigest implements android.os.Parcelable {
@@ -1520,7 +1545,7 @@
     method public byte[][] getDigestBytes();
     method public int[] getDigestPrefix();
     method public void writeToParcel(android.os.Parcel, int);
-    field public static final android.os.Parcelable.Creator<android.content.pm.InstantAppResolveInfo.InstantAppDigest> CREATOR;
+    field @NonNull public static final android.os.Parcelable.Creator<android.content.pm.InstantAppResolveInfo.InstantAppDigest> CREATOR;
     field public static final android.content.pm.InstantAppResolveInfo.InstantAppDigest UNDEFINED;
   }
 
@@ -1530,7 +1555,7 @@
     method public String getPackageName();
     method public int getStatus();
     method public void writeToParcel(android.os.Parcel, int);
-    field public static final android.os.Parcelable.Creator<android.content.pm.IntentFilterVerificationInfo> CREATOR;
+    field @NonNull public static final android.os.Parcelable.Creator<android.content.pm.IntentFilterVerificationInfo> CREATOR;
   }
 
   public class PackageInstaller {
@@ -1543,23 +1568,26 @@
 
   public static class PackageInstaller.SessionInfo implements android.os.Parcelable {
     method public boolean getAllocateAggressive();
-    method public boolean getAllowDowngrade();
+    method @Deprecated public boolean getAllowDowngrade();
     method public boolean getDontKillApp();
+    method public boolean getEnableRollback();
     method @Nullable public String[] getGrantedRuntimePermissions();
     method public boolean getInstallAsFullApp(boolean);
     method public boolean getInstallAsInstantApp(boolean);
     method public boolean getInstallAsVirtualPreload();
+    method public boolean getRequestDowngrade();
   }
 
   public static class PackageInstaller.SessionParams implements android.os.Parcelable {
     method @RequiresPermission(android.Manifest.permission.ALLOCATE_AGGRESSIVE) public void setAllocateAggressive(boolean);
-    method public void setAllowDowngrade(boolean);
+    method @Deprecated public void setAllowDowngrade(boolean);
     method public void setDontKillApp(boolean);
-    method public void setEnableRollback();
+    method public void setEnableRollback(boolean);
     method @RequiresPermission(android.Manifest.permission.INSTALL_GRANT_RUNTIME_PERMISSIONS) public void setGrantedRuntimePermissions(String[]);
     method @RequiresPermission(android.Manifest.permission.INSTALL_PACKAGES) public void setInstallAsApex();
     method public void setInstallAsInstantApp(boolean);
     method public void setInstallAsVirtualPreload();
+    method public void setRequestDowngrade(boolean);
     method @RequiresPermission(android.Manifest.permission.INSTALL_PACKAGES) public void setStaged();
   }
 
@@ -1589,7 +1617,7 @@
     method @NonNull @RequiresPermission(android.Manifest.permission.ACCESS_INSTANT_APPS) public abstract java.util.List<android.content.pm.InstantAppInfo> getInstantApps();
     method public abstract java.util.List<android.content.pm.IntentFilterVerificationInfo> getIntentFilterVerifications(String);
     method @RequiresPermission(android.Manifest.permission.INTERACT_ACROSS_USERS_FULL) public abstract int getIntentVerificationStatusAsUser(String, int);
-    method @android.content.pm.PackageManager.PermissionFlags @RequiresPermission(anyOf={android.Manifest.permission.GRANT_RUNTIME_PERMISSIONS, android.Manifest.permission.REVOKE_RUNTIME_PERMISSIONS}) public abstract int getPermissionFlags(String, String, @NonNull android.os.UserHandle);
+    method @android.content.pm.PackageManager.PermissionFlags @RequiresPermission(anyOf={android.Manifest.permission.GRANT_RUNTIME_PERMISSIONS, android.Manifest.permission.REVOKE_RUNTIME_PERMISSIONS, android.Manifest.permission.GET_RUNTIME_PERMISSIONS}) public abstract int getPermissionFlags(String, String, @NonNull android.os.UserHandle);
     method @NonNull @RequiresPermission(android.Manifest.permission.SUSPEND_APPS) public String[] getUnsuspendablePackages(@NonNull String[]);
     method @RequiresPermission(android.Manifest.permission.GRANT_RUNTIME_PERMISSIONS) public abstract void grantRuntimePermission(@NonNull String, @NonNull String, @NonNull android.os.UserHandle);
     method @Deprecated public abstract int installExistingPackage(String) throws android.content.pm.PackageManager.NameNotFoundException;
@@ -1624,6 +1652,8 @@
     field public static final int FLAG_PERMISSION_REVOKE_ON_UPGRADE = 8; // 0x8
     field public static final int FLAG_PERMISSION_SYSTEM_FIXED = 16; // 0x10
     field public static final int FLAG_PERMISSION_USER_FIXED = 2; // 0x2
+    field public static final int FLAG_PERMISSION_USER_SENSITIVE_WHEN_DENIED = 512; // 0x200
+    field public static final int FLAG_PERMISSION_USER_SENSITIVE_WHEN_GRANTED = 256; // 0x100
     field public static final int FLAG_PERMISSION_USER_SET = 1; // 0x1
     field public static final int INSTALL_FAILED_ALREADY_EXISTS = -1; // 0xffffffff
     field public static final int INSTALL_FAILED_CONFLICTING_PROVIDER = -13; // 0xfffffff3
@@ -1669,7 +1699,7 @@
     field public static final int INTENT_FILTER_DOMAIN_VERIFICATION_STATUS_UNDEFINED = 0; // 0x0
     field public static final int INTENT_FILTER_VERIFICATION_FAILURE = -1; // 0xffffffff
     field public static final int INTENT_FILTER_VERIFICATION_SUCCESS = 1; // 0x1
-    field public static final int MASK_PERMISSION_FLAGS = 255; // 0xff
+    field @Deprecated public static final int MASK_PERMISSION_FLAGS = 255; // 0xff
     field public static final int MATCH_ANY_USER = 4194304; // 0x400000
     field public static final int MATCH_FACTORY_ONLY = 2097152; // 0x200000
     field public static final int MATCH_INSTANT = 8388608; // 0x800000
@@ -1687,13 +1717,13 @@
     method public void onPermissionsChanged(int);
   }
 
-  @IntDef(prefix={"FLAG_PERMISSION_"}, value={android.content.pm.PackageManager.FLAG_PERMISSION_USER_SET, android.content.pm.PackageManager.FLAG_PERMISSION_USER_FIXED, android.content.pm.PackageManager.FLAG_PERMISSION_POLICY_FIXED, android.content.pm.PackageManager.FLAG_PERMISSION_REVOKE_ON_UPGRADE, android.content.pm.PackageManager.FLAG_PERMISSION_SYSTEM_FIXED, android.content.pm.PackageManager.FLAG_PERMISSION_GRANTED_BY_DEFAULT}) @java.lang.annotation.Retention(java.lang.annotation.RetentionPolicy.SOURCE) public static @interface PackageManager.PermissionFlags {
+  @IntDef(prefix={"FLAG_PERMISSION_"}, value={android.content.pm.PackageManager.FLAG_PERMISSION_USER_SET, android.content.pm.PackageManager.FLAG_PERMISSION_USER_FIXED, android.content.pm.PackageManager.FLAG_PERMISSION_POLICY_FIXED, android.content.pm.PackageManager.FLAG_PERMISSION_REVOKE_ON_UPGRADE, android.content.pm.PackageManager.FLAG_PERMISSION_SYSTEM_FIXED, android.content.pm.PackageManager.FLAG_PERMISSION_GRANTED_BY_DEFAULT, android.content.pm.PackageManager.FLAG_PERMISSION_USER_SENSITIVE_WHEN_GRANTED, android.content.pm.PackageManager.FLAG_PERMISSION_USER_SENSITIVE_WHEN_DENIED}) @java.lang.annotation.Retention(java.lang.annotation.RetentionPolicy.SOURCE) public static @interface PackageManager.PermissionFlags {
   }
 
   public class PermissionGroupInfo extends android.content.pm.PackageItemInfo implements android.os.Parcelable {
-    field @StringRes public int backgroundRequestDetailResourceId;
-    field @StringRes public int backgroundRequestResourceId;
-    field @StringRes public int requestDetailResourceId;
+    field @StringRes public final int backgroundRequestDetailResourceId;
+    field @StringRes public final int backgroundRequestResourceId;
+    field @StringRes public final int requestDetailResourceId;
     field @StringRes public int requestRes;
   }
 
@@ -1706,8 +1736,8 @@
     field public static final int PROTECTION_FLAG_OEM = 16384; // 0x4000
     field public static final int PROTECTION_FLAG_SYSTEM_TEXT_CLASSIFIER = 65536; // 0x10000
     field public static final int PROTECTION_FLAG_WELLBEING = 131072; // 0x20000
-    field public String backgroundPermission;
-    field public int requestRes;
+    field @Nullable public final String backgroundPermission;
+    field @StringRes public int requestRes;
   }
 
   public class ResolveInfo implements android.os.Parcelable {
@@ -1728,13 +1758,13 @@
     method public android.content.pm.ShortcutInfo getShortcutInfo();
     method public android.content.ComponentName getTargetComponent();
     method public void writeToParcel(android.os.Parcel, int);
-    field public static final android.os.Parcelable.Creator<android.content.pm.ShortcutManager.ShareShortcutInfo> CREATOR;
+    field @NonNull public static final android.os.Parcelable.Creator<android.content.pm.ShortcutManager.ShareShortcutInfo> CREATOR;
   }
 
   public final class SuspendDialogInfo 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.content.pm.SuspendDialogInfo> CREATOR;
+    field @NonNull public static final android.os.Parcelable.Creator<android.content.pm.SuspendDialogInfo> CREATOR;
   }
 
   public static final class SuspendDialogInfo.Builder {
@@ -1778,7 +1808,7 @@
     method @Deprecated public boolean isGranted();
     method @Deprecated public boolean isStandard();
     method @Deprecated public void writeToParcel(android.os.Parcel, int);
-    field @Deprecated public static final android.os.Parcelable.Creator<android.content.pm.permission.RuntimePermissionPresentationInfo> CREATOR;
+    field @Deprecated @NonNull public static final android.os.Parcelable.Creator<android.content.pm.permission.RuntimePermissionPresentationInfo> CREATOR;
   }
 
 }
@@ -1787,28 +1817,28 @@
 
   public final class PackageRollbackInfo implements android.os.Parcelable {
     method public int describeContents();
-    method public String getPackageName();
-    method public android.content.pm.VersionedPackage getVersionRolledBackFrom();
-    method public android.content.pm.VersionedPackage getVersionRolledBackTo();
+    method @NonNull public String getPackageName();
+    method @NonNull public android.content.pm.VersionedPackage getVersionRolledBackFrom();
+    method @NonNull public android.content.pm.VersionedPackage getVersionRolledBackTo();
     method public void writeToParcel(android.os.Parcel, int);
-    field public static final android.os.Parcelable.Creator<android.content.rollback.PackageRollbackInfo> CREATOR;
+    field @NonNull public static final android.os.Parcelable.Creator<android.content.rollback.PackageRollbackInfo> CREATOR;
   }
 
   public final class RollbackInfo implements android.os.Parcelable {
     method public int describeContents();
-    method public java.util.List<android.content.pm.VersionedPackage> getCausePackages();
+    method @NonNull public java.util.List<android.content.pm.VersionedPackage> getCausePackages();
     method public int getCommittedSessionId();
-    method public java.util.List<android.content.rollback.PackageRollbackInfo> getPackages();
+    method @NonNull public java.util.List<android.content.rollback.PackageRollbackInfo> getPackages();
     method public int getRollbackId();
     method public boolean isStaged();
     method public void writeToParcel(android.os.Parcel, int);
-    field public static final android.os.Parcelable.Creator<android.content.rollback.RollbackInfo> CREATOR;
+    field @NonNull public static final android.os.Parcelable.Creator<android.content.rollback.RollbackInfo> CREATOR;
   }
 
   public final class RollbackManager {
     method @RequiresPermission(android.Manifest.permission.MANAGE_ROLLBACKS) public void commitRollback(int, @NonNull java.util.List<android.content.pm.VersionedPackage>, @NonNull android.content.IntentSender);
     method @RequiresPermission(android.Manifest.permission.MANAGE_ROLLBACKS) public void expireRollbackForPackage(@NonNull String);
-    method @RequiresPermission(android.Manifest.permission.MANAGE_ROLLBACKS) public java.util.List<android.content.rollback.RollbackInfo> getAvailableRollbacks();
+    method @RequiresPermission(android.Manifest.permission.MANAGE_ROLLBACKS) @NonNull public java.util.List<android.content.rollback.RollbackInfo> getAvailableRollbacks();
     method @RequiresPermission(android.Manifest.permission.MANAGE_ROLLBACKS) @NonNull public java.util.List<android.content.rollback.RollbackInfo> getRecentlyCommittedRollbacks();
     method @RequiresPermission(android.Manifest.permission.MANAGE_ROLLBACKS) public void reloadPersistedData();
     field public static final String EXTRA_STATUS = "android.content.rollback.extra.STATUS";
@@ -1872,13 +1902,13 @@
     method public java.time.LocalDate getLocalDate();
     method public float[] getStats();
     method public void writeToParcel(android.os.Parcel, int);
-    field public static final android.os.Parcelable.Creator<android.hardware.display.AmbientBrightnessDayStats> CREATOR;
+    field @NonNull public static final android.os.Parcelable.Creator<android.hardware.display.AmbientBrightnessDayStats> CREATOR;
   }
 
   public final class BrightnessChangeEvent 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.hardware.display.BrightnessChangeEvent> CREATOR;
+    field @NonNull public static final android.os.Parcelable.Creator<android.hardware.display.BrightnessChangeEvent> CREATOR;
     field public final float batteryLevel;
     field public final float brightness;
     field public final long colorSampleDuration;
@@ -1901,17 +1931,17 @@
     method @Nullable public android.hardware.display.BrightnessCorrection getCorrectionByPackageName(@NonNull String);
     method public android.util.Pair<float[],float[]> getCurve();
     method public void writeToParcel(android.os.Parcel, int);
-    field public static final android.os.Parcelable.Creator<android.hardware.display.BrightnessConfiguration> CREATOR;
+    field @NonNull public static final android.os.Parcelable.Creator<android.hardware.display.BrightnessConfiguration> CREATOR;
   }
 
   public static class BrightnessConfiguration.Builder {
     ctor public BrightnessConfiguration.Builder(float[], float[]);
-    method public android.hardware.display.BrightnessConfiguration.Builder addCorrectionByCategory(int, @NonNull android.hardware.display.BrightnessCorrection);
-    method public android.hardware.display.BrightnessConfiguration.Builder addCorrectionByPackageName(@NonNull String, @NonNull android.hardware.display.BrightnessCorrection);
-    method public android.hardware.display.BrightnessConfiguration build();
+    method @NonNull public android.hardware.display.BrightnessConfiguration.Builder addCorrectionByCategory(int, @NonNull android.hardware.display.BrightnessCorrection);
+    method @NonNull public android.hardware.display.BrightnessConfiguration.Builder addCorrectionByPackageName(@NonNull String, @NonNull android.hardware.display.BrightnessCorrection);
+    method @NonNull public android.hardware.display.BrightnessConfiguration build();
     method public int getMaxCorrectionsByCategory();
     method public int getMaxCorrectionsByPackageName();
-    method public android.hardware.display.BrightnessConfiguration.Builder setDescription(@Nullable String);
+    method @NonNull public android.hardware.display.BrightnessConfiguration.Builder setDescription(@Nullable String);
   }
 
   public final class BrightnessCorrection implements android.os.Parcelable {
@@ -1919,7 +1949,7 @@
     method @NonNull public static android.hardware.display.BrightnessCorrection createScaleAndTranslateLog(float, float);
     method public int describeContents();
     method public void writeToParcel(android.os.Parcel, int);
-    field public static final android.os.Parcelable.Creator<android.hardware.display.BrightnessCorrection> CREATOR;
+    field @NonNull public static final android.os.Parcelable.Creator<android.hardware.display.BrightnessCorrection> CREATOR;
   }
 
   public final class ColorDisplayManager {
@@ -1969,10 +1999,10 @@
     method @Nullable public android.hardware.hdmi.HdmiPlaybackClient getPlaybackClient();
     method @Nullable public android.hardware.hdmi.HdmiSwitchClient getSwitchClient();
     method @Nullable public android.hardware.hdmi.HdmiTvClient getTvClient();
-    method public boolean isRemoteDeviceConnected(android.hardware.hdmi.HdmiDeviceInfo);
-    method public void powerOffRemoteDevice(android.hardware.hdmi.HdmiDeviceInfo);
+    method public boolean isRemoteDeviceConnected(@NonNull android.hardware.hdmi.HdmiDeviceInfo);
+    method public void powerOffRemoteDevice(@NonNull android.hardware.hdmi.HdmiDeviceInfo);
     method @RequiresPermission(android.Manifest.permission.HDMI_CEC) public void removeHotplugEventListener(android.hardware.hdmi.HdmiControlManager.HotplugEventListener);
-    method public void requestRemoteDeviceToBecomeActiveSource(android.hardware.hdmi.HdmiDeviceInfo);
+    method public void requestRemoteDeviceToBecomeActiveSource(@NonNull android.hardware.hdmi.HdmiDeviceInfo);
     method @RequiresPermission(android.Manifest.permission.HDMI_CEC) public void setStandbyMode(boolean);
     field public static final String ACTION_OSD_MESSAGE = "android.hardware.hdmi.action.OSD_MESSAGE";
     field public static final int AVR_VOLUME_MUTED = 101; // 0x65
@@ -2096,7 +2126,7 @@
     method public boolean isSourceType();
     method public void writeToParcel(android.os.Parcel, int);
     field public static final int ADDR_INTERNAL = 0; // 0x0
-    field public static final android.os.Parcelable.Creator<android.hardware.hdmi.HdmiDeviceInfo> CREATOR;
+    field @NonNull public static final android.os.Parcelable.Creator<android.hardware.hdmi.HdmiDeviceInfo> CREATOR;
     field public static final int DEVICE_AUDIO_SYSTEM = 5; // 0x5
     field public static final int DEVICE_INACTIVE = -1; // 0xffffffff
     field public static final int DEVICE_PLAYBACK = 4; // 0x4
@@ -2116,7 +2146,7 @@
     method public int getPort();
     method public boolean isConnected();
     method public void writeToParcel(android.os.Parcel, int);
-    field public static final android.os.Parcelable.Creator<android.hardware.hdmi.HdmiHotplugEvent> CREATOR;
+    field @NonNull public static final android.os.Parcelable.Creator<android.hardware.hdmi.HdmiHotplugEvent> CREATOR;
   }
 
   public final class HdmiPlaybackClient extends android.hardware.hdmi.HdmiClient {
@@ -2144,7 +2174,7 @@
     method public boolean isCecSupported();
     method public boolean isMhlSupported();
     method public void writeToParcel(android.os.Parcel, int);
-    field public static final android.os.Parcelable.Creator<android.hardware.hdmi.HdmiPortInfo> CREATOR;
+    field @NonNull public static final android.os.Parcelable.Creator<android.hardware.hdmi.HdmiPortInfo> CREATOR;
     field public static final int PORT_INPUT = 0; // 0x0
     field public static final int PORT_OUTPUT = 1; // 0x1
   }
@@ -2307,7 +2337,7 @@
     method public int getToolchainVersion();
     method public String getVendor();
     method public void writeToParcel(android.os.Parcel, int);
-    field public static final android.os.Parcelable.Creator<android.hardware.location.ContextHubInfo> CREATOR;
+    field @NonNull public static final android.os.Parcelable.Creator<android.hardware.location.ContextHubInfo> CREATOR;
   }
 
   public class ContextHubIntentEvent {
@@ -2368,7 +2398,7 @@
     method @Deprecated public void setMsgType(int);
     method @Deprecated public void setVersion(int);
     method @Deprecated public void writeToParcel(android.os.Parcel, int);
-    field @Deprecated public static final android.os.Parcelable.Creator<android.hardware.location.ContextHubMessage> CREATOR;
+    field @Deprecated @NonNull public static final android.os.Parcelable.Creator<android.hardware.location.ContextHubMessage> CREATOR;
   }
 
   public class ContextHubTransaction<T> {
@@ -2456,7 +2486,7 @@
     method public int getMonitoringType();
     method public int getSourceTechnologies();
     method public void writeToParcel(android.os.Parcel, int);
-    field public static final android.os.Parcelable.Creator<android.hardware.location.GeofenceHardwareMonitorEvent> CREATOR;
+    field @NonNull public static final android.os.Parcelable.Creator<android.hardware.location.GeofenceHardwareMonitorEvent> CREATOR;
   }
 
   public final class GeofenceHardwareRequest {
@@ -2486,7 +2516,7 @@
     method public boolean isReadable();
     method public boolean isWritable();
     method public void writeToParcel(android.os.Parcel, int);
-    field public static final android.os.Parcelable.Creator<android.hardware.location.MemoryRegion> CREATOR;
+    field @NonNull public static final android.os.Parcelable.Creator<android.hardware.location.MemoryRegion> CREATOR;
   }
 
   @Deprecated public class NanoApp implements android.os.Parcelable {
@@ -2515,7 +2545,7 @@
     method @Deprecated public void setOutputEvents(int[]);
     method @Deprecated public void setPublisher(String);
     method @Deprecated public void writeToParcel(android.os.Parcel, int);
-    field @Deprecated public static final android.os.Parcelable.Creator<android.hardware.location.NanoApp> CREATOR;
+    field @Deprecated @NonNull public static final android.os.Parcelable.Creator<android.hardware.location.NanoApp> CREATOR;
   }
 
   public final class NanoAppBinary implements android.os.Parcelable {
@@ -2534,7 +2564,7 @@
     method public boolean isEncrypted();
     method public boolean isSigned();
     method public void writeToParcel(android.os.Parcel, int);
-    field public static final android.os.Parcelable.Creator<android.hardware.location.NanoAppBinary> CREATOR;
+    field @NonNull public static final android.os.Parcelable.Creator<android.hardware.location.NanoAppBinary> CREATOR;
   }
 
   @Deprecated public class NanoAppFilter implements android.os.Parcelable {
@@ -2543,7 +2573,7 @@
     method @Deprecated public boolean testMatch(android.hardware.location.NanoAppInstanceInfo);
     method @Deprecated public void writeToParcel(android.os.Parcel, int);
     field @Deprecated public static final int APP_ANY = -1; // 0xffffffff
-    field @Deprecated public static final android.os.Parcelable.Creator<android.hardware.location.NanoAppFilter> CREATOR;
+    field @Deprecated @NonNull public static final android.os.Parcelable.Creator<android.hardware.location.NanoAppFilter> CREATOR;
     field @Deprecated public static final int FLAGS_VERSION_ANY = -1; // 0xffffffff
     field @Deprecated public static final int FLAGS_VERSION_GREAT_THAN = 2; // 0x2
     field @Deprecated public static final int FLAGS_VERSION_LESS_THAN = 4; // 0x4
@@ -2567,7 +2597,7 @@
     method @Deprecated @NonNull public int[] getOutputEvents();
     method @Deprecated public String getPublisher();
     method @Deprecated public void writeToParcel(android.os.Parcel, int);
-    field @Deprecated public static final android.os.Parcelable.Creator<android.hardware.location.NanoAppInstanceInfo> CREATOR;
+    field @Deprecated @NonNull public static final android.os.Parcelable.Creator<android.hardware.location.NanoAppInstanceInfo> CREATOR;
   }
 
   public final class NanoAppMessage implements android.os.Parcelable {
@@ -2579,7 +2609,7 @@
     method public long getNanoAppId();
     method public boolean isBroadcastMessage();
     method public void writeToParcel(android.os.Parcel, int);
-    field public static final android.os.Parcelable.Creator<android.hardware.location.NanoAppMessage> CREATOR;
+    field @NonNull public static final android.os.Parcelable.Creator<android.hardware.location.NanoAppMessage> CREATOR;
   }
 
   public final class NanoAppState implements android.os.Parcelable {
@@ -2589,7 +2619,7 @@
     method public long getNanoAppVersion();
     method public boolean isEnabled();
     method public void writeToParcel(android.os.Parcel, int);
-    field public static final android.os.Parcelable.Creator<android.hardware.location.NanoAppState> CREATOR;
+    field @NonNull public static final android.os.Parcelable.Creator<android.hardware.location.NanoAppState> CREATOR;
   }
 
 }
@@ -2602,7 +2632,7 @@
     method public int getType();
     method @NonNull public java.util.Map<java.lang.String,java.lang.String> getVendorInfo();
     method public void writeToParcel(android.os.Parcel, int);
-    field public static final android.os.Parcelable.Creator<android.hardware.radio.Announcement> CREATOR;
+    field @NonNull public static final android.os.Parcelable.Creator<android.hardware.radio.Announcement> CREATOR;
     field public static final int TYPE_EMERGENCY = 1; // 0x1
     field public static final int TYPE_EVENT = 6; // 0x6
     field public static final int TYPE_MISC = 8; // 0x8
@@ -2637,7 +2667,7 @@
     method @NonNull public java.util.Set<java.lang.Integer> getIdentifierTypes();
     method @NonNull public java.util.Set<android.hardware.radio.ProgramSelector.Identifier> getIdentifiers();
     method public void writeToParcel(android.os.Parcel, int);
-    field public static final android.os.Parcelable.Creator<android.hardware.radio.ProgramList.Filter> CREATOR;
+    field @NonNull public static final android.os.Parcelable.Creator<android.hardware.radio.ProgramList.Filter> CREATOR;
   }
 
   public abstract static class ProgramList.ListCallback {
@@ -2663,7 +2693,7 @@
     method @Deprecated @NonNull public long[] getVendorIds();
     method @NonNull public android.hardware.radio.ProgramSelector withSecondaryPreferred(@NonNull android.hardware.radio.ProgramSelector.Identifier);
     method public void writeToParcel(android.os.Parcel, int);
-    field public static final android.os.Parcelable.Creator<android.hardware.radio.ProgramSelector> CREATOR;
+    field @NonNull public static final android.os.Parcelable.Creator<android.hardware.radio.ProgramSelector> CREATOR;
     field public static final int IDENTIFIER_TYPE_AMFM_FREQUENCY = 1; // 0x1
     field public static final int IDENTIFIER_TYPE_DAB_ENSEMBLE = 6; // 0x6
     field public static final int IDENTIFIER_TYPE_DAB_FREQUENCY = 8; // 0x8
@@ -2702,7 +2732,7 @@
     method @android.hardware.radio.ProgramSelector.IdentifierType public int getType();
     method public long getValue();
     method public void writeToParcel(android.os.Parcel, int);
-    field public static final android.os.Parcelable.Creator<android.hardware.radio.ProgramSelector.Identifier> CREATOR;
+    field @NonNull public static final android.os.Parcelable.Creator<android.hardware.radio.ProgramSelector.Identifier> CREATOR;
   }
 
   @IntDef(prefix={"IDENTIFIER_TYPE_"}, value={android.hardware.radio.ProgramSelector.IDENTIFIER_TYPE_INVALID, android.hardware.radio.ProgramSelector.IDENTIFIER_TYPE_AMFM_FREQUENCY, android.hardware.radio.ProgramSelector.IDENTIFIER_TYPE_RDS_PI, android.hardware.radio.ProgramSelector.IDENTIFIER_TYPE_HD_STATION_ID_EXT, android.hardware.radio.ProgramSelector.IDENTIFIER_TYPE_HD_SUBCHANNEL, android.hardware.radio.ProgramSelector.IDENTIFIER_TYPE_HD_STATION_NAME, android.hardware.radio.ProgramSelector.IDENTIFIER_TYPE_DAB_SID_EXT, android.hardware.radio.ProgramSelector.IDENTIFIER_TYPE_DAB_SIDECC, android.hardware.radio.ProgramSelector.IDENTIFIER_TYPE_DAB_ENSEMBLE, android.hardware.radio.ProgramSelector.IDENTIFIER_TYPE_DAB_SCID, android.hardware.radio.ProgramSelector.IDENTIFIER_TYPE_DAB_FREQUENCY, android.hardware.radio.ProgramSelector.IDENTIFIER_TYPE_DRMO_SERVICE_ID, android.hardware.radio.ProgramSelector.IDENTIFIER_TYPE_DRMO_FREQUENCY, android.hardware.radio.ProgramSelector.IDENTIFIER_TYPE_DRMO_MODULATION, android.hardware.radio.ProgramSelector.IDENTIFIER_TYPE_SXM_SERVICE_ID, android.hardware.radio.ProgramSelector.IDENTIFIER_TYPE_SXM_CHANNEL}) @IntRange(from=android.hardware.radio.ProgramSelector.IDENTIFIER_TYPE_VENDOR_START, to=android.hardware.radio.ProgramSelector.IDENTIFIER_TYPE_VENDOR_END) @java.lang.annotation.Retention(java.lang.annotation.RetentionPolicy.SOURCE) public static @interface ProgramSelector.IdentifierType {
@@ -2751,7 +2781,7 @@
 
   public static class RadioManager.AmBandConfig extends android.hardware.radio.RadioManager.BandConfig {
     method public boolean getStereo();
-    field public static final android.os.Parcelable.Creator<android.hardware.radio.RadioManager.AmBandConfig> CREATOR;
+    field @NonNull public static final android.os.Parcelable.Creator<android.hardware.radio.RadioManager.AmBandConfig> CREATOR;
   }
 
   public static class RadioManager.AmBandConfig.Builder {
@@ -2763,7 +2793,7 @@
 
   public static class RadioManager.AmBandDescriptor extends android.hardware.radio.RadioManager.BandDescriptor {
     method public boolean isStereoSupported();
-    field public static final android.os.Parcelable.Creator<android.hardware.radio.RadioManager.AmBandDescriptor> CREATOR;
+    field @NonNull public static final android.os.Parcelable.Creator<android.hardware.radio.RadioManager.AmBandDescriptor> CREATOR;
   }
 
   @IntDef(prefix={"BAND_"}, value={android.hardware.radio.RadioManager.BAND_INVALID, android.hardware.radio.RadioManager.BAND_AM, android.hardware.radio.RadioManager.BAND_FM, android.hardware.radio.RadioManager.BAND_AM_HD, android.hardware.radio.RadioManager.BAND_FM_HD}) @java.lang.annotation.Retention(java.lang.annotation.RetentionPolicy.SOURCE) public static @interface RadioManager.Band {
@@ -2777,7 +2807,7 @@
     method public int getType();
     method public int getUpperLimit();
     method public void writeToParcel(android.os.Parcel, int);
-    field public static final android.os.Parcelable.Creator<android.hardware.radio.RadioManager.BandConfig> CREATOR;
+    field @NonNull public static final android.os.Parcelable.Creator<android.hardware.radio.RadioManager.BandConfig> CREATOR;
   }
 
   public static class RadioManager.BandDescriptor implements android.os.Parcelable {
@@ -2790,7 +2820,7 @@
     method public boolean isAmBand();
     method public boolean isFmBand();
     method public void writeToParcel(android.os.Parcel, int);
-    field public static final android.os.Parcelable.Creator<android.hardware.radio.RadioManager.BandDescriptor> CREATOR;
+    field @NonNull public static final android.os.Parcelable.Creator<android.hardware.radio.RadioManager.BandDescriptor> CREATOR;
   }
 
   public static class RadioManager.FmBandConfig extends android.hardware.radio.RadioManager.BandConfig {
@@ -2799,7 +2829,7 @@
     method public boolean getRds();
     method public boolean getStereo();
     method public boolean getTa();
-    field public static final android.os.Parcelable.Creator<android.hardware.radio.RadioManager.FmBandConfig> CREATOR;
+    field @NonNull public static final android.os.Parcelable.Creator<android.hardware.radio.RadioManager.FmBandConfig> CREATOR;
   }
 
   public static class RadioManager.FmBandConfig.Builder {
@@ -2819,7 +2849,7 @@
     method public boolean isRdsSupported();
     method public boolean isStereoSupported();
     method public boolean isTaSupported();
-    field public static final android.os.Parcelable.Creator<android.hardware.radio.RadioManager.FmBandDescriptor> CREATOR;
+    field @NonNull public static final android.os.Parcelable.Creator<android.hardware.radio.RadioManager.FmBandDescriptor> CREATOR;
   }
 
   public static class RadioManager.ModuleProperties implements android.os.Parcelable {
@@ -2842,7 +2872,7 @@
     method public boolean isProgramIdentifierSupported(@android.hardware.radio.ProgramSelector.IdentifierType int);
     method public boolean isProgramTypeSupported(@android.hardware.radio.ProgramSelector.ProgramType int);
     method public void writeToParcel(android.os.Parcel, int);
-    field public static final android.os.Parcelable.Creator<android.hardware.radio.RadioManager.ModuleProperties> CREATOR;
+    field @NonNull public static final android.os.Parcelable.Creator<android.hardware.radio.RadioManager.ModuleProperties> CREATOR;
   }
 
   public static class RadioManager.ProgramInfo implements android.os.Parcelable {
@@ -2864,7 +2894,7 @@
     method public boolean isTrafficProgram();
     method public boolean isTuned();
     method public void writeToParcel(android.os.Parcel, int);
-    field public static final android.os.Parcelable.Creator<android.hardware.radio.RadioManager.ProgramInfo> CREATOR;
+    field @NonNull public static final android.os.Parcelable.Creator<android.hardware.radio.RadioManager.ProgramInfo> CREATOR;
   }
 
   public final class RadioMetadata implements android.os.Parcelable {
@@ -2877,7 +2907,7 @@
     method public java.util.Set<java.lang.String> keySet();
     method public int size();
     method public void writeToParcel(android.os.Parcel, int);
-    field public static final android.os.Parcelable.Creator<android.hardware.radio.RadioMetadata> CREATOR;
+    field @NonNull public static final android.os.Parcelable.Creator<android.hardware.radio.RadioMetadata> CREATOR;
     field public static final String METADATA_KEY_ALBUM = "android.hardware.radio.metadata.ALBUM";
     field public static final String METADATA_KEY_ART = "android.hardware.radio.metadata.ART";
     field public static final String METADATA_KEY_ARTIST = "android.hardware.radio.metadata.ARTIST";
@@ -2915,7 +2945,7 @@
     method public int getTimezoneOffsetMinutes();
     method public long getUtcEpochSeconds();
     method public void writeToParcel(android.os.Parcel, int);
-    field public static final android.os.Parcelable.Creator<android.hardware.radio.RadioMetadata.Clock> CREATOR;
+    field @NonNull public static final android.os.Parcelable.Creator<android.hardware.radio.RadioMetadata.Clock> CREATOR;
   }
 
   public abstract class RadioTuner {
@@ -3015,7 +3045,7 @@
     method public boolean isConnected();
     method public boolean isRoleCombinationSupported(int, int);
     method public void writeToParcel(android.os.Parcel, int);
-    field public static final android.os.Parcelable.Creator<android.hardware.usb.UsbPortStatus> CREATOR;
+    field @NonNull public static final android.os.Parcelable.Creator<android.hardware.usb.UsbPortStatus> CREATOR;
     field public static final int DATA_ROLE_DEVICE = 2; // 0x2
     field public static final int DATA_ROLE_HOST = 1; // 0x1
     field public static final int DATA_ROLE_NONE = 0; // 0x0
@@ -3040,81 +3070,75 @@
 
   public final class GnssMeasurementCorrections implements android.os.Parcelable {
     method public int describeContents();
-    method public double getAltitudeMeters();
-    method public double getHorizontalPositionUncertaintyMeters();
-    method public double getLatitudeDegrees();
-    method public double getLongitudeDegrees();
-    method @Nullable public java.util.List<android.location.GnssSingleSatCorrection> getSingleSatelliteCorrectionList();
-    method public long getToaGpsNanosecondsOfWeek();
-    method public double getVerticalPositionUncertaintyMeters();
-    method public void writeToParcel(android.os.Parcel, int);
+    method @FloatRange(from=-1000.0F, to=10000.0f) public double getAltitudeMeters();
+    method @FloatRange(from=0.0f) public double getHorizontalPositionUncertaintyMeters();
+    method @FloatRange(from=-90.0F, to=90.0f) public double getLatitudeDegrees();
+    method @FloatRange(from=-180.0F, to=180.0f) public double getLongitudeDegrees();
+    method @NonNull public java.util.List<android.location.GnssSingleSatCorrection> getSingleSatelliteCorrectionList();
+    method @IntRange(from=0) public long getToaGpsNanosecondsOfWeek();
+    method @FloatRange(from=0.0f) public double getVerticalPositionUncertaintyMeters();
+    method public void writeToParcel(@NonNull android.os.Parcel, int);
     field public static final android.os.Parcelable.Creator<android.location.GnssMeasurementCorrections> CREATOR;
   }
 
   public static final class GnssMeasurementCorrections.Builder {
     ctor public GnssMeasurementCorrections.Builder();
-    method public android.location.GnssMeasurementCorrections build();
-    method public android.location.GnssMeasurementCorrections.Builder setAltitudeMeters(double);
-    method public android.location.GnssMeasurementCorrections.Builder setHorizontalPositionUncertaintyMeters(double);
-    method public android.location.GnssMeasurementCorrections.Builder setLatitudeDegrees(double);
-    method public android.location.GnssMeasurementCorrections.Builder setLongitudeDegrees(double);
-    method public android.location.GnssMeasurementCorrections.Builder setSingleSatelliteCorrectionList(@Nullable java.util.List<android.location.GnssSingleSatCorrection>);
-    method public android.location.GnssMeasurementCorrections.Builder setToaGpsNanosecondsOfWeek(long);
-    method public android.location.GnssMeasurementCorrections.Builder setVerticalPositionUncertaintyMeters(double);
+    method @NonNull public android.location.GnssMeasurementCorrections build();
+    method @NonNull public android.location.GnssMeasurementCorrections.Builder setAltitudeMeters(@FloatRange(from=-1000.0F, to=10000.0f) double);
+    method @NonNull public android.location.GnssMeasurementCorrections.Builder setHorizontalPositionUncertaintyMeters(@FloatRange(from=0.0f) double);
+    method @NonNull public android.location.GnssMeasurementCorrections.Builder setLatitudeDegrees(@FloatRange(from=-90.0F, to=90.0f) double);
+    method @NonNull public android.location.GnssMeasurementCorrections.Builder setLongitudeDegrees(@FloatRange(from=-180.0F, to=180.0f) double);
+    method @NonNull public android.location.GnssMeasurementCorrections.Builder setSingleSatelliteCorrectionList(@NonNull java.util.List<android.location.GnssSingleSatCorrection>);
+    method @NonNull public android.location.GnssMeasurementCorrections.Builder setToaGpsNanosecondsOfWeek(@IntRange(from=0) long);
+    method @NonNull public android.location.GnssMeasurementCorrections.Builder setVerticalPositionUncertaintyMeters(@FloatRange(from=0.0f) double);
   }
 
   public final class GnssReflectingPlane implements android.os.Parcelable {
     method public int describeContents();
-    method public double getAltitudeMeters();
-    method public double getAzimuthDegrees();
-    method public double getLatitudeDegrees();
-    method public double getLongitudeDegrees();
-    method public void writeToParcel(android.os.Parcel, int);
+    method @FloatRange(from=-1000.0F, to=10000.0f) public double getAltitudeMeters();
+    method @FloatRange(from=0.0f, to=360.0f) public double getAzimuthDegrees();
+    method @FloatRange(from=-90.0F, to=90.0f) public double getLatitudeDegrees();
+    method @FloatRange(from=-180.0F, to=180.0f) public double getLongitudeDegrees();
+    method public void writeToParcel(@NonNull android.os.Parcel, int);
     field public static final android.os.Parcelable.Creator<android.location.GnssReflectingPlane> CREATOR;
   }
 
   public static final class GnssReflectingPlane.Builder {
     ctor public GnssReflectingPlane.Builder();
-    method public android.location.GnssReflectingPlane build();
-    method public android.location.GnssReflectingPlane.Builder setAltitudeMeters(double);
-    method public android.location.GnssReflectingPlane.Builder setAzimuthDegrees(double);
-    method public android.location.GnssReflectingPlane.Builder setLatitudeDegrees(double);
-    method public android.location.GnssReflectingPlane.Builder setLongitudeDegrees(double);
+    method @NonNull public android.location.GnssReflectingPlane build();
+    method @NonNull public android.location.GnssReflectingPlane.Builder setAltitudeMeters(@FloatRange(from=-1000.0F, to=10000.0f) double);
+    method @NonNull public android.location.GnssReflectingPlane.Builder setAzimuthDegrees(@FloatRange(from=0.0f, to=360.0f) double);
+    method @NonNull public android.location.GnssReflectingPlane.Builder setLatitudeDegrees(@FloatRange(from=-90.0F, to=90.0f) double);
+    method @NonNull public android.location.GnssReflectingPlane.Builder setLongitudeDegrees(@FloatRange(from=-180.0F, to=180.0f) double);
   }
 
   public final class GnssSingleSatCorrection implements android.os.Parcelable {
     method public int describeContents();
-    method public float getCarrierFrequencyHz();
+    method @FloatRange(from=0.0f, fromInclusive=false) public float getCarrierFrequencyHz();
     method public int getConstellationType();
-    method public float getExcessPathLengthMeters();
-    method public float getExcessPathLengthUncertaintyMeters();
+    method @FloatRange(from=0.0f) public float getExcessPathLengthMeters();
+    method @FloatRange(from=0.0f) public float getExcessPathLengthUncertaintyMeters();
     method @FloatRange(from=0.0f, to=1.0f) public float getProbabilityLineOfSight();
     method @Nullable public android.location.GnssReflectingPlane getReflectingPlane();
-    method public int getSatelliteId();
-    method public int getSingleSatelliteCorrectionFlags();
+    method @IntRange(from=0) public int getSatelliteId();
     method public boolean hasExcessPathLength();
     method public boolean hasExcessPathLengthUncertainty();
     method public boolean hasReflectingPlane();
     method public boolean hasValidSatelliteLineOfSight();
-    method public void writeToParcel(android.os.Parcel, int);
+    method public void writeToParcel(@NonNull android.os.Parcel, int);
     field public static final android.os.Parcelable.Creator<android.location.GnssSingleSatCorrection> CREATOR;
-    field public static final int HAS_EXCESS_PATH_LENGTH_MASK = 2; // 0x2
-    field public static final int HAS_EXCESS_PATH_LENGTH_UNC_MASK = 4; // 0x4
-    field public static final int HAS_PROB_SAT_IS_LOS_MASK = 1; // 0x1
-    field public static final int HAS_REFLECTING_PLANE_MASK = 8; // 0x8
   }
 
   public static final class GnssSingleSatCorrection.Builder {
     ctor public GnssSingleSatCorrection.Builder();
-    method public android.location.GnssSingleSatCorrection build();
-    method public android.location.GnssSingleSatCorrection.Builder setCarrierFrequencyHz(float);
-    method public android.location.GnssSingleSatCorrection.Builder setConstellationType(int);
-    method public android.location.GnssSingleSatCorrection.Builder setExcessPathLengthMeters(float);
-    method public android.location.GnssSingleSatCorrection.Builder setExcessPathLengthUncertaintyMeters(float);
-    method public android.location.GnssSingleSatCorrection.Builder setProbabilityLineOfSight(@FloatRange(from=0.0f, to=1.0f) float);
-    method public android.location.GnssSingleSatCorrection.Builder setReflectingPlane(android.location.GnssReflectingPlane);
-    method public android.location.GnssSingleSatCorrection.Builder setSatelliteId(int);
-    method public android.location.GnssSingleSatCorrection.Builder setSingleSatelliteCorrectionFlags(int);
+    method @NonNull public android.location.GnssSingleSatCorrection build();
+    method @NonNull public android.location.GnssSingleSatCorrection.Builder setCarrierFrequencyHz(@FloatRange(from=0.0f, fromInclusive=false) float);
+    method @NonNull public android.location.GnssSingleSatCorrection.Builder setConstellationType(int);
+    method @NonNull public android.location.GnssSingleSatCorrection.Builder setExcessPathLengthMeters(@FloatRange(from=0.0f) float);
+    method @NonNull public android.location.GnssSingleSatCorrection.Builder setExcessPathLengthUncertaintyMeters(@FloatRange(from=0.0f) float);
+    method @NonNull public android.location.GnssSingleSatCorrection.Builder setProbabilityLineOfSight(@FloatRange(from=0.0f, to=1.0f) float);
+    method @NonNull public android.location.GnssSingleSatCorrection.Builder setReflectingPlane(@Nullable android.location.GnssReflectingPlane);
+    method @NonNull public android.location.GnssSingleSatCorrection.Builder setSatelliteId(@IntRange(from=0) int);
   }
 
   public class GpsClock implements android.os.Parcelable {
@@ -3154,7 +3178,7 @@
     method public void setTimeUncertaintyInNs(double);
     method public void setType(byte);
     method public void writeToParcel(android.os.Parcel, int);
-    field public static final android.os.Parcelable.Creator<android.location.GpsClock> CREATOR;
+    field @NonNull public static final android.os.Parcelable.Creator<android.location.GpsClock> CREATOR;
     field public static final byte TYPE_GPS_TIME = 2; // 0x2
     field public static final byte TYPE_LOCAL_HW_TIME = 1; // 0x1
     field public static final byte TYPE_UNKNOWN = 0; // 0x0
@@ -3266,7 +3290,7 @@
     field public static final short ADR_STATE_RESET = 2; // 0x2
     field public static final short ADR_STATE_UNKNOWN = 0; // 0x0
     field public static final short ADR_STATE_VALID = 1; // 0x1
-    field public static final android.os.Parcelable.Creator<android.location.GpsMeasurement> CREATOR;
+    field @NonNull public static final android.os.Parcelable.Creator<android.location.GpsMeasurement> CREATOR;
     field public static final byte LOSS_OF_LOCK_CYCLE_SLIP = 2; // 0x2
     field public static final byte LOSS_OF_LOCK_OK = 1; // 0x1
     field public static final byte LOSS_OF_LOCK_UNKNOWN = 0; // 0x0
@@ -3287,7 +3311,7 @@
     method @NonNull public android.location.GpsClock getClock();
     method @NonNull public java.util.Collection<android.location.GpsMeasurement> getMeasurements();
     method public void writeToParcel(android.os.Parcel, int);
-    field public static final android.os.Parcelable.Creator<android.location.GpsMeasurementsEvent> CREATOR;
+    field @NonNull public static final android.os.Parcelable.Creator<android.location.GpsMeasurementsEvent> CREATOR;
     field public static final int STATUS_GPS_LOCATION_DISABLED = 2; // 0x2
     field public static final int STATUS_NOT_SUPPORTED = 0; // 0x0
     field public static final int STATUS_READY = 1; // 0x1
@@ -3315,7 +3339,7 @@
     method public void setSubmessageId(short);
     method public void setType(byte);
     method public void writeToParcel(android.os.Parcel, int);
-    field public static final android.os.Parcelable.Creator<android.location.GpsNavigationMessage> CREATOR;
+    field @NonNull public static final android.os.Parcelable.Creator<android.location.GpsNavigationMessage> CREATOR;
     field public static final short STATUS_PARITY_PASSED = 1; // 0x1
     field public static final short STATUS_PARITY_REBUILT = 2; // 0x2
     field public static final short STATUS_UNKNOWN = 0; // 0x0
@@ -3331,7 +3355,7 @@
     method public int describeContents();
     method @NonNull public android.location.GpsNavigationMessage getNavigationMessage();
     method public void writeToParcel(android.os.Parcel, int);
-    field public static final android.os.Parcelable.Creator<android.location.GpsNavigationMessageEvent> CREATOR;
+    field @NonNull public static final android.os.Parcelable.Creator<android.location.GpsNavigationMessageEvent> CREATOR;
     field public static int STATUS_GPS_LOCATION_DISABLED;
     field public static int STATUS_NOT_SUPPORTED;
     field public static int STATUS_READY;
@@ -3349,62 +3373,58 @@
   }
 
   public class LocationManager {
-    method @Deprecated public boolean addGpsMeasurementListener(android.location.GpsMeasurementsEvent.Listener);
-    method @Deprecated public boolean addGpsNavigationMessageListener(android.location.GpsNavigationMessageEvent.Listener);
     method @RequiresPermission(android.Manifest.permission.LOCATION_HARDWARE) public void flushGnssBatch();
     method @RequiresPermission(android.Manifest.permission.LOCATION_HARDWARE) public int getGnssBatchSize();
     method public int getGnssCapabilities();
     method @Nullable public String getLocationControllerExtraPackage();
     method @RequiresPermission(android.Manifest.permission.ACCESS_FINE_LOCATION) public void injectGnssMeasurementCorrections(@NonNull android.location.GnssMeasurementCorrections);
     method public boolean isLocationControllerExtraPackageEnabled();
-    method public boolean isLocationEnabledForUser(android.os.UserHandle);
-    method public boolean isProviderEnabledForUser(String, android.os.UserHandle);
-    method public boolean isProviderPackage(String);
-    method @RequiresPermission(android.Manifest.permission.LOCATION_HARDWARE) public boolean registerGnssBatchedLocationCallback(long, boolean, android.location.BatchedLocationCallback, android.os.Handler);
-    method @Deprecated public void removeGpsMeasurementListener(android.location.GpsMeasurementsEvent.Listener);
-    method @Deprecated public void removeGpsNavigationMessageListener(android.location.GpsNavigationMessageEvent.Listener);
-    method @RequiresPermission(anyOf={android.Manifest.permission.ACCESS_COARSE_LOCATION, android.Manifest.permission.ACCESS_FINE_LOCATION}) public void requestLocationUpdates(android.location.LocationRequest, android.location.LocationListener, android.os.Looper);
-    method @RequiresPermission(anyOf={android.Manifest.permission.ACCESS_COARSE_LOCATION, android.Manifest.permission.ACCESS_FINE_LOCATION}) public void requestLocationUpdates(android.location.LocationRequest, android.app.PendingIntent);
-    method @RequiresPermission(android.Manifest.permission.LOCATION_HARDWARE) public void setLocationControllerExtraPackage(String);
+    method public boolean isLocationEnabledForUser(@NonNull android.os.UserHandle);
+    method public boolean isProviderEnabledForUser(@NonNull String, @NonNull android.os.UserHandle);
+    method public boolean isProviderPackage(@NonNull String);
+    method @RequiresPermission(android.Manifest.permission.LOCATION_HARDWARE) public boolean registerGnssBatchedLocationCallback(long, boolean, @NonNull android.location.BatchedLocationCallback, @Nullable android.os.Handler);
+    method @RequiresPermission(anyOf={android.Manifest.permission.ACCESS_COARSE_LOCATION, android.Manifest.permission.ACCESS_FINE_LOCATION}) public void requestLocationUpdates(@NonNull android.location.LocationRequest, @NonNull android.location.LocationListener, @Nullable android.os.Looper);
+    method @RequiresPermission(anyOf={android.Manifest.permission.ACCESS_COARSE_LOCATION, android.Manifest.permission.ACCESS_FINE_LOCATION}) public void requestLocationUpdates(@NonNull android.location.LocationRequest, @NonNull android.app.PendingIntent);
+    method @RequiresPermission(android.Manifest.permission.LOCATION_HARDWARE) public void setLocationControllerExtraPackage(@NonNull String);
     method @RequiresPermission(android.Manifest.permission.LOCATION_HARDWARE) public void setLocationControllerExtraPackageEnabled(boolean);
-    method @RequiresPermission(android.Manifest.permission.WRITE_SECURE_SETTINGS) public void setLocationEnabledForUser(boolean, android.os.UserHandle);
-    method @Deprecated @RequiresPermission(android.Manifest.permission.WRITE_SECURE_SETTINGS) public boolean setProviderEnabledForUser(String, boolean, android.os.UserHandle);
-    method @RequiresPermission(android.Manifest.permission.LOCATION_HARDWARE) public boolean unregisterGnssBatchedLocationCallback(android.location.BatchedLocationCallback);
+    method @RequiresPermission(android.Manifest.permission.WRITE_SECURE_SETTINGS) public void setLocationEnabledForUser(boolean, @NonNull android.os.UserHandle);
+    method @Deprecated @RequiresPermission(android.Manifest.permission.WRITE_SECURE_SETTINGS) public boolean setProviderEnabledForUser(@NonNull String, boolean, @NonNull android.os.UserHandle);
+    method @RequiresPermission(android.Manifest.permission.LOCATION_HARDWARE) public boolean unregisterGnssBatchedLocationCallback(@NonNull android.location.BatchedLocationCallback);
   }
 
   public final class LocationRequest implements android.os.Parcelable {
-    method public static android.location.LocationRequest create();
-    method public static android.location.LocationRequest createFromDeprecatedCriteria(android.location.Criteria, long, float, boolean);
-    method public static android.location.LocationRequest createFromDeprecatedProvider(String, long, float, boolean);
+    method @NonNull public static android.location.LocationRequest create();
+    method @NonNull public static android.location.LocationRequest createFromDeprecatedCriteria(@NonNull android.location.Criteria, long, float, boolean);
+    method @NonNull public static android.location.LocationRequest createFromDeprecatedProvider(@NonNull String, long, float, boolean);
     method public int describeContents();
     method public long getExpireAt();
     method public long getFastestInterval();
     method public boolean getHideFromAppOps();
     method public long getInterval();
     method public int getNumUpdates();
-    method public String getProvider();
+    method @NonNull public String getProvider();
     method public int getQuality();
     method public float getSmallestDisplacement();
-    method public android.os.WorkSource getWorkSource();
+    method @Nullable public android.os.WorkSource getWorkSource();
     method public boolean isLocationSettingsIgnored();
     method public boolean isLowPowerMode();
-    method public android.location.LocationRequest setExpireAt(long);
-    method public android.location.LocationRequest setExpireIn(long);
-    method public android.location.LocationRequest setFastestInterval(long);
+    method @NonNull public android.location.LocationRequest setExpireAt(long);
+    method @NonNull public android.location.LocationRequest setExpireIn(long);
+    method @NonNull public android.location.LocationRequest setFastestInterval(long);
     method public void setHideFromAppOps(boolean);
-    method public android.location.LocationRequest setInterval(long);
-    method @RequiresPermission(android.Manifest.permission.WRITE_SECURE_SETTINGS) public android.location.LocationRequest setLocationSettingsIgnored(boolean);
-    method public android.location.LocationRequest setLowPowerMode(boolean);
-    method public android.location.LocationRequest setNumUpdates(int);
-    method public android.location.LocationRequest setProvider(String);
-    method public android.location.LocationRequest setQuality(int);
-    method public android.location.LocationRequest setSmallestDisplacement(float);
-    method public void setWorkSource(android.os.WorkSource);
+    method @NonNull public android.location.LocationRequest setInterval(long);
+    method @RequiresPermission(android.Manifest.permission.WRITE_SECURE_SETTINGS) @NonNull public android.location.LocationRequest setLocationSettingsIgnored(boolean);
+    method @NonNull public android.location.LocationRequest setLowPowerMode(boolean);
+    method @NonNull public android.location.LocationRequest setNumUpdates(int);
+    method @NonNull public android.location.LocationRequest setProvider(@NonNull String);
+    method @NonNull public android.location.LocationRequest setQuality(int);
+    method @NonNull public android.location.LocationRequest setSmallestDisplacement(float);
+    method public void setWorkSource(@Nullable android.os.WorkSource);
     method public void writeToParcel(android.os.Parcel, int);
     field public static final int ACCURACY_BLOCK = 102; // 0x66
     field public static final int ACCURACY_CITY = 104; // 0x68
     field public static final int ACCURACY_FINE = 100; // 0x64
-    field public static final android.os.Parcelable.Creator<android.location.LocationRequest> CREATOR;
+    field @NonNull public static final android.os.Parcelable.Creator<android.location.LocationRequest> CREATOR;
     field public static final int POWER_HIGH = 203; // 0xcb
     field public static final int POWER_LOW = 201; // 0xc9
     field public static final int POWER_NONE = 200; // 0xc8
@@ -3440,7 +3460,7 @@
     method public int getLossReceived();
     method @NonNull public String getPackageName();
     method public void writeToParcel(android.os.Parcel, int);
-    field public static final android.os.Parcelable.Creator<android.media.AudioFocusInfo> CREATOR;
+    field @NonNull public static final android.os.Parcelable.Creator<android.media.AudioFocusInfo> CREATOR;
   }
 
   public final class AudioFocusRequest {
@@ -3456,15 +3476,22 @@
     method public void clearAudioServerStateCallback();
     method @RequiresPermission(android.Manifest.permission.MODIFY_AUDIO_ROUTING) public int dispatchAudioFocusChange(@NonNull android.media.AudioFocusInfo, int, @NonNull android.media.audiopolicy.AudioPolicy);
     method @NonNull @RequiresPermission(android.Manifest.permission.MODIFY_AUDIO_ROUTING) public android.media.audiopolicy.AudioProductStrategies getAudioProductStrategies();
+    method @NonNull @RequiresPermission(android.Manifest.permission.MODIFY_AUDIO_ROUTING) public android.media.audiopolicy.AudioVolumeGroups getAudioVolumeGroups();
+    method @RequiresPermission(android.Manifest.permission.MODIFY_AUDIO_ROUTING) public int getMaxVolumeIndexForAttributes(@NonNull android.media.AudioAttributes);
+    method @RequiresPermission(android.Manifest.permission.MODIFY_AUDIO_ROUTING) public int getMinVolumeIndexForAttributes(@NonNull android.media.AudioAttributes);
+    method @RequiresPermission(android.Manifest.permission.MODIFY_AUDIO_ROUTING) public int getVolumeIndexForAttributes(@NonNull android.media.AudioAttributes);
     method public boolean isAudioServerRunning();
     method public boolean isHdmiSystemAudioSupported();
     method @RequiresPermission(android.Manifest.permission.MODIFY_AUDIO_ROUTING) public int registerAudioPolicy(@NonNull android.media.audiopolicy.AudioPolicy);
+    method public void registerVolumeGroupCallback(@NonNull java.util.concurrent.Executor, @NonNull android.media.AudioManager.VolumeGroupCallback);
     method @RequiresPermission(android.Manifest.permission.MODIFY_PHONE_STATE) public int requestAudioFocus(android.media.AudioManager.OnAudioFocusChangeListener, @NonNull android.media.AudioAttributes, int, int) throws java.lang.IllegalArgumentException;
     method @Deprecated @RequiresPermission(anyOf={android.Manifest.permission.MODIFY_PHONE_STATE, android.Manifest.permission.MODIFY_AUDIO_ROUTING}) public int requestAudioFocus(android.media.AudioManager.OnAudioFocusChangeListener, @NonNull android.media.AudioAttributes, int, int, android.media.audiopolicy.AudioPolicy) throws java.lang.IllegalArgumentException;
     method @RequiresPermission(android.Manifest.permission.MODIFY_AUDIO_ROUTING) public int requestAudioFocus(@NonNull android.media.AudioFocusRequest, @Nullable android.media.audiopolicy.AudioPolicy);
     method public void setAudioServerStateCallback(@NonNull java.util.concurrent.Executor, @NonNull android.media.AudioManager.AudioServerStateCallback);
     method @RequiresPermission(android.Manifest.permission.MODIFY_AUDIO_ROUTING) public void setFocusRequestResult(@NonNull android.media.AudioFocusInfo, int, @NonNull android.media.audiopolicy.AudioPolicy);
+    method @RequiresPermission(android.Manifest.permission.MODIFY_AUDIO_ROUTING) public void setVolumeIndexForAttributes(@NonNull android.media.AudioAttributes, int, int);
     method @RequiresPermission(android.Manifest.permission.MODIFY_AUDIO_ROUTING) public void unregisterAudioPolicyAsync(@NonNull android.media.audiopolicy.AudioPolicy);
+    method public void unregisterVolumeGroupCallback(@NonNull android.media.AudioManager.VolumeGroupCallback);
     field public static final int AUDIOFOCUS_FLAG_DELAY_OK = 1; // 0x1
     field public static final int AUDIOFOCUS_FLAG_LOCK = 4; // 0x4
     field public static final int AUDIOFOCUS_FLAG_PAUSES_ON_DUCKABLE_LOSS = 2; // 0x2
@@ -3478,6 +3505,11 @@
     method public void onAudioServerUp();
   }
 
+  public abstract static class AudioManager.VolumeGroupCallback {
+    ctor public AudioManager.VolumeGroupCallback();
+    method public void onAudioVolumeGroupChanged(int, int);
+  }
+
   public final class AudioPlaybackConfiguration implements android.os.Parcelable {
     method public int getClientPid();
     method public int getClientUid();
@@ -3509,11 +3541,12 @@
   }
 
   public class HwAudioSource {
+    method public boolean isPlaying();
     method public void start();
     method public void stop();
   }
 
-  public static class HwAudioSource.Builder {
+  public static final class HwAudioSource.Builder {
     ctor public HwAudioSource.Builder();
     method @NonNull public android.media.HwAudioSource build();
     method @NonNull public android.media.HwAudioSource.Builder setAudioAttributes(@NonNull android.media.AudioAttributes);
@@ -3526,7 +3559,7 @@
     field public static final int RADIO_TUNER = 1998; // 0x7ce
   }
 
-  public static class MediaTimestamp.Builder {
+  public static final class MediaTimestamp.Builder {
     ctor public MediaTimestamp.Builder();
     ctor public MediaTimestamp.Builder(@NonNull android.media.MediaTimestamp);
     method @NonNull public android.media.MediaTimestamp build();
@@ -3542,14 +3575,14 @@
     method public void stop();
   }
 
-  public static class SubtitleData.Builder {
+  public static final class SubtitleData.Builder {
     ctor public SubtitleData.Builder();
     ctor public SubtitleData.Builder(@NonNull android.media.SubtitleData);
     method @NonNull public android.media.SubtitleData build();
     method @NonNull public android.media.SubtitleData.Builder setSubtitleData(int, long, long, @NonNull byte[]);
   }
 
-  public static class TimedMetaData.Builder {
+  public static final class TimedMetaData.Builder {
     ctor public TimedMetaData.Builder();
     ctor public TimedMetaData.Builder(@NonNull android.media.TimedMetaData);
     method @NonNull public android.media.TimedMetaData build();
@@ -3649,10 +3682,12 @@
     method @Nullable public android.media.audiopolicy.AudioProductStrategy getById(int);
     method public int getLegacyStreamTypeForAudioAttributes(@NonNull android.media.AudioAttributes);
     method @Nullable public android.media.audiopolicy.AudioProductStrategy getProductStrategyForAudioAttributes(@NonNull android.media.AudioAttributes);
-    method public java.util.Iterator<android.media.audiopolicy.AudioProductStrategy> iterator();
+    method public int getVolumeGroupIdForAttributes(@NonNull android.media.AudioAttributes);
+    method public int getVolumeGroupIdForLegacyStreamType(int);
+    method @NonNull public java.util.Iterator<android.media.audiopolicy.AudioProductStrategy> iterator();
     method public int size();
     method public void writeToParcel(@NonNull android.os.Parcel, int);
-    field public static final android.os.Parcelable.Creator<android.media.audiopolicy.AudioProductStrategies> CREATOR;
+    field @NonNull public static final android.os.Parcelable.Creator<android.media.audiopolicy.AudioProductStrategies> CREATOR;
   }
 
   public final class AudioProductStrategy implements android.os.Parcelable {
@@ -3661,7 +3696,28 @@
     method public int getId();
     method @NonNull public String name();
     method public void writeToParcel(@NonNull android.os.Parcel, int);
-    field public static final android.os.Parcelable.Creator<android.media.audiopolicy.AudioProductStrategy> CREATOR;
+    field @NonNull public static final android.os.Parcelable.Creator<android.media.audiopolicy.AudioProductStrategy> CREATOR;
+  }
+
+  public final class AudioVolumeGroup implements android.os.Parcelable {
+    method public int describeContents();
+    method @NonNull public java.util.List<android.media.AudioAttributes> getAudioAttributes();
+    method public int getId();
+    method @NonNull public int[] getLegacyStreamTypes();
+    method @NonNull public String name();
+    method public void writeToParcel(@NonNull android.os.Parcel, int);
+    field public static final android.os.Parcelable.Creator<android.media.audiopolicy.AudioVolumeGroup> CREATOR;
+  }
+
+  public final class AudioVolumeGroups implements java.lang.Iterable<android.media.audiopolicy.AudioVolumeGroup> android.os.Parcelable {
+    ctor public AudioVolumeGroups();
+    method public int describeContents();
+    method @Nullable public android.media.audiopolicy.AudioVolumeGroup getById(int);
+    method @NonNull public java.util.Iterator<android.media.audiopolicy.AudioVolumeGroup> iterator();
+    method public int size();
+    method public void writeToParcel(@NonNull android.os.Parcel, int);
+    field public static final android.os.Parcelable.Creator<android.media.audiopolicy.AudioVolumeGroups> CREATOR;
+    field public static final int DEFAULT_VOLUME_GROUP = -1; // 0xffffffff
   }
 
 }
@@ -3796,7 +3852,7 @@
     field public static final int CABLE_CONNECTION_STATUS_CONNECTED = 1; // 0x1
     field public static final int CABLE_CONNECTION_STATUS_DISCONNECTED = 2; // 0x2
     field public static final int CABLE_CONNECTION_STATUS_UNKNOWN = 0; // 0x0
-    field public static final android.os.Parcelable.Creator<android.media.tv.TvInputHardwareInfo> CREATOR;
+    field @NonNull public static final android.os.Parcelable.Creator<android.media.tv.TvInputHardwareInfo> CREATOR;
     field public static final int TV_INPUT_TYPE_COMPONENT = 6; // 0x6
     field public static final int TV_INPUT_TYPE_COMPOSITE = 3; // 0x3
     field public static final int TV_INPUT_TYPE_DISPLAY_PORT = 10; // 0xa
@@ -3904,7 +3960,7 @@
     method public int getStreamId();
     method public int getType();
     method public void writeToParcel(android.os.Parcel, int);
-    field public static final android.os.Parcelable.Creator<android.media.tv.TvStreamConfig> CREATOR;
+    field @NonNull public static final android.os.Parcelable.Creator<android.media.tv.TvStreamConfig> CREATOR;
     field public static final int STREAM_TYPE_BUFFER_PRODUCER = 2; // 0x2
     field public static final int STREAM_TYPE_INDEPENDENT_VIDEO_SOURCE = 1; // 0x1
   }
@@ -3990,13 +4046,15 @@
     method @RequiresPermission(android.Manifest.permission.PACKET_KEEPALIVE_OFFLOAD) public android.net.SocketKeepalive createSocketKeepalive(@NonNull android.net.Network, @NonNull java.net.Socket, @NonNull java.util.concurrent.Executor, @NonNull android.net.SocketKeepalive.Callback);
     method public boolean getAvoidBadWifi();
     method @RequiresPermission(android.Manifest.permission.LOCAL_MAC_ADDRESS) public String getCaptivePortalServerUrl();
-    method @RequiresPermission(android.Manifest.permission.TETHER_PRIVILEGED) public void getLatestTetheringEntitlementValue(int, boolean, @NonNull android.net.ConnectivityManager.TetheringEntitlementValueListener, @Nullable android.os.Handler);
+    method @RequiresPermission(android.Manifest.permission.TETHER_PRIVILEGED) public void getLatestTetheringEntitlementResult(int, boolean, @NonNull java.util.concurrent.Executor, @NonNull android.net.ConnectivityManager.OnTetheringEntitlementResultListener);
     method @RequiresPermission(anyOf={android.Manifest.permission.TETHER_PRIVILEGED, android.Manifest.permission.WRITE_SETTINGS}) public boolean isTetheringSupported();
+    method @RequiresPermission(android.Manifest.permission.TETHER_PRIVILEGED) public void registerTetheringEventCallback(@NonNull java.util.concurrent.Executor, @NonNull android.net.ConnectivityManager.OnTetheringEventCallback);
     method @RequiresPermission(anyOf={"android.permission.NETWORK_SETTINGS", android.Manifest.permission.NETWORK_SETUP_WIZARD, "android.permission.NETWORK_STACK"}) public void setAirplaneMode(boolean);
     method @RequiresPermission(android.net.NetworkStack.PERMISSION_MAINLINE_NETWORK_STACK) public void startCaptivePortalApp(android.net.Network, android.os.Bundle);
     method @RequiresPermission(android.Manifest.permission.TETHER_PRIVILEGED) public void startTethering(int, boolean, android.net.ConnectivityManager.OnStartTetheringCallback);
     method @RequiresPermission(android.Manifest.permission.TETHER_PRIVILEGED) public void startTethering(int, boolean, android.net.ConnectivityManager.OnStartTetheringCallback, android.os.Handler);
     method @RequiresPermission(android.Manifest.permission.TETHER_PRIVILEGED) public void stopTethering(int);
+    method @RequiresPermission(android.Manifest.permission.TETHER_PRIVILEGED) public void unregisterTetheringEventCallback(@NonNull android.net.ConnectivityManager.OnTetheringEventCallback);
     field public static final String EXTRA_CAPTIVE_PORTAL_PROBE_SPEC = "android.net.extra.CAPTIVE_PORTAL_PROBE_SPEC";
     field public static final String EXTRA_CAPTIVE_PORTAL_USER_AGENT = "android.net.extra.CAPTIVE_PORTAL_USER_AGENT";
     field public static final int TETHERING_BLUETOOTH = 2; // 0x2
@@ -4013,11 +4071,15 @@
     method public void onTetheringStarted();
   }
 
-  public abstract static class ConnectivityManager.TetheringEntitlementValueListener {
-    ctor public ConnectivityManager.TetheringEntitlementValueListener();
+  public static interface ConnectivityManager.OnTetheringEntitlementResultListener {
     method public void onEntitlementResult(int);
   }
 
+  public abstract static class ConnectivityManager.OnTetheringEventCallback {
+    ctor public ConnectivityManager.OnTetheringEventCallback();
+    method public void onUpstreamChanged(@Nullable android.net.Network);
+  }
+
   public final class IpPrefix implements android.os.Parcelable {
     ctor public IpPrefix(java.net.InetAddress, int);
     ctor public IpPrefix(String);
@@ -4041,8 +4103,8 @@
 
   public class LinkAddress implements android.os.Parcelable {
     ctor public LinkAddress(java.net.InetAddress, int, int, int);
-    ctor public LinkAddress(java.net.InetAddress, int);
-    ctor public LinkAddress(String);
+    ctor public LinkAddress(@NonNull java.net.InetAddress, int);
+    ctor public LinkAddress(@NonNull String);
     ctor public LinkAddress(String, int, int);
     method public boolean isGlobalPreferred();
     method public boolean isIPv4();
@@ -4101,7 +4163,7 @@
     ctor public NetworkKey(android.net.WifiKey);
     method public int describeContents();
     method public void writeToParcel(android.os.Parcel, int);
-    field public static final android.os.Parcelable.Creator<android.net.NetworkKey> CREATOR;
+    field @NonNull public static final android.os.Parcelable.Creator<android.net.NetworkKey> CREATOR;
     field public static final int TYPE_WIFI = 1; // 0x1
     field public final int type;
     field public final android.net.WifiKey wifiKey;
@@ -4152,7 +4214,7 @@
     method public byte lookupScore(int);
     method public byte lookupScore(int, boolean);
     method public void writeToParcel(android.os.Parcel, int);
-    field public static final android.os.Parcelable.Creator<android.net.RssiCurve> CREATOR;
+    field @NonNull public static final android.os.Parcelable.Creator<android.net.RssiCurve> CREATOR;
     field public final int activeNetworkRssiBoost;
     field public final int bucketWidth;
     field public final byte[] rssiBuckets;
@@ -4169,7 +4231,7 @@
     field public static final String ATTRIBUTES_KEY_BADGING_CURVE = "android.net.attributes.key.BADGING_CURVE";
     field public static final String ATTRIBUTES_KEY_HAS_CAPTIVE_PORTAL = "android.net.attributes.key.HAS_CAPTIVE_PORTAL";
     field public static final String ATTRIBUTES_KEY_RANKING_SCORE_OFFSET = "android.net.attributes.key.RANKING_SCORE_OFFSET";
-    field public static final android.os.Parcelable.Creator<android.net.ScoredNetwork> CREATOR;
+    field @NonNull public static final android.os.Parcelable.Creator<android.net.ScoredNetwork> CREATOR;
     field @Nullable public final android.os.Bundle attributes;
     field public final boolean meteredHint;
     field public final android.net.NetworkKey networkKey;
@@ -4191,7 +4253,7 @@
     method public void setGateway(java.net.InetAddress);
     method public void setIpAddress(android.net.LinkAddress);
     method public void writeToParcel(android.os.Parcel, int);
-    field public static final android.os.Parcelable.Creator<android.net.StaticIpConfiguration> CREATOR;
+    field @NonNull public static final android.os.Parcelable.Creator<android.net.StaticIpConfiguration> CREATOR;
   }
 
   public class TrafficStats {
@@ -4215,7 +4277,7 @@
     ctor public WifiKey(String, String);
     method public int describeContents();
     method public void writeToParcel(android.os.Parcel, int);
-    field public static final android.os.Parcelable.Creator<android.net.WifiKey> CREATOR;
+    field @NonNull public static final android.os.Parcelable.Creator<android.net.WifiKey> CREATOR;
     field public final String bssid;
     field public final String ssid;
   }
@@ -4424,19 +4486,16 @@
 package android.net.util {
 
   public class SocketUtils {
-    method public static void addArpEntry(java.net.Inet4Address, android.net.MacAddress, String, java.io.FileDescriptor) throws java.io.IOException;
-    method public static void attachControlPacketFilter(java.io.FileDescriptor, int) throws java.net.SocketException;
-    method public static void attachDhcpFilter(java.io.FileDescriptor) throws java.net.SocketException;
-    method public static void attachRaFilter(java.io.FileDescriptor, int) throws java.net.SocketException;
-    method public static void bindSocket(java.io.FileDescriptor, java.net.SocketAddress) throws android.system.ErrnoException, java.net.SocketException;
-    method public static void bindSocketToInterface(java.io.FileDescriptor, String) throws android.system.ErrnoException;
-    method public static void closeSocket(java.io.FileDescriptor) throws java.io.IOException;
-    method public static void connectSocket(java.io.FileDescriptor, java.net.SocketAddress) throws android.system.ErrnoException, java.net.SocketException;
+    method public static void addArpEntry(@NonNull java.net.Inet4Address, @NonNull android.net.MacAddress, @NonNull String, @NonNull java.io.FileDescriptor) throws java.io.IOException;
+    method public static void attachControlPacketFilter(@NonNull java.io.FileDescriptor, int) throws java.net.SocketException;
+    method public static void attachDhcpFilter(@NonNull java.io.FileDescriptor) throws java.net.SocketException;
+    method public static void attachRaFilter(@NonNull java.io.FileDescriptor, int) throws java.net.SocketException;
+    method public static void bindSocketToInterface(@NonNull java.io.FileDescriptor, @NonNull String) throws android.system.ErrnoException;
+    method public static void closeSocket(@Nullable java.io.FileDescriptor) throws java.io.IOException;
     method public static java.net.SocketAddress makeNetlinkSocketAddress(int, int);
     method public static java.net.SocketAddress makePacketSocketAddress(short, int);
-    method public static java.net.SocketAddress makePacketSocketAddress(int, byte[]);
-    method public static void sendTo(java.io.FileDescriptor, byte[], int, int, int, java.net.SocketAddress) throws android.system.ErrnoException, java.net.SocketException;
-    method public static void setSocketTimeValueOption(java.io.FileDescriptor, int, int, long) throws android.system.ErrnoException;
+    method public static java.net.SocketAddress makePacketSocketAddress(int, @NonNull byte[]);
+    method public static void setSocketTimeValueOption(@NonNull java.io.FileDescriptor, int, int, long) throws android.system.ErrnoException;
   }
 
 }
@@ -4558,7 +4617,7 @@
     ctor @Deprecated public RttManager.ResponderConfig();
     method @Deprecated public int describeContents();
     method @Deprecated public void writeToParcel(android.os.Parcel, int);
-    field @Deprecated public static final android.os.Parcelable.Creator<android.net.wifi.RttManager.ResponderConfig> CREATOR;
+    field @Deprecated @NonNull public static final android.os.Parcelable.Creator<android.net.wifi.RttManager.ResponderConfig> CREATOR;
     field @Deprecated public int centerFreq0;
     field @Deprecated public int centerFreq1;
     field @Deprecated public int channelWidth;
@@ -4683,13 +4742,13 @@
 
   public class WifiManager {
     method @RequiresPermission("android.permission.WIFI_UPDATE_USABILITY_STATS_SCORE") public void addWifiUsabilityStatsListener(@NonNull java.util.concurrent.Executor, @NonNull android.net.wifi.WifiManager.WifiUsabilityStatsListener);
-    method @RequiresPermission(anyOf={"android.permission.NETWORK_SETTINGS", android.Manifest.permission.NETWORK_SETUP_WIZARD, "android.permission.NETWORK_STACK"}) public void connect(android.net.wifi.WifiConfiguration, android.net.wifi.WifiManager.ActionListener);
-    method @RequiresPermission(anyOf={"android.permission.NETWORK_SETTINGS", android.Manifest.permission.NETWORK_SETUP_WIZARD, "android.permission.NETWORK_STACK"}) public void connect(int, android.net.wifi.WifiManager.ActionListener);
-    method @RequiresPermission(anyOf={"android.permission.NETWORK_SETTINGS", android.Manifest.permission.NETWORK_SETUP_WIZARD, "android.permission.NETWORK_STACK"}) public void disable(int, android.net.wifi.WifiManager.ActionListener);
-    method @RequiresPermission(anyOf={"android.permission.NETWORK_SETTINGS", android.Manifest.permission.NETWORK_SETUP_WIZARD, "android.permission.NETWORK_STACK"}) public void forget(int, android.net.wifi.WifiManager.ActionListener);
-    method @RequiresPermission(anyOf={"android.permission.NETWORK_SETTINGS", android.Manifest.permission.NETWORK_SETUP_WIZARD}) public java.util.List<android.util.Pair<android.net.wifi.WifiConfiguration,java.util.Map<java.lang.Integer,java.util.List<android.net.wifi.ScanResult>>>> getAllMatchingWifiConfigs(@NonNull java.util.List<android.net.wifi.ScanResult>);
-    method @RequiresPermission(anyOf={"android.permission.NETWORK_SETTINGS", android.Manifest.permission.NETWORK_SETUP_WIZARD}) public java.util.Map<android.net.wifi.hotspot2.OsuProvider,java.util.List<android.net.wifi.ScanResult>> getMatchingOsuProviders(java.util.List<android.net.wifi.ScanResult>);
-    method @RequiresPermission(anyOf={"android.permission.NETWORK_SETTINGS", android.Manifest.permission.NETWORK_SETUP_WIZARD}) public java.util.Map<android.net.wifi.hotspot2.OsuProvider,android.net.wifi.hotspot2.PasspointConfiguration> getMatchingPasspointConfigsForOsuProviders(@NonNull java.util.Set<android.net.wifi.hotspot2.OsuProvider>);
+    method @RequiresPermission(anyOf={"android.permission.NETWORK_SETTINGS", android.Manifest.permission.NETWORK_SETUP_WIZARD, "android.permission.NETWORK_STACK"}) public void connect(@NonNull android.net.wifi.WifiConfiguration, @Nullable android.net.wifi.WifiManager.ActionListener);
+    method @RequiresPermission(anyOf={"android.permission.NETWORK_SETTINGS", android.Manifest.permission.NETWORK_SETUP_WIZARD, "android.permission.NETWORK_STACK"}) public void connect(int, @Nullable android.net.wifi.WifiManager.ActionListener);
+    method @RequiresPermission(anyOf={"android.permission.NETWORK_SETTINGS", android.Manifest.permission.NETWORK_SETUP_WIZARD, "android.permission.NETWORK_STACK"}) public void disable(int, @Nullable android.net.wifi.WifiManager.ActionListener);
+    method @RequiresPermission(anyOf={"android.permission.NETWORK_SETTINGS", android.Manifest.permission.NETWORK_SETUP_WIZARD, "android.permission.NETWORK_STACK"}) public void forget(int, @Nullable android.net.wifi.WifiManager.ActionListener);
+    method @NonNull @RequiresPermission(anyOf={"android.permission.NETWORK_SETTINGS", android.Manifest.permission.NETWORK_SETUP_WIZARD}) public java.util.List<android.util.Pair<android.net.wifi.WifiConfiguration,java.util.Map<java.lang.Integer,java.util.List<android.net.wifi.ScanResult>>>> getAllMatchingWifiConfigs(@NonNull java.util.List<android.net.wifi.ScanResult>);
+    method @NonNull @RequiresPermission(anyOf={"android.permission.NETWORK_SETTINGS", android.Manifest.permission.NETWORK_SETUP_WIZARD}) public java.util.Map<android.net.wifi.hotspot2.OsuProvider,java.util.List<android.net.wifi.ScanResult>> getMatchingOsuProviders(java.util.List<android.net.wifi.ScanResult>);
+    method @NonNull @RequiresPermission(anyOf={"android.permission.NETWORK_SETTINGS", android.Manifest.permission.NETWORK_SETUP_WIZARD}) public java.util.Map<android.net.wifi.hotspot2.OsuProvider,android.net.wifi.hotspot2.PasspointConfiguration> getMatchingPasspointConfigsForOsuProviders(@NonNull java.util.Set<android.net.wifi.hotspot2.OsuProvider>);
     method @RequiresPermission(allOf={android.Manifest.permission.ACCESS_FINE_LOCATION, android.Manifest.permission.ACCESS_WIFI_STATE, android.Manifest.permission.READ_WIFI_CREDENTIAL}) public java.util.List<android.net.wifi.WifiConfiguration> getPrivilegedConfiguredNetworks();
     method @RequiresPermission(android.Manifest.permission.ACCESS_WIFI_STATE) public android.net.wifi.WifiConfiguration getWifiApConfiguration();
     method @RequiresPermission(android.Manifest.permission.ACCESS_WIFI_STATE) public int getWifiApState();
@@ -4698,13 +4757,13 @@
     method @RequiresPermission(android.Manifest.permission.ACCESS_WIFI_STATE) public boolean isWifiApEnabled();
     method public boolean isWifiScannerSupported();
     method @RequiresPermission("android.permission.WIFI_UPDATE_USABILITY_STATS_SCORE") public void removeWifiUsabilityStatsListener(@NonNull android.net.wifi.WifiManager.WifiUsabilityStatsListener);
-    method @RequiresPermission(anyOf={"android.permission.NETWORK_SETTINGS", android.Manifest.permission.NETWORK_SETUP_WIZARD, "android.permission.NETWORK_STACK"}) public void save(android.net.wifi.WifiConfiguration, android.net.wifi.WifiManager.ActionListener);
+    method @RequiresPermission(anyOf={"android.permission.NETWORK_SETTINGS", android.Manifest.permission.NETWORK_SETUP_WIZARD, "android.permission.NETWORK_STACK"}) public void save(@NonNull android.net.wifi.WifiConfiguration, @Nullable android.net.wifi.WifiManager.ActionListener);
     method @RequiresPermission("android.permission.WIFI_SET_DEVICE_MOBILITY_STATE") public void setDeviceMobilityState(int);
     method @RequiresPermission(android.Manifest.permission.CHANGE_WIFI_STATE) public boolean setWifiApConfiguration(android.net.wifi.WifiConfiguration);
     method @RequiresPermission(anyOf={"android.permission.NETWORK_SETTINGS", android.Manifest.permission.NETWORK_SETUP_WIZARD}) public void startEasyConnectAsConfiguratorInitiator(@NonNull String, int, int, @NonNull java.util.concurrent.Executor, @NonNull android.net.wifi.EasyConnectStatusCallback);
     method @RequiresPermission(anyOf={"android.permission.NETWORK_SETTINGS", android.Manifest.permission.NETWORK_SETUP_WIZARD}) public void startEasyConnectAsEnrolleeInitiator(@NonNull String, @NonNull java.util.concurrent.Executor, @NonNull android.net.wifi.EasyConnectStatusCallback);
     method @RequiresPermission(android.Manifest.permission.UPDATE_DEVICE_STATS) public boolean startScan(android.os.WorkSource);
-    method @RequiresPermission(anyOf={"android.permission.NETWORK_SETTINGS", android.Manifest.permission.NETWORK_SETUP_WIZARD}) public void startSubscriptionProvisioning(android.net.wifi.hotspot2.OsuProvider, android.net.wifi.hotspot2.ProvisioningCallback, @Nullable android.os.Handler);
+    method @RequiresPermission(anyOf={"android.permission.NETWORK_SETTINGS", android.Manifest.permission.NETWORK_SETUP_WIZARD}) public void startSubscriptionProvisioning(@NonNull android.net.wifi.hotspot2.OsuProvider, @NonNull java.util.concurrent.Executor, @NonNull android.net.wifi.hotspot2.ProvisioningCallback);
     method @RequiresPermission(anyOf={"android.permission.NETWORK_SETTINGS", android.Manifest.permission.NETWORK_SETUP_WIZARD}) public void stopEasyConnectSession();
     method @RequiresPermission("android.permission.WIFI_UPDATE_USABILITY_STATS_SCORE") public void updateWifiUsabilityScore(int, int, int);
     field public static final int CHANGE_REASON_ADDED = 0; // 0x0
@@ -4752,7 +4811,7 @@
     ctor public WifiNetworkConnectionStatistics(android.net.wifi.WifiNetworkConnectionStatistics);
     method public int describeContents();
     method public void writeToParcel(android.os.Parcel, int);
-    field public static final android.os.Parcelable.Creator<android.net.wifi.WifiNetworkConnectionStatistics> CREATOR;
+    field @NonNull public static final android.os.Parcelable.Creator<android.net.wifi.WifiNetworkConnectionStatistics> CREATOR;
     field public int numConnection;
     field public int numUsage;
   }
@@ -4879,7 +4938,7 @@
   public final class WifiUsabilityStatsEntry 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.net.wifi.WifiUsabilityStatsEntry> CREATOR;
+    field @NonNull public static final android.os.Parcelable.Creator<android.net.wifi.WifiUsabilityStatsEntry> CREATOR;
     field public static final int PROBE_STATUS_FAILURE = 3; // 0x3
     field public static final int PROBE_STATUS_NO_PROBE = 1; // 0x1
     field public static final int PROBE_STATUS_SUCCESS = 2; // 0x2
@@ -4917,8 +4976,8 @@
     method @Deprecated public android.net.NetworkSpecifier createNetworkSpecifierPmk(@NonNull android.net.wifi.aware.PeerHandle, @NonNull byte[]);
   }
 
-  public static class WifiAwareManager.NetworkSpecifierBuilder {
-    method @NonNull public android.net.wifi.aware.WifiAwareManager.NetworkSpecifierBuilder setPmk(@NonNull byte[]);
+  public static final class WifiAwareNetworkSpecifier.Builder {
+    method @NonNull public android.net.wifi.aware.WifiAwareNetworkSpecifier.Builder setPmk(@NonNull byte[]);
   }
 
   public class WifiAwareSession implements java.lang.AutoCloseable {
@@ -4931,10 +4990,10 @@
 
   public final class OsuProvider implements android.os.Parcelable {
     method public int describeContents();
-    method public String getFriendlyName();
-    method public android.net.Uri getServerUri();
+    method @Nullable public String getFriendlyName();
+    method @Nullable public android.net.Uri getServerUri();
     method public void writeToParcel(android.os.Parcel, int);
-    field public static final android.os.Parcelable.Creator<android.net.wifi.hotspot2.OsuProvider> CREATOR;
+    field @NonNull public static final android.os.Parcelable.Creator<android.net.wifi.hotspot2.OsuProvider> CREATOR;
   }
 
   public abstract class ProvisioningCallback {
@@ -5004,7 +5063,7 @@
     field public static final int CHANNEL_WIDTH_40MHZ = 1; // 0x1
     field public static final int CHANNEL_WIDTH_80MHZ = 2; // 0x2
     field public static final int CHANNEL_WIDTH_80MHZ_PLUS_MHZ = 4; // 0x4
-    field public static final android.os.Parcelable.Creator<android.net.wifi.rtt.ResponderConfig> CREATOR;
+    field @NonNull public static final android.os.Parcelable.Creator<android.net.wifi.rtt.ResponderConfig> CREATOR;
     field public static final int PREAMBLE_HT = 1; // 0x1
     field public static final int PREAMBLE_LEGACY = 0; // 0x0
     field public static final int PREAMBLE_VHT = 2; // 0x2
@@ -5044,9 +5103,9 @@
     method @RequiresPermission(android.Manifest.permission.WRITE_SECURE_SETTINGS) public boolean disableNdefPush();
     method @RequiresPermission(android.Manifest.permission.WRITE_SECURE_SETTINGS) public boolean enable();
     method @RequiresPermission(android.Manifest.permission.WRITE_SECURE_SETTINGS) public boolean enableNdefPush();
+    method @RequiresPermission(android.Manifest.permission.WRITE_SECURE_SETTINGS) public boolean enableSecureNfc(boolean);
     method @RequiresPermission(android.Manifest.permission.WRITE_SECURE_SETTINGS) public boolean removeNfcUnlockHandler(android.nfc.NfcAdapter.NfcUnlockHandler);
     method public void setNdefPushMessage(android.nfc.NdefMessage, android.app.Activity, int);
-    method @RequiresPermission(android.Manifest.permission.WRITE_SECURE_SETTINGS) public boolean setNfcSecure(boolean);
     field public static final int FLAG_NDEF_PUSH_NO_CONFIRM = 1; // 0x1
   }
 
@@ -5086,7 +5145,7 @@
     method public boolean getForceBackgroundCheck();
     method public int getLocationMode();
     method public void writeToParcel(android.os.Parcel, int);
-    field public static final android.os.Parcelable.Creator<android.os.BatterySaverPolicyConfig> CREATOR;
+    field @NonNull public static final android.os.Parcelable.Creator<android.os.BatterySaverPolicyConfig> CREATOR;
   }
 
   public static final class BatterySaverPolicyConfig.Builder {
@@ -5123,10 +5182,10 @@
 
   public static interface Binder.ProxyTransactListener {
     method public void onTransactEnded(@Nullable Object);
-    method public Object onTransactStarted(android.os.IBinder, int);
+    method @Nullable public Object onTransactStarted(@NonNull android.os.IBinder, int);
   }
 
-  public class BugreportManager {
+  public final class BugreportManager {
     method @RequiresPermission(android.Manifest.permission.DUMP) public void cancelBugreport();
     method @RequiresPermission(android.Manifest.permission.DUMP) public void startBugreport(@NonNull android.os.ParcelFileDescriptor, @Nullable android.os.ParcelFileDescriptor, @NonNull android.os.BugreportParams, @NonNull java.util.concurrent.Executor, @NonNull android.os.BugreportManager.BugreportCallback);
   }
@@ -5135,7 +5194,7 @@
     ctor public BugreportManager.BugreportCallback();
     method public void onError(int);
     method public void onFinished();
-    method public void onProgress(float);
+    method public void onProgress(@FloatRange(from=0.0f, to=100.0f) float);
     field public static final int BUGREPORT_ERROR_ANOTHER_REPORT_IN_PROGRESS = 5; // 0x5
     field public static final int BUGREPORT_ERROR_INVALID_INPUT = 1; // 0x1
     field public static final int BUGREPORT_ERROR_RUNTIME = 2; // 0x2
@@ -5144,7 +5203,7 @@
   }
 
   public final class BugreportParams {
-    ctor public BugreportParams(@android.os.BugreportParams.BugreportMode int);
+    ctor public BugreportParams(int);
     method public int getMode();
     field public static final int BUGREPORT_MODE_FULL = 0; // 0x0
     field public static final int BUGREPORT_MODE_INTERACTIVE = 1; // 0x1
@@ -5154,9 +5213,6 @@
     field public static final int BUGREPORT_MODE_WIFI = 5; // 0x5
   }
 
-  @java.lang.annotation.Retention(java.lang.annotation.RetentionPolicy.SOURCE) @IntDef(prefix={"BUGREPORT_MODE_"}, value={android.os.BugreportParams.BUGREPORT_MODE_FULL, android.os.BugreportParams.BUGREPORT_MODE_INTERACTIVE, android.os.BugreportParams.BUGREPORT_MODE_REMOTE, android.os.BugreportParams.BUGREPORT_MODE_WEAR, android.os.BugreportParams.BUGREPORT_MODE_TELEPHONY, android.os.BugreportParams.BUGREPORT_MODE_WIFI}) public static @interface BugreportParams.BugreportMode {
-  }
-
   public static class Build.VERSION {
     field public static final String PREVIEW_SDK_FINGERPRINT;
   }
@@ -5175,11 +5231,11 @@
   }
 
   public class Environment {
-    method public static java.io.File getOdmDirectory();
-    method public static java.io.File getOemDirectory();
-    method public static java.io.File getProductDirectory();
-    method public static java.io.File getProductServicesDirectory();
-    method public static java.io.File getVendorDirectory();
+    method @NonNull public static java.io.File getOdmDirectory();
+    method @NonNull public static java.io.File getOemDirectory();
+    method @NonNull public static java.io.File getProductDirectory();
+    method @NonNull public static java.io.File getProductServicesDirectory();
+    method @NonNull public static java.io.File getVendorDirectory();
   }
 
   public class HidlSupport {
@@ -5234,7 +5290,7 @@
     method public final void putInt64Array(long, long[]);
     method public final void putInt8(long, byte);
     method public final void putInt8Array(long, byte[]);
-    method public final void putNativeHandle(long, android.os.NativeHandle);
+    method public final void putNativeHandle(long, @Nullable android.os.NativeHandle);
     method public final void putString(long, String);
     method public static Boolean[] wrapArray(@NonNull boolean[]);
     method public static Long[] wrapArray(@NonNull long[]);
@@ -5254,7 +5310,7 @@
     method public final double readDouble();
     method public final java.util.ArrayList<java.lang.Double> readDoubleVector();
     method public final android.os.HwBlob readEmbeddedBuffer(long, long, long, boolean);
-    method public final android.os.NativeHandle readEmbeddedNativeHandle(long, long);
+    method @Nullable public final android.os.NativeHandle readEmbeddedNativeHandle(long, long);
     method public final float readFloat();
     method public final java.util.ArrayList<java.lang.Float> readFloatVector();
     method public final short readInt16();
@@ -5265,8 +5321,8 @@
     method public final java.util.ArrayList<java.lang.Long> readInt64Vector();
     method public final byte readInt8();
     method public final java.util.ArrayList<java.lang.Byte> readInt8Vector();
-    method public final android.os.NativeHandle readNativeHandle();
-    method public final java.util.ArrayList<android.os.NativeHandle> readNativeHandleVector();
+    method @Nullable public final android.os.NativeHandle readNativeHandle();
+    method @NonNull public final java.util.ArrayList<android.os.NativeHandle> readNativeHandleVector();
     method public final String readString();
     method public final java.util.ArrayList<java.lang.String> readStringVector();
     method public final android.os.IHwBinder readStrongBinder();
@@ -5290,8 +5346,8 @@
     method public final void writeInt8(byte);
     method public final void writeInt8Vector(java.util.ArrayList<java.lang.Byte>);
     method public final void writeInterfaceToken(String);
-    method public final void writeNativeHandle(android.os.NativeHandle);
-    method public final void writeNativeHandleVector(java.util.ArrayList<android.os.NativeHandle>);
+    method public final void writeNativeHandle(@Nullable android.os.NativeHandle);
+    method public final void writeNativeHandleVector(@NonNull java.util.ArrayList<android.os.NativeHandle>);
     method public final void writeStatus(int);
     method public final void writeString(String);
     method public final void writeStringVector(java.util.ArrayList<java.lang.String>);
@@ -5347,7 +5403,7 @@
     method public long getPrivacyPolicy();
     method public long getTimestamp();
     method public void writeToParcel(android.os.Parcel, int);
-    field public static final android.os.Parcelable.Creator<android.os.IncidentManager.IncidentReport> CREATOR;
+    field @NonNull public static final android.os.Parcelable.Creator<android.os.IncidentManager.IncidentReport> CREATOR;
   }
 
   public static class IncidentManager.PendingReport {
@@ -5371,7 +5427,7 @@
     method public void setAll(boolean);
     method public void setPrivacyPolicy(int);
     method public void writeToParcel(android.os.Parcel, int);
-    field public static final android.os.Parcelable.Creator<android.os.IncidentReportArgs> CREATOR;
+    field @NonNull public static final android.os.Parcelable.Creator<android.os.IncidentReportArgs> CREATOR;
   }
 
   public final class LocaleList implements android.os.Parcelable {
@@ -5383,10 +5439,10 @@
     ctor public NativeHandle(@NonNull java.io.FileDescriptor, boolean);
     ctor public NativeHandle(@NonNull java.io.FileDescriptor[], @NonNull int[], boolean);
     method public void close() throws java.io.IOException;
-    method public android.os.NativeHandle dup() throws java.io.IOException;
-    method public java.io.FileDescriptor getFileDescriptor();
-    method public java.io.FileDescriptor[] getFileDescriptors();
-    method public int[] getInts();
+    method @NonNull public android.os.NativeHandle dup() throws java.io.IOException;
+    method @NonNull public java.io.FileDescriptor getFileDescriptor();
+    method @NonNull public java.io.FileDescriptor[] getFileDescriptors();
+    method @NonNull public int[] getInts();
     method public boolean hasSingleFileDescriptor();
   }
 
@@ -5425,7 +5481,7 @@
     method public int describeContents();
     method public void sendResult(@Nullable android.os.Bundle);
     method public void writeToParcel(android.os.Parcel, int);
-    field public static final android.os.Parcelable.Creator<android.os.RemoteCallback> CREATOR;
+    field @NonNull public static final android.os.Parcelable.Creator<android.os.RemoteCallback> CREATOR;
   }
 
   public static interface RemoteCallback.OnResultListener {
@@ -5451,7 +5507,7 @@
     method public boolean isValueType(int);
     method public void writeToParcel(android.os.Parcel, int);
     field public static final int BOOLEAN_VALUE_TYPE = 5; // 0x5
-    field public static final android.os.Parcelable.Creator<android.os.StatsDimensionsValue> CREATOR;
+    field @NonNull public static final android.os.Parcelable.Creator<android.os.StatsDimensionsValue> CREATOR;
     field public static final int FLOAT_VALUE_TYPE = 6; // 0x6
     field public static final int INT_VALUE_TYPE = 3; // 0x3
     field public static final int LONG_VALUE_TYPE = 4; // 0x4
@@ -5540,9 +5596,9 @@
     method public boolean isSystem();
     method public static int myUserId();
     method public static android.os.UserHandle of(int);
-    field public static final android.os.UserHandle ALL;
-    field public static final android.os.UserHandle CURRENT;
-    field public static final android.os.UserHandle SYSTEM;
+    field @NonNull public static final android.os.UserHandle ALL;
+    field @NonNull public static final android.os.UserHandle CURRENT;
+    field @NonNull public static final android.os.UserHandle SYSTEM;
   }
 
   public class UserManager {
@@ -5553,7 +5609,7 @@
     method @RequiresPermission(android.Manifest.permission.MANAGE_USERS) public android.os.PersistableBundle getSeedAccountOptions();
     method @RequiresPermission(android.Manifest.permission.MANAGE_USERS) public String getSeedAccountType();
     method @RequiresPermission(android.Manifest.permission.MANAGE_USERS) public long[] getSerialNumbersOfUsers(boolean);
-    method @RequiresPermission(android.Manifest.permission.MANAGE_USERS) public android.graphics.Bitmap getUserIcon();
+    method @Nullable @RequiresPermission(android.Manifest.permission.MANAGE_USERS) public android.graphics.Bitmap getUserIcon();
     method @Deprecated @android.os.UserManager.UserRestrictionSource @RequiresPermission(android.Manifest.permission.MANAGE_USERS) public int getUserRestrictionSource(String, android.os.UserHandle);
     method @RequiresPermission(android.Manifest.permission.MANAGE_USERS) public java.util.List<android.os.UserManager.EnforcingUser> getUserRestrictionSources(String, android.os.UserHandle);
     method public boolean hasRestrictedProfiles();
@@ -5564,8 +5620,8 @@
     method @RequiresPermission(android.Manifest.permission.MANAGE_USERS) public boolean isPrimaryUser();
     method @RequiresPermission(android.Manifest.permission.MANAGE_USERS) public boolean isRestrictedProfile();
     method @RequiresPermission(android.Manifest.permission.MANAGE_USERS) public boolean removeUser(android.os.UserHandle);
-    method @RequiresPermission(android.Manifest.permission.MANAGE_USERS) public void setUserIcon(android.graphics.Bitmap);
-    method @RequiresPermission(android.Manifest.permission.MANAGE_USERS) public void setUserName(String);
+    method @RequiresPermission(android.Manifest.permission.MANAGE_USERS) public void setUserIcon(@NonNull android.graphics.Bitmap);
+    method @RequiresPermission(android.Manifest.permission.MANAGE_USERS) public void setUserName(@Nullable String);
     field public static final String ACTION_USER_RESTRICTIONS_CHANGED = "android.os.action.USER_RESTRICTIONS_CHANGED";
     field @Deprecated public static final String DISALLOW_OEM_UNLOCK = "no_oem_unlock";
     field public static final String DISALLOW_RUN_IN_BACKGROUND = "no_run_in_background";
@@ -5580,7 +5636,7 @@
     method public android.os.UserHandle getUserHandle();
     method @android.os.UserManager.UserRestrictionSource public int getUserRestrictionSource();
     method public void writeToParcel(android.os.Parcel, int);
-    field public static final android.os.Parcelable.Creator<android.os.UserManager.EnforcingUser> CREATOR;
+    field @NonNull public static final android.os.Parcelable.Creator<android.os.UserManager.EnforcingUser> CREATOR;
   }
 
   @IntDef(flag=true, prefix={"RESTRICTION_"}, value={android.os.UserManager.RESTRICTION_NOT_SET, android.os.UserManager.RESTRICTION_SOURCE_SYSTEM, android.os.UserManager.RESTRICTION_SOURCE_DEVICE_OWNER, android.os.UserManager.RESTRICTION_SOURCE_PROFILE_OWNER}) @java.lang.annotation.Retention(java.lang.annotation.RetentionPolicy.SOURCE) public static @interface UserManager.UserRestrictionSource {
@@ -5597,7 +5653,7 @@
     method public String getAttributionTag();
     method public int getAttributionUid();
     method public void writeToParcel(android.os.Parcel, int);
-    field public static final android.os.Parcelable.Creator<android.os.WorkSource.WorkChain> CREATOR;
+    field @NonNull public static final android.os.Parcelable.Creator<android.os.WorkSource.WorkChain> CREATOR;
   }
 
 }
@@ -5632,12 +5688,11 @@
   public abstract class PermissionControllerService extends android.app.Service {
     ctor public PermissionControllerService();
     method public final void attachBaseContext(android.content.Context);
-    method public final android.os.IBinder onBind(android.content.Intent);
+    method @NonNull public final android.os.IBinder onBind(android.content.Intent);
     method public abstract int onCountPermissionApps(@NonNull java.util.List<java.lang.String>, int);
     method @NonNull public abstract java.util.List<android.permission.RuntimePermissionPresentationInfo> onGetAppPermissions(@NonNull String);
     method @NonNull public abstract java.util.List<android.permission.RuntimePermissionUsageInfo> onGetPermissionUsages(boolean, long);
     method public abstract void onGetRuntimePermissionsBackup(@NonNull android.os.UserHandle, @NonNull java.io.OutputStream);
-    method public abstract boolean onIsApplicationQualifiedForRole(@NonNull String, @NonNull String);
     method @BinderThread public abstract boolean onRestoreDelayedRuntimePermissionsBackup(@NonNull String, @NonNull android.os.UserHandle);
     method @BinderThread public abstract void onRestoreRuntimePermissionsBackup(@NonNull android.os.UserHandle, @NonNull java.io.InputStream);
     method public abstract void onRevokeRuntimePermission(@NonNull String, @NonNull String);
@@ -5657,13 +5712,13 @@
   }
 
   public final class RuntimePermissionPresentationInfo implements android.os.Parcelable {
-    ctor public RuntimePermissionPresentationInfo(CharSequence, boolean, boolean);
+    ctor public RuntimePermissionPresentationInfo(@NonNull CharSequence, boolean, boolean);
     method public int describeContents();
     method @NonNull public CharSequence getLabel();
     method public boolean isGranted();
     method public boolean isStandard();
     method public void writeToParcel(android.os.Parcel, int);
-    field public static final android.os.Parcelable.Creator<android.permission.RuntimePermissionPresentationInfo> CREATOR;
+    field @NonNull public static final android.os.Parcelable.Creator<android.permission.RuntimePermissionPresentationInfo> CREATOR;
   }
 
   public final class RuntimePermissionUsageInfo implements android.os.Parcelable {
@@ -5672,7 +5727,7 @@
     method public int getAppAccessCount();
     method @NonNull public CharSequence getName();
     method public void writeToParcel(android.os.Parcel, int);
-    field public static final android.os.Parcelable.Creator<android.permission.RuntimePermissionUsageInfo> CREATOR;
+    field @NonNull public static final android.os.Parcelable.Creator<android.permission.RuntimePermissionUsageInfo> CREATOR;
   }
 
 }
@@ -5726,7 +5781,7 @@
     method public int describeContents();
     method @NonNull public android.content.ComponentName getComponentName();
     method public void writeToParcel(android.os.Parcel, int);
-    field public static final android.os.Parcelable.Creator<android.printservice.PrintServiceInfo> CREATOR;
+    field @NonNull public static final android.os.Parcelable.Creator<android.printservice.PrintServiceInfo> CREATOR;
   }
 
 }
@@ -5743,7 +5798,7 @@
     method public CharSequence getPackageName();
     method public boolean recommendsMultiVendorService();
     method public void writeToParcel(android.os.Parcel, int);
-    field public static final android.os.Parcelable.Creator<android.printservice.recommendation.RecommendationInfo> CREATOR;
+    field @NonNull public static final android.os.Parcelable.Creator<android.printservice.recommendation.RecommendationInfo> CREATOR;
   }
 
   public abstract class RecommendationService extends android.app.Service {
@@ -5790,34 +5845,30 @@
   }
 
   public final class DeviceConfig {
+    method @RequiresPermission(android.Manifest.permission.READ_DEVICE_CONFIG) public static void addOnPropertiesChangedListener(@NonNull String, @NonNull java.util.concurrent.Executor, @NonNull android.provider.DeviceConfig.OnPropertiesChangedListener);
     method @RequiresPermission(android.Manifest.permission.READ_DEVICE_CONFIG) public static void addOnPropertyChangedListener(@NonNull String, @NonNull java.util.concurrent.Executor, @NonNull android.provider.DeviceConfig.OnPropertyChangedListener);
+    method @RequiresPermission(android.Manifest.permission.READ_DEVICE_CONFIG) public static boolean getBoolean(String, String, boolean);
+    method @RequiresPermission(android.Manifest.permission.READ_DEVICE_CONFIG) public static float getFloat(String, String, float);
+    method @RequiresPermission(android.Manifest.permission.READ_DEVICE_CONFIG) public static int getInt(String, String, int);
+    method @RequiresPermission(android.Manifest.permission.READ_DEVICE_CONFIG) public static long getLong(String, String, long);
     method @RequiresPermission(android.Manifest.permission.READ_DEVICE_CONFIG) public static String getProperty(String, String);
-    method public static void removeOnPropertyChangedListener(android.provider.DeviceConfig.OnPropertyChangedListener);
+    method @RequiresPermission(android.Manifest.permission.READ_DEVICE_CONFIG) public static String getString(String, String, String);
+    method public static void removeOnPropertiesChangedListener(@NonNull android.provider.DeviceConfig.OnPropertiesChangedListener);
+    method public static void removeOnPropertyChangedListener(@NonNull android.provider.DeviceConfig.OnPropertyChangedListener);
     method @RequiresPermission(android.Manifest.permission.WRITE_DEVICE_CONFIG) public static void resetToDefaults(int, @Nullable String);
     method @RequiresPermission(android.Manifest.permission.WRITE_DEVICE_CONFIG) public static boolean setProperty(String, String, String, boolean);
+    field public static final String NAMESPACE_ACTIVITY_MANAGER = "activity_manager";
+    field public static final String NAMESPACE_ACTIVITY_MANAGER_NATIVE_BOOT = "activity_manager_native_boot";
     field public static final String NAMESPACE_AUTOFILL = "autofill";
+    field public static final String NAMESPACE_CONNECTIVITY = "connectivity";
     field public static final String NAMESPACE_CONTENT_CAPTURE = "content_capture";
     field public static final String NAMESPACE_GAME_DRIVER = "game_driver";
     field public static final String NAMESPACE_INPUT_NATIVE_BOOT = "input_native_boot";
+    field public static final String NAMESPACE_MEDIA_NATIVE = "media_native";
     field public static final String NAMESPACE_NETD_NATIVE = "netd_native";
-  }
-
-  public static interface DeviceConfig.ActivityManager {
-    field public static final String KEY_COMPACT_ACTION_1 = "compact_action_1";
-    field public static final String KEY_COMPACT_ACTION_2 = "compact_action_2";
-    field public static final String KEY_COMPACT_STATSD_SAMPLE_RATE = "compact_statsd_sample_rate";
-    field public static final String KEY_COMPACT_THROTTLE_1 = "compact_throttle_1";
-    field public static final String KEY_COMPACT_THROTTLE_2 = "compact_throttle_2";
-    field public static final String KEY_COMPACT_THROTTLE_3 = "compact_throttle_3";
-    field public static final String KEY_COMPACT_THROTTLE_4 = "compact_throttle_4";
-    field public static final String KEY_MAX_CACHED_PROCESSES = "max_cached_processes";
-    field public static final String KEY_USE_COMPACTION = "use_compaction";
-    field public static final String NAMESPACE = "activity_manager";
-  }
-
-  public static interface DeviceConfig.ActivityManagerNativeBoot {
-    field public static final String NAMESPACE = "activity_manager_native_boot";
-    field public static final String OFFLOAD_QUEUE_ENABLED = "offload_queue_enabled";
+    field public static final String NAMESPACE_RUNTIME_NATIVE_BOOT = "runtime_native_boot";
+    field public static final String NAMESPACE_SYSTEMUI = "systemui";
+    field public static final String NAMESPACE_TEXTCLASSIFIER = "textclassifier";
   }
 
   public static interface DeviceConfig.AttentionManagerService {
@@ -5838,16 +5889,8 @@
     field public static final String NAMESPACE = "intelligence_attention";
   }
 
-  public static interface DeviceConfig.MediaNative {
-    field public static final String NAMESPACE = "media_native";
-  }
-
-  public static interface DeviceConfig.NotificationAssistant {
-    field public static final String GENERATE_ACTIONS = "generate_actions";
-    field public static final String GENERATE_REPLIES = "generate_replies";
-    field public static final String MAX_MESSAGES_TO_EXTRACT = "max_messages_to_extract";
-    field public static final String MAX_SUGGESTIONS = "max_suggestions";
-    field public static final String NAMESPACE = "notification_assistant";
+  public static interface DeviceConfig.OnPropertiesChangedListener {
+    method public void onPropertiesChanged(@NonNull android.provider.DeviceConfig.Properties);
   }
 
   public static interface DeviceConfig.OnPropertyChangedListener {
@@ -5860,6 +5903,16 @@
     field public static final String PROPERTY_PERMISSIONS_HUB_ENABLED = "permissions_hub_enabled";
   }
 
+  public static class DeviceConfig.Properties {
+    method public boolean getBoolean(@NonNull String, boolean);
+    method public float getFloat(@NonNull String, float);
+    method public int getInt(@NonNull String, int);
+    method @NonNull public java.util.Set<java.lang.String> getKeyset();
+    method public long getLong(@NonNull String, long);
+    method @NonNull public String getNamespace();
+    method @Nullable public String getString(@NonNull String, @Nullable String);
+  }
+
   public static interface DeviceConfig.Rollback {
     field public static final String BOOT_NAMESPACE = "rollback_boot";
     field public static final String ENABLE_ROLLBACK_TIMEOUT = "enable_rollback_timeout";
@@ -5876,10 +5929,6 @@
     field public static final String NAMESPACE = "runtime_native";
   }
 
-  public static interface DeviceConfig.RuntimeNativeBoot {
-    field public static final String NAMESPACE = "runtime_native_boot";
-  }
-
   public static interface DeviceConfig.Scheduler {
     field public static final String ENABLE_FAST_METRICS_COLLECTION = "enable_fast_metrics_collection";
     field public static final String NAMESPACE = "scheduler";
@@ -5898,8 +5947,8 @@
   }
 
   public final class DocumentsContract {
-    method public static boolean isManageMode(android.net.Uri);
-    method public static android.net.Uri setManageMode(android.net.Uri);
+    method public static boolean isManageMode(@NonNull android.net.Uri);
+    method @NonNull public static android.net.Uri setManageMode(@NonNull android.net.Uri);
     field public static final String ACTION_DOCUMENT_ROOT_SETTINGS = "android.provider.action.DOCUMENT_ROOT_SETTINGS";
     field public static final String ACTION_MANAGE_DOCUMENT = "android.provider.action.MANAGE_DOCUMENT";
     field public static final String EXTRA_SHOW_ADVANCED = "android.provider.extra.SHOW_ADVANCED";
@@ -6024,6 +6073,7 @@
   }
 
   public final class Settings {
+    field public static final String ACTION_ACCESSIBILITY_DETAILS_SETTINGS = "android.settings.ACCESSIBILITY_DETAILS_SETTINGS";
     field public static final String ACTION_ENTERPRISE_PRIVACY_SETTINGS = "android.settings.ENTERPRISE_PRIVACY_SETTINGS";
     field public static final String ACTION_LOCATION_CONTROLLER_EXTRA_PACKAGE_SETTINGS = "android.settings.LOCATION_CONTROLLER_EXTRA_PACKAGE_SETTINGS";
     field public static final String ACTION_REQUEST_ENABLE_CONTENT_CAPTURE = "android.settings.REQUEST_ENABLE_CONTENT_CAPTURE";
@@ -6050,6 +6100,7 @@
     field public static final String CARRIER_APP_WHITELIST = "carrier_app_whitelist";
     field public static final String DATA_STALL_CONSECUTIVE_DNS_TIMEOUT_THRESHOLD = "data_stall_consecutive_dns_timeout_threshold";
     field public static final String DATA_STALL_EVALUATION_TYPE = "data_stall_evaluation_type";
+    field public static final int DATA_STALL_EVALUATION_TYPE_DNS = 1; // 0x1
     field public static final String DATA_STALL_MIN_EVALUATE_INTERVAL = "data_stall_min_evaluate_interval";
     field public static final String DATA_STALL_VALID_DNS_TIME_THRESHOLD = "data_stall_valid_dns_time_threshold";
     field public static final String DEFAULT_SM_DP_PLUS = "default_sm_dp_plus";
@@ -6085,6 +6136,7 @@
     field public static final String LAST_SETUP_SHOWN = "last_setup_shown";
     field public static final String LOCATION_ACCESS_CHECK_DELAY_MILLIS = "location_access_check_delay_millis";
     field public static final String LOCATION_ACCESS_CHECK_INTERVAL_MILLIS = "location_access_check_interval_millis";
+    field public static final String LOCATION_PERMISSIONS_UPGRADE_TO_Q_MODE = "location_permissions_upgrade_to_q_mode";
     field public static final String LOCK_SCREEN_ALLOW_PRIVATE_NOTIFICATIONS = "lock_screen_allow_private_notifications";
     field public static final String LOCK_SCREEN_SHOW_NOTIFICATIONS = "lock_screen_show_notifications";
     field public static final String MANUAL_RINGER_TOGGLE_COUNT = "manual_ringer_toggle_count";
@@ -6133,21 +6185,6 @@
 
 }
 
-package android.rolecontrollerservice {
-
-  public abstract class RoleControllerService extends android.app.Service {
-    ctor public RoleControllerService();
-    method public abstract void onAddRoleHolder(@NonNull String, @NonNull String, int, @NonNull android.app.role.RoleManagerCallback);
-    method @Nullable public final android.os.IBinder onBind(@Nullable android.content.Intent);
-    method public abstract void onClearRoleHolders(@NonNull String, int, @NonNull android.app.role.RoleManagerCallback);
-    method public abstract void onGrantDefaultRoles(@NonNull android.app.role.RoleManagerCallback);
-    method public abstract void onRemoveRoleHolder(@NonNull String, @NonNull String, int, @NonNull android.app.role.RoleManagerCallback);
-    method public abstract void onSmsKillSwitchToggled(boolean);
-    field public static final String SERVICE_INTERFACE = "android.rolecontrollerservice.RoleControllerService";
-  }
-
-}
-
 package android.security.keystore {
 
   public abstract class AttestationUtils {
@@ -6158,8 +6195,8 @@
   }
 
   public class DeviceIdAttestationException extends java.lang.Exception {
-    ctor public DeviceIdAttestationException(String);
-    ctor public DeviceIdAttestationException(String, Throwable);
+    ctor public DeviceIdAttestationException(@Nullable String);
+    ctor public DeviceIdAttestationException(@Nullable String, @Nullable Throwable);
   }
 
 }
@@ -6183,7 +6220,7 @@
     method @NonNull public byte[] getSecret();
     method public int getUserSecretType();
     method public void writeToParcel(android.os.Parcel, int);
-    field public static final android.os.Parcelable.Creator<android.security.keystore.recovery.KeyChainProtectionParams> CREATOR;
+    field @NonNull public static final android.os.Parcelable.Creator<android.security.keystore.recovery.KeyChainProtectionParams> CREATOR;
     field public static final int TYPE_LOCKSCREEN = 100; // 0x64
     field public static final int UI_FORMAT_PASSWORD = 2; // 0x2
     field public static final int UI_FORMAT_PATTERN = 3; // 0x3
@@ -6193,10 +6230,10 @@
   public static class KeyChainProtectionParams.Builder {
     ctor public KeyChainProtectionParams.Builder();
     method @NonNull public android.security.keystore.recovery.KeyChainProtectionParams build();
-    method public android.security.keystore.recovery.KeyChainProtectionParams.Builder setKeyDerivationParams(@NonNull android.security.keystore.recovery.KeyDerivationParams);
-    method public android.security.keystore.recovery.KeyChainProtectionParams.Builder setLockScreenUiFormat(int);
-    method public android.security.keystore.recovery.KeyChainProtectionParams.Builder setSecret(@NonNull byte[]);
-    method public android.security.keystore.recovery.KeyChainProtectionParams.Builder setUserSecretType(int);
+    method @NonNull public android.security.keystore.recovery.KeyChainProtectionParams.Builder setKeyDerivationParams(@NonNull android.security.keystore.recovery.KeyDerivationParams);
+    method @NonNull public android.security.keystore.recovery.KeyChainProtectionParams.Builder setLockScreenUiFormat(int);
+    method @NonNull public android.security.keystore.recovery.KeyChainProtectionParams.Builder setSecret(@NonNull byte[]);
+    method @NonNull public android.security.keystore.recovery.KeyChainProtectionParams.Builder setUserSecretType(int);
   }
 
   public final class KeyChainSnapshot implements android.os.Parcelable {
@@ -6210,7 +6247,7 @@
     method @NonNull public java.security.cert.CertPath getTrustedHardwareCertPath();
     method @NonNull public java.util.List<android.security.keystore.recovery.WrappedApplicationKey> getWrappedApplicationKeys();
     method public void writeToParcel(android.os.Parcel, int);
-    field public static final android.os.Parcelable.Creator<android.security.keystore.recovery.KeyChainSnapshot> CREATOR;
+    field @NonNull public static final android.os.Parcelable.Creator<android.security.keystore.recovery.KeyChainSnapshot> CREATOR;
   }
 
   public final class KeyDerivationParams implements android.os.Parcelable {
@@ -6223,7 +6260,7 @@
     method public void writeToParcel(android.os.Parcel, int);
     field public static final int ALGORITHM_SCRYPT = 2; // 0x2
     field public static final int ALGORITHM_SHA256 = 1; // 0x1
-    field public static final android.os.Parcelable.Creator<android.security.keystore.recovery.KeyDerivationParams> CREATOR;
+    field @NonNull public static final android.os.Parcelable.Creator<android.security.keystore.recovery.KeyDerivationParams> CREATOR;
   }
 
   public class LockScreenRequiredException extends java.security.GeneralSecurityException {
@@ -6271,15 +6308,15 @@
     method @NonNull public byte[] getEncryptedKeyMaterial();
     method @Nullable public byte[] getMetadata();
     method public void writeToParcel(android.os.Parcel, int);
-    field public static final android.os.Parcelable.Creator<android.security.keystore.recovery.WrappedApplicationKey> CREATOR;
+    field @NonNull public static final android.os.Parcelable.Creator<android.security.keystore.recovery.WrappedApplicationKey> CREATOR;
   }
 
   public static class WrappedApplicationKey.Builder {
     ctor public WrappedApplicationKey.Builder();
     method @NonNull public android.security.keystore.recovery.WrappedApplicationKey build();
-    method public android.security.keystore.recovery.WrappedApplicationKey.Builder setAlias(@NonNull String);
-    method public android.security.keystore.recovery.WrappedApplicationKey.Builder setEncryptedKeyMaterial(@NonNull byte[]);
-    method public android.security.keystore.recovery.WrappedApplicationKey.Builder setMetadata(@Nullable byte[]);
+    method @NonNull public android.security.keystore.recovery.WrappedApplicationKey.Builder setAlias(@NonNull String);
+    method @NonNull public android.security.keystore.recovery.WrappedApplicationKey.Builder setEncryptedKeyMaterial(@NonNull byte[]);
+    method @NonNull public android.security.keystore.recovery.WrappedApplicationKey.Builder setMetadata(@Nullable byte[]);
   }
 
 }
@@ -6372,9 +6409,8 @@
 
   public static final class FillResponse.Builder {
     ctor public FillResponse.Builder();
-    method public android.service.autofill.augmented.FillResponse build();
-    method public android.service.autofill.augmented.FillResponse.Builder setFillWindow(@NonNull android.service.autofill.augmented.FillWindow);
-    method public android.service.autofill.augmented.FillResponse.Builder setIgnoredIds(@NonNull java.util.List<android.view.autofill.AutofillId>);
+    method @NonNull public android.service.autofill.augmented.FillResponse build();
+    method @NonNull public android.service.autofill.augmented.FillResponse.Builder setFillWindow(@NonNull android.service.autofill.augmented.FillWindow);
   }
 
   public final class FillWindow implements java.lang.AutoCloseable {
@@ -6397,17 +6433,28 @@
 
   public abstract class ApnService extends android.app.Service {
     ctor public ApnService();
-    method public android.os.IBinder onBind(android.content.Intent);
-    method @WorkerThread public abstract java.util.List<android.content.ContentValues> onRestoreApns(int);
+    method @NonNull public android.os.IBinder onBind(@Nullable android.content.Intent);
+    method @WorkerThread @NonNull public abstract java.util.List<android.content.ContentValues> onRestoreApns(int);
   }
 
 }
 
 package android.service.contentcapture {
 
+  public final class ActivityEvent implements android.os.Parcelable {
+    method public int describeContents();
+    method @NonNull public android.content.ComponentName getComponentName();
+    method public int getEventType();
+    method public void writeToParcel(@NonNull android.os.Parcel, int);
+    field @NonNull public static final android.os.Parcelable.Creator<android.service.contentcapture.ActivityEvent> CREATOR;
+    field public static final int TYPE_ACTIVITY_PAUSED = 2; // 0x2
+    field public static final int TYPE_ACTIVITY_RESUMED = 1; // 0x1
+  }
+
   public abstract class ContentCaptureService extends android.app.Service {
     ctor public ContentCaptureService();
     method public final void disableContentCaptureServices();
+    method public void onActivityEvent(@NonNull android.service.contentcapture.ActivityEvent);
     method public void onActivitySnapshot(@NonNull android.view.contentcapture.ContentCaptureSessionId, @NonNull android.service.contentcapture.SnapshotData);
     method public void onConnected();
     method public void onContentCaptureEvent(@NonNull android.view.contentcapture.ContentCaptureSessionId, @NonNull android.view.contentcapture.ContentCaptureEvent);
@@ -6415,18 +6462,17 @@
     method public void onDestroyContentCaptureSession(@NonNull android.view.contentcapture.ContentCaptureSessionId);
     method public void onDisconnected();
     method public void onUserDataRemovalRequest(@NonNull android.view.contentcapture.UserDataRemovalRequest);
-    method @Deprecated public final void setContentCaptureWhitelist(@Nullable java.util.List<java.lang.String>, @Nullable java.util.List<android.content.ComponentName>);
     method public final void setContentCaptureWhitelist(@Nullable java.util.Set<java.lang.String>, @Nullable java.util.Set<android.content.ComponentName>);
     field public static final String SERVICE_INTERFACE = "android.service.contentcapture.ContentCaptureService";
   }
 
   public final class SnapshotData implements android.os.Parcelable {
     method public int describeContents();
-    method public android.app.assist.AssistContent getAssistContent();
-    method public android.os.Bundle getAssistData();
-    method public android.app.assist.AssistStructure getAssistStructure();
+    method @Nullable public android.app.assist.AssistContent getAssistContent();
+    method @NonNull public android.os.Bundle getAssistData();
+    method @NonNull public android.app.assist.AssistStructure getAssistStructure();
     method public void writeToParcel(@NonNull android.os.Parcel, int);
-    field public static final android.os.Parcelable.Creator<android.service.contentcapture.SnapshotData> CREATOR;
+    field @NonNull public static final android.os.Parcelable.Creator<android.service.contentcapture.SnapshotData> CREATOR;
   }
 
 }
@@ -6435,10 +6481,14 @@
 
   public abstract class ContentSuggestionsService extends android.app.Service {
     ctor public ContentSuggestionsService();
-    method public abstract void classifyContentSelections(@NonNull android.app.contentsuggestions.ClassificationsRequest, @NonNull android.app.contentsuggestions.ContentSuggestionsManager.ClassificationsCallback);
-    method public abstract void notifyInteraction(@NonNull String, @NonNull android.os.Bundle);
-    method public abstract void processContextImage(int, @Nullable android.graphics.Bitmap, @NonNull android.os.Bundle);
-    method public abstract void suggestContentSelections(@NonNull android.app.contentsuggestions.SelectionsRequest, @NonNull android.app.contentsuggestions.ContentSuggestionsManager.SelectionsCallback);
+    method @Deprecated public void classifyContentSelections(@NonNull android.app.contentsuggestions.ClassificationsRequest, @NonNull android.app.contentsuggestions.ContentSuggestionsManager.ClassificationsCallback);
+    method @Deprecated public void notifyInteraction(@NonNull String, @NonNull android.os.Bundle);
+    method public void onClassifyContentSelections(@NonNull android.app.contentsuggestions.ClassificationsRequest, @NonNull android.app.contentsuggestions.ContentSuggestionsManager.ClassificationsCallback);
+    method public void onNotifyInteraction(@NonNull String, @NonNull android.os.Bundle);
+    method public void onProcessContextImage(int, @Nullable android.graphics.Bitmap, @NonNull android.os.Bundle);
+    method public void onSuggestContentSelections(@NonNull android.app.contentsuggestions.SelectionsRequest, @NonNull android.app.contentsuggestions.ContentSuggestionsManager.SelectionsCallback);
+    method @Deprecated public void processContextImage(int, @Nullable android.graphics.Bitmap, @NonNull android.os.Bundle);
+    method @Deprecated public void suggestContentSelections(@NonNull android.app.contentsuggestions.SelectionsRequest, @NonNull android.app.contentsuggestions.ContentSuggestionsManager.SelectionsCallback);
     field public static final String SERVICE_INTERFACE = "android.service.contentsuggestions.ContentSuggestionsService";
   }
 
@@ -6453,7 +6503,7 @@
     method public int getResolvableErrors();
     method public int getResult();
     method public void writeToParcel(android.os.Parcel, int);
-    field public static final android.os.Parcelable.Creator<android.service.euicc.DownloadSubscriptionResult> CREATOR;
+    field @NonNull public static final android.os.Parcelable.Creator<android.service.euicc.DownloadSubscriptionResult> CREATOR;
   }
 
   public final class EuiccProfileInfo implements android.os.Parcelable {
@@ -6470,7 +6520,7 @@
     method public boolean hasPolicyRule(@android.service.euicc.EuiccProfileInfo.PolicyRule int);
     method public boolean hasPolicyRules();
     method public void writeToParcel(android.os.Parcel, int);
-    field public static final android.os.Parcelable.Creator<android.service.euicc.EuiccProfileInfo> CREATOR;
+    field @NonNull public static final android.os.Parcelable.Creator<android.service.euicc.EuiccProfileInfo> CREATOR;
     field public static final int POLICY_RULE_DELETE_AFTER_DISABLING = 4; // 0x4
     field public static final int POLICY_RULE_DO_NOT_DELETE = 2; // 0x2
     field public static final int POLICY_RULE_DO_NOT_DISABLE = 1; // 0x1
@@ -6561,7 +6611,7 @@
     method @Nullable public java.util.List<android.telephony.euicc.DownloadableSubscription> getDownloadableSubscriptions();
     method public int getResult();
     method public void writeToParcel(android.os.Parcel, int);
-    field public static final android.os.Parcelable.Creator<android.service.euicc.GetDefaultDownloadableSubscriptionListResult> CREATOR;
+    field @NonNull public static final android.os.Parcelable.Creator<android.service.euicc.GetDefaultDownloadableSubscriptionListResult> CREATOR;
   }
 
   public final class GetDownloadableSubscriptionMetadataResult implements android.os.Parcelable {
@@ -6570,7 +6620,7 @@
     method @Nullable public android.telephony.euicc.DownloadableSubscription getDownloadableSubscription();
     method public int getResult();
     method public void writeToParcel(android.os.Parcel, int);
-    field public static final android.os.Parcelable.Creator<android.service.euicc.GetDownloadableSubscriptionMetadataResult> CREATOR;
+    field @NonNull public static final android.os.Parcelable.Creator<android.service.euicc.GetDownloadableSubscriptionMetadataResult> CREATOR;
   }
 
   public final class GetEuiccProfileInfoListResult implements android.os.Parcelable {
@@ -6580,7 +6630,7 @@
     method @Nullable public java.util.List<android.service.euicc.EuiccProfileInfo> getProfiles();
     method public int getResult();
     method public void writeToParcel(android.os.Parcel, int);
-    field public static final android.os.Parcelable.Creator<android.service.euicc.GetEuiccProfileInfoListResult> CREATOR;
+    field @NonNull public static final android.os.Parcelable.Creator<android.service.euicc.GetEuiccProfileInfoListResult> CREATOR;
   }
 
 }
@@ -6589,13 +6639,78 @@
 
   public final class Adjustment implements android.os.Parcelable {
     ctor public Adjustment(String, String, android.os.Bundle, CharSequence, int);
+    ctor public Adjustment(@NonNull String, @NonNull String, @NonNull android.os.Bundle, @NonNull CharSequence, @NonNull android.os.UserHandle);
     ctor protected Adjustment(android.os.Parcel);
+    method public int describeContents();
+    method @NonNull public CharSequence getExplanation();
+    method @NonNull public String getKey();
+    method @NonNull public String getPackage();
+    method @NonNull public android.os.Bundle getSignals();
     method public int getUser();
+    method @NonNull public android.os.UserHandle getUserHandle();
+    method public void writeToParcel(android.os.Parcel, int);
+    field @NonNull public static final android.os.Parcelable.Creator<android.service.notification.Adjustment> CREATOR;
+    field public static final String KEY_CONTEXTUAL_ACTIONS = "key_contextual_actions";
+    field public static final String KEY_IMPORTANCE = "key_importance";
     field public static final String KEY_PEOPLE = "key_people";
+    field public static final String KEY_SNOOZE_CRITERIA = "key_snooze_criteria";
+    field public static final String KEY_TEXT_REPLIES = "key_text_replies";
+    field public static final String KEY_USER_SENTIMENT = "key_user_sentiment";
+  }
+
+  public abstract class NotificationAssistantService extends android.service.notification.NotificationListenerService {
+    ctor public NotificationAssistantService();
+    method public final void adjustNotification(@NonNull android.service.notification.Adjustment);
+    method public final void adjustNotifications(@NonNull java.util.List<android.service.notification.Adjustment>);
+    method public void onActionInvoked(@NonNull String, @NonNull android.app.Notification.Action, int);
+    method @NonNull public final android.os.IBinder onBind(@Nullable android.content.Intent);
+    method public void onNotificationDirectReplied(@NonNull String);
+    method @Nullable public abstract android.service.notification.Adjustment onNotificationEnqueued(@NonNull android.service.notification.StatusBarNotification);
+    method @Nullable public android.service.notification.Adjustment onNotificationEnqueued(@NonNull android.service.notification.StatusBarNotification, @NonNull android.app.NotificationChannel);
+    method public void onNotificationExpansionChanged(@NonNull String, boolean, boolean);
+    method public abstract void onNotificationSnoozedUntilContext(@NonNull android.service.notification.StatusBarNotification, @NonNull String);
+    method public void onNotificationsSeen(@NonNull java.util.List<java.lang.String>);
+    method public void onSuggestedReplySent(@NonNull String, @NonNull CharSequence, int);
+    method public final void unsnoozeNotification(@NonNull String);
+    field public static final String SERVICE_INTERFACE = "android.service.notification.NotificationAssistantService";
+    field public static final int SOURCE_FROM_APP = 0; // 0x0
+    field public static final int SOURCE_FROM_ASSISTANT = 1; // 0x1
+  }
+
+  public abstract class NotificationListenerService extends android.app.Service {
+    method public void onNotificationRemoved(@NonNull android.service.notification.StatusBarNotification, @NonNull android.service.notification.NotificationListenerService.RankingMap, @NonNull android.service.notification.NotificationStats, int);
   }
 
   public final class NotificationStats implements android.os.Parcelable {
+    ctor public NotificationStats();
     ctor protected NotificationStats(android.os.Parcel);
+    method public int describeContents();
+    method public int getDismissalSentiment();
+    method public int getDismissalSurface();
+    method public boolean hasDirectReplied();
+    method public boolean hasExpanded();
+    method public boolean hasInteracted();
+    method public boolean hasSeen();
+    method public boolean hasSnoozed();
+    method public boolean hasViewedSettings();
+    method public void setDirectReplied();
+    method public void setDismissalSentiment(int);
+    method public void setDismissalSurface(int);
+    method public void setExpanded();
+    method public void setSeen();
+    method public void setSnoozed();
+    method public void setViewedSettings();
+    method public void writeToParcel(android.os.Parcel, int);
+    field @NonNull public static final android.os.Parcelable.Creator<android.service.notification.NotificationStats> CREATOR;
+    field public static final int DISMISSAL_AOD = 2; // 0x2
+    field public static final int DISMISSAL_NOT_DISMISSED = -1; // 0xffffffff
+    field public static final int DISMISSAL_OTHER = 0; // 0x0
+    field public static final int DISMISSAL_PEEK = 1; // 0x1
+    field public static final int DISMISSAL_SHADE = 3; // 0x3
+    field public static final int DISMISS_SENTIMENT_NEGATIVE = 0; // 0x0
+    field public static final int DISMISS_SENTIMENT_NEUTRAL = 1; // 0x1
+    field public static final int DISMISS_SENTIMENT_POSITIVE = 2; // 0x2
+    field public static final int DISMISS_SENTIMENT_UNKNOWN = -1000; // 0xfffffc18
   }
 
   public final class SnoozeCriterion implements android.os.Parcelable {
@@ -6606,7 +6721,7 @@
     method public CharSequence getExplanation();
     method public String getId();
     method public void writeToParcel(android.os.Parcel, int);
-    field public static final android.os.Parcelable.Creator<android.service.notification.SnoozeCriterion> CREATOR;
+    field @NonNull public static final android.os.Parcelable.Creator<android.service.notification.SnoozeCriterion> CREATOR;
   }
 
 }
@@ -6678,7 +6793,7 @@
     method public void setSelectProbability(float);
     method public void setTimeSpentScore(float);
     method public void writeToParcel(android.os.Parcel, int);
-    field public static final android.os.Parcelable.Creator<android.service.resolver.ResolverTarget> CREATOR;
+    field @NonNull public static final android.os.Parcelable.Creator<android.service.resolver.ResolverTarget> CREATOR;
   }
 
 }
@@ -6694,7 +6809,7 @@
     method public CharSequence getSummary();
     method public CharSequence getTitle();
     method public void writeToParcel(android.os.Parcel, int);
-    field public static final android.os.Parcelable.Creator<android.service.settings.suggestions.Suggestion> CREATOR;
+    field @NonNull public static final android.os.Parcelable.Creator<android.service.settings.suggestions.Suggestion> CREATOR;
     field public static final int FLAG_HAS_BUTTON = 1; // 0x1
   }
 
@@ -6735,15 +6850,15 @@
     method public static android.view.textclassifier.TextClassifier getDefaultTextClassifierImplementation(@NonNull android.content.Context);
     method @Deprecated public final android.view.textclassifier.TextClassifier getLocalTextClassifier();
     method @Nullable public final android.os.IBinder onBind(android.content.Intent);
-    method public abstract void onClassifyText(@Nullable android.view.textclassifier.TextClassificationSessionId, @NonNull android.view.textclassifier.TextClassification.Request, @NonNull android.os.CancellationSignal, @NonNull android.service.textclassifier.TextClassifierService.Callback<android.view.textclassifier.TextClassification>);
-    method public void onCreateTextClassificationSession(@NonNull android.view.textclassifier.TextClassificationContext, @NonNull android.view.textclassifier.TextClassificationSessionId);
-    method public void onDestroyTextClassificationSession(@NonNull android.view.textclassifier.TextClassificationSessionId);
-    method public void onDetectLanguage(@Nullable android.view.textclassifier.TextClassificationSessionId, @NonNull android.view.textclassifier.TextLanguage.Request, @NonNull android.os.CancellationSignal, @NonNull android.service.textclassifier.TextClassifierService.Callback<android.view.textclassifier.TextLanguage>);
-    method public abstract void onGenerateLinks(@Nullable android.view.textclassifier.TextClassificationSessionId, @NonNull android.view.textclassifier.TextLinks.Request, @NonNull android.os.CancellationSignal, @NonNull android.service.textclassifier.TextClassifierService.Callback<android.view.textclassifier.TextLinks>);
-    method @Deprecated public void onSelectionEvent(@Nullable android.view.textclassifier.TextClassificationSessionId, @NonNull android.view.textclassifier.SelectionEvent);
-    method public void onSuggestConversationActions(@Nullable android.view.textclassifier.TextClassificationSessionId, @NonNull android.view.textclassifier.ConversationActions.Request, @NonNull android.os.CancellationSignal, @NonNull android.service.textclassifier.TextClassifierService.Callback<android.view.textclassifier.ConversationActions>);
-    method public abstract void onSuggestSelection(@Nullable android.view.textclassifier.TextClassificationSessionId, @NonNull android.view.textclassifier.TextSelection.Request, @NonNull android.os.CancellationSignal, @NonNull android.service.textclassifier.TextClassifierService.Callback<android.view.textclassifier.TextSelection>);
-    method public void onTextClassifierEvent(@Nullable android.view.textclassifier.TextClassificationSessionId, @NonNull android.view.textclassifier.TextClassifierEvent);
+    method @MainThread public abstract void onClassifyText(@Nullable android.view.textclassifier.TextClassificationSessionId, @NonNull android.view.textclassifier.TextClassification.Request, @NonNull android.os.CancellationSignal, @NonNull android.service.textclassifier.TextClassifierService.Callback<android.view.textclassifier.TextClassification>);
+    method @MainThread public void onCreateTextClassificationSession(@NonNull android.view.textclassifier.TextClassificationContext, @NonNull android.view.textclassifier.TextClassificationSessionId);
+    method @MainThread public void onDestroyTextClassificationSession(@NonNull android.view.textclassifier.TextClassificationSessionId);
+    method @MainThread public void onDetectLanguage(@Nullable android.view.textclassifier.TextClassificationSessionId, @NonNull android.view.textclassifier.TextLanguage.Request, @NonNull android.os.CancellationSignal, @NonNull android.service.textclassifier.TextClassifierService.Callback<android.view.textclassifier.TextLanguage>);
+    method @MainThread public abstract void onGenerateLinks(@Nullable android.view.textclassifier.TextClassificationSessionId, @NonNull android.view.textclassifier.TextLinks.Request, @NonNull android.os.CancellationSignal, @NonNull android.service.textclassifier.TextClassifierService.Callback<android.view.textclassifier.TextLinks>);
+    method @Deprecated @MainThread public void onSelectionEvent(@Nullable android.view.textclassifier.TextClassificationSessionId, @NonNull android.view.textclassifier.SelectionEvent);
+    method @MainThread public void onSuggestConversationActions(@Nullable android.view.textclassifier.TextClassificationSessionId, @NonNull android.view.textclassifier.ConversationActions.Request, @NonNull android.os.CancellationSignal, @NonNull android.service.textclassifier.TextClassifierService.Callback<android.view.textclassifier.ConversationActions>);
+    method @MainThread public abstract void onSuggestSelection(@Nullable android.view.textclassifier.TextClassificationSessionId, @NonNull android.view.textclassifier.TextSelection.Request, @NonNull android.os.CancellationSignal, @NonNull android.service.textclassifier.TextClassifierService.Callback<android.view.textclassifier.TextSelection>);
+    method @MainThread public void onTextClassifierEvent(@Nullable android.view.textclassifier.TextClassificationSessionId, @NonNull android.view.textclassifier.TextClassifierEvent);
     field public static final String SERVICE_INTERFACE = "android.service.textclassifier.TextClassifierService";
   }
 
@@ -6808,7 +6923,7 @@
     method @Deprecated public int getSupportedRouteMask();
     method @Deprecated public boolean isMuted();
     method @Deprecated public void writeToParcel(android.os.Parcel, int);
-    field @Deprecated public static final android.os.Parcelable.Creator<android.telecom.AudioState> CREATOR;
+    field @Deprecated @NonNull public static final android.os.Parcelable.Creator<android.telecom.AudioState> CREATOR;
     field @Deprecated public static final int ROUTE_BLUETOOTH = 2; // 0x2
     field @Deprecated public static final int ROUTE_EARPIECE = 1; // 0x1
     field @Deprecated public static final int ROUTE_SPEAKER = 8; // 0x8
@@ -6866,7 +6981,7 @@
     field public static final int CALLTYPE_OUTGOING = 2; // 0x2
     field public static final int CALLTYPE_UNKNOWN = 0; // 0x0
     field public static final int CDMA_PHONE = 1; // 0x1
-    field public static final android.os.Parcelable.Creator<android.telecom.ParcelableCallAnalytics> CREATOR;
+    field @NonNull public static final android.os.Parcelable.Creator<android.telecom.ParcelableCallAnalytics> CREATOR;
     field public static final int GSM_PHONE = 2; // 0x2
     field public static final int IMS_PHONE = 4; // 0x4
     field public static final long MILLIS_IN_1_SECOND = 1000L; // 0x3e8L
@@ -6890,7 +7005,7 @@
     field public static final int BLOCK_CHECK_FINISHED = 105; // 0x69
     field public static final int BLOCK_CHECK_INITIATED = 104; // 0x68
     field public static final int CONFERENCE_WITH = 300; // 0x12c
-    field public static final android.os.Parcelable.Creator<android.telecom.ParcelableCallAnalytics.AnalyticsEvent> CREATOR;
+    field @NonNull public static final android.os.Parcelable.Creator<android.telecom.ParcelableCallAnalytics.AnalyticsEvent> CREATOR;
     field public static final int CS_BOUND = 6; // 0x6
     field public static final int DIRECT_TO_VM_FINISHED = 103; // 0x67
     field public static final int DIRECT_TO_VM_INITIATED = 102; // 0x66
@@ -6930,7 +7045,7 @@
     field public static final int ACCEPT_TIMING = 0; // 0x0
     field public static final int BIND_CS_TIMING = 6; // 0x6
     field public static final int BLOCK_CHECK_FINISHED_TIMING = 9; // 0x9
-    field public static final android.os.Parcelable.Creator<android.telecom.ParcelableCallAnalytics.EventTiming> CREATOR;
+    field @NonNull public static final android.os.Parcelable.Creator<android.telecom.ParcelableCallAnalytics.EventTiming> CREATOR;
     field public static final int DIRECT_TO_VM_FINISHED_TIMING = 8; // 0x8
     field public static final int DISCONNECT_TIMING = 2; // 0x2
     field public static final int FILTERING_COMPLETED_TIMING = 10; // 0xa
@@ -6970,10 +7085,6 @@
     field public static final int CAPABILITY_MULTI_USER = 32; // 0x20
   }
 
-  public final class PhoneAccountSuggestion implements android.os.Parcelable {
-    ctor public PhoneAccountSuggestion(android.telecom.PhoneAccountHandle, int, boolean);
-  }
-
   public class PhoneAccountSuggestionService extends android.app.Service {
     ctor public PhoneAccountSuggestionService();
     method public void onAccountSuggestionRequest(@NonNull String);
@@ -7003,7 +7114,7 @@
     method public java.util.List<android.telecom.ParcelableCallAnalytics> getCallAnalytics();
     method public java.util.List<android.telecom.TelecomAnalytics.SessionTiming> getSessionTimings();
     method public void writeToParcel(android.os.Parcel, int);
-    field public static final android.os.Parcelable.Creator<android.telecom.TelecomAnalytics> CREATOR;
+    field @NonNull public static final android.os.Parcelable.Creator<android.telecom.TelecomAnalytics> CREATOR;
   }
 
   public static final class TelecomAnalytics.SessionTiming implements android.os.Parcelable {
@@ -7012,7 +7123,7 @@
     method public Integer getKey();
     method public long getTime();
     method public void writeToParcel(android.os.Parcel, int);
-    field public static final android.os.Parcelable.Creator<android.telecom.TelecomAnalytics.SessionTiming> CREATOR;
+    field @NonNull public static final android.os.Parcelable.Creator<android.telecom.TelecomAnalytics.SessionTiming> CREATOR;
     field public static final int CSW_ADD_CONFERENCE_CALL = 108; // 0x6c
     field public static final int CSW_HANDLE_CREATE_CONNECTION_COMPLETE = 100; // 0x64
     field public static final int CSW_REMOVE_CALL = 106; // 0x6a
@@ -7049,8 +7160,8 @@
     method @RequiresPermission(anyOf={android.Manifest.permission.READ_PRIVILEGED_PHONE_STATE, android.Manifest.permission.READ_PHONE_STATE}) public java.util.List<android.telecom.PhoneAccountHandle> getPhoneAccountsSupportingScheme(String);
     method @RequiresPermission(android.Manifest.permission.MODIFY_PHONE_STATE) public boolean isInEmergencyCall();
     method @RequiresPermission(anyOf={android.Manifest.permission.READ_PRIVILEGED_PHONE_STATE, android.Manifest.permission.READ_PHONE_STATE}) public boolean isRinging();
-    method @Deprecated @RequiresPermission(allOf={android.Manifest.permission.MODIFY_PHONE_STATE, android.Manifest.permission.WRITE_SECURE_SETTINGS}) public boolean setDefaultDialer(String);
-    method @RequiresPermission(android.Manifest.permission.MODIFY_PHONE_STATE) public void setUserSelectedOutgoingPhoneAccount(android.telecom.PhoneAccountHandle);
+    method @Deprecated @RequiresPermission(allOf={android.Manifest.permission.MODIFY_PHONE_STATE, android.Manifest.permission.WRITE_SECURE_SETTINGS}) public boolean setDefaultDialer(@Nullable String);
+    method @RequiresPermission(android.Manifest.permission.MODIFY_PHONE_STATE) public void setUserSelectedOutgoingPhoneAccount(@Nullable android.telecom.PhoneAccountHandle);
     field public static final String EXTRA_CALL_BACK_INTENT = "android.telecom.extra.CALL_BACK_INTENT";
     field public static final String EXTRA_CLEAR_MISSED_CALLS_INTENT = "android.telecom.extra.CLEAR_MISSED_CALLS_INTENT";
     field public static final String EXTRA_CONNECTION_SERVICE = "android.telecom.extra.CONNECTION_SERVICE";
@@ -7070,14 +7181,14 @@
     field public static final int WWAN = 1; // 0x1
   }
 
-  public class CallAttributes implements android.os.Parcelable {
-    ctor public CallAttributes(android.telephony.PreciseCallState, int, android.telephony.CallQuality);
+  public final class CallAttributes implements android.os.Parcelable {
+    ctor public CallAttributes(@NonNull android.telephony.PreciseCallState, int, @NonNull android.telephony.CallQuality);
     method public int describeContents();
-    method public android.telephony.CallQuality getCallQuality();
+    method @NonNull public android.telephony.CallQuality getCallQuality();
     method public int getNetworkType();
-    method public android.telephony.PreciseCallState getPreciseCallState();
+    method @NonNull public android.telephony.PreciseCallState getPreciseCallState();
     method public void writeToParcel(android.os.Parcel, int);
-    field public static final android.os.Parcelable.Creator<android.telephony.CallAttributes> CREATOR;
+    field @NonNull public static final android.os.Parcelable.Creator<android.telephony.CallAttributes> CREATOR;
   }
 
   public final class CallQuality implements android.os.Parcelable {
@@ -7101,7 +7212,7 @@
     field public static final int CALL_QUALITY_GOOD = 1; // 0x1
     field public static final int CALL_QUALITY_NOT_AVAILABLE = 5; // 0x5
     field public static final int CALL_QUALITY_POOR = 3; // 0x3
-    field public static final android.os.Parcelable.Creator<android.telephony.CallQuality> CREATOR;
+    field @NonNull public static final android.os.Parcelable.Creator<android.telephony.CallQuality> CREATOR;
   }
 
   public class CarrierConfigManager {
@@ -7112,28 +7223,28 @@
   }
 
   public final class CarrierRestrictionRules implements android.os.Parcelable {
+    method @NonNull public java.util.List<java.lang.Boolean> areCarrierIdentifiersAllowed(@NonNull java.util.List<android.service.carrier.CarrierIdentifier>);
     method public int describeContents();
     method @NonNull public java.util.List<android.service.carrier.CarrierIdentifier> getAllowedCarriers();
     method public int getDefaultCarrierRestriction();
     method @NonNull public java.util.List<android.service.carrier.CarrierIdentifier> getExcludedCarriers();
     method public int getMultiSimPolicy();
     method public boolean isAllCarriersAllowed();
-    method public java.util.List<java.lang.Boolean> isCarrierIdentifiersAllowed(@NonNull java.util.List<android.service.carrier.CarrierIdentifier>);
     method public void writeToParcel(android.os.Parcel, int);
     field public static final int CARRIER_RESTRICTION_DEFAULT_ALLOWED = 1; // 0x1
     field public static final int CARRIER_RESTRICTION_DEFAULT_NOT_ALLOWED = 0; // 0x0
-    field public static final android.os.Parcelable.Creator<android.telephony.CarrierRestrictionRules> CREATOR;
+    field @NonNull public static final android.os.Parcelable.Creator<android.telephony.CarrierRestrictionRules> CREATOR;
     field public static final int MULTISIM_POLICY_NONE = 0; // 0x0
     field public static final int MULTISIM_POLICY_ONE_VALID_SIM_MUST_BE_PRESENT = 1; // 0x1
   }
 
-  public static class CarrierRestrictionRules.Builder {
-    method public android.telephony.CarrierRestrictionRules build();
-    method public android.telephony.CarrierRestrictionRules.Builder setAllCarriersAllowed();
-    method public android.telephony.CarrierRestrictionRules.Builder setAllowedCarriers(java.util.List<android.service.carrier.CarrierIdentifier>);
-    method public android.telephony.CarrierRestrictionRules.Builder setDefaultCarrierRestriction(int);
-    method public android.telephony.CarrierRestrictionRules.Builder setExcludedCarriers(java.util.List<android.service.carrier.CarrierIdentifier>);
-    method public android.telephony.CarrierRestrictionRules.Builder setMultiSimPolicy(int);
+  public static final class CarrierRestrictionRules.Builder {
+    method @NonNull public android.telephony.CarrierRestrictionRules build();
+    method @NonNull public android.telephony.CarrierRestrictionRules.Builder setAllCarriersAllowed();
+    method @NonNull public android.telephony.CarrierRestrictionRules.Builder setAllowedCarriers(@NonNull java.util.List<android.service.carrier.CarrierIdentifier>);
+    method @NonNull public android.telephony.CarrierRestrictionRules.Builder setDefaultCarrierRestriction(int);
+    method @NonNull public android.telephony.CarrierRestrictionRules.Builder setExcludedCarriers(@NonNull java.util.List<android.service.carrier.CarrierIdentifier>);
+    method @NonNull public android.telephony.CarrierRestrictionRules.Builder setMultiSimPolicy(int);
   }
 
   public final class DataFailCause {
@@ -7479,6 +7590,13 @@
     field public static final int VSNCP_TIMEOUT = 2236; // 0x8bc
   }
 
+  public final class DataSpecificRegistrationStates implements android.os.Parcelable {
+    method public int describeContents();
+    method @NonNull public android.telephony.LteVopsSupportInfo getLteVopsSupportInfo();
+    method public void writeToParcel(android.os.Parcel, int);
+    field @NonNull public static final android.os.Parcelable.Creator<android.telephony.DataSpecificRegistrationStates> CREATOR;
+  }
+
   public final class DisconnectCause {
     field public static final int ALREADY_DIALING = 72; // 0x48
     field public static final int ANSWERED_ELSEWHERE = 52; // 0x34
@@ -7562,7 +7680,7 @@
     method public int getEmcBearerSupport();
     method public int getVopsSupport();
     method public void writeToParcel(android.os.Parcel, int);
-    field public static final android.os.Parcelable.Creator<android.telephony.LteVopsSupportInfo> CREATOR;
+    field @NonNull public static final android.os.Parcelable.Creator<android.telephony.LteVopsSupportInfo> CREATOR;
     field public static final int LTE_STATUS_NOT_AVAILABLE = 1; // 0x1
     field public static final int LTE_STATUS_NOT_SUPPORTED = 3; // 0x3
     field public static final int LTE_STATUS_SUPPORTED = 2; // 0x2
@@ -7581,12 +7699,12 @@
   }
 
   public class NetworkRegistrationState implements android.os.Parcelable {
-    ctor public NetworkRegistrationState(int, int, int, int, int, boolean, int[], @Nullable android.telephony.CellIdentity);
-    ctor protected NetworkRegistrationState(android.os.Parcel);
+    ctor public NetworkRegistrationState(int, int, int, int, int, boolean, @NonNull int[], @Nullable android.telephony.CellIdentity);
     method public int describeContents();
     method public int getAccessNetworkTechnology();
-    method public int[] getAvailableServices();
-    method public android.telephony.CellIdentity getCellIdentity();
+    method @NonNull public int[] getAvailableServices();
+    method @Nullable public android.telephony.CellIdentity getCellIdentity();
+    method @Nullable public android.telephony.DataSpecificRegistrationStates getDataSpecificStates();
     method public int getDomain();
     method public int getRegState();
     method public int getRejectCause();
@@ -7595,7 +7713,7 @@
     method public boolean isEmergencyEnabled();
     method public boolean isRoaming();
     method public void writeToParcel(android.os.Parcel, int);
-    field public static final android.os.Parcelable.Creator<android.telephony.NetworkRegistrationState> CREATOR;
+    field @NonNull public static final android.os.Parcelable.Creator<android.telephony.NetworkRegistrationState> CREATOR;
     field public static final int DOMAIN_CS = 1; // 0x1
     field public static final int DOMAIN_PS = 2; // 0x2
     field public static final int REG_STATE_DENIED = 3; // 0x3
@@ -7611,22 +7729,38 @@
     field public static final int SERVICE_TYPE_VOICE = 1; // 0x1
   }
 
+  public static class NetworkRegistrationState.Builder {
+    ctor public NetworkRegistrationState.Builder();
+    method @NonNull public android.telephony.NetworkRegistrationState build();
+    method @NonNull public android.telephony.NetworkRegistrationState.Builder setAccessNetworkTechnology(int);
+    method @NonNull public android.telephony.NetworkRegistrationState.Builder setAvailableServices(@NonNull int[]);
+    method @NonNull public android.telephony.NetworkRegistrationState.Builder setCellIdentity(@Nullable android.telephony.CellIdentity);
+    method @NonNull public android.telephony.NetworkRegistrationState.Builder setDomain(int);
+    method @NonNull public android.telephony.NetworkRegistrationState.Builder setEmergencyOnly(boolean);
+    method @NonNull public android.telephony.NetworkRegistrationState.Builder setNrStatus(int);
+    method @NonNull public android.telephony.NetworkRegistrationState.Builder setRegState(int);
+    method @NonNull public android.telephony.NetworkRegistrationState.Builder setRejectCause(int);
+    method @NonNull public android.telephony.NetworkRegistrationState.Builder setRoamingType(int);
+    method @NonNull public android.telephony.NetworkRegistrationState.Builder setTransportType(int);
+  }
+
   public abstract class NetworkService extends android.app.Service {
     ctor public NetworkService();
-    method protected abstract android.telephony.NetworkService.NetworkServiceProvider createNetworkServiceProvider(int);
+    method public android.os.IBinder onBind(android.content.Intent);
+    method @Nullable public abstract android.telephony.NetworkService.NetworkServiceProvider onCreateNetworkServiceProvider(int);
     field public static final String NETWORK_SERVICE_INTERFACE = "android.telephony.NetworkService";
   }
 
   public abstract class NetworkService.NetworkServiceProvider implements java.lang.AutoCloseable {
     ctor public NetworkService.NetworkServiceProvider(int);
     method public abstract void close();
-    method public void getNetworkRegistrationState(int, android.telephony.NetworkServiceCallback);
-    method public final int getSlotId();
+    method public void getNetworkRegistrationState(int, @NonNull android.telephony.NetworkServiceCallback);
+    method public final int getSlotIndex();
     method public final void notifyNetworkRegistrationStateChanged();
   }
 
   public class NetworkServiceCallback {
-    method public void onGetNetworkRegistrationStateComplete(int, android.telephony.NetworkRegistrationState);
+    method public void onGetNetworkRegistrationStateComplete(int, @Nullable android.telephony.NetworkRegistrationState);
     field public static final int RESULT_ERROR_BUSY = 3; // 0x3
     field public static final int RESULT_ERROR_FAILED = 5; // 0x5
     field public static final int RESULT_ERROR_ILLEGAL_STATE = 4; // 0x4
@@ -7650,9 +7784,9 @@
   public final class PhoneNumberRange implements android.os.Parcelable {
     ctor public PhoneNumberRange(@NonNull String, @NonNull String, @NonNull String, @NonNull String);
     method public int describeContents();
-    method public boolean matches(String);
+    method public boolean matches(@NonNull String);
     method public void writeToParcel(android.os.Parcel, int);
-    field public static final android.os.Parcelable.Creator<android.telephony.PhoneNumberRange> CREATOR;
+    field @NonNull public static final android.os.Parcelable.Creator<android.telephony.PhoneNumberRange> CREATOR;
   }
 
   public class PhoneStateListener {
@@ -7660,7 +7794,7 @@
     method @RequiresPermission("android.permission.READ_PRECISE_PHONE_STATE") public void onCallDisconnectCauseChanged(int, int);
     method @RequiresPermission("android.permission.READ_PRECISE_PHONE_STATE") public void onImsCallDisconnectCauseChanged(@NonNull android.telephony.ims.ImsReasonInfo);
     method @RequiresPermission("android.permission.READ_PRECISE_PHONE_STATE") public void onPreciseCallStateChanged(@NonNull android.telephony.PreciseCallState);
-    method @RequiresPermission("android.permission.READ_PRECISE_PHONE_STATE") public void onPreciseDataConnectionStateChanged(android.telephony.PreciseDataConnectionState);
+    method @RequiresPermission("android.permission.READ_PRECISE_PHONE_STATE") public void onPreciseDataConnectionStateChanged(@NonNull android.telephony.PreciseDataConnectionState);
     method public void onRadioPowerStateChanged(int);
     method public void onSrvccStateChanged(int);
     method public void onVoiceActivationStateChanged(int);
@@ -7680,7 +7814,7 @@
     method public int getForegroundCallState();
     method public int getRingingCallState();
     method public void writeToParcel(android.os.Parcel, int);
-    field public static final android.os.Parcelable.Creator<android.telephony.PreciseCallState> CREATOR;
+    field @NonNull public static final android.os.Parcelable.Creator<android.telephony.PreciseCallState> CREATOR;
     field public static final int PRECISE_CALL_STATE_ACTIVE = 1; // 0x1
     field public static final int PRECISE_CALL_STATE_ALERTING = 4; // 0x4
     field public static final int PRECISE_CALL_STATE_DIALING = 3; // 0x3
@@ -7695,12 +7829,12 @@
 
   public final class PreciseDataConnectionState implements android.os.Parcelable {
     method public int describeContents();
-    method public String getDataConnectionApn();
+    method @Nullable public String getDataConnectionApn();
     method public int getDataConnectionApnTypeBitMask();
     method public int getDataConnectionFailCause();
     method public int getDataConnectionState();
     method public void writeToParcel(android.os.Parcel, int);
-    field public static final android.os.Parcelable.Creator<android.telephony.PreciseDataConnectionState> CREATOR;
+    field @NonNull public static final android.os.Parcelable.Creator<android.telephony.PreciseDataConnectionState> CREATOR;
   }
 
   public final class PreciseDisconnectCause {
@@ -7801,12 +7935,12 @@
   }
 
   public class ServiceState implements android.os.Parcelable {
-    method public android.telephony.NetworkRegistrationState getNetworkRegistrationState(int, int);
-    method public java.util.List<android.telephony.NetworkRegistrationState> getNetworkRegistrationStates();
-    method @Deprecated public java.util.List<android.telephony.NetworkRegistrationState> getNetworkRegistrationStates(int);
-    method @Deprecated public android.telephony.NetworkRegistrationState getNetworkRegistrationStates(int, int);
-    method public java.util.List<android.telephony.NetworkRegistrationState> getNetworkRegistrationStatesForDomain(int);
-    method public java.util.List<android.telephony.NetworkRegistrationState> getNetworkRegistrationStatesForTransportType(int);
+    method @Nullable public android.telephony.NetworkRegistrationState getNetworkRegistrationState(int, int);
+    method @NonNull public java.util.List<android.telephony.NetworkRegistrationState> getNetworkRegistrationStates();
+    method @Deprecated @NonNull public java.util.List<android.telephony.NetworkRegistrationState> getNetworkRegistrationStates(int);
+    method @Deprecated @Nullable public android.telephony.NetworkRegistrationState getNetworkRegistrationStates(int, int);
+    method @NonNull public java.util.List<android.telephony.NetworkRegistrationState> getNetworkRegistrationStatesForDomain(int);
+    method @NonNull public java.util.List<android.telephony.NetworkRegistrationState> getNetworkRegistrationStatesForTransportType(int);
     field public static final int ROAMING_TYPE_DOMESTIC = 2; // 0x2
     field public static final int ROAMING_TYPE_INTERNATIONAL = 3; // 0x3
     field public static final int ROAMING_TYPE_NOT_ROAMING = 0; // 0x0
@@ -7848,19 +7982,19 @@
     method public void requestEmbeddedSubscriptionInfoListRefresh(int);
     method @RequiresPermission(android.Manifest.permission.MODIFY_PHONE_STATE) public void setDefaultDataSubId(int);
     method @RequiresPermission(android.Manifest.permission.MODIFY_PHONE_STATE) public void setDefaultSmsSubId(int);
-    method @RequiresPermission(android.Manifest.permission.MODIFY_PHONE_STATE) public void setPreferredDataSubscriptionId(int, boolean, @NonNull java.util.concurrent.Executor, java.util.function.Consumer<java.lang.Integer>);
+    method @RequiresPermission(android.Manifest.permission.MODIFY_PHONE_STATE) public void setPreferredDataSubscriptionId(int, boolean, @Nullable java.util.concurrent.Executor, @Nullable java.util.function.Consumer<java.lang.Integer>);
     method @RequiresPermission(android.Manifest.permission.MODIFY_PHONE_STATE) public boolean setSubscriptionEnabled(int, boolean);
-    field public static final android.net.Uri ADVANCED_CALLING_ENABLED_CONTENT_URI;
+    field @NonNull public static final android.net.Uri ADVANCED_CALLING_ENABLED_CONTENT_URI;
     field public static final int PROFILE_CLASS_DEFAULT = -1; // 0xffffffff
     field public static final int PROFILE_CLASS_OPERATIONAL = 2; // 0x2
     field public static final int PROFILE_CLASS_PROVISIONING = 1; // 0x1
     field public static final int PROFILE_CLASS_TESTING = 0; // 0x0
     field public static final int PROFILE_CLASS_UNSET = -1; // 0xffffffff
-    field public static final android.net.Uri VT_ENABLED_CONTENT_URI;
-    field public static final android.net.Uri WFC_ENABLED_CONTENT_URI;
-    field public static final android.net.Uri WFC_MODE_CONTENT_URI;
-    field public static final android.net.Uri WFC_ROAMING_ENABLED_CONTENT_URI;
-    field public static final android.net.Uri WFC_ROAMING_MODE_CONTENT_URI;
+    field @NonNull public static final android.net.Uri VT_ENABLED_CONTENT_URI;
+    field @NonNull public static final android.net.Uri WFC_ENABLED_CONTENT_URI;
+    field @NonNull public static final android.net.Uri WFC_MODE_CONTENT_URI;
+    field @NonNull public static final android.net.Uri WFC_ROAMING_ENABLED_CONTENT_URI;
+    field @NonNull public static final android.net.Uri WFC_ROAMING_MODE_CONTENT_URI;
   }
 
   public static class SubscriptionPlan.Builder {
@@ -7885,7 +8019,7 @@
     method public int getMinTime();
     method public int getSampleCount();
     method public void writeToParcel(android.os.Parcel, int);
-    field public static final android.os.Parcelable.Creator<android.telephony.TelephonyHistogram> CREATOR;
+    field @NonNull public static final android.os.Parcelable.Creator<android.telephony.TelephonyHistogram> CREATOR;
     field public static final int TELEPHONY_CATEGORY_RIL = 1; // 0x1
   }
 
@@ -7898,7 +8032,7 @@
     method @RequiresPermission(android.Manifest.permission.MODIFY_PHONE_STATE) public boolean enableDataConnectivity();
     method @RequiresPermission(android.Manifest.permission.MODIFY_PHONE_STATE) public boolean enableModemForSlot(int, boolean);
     method @RequiresPermission(android.Manifest.permission.MODIFY_PHONE_STATE) public void enableVideoCalling(boolean);
-    method @RequiresPermission(android.Manifest.permission.READ_PRIVILEGED_PHONE_STATE) public String getAidForAppType(int);
+    method @Nullable @RequiresPermission(android.Manifest.permission.READ_PRIVILEGED_PHONE_STATE) public String getAidForAppType(int);
     method @Deprecated @RequiresPermission(android.Manifest.permission.READ_PRIVILEGED_PHONE_STATE) public java.util.List<android.service.carrier.CarrierIdentifier> getAllowedCarriers(int);
     method public java.util.List<java.lang.String> getCarrierPackageNamesForIntent(android.content.Intent);
     method public java.util.List<java.lang.String> getCarrierPackageNamesForIntentAndPhone(android.content.Intent, int);
@@ -7914,9 +8048,10 @@
     method @Deprecated public boolean getDataEnabled();
     method @Deprecated public boolean getDataEnabled(int);
     method @RequiresPermission(android.Manifest.permission.READ_PRIVILEGED_PHONE_STATE) public boolean getEmergencyCallbackMode();
-    method @RequiresPermission(android.Manifest.permission.READ_PRIVILEGED_PHONE_STATE) public String getIsimDomain();
-    method @RequiresPermission(android.Manifest.permission.READ_PRIVILEGED_PHONE_STATE) public String getIsimIst();
+    method @Nullable @RequiresPermission(android.Manifest.permission.READ_PRIVILEGED_PHONE_STATE) public String getIsimDomain();
+    method @Nullable @RequiresPermission(android.Manifest.permission.READ_PRIVILEGED_PHONE_STATE) public String getIsimIst();
     method @NonNull @RequiresPermission(android.Manifest.permission.READ_PRIVILEGED_PHONE_STATE) public java.util.List<android.util.Pair<java.lang.Integer,java.lang.Integer>> getLogicalToPhysicalSlotMapping();
+    method public static long getMaxNumberVerificationTimeoutMillis();
     method @RequiresPermission(android.Manifest.permission.READ_PRIVILEGED_PHONE_STATE) public long getPreferredNetworkTypeBitmap();
     method @RequiresPermission(anyOf={android.Manifest.permission.READ_PRIVILEGED_PHONE_STATE, android.Manifest.permission.READ_PHONE_STATE}) public int getRadioPowerState();
     method public int getSimApplicationState();
@@ -7929,10 +8064,10 @@
     method @RequiresPermission(android.Manifest.permission.READ_PRIVILEGED_PHONE_STATE) public int getVoiceActivationState();
     method @RequiresPermission(android.Manifest.permission.MODIFY_PHONE_STATE) public boolean handlePinMmi(String);
     method @RequiresPermission(android.Manifest.permission.MODIFY_PHONE_STATE) public boolean handlePinMmiForSubscriber(int, String);
-    method @RequiresPermission(android.Manifest.permission.READ_PRIVILEGED_PHONE_STATE) public boolean isCurrentPotentialEmergencyNumber(@NonNull String);
     method public boolean isDataConnectivityPossible();
     method @Deprecated @RequiresPermission(anyOf={android.Manifest.permission.READ_PRIVILEGED_PHONE_STATE, android.Manifest.permission.READ_PHONE_STATE}) public boolean isIdle();
     method @Deprecated @RequiresPermission(anyOf={android.Manifest.permission.READ_PRIVILEGED_PHONE_STATE, android.Manifest.permission.READ_PHONE_STATE}) public boolean isOffhook();
+    method @RequiresPermission(android.Manifest.permission.READ_PRIVILEGED_PHONE_STATE) public boolean isPotentialEmergencyNumber(@NonNull String);
     method @Deprecated @RequiresPermission(anyOf={android.Manifest.permission.READ_PRIVILEGED_PHONE_STATE, android.Manifest.permission.READ_PHONE_STATE}) public boolean isRadioOn();
     method @RequiresPermission(android.Manifest.permission.READ_PRIVILEGED_PHONE_STATE) public boolean isRebootRequiredForModemConfigChange();
     method @Deprecated @RequiresPermission(anyOf={android.Manifest.permission.READ_PRIVILEGED_PHONE_STATE, android.Manifest.permission.READ_PHONE_STATE}) public boolean isRinging();
@@ -7977,7 +8112,6 @@
     field public static final String EXTRA_SIM_STATE = "android.telephony.extra.SIM_STATE";
     field public static final String EXTRA_VISUAL_VOICEMAIL_ENABLED_BY_USER_BOOL = "android.telephony.extra.VISUAL_VOICEMAIL_ENABLED_BY_USER_BOOL";
     field public static final String EXTRA_VOICEMAIL_SCRAMBLED_PIN_STRING = "android.telephony.extra.VOICEMAIL_SCRAMBLED_PIN_STRING";
-    field public static final long MAX_NUMBER_VERIFICATION_TIMEOUT_MILLIS = 60000L; // 0xea60L
     field public static final long NETWORK_TYPE_BITMASK_1xRTT = 64L; // 0x40L
     field public static final long NETWORK_TYPE_BITMASK_CDMA = 8L; // 0x8L
     field public static final long NETWORK_TYPE_BITMASK_EDGE = 2L; // 0x2L
@@ -8026,7 +8160,7 @@
     method public String getCertificateHexString();
     method @Nullable public String getPackageName();
     method public void writeToParcel(android.os.Parcel, int);
-    field public static final android.os.Parcelable.Creator<android.telephony.UiccAccessRule> CREATOR;
+    field @NonNull public static final android.os.Parcelable.Creator<android.telephony.UiccAccessRule> CREATOR;
   }
 
   public class UiccSlotInfo implements android.os.Parcelable {
@@ -8044,7 +8178,7 @@
     field public static final int CARD_STATE_INFO_ERROR = 3; // 0x3
     field public static final int CARD_STATE_INFO_PRESENT = 2; // 0x2
     field public static final int CARD_STATE_INFO_RESTRICTED = 4; // 0x4
-    field public static final android.os.Parcelable.Creator<android.telephony.UiccSlotInfo> CREATOR;
+    field @NonNull public static final android.os.Parcelable.Creator<android.telephony.UiccSlotInfo> CREATOR;
   }
 
   public abstract class VisualVoicemailService extends android.app.Service {
@@ -8058,7 +8192,6 @@
 
   public final class DataCallResponse implements android.os.Parcelable {
     ctor public DataCallResponse(int, int, int, int, int, @Nullable String, @Nullable java.util.List<android.net.LinkAddress>, @Nullable java.util.List<java.net.InetAddress>, @Nullable java.util.List<java.net.InetAddress>, @Nullable java.util.List<java.lang.String>, int);
-    ctor public DataCallResponse(android.os.Parcel);
     method public int describeContents();
     method public int getActive();
     method @NonNull public java.util.List<android.net.LinkAddress> getAddresses();
@@ -8072,27 +8205,30 @@
     method public int getStatus();
     method public int getSuggestedRetryTime();
     method public void writeToParcel(android.os.Parcel, int);
-    field public static final android.os.Parcelable.Creator<android.telephony.data.DataCallResponse> CREATOR;
+    field @NonNull public static final android.os.Parcelable.Creator<android.telephony.data.DataCallResponse> CREATOR;
   }
 
   public final class DataProfile implements android.os.Parcelable {
-    method public String getApn();
+    method public int describeContents();
+    method @NonNull public String getApn();
     method public int getAuthType();
     method public int getBearerBitmap();
     method public int getMaxConns();
     method public int getMaxConnsTime();
     method public int getMtu();
-    method public String getPassword();
+    method @Nullable public String getPassword();
     method public int getProfileId();
     method public int getProtocol();
     method public int getRoamingProtocol();
     method public int getSupportedApnTypesBitmap();
     method public int getType();
-    method public String getUserName();
+    method @Nullable public String getUserName();
     method public int getWaitTime();
     method public boolean isEnabled();
     method public boolean isPersistent();
     method public boolean isPreferred();
+    method public void writeToParcel(android.os.Parcel, int);
+    field @NonNull public static final android.os.Parcelable.Creator<android.telephony.data.DataProfile> CREATOR;
     field public static final int TYPE_3GPP = 1; // 0x1
     field public static final int TYPE_3GPP2 = 2; // 0x2
     field public static final int TYPE_COMMON = 0; // 0x0
@@ -8100,7 +8236,8 @@
 
   public abstract class DataService extends android.app.Service {
     ctor public DataService();
-    method public abstract android.telephony.data.DataService.DataServiceProvider createDataServiceProvider(int);
+    method public android.os.IBinder onBind(android.content.Intent);
+    method @Nullable public abstract android.telephony.data.DataService.DataServiceProvider onCreateDataServiceProvider(int);
     field public static final String DATA_SERVICE_INTERFACE = "android.telephony.data.DataService";
     field public static final int REQUEST_REASON_HANDOVER = 3; // 0x3
     field public static final int REQUEST_REASON_NORMAL = 1; // 0x1
@@ -8112,20 +8249,20 @@
     method public abstract void close();
     method public void deactivateDataCall(int, int, @Nullable android.telephony.data.DataServiceCallback);
     method public void getDataCallList(@NonNull android.telephony.data.DataServiceCallback);
-    method public final int getSlotId();
+    method public final int getSlotIndex();
     method public final void notifyDataCallListChanged(java.util.List<android.telephony.data.DataCallResponse>);
-    method public void setDataProfile(java.util.List<android.telephony.data.DataProfile>, boolean, @Nullable android.telephony.data.DataServiceCallback);
-    method public void setInitialAttachApn(android.telephony.data.DataProfile, boolean, @Nullable android.telephony.data.DataServiceCallback);
-    method public void setupDataCall(int, android.telephony.data.DataProfile, boolean, boolean, int, @Nullable android.net.LinkProperties, @Nullable android.telephony.data.DataServiceCallback);
+    method public void setDataProfile(@NonNull java.util.List<android.telephony.data.DataProfile>, boolean, @Nullable android.telephony.data.DataServiceCallback);
+    method public void setInitialAttachApn(@NonNull android.telephony.data.DataProfile, boolean, @Nullable android.telephony.data.DataServiceCallback);
+    method public void setupDataCall(int, @NonNull android.telephony.data.DataProfile, boolean, boolean, int, @Nullable android.net.LinkProperties, @Nullable android.telephony.data.DataServiceCallback);
   }
 
   public class DataServiceCallback {
-    method public void onDataCallListChanged(java.util.List<android.telephony.data.DataCallResponse>);
+    method public void onDataCallListChanged(@NonNull java.util.List<android.telephony.data.DataCallResponse>);
     method public void onDeactivateDataCallComplete(int);
-    method public void onGetDataCallListComplete(int, java.util.List<android.telephony.data.DataCallResponse>);
+    method public void onGetDataCallListComplete(int, @NonNull java.util.List<android.telephony.data.DataCallResponse>);
     method public void onSetDataProfileComplete(int);
     method public void onSetInitialAttachApnComplete(int);
-    method public void onSetupDataCallComplete(int, android.telephony.data.DataCallResponse);
+    method public void onSetupDataCallComplete(int, @Nullable android.telephony.data.DataCallResponse);
     field public static final int RESULT_ERROR_BUSY = 3; // 0x3
     field public static final int RESULT_ERROR_ILLEGAL_STATE = 4; // 0x4
     field public static final int RESULT_ERROR_INVALID_ARG = 2; // 0x2
@@ -8135,7 +8272,7 @@
 
   public abstract class QualifiedNetworksService extends android.app.Service {
     ctor public QualifiedNetworksService();
-    method public abstract android.telephony.data.QualifiedNetworksService.NetworkAvailabilityUpdater createNetworkAvailabilityUpdater(int);
+    method @NonNull public abstract android.telephony.data.QualifiedNetworksService.NetworkAvailabilityUpdater createNetworkAvailabilityUpdater(int);
     field public static final String QUALIFIED_NETWORKS_SERVICE_INTERFACE = "android.telephony.data.QualifiedNetworksService";
   }
 
@@ -8143,7 +8280,7 @@
     ctor public QualifiedNetworksService.NetworkAvailabilityUpdater(int);
     method public abstract void close();
     method public final int getSlotIndex();
-    method public final void updateQualifiedNetworkTypes(int, int[]);
+    method public final void updateQualifiedNetworkTypes(int, @Nullable int[]);
   }
 
 }
@@ -8251,7 +8388,7 @@
     method public String getTargetAddr();
     method public void writeToParcel(android.os.Parcel, int);
     field @android.telephony.euicc.EuiccNotification.Event public static final int ALL_EVENTS = 15; // 0xf
-    field public static final android.os.Parcelable.Creator<android.telephony.euicc.EuiccNotification> CREATOR;
+    field @NonNull public static final android.os.Parcelable.Creator<android.telephony.euicc.EuiccNotification> CREATOR;
     field public static final int EVENT_DELETE = 8; // 0x8
     field public static final int EVENT_DISABLE = 4; // 0x4
     field public static final int EVENT_ENABLE = 2; // 0x2
@@ -8266,7 +8403,7 @@
     method public int findIndex(@android.service.euicc.EuiccProfileInfo.PolicyRule int, android.service.carrier.CarrierIdentifier);
     method public boolean hasPolicyRuleFlag(int, @android.telephony.euicc.EuiccRulesAuthTable.PolicyRuleFlag int);
     method public void writeToParcel(android.os.Parcel, int);
-    field public static final android.os.Parcelable.Creator<android.telephony.euicc.EuiccRulesAuthTable> CREATOR;
+    field @NonNull public static final android.os.Parcelable.Creator<android.telephony.euicc.EuiccRulesAuthTable> CREATOR;
     field public static final int POLICY_RULE_FLAG_CONSENT_REQUIRED = 1; // 0x1
   }
 
@@ -8300,7 +8437,7 @@
     field public static final int CDIV_CF_REASON_NOT_REACHABLE = 3; // 0x3
     field public static final int CDIV_CF_REASON_NO_REPLY = 2; // 0x2
     field public static final int CDIV_CF_REASON_UNCONDITIONAL = 0; // 0x0
-    field public static final android.os.Parcelable.Creator<android.telephony.ims.ImsCallForwardInfo> CREATOR;
+    field @NonNull public static final android.os.Parcelable.Creator<android.telephony.ims.ImsCallForwardInfo> CREATOR;
     field public static final int STATUS_ACTIVE = 1; // 0x1
     field public static final int STATUS_NOT_ACTIVE = 0; // 0x0
     field public static final int TYPE_OF_ADDRESS_INTERNATIONAL = 145; // 0x91
@@ -8323,7 +8460,7 @@
     method public static int getCallTypeFromVideoState(int);
     method public int getEmergencyCallRouting();
     method public int getEmergencyServiceCategories();
-    method public java.util.List<java.lang.String> getEmergencyUrns();
+    method @NonNull public java.util.List<java.lang.String> getEmergencyUrns();
     method public android.telephony.ims.ImsStreamMediaProfile getMediaProfile();
     method public int getRestrictCause();
     method public int getServiceType();
@@ -8341,7 +8478,7 @@
     method public void setEmergencyCallRouting(int);
     method public void setEmergencyCallTesting(boolean);
     method public void setEmergencyServiceCategories(int);
-    method public void setEmergencyUrns(java.util.List<java.lang.String>);
+    method public void setEmergencyUrns(@NonNull java.util.List<java.lang.String>);
     method public void setHasKnownUserIntentEmergency(boolean);
     method public void updateCallExtras(android.telephony.ims.ImsCallProfile);
     method public void updateCallType(android.telephony.ims.ImsCallProfile);
@@ -8361,7 +8498,7 @@
     field public static final int CALL_TYPE_VT_NODIR = 7; // 0x7
     field public static final int CALL_TYPE_VT_RX = 6; // 0x6
     field public static final int CALL_TYPE_VT_TX = 5; // 0x5
-    field public static final android.os.Parcelable.Creator<android.telephony.ims.ImsCallProfile> CREATOR;
+    field @NonNull public static final android.os.Parcelable.Creator<android.telephony.ims.ImsCallProfile> CREATOR;
     field public static final int DIALSTRING_NORMAL = 0; // 0x0
     field public static final int DIALSTRING_SS_CONF = 1; // 0x1
     field public static final int DIALSTRING_USSD = 2; // 0x2
@@ -8391,7 +8528,7 @@
   }
 
   public class ImsCallSessionListener {
-    method public void callQualityChanged(android.telephony.CallQuality);
+    method public void callQualityChanged(@NonNull android.telephony.CallQuality);
     method public void callSessionConferenceExtendFailed(android.telephony.ims.ImsReasonInfo);
     method public void callSessionConferenceExtendReceived(android.telephony.ims.stub.ImsCallSessionImplBase, android.telephony.ims.ImsCallProfile);
     method public void callSessionConferenceExtended(android.telephony.ims.stub.ImsCallSessionImplBase, android.telephony.ims.ImsCallProfile);
@@ -8416,7 +8553,7 @@
     method public void callSessionResumeFailed(android.telephony.ims.ImsReasonInfo);
     method public void callSessionResumeReceived(android.telephony.ims.ImsCallProfile);
     method public void callSessionResumed(android.telephony.ims.ImsCallProfile);
-    method public void callSessionRttAudioIndicatorChanged(android.telephony.ims.ImsStreamMediaProfile);
+    method public void callSessionRttAudioIndicatorChanged(@NonNull android.telephony.ims.ImsStreamMediaProfile);
     method public void callSessionRttMessageReceived(String);
     method public void callSessionRttModifyRequestReceived(android.telephony.ims.ImsCallProfile);
     method public void callSessionRttModifyResponseReceived(int);
@@ -8433,7 +8570,7 @@
     method public int describeContents();
     method public static int getConnectionStateForStatus(String);
     method public void writeToParcel(android.os.Parcel, int);
-    field public static final android.os.Parcelable.Creator<android.telephony.ims.ImsConferenceState> CREATOR;
+    field @NonNull public static final android.os.Parcelable.Creator<android.telephony.ims.ImsConferenceState> CREATOR;
     field public static final String DISPLAY_TEXT = "display-text";
     field public static final String ENDPOINT = "endpoint";
     field public static final String SIP_STATUS_CODE = "sipstatuscode";
@@ -8457,7 +8594,7 @@
   public class ImsException extends java.lang.Exception {
     ctor public ImsException(@Nullable String);
     ctor public ImsException(@Nullable String, int);
-    ctor public ImsException(@Nullable String, int, Throwable);
+    ctor public ImsException(@Nullable String, int, @Nullable Throwable);
     method public int getCode();
     field public static final int CODE_ERROR_SERVICE_UNAVAILABLE = 1; // 0x1
     field public static final int CODE_ERROR_UNSPECIFIED = 0; // 0x0
@@ -8465,23 +8602,23 @@
   }
 
   public final class ImsExternalCallState implements android.os.Parcelable {
-    ctor public ImsExternalCallState(String, android.net.Uri, android.net.Uri, boolean, int, int, boolean);
+    ctor public ImsExternalCallState(@NonNull String, @NonNull android.net.Uri, @Nullable android.net.Uri, boolean, int, int, boolean);
     method public int describeContents();
-    method public android.net.Uri getAddress();
+    method @NonNull public android.net.Uri getAddress();
     method public int getCallId();
     method public int getCallState();
     method public int getCallType();
-    method public android.net.Uri getLocalAddress();
+    method @Nullable public android.net.Uri getLocalAddress();
     method public boolean isCallHeld();
     method public boolean isCallPullable();
     method public void writeToParcel(android.os.Parcel, int);
     field public static final int CALL_STATE_CONFIRMED = 1; // 0x1
     field public static final int CALL_STATE_TERMINATED = 2; // 0x2
-    field public static final android.os.Parcelable.Creator<android.telephony.ims.ImsExternalCallState> CREATOR;
+    field @NonNull public static final android.os.Parcelable.Creator<android.telephony.ims.ImsExternalCallState> CREATOR;
   }
 
   public class ImsMmTelManager {
-    method public static android.telephony.ims.ImsMmTelManager createForSubscriptionId(int);
+    method @NonNull public static android.telephony.ims.ImsMmTelManager createForSubscriptionId(int);
     method @RequiresPermission(android.Manifest.permission.READ_PRIVILEGED_PHONE_STATE) public int getVoWiFiModeSetting();
     method @RequiresPermission(android.Manifest.permission.READ_PRIVILEGED_PHONE_STATE) public int getVoWiFiRoamingModeSetting();
     method @RequiresPermission(android.Manifest.permission.READ_PRIVILEGED_PHONE_STATE) public boolean isAdvancedCallingSettingEnabled();
@@ -8490,16 +8627,16 @@
     method @RequiresPermission(android.Manifest.permission.READ_PRIVILEGED_PHONE_STATE) public boolean isVoWiFiRoamingSettingEnabled();
     method @RequiresPermission(android.Manifest.permission.READ_PRIVILEGED_PHONE_STATE) public boolean isVoWiFiSettingEnabled();
     method @RequiresPermission(android.Manifest.permission.READ_PRIVILEGED_PHONE_STATE) public boolean isVtSettingEnabled();
-    method @RequiresPermission(android.Manifest.permission.READ_PRIVILEGED_PHONE_STATE) public void registerImsRegistrationCallback(java.util.concurrent.Executor, @NonNull android.telephony.ims.ImsMmTelManager.RegistrationCallback) throws android.telephony.ims.ImsException;
+    method @RequiresPermission(android.Manifest.permission.READ_PRIVILEGED_PHONE_STATE) public void registerImsRegistrationCallback(@NonNull java.util.concurrent.Executor, @NonNull android.telephony.ims.ImsMmTelManager.RegistrationCallback) throws android.telephony.ims.ImsException;
     method @RequiresPermission(android.Manifest.permission.READ_PRIVILEGED_PHONE_STATE) public void registerMmTelCapabilityCallback(@NonNull java.util.concurrent.Executor, @NonNull android.telephony.ims.ImsMmTelManager.CapabilityCallback) throws android.telephony.ims.ImsException;
-    method @RequiresPermission(android.Manifest.permission.MODIFY_PHONE_STATE) public void setAdvancedCallingSetting(boolean);
+    method @RequiresPermission(android.Manifest.permission.MODIFY_PHONE_STATE) public void setAdvancedCallingSettingEnabled(boolean);
     method @RequiresPermission(android.Manifest.permission.MODIFY_PHONE_STATE) public void setRttCapabilitySetting(boolean);
     method @RequiresPermission(android.Manifest.permission.MODIFY_PHONE_STATE) public void setVoWiFiModeSetting(int);
     method @RequiresPermission(android.Manifest.permission.MODIFY_PHONE_STATE) public void setVoWiFiNonPersistent(boolean, int);
     method @RequiresPermission(android.Manifest.permission.MODIFY_PHONE_STATE) public void setVoWiFiRoamingModeSetting(int);
-    method @RequiresPermission(android.Manifest.permission.MODIFY_PHONE_STATE) public void setVoWiFiRoamingSetting(boolean);
-    method @RequiresPermission(android.Manifest.permission.MODIFY_PHONE_STATE) public void setVoWiFiSetting(boolean);
-    method @RequiresPermission(android.Manifest.permission.MODIFY_PHONE_STATE) public void setVtSetting(boolean);
+    method @RequiresPermission(android.Manifest.permission.MODIFY_PHONE_STATE) public void setVoWiFiRoamingSettingEnabled(boolean);
+    method @RequiresPermission(android.Manifest.permission.MODIFY_PHONE_STATE) public void setVoWiFiSettingEnabled(boolean);
+    method @RequiresPermission(android.Manifest.permission.MODIFY_PHONE_STATE) public void setVtSettingEnabled(boolean);
     method @RequiresPermission(android.Manifest.permission.READ_PRIVILEGED_PHONE_STATE) public void unregisterImsRegistrationCallback(@NonNull android.telephony.ims.ImsMmTelManager.RegistrationCallback);
     method @RequiresPermission(android.Manifest.permission.READ_PRIVILEGED_PHONE_STATE) public void unregisterMmTelCapabilityCallback(@NonNull android.telephony.ims.ImsMmTelManager.CapabilityCallback);
     field public static final int WIFI_MODE_CELLULAR_PREFERRED = 1; // 0x1
@@ -8509,15 +8646,15 @@
 
   public static class ImsMmTelManager.CapabilityCallback {
     ctor public ImsMmTelManager.CapabilityCallback();
-    method public void onCapabilitiesStatusChanged(android.telephony.ims.feature.MmTelFeature.MmTelCapabilities);
+    method public void onCapabilitiesStatusChanged(@NonNull android.telephony.ims.feature.MmTelFeature.MmTelCapabilities);
   }
 
   public static class ImsMmTelManager.RegistrationCallback {
     ctor public ImsMmTelManager.RegistrationCallback();
-    method public void onDeregistered(android.telephony.ims.ImsReasonInfo);
     method public void onRegistered(int);
     method public void onRegistering(int);
-    method public void onTechnologyChangeFailed(int, android.telephony.ims.ImsReasonInfo);
+    method public void onTechnologyChangeFailed(int, @Nullable android.telephony.ims.ImsReasonInfo);
+    method public void onUnregistered(@Nullable android.telephony.ims.ImsReasonInfo);
   }
 
   public final class ImsReasonInfo implements android.os.Parcelable {
@@ -8697,7 +8834,7 @@
     field public static final int CODE_UT_SS_MODIFIED_TO_SS = 824; // 0x338
     field public static final int CODE_UT_SS_MODIFIED_TO_USSD = 823; // 0x337
     field public static final int CODE_WIFI_LOST = 1407; // 0x57f
-    field public static final android.os.Parcelable.Creator<android.telephony.ims.ImsReasonInfo> CREATOR;
+    field @NonNull public static final android.os.Parcelable.Creator<android.telephony.ims.ImsReasonInfo> CREATOR;
     field public static final int EXTRA_CODE_CALL_RETRY_BY_SETTINGS = 3; // 0x3
     field public static final int EXTRA_CODE_CALL_RETRY_NORMAL = 1; // 0x1
     field public static final int EXTRA_CODE_CALL_RETRY_SILENT_REDIAL = 2; // 0x2
@@ -8720,12 +8857,12 @@
   public final class ImsSsData implements android.os.Parcelable {
     ctor public ImsSsData(int, int, int, int, int);
     method public int describeContents();
-    method public android.telephony.ims.ImsCallForwardInfo[] getCallForwardInfo();
+    method @Nullable public java.util.List<android.telephony.ims.ImsCallForwardInfo> getCallForwardInfo();
     method public int getRequestType();
     method public int getResult();
     method public int getServiceClass();
     method public int getServiceType();
-    method @NonNull public android.telephony.ims.ImsSsInfo[] getSuppServiceInfo();
+    method @NonNull public java.util.List<android.telephony.ims.ImsSsInfo> getSuppServiceInfo();
     method public int getTeleserviceType();
     method public boolean isTypeBarring();
     method public boolean isTypeCf();
@@ -8738,7 +8875,7 @@
     method public boolean isTypeInterrogation();
     method public boolean isTypeUnConditional();
     method public void writeToParcel(android.os.Parcel, int);
-    field public static final android.os.Parcelable.Creator<android.telephony.ims.ImsSsData> CREATOR;
+    field @NonNull public static final android.os.Parcelable.Creator<android.telephony.ims.ImsSsData> CREATOR;
     field public static final int RESULT_SUCCESS = 0; // 0x0
     field public static final int SERVICE_CLASS_DATA = 2; // 0x2
     field public static final int SERVICE_CLASS_DATA_CIRCUIT_ASYNC = 32; // 0x20
@@ -8785,11 +8922,11 @@
     field public static final int SS_WAIT = 12; // 0xc
   }
 
-  public static class ImsSsData.Builder {
+  public static final class ImsSsData.Builder {
     ctor public ImsSsData.Builder(int, int, int, int, int);
     method @NonNull public android.telephony.ims.ImsSsData build();
-    method @NonNull public android.telephony.ims.ImsSsData.Builder setCallForwardingInfo(@NonNull android.telephony.ims.ImsCallForwardInfo[]);
-    method @NonNull public android.telephony.ims.ImsSsData.Builder setSuppServiceInfo(@NonNull android.telephony.ims.ImsSsInfo[]);
+    method @NonNull public android.telephony.ims.ImsSsData.Builder setCallForwardingInfo(@NonNull java.util.List<android.telephony.ims.ImsCallForwardInfo>);
+    method @NonNull public android.telephony.ims.ImsSsData.Builder setSuppServiceInfo(@NonNull java.util.List<android.telephony.ims.ImsSsInfo>);
   }
 
   public final class ImsSsInfo implements android.os.Parcelable {
@@ -8798,7 +8935,7 @@
     method public int getClirInterrogationStatus();
     method public int getClirOutgoingState();
     method @Deprecated public String getIcbNum();
-    method public String getIncomingCommunicationBarringNumber();
+    method @Nullable public String getIncomingCommunicationBarringNumber();
     method public int getProvisionStatus();
     method public int getStatus();
     method public void writeToParcel(android.os.Parcel, int);
@@ -8810,7 +8947,7 @@
     field public static final int CLIR_STATUS_TEMPORARILY_ALLOWED = 4; // 0x4
     field public static final int CLIR_STATUS_TEMPORARILY_RESTRICTED = 3; // 0x3
     field public static final int CLIR_STATUS_UNKNOWN = 2; // 0x2
-    field public static final android.os.Parcelable.Creator<android.telephony.ims.ImsSsInfo> CREATOR;
+    field @NonNull public static final android.os.Parcelable.Creator<android.telephony.ims.ImsSsInfo> CREATOR;
     field public static final int DISABLED = 0; // 0x0
     field public static final int ENABLED = 1; // 0x1
     field public static final int NOT_REGISTERED = -1; // 0xffffffff
@@ -8819,7 +8956,7 @@
     field public static final int SERVICE_PROVISIONING_UNKNOWN = -1; // 0xffffffff
   }
 
-  public static class ImsSsInfo.Builder {
+  public static final class ImsSsInfo.Builder {
     ctor public ImsSsInfo.Builder(int);
     method @NonNull public android.telephony.ims.ImsSsInfo build();
     method @NonNull public android.telephony.ims.ImsSsInfo.Builder setClirInterrogationStatus(int);
@@ -8863,7 +9000,7 @@
     field public static final int AUDIO_QUALITY_GSM_HR = 10; // 0xa
     field public static final int AUDIO_QUALITY_NONE = 0; // 0x0
     field public static final int AUDIO_QUALITY_QCELP13K = 3; // 0x3
-    field public static final android.os.Parcelable.Creator<android.telephony.ims.ImsStreamMediaProfile> CREATOR;
+    field @NonNull public static final android.os.Parcelable.Creator<android.telephony.ims.ImsStreamMediaProfile> CREATOR;
     field public static final int DIRECTION_INACTIVE = 0; // 0x0
     field public static final int DIRECTION_INVALID = -1; // 0xffffffff
     field public static final int DIRECTION_RECEIVE = 1; // 0x1
@@ -8883,7 +9020,7 @@
     ctor public ImsSuppServiceNotification(int, int, int, int, String, String[]);
     method public int describeContents();
     method public void writeToParcel(android.os.Parcel, int);
-    field public static final android.os.Parcelable.Creator<android.telephony.ims.ImsSuppServiceNotification> CREATOR;
+    field @NonNull public static final android.os.Parcelable.Creator<android.telephony.ims.ImsSuppServiceNotification> CREATOR;
     field public final int code;
     field public final String[] history;
     field public final int index;
@@ -8926,14 +9063,14 @@
   }
 
   public class ProvisioningManager {
-    method public static android.telephony.ims.ProvisioningManager createForSubscriptionId(int);
+    method @NonNull public static android.telephony.ims.ProvisioningManager createForSubscriptionId(int);
     method @WorkerThread @RequiresPermission(android.Manifest.permission.READ_PRIVILEGED_PHONE_STATE) public int getProvisioningIntValue(int);
     method @WorkerThread @RequiresPermission(android.Manifest.permission.READ_PRIVILEGED_PHONE_STATE) public boolean getProvisioningStatusForCapability(@android.telephony.ims.feature.MmTelFeature.MmTelCapabilities.MmTelCapability int, int);
-    method @WorkerThread @RequiresPermission(android.Manifest.permission.READ_PRIVILEGED_PHONE_STATE) public String getProvisioningStringValue(int);
-    method @RequiresPermission(android.Manifest.permission.READ_PRIVILEGED_PHONE_STATE) public void registerProvisioningChangedCallback(java.util.concurrent.Executor, @NonNull android.telephony.ims.ProvisioningManager.Callback) throws android.telephony.ims.ImsException;
+    method @Nullable @RequiresPermission(android.Manifest.permission.READ_PRIVILEGED_PHONE_STATE) @WorkerThread public String getProvisioningStringValue(int);
+    method @RequiresPermission(android.Manifest.permission.READ_PRIVILEGED_PHONE_STATE) public void registerProvisioningChangedCallback(@NonNull java.util.concurrent.Executor, @NonNull android.telephony.ims.ProvisioningManager.Callback) throws android.telephony.ims.ImsException;
     method @RequiresPermission(android.Manifest.permission.MODIFY_PHONE_STATE) @WorkerThread public int setProvisioningIntValue(int, int);
     method @WorkerThread @RequiresPermission(android.Manifest.permission.MODIFY_PHONE_STATE) public void setProvisioningStatusForCapability(@android.telephony.ims.feature.MmTelFeature.MmTelCapabilities.MmTelCapability int, int, boolean);
-    method @RequiresPermission(android.Manifest.permission.MODIFY_PHONE_STATE) @WorkerThread public int setProvisioningStringValue(int, String);
+    method @RequiresPermission(android.Manifest.permission.MODIFY_PHONE_STATE) @WorkerThread public int setProvisioningStringValue(int, @NonNull String);
     method @RequiresPermission(android.Manifest.permission.READ_PRIVILEGED_PHONE_STATE) public void unregisterProvisioningChangedCallback(@NonNull android.telephony.ims.ProvisioningManager.Callback);
     field public static final int KEY_VOICE_OVER_WIFI_MODE_OVERRIDE = 27; // 0x1b
     field public static final int KEY_VOICE_OVER_WIFI_ROAMING_ENABLED_OVERRIDE = 26; // 0x1a
@@ -8946,7 +9083,7 @@
   public static class ProvisioningManager.Callback {
     ctor public ProvisioningManager.Callback();
     method public void onProvisioningIntChanged(int, int);
-    method public void onProvisioningStringChanged(int, String);
+    method public void onProvisioningStringChanged(int, @NonNull String);
   }
 
 }
@@ -8960,7 +9097,7 @@
     method public java.util.List<android.telephony.ims.feature.CapabilityChangeRequest.CapabilityPair> getCapabilitiesToDisable();
     method public java.util.List<android.telephony.ims.feature.CapabilityChangeRequest.CapabilityPair> getCapabilitiesToEnable();
     method public void writeToParcel(android.os.Parcel, int);
-    field public static final android.os.Parcelable.Creator<android.telephony.ims.feature.CapabilityChangeRequest> CREATOR;
+    field @NonNull public static final android.os.Parcelable.Creator<android.telephony.ims.feature.CapabilityChangeRequest> CREATOR;
   }
 
   public static class CapabilityChangeRequest.CapabilityPair {
@@ -9122,7 +9259,7 @@
     method public int describeContents();
     method public java.util.Set<android.telephony.ims.stub.ImsFeatureConfiguration.FeatureSlotPair> getServiceFeatures();
     method public void writeToParcel(android.os.Parcel, int);
-    field public static final android.os.Parcelable.Creator<android.telephony.ims.stub.ImsFeatureConfiguration> CREATOR;
+    field @NonNull public static final android.os.Parcelable.Creator<android.telephony.ims.stub.ImsFeatureConfiguration> CREATOR;
   }
 
   public static class ImsFeatureConfiguration.Builder {
@@ -9235,7 +9372,7 @@
     method public android.net.Uri getContentUri();
     method public android.net.Uri getFilePathUri();
     method public void writeToParcel(android.os.Parcel, int);
-    field public static final android.os.Parcelable.Creator<android.telephony.mbms.UriPathPair> CREATOR;
+    field @NonNull public static final android.os.Parcelable.Creator<android.telephony.mbms.UriPathPair> CREATOR;
   }
 
 }
@@ -9267,12 +9404,12 @@
   public class MbmsGroupCallServiceBase extends android.app.Service {
     ctor public MbmsGroupCallServiceBase();
     method public void dispose(int) throws android.os.RemoteException;
-    method public int initialize(android.telephony.mbms.MbmsGroupCallSessionCallback, int) throws android.os.RemoteException;
+    method public int initialize(@NonNull android.telephony.mbms.MbmsGroupCallSessionCallback, int) throws android.os.RemoteException;
     method public void onAppCallbackDied(int, int);
     method public android.os.IBinder onBind(android.content.Intent);
-    method public int startGroupCall(int, long, java.util.List<java.lang.Integer>, java.util.List<java.lang.Integer>, android.telephony.mbms.GroupCallCallback);
+    method public int startGroupCall(int, long, @NonNull java.util.List<java.lang.Integer>, @NonNull java.util.List<java.lang.Integer>, @NonNull android.telephony.mbms.GroupCallCallback);
     method public void stopGroupCall(int, long);
-    method public void updateGroupCall(int, long, java.util.List<java.lang.Integer>, java.util.List<java.lang.Integer>);
+    method public void updateGroupCall(int, long, @NonNull java.util.List<java.lang.Integer>, @NonNull java.util.List<java.lang.Integer>);
   }
 
   public class MbmsStreamingServiceBase extends android.os.Binder {
@@ -9319,7 +9456,7 @@
     method public static void logFileOperationFailure(int, int);
     method public static void logFilePick(int, long, int, boolean, int, int, int);
     method public static void logInvalidScopedAccessRequest(int);
-    method public static void logPickerLaunchedFrom(String);
+    method public static void logPickerLaunchedFrom(@Nullable String);
     method public static void logRootVisited(int, int);
     method public static void logSearchMode(int);
     method public static void logSearchType(int);
@@ -9385,7 +9522,6 @@
 package android.view.autofill {
 
   public final class AutofillManager {
-    method @Deprecated public void setAugmentedAutofillWhitelist(@Nullable java.util.List<java.lang.String>, @Nullable java.util.List<android.content.ComponentName>);
     method public void setAugmentedAutofillWhitelist(@Nullable java.util.Set<java.lang.String>, @Nullable java.util.Set<android.content.ComponentName>);
   }
 
@@ -9413,7 +9549,7 @@
     method public int getType();
     method @Nullable public android.view.contentcapture.ViewNode getViewNode();
     method public void writeToParcel(android.os.Parcel, int);
-    field public static final android.os.Parcelable.Creator<android.view.contentcapture.ContentCaptureEvent> CREATOR;
+    field @NonNull public static final android.os.Parcelable.Creator<android.view.contentcapture.ContentCaptureEvent> CREATOR;
     field public static final int TYPE_CONTEXT_UPDATED = 6; // 0x6
     field public static final int TYPE_SESSION_PAUSED = 8; // 0x8
     field public static final int TYPE_SESSION_RESUMED = 7; // 0x7
@@ -9599,16 +9735,16 @@
 
   public final class WebViewDelegate {
     method public void addWebViewAssetPath(android.content.Context);
-    method public void callDrawGlFunction(android.graphics.Canvas, long);
-    method public void callDrawGlFunction(@NonNull android.graphics.Canvas, long, @Nullable Runnable);
-    method public boolean canInvokeDrawGlFunctor(android.view.View);
-    method public void detachDrawGlFunctor(android.view.View, long);
+    method @Deprecated public void callDrawGlFunction(android.graphics.Canvas, long);
+    method @Deprecated public void callDrawGlFunction(@NonNull android.graphics.Canvas, long, @Nullable Runnable);
+    method @Deprecated public boolean canInvokeDrawGlFunctor(android.view.View);
+    method @Deprecated public void detachDrawGlFunctor(android.view.View, long);
     method public void drawWebViewFunctor(@NonNull android.graphics.Canvas, int);
     method public android.app.Application getApplication();
     method public String getDataDirectorySuffix();
     method public String getErrorString(android.content.Context, int);
     method public int getPackageId(android.content.res.Resources, String);
-    method public void invokeDrawGlFunctor(android.view.View, long, boolean);
+    method @Deprecated public void invokeDrawGlFunctor(android.view.View, long, boolean);
     method public boolean isMultiProcessEnabled();
     method public boolean isTraceTagEnabled();
     method public void setOnTraceEnabledChangeListener(android.webkit.WebViewDelegate.OnTraceEnabledChangeListener);
@@ -9807,7 +9943,7 @@
     method public default void onMovedToDisplay(int, android.content.res.Configuration);
     method public void onOverScrolled(int, int, boolean, boolean);
     method public default void onProvideAutofillVirtualStructure(android.view.ViewStructure, int);
-    method public default void onProvideContentCaptureStructure(android.view.ViewStructure, int);
+    method public default void onProvideContentCaptureStructure(@NonNull android.view.ViewStructure, int);
     method public void onProvideVirtualStructure(android.view.ViewStructure);
     method public void onScrollChanged(int, int, int, int);
     method public void onSizeChanged(int, int, int, int);
@@ -9835,7 +9971,7 @@
     ctor public WebViewProviderInfo(String, String, boolean, boolean, String[]);
     method public int describeContents();
     method public void writeToParcel(android.os.Parcel, int);
-    field public static final android.os.Parcelable.Creator<android.webkit.WebViewProviderInfo> CREATOR;
+    field @NonNull public static final android.os.Parcelable.Creator<android.webkit.WebViewProviderInfo> CREATOR;
     field public final boolean availableByDefault;
     field public final String description;
     field public final boolean isFallback;
diff --git a/api/system-removed.txt b/api/system-removed.txt
index 22a3fb3..18d0ec0 100644
--- a/api/system-removed.txt
+++ b/api/system-removed.txt
@@ -60,6 +60,25 @@
 
 }
 
+package android.content.pm {
+
+  public static class PackageInstaller.SessionParams implements android.os.Parcelable {
+    method @Deprecated public void setEnableRollback();
+  }
+
+}
+
+package android.location {
+
+  public class LocationManager {
+    method @Deprecated public boolean addGpsMeasurementListener(android.location.GpsMeasurementsEvent.Listener);
+    method @Deprecated public boolean addGpsNavigationMessageListener(android.location.GpsNavigationMessageEvent.Listener);
+    method @Deprecated public void removeGpsMeasurementListener(android.location.GpsMeasurementsEvent.Listener);
+    method @Deprecated public void removeGpsNavigationMessageListener(android.location.GpsNavigationMessageEvent.Listener);
+  }
+
+}
+
 package android.media.tv {
 
   public final class TvInputManager {
diff --git a/api/test-current.txt b/api/test-current.txt
index 1089761..97f5ffe 100644
--- a/api/test-current.txt
+++ b/api/test-current.txt
@@ -41,7 +41,6 @@
 
   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 void onMovedToDisplay(int, android.content.res.Configuration);
-    method public void setInheritShowWhenLocked(boolean);
   }
 
   public class ActivityManager {
@@ -193,31 +192,38 @@
     field public static final String OPSTR_WRITE_SMS = "android:write_sms";
     field public static final String OPSTR_WRITE_WALLPAPER = "android:write_wallpaper";
     field public static final int OP_COARSE_LOCATION = 0; // 0x0
+    field public static final int OP_FLAGS_ALL = 31; // 0x1f
+    field public static final int OP_FLAG_SELF = 1; // 0x1
+    field public static final int OP_FLAG_TRUSTED_PROXIED = 8; // 0x8
+    field public static final int OP_FLAG_TRUSTED_PROXY = 2; // 0x2
+    field public static final int OP_FLAG_UNTRUSTED_PROXIED = 16; // 0x10
+    field public static final int OP_FLAG_UNTRUSTED_PROXY = 4; // 0x4
     field public static final int OP_RECORD_AUDIO = 27; // 0x1b
+    field public static final int OP_START_FOREGROUND = 76; // 0x4c
     field public static final int OP_SYSTEM_ALERT_WINDOW = 24; // 0x18
-    field public static final int UID_STATE_BACKGROUND = 5; // 0x5
-    field public static final int UID_STATE_CACHED = 6; // 0x6
-    field public static final int UID_STATE_FOREGROUND = 4; // 0x4
-    field public static final int UID_STATE_FOREGROUND_SERVICE = 3; // 0x3
-    field public static final int UID_STATE_FOREGROUND_SERVICE_LOCATION = 2; // 0x2
-    field public static final int UID_STATE_PERSISTENT = 0; // 0x0
-    field public static final int UID_STATE_TOP = 1; // 0x1
+    field public static final int UID_STATE_BACKGROUND = 600; // 0x258
+    field public static final int UID_STATE_CACHED = 700; // 0x2bc
+    field public static final int UID_STATE_FOREGROUND = 500; // 0x1f4
+    field public static final int UID_STATE_FOREGROUND_SERVICE = 400; // 0x190
+    field public static final int UID_STATE_FOREGROUND_SERVICE_LOCATION = 300; // 0x12c
+    field public static final int UID_STATE_PERSISTENT = 100; // 0x64
+    field public static final int UID_STATE_TOP = 200; // 0xc8
   }
 
   public static final class AppOpsManager.HistoricalOp implements android.os.Parcelable {
     method public int describeContents();
-    method public long getAccessCount(int);
-    method public long getAccessDuration(int);
-    method public long getBackgroundAccessCount();
-    method public long getBackgroundAccessDuration();
-    method public long getBackgroundRejectCount();
-    method public long getForegroundAccessCount();
-    method public long getForegroundAccessDuration();
-    method public long getForegroundRejectCount();
+    method public long getAccessCount(int, int, int);
+    method public long getAccessDuration(int, int, int);
+    method public long getBackgroundAccessCount(int);
+    method public long getBackgroundAccessDuration(int);
+    method public long getBackgroundRejectCount(int);
+    method public long getForegroundAccessCount(int);
+    method public long getForegroundAccessDuration(int);
+    method public long getForegroundRejectCount(int);
     method @NonNull public String getOpName();
-    method public long getRejectCount(int);
+    method public long getRejectCount(int, int, int);
     method public void writeToParcel(android.os.Parcel, int);
-    field public static final android.os.Parcelable.Creator<android.app.AppOpsManager.HistoricalOp> CREATOR;
+    field @NonNull public static final android.os.Parcelable.Creator<android.app.AppOpsManager.HistoricalOp> CREATOR;
   }
 
   public static final class AppOpsManager.HistoricalOps implements android.os.Parcelable {
@@ -228,12 +234,12 @@
     method public int getUidCount();
     method @Nullable public android.app.AppOpsManager.HistoricalUidOps getUidOps(int);
     method @NonNull public android.app.AppOpsManager.HistoricalUidOps getUidOpsAt(int);
-    method public void increaseAccessCount(int, int, @NonNull String, int, long);
-    method public void increaseAccessDuration(int, int, @NonNull String, int, long);
-    method public void increaseRejectCount(int, int, @NonNull String, int, long);
+    method public void increaseAccessCount(int, int, @NonNull String, int, int, long);
+    method public void increaseAccessDuration(int, int, @NonNull String, int, int, long);
+    method public void increaseRejectCount(int, int, @NonNull String, int, int, long);
     method public void offsetBeginAndEndTime(long);
     method public void writeToParcel(android.os.Parcel, int);
-    field public static final android.os.Parcelable.Creator<android.app.AppOpsManager.HistoricalOps> CREATOR;
+    field @NonNull public static final android.os.Parcelable.Creator<android.app.AppOpsManager.HistoricalOps> CREATOR;
   }
 
   public static final class AppOpsManager.HistoricalOpsRequest {
@@ -242,6 +248,7 @@
   public static final class AppOpsManager.HistoricalOpsRequest.Builder {
     ctor public AppOpsManager.HistoricalOpsRequest.Builder(long, long);
     method @NonNull public android.app.AppOpsManager.HistoricalOpsRequest build();
+    method @NonNull public android.app.AppOpsManager.HistoricalOpsRequest.Builder setFlags(int);
     method @NonNull public android.app.AppOpsManager.HistoricalOpsRequest.Builder setOpNames(@Nullable java.util.List<java.lang.String>);
     method @NonNull public android.app.AppOpsManager.HistoricalOpsRequest.Builder setPackageName(@Nullable String);
     method @NonNull public android.app.AppOpsManager.HistoricalOpsRequest.Builder setUid(int);
@@ -254,7 +261,7 @@
     method public int getOpCount();
     method @NonNull public String getPackageName();
     method public void writeToParcel(@NonNull android.os.Parcel, int);
-    field public static final android.os.Parcelable.Creator<android.app.AppOpsManager.HistoricalPackageOps> CREATOR;
+    field @NonNull public static final android.os.Parcelable.Creator<android.app.AppOpsManager.HistoricalPackageOps> CREATOR;
   }
 
   public static final class AppOpsManager.HistoricalUidOps implements android.os.Parcelable {
@@ -264,13 +271,42 @@
     method @NonNull public android.app.AppOpsManager.HistoricalPackageOps getPackageOpsAt(int);
     method public int getUid();
     method public void writeToParcel(android.os.Parcel, int);
-    field public static final android.os.Parcelable.Creator<android.app.AppOpsManager.HistoricalUidOps> CREATOR;
+    field @NonNull public static final android.os.Parcelable.Creator<android.app.AppOpsManager.HistoricalUidOps> CREATOR;
   }
 
   public static interface AppOpsManager.OnOpActiveChangedListener {
     method public void onOpActiveChanged(int, int, String, boolean);
   }
 
+  public static final class AppOpsManager.OpEntry implements android.os.Parcelable {
+    method public int describeContents();
+    method public long getDuration();
+    method public long getLastAccessBackgroundTime(int);
+    method public long getLastAccessForegroundTime(int);
+    method public long getLastAccessTime(int);
+    method public long getLastAccessTime(int, int, int);
+    method public long getLastBackgroundDuration(int);
+    method public long getLastDuration(int, int, int);
+    method public long getLastForegroundDuration(int);
+    method public long getLastRejectBackgroundTime(int);
+    method public long getLastRejectForegroundTime(int);
+    method public long getLastRejectTime(int);
+    method public long getLastRejectTime(int, int, int);
+    method public int getMode();
+    method @NonNull public String getOpStr();
+    method @Nullable public String getProxyPackageName();
+    method @Nullable public String getProxyPackageName(int, int);
+    method public int getProxyUid();
+    method public int getProxyUid(int, int);
+    method public boolean isRunning();
+    method public void writeToParcel(android.os.Parcel, int);
+    field @NonNull public static final android.os.Parcelable.Creator<android.app.AppOpsManager.OpEntry> CREATOR;
+  }
+
+  public class DownloadManager {
+    field public static final String COLUMN_MEDIASTORE_URI = "mediastore_uri";
+  }
+
   public final class NotificationChannel implements android.os.Parcelable {
     method public boolean isImportanceLockedByOEM();
     method public void setImportanceLockedByOEM(boolean);
@@ -392,7 +428,7 @@
     method public int getPredictedTargetCount();
     method public String getUiSurface();
     method public void writeToParcel(android.os.Parcel, int);
-    field public static final android.os.Parcelable.Creator<android.app.prediction.AppPredictionContext> CREATOR;
+    field @NonNull public static final android.os.Parcelable.Creator<android.app.prediction.AppPredictionContext> CREATOR;
   }
 
   public static final class AppPredictionContext.Builder {
@@ -410,7 +446,7 @@
   public final class AppPredictionSessionId 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.prediction.AppPredictionSessionId> CREATOR;
+    field @NonNull public static final android.os.Parcelable.Creator<android.app.prediction.AppPredictionSessionId> CREATOR;
   }
 
   public final class AppPredictor {
@@ -438,7 +474,7 @@
     method @Nullable public android.content.pm.ShortcutInfo getShortcutInfo();
     method @NonNull public android.os.UserHandle getUser();
     method public void writeToParcel(android.os.Parcel, int);
-    field public static final android.os.Parcelable.Creator<android.app.prediction.AppTarget> CREATOR;
+    field @NonNull public static final android.os.Parcelable.Creator<android.app.prediction.AppTarget> CREATOR;
   }
 
   public final class AppTargetEvent implements android.os.Parcelable {
@@ -450,7 +486,7 @@
     field public static final int ACTION_DISMISS = 2; // 0x2
     field public static final int ACTION_LAUNCH = 1; // 0x1
     field public static final int ACTION_PIN = 3; // 0x3
-    field public static final android.os.Parcelable.Creator<android.app.prediction.AppTargetEvent> CREATOR;
+    field @NonNull public static final android.os.Parcelable.Creator<android.app.prediction.AppTargetEvent> CREATOR;
   }
 
   public static final class AppTargetEvent.Builder {
@@ -463,24 +499,30 @@
     ctor public AppTargetId(@NonNull String);
     method public int describeContents();
     method public void writeToParcel(android.os.Parcel, int);
-    field public static final android.os.Parcelable.Creator<android.app.prediction.AppTargetId> CREATOR;
+    field @NonNull public static final android.os.Parcelable.Creator<android.app.prediction.AppTargetId> CREATOR;
   }
 
 }
 
 package android.app.role {
 
-  public final class RoleManager {
-    method @RequiresPermission("android.permission.MANAGE_ROLE_HOLDERS") public void addRoleHolderAsUser(@NonNull String, @NonNull String, int, @NonNull android.os.UserHandle, @NonNull java.util.concurrent.Executor, @NonNull android.app.role.RoleManagerCallback);
-    method @RequiresPermission("android.permission.MANAGE_ROLE_HOLDERS") public void clearRoleHoldersAsUser(@NonNull String, int, @NonNull android.os.UserHandle, @NonNull java.util.concurrent.Executor, @NonNull android.app.role.RoleManagerCallback);
-    method @NonNull @RequiresPermission("android.permission.MANAGE_ROLE_HOLDERS") public java.util.List<java.lang.String> getRoleHolders(@NonNull String);
-    method @NonNull @RequiresPermission("android.permission.MANAGE_ROLE_HOLDERS") public java.util.List<java.lang.String> getRoleHoldersAsUser(@NonNull String, @NonNull android.os.UserHandle);
-    method @RequiresPermission("android.permission.MANAGE_ROLE_HOLDERS") public void removeRoleHolderAsUser(@NonNull String, @NonNull String, int, @NonNull android.os.UserHandle, @NonNull java.util.concurrent.Executor, @NonNull android.app.role.RoleManagerCallback);
+  public interface OnRoleHoldersChangedListener {
+    method public void onRoleHoldersChanged(@NonNull String, @NonNull android.os.UserHandle);
   }
 
-  public interface RoleManagerCallback {
-    method public void onFailure();
-    method public void onSuccess();
+  public final class RoleManager {
+    method @RequiresPermission("android.permission.OBSERVE_ROLE_HOLDERS") public void addOnRoleHoldersChangedListenerAsUser(@NonNull java.util.concurrent.Executor, @NonNull android.app.role.OnRoleHoldersChangedListener, @NonNull android.os.UserHandle);
+    method @RequiresPermission("android.permission.MANAGE_ROLE_HOLDERS") public void addRoleHolderAsUser(@NonNull String, @NonNull String, int, @NonNull android.os.UserHandle, @NonNull java.util.concurrent.Executor, @NonNull java.util.function.Consumer<java.lang.Boolean>);
+    method @RequiresPermission("com.android.permissioncontroller.permission.MANAGE_ROLES_FROM_CONTROLLER") public boolean addRoleHolderFromController(@NonNull String, @NonNull String);
+    method @RequiresPermission("android.permission.MANAGE_ROLE_HOLDERS") public void clearRoleHoldersAsUser(@NonNull String, int, @NonNull android.os.UserHandle, @NonNull java.util.concurrent.Executor, @NonNull java.util.function.Consumer<java.lang.Boolean>);
+    method @NonNull @RequiresPermission("com.android.permissioncontroller.permission.MANAGE_ROLES_FROM_CONTROLLER") public java.util.List<java.lang.String> getHeldRolesFromController(@NonNull String);
+    method @NonNull @RequiresPermission("android.permission.MANAGE_ROLE_HOLDERS") public java.util.List<java.lang.String> getRoleHolders(@NonNull String);
+    method @NonNull @RequiresPermission("android.permission.MANAGE_ROLE_HOLDERS") public java.util.List<java.lang.String> getRoleHoldersAsUser(@NonNull String, @NonNull android.os.UserHandle);
+    method @RequiresPermission("android.permission.OBSERVE_ROLE_HOLDERS") public void removeOnRoleHoldersChangedListenerAsUser(@NonNull android.app.role.OnRoleHoldersChangedListener, @NonNull android.os.UserHandle);
+    method @RequiresPermission("android.permission.MANAGE_ROLE_HOLDERS") public void removeRoleHolderAsUser(@NonNull String, @NonNull String, int, @NonNull android.os.UserHandle, @NonNull java.util.concurrent.Executor, @NonNull java.util.function.Consumer<java.lang.Boolean>);
+    method @RequiresPermission("com.android.permissioncontroller.permission.MANAGE_ROLES_FROM_CONTROLLER") public boolean removeRoleHolderFromController(@NonNull String, @NonNull String);
+    method @RequiresPermission("com.android.permissioncontroller.permission.MANAGE_ROLES_FROM_CONTROLLER") public void setRoleNamesFromController(@NonNull java.util.List<java.lang.String>);
+    field public static final int MANAGE_HOLDERS_FLAG_DONT_KILL_APP = 1; // 0x1
   }
 
 }
@@ -516,11 +558,13 @@
     ctor public AutofillOptions(int, boolean);
     method public int describeContents();
     method public static android.content.AutofillOptions forWhitelistingItself();
+    method public boolean isAugmentedAutofillEnabled(@NonNull android.content.Context);
     method public void writeToParcel(android.os.Parcel, int);
-    field public static final android.os.Parcelable.Creator<android.content.AutofillOptions> CREATOR;
-    field public boolean augmentedEnabled;
+    field @NonNull public static final android.os.Parcelable.Creator<android.content.AutofillOptions> CREATOR;
+    field public boolean augmentedAutofillEnabled;
     field public final boolean compatModeEnabled;
     field public final int loggingLevel;
+    field @Nullable public android.util.ArraySet<android.content.ComponentName> whitelistedActivitiesForAugmentedAutofill;
   }
 
   public final class ContentCaptureOptions implements android.os.Parcelable {
@@ -528,7 +572,7 @@
     method public int describeContents();
     method public static android.content.ContentCaptureOptions forWhitelistingItself();
     method public void writeToParcel(android.os.Parcel, int);
-    field public static final android.os.Parcelable.Creator<android.content.ContentCaptureOptions> CREATOR;
+    field @NonNull public static final android.os.Parcelable.Creator<android.content.ContentCaptureOptions> CREATOR;
     field public final int idleFlushingFrequencyMs;
     field public final int logHistorySize;
     field public final int loggingLevel;
@@ -558,6 +602,10 @@
     method public android.view.Display getDisplay();
   }
 
+  public class Intent implements java.lang.Cloneable android.os.Parcelable {
+    field public static final String EXTRA_ROLE_NAME = "android.intent.extra.ROLE_NAME";
+  }
+
 }
 
 package android.content.pm {
@@ -587,7 +635,7 @@
     method @RequiresPermission("android.permission.INTERACT_ACROSS_USERS_FULL") public abstract java.util.List<android.content.pm.PackageInfo> getInstalledPackagesAsUser(int, int);
     method @Nullable public abstract String[] getNamesForUids(int[]);
     method public abstract String getPermissionControllerPackageName();
-    method @RequiresPermission(anyOf={"android.permission.GRANT_RUNTIME_PERMISSIONS", "android.permission.REVOKE_RUNTIME_PERMISSIONS"}) public abstract int getPermissionFlags(String, String, @NonNull android.os.UserHandle);
+    method @RequiresPermission(anyOf={"android.permission.GRANT_RUNTIME_PERMISSIONS", "android.permission.REVOKE_RUNTIME_PERMISSIONS", "android.permission.GET_RUNTIME_PERMISSIONS"}) public abstract int getPermissionFlags(String, String, @NonNull android.os.UserHandle);
     method @NonNull public abstract String getServicesSystemSharedLibraryPackageName();
     method @NonNull public abstract String getSharedSystemSharedLibraryPackageName();
     method public String getWellbeingPackageName();
@@ -616,7 +664,7 @@
     field public static final int PROTECTION_FLAG_SYSTEM_TEXT_CLASSIFIER = 65536; // 0x10000
     field public static final int PROTECTION_FLAG_VENDOR_PRIVILEGED = 32768; // 0x8000
     field public static final int PROTECTION_FLAG_WELLBEING = 131072; // 0x20000
-    field public String backgroundPermission;
+    field @Nullable public final String backgroundPermission;
   }
 
   public final class ShortcutInfo implements android.os.Parcelable {
@@ -737,7 +785,7 @@
     method public java.time.LocalDate getLocalDate();
     method public float[] getStats();
     method public void writeToParcel(android.os.Parcel, int);
-    field public static final android.os.Parcelable.Creator<android.hardware.display.AmbientBrightnessDayStats> CREATOR;
+    field @NonNull public static final android.os.Parcelable.Creator<android.hardware.display.AmbientBrightnessDayStats> CREATOR;
   }
 
   public class AmbientDisplayConfiguration {
@@ -750,7 +798,7 @@
   public final class BrightnessChangeEvent 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.hardware.display.BrightnessChangeEvent> CREATOR;
+    field @NonNull public static final android.os.Parcelable.Creator<android.hardware.display.BrightnessChangeEvent> CREATOR;
     field public final float batteryLevel;
     field public final float brightness;
     field public final long colorSampleDuration;
@@ -773,17 +821,17 @@
     method @Nullable public android.hardware.display.BrightnessCorrection getCorrectionByPackageName(@NonNull String);
     method public android.util.Pair<float[],float[]> getCurve();
     method public void writeToParcel(android.os.Parcel, int);
-    field public static final android.os.Parcelable.Creator<android.hardware.display.BrightnessConfiguration> CREATOR;
+    field @NonNull public static final android.os.Parcelable.Creator<android.hardware.display.BrightnessConfiguration> CREATOR;
   }
 
   public static class BrightnessConfiguration.Builder {
     ctor public BrightnessConfiguration.Builder(float[], float[]);
-    method public android.hardware.display.BrightnessConfiguration.Builder addCorrectionByCategory(int, @NonNull android.hardware.display.BrightnessCorrection);
-    method public android.hardware.display.BrightnessConfiguration.Builder addCorrectionByPackageName(@NonNull String, @NonNull android.hardware.display.BrightnessCorrection);
-    method public android.hardware.display.BrightnessConfiguration build();
+    method @NonNull public android.hardware.display.BrightnessConfiguration.Builder addCorrectionByCategory(int, @NonNull android.hardware.display.BrightnessCorrection);
+    method @NonNull public android.hardware.display.BrightnessConfiguration.Builder addCorrectionByPackageName(@NonNull String, @NonNull android.hardware.display.BrightnessCorrection);
+    method @NonNull public android.hardware.display.BrightnessConfiguration build();
     method public int getMaxCorrectionsByCategory();
     method public int getMaxCorrectionsByPackageName();
-    method public android.hardware.display.BrightnessConfiguration.Builder setDescription(@Nullable String);
+    method @NonNull public android.hardware.display.BrightnessConfiguration.Builder setDescription(@Nullable String);
   }
 
   public final class BrightnessCorrection implements android.os.Parcelable {
@@ -791,7 +839,7 @@
     method @NonNull public static android.hardware.display.BrightnessCorrection createScaleAndTranslateLog(float, float);
     method public int describeContents();
     method public void writeToParcel(android.os.Parcel, int);
-    field public static final android.os.Parcelable.Creator<android.hardware.display.BrightnessCorrection> CREATOR;
+    field @NonNull public static final android.os.Parcelable.Creator<android.hardware.display.BrightnessCorrection> CREATOR;
   }
 
   public final class DisplayManager {
@@ -885,32 +933,36 @@
   }
 
   public class LocationManager {
-    method public String[] getBackgroundThrottlingWhitelist();
-    method public String[] getIgnoreSettingsWhitelist();
-    method @RequiresPermission(anyOf={android.Manifest.permission.ACCESS_COARSE_LOCATION, android.Manifest.permission.ACCESS_FINE_LOCATION}) public void requestLocationUpdates(android.location.LocationRequest, android.location.LocationListener, android.os.Looper);
-    method @RequiresPermission(anyOf={android.Manifest.permission.ACCESS_COARSE_LOCATION, android.Manifest.permission.ACCESS_FINE_LOCATION}) public void requestLocationUpdates(android.location.LocationRequest, android.app.PendingIntent);
-    method @RequiresPermission(android.Manifest.permission.WRITE_SECURE_SETTINGS) public void setLocationEnabledForUser(boolean, android.os.UserHandle);
+    method @NonNull public String[] getBackgroundThrottlingWhitelist();
+    method @NonNull public String[] getIgnoreSettingsWhitelist();
+    method @NonNull public java.util.List<android.location.LocationRequest> getTestProviderCurrentRequests(String);
+    method @RequiresPermission(anyOf={android.Manifest.permission.ACCESS_COARSE_LOCATION, android.Manifest.permission.ACCESS_FINE_LOCATION}) public void requestLocationUpdates(@NonNull android.location.LocationRequest, @NonNull android.location.LocationListener, @Nullable android.os.Looper);
+    method @RequiresPermission(anyOf={android.Manifest.permission.ACCESS_COARSE_LOCATION, android.Manifest.permission.ACCESS_FINE_LOCATION}) public void requestLocationUpdates(@NonNull android.location.LocationRequest, @NonNull android.app.PendingIntent);
+    method @RequiresPermission(android.Manifest.permission.WRITE_SECURE_SETTINGS) public void setLocationEnabledForUser(boolean, @NonNull android.os.UserHandle);
   }
 
   public final class LocationRequest implements android.os.Parcelable {
-    method public static android.location.LocationRequest create();
+    method @NonNull public static android.location.LocationRequest create();
     method public int describeContents();
     method public long getExpireAt();
     method public long getFastestInterval();
     method public long getInterval();
     method public int getNumUpdates();
     method public int getQuality();
-    method public android.location.LocationRequest setExpireAt(long);
-    method public android.location.LocationRequest setExpireIn(long);
-    method public android.location.LocationRequest setFastestInterval(long);
-    method public android.location.LocationRequest setInterval(long);
-    method public android.location.LocationRequest setNumUpdates(int);
-    method public android.location.LocationRequest setQuality(int);
+    method public boolean isLocationSettingsIgnored();
+    method @NonNull public android.location.LocationRequest setExpireAt(long);
+    method @NonNull public android.location.LocationRequest setExpireIn(long);
+    method @NonNull public android.location.LocationRequest setFastestInterval(long);
+    method @NonNull public android.location.LocationRequest setInterval(long);
+    method @RequiresPermission(android.Manifest.permission.WRITE_SECURE_SETTINGS) @NonNull public android.location.LocationRequest setLocationSettingsIgnored(boolean);
+    method @NonNull public android.location.LocationRequest setNumUpdates(int);
+    method @NonNull public android.location.LocationRequest setProvider(@NonNull String);
+    method @NonNull public android.location.LocationRequest setQuality(int);
     method public void writeToParcel(android.os.Parcel, int);
     field public static final int ACCURACY_BLOCK = 102; // 0x66
     field public static final int ACCURACY_CITY = 104; // 0x68
     field public static final int ACCURACY_FINE = 100; // 0x64
-    field public static final android.os.Parcelable.Creator<android.location.LocationRequest> CREATOR;
+    field @NonNull public static final android.os.Parcelable.Creator<android.location.LocationRequest> CREATOR;
     field public static final int POWER_HIGH = 203; // 0xcb
     field public static final int POWER_LOW = 201; // 0xc9
     field public static final int POWER_NONE = 200; // 0xc8
@@ -931,17 +983,35 @@
     method public static boolean isEncodingLinearPcm(int);
   }
 
+  public static final class AudioRecord.MetricsConstants {
+    field public static final String ATTRIBUTES = "android.media.audiorecord.attributes";
+    field public static final String CHANNEL_MASK = "android.media.audiorecord.channelMask";
+    field public static final String DURATION_MS = "android.media.audiorecord.durationMs";
+    field public static final String FRAME_COUNT = "android.media.audiorecord.frameCount";
+    field public static final String PORT_ID = "android.media.audiorecord.portId";
+    field public static final String START_COUNT = "android.media.audiorecord.startCount";
+  }
+
   public final class AudioRecordingConfiguration implements android.os.Parcelable {
     ctor public AudioRecordingConfiguration(int, int, int, android.media.AudioFormat, android.media.AudioFormat, int, String, int, boolean, int, android.media.audiofx.AudioEffect.Descriptor[], android.media.audiofx.AudioEffect.Descriptor[]);
     ctor public AudioRecordingConfiguration(int, int, int, android.media.AudioFormat, android.media.AudioFormat, int, String);
   }
 
+  public static final class AudioTrack.MetricsConstants {
+    field public static final String ATTRIBUTES = "android.media.audiotrack.attributes";
+    field public static final String CHANNEL_MASK = "android.media.audiotrack.channelMask";
+    field public static final String ENCODING = "android.media.audiotrack.encoding";
+    field public static final String FRAME_COUNT = "android.media.audiotrack.frameCount";
+    field public static final String PORT_ID = "android.media.audiotrack.portId";
+    field public static final String SAMPLE_RATE = "android.media.audiotrack.sampleRate";
+  }
+
   public final class BufferingParams implements android.os.Parcelable {
     method public int describeContents();
     method public int getInitialMarkMs();
     method public int getResumePlaybackMarkMs();
     method public void writeToParcel(android.os.Parcel, int);
-    field public static final android.os.Parcelable.Creator<android.media.BufferingParams> CREATOR;
+    field @NonNull public static final android.os.Parcelable.Creator<android.media.BufferingParams> CREATOR;
   }
 
   public static class BufferingParams.Builder {
@@ -956,7 +1026,7 @@
     method public android.media.MediaPlayer2.DrmInfo getDrmInfo(@NonNull android.media.DataSourceDesc);
     method public android.media.MediaDrm.KeyRequest getDrmKeyRequest(@NonNull android.media.DataSourceDesc, @Nullable byte[], @Nullable byte[], @Nullable String, int, @Nullable java.util.Map<java.lang.String,java.lang.String>) throws android.media.MediaPlayer2.NoDrmSchemeException;
     method public String getDrmPropertyString(@NonNull android.media.DataSourceDesc, @NonNull String) throws android.media.MediaPlayer2.NoDrmSchemeException;
-    method public Object prepareDrm(@NonNull android.media.DataSourceDesc, @NonNull java.util.UUID);
+    method @NonNull public Object prepareDrm(@NonNull android.media.DataSourceDesc, @NonNull java.util.UUID);
     method public byte[] provideDrmKeyResponse(@NonNull android.media.DataSourceDesc, @Nullable byte[], @NonNull byte[]) throws android.media.DeniedByServerException, android.media.MediaPlayer2.NoDrmSchemeException;
     method public void releaseDrm(@NonNull android.media.DataSourceDesc) throws android.media.MediaPlayer2.NoDrmSchemeException;
     method public void restoreDrmKeys(@NonNull android.media.DataSourceDesc, @NonNull byte[]) throws android.media.MediaPlayer2.NoDrmSchemeException;
@@ -1081,8 +1151,8 @@
 
   public class LinkAddress implements android.os.Parcelable {
     ctor public LinkAddress(java.net.InetAddress, int, int, int);
-    ctor public LinkAddress(java.net.InetAddress, int);
-    ctor public LinkAddress(String);
+    ctor public LinkAddress(@NonNull java.net.InetAddress, int);
+    ctor public LinkAddress(@NonNull String);
     ctor public LinkAddress(String, int, int);
     method public boolean isGlobalPreferred();
     method public boolean isIPv4();
@@ -1155,7 +1225,22 @@
     method public void setGateway(java.net.InetAddress);
     method public void setIpAddress(android.net.LinkAddress);
     method public void writeToParcel(android.os.Parcel, int);
-    field public static final android.os.Parcelable.Creator<android.net.StaticIpConfiguration> CREATOR;
+    field @NonNull public static final android.os.Parcelable.Creator<android.net.StaticIpConfiguration> CREATOR;
+  }
+
+  public final class TestNetworkInterface implements android.os.Parcelable {
+    ctor public TestNetworkInterface(android.os.ParcelFileDescriptor, String);
+    method public int describeContents();
+    method public android.os.ParcelFileDescriptor getFileDescriptor();
+    method public String getInterfaceName();
+    method public void writeToParcel(android.os.Parcel, int);
+    field public static final android.os.Parcelable.Creator<android.net.TestNetworkInterface> CREATOR;
+  }
+
+  public class TestNetworkManager {
+    method public android.net.TestNetworkInterface createTunInterface(@NonNull android.net.LinkAddress[]);
+    method public void setupTestNetwork(@NonNull String, @NonNull android.os.IBinder);
+    method public void teardownTestNetwork(@NonNull android.net.Network);
   }
 
   public class TrafficStats {
@@ -1372,19 +1457,16 @@
 package android.net.util {
 
   public class SocketUtils {
-    method public static void addArpEntry(java.net.Inet4Address, android.net.MacAddress, String, java.io.FileDescriptor) throws java.io.IOException;
-    method public static void attachControlPacketFilter(java.io.FileDescriptor, int) throws java.net.SocketException;
-    method public static void attachDhcpFilter(java.io.FileDescriptor) throws java.net.SocketException;
-    method public static void attachRaFilter(java.io.FileDescriptor, int) throws java.net.SocketException;
-    method public static void bindSocket(java.io.FileDescriptor, java.net.SocketAddress) throws android.system.ErrnoException, java.net.SocketException;
-    method public static void bindSocketToInterface(java.io.FileDescriptor, String) throws android.system.ErrnoException;
-    method public static void closeSocket(java.io.FileDescriptor) throws java.io.IOException;
-    method public static void connectSocket(java.io.FileDescriptor, java.net.SocketAddress) throws android.system.ErrnoException, java.net.SocketException;
+    method public static void addArpEntry(@NonNull java.net.Inet4Address, @NonNull android.net.MacAddress, @NonNull String, @NonNull java.io.FileDescriptor) throws java.io.IOException;
+    method public static void attachControlPacketFilter(@NonNull java.io.FileDescriptor, int) throws java.net.SocketException;
+    method public static void attachDhcpFilter(@NonNull java.io.FileDescriptor) throws java.net.SocketException;
+    method public static void attachRaFilter(@NonNull java.io.FileDescriptor, int) throws java.net.SocketException;
+    method public static void bindSocketToInterface(@NonNull java.io.FileDescriptor, @NonNull String) throws android.system.ErrnoException;
+    method public static void closeSocket(@Nullable java.io.FileDescriptor) throws java.io.IOException;
     method public static java.net.SocketAddress makeNetlinkSocketAddress(int, int);
     method public static java.net.SocketAddress makePacketSocketAddress(short, int);
-    method public static java.net.SocketAddress makePacketSocketAddress(int, byte[]);
-    method public static void sendTo(java.io.FileDescriptor, byte[], int, int, int, java.net.SocketAddress) throws android.system.ErrnoException, java.net.SocketException;
-    method public static void setSocketTimeValueOption(java.io.FileDescriptor, int, int, long) throws android.system.ErrnoException;
+    method public static java.net.SocketAddress makePacketSocketAddress(int, @NonNull byte[]);
+    method public static void setSocketTimeValueOption(@NonNull java.io.FileDescriptor, int, int, long) throws android.system.ErrnoException;
   }
 
 }
@@ -1412,8 +1494,8 @@
 
   public class Environment {
     method public static java.io.File buildPath(java.io.File, java.lang.String...);
-    method public static java.io.File getProductDirectory();
-    method public static java.io.File getStorageDirectory();
+    method @NonNull public static java.io.File getProductDirectory();
+    method @NonNull public static java.io.File getStorageDirectory();
   }
 
   public final class FileUtils {
@@ -1465,7 +1547,7 @@
     method public final void putInt64Array(long, long[]);
     method public final void putInt8(long, byte);
     method public final void putInt8Array(long, byte[]);
-    method public final void putNativeHandle(long, android.os.NativeHandle);
+    method public final void putNativeHandle(long, @Nullable android.os.NativeHandle);
     method public final void putString(long, String);
     method public static Boolean[] wrapArray(@NonNull boolean[]);
     method public static Long[] wrapArray(@NonNull long[]);
@@ -1485,7 +1567,7 @@
     method public final double readDouble();
     method public final java.util.ArrayList<java.lang.Double> readDoubleVector();
     method public final android.os.HwBlob readEmbeddedBuffer(long, long, long, boolean);
-    method public final android.os.NativeHandle readEmbeddedNativeHandle(long, long);
+    method @Nullable public final android.os.NativeHandle readEmbeddedNativeHandle(long, long);
     method public final float readFloat();
     method public final java.util.ArrayList<java.lang.Float> readFloatVector();
     method public final short readInt16();
@@ -1496,8 +1578,8 @@
     method public final java.util.ArrayList<java.lang.Long> readInt64Vector();
     method public final byte readInt8();
     method public final java.util.ArrayList<java.lang.Byte> readInt8Vector();
-    method public final android.os.NativeHandle readNativeHandle();
-    method public final java.util.ArrayList<android.os.NativeHandle> readNativeHandleVector();
+    method @Nullable public final android.os.NativeHandle readNativeHandle();
+    method @NonNull public final java.util.ArrayList<android.os.NativeHandle> readNativeHandleVector();
     method public final String readString();
     method public final java.util.ArrayList<java.lang.String> readStringVector();
     method public final android.os.IHwBinder readStrongBinder();
@@ -1521,8 +1603,8 @@
     method public final void writeInt8(byte);
     method public final void writeInt8Vector(java.util.ArrayList<java.lang.Byte>);
     method public final void writeInterfaceToken(String);
-    method public final void writeNativeHandle(android.os.NativeHandle);
-    method public final void writeNativeHandleVector(java.util.ArrayList<android.os.NativeHandle>);
+    method public final void writeNativeHandle(@Nullable android.os.NativeHandle);
+    method public final void writeNativeHandleVector(@NonNull java.util.ArrayList<android.os.NativeHandle>);
     method public final void writeStatus(int);
     method public final void writeString(String);
     method public final void writeStringVector(java.util.ArrayList<java.lang.String>);
@@ -1578,7 +1660,7 @@
     method public long getPrivacyPolicy();
     method public long getTimestamp();
     method public void writeToParcel(android.os.Parcel, int);
-    field public static final android.os.Parcelable.Creator<android.os.IncidentManager.IncidentReport> CREATOR;
+    field @NonNull public static final android.os.Parcelable.Creator<android.os.IncidentManager.IncidentReport> CREATOR;
   }
 
   public static class IncidentManager.PendingReport {
@@ -1602,7 +1684,7 @@
     method public void setAll(boolean);
     method public void setPrivacyPolicy(int);
     method public void writeToParcel(android.os.Parcel, int);
-    field public static final android.os.Parcelable.Creator<android.os.IncidentReportArgs> CREATOR;
+    field @NonNull public static final android.os.Parcelable.Creator<android.os.IncidentReportArgs> CREATOR;
   }
 
   public final class MessageQueue {
@@ -1615,10 +1697,10 @@
     ctor public NativeHandle(@NonNull java.io.FileDescriptor, boolean);
     ctor public NativeHandle(@NonNull java.io.FileDescriptor[], @NonNull int[], boolean);
     method public void close() throws java.io.IOException;
-    method public android.os.NativeHandle dup() throws java.io.IOException;
-    method public java.io.FileDescriptor getFileDescriptor();
-    method public java.io.FileDescriptor[] getFileDescriptors();
-    method public int[] getInts();
+    method @NonNull public android.os.NativeHandle dup() throws java.io.IOException;
+    method @NonNull public java.io.FileDescriptor getFileDescriptor();
+    method @NonNull public java.io.FileDescriptor[] getFileDescriptors();
+    method @NonNull public int[] getInts();
     method public boolean hasSingleFileDescriptor();
   }
 
@@ -1649,7 +1731,7 @@
     method public int describeContents();
     method public void sendResult(@Nullable android.os.Bundle);
     method public void writeToParcel(android.os.Parcel, int);
-    field public static final android.os.Parcelable.Creator<android.os.RemoteCallback> CREATOR;
+    field @NonNull public static final android.os.Parcelable.Creator<android.os.RemoteCallback> CREATOR;
   }
 
   public static interface RemoteCallback.OnResultListener {
@@ -1662,7 +1744,7 @@
   }
 
   public static final class StrictMode.ThreadPolicy.Builder {
-    method public android.os.StrictMode.ThreadPolicy.Builder detectExplicitGc();
+    method @NonNull public android.os.StrictMode.ThreadPolicy.Builder detectExplicitGc();
   }
 
   public static final class StrictMode.ViolationInfo implements android.os.Parcelable {
@@ -1674,7 +1756,7 @@
     method public Class<? extends android.os.strictmode.Violation> getViolationClass();
     method public String getViolationDetails();
     method public void writeToParcel(android.os.Parcel, int);
-    field public static final android.os.Parcelable.Creator<android.os.StrictMode.ViolationInfo> CREATOR;
+    field @NonNull public static final android.os.Parcelable.Creator<android.os.StrictMode.ViolationInfo> CREATOR;
     field public String broadcastIntentAction;
     field public int durationMillis;
     field public int numAnimationsRunning;
@@ -1697,9 +1779,9 @@
     method public static int getAppId(int);
     method public int getIdentifier();
     method public static boolean isApp(int);
-    field public static final android.os.UserHandle ALL;
-    field public static final android.os.UserHandle CURRENT;
-    field public static final android.os.UserHandle SYSTEM;
+    field @NonNull public static final android.os.UserHandle ALL;
+    field @NonNull public static final android.os.UserHandle CURRENT;
+    field @NonNull public static final android.os.UserHandle SYSTEM;
   }
 
   public class UserManager {
@@ -1729,7 +1811,7 @@
     method public android.os.VibrationEffect.OneShot scale(float, int);
     method public void validate();
     method public void writeToParcel(android.os.Parcel, int);
-    field public static final android.os.Parcelable.Creator<android.os.VibrationEffect.OneShot> CREATOR;
+    field @NonNull public static final android.os.Parcelable.Creator<android.os.VibrationEffect.OneShot> CREATOR;
   }
 
   public static class VibrationEffect.Prebaked extends android.os.VibrationEffect implements android.os.Parcelable {
@@ -1742,7 +1824,7 @@
     method public boolean shouldFallback();
     method public void validate();
     method public void writeToParcel(android.os.Parcel, int);
-    field public static final android.os.Parcelable.Creator<android.os.VibrationEffect.Prebaked> CREATOR;
+    field @NonNull public static final android.os.Parcelable.Creator<android.os.VibrationEffect.Prebaked> CREATOR;
   }
 
   public static class VibrationEffect.Waveform extends android.os.VibrationEffect implements android.os.Parcelable {
@@ -1755,7 +1837,7 @@
     method public android.os.VibrationEffect.Waveform scale(float, int);
     method public void validate();
     method public void writeToParcel(android.os.Parcel, int);
-    field public static final android.os.Parcelable.Creator<android.os.VibrationEffect.Waveform> CREATOR;
+    field @NonNull public static final android.os.Parcelable.Creator<android.os.VibrationEffect.Waveform> CREATOR;
   }
 
   public class VintfObject {
@@ -1829,7 +1911,7 @@
     method public int describeContents();
     method public android.os.health.HealthStats getHealthStats();
     method public void writeToParcel(android.os.Parcel, int);
-    field public static final android.os.Parcelable.Creator<android.os.health.HealthStatsParceler> CREATOR;
+    field @NonNull public static final android.os.Parcelable.Creator<android.os.health.HealthStatsParceler> CREATOR;
   }
 
   public class HealthStatsWriter {
@@ -1920,15 +2002,26 @@
   }
 
   public final class DeviceConfig {
+    method @RequiresPermission("android.permission.READ_DEVICE_CONFIG") public static void addOnPropertiesChangedListener(@NonNull String, @NonNull java.util.concurrent.Executor, @NonNull android.provider.DeviceConfig.OnPropertiesChangedListener);
     method @RequiresPermission("android.permission.READ_DEVICE_CONFIG") public static void addOnPropertyChangedListener(@NonNull String, @NonNull java.util.concurrent.Executor, @NonNull android.provider.DeviceConfig.OnPropertyChangedListener);
+    method @RequiresPermission("android.permission.READ_DEVICE_CONFIG") public static boolean getBoolean(String, String, boolean);
+    method @RequiresPermission("android.permission.READ_DEVICE_CONFIG") public static float getFloat(String, String, float);
+    method @RequiresPermission("android.permission.READ_DEVICE_CONFIG") public static int getInt(String, String, int);
+    method @RequiresPermission("android.permission.READ_DEVICE_CONFIG") public static long getLong(String, String, long);
     method @RequiresPermission("android.permission.READ_DEVICE_CONFIG") public static String getProperty(String, String);
-    method public static void removeOnPropertyChangedListener(android.provider.DeviceConfig.OnPropertyChangedListener);
+    method @RequiresPermission("android.permission.READ_DEVICE_CONFIG") public static String getString(String, String, String);
+    method public static void removeOnPropertiesChangedListener(@NonNull android.provider.DeviceConfig.OnPropertiesChangedListener);
+    method public static void removeOnPropertyChangedListener(@NonNull android.provider.DeviceConfig.OnPropertyChangedListener);
     method @RequiresPermission("android.permission.WRITE_DEVICE_CONFIG") public static void resetToDefaults(int, @Nullable String);
     method @RequiresPermission("android.permission.WRITE_DEVICE_CONFIG") public static boolean setProperty(String, String, String, boolean);
     field public static final String NAMESPACE_AUTOFILL = "autofill";
     field public static final String NAMESPACE_CONTENT_CAPTURE = "content_capture";
   }
 
+  public static interface DeviceConfig.OnPropertiesChangedListener {
+    method public void onPropertiesChanged(@NonNull android.provider.DeviceConfig.Properties);
+  }
+
   public static interface DeviceConfig.OnPropertyChangedListener {
     method public void onPropertyChanged(String, String, String);
   }
@@ -1938,6 +2031,16 @@
     field public static final String PROPERTY_LOCATION_ACCESS_CHECK_ENABLED = "location_access_check_enabled";
   }
 
+  public static class DeviceConfig.Properties {
+    method public boolean getBoolean(@NonNull String, boolean);
+    method public float getFloat(@NonNull String, float);
+    method public int getInt(@NonNull String, int);
+    method @NonNull public java.util.Set<java.lang.String> getKeyset();
+    method public long getLong(@NonNull String, long);
+    method @NonNull public String getNamespace();
+    method @Nullable public String getString(@NonNull String, @Nullable String);
+  }
+
   public final class MediaStore {
     method @RequiresPermission(android.Manifest.permission.CLEAR_APP_USER_DATA) public static void deleteContributedMedia(android.content.Context, String, android.os.UserHandle) throws java.io.IOException;
     method @RequiresPermission(android.Manifest.permission.CLEAR_APP_USER_DATA) public static long getContributedMediaSize(android.content.Context, String, android.os.UserHandle) throws java.io.IOException;
@@ -1971,12 +2074,14 @@
     field public static final String CAPTIVE_PORTAL_USE_HTTPS = "captive_portal_use_https";
     field public static final String DATA_STALL_CONSECUTIVE_DNS_TIMEOUT_THRESHOLD = "data_stall_consecutive_dns_timeout_threshold";
     field public static final String DATA_STALL_EVALUATION_TYPE = "data_stall_evaluation_type";
+    field public static final int DATA_STALL_EVALUATION_TYPE_DNS = 1; // 0x1
     field public static final String DATA_STALL_MIN_EVALUATE_INTERVAL = "data_stall_min_evaluate_interval";
     field public static final String DATA_STALL_VALID_DNS_TIME_THRESHOLD = "data_stall_valid_dns_time_threshold";
     field public static final String DYNAMIC_POWER_SAVINGS_DISABLE_THRESHOLD = "dynamic_power_savings_disable_threshold";
     field public static final String DYNAMIC_POWER_SAVINGS_ENABLED = "dynamic_power_savings_enabled";
     field public static final String HIDDEN_API_BLACKLIST_EXEMPTIONS = "hidden_api_blacklist_exemptions";
     field public static final String LOCATION_GLOBAL_KILL_SWITCH = "location_global_kill_switch";
+    field public static final String LOCATION_IGNORE_SETTINGS_PACKAGE_WHITELIST = "location_ignore_settings_package_whitelist";
     field public static final String LOW_POWER_MODE = "low_power";
     field public static final String LOW_POWER_MODE_STICKY = "low_power_sticky";
     field public static final String OVERLAY_DISPLAY_DEVICES = "overlay_display_devices";
@@ -2038,8 +2143,8 @@
   }
 
   public class DeviceIdAttestationException extends java.lang.Exception {
-    ctor public DeviceIdAttestationException(String);
-    ctor public DeviceIdAttestationException(String, Throwable);
+    ctor public DeviceIdAttestationException(@Nullable String);
+    ctor public DeviceIdAttestationException(@Nullable String, @Nullable Throwable);
   }
 
   public static final class KeyGenParameterSpec.Builder {
@@ -2100,7 +2205,7 @@
     method public android.util.ArrayMap<java.lang.String,android.os.Bundle> getFieldClassificationArgs();
     method public String[] getValues();
     method public void writeToParcel(android.os.Parcel, int);
-    field public static final android.os.Parcelable.Creator<android.service.autofill.CompositeUserData> CREATOR;
+    field @NonNull public static final android.os.Parcelable.Creator<android.service.autofill.CompositeUserData> CREATOR;
   }
 
   public final class CustomDescription implements android.os.Parcelable {
@@ -2203,9 +2308,8 @@
 
   public static final class FillResponse.Builder {
     ctor public FillResponse.Builder();
-    method public android.service.autofill.augmented.FillResponse build();
-    method public android.service.autofill.augmented.FillResponse.Builder setFillWindow(@NonNull android.service.autofill.augmented.FillWindow);
-    method public android.service.autofill.augmented.FillResponse.Builder setIgnoredIds(@NonNull java.util.List<android.view.autofill.AutofillId>);
+    method @NonNull public android.service.autofill.augmented.FillResponse build();
+    method @NonNull public android.service.autofill.augmented.FillResponse.Builder setFillWindow(@NonNull android.service.autofill.augmented.FillWindow);
   }
 
   public final class FillWindow implements java.lang.AutoCloseable {
@@ -2226,9 +2330,20 @@
 
 package android.service.contentcapture {
 
+  public final class ActivityEvent implements android.os.Parcelable {
+    method public int describeContents();
+    method @NonNull public android.content.ComponentName getComponentName();
+    method public int getEventType();
+    method public void writeToParcel(@NonNull android.os.Parcel, int);
+    field @NonNull public static final android.os.Parcelable.Creator<android.service.contentcapture.ActivityEvent> CREATOR;
+    field public static final int TYPE_ACTIVITY_PAUSED = 2; // 0x2
+    field public static final int TYPE_ACTIVITY_RESUMED = 1; // 0x1
+  }
+
   public abstract class ContentCaptureService extends android.app.Service {
     ctor public ContentCaptureService();
     method public final void disableContentCaptureServices();
+    method public void onActivityEvent(@NonNull android.service.contentcapture.ActivityEvent);
     method public void onActivitySnapshot(@NonNull android.view.contentcapture.ContentCaptureSessionId, @NonNull android.service.contentcapture.SnapshotData);
     method public void onConnected();
     method public void onContentCaptureEvent(@NonNull android.view.contentcapture.ContentCaptureSessionId, @NonNull android.view.contentcapture.ContentCaptureEvent);
@@ -2236,18 +2351,17 @@
     method public void onDestroyContentCaptureSession(@NonNull android.view.contentcapture.ContentCaptureSessionId);
     method public void onDisconnected();
     method public void onUserDataRemovalRequest(@NonNull android.view.contentcapture.UserDataRemovalRequest);
-    method @Deprecated public final void setContentCaptureWhitelist(@Nullable java.util.List<java.lang.String>, @Nullable java.util.List<android.content.ComponentName>);
     method public final void setContentCaptureWhitelist(@Nullable java.util.Set<java.lang.String>, @Nullable java.util.Set<android.content.ComponentName>);
     field public static final String SERVICE_INTERFACE = "android.service.contentcapture.ContentCaptureService";
   }
 
   public final class SnapshotData implements android.os.Parcelable {
     method public int describeContents();
-    method public android.app.assist.AssistContent getAssistContent();
-    method public android.os.Bundle getAssistData();
-    method public android.app.assist.AssistStructure getAssistStructure();
+    method @Nullable public android.app.assist.AssistContent getAssistContent();
+    method @NonNull public android.os.Bundle getAssistData();
+    method @NonNull public android.app.assist.AssistStructure getAssistStructure();
     method public void writeToParcel(@NonNull android.os.Parcel, int);
-    field public static final android.os.Parcelable.Creator<android.service.contentcapture.SnapshotData> CREATOR;
+    field @NonNull public static final android.os.Parcelable.Creator<android.service.contentcapture.SnapshotData> CREATOR;
   }
 
 }
@@ -2259,7 +2373,38 @@
   }
 
   public abstract class NotificationListenerService extends android.app.Service {
-    method public void onNotificationRemoved(android.service.notification.StatusBarNotification, android.service.notification.NotificationListenerService.RankingMap, android.service.notification.NotificationStats, int);
+    method public void onNotificationRemoved(@NonNull android.service.notification.StatusBarNotification, @NonNull android.service.notification.NotificationListenerService.RankingMap, @NonNull android.service.notification.NotificationStats, int);
+  }
+
+  public final class NotificationStats implements android.os.Parcelable {
+    ctor public NotificationStats();
+    method public int describeContents();
+    method public int getDismissalSentiment();
+    method public int getDismissalSurface();
+    method public boolean hasDirectReplied();
+    method public boolean hasExpanded();
+    method public boolean hasInteracted();
+    method public boolean hasSeen();
+    method public boolean hasSnoozed();
+    method public boolean hasViewedSettings();
+    method public void setDirectReplied();
+    method public void setDismissalSentiment(int);
+    method public void setDismissalSurface(int);
+    method public void setExpanded();
+    method public void setSeen();
+    method public void setSnoozed();
+    method public void setViewedSettings();
+    method public void writeToParcel(android.os.Parcel, int);
+    field @NonNull public static final android.os.Parcelable.Creator<android.service.notification.NotificationStats> CREATOR;
+    field public static final int DISMISSAL_AOD = 2; // 0x2
+    field public static final int DISMISSAL_NOT_DISMISSED = -1; // 0xffffffff
+    field public static final int DISMISSAL_OTHER = 0; // 0x0
+    field public static final int DISMISSAL_PEEK = 1; // 0x1
+    field public static final int DISMISSAL_SHADE = 3; // 0x3
+    field public static final int DISMISS_SENTIMENT_NEGATIVE = 0; // 0x0
+    field public static final int DISMISS_SENTIMENT_NEUTRAL = 1; // 0x1
+    field public static final int DISMISS_SENTIMENT_POSITIVE = 2; // 0x2
+    field public static final int DISMISS_SENTIMENT_UNKNOWN = -1000; // 0xfffffc18
   }
 
   public final class SnoozeCriterion implements android.os.Parcelable {
@@ -2270,7 +2415,7 @@
     method public CharSequence getExplanation();
     method public String getId();
     method public void writeToParcel(android.os.Parcel, int);
-    field public static final android.os.Parcelable.Creator<android.service.notification.SnoozeCriterion> CREATOR;
+    field @NonNull public static final android.os.Parcelable.Creator<android.service.notification.SnoozeCriterion> CREATOR;
   }
 
 }
@@ -2293,10 +2438,6 @@
     method public android.telecom.Connection getPrimaryConnection();
   }
 
-  public final class PhoneAccountSuggestion implements android.os.Parcelable {
-    ctor public PhoneAccountSuggestion(android.telecom.PhoneAccountHandle, int, boolean);
-  }
-
   public class PhoneAccountSuggestionService extends android.app.Service {
     ctor public PhoneAccountSuggestionService();
     method public void onAccountSuggestionRequest(@NonNull String);
@@ -2308,7 +2449,7 @@
   public class TelecomManager {
     method @RequiresPermission("android.permission.READ_PRIVILEGED_PHONE_STATE") public int getCurrentTtyMode();
     method @RequiresPermission(android.Manifest.permission.MODIFY_PHONE_STATE) public boolean isInEmergencyCall();
-    method @RequiresPermission(android.Manifest.permission.MODIFY_PHONE_STATE) public void setUserSelectedOutgoingPhoneAccount(android.telecom.PhoneAccountHandle);
+    method @RequiresPermission(android.Manifest.permission.MODIFY_PHONE_STATE) public void setUserSelectedOutgoingPhoneAccount(@Nullable android.telecom.PhoneAccountHandle);
     field public static final int TTY_MODE_FULL = 1; // 0x1
     field public static final int TTY_MODE_HCO = 2; // 0x2
     field public static final int TTY_MODE_OFF = 0; // 0x0
@@ -2381,7 +2522,7 @@
     method public android.net.Uri getContentUri();
     method public android.net.Uri getFilePathUri();
     method public void writeToParcel(android.os.Parcel, int);
-    field public static final android.os.Parcelable.Creator<android.telephony.mbms.UriPathPair> CREATOR;
+    field @NonNull public static final android.os.Parcelable.Creator<android.telephony.mbms.UriPathPair> CREATOR;
   }
 
 }
@@ -2413,12 +2554,12 @@
   public class MbmsGroupCallServiceBase extends android.app.Service {
     ctor public MbmsGroupCallServiceBase();
     method public void dispose(int) throws android.os.RemoteException;
-    method public int initialize(android.telephony.mbms.MbmsGroupCallSessionCallback, int) throws android.os.RemoteException;
+    method public int initialize(@NonNull android.telephony.mbms.MbmsGroupCallSessionCallback, int) throws android.os.RemoteException;
     method public void onAppCallbackDied(int, int);
     method public android.os.IBinder onBind(android.content.Intent);
-    method public int startGroupCall(int, long, java.util.List<java.lang.Integer>, java.util.List<java.lang.Integer>, android.telephony.mbms.GroupCallCallback);
+    method public int startGroupCall(int, long, @NonNull java.util.List<java.lang.Integer>, @NonNull java.util.List<java.lang.Integer>, @NonNull android.telephony.mbms.GroupCallCallback);
     method public void stopGroupCall(int, long);
-    method public void updateGroupCall(int, long, java.util.List<java.lang.Integer>, java.util.List<java.lang.Integer>);
+    method public void updateGroupCall(int, long, @NonNull java.util.List<java.lang.Integer>, @NonNull java.util.List<java.lang.Integer>);
   }
 
   public class MbmsStreamingServiceBase extends android.os.Binder {
@@ -2706,7 +2847,7 @@
   }
 
   public final class Display {
-    method public boolean supportsSystemDecorations();
+    method public boolean hasAccess(int);
   }
 
   public class FocusFinder {
@@ -2778,13 +2919,14 @@
     method public default void setShouldShowIme(int, boolean);
     method public default void setShouldShowSystemDecors(int, boolean);
     method public default void setShouldShowWithInsecureKeyguard(int, boolean);
+    method public default boolean shouldShowSystemDecors(int);
   }
 
   public static class WindowManager.LayoutParams extends android.view.ViewGroup.LayoutParams implements android.os.Parcelable {
     field public static final int ACCESSIBILITY_TITLE_CHANGED = 33554432; // 0x2000000
     field public static final int PRIVATE_FLAG_NO_MOVE_ANIMATION = 64; // 0x40
     field public CharSequence accessibilityTitle;
-    field @android.view.ViewDebug.ExportedProperty(flagMapping={@android.view.ViewDebug.FlagToString(mask=0x1, equals=0x1, name="FAKE_HARDWARE_ACCELERATED"), @android.view.ViewDebug.FlagToString(mask=0x2, equals=0x2, name="FORCE_HARDWARE_ACCELERATED"), @android.view.ViewDebug.FlagToString(mask=0x4, equals=0x4, name="WANTS_OFFSET_NOTIFICATIONS"), @android.view.ViewDebug.FlagToString(mask=0x10, equals=0x10, name="SHOW_FOR_ALL_USERS"), @android.view.ViewDebug.FlagToString(mask=android.view.WindowManager.LayoutParams.PRIVATE_FLAG_NO_MOVE_ANIMATION, equals=android.view.WindowManager.LayoutParams.PRIVATE_FLAG_NO_MOVE_ANIMATION, name="NO_MOVE_ANIMATION"), @android.view.ViewDebug.FlagToString(mask=0x80, equals=0x80, name="COMPATIBLE_WINDOW"), @android.view.ViewDebug.FlagToString(mask=0x100, equals=0x100, name="SYSTEM_ERROR"), @android.view.ViewDebug.FlagToString(mask=0x200, equals=0x200, name="INHERIT_TRANSLUCENT_DECOR"), @android.view.ViewDebug.FlagToString(mask=0x400, equals=0x400, name="KEYGUARD"), @android.view.ViewDebug.FlagToString(mask=0x800, equals=0x800, name="DISABLE_WALLPAPER_TOUCH_EVENTS"), @android.view.ViewDebug.FlagToString(mask=0x1000, equals=0x1000, name="FORCE_STATUS_BAR_VISIBLE_TRANSPARENT"), @android.view.ViewDebug.FlagToString(mask=0x2000, equals=0x2000, name="PRESERVE_GEOMETRY"), @android.view.ViewDebug.FlagToString(mask=0x4000, equals=0x4000, name="FORCE_DECOR_VIEW_VISIBILITY"), @android.view.ViewDebug.FlagToString(mask=0x8000, equals=0x8000, name="WILL_NOT_REPLACE_ON_RELAUNCH"), @android.view.ViewDebug.FlagToString(mask=0x10000, equals=0x10000, name="LAYOUT_CHILD_WINDOW_IN_PARENT_FRAME"), @android.view.ViewDebug.FlagToString(mask=0x20000, equals=0x20000, name="FORCE_DRAW_STATUS_BAR_BACKGROUND"), @android.view.ViewDebug.FlagToString(mask=0x40000, equals=0x40000, name="SUSTAINED_PERFORMANCE_MODE"), @android.view.ViewDebug.FlagToString(mask=0x80000, equals=0x80000, name="HIDE_NON_SYSTEM_OVERLAY_WINDOWS"), @android.view.ViewDebug.FlagToString(mask=0x100000, equals=0x100000, name="IS_ROUNDED_CORNERS_OVERLAY"), @android.view.ViewDebug.FlagToString(mask=0x400000, equals=0x400000, name="IS_SCREEN_DECOR"), @android.view.ViewDebug.FlagToString(mask=0x800000, equals=0x800000, name="STATUS_FORCE_SHOW_NAVIGATION")}) public int privateFlags;
+    field @android.view.ViewDebug.ExportedProperty(flagMapping={@android.view.ViewDebug.FlagToString(mask=0x1, equals=0x1, name="FAKE_HARDWARE_ACCELERATED"), @android.view.ViewDebug.FlagToString(mask=0x2, equals=0x2, name="FORCE_HARDWARE_ACCELERATED"), @android.view.ViewDebug.FlagToString(mask=0x4, equals=0x4, name="WANTS_OFFSET_NOTIFICATIONS"), @android.view.ViewDebug.FlagToString(mask=0x10, equals=0x10, name="SHOW_FOR_ALL_USERS"), @android.view.ViewDebug.FlagToString(mask=android.view.WindowManager.LayoutParams.PRIVATE_FLAG_NO_MOVE_ANIMATION, equals=android.view.WindowManager.LayoutParams.PRIVATE_FLAG_NO_MOVE_ANIMATION, name="NO_MOVE_ANIMATION"), @android.view.ViewDebug.FlagToString(mask=0x80, equals=0x80, name="COMPATIBLE_WINDOW"), @android.view.ViewDebug.FlagToString(mask=0x100, equals=0x100, name="SYSTEM_ERROR"), @android.view.ViewDebug.FlagToString(mask=0x200, equals=0x200, name="INHERIT_TRANSLUCENT_DECOR"), @android.view.ViewDebug.FlagToString(mask=0x400, equals=0x400, name="KEYGUARD"), @android.view.ViewDebug.FlagToString(mask=0x800, equals=0x800, name="DISABLE_WALLPAPER_TOUCH_EVENTS"), @android.view.ViewDebug.FlagToString(mask=0x1000, equals=0x1000, name="FORCE_STATUS_BAR_VISIBLE_TRANSPARENT"), @android.view.ViewDebug.FlagToString(mask=0x2000, equals=0x2000, name="PRESERVE_GEOMETRY"), @android.view.ViewDebug.FlagToString(mask=0x4000, equals=0x4000, name="FORCE_DECOR_VIEW_VISIBILITY"), @android.view.ViewDebug.FlagToString(mask=0x8000, equals=0x8000, name="WILL_NOT_REPLACE_ON_RELAUNCH"), @android.view.ViewDebug.FlagToString(mask=0x10000, equals=0x10000, name="LAYOUT_CHILD_WINDOW_IN_PARENT_FRAME"), @android.view.ViewDebug.FlagToString(mask=0x20000, equals=0x20000, name="FORCE_DRAW_STATUS_BAR_BACKGROUND"), @android.view.ViewDebug.FlagToString(mask=0x40000, equals=0x40000, name="SUSTAINED_PERFORMANCE_MODE"), @android.view.ViewDebug.FlagToString(mask=0x80000, equals=0x80000, name="HIDE_NON_SYSTEM_OVERLAY_WINDOWS"), @android.view.ViewDebug.FlagToString(mask=0x100000, equals=0x100000, name="IS_ROUNDED_CORNERS_OVERLAY"), @android.view.ViewDebug.FlagToString(mask=0x400000, equals=0x400000, name="IS_SCREEN_DECOR"), @android.view.ViewDebug.FlagToString(mask=0x800000, equals=0x800000, name="STATUS_FORCE_SHOW_NAVIGATION"), @android.view.ViewDebug.FlagToString(mask=0x1000000, equals=0x1000000, name="COLOR_SPACE_AGNOSTIC")}) public int privateFlags;
   }
 
 }
@@ -2836,7 +2978,6 @@
   }
 
   public final class AutofillManager {
-    method @Deprecated public void setAugmentedAutofillWhitelist(@Nullable java.util.List<java.lang.String>, @Nullable java.util.List<android.content.ComponentName>);
     method public void setAugmentedAutofillWhitelist(@Nullable java.util.Set<java.lang.String>, @Nullable java.util.Set<android.content.ComponentName>);
     field public static final String DEVICE_CONFIG_AUTOFILL_SMART_SUGGESTION_SUPPORTED_MODES = "smart_suggestion_supported_modes";
     field public static final int FLAG_SMART_SUGGESTION_OFF = 0; // 0x0
@@ -2868,7 +3009,7 @@
     method public int getType();
     method @Nullable public android.view.contentcapture.ViewNode getViewNode();
     method public void writeToParcel(android.os.Parcel, int);
-    field public static final android.os.Parcelable.Creator<android.view.contentcapture.ContentCaptureEvent> CREATOR;
+    field @NonNull public static final android.os.Parcelable.Creator<android.view.contentcapture.ContentCaptureEvent> CREATOR;
     field public static final int TYPE_CONTEXT_UPDATED = 6; // 0x6
     field public static final int TYPE_SESSION_PAUSED = 8; // 0x8
     field public static final int TYPE_SESSION_RESUMED = 7; // 0x7
@@ -2972,7 +3113,7 @@
     method public abstract String value();
   }
 
-  @java.lang.annotation.Retention(java.lang.annotation.RetentionPolicy.SOURCE) @java.lang.annotation.Target({java.lang.annotation.ElementType.METHOD}) public @interface InspectableProperty {
+  @java.lang.annotation.Retention(java.lang.annotation.RetentionPolicy.SOURCE) @java.lang.annotation.Target({java.lang.annotation.ElementType.METHOD, java.lang.annotation.ElementType.FIELD}) public @interface InspectableProperty {
     method public abstract int attributeId() default android.content.res.Resources.ID_NULL;
     method public abstract android.view.inspector.InspectableProperty.EnumMap[] enumMapping() default {};
     method public abstract android.view.inspector.InspectableProperty.FlagMap[] flagMapping() default {};
@@ -2999,6 +3140,7 @@
     enum_constant public static final android.view.inspector.InspectableProperty.ValueType INT_ENUM;
     enum_constant public static final android.view.inspector.InspectableProperty.ValueType INT_FLAG;
     enum_constant public static final android.view.inspector.InspectableProperty.ValueType NONE;
+    enum_constant public static final android.view.inspector.InspectableProperty.ValueType RESOURCE_ID;
   }
 
 }
diff --git a/cmds/hid/hid b/cmds/hid/hid
index 2359fcd..3931da1 100755
--- a/cmds/hid/hid
+++ b/cmds/hid/hid
@@ -5,4 +5,10 @@
 #
 base=/system
 export CLASSPATH=$base/framework/hid.jar
+
+# Preload the native portion libhidcommand_jni.so to bypass the dependency
+# checks in the Java classloader, which prohibit dependencies that aren't
+# listed in system/core/rootdir/etc/public.libraries.android.txt.
+export LD_PRELOAD=libhidcommand_jni.so
+
 exec app_process $base/bin com.android.commands.hid.Hid "$@"
diff --git a/cmds/idmap2/idmap2/Create.cpp b/cmds/idmap2/idmap2/Create.cpp
index 6703909..c416fa1 100644
--- a/cmds/idmap2/idmap2/Create.cpp
+++ b/cmds/idmap2/idmap2/Create.cpp
@@ -28,7 +28,6 @@
 #include "idmap2/FileUtils.h"
 #include "idmap2/Idmap.h"
 #include "idmap2/Policies.h"
-#include "idmap2/Result.h"
 #include "idmap2/SysTrace.h"
 
 using android::ApkAssets;
@@ -38,7 +37,6 @@
 using android::idmap2::PoliciesToBitmask;
 using android::idmap2::PolicyBitmask;
 using android::idmap2::PolicyFlags;
-using android::idmap2::Result;
 using android::idmap2::utils::kIdmapFilePermissionMask;
 using android::idmap2::utils::UidHasWriteAccessToPath;
 
@@ -77,9 +75,11 @@
   }
 
   PolicyBitmask fulfilled_policies = 0;
-  if (auto result = PoliciesToBitmask(policies, out_error)) {
-    fulfilled_policies |= *result;
+  auto conv_result = PoliciesToBitmask(policies);
+  if (conv_result) {
+    fulfilled_policies |= *conv_result;
   } else {
+    out_error << "error: " << conv_result.GetErrorMessage() << std::endl;
     return false;
   }
 
diff --git a/cmds/idmap2/idmap2/Lookup.cpp b/cmds/idmap2/idmap2/Lookup.cpp
index 553d8ca..83a40ef 100644
--- a/cmds/idmap2/idmap2/Lookup.cpp
+++ b/cmds/idmap2/idmap2/Lookup.cpp
@@ -53,6 +53,7 @@
 using android::StringPiece16;
 using android::base::StringPrintf;
 using android::idmap2::CommandLineOptions;
+using android::idmap2::Error;
 using android::idmap2::IdmapHeader;
 using android::idmap2::ResourceId;
 using android::idmap2::Result;
@@ -71,17 +72,17 @@
   ResourceId resid;
   resid = strtol(res.c_str(), &endptr, kBaseHex);
   if (*endptr == '\0') {
-    return {resid};
+    return resid;
   }
 
   // next, try to parse as a package:type/name string
   resid = am.GetResourceId(res, "", fallback_package);
   if (is_valid_resid(resid)) {
-    return {resid};
+    return resid;
   }
 
   // end of the road: res could not be parsed
-  return {};
+  return Error("failed to obtain resource id for %s", res.c_str());
 }
 
 Result<std::string> WARN_UNUSED GetValue(const AssetManager2& am, ResourceId resid) {
@@ -90,7 +91,7 @@
   uint32_t flags;
   ApkAssetsCookie cookie = am.GetResource(resid, false, 0, &value, &config, &flags);
   if (cookie == kInvalidCookie) {
-    return {};
+    return Error("no resource 0x%08x in asset manager", resid);
   }
 
   std::string out;
@@ -128,31 +129,31 @@
       out.append(StringPrintf("dataType=0x%02x data=0x%08x", value.dataType, value.data));
       break;
   }
-  return {out};
+  return out;
 }
 
 Result<std::string> GetTargetPackageNameFromManifest(const std::string& apk_path) {
   const auto zip = ZipFile::Open(apk_path);
   if (!zip) {
-    return {};
+    return Error("failed to open %s as zip", apk_path.c_str());
   }
   const auto entry = zip->Uncompress("AndroidManifest.xml");
   if (!entry) {
-    return {};
+    return Error("failed to uncompress AndroidManifest.xml in %s", apk_path.c_str());
   }
   const auto xml = Xml::Create(entry->buf, entry->size);
   if (!xml) {
-    return {};
+    return Error("failed to create XML buffer");
   }
   const auto tag = xml->FindTag("overlay");
   if (!tag) {
-    return {};
+    return Error("failed to find <overlay> tag");
   }
   const auto iter = tag->find("targetPackage");
   if (iter == tag->end()) {
-    return {};
+    return Error("failed to find targetPackage attribute");
   }
-  return {iter->second};
+  return iter->second;
 }
 }  // namespace
 
diff --git a/cmds/idmap2/idmap2/Scan.cpp b/cmds/idmap2/idmap2/Scan.cpp
index 873779f..e85f132 100644
--- a/cmds/idmap2/idmap2/Scan.cpp
+++ b/cmds/idmap2/idmap2/Scan.cpp
@@ -38,7 +38,10 @@
 
 using android::idmap2::CommandLineOptions;
 using android::idmap2::Idmap;
-using android::idmap2::PoliciesToBitmask;
+using android::idmap2::kPolicyProduct;
+using android::idmap2::kPolicyPublic;
+using android::idmap2::kPolicySystem;
+using android::idmap2::kPolicyVendor;
 using android::idmap2::PolicyBitmask;
 using android::idmap2::PolicyFlags;
 using android::idmap2::Result;
@@ -87,20 +90,22 @@
   return std::make_unique<std::vector<std::string>>(paths.cbegin(), paths.cend());
 }
 
-PolicyBitmask PolicyForPath(const std::string& apk_path) {
-  static const std::vector<std::pair<std::string, PolicyBitmask>> values = {
-      {"/product/", PolicyFlags::POLICY_PRODUCT_PARTITION},
-      {"/system/", PolicyFlags::POLICY_SYSTEM_PARTITION},
-      {"/vendor/", PolicyFlags::POLICY_VENDOR_PARTITION},
+std::vector<std::string> PoliciesForPath(const std::string& apk_path) {
+  static const std::vector<std::pair<std::string, std::string>> values = {
+      {"/product/", kPolicyProduct},
+      {"/system/", kPolicySystem},
+      {"/vendor/", kPolicyVendor},
   };
 
+  std::vector<std::string> fulfilled_policies = {kPolicyPublic};
   for (auto const& pair : values) {
     if (apk_path.compare(0, pair.first.size(), pair.first) == 0) {
-      return pair.second | PolicyFlags::POLICY_PUBLIC;
+      fulfilled_policies.emplace_back(pair.second);
+      break;
     }
   }
 
-  return PolicyFlags::POLICY_PUBLIC;
+  return fulfilled_policies;
 }
 
 }  // namespace
@@ -142,9 +147,9 @@
   std::vector<InputOverlay> interesting_apks;
   for (const std::string& path : *apk_paths) {
     Result<OverlayManifestInfo> overlay_info =
-        ExtractOverlayManifestInfo(path, out_error,
-                                   /* assert_overlay */ false);
+        ExtractOverlayManifestInfo(path, /* assert_overlay */ false);
     if (!overlay_info) {
+      out_error << "error: " << overlay_info.GetErrorMessage() << std::endl;
       return false;
     }
 
@@ -161,19 +166,17 @@
       continue;
     }
 
-    PolicyBitmask fulfilled_policies;
+    std::vector<std::string> fulfilled_policies;
     if (!override_policies.empty()) {
-      if (Result<PolicyBitmask> result = PoliciesToBitmask(override_policies, out_error)) {
-        fulfilled_policies = *result;
-      } else {
-        return false;
-      }
+      fulfilled_policies = override_policies;
     } else {
-      fulfilled_policies = PolicyForPath(path);
+      fulfilled_policies = PoliciesForPath(path);
     }
 
     bool ignore_overlayable = false;
-    if ((fulfilled_policies & PolicyFlags::POLICY_VENDOR_PARTITION) != 0 && !VendorIsQOrLater()) {
+    if (std::find(fulfilled_policies.begin(), fulfilled_policies.end(), kPolicyVendor) !=
+            fulfilled_policies.end() &&
+        !VendorIsQOrLater()) {
       // If the overlay is on a pre-Q vendor partition, do not enforce overlayable
       // restrictions on this overlay because the pre-Q platform has no understanding of
       // overlayable.
@@ -183,7 +186,7 @@
     std::string idmap_path = Idmap::CanonicalIdmapPathFor(output_directory, path);
 
     // Sort the static overlays in ascending priority order
-    InputOverlay input{path, idmap_path, overlay_info->priority, override_policies,
+    InputOverlay input{path, idmap_path, overlay_info->priority, fulfilled_policies,
                        ignore_overlayable};
     interesting_apks.insert(
         std::lower_bound(interesting_apks.begin(), interesting_apks.end(), input), input);
@@ -209,8 +212,8 @@
       }
 
       for (const std::string& policy : overlay.policies) {
-        verify_args.emplace_back("--policy");
-        verify_args.emplace_back(policy);
+        create_args.emplace_back("--policy");
+        create_args.emplace_back(policy);
       }
 
       if (!Create(create_args, out_error)) {
diff --git a/cmds/idmap2/idmap2d/Idmap2Service.cpp b/cmds/idmap2/idmap2d/Idmap2Service.cpp
index 0e4bd89..fa94414 100644
--- a/cmds/idmap2/idmap2d/Idmap2Service.cpp
+++ b/cmds/idmap2/idmap2d/Idmap2Service.cpp
@@ -34,7 +34,6 @@
 #include "idmap2/FileUtils.h"
 #include "idmap2/Idmap.h"
 #include "idmap2/Policies.h"
-#include "idmap2/Result.h"
 #include "idmap2/SysTrace.h"
 
 #include "idmap2d/Idmap2Service.h"
@@ -45,7 +44,6 @@
 using android::idmap2::Idmap;
 using android::idmap2::IdmapHeader;
 using android::idmap2::PolicyBitmask;
-using android::idmap2::Result;
 using android::idmap2::utils::kIdmapCacheDir;
 using android::idmap2::utils::kIdmapFilePermissionMask;
 using android::idmap2::utils::UidHasWriteAccessToPath;
diff --git a/cmds/idmap2/include/idmap2/Policies.h b/cmds/idmap2/include/idmap2/Policies.h
index eecee25..cd76b84 100644
--- a/cmds/idmap2/include/idmap2/Policies.h
+++ b/cmds/idmap2/include/idmap2/Policies.h
@@ -14,7 +14,6 @@
  * limitations under the License.
  */
 
-#include <ostream>
 #include <string>
 #include <vector>
 
@@ -28,13 +27,20 @@
 
 namespace android::idmap2 {
 
+constexpr const char* kPolicyPublic = "public";
+constexpr const char* kPolicyProduct = "product";
+constexpr const char* kPolicySystem = "system";
+constexpr const char* kPolicyVendor = "vendor";
+constexpr const char* kPolicySignature = "signature";
+
 using PolicyFlags = ResTable_overlayable_policy_header::PolicyFlags;
 using PolicyBitmask = uint32_t;
 
-// Parses a the string representation of a set of policies into a bitmask. The format of the string
-// is the same as for the <policy> element.
-Result<PolicyBitmask> PoliciesToBitmask(const std::vector<std::string>& policies,
-                                        std::ostream& err);
+// Parses the string representations of policies into a bitmask.
+Result<PolicyBitmask> PoliciesToBitmask(const std::vector<std::string>& policies);
+
+// Retrieves the string representations of policies in the bitmask.
+std::vector<std::string> BitmaskToPolicies(const PolicyBitmask& bitmask);
 
 }  // namespace android::idmap2
 
diff --git a/cmds/idmap2/include/idmap2/ResourceUtils.h b/cmds/idmap2/include/idmap2/ResourceUtils.h
index 22827ac..1d81c48 100644
--- a/cmds/idmap2/include/idmap2/ResourceUtils.h
+++ b/cmds/idmap2/include/idmap2/ResourceUtils.h
@@ -18,10 +18,8 @@
 #define IDMAP2_INCLUDE_IDMAP2_RESOURCEUTILS_H_
 
 #include <optional>
-#include <ostream>
 #include <string>
 
-#include "android-base/macros.h"
 #include "androidfw/AssetManager2.h"
 
 #include "idmap2/Idmap.h"
@@ -38,10 +36,9 @@
 };
 
 Result<OverlayManifestInfo> ExtractOverlayManifestInfo(const std::string& path,
-                                                       std::ostream& out_error,
                                                        bool assert_overlay = true);
 
-Result<std::string> WARN_UNUSED ResToTypeEntryName(const AssetManager2& am, ResourceId resid);
+Result<std::string> ResToTypeEntryName(const AssetManager2& am, ResourceId resid);
 
 }  // namespace android::idmap2::utils
 
diff --git a/cmds/idmap2/include/idmap2/Result.h b/cmds/idmap2/include/idmap2/Result.h
index d88dd51..41b15eb 100644
--- a/cmds/idmap2/include/idmap2/Result.h
+++ b/cmds/idmap2/include/idmap2/Result.h
@@ -17,7 +17,6 @@
 #ifndef IDMAP2_INCLUDE_IDMAP2_RESULT_H_
 #define IDMAP2_INCLUDE_IDMAP2_RESULT_H_
 
-#include <optional>
 #include <string>
 #include <utility>
 #include <variant>
@@ -26,13 +25,6 @@
 
 namespace android::idmap2 {
 
-template <typename T>
-using Result = std::optional<T>;
-
-static constexpr std::nullopt_t kResultError = std::nullopt;
-
-namespace v2 {
-
 using Unit = std::monostate;
 
 class Error {
@@ -148,8 +140,6 @@
   return std::holds_alternative<T>(data_);
 }
 
-}  // namespace v2
-
 }  // namespace android::idmap2
 
 #endif  // IDMAP2_INCLUDE_IDMAP2_RESULT_H_
diff --git a/cmds/idmap2/libidmap2/Idmap.cpp b/cmds/idmap2/libidmap2/Idmap.cpp
index ec498ff..a7d180c 100644
--- a/cmds/idmap2/libidmap2/Idmap.cpp
+++ b/cmds/idmap2/libidmap2/Idmap.cpp
@@ -55,7 +55,8 @@
     map_[target_typeid].insert(std::make_pair(target_resid, overlay_resid));
   }
 
-  inline const std::map<TypeId, std::set<std::pair<ResourceId, ResourceId>>>& Map() const {
+  inline const std::map<TypeId, std::set<std::pair<ResourceId, ResourceId>>>& WARN_UNUSED
+      Map() const {
     return map_;
   }
 
@@ -121,7 +122,9 @@
 Result<uint32_t> GetCrc(const ZipFile& zip) {
   const Result<uint32_t> a = zip.Crc("resources.arsc");
   const Result<uint32_t> b = zip.Crc("AndroidManifest.xml");
-  return a && b ? Result<uint32_t>(*a ^ *b) : kResultError;
+  return a && b
+             ? Result<uint32_t>(*a ^ *b)
+             : Error("Couldn't get CRC for \"%s\"", a ? "AndroidManifest.xml" : "resources.arsc");
 }
 
 }  // namespace
@@ -282,24 +285,58 @@
   return std::move(idmap);
 }
 
-bool CheckOverlayable(const LoadedPackage& target_package,
-                      const utils::OverlayManifestInfo& overlay_info,
-                      const PolicyBitmask& fulfilled_policies, const ResourceId& resid) {
+std::string ConcatPolicies(const std::vector<std::string>& policies) {
+  std::string message;
+  for (const std::string& policy : policies) {
+    if (message.empty()) {
+      message.append(policy);
+    } else {
+      message.append(policy);
+      message.append("|");
+    }
+  }
+
+  return message;
+}
+
+Result<Unit> CheckOverlayable(const LoadedPackage& target_package,
+                              const utils::OverlayManifestInfo& overlay_info,
+                              const PolicyBitmask& fulfilled_policies, const ResourceId& resid) {
+  static constexpr const PolicyBitmask sDefaultPolicies =
+      PolicyFlags::POLICY_SYSTEM_PARTITION | PolicyFlags::POLICY_VENDOR_PARTITION |
+      PolicyFlags::POLICY_PRODUCT_PARTITION | PolicyFlags::POLICY_SIGNATURE;
+
+  // If the resource does not have an overlayable definition, allow the resource to be overlaid if
+  // the overlay is preinstalled or signed with the same signature as the target.
+  if (!target_package.DefinesOverlayable()) {
+    return (sDefaultPolicies & fulfilled_policies) != 0
+               ? Result<Unit>({})
+               : Error(
+                     "overlay must be preinstalled or signed with the same signature as the "
+                     "target");
+  }
+
   const OverlayableInfo* overlayable_info = target_package.GetOverlayableInfo(resid);
   if (overlayable_info == nullptr) {
-    // If the resource does not have an overlayable definition, allow the resource to be overlaid.
-    // Once overlayable enforcement is turned on, this check will return false.
-    return !target_package.DefinesOverlayable();
+    // Do not allow non-overlayable resources to be overlaid.
+    return Error("resource has no overlayable declaration");
   }
 
   if (overlay_info.target_name != overlayable_info->name) {
     // If the overlay supplies a target overlayable name, the resource must belong to the
     // overlayable defined with the specified name to be overlaid.
-    return false;
+    return Error("<overlay> android:targetName '%s' does not match overlayable name '%s'",
+                 overlay_info.target_name.c_str(), overlayable_info->name.c_str());
   }
 
   // Enforce policy restrictions if the resource is declared as overlayable.
-  return (overlayable_info->policy_flags & fulfilled_policies) != 0;
+  if ((overlayable_info->policy_flags & fulfilled_policies) == 0) {
+    return Error("overlay with policies '%s' does not fulfill any overlayable policies '%s'",
+                 ConcatPolicies(BitmaskToPolicies(fulfilled_policies)).c_str(),
+                 ConcatPolicies(BitmaskToPolicies(overlayable_info->policy_flags)).c_str());
+  }
+
+  return Result<Unit>({});
 }
 
 std::unique_ptr<const Idmap> Idmap::FromApkAssets(
@@ -355,9 +392,9 @@
     return nullptr;
   }
 
-  Result<utils::OverlayManifestInfo> overlay_info =
-      utils::ExtractOverlayManifestInfo(overlay_apk_path, out_error);
+  auto overlay_info = utils::ExtractOverlayManifestInfo(overlay_apk_path);
   if (!overlay_info) {
+    out_error << "error: " << overlay_info.GetErrorMessage() << std::endl;
     return nullptr;
   }
 
@@ -415,16 +452,26 @@
       continue;
     }
 
-    if (enforce_overlayable &&
-        !CheckOverlayable(*target_pkg, *overlay_info, fulfilled_policies, target_resid)) {
-      LOG(WARNING) << "overlay \"" << overlay_apk_path << "\" is not allowed to overlay resource \""
-                   << full_name << "\"" << std::endl;
-      continue;
+    if (!enforce_overlayable) {
+      Result<Unit> success =
+          CheckOverlayable(*target_pkg, *overlay_info, fulfilled_policies, target_resid);
+      if (!success) {
+        LOG(WARNING) << "overlay \"" << overlay_apk_path
+                     << "\" is not allowed to overlay resource \"" << full_name
+                     << "\": " << success.GetErrorMessage();
+        continue;
+      }
     }
 
     matching_resources.Add(target_resid, overlay_resid);
   }
 
+  if (matching_resources.Map().empty()) {
+    out_error << "overlay \"" << overlay_apk_path << "\" does not successfully overlay any resource"
+              << std::endl;
+    return nullptr;
+  }
+
   // encode idmap data
   std::unique_ptr<IdmapData> data(new IdmapData());
   const auto types_end = matching_resources.Map().cend();
diff --git a/cmds/idmap2/libidmap2/Policies.cpp b/cmds/idmap2/libidmap2/Policies.cpp
index 6649288..7c45556 100644
--- a/cmds/idmap2/libidmap2/Policies.cpp
+++ b/cmds/idmap2/libidmap2/Policies.cpp
@@ -16,7 +16,6 @@
 
 #include <iterator>
 #include <map>
-#include <sstream>
 #include <string>
 #include <vector>
 
@@ -31,28 +30,52 @@
 namespace {
 
 const std::map<android::StringPiece, PolicyFlags> kStringToFlag = {
-    {"public", PolicyFlags::POLICY_PUBLIC},
-    {"product", PolicyFlags::POLICY_PRODUCT_PARTITION},
-    {"system", PolicyFlags::POLICY_SYSTEM_PARTITION},
-    {"vendor", PolicyFlags::POLICY_VENDOR_PARTITION},
-    {"signature", PolicyFlags::POLICY_SIGNATURE},
+    {kPolicyPublic, PolicyFlags::POLICY_PUBLIC},
+    {kPolicyProduct, PolicyFlags::POLICY_PRODUCT_PARTITION},
+    {kPolicySystem, PolicyFlags::POLICY_SYSTEM_PARTITION},
+    {kPolicyVendor, PolicyFlags::POLICY_VENDOR_PARTITION},
+    {kPolicySignature, PolicyFlags::POLICY_SIGNATURE},
 };
+
 }  // namespace
 
-Result<PolicyBitmask> PoliciesToBitmask(const std::vector<std::string>& policies,
-                                        std::ostream& err) {
+Result<PolicyBitmask> PoliciesToBitmask(const std::vector<std::string>& policies) {
   PolicyBitmask bitmask = 0;
   for (const std::string& policy : policies) {
     const auto iter = kStringToFlag.find(policy);
     if (iter != kStringToFlag.end()) {
       bitmask |= iter->second;
     } else {
-      err << "error: unknown policy \"" << policy << "\"";
-      return kResultError;
+      return Error("unknown policy \"%s\"", policy.c_str());
     }
   }
 
   return Result<PolicyBitmask>(bitmask);
 }
 
+std::vector<std::string> BitmaskToPolicies(const PolicyBitmask& bitmask) {
+  std::vector<std::string> policies;
+  if ((bitmask & PolicyFlags::POLICY_PUBLIC) != 0) {
+    policies.emplace_back(kPolicyPublic);
+  }
+
+  if ((bitmask & PolicyFlags::POLICY_PRODUCT_PARTITION) != 0) {
+    policies.emplace_back(kPolicyProduct);
+  }
+
+  if ((bitmask & PolicyFlags::POLICY_SYSTEM_PARTITION) != 0) {
+    policies.emplace_back(kPolicySystem);
+  }
+
+  if ((bitmask & PolicyFlags::POLICY_VENDOR_PARTITION) != 0) {
+    policies.emplace_back(kPolicyVendor);
+  }
+
+  if ((bitmask & PolicyFlags::POLICY_SIGNATURE) != 0) {
+    policies.emplace_back(kPolicySignature);
+  }
+
+  return policies;
+}
+
 }  // namespace android::idmap2
diff --git a/cmds/idmap2/libidmap2/RawPrintVisitor.cpp b/cmds/idmap2/libidmap2/RawPrintVisitor.cpp
index b78e942..1149c90 100644
--- a/cmds/idmap2/libidmap2/RawPrintVisitor.cpp
+++ b/cmds/idmap2/libidmap2/RawPrintVisitor.cpp
@@ -75,7 +75,7 @@
                                             type_entry.GetEntryOffset() + i);
       const ResourceId overlay_resid =
           RESID(last_seen_package_id_, type_entry.GetOverlayTypeId(), entry);
-      Result<std::string> name;
+      Result<std::string> name(Error(""));
       if (target_package_loaded) {
         name = utils::ResToTypeEntryName(target_am_, target_resid);
       }
diff --git a/cmds/idmap2/libidmap2/ResourceUtils.cpp b/cmds/idmap2/libidmap2/ResourceUtils.cpp
index 7a984f3..a24836d 100644
--- a/cmds/idmap2/libidmap2/ResourceUtils.cpp
+++ b/cmds/idmap2/libidmap2/ResourceUtils.cpp
@@ -33,10 +33,10 @@
 
 namespace android::idmap2::utils {
 
-Result<std::string> WARN_UNUSED ResToTypeEntryName(const AssetManager2& am, ResourceId resid) {
+Result<std::string> ResToTypeEntryName(const AssetManager2& am, ResourceId resid) {
   AssetManager2::ResourceName name;
   if (!am.GetResourceName(resid, &name)) {
-    return {};
+    return Error("no resource 0x%08x in asset manager", resid);
   }
   std::string out;
   if (name.type != nullptr) {
@@ -50,36 +50,31 @@
   } else {
     out += Utf16ToUtf8(StringPiece16(name.entry16, name.entry_len));
   }
-  return {out};
+  return out;
 }
 
 Result<OverlayManifestInfo> ExtractOverlayManifestInfo(const std::string& path,
-                                                       std::ostream& out_error,
                                                        bool assert_overlay) {
   std::unique_ptr<const ZipFile> zip = ZipFile::Open(path);
   if (!zip) {
-    out_error << "error: failed to open " << path << " as a zip file" << std::endl;
-    return kResultError;
+    return Error("failed to open %s as a zip file", path.c_str());
   }
 
   std::unique_ptr<const MemoryChunk> entry = zip->Uncompress("AndroidManifest.xml");
   if (!entry) {
-    out_error << "error: failed to uncompress AndroidManifest.xml from " << path << std::endl;
-    return kResultError;
+    return Error("failed to uncompress AndroidManifest.xml from %s", path.c_str());
   }
 
   std::unique_ptr<const Xml> xml = Xml::Create(entry->buf, entry->size);
   if (!xml) {
-    out_error << "error: failed to parse AndroidManifest.xml from " << path << std::endl;
-    return kResultError;
+    return Error("failed to parse AndroidManifest.xml from %s", path.c_str());
   }
 
   OverlayManifestInfo info{};
   const auto tag = xml->FindTag("overlay");
   if (!tag) {
     if (assert_overlay) {
-      out_error << "error: <overlay> missing from AndroidManifest.xml of " << path << std::endl;
-      return kResultError;
+      return Error("<overlay> missing from AndroidManifest.xml of %s", path.c_str());
     }
     return info;
   }
@@ -87,8 +82,7 @@
   auto iter = tag->find("targetPackage");
   if (iter == tag->end()) {
     if (assert_overlay) {
-      out_error << "error: android:targetPackage missing from <overlay> of " << path << std::endl;
-      return kResultError;
+      return Error("android:targetPackage missing from <overlay> of %s", path.c_str());
     }
   } else {
     info.target_package = iter->second;
diff --git a/cmds/idmap2/libidmap2/Result.cpp b/cmds/idmap2/libidmap2/Result.cpp
index bd4fabd..471dab2 100644
--- a/cmds/idmap2/libidmap2/Result.cpp
+++ b/cmds/idmap2/libidmap2/Result.cpp
@@ -23,7 +23,7 @@
 namespace android::idmap2 {
 
 // NOLINTNEXTLINE(cert-dcl50-cpp)
-v2::Error::Error(const char* fmt, ...) {
+Error::Error(const char* fmt, ...) {
   va_list ap;
   va_start(ap, fmt);
   base::StringAppendV(&msg_, fmt, ap);
@@ -31,7 +31,7 @@
 }
 
 // NOLINTNEXTLINE(cert-dcl50-cpp)
-v2::Error::Error(const Error& parent, const char* fmt, ...) : msg_(parent.msg_) {
+Error::Error(const Error& parent, const char* fmt, ...) : msg_(parent.msg_) {
   msg_.append(" -> ");
 
   va_list ap;
diff --git a/cmds/idmap2/libidmap2/ZipFile.cpp b/cmds/idmap2/libidmap2/ZipFile.cpp
index 15ec3f9..0f07324 100644
--- a/cmds/idmap2/libidmap2/ZipFile.cpp
+++ b/cmds/idmap2/libidmap2/ZipFile.cpp
@@ -59,7 +59,10 @@
 Result<uint32_t> ZipFile::Crc(const std::string& entryPath) const {
   ::ZipEntry entry;
   int32_t status = ::FindEntry(handle_, ::ZipString(entryPath.c_str()), &entry);
-  return status == 0 ? Result<uint32_t>(entry.crc32) : kResultError;
+  if (status != 0) {
+    return Error("failed to find zip entry %s", entryPath.c_str());
+  }
+  return entry.crc32;
 }
 
 }  // namespace android::idmap2
diff --git a/cmds/idmap2/tests/FileUtilsTests.cpp b/cmds/idmap2/tests/FileUtilsTests.cpp
index 2e85eb6..34a0097 100644
--- a/cmds/idmap2/tests/FileUtilsTests.cpp
+++ b/cmds/idmap2/tests/FileUtilsTests.cpp
@@ -58,21 +58,15 @@
   });
   ASSERT_THAT(v, NotNull());
   ASSERT_EQ(v->size(), 10U);
-  ASSERT_EQ(
-      std::set<std::string>(v->begin(), v->end()),
-      std::set<std::string>(
-          {
-              root + "/target/target.apk",
-              root + "/target/target-no-overlayable.apk",
-              root + "/overlay/overlay.apk",
-              root + "/overlay/overlay-no-name.apk",
-              root + "/overlay/overlay-no-name-static.apk",
-              root + "/overlay/overlay-static-1.apk",
-              root + "/overlay/overlay-static-2.apk",
-              root + "/signature-overlay/signature-overlay.apk",
-              root + "/system-overlay/system-overlay.apk",
-              root + "/system-overlay-invalid/system-overlay-invalid.apk"
-          }));
+  ASSERT_EQ(std::set<std::string>(v->begin(), v->end()),
+            std::set<std::string>(
+                {root + "/target/target.apk", root + "/target/target-no-overlayable.apk",
+                 root + "/overlay/overlay.apk", root + "/overlay/overlay-no-name.apk",
+                 root + "/overlay/overlay-no-name-static.apk",
+                 root + "/overlay/overlay-static-1.apk", root + "/overlay/overlay-static-2.apk",
+                 root + "/signature-overlay/signature-overlay.apk",
+                 root + "/system-overlay/system-overlay.apk",
+                 root + "/system-overlay-invalid/system-overlay-invalid.apk"}));
 }
 
 TEST(FileUtilsTests, ReadFile) {
diff --git a/cmds/idmap2/tests/IdmapTests.cpp b/cmds/idmap2/tests/IdmapTests.cpp
index 53ec03b..8d65428 100644
--- a/cmds/idmap2/tests/IdmapTests.cpp
+++ b/cmds/idmap2/tests/IdmapTests.cpp
@@ -173,20 +173,27 @@
   ASSERT_THAT(idmap, IsNull());
 }
 
-TEST(IdmapTests, CreateIdmapFromApkAssets) {
-  const std::string target_apk_path(GetTestDataPath() + "/target/target.apk");
-  std::unique_ptr<const ApkAssets> target_apk = ApkAssets::Load(target_apk_path);
+void CreateIdmap(const StringPiece& target_apk_path, const StringPiece& overlay_apk_path,
+                 const PolicyBitmask& fulfilled_policies, bool enforce_overlayable,
+                 std::unique_ptr<const Idmap>* out_idmap) {
+  std::unique_ptr<const ApkAssets> target_apk = ApkAssets::Load(target_apk_path.to_string());
   ASSERT_THAT(target_apk, NotNull());
 
-  const std::string overlay_apk_path(GetTestDataPath() + "/overlay/overlay.apk");
-  std::unique_ptr<const ApkAssets> overlay_apk = ApkAssets::Load(overlay_apk_path);
+  std::unique_ptr<const ApkAssets> overlay_apk = ApkAssets::Load(overlay_apk_path.to_string());
   ASSERT_THAT(overlay_apk, NotNull());
 
   std::stringstream error;
-  std::unique_ptr<const Idmap> idmap =
-      Idmap::FromApkAssets(target_apk_path, *target_apk, overlay_apk_path, *overlay_apk,
-                           PolicyFlags::POLICY_PUBLIC, /* enforce_overlayable */ true, error);
-  ASSERT_THAT(idmap, NotNull());
+  *out_idmap =
+      Idmap::FromApkAssets(target_apk_path.to_string(), *target_apk, overlay_apk_path.to_string(),
+                           *overlay_apk, fulfilled_policies, enforce_overlayable, error);
+}
+
+TEST(IdmapTests, CreateIdmapFromApkAssets) {
+  std::unique_ptr<const Idmap> idmap;
+  std::string target_apk_path = GetTestDataPath() + "/target/target.apk";
+  std::string overlay_apk_path = GetTestDataPath() + "/overlay/overlay.apk";
+  CreateIdmap(target_apk_path, overlay_apk_path, PolicyFlags::POLICY_PUBLIC,
+              /* enforce_overlayable */ true, &idmap);
 
   ASSERT_THAT(idmap->GetHeader(), NotNull());
   ASSERT_EQ(idmap->GetHeader()->GetMagic(), 0x504d4449U);
@@ -226,19 +233,12 @@
 
 // Overlays should abide by all overlayable restrictions if enforcement of overlayable is enabled.
 TEST(IdmapOverlayableTests, CreateIdmapFromApkAssetsPolicySystemPublic) {
-  const std::string target_apk_path(GetTestDataPath() + "/target/target.apk");
-  std::unique_ptr<const ApkAssets> target_apk = ApkAssets::Load(target_apk_path);
-  ASSERT_THAT(target_apk, NotNull());
-
-  const std::string overlay_apk_path(GetTestDataPath() + "/system-overlay/system-overlay.apk");
-  std::unique_ptr<const ApkAssets> overlay_apk = ApkAssets::Load(overlay_apk_path);
-  ASSERT_THAT(overlay_apk, NotNull());
-
-  std::stringstream error;
-  std::unique_ptr<const Idmap> idmap =
-      Idmap::FromApkAssets(target_apk_path, *target_apk, overlay_apk_path, *overlay_apk,
-                           PolicyFlags::POLICY_SYSTEM_PARTITION | PolicyFlags::POLICY_PUBLIC,
-                           /* enforce_overlayable */ true, error);
+  std::unique_ptr<const Idmap> idmap;
+  std::string target_apk_path = GetTestDataPath() + "/target/target.apk";
+  std::string overlay_apk_path = GetTestDataPath() + "/system-overlay/system-overlay.apk";
+  CreateIdmap(target_apk_path, overlay_apk_path,
+              PolicyFlags::POLICY_SYSTEM_PARTITION | PolicyFlags::POLICY_PUBLIC,
+              /* enforce_overlayable */ true, &idmap);
   ASSERT_THAT(idmap, NotNull());
 
   const std::vector<std::unique_ptr<const IdmapData>>& dataBlocks = idmap->GetData();
@@ -256,27 +256,19 @@
   ASSERT_EQ(types[0]->GetOverlayTypeId(), 0x01U);
   ASSERT_EQ(types[0]->GetEntryCount(), 4U);
   ASSERT_EQ(types[0]->GetEntryOffset(), 6U);
-  ASSERT_EQ(types[0]->GetEntry(0), 0x0000U);  // string/policy_public
-  ASSERT_EQ(types[0]->GetEntry(1), kNoEntry); // string/policy_signature
-  ASSERT_EQ(types[0]->GetEntry(2), 0x0001U);  // string/policy_system
-  ASSERT_EQ(types[0]->GetEntry(3), 0x0002U);  // string/policy_system_vendor
+  ASSERT_EQ(types[0]->GetEntry(0), 0x0000U);   // string/policy_public
+  ASSERT_EQ(types[0]->GetEntry(1), kNoEntry);  // string/policy_signature
+  ASSERT_EQ(types[0]->GetEntry(2), 0x0001U);   // string/policy_system
+  ASSERT_EQ(types[0]->GetEntry(3), 0x0002U);   // string/policy_system_vendor
 }
 
 TEST(IdmapOverlayableTests, CreateIdmapFromApkAssetsPolicySignature) {
-  const std::string target_apk_path(GetTestDataPath() + "/target/target.apk");
-  std::unique_ptr<const ApkAssets> target_apk = ApkAssets::Load(target_apk_path);
-  ASSERT_THAT(target_apk, NotNull());
-
-  const std::string overlay_apk_path(GetTestDataPath() + "/signature-overlay/signature-overlay.apk");
-  std::unique_ptr<const ApkAssets> overlay_apk = ApkAssets::Load(overlay_apk_path);
-  ASSERT_THAT(overlay_apk, NotNull());
-
-  uint32_t policy_flags = PolicyFlags::POLICY_PUBLIC | PolicyFlags::POLICY_SIGNATURE;
-
-  std::stringstream error;
-  std::unique_ptr<const Idmap> idmap =
-      Idmap::FromApkAssets(target_apk_path, *target_apk, overlay_apk_path, *overlay_apk,
-                           policy_flags, /* enforce_overlayable */ true, error);
+  std::unique_ptr<const Idmap> idmap;
+  std::string target_apk_path = GetTestDataPath() + "/target/target.apk";
+  std::string overlay_apk_path = GetTestDataPath() + "/signature-overlay/signature-overlay.apk";
+  CreateIdmap(target_apk_path, overlay_apk_path,
+              PolicyFlags::POLICY_PUBLIC | PolicyFlags::POLICY_SIGNATURE,
+              /* enforce_overlayable */ true, &idmap);
   ASSERT_THAT(idmap, NotNull());
 
   const std::vector<std::unique_ptr<const IdmapData>>& dataBlocks = idmap->GetData();
@@ -294,54 +286,18 @@
   ASSERT_EQ(types[0]->GetOverlayTypeId(), 0x01U);
   ASSERT_EQ(types[0]->GetEntryCount(), 1U);
   ASSERT_EQ(types[0]->GetEntryOffset(), 7U);
-  ASSERT_EQ(types[0]->GetEntry(0), 0x0000U); // string/policy_signature
-}
-
-TEST(IdmapOverlayableTests, CreateIdmapFromApkAssetsPolicySignatureNotFulfilled) {
-  const std::string target_apk_path(GetTestDataPath() + "/target/target.apk");
-  std::unique_ptr<const ApkAssets> target_apk = ApkAssets::Load(target_apk_path);
-  ASSERT_THAT(target_apk, NotNull());
-
-  const std::string overlay_apk_path(GetTestDataPath() + "/signature-overlay/signature-overlay.apk");
-  std::unique_ptr<const ApkAssets> overlay_apk = ApkAssets::Load(overlay_apk_path);
-  ASSERT_THAT(overlay_apk, NotNull());
-
-  uint32_t policy_flags = PolicyFlags::POLICY_PUBLIC;
-
-  std::stringstream error;
-  std::unique_ptr<const Idmap> idmap =
-      Idmap::FromApkAssets(target_apk_path, *target_apk, overlay_apk_path, *overlay_apk,
-                           policy_flags, /* enforce_overlayable */ true, error);
-  ASSERT_THAT(idmap, NotNull());
-
-  const std::vector<std::unique_ptr<const IdmapData>>& dataBlocks = idmap->GetData();
-  ASSERT_EQ(dataBlocks.size(), 1U);
-
-  const std::unique_ptr<const IdmapData>& data = dataBlocks[0];
-
-  ASSERT_EQ(data->GetHeader()->GetTargetPackageId(), 0x7fU);
-  ASSERT_EQ(data->GetHeader()->GetTypeCount(), 0U);
-
-  const std::vector<std::unique_ptr<const IdmapData::TypeEntry>>& types = data->GetTypeEntries();
-  ASSERT_EQ(types.size(), 0U); // can't overlay, so contains nothing
+  ASSERT_EQ(types[0]->GetEntry(0), 0x0000U);  // string/policy_signature
 }
 
 // Overlays should abide by all overlayable restrictions if enforcement of overlayable is enabled.
 TEST(IdmapOverlayableTests, CreateIdmapFromApkAssetsPolicySystemPublicInvalid) {
-  const std::string target_apk_path(GetTestDataPath() + "/target/target.apk");
-  std::unique_ptr<const ApkAssets> target_apk = ApkAssets::Load(target_apk_path);
-  ASSERT_THAT(target_apk, NotNull());
-
-  const std::string overlay_apk_path(GetTestDataPath() +
-                                     "/system-overlay-invalid/system-overlay-invalid.apk");
-  std::unique_ptr<const ApkAssets> overlay_apk = ApkAssets::Load(overlay_apk_path);
-  ASSERT_THAT(overlay_apk, NotNull());
-
-  std::stringstream error;
-  std::unique_ptr<const Idmap> idmap =
-      Idmap::FromApkAssets(target_apk_path, *target_apk, overlay_apk_path, *overlay_apk,
-                           PolicyFlags::POLICY_SYSTEM_PARTITION | PolicyFlags::POLICY_PUBLIC,
-                           /* enforce_overlayable */ true, error);
+  std::unique_ptr<const Idmap> idmap;
+  std::string target_apk_path = GetTestDataPath() + "/target/target.apk";
+  std::string overlay_apk_path =
+      GetTestDataPath() + "/system-overlay-invalid/system-overlay-invalid.apk";
+  CreateIdmap(target_apk_path, overlay_apk_path,
+              PolicyFlags::POLICY_SYSTEM_PARTITION | PolicyFlags::POLICY_PUBLIC,
+              /* enforce_overlayable */ true, &idmap);
   ASSERT_THAT(idmap, NotNull());
 
   const std::vector<std::unique_ptr<const IdmapData>>& dataBlocks = idmap->GetData();
@@ -359,28 +315,21 @@
   ASSERT_EQ(types[0]->GetOverlayTypeId(), 0x01U);
   ASSERT_EQ(types[0]->GetEntryCount(), 4U);
   ASSERT_EQ(types[0]->GetEntryOffset(), 6U);
-  ASSERT_EQ(types[0]->GetEntry(0), 0x0003U);  // string/policy_public
-  ASSERT_EQ(types[0]->GetEntry(1), kNoEntry); // string/policy_signature
-  ASSERT_EQ(types[0]->GetEntry(2), 0x0005U);  // string/policy_system
-  ASSERT_EQ(types[0]->GetEntry(3), 0x0006U);  // string/policy_system_vendor
+  ASSERT_EQ(types[0]->GetEntry(0), 0x0003U);   // string/policy_public
+  ASSERT_EQ(types[0]->GetEntry(1), kNoEntry);  // string/policy_signature
+  ASSERT_EQ(types[0]->GetEntry(2), 0x0005U);   // string/policy_system
+  ASSERT_EQ(types[0]->GetEntry(3), 0x0006U);   // string/policy_system_vendor
 }
 
 // Overlays should ignore all overlayable restrictions if enforcement of overlayable is disabled.
 TEST(IdmapOverlayableTests, CreateIdmapFromApkAssetsPolicySystemPublicInvalidIgnoreOverlayable) {
-  const std::string target_apk_path(GetTestDataPath() + "/target/target.apk");
-  std::unique_ptr<const ApkAssets> target_apk = ApkAssets::Load(target_apk_path);
-  ASSERT_THAT(target_apk, NotNull());
-
-  const std::string overlay_apk_path(GetTestDataPath() +
-                                     "/system-overlay-invalid/system-overlay-invalid.apk");
-  std::unique_ptr<const ApkAssets> overlay_apk = ApkAssets::Load(overlay_apk_path);
-  ASSERT_THAT(overlay_apk, NotNull());
-
-  std::stringstream error;
-  std::unique_ptr<const Idmap> idmap =
-      Idmap::FromApkAssets(target_apk_path, *target_apk, overlay_apk_path, *overlay_apk,
-                           PolicyFlags::POLICY_SYSTEM_PARTITION | PolicyFlags::POLICY_PUBLIC,
-                           /* enforce_overlayable */ false, error);
+  std::unique_ptr<const Idmap> idmap;
+  std::string target_apk_path = GetTestDataPath() + "/target/target.apk";
+  std::string overlay_apk_path =
+      GetTestDataPath() + "/system-overlay-invalid/system-overlay-invalid.apk";
+  CreateIdmap(target_apk_path, overlay_apk_path,
+              PolicyFlags::POLICY_SYSTEM_PARTITION | PolicyFlags::POLICY_PUBLIC,
+              /* enforce_overlayable */ false, &idmap);
   ASSERT_THAT(idmap, NotNull());
 
   const std::vector<std::unique_ptr<const IdmapData>>& dataBlocks = idmap->GetData();
@@ -407,63 +356,13 @@
   ASSERT_EQ(types[0]->GetEntry(6), 0x0006U);  // string/policy_system_vendor
 }
 
-// The resources of APKs that do not include an overlayable declaration should not restrict what
-// resources can be overlaid.
-TEST(IdmapOverlayableTests, CreateIdmapFromApkAssetsNoDefinedOverlayable) {
-  const std::string target_apk_path(GetTestDataPath() + "/target/target-no-overlayable.apk");
-  std::unique_ptr<const ApkAssets> target_apk = ApkAssets::Load(target_apk_path);
-  ASSERT_THAT(target_apk, NotNull());
-
-  const std::string overlay_apk_path(GetTestDataPath() +
-                                     "/system-overlay-invalid/system-overlay-invalid.apk");
-  std::unique_ptr<const ApkAssets> overlay_apk = ApkAssets::Load(overlay_apk_path);
-  ASSERT_THAT(overlay_apk, NotNull());
-
-  std::stringstream error;
-  std::unique_ptr<const Idmap> idmap =
-      Idmap::FromApkAssets(target_apk_path, *target_apk, overlay_apk_path, *overlay_apk,
-                           PolicyFlags::POLICY_PUBLIC, /* enforce_overlayable */ true, error);
-  ASSERT_THAT(idmap, NotNull());
-
-  const std::vector<std::unique_ptr<const IdmapData>>& dataBlocks = idmap->GetData();
-  ASSERT_EQ(dataBlocks.size(), 1U);
-
-  const std::unique_ptr<const IdmapData>& data = dataBlocks[0];
-
-  ASSERT_EQ(data->GetHeader()->GetTargetPackageId(), 0x7fU);
-  ASSERT_EQ(data->GetHeader()->GetTypeCount(), 1U);
-
-  const std::vector<std::unique_ptr<const IdmapData::TypeEntry>>& types = data->GetTypeEntries();
-  ASSERT_EQ(types.size(), 1U);
-
-  ASSERT_EQ(types[0]->GetTargetTypeId(), 0x02U);
-  ASSERT_EQ(types[0]->GetOverlayTypeId(), 0x01U);
-  ASSERT_EQ(types[0]->GetEntryCount(), 7U);
-  ASSERT_EQ(types[0]->GetEntryOffset(), 3U);
-  ASSERT_EQ(types[0]->GetEntry(0), 0x0000U);  // string/not_overlayable
-  ASSERT_EQ(types[0]->GetEntry(1), 0x0001U);  // string/other
-  ASSERT_EQ(types[0]->GetEntry(2), 0x0002U);  // string/policy_product
-  ASSERT_EQ(types[0]->GetEntry(3), 0x0003U);  // string/policy_public
-  ASSERT_EQ(types[0]->GetEntry(4), 0x0004U);  // string/string/policy_signature
-  ASSERT_EQ(types[0]->GetEntry(5), 0x0005U);  // string/policy_system
-  ASSERT_EQ(types[0]->GetEntry(6), 0x0006U);  // string/policy_system_vendor
-}
-
-// The resources of APKs that do not include an overlayable declaration should not restrict what
-// resources can be overlaid.
+// Overlays that do not specify a target <overlayable> can overlay resources defined as overlayable.
 TEST(IdmapOverlayableTests, CreateIdmapFromApkAssetsNoDefinedOverlayableAndNoTargetName) {
-  const std::string target_apk_path(GetTestDataPath() + "/target/target-no-overlayable.apk");
-  std::unique_ptr<const ApkAssets> target_apk = ApkAssets::Load(target_apk_path);
-  ASSERT_THAT(target_apk, NotNull());
-
-  const std::string overlay_apk_path(GetTestDataPath() + "/overlay/overlay-no-name.apk");
-  std::unique_ptr<const ApkAssets> overlay_apk = ApkAssets::Load(overlay_apk_path);
-  ASSERT_THAT(overlay_apk, NotNull());
-
-  std::stringstream error;
-  std::unique_ptr<const Idmap> idmap =
-      Idmap::FromApkAssets(target_apk_path, *target_apk, overlay_apk_path, *overlay_apk,
-                           PolicyFlags::POLICY_PUBLIC, /* enforce_overlayable */ true, error);
+  std::unique_ptr<const Idmap> idmap;
+  std::string target_apk_path = GetTestDataPath() + "/target/target-no-overlayable.apk";
+  std::string overlay_apk_path = GetTestDataPath() + "/overlay/overlay-no-name.apk";
+  CreateIdmap(target_apk_path, overlay_apk_path, PolicyFlags::POLICY_PUBLIC,
+              /* enforce_overlayable */ false, &idmap);
   ASSERT_THAT(idmap, NotNull());
 
   const std::vector<std::unique_ptr<const IdmapData>>& dataBlocks = idmap->GetData();
@@ -481,16 +380,81 @@
   ASSERT_EQ(types[0]->GetOverlayTypeId(), 0x01U);
   ASSERT_EQ(types[0]->GetEntryCount(), 1U);
   ASSERT_EQ(types[0]->GetEntryOffset(), 0U);
-  ASSERT_EQ(types[0]->GetEntry(0), 0x0000U);
+  ASSERT_EQ(types[0]->GetEntry(0), 0x0000U);  // string/int1
 
   ASSERT_EQ(types[1]->GetTargetTypeId(), 0x02U);
   ASSERT_EQ(types[1]->GetOverlayTypeId(), 0x02U);
   ASSERT_EQ(types[1]->GetEntryCount(), 4U);
   ASSERT_EQ(types[1]->GetEntryOffset(), 10U);
-  ASSERT_EQ(types[1]->GetEntry(0), 0x0000U);
-  ASSERT_EQ(types[1]->GetEntry(1), kNoEntry);
-  ASSERT_EQ(types[1]->GetEntry(2), 0x0001U);
-  ASSERT_EQ(types[1]->GetEntry(3), 0x0002U);
+  ASSERT_EQ(types[1]->GetEntry(0), 0x0000U);   // string/str1
+  ASSERT_EQ(types[1]->GetEntry(1), kNoEntry);  // string/str2
+  ASSERT_EQ(types[1]->GetEntry(2), 0x0001U);   // string/str3
+  ASSERT_EQ(types[1]->GetEntry(3), 0x0002U);   // string/str4
+}
+
+// Overlays that are not pre-installed and are not signed with the same signature as the target
+// cannot overlay packages that have not defined overlayable resources.
+TEST(IdmapOverlayableTests, CreateIdmapFromApkAssetsDefaultPoliciesPublicFail) {
+  std::unique_ptr<const Idmap> idmap;
+  std::string target_apk_path = GetTestDataPath() + "/target/target-no-overlayable.apk";
+  std::string overlay_apk_path = GetTestDataPath() + "/overlay/overlay-no-name.apk";
+  CreateIdmap(target_apk_path, overlay_apk_path, PolicyFlags::POLICY_PUBLIC,
+              /* enforce_overlayable */ true, &idmap);
+  ASSERT_THAT(idmap, IsNull());
+}
+
+// Overlays that are pre-installed or are signed with the same signature as the target can overlay
+// packages that have not defined overlayable resources.
+TEST(IdmapOverlayableTests, CreateIdmapFromApkAssetsDefaultPolicies) {
+  std::unique_ptr<const Idmap> idmap;
+  std::string target_apk_path = GetTestDataPath() + "/target/target-no-overlayable.apk";
+  std::string overlay_apk_path =
+      GetTestDataPath() + "/system-overlay-invalid/system-overlay-invalid.apk";
+
+  auto CheckEntries = [&]() -> void {
+    const std::vector<std::unique_ptr<const IdmapData>>& dataBlocks = idmap->GetData();
+    ASSERT_EQ(dataBlocks.size(), 1U);
+
+    const std::unique_ptr<const IdmapData>& data = dataBlocks[0];
+
+    ASSERT_EQ(data->GetHeader()->GetTargetPackageId(), 0x7fU);
+    ASSERT_EQ(data->GetHeader()->GetTypeCount(), 1U);
+
+    const std::vector<std::unique_ptr<const IdmapData::TypeEntry>>& types = data->GetTypeEntries();
+    ASSERT_EQ(types.size(), 1U);
+
+    ASSERT_EQ(types[0]->GetTargetTypeId(), 0x02U);
+    ASSERT_EQ(types[0]->GetOverlayTypeId(), 0x01U);
+    ASSERT_EQ(types[0]->GetEntryCount(), 7U);
+    ASSERT_EQ(types[0]->GetEntryOffset(), 3U);
+    ASSERT_EQ(types[0]->GetEntry(0), 0x0000U);  // string/not_overlayable
+    ASSERT_EQ(types[0]->GetEntry(1), 0x0001U);  // string/other
+    ASSERT_EQ(types[0]->GetEntry(2), 0x0002U);  // string/policy_product
+    ASSERT_EQ(types[0]->GetEntry(3), 0x0003U);  // string/policy_public
+    ASSERT_EQ(types[0]->GetEntry(4), 0x0004U);  // string/string/policy_signature
+    ASSERT_EQ(types[0]->GetEntry(5), 0x0005U);  // string/policy_system
+    ASSERT_EQ(types[0]->GetEntry(6), 0x0006U);  // string/policy_system_vendor
+  };
+
+  CreateIdmap(target_apk_path, overlay_apk_path, PolicyFlags::POLICY_SIGNATURE,
+              /* enforce_overlayable */ true, &idmap);
+  ASSERT_THAT(idmap, NotNull());
+  CheckEntries();
+
+  CreateIdmap(target_apk_path, overlay_apk_path, PolicyFlags::POLICY_PRODUCT_PARTITION,
+              /* enforce_overlayable */ true, &idmap);
+  ASSERT_THAT(idmap, NotNull());
+  CheckEntries();
+
+  CreateIdmap(target_apk_path, overlay_apk_path, PolicyFlags::POLICY_SYSTEM_PARTITION,
+              /* enforce_overlayable */ true, &idmap);
+  ASSERT_THAT(idmap, NotNull());
+  CheckEntries();
+
+  CreateIdmap(target_apk_path, overlay_apk_path, PolicyFlags::POLICY_VENDOR_PARTITION,
+              /* enforce_overlayable */ true, &idmap);
+  ASSERT_THAT(idmap, NotNull());
+  CheckEntries();
 }
 
 TEST(IdmapTests, FailToCreateIdmapFromApkAssetsIfPathTooLong) {
diff --git a/cmds/idmap2/tests/PoliciesTests.cpp b/cmds/idmap2/tests/PoliciesTests.cpp
index ab567ad..a76da53 100644
--- a/cmds/idmap2/tests/PoliciesTests.cpp
+++ b/cmds/idmap2/tests/PoliciesTests.cpp
@@ -27,44 +27,42 @@
 namespace android::idmap2 {
 
 TEST(PoliciesTests, PoliciesToBitmasks) {
-  const Result<PolicyBitmask> bitmask1 = PoliciesToBitmask({"system"}, std::cerr);
-  ASSERT_NE(bitmask1, kResultError);
-  ASSERT_EQ(bitmask1, PolicyFlags::POLICY_SYSTEM_PARTITION);
+  const auto bitmask1 = PoliciesToBitmask({"system"});
+  ASSERT_TRUE(bitmask1);
+  ASSERT_EQ(*bitmask1, PolicyFlags::POLICY_SYSTEM_PARTITION);
 
-  const Result<PolicyBitmask> bitmask2 = PoliciesToBitmask({"system", "vendor"}, std::cerr);
-  ASSERT_NE(bitmask2, kResultError);
-  ASSERT_EQ(bitmask2, PolicyFlags::POLICY_SYSTEM_PARTITION | PolicyFlags::POLICY_VENDOR_PARTITION);
+  const auto bitmask2 = PoliciesToBitmask({"system", "vendor"});
+  ASSERT_TRUE(bitmask2);
+  ASSERT_EQ(*bitmask2, PolicyFlags::POLICY_SYSTEM_PARTITION | PolicyFlags::POLICY_VENDOR_PARTITION);
 
-  const Result<PolicyBitmask> bitmask3 = PoliciesToBitmask({"vendor", "system"}, std::cerr);
-  ASSERT_NE(bitmask3, kResultError);
-  ASSERT_EQ(bitmask3, PolicyFlags::POLICY_SYSTEM_PARTITION | PolicyFlags::POLICY_VENDOR_PARTITION);
+  const auto bitmask3 = PoliciesToBitmask({"vendor", "system"});
+  ASSERT_TRUE(bitmask3);
+  ASSERT_EQ(*bitmask3, PolicyFlags::POLICY_SYSTEM_PARTITION | PolicyFlags::POLICY_VENDOR_PARTITION);
 
-  const Result<PolicyBitmask> bitmask4 =
-      PoliciesToBitmask({"public", "product", "system", "vendor"}, std::cerr);
-  ASSERT_NE(bitmask4, kResultError);
-  ASSERT_EQ(bitmask4, PolicyFlags::POLICY_PUBLIC | PolicyFlags::POLICY_PRODUCT_PARTITION |
-                          PolicyFlags::POLICY_SYSTEM_PARTITION |
-                          PolicyFlags::POLICY_VENDOR_PARTITION);
+  const auto bitmask4 = PoliciesToBitmask({"public", "product", "system", "vendor"});
+  ASSERT_TRUE(bitmask4);
+  ASSERT_EQ(*bitmask4, PolicyFlags::POLICY_PUBLIC | PolicyFlags::POLICY_PRODUCT_PARTITION |
+                           PolicyFlags::POLICY_SYSTEM_PARTITION |
+                           PolicyFlags::POLICY_VENDOR_PARTITION);
 
-  const Result<PolicyBitmask> bitmask5 =
-      PoliciesToBitmask({"system", "system", "system"}, std::cerr);
-  ASSERT_NE(bitmask5, kResultError);
-  ASSERT_EQ(bitmask5, PolicyFlags::POLICY_SYSTEM_PARTITION);
+  const auto bitmask5 = PoliciesToBitmask({"system", "system", "system"});
+  ASSERT_TRUE(bitmask5);
+  ASSERT_EQ(*bitmask5, PolicyFlags::POLICY_SYSTEM_PARTITION);
 
-  const Result<PolicyBitmask> bitmask6 = PoliciesToBitmask({""}, std::cerr);
-  ASSERT_EQ(bitmask6, kResultError);
+  const auto bitmask6 = PoliciesToBitmask({""});
+  ASSERT_FALSE(bitmask6);
 
-  const Result<PolicyBitmask> bitmask7 = PoliciesToBitmask({"foo"}, std::cerr);
-  ASSERT_EQ(bitmask7, kResultError);
+  const auto bitmask7 = PoliciesToBitmask({"foo"});
+  ASSERT_FALSE(bitmask7);
 
-  const Result<PolicyBitmask> bitmask8 = PoliciesToBitmask({"system", "foo"}, std::cerr);
-  ASSERT_EQ(bitmask8, kResultError);
+  const auto bitmask8 = PoliciesToBitmask({"system", "foo"});
+  ASSERT_FALSE(bitmask8);
 
-  const Result<PolicyBitmask> bitmask9 = PoliciesToBitmask({"system", ""}, std::cerr);
-  ASSERT_EQ(bitmask9, kResultError);
+  const auto bitmask9 = PoliciesToBitmask({"system", ""});
+  ASSERT_FALSE(bitmask9);
 
-  const Result<PolicyBitmask> bitmask10 = PoliciesToBitmask({"system "}, std::cerr);
-  ASSERT_EQ(bitmask10, kResultError);
+  const auto bitmask10 = PoliciesToBitmask({"system "});
+  ASSERT_FALSE(bitmask10);
 }
 
 }  // namespace android::idmap2
diff --git a/cmds/idmap2/tests/ResultTests.cpp b/cmds/idmap2/tests/ResultTests.cpp
index d82f0c4..5f4daed 100644
--- a/cmds/idmap2/tests/ResultTests.cpp
+++ b/cmds/idmap2/tests/ResultTests.cpp
@@ -32,28 +32,28 @@
 // Tests: Error
 
 TEST(ResultTests, ErrorTraits) {
-  ASSERT_TRUE(std::is_move_constructible<v2::Error>::value);
-  ASSERT_TRUE(std::is_move_assignable<v2::Error>::value);
-  ASSERT_TRUE(std::is_copy_constructible<v2::Error>::value);
-  ASSERT_TRUE(std::is_copy_assignable<v2::Error>::value);
+  ASSERT_TRUE(std::is_move_constructible<Error>::value);
+  ASSERT_TRUE(std::is_move_assignable<Error>::value);
+  ASSERT_TRUE(std::is_copy_constructible<Error>::value);
+  ASSERT_TRUE(std::is_copy_assignable<Error>::value);
 }
 
 TEST(ResultTests, ErrorCtorFormat) {
-  v2::Error e("%s=0x%08x", "resid", 0x7f010002);
+  Error e("%s=0x%08x", "resid", 0x7f010002);
   ASSERT_EQ(e.GetMessage(), "resid=0x7f010002");
 }
 
 TEST(ResultTests, ErrorPropagateParent) {
-  v2::Error e1("foo");
+  Error e1("foo");
   ASSERT_EQ(e1.GetMessage(), "foo");
 
-  v2::Error e2(e1, "bar");
+  Error e2(e1, "bar");
   ASSERT_EQ(e2.GetMessage(), "foo -> bar");
 
-  v2::Error e3(e2);  // NOLINT(performance-unnecessary-copy-initialization)
+  Error e3(e2);  // NOLINT(performance-unnecessary-copy-initialization)
   ASSERT_EQ(e3.GetMessage(), "foo -> bar");
 
-  v2::Error e4(e3, "%02d", 1);
+  Error e4(e3, "%02d", 1);
   ASSERT_EQ(e4.GetMessage(), "foo -> bar -> 01");
 }
 
@@ -61,13 +61,13 @@
 
 // Result(const Result&)
 TEST(ResultTests, CopyConstructor) {
-  v2::Result<uint32_t> r1(42U);
+  Result<uint32_t> r1(42U);
 
-  v2::Result<uint32_t> r2(r1);
+  Result<uint32_t> r2(r1);
   ASSERT_TRUE(r2);
   ASSERT_EQ(*r2, 42U);
 
-  v2::Result<uint32_t> r3 = r2;
+  Result<uint32_t> r3 = r2;
   ASSERT_TRUE(r3);
   ASSERT_EQ(*r3, 42U);
 }
@@ -75,23 +75,23 @@
 // Result(const T&)
 TEST(ResultTests, Constructor) {
   uint32_t v = 42U;
-  v2::Result<uint32_t> r1(v);
+  Result<uint32_t> r1(v);
   ASSERT_TRUE(r1);
   ASSERT_EQ(*r1, 42U);
 
-  v2::Error e("foo");
-  v2::Result<uint32_t> r2(e);
+  Error e("foo");
+  Result<uint32_t> r2(e);
   ASSERT_FALSE(r2);
   ASSERT_EQ(r2.GetErrorMessage(), "foo");
 }
 
 // Result(const T&&)
 TEST(ResultTests, MoveConstructor) {
-  v2::Result<uint32_t> r1(42U);
+  Result<uint32_t> r1(42U);
   ASSERT_TRUE(r1);
   ASSERT_EQ(*r1, 42U);
 
-  v2::Result<uint32_t> r2(v2::Error("foo"));
+  Result<uint32_t> r2(Error("foo"));
   ASSERT_FALSE(r2);
   ASSERT_EQ(r2.GetErrorMessage(), "foo");
 }
@@ -99,52 +99,52 @@
 // operator=
 TEST(ResultTests, CopyAssignmentOperator) {
   // note: 'Result<...> r2 = r1;' calls the copy ctor
-  v2::Result<uint32_t> r1(42U);
-  v2::Result<uint32_t> r2(0U);
+  Result<uint32_t> r1(42U);
+  Result<uint32_t> r2(0U);
   r2 = r1;
   ASSERT_TRUE(r2);
   ASSERT_EQ(*r2, 42U);
 
-  v2::Result<uint32_t> r3(v2::Error("foo"));
+  Result<uint32_t> r3(Error("foo"));
   r2 = r3;
   ASSERT_FALSE(r2);
   ASSERT_EQ(r2.GetErrorMessage(), "foo");
 }
 
 TEST(ResultTests, MoveAssignmentOperator) {
-  v2::Result<uint32_t> r(0U);
-  r = v2::Result<uint32_t>(42U);
+  Result<uint32_t> r(0U);
+  r = Result<uint32_t>(42U);
   ASSERT_TRUE(r);
   ASSERT_EQ(*r, 42U);
 
-  r = v2::Result<uint32_t>(v2::Error("foo"));
+  r = Result<uint32_t>(Error("foo"));
   ASSERT_FALSE(r);
   ASSERT_EQ(r.GetErrorMessage(), "foo");
 }
 
 // operator bool()
 TEST(ResultTests, BoolOperator) {
-  v2::Result<uint32_t> r1(42U);
+  Result<uint32_t> r1(42U);
   ASSERT_TRUE(r1);
   ASSERT_EQ(*r1, 42U);
 
-  v2::Result<uint32_t> r2(v2::Error("foo"));
+  Result<uint32_t> r2(Error("foo"));
   ASSERT_FALSE(r2);
   ASSERT_EQ(r2.GetErrorMessage(), "foo");
 }
 
 // operator*
 TEST(ResultTests, IndirectionOperator) {
-  const v2::Result<uint32_t> r1(42U);
+  const Result<uint32_t> r1(42U);
   ASSERT_TRUE(r1);
   ASSERT_EQ(*r1, 42U);
 
-  const v2::Result<Container> r2(Container{42U});
+  const Result<Container> r2(Container{42U});
   ASSERT_TRUE(r2);
   const Container& c = *r2;
   ASSERT_EQ(c.value, 42U);
 
-  v2::Result<Container> r3(Container{42U});
+  Result<Container> r3(Container{42U});
   ASSERT_TRUE(r3);
   ASSERT_EQ((*r3).value, 42U);
   (*r3).value = 0U;
@@ -153,11 +153,11 @@
 
 // operator->
 TEST(ResultTests, DereferenceOperator) {
-  const v2::Result<Container> r1(Container{42U});
+  const Result<Container> r1(Container{42U});
   ASSERT_TRUE(r1);
   ASSERT_EQ(r1->value, 42U);
 
-  v2::Result<Container> r2(Container{42U});
+  Result<Container> r2(Container{42U});
   ASSERT_TRUE(r2);
   ASSERT_EQ(r2->value, 42U);
   r2->value = 0U;
@@ -167,14 +167,14 @@
 // Tests: intended use of Result<T>
 
 TEST(ResultTests, ResultTraits) {
-  ASSERT_TRUE(std::is_move_constructible<v2::Result<uint32_t>>::value);
-  ASSERT_TRUE(std::is_move_assignable<v2::Result<uint32_t>>::value);
-  ASSERT_TRUE(std::is_copy_constructible<v2::Result<uint32_t>>::value);
-  ASSERT_TRUE(std::is_copy_assignable<v2::Result<uint32_t>>::value);
+  ASSERT_TRUE(std::is_move_constructible<Result<uint32_t>>::value);
+  ASSERT_TRUE(std::is_move_assignable<Result<uint32_t>>::value);
+  ASSERT_TRUE(std::is_copy_constructible<Result<uint32_t>>::value);
+  ASSERT_TRUE(std::is_copy_assignable<Result<uint32_t>>::value);
 }
 
 TEST(ResultTests, UnitTypeResult) {
-  v2::Result<v2::Unit> r(v2::Unit{});
+  Result<Unit> r(Unit{});
   ASSERT_TRUE(r);
 }
 
@@ -220,16 +220,16 @@
   ASSERT_FALSE(std::is_copy_assignable<RefCountContainer>::value);
 
   RefCountData rc{0, 0, 0, 0};
-  { v2::Result<RefCountContainer> r(RefCountContainer{rc}); }
+  { Result<RefCountContainer> r(RefCountContainer{rc}); }
   ASSERT_EQ(rc.ctor, 1);
   ASSERT_EQ(rc.copy_ctor, 1);
   ASSERT_EQ(rc.move, 0);
   ASSERT_EQ(rc.dtor, 2);
 }
 
-v2::Result<Container> CreateContainer(bool succeed) {
+Result<Container> CreateContainer(bool succeed) {
   if (!succeed) {
-    return v2::Error("foo");
+    return Error("foo");
   }
   return Container{42U};
 }
@@ -245,10 +245,10 @@
   ASSERT_EQ(r2.GetError().GetMessage(), "foo");
 }
 
-v2::Result<Container> FailToCreateContainer() {
+Result<Container> FailToCreateContainer() {
   auto container = CreateContainer(false);
   if (!container) {
-    return v2::Error(container.GetError(), "bar");
+    return Error(container.GetError(), "bar");
   }
   return container;
 }
@@ -264,9 +264,9 @@
   DISALLOW_COPY_AND_ASSIGN(NoCopyContainer);
 };
 
-v2::Result<std::unique_ptr<NoCopyContainer>> CreateNoCopyContainer(bool succeed) {
+Result<std::unique_ptr<NoCopyContainer>> CreateNoCopyContainer(bool succeed) {
   if (!succeed) {
-    return v2::Error("foo");
+    return Error("foo");
   }
   std::unique_ptr<NoCopyContainer> p(new NoCopyContainer{0U});
   p->value = 42U;
diff --git a/cmds/idmap2/tests/data/overlay/build b/cmds/idmap2/tests/data/overlay/build
index e879f44..68b9f50 100755
--- a/cmds/idmap2/tests/data/overlay/build
+++ b/cmds/idmap2/tests/data/overlay/build
@@ -12,7 +12,7 @@
 # See the License for the specific language governing permissions and
 # limitations under the License.
 
-FRAMEWORK_RES_APK="${ANDROID_BUILD_TOP}/out/target/common/obj/APPS/framework-res_intermediates/package-export.apk"
+FRAMEWORK_RES_APK=${ANDROID_BUILD_TOP}/prebuilts/sdk/current/public/android.jar
 
 aapt2 compile --dir res -o compiled.flata
 
diff --git a/cmds/idmap2/tests/data/overlay/overlay-no-name.apk b/cmds/idmap2/tests/data/overlay/overlay-no-name.apk
index 7d23c09..6425190 100644
--- a/cmds/idmap2/tests/data/overlay/overlay-no-name.apk
+++ b/cmds/idmap2/tests/data/overlay/overlay-no-name.apk
Binary files differ
diff --git a/cmds/incident_helper/src/ih_util.cpp b/cmds/incident_helper/src/ih_util.cpp
index 012310c..77a56e5 100644
--- a/cmds/incident_helper/src/ih_util.cpp
+++ b/cmds/incident_helper/src/ih_util.cpp
@@ -142,7 +142,7 @@
     }
     if (lineSize - lastIndex > 0) {
         int beginning = lastIndex;
-        if (record.size() == indices.size()) {
+        if (record.size() == indices.size() && !record.empty()) {
             // We've already encountered all of the columns...put whatever is
             // left in the last column.
             record.pop_back();
diff --git a/cmds/incident_helper/src/parsers/CpuInfoParser.cpp b/cmds/incident_helper/src/parsers/CpuInfoParser.cpp
index 21ced9c..5d525e6 100644
--- a/cmds/incident_helper/src/parsers/CpuInfoParser.cpp
+++ b/cmds/incident_helper/src/parsers/CpuInfoParser.cpp
@@ -65,8 +65,9 @@
         if (line.empty()) continue;
 
         nline++;
-
-        if (stripPrefix(&line, "Tasks:")) {
+        // The format changes from time to time in toybox/toys/posix/ps.c
+        // With -H, it prints Threads instead of Tasks (FLAG(H)?"Thread":"Task")
+        if (stripPrefix(&line, "Threads:")) {
             writeSuffixLine(&proto, CpuInfoProto::TASK_STATS, line, COMMA_DELIMITER,
                 CpuInfoProto::TaskStats::_FIELD_COUNT,
                 CpuInfoProto::TaskStats::_FIELD_NAMES,
diff --git a/cmds/incident_helper/testdata/cpuinfo.txt b/cmds/incident_helper/testdata/cpuinfo.txt
index ec4a839..aa3afc3 100644
--- a/cmds/incident_helper/testdata/cpuinfo.txt
+++ b/cmds/incident_helper/testdata/cpuinfo.txt
@@ -1,8 +1,8 @@
-Tasks: 2038 total,   1 running,2033 sleeping,   0 stopped,   0 zombie
+Threads: 2038 total,   1 running,2033 sleeping,   0 stopped,   0 zombie
 
-Mem:   3842668k total,  3761936k used,    80732k free,   220188k buffers
+  Mem:   3842668k total,  3761936k used,    80732k free,   220188k buffers
 
-Swap:   524284k total,    25892k used,   498392k free,  1316952k cached
+ Swap:   524284k total,    25892k used,   498392k free,  1316952k cached
 
 400%cpu  17%user   0%nice  43%sys 338%idle   0%iow   0%irq   1%sirq   0%host
 
@@ -12,4 +12,4 @@
 29438 29438 rootabcdefghij 20 0 57.9 R  14M 3.8M     top test        top
   916   916 system       18  -2  1.4 S 4.6G 404M  fg system_server   system_server
    28    28 root         -2   0  1.4 S    0    0  bg rcuc/3          [rcuc/3]
-   27    27 root         RT   0  1.4 S    0    0  ta migration/3     [migration/3]
\ No newline at end of file
+   27    27 root         RT   0  1.4 S    0    0  ta migration/3     [migration/3]
diff --git a/cmds/sm/src/com/android/commands/sm/Sm.java b/cmds/sm/src/com/android/commands/sm/Sm.java
index be5a5bf..4a6f87f 100644
--- a/cmds/sm/src/com/android/commands/sm/Sm.java
+++ b/cmds/sm/src/com/android/commands/sm/Sm.java
@@ -103,6 +103,8 @@
             runSetVirtualDisk();
         } else if ("set-isolated-storage".equals(op)) {
             runIsolatedStorage();
+        } else if ("set-legacy-greylist".equals(op)) {
+            runLegacyGreylist();
         } else {
             throw new IllegalArgumentException();
         }
@@ -282,7 +284,7 @@
                 StorageManager.DEBUG_VIRTUAL_DISK);
     }
 
-    public void runIsolatedStorage() {
+    public void runIsolatedStorage() throws RemoteException {
         final int value;
         final int mask = StorageManager.DEBUG_ISOLATED_STORAGE_FORCE_ON
                 | StorageManager.DEBUG_ISOLATED_STORAGE_FORCE_OFF;
@@ -301,16 +303,13 @@
             default:
                 return;
         }
+        mSm.setDebugFlags(value, mask);
+    }
 
-        // Toggling isolated-storage state will result in a device reboot. So to avoid this command
-        // from erroring out (DeadSystemException), call setDebugFlags() in a separate thread.
-        new Thread(() -> {
-            try {
-                mSm.setDebugFlags(value, mask);
-            } catch (RemoteException e) {
-                Log.e(TAG, "Encountered an error!", e);
-            }
-        }).start();
+    public void runLegacyGreylist() throws RemoteException {
+        final boolean legacyGreylist = Boolean.parseBoolean(nextArg());
+        mSm.setDebugFlags(legacyGreylist ? StorageManager.DEBUG_LEGACY_GREYLIST : 0,
+                StorageManager.DEBUG_LEGACY_GREYLIST);
     }
 
     public void runIdleMaint() throws RemoteException {
diff --git a/cmds/statsd/Android.bp b/cmds/statsd/Android.bp
index ca48881..7298da6 100644
--- a/cmds/statsd/Android.bp
+++ b/cmds/statsd/Android.bp
@@ -68,6 +68,7 @@
         "src/config/ConfigKey.cpp",
         "src/config/ConfigListener.cpp",
         "src/config/ConfigManager.cpp",
+        "src/external/GpuStatsPuller.cpp",
         "src/external/Perfetto.cpp",
         "src/external/Perfprofd.cpp",
         "src/external/StatsPuller.cpp",
@@ -122,6 +123,7 @@
     shared_libs: [
         "libbase",
         "libbinder",
+        "libgraphicsenv",
         "libincident",
         "liblog",
         "libutils",
@@ -217,6 +219,7 @@
         "tests/anomaly/AnomalyTracker_test.cpp",
         "tests/ConfigManager_test.cpp",
         "tests/external/puller_util_test.cpp",
+        "tests/external/IncidentReportArgs_test.cpp",
         "tests/external/StatsPuller_test.cpp",
         "tests/indexed_priority_queue_test.cpp",
         "tests/LogEntryMatcher_test.cpp",
diff --git a/cmds/statsd/OWNERS b/cmds/statsd/OWNERS
index deebd4e..1315750 100644
--- a/cmds/statsd/OWNERS
+++ b/cmds/statsd/OWNERS
@@ -1,7 +1,6 @@
 bookatz@google.com
 cjyu@google.com
 dwchen@google.com
-gaillard@google.com
 jinyithu@google.com
 joeo@google.com
 kwekua@google.com
diff --git a/cmds/statsd/src/StatsService.cpp b/cmds/statsd/src/StatsService.cpp
index 69fbf1f..1526d66 100644
--- a/cmds/statsd/src/StatsService.cpp
+++ b/cmds/statsd/src/StatsService.cpp
@@ -1210,89 +1210,102 @@
                     (long long)expId);
     }
 
-    vector<uint8_t> buffer;
-    buffer.resize(proto.size());
+    vector<uint8_t> experimentIdsProtoBuffer;
+    experimentIdsProtoBuffer.resize(proto.size());
     size_t pos = 0;
     auto iter = proto.data();
     while (iter.readBuffer() != NULL) {
         size_t toRead = iter.currentToRead();
-        std::memcpy(&(buffer[pos]), iter.readBuffer(), toRead);
+        std::memcpy(&(experimentIdsProtoBuffer[pos]), iter.readBuffer(), toRead);
         pos += toRead;
         iter.rp()->move(toRead);
     }
-    LogEvent event(std::string(String8(trainName).string()), trainVersionCode, requiresStaging,
-                   rollbackEnabled, requiresLowLatencyMonitor, state, buffer, userId);
+
+    std::string trainNameUtf8 = std::string(String8(trainName).string());
+    LogEvent event(trainNameUtf8, trainVersionCode, requiresStaging, rollbackEnabled,
+                   requiresLowLatencyMonitor, state, experimentIdsProtoBuffer, userId);
     mProcessor->OnLogEvent(&event);
-    StorageManager::writeTrainInfo(trainVersionCode, buffer);
+    StorageManager::writeTrainInfo(trainVersionCode, trainNameUtf8, state, experimentIdsProtoBuffer);
     return Status::ok();
 }
 
 hardware::Return<void> StatsService::reportSpeakerImpedance(
         const SpeakerImpedance& speakerImpedance) {
-    LogEvent event(getWallClockSec() * NS_PER_SEC, getElapsedRealtimeNs(), speakerImpedance);
-    mProcessor->OnLogEvent(&event);
+    android::util::stats_write(android::util::SPEAKER_IMPEDANCE_REPORTED,
+            speakerImpedance.speakerLocation, speakerImpedance.milliOhms);
 
     return hardware::Void();
 }
 
 hardware::Return<void> StatsService::reportHardwareFailed(const HardwareFailed& hardwareFailed) {
-    LogEvent event(getWallClockSec() * NS_PER_SEC, getElapsedRealtimeNs(), hardwareFailed);
-    mProcessor->OnLogEvent(&event);
+    android::util::stats_write(android::util::HARDWARE_FAILED, int32_t(hardwareFailed.hardwareType),
+            hardwareFailed.hardwareLocation, int32_t(hardwareFailed.errorCode));
 
     return hardware::Void();
 }
 
 hardware::Return<void> StatsService::reportPhysicalDropDetected(
         const PhysicalDropDetected& physicalDropDetected) {
-    LogEvent event(getWallClockSec() * NS_PER_SEC, getElapsedRealtimeNs(), physicalDropDetected);
-    mProcessor->OnLogEvent(&event);
+    android::util::stats_write(android::util::PHYSICAL_DROP_DETECTED,
+            int32_t(physicalDropDetected.confidencePctg), physicalDropDetected.accelPeak,
+            physicalDropDetected.freefallDuration);
 
     return hardware::Void();
 }
 
 hardware::Return<void> StatsService::reportChargeCycles(const ChargeCycles& chargeCycles) {
-    LogEvent event(getWallClockSec() * NS_PER_SEC, getElapsedRealtimeNs(), chargeCycles);
-    mProcessor->OnLogEvent(&event);
+    std::vector<int32_t> buckets = chargeCycles.cycleBucket;
+    int initialSize = buckets.size();
+    for (int i = 0; i < 10 - initialSize; i++) {
+        buckets.push_back(-1); // Push -1 for buckets that do not exist.
+    }
+    android::util::stats_write(android::util::CHARGE_CYCLES_REPORTED, buckets[0], buckets[1],
+            buckets[2], buckets[3], buckets[4], buckets[5], buckets[6], buckets[7], buckets[8],
+            buckets[9]);
 
     return hardware::Void();
 }
 
 hardware::Return<void> StatsService::reportBatteryHealthSnapshot(
         const BatteryHealthSnapshotArgs& batteryHealthSnapshotArgs) {
-    LogEvent event(getWallClockSec() * NS_PER_SEC, getElapsedRealtimeNs(),
-                   batteryHealthSnapshotArgs);
-    mProcessor->OnLogEvent(&event);
+    android::util::stats_write(android::util::BATTERY_HEALTH_SNAPSHOT,
+            int32_t(batteryHealthSnapshotArgs.type), batteryHealthSnapshotArgs.temperatureDeciC,
+            batteryHealthSnapshotArgs.voltageMicroV, batteryHealthSnapshotArgs.currentMicroA,
+            batteryHealthSnapshotArgs.openCircuitVoltageMicroV,
+            batteryHealthSnapshotArgs.resistanceMicroOhm, batteryHealthSnapshotArgs.levelPercent);
 
     return hardware::Void();
 }
 
 hardware::Return<void> StatsService::reportSlowIo(const SlowIo& slowIo) {
-    LogEvent event(getWallClockSec() * NS_PER_SEC, getElapsedRealtimeNs(), slowIo);
-    mProcessor->OnLogEvent(&event);
+    android::util::stats_write(android::util::SLOW_IO, int32_t(slowIo.operation), slowIo.count);
 
     return hardware::Void();
 }
 
 hardware::Return<void> StatsService::reportBatteryCausedShutdown(
         const BatteryCausedShutdown& batteryCausedShutdown) {
-    LogEvent event(getWallClockSec() * NS_PER_SEC, getElapsedRealtimeNs(), batteryCausedShutdown);
-    mProcessor->OnLogEvent(&event);
+    android::util::stats_write(android::util::BATTERY_CAUSED_SHUTDOWN,
+            batteryCausedShutdown.voltageMicroV);
 
     return hardware::Void();
 }
 
 hardware::Return<void> StatsService::reportUsbPortOverheatEvent(
         const UsbPortOverheatEvent& usbPortOverheatEvent) {
-    LogEvent event(getWallClockSec() * NS_PER_SEC, getElapsedRealtimeNs(), usbPortOverheatEvent);
-    mProcessor->OnLogEvent(&event);
+    android::util::stats_write(android::util::USB_PORT_OVERHEAT_EVENT_REPORTED,
+            usbPortOverheatEvent.plugTemperatureDeciC, usbPortOverheatEvent.maxTemperatureDeciC,
+            usbPortOverheatEvent.timeToOverheat, usbPortOverheatEvent.timeToHysteresis,
+            usbPortOverheatEvent.timeToInactive);
 
     return hardware::Void();
 }
 
 hardware::Return<void> StatsService::reportSpeechDspStat(
         const SpeechDspStat& speechDspStat) {
-    LogEvent event(getWallClockSec() * NS_PER_SEC, getElapsedRealtimeNs(), speechDspStat);
-    mProcessor->OnLogEvent(&event);
+    android::util::stats_write(android::util::SPEECH_DSP_STAT_REPORTED,
+            speechDspStat.totalUptimeMillis, speechDspStat.totalDowntimeMillis,
+            speechDspStat.totalCrashCount, speechDspStat.totalRecoverCount);
 
     return hardware::Void();
 }
diff --git a/cmds/statsd/src/atoms.proto b/cmds/statsd/src/atoms.proto
index 1dd68df..b812c80 100644
--- a/cmds/statsd/src/atoms.proto
+++ b/cmds/statsd/src/atoms.proto
@@ -149,7 +149,7 @@
         WTFOccurred wtf_occurred = 80;
         LowMemReported low_mem_reported = 81;
         GenericAtom generic_atom = 82;
-        KeyValuePairsAtom key_value_pairs_atom = 83;
+        KeyValuePairsAtom key_value_pairs_atom = 83 [(allow_from_any_uid) = true];
         VibratorStateChanged vibrator_state_changed = 84;
         DeferredJobStatsReported deferred_job_stats_reported = 85;
         ThermalThrottlingStateChanged thermal_throttling = 86;
@@ -252,7 +252,7 @@
     }
 
     // Pulled events will start at field 10000.
-    // Next: 10048
+    // Next: 10056
     oneof pulled {
         WifiBytesTransfer wifi_bytes_transfer = 10000;
         WifiBytesTransferByFgBg wifi_bytes_transfer_by_fg_bg = 10001;
@@ -308,6 +308,8 @@
         TrainInfo train_info = 10051;
         TimeZoneDataInfo time_zone_data_info = 10052;
         SDCardInfo sdcard_info = 10053;
+        GpuStatsGlobalInfo gpu_stats_global_info = 10054;
+        GpuStatsAppInfo gpu_stats_app_info = 10055;
     }
 
     // DO NOT USE field numbers above 100,000 in AOSP.
@@ -519,7 +521,7 @@
         ADD_PSS_EXTERNAL_SLOW = 4;
     }
     optional Type type = 7;
-    optional int64 duration = 8;
+    optional int64 duration_millis = 8;
 }
 
 /**
@@ -1566,6 +1568,7 @@
         ROLLBACK_INITIATE = 1;
         ROLLBACK_SUCCESS = 2;
         ROLLBACK_FAILURE = 3;
+        ROLLBACK_BOOT_TRIGGERED = 4;
     }
     optional RollbackType rollback_type = 1;
 
@@ -3002,6 +3005,9 @@
 
     // The elapsed real time of start of the process.
     optional int64 process_start_time_nanos = 9;
+
+    // Min oom adj score considered by lmkd.
+    optional int32 min_oom_score = 10;
 }
 
 /*
@@ -3237,8 +3243,18 @@
         INSTALL_FAILURE = 6;
         INSTALL_CANCELLED = 7;
         INSTALLER_ROLLBACK_REQUESTED = 8;
-        INSTALLER_ROLLBACK_SUCCESS = 9;
-        INSTALLER_ROLLBACK_FAILURE = 10;
+        INSTALLER_ROLLBACK_INITIATED = 9;
+        INSTALLER_ROLLBACK_INITIATED_FAILURE = 10;
+        INSTALLER_ROLLBACK_STAGED = 11;
+        INSTALLER_ROLLBACK_STAGED_FAILURE = 12;
+        INSTALLER_ROLLBACK_BOOT_TRIGGERED = 13;
+        INSTALLER_ROLLBACK_BOOT_TRIGGERED_FAILURE = 14;
+        INSTALLER_ROLLBACK_SUCCESS = 15;
+        INSTALLER_ROLLBACK_FAILURE = 16;
+        INSTALLER_ROLLBACK_CANCEL_STAGED_REMOVE_FROM_QUEUE = 17;
+        INSTALLER_ROLLBACK_CANCEL_STAGED_DELETE_SESSION_INITIATED = 18;
+        INSTALLER_ROLLBACK_CANCEL_STAGED_DELETE_SESSION_SUCCESS = 19;
+        INSTALLER_ROLLBACK_CANCEL_STAGED_DELETE_SESSION_FAILURE = 20;
     }
     optional State state = 6;
     // Possible experiment ids for monitoring this push.
@@ -5528,8 +5544,9 @@
     optional com.android.server.job.ConstraintEnum constraint = 3;
 
     enum State {
-        UNSATISFIED = 0;
-        SATISFIED = 1;
+        UNKNOWN = 0;
+        UNSATISFIED = 1;
+        SATISFIED = 2;
     }
     optional State state = 4;
 }
@@ -5646,6 +5663,33 @@
     optional int64 train_version_code = 1;
 
     optional TrainExperimentIds train_experiment_id = 2;
+
+    optional string train_name = 3;
+
+    enum Status {
+        UNKNOWN = 0;
+        INSTALL_REQUESTED = 1;
+        INSTALL_STARTED = 2;
+        INSTALL_STAGED_NOT_READY = 3;
+        INSTALL_STAGED_READY = 4;
+        INSTALL_SUCCESS = 5;
+        INSTALL_FAILURE = 6;
+        INSTALL_CANCELLED = 7;
+        INSTALLER_ROLLBACK_REQUESTED = 8;
+        INSTALLER_ROLLBACK_INITIATED = 9;
+        INSTALLER_ROLLBACK_INITIATED_FAILURE = 10;
+        INSTALLER_ROLLBACK_STAGED = 11;
+        INSTALLER_ROLLBACK_STAGED_FAILURE = 12;
+        INSTALLER_ROLLBACK_BOOT_TRIGGERED = 13;
+        INSTALLER_ROLLBACK_BOOT_TRIGGERED_FAILURE = 14;
+        INSTALLER_ROLLBACK_SUCCESS = 15;
+        INSTALLER_ROLLBACK_FAILURE = 16;
+        INSTALLER_ROLLBACK_CANCEL_STAGED_REMOVE_FROM_QUEUE = 17;
+        INSTALLER_ROLLBACK_CANCEL_STAGED_DELETE_SESSION_INITIATED = 18;
+        INSTALLER_ROLLBACK_CANCEL_STAGED_DELETE_SESSION_SUCCESS = 19;
+        INSTALLER_ROLLBACK_CANCEL_STAGED_DELETE_SESSION_FAILURE = 20;
+    }
+    optional Status status = 4;
 }
 
 /**
@@ -5687,3 +5731,55 @@
     // A version identifier for the data set on device. e.g. "2018i"
     optional string tzdb_version = 1;
 }
+
+/*
+ * Logs the GPU stats global health information.
+ *
+ * Logged from:
+ *   frameworks/native/services/gpuservice/gpustats/
+ */
+message GpuStatsGlobalInfo {
+    // Package name of the gpu driver.
+    optional string driver_package_name = 1;
+
+    // Version name of the gpu driver.
+    optional string driver_version_name = 2;
+
+    // Version code of the gpu driver.
+    optional int64 driver_version_code = 3;
+
+    // Build time of the gpu driver in UTC as seconds since January 1, 1970.
+    optional int64 driver_build_time = 4;
+
+    // Total count of the gl driver gets loaded.
+    optional int64 gl_loading_count = 5;
+
+    // Total count of the gl driver fails to be loaded.
+    optional int64 gl_loading_failure_count = 6;
+
+    // Total count of the Vulkan driver gets loaded.
+    optional int64 vk_loading_count = 7;
+
+    // Total count of the Vulkan driver fails to be loaded.
+    optional int64 vk_loading_failure_count = 8;
+}
+
+/*
+ * Logs the GPU stats per app health information.
+ *
+ * Logged from:
+ *   frameworks/native/services/gpuservice/gpustats/
+ */
+message GpuStatsAppInfo {
+    // Package name of the application that loads the gpu driver.
+    optional string app_package_name = 1;
+
+    // Version code of the gpu driver this app loads.
+    optional int64 driver_version_code = 2;
+
+    // List of all the gl driver loading times for this app.
+    repeated int64 gl_driver_loading_time = 3;
+
+    // List of all the Vulkan driver laoding times for this app.
+    repeated int64 vk_driver_loading_time = 4;
+}
diff --git a/cmds/statsd/src/external/GpuStatsPuller.cpp b/cmds/statsd/src/external/GpuStatsPuller.cpp
new file mode 100644
index 0000000..8445803
--- /dev/null
+++ b/cmds/statsd/src/external/GpuStatsPuller.cpp
@@ -0,0 +1,91 @@
+/*
+ * Copyright 2019 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.
+ */
+
+#include "GpuStatsPuller.h"
+
+#include <binder/IServiceManager.h>
+#include <graphicsenv/GpuStatsInfo.h>
+#include <graphicsenv/IGpuService.h>
+
+#include "logd/LogEvent.h"
+
+#include "stats_log_util.h"
+#include "statslog.h"
+
+namespace android {
+namespace os {
+namespace statsd {
+
+GpuStatsPuller::GpuStatsPuller(const int tagId) : StatsPuller(tagId) {
+}
+
+static sp<IGpuService> getGpuService() {
+    const sp<IBinder> binder = defaultServiceManager()->checkService(String16("gpu"));
+    if (!binder) {
+        ALOGE("Failed to get gpu service");
+        return nullptr;
+    }
+
+    return interface_cast<IGpuService>(binder);
+}
+
+static bool pullGpuStatsGlobalInfo(const sp<IGpuService>& gpuService,
+                                   std::vector<std::shared_ptr<LogEvent>>* data) {
+    std::vector<GpuStatsGlobalInfo> stats;
+    status_t status = gpuService->getGpuStatsGlobalInfo(&stats);
+    if (status != OK) {
+        return false;
+    }
+
+    data->clear();
+    data->reserve(stats.size());
+    for (const auto& info : stats) {
+        std::shared_ptr<LogEvent> event = make_shared<LogEvent>(
+                android::util::GPU_STATS_GLOBAL_INFO, getWallClockNs(), getElapsedRealtimeNs());
+        if (!event->write(info.driverPackageName)) return false;
+        if (!event->write(info.driverVersionName)) return false;
+        if (!event->write((int64_t)info.driverVersionCode)) return false;
+        if (!event->write(info.driverBuildTime)) return false;
+        if (!event->write((int64_t)info.glLoadingCount)) return false;
+        if (!event->write((int64_t)info.glLoadingFailureCount)) return false;
+        if (!event->write((int64_t)info.vkLoadingCount)) return false;
+        if (!event->write((int64_t)info.vkLoadingFailureCount)) return false;
+        event->init();
+        data->emplace_back(event);
+    }
+
+    return true;
+}
+
+bool GpuStatsPuller::PullInternal(std::vector<std::shared_ptr<LogEvent>>* data) {
+    const sp<IGpuService> gpuService = getGpuService();
+    if (!gpuService) {
+        return false;
+    }
+
+    switch (mTagId) {
+        case android::util::GPU_STATS_GLOBAL_INFO:
+            return pullGpuStatsGlobalInfo(gpuService, data);
+        default:
+            break;
+    }
+
+    return false;
+}
+
+}  // namespace statsd
+}  // namespace os
+}  // namespace android
diff --git a/cmds/statsd/src/external/GpuStatsPuller.h b/cmds/statsd/src/external/GpuStatsPuller.h
new file mode 100644
index 0000000..4c7a4d6
--- /dev/null
+++ b/cmds/statsd/src/external/GpuStatsPuller.h
@@ -0,0 +1,36 @@
+/*
+ * Copyright 2019 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.
+ */
+
+#pragma once
+
+#include "StatsPuller.h"
+
+namespace android {
+namespace os {
+namespace statsd {
+
+/**
+ * Pull GpuStats from GpuService.
+ */
+class GpuStatsPuller : public StatsPuller {
+public:
+    explicit GpuStatsPuller(const int tagId);
+    bool PullInternal(std::vector<std::shared_ptr<LogEvent>>* data) override;
+};
+
+}  // namespace statsd
+}  // namespace os
+}  // namespace android
diff --git a/cmds/statsd/src/external/StatsPullerManager.cpp b/cmds/statsd/src/external/StatsPullerManager.cpp
index 1513834..924704b 100644
--- a/cmds/statsd/src/external/StatsPullerManager.cpp
+++ b/cmds/statsd/src/external/StatsPullerManager.cpp
@@ -27,6 +27,7 @@
 #include "../logd/LogEvent.h"
 #include "../stats_log_util.h"
 #include "../statscompanion_util.h"
+#include "GpuStatsPuller.h"
 #include "PowerStatsPuller.h"
 #include "ResourceHealthManagerPuller.h"
 #include "StatsCallbackPuller.h"
@@ -240,6 +241,9 @@
         // SDCardInfo
         {android::util::SDCARD_INFO,
          {.puller = new StatsCompanionServicePuller(android::util::SDCARD_INFO)}},
+        // GpuStatsGlobalInfo
+        {android::util::GPU_STATS_GLOBAL_INFO,
+         {.puller = new GpuStatsPuller(android::util::GPU_STATS_GLOBAL_INFO)}},
 };
 
 StatsPullerManager::StatsPullerManager() : mNextPullTimeNs(NO_ALARM_UPDATE) {
diff --git a/cmds/statsd/src/logd/LogEvent.cpp b/cmds/statsd/src/logd/LogEvent.cpp
index dec36b5..d9f5415 100644
--- a/cmds/statsd/src/logd/LogEvent.cpp
+++ b/cmds/statsd/src/logd/LogEvent.cpp
@@ -21,6 +21,7 @@
 #include "statslog.h"
 
 #include <binder/IPCThreadState.h>
+#include <private/android_filesystem_config.h>
 
 namespace android {
 namespace os {
@@ -202,140 +203,11 @@
 }
 
 LogEvent::LogEvent(int64_t wallClockTimestampNs, int64_t elapsedTimestampNs,
-                   const SpeakerImpedance& speakerImpedance) {
-    mLogdTimestampNs = wallClockTimestampNs;
-    mElapsedTimestampNs = elapsedTimestampNs;
-    mTagId = android::util::SPEAKER_IMPEDANCE_REPORTED;
-
-    mValues.push_back(
-            FieldValue(Field(mTagId, getSimpleField(1)), Value(speakerImpedance.speakerLocation)));
-    mValues.push_back(
-            FieldValue(Field(mTagId, getSimpleField(2)), Value(speakerImpedance.milliOhms)));
-}
-
-LogEvent::LogEvent(int64_t wallClockTimestampNs, int64_t elapsedTimestampNs,
-                   const HardwareFailed& hardwareFailed) {
-    mLogdTimestampNs = wallClockTimestampNs;
-    mElapsedTimestampNs = elapsedTimestampNs;
-    mTagId = android::util::HARDWARE_FAILED;
-
-    mValues.push_back(FieldValue(Field(mTagId, getSimpleField(1)),
-                                 Value(int32_t(hardwareFailed.hardwareType))));
-    mValues.push_back(
-            FieldValue(Field(mTagId, getSimpleField(2)), Value(hardwareFailed.hardwareLocation)));
-    mValues.push_back(
-            FieldValue(Field(mTagId, getSimpleField(3)), Value(int32_t(hardwareFailed.errorCode))));
-}
-
-LogEvent::LogEvent(int64_t wallClockTimestampNs, int64_t elapsedTimestampNs,
-                   const PhysicalDropDetected& physicalDropDetected) {
-    mLogdTimestampNs = wallClockTimestampNs;
-    mElapsedTimestampNs = elapsedTimestampNs;
-    mTagId = android::util::PHYSICAL_DROP_DETECTED;
-
-    mValues.push_back(FieldValue(Field(mTagId, getSimpleField(1)),
-                                 Value(int32_t(physicalDropDetected.confidencePctg))));
-    mValues.push_back(
-            FieldValue(Field(mTagId, getSimpleField(2)), Value(physicalDropDetected.accelPeak)));
-    mValues.push_back(FieldValue(Field(mTagId, getSimpleField(3)),
-                                 Value(physicalDropDetected.freefallDuration)));
-}
-
-LogEvent::LogEvent(int64_t wallClockTimestampNs, int64_t elapsedTimestampNs,
-                   const ChargeCycles& chargeCycles) {
-    mLogdTimestampNs = wallClockTimestampNs;
-    mElapsedTimestampNs = elapsedTimestampNs;
-    mTagId = android::util::CHARGE_CYCLES_REPORTED;
-
-    for (size_t i = 0; i < chargeCycles.cycleBucket.size(); i++) {
-        mValues.push_back(FieldValue(Field(mTagId, getSimpleField(i + 1)),
-                                     Value(chargeCycles.cycleBucket[i])));
-    }
-}
-
-LogEvent::LogEvent(int64_t wallClockTimestampNs, int64_t elapsedTimestampNs,
-                   const BatteryHealthSnapshotArgs& batteryHealthSnapshotArgs) {
-    mLogdTimestampNs = wallClockTimestampNs;
-    mElapsedTimestampNs = elapsedTimestampNs;
-    mTagId = android::util::BATTERY_HEALTH_SNAPSHOT;
-
-    mValues.push_back(FieldValue(Field(mTagId, getSimpleField(1)),
-                                 Value(int32_t(batteryHealthSnapshotArgs.type))));
-    mValues.push_back(FieldValue(Field(mTagId, getSimpleField(2)),
-                                 Value(batteryHealthSnapshotArgs.temperatureDeciC)));
-    mValues.push_back(FieldValue(Field(mTagId, getSimpleField(3)),
-                                 Value(batteryHealthSnapshotArgs.voltageMicroV)));
-    mValues.push_back(FieldValue(Field(mTagId, getSimpleField(4)),
-                                 Value(batteryHealthSnapshotArgs.currentMicroA)));
-    mValues.push_back(FieldValue(Field(mTagId, getSimpleField(5)),
-                                 Value(batteryHealthSnapshotArgs.openCircuitVoltageMicroV)));
-    mValues.push_back(FieldValue(Field(mTagId, getSimpleField(6)),
-                                 Value(batteryHealthSnapshotArgs.resistanceMicroOhm)));
-    mValues.push_back(FieldValue(Field(mTagId, getSimpleField(7)),
-                                 Value(batteryHealthSnapshotArgs.levelPercent)));
-}
-
-LogEvent::LogEvent(int64_t wallClockTimestampNs, int64_t elapsedTimestampNs, const SlowIo& slowIo) {
-    mLogdTimestampNs = wallClockTimestampNs;
-    mElapsedTimestampNs = elapsedTimestampNs;
-    mTagId = android::util::SLOW_IO;
-
-    int pos[] = {1};
-    mValues.push_back(
-            FieldValue(Field(mTagId, getSimpleField(1)), Value(int32_t(slowIo.operation))));
-    pos[0]++;
-    mValues.push_back(FieldValue(Field(mTagId, getSimpleField(2)), Value(slowIo.count)));
-}
-
-LogEvent::LogEvent(int64_t wallClockTimestampNs, int64_t elapsedTimestampNs,
-                   const SpeechDspStat& speechDspStat) {
-    mLogdTimestampNs = wallClockTimestampNs;
-    mElapsedTimestampNs = elapsedTimestampNs;
-    mTagId = android::util::SPEECH_DSP_STAT_REPORTED;
-
-    mValues.push_back(FieldValue(Field(mTagId, getSimpleField(1)),
-                                 Value(speechDspStat.totalUptimeMillis)));
-    mValues.push_back(FieldValue(Field(mTagId, getSimpleField(2)),
-                                 Value(speechDspStat.totalDowntimeMillis)));
-    mValues.push_back(FieldValue(Field(mTagId, getSimpleField(3)),
-                                 Value(speechDspStat.totalCrashCount)));
-    mValues.push_back(FieldValue(Field(mTagId, getSimpleField(4)),
-                                 Value(speechDspStat.totalRecoverCount)));
-}
-
-LogEvent::LogEvent(int64_t wallClockTimestampNs, int64_t elapsedTimestampNs,
-                   const BatteryCausedShutdown& batteryCausedShutdown) {
-    mLogdTimestampNs = wallClockTimestampNs;
-    mElapsedTimestampNs = elapsedTimestampNs;
-    mTagId = android::util::BATTERY_CAUSED_SHUTDOWN;
-
-    mValues.push_back(FieldValue(Field(mTagId, getSimpleField(1)),
-                                 Value(batteryCausedShutdown.voltageMicroV)));
-}
-
-LogEvent::LogEvent(int64_t wallClockTimestampNs, int64_t elapsedTimestampNs,
-                   const UsbPortOverheatEvent& usbPortOverheatEvent) {
-    mLogdTimestampNs = wallClockTimestampNs;
-    mElapsedTimestampNs = elapsedTimestampNs;
-    mTagId = android::util::USB_PORT_OVERHEAT_EVENT_REPORTED;
-
-    mValues.push_back(FieldValue(Field(mTagId, getSimpleField(1)),
-                                 Value(usbPortOverheatEvent.plugTemperatureDeciC)));
-    mValues.push_back(FieldValue(Field(mTagId, getSimpleField(2)),
-                                 Value(usbPortOverheatEvent.maxTemperatureDeciC)));
-    mValues.push_back(FieldValue(Field(mTagId, getSimpleField(3)),
-                                 Value(usbPortOverheatEvent.timeToOverheat)));
-    mValues.push_back(FieldValue(Field(mTagId, getSimpleField(4)),
-                                 Value(usbPortOverheatEvent.timeToHysteresis)));
-    mValues.push_back(FieldValue(Field(mTagId, getSimpleField(5)),
-                                 Value(usbPortOverheatEvent.timeToInactive)));
-}
-
-LogEvent::LogEvent(int64_t wallClockTimestampNs, int64_t elapsedTimestampNs,
                    const VendorAtom& vendorAtom) {
     mLogdTimestampNs = wallClockTimestampNs;
     mElapsedTimestampNs = elapsedTimestampNs;
     mTagId = vendorAtom.atomId;
+    mLogUid = AID_STATSD;
 
     mValues.push_back(
             FieldValue(Field(mTagId, getSimpleField(1)), Value(vendorAtom.reverseDomainName)));
@@ -366,9 +238,12 @@
     mLogdTimestampNs = wallClockTimestampNs;
     mElapsedTimestampNs = elapsedTimestampNs;
     mTagId = android::util::TRAIN_INFO;
+
     mValues.push_back(
             FieldValue(Field(mTagId, getSimpleField(1)), Value(trainInfo.trainVersionCode)));
     mValues.push_back(FieldValue(Field(mTagId, getSimpleField(2)), Value(trainInfo.experimentIds)));
+    mValues.push_back(FieldValue(Field(mTagId, getSimpleField(3)), Value(trainInfo.trainName)));
+    mValues.push_back(FieldValue(Field(mTagId, getSimpleField(4)), Value(trainInfo.status)));
 }
 
 LogEvent::LogEvent(int32_t tagId, int64_t timestampNs) : LogEvent(tagId, timestampNs, 0) {}
diff --git a/cmds/statsd/src/logd/LogEvent.h b/cmds/statsd/src/logd/LogEvent.h
index 111a619..753a9a5 100644
--- a/cmds/statsd/src/logd/LogEvent.h
+++ b/cmds/statsd/src/logd/LogEvent.h
@@ -58,6 +58,8 @@
 
 struct InstallTrainInfo {
     int64_t trainVersionCode;
+    std::string trainName;
+    int32_t status;
     std::vector<uint8_t> experimentIds;
 };
 /**
@@ -108,33 +110,6 @@
                       const std::vector<uint8_t>& experimentIds, int32_t userId);
 
     explicit LogEvent(int64_t wallClockTimestampNs, int64_t elapsedTimestampNs,
-                      const SpeakerImpedance& speakerImpedance);
-
-    explicit LogEvent(int64_t wallClockTimestampNs, int64_t elapsedTimestampNs,
-                      const HardwareFailed& hardwareFailed);
-
-    explicit LogEvent(int64_t wallClockTimestampNs, int64_t elapsedTimestampNs,
-                      const PhysicalDropDetected& physicalDropDetected);
-
-    explicit LogEvent(int64_t wallClockTimestampNs, int64_t elapsedTimestampNs,
-                      const ChargeCycles& chargeCycles);
-
-    explicit LogEvent(int64_t wallClockTimestampNs, int64_t elapsedTimestampNs,
-                      const BatteryHealthSnapshotArgs& batteryHealthSnapshotArgs);
-
-    explicit LogEvent(int64_t wallClockTimestampNs, int64_t elapsedTimestampNs,
-                      const SlowIo& slowIo);
-
-    explicit LogEvent(int64_t wallClockTimestampNs, int64_t elapsedTimestampNs,
-                      const BatteryCausedShutdown& batteryCausedShutdown);
-
-    explicit LogEvent(int64_t wallClockTimestampNs, int64_t elapsedTimestampNs,
-                      const UsbPortOverheatEvent& usbPortOverheatEvent);
-
-    explicit LogEvent(int64_t wallClockTimestampNs, int64_t elapsedTimestampNs,
-                      const SpeechDspStat& speechDspStat);
-
-    explicit LogEvent(int64_t wallClockTimestampNs, int64_t elapsedTimestampNs,
                       const VendorAtom& vendorAtom);
 
     explicit LogEvent(int64_t wallClockTimestampNs, int64_t elapsedTimestampNs,
diff --git a/cmds/statsd/src/metrics/MetricProducer.h b/cmds/statsd/src/metrics/MetricProducer.h
index 99cb5d4..046f996 100644
--- a/cmds/statsd/src/metrics/MetricProducer.h
+++ b/cmds/statsd/src/metrics/MetricProducer.h
@@ -69,7 +69,7 @@
           mTimeBaseNs(timeBaseNs),
           mCurrentBucketStartTimeNs(timeBaseNs),
           mCurrentBucketNum(0),
-          mCondition(conditionIndex >= 0 ? ConditionState::kUnknown : ConditionState::kTrue),
+          mCondition(initialCondition(conditionIndex)),
           mConditionSliced(false),
           mWizard(wizard),
           mConditionTrackerIndex(conditionIndex),
@@ -82,6 +82,10 @@
 
     virtual ~MetricProducer(){};
 
+    ConditionState initialCondition(const int conditionIndex) const {
+        return conditionIndex >= 0 ? ConditionState::kUnknown : ConditionState::kTrue;
+    }
+
     /**
      * Forces this metric to split into a partial bucket right now. If we're past a full bucket, we
      * first call the standard flushing code to flush up to the latest full bucket. Then we call
diff --git a/cmds/statsd/src/metrics/ValueMetricProducer.cpp b/cmds/statsd/src/metrics/ValueMetricProducer.cpp
index 9de62a2..27ee570 100644
--- a/cmds/statsd/src/metrics/ValueMetricProducer.cpp
+++ b/cmds/statsd/src/metrics/ValueMetricProducer.cpp
@@ -394,7 +394,7 @@
         invalidateCurrentBucket();
         // Something weird happened. If we received another event if the future, the condition might
         // be wrong.
-        mCondition = ConditionState::kUnknown;
+        mCondition = initialCondition(mConditionTrackerIndex);
     }
 
     // This part should alway be called.
diff --git a/cmds/statsd/src/statsd_config.proto b/cmds/statsd/src/statsd_config.proto
index 5c6d548..0e91f52 100644
--- a/cmds/statsd/src/statsd_config.proto
+++ b/cmds/statsd/src/statsd_config.proto
@@ -324,6 +324,12 @@
     EXPLICIT = 1;
   }
   optional Destination dest = 2;
+
+  // Package name of the incident report receiver.
+  optional string receiver_pkg = 3;
+
+  // Class name of the incident report receiver.
+  optional string receiver_cls = 4;
 }
 
 message PerfettoDetails {
diff --git a/cmds/statsd/src/storage/StorageManager.cpp b/cmds/statsd/src/storage/StorageManager.cpp
index 165e57c..5df8fb5 100644
--- a/cmds/statsd/src/storage/StorageManager.cpp
+++ b/cmds/statsd/src/storage/StorageManager.cpp
@@ -95,8 +95,8 @@
     close(fd);
 }
 
-bool StorageManager::writeTrainInfo(int64_t trainVersionCode,
-                                    const std::vector<uint8_t>& experimentIds) {
+bool StorageManager::writeTrainInfo(int64_t trainVersionCode, const std::string& trainName,
+                                    int32_t status, const std::vector<uint8_t>& experimentIds) {
     std::lock_guard<std::mutex> lock(sTrainInfoMutex);
 
     deleteAllFiles(TRAIN_INFO_DIR);
@@ -109,7 +109,34 @@
         return false;
     }
 
-    size_t result = write(fd, experimentIds.data(), experimentIds.size());
+    size_t result;
+
+    // Write # of bytes in trainName to file
+    const size_t trainNameSize = trainName.size();
+    const size_t trainNameSizeByteCount = sizeof(trainNameSize);
+    result = write(fd, (uint8_t*)&trainNameSize, trainNameSizeByteCount);
+    if (result != trainNameSizeByteCount) {
+        VLOG("Failed to write %s", file_name.c_str());
+        return false;
+    }
+
+    // Write trainName to file
+    result = write(fd, trainName.c_str(), trainNameSize);
+    if (result != trainNameSize) {
+        VLOG("Failed to write %s", file_name.c_str());
+        return false;
+    }
+
+    // Write status to file
+    const size_t statusByteCount = sizeof(status);
+    result = write(fd, (uint8_t*)&status, statusByteCount);
+    if (result != statusByteCount) {
+        VLOG("Failed to write %s", file_name.c_str());
+        return false;
+    }
+
+    // Write experimentIds to file
+    result = write(fd, experimentIds.data(), experimentIds.size());
     if (result == experimentIds.size()) {
         VLOG("Successfully wrote %s", file_name.c_str());
     } else {
@@ -150,7 +177,27 @@
             string str;
             if (android::base::ReadFdToString(fd, &str)) {
                 close(fd);
-                std::copy(str.begin(), str.end(), std::back_inserter(trainInfo.experimentIds));
+
+                auto it = str.begin();
+
+                // Read # of bytes taken by trainName in the file
+                size_t trainNameSize;
+                const size_t trainNameSizeByteCount = sizeof(trainNameSize);
+                std::copy_n(it, trainNameSizeByteCount, &trainNameSize);
+                it += trainNameSizeByteCount;
+
+                // Read trainName
+                std::copy_n(it, trainNameSize, std::back_inserter(trainInfo.trainName));
+                it += trainNameSize;
+
+                // Read status
+                const size_t statusByteCount = sizeof(trainInfo.status);
+                std::copy_n(it, statusByteCount, &trainInfo.status);
+                it += statusByteCount;
+
+                // Read experimentIds
+                std::copy(it, str.end(), std::back_inserter(trainInfo.experimentIds));
+
                 VLOG("Read train info file successful: %s", fullPath.c_str());
                 return true;
             }
diff --git a/cmds/statsd/src/storage/StorageManager.h b/cmds/statsd/src/storage/StorageManager.h
index d6df867..88280cf 100644
--- a/cmds/statsd/src/storage/StorageManager.h
+++ b/cmds/statsd/src/storage/StorageManager.h
@@ -44,7 +44,8 @@
     /**
      * Writes train info.
      */
-    static bool writeTrainInfo(int64_t trainVersionCode, const std::vector<uint8_t>& experimentIds);
+    static bool writeTrainInfo(int64_t trainVersionCode, const std::string& trainName,
+                               int32_t status, const std::vector<uint8_t>& experimentIds);
 
     /**
      * Reads train info.
diff --git a/cmds/statsd/src/subscriber/IncidentdReporter.cpp b/cmds/statsd/src/subscriber/IncidentdReporter.cpp
index 0ed2d75..7c2d242 100644
--- a/cmds/statsd/src/subscriber/IncidentdReporter.cpp
+++ b/cmds/statsd/src/subscriber/IncidentdReporter.cpp
@@ -162,6 +162,10 @@
     }
     incidentReport.setDest(dest);
 
+    incidentReport.setReceiverPkg(config.receiver_pkg());
+
+    incidentReport.setReceiverCls(config.receiver_cls());
+
     sp<IIncidentManager> service = interface_cast<IIncidentManager>(
             defaultServiceManager()->getService(android::String16("incident")));
     if (service == nullptr) {
diff --git a/cmds/statsd/tests/external/IncidentReportArgs_test.cpp b/cmds/statsd/tests/external/IncidentReportArgs_test.cpp
new file mode 100644
index 0000000..c170b12
--- /dev/null
+++ b/cmds/statsd/tests/external/IncidentReportArgs_test.cpp
@@ -0,0 +1,72 @@
+// Copyright (C) 2018 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.
+
+#include <android/os/IncidentReportArgs.h>
+
+#include <gtest/gtest.h>
+
+namespace android {
+namespace os {
+namespace statsd {
+
+TEST(IncidentReportArgsTest, testSerialization) {
+    IncidentReportArgs args;
+    args.setAll(0);
+    args.addSection(1000);
+    args.addSection(1001);
+
+    vector<uint8_t> header1;
+    header1.push_back(0x1);
+    header1.push_back(0x2);
+    vector<uint8_t> header2;
+    header1.push_back(0x22);
+    header1.push_back(0x33);
+
+    args.addHeader(header1);
+    args.addHeader(header2);
+
+    args.setDest(1);
+
+    args.setReceiverPkg("com.android.os");
+    args.setReceiverCls("com.android.os.Receiver");
+
+    Parcel out;
+    status_t err = args.writeToParcel(&out);
+    EXPECT_EQ(NO_ERROR, err);
+
+    out.setDataPosition(0);
+
+    IncidentReportArgs args2;
+    err = args2.readFromParcel(&out);
+    EXPECT_EQ(NO_ERROR, err);
+
+    EXPECT_EQ(0, args2.all());
+    set<int> sections;
+    sections.insert(1000);
+    sections.insert(1001);
+    EXPECT_EQ(sections, args2.sections());
+    EXPECT_EQ(1, args2.dest());
+
+    EXPECT_EQ(String16("com.android.os"), args2.receiverPkg());
+    EXPECT_EQ(String16("com.android.os.Receiver"), args2.receiverCls());
+
+    vector<vector<uint8_t>> headers;
+    headers.push_back(header1);
+    headers.push_back(header2);
+    EXPECT_EQ(headers, args2.headers());
+}
+
+}  // namespace statsd
+}  // namespace os
+}  // namespace android
\ No newline at end of file
diff --git a/cmds/statsd/tests/storage/StorageManager_test.cpp b/cmds/statsd/tests/storage/StorageManager_test.cpp
index f66de05..4564a5d 100644
--- a/cmds/statsd/tests/storage/StorageManager_test.cpp
+++ b/cmds/statsd/tests/storage/StorageManager_test.cpp
@@ -32,16 +32,82 @@
 TEST(StorageManagerTest, TrainInfoReadWriteTest) {
     InstallTrainInfo trainInfo;
     trainInfo.trainVersionCode = 12345;
+    trainInfo.trainName = "This is a train name #)$(&&$";
+    trainInfo.status = 1;
     const char* expIds = "test_ids";
     trainInfo.experimentIds.assign(expIds, expIds + strlen(expIds));
 
-    StorageManager::writeTrainInfo(trainInfo.trainVersionCode, trainInfo.experimentIds);
+    bool result;
 
-    InstallTrainInfo result;
-    StorageManager::readTrainInfo(result);
-    EXPECT_EQ(trainInfo.trainVersionCode, result.trainVersionCode);
-    EXPECT_EQ(trainInfo.experimentIds.size(), result.experimentIds.size());
-    EXPECT_EQ(trainInfo.experimentIds, result.experimentIds);
+    result = StorageManager::writeTrainInfo(trainInfo.trainVersionCode, trainInfo.trainName,
+                                            trainInfo.status, trainInfo.experimentIds);
+
+    EXPECT_TRUE(result);
+
+    InstallTrainInfo trainInfoResult;
+    result = StorageManager::readTrainInfo(trainInfoResult);
+    EXPECT_TRUE(result);
+
+    EXPECT_EQ(trainInfo.trainVersionCode, trainInfoResult.trainVersionCode);
+    EXPECT_EQ(trainInfo.trainName.size(), trainInfoResult.trainName.size());
+    EXPECT_EQ(trainInfo.trainName, trainInfoResult.trainName);
+    EXPECT_EQ(trainInfo.status, trainInfoResult.status);
+    EXPECT_EQ(trainInfo.experimentIds.size(), trainInfoResult.experimentIds.size());
+    EXPECT_EQ(trainInfo.experimentIds, trainInfoResult.experimentIds);
+}
+
+TEST(StorageManagerTest, TrainInfoReadWriteEmptyTrainNameTest) {
+    InstallTrainInfo trainInfo;
+    trainInfo.trainVersionCode = 12345;
+    trainInfo.trainName = "";
+    trainInfo.status = 1;
+    const char* expIds = "test_ids";
+    trainInfo.experimentIds.assign(expIds, expIds + strlen(expIds));
+
+    bool result;
+
+    result = StorageManager::writeTrainInfo(trainInfo.trainVersionCode, trainInfo.trainName,
+                                            trainInfo.status, trainInfo.experimentIds);
+
+    EXPECT_TRUE(result);
+
+    InstallTrainInfo trainInfoResult;
+    result = StorageManager::readTrainInfo(trainInfoResult);
+    EXPECT_TRUE(result);
+
+    EXPECT_EQ(trainInfo.trainVersionCode, trainInfoResult.trainVersionCode);
+    EXPECT_EQ(trainInfo.trainName.size(), trainInfoResult.trainName.size());
+    EXPECT_EQ(trainInfo.trainName, trainInfoResult.trainName);
+    EXPECT_EQ(trainInfo.status, trainInfoResult.status);
+    EXPECT_EQ(trainInfo.experimentIds.size(), trainInfoResult.experimentIds.size());
+    EXPECT_EQ(trainInfo.experimentIds, trainInfoResult.experimentIds);
+}
+
+TEST(StorageManagerTest, TrainInfoReadWriteTrainNameSizeOneTest) {
+    InstallTrainInfo trainInfo;
+    trainInfo.trainVersionCode = 12345;
+    trainInfo.trainName = "{";
+    trainInfo.status = 1;
+    const char* expIds = "test_ids";
+    trainInfo.experimentIds.assign(expIds, expIds + strlen(expIds));
+
+    bool result;
+
+    result = StorageManager::writeTrainInfo(trainInfo.trainVersionCode, trainInfo.trainName,
+                                            trainInfo.status, trainInfo.experimentIds);
+
+    EXPECT_TRUE(result);
+
+    InstallTrainInfo trainInfoResult;
+    result = StorageManager::readTrainInfo(trainInfoResult);
+    EXPECT_TRUE(result);
+
+    EXPECT_EQ(trainInfo.trainVersionCode, trainInfoResult.trainVersionCode);
+    EXPECT_EQ(trainInfo.trainName.size(), trainInfoResult.trainName.size());
+    EXPECT_EQ(trainInfo.trainName, trainInfoResult.trainName);
+    EXPECT_EQ(trainInfo.status, trainInfoResult.status);
+    EXPECT_EQ(trainInfo.experimentIds.size(), trainInfoResult.experimentIds.size());
+    EXPECT_EQ(trainInfo.experimentIds, trainInfoResult.experimentIds);
 }
 
 }  // namespace statsd
diff --git a/config/hiddenapi-greylist.txt b/config/hiddenapi-greylist.txt
index e25f463..ff8dec1 100644
--- a/config/hiddenapi-greylist.txt
+++ b/config/hiddenapi-greylist.txt
@@ -5,21 +5,10 @@
 Landroid/accounts/IAccountAuthenticator$Stub$Proxy;->mRemote:Landroid/os/IBinder;
 Landroid/accounts/IAccountAuthenticator$Stub;-><init>()V
 Landroid/accounts/IAccountAuthenticator$Stub;->asInterface(Landroid/os/IBinder;)Landroid/accounts/IAccountAuthenticator;
-Landroid/accounts/IAccountAuthenticator;->addAccount(Landroid/accounts/IAccountAuthenticatorResponse;Ljava/lang/String;Ljava/lang/String;[Ljava/lang/String;Landroid/os/Bundle;)V
-Landroid/accounts/IAccountAuthenticator;->confirmCredentials(Landroid/accounts/IAccountAuthenticatorResponse;Landroid/accounts/Account;Landroid/os/Bundle;)V
-Landroid/accounts/IAccountAuthenticator;->editProperties(Landroid/accounts/IAccountAuthenticatorResponse;Ljava/lang/String;)V
-Landroid/accounts/IAccountAuthenticator;->getAccountRemovalAllowed(Landroid/accounts/IAccountAuthenticatorResponse;Landroid/accounts/Account;)V
-Landroid/accounts/IAccountAuthenticator;->getAuthToken(Landroid/accounts/IAccountAuthenticatorResponse;Landroid/accounts/Account;Ljava/lang/String;Landroid/os/Bundle;)V
-Landroid/accounts/IAccountAuthenticator;->getAuthTokenLabel(Landroid/accounts/IAccountAuthenticatorResponse;Ljava/lang/String;)V
-Landroid/accounts/IAccountAuthenticator;->hasFeatures(Landroid/accounts/IAccountAuthenticatorResponse;Landroid/accounts/Account;[Ljava/lang/String;)V
-Landroid/accounts/IAccountAuthenticator;->updateCredentials(Landroid/accounts/IAccountAuthenticatorResponse;Landroid/accounts/Account;Ljava/lang/String;Landroid/os/Bundle;)V
 Landroid/accounts/IAccountAuthenticatorResponse$Stub$Proxy;-><init>(Landroid/os/IBinder;)V
 Landroid/accounts/IAccountAuthenticatorResponse$Stub$Proxy;->mRemote:Landroid/os/IBinder;
 Landroid/accounts/IAccountAuthenticatorResponse$Stub;-><init>()V
 Landroid/accounts/IAccountAuthenticatorResponse$Stub;->asInterface(Landroid/os/IBinder;)Landroid/accounts/IAccountAuthenticatorResponse;
-Landroid/accounts/IAccountAuthenticatorResponse;->onError(ILjava/lang/String;)V
-Landroid/accounts/IAccountAuthenticatorResponse;->onRequestContinued()V
-Landroid/accounts/IAccountAuthenticatorResponse;->onResult(Landroid/os/Bundle;)V
 Landroid/accounts/IAccountManager$Stub$Proxy;-><init>(Landroid/os/IBinder;)V
 Landroid/accounts/IAccountManager$Stub;-><init>()V
 Landroid/accounts/IAccountManager$Stub;->asInterface(Landroid/os/IBinder;)Landroid/accounts/IAccountManager;
@@ -27,8 +16,6 @@
 Landroid/accounts/IAccountManagerResponse$Stub$Proxy;->mRemote:Landroid/os/IBinder;
 Landroid/accounts/IAccountManagerResponse$Stub;-><init>()V
 Landroid/accounts/IAccountManagerResponse$Stub;->asInterface(Landroid/os/IBinder;)Landroid/accounts/IAccountManagerResponse;
-Landroid/accounts/IAccountManagerResponse;->onError(ILjava/lang/String;)V
-Landroid/accounts/IAccountManagerResponse;->onResult(Landroid/os/Bundle;)V
 Landroid/app/ActivityManagerNative;-><init>()V
 Landroid/app/ActivityThread$AppBindData;-><init>()V
 Landroid/app/ActivityThread$CreateServiceData;-><init>()V
@@ -36,21 +23,9 @@
 Landroid/app/admin/IDevicePolicyManager$Stub;->asInterface(Landroid/os/IBinder;)Landroid/app/admin/IDevicePolicyManager;
 Landroid/app/admin/IDevicePolicyManager$Stub;->TRANSACTION_packageHasActiveAdmins:I
 Landroid/app/admin/IDevicePolicyManager$Stub;->TRANSACTION_removeActiveAdmin:I
-Landroid/app/admin/IDevicePolicyManager;->packageHasActiveAdmins(Ljava/lang/String;I)Z
 Landroid/app/backup/IBackupManager$Stub;->asInterface(Landroid/os/IBinder;)Landroid/app/backup/IBackupManager;
-Landroid/app/backup/IBackupManager;->acknowledgeFullBackupOrRestore(IZLjava/lang/String;Ljava/lang/String;Landroid/app/backup/IFullBackupRestoreObserver;)V
-Landroid/app/backup/IBackupManager;->clearBackupData(Ljava/lang/String;Ljava/lang/String;)V
-Landroid/app/backup/IBackupManager;->dataChanged(Ljava/lang/String;)V
-Landroid/app/backup/IBackupManager;->getCurrentTransport()Ljava/lang/String;
-Landroid/app/backup/IBackupManager;->isBackupEnabled()Z
-Landroid/app/backup/IBackupManager;->isBackupServiceActive(I)Z
-Landroid/app/backup/IBackupManager;->listAllTransports()[Ljava/lang/String;
-Landroid/app/backup/IBackupManager;->selectBackupTransport(Ljava/lang/String;)Ljava/lang/String;
-Landroid/app/backup/IBackupManager;->setAutoRestore(Z)V
-Landroid/app/backup/IBackupManager;->setBackupEnabled(Z)V
 Landroid/app/backup/IFullBackupRestoreObserver$Stub;-><init>()V
 Landroid/app/backup/IRestoreObserver$Stub;-><init>()V
-Landroid/app/DownloadManager;->restartDownload([J)V
 Landroid/app/IActivityController$Stub;-><init>()V
 Landroid/app/IActivityManager$Stub$Proxy;->getConfiguration()Landroid/content/res/Configuration;
 Landroid/app/IActivityManager$Stub$Proxy;->getLaunchedFromUid(Landroid/os/IBinder;)I
@@ -60,187 +35,52 @@
 Landroid/app/IActivityManager$Stub$Proxy;->setActivityController(Landroid/app/IActivityController;Z)V
 Landroid/app/IActivityManager$Stub$Proxy;->updatePersistentConfiguration(Landroid/content/res/Configuration;)V
 Landroid/app/IActivityManager$Stub;->asInterface(Landroid/os/IBinder;)Landroid/app/IActivityManager;
-Landroid/app/IActivityManager;->bindService(Landroid/app/IApplicationThread;Landroid/os/IBinder;Landroid/content/Intent;Ljava/lang/String;Landroid/app/IServiceConnection;ILjava/lang/String;I)I
-Landroid/app/IActivityManager;->broadcastIntent(Landroid/app/IApplicationThread;Landroid/content/Intent;Ljava/lang/String;Landroid/content/IIntentReceiver;ILjava/lang/String;Landroid/os/Bundle;[Ljava/lang/String;ILandroid/os/Bundle;ZZI)I
-Landroid/app/IActivityManager;->cancelRecentsAnimation(Z)V
-Landroid/app/IActivityManager;->cancelTaskWindowTransition(I)V
-Landroid/app/IActivityManager;->checkPermission(Ljava/lang/String;II)I
-Landroid/app/IActivityManager;->closeSystemDialogs(Ljava/lang/String;)V
-Landroid/app/IActivityManager;->finishActivity(Landroid/os/IBinder;ILandroid/content/Intent;I)Z
-Landroid/app/IActivityManager;->finishHeavyWeightApp()V
 Landroid/app/IActivityManager;->finishReceiver(Landroid/os/IBinder;ILjava/lang/String;Landroid/os/Bundle;ZI)V
-Landroid/app/IActivityManager;->forceStopPackage(Ljava/lang/String;I)V
-Landroid/app/IActivityManager;->getAllStackInfos()Ljava/util/List;
-Landroid/app/IActivityManager;->getConfiguration()Landroid/content/res/Configuration;
-Landroid/app/IActivityManager;->getCurrentUser()Landroid/content/pm/UserInfo;
-Landroid/app/IActivityManager;->getFilteredTasks(III)Ljava/util/List;
-Landroid/app/IActivityManager;->getIntentForIntentSender(Landroid/content/IIntentSender;)Landroid/content/Intent;
-Landroid/app/IActivityManager;->getIntentSender(ILjava/lang/String;Landroid/os/IBinder;Ljava/lang/String;I[Landroid/content/Intent;[Ljava/lang/String;ILandroid/os/Bundle;I)Landroid/content/IIntentSender;
-Landroid/app/IActivityManager;->getLaunchedFromPackage(Landroid/os/IBinder;)Ljava/lang/String;
-Landroid/app/IActivityManager;->getLaunchedFromUid(Landroid/os/IBinder;)I
-Landroid/app/IActivityManager;->getLockTaskModeState()I
-Landroid/app/IActivityManager;->getMemoryInfo(Landroid/app/ActivityManager$MemoryInfo;)V
-Landroid/app/IActivityManager;->getPackageProcessState(Ljava/lang/String;Ljava/lang/String;)I
-Landroid/app/IActivityManager;->getProcessLimit()I
-Landroid/app/IActivityManager;->getProcessMemoryInfo([I)[Landroid/os/Debug$MemoryInfo;
-Landroid/app/IActivityManager;->getProcessPss([I)[J
-Landroid/app/IActivityManager;->getProviderMimeType(Landroid/net/Uri;I)Ljava/lang/String;
-Landroid/app/IActivityManager;->getRecentTasks(III)Landroid/content/pm/ParceledListSlice;
-Landroid/app/IActivityManager;->getRunningAppProcesses()Ljava/util/List;
-Landroid/app/IActivityManager;->getServices(II)Ljava/util/List;
-Landroid/app/IActivityManager;->getTaskBounds(I)Landroid/graphics/Rect;
-Landroid/app/IActivityManager;->getTaskForActivity(Landroid/os/IBinder;Z)I
-Landroid/app/IActivityManager;->getTaskSnapshot(IZ)Landroid/app/ActivityManager$TaskSnapshot;
-Landroid/app/IActivityManager;->handleApplicationStrictModeViolation(Landroid/os/IBinder;ILandroid/os/StrictMode$ViolationInfo;)V
-Landroid/app/IActivityManager;->hang(Landroid/os/IBinder;Z)V
-Landroid/app/IActivityManager;->isInLockTaskMode()Z
-Landroid/app/IActivityManager;->isIntentSenderAnActivity(Landroid/content/IIntentSender;)Z
-Landroid/app/IActivityManager;->isTopOfTask(Landroid/os/IBinder;)Z
-Landroid/app/IActivityManager;->isUserRunning(II)Z
-Landroid/app/IActivityManager;->killAllBackgroundProcesses()V
-Landroid/app/IActivityManager;->killBackgroundProcesses(Ljava/lang/String;I)V
-Landroid/app/IActivityManager;->moveActivityTaskToBack(Landroid/os/IBinder;Z)Z
-Landroid/app/IActivityManager;->moveTaskToFront(IILandroid/os/Bundle;)V
-Landroid/app/IActivityManager;->moveTaskToStack(IIZ)V
-Landroid/app/IActivityManager;->moveTopActivityToPinnedStack(ILandroid/graphics/Rect;)Z
-Landroid/app/IActivityManager;->positionTaskInStack(III)V
-Landroid/app/IActivityManager;->profileControl(Ljava/lang/String;IZLandroid/app/ProfilerInfo;I)Z
-Landroid/app/IActivityManager;->publishContentProviders(Landroid/app/IApplicationThread;Ljava/util/List;)V
-Landroid/app/IActivityManager;->registerProcessObserver(Landroid/app/IProcessObserver;)V
-Landroid/app/IActivityManager;->registerReceiver(Landroid/app/IApplicationThread;Ljava/lang/String;Landroid/content/IIntentReceiver;Landroid/content/IntentFilter;Ljava/lang/String;II)Landroid/content/Intent;
-Landroid/app/IActivityManager;->registerTaskStackListener(Landroid/app/ITaskStackListener;)V
-Landroid/app/IActivityManager;->registerUserSwitchObserver(Landroid/app/IUserSwitchObserver;Ljava/lang/String;)V
-Landroid/app/IActivityManager;->removeContentProviderExternal(Ljava/lang/String;Landroid/os/IBinder;)V
-Landroid/app/IActivityManager;->removeStack(I)V
-Landroid/app/IActivityManager;->removeTask(I)Z
-Landroid/app/IActivityManager;->requestBugReport(I)V
-Landroid/app/IActivityManager;->resizeDockedStack(Landroid/graphics/Rect;Landroid/graphics/Rect;Landroid/graphics/Rect;Landroid/graphics/Rect;Landroid/graphics/Rect;)V
-Landroid/app/IActivityManager;->resizeStack(ILandroid/graphics/Rect;ZZZI)V
-Landroid/app/IActivityManager;->resizeTask(ILandroid/graphics/Rect;I)V
-Landroid/app/IActivityManager;->restart()V
-Landroid/app/IActivityManager;->resumeAppSwitches()V
-Landroid/app/IActivityManager;->sendIdleJobTrigger()V
 Landroid/app/IActivityManager;->serviceDoneExecuting(Landroid/os/IBinder;III)V
-Landroid/app/IActivityManager;->setActivityController(Landroid/app/IActivityController;Z)V
-Landroid/app/IActivityManager;->setAlwaysFinish(Z)V
-Landroid/app/IActivityManager;->setDebugApp(Ljava/lang/String;ZZ)V
-Landroid/app/IActivityManager;->setDumpHeapDebugLimit(Ljava/lang/String;IJLjava/lang/String;)V
-Landroid/app/IActivityManager;->setPackageScreenCompatMode(Ljava/lang/String;I)V
-Landroid/app/IActivityManager;->setProcessImportant(Landroid/os/IBinder;IZLjava/lang/String;)V
-Landroid/app/IActivityManager;->setProcessLimit(I)V
-Landroid/app/IActivityManager;->setProcessMemoryTrimLevel(Ljava/lang/String;II)Z
-Landroid/app/IActivityManager;->setRequestedOrientation(Landroid/os/IBinder;I)V
-Landroid/app/IActivityManager;->setTaskResizeable(II)V
-Landroid/app/IActivityManager;->shutdown(I)Z
-Landroid/app/IActivityManager;->startActivity(Landroid/app/IApplicationThread;Ljava/lang/String;Landroid/content/Intent;Ljava/lang/String;Landroid/os/IBinder;Ljava/lang/String;IILandroid/app/ProfilerInfo;Landroid/os/Bundle;)I
-Landroid/app/IActivityManager;->startActivityAsUser(Landroid/app/IApplicationThread;Ljava/lang/String;Landroid/content/Intent;Ljava/lang/String;Landroid/os/IBinder;Ljava/lang/String;IILandroid/app/ProfilerInfo;Landroid/os/Bundle;I)I
-Landroid/app/IActivityManager;->startActivityFromRecents(ILandroid/os/Bundle;)I
-Landroid/app/IActivityManager;->startBinderTracking()Z
-Landroid/app/IActivityManager;->startInstrumentation(Landroid/content/ComponentName;Ljava/lang/String;ILandroid/os/Bundle;Landroid/app/IInstrumentationWatcher;Landroid/app/IUiAutomationConnection;ILjava/lang/String;)Z
-Landroid/app/IActivityManager;->startRecentsActivity(Landroid/content/Intent;Landroid/app/IAssistDataReceiver;Landroid/view/IRecentsAnimationRunner;)V
-Landroid/app/IActivityManager;->startSystemLockTaskMode(I)V
-Landroid/app/IActivityManager;->startUserInBackground(I)Z
-Landroid/app/IActivityManager;->stopAppSwitches()V
-Landroid/app/IActivityManager;->stopBinderTrackingAndDump(Landroid/os/ParcelFileDescriptor;)Z
-Landroid/app/IActivityManager;->stopService(Landroid/app/IApplicationThread;Landroid/content/Intent;Ljava/lang/String;I)I
-Landroid/app/IActivityManager;->stopUser(IZLandroid/app/IStopUserCallback;)I
-Landroid/app/IActivityManager;->suppressResizeConfigChanges(Z)V
-Landroid/app/IActivityManager;->switchUser(I)Z
-Landroid/app/IActivityManager;->unbindService(Landroid/app/IServiceConnection;)Z
-Landroid/app/IActivityManager;->unhandledBack()V
-Landroid/app/IActivityManager;->unlockUser(I[B[BLandroid/os/IProgressListener;)Z
-Landroid/app/IActivityManager;->unregisterProcessObserver(Landroid/app/IProcessObserver;)V
-Landroid/app/IActivityManager;->unregisterReceiver(Landroid/content/IIntentReceiver;)V
-Landroid/app/IActivityManager;->unstableProviderDied(Landroid/os/IBinder;)V
-Landroid/app/IActivityManager;->updateConfiguration(Landroid/content/res/Configuration;)Z
-Landroid/app/IActivityManager;->updatePersistentConfiguration(Landroid/content/res/Configuration;)V
 Landroid/app/IAlarmManager$Stub$Proxy;-><init>(Landroid/os/IBinder;)V
 Landroid/app/IAlarmManager$Stub;->asInterface(Landroid/os/IBinder;)Landroid/app/IAlarmManager;
 Landroid/app/IAlarmManager$Stub;->TRANSACTION_remove:I
 Landroid/app/IAlarmManager$Stub;->TRANSACTION_set:I
-Landroid/app/IAlarmManager;->getNextAlarmClock(I)Landroid/app/AlarmManager$AlarmClockInfo;
-Landroid/app/IAlarmManager;->set(Ljava/lang/String;IJJJILandroid/app/PendingIntent;Landroid/app/IAlarmListener;Ljava/lang/String;Landroid/os/WorkSource;Landroid/app/AlarmManager$AlarmClockInfo;)V
-Landroid/app/IAlarmManager;->setTime(J)Z
-Landroid/app/IApplicationThread;->scheduleBindService(Landroid/os/IBinder;Landroid/content/Intent;ZI)V
-Landroid/app/IApplicationThread;->scheduleCreateService(Landroid/os/IBinder;Landroid/content/pm/ServiceInfo;Landroid/content/res/CompatibilityInfo;I)V
-Landroid/app/IApplicationThread;->scheduleStopService(Landroid/os/IBinder;)V
-Landroid/app/IApplicationThread;->scheduleTrimMemory(I)V
-Landroid/app/IApplicationThread;->scheduleUnbindService(Landroid/os/IBinder;Landroid/content/Intent;)V
-Landroid/app/IAppTask;->getTaskInfo()Landroid/app/ActivityManager$RecentTaskInfo;
 Landroid/app/IAssistDataReceiver$Stub;-><init>()V
-Landroid/app/IAssistDataReceiver;->onHandleAssistData(Landroid/os/Bundle;)V
-Landroid/app/IAssistDataReceiver;->onHandleAssistScreenshot(Landroid/graphics/Bitmap;)V
 Landroid/app/IInstrumentationWatcher$Stub;-><init>()V
-Landroid/app/IInstrumentationWatcher;->instrumentationStatus(Landroid/content/ComponentName;ILandroid/os/Bundle;)V
 Landroid/app/INotificationManager$Stub$Proxy;-><init>(Landroid/os/IBinder;)V
 Landroid/app/INotificationManager$Stub$Proxy;->areNotificationsEnabledForPackage(Ljava/lang/String;I)Z
 Landroid/app/INotificationManager$Stub;->asInterface(Landroid/os/IBinder;)Landroid/app/INotificationManager;
 Landroid/app/INotificationManager$Stub;->TRANSACTION_enqueueNotificationWithTag:I
-Landroid/app/INotificationManager;->areNotificationsEnabledForPackage(Ljava/lang/String;I)Z
-Landroid/app/INotificationManager;->cancelAllNotifications(Ljava/lang/String;I)V
-Landroid/app/INotificationManager;->cancelNotificationWithTag(Ljava/lang/String;Ljava/lang/String;II)V
-Landroid/app/INotificationManager;->cancelToast(Ljava/lang/String;Landroid/app/ITransientNotification;)V
-Landroid/app/INotificationManager;->enqueueToast(Ljava/lang/String;Landroid/app/ITransientNotification;II)V
-Landroid/app/INotificationManager;->getActiveNotifications(Ljava/lang/String;)[Landroid/service/notification/StatusBarNotification;
-Landroid/app/INotificationManager;->getHistoricalNotifications(Ljava/lang/String;I)[Landroid/service/notification/StatusBarNotification;
-Landroid/app/INotificationManager;->getZenMode()I
-Landroid/app/INotificationManager;->getZenModeConfig()Landroid/service/notification/ZenModeConfig;
 Landroid/app/IProcessObserver$Stub;-><init>()V
 Landroid/app/ISearchManager$Stub$Proxy;->getGlobalSearchActivity()Landroid/content/ComponentName;
 Landroid/app/ISearchManager$Stub$Proxy;->getWebSearchActivity()Landroid/content/ComponentName;
 Landroid/app/ISearchManager$Stub;->asInterface(Landroid/os/IBinder;)Landroid/app/ISearchManager;
-Landroid/app/ISearchManager;->getGlobalSearchActivity()Landroid/content/ComponentName;
 Landroid/app/IServiceConnection$Stub$Proxy;-><init>(Landroid/os/IBinder;)V
 Landroid/app/IServiceConnection$Stub$Proxy;->mRemote:Landroid/os/IBinder;
 Landroid/app/IServiceConnection$Stub;-><init>()V
 Landroid/app/IServiceConnection$Stub;->asInterface(Landroid/os/IBinder;)Landroid/app/IServiceConnection;
-Landroid/app/IServiceConnection;->connected(Landroid/content/ComponentName;Landroid/os/IBinder;Z)V
 Landroid/app/IStopUserCallback$Stub$Proxy;-><init>(Landroid/os/IBinder;)V
 Landroid/app/IStopUserCallback$Stub$Proxy;->mRemote:Landroid/os/IBinder;
 Landroid/app/IStopUserCallback$Stub;-><init>()V
-Landroid/app/IStopUserCallback;->userStopped(I)V
 Landroid/app/ITransientNotification$Stub;-><init>()V
-Landroid/app/ITransientNotification;->show(Landroid/os/IBinder;)V
 Landroid/app/IUiModeManager$Stub$Proxy;-><init>(Landroid/os/IBinder;)V
 Landroid/app/IUserSwitchObserver$Stub;-><init>()V
 Landroid/app/IWallpaperManager$Stub;->asInterface(Landroid/os/IBinder;)Landroid/app/IWallpaperManager;
-Landroid/app/IWallpaperManager;->getHeightHint(I)I
-Landroid/app/IWallpaperManager;->getWallpaper(Ljava/lang/String;Landroid/app/IWallpaperManagerCallback;ILandroid/os/Bundle;I)Landroid/os/ParcelFileDescriptor;
-Landroid/app/IWallpaperManager;->getWallpaperInfo(I)Landroid/app/WallpaperInfo;
-Landroid/app/IWallpaperManager;->getWidthHint(I)I
-Landroid/app/IWallpaperManager;->hasNamedWallpaper(Ljava/lang/String;)Z
-Landroid/app/IWallpaperManager;->setWallpaperComponent(Landroid/content/ComponentName;)V
 Landroid/app/IWallpaperManagerCallback$Stub;-><init>()V
 Landroid/app/job/IJobCallback$Stub$Proxy;-><init>(Landroid/os/IBinder;)V
 Landroid/app/job/IJobCallback$Stub$Proxy;->mRemote:Landroid/os/IBinder;
 Landroid/app/job/IJobCallback$Stub;-><init>()V
 Landroid/app/job/IJobCallback$Stub;->asInterface(Landroid/os/IBinder;)Landroid/app/job/IJobCallback;
-Landroid/app/job/IJobCallback;->acknowledgeStartMessage(IZ)V
-Landroid/app/job/IJobCallback;->acknowledgeStopMessage(IZ)V
-Landroid/app/job/IJobCallback;->completeWork(II)Z
-Landroid/app/job/IJobCallback;->dequeueWork(I)Landroid/app/job/JobWorkItem;
-Landroid/app/job/IJobCallback;->jobFinished(IZ)V
 Landroid/app/job/IJobScheduler$Stub$Proxy;-><init>(Landroid/os/IBinder;)V
 Landroid/app/job/IJobScheduler$Stub;->asInterface(Landroid/os/IBinder;)Landroid/app/job/IJobScheduler;
 Landroid/app/job/IJobService$Stub$Proxy;-><init>(Landroid/os/IBinder;)V
 Landroid/app/job/IJobService$Stub$Proxy;->mRemote:Landroid/os/IBinder;
 Landroid/app/job/IJobService$Stub;-><init>()V
 Landroid/app/job/IJobService$Stub;->asInterface(Landroid/os/IBinder;)Landroid/app/job/IJobService;
-Landroid/app/job/IJobService;->startJob(Landroid/app/job/JobParameters;)V
-Landroid/app/job/IJobService;->stopJob(Landroid/app/job/JobParameters;)V
 Landroid/app/PackageDeleteObserver;-><init>()V
 Landroid/app/PackageInstallObserver;-><init>()V
-Landroid/app/ReceiverRestrictedContext;-><init>(Landroid/content/Context;)V
 Landroid/app/ResourcesManager$ActivityResources;-><init>()V
 Landroid/app/ResourcesManager;-><init>()V
 Landroid/app/TaskStackListener;-><init>()V
 Landroid/app/trust/ITrustManager$Stub$Proxy;-><init>(Landroid/os/IBinder;)V
 Landroid/app/UiAutomationConnection;-><init>()V
 Landroid/app/usage/IUsageStatsManager$Stub;->asInterface(Landroid/os/IBinder;)Landroid/app/usage/IUsageStatsManager;
-Landroid/app/usage/IUsageStatsManager;->isAppInactive(Ljava/lang/String;I)Z
-Landroid/app/usage/IUsageStatsManager;->queryConfigurationStats(IJJLjava/lang/String;)Landroid/content/pm/ParceledListSlice;
-Landroid/app/usage/IUsageStatsManager;->queryUsageStats(IJJLjava/lang/String;)Landroid/content/pm/ParceledListSlice;
-Landroid/app/usage/IUsageStatsManager;->setAppInactive(Ljava/lang/String;ZI)V
 Landroid/app/UserSwitchObserver;-><init>()V
 Landroid/bluetooth/IBluetooth$Stub$Proxy;->getAddress()Ljava/lang/String;
 Landroid/bluetooth/IBluetooth$Stub$Proxy;->getConnectionState(Landroid/bluetooth/BluetoothDevice;)I
@@ -284,22 +124,14 @@
 Landroid/companion/ICompanionDeviceDiscoveryServiceCallback;->onDeviceSelected(Ljava/lang/String;ILjava/lang/String;)V
 Landroid/companion/ICompanionDeviceDiscoveryServiceCallback;->onDeviceSelectionCancel()V
 Landroid/companion/IFindDeviceCallback;->onSuccess(Landroid/app/PendingIntent;)V
-Landroid/content/ContentProviderProxy;->mRemote:Landroid/os/IBinder;
 Landroid/content/IClipboard$Stub$Proxy;-><init>(Landroid/os/IBinder;)V
 Landroid/content/IClipboard$Stub;->asInterface(Landroid/os/IBinder;)Landroid/content/IClipboard;
 Landroid/content/IContentService$Stub$Proxy;-><init>(Landroid/os/IBinder;)V
 Landroid/content/IContentService$Stub;-><init>()V
 Landroid/content/IContentService$Stub;->asInterface(Landroid/os/IBinder;)Landroid/content/IContentService;
-Landroid/content/IContentService;->cancelSync(Landroid/accounts/Account;Ljava/lang/String;Landroid/content/ComponentName;)V
-Landroid/content/IContentService;->getIsSyncable(Landroid/accounts/Account;Ljava/lang/String;)I
-Landroid/content/IContentService;->getMasterSyncAutomatically()Z
-Landroid/content/IContentService;->getSyncAdapterTypes()[Landroid/content/SyncAdapterType;
-Landroid/content/IContentService;->isSyncActive(Landroid/accounts/Account;Ljava/lang/String;Landroid/content/ComponentName;)Z
-Landroid/content/IContentService;->setMasterSyncAutomatically(Z)V
 Landroid/content/IIntentReceiver$Stub$Proxy;-><init>(Landroid/os/IBinder;)V
 Landroid/content/IIntentReceiver$Stub$Proxy;->mRemote:Landroid/os/IBinder;
 Landroid/content/IIntentReceiver$Stub;-><init>()V
-Landroid/content/IIntentReceiver;->performReceive(Landroid/content/Intent;ILjava/lang/String;Landroid/os/Bundle;ZZI)V
 Landroid/content/IOnPrimaryClipChangedListener$Stub;-><init>()V
 Landroid/content/IOnPrimaryClipChangedListener$Stub;->asInterface(Landroid/os/IBinder;)Landroid/content/IOnPrimaryClipChangedListener;
 Landroid/content/IRestrictionsManager$Stub;->asInterface(Landroid/os/IBinder;)Landroid/content/IRestrictionsManager;
@@ -307,29 +139,20 @@
 Landroid/content/ISyncAdapter$Stub$Proxy;->mRemote:Landroid/os/IBinder;
 Landroid/content/ISyncAdapter$Stub;-><init>()V
 Landroid/content/ISyncAdapter$Stub;->asInterface(Landroid/os/IBinder;)Landroid/content/ISyncAdapter;
-Landroid/content/ISyncAdapter;->cancelSync(Landroid/content/ISyncContext;)V
-Landroid/content/ISyncAdapter;->onUnsyncableAccount(Landroid/content/ISyncAdapterUnsyncableAccountCallback;)V
-Landroid/content/ISyncAdapter;->startSync(Landroid/content/ISyncContext;Ljava/lang/String;Landroid/accounts/Account;Landroid/os/Bundle;)V
 Landroid/content/ISyncContext$Stub$Proxy;-><init>(Landroid/os/IBinder;)V
 Landroid/content/ISyncContext$Stub$Proxy;->mRemote:Landroid/os/IBinder;
 Landroid/content/ISyncContext$Stub;-><init>()V
 Landroid/content/ISyncContext$Stub;->asInterface(Landroid/os/IBinder;)Landroid/content/ISyncContext;
 Landroid/content/ISyncServiceAdapter$Stub;->asInterface(Landroid/os/IBinder;)Landroid/content/ISyncServiceAdapter;
-Landroid/content/ISyncServiceAdapter;->cancelSync(Landroid/content/ISyncContext;)V
-Landroid/content/ISyncServiceAdapter;->startSync(Landroid/content/ISyncContext;Landroid/os/Bundle;)V
 Landroid/content/ISyncStatusObserver$Stub$Proxy;-><init>(Landroid/os/IBinder;)V
 Landroid/content/ISyncStatusObserver$Stub$Proxy;->mRemote:Landroid/os/IBinder;
 Landroid/content/ISyncStatusObserver$Stub;-><init>()V
 Landroid/content/ISyncStatusObserver$Stub;->asInterface(Landroid/os/IBinder;)Landroid/content/ISyncStatusObserver;
-Landroid/content/ISyncStatusObserver;->onStatusChanged(I)V
 Landroid/content/om/IOverlayManager$Stub;->asInterface(Landroid/os/IBinder;)Landroid/content/om/IOverlayManager;
-Landroid/content/om/IOverlayManager;->getAllOverlays(I)Ljava/util/Map;
-Landroid/content/om/IOverlayManager;->getOverlayInfo(Ljava/lang/String;I)Landroid/content/om/OverlayInfo;
 Landroid/content/pm/IPackageDataObserver$Stub$Proxy;-><init>(Landroid/os/IBinder;)V
 Landroid/content/pm/IPackageDataObserver$Stub$Proxy;->mRemote:Landroid/os/IBinder;
 Landroid/content/pm/IPackageDataObserver$Stub;-><init>()V
 Landroid/content/pm/IPackageDataObserver$Stub;->asInterface(Landroid/os/IBinder;)Landroid/content/pm/IPackageDataObserver;
-Landroid/content/pm/IPackageDataObserver;->onRemoveCompleted(Ljava/lang/String;Z)V
 Landroid/content/pm/IPackageDeleteObserver$Stub$Proxy;-><init>(Landroid/os/IBinder;)V
 Landroid/content/pm/IPackageDeleteObserver$Stub;-><init>()V
 Landroid/content/pm/IPackageDeleteObserver$Stub;->asInterface(Landroid/os/IBinder;)Landroid/content/pm/IPackageDeleteObserver;
@@ -337,17 +160,9 @@
 Landroid/content/pm/IPackageDeleteObserver2$Stub$Proxy;->mRemote:Landroid/os/IBinder;
 Landroid/content/pm/IPackageDeleteObserver2$Stub;-><init>()V
 Landroid/content/pm/IPackageDeleteObserver2$Stub;->asInterface(Landroid/os/IBinder;)Landroid/content/pm/IPackageDeleteObserver2;
-Landroid/content/pm/IPackageDeleteObserver2;->onPackageDeleted(Ljava/lang/String;ILjava/lang/String;)V
-Landroid/content/pm/IPackageDeleteObserver;->packageDeleted(Ljava/lang/String;I)V
-Landroid/content/pm/IPackageInstaller;->uninstall(Landroid/content/pm/VersionedPackage;Ljava/lang/String;ILandroid/content/IntentSender;I)V
 Landroid/content/pm/IPackageInstallerCallback$Stub$Proxy;-><init>(Landroid/os/IBinder;)V
 Landroid/content/pm/IPackageInstallerCallback$Stub$Proxy;->mRemote:Landroid/os/IBinder;
 Landroid/content/pm/IPackageInstallerCallback$Stub;->asInterface(Landroid/os/IBinder;)Landroid/content/pm/IPackageInstallerCallback;
-Landroid/content/pm/IPackageInstallerCallback;->onSessionActiveChanged(IZ)V
-Landroid/content/pm/IPackageInstallerCallback;->onSessionBadgingChanged(I)V
-Landroid/content/pm/IPackageInstallerCallback;->onSessionCreated(I)V
-Landroid/content/pm/IPackageInstallerCallback;->onSessionFinished(IZ)V
-Landroid/content/pm/IPackageInstallerCallback;->onSessionProgressChanged(IF)V
 Landroid/content/pm/IPackageInstallerSession$Stub$Proxy;-><init>(Landroid/os/IBinder;)V
 Landroid/content/pm/IPackageInstallerSession$Stub$Proxy;->mRemote:Landroid/os/IBinder;
 Landroid/content/pm/IPackageInstallerSession$Stub;-><init>()V
@@ -356,8 +171,6 @@
 Landroid/content/pm/IPackageInstallObserver2$Stub$Proxy;->mRemote:Landroid/os/IBinder;
 Landroid/content/pm/IPackageInstallObserver2$Stub;-><init>()V
 Landroid/content/pm/IPackageInstallObserver2$Stub;->asInterface(Landroid/os/IBinder;)Landroid/content/pm/IPackageInstallObserver2;
-Landroid/content/pm/IPackageInstallObserver2;->onPackageInstalled(Ljava/lang/String;ILjava/lang/String;Landroid/os/Bundle;)V
-Landroid/content/pm/IPackageInstallObserver2;->onUserActionRequired(Landroid/content/Intent;)V
 Landroid/content/pm/IPackageManager$Stub$Proxy;-><init>(Landroid/os/IBinder;)V
 Landroid/content/pm/IPackageManager$Stub$Proxy;->checkUidPermission(Ljava/lang/String;I)I
 Landroid/content/pm/IPackageManager$Stub$Proxy;->getAppOpPermissionPackages(Ljava/lang/String;)[Ljava/lang/String;
@@ -369,75 +182,17 @@
 Landroid/content/pm/IPackageManager$Stub$Proxy;->getSystemSharedLibraryNames()[Ljava/lang/String;
 Landroid/content/pm/IPackageManager$Stub;->asInterface(Landroid/os/IBinder;)Landroid/content/pm/IPackageManager;
 Landroid/content/pm/IPackageManager$Stub;->TRANSACTION_getApplicationInfo:I
-Landroid/content/pm/IPackageManager;->addPermission(Landroid/content/pm/PermissionInfo;)Z
-Landroid/content/pm/IPackageManager;->addPermissionAsync(Landroid/content/pm/PermissionInfo;)Z
-Landroid/content/pm/IPackageManager;->canonicalToCurrentPackageNames([Ljava/lang/String;)[Ljava/lang/String;
-Landroid/content/pm/IPackageManager;->checkPermission(Ljava/lang/String;Ljava/lang/String;I)I
-Landroid/content/pm/IPackageManager;->checkSignatures(Ljava/lang/String;Ljava/lang/String;)I
-Landroid/content/pm/IPackageManager;->checkUidSignatures(II)I
-Landroid/content/pm/IPackageManager;->clearPackagePreferredActivities(Ljava/lang/String;)V
-Landroid/content/pm/IPackageManager;->currentToCanonicalPackageNames([Ljava/lang/String;)[Ljava/lang/String;
-Landroid/content/pm/IPackageManager;->deleteApplicationCacheFiles(Ljava/lang/String;Landroid/content/pm/IPackageDataObserver;)V
-Landroid/content/pm/IPackageManager;->getActivityInfo(Landroid/content/ComponentName;II)Landroid/content/pm/ActivityInfo;
-Landroid/content/pm/IPackageManager;->getApplicationEnabledSetting(Ljava/lang/String;I)I
-Landroid/content/pm/IPackageManager;->getApplicationInfo(Ljava/lang/String;II)Landroid/content/pm/ApplicationInfo;
-Landroid/content/pm/IPackageManager;->getAppOpPermissionPackages(Ljava/lang/String;)[Ljava/lang/String;
-Landroid/content/pm/IPackageManager;->getBlockUninstallForUser(Ljava/lang/String;I)Z
-Landroid/content/pm/IPackageManager;->getComponentEnabledSetting(Landroid/content/ComponentName;I)I
-Landroid/content/pm/IPackageManager;->getFlagsForUid(I)I
-Landroid/content/pm/IPackageManager;->getHomeActivities(Ljava/util/List;)Landroid/content/ComponentName;
-Landroid/content/pm/IPackageManager;->getInstalledApplications(II)Landroid/content/pm/ParceledListSlice;
-Landroid/content/pm/IPackageManager;->getInstalledPackages(II)Landroid/content/pm/ParceledListSlice;
-Landroid/content/pm/IPackageManager;->getInstallerPackageName(Ljava/lang/String;)Ljava/lang/String;
-Landroid/content/pm/IPackageManager;->getInstallLocation()I
-Landroid/content/pm/IPackageManager;->getInstrumentationInfo(Landroid/content/ComponentName;I)Landroid/content/pm/InstrumentationInfo;
-Landroid/content/pm/IPackageManager;->getLastChosenActivity(Landroid/content/Intent;Ljava/lang/String;I)Landroid/content/pm/ResolveInfo;
-Landroid/content/pm/IPackageManager;->getNameForUid(I)Ljava/lang/String;
-Landroid/content/pm/IPackageManager;->getPackageInfo(Ljava/lang/String;II)Landroid/content/pm/PackageInfo;
-Landroid/content/pm/IPackageManager;->getPackageInstaller()Landroid/content/pm/IPackageInstaller;
-Landroid/content/pm/IPackageManager;->getPackagesForUid(I)[Ljava/lang/String;
-Landroid/content/pm/IPackageManager;->getPackageUid(Ljava/lang/String;II)I
-Landroid/content/pm/IPackageManager;->getPermissionControllerPackageName()Ljava/lang/String;
-Landroid/content/pm/IPackageManager;->getPermissionGroupInfo(Ljava/lang/String;I)Landroid/content/pm/PermissionGroupInfo;
-Landroid/content/pm/IPackageManager;->getPreferredActivities(Ljava/util/List;Ljava/util/List;Ljava/lang/String;)I
-Landroid/content/pm/IPackageManager;->getProviderInfo(Landroid/content/ComponentName;II)Landroid/content/pm/ProviderInfo;
-Landroid/content/pm/IPackageManager;->getReceiverInfo(Landroid/content/ComponentName;II)Landroid/content/pm/ActivityInfo;
-Landroid/content/pm/IPackageManager;->getServiceInfo(Landroid/content/ComponentName;II)Landroid/content/pm/ServiceInfo;
-Landroid/content/pm/IPackageManager;->getServicesSystemSharedLibraryPackageName()Ljava/lang/String;
-Landroid/content/pm/IPackageManager;->getSharedSystemSharedLibraryPackageName()Ljava/lang/String;
-Landroid/content/pm/IPackageManager;->getSystemSharedLibraryNames()[Ljava/lang/String;
-Landroid/content/pm/IPackageManager;->getUidForSharedUser(Ljava/lang/String;)I
-Landroid/content/pm/IPackageManager;->grantRuntimePermission(Ljava/lang/String;Ljava/lang/String;I)V
-Landroid/content/pm/IPackageManager;->hasSystemUidErrors()Z
-Landroid/content/pm/IPackageManager;->isPackageAvailable(Ljava/lang/String;I)Z
-Landroid/content/pm/IPackageManager;->isSafeMode()Z
-Landroid/content/pm/IPackageManager;->isStorageLow()Z
-Landroid/content/pm/IPackageManager;->isUidPrivileged(I)Z
-Landroid/content/pm/IPackageManager;->queryInstrumentation(Ljava/lang/String;I)Landroid/content/pm/ParceledListSlice;
-Landroid/content/pm/IPackageManager;->queryIntentActivities(Landroid/content/Intent;Ljava/lang/String;II)Landroid/content/pm/ParceledListSlice;
-Landroid/content/pm/IPackageManager;->querySyncProviders(Ljava/util/List;Ljava/util/List;)V
-Landroid/content/pm/IPackageManager;->removePermission(Ljava/lang/String;)V
-Landroid/content/pm/IPackageManager;->replacePreferredActivity(Landroid/content/IntentFilter;I[Landroid/content/ComponentName;Landroid/content/ComponentName;I)V
-Landroid/content/pm/IPackageManager;->resolveIntent(Landroid/content/Intent;Ljava/lang/String;II)Landroid/content/pm/ResolveInfo;
-Landroid/content/pm/IPackageManager;->setApplicationEnabledSetting(Ljava/lang/String;IIILjava/lang/String;)V
-Landroid/content/pm/IPackageManager;->setApplicationHiddenSettingAsUser(Ljava/lang/String;ZI)Z
-Landroid/content/pm/IPackageManager;->setComponentEnabledSetting(Landroid/content/ComponentName;III)V
-Landroid/content/pm/IPackageManager;->setInstallerPackageName(Ljava/lang/String;Ljava/lang/String;)V
-Landroid/content/pm/IPackageManager;->setLastChosenActivity(Landroid/content/Intent;Ljava/lang/String;ILandroid/content/IntentFilter;ILandroid/content/ComponentName;)V
-Landroid/content/pm/IPackageManager;->setPackageStoppedState(Ljava/lang/String;ZI)V
 Landroid/content/pm/IPackageMoveObserver$Stub;-><init>()V
 Landroid/content/pm/IPackageMoveObserver$Stub;->asInterface(Landroid/os/IBinder;)Landroid/content/pm/IPackageMoveObserver;
 Landroid/content/pm/IPackageStatsObserver$Stub$Proxy;-><init>(Landroid/os/IBinder;)V
 Landroid/content/pm/IPackageStatsObserver$Stub$Proxy;->mRemote:Landroid/os/IBinder;
 Landroid/content/pm/IPackageStatsObserver$Stub;-><init>()V
 Landroid/content/pm/IPackageStatsObserver$Stub;->asInterface(Landroid/os/IBinder;)Landroid/content/pm/IPackageStatsObserver;
-Landroid/content/pm/IPackageStatsObserver;->onGetStatsCompleted(Landroid/content/pm/PackageStats;Z)V
 Landroid/content/pm/IShortcutService$Stub$Proxy;-><init>(Landroid/os/IBinder;)V
 Landroid/content/pm/IShortcutService$Stub;->asInterface(Landroid/os/IBinder;)Landroid/content/pm/IShortcutService;
 Landroid/content/res/ConfigurationBoundResourceCache;-><init>()V
 Landroid/content/res/DrawableCache;-><init>()V
 Landroid/content/UndoManager;-><init>()V
-Landroid/database/BulkCursorProxy;->mRemote:Landroid/os/IBinder;
 Landroid/database/IContentObserver$Stub;-><init>()V
 Landroid/database/IContentObserver$Stub;->asInterface(Landroid/os/IBinder;)Landroid/database/IContentObserver;
 Landroid/database/IContentObserver;->onChange(ZLandroid/net/Uri;I)V
@@ -446,16 +201,13 @@
 Landroid/filterfw/GraphEnvironment;->addReferences([Ljava/lang/Object;)V
 Landroid/hardware/camera2/utils/HashCodeHelpers;->hashCode([I)I
 Landroid/hardware/display/IDisplayManager$Stub;->asInterface(Landroid/os/IBinder;)Landroid/hardware/display/IDisplayManager;
-Landroid/hardware/display/IDisplayManager;->getDisplayInfo(I)Landroid/view/DisplayInfo;
 Landroid/hardware/fingerprint/IFingerprintService$Stub$Proxy;-><init>(Landroid/os/IBinder;)V
 Landroid/hardware/fingerprint/IFingerprintService$Stub;->asInterface(Landroid/os/IBinder;)Landroid/hardware/fingerprint/IFingerprintService;
 Landroid/hardware/ICameraService$Stub;->asInterface(Landroid/os/IBinder;)Landroid/hardware/ICameraService;
 Landroid/hardware/input/IInputManager$Stub$Proxy;-><init>(Landroid/os/IBinder;)V
 Landroid/hardware/input/IInputManager$Stub;->asInterface(Landroid/os/IBinder;)Landroid/hardware/input/IInputManager;
 Landroid/hardware/input/IInputManager$Stub;->TRANSACTION_injectInputEvent:I
-Landroid/hardware/input/IInputManager;->injectInputEvent(Landroid/view/InputEvent;I)Z
 Landroid/hardware/location/IActivityRecognitionHardwareClient$Stub;-><init>()V
-Landroid/hardware/location/IActivityRecognitionHardwareClient;->onAvailabilityChanged(ZLandroid/hardware/location/IActivityRecognitionHardware;)V
 Landroid/hardware/location/IContextHubService$Stub;->asInterface(Landroid/os/IBinder;)Landroid/hardware/location/IContextHubService;
 Landroid/hardware/usb/IUsbManager$Stub$Proxy;-><init>(Landroid/os/IBinder;)V
 Landroid/hardware/usb/IUsbManager$Stub;->asInterface(Landroid/os/IBinder;)Landroid/hardware/usb/IUsbManager;
@@ -465,60 +217,33 @@
 Landroid/location/ICountryListener$Stub;-><init>()V
 Landroid/location/IGeocodeProvider$Stub;-><init>()V
 Landroid/location/IGeocodeProvider$Stub;->asInterface(Landroid/os/IBinder;)Landroid/location/IGeocodeProvider;
-Landroid/location/IGeocodeProvider;->getFromLocation(DDILandroid/location/GeocoderParams;Ljava/util/List;)Ljava/lang/String;
-Landroid/location/IGeocodeProvider;->getFromLocationName(Ljava/lang/String;DDDDILandroid/location/GeocoderParams;Ljava/util/List;)Ljava/lang/String;
 Landroid/location/IGeofenceProvider$Stub;-><init>()V
-Landroid/location/IGeofenceProvider;->setGeofenceHardware(Landroid/hardware/location/IGeofenceHardware;)V
 Landroid/location/ILocationListener$Stub$Proxy;-><init>(Landroid/os/IBinder;)V
 Landroid/location/ILocationListener$Stub$Proxy;->mRemote:Landroid/os/IBinder;
 Landroid/location/ILocationListener$Stub;-><init>()V
 Landroid/location/ILocationListener$Stub;->asInterface(Landroid/os/IBinder;)Landroid/location/ILocationListener;
-Landroid/location/ILocationListener;->onLocationChanged(Landroid/location/Location;)V
-Landroid/location/ILocationListener;->onProviderDisabled(Ljava/lang/String;)V
-Landroid/location/ILocationListener;->onProviderEnabled(Ljava/lang/String;)V
-Landroid/location/ILocationListener;->onStatusChanged(Ljava/lang/String;ILandroid/os/Bundle;)V
 Landroid/location/ILocationManager$Stub$Proxy;-><init>(Landroid/os/IBinder;)V
 Landroid/location/ILocationManager$Stub;->asInterface(Landroid/os/IBinder;)Landroid/location/ILocationManager;
 Landroid/location/ILocationManager$Stub;->TRANSACTION_getAllProviders:I
-Landroid/location/ILocationManager;->getAllProviders()Ljava/util/List;
 Landroid/location/INetInitiatedListener$Stub;-><init>()V
-Landroid/location/INetInitiatedListener;->sendNiResponse(II)Z
 Landroid/location/LocationManager$ListenerTransport;-><init>(Landroid/location/LocationManager;Landroid/location/LocationListener;Landroid/os/Looper;)V
 Landroid/Manifest$permission;->CAPTURE_SECURE_VIDEO_OUTPUT:Ljava/lang/String;
 Landroid/Manifest$permission;->CAPTURE_VIDEO_OUTPUT:Ljava/lang/String;
 Landroid/Manifest$permission;->READ_FRAME_BUFFER:Ljava/lang/String;
 Landroid/media/effect/SingleFilterEffect;-><init>(Landroid/media/effect/EffectContext;Ljava/lang/String;Ljava/lang/Class;Ljava/lang/String;Ljava/lang/String;[Ljava/lang/Object;)V
-Landroid/media/IAudioFocusDispatcher;->dispatchAudioFocusChange(ILjava/lang/String;)V
 Landroid/media/IAudioRoutesObserver$Stub;-><init>()V
 Landroid/media/IAudioService$Stub$Proxy;-><init>(Landroid/os/IBinder;)V
 Landroid/media/IAudioService$Stub;-><init>()V
 Landroid/media/IAudioService$Stub;->asInterface(Landroid/os/IBinder;)Landroid/media/IAudioService;
-Landroid/media/IAudioService;->getStreamMaxVolume(I)I
-Landroid/media/IAudioService;->getStreamVolume(I)I
-Landroid/media/IAudioService;->setStreamVolume(IIILjava/lang/String;)V
-Landroid/media/IAudioService;->startWatchingRoutes(Landroid/media/IAudioRoutesObserver;)Landroid/media/AudioRoutesInfo;
 Landroid/media/IMediaRouterService$Stub;->asInterface(Landroid/os/IBinder;)Landroid/media/IMediaRouterService;
 Landroid/media/IMediaScannerListener$Stub;-><init>()V
 Landroid/media/IMediaScannerService$Stub;->asInterface(Landroid/os/IBinder;)Landroid/media/IMediaScannerService;
-Landroid/media/IMediaScannerService;->requestScanFile(Ljava/lang/String;Ljava/lang/String;Landroid/media/IMediaScannerListener;)V
-Landroid/media/IMediaScannerService;->scanFile(Ljava/lang/String;Ljava/lang/String;)V
-Landroid/media/IRemoteDisplayCallback;->onStateChanged(Landroid/media/RemoteDisplayState;)V
 Landroid/media/IRingtonePlayer;->play(Landroid/os/IBinder;Landroid/net/Uri;Landroid/media/AudioAttributes;FZ)V
 Landroid/media/IVolumeController$Stub;->asInterface(Landroid/os/IBinder;)Landroid/media/IVolumeController;
 Landroid/media/MediaFile;-><init>()V
 Landroid/media/MediaScanner$MyMediaScannerClient;-><init>(Landroid/media/MediaScanner;)V
-Landroid/media/projection/IMediaProjectionManager;->hasProjectionPermission(ILjava/lang/String;)Z
 Landroid/media/session/ISessionManager$Stub;->asInterface(Landroid/os/IBinder;)Landroid/media/session/ISessionManager;
 Landroid/media/tv/ITvRemoteProvider$Stub;-><init>()V
-Landroid/media/tv/ITvRemoteServiceInput;->clearInputBridge(Landroid/os/IBinder;)V
-Landroid/media/tv/ITvRemoteServiceInput;->closeInputBridge(Landroid/os/IBinder;)V
-Landroid/media/tv/ITvRemoteServiceInput;->openInputBridge(Landroid/os/IBinder;Ljava/lang/String;III)V
-Landroid/media/tv/ITvRemoteServiceInput;->sendKeyDown(Landroid/os/IBinder;I)V
-Landroid/media/tv/ITvRemoteServiceInput;->sendKeyUp(Landroid/os/IBinder;I)V
-Landroid/media/tv/ITvRemoteServiceInput;->sendPointerDown(Landroid/os/IBinder;III)V
-Landroid/media/tv/ITvRemoteServiceInput;->sendPointerSync(Landroid/os/IBinder;)V
-Landroid/media/tv/ITvRemoteServiceInput;->sendPointerUp(Landroid/os/IBinder;I)V
-Landroid/media/tv/ITvRemoteServiceInput;->sendTimestamp(Landroid/os/IBinder;J)V
 Landroid/net/ConnectivityManager$PacketKeepaliveCallback;-><init>()V
 Landroid/net/IConnectivityManager$Stub$Proxy;-><init>(Landroid/os/IBinder;)V
 Landroid/net/IConnectivityManager$Stub$Proxy;->getActiveLinkProperties()Landroid/net/LinkProperties;
@@ -530,41 +255,13 @@
 Landroid/net/IConnectivityManager$Stub$Proxy;->getTetheredIfaces()[Ljava/lang/String;
 Landroid/net/IConnectivityManager$Stub$Proxy;->mRemote:Landroid/os/IBinder;
 Landroid/net/IConnectivityManager$Stub;->asInterface(Landroid/os/IBinder;)Landroid/net/IConnectivityManager;
-Landroid/net/IConnectivityManager;->getActiveLinkProperties()Landroid/net/LinkProperties;
-Landroid/net/IConnectivityManager;->getActiveNetworkInfo()Landroid/net/NetworkInfo;
-Landroid/net/IConnectivityManager;->getAllNetworkInfo()[Landroid/net/NetworkInfo;
-Landroid/net/IConnectivityManager;->getAllNetworkState()[Landroid/net/NetworkState;
-Landroid/net/IConnectivityManager;->getLastTetherError(Ljava/lang/String;)I
-Landroid/net/IConnectivityManager;->getTetherableIfaces()[Ljava/lang/String;
-Landroid/net/IConnectivityManager;->getTetherableUsbRegexs()[Ljava/lang/String;
-Landroid/net/IConnectivityManager;->getTetherableWifiRegexs()[Ljava/lang/String;
-Landroid/net/IConnectivityManager;->getTetheredIfaces()[Ljava/lang/String;
-Landroid/net/IConnectivityManager;->getTetheringErroredIfaces()[Ljava/lang/String;
-Landroid/net/IConnectivityManager;->startLegacyVpn(Lcom/android/internal/net/VpnProfile;)V
 Landroid/net/INetworkManagementEventObserver$Stub;-><init>()V
 Landroid/net/INetworkPolicyListener$Stub;-><init>()V
 Landroid/net/INetworkPolicyManager$Stub;->asInterface(Landroid/os/IBinder;)Landroid/net/INetworkPolicyManager;
-Landroid/net/INetworkPolicyManager;->getNetworkQuotaInfo(Landroid/net/NetworkState;)Landroid/net/NetworkQuotaInfo;
-Landroid/net/INetworkPolicyManager;->getRestrictBackground()Z
-Landroid/net/INetworkPolicyManager;->getUidPolicy(I)I
-Landroid/net/INetworkPolicyManager;->setNetworkPolicies([Landroid/net/NetworkPolicy;)V
-Landroid/net/INetworkPolicyManager;->setRestrictBackground(Z)V
-Landroid/net/INetworkPolicyManager;->setUidPolicy(II)V
-Landroid/net/INetworkPolicyManager;->snoozeLimit(Landroid/net/NetworkTemplate;)V
 Landroid/net/INetworkScoreService$Stub;->asInterface(Landroid/os/IBinder;)Landroid/net/INetworkScoreService;
 Landroid/net/INetworkStatsService$Stub$Proxy;-><init>(Landroid/os/IBinder;)V
 Landroid/net/INetworkStatsService$Stub$Proxy;->getMobileIfaces()[Ljava/lang/String;
 Landroid/net/INetworkStatsService$Stub;->asInterface(Landroid/os/IBinder;)Landroid/net/INetworkStatsService;
-Landroid/net/INetworkStatsService;->forceUpdate()V
-Landroid/net/INetworkStatsService;->getDataLayerSnapshotForUid(I)Landroid/net/NetworkStats;
-Landroid/net/INetworkStatsService;->getMobileIfaces()[Ljava/lang/String;
-Landroid/net/INetworkStatsService;->openSession()Landroid/net/INetworkStatsSession;
-Landroid/net/INetworkStatsService;->openSessionForUsageStats(ILjava/lang/String;)Landroid/net/INetworkStatsSession;
-Landroid/net/INetworkStatsSession;->close()V
-Landroid/net/INetworkStatsSession;->getHistoryForNetwork(Landroid/net/NetworkTemplate;I)Landroid/net/NetworkStatsHistory;
-Landroid/net/INetworkStatsSession;->getHistoryForUid(Landroid/net/NetworkTemplate;IIII)Landroid/net/NetworkStatsHistory;
-Landroid/net/INetworkStatsSession;->getSummaryForAllUid(Landroid/net/NetworkTemplate;JJZ)Landroid/net/NetworkStats;
-Landroid/net/INetworkStatsSession;->getSummaryForNetwork(Landroid/net/NetworkTemplate;JJ)Landroid/net/NetworkStats;
 Landroid/net/InterfaceConfiguration;-><init>()V
 Landroid/net/LinkProperties$ProvisioningChange;->values()[Landroid/net/LinkProperties$ProvisioningChange;
 Landroid/net/MobileLinkQualityInfo;-><init>()V
@@ -575,22 +272,12 @@
 Landroid/net/wifi/IWifiManager$Stub$Proxy;-><init>(Landroid/os/IBinder;)V
 Landroid/net/wifi/IWifiManager$Stub;->asInterface(Landroid/os/IBinder;)Landroid/net/wifi/IWifiManager;
 Landroid/net/wifi/IWifiManager$Stub;->TRANSACTION_getScanResults:I
-Landroid/net/wifi/IWifiManager;->getCurrentNetwork()Landroid/net/Network;
-Landroid/net/wifi/IWifiManager;->getWifiApConfiguration()Landroid/net/wifi/WifiConfiguration;
-Landroid/net/wifi/IWifiManager;->getWifiApEnabledState()I
 Landroid/net/wifi/IWifiScanner$Stub$Proxy;-><init>(Landroid/os/IBinder;)V
 Landroid/net/wifi/IWifiScanner$Stub$Proxy;->mRemote:Landroid/os/IBinder;
 Landroid/net/wifi/IWifiScanner$Stub;-><init>()V
 Landroid/net/wifi/IWifiScanner$Stub;->asInterface(Landroid/os/IBinder;)Landroid/net/wifi/IWifiScanner;
 Landroid/net/wifi/p2p/IWifiP2pManager$Stub;->asInterface(Landroid/os/IBinder;)Landroid/net/wifi/p2p/IWifiP2pManager;
 Landroid/nfc/INfcAdapter$Stub;->TRANSACTION_enable:I
-Landroid/nfc/INfcAdapterExtras;->authenticate(Ljava/lang/String;[B)V
-Landroid/nfc/INfcAdapterExtras;->close(Ljava/lang/String;Landroid/os/IBinder;)Landroid/os/Bundle;
-Landroid/nfc/INfcAdapterExtras;->getCardEmulationRoute(Ljava/lang/String;)I
-Landroid/nfc/INfcAdapterExtras;->getDriverName(Ljava/lang/String;)Ljava/lang/String;
-Landroid/nfc/INfcAdapterExtras;->open(Ljava/lang/String;Landroid/os/IBinder;)Landroid/os/Bundle;
-Landroid/nfc/INfcAdapterExtras;->setCardEmulationRoute(Ljava/lang/String;I)V
-Landroid/nfc/INfcAdapterExtras;->transceive(Ljava/lang/String;[B)Landroid/os/Bundle;
 Landroid/os/AsyncResult;-><init>(Ljava/lang/Object;Ljava/lang/Object;Ljava/lang/Throwable;)V
 Landroid/os/AsyncResult;->exception:Ljava/lang/Throwable;
 Landroid/os/AsyncResult;->forMessage(Landroid/os/Message;)Landroid/os/AsyncResult;
@@ -1360,9 +1047,7 @@
 Landroid/R$styleable;->Window:[I
 Landroid/R$styleable;->Window_windowBackground:I
 Landroid/R$styleable;->Window_windowFrame:I
-Landroid/security/Credentials;->convertToPem([Ljava/security/cert/Certificate;)[B
 Landroid/security/IKeyChainService$Stub;->asInterface(Landroid/os/IBinder;)Landroid/security/IKeyChainService;
-Landroid/security/IKeyChainService;->requestPrivateKey(Ljava/lang/String;)Ljava/lang/String;
 Landroid/security/keymaster/KeymasterBlobArgument;-><init>(ILandroid/os/Parcel;)V
 Landroid/security/keymaster/KeymasterBlobArgument;-><init>(I[B)V
 Landroid/security/keymaster/KeymasterBlobArgument;->blob:[B
@@ -1391,29 +1076,12 @@
 Landroid/service/dreams/IDreamManager;->getDreamComponents()[Landroid/content/ComponentName;
 Landroid/service/dreams/IDreamManager;->isDreaming()Z
 Landroid/service/dreams/IDreamManager;->setDreamComponents([Landroid/content/ComponentName;)V
-Landroid/service/euicc/IDeleteSubscriptionCallback;->onComplete(I)V
-Landroid/service/euicc/IEraseSubscriptionsCallback;->onComplete(I)V
 Landroid/service/euicc/IEuiccService$Stub;-><init>()V
-Landroid/service/euicc/IGetDefaultDownloadableSubscriptionListCallback;->onComplete(Landroid/service/euicc/GetDefaultDownloadableSubscriptionListResult;)V
-Landroid/service/euicc/IGetDownloadableSubscriptionMetadataCallback;->onComplete(Landroid/service/euicc/GetDownloadableSubscriptionMetadataResult;)V
-Landroid/service/euicc/IGetEidCallback;->onSuccess(Ljava/lang/String;)V
-Landroid/service/euicc/IGetEuiccInfoCallback;->onSuccess(Landroid/telephony/euicc/EuiccInfo;)V
-Landroid/service/euicc/IGetEuiccProfileInfoListCallback;->onComplete(Landroid/service/euicc/GetEuiccProfileInfoListResult;)V
-Landroid/service/euicc/IRetainSubscriptionsForFactoryResetCallback;->onComplete(I)V
-Landroid/service/euicc/ISwitchToSubscriptionCallback;->onComplete(I)V
-Landroid/service/euicc/IUpdateSubscriptionNicknameCallback;->onComplete(I)V
 Landroid/service/notification/INotificationListener$Stub;-><init>()V
 Landroid/service/persistentdata/IPersistentDataBlockService$Stub;->asInterface(Landroid/os/IBinder;)Landroid/service/persistentdata/IPersistentDataBlockService;
 Landroid/service/vr/IVrManager$Stub;->asInterface(Landroid/os/IBinder;)Landroid/service/vr/IVrManager;
-Landroid/service/vr/IVrManager;->getVr2dDisplayId()I
-Landroid/service/vr/IVrManager;->getVrModeState()Z
 Landroid/service/wallpaper/IWallpaperConnection$Stub;-><init>()V
-Landroid/service/wallpaper/IWallpaperEngine;->destroy()V
-Landroid/service/wallpaper/IWallpaperEngine;->dispatchPointer(Landroid/view/MotionEvent;)V
-Landroid/service/wallpaper/IWallpaperEngine;->dispatchWallpaperCommand(Ljava/lang/String;IIILandroid/os/Bundle;)V
-Landroid/service/wallpaper/IWallpaperEngine;->setVisibility(Z)V
 Landroid/service/wallpaper/IWallpaperService$Stub;->asInterface(Landroid/os/IBinder;)Landroid/service/wallpaper/IWallpaperService;
-Landroid/speech/IRecognitionListener;->onEvent(ILandroid/os/Bundle;)V
 Landroid/telecom/Log;->i(Ljava/lang/String;Ljava/lang/String;[Ljava/lang/Object;)V
 Landroid/telecom/Log;->w(Ljava/lang/String;Ljava/lang/String;[Ljava/lang/Object;)V
 Landroid/telephony/ims/compat/feature/MMTelFeature;-><init>()V
@@ -1424,10 +1092,6 @@
 Landroid/telephony/mbms/IMbmsStreamingSessionCallback$Stub;-><init>()V
 Landroid/telephony/mbms/IStreamingServiceCallback$Stub;-><init>()V
 Landroid/telephony/mbms/vendor/IMbmsStreamingService$Stub;->asInterface(Landroid/os/IBinder;)Landroid/telephony/mbms/vendor/IMbmsStreamingService;
-Landroid/telephony/mbms/vendor/IMbmsStreamingService;->getPlaybackUri(ILjava/lang/String;)Landroid/net/Uri;
-Landroid/telephony/mbms/vendor/IMbmsStreamingService;->initialize(Landroid/telephony/mbms/IMbmsStreamingSessionCallback;I)I
-Landroid/telephony/mbms/vendor/IMbmsStreamingService;->requestUpdateStreamingServices(ILjava/util/List;)I
-Landroid/telephony/mbms/vendor/IMbmsStreamingService;->startStreaming(ILjava/lang/String;Landroid/telephony/mbms/IStreamingServiceCallback;)I
 Landroid/telephony/SmsCbCmasInfo;->getCategory()I
 Landroid/telephony/SmsCbCmasInfo;->getCertainty()I
 Landroid/telephony/SmsCbCmasInfo;->getMessageClass()I
@@ -1453,9 +1117,6 @@
 Landroid/telephony/SmsCbMessage;->isCmasMessage()Z
 Landroid/telephony/SmsCbMessage;->isEmergencyMessage()Z
 Landroid/telephony/TelephonyManager$MultiSimVariants;->values()[Landroid/telephony/TelephonyManager$MultiSimVariants;
-Landroid/test/AndroidTestCase;->getTestContext()Landroid/content/Context;
-Landroid/test/AndroidTestCase;->setTestContext(Landroid/content/Context;)V
-Landroid/test/InstrumentationTestCase;->runMethod(Ljava/lang/reflect/Method;I)V
 Landroid/util/Singleton;-><init>()V
 Landroid/util/XmlPullAttributes;-><init>(Lorg/xmlpull/v1/XmlPullParser;)V
 Landroid/util/XmlPullAttributes;->mParser:Lorg/xmlpull/v1/XmlPullParser;
@@ -1470,17 +1131,8 @@
 Landroid/view/autofill/IAutoFillManager$Stub;->asInterface(Landroid/os/IBinder;)Landroid/view/autofill/IAutoFillManager;
 Landroid/view/IAppTransitionAnimationSpecsFuture$Stub;-><init>()V
 Landroid/view/IDockedStackListener$Stub;-><init>()V
-Landroid/view/IRecentsAnimationController;->finish(Z)V
-Landroid/view/IRecentsAnimationController;->screenshotTask(I)Landroid/app/ActivityManager$TaskSnapshot;
-Landroid/view/IRecentsAnimationController;->setAnimationTargetsBehindSystemBars(Z)V
-Landroid/view/IRecentsAnimationController;->setInputConsumerEnabled(Z)V
 Landroid/view/IRecentsAnimationRunner$Stub;-><init>()V
-Landroid/view/IRecentsAnimationRunner;->onAnimationCanceled()V
-Landroid/view/IRecentsAnimationRunner;->onAnimationStart(Landroid/view/IRecentsAnimationController;[Landroid/view/RemoteAnimationTarget;Landroid/graphics/Rect;Landroid/graphics/Rect;)V
-Landroid/view/IRemoteAnimationFinishedCallback;->onAnimationFinished()V
 Landroid/view/IRemoteAnimationRunner$Stub;-><init>()V
-Landroid/view/IRemoteAnimationRunner;->onAnimationCancelled()V
-Landroid/view/IRemoteAnimationRunner;->onAnimationStart([Landroid/view/RemoteAnimationTarget;Landroid/view/IRemoteAnimationFinishedCallback;)V
 Landroid/view/IRotationWatcher$Stub;-><init>()V
 Landroid/view/IWindow$Stub;-><init>()V
 Landroid/view/IWindow$Stub;->asInterface(Landroid/os/IBinder;)Landroid/view/IWindow;
@@ -1492,44 +1144,7 @@
 Landroid/view/IWindowManager$Stub$Proxy;->watchRotation(Landroid/view/IRotationWatcher;I)I
 Landroid/view/IWindowManager$Stub;-><init>()V
 Landroid/view/IWindowManager$Stub;->asInterface(Landroid/os/IBinder;)Landroid/view/IWindowManager;
-Landroid/view/IWindowManager;->createInputConsumer(Landroid/os/IBinder;Ljava/lang/String;ILandroid/view/InputChannel;)V
-Landroid/view/IWindowManager;->destroyInputConsumer(Ljava/lang/String;I)Z
-Landroid/view/IWindowManager;->endProlongedAnimations()V
-Landroid/view/IWindowManager;->executeAppTransition()V
-Landroid/view/IWindowManager;->freezeRotation(I)V
-Landroid/view/IWindowManager;->getAnimationScale(I)F
-Landroid/view/IWindowManager;->getAnimationScales()[F
-Landroid/view/IWindowManager;->getBaseDisplaySize(ILandroid/graphics/Point;)V
-Landroid/view/IWindowManager;->getDockedStackSide()I
-Landroid/view/IWindowManager;->getInitialDisplayDensity(I)I
-Landroid/view/IWindowManager;->getInitialDisplaySize(ILandroid/graphics/Point;)V
-Landroid/view/IWindowManager;->getStableInsets(ILandroid/graphics/Rect;)V
-Landroid/view/IWindowManager;->hasNavigationBar(I)Z
-Landroid/view/IWindowManager;->isKeyguardLocked()Z
-Landroid/view/IWindowManager;->isKeyguardSecure()Z
-Landroid/view/IWindowManager;->isSafeModeEnabled()Z
-Landroid/view/IWindowManager;->lockNow(Landroid/os/Bundle;)V
-Landroid/view/IWindowManager;->overridePendingAppTransitionMultiThumbFuture(Landroid/view/IAppTransitionAnimationSpecsFuture;Landroid/os/IRemoteCallback;ZI)V
-Landroid/view/IWindowManager;->overridePendingAppTransitionRemote(Landroid/view/RemoteAnimationAdapter;I)V
-Landroid/view/IWindowManager;->registerDockedStackListener(Landroid/view/IDockedStackListener;)V
-Landroid/view/IWindowManager;->removeRotationWatcher(Landroid/view/IRotationWatcher;)V
-Landroid/view/IWindowManager;->setAnimationScale(IF)V
-Landroid/view/IWindowManager;->setAnimationScales([F)V
-Landroid/view/IWindowManager;->setNavBarVirtualKeyHapticFeedbackEnabled(Z)V
-Landroid/view/IWindowManager;->setShelfHeight(ZI)V
-Landroid/view/IWindowManager;->setStrictModeVisualIndicatorPreference(Ljava/lang/String;)V
-Landroid/view/IWindowManager;->thawRotation()V
 Landroid/view/IWindowSession$Stub;->asInterface(Landroid/os/IBinder;)Landroid/view/IWindowSession;
-Landroid/view/IWindowSession;->finishDrawing(Landroid/view/IWindow;)V
-Landroid/view/IWindowSession;->getInTouchMode()Z
-Landroid/view/IWindowSession;->performDrag(Landroid/view/IWindow;ILandroid/view/SurfaceControl;IFFFFLandroid/content/ClipData;)Landroid/os/IBinder;
-Landroid/view/IWindowSession;->performHapticFeedback(IZ)Z
-Landroid/view/IWindowSession;->remove(Landroid/view/IWindow;)V
-Landroid/view/IWindowSession;->setInTouchMode(Z)V
-Landroid/view/IWindowSession;->setTransparentRegion(Landroid/view/IWindow;Landroid/graphics/Region;)V
-Landroid/view/IWindowSession;->wallpaperCommandComplete(Landroid/os/IBinder;Landroid/os/Bundle;)V
-Landroid/view/IWindowSession;->wallpaperOffsetsComplete(Landroid/os/IBinder;)V
-Landroid/view/RenderNodeAnimator;->setDuration(J)Landroid/view/RenderNodeAnimator;
 Landroid/view/View$AttachInfo$InvalidateInfo;-><init>()V
 Landroid/view/View$CheckForLongPress;-><init>(Landroid/view/View;)V
 Landroid/view/View$ListenerInfo;-><init>()V
@@ -1538,9 +1153,6 @@
 Landroid/webkit/IWebViewUpdateService$Stub$Proxy;-><init>(Landroid/os/IBinder;)V
 Landroid/webkit/IWebViewUpdateService$Stub$Proxy;->waitForAndGetProvider()Landroid/webkit/WebViewProviderResponse;
 Landroid/webkit/IWebViewUpdateService$Stub;->asInterface(Landroid/os/IBinder;)Landroid/webkit/IWebViewUpdateService;
-Landroid/webkit/IWebViewUpdateService;->getCurrentWebViewPackageName()Ljava/lang/String;
-Landroid/webkit/IWebViewUpdateService;->getValidWebViewPackages()[Landroid/webkit/WebViewProviderInfo;
-Landroid/webkit/IWebViewUpdateService;->isFallbackPackage(Ljava/lang/String;)Z
 Landroid/widget/DigitalClock$FormatChangeObserver;-><init>(Landroid/widget/DigitalClock;)V
 Landroid/widget/QuickContactBadge$QueryHandler;-><init>(Landroid/widget/QuickContactBadge;Landroid/content/ContentResolver;)V
 Landroid/widget/RelativeLayout$DependencyGraph$Node;-><init>()V
@@ -1550,7 +1162,6 @@
 Lcom/android/ims/ImsCall;->reject(I)V
 Lcom/android/ims/ImsCall;->terminate(I)V
 Lcom/android/ims/ImsConfigListener$Stub;-><init>()V
-Lcom/android/ims/ImsConfigListener;->onSetFeatureResponse(IIII)V
 Lcom/android/ims/ImsEcbm;->exitEmergencyCallbackMode()V
 Lcom/android/ims/ImsManager;->getConfigInterface()Lcom/android/ims/ImsConfig;
 Lcom/android/ims/ImsManager;->getInstance(Landroid/content/Context;I)Lcom/android/ims/ImsManager;
@@ -1560,104 +1171,17 @@
 Lcom/android/ims/ImsUtInterface;->queryCallForward(ILjava/lang/String;Landroid/os/Message;)V
 Lcom/android/ims/internal/IImsCallSession$Stub;-><init>()V
 Lcom/android/ims/internal/IImsCallSession$Stub;->asInterface(Landroid/os/IBinder;)Lcom/android/ims/internal/IImsCallSession;
-Lcom/android/ims/internal/IImsCallSessionListener;->callSessionConferenceStateUpdated(Lcom/android/ims/internal/IImsCallSession;Landroid/telephony/ims/ImsConferenceState;)V
-Lcom/android/ims/internal/IImsCallSessionListener;->callSessionHandover(Lcom/android/ims/internal/IImsCallSession;IILandroid/telephony/ims/ImsReasonInfo;)V
-Lcom/android/ims/internal/IImsCallSessionListener;->callSessionHandoverFailed(Lcom/android/ims/internal/IImsCallSession;IILandroid/telephony/ims/ImsReasonInfo;)V
-Lcom/android/ims/internal/IImsCallSessionListener;->callSessionHeld(Lcom/android/ims/internal/IImsCallSession;Landroid/telephony/ims/ImsCallProfile;)V
-Lcom/android/ims/internal/IImsCallSessionListener;->callSessionHoldFailed(Lcom/android/ims/internal/IImsCallSession;Landroid/telephony/ims/ImsReasonInfo;)V
-Lcom/android/ims/internal/IImsCallSessionListener;->callSessionHoldReceived(Lcom/android/ims/internal/IImsCallSession;Landroid/telephony/ims/ImsCallProfile;)V
-Lcom/android/ims/internal/IImsCallSessionListener;->callSessionInviteParticipantsRequestDelivered(Lcom/android/ims/internal/IImsCallSession;)V
-Lcom/android/ims/internal/IImsCallSessionListener;->callSessionInviteParticipantsRequestFailed(Lcom/android/ims/internal/IImsCallSession;Landroid/telephony/ims/ImsReasonInfo;)V
-Lcom/android/ims/internal/IImsCallSessionListener;->callSessionMergeComplete(Lcom/android/ims/internal/IImsCallSession;)V
-Lcom/android/ims/internal/IImsCallSessionListener;->callSessionMergeFailed(Lcom/android/ims/internal/IImsCallSession;Landroid/telephony/ims/ImsReasonInfo;)V
-Lcom/android/ims/internal/IImsCallSessionListener;->callSessionMergeStarted(Lcom/android/ims/internal/IImsCallSession;Lcom/android/ims/internal/IImsCallSession;Landroid/telephony/ims/ImsCallProfile;)V
-Lcom/android/ims/internal/IImsCallSessionListener;->callSessionMultipartyStateChanged(Lcom/android/ims/internal/IImsCallSession;Z)V
-Lcom/android/ims/internal/IImsCallSessionListener;->callSessionProgressing(Lcom/android/ims/internal/IImsCallSession;Landroid/telephony/ims/ImsStreamMediaProfile;)V
-Lcom/android/ims/internal/IImsCallSessionListener;->callSessionResumed(Lcom/android/ims/internal/IImsCallSession;Landroid/telephony/ims/ImsCallProfile;)V
-Lcom/android/ims/internal/IImsCallSessionListener;->callSessionResumeFailed(Lcom/android/ims/internal/IImsCallSession;Landroid/telephony/ims/ImsReasonInfo;)V
-Lcom/android/ims/internal/IImsCallSessionListener;->callSessionResumeReceived(Lcom/android/ims/internal/IImsCallSession;Landroid/telephony/ims/ImsCallProfile;)V
-Lcom/android/ims/internal/IImsCallSessionListener;->callSessionStarted(Lcom/android/ims/internal/IImsCallSession;Landroid/telephony/ims/ImsCallProfile;)V
-Lcom/android/ims/internal/IImsCallSessionListener;->callSessionStartFailed(Lcom/android/ims/internal/IImsCallSession;Landroid/telephony/ims/ImsReasonInfo;)V
-Lcom/android/ims/internal/IImsCallSessionListener;->callSessionSuppServiceReceived(Lcom/android/ims/internal/IImsCallSession;Landroid/telephony/ims/ImsSuppServiceNotification;)V
-Lcom/android/ims/internal/IImsCallSessionListener;->callSessionTerminated(Lcom/android/ims/internal/IImsCallSession;Landroid/telephony/ims/ImsReasonInfo;)V
-Lcom/android/ims/internal/IImsCallSessionListener;->callSessionTtyModeReceived(Lcom/android/ims/internal/IImsCallSession;I)V
-Lcom/android/ims/internal/IImsCallSessionListener;->callSessionUpdated(Lcom/android/ims/internal/IImsCallSession;Landroid/telephony/ims/ImsCallProfile;)V
 Lcom/android/ims/internal/IImsConfig$Stub;-><init>()V
 Lcom/android/ims/internal/IImsEcbm$Stub;-><init>()V
-Lcom/android/ims/internal/IImsRegistrationListener;->registrationAssociatedUriChanged([Landroid/net/Uri;)V
-Lcom/android/ims/internal/IImsRegistrationListener;->registrationChangeFailed(ILandroid/telephony/ims/ImsReasonInfo;)V
-Lcom/android/ims/internal/IImsRegistrationListener;->registrationConnected()V
-Lcom/android/ims/internal/IImsRegistrationListener;->registrationConnectedWithRadioTech(I)V
-Lcom/android/ims/internal/IImsRegistrationListener;->registrationDisconnected(Landroid/telephony/ims/ImsReasonInfo;)V
-Lcom/android/ims/internal/IImsRegistrationListener;->registrationFeatureCapabilityChanged(I[I[I)V
-Lcom/android/ims/internal/IImsRegistrationListener;->registrationProgressingWithRadioTech(I)V
-Lcom/android/ims/internal/IImsRegistrationListener;->voiceMessageCountUpdate(I)V
 Lcom/android/ims/internal/IImsService$Stub;-><init>()V
 Lcom/android/ims/internal/IImsService$Stub;->asInterface(Landroid/os/IBinder;)Lcom/android/ims/internal/IImsService;
 Lcom/android/ims/internal/IImsUt$Stub;-><init>()V
-Lcom/android/ims/internal/IImsUtListener;->utConfigurationCallBarringQueried(Lcom/android/ims/internal/IImsUt;I[Landroid/telephony/ims/ImsSsInfo;)V
-Lcom/android/ims/internal/IImsUtListener;->utConfigurationCallForwardQueried(Lcom/android/ims/internal/IImsUt;I[Landroid/telephony/ims/ImsCallForwardInfo;)V
-Lcom/android/ims/internal/IImsUtListener;->utConfigurationCallWaitingQueried(Lcom/android/ims/internal/IImsUt;I[Landroid/telephony/ims/ImsSsInfo;)V
-Lcom/android/ims/internal/IImsUtListener;->utConfigurationQueried(Lcom/android/ims/internal/IImsUt;ILandroid/os/Bundle;)V
-Lcom/android/ims/internal/IImsUtListener;->utConfigurationQueryFailed(Lcom/android/ims/internal/IImsUt;ILandroid/telephony/ims/ImsReasonInfo;)V
-Lcom/android/ims/internal/IImsUtListener;->utConfigurationUpdated(Lcom/android/ims/internal/IImsUt;I)V
-Lcom/android/ims/internal/IImsUtListener;->utConfigurationUpdateFailed(Lcom/android/ims/internal/IImsUt;ILandroid/telephony/ims/ImsReasonInfo;)V
-Lcom/android/ims/internal/IImsVideoCallCallback;->changeCallDataUsage(J)V
-Lcom/android/ims/internal/IImsVideoCallCallback;->changeCameraCapabilities(Landroid/telecom/VideoProfile$CameraCapabilities;)V
-Lcom/android/ims/internal/IImsVideoCallCallback;->changePeerDimensions(II)V
-Lcom/android/ims/internal/IImsVideoCallCallback;->changeVideoQuality(I)V
-Lcom/android/ims/internal/IImsVideoCallCallback;->handleCallSessionEvent(I)V
-Lcom/android/ims/internal/IImsVideoCallCallback;->receiveSessionModifyRequest(Landroid/telecom/VideoProfile;)V
-Lcom/android/ims/internal/IImsVideoCallCallback;->receiveSessionModifyResponse(ILandroid/telecom/VideoProfile;Landroid/telecom/VideoProfile;)V
 Lcom/android/ims/internal/IImsVideoCallProvider$Stub;-><init>()V
-Lcom/android/ims/internal/IImsVideoCallProvider;->setCallback(Lcom/android/ims/internal/IImsVideoCallCallback;)V
 Lcom/android/ims/internal/ImsVideoCallProviderWrapper;-><init>(Lcom/android/ims/internal/IImsVideoCallProvider;)V
-Lcom/android/ims/internal/uce/options/IOptionsListener;->cmdStatus(Lcom/android/ims/internal/uce/options/OptionsCmdStatus;)V
-Lcom/android/ims/internal/uce/options/IOptionsListener;->getVersionCb(Ljava/lang/String;)V
-Lcom/android/ims/internal/uce/options/IOptionsListener;->incomingOptions(Ljava/lang/String;Lcom/android/ims/internal/uce/options/OptionsCapInfo;I)V
-Lcom/android/ims/internal/uce/options/IOptionsListener;->serviceAvailable(Lcom/android/ims/internal/uce/common/StatusCode;)V
-Lcom/android/ims/internal/uce/options/IOptionsListener;->serviceUnavailable(Lcom/android/ims/internal/uce/common/StatusCode;)V
-Lcom/android/ims/internal/uce/options/IOptionsListener;->sipResponseReceived(Ljava/lang/String;Lcom/android/ims/internal/uce/options/OptionsSipResponse;Lcom/android/ims/internal/uce/options/OptionsCapInfo;)V
 Lcom/android/ims/internal/uce/options/IOptionsService$Stub;-><init>()V
-Lcom/android/ims/internal/uce/options/IOptionsService;->addListener(ILcom/android/ims/internal/uce/options/IOptionsListener;Lcom/android/ims/internal/uce/common/UceLong;)Lcom/android/ims/internal/uce/common/StatusCode;
-Lcom/android/ims/internal/uce/options/IOptionsService;->getContactCap(ILjava/lang/String;I)Lcom/android/ims/internal/uce/common/StatusCode;
-Lcom/android/ims/internal/uce/options/IOptionsService;->getContactListCap(I[Ljava/lang/String;I)Lcom/android/ims/internal/uce/common/StatusCode;
-Lcom/android/ims/internal/uce/options/IOptionsService;->getMyInfo(II)Lcom/android/ims/internal/uce/common/StatusCode;
-Lcom/android/ims/internal/uce/options/IOptionsService;->getVersion(I)Lcom/android/ims/internal/uce/common/StatusCode;
-Lcom/android/ims/internal/uce/options/IOptionsService;->removeListener(ILcom/android/ims/internal/uce/common/UceLong;)Lcom/android/ims/internal/uce/common/StatusCode;
-Lcom/android/ims/internal/uce/options/IOptionsService;->responseIncomingOptions(IIILjava/lang/String;Lcom/android/ims/internal/uce/options/OptionsCapInfo;Z)Lcom/android/ims/internal/uce/common/StatusCode;
-Lcom/android/ims/internal/uce/options/IOptionsService;->setMyInfo(ILcom/android/ims/internal/uce/common/CapInfo;I)Lcom/android/ims/internal/uce/common/StatusCode;
-Lcom/android/ims/internal/uce/presence/IPresenceListener;->capInfoReceived(Ljava/lang/String;[Lcom/android/ims/internal/uce/presence/PresTupleInfo;)V
-Lcom/android/ims/internal/uce/presence/IPresenceListener;->cmdStatus(Lcom/android/ims/internal/uce/presence/PresCmdStatus;)V
-Lcom/android/ims/internal/uce/presence/IPresenceListener;->getVersionCb(Ljava/lang/String;)V
-Lcom/android/ims/internal/uce/presence/IPresenceListener;->listCapInfoReceived(Lcom/android/ims/internal/uce/presence/PresRlmiInfo;[Lcom/android/ims/internal/uce/presence/PresResInfo;)V
-Lcom/android/ims/internal/uce/presence/IPresenceListener;->publishTriggering(Lcom/android/ims/internal/uce/presence/PresPublishTriggerType;)V
-Lcom/android/ims/internal/uce/presence/IPresenceListener;->serviceAvailable(Lcom/android/ims/internal/uce/common/StatusCode;)V
-Lcom/android/ims/internal/uce/presence/IPresenceListener;->serviceUnAvailable(Lcom/android/ims/internal/uce/common/StatusCode;)V
-Lcom/android/ims/internal/uce/presence/IPresenceListener;->sipResponseReceived(Lcom/android/ims/internal/uce/presence/PresSipResponse;)V
-Lcom/android/ims/internal/uce/presence/IPresenceListener;->unpublishMessageSent()V
 Lcom/android/ims/internal/uce/presence/IPresenceService$Stub;-><init>()V
-Lcom/android/ims/internal/uce/presence/IPresenceService;->addListener(ILcom/android/ims/internal/uce/presence/IPresenceListener;Lcom/android/ims/internal/uce/common/UceLong;)Lcom/android/ims/internal/uce/common/StatusCode;
-Lcom/android/ims/internal/uce/presence/IPresenceService;->getContactCap(ILjava/lang/String;I)Lcom/android/ims/internal/uce/common/StatusCode;
-Lcom/android/ims/internal/uce/presence/IPresenceService;->getContactListCap(I[Ljava/lang/String;I)Lcom/android/ims/internal/uce/common/StatusCode;
-Lcom/android/ims/internal/uce/presence/IPresenceService;->getVersion(I)Lcom/android/ims/internal/uce/common/StatusCode;
-Lcom/android/ims/internal/uce/presence/IPresenceService;->publishMyCap(ILcom/android/ims/internal/uce/presence/PresCapInfo;I)Lcom/android/ims/internal/uce/common/StatusCode;
-Lcom/android/ims/internal/uce/presence/IPresenceService;->reenableService(II)Lcom/android/ims/internal/uce/common/StatusCode;
-Lcom/android/ims/internal/uce/presence/IPresenceService;->removeListener(ILcom/android/ims/internal/uce/common/UceLong;)Lcom/android/ims/internal/uce/common/StatusCode;
-Lcom/android/ims/internal/uce/presence/IPresenceService;->setNewFeatureTag(ILjava/lang/String;Lcom/android/ims/internal/uce/presence/PresServiceInfo;I)Lcom/android/ims/internal/uce/common/StatusCode;
 Lcom/android/ims/internal/uce/uceservice/IUceListener$Stub;-><init>()V
-Lcom/android/ims/internal/uce/uceservice/IUceListener;->setStatus(I)V
 Lcom/android/ims/internal/uce/uceservice/IUceService$Stub;-><init>()V
-Lcom/android/ims/internal/uce/uceservice/IUceService;->createOptionsService(Lcom/android/ims/internal/uce/options/IOptionsListener;Lcom/android/ims/internal/uce/common/UceLong;)I
-Lcom/android/ims/internal/uce/uceservice/IUceService;->createPresenceService(Lcom/android/ims/internal/uce/presence/IPresenceListener;Lcom/android/ims/internal/uce/common/UceLong;)I
-Lcom/android/ims/internal/uce/uceservice/IUceService;->destroyOptionsService(I)V
-Lcom/android/ims/internal/uce/uceservice/IUceService;->destroyPresenceService(I)V
-Lcom/android/ims/internal/uce/uceservice/IUceService;->getOptionsService()Lcom/android/ims/internal/uce/options/IOptionsService;
-Lcom/android/ims/internal/uce/uceservice/IUceService;->getPresenceService()Lcom/android/ims/internal/uce/presence/IPresenceService;
-Lcom/android/ims/internal/uce/uceservice/IUceService;->getServiceStatus()Z
-Lcom/android/ims/internal/uce/uceservice/IUceService;->isServiceStarted()Z
-Lcom/android/ims/internal/uce/uceservice/IUceService;->startService(Lcom/android/ims/internal/uce/uceservice/IUceListener;)Z
-Lcom/android/ims/internal/uce/uceservice/IUceService;->stopService()Z
 Lcom/android/internal/app/AlertActivity;-><init>()V
 Lcom/android/internal/app/AlertActivity;->mAlert:Lcom/android/internal/app/AlertController;
 Lcom/android/internal/app/AlertActivity;->mAlertParams:Lcom/android/internal/app/AlertController$AlertParams;
@@ -1688,22 +1212,12 @@
 Lcom/android/internal/app/IAppOpsService$Stub;->TRANSACTION_startOperation:I
 Lcom/android/internal/app/IAppOpsService$Stub;->TRANSACTION_startWatchingMode:I
 Lcom/android/internal/app/IAppOpsService$Stub;->TRANSACTION_stopWatchingMode:I
-Lcom/android/internal/app/IAppOpsService;->finishOperation(Landroid/os/IBinder;IILjava/lang/String;)V
-Lcom/android/internal/app/IAppOpsService;->getOpsForPackage(ILjava/lang/String;[I)Ljava/util/List;
-Lcom/android/internal/app/IAppOpsService;->getPackagesForOps([I)Ljava/util/List;
-Lcom/android/internal/app/IAppOpsService;->resetAllModes(ILjava/lang/String;)V
-Lcom/android/internal/app/IAppOpsService;->setMode(IILjava/lang/String;I)V
 Lcom/android/internal/app/IBatteryStats$Stub$Proxy;-><init>(Landroid/os/IBinder;)V
 Lcom/android/internal/app/IBatteryStats$Stub;->asInterface(Landroid/os/IBinder;)Lcom/android/internal/app/IBatteryStats;
-Lcom/android/internal/app/IBatteryStats;->computeChargeTimeRemaining()J
-Lcom/android/internal/app/IBatteryStats;->getAwakeTimeBattery()J
-Lcom/android/internal/app/IBatteryStats;->getStatistics()[B
-Lcom/android/internal/app/IBatteryStats;->isCharging()Z
 Lcom/android/internal/app/IMediaContainerService$Stub;->asInterface(Landroid/os/IBinder;)Lcom/android/internal/app/IMediaContainerService;
 Lcom/android/internal/app/IntentForwarderActivity;->TAG:Ljava/lang/String;
 Lcom/android/internal/app/IVoiceInteractionManagerService$Stub$Proxy;->showSessionFromSession(Landroid/os/IBinder;Landroid/os/Bundle;I)Z
 Lcom/android/internal/app/IVoiceInteractionManagerService$Stub;->asInterface(Landroid/os/IBinder;)Lcom/android/internal/app/IVoiceInteractionManagerService;
-Lcom/android/internal/app/IVoiceInteractionManagerService;->getKeyphraseSoundModel(ILjava/lang/String;)Landroid/hardware/soundtrigger/SoundTrigger$KeyphraseSoundModel;
 Lcom/android/internal/app/LocaleHelper$LocaleInfoComparator;-><init>(Ljava/util/Locale;Z)V
 Lcom/android/internal/app/LocaleHelper$LocaleInfoComparator;->compare(Lcom/android/internal/app/LocaleStore$LocaleInfo;Lcom/android/internal/app/LocaleStore$LocaleInfo;)I
 Lcom/android/internal/app/LocaleHelper;->getDisplayCountry(Ljava/util/Locale;Ljava/util/Locale;)Ljava/lang/String;
@@ -1731,10 +1245,6 @@
 Lcom/android/internal/app/WindowDecorActionBar;->setShowHideAnimationEnabled(Z)V
 Lcom/android/internal/appwidget/IAppWidgetService$Stub;->asInterface(Landroid/os/IBinder;)Lcom/android/internal/appwidget/IAppWidgetService;
 Lcom/android/internal/appwidget/IAppWidgetService$Stub;->TRANSACTION_bindAppWidgetId:I
-Lcom/android/internal/appwidget/IAppWidgetService;->bindAppWidgetId(Ljava/lang/String;IILandroid/content/ComponentName;Landroid/os/Bundle;)Z
-Lcom/android/internal/appwidget/IAppWidgetService;->bindRemoteViewsService(Ljava/lang/String;ILandroid/content/Intent;Landroid/app/IApplicationThread;Landroid/os/IBinder;Landroid/app/IServiceConnection;I)Z
-Lcom/android/internal/appwidget/IAppWidgetService;->getAppWidgetIds(Landroid/content/ComponentName;)[I
-Lcom/android/internal/appwidget/IAppWidgetService;->getAppWidgetViews(Ljava/lang/String;I)Landroid/widget/RemoteViews;
 Lcom/android/internal/backup/IBackupTransport$Stub;-><init>()V
 Lcom/android/internal/content/PackageMonitor;-><init>()V
 Lcom/android/internal/database/SortCursor;-><init>([Landroid/database/Cursor;Ljava/lang/String;)V
@@ -1751,16 +1261,11 @@
 Lcom/android/internal/location/GpsNetInitiatedHandler;->mIsHexInput:Z
 Lcom/android/internal/location/ILocationProvider$Stub;-><init>()V
 Lcom/android/internal/location/ILocationProvider$Stub;->asInterface(Landroid/os/IBinder;)Lcom/android/internal/location/ILocationProvider;
-Lcom/android/internal/location/ILocationProvider;->getStatus(Landroid/os/Bundle;)I
-Lcom/android/internal/location/ILocationProvider;->getStatusUpdateTime()J
 Lcom/android/internal/location/ILocationProvider;->sendExtraCommand(Ljava/lang/String;Landroid/os/Bundle;)V
 Lcom/android/internal/location/ILocationProvider;->setLocationProviderManager(Lcom/android/internal/location/ILocationProviderManager;)V
 Lcom/android/internal/location/ILocationProvider;->setRequest(Lcom/android/internal/location/ProviderRequest;Landroid/os/WorkSource;)V
 Lcom/android/internal/location/ILocationProviderManager$Stub;-><init>()V
 Lcom/android/internal/location/ILocationProviderManager$Stub;->asInterface(Landroid/os/IBinder;)Lcom/android/internal/location/ILocationProviderManager;
-Lcom/android/internal/location/ILocationProviderManager;->onReportLocation(Landroid/location/Location;)V
-Lcom/android/internal/location/ILocationProviderManager;->onSetEnabled(Z)V
-Lcom/android/internal/location/ILocationProviderManager;->onSetProperties(Lcom/android/internal/location/ProviderProperties;)V
 Lcom/android/internal/logging/MetricsLogger;-><init>()V
 Lcom/android/internal/net/LegacyVpnInfo;-><init>()V
 Lcom/android/internal/net/VpnConfig;-><init>()V
@@ -1770,9 +1275,8 @@
 Lcom/android/internal/os/BatterySipper$DrainType;->values()[Lcom/android/internal/os/BatterySipper$DrainType;
 Lcom/android/internal/os/BinderInternal;->getContextObject()Landroid/os/IBinder;
 Lcom/android/internal/os/BinderInternal;->handleGc()V
-Lcom/android/internal/os/ClassLoaderFactory;->createClassloaderNamespace(Ljava/lang/ClassLoader;ILjava/lang/String;Ljava/lang/String;ZZ)Ljava/lang/String;
+Lcom/android/internal/os/ClassLoaderFactory;->createClassloaderNamespace(Ljava/lang/ClassLoader;ILjava/lang/String;Ljava/lang/String;ZLjava/lang/String;)Ljava/lang/String;
 Lcom/android/internal/os/IDropBoxManagerService$Stub;->asInterface(Landroid/os/IBinder;)Lcom/android/internal/os/IDropBoxManagerService;
-Lcom/android/internal/os/IDropBoxManagerService;->getNextEntry(Ljava/lang/String;JLjava/lang/String;)Landroid/os/DropBoxManager$Entry;
 Lcom/android/internal/os/ProcessCpuTracker$Stats;->name:Ljava/lang/String;
 Lcom/android/internal/os/ProcessCpuTracker$Stats;->rel_stime:I
 Lcom/android/internal/os/ProcessCpuTracker$Stats;->rel_uptime:J
@@ -1798,8 +1302,6 @@
 Lcom/android/internal/policy/DecorView;->mLastRightInset:I
 Lcom/android/internal/policy/DecorView;->mWindow:Lcom/android/internal/policy/PhoneWindow;
 Lcom/android/internal/policy/IKeyguardService$Stub;->asInterface(Landroid/os/IBinder;)Lcom/android/internal/policy/IKeyguardService;
-Lcom/android/internal/policy/IKeyguardService;->doKeyguardTimeout(Landroid/os/Bundle;)V
-Lcom/android/internal/policy/IKeyguardService;->setKeyguardEnabled(Z)V
 Lcom/android/internal/policy/IKeyguardStateCallback$Stub;->asInterface(Landroid/os/IBinder;)Lcom/android/internal/policy/IKeyguardStateCallback;
 Lcom/android/internal/policy/PhoneFallbackEventHandler;-><init>(Landroid/content/Context;)V
 Lcom/android/internal/policy/PhoneFallbackEventHandler;->mContext:Landroid/content/Context;
@@ -2253,14 +1755,7 @@
 Lcom/android/internal/statusbar/IStatusBar$Stub;->asInterface(Landroid/os/IBinder;)Lcom/android/internal/statusbar/IStatusBar;
 Lcom/android/internal/statusbar/IStatusBarService$Stub;-><init>()V
 Lcom/android/internal/statusbar/IStatusBarService$Stub;->asInterface(Landroid/os/IBinder;)Lcom/android/internal/statusbar/IStatusBarService;
-Lcom/android/internal/statusbar/IStatusBarService;->collapsePanels()V
-Lcom/android/internal/statusbar/IStatusBarService;->disable(ILandroid/os/IBinder;Ljava/lang/String;)V
-Lcom/android/internal/statusbar/IStatusBarService;->expandNotificationsPanel()V
-Lcom/android/internal/statusbar/IStatusBarService;->handleSystemKey(I)V
-Lcom/android/internal/statusbar/IStatusBarService;->removeIcon(Ljava/lang/String;)V
-Lcom/android/internal/statusbar/IStatusBarService;->setIconVisibility(Ljava/lang/String;Z)V
 Lcom/android/internal/telecom/ITelecomService$Stub;->asInterface(Landroid/os/IBinder;)Lcom/android/internal/telecom/ITelecomService;
-Lcom/android/internal/telecom/ITelecomService;->getCallState()I
 Lcom/android/internal/telephony/BaseCommands;->mCallStateRegistrants:Landroid/os/RegistrantList;
 Lcom/android/internal/telephony/BaseCommands;->mCallWaitingInfoRegistrants:Landroid/os/RegistrantList;
 Lcom/android/internal/telephony/BaseCommands;->mCatCallSetUpRegistrant:Landroid/os/Registrant;
@@ -2887,7 +2382,6 @@
 Lcom/android/internal/telephony/GsmCdmaPhone;->notifyServiceStateChanged(Landroid/telephony/ServiceState;)V
 Lcom/android/internal/telephony/GsmCdmaPhone;->setOnEcbModeExitResponse(Landroid/os/Handler;ILjava/lang/Object;)V
 Lcom/android/internal/telephony/GsmCdmaPhone;->syncClirSetting()V
-Lcom/android/internal/telephony/ICarrierConfigLoader;->getConfigForSubId(ILjava/lang/String;)Landroid/os/PersistableBundle;
 Lcom/android/internal/telephony/IccCard;->getState()Lcom/android/internal/telephony/IccCardConstants$State;
 Lcom/android/internal/telephony/IccCard;->registerForNetworkLocked(Landroid/os/Handler;ILjava/lang/Object;)V
 Lcom/android/internal/telephony/IccCard;->supplyNetworkDepersonalization(Ljava/lang/String;Landroid/os/Message;)V
@@ -3093,8 +2587,6 @@
 Lcom/android/internal/telephony/IPhoneSubInfo$Stub$Proxy;->getDeviceId(Ljava/lang/String;)Ljava/lang/String;
 Lcom/android/internal/telephony/IPhoneSubInfo$Stub;->asInterface(Landroid/os/IBinder;)Lcom/android/internal/telephony/IPhoneSubInfo;
 Lcom/android/internal/telephony/IPhoneSubInfo$Stub;->TRANSACTION_getDeviceId:I
-Lcom/android/internal/telephony/IPhoneSubInfo;->getIccSerialNumber(Ljava/lang/String;)Ljava/lang/String;
-Lcom/android/internal/telephony/IPhoneSubInfo;->getSubscriberId(Ljava/lang/String;)Ljava/lang/String;
 Lcom/android/internal/telephony/ISms$Stub;-><init>()V
 Lcom/android/internal/telephony/ISms$Stub;->asInterface(Landroid/os/IBinder;)Lcom/android/internal/telephony/ISms;
 Lcom/android/internal/telephony/ISub$Stub$Proxy;-><init>(Landroid/os/IBinder;)V
@@ -3108,38 +2600,9 @@
 Lcom/android/internal/telephony/ITelephony$Stub;->TRANSACTION_call:I
 Lcom/android/internal/telephony/ITelephony$Stub;->TRANSACTION_dial:I
 Lcom/android/internal/telephony/ITelephony$Stub;->TRANSACTION_getDeviceId:I
-Lcom/android/internal/telephony/ITelephony;->call(Ljava/lang/String;Ljava/lang/String;)V
-Lcom/android/internal/telephony/ITelephony;->dial(Ljava/lang/String;)V
-Lcom/android/internal/telephony/ITelephony;->disableDataConnectivity()Z
-Lcom/android/internal/telephony/ITelephony;->disableLocationUpdates()V
-Lcom/android/internal/telephony/ITelephony;->enableDataConnectivity()Z
-Lcom/android/internal/telephony/ITelephony;->enableLocationUpdates()V
-Lcom/android/internal/telephony/ITelephony;->getActivePhoneType()I
-Lcom/android/internal/telephony/ITelephony;->getCallState()I
-Lcom/android/internal/telephony/ITelephony;->getDataActivity()I
-Lcom/android/internal/telephony/ITelephony;->getDataEnabled(I)Z
-Lcom/android/internal/telephony/ITelephony;->getDataState()I
-Lcom/android/internal/telephony/ITelephony;->getNetworkType()I
-Lcom/android/internal/telephony/ITelephony;->handlePinMmi(Ljava/lang/String;)Z
-Lcom/android/internal/telephony/ITelephony;->handlePinMmiForSubscriber(ILjava/lang/String;)Z
-Lcom/android/internal/telephony/ITelephony;->hasIccCard()Z
-Lcom/android/internal/telephony/ITelephony;->iccCloseLogicalChannel(II)Z
-Lcom/android/internal/telephony/ITelephony;->iccTransmitApduLogicalChannel(IIIIIIILjava/lang/String;)Ljava/lang/String;
-Lcom/android/internal/telephony/ITelephony;->isRadioOnForSubscriber(ILjava/lang/String;)Z
-Lcom/android/internal/telephony/ITelephony;->setRadio(Z)Z
-Lcom/android/internal/telephony/ITelephony;->supplyPin(Ljava/lang/String;)Z
-Lcom/android/internal/telephony/ITelephony;->toggleRadioOnOff()V
-Lcom/android/internal/telephony/ITelephony;->updateServiceLocation()V
 Lcom/android/internal/telephony/ITelephonyRegistry$Stub$Proxy;-><init>(Landroid/os/IBinder;)V
 Lcom/android/internal/telephony/ITelephonyRegistry$Stub;->asInterface(Landroid/os/IBinder;)Lcom/android/internal/telephony/ITelephonyRegistry;
-Lcom/android/internal/telephony/ITelephonyRegistry;->listen(Ljava/lang/String;Lcom/android/internal/telephony/IPhoneStateListener;IZ)V
-Lcom/android/internal/telephony/ITelephonyRegistry;->notifyCallState(ILjava/lang/String;)V
-Lcom/android/internal/telephony/ITelephonyRegistry;->notifyCellInfo(Ljava/util/List;)V
-Lcom/android/internal/telephony/ITelephonyRegistry;->notifyDataConnectionFailed(Ljava/lang/String;)V
 Lcom/android/internal/telephony/IWapPushManager$Stub;->asInterface(Landroid/os/IBinder;)Lcom/android/internal/telephony/IWapPushManager;
-Lcom/android/internal/telephony/IWapPushManager;->addPackage(Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;IZZ)Z
-Lcom/android/internal/telephony/IWapPushManager;->deletePackage(Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;)Z
-Lcom/android/internal/telephony/IWapPushManager;->updatePackage(Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;IZZ)Z
 Lcom/android/internal/telephony/MccTable$MccEntry;->mIso:Ljava/lang/String;
 Lcom/android/internal/telephony/MccTable;->countryCodeForMcc(I)Ljava/lang/String;
 Lcom/android/internal/telephony/MccTable;->defaultLanguageForMcc(I)Ljava/lang/String;
@@ -3334,7 +2797,6 @@
 Lcom/android/internal/telephony/ServiceStateTracker;->isInvalidOperatorNumeric(Ljava/lang/String;)Z
 Lcom/android/internal/telephony/ServiceStateTracker;->log(Ljava/lang/String;)V
 Lcom/android/internal/telephony/ServiceStateTracker;->loge(Ljava/lang/String;)V
-Lcom/android/internal/telephony/ServiceStateTracker;->mAttachedRegistrants:Landroid/os/RegistrantList;
 Lcom/android/internal/telephony/ServiceStateTracker;->mCi:Lcom/android/internal/telephony/CommandsInterface;
 Lcom/android/internal/telephony/ServiceStateTracker;->mCr:Landroid/content/ContentResolver;
 Lcom/android/internal/telephony/ServiceStateTracker;->mCurDataSpn:Ljava/lang/String;
@@ -3346,7 +2808,6 @@
 Lcom/android/internal/telephony/ServiceStateTracker;->mDataRoamingOnRegistrants:Landroid/os/RegistrantList;
 Lcom/android/internal/telephony/ServiceStateTracker;->mDefaultRoamingIndicator:I
 Lcom/android/internal/telephony/ServiceStateTracker;->mDesiredPowerState:Z
-Lcom/android/internal/telephony/ServiceStateTracker;->mDetachedRegistrants:Landroid/os/RegistrantList;
 Lcom/android/internal/telephony/ServiceStateTracker;->mDeviceShuttingDown:Z
 Lcom/android/internal/telephony/ServiceStateTracker;->mEmergencyOnly:Z
 Lcom/android/internal/telephony/ServiceStateTracker;->mIccRecords:Lcom/android/internal/telephony/uicc/IccRecords;
@@ -3374,7 +2835,6 @@
 Lcom/android/internal/telephony/ServiceStateTracker;->mUiccController:Lcom/android/internal/telephony/uicc/UiccController;
 Lcom/android/internal/telephony/ServiceStateTracker;->mVoiceRoamingOffRegistrants:Landroid/os/RegistrantList;
 Lcom/android/internal/telephony/ServiceStateTracker;->mVoiceRoamingOnRegistrants:Landroid/os/RegistrantList;
-Lcom/android/internal/telephony/ServiceStateTracker;->notifyDataRegStateRilRadioTechnologyChanged()V
 Lcom/android/internal/telephony/ServiceStateTracker;->notifySignalStrength()Z
 Lcom/android/internal/telephony/ServiceStateTracker;->pollState()V
 Lcom/android/internal/telephony/ServiceStateTracker;->reRegisterNetwork(Landroid/os/Message;)V
@@ -3934,23 +3394,7 @@
 Lcom/android/internal/widget/ActionBarOverlayLayout;->setWindowCallback(Landroid/view/Window$Callback;)V
 Lcom/android/internal/widget/EditableInputConnection;-><init>(Landroid/widget/TextView;)V
 Lcom/android/internal/widget/ILockSettings$Stub;->asInterface(Landroid/os/IBinder;)Lcom/android/internal/widget/ILockSettings;
-Lcom/android/internal/widget/ILockSettings;->getBoolean(Ljava/lang/String;ZI)Z
-Lcom/android/internal/widget/ILockSettings;->getLong(Ljava/lang/String;JI)J
-Lcom/android/internal/widget/ILockSettings;->getString(Ljava/lang/String;Ljava/lang/String;I)Ljava/lang/String;
-Lcom/android/internal/widget/ILockSettings;->havePassword(I)Z
-Lcom/android/internal/widget/ILockSettings;->havePattern(I)Z
-Lcom/android/internal/widget/ILockSettings;->setBoolean(Ljava/lang/String;ZI)V
-Lcom/android/internal/widget/ILockSettings;->setLong(Ljava/lang/String;JI)V
-Lcom/android/internal/widget/ILockSettings;->setString(Ljava/lang/String;Ljava/lang/String;I)V
 Lcom/android/internal/widget/IRemoteViewsFactory$Stub;->asInterface(Landroid/os/IBinder;)Lcom/android/internal/widget/IRemoteViewsFactory;
-Lcom/android/internal/widget/IRemoteViewsFactory;->getCount()I
-Lcom/android/internal/widget/IRemoteViewsFactory;->getItemId(I)J
-Lcom/android/internal/widget/IRemoteViewsFactory;->getLoadingView()Landroid/widget/RemoteViews;
-Lcom/android/internal/widget/IRemoteViewsFactory;->getViewAt(I)Landroid/widget/RemoteViews;
-Lcom/android/internal/widget/IRemoteViewsFactory;->getViewTypeCount()I
-Lcom/android/internal/widget/IRemoteViewsFactory;->hasStableIds()Z
-Lcom/android/internal/widget/IRemoteViewsFactory;->isCreated()Z
-Lcom/android/internal/widget/IRemoteViewsFactory;->onDataSetChanged()V
 Lcom/android/internal/widget/LinearLayoutWithDefaultTouchRecepient;-><init>(Landroid/content/Context;)V
 Lcom/android/internal/widget/LinearLayoutWithDefaultTouchRecepient;->setDefaultTouchRecepient(Landroid/view/View;)V
 Lcom/android/internal/widget/LockPatternChecker;->checkPassword(Lcom/android/internal/widget/LockPatternUtils;Ljava/lang/String;ILcom/android/internal/widget/LockPatternChecker$OnCheckCallback;)Landroid/os/AsyncTask;
@@ -4482,9 +3926,6 @@
 Lgov/nist/javax/sip/address/SipUri;->setUserParam(Ljava/lang/String;)V
 Lgov/nist/javax/sip/parser/URLParser;-><init>(Ljava/lang/String;)V
 Lgov/nist/javax/sip/parser/URLParser;->sipURL(Z)Lgov/nist/javax/sip/address/SipUri;
-Ljunit/framework/TestCase;->fName:Ljava/lang/String;
-Ljunit/framework/TestSuite;->isPublicTestMethod(Ljava/lang/reflect/Method;)Z
-Ljunit/framework/TestSuite;->isTestMethod(Ljava/lang/reflect/Method;)Z
 Lorg/apache/xalan/extensions/ExpressionContext;->getContextNode()Lorg/w3c/dom/Node;
 Lorg/apache/xalan/extensions/ExpressionContext;->getErrorListener()Ljavax/xml/transform/ErrorListener;
 Lorg/apache/xalan/extensions/ExpressionContext;->getVariableOrParam(Lorg/apache/xml/utils/QName;)Lorg/apache/xpath/objects/XObject;
diff --git a/core/java/android/accessibilityservice/AccessibilityServiceInfo.java b/core/java/android/accessibilityservice/AccessibilityServiceInfo.java
index e86fa89..cf24b8e 100644
--- a/core/java/android/accessibilityservice/AccessibilityServiceInfo.java
+++ b/core/java/android/accessibilityservice/AccessibilityServiceInfo.java
@@ -1225,7 +1225,7 @@
     /**
      * @see Parcelable.Creator
      */
-    public static final Parcelable.Creator<AccessibilityServiceInfo> CREATOR =
+    public static final @android.annotation.NonNull Parcelable.Creator<AccessibilityServiceInfo> CREATOR =
             new Parcelable.Creator<AccessibilityServiceInfo>() {
         public AccessibilityServiceInfo createFromParcel(Parcel parcel) {
             AccessibilityServiceInfo info = new AccessibilityServiceInfo();
diff --git a/core/java/android/accessibilityservice/GestureDescription.java b/core/java/android/accessibilityservice/GestureDescription.java
index 56f4ae2..a3e7ad5 100644
--- a/core/java/android/accessibilityservice/GestureDescription.java
+++ b/core/java/android/accessibilityservice/GestureDescription.java
@@ -455,7 +455,7 @@
             dest.writeFloat(mY);
         }
 
-        public static final Parcelable.Creator<TouchPoint> CREATOR
+        public static final @android.annotation.NonNull Parcelable.Creator<TouchPoint> CREATOR
                 = new Parcelable.Creator<TouchPoint>() {
             public TouchPoint createFromParcel(Parcel in) {
                 return new TouchPoint(in);
@@ -509,7 +509,7 @@
             dest.writeParcelableArray(touchPoints, flags);
         }
 
-        public static final Parcelable.Creator<GestureStep> CREATOR
+        public static final @android.annotation.NonNull Parcelable.Creator<GestureStep> CREATOR
                 = new Parcelable.Creator<GestureStep>() {
             public GestureStep createFromParcel(Parcel in) {
                 return new GestureStep(in);
diff --git a/core/java/android/accounts/Account.java b/core/java/android/accounts/Account.java
index d3b2238..2637764 100644
--- a/core/java/android/accounts/Account.java
+++ b/core/java/android/accounts/Account.java
@@ -124,7 +124,7 @@
         dest.writeString(accessId);
     }
 
-    public static final Creator<Account> CREATOR = new Creator<Account>() {
+    public static final @android.annotation.NonNull Creator<Account> CREATOR = new Creator<Account>() {
         public Account createFromParcel(Parcel source) {
             return new Account(source);
         }
diff --git a/core/java/android/accounts/AccountAuthenticatorResponse.java b/core/java/android/accounts/AccountAuthenticatorResponse.java
index bcc9f90..bb2e327 100644
--- a/core/java/android/accounts/AccountAuthenticatorResponse.java
+++ b/core/java/android/accounts/AccountAuthenticatorResponse.java
@@ -87,7 +87,7 @@
         dest.writeStrongBinder(mAccountAuthenticatorResponse.asBinder());
     }
 
-    public static final Creator<AccountAuthenticatorResponse> CREATOR =
+    public static final @android.annotation.NonNull Creator<AccountAuthenticatorResponse> CREATOR =
             new Creator<AccountAuthenticatorResponse>() {
         public AccountAuthenticatorResponse createFromParcel(Parcel source) {
             return new AccountAuthenticatorResponse(source);
diff --git a/core/java/android/accounts/AccountManagerResponse.java b/core/java/android/accounts/AccountManagerResponse.java
index 11c6e60..369a7c3 100644
--- a/core/java/android/accounts/AccountManagerResponse.java
+++ b/core/java/android/accounts/AccountManagerResponse.java
@@ -66,7 +66,7 @@
     }
 
     /** @hide */
-    public static final Creator<AccountManagerResponse> CREATOR =
+    public static final @android.annotation.NonNull Creator<AccountManagerResponse> CREATOR =
             new Creator<AccountManagerResponse>() {
         public AccountManagerResponse createFromParcel(Parcel source) {
             return new AccountManagerResponse(source);
diff --git a/core/java/android/accounts/AuthenticatorDescription.java b/core/java/android/accounts/AuthenticatorDescription.java
index 2360cec..5556394 100644
--- a/core/java/android/accounts/AuthenticatorDescription.java
+++ b/core/java/android/accounts/AuthenticatorDescription.java
@@ -134,7 +134,7 @@
     }
 
     /** Used to create the object from a parcel. */
-    public static final Creator<AuthenticatorDescription> CREATOR =
+    public static final @android.annotation.NonNull Creator<AuthenticatorDescription> CREATOR =
             new Creator<AuthenticatorDescription>() {
         /** @inheritDoc */
         public AuthenticatorDescription createFromParcel(Parcel source) {
diff --git a/core/java/android/accounts/IAccountAuthenticator.aidl b/core/java/android/accounts/IAccountAuthenticator.aidl
index 8b98ca2..701cecf 100644
--- a/core/java/android/accounts/IAccountAuthenticator.aidl
+++ b/core/java/android/accounts/IAccountAuthenticator.aidl
@@ -28,47 +28,55 @@
     /**
      * prompts the user for account information and adds the result to the IAccountManager
      */
+    @UnsupportedAppUsage
     void addAccount(in IAccountAuthenticatorResponse response, String accountType,
         String authTokenType, in String[] requiredFeatures, in Bundle options);
 
     /**
      * prompts the user for the credentials of the account
      */
+    @UnsupportedAppUsage
     void confirmCredentials(in IAccountAuthenticatorResponse response, in Account account,
         in Bundle options);
 
     /**
      * gets the password by either prompting the user or querying the IAccountManager
      */
+    @UnsupportedAppUsage
     void getAuthToken(in IAccountAuthenticatorResponse response, in Account account,
         String authTokenType, in Bundle options);
 
     /**
      * Gets the user-visible label of the given authtoken type.
      */
+    @UnsupportedAppUsage
     void getAuthTokenLabel(in IAccountAuthenticatorResponse response, String authTokenType);
 
     /**
      * prompts the user for a new password and writes it to the IAccountManager
      */
+    @UnsupportedAppUsage
     void updateCredentials(in IAccountAuthenticatorResponse response, in Account account,
         String authTokenType, in Bundle options);
 
     /**
      * launches an activity that lets the user edit and set the properties for an authenticator
      */
+    @UnsupportedAppUsage
     void editProperties(in IAccountAuthenticatorResponse response, String accountType);
 
     /**
      * returns a Bundle where the boolean value BOOLEAN_RESULT_KEY is set if the account has the
      * specified features
      */
+    @UnsupportedAppUsage
     void hasFeatures(in IAccountAuthenticatorResponse response, in Account account, 
         in String[] features);
 
     /**
      * Gets whether or not the account is allowed to be removed.
      */
+    @UnsupportedAppUsage
     void getAccountRemovalAllowed(in IAccountAuthenticatorResponse response, in Account account);
 
     /**
diff --git a/core/java/android/accounts/IAccountAuthenticatorResponse.aidl b/core/java/android/accounts/IAccountAuthenticatorResponse.aidl
index 0c75e50..fbc8e5d 100644
--- a/core/java/android/accounts/IAccountAuthenticatorResponse.aidl
+++ b/core/java/android/accounts/IAccountAuthenticatorResponse.aidl
@@ -22,7 +22,10 @@
  * @hide
  */
 oneway interface IAccountAuthenticatorResponse {
+    @UnsupportedAppUsage
     void onResult(in Bundle value);
+    @UnsupportedAppUsage
     void onRequestContinued();
+    @UnsupportedAppUsage
     void onError(int errorCode, String errorMessage);
 }
diff --git a/core/java/android/accounts/IAccountManagerResponse.aidl b/core/java/android/accounts/IAccountManagerResponse.aidl
index ca1203d..11d0c02 100644
--- a/core/java/android/accounts/IAccountManagerResponse.aidl
+++ b/core/java/android/accounts/IAccountManagerResponse.aidl
@@ -22,6 +22,8 @@
  * @hide
  */
 oneway interface IAccountManagerResponse {
+    @UnsupportedAppUsage
     void onResult(in Bundle value);
+    @UnsupportedAppUsage
     void onError(int errorCode, String errorMessage);
 }
diff --git a/core/java/android/app/ActionBar.java b/core/java/android/app/ActionBar.java
index 831cac2..e573279 100644
--- a/core/java/android/app/ActionBar.java
+++ b/core/java/android/app/ActionBar.java
@@ -36,6 +36,7 @@
 import android.view.ViewGroup;
 import android.view.ViewHierarchyEncoder;
 import android.view.Window;
+import android.view.inspector.InspectableProperty;
 import android.widget.SpinnerAdapter;
 
 import java.lang.annotation.Retention;
@@ -1374,6 +1375,9 @@
                 @ViewDebug.IntToString(from = Gravity.CENTER,            to = "CENTER"),
                 @ViewDebug.IntToString(from = Gravity.FILL,              to = "FILL")
         })
+        @InspectableProperty(
+                name = "layout_gravity",
+                valueType = InspectableProperty.ValueType.GRAVITY)
         public int gravity = Gravity.NO_GRAVITY;
 
         public LayoutParams(@NonNull Context c, AttributeSet attrs) {
diff --git a/core/java/android/app/Activity.java b/core/java/android/app/Activity.java
index 68b2de4..56bf8fa 100644
--- a/core/java/android/app/Activity.java
+++ b/core/java/android/app/Activity.java
@@ -127,6 +127,7 @@
 import android.view.autofill.IAutofillWindowPresenter;
 import android.view.contentcapture.ContentCaptureContext;
 import android.view.contentcapture.ContentCaptureManager;
+import android.view.contentcapture.ContentCaptureManager.ContentCaptureClient;
 import android.widget.AdapterView;
 import android.widget.Toast;
 import android.widget.Toolbar;
@@ -717,7 +718,7 @@
         Window.Callback, KeyEvent.Callback,
         OnCreateContextMenuListener, ComponentCallbacks2,
         Window.OnWindowDismissedCallback, WindowControllerCallback,
-        AutofillManager.AutofillClient {
+        AutofillManager.AutofillClient, ContentCaptureManager.ContentCaptureClient {
     private static final String TAG = "Activity";
     private static final boolean DEBUG_LIFECYCLE = false;
 
@@ -1119,6 +1120,12 @@
         return this;
     }
 
+    /** @hide */
+    @Override
+    public final ContentCaptureClient getContentCaptureClient() {
+        return this;
+    }
+
     /**
      * Register an {@link Application.ActivityLifecycleCallbacks} instance that receives
      * lifecycle callbacks for only this Activity.
@@ -6464,6 +6471,12 @@
         return getComponentName();
     }
 
+    /** @hide */
+    @Override
+    public final ComponentName contentCaptureClientGetComponentName() {
+        return getComponentName();
+    }
+
     /**
      * Retrieve a {@link SharedPreferences} object for accessing preferences
      * that are private to this activity.  This simply calls the underlying
@@ -8366,11 +8379,8 @@
      *                              screen when this activity has another activity behind it with
      *                              the showWhenLock attribute set; {@code false} otherwise.
      * @see #setShowWhenLocked(boolean)
-     * See android.R.attr#inheritShowWhenLocked
-     * @hide
+     * @see android.R.attr#inheritShowWhenLocked
      */
-    @SystemApi
-    @TestApi
     public void setInheritShowWhenLocked(boolean inheritShowWhenLocked) {
         try {
             ActivityTaskManager.getService().setInheritShowWhenLocked(
diff --git a/core/java/android/app/ActivityManager.java b/core/java/android/app/ActivityManager.java
index ee7288f..023371d 100644
--- a/core/java/android/app/ActivityManager.java
+++ b/core/java/android/app/ActivityManager.java
@@ -1345,7 +1345,7 @@
             mIconFilename = source.readInt() > 0 ? source.readString() : null;
         }
 
-        public static final Creator<TaskDescription> CREATOR
+        public static final @android.annotation.NonNull Creator<TaskDescription> CREATOR
                 = new Creator<TaskDescription>() {
             public TaskDescription createFromParcel(Parcel source) {
                 return new TaskDescription(source);
@@ -1431,7 +1431,7 @@
             super.writeToParcel(dest, flags);
         }
 
-        public static final Creator<RecentTaskInfo> CREATOR
+        public static final @android.annotation.NonNull Creator<RecentTaskInfo> CREATOR
                 = new Creator<RecentTaskInfo>() {
             public RecentTaskInfo createFromParcel(Parcel source) {
                 return new RecentTaskInfo(source);
@@ -1601,7 +1601,7 @@
             super.writeToParcel(dest, flags);
         }
 
-        public static final Creator<RunningTaskInfo> CREATOR = new Creator<RunningTaskInfo>() {
+        public static final @android.annotation.NonNull Creator<RunningTaskInfo> CREATOR = new Creator<RunningTaskInfo>() {
             public RunningTaskInfo createFromParcel(Parcel source) {
                 return new RunningTaskInfo(source);
             }
@@ -1936,7 +1936,7 @@
                     + " mIsTranslucent=" + mIsTranslucent;
         }
 
-        public static final Creator<TaskSnapshot> CREATOR = new Creator<TaskSnapshot>() {
+        public static final @android.annotation.NonNull Creator<TaskSnapshot> CREATOR = new Creator<TaskSnapshot>() {
             public TaskSnapshot createFromParcel(Parcel source) {
                 return new TaskSnapshot(source);
             }
@@ -2018,7 +2018,8 @@
      * @return {@code true} if a call to start an activity on the target display is allowed for the
      * provided context and no {@link SecurityException} will be thrown, {@code false} otherwise.
      */
-    public boolean isActivityStartAllowedOnDisplay(Context context, int displayId, Intent intent) {
+    public boolean isActivityStartAllowedOnDisplay(@NonNull Context context, int displayId,
+            @NonNull Intent intent) {
         try {
             return getTaskService().isActivityStartAllowedOnDisplay(displayId, intent,
                     intent.resolveTypeIfNeeded(context.getContentResolver()), context.getUserId());
@@ -2177,7 +2178,7 @@
             clientLabel = source.readInt();
         }
 
-        public static final Creator<RunningServiceInfo> CREATOR = new Creator<RunningServiceInfo>() {
+        public static final @android.annotation.NonNull Creator<RunningServiceInfo> CREATOR = new Creator<RunningServiceInfo>() {
             public RunningServiceInfo createFromParcel(Parcel source) {
                 return new RunningServiceInfo(source);
             }
@@ -2309,7 +2310,7 @@
             foregroundAppThreshold = source.readLong();
         }
 
-        public static final Creator<MemoryInfo> CREATOR
+        public static final @android.annotation.NonNull Creator<MemoryInfo> CREATOR
                 = new Creator<MemoryInfo>() {
             public MemoryInfo createFromParcel(Parcel source) {
                 return new MemoryInfo(source);
@@ -2440,7 +2441,7 @@
             configuration.readFromParcel(source);
         }
 
-        public static final Creator<StackInfo> CREATOR = new Creator<StackInfo>() {
+        public static final @android.annotation.NonNull Creator<StackInfo> CREATOR = new Creator<StackInfo>() {
             @Override
             public StackInfo createFromParcel(Parcel source) {
                 return new StackInfo(source);
@@ -2646,7 +2647,7 @@
             stackTrace = source.readString();
         }
 
-        public static final Creator<ProcessErrorStateInfo> CREATOR =
+        public static final @android.annotation.NonNull Creator<ProcessErrorStateInfo> CREATOR =
                 new Creator<ProcessErrorStateInfo>() {
             public ProcessErrorStateInfo createFromParcel(Parcel source) {
                 return new ProcessErrorStateInfo(source);
@@ -3110,7 +3111,7 @@
             lastActivityTime = source.readLong();
         }
 
-        public static final Creator<RunningAppProcessInfo> CREATOR =
+        public static final @android.annotation.NonNull Creator<RunningAppProcessInfo> CREATOR =
             new Creator<RunningAppProcessInfo>() {
             public RunningAppProcessInfo createFromParcel(Parcel source) {
                 return new RunningAppProcessInfo(source);
diff --git a/core/java/android/app/ActivityManagerInternal.java b/core/java/android/app/ActivityManagerInternal.java
index 7d828d8..664f0a3 100644
--- a/core/java/android/app/ActivityManagerInternal.java
+++ b/core/java/android/app/ActivityManagerInternal.java
@@ -196,6 +196,9 @@
     /** Kill the processes in the list due to their tasks been removed. */
     public abstract void killProcessesForRemovedTask(ArrayList<Object> procsToKill);
 
+    /** Kill the process immediately. */
+    public abstract void killProcess(String processName, int uid, String reason);
+
     /**
      * Returns {@code true} if {@code uid} is running an activity from {@code packageName}.
      */
@@ -276,6 +279,7 @@
     public abstract boolean isActivityStartsLoggingEnabled();
     /** Returns true if the background activity starts is enabled. */
     public abstract boolean isBackgroundActivityStartsEnabled();
+    public abstract boolean isPackageNameWhitelistedForBgActivityStarts(String packageName);
     public abstract void reportCurKeyguardUsageEvent(boolean keyguardShowing);
 
     /** Input dispatch timeout to a window, start the ANR process. */
diff --git a/core/java/android/app/ActivityThread.java b/core/java/android/app/ActivityThread.java
index 92302c5..08239a1 100644
--- a/core/java/android/app/ActivityThread.java
+++ b/core/java/android/app/ActivityThread.java
@@ -182,6 +182,7 @@
 import java.lang.ref.WeakReference;
 import java.lang.reflect.Method;
 import java.net.InetAddress;
+import java.nio.file.Files;
 import java.text.DateFormat;
 import java.util.ArrayList;
 import java.util.Arrays;
@@ -331,7 +332,6 @@
     String[] mInstrumentedSplitAppDirs = null;
     String mInstrumentedLibDir = null;
     boolean mSystemThread = false;
-    boolean mJitEnabled = false;
     boolean mSomeActivitiesChanged = false;
     boolean mUpdatingSystemConfig = false;
     /* package */ boolean mHiddenApiWarningShown = false;
@@ -1695,7 +1695,6 @@
         public static final int SUICIDE                 = 130;
         @UnsupportedAppUsage
         public static final int REMOVE_PROVIDER         = 131;
-        public static final int ENABLE_JIT              = 132;
         public static final int DISPATCH_PACKAGE_BROADCAST = 133;
         @UnsupportedAppUsage
         public static final int SCHEDULE_CRASH          = 134;
@@ -1745,7 +1744,6 @@
                     case DESTROY_BACKUP_AGENT: return "DESTROY_BACKUP_AGENT";
                     case SUICIDE: return "SUICIDE";
                     case REMOVE_PROVIDER: return "REMOVE_PROVIDER";
-                    case ENABLE_JIT: return "ENABLE_JIT";
                     case DISPATCH_PACKAGE_BROADCAST: return "DISPATCH_PACKAGE_BROADCAST";
                     case SCHEDULE_CRASH: return "SCHEDULE_CRASH";
                     case DUMP_HEAP: return "DUMP_HEAP";
@@ -1857,9 +1855,6 @@
                     completeRemoveProvider((ProviderRefCount)msg.obj);
                     Trace.traceEnd(Trace.TRACE_TAG_ACTIVITY_MANAGER);
                     break;
-                case ENABLE_JIT:
-                    ensureJitEnabled();
-                    break;
                 case DISPATCH_PACKAGE_BROADCAST:
                     Trace.traceBegin(Trace.TRACE_TAG_ACTIVITY_MANAGER, "broadcastPackage");
                     handleDispatchPackageBroadcast(msg.arg1, (String[])msg.obj);
@@ -1995,7 +1990,6 @@
             if (stopProfiling) {
                 mProfiler.stopProfiling();
             }
-            ensureJitEnabled();
             return false;
         }
     }
@@ -2329,13 +2323,6 @@
         }
     }
 
-    void ensureJitEnabled() {
-        if (!mJitEnabled) {
-            mJitEnabled = true;
-            dalvik.system.VMRuntime.getRuntime().startJitCompilation();
-        }
-    }
-
     @UnsupportedAppUsage
     void scheduleGcIdler() {
         if (!mGcIdlerScheduled) {
@@ -3781,7 +3768,6 @@
                         ActivityManager.getService().serviceDoneExecuting(
                                 data.token, SERVICE_DONE_EXECUTING_ANON, 0, 0);
                     }
-                    ensureJitEnabled();
                 } catch (RemoteException ex) {
                     throw ex.rethrowFromSystemServer();
                 }
@@ -3895,7 +3881,6 @@
                 } catch (RemoteException e) {
                     throw e.rethrowFromSystemServer();
                 }
-                ensureJitEnabled();
             } catch (Exception e) {
                 if (!mInstrumentation.onException(s, e)) {
                     throw new RuntimeException(
@@ -6176,9 +6161,6 @@
             if (!data.restrictedBackupMode) {
                 if (!ArrayUtils.isEmpty(data.providers)) {
                     installContentProviders(app, data.providers);
-                    // For process that contains content providers, we want to
-                    // ensure that the JIT is enabled "at some point".
-                    mH.sendEmptyMessageDelayed(H.ENABLE_JIT, 10*1000);
                 }
             }
 
@@ -6811,12 +6793,6 @@
         sCurrentActivityThread = this;
         mSystemThread = system;
         if (!system) {
-            ViewRootImpl.addFirstDrawHandler(new Runnable() {
-                @Override
-                public void run() {
-                    ensureJitEnabled();
-                }
-            });
             android.ddm.DdmHandleAppName.setAppName("<pre-initialized>",
                                                     UserHandle.myUserId());
             RuntimeInit.setApplicationObject(mAppThread.asBinder());
@@ -6954,6 +6930,25 @@
                 fd.setInt$(cr.openFileDescriptor(uri,
                         FileUtils.translateModePosixToString(mode)).detachFd());
                 return fd;
+            } catch (SecurityException e) {
+                throw new ErrnoException(e.getMessage(), OsConstants.EACCES);
+            } catch (FileNotFoundException e) {
+                throw new ErrnoException(e.getMessage(), OsConstants.ENOENT);
+            }
+        }
+
+        private void deleteDeprecatedDataPath(String path) throws ErrnoException {
+            final Uri uri = ContentResolver.translateDeprecatedDataPath(path);
+            Log.v(TAG, "Redirecting " + path + " to " + uri);
+
+            final ContentResolver cr = currentActivityThread().getApplication()
+                    .getContentResolver();
+            try {
+                if (cr.delete(uri, null, null) == 0) {
+                    throw new FileNotFoundException();
+                }
+            } catch (SecurityException e) {
+                throw new ErrnoException(e.getMessage(), OsConstants.EACCES);
             } catch (FileNotFoundException e) {
                 throw new ErrnoException(e.getMessage(), OsConstants.ENOENT);
             }
@@ -6993,6 +6988,42 @@
                 return super.stat(path);
             }
         }
+
+        @Override
+        public void unlink(String path) throws ErrnoException {
+            if (path != null && path.startsWith(DEPRECATE_DATA_PREFIX)) {
+                deleteDeprecatedDataPath(path);
+            } else {
+                super.unlink(path);
+            }
+        }
+
+        @Override
+        public void remove(String path) throws ErrnoException {
+            if (path != null && path.startsWith(DEPRECATE_DATA_PREFIX)) {
+                deleteDeprecatedDataPath(path);
+            } else {
+                super.remove(path);
+            }
+        }
+
+        @Override
+        public void rename(String oldPath, String newPath) throws ErrnoException {
+            try {
+                super.rename(oldPath, newPath);
+            } catch (ErrnoException e) {
+                if (e.errno == OsConstants.EXDEV) {
+                    Log.v(TAG, "Recovering failed rename " + oldPath + " to " + newPath);
+                    try {
+                        Files.move(new File(oldPath).toPath(), new File(newPath).toPath());
+                    } catch (IOException e2) {
+                        throw e;
+                    }
+                } else {
+                    throw e;
+                }
+            }
+        }
     }
 
     public static void main(String[] args) {
diff --git a/core/java/android/app/AlarmManager.java b/core/java/android/app/AlarmManager.java
index 2f0f14aa..3a34b79 100644
--- a/core/java/android/app/AlarmManager.java
+++ b/core/java/android/app/AlarmManager.java
@@ -1135,7 +1135,7 @@
             dest.writeParcelable(mShowIntent, flags);
         }
 
-        public static final Creator<AlarmClockInfo> CREATOR = new Creator<AlarmClockInfo>() {
+        public static final @android.annotation.NonNull Creator<AlarmClockInfo> CREATOR = new Creator<AlarmClockInfo>() {
             @Override
             public AlarmClockInfo createFromParcel(Parcel in) {
                 return new AlarmClockInfo(in);
diff --git a/core/java/android/app/AppComponentFactory.java b/core/java/android/app/AppComponentFactory.java
index ae63291..2cec7f0 100644
--- a/core/java/android/app/AppComponentFactory.java
+++ b/core/java/android/app/AppComponentFactory.java
@@ -27,6 +27,7 @@
  *
  * @see #instantiateApplication
  * @see #instantiateActivity
+ * @see #instantiateClassLoader
  * @see #instantiateService
  * @see #instantiateReceiver
  * @see #instantiateProvider
@@ -39,8 +40,10 @@
      * a custom class loader hierarchy.
      *
      * @param cl        The default classloader instantiated by platform.
+     * @param aInfo     Information about the application being loaded.
      */
-    public @NonNull ClassLoader instantiateClassLoader(@NonNull ClassLoader cl) {
+    public @NonNull ClassLoader instantiateClassLoader(@NonNull ClassLoader cl,
+            @NonNull ApplicationInfo aInfo) {
         return cl;
     }
 
@@ -133,19 +136,6 @@
         return (ContentProvider) cl.loadClass(className).newInstance();
     }
 
-    private ApplicationInfo mApplicationInfo = null;
-
-    void setApplicationInfo(ApplicationInfo info) {
-        mApplicationInfo = info;
-    }
-
-    /**
-     * Returns the ApplicationInfo associated with this package.
-     */
-    public ApplicationInfo getApplicationInfo() {
-        return mApplicationInfo;
-    }
-
     /**
      * @hide
      */
diff --git a/core/java/android/app/AppOpsManager.java b/core/java/android/app/AppOpsManager.java
index 040ad06..91df05f 100644
--- a/core/java/android/app/AppOpsManager.java
+++ b/core/java/android/app/AppOpsManager.java
@@ -43,6 +43,8 @@
 import android.os.UserManager;
 import android.provider.Settings;
 import android.util.ArrayMap;
+import android.util.LongSparseArray;
+import android.util.LongSparseLongArray;
 import android.util.SparseArray;
 
 import com.android.internal.annotations.GuardedBy;
@@ -55,8 +57,10 @@
 import com.android.internal.util.ArrayUtils;
 import com.android.internal.util.Preconditions;
 
+import java.lang.annotation.ElementType;
 import java.lang.annotation.Retention;
 import java.lang.annotation.RetentionPolicy;
+import java.lang.annotation.Target;
 import java.math.BigDecimal;
 import java.math.RoundingMode;
 import java.util.ArrayList;
@@ -64,9 +68,11 @@
 import java.util.Collections;
 import java.util.HashMap;
 import java.util.List;
+import java.util.Objects;
 import java.util.concurrent.Executor;
 import java.util.concurrent.atomic.AtomicInteger;
 import java.util.function.Consumer;
+import java.util.function.Supplier;
 
 /**
  * API for interacting with "application operation" tracking.
@@ -227,7 +233,7 @@
 
     /** @hide */
     @Retention(RetentionPolicy.SOURCE)
-    @IntDef(flag = true, prefix = { "UID_STATE_" }, value = {
+    @IntDef(prefix = { "UID_STATE_" }, value = {
             UID_STATE_PERSISTENT,
             UID_STATE_TOP,
             UID_STATE_FOREGROUND_SERVICE_LOCATION,
@@ -239,78 +245,322 @@
     public @interface UidState {}
 
     /**
-     * Invalid UID state.
-     * @hide
-     */
-    public static final int UID_STATE_INVALID = -1;
-
-    /**
-     * Metrics about an op when its uid is persistent.
+     * Uid state: The UID is a foreground persistent app.
      * @hide
      */
     @TestApi
     @SystemApi
-    public static final int UID_STATE_PERSISTENT = 0;
+    public static final int UID_STATE_PERSISTENT = 100;
 
     /**
-     * Metrics about an op when its uid is at the top.
+     * Uid state: The UID is top foreground app.
      * @hide
      */
     @TestApi
     @SystemApi
-    public static final int UID_STATE_TOP = 1;
+    public static final int UID_STATE_TOP = 200;
 
     /**
-     * Metrics about an op when its uid is running a foreground service with location type.
+     * Uid state: The UID is running a foreground service of location type.
      * @hide
      */
     @TestApi
     @SystemApi
-    public static final int UID_STATE_FOREGROUND_SERVICE_LOCATION = 2;
+    public static final int UID_STATE_FOREGROUND_SERVICE_LOCATION = 300;
 
     /**
-     * Metrics about an op when its uid is running a foreground service.
+     * Uid state: The UID is running a foreground service.
      * @hide
      */
     @TestApi
     @SystemApi
-    public static final int UID_STATE_FOREGROUND_SERVICE = 3;
+    public static final int UID_STATE_FOREGROUND_SERVICE = 400;
 
     /**
-     * Last UID state in which we don't restrict what an op can do.
+     * The max, which is min priority, UID state for which any app op
+     * would be considered as performed in the foreground.
      * @hide
      */
-    public static final int UID_STATE_LAST_NON_RESTRICTED = UID_STATE_FOREGROUND_SERVICE_LOCATION;
+    public static final int UID_STATE_MAX_LAST_NON_RESTRICTED = UID_STATE_FOREGROUND_SERVICE;
 
     /**
-     * Metrics about an op when its uid is in the foreground for any other reasons.
+     * Uid state: The UID is a foreground app.
      * @hide
      */
     @TestApi
     @SystemApi
-    public static final int UID_STATE_FOREGROUND = 4;
+    public static final int UID_STATE_FOREGROUND = 500;
 
     /**
-     * Metrics about an op when its uid is in the background for any reason.
+     * Uid state: The UID is a background app.
      * @hide
      */
     @TestApi
     @SystemApi
-    public static final int UID_STATE_BACKGROUND = 5;
+    public static final int UID_STATE_BACKGROUND = 600;
 
     /**
-     * Metrics about an op when its uid is cached.
+     * Uid state: The UID is a cached app.
      * @hide
      */
     @TestApi
     @SystemApi
-    public static final int UID_STATE_CACHED = 6;
+    public static final int UID_STATE_CACHED = 700;
 
     /**
-     * Number of uid states we track.
+     * Uid state: The UID state with the highest priority.
      * @hide
      */
-    public static final int _NUM_UID_STATE = 7;
+    public static final int MAX_PRIORITY_UID_STATE = UID_STATE_PERSISTENT;
+
+    /**
+     * Uid state: The UID state with the lowest priority.
+     * @hide
+     */
+    public static final int MIN_PRIORITY_UID_STATE = UID_STATE_CACHED;
+
+    /**
+     * Resolves the first unrestricted state given an app op. Location is
+     * special as we want to allow its access only if a dedicated location
+     * foreground service is running. For other ops we consider any foreground
+     * service as a foreground state.
+     *
+     * @param op The op to resolve.
+     * @return The last restricted UID state.
+     *
+     * @hide
+     */
+    public static int resolveFirstUnrestrictedUidState(int op) {
+        switch (op) {
+            case OP_FINE_LOCATION:
+            case OP_COARSE_LOCATION: {
+                return UID_STATE_FOREGROUND_SERVICE_LOCATION;
+            }
+        }
+        return UID_STATE_FOREGROUND_SERVICE;
+    }
+
+    /**
+     * Resolves the last restricted state given an app op. Location is
+     * special as we want to allow its access only if a dedicated location
+     * foreground service is running. For other ops we consider any foreground
+     * service as a foreground state.
+     *
+     * @param op The op to resolve.
+     * @return The last restricted UID state.
+     *
+     * @hide
+     */
+    public static int resolveLastRestrictedUidState(int op) {
+        switch (op) {
+            case OP_FINE_LOCATION:
+            case OP_COARSE_LOCATION: {
+                return UID_STATE_FOREGROUND_SERVICE;
+            }
+        }
+        return UID_STATE_FOREGROUND;
+    }
+
+    /** @hide Note: Keep these sorted */
+    public static final int[] UID_STATES = {
+            UID_STATE_PERSISTENT,
+            UID_STATE_TOP,
+            UID_STATE_FOREGROUND_SERVICE_LOCATION,
+            UID_STATE_FOREGROUND_SERVICE,
+            UID_STATE_FOREGROUND,
+            UID_STATE_BACKGROUND,
+            UID_STATE_CACHED
+    };
+
+    /** @hide */
+    public static String getUidStateName(@UidState int uidState) {
+        switch (uidState) {
+            case UID_STATE_PERSISTENT:
+                return "pers";
+            case UID_STATE_TOP:
+                return "top";
+            case UID_STATE_FOREGROUND_SERVICE_LOCATION:
+                return "fgsvcl";
+            case UID_STATE_FOREGROUND_SERVICE:
+                return "fgsvc";
+            case UID_STATE_FOREGROUND:
+                return "fg";
+            case UID_STATE_BACKGROUND:
+                return "bg";
+            case UID_STATE_CACHED:
+                return "cch";
+            default:
+                return "unknown";
+        }
+    }
+
+    /**
+     * Flag: non proxy operations. These are operations
+     * performed on behalf of the app itself and not on behalf of
+     * another one.
+     *
+     * @hide
+     */
+    @TestApi
+    @SystemApi
+    public static final int OP_FLAG_SELF = 0x1;
+
+    /**
+     * Flag: trusted proxy operations. These are operations
+     * performed on behalf of another app by a trusted app.
+     * Which is work a trusted app blames on another app.
+     *
+     * @hide
+     */
+    @TestApi
+    @SystemApi
+    public static final int OP_FLAG_TRUSTED_PROXY = 0x2;
+
+    /**
+     * Flag: untrusted proxy operations. These are operations
+     * performed on behalf of another app by an untrusted app.
+     * Which is work an untrusted app blames on another app.
+     *
+     * @hide
+     */
+    @TestApi
+    @SystemApi
+    public static final int OP_FLAG_UNTRUSTED_PROXY = 0x4;
+
+    /**
+     * Flag: trusted proxied operations. These are operations
+     * performed by a trusted other app on behalf of an app.
+     * Which is work an app was blamed for by a trusted app.
+     *
+     * @hide
+     */
+    @TestApi
+    @SystemApi
+    public static final int OP_FLAG_TRUSTED_PROXIED = 0x8;
+
+    /**
+     * Flag: untrusted proxied operations. These are operations
+     * performed by an untrusted other app on behalf of an app.
+     * Which is work an app was blamed for by an untrusted app.
+     *
+     * @hide
+     */
+    @TestApi
+    @SystemApi
+    public static final int OP_FLAG_UNTRUSTED_PROXIED = 0x10;
+
+    /**
+     * Flags: all operations. These include operations matched
+     * by {@link #OP_FLAG_SELF}, {@link #OP_FLAG_TRUSTED_PROXIED},
+     * {@link #OP_FLAG_UNTRUSTED_PROXIED}, {@link #OP_FLAG_TRUSTED_PROXIED},
+     * {@link #OP_FLAG_UNTRUSTED_PROXIED}.
+     *
+     * @hide
+     */
+    @TestApi
+    @SystemApi
+    public static final int OP_FLAGS_ALL =
+            OP_FLAG_SELF
+                | OP_FLAG_TRUSTED_PROXY
+                | OP_FLAG_UNTRUSTED_PROXY
+                | OP_FLAG_TRUSTED_PROXIED
+                | OP_FLAG_UNTRUSTED_PROXIED;
+
+    /**
+     * Flags: all trusted operations which is ones either the app did {@link #OP_FLAG_SELF},
+     * or it was blamed for by a trusted app {@link #OP_FLAG_TRUSTED_PROXIED}, or ones the
+     * app if untrusted blamed on other apps {@link #OP_FLAG_UNTRUSTED_PROXY}.
+     *
+     * @hide
+     */
+    @SystemApi
+    public static final int OP_FLAGS_ALL_TRUSTED = AppOpsManager.OP_FLAG_SELF
+        | AppOpsManager.OP_FLAG_UNTRUSTED_PROXY
+        | AppOpsManager.OP_FLAG_TRUSTED_PROXIED;
+
+    /** @hide */
+    @Retention(RetentionPolicy.SOURCE)
+    @IntDef(flag = true, prefix = { "FLAG_" }, value = {
+            OP_FLAG_SELF,
+            OP_FLAG_TRUSTED_PROXY,
+            OP_FLAG_UNTRUSTED_PROXY,
+            OP_FLAG_TRUSTED_PROXIED,
+            OP_FLAG_UNTRUSTED_PROXIED
+    })
+    public @interface OpFlags {}
+
+
+    /** @hide */
+    public static final String getFlagName(@OpFlags int flag) {
+        switch (flag) {
+            case OP_FLAG_SELF:
+                return "s";
+            case OP_FLAG_TRUSTED_PROXY:
+                return "tp";
+            case OP_FLAG_UNTRUSTED_PROXY:
+                return "up";
+            case OP_FLAG_TRUSTED_PROXIED:
+                return "tpd";
+            case OP_FLAG_UNTRUSTED_PROXIED:
+                return "upd";
+            default:
+                return "unknown";
+        }
+    }
+
+    private static final int UID_STATE_OFFSET = 31;
+    private static final int FLAGS_MASK = 0xFFFFFFFF;
+
+    /**
+     * Key for a data bucket storing app op state. The bucket
+     * is composed of the uid state and state flags. This way
+     * we can query data for given uid state and a set of flags where
+     * the flags control which type of data to get. For example,
+     * one can get the ops an app did on behalf of other apps
+     * while in the background.
+     *
+     * @hide
+     */
+    @Retention(RetentionPolicy.SOURCE)
+    @Target({ElementType.METHOD, ElementType.PARAMETER, ElementType.FIELD})
+    public @interface DataBucketKey {
+    }
+
+    /** @hide */
+    public static String keyToString(@DataBucketKey long key) {
+        final int uidState = extractUidStateFromKey(key);
+        final int flags = extractFlagsFromKey(key);
+        return "[" + getUidStateName(uidState) + "-" + flagsToString(flags) + "]";
+    }
+
+    /** @hide */
+    public static @DataBucketKey long makeKey(@UidState int uidState, @OpFlags int flags) {
+        return ((long) uidState << UID_STATE_OFFSET) | flags;
+    }
+
+    /** @hide */
+    public static int extractUidStateFromKey(@DataBucketKey long key) {
+        return (int) (key >> UID_STATE_OFFSET);
+    }
+
+    /** @hide */
+    public static int extractFlagsFromKey(@DataBucketKey long key) {
+        return (int) (key & FLAGS_MASK);
+    }
+
+    /** @hide */
+    public static String flagsToString(@OpFlags int flags) {
+        final StringBuilder flagsBuilder = new StringBuilder();
+        while (flags != 0) {
+            final int flag = 1 << Integer.numberOfTrailingZeros(flags);
+            flags &= ~flag;
+            if (flagsBuilder.length() > 0) {
+                flagsBuilder.append('|');
+            }
+            flagsBuilder.append(getFlagName(flag));
+        }
+        return flagsBuilder.toString();
+    }
 
     // when adding one of these:
     //  - increment _NUM_OP
@@ -551,7 +801,7 @@
     @UnsupportedAppUsage
     public static final int OP_MANAGE_IPSEC_TUNNELS = 75;
     /** @hide Any app start foreground service. */
-    @UnsupportedAppUsage
+    @TestApi
     public static final int OP_START_FOREGROUND = 76;
     /** @hide */
     @UnsupportedAppUsage
@@ -1947,14 +2197,23 @@
             mEntries = entries;
         }
 
-        public String getPackageName() {
+        /**
+         * @return The name of the package.
+         */
+        public @NonNull String getPackageName() {
             return mPackageName;
         }
 
+        /**
+         * @return The uid of the package.
+         */
         public int getUid() {
             return mUid;
         }
 
+        /**
+         * @return The ops of the package.
+         */
         public List<OpEntry> getOps() {
             return mEntries;
         }
@@ -1984,7 +2243,7 @@
             }
         }
 
-        public static final Creator<PackageOps> CREATOR = new Creator<PackageOps>() {
+        public static final @android.annotation.NonNull Creator<PackageOps> CREATOR = new Creator<PackageOps>() {
             @Override public PackageOps createFromParcel(Parcel source) {
                 return new PackageOps(source);
             }
@@ -1999,57 +2258,59 @@
      * Class holding the information about one unique operation of an application.
      * @hide
      */
+    @TestApi
+    @Immutable
     @SystemApi
     public static final class OpEntry implements Parcelable {
         private final int mOp;
-        private final @Mode int mMode;
-        private final long[] mTimes;
-        private final long[] mRejectTimes;
-        private final int mDuration;
-        private final int mProxyUid;
         private final boolean mRunning;
-        private final String mProxyPackageName;
+        private final @Mode int mMode;
+        private final @Nullable LongSparseLongArray mAccessTimes;
+        private final @Nullable LongSparseLongArray mRejectTimes;
+        private final @Nullable LongSparseLongArray mDurations;
+        private final @Nullable LongSparseLongArray mProxyUids;
+        private final @Nullable LongSparseArray<String> mProxyPackageNames;
 
         /**
          * @hide
          */
-        public OpEntry(int op, @Mode int mode, long time, long rejectTime, int duration,
-                int proxyUid, String proxyPackage) {
+        public OpEntry(int op, boolean running, @Mode int mode,
+                @Nullable LongSparseLongArray accessTimes, @Nullable LongSparseLongArray rejectTimes,
+                @Nullable LongSparseLongArray durations, @Nullable LongSparseLongArray proxyUids,
+                @Nullable LongSparseArray<String> proxyPackageNames) {
             mOp = op;
-            mMode = mode;
-            mTimes = new long[_NUM_UID_STATE];
-            mRejectTimes = new long[_NUM_UID_STATE];
-            mTimes[0] = time;
-            mRejectTimes[0] = rejectTime;
-            mDuration = duration;
-            mRunning = duration == -1;
-            mProxyUid = proxyUid;
-            mProxyPackageName = proxyPackage;
-        }
-
-        /**
-         * @hide
-         */
-        public OpEntry(int op, @Mode int mode, long[] times, long[] rejectTimes, int duration,
-                boolean running, int proxyUid, String proxyPackage) {
-            mOp = op;
-            mMode = mode;
-            mTimes = new long[_NUM_UID_STATE];
-            mRejectTimes = new long[_NUM_UID_STATE];
-            System.arraycopy(times, 0, mTimes, 0, _NUM_UID_STATE);
-            System.arraycopy(rejectTimes, 0, mRejectTimes, 0, _NUM_UID_STATE);
-            mDuration = duration;
             mRunning = running;
-            mProxyUid = proxyUid;
-            mProxyPackageName = proxyPackage;
+            mMode = mode;
+            mAccessTimes = accessTimes;
+            mRejectTimes = rejectTimes;
+            mDurations = durations;
+            mProxyUids = proxyUids;
+            mProxyPackageNames = proxyPackageNames;
         }
 
         /**
          * @hide
          */
-        public OpEntry(int op, @Mode int mode, long[] times, long[] rejectTimes, int duration,
-                int proxyUid, String proxyPackage) {
-            this(op, mode, times, rejectTimes, duration, duration == -1, proxyUid, proxyPackage);
+        public OpEntry(int op, @Mode int mode) {
+            mOp = op;
+            mMode = mode;
+            mRunning = false;
+            mAccessTimes = null;
+            mRejectTimes = null;
+            mDurations = null;
+            mProxyUids = null;
+            mProxyPackageNames = null;
+        }
+
+        /**
+         * Returns all keys for which we have mapped state in any of the data buckets -
+         * access time, reject time, duration.
+         * @hide */
+        public @Nullable LongSparseArray<Object> collectKeys() {
+            LongSparseArray<Object> result = AppOpsManager.collectKeys(mAccessTimes, null);
+            result = AppOpsManager.collectKeys(mRejectTimes, result);
+            result = AppOpsManager.collectKeys(mDurations, result);
+            return result;
         }
 
         /**
@@ -2061,14 +2322,14 @@
         }
 
         /**
-         * Return this entry's op string name, such as {@link #OPSTR_COARSE_LOCATION}.
+         * @return This entry's op string name, such as {@link #OPSTR_COARSE_LOCATION}.
          */
-        public String getOpStr() {
+        public @NonNull String getOpStr() {
             return sOpToString[mOp];
         }
 
         /**
-         * Return this entry's current mode, such as {@link #MODE_ALLOWED}.
+         * @return this entry's current mode, such as {@link #MODE_ALLOWED}.
          */
         public @Mode int getMode() {
             return mMode;
@@ -2079,89 +2340,331 @@
          */
         @UnsupportedAppUsage
         public long getTime() {
-            return maxTime(mTimes, 0, _NUM_UID_STATE);
+            return getLastAccessTime(OP_FLAGS_ALL);
         }
 
         /**
-         * Return the last wall clock time this op was accessed by the app.
+         * Return the last wall clock time in milliseconds this op was accessed.
+         *
+         * @param flags The flags which are any combination of
+         * {@link #OP_FLAG_SELF}, {@link #OP_FLAG_TRUSTED_PROXY},
+         * {@link #OP_FLAG_UNTRUSTED_PROXY}, {@link #OP_FLAG_TRUSTED_PROXIED},
+         * {@link #OP_FLAG_UNTRUSTED_PROXIED}. You can use {@link #OP_FLAGS_ALL}
+         * for any flag.
+         * @return the last access time in milliseconds since
+         * epoch start (January 1, 1970 00:00:00.000 GMT - Gregorian).
+         *
+         * @see #getLastAccessForegroundTime(int)
+         * @see #getLastAccessBackgroundTime(int)
+         * @see #getLastAccessTime(int, int, int)
          */
-        public long getLastAccessTime() {
-            return maxTime(mTimes, 0, _NUM_UID_STATE);
+        public long getLastAccessTime(@OpFlags int flags) {
+            return maxForFlagsInStates(mAccessTimes, MAX_PRIORITY_UID_STATE,
+                    MIN_PRIORITY_UID_STATE, flags);
         }
 
         /**
-         * Return the last wall clock time this op was accessed by the app while in the foreground.
+         * Return the last wall clock time in milliseconds this op was accessed
+         * by the app while in the foreground.
+         *
+         * @param flags The flags which are any combination of
+         * {@link #OP_FLAG_SELF}, {@link #OP_FLAG_TRUSTED_PROXY},
+         * {@link #OP_FLAG_UNTRUSTED_PROXY}, {@link #OP_FLAG_TRUSTED_PROXIED},
+         * {@link #OP_FLAG_UNTRUSTED_PROXIED}. You can use {@link #OP_FLAGS_ALL}
+         * for any flag.
+         * @return the last foreground access time in milliseconds since
+         * epoch start (January 1, 1970 00:00:00.000 GMT - Gregorian).
+         *
+         * @see #getLastAccessBackgroundTime(int)
+         * @see #getLastAccessTime(int)
+         * @see #getLastAccessTime(int, int, int)
          */
-        public long getLastAccessForegroundTime() {
-            return maxTime(mTimes, UID_STATE_PERSISTENT, UID_STATE_LAST_NON_RESTRICTED + 1);
+        public long getLastAccessForegroundTime(@OpFlags int flags) {
+            return maxForFlagsInStates(mAccessTimes, MAX_PRIORITY_UID_STATE,
+                    resolveFirstUnrestrictedUidState(mOp), flags);
         }
 
         /**
-         * Return the last wall clock time this op was accessed by the app while in the background.
+         * Return the last wall clock time in milliseconds this op was accessed
+         * by the app while in the background.
+         *
+         * @param flags The flags which are any combination of
+         * {@link #OP_FLAG_SELF}, {@link #OP_FLAG_TRUSTED_PROXY},
+         * {@link #OP_FLAG_UNTRUSTED_PROXY}, {@link #OP_FLAG_TRUSTED_PROXIED},
+         * {@link #OP_FLAG_UNTRUSTED_PROXIED}. You can use {@link #OP_FLAGS_ALL}
+         * for any flag.
+         * @return the last foreground access time in milliseconds since
+         * epoch start (January 1, 1970 00:00:00.000 GMT - Gregorian).
+         *
+         * @see #getLastAccessForegroundTime(int)
+         * @see #getLastAccessTime(int)
+         * @see #getLastAccessTime(int, int, int)
          */
-        public long getLastAccessBackgroundTime() {
-            return maxTime(mTimes, UID_STATE_LAST_NON_RESTRICTED + 1, _NUM_UID_STATE);
+        public long getLastAccessBackgroundTime(@OpFlags int flags) {
+            return maxForFlagsInStates(mAccessTimes, resolveLastRestrictedUidState(mOp),
+                    MIN_PRIORITY_UID_STATE, flags);
         }
 
         /**
-         * @hide
+         * Return the last wall clock time  in milliseconds this op was accessed
+         * by the app for a given range of UID states.
+         *
+         * @param fromUidState The UID state for which to query. Could be one of
+         * {@link #UID_STATE_PERSISTENT}, {@link #UID_STATE_TOP},
+         * {@link #UID_STATE_FOREGROUND_SERVICE}, {@link #UID_STATE_FOREGROUND},
+         * {@link #UID_STATE_BACKGROUND}, {@link #UID_STATE_CACHED}.
+         * @param toUidState The UID state for which to query.
+         * @param flags The flags which are any combination of
+         * {@link #OP_FLAG_SELF}, {@link #OP_FLAG_TRUSTED_PROXY},
+         * {@link #OP_FLAG_UNTRUSTED_PROXY}, {@link #OP_FLAG_TRUSTED_PROXIED},
+         * {@link #OP_FLAG_UNTRUSTED_PROXIED}. You can use {@link #OP_FLAGS_ALL}
+         * for any flag.
+         *
+         * @return the last foreground access time in milliseconds since
+         * epoch start (January 1, 1970 00:00:00.000 GMT - Gregorian).
+         *
+         * @see #getLastAccessForegroundTime(int)
+         * @see #getLastAccessBackgroundTime(int)
+         * @see #getLastAccessTime(int)
          */
-        public long getLastTimeFor(int uidState) {
-            return mTimes[uidState];
+        public long getLastAccessTime(@UidState int fromUidState, @UidState int toUidState,
+                @OpFlags int flags) {
+            return maxForFlagsInStates(mAccessTimes, fromUidState, toUidState, flags);
         }
 
         /**
          * @hide
          */
         public long getRejectTime() {
-            return maxTime(mRejectTimes, 0, _NUM_UID_STATE);
+            return getLastRejectTime(OP_FLAGS_ALL);
         }
 
         /**
-         * Return the last wall clock time the app made an attempt to access this op but
-         * was rejected.
+         * Return the last wall clock time in milliseconds the app made an attempt
+         * to access this op but was rejected.
+         *
+         * @param flags The flags which are any combination of
+         * {@link #OP_FLAG_SELF}, {@link #OP_FLAG_TRUSTED_PROXY},
+         * {@link #OP_FLAG_UNTRUSTED_PROXY}, {@link #OP_FLAG_TRUSTED_PROXIED},
+         * {@link #OP_FLAG_UNTRUSTED_PROXIED}. You can use {@link #OP_FLAGS_ALL}
+         * for any flag.
+         * @return the last reject time in milliseconds since
+         * epoch start (January 1, 1970 00:00:00.000 GMT - Gregorian).
+         *
+         * @see #getLastRejectBackgroundTime(int)
+         * @see #getLastRejectForegroundTime(int)
+         * @see #getLastRejectTime(int, int, int)
          */
-        public long getLastRejectTime() {
-            return maxTime(mRejectTimes, 0, _NUM_UID_STATE);
+        public long getLastRejectTime(@OpFlags int flags) {
+            return maxForFlagsInStates(mRejectTimes, MAX_PRIORITY_UID_STATE,
+                    MIN_PRIORITY_UID_STATE, flags);
         }
 
         /**
-         * Return the last wall clock time the app made an attempt to access this op while in
-         * the foreground but was rejected.
+         * Return the last wall clock time in milliseconds the app made an attempt
+         * to access this op while in the foreground but was rejected.
+         *
+         * @param flags The flags which are any combination of
+         * {@link #OP_FLAG_SELF}, {@link #OP_FLAG_TRUSTED_PROXY},
+         * {@link #OP_FLAG_UNTRUSTED_PROXY}, {@link #OP_FLAG_TRUSTED_PROXIED},
+         * {@link #OP_FLAG_UNTRUSTED_PROXIED}. You can use {@link #OP_FLAGS_ALL}
+         * for any flag.
+         * @return the last foreground reject time in milliseconds since
+         * epoch start (January 1, 1970 00:00:00.000 GMT - Gregorian).
+         *
+         * @see #getLastRejectBackgroundTime(int)
+         * @see #getLastRejectTime(int, int, int)
+         * @see #getLastRejectTime(int)
          */
-        public long getLastRejectForegroundTime() {
-            return maxTime(mRejectTimes, UID_STATE_PERSISTENT, UID_STATE_LAST_NON_RESTRICTED + 1);
+        public long getLastRejectForegroundTime(@OpFlags int flags) {
+            return maxForFlagsInStates(mRejectTimes, MAX_PRIORITY_UID_STATE,
+                    resolveFirstUnrestrictedUidState(mOp), flags);
         }
 
         /**
-         * Return the last wall clock time the app made an attempt to access this op while in
-         * the background but was rejected.
+         * Return the last wall clock time in milliseconds the app made an attempt
+         * to access this op while in the background but was rejected.
+         *
+         * @param flags The flags which are any combination of
+         * {@link #OP_FLAG_SELF}, {@link #OP_FLAG_TRUSTED_PROXY},
+         * {@link #OP_FLAG_UNTRUSTED_PROXY}, {@link #OP_FLAG_TRUSTED_PROXIED},
+         * {@link #OP_FLAG_UNTRUSTED_PROXIED}. You can use {@link #OP_FLAGS_ALL}
+         * for any flag.
+         * @return the last background reject time in milliseconds since
+         * epoch start (January 1, 1970 00:00:00.000 GMT - Gregorian).
+         *
+         * @see #getLastRejectForegroundTime(int)
+         * @see #getLastRejectTime(int, int, int)
+         * @see #getLastRejectTime(int)
          */
-        public long getLastRejectBackgroundTime() {
-            return maxTime(mRejectTimes, UID_STATE_LAST_NON_RESTRICTED + 1, _NUM_UID_STATE);
+        public long getLastRejectBackgroundTime(@OpFlags int flags) {
+            return maxForFlagsInStates(mRejectTimes, resolveLastRestrictedUidState(mOp),
+                    MIN_PRIORITY_UID_STATE, flags);
         }
 
         /**
-         * @hide
+         * Return the last wall clock time state in milliseconds the app made an
+         * attempt to access this op for a given range of UID states.
+         *
+         * @param fromUidState The UID state from which to query. Could be one of
+         * {@link #UID_STATE_PERSISTENT}, {@link #UID_STATE_TOP},
+         * {@link #UID_STATE_FOREGROUND_SERVICE}, {@link #UID_STATE_FOREGROUND},
+         * {@link #UID_STATE_BACKGROUND}, {@link #UID_STATE_CACHED}.
+         * @param toUidState The UID state to which to query.
+         * @param flags The flags which are any combination of
+         * {@link #OP_FLAG_SELF}, {@link #OP_FLAG_TRUSTED_PROXY},
+         * {@link #OP_FLAG_UNTRUSTED_PROXY}, {@link #OP_FLAG_TRUSTED_PROXIED},
+         * {@link #OP_FLAG_UNTRUSTED_PROXIED}. You can use {@link #OP_FLAGS_ALL}
+         * for any flag.
+         * @return the last foreground access time in milliseconds since
+         * epoch start (January 1, 1970 00:00:00.000 GMT - Gregorian).
+         *
+         * @see #getLastRejectForegroundTime(int)
+         * @see #getLastRejectBackgroundTime(int)
+         * @see #getLastRejectTime(int)
          */
-        public long getLastRejectTimeFor(int uidState) {
-            return mRejectTimes[uidState];
+        public long getLastRejectTime(@UidState int fromUidState, @UidState int toUidState,
+                @OpFlags int flags) {
+            return maxForFlagsInStates(mRejectTimes, fromUidState, toUidState, flags);
         }
 
+        /**
+         * @return Whether the operation is running.
+         */
         public boolean isRunning() {
             return mRunning;
         }
 
-        public int getDuration() {
-            return mDuration;
+        /**
+         * @return The duration of the operation in milliseconds.
+         */
+        public long getDuration() {
+            return getLastDuration(MAX_PRIORITY_UID_STATE, MIN_PRIORITY_UID_STATE, OP_FLAGS_ALL);
         }
 
+        /**
+         * Return the duration in milliseconds the app accessed this op while
+         * in the foreground.
+         *
+         * @param flags The flags which are any combination of
+         * {@link #OP_FLAG_SELF}, {@link #OP_FLAG_TRUSTED_PROXY},
+         * {@link #OP_FLAG_UNTRUSTED_PROXY}, {@link #OP_FLAG_TRUSTED_PROXIED},
+         * {@link #OP_FLAG_UNTRUSTED_PROXIED}. You can use {@link #OP_FLAGS_ALL}
+         * for any flag.
+         * @return the foreground access duration in milliseconds.
+         *
+         * @see #getLastBackgroundDuration(int)
+         * @see #getLastDuration(int, int, int)
+         */
+        public long getLastForegroundDuration(@OpFlags int flags) {
+            return sumForFlagsInStates(mDurations, MAX_PRIORITY_UID_STATE,
+                    resolveFirstUnrestrictedUidState(mOp), flags);
+        }
+
+        /**
+         * Return the duration in milliseconds the app accessed this op while
+         * in the background.
+         *
+         * @param flags The flags which are any combination of
+         * {@link #OP_FLAG_SELF}, {@link #OP_FLAG_TRUSTED_PROXY},
+         * {@link #OP_FLAG_UNTRUSTED_PROXY}, {@link #OP_FLAG_TRUSTED_PROXIED},
+         * {@link #OP_FLAG_UNTRUSTED_PROXIED}. You can use {@link #OP_FLAGS_ALL}
+         * for any flag.
+         * @return the background access duration in milliseconds.
+         *
+         * @see #getLastForegroundDuration(int)
+         * @see #getLastDuration(int, int, int)
+         */
+        public long getLastBackgroundDuration(@OpFlags int flags) {
+            return sumForFlagsInStates(mDurations, resolveLastRestrictedUidState(mOp),
+                    MIN_PRIORITY_UID_STATE, flags);
+        }
+
+        /**
+         * Return the duration in milliseconds the app accessed this op for
+         * a given range of UID states.
+         *
+         * @param fromUidState The UID state for which to query. Could be one of
+         * {@link #UID_STATE_PERSISTENT}, {@link #UID_STATE_TOP},
+         * {@link #UID_STATE_FOREGROUND_SERVICE}, {@link #UID_STATE_FOREGROUND},
+         * {@link #UID_STATE_BACKGROUND}, {@link #UID_STATE_CACHED}.
+         * @param toUidState The UID state for which to query.
+         * @param flags The flags which are any combination of
+         * {@link #OP_FLAG_SELF}, {@link #OP_FLAG_TRUSTED_PROXY},
+         * {@link #OP_FLAG_UNTRUSTED_PROXY}, {@link #OP_FLAG_TRUSTED_PROXIED},
+         * {@link #OP_FLAG_UNTRUSTED_PROXIED}. You can use {@link #OP_FLAGS_ALL}
+         * for any flag.
+         * @return the access duration in milliseconds.
+         */
+        public long getLastDuration(@UidState int fromUidState, @UidState int toUidState,
+                @OpFlags int flags) {
+            return sumForFlagsInStates(mDurations, fromUidState, toUidState, flags);
+        }
+
+        /**
+         * Gets the UID of the app that performed the op on behalf of this app and
+         * as a result blamed the op on this app or {@link Process#INVALID_UID} if
+         * there is no proxy.
+         *
+         * @return The proxy UID.
+         */
         public int getProxyUid() {
-            return  mProxyUid;
+            return (int) findFirstNonNegativeForFlagsInStates(mDurations,
+                    MAX_PRIORITY_UID_STATE, MIN_PRIORITY_UID_STATE, OP_FLAGS_ALL);
         }
 
-        public String getProxyPackageName() {
-            return mProxyPackageName;
+        /**
+         * Gets the UID of the app that performed the op on behalf of this app and
+         * as a result blamed the op on this app or {@link Process#INVALID_UID} if
+         * there is no proxy.
+         *
+         * @param uidState The UID state for which to query. Could be one of
+         * {@link #UID_STATE_PERSISTENT}, {@link #UID_STATE_TOP},
+         * {@link #UID_STATE_FOREGROUND_SERVICE}, {@link #UID_STATE_FOREGROUND},
+         * {@link #UID_STATE_BACKGROUND}, {@link #UID_STATE_CACHED}.
+         * @param flags The flags which are any combination of
+         * {@link #OP_FLAG_SELF}, {@link #OP_FLAG_TRUSTED_PROXY},
+         * {@link #OP_FLAG_UNTRUSTED_PROXY}, {@link #OP_FLAG_TRUSTED_PROXIED},
+         * {@link #OP_FLAG_UNTRUSTED_PROXIED}. You can use {@link #OP_FLAGS_ALL}
+         * for any flag.
+         *
+         * @return The proxy UID.
+         */
+        public int getProxyUid(@UidState int uidState, @OpFlags int flags) {
+            return (int) findFirstNonNegativeForFlagsInStates(mDurations,
+                    uidState, uidState, flags);
+        }
+
+        /**
+         * Gets the package name of the app that performed the op on behalf of this
+         * app and as a result blamed the op on this app or {@code null}
+         * if there is no proxy.
+         *
+         * @return The proxy package name.
+         */
+        public @Nullable String getProxyPackageName() {
+            return findFirstNonNullForFlagsInStates(mProxyPackageNames, MAX_PRIORITY_UID_STATE,
+                    MIN_PRIORITY_UID_STATE, OP_FLAGS_ALL);
+        }
+
+        /**
+         * Gets the package name of the app that performed the op on behalf of this
+         * app and as a result blamed the op on this app for a UID state or
+         * {@code null} if there is no proxy.
+         *
+         * @param uidState The UID state for which to query. Could be one of
+         * {@link #UID_STATE_PERSISTENT}, {@link #UID_STATE_TOP},
+         * {@link #UID_STATE_FOREGROUND_SERVICE}, {@link #UID_STATE_FOREGROUND},
+         * {@link #UID_STATE_BACKGROUND}, {@link #UID_STATE_CACHED}.
+         * @param flags The flags which are any combination of
+         * {@link #OP_FLAG_SELF}, {@link #OP_FLAG_TRUSTED_PROXY},
+         * {@link #OP_FLAG_UNTRUSTED_PROXY}, {@link #OP_FLAG_TRUSTED_PROXIED},
+         * {@link #OP_FLAG_UNTRUSTED_PROXIED}. You can use {@link #OP_FLAGS_ALL}
+         * for any flag.
+         * @return The proxy package name.
+         */
+        public @Nullable String getProxyPackageName(@UidState int uidState, @OpFlags int flags) {
+            return findFirstNonNullForFlagsInStates(mProxyPackageNames, uidState, uidState, flags);
         }
 
         @Override
@@ -2173,26 +2676,26 @@
         public void writeToParcel(Parcel dest, int flags) {
             dest.writeInt(mOp);
             dest.writeInt(mMode);
-            dest.writeLongArray(mTimes);
-            dest.writeLongArray(mRejectTimes);
-            dest.writeInt(mDuration);
             dest.writeBoolean(mRunning);
-            dest.writeInt(mProxyUid);
-            dest.writeString(mProxyPackageName);
+            writeLongSparseLongArrayToParcel(mAccessTimes, dest);
+            writeLongSparseLongArrayToParcel(mRejectTimes, dest);
+            writeLongSparseLongArrayToParcel(mDurations, dest);
+            writeLongSparseLongArrayToParcel(mProxyUids, dest);
+            writeLongSparseStringArrayToParcel(mProxyPackageNames, dest);
         }
 
         OpEntry(Parcel source) {
             mOp = source.readInt();
             mMode = source.readInt();
-            mTimes = source.createLongArray();
-            mRejectTimes = source.createLongArray();
-            mDuration = source.readInt();
             mRunning = source.readBoolean();
-            mProxyUid = source.readInt();
-            mProxyPackageName = source.readString();
+            mAccessTimes = readLongSparseLongArrayFromParcel(source);
+            mRejectTimes = readLongSparseLongArrayFromParcel(source);
+            mDurations = readLongSparseLongArrayFromParcel(source);
+            mProxyUids = readLongSparseLongArrayFromParcel(source);
+            mProxyPackageNames = readLongSparseStringArrayFromParcel(source);
         }
 
-        public static final Creator<OpEntry> CREATOR = new Creator<OpEntry>() {
+        public static final @android.annotation.NonNull Creator<OpEntry> CREATOR = new Creator<OpEntry>() {
             @Override public OpEntry createFromParcel(Parcel source) {
                 return new OpEntry(source);
             }
@@ -2226,14 +2729,17 @@
         private final @Nullable List<String> mOpNames;
         private final long mBeginTimeMillis;
         private final long mEndTimeMillis;
+        private final @OpFlags int mFlags;
 
         private HistoricalOpsRequest(int uid, @Nullable String packageName,
-                @Nullable List<String> opNames, long beginTimeMillis, long endTimeMillis) {
+                @Nullable List<String> opNames, long beginTimeMillis, long endTimeMillis,
+                @OpFlags int flags) {
             mUid = uid;
             mPackageName = packageName;
             mOpNames = opNames;
             mBeginTimeMillis = beginTimeMillis;
             mEndTimeMillis = endTimeMillis;
+            mFlags = flags;
         }
 
         /**
@@ -2249,6 +2755,7 @@
             private @Nullable List<String> mOpNames;
             private final long mBeginTimeMillis;
             private final long mEndTimeMillis;
+            private @OpFlags int mFlags = OP_FLAGS_ALL;
 
             /**
              * Creates a new builder.
@@ -2311,11 +2818,28 @@
             }
 
             /**
+             * Sets the op flags to query for. The flags specify the type of
+             * op data being queried.
+             *
+             * @param flags The flags which are any combination of
+             * {@link #OP_FLAG_SELF}, {@link #OP_FLAG_TRUSTED_PROXY},
+             * {@link #OP_FLAG_UNTRUSTED_PROXY}, {@link #OP_FLAG_TRUSTED_PROXIED},
+             * {@link #OP_FLAG_UNTRUSTED_PROXIED}. You can use {@link #OP_FLAGS_ALL}
+             * for any flag.
+             * @return This builder.
+             */
+            public @NonNull Builder setFlags(@OpFlags int flags) {
+                Preconditions.checkFlagsArgument(flags, OP_FLAGS_ALL);
+                mFlags = flags;
+                return this;
+            }
+
+            /**
              * @return a new {@link HistoricalOpsRequest}.
              */
             public @NonNull HistoricalOpsRequest build() {
                 return new HistoricalOpsRequest(mUid, mPackageName, mOpNames,
-                        mBeginTimeMillis, mEndTimeMillis);
+                        mBeginTimeMillis, mEndTimeMillis, mFlags);
             }
         }
     }
@@ -2521,25 +3045,25 @@
         /** @hide */
         @TestApi
         public void increaseAccessCount(int opCode, int uid, @NonNull String packageName,
-                @UidState int uidState, long increment) {
+                @UidState int uidState,  @OpFlags int flags, long increment) {
             getOrCreateHistoricalUidOps(uid).increaseAccessCount(opCode,
-                    packageName, uidState, increment);
+                    packageName, uidState, flags, increment);
         }
 
         /** @hide */
         @TestApi
         public void increaseRejectCount(int opCode, int uid, @NonNull String packageName,
-                @UidState int uidState, long increment) {
+                @UidState int uidState, @OpFlags int flags, long increment) {
             getOrCreateHistoricalUidOps(uid).increaseRejectCount(opCode,
-                    packageName, uidState, increment);
+                    packageName, uidState, flags, increment);
         }
 
         /** @hide */
         @TestApi
         public void increaseAccessDuration(int opCode, int uid, @NonNull String packageName,
-                @UidState int uidState, long increment) {
+                @UidState int uidState, @OpFlags int flags, long increment) {
             getOrCreateHistoricalUidOps(uid).increaseAccessDuration(opCode,
-                    packageName, uidState, increment);
+                    packageName, uidState, flags, increment);
         }
 
         /** @hide */
@@ -2725,7 +3249,7 @@
                     + mBeginTimeMillis + " to:" + mEndTimeMillis + "]";
         }
 
-        public static final Creator<HistoricalOps> CREATOR = new Creator<HistoricalOps>() {
+        public static final @android.annotation.NonNull Creator<HistoricalOps> CREATOR = new Creator<HistoricalOps>() {
             @Override
             public @NonNull HistoricalOps createFromParcel(@NonNull Parcel parcel) {
                 return new HistoricalOps(parcel);
@@ -2834,21 +3358,21 @@
         }
 
         private void increaseAccessCount(int opCode, @NonNull String packageName,
-                @UidState int uidState, long increment) {
+                @UidState int uidState, @OpFlags int flags, long increment) {
             getOrCreateHistoricalPackageOps(packageName).increaseAccessCount(
-                    opCode, uidState, increment);
+                    opCode, uidState, flags, increment);
         }
 
         private void increaseRejectCount(int opCode, @NonNull String packageName,
-                @UidState int uidState, long increment) {
+                @UidState int uidState,  @OpFlags int flags, long increment) {
             getOrCreateHistoricalPackageOps(packageName).increaseRejectCount(
-                    opCode, uidState, increment);
+                    opCode, uidState, flags, increment);
         }
 
         private void increaseAccessDuration(int opCode, @NonNull String packageName,
-                @UidState int uidState, long increment) {
+                @UidState int uidState, @OpFlags int flags, long increment) {
             getOrCreateHistoricalPackageOps(packageName).increaseAccessDuration(
-                    opCode, uidState, increment);
+                    opCode, uidState, flags, increment);
         }
 
         /**
@@ -2935,7 +3459,7 @@
         }
 
 
-        public static final Creator<HistoricalUidOps> CREATOR = new Creator<HistoricalUidOps>() {
+        public static final @android.annotation.NonNull Creator<HistoricalUidOps> CREATOR = new Creator<HistoricalUidOps>() {
             @Override
             public @NonNull HistoricalUidOps createFromParcel(@NonNull Parcel parcel) {
                 return new HistoricalUidOps(parcel);
@@ -3070,16 +3594,19 @@
             return true;
         }
 
-        private void increaseAccessCount(int opCode, @UidState int uidState, long increment) {
-            getOrCreateHistoricalOp(opCode).increaseAccessCount(uidState, increment);
+        private void increaseAccessCount(int opCode, @UidState int uidState,
+                @OpFlags int flags, long increment) {
+            getOrCreateHistoricalOp(opCode).increaseAccessCount(uidState, flags, increment);
         }
 
-        private void increaseRejectCount(int opCode, @UidState int uidState, long increment) {
-            getOrCreateHistoricalOp(opCode).increaseRejectCount(uidState, increment);
+        private void increaseRejectCount(int opCode, @UidState int uidState,
+                @OpFlags int flags, long increment) {
+            getOrCreateHistoricalOp(opCode).increaseRejectCount(uidState, flags, increment);
         }
 
-        private void increaseAccessDuration(int opCode, @UidState int uidState, long increment) {
-            getOrCreateHistoricalOp(opCode).increaseAccessDuration(uidState, increment);
+        private void increaseAccessDuration(int opCode, @UidState int uidState,
+                @OpFlags int flags, long increment) {
+            getOrCreateHistoricalOp(opCode).increaseAccessDuration(uidState, flags, increment);
         }
 
         /**
@@ -3095,7 +3622,6 @@
          * Gets number historical app ops.
          *
          * @return The number historical app ops.
-         *
          * @see #getOpAt(int)
          */
         public int getOpCount() {
@@ -3109,9 +3635,7 @@
          * Gets the historical op at a given index.
          *
          * @param index The index to lookup.
-         *
          * @return The op at the given index.
-         *
          * @see #getOpCount()
          */
         public @NonNull HistoricalOp getOpAt(int index) {
@@ -3125,7 +3649,6 @@
          * Gets the historical entry for a given op name.
          *
          * @param opName The op name.
-         *
          * @return The historical entry for that op name.
          */
         public @Nullable HistoricalOp getOp(@NonNull String opName) {
@@ -3167,7 +3690,7 @@
             return op;
         }
 
-        public static final Creator<HistoricalPackageOps> CREATOR =
+        public static final @android.annotation.NonNull Creator<HistoricalPackageOps> CREATOR =
                 new Creator<HistoricalPackageOps>() {
             @Override
             public @NonNull HistoricalPackageOps createFromParcel(@NonNull Parcel parcel) {
@@ -3219,39 +3742,33 @@
     @SystemApi
     public static final class HistoricalOp implements Parcelable {
         private final int mOp;
-        private @Nullable long[] mAccessCount;
-        private @Nullable long[] mRejectCount;
-        private @Nullable long[] mAccessDuration;
+        private @Nullable LongSparseLongArray mAccessCount;
+        private @Nullable LongSparseLongArray mRejectCount;
+        private @Nullable LongSparseLongArray mAccessDuration;
 
         /** @hide */
         public HistoricalOp(int op) {
             mOp = op;
-            mAccessCount = new long[_NUM_UID_STATE];
-            mRejectCount = new long[_NUM_UID_STATE];
-            mAccessDuration = new long[_NUM_UID_STATE];
         }
 
         private HistoricalOp(@NonNull HistoricalOp other) {
             mOp = other.mOp;
             if (other.mAccessCount != null) {
-                System.arraycopy(other.mAccessCount, 0, getOrCreateAccessCount(),
-                        0, other.mAccessCount.length);
+                mAccessCount = other.mAccessCount.clone();
             }
             if (other.mRejectCount != null) {
-                System.arraycopy(other.mRejectCount, 0, getOrCreateRejectCount(),
-                        0, other.mRejectCount.length);
+                mRejectCount = other.mRejectCount.clone();
             }
             if (other.mAccessDuration != null) {
-                System.arraycopy(other.mAccessDuration, 0, getOrCreateAccessDuration(),
-                        0, other.mAccessDuration.length);
+                mAccessDuration = other.mAccessDuration.clone();
             }
         }
 
         private HistoricalOp(@NonNull Parcel parcel) {
             mOp = parcel.readInt();
-            mAccessCount = parcel.createLongArray();
-            mRejectCount = parcel.createLongArray();
-            mAccessDuration = parcel.createLongArray();
+            mAccessCount = readLongSparseLongArrayFromParcel(parcel);
+            mRejectCount = readLongSparseLongArrayFromParcel(parcel);
+            mAccessDuration = readLongSparseLongArrayFromParcel(parcel);
         }
 
         private void filter(double scaleFactor) {
@@ -3266,90 +3783,64 @@
                     && !hasData(mAccessDuration);
         }
 
-        private boolean hasData(@NonNull long[] array) {
-            for (long value : array) {
-                if (value != 0) {
-                    return true;
-                }
-            }
-            return false;
+        private boolean hasData(@NonNull LongSparseLongArray array) {
+            return (array != null && array.size() > 0);
         }
 
         private @Nullable HistoricalOp splice(double fractionToRemove) {
-            HistoricalOp splice = null;
-            if (mAccessCount != null) {
-                for (int i = 0; i < _NUM_UID_STATE; i++) {
-                    final long spliceAccessCount = Math.round(
-                            mAccessCount[i] * fractionToRemove);
-                    if (spliceAccessCount > 0) {
-                        if (splice == null) {
-                            splice = new HistoricalOp(mOp);
-                        }
-                        splice.getOrCreateAccessCount()[i] = spliceAccessCount;
-                        mAccessCount[i] -= spliceAccessCount;
-                    }
-                }
-            }
-
-            if (mRejectCount != null) {
-                for (int i = 0; i < _NUM_UID_STATE; i++) {
-                    final long spliceRejectCount = Math.round(
-                            mRejectCount[i] * fractionToRemove);
-
-                    if (spliceRejectCount > 0) {
-                        if (splice == null) {
-                            splice = new HistoricalOp(mOp);
-                        }
-                        splice.getOrCreateRejectCount()[i] = spliceRejectCount;
-                        mRejectCount[i] -= spliceRejectCount;
-                    }
-                }
-            }
-
-            if (mAccessDuration != null) {
-                for (int i = 0; i < _NUM_UID_STATE; i++) {
-                    final long spliceAccessDuration =  Math.round(
-                            mAccessDuration[i] * fractionToRemove);
-                    if (spliceAccessDuration > 0) {
-                        if (splice == null) {
-                            splice = new HistoricalOp(mOp);
-                        }
-                        splice.getOrCreateAccessDuration()[i] = spliceAccessDuration;
-                        mAccessDuration[i] -= spliceAccessDuration;
-                    }
-                }
-            }
+            final HistoricalOp splice = new HistoricalOp(mOp);
+            splice(mAccessCount, splice::getOrCreateAccessCount, fractionToRemove);
+            splice(mRejectCount, splice::getOrCreateRejectCount, fractionToRemove);
+            splice(mAccessDuration, splice::getOrCreateAccessDuration, fractionToRemove);
             return splice;
         }
 
+        private static void splice(@Nullable LongSparseLongArray sourceContainer,
+                @NonNull Supplier<LongSparseLongArray> destContainerProvider,
+                    double fractionToRemove) {
+            if (sourceContainer != null) {
+                final int size = sourceContainer.size();
+                for (int i = 0; i < size; i++) {
+                    final long key = sourceContainer.keyAt(i);
+                    final long value = sourceContainer.valueAt(i);
+                    final long removedFraction = Math.round(value * fractionToRemove);
+                    if (removedFraction > 0) {
+                        destContainerProvider.get().put(key, removedFraction);
+                        sourceContainer.put(key, value - removedFraction);
+                    }
+                }
+            }
+        }
+
         private void merge(@NonNull HistoricalOp other) {
-            if (other.mAccessCount != null) {
-                for (int i = 0; i < _NUM_UID_STATE; i++) {
-                    getOrCreateAccessCount()[i] += other.mAccessCount[i];
-                }
-            }
-            if (other.mRejectCount != null) {
-                for (int i = 0; i < _NUM_UID_STATE; i++) {
-                    getOrCreateRejectCount()[i] += other.mRejectCount[i];
-                }
-            }
-            if (other.mAccessDuration != null) {
-                for (int i = 0; i < _NUM_UID_STATE; i++) {
-                    getOrCreateAccessDuration()[i] += other.mAccessDuration[i];
-                }
-            }
+            merge(this::getOrCreateAccessCount, other.mAccessCount);
+            merge(this::getOrCreateRejectCount, other.mRejectCount);
+            merge(this::getOrCreateAccessDuration, other.mAccessDuration);
         }
 
-        private void increaseAccessCount(@UidState int uidState, long increment) {
-            getOrCreateAccessCount()[uidState] += increment;
+        private void increaseAccessCount(@UidState int uidState, @OpFlags int flags,
+                long increment) {
+            increaseCount(getOrCreateAccessCount(), uidState, flags, increment);
         }
 
-        private void increaseRejectCount(@UidState int uidState, long increment) {
-            getOrCreateRejectCount()[uidState] += increment;
+        private void increaseRejectCount(@UidState int uidState, @OpFlags int flags,
+                long increment) {
+            increaseCount(getOrCreateRejectCount(), uidState, flags, increment);
         }
 
-        private void increaseAccessDuration(@UidState int uidState, long increment) {
-            getOrCreateAccessDuration()[uidState] += increment;
+        private void increaseAccessDuration(@UidState int uidState, @OpFlags int flags,
+                long increment) {
+            increaseCount(getOrCreateAccessDuration(), uidState, flags, increment);
+        }
+
+        private void increaseCount(@NonNull LongSparseLongArray counts,
+                @UidState int uidState, @OpFlags int flags, long increment) {
+            while (flags != 0) {
+                final int flag = 1 << Integer.numberOfTrailingZeros(flags);
+                flags &= ~flag;
+                final long key = makeKey(uidState, flag);
+                counts.put(key, counts.get(key) + increment);
+            }
         }
 
         /**
@@ -3369,154 +3860,186 @@
         /**
          * Gets the number times the op was accessed (performed) in the foreground.
          *
+         * @param flags The flags which are any combination of
+         * {@link #OP_FLAG_SELF}, {@link #OP_FLAG_TRUSTED_PROXY},
+         * {@link #OP_FLAG_UNTRUSTED_PROXY}, {@link #OP_FLAG_TRUSTED_PROXIED},
+         * {@link #OP_FLAG_UNTRUSTED_PROXIED}. You can use {@link #OP_FLAGS_ALL}
+         * for any flag.
          * @return The times the op was accessed in the foreground.
          *
-         * @see #getBackgroundAccessCount()
-         * @see #getAccessCount(int)
+         * @see #getBackgroundAccessCount(int)
+         * @see #getAccessCount(int, int, int)
          */
-        public long getForegroundAccessCount() {
-            if (mAccessCount == null) {
-                return 0;
-            }
-            return sum(mAccessCount, UID_STATE_PERSISTENT, UID_STATE_LAST_NON_RESTRICTED + 1);
+        public long getForegroundAccessCount(@OpFlags int flags) {
+            return sumForFlagsInStates(mAccessCount, MAX_PRIORITY_UID_STATE,
+                    resolveFirstUnrestrictedUidState(mOp), flags);
         }
 
         /**
          * Gets the number times the op was accessed (performed) in the background.
          *
+         * @param flags The flags which are any combination of
+         * {@link #OP_FLAG_SELF}, {@link #OP_FLAG_TRUSTED_PROXY},
+         * {@link #OP_FLAG_UNTRUSTED_PROXY}, {@link #OP_FLAG_TRUSTED_PROXIED},
+         * {@link #OP_FLAG_UNTRUSTED_PROXIED}. You can use {@link #OP_FLAGS_ALL}
+         * for any flag.
          * @return The times the op was accessed in the background.
          *
-         * @see #getForegroundAccessCount()
-         * @see #getAccessCount(int)
+         * @see #getForegroundAccessCount(int)
+         * @see #getAccessCount(int, int, int)
          */
-        public long getBackgroundAccessCount() {
-            if (mAccessCount == null) {
-                return 0;
-            }
-            return sum(mAccessCount, UID_STATE_LAST_NON_RESTRICTED + 1, _NUM_UID_STATE);
+        public long getBackgroundAccessCount(@OpFlags int flags) {
+            return sumForFlagsInStates(mAccessCount, resolveLastRestrictedUidState(mOp),
+                    MIN_PRIORITY_UID_STATE, flags);
         }
 
         /**
-         * Gets the number times the op was accessed (performed) for a given uid state.
+         * Gets the number times the op was accessed (performed) for a
+         * range of uid states.
          *
-         * @param uidState The UID state for which to query. Could be one of
+         * @param fromUidState The UID state from which to query. Could be one of
          * {@link #UID_STATE_PERSISTENT}, {@link #UID_STATE_TOP},
          * {@link #UID_STATE_FOREGROUND_SERVICE_LOCATION},
          * {@link #UID_STATE_FOREGROUND_SERVICE}, {@link #UID_STATE_FOREGROUND},
          * {@link #UID_STATE_BACKGROUND}, {@link #UID_STATE_CACHED}.
+         * @param toUidState The UID state to which to query.
+         * @param flags The flags which are any combination of
+         * {@link #OP_FLAG_SELF}, {@link #OP_FLAG_TRUSTED_PROXY},
+         * {@link #OP_FLAG_UNTRUSTED_PROXY}, {@link #OP_FLAG_TRUSTED_PROXIED},
+         * {@link #OP_FLAG_UNTRUSTED_PROXIED}. You can use {@link #OP_FLAGS_ALL}
+         * for any flag.
          *
          * @return The times the op was accessed for the given UID state.
          *
-         * @see #getForegroundAccessCount()
-         * @see #getBackgroundAccessCount()
+         * @see #getForegroundAccessCount(int)
+         * @see #getBackgroundAccessCount(int)
          */
-        public long getAccessCount(@UidState int uidState) {
-            if (mAccessCount == null) {
-                return 0;
-            }
-            return mAccessCount[uidState];
+        public long getAccessCount(@UidState int fromUidState, @UidState int toUidState,
+                @OpFlags int flags) {
+            return sumForFlagsInStates(mAccessCount, fromUidState, toUidState, flags);
         }
 
         /**
          * Gets the number times the op was rejected in the foreground.
          *
+         * @param flags The flags which are any combination of
+         * {@link #OP_FLAG_SELF}, {@link #OP_FLAG_TRUSTED_PROXY},
+         * {@link #OP_FLAG_UNTRUSTED_PROXY}, {@link #OP_FLAG_TRUSTED_PROXIED},
+         * {@link #OP_FLAG_UNTRUSTED_PROXIED}. You can use {@link #OP_FLAGS_ALL}
+         * for any flag.
          * @return The times the op was rejected in the foreground.
          *
-         * @see #getBackgroundRejectCount()
-         * @see #getRejectCount(int)
+         * @see #getBackgroundRejectCount(int)
+         * @see #getRejectCount(int, int, int)
          */
-        public long getForegroundRejectCount() {
-            if (mRejectCount == null) {
-                return 0;
-            }
-            return sum(mRejectCount, UID_STATE_PERSISTENT, UID_STATE_LAST_NON_RESTRICTED + 1);
+        public long getForegroundRejectCount(@OpFlags int flags) {
+            return sumForFlagsInStates(mRejectCount, MAX_PRIORITY_UID_STATE,
+                    resolveFirstUnrestrictedUidState(mOp), flags);
         }
 
         /**
          * Gets the number times the op was rejected in the background.
          *
+         * @param flags The flags which are any combination of
+         * {@link #OP_FLAG_SELF}, {@link #OP_FLAG_TRUSTED_PROXY},
+         * {@link #OP_FLAG_UNTRUSTED_PROXY}, {@link #OP_FLAG_TRUSTED_PROXIED},
+         * {@link #OP_FLAG_UNTRUSTED_PROXIED}. You can use {@link #OP_FLAGS_ALL}
+         * for any flag.
          * @return The times the op was rejected in the background.
          *
-         * @see #getForegroundRejectCount()
-         * @see #getRejectCount(int)
+         * @see #getForegroundRejectCount(int)
+         * @see #getRejectCount(int, int, int)
          */
-        public long getBackgroundRejectCount() {
-            if (mRejectCount == null) {
-                return 0;
-            }
-            return sum(mRejectCount, UID_STATE_LAST_NON_RESTRICTED + 1, _NUM_UID_STATE);
+        public long getBackgroundRejectCount(@OpFlags int flags) {
+            return sumForFlagsInStates(mRejectCount, resolveLastRestrictedUidState(mOp),
+                    MIN_PRIORITY_UID_STATE, flags);
         }
 
         /**
-         * Gets the number times the op was rejected for a given uid state.
+         * Gets the number times the op was rejected for a given range of UID states.
          *
-         * @param uidState The UID state for which to query. Could be one of
+         * @param fromUidState The UID state from which to query. Could be one of
          * {@link #UID_STATE_PERSISTENT}, {@link #UID_STATE_TOP},
          * {@link #UID_STATE_FOREGROUND_SERVICE_LOCATION},
          * {@link #UID_STATE_FOREGROUND_SERVICE}, {@link #UID_STATE_FOREGROUND},
          * {@link #UID_STATE_BACKGROUND}, {@link #UID_STATE_CACHED}.
+         * @param toUidState The UID state to which to query.
+         * @param flags The flags which are any combination of
+         * {@link #OP_FLAG_SELF}, {@link #OP_FLAG_TRUSTED_PROXY},
+         * {@link #OP_FLAG_UNTRUSTED_PROXY}, {@link #OP_FLAG_TRUSTED_PROXIED},
+         * {@link #OP_FLAG_UNTRUSTED_PROXIED}. You can use {@link #OP_FLAGS_ALL}
+         * for any flag.
          *
          * @return The times the op was rejected for the given UID state.
          *
-         * @see #getForegroundRejectCount()
-         * @see #getBackgroundRejectCount()
+         * @see #getForegroundRejectCount(int)
+         * @see #getBackgroundRejectCount(int)
          */
-        public long getRejectCount(@UidState int uidState) {
-            if (mRejectCount == null) {
-                return 0;
-            }
-            return mRejectCount[uidState];
+        public long getRejectCount(@UidState int fromUidState, @UidState int toUidState,
+                @OpFlags int flags) {
+            return sumForFlagsInStates(mRejectCount, fromUidState, toUidState, flags);
         }
 
         /**
          * Gets the total duration the app op was accessed (performed) in the foreground.
          *
+         * @param flags The flags which are any combination of
+         * {@link #OP_FLAG_SELF}, {@link #OP_FLAG_TRUSTED_PROXY},
+         * {@link #OP_FLAG_UNTRUSTED_PROXY}, {@link #OP_FLAG_TRUSTED_PROXIED},
+         * {@link #OP_FLAG_UNTRUSTED_PROXIED}. You can use {@link #OP_FLAGS_ALL}
+         * for any flag.
          * @return The total duration the app op was accessed in the foreground.
          *
-         * @see #getBackgroundAccessDuration()
-         * @see #getAccessDuration(int)
+         * @see #getBackgroundAccessDuration(int)
+         * @see #getAccessDuration(int, int, int)
          */
-        public long getForegroundAccessDuration() {
-            if (mAccessDuration == null) {
-                return 0;
-            }
-            return sum(mAccessDuration, UID_STATE_PERSISTENT, UID_STATE_LAST_NON_RESTRICTED + 1);
+        public long getForegroundAccessDuration(@OpFlags int flags) {
+            return sumForFlagsInStates(mAccessDuration, MAX_PRIORITY_UID_STATE,
+                    resolveFirstUnrestrictedUidState(mOp), flags);
         }
 
         /**
          * Gets the total duration the app op was accessed (performed) in the background.
          *
+         * @param flags The flags which are any combination of
+         * {@link #OP_FLAG_SELF}, {@link #OP_FLAG_TRUSTED_PROXY},
+         * {@link #OP_FLAG_UNTRUSTED_PROXY}, {@link #OP_FLAG_TRUSTED_PROXIED},
+         * {@link #OP_FLAG_UNTRUSTED_PROXIED}. You can use {@link #OP_FLAGS_ALL}
+         * for any flag.
          * @return The total duration the app op was accessed in the background.
          *
-         * @see #getForegroundAccessDuration()
-         * @see #getAccessDuration(int)
+         * @see #getForegroundAccessDuration(int)
+         * @see #getAccessDuration(int, int, int)
          */
-        public long getBackgroundAccessDuration() {
-            if (mAccessDuration == null) {
-                return 0;
-            }
-            return sum(mAccessDuration, UID_STATE_LAST_NON_RESTRICTED + 1, _NUM_UID_STATE);
+        public long getBackgroundAccessDuration(@OpFlags int flags) {
+            return sumForFlagsInStates(mAccessDuration, resolveLastRestrictedUidState(mOp),
+                    MIN_PRIORITY_UID_STATE, flags);
         }
 
         /**
-         * Gets the total duration the app op was accessed (performed) for a given UID state.
+         * Gets the total duration the app op was accessed (performed) for a given
+         * range of UID states.
          *
-         * @param uidState The UID state for which to query. Could be one of
+         * @param fromUidState The UID state from which to query. Could be one of
          * {@link #UID_STATE_PERSISTENT}, {@link #UID_STATE_TOP},
          * {@link #UID_STATE_FOREGROUND_SERVICE_LOCATION},
          * {@link #UID_STATE_FOREGROUND_SERVICE}, {@link #UID_STATE_FOREGROUND},
          * {@link #UID_STATE_BACKGROUND}, {@link #UID_STATE_CACHED}.
+         * @param toUidState The UID state from which to query.
+         * @param flags The flags which are any combination of
+         * {@link #OP_FLAG_SELF}, {@link #OP_FLAG_TRUSTED_PROXY},
+         * {@link #OP_FLAG_UNTRUSTED_PROXY}, {@link #OP_FLAG_TRUSTED_PROXIED},
+         * {@link #OP_FLAG_UNTRUSTED_PROXIED}. You can use {@link #OP_FLAGS_ALL}
+         * for any flag.
          *
          * @return The total duration the app op was accessed for the given UID state.
          *
-         * @see #getForegroundAccessDuration()
-         * @see #getBackgroundAccessDuration()
+         * @see #getForegroundAccessDuration(int)
+         * @see #getBackgroundAccessDuration(int)
          */
-        public long getAccessDuration(@UidState int uidState) {
-            if (mAccessDuration == null) {
-                return 0;
-            }
-            return mAccessDuration[uidState];
+        public long getAccessDuration(@UidState int fromUidState, @UidState int toUidState,
+                @OpFlags int flags) {
+            return sumForFlagsInStates(mAccessDuration, fromUidState, toUidState, flags);
         }
 
         @Override
@@ -3527,80 +4050,11 @@
         @Override
         public void writeToParcel(Parcel parcel, int flags) {
             parcel.writeInt(mOp);
-            parcel.writeLongArray(mAccessCount);
-            parcel.writeLongArray(mRejectCount);
-            parcel.writeLongArray(mAccessDuration);
+            writeLongSparseLongArrayToParcel(mAccessCount, parcel);
+            writeLongSparseLongArrayToParcel(mRejectCount, parcel);
+            writeLongSparseLongArrayToParcel(mAccessDuration, parcel);
         }
 
-        private void accept(@NonNull HistoricalOpsVisitor visitor) {
-            visitor.visitHistoricalOp(this);
-        }
-
-        private @NonNull long[] getOrCreateAccessCount() {
-            if (mAccessCount == null) {
-                mAccessCount = new long[_NUM_UID_STATE];
-            }
-            return mAccessCount;
-        }
-
-        private @NonNull long[] getOrCreateRejectCount() {
-            if (mRejectCount == null) {
-                mRejectCount = new long[_NUM_UID_STATE];
-            }
-            return mRejectCount;
-        }
-
-        private @NonNull long[] getOrCreateAccessDuration() {
-            if (mAccessDuration == null) {
-                mAccessDuration = new long[_NUM_UID_STATE];
-            }
-            return mAccessDuration;
-        }
-
-        /**
-         *
-         * Computes the sum given the start and end index.
-         *
-         * @param counts The data array.
-         * @param start The start index (inclusive)
-         * @param end The end index (exclusive)
-         * @return The sum.
-         */
-        private static long sum(@NonNull long[] counts, int start, int end) {
-            long totalCount = 0;
-            for (int i = start; i < end; i++) {
-                totalCount += counts[i];
-            }
-            return totalCount;
-        }
-
-        /**
-         * Multiplies the entries in the array with the passed in scale factor and
-         * rounds the result at up 0.5 boundary.
-         *
-         * @param data The data to scale.
-         * @param scaleFactor The scale factor.
-         */
-        private static void scale(@NonNull long[] data, double scaleFactor) {
-            if (data != null) {
-                for (int i = 0; i < _NUM_UID_STATE; i++) {
-                    data[i] = (long) HistoricalOps.round((double) data[i] * scaleFactor);
-                }
-            }
-        }
-
-        public static final Creator<HistoricalOp> CREATOR = new Creator<HistoricalOp>() {
-            @Override
-            public @NonNull HistoricalOp createFromParcel(@NonNull Parcel source) {
-                return new HistoricalOp(source);
-            }
-
-            @Override
-            public @NonNull HistoricalOp[] newArray(int size) {
-                return new HistoricalOp[size];
-            }
-        };
-
         @Override
         public boolean equals(Object obj) {
             if (this == obj) {
@@ -3613,23 +4067,201 @@
             if (mOp != other.mOp) {
                 return false;
             }
-            if (!Arrays.equals(mAccessCount, other.mAccessCount)) {
+            if (!Objects.equals(mAccessCount, other.mAccessCount)) {
                 return false;
             }
-            if (!Arrays.equals(mRejectCount, other.mRejectCount)) {
+            if (!Objects.equals(mRejectCount, other.mRejectCount)) {
                 return false;
             }
-            return Arrays.equals(mAccessDuration, other.mAccessDuration);
+            return Objects.equals(mAccessDuration, other.mAccessDuration);
         }
 
         @Override
         public int hashCode() {
             int result = mOp;
-            result = 31 * result + Arrays.hashCode(mAccessCount);
-            result = 31 * result + Arrays.hashCode(mRejectCount);
-            result = 31 * result + Arrays.hashCode(mAccessDuration);
+            result = 31 * result + Objects.hashCode(mAccessCount);
+            result = 31 * result + Objects.hashCode(mRejectCount);
+            result = 31 * result + Objects.hashCode(mAccessDuration);
             return result;
         }
+
+        private void accept(@NonNull HistoricalOpsVisitor visitor) {
+            visitor.visitHistoricalOp(this);
+        }
+
+        private @NonNull LongSparseLongArray getOrCreateAccessCount() {
+            if (mAccessCount == null) {
+                mAccessCount = new LongSparseLongArray();
+            }
+            return mAccessCount;
+        }
+
+        private @NonNull LongSparseLongArray getOrCreateRejectCount() {
+            if (mRejectCount == null) {
+                mRejectCount = new LongSparseLongArray();
+            }
+            return mRejectCount;
+        }
+
+        private @NonNull LongSparseLongArray getOrCreateAccessDuration() {
+            if (mAccessDuration == null) {
+                mAccessDuration = new LongSparseLongArray();
+            }
+            return mAccessDuration;
+        }
+
+        /**
+         * Multiplies the entries in the array with the passed in scale factor and
+         * rounds the result at up 0.5 boundary.
+         *
+         * @param data The data to scale.
+         * @param scaleFactor The scale factor.
+         */
+        private static void scale(@NonNull LongSparseLongArray data, double scaleFactor) {
+            if (data != null) {
+                final int size = data.size();
+                for (int i = 0; i < size; i++) {
+                    data.put(data.keyAt(i), (long) HistoricalOps.round(
+                            (double) data.valueAt(i) * scaleFactor));
+                }
+            }
+        }
+
+        /**
+         * Merges two arrays while lazily acquiring the destination.
+         *
+         * @param thisSupplier The destination supplier.
+         * @param other The array to merge in.
+         */
+        private static void merge(@NonNull Supplier<LongSparseLongArray> thisSupplier,
+                @Nullable LongSparseLongArray other) {
+            if (other != null) {
+                final int otherSize = other.size();
+                for (int i = 0; i < otherSize; i++) {
+                    final LongSparseLongArray that = thisSupplier.get();
+                    final long otherKey = other.keyAt(i);
+                    final long otherValue = other.valueAt(i);
+                    that.put(otherKey, that.get(otherKey) + otherValue);
+                }
+            }
+        }
+
+        /** @hide */
+        public @Nullable LongSparseArray<Object> collectKeys() {
+            LongSparseArray<Object> result = AppOpsManager.collectKeys(mAccessCount,
+                null /*result*/);
+            result = AppOpsManager.collectKeys(mRejectCount, result);
+            result = AppOpsManager.collectKeys(mAccessDuration, result);
+            return result;
+        }
+
+        public static final @android.annotation.NonNull Creator<HistoricalOp> CREATOR =
+                new Creator<HistoricalOp>() {
+            @Override
+            public @NonNull HistoricalOp createFromParcel(@NonNull Parcel source) {
+                return new HistoricalOp(source);
+            }
+
+            @Override
+            public @NonNull HistoricalOp[] newArray(int size) {
+                return new HistoricalOp[size];
+            }
+        };
+    }
+
+    /**
+     * Computes the sum of the counts for the given flags in between the begin and
+     * end UID states.
+     *
+     * @param counts The data array.
+     * @param beginUidState The beginning UID state (exclusive).
+     * @param endUidState The end UID state.
+     * @param flags The UID flags.
+     * @return The sum.
+     */
+    private static long sumForFlagsInStates(@Nullable LongSparseLongArray counts,
+            @UidState int beginUidState, @UidState int endUidState, @OpFlags int flags) {
+        if (counts == null) {
+            return 0;
+        }
+        long sum = 0;
+        while (flags != 0) {
+            final int flag = 1 << Integer.numberOfTrailingZeros(flags);
+            flags &= ~flag;
+            for (int uidState : UID_STATES) {
+                if (uidState < beginUidState || uidState > endUidState) {
+                    continue;
+                }
+                final long key = makeKey(uidState, flag);
+                sum += counts.get(key);
+            }
+        }
+        return sum;
+    }
+
+    /**
+     * Finds the first non-negative value for the given flags in between the begin and
+     * end UID states.
+     *
+     * @param counts The data array.
+     * @param flags The UID flags.
+     * @param beginUidState The beginning UID state (exclusive).
+     * @param endUidState The end UID state.
+     * @return The non-negative value or -1.
+     */
+    private static long findFirstNonNegativeForFlagsInStates(@Nullable LongSparseLongArray counts,
+            @OpFlags int flags, @UidState int beginUidState, @UidState int endUidState) {
+        if (counts == null) {
+            return -1;
+        }
+        while (flags != 0) {
+            final int flag = 1 << Integer.numberOfTrailingZeros(flags);
+            flags &= ~flag;
+            for (int uidState : UID_STATES) {
+                if (uidState < beginUidState || uidState > endUidState) {
+                    continue;
+                }
+                final long key = makeKey(uidState, flag);
+                final long value = counts.get(key);
+                if (value >= 0) {
+                    return value;
+                }
+            }
+        }
+        return -1;
+    }
+
+    /**
+     * Finds the first non-null value for the given flags in between the begin and
+     * end UID states.
+     *
+     * @param counts The data array.
+     * @param flags The UID flags.
+     * @param beginUidState The beginning UID state (exclusive).
+     * @param endUidState The end UID state.
+     * @return The non-negative value or -1.
+     */
+    private static @Nullable String findFirstNonNullForFlagsInStates(
+            @Nullable LongSparseArray<String> counts, @OpFlags int flags,
+            @UidState int beginUidState, @UidState int endUidState) {
+        if (counts == null) {
+            return null;
+        }
+        while (flags != 0) {
+            final int flag = 1 << Integer.numberOfTrailingZeros(flags);
+            flags &= ~flag;
+            for (int uidState : UID_STATES) {
+                if (uidState < beginUidState || uidState > endUidState) {
+                    continue;
+                }
+                final long key = makeKey(uidState, flag);
+                final String value = counts.get(key);
+                if (value != null) {
+                    return value;
+                }
+            }
+        }
+        return null;
     }
 
     /**
@@ -3800,7 +4432,7 @@
         Preconditions.checkNotNull(callback, "callback cannot be null");
         try {
             mService.getHistoricalOps(request.mUid, request.mPackageName, request.mOpNames,
-                    request.mBeginTimeMillis, request.mEndTimeMillis,
+                    request.mBeginTimeMillis, request.mEndTimeMillis, request.mFlags,
                     new RemoteCallback((result) -> {
                 final HistoricalOps ops = result.getParcelable(KEY_HISTORICAL_OPS);
                 final long identity = Binder.clearCallingIdentity();
@@ -3840,7 +4472,7 @@
         try {
             mService.getHistoricalOpsFromDiskRaw(request.mUid, request.mPackageName,
                     request.mOpNames, request.mBeginTimeMillis, request.mEndTimeMillis,
-                    new RemoteCallback((result) -> {
+                    request.mFlags, new RemoteCallback((result) -> {
                 final HistoricalOps ops = result.getParcelable(KEY_HISTORICAL_OPS);
                 final long identity = Binder.clearCallingIdentity();
                 try {
@@ -4310,7 +4942,20 @@
      * Like {@link #checkOp} but returns the <em>raw</em> mode associated with the op.
      * Does not throw a security exception, does not translate {@link #MODE_FOREGROUND}.
      */
-    public int unsafeCheckOpRaw(String op, int uid, String packageName) {
+    public int unsafeCheckOpRaw(@NonNull String op, int uid, String packageName) {
+        try {
+            return mService.checkOperationRaw(strOpToOp(op), uid, packageName);
+        } catch (RemoteException e) {
+            throw e.rethrowFromSystemServer();
+        }
+    }
+
+    /**
+     * Like {@link #unsafeCheckOpNoThrow(String, int, String)} but returns the <em>raw</em>
+     * mode associated with the op. Does not throw a security exception, does not translate
+     * {@link #MODE_FOREGROUND}.
+     */
+    public int unsafeCheckOpRawNoThrow(@NonNull String op, int uid, @NonNull String packageName) {
         try {
             return mService.checkOperationRaw(strOpToOp(op), uid, packageName);
         } catch (RemoteException e) {
@@ -4375,8 +5020,7 @@
     }
 
     /**
-     * Like {@link #noteProxyOp(String, String)} but instead
-     * of throwing a {@link SecurityException} it returns {@link #MODE_ERRORED}.
+     * Like {@link #noteProxyOpNoThrow(String, String)} but allows to specify the proxied uid.
      *
      * <p>This API requires package with the {@code proxiedPackageName} to belong to
      * {@code proxiedUid}.
@@ -4385,10 +5029,7 @@
      * @param proxiedPackageName The package to note the op for or {@code null} if the op should be
      *                           noted for the "android" package
      * @param proxiedUid The uid the package belongs to
-     *
-     * @hide
      */
-    @SystemApi
     public int noteProxyOpNoThrow(@NonNull String op, @Nullable String proxiedPackageName,
             int proxiedUid) {
         return noteProxyOpNoThrow(strOpToOp(op), proxiedPackageName, proxiedUid);
@@ -4903,16 +5544,110 @@
     }
 
     /**
-     * @hide
+     * Computes the max for the given flags in between the begin and
+     * end UID states.
+     *
+     * @param counts The data array.
+     * @param flags The UID flags.
+     * @param beginUidState The beginning UID state (exclusive).
+     * @param endUidState The end UID state.
+     * @return The sum.
      */
-    public static long maxTime(long[] times, int start, int end) {
-        long time = 0;
-        for (int i = start; i < end; i++) {
-            if (times[i] > time) {
-                time = times[i];
+    private static long maxForFlagsInStates(@Nullable LongSparseLongArray counts,
+            @UidState int beginUidState, @UidState int endUidState,
+            @OpFlags int flags) {
+        if (counts == null) {
+            return 0;
+        }
+        long max = 0;
+        while (flags != 0) {
+            final int flag = 1 << Integer.numberOfTrailingZeros(flags);
+            flags &= ~flag;
+            for (int uidState : UID_STATES) {
+                if (uidState < beginUidState || uidState > endUidState) {
+                    continue;
+                }
+                final long key = makeKey(uidState, flag);
+                max = Math.max(max, counts.get(key));
             }
         }
-        return time;
+        return max;
+    }
+
+
+    private static void writeLongSparseLongArrayToParcel(
+            @Nullable LongSparseLongArray array, @NonNull Parcel parcel) {
+        if (array != null) {
+            final int size = array.size();
+            parcel.writeInt(size);
+            for (int i = 0; i < size; i++) {
+                parcel.writeLong(array.keyAt(i));
+                parcel.writeLong(array.valueAt(i));
+            }
+        } else {
+            parcel.writeInt(-1);
+        }
+    }
+
+    private static @Nullable LongSparseLongArray readLongSparseLongArrayFromParcel(
+            @NonNull Parcel parcel) {
+        final int size = parcel.readInt();
+        if (size < 0) {
+            return null;
+        }
+        final LongSparseLongArray array = new LongSparseLongArray(size);
+        for (int i = 0; i < size; i++) {
+            array.append(parcel.readLong(), parcel.readLong());
+        }
+        return array;
+    }
+
+    private static void writeLongSparseStringArrayToParcel(
+            @Nullable LongSparseArray<String> array, @NonNull Parcel parcel) {
+        if (array != null) {
+            final int size = array.size();
+            parcel.writeInt(size);
+            for (int i = 0; i < size; i++) {
+                parcel.writeLong(array.keyAt(i));
+                parcel.writeString(array.valueAt(i));
+            }
+        } else {
+            parcel.writeInt(-1);
+        }
+    }
+
+    private static @Nullable LongSparseArray<String> readLongSparseStringArrayFromParcel(
+            @NonNull Parcel parcel) {
+        final int size = parcel.readInt();
+        if (size < 0) {
+            return null;
+        }
+        final LongSparseArray<String> array = new LongSparseArray<>(size);
+        for (int i = 0; i < size; i++) {
+            array.append(parcel.readLong(), parcel.readString());
+        }
+        return array;
+    }
+
+    /**
+     * Collects the keys from an array to the result creating the result if needed.
+     *
+     * @param array The array whose keys to collect.
+     * @param result The optional result store collected keys.
+     * @return The result collected keys array.
+     */
+    private static LongSparseArray<Object> collectKeys(@Nullable LongSparseLongArray array,
+            @Nullable LongSparseArray<Object> result) {
+        if (array != null) {
+            if (result == null) {
+                result = new LongSparseArray<>();
+            }
+            final int accessSize = array.size();
+            for (int i = 0; i < accessSize; i++) {
+                result.put(array.keyAt(i), null);
+            }
+        }
+        return result;
     }
 
     /** @hide */
diff --git a/core/java/android/app/ApplicationErrorReport.java b/core/java/android/app/ApplicationErrorReport.java
index 8874554..a0b3dc0 100644
--- a/core/java/android/app/ApplicationErrorReport.java
+++ b/core/java/android/app/ApplicationErrorReport.java
@@ -492,7 +492,7 @@
             return 0;
         }
 
-        public static final Parcelable.Creator<ParcelableCrashInfo> CREATOR =
+        public static final @android.annotation.NonNull Parcelable.Creator<ParcelableCrashInfo> CREATOR =
                 new Parcelable.Creator<ParcelableCrashInfo>() {
                     @Override
                     public ParcelableCrashInfo createFromParcel(Parcel in) {
@@ -666,7 +666,7 @@
         }
     }
 
-    public static final Parcelable.Creator<ApplicationErrorReport> CREATOR
+    public static final @android.annotation.NonNull Parcelable.Creator<ApplicationErrorReport> CREATOR
             = new Parcelable.Creator<ApplicationErrorReport>() {
         public ApplicationErrorReport createFromParcel(Parcel source) {
             return new ApplicationErrorReport(source);
diff --git a/core/java/android/app/AuthenticationRequiredException.java b/core/java/android/app/AuthenticationRequiredException.java
index 04e5e0a..0d87336 100644
--- a/core/java/android/app/AuthenticationRequiredException.java
+++ b/core/java/android/app/AuthenticationRequiredException.java
@@ -81,7 +81,7 @@
         mUserAction.writeToParcel(dest, flags);
     }
 
-    public static final Creator<AuthenticationRequiredException> CREATOR =
+    public static final @android.annotation.NonNull Creator<AuthenticationRequiredException> CREATOR =
             new Creator<AuthenticationRequiredException>() {
         @Override
         public AuthenticationRequiredException createFromParcel(Parcel source) {
diff --git a/core/java/android/app/AutomaticZenRule.java b/core/java/android/app/AutomaticZenRule.java
index fe23e21..ec2825e 100644
--- a/core/java/android/app/AutomaticZenRule.java
+++ b/core/java/android/app/AutomaticZenRule.java
@@ -16,18 +16,15 @@
 
 package android.app;
 
-import static android.app.NotificationManager.INTERRUPTION_FILTER_PRIORITY;
-
+import android.annotation.NonNull;
+import android.annotation.Nullable;
 import android.app.NotificationManager.InterruptionFilter;
 import android.content.ComponentName;
-import android.content.Intent;
 import android.net.Uri;
 import android.os.Parcel;
 import android.os.Parcelable;
-import android.service.notification.ZenPolicy;
 import android.service.notification.Condition;
-
-import com.android.internal.util.Preconditions;
+import android.service.notification.ZenPolicy;
 
 import java.util.Objects;
 
@@ -92,8 +89,9 @@
      *               action ({@link Condition#STATE_TRUE}).
      * @param enabled Whether the rule is enabled.
      */
-    public AutomaticZenRule(String name, ComponentName owner, ComponentName configurationActivity,
-            Uri conditionId, ZenPolicy policy, int interruptionFilter, boolean enabled) {
+    public AutomaticZenRule(@NonNull String name, @Nullable ComponentName owner,
+            @Nullable ComponentName configurationActivity, @NonNull Uri conditionId,
+            @Nullable ZenPolicy policy, int interruptionFilter, boolean enabled) {
         this.name = name;
         this.owner = owner;
         this.configurationActivity = configurationActivity;
@@ -138,7 +136,7 @@
      * Returns the {@link ComponentName} of the activity that shows configuration options
      * for this rule.
      */
-    public ComponentName getConfigurationActivity() {
+    public @Nullable ComponentName getConfigurationActivity() {
         return configurationActivity;
     }
 
@@ -239,9 +237,10 @@
     /**
      * Sets the configuration activity - an activity that handles
      * {@link NotificationManager#ACTION_AUTOMATIC_ZEN_RULE} that shows the user more information
-     * about this rule and/or allows them to configure it.
+     * about this rule and/or allows them to configure it. This is required to be non-null for rules
+     * that are not backed by {@link android.service.notification.ConditionProviderService}.
      */
-    public void setConfigurationActivity(ComponentName componentName) {
+    public void setConfigurationActivity(@Nullable ComponentName componentName) {
         this.configurationActivity = componentName;
     }
 
@@ -304,7 +303,7 @@
                 configurationActivity, mZenPolicy, mModified, creationTime);
     }
 
-    public static final Parcelable.Creator<AutomaticZenRule> CREATOR
+    public static final @android.annotation.NonNull Parcelable.Creator<AutomaticZenRule> CREATOR
             = new Parcelable.Creator<AutomaticZenRule>() {
         @Override
         public AutomaticZenRule createFromParcel(Parcel source) {
diff --git a/core/java/android/app/BackStackRecord.java b/core/java/android/app/BackStackRecord.java
index 46e6def..351e737 100644
--- a/core/java/android/app/BackStackRecord.java
+++ b/core/java/android/app/BackStackRecord.java
@@ -155,7 +155,7 @@
         dest.writeInt(mReorderingAllowed ? 1 : 0);
     }
 
-    public static final Parcelable.Creator<BackStackState> CREATOR
+    public static final @android.annotation.NonNull Parcelable.Creator<BackStackState> CREATOR
             = new Parcelable.Creator<BackStackState>() {
         public BackStackState createFromParcel(Parcel in) {
             return new BackStackState(in);
diff --git a/core/java/android/app/BroadcastOptions.java b/core/java/android/app/BroadcastOptions.java
index 062a462..161e2ad 100644
--- a/core/java/android/app/BroadcastOptions.java
+++ b/core/java/android/app/BroadcastOptions.java
@@ -61,7 +61,7 @@
             "android:broadcast.dontSendToRestrictedApps";
 
     /**
-     * Corresponds to {@link #setAllowBackgroundActivityStarts}.
+     * Corresponds to {@link #setBackgroundActivityStartsAllowed}.
      */
     static final String KEY_ALLOW_BACKGROUND_ACTIVITY_STARTS =
             "android:broadcast.allowBackgroundActivityStarts";
@@ -161,7 +161,7 @@
      * the broadcast dispatch. Default value is {@code false}
      */
     @RequiresPermission(android.Manifest.permission.START_ACTIVITIES_FROM_BACKGROUND)
-    public void setAllowBackgroundActivityStarts(boolean allowBackgroundActivityStarts) {
+    public void setBackgroundActivityStartsAllowed(boolean allowBackgroundActivityStarts) {
         mAllowBackgroundActivityStarts = allowBackgroundActivityStarts;
     }
 
diff --git a/core/java/android/app/ContentProviderHolder.java b/core/java/android/app/ContentProviderHolder.java
index 2a13c71..004dca1a 100644
--- a/core/java/android/app/ContentProviderHolder.java
+++ b/core/java/android/app/ContentProviderHolder.java
@@ -61,7 +61,7 @@
         dest.writeInt(noReleaseNeeded ? 1 : 0);
     }
 
-    public static final Parcelable.Creator<ContentProviderHolder> CREATOR
+    public static final @android.annotation.NonNull Parcelable.Creator<ContentProviderHolder> CREATOR
             = new Parcelable.Creator<ContentProviderHolder>() {
         @Override
         public ContentProviderHolder createFromParcel(Parcel source) {
diff --git a/core/java/android/app/ContextImpl.java b/core/java/android/app/ContextImpl.java
index b607f9a..5945eef 100644
--- a/core/java/android/app/ContextImpl.java
+++ b/core/java/android/app/ContextImpl.java
@@ -102,6 +102,7 @@
 import java.util.concurrent.Executor;
 
 class ReceiverRestrictedContext extends ContextWrapper {
+    @UnsupportedAppUsage
     ReceiverRestrictedContext(Context base) {
         super(base);
     }
@@ -144,10 +145,17 @@
     }
 
     @Override
-    public boolean bindIsolatedService(Intent service, ServiceConnection conn, int flags,
-            String instanceName) {
+    public boolean bindService(
+          Intent service, int flags, Executor executor, ServiceConnection conn) {
         throw new ReceiverCallNotAllowedException(
-                "BroadcastReceiver components are not allowed to bind to services");
+            "BroadcastReceiver components are not allowed to bind to services");
+    }
+
+    @Override
+    public boolean bindIsolatedService(Intent service, int flags, String instanceName,
+            Executor executor, ServiceConnection conn) {
+        throw new ReceiverCallNotAllowedException(
+            "BroadcastReceiver components are not allowed to bind to services");
     }
 }
 
@@ -1638,28 +1646,34 @@
     }
 
     @Override
-    public boolean bindService(Intent service, ServiceConnection conn,
-            int flags) {
+    public boolean bindService(Intent service, ServiceConnection conn, int flags) {
         warnIfCallingFromSystemProcess();
-        return bindServiceCommon(service, conn, flags, null, mMainThread.getHandler(), getUser());
+        return bindServiceCommon(service, conn, flags, null, mMainThread.getHandler(), null,
+                getUser());
     }
 
     @Override
-    public boolean bindIsolatedService(Intent service, ServiceConnection conn,
-            int flags, String instanceName) {
+    public boolean bindService(
+            Intent service, int flags, Executor executor, ServiceConnection conn) {
+        warnIfCallingFromSystemProcess();
+        return bindServiceCommon(service, conn, flags, null, null, executor, getUser());
+    }
+
+    @Override
+    public boolean bindIsolatedService(Intent service, int flags, String instanceName,
+            Executor executor, ServiceConnection conn) {
         warnIfCallingFromSystemProcess();
         if (instanceName == null) {
             throw new NullPointerException("null instanceName");
         }
-        return bindServiceCommon(service, conn, flags, instanceName, mMainThread.getHandler(),
-                getUser());
+        return bindServiceCommon(service, conn, flags, instanceName, null, executor, getUser());
     }
 
     /** @hide */
     @Override
     public boolean bindServiceAsUser(Intent service, ServiceConnection conn, int flags,
             UserHandle user) {
-        return bindServiceCommon(service, conn, flags, null, mMainThread.getHandler(), user);
+        return bindServiceCommon(service, conn, flags, null, mMainThread.getHandler(), null, user);
     }
 
     /** @hide */
@@ -1669,7 +1683,7 @@
         if (handler == null) {
             throw new IllegalArgumentException("handler must not be null.");
         }
-        return bindServiceCommon(service, conn, flags, null, handler, user);
+        return bindServiceCommon(service, conn, flags, null, handler, null, user);
     }
 
     /** @hide */
@@ -1692,15 +1706,21 @@
     }
 
     private boolean bindServiceCommon(Intent service, ServiceConnection conn, int flags,
-            String instanceName, Handler
-            handler, UserHandle user) {
+            String instanceName, Handler handler, Executor executor, UserHandle user) {
         // Keep this in sync with DevicePolicyManager.bindDeviceAdminServiceAsUser.
         IServiceConnection sd;
         if (conn == null) {
             throw new IllegalArgumentException("connection is null");
         }
+        if (handler != null && executor != null) {
+            throw new IllegalArgumentException("Handler and Executor both supplied");
+        }
         if (mPackageInfo != null) {
-            sd = mPackageInfo.getServiceDispatcher(conn, getOuterContext(), handler, flags);
+            if (executor != null) {
+                sd = mPackageInfo.getServiceDispatcher(conn, getOuterContext(), executor, flags);
+            } else {
+                sd = mPackageInfo.getServiceDispatcher(conn, getOuterContext(), handler, flags);
+            }
         } else {
             throw new RuntimeException("Not supported in system context");
         }
diff --git a/core/java/android/app/DownloadManager.java b/core/java/android/app/DownloadManager.java
index fde1d29e..7ae88fd 100644
--- a/core/java/android/app/DownloadManager.java
+++ b/core/java/android/app/DownloadManager.java
@@ -21,6 +21,7 @@
 import android.annotation.SdkConstant.SdkConstantType;
 import android.annotation.SystemApi;
 import android.annotation.SystemService;
+import android.annotation.TestApi;
 import android.annotation.UnsupportedAppUsage;
 import android.content.ContentResolver;
 import android.content.ContentUris;
@@ -163,6 +164,10 @@
      */
     public static final String COLUMN_MEDIAPROVIDER_URI = Downloads.Impl.COLUMN_MEDIAPROVIDER_URI;
 
+    /** @hide */
+    @TestApi
+    public static final String COLUMN_MEDIASTORE_URI = Downloads.Impl.COLUMN_MEDIASTORE_URI;
+
     /**
      * @hide
      */
@@ -1153,6 +1158,7 @@
      * @param ids the IDs of the downloads
      * @hide
      */
+    @UnsupportedAppUsage
     public void restartDownload(long... ids) {
         Cursor cursor = query(new Query().setFilterById(ids));
         try {
diff --git a/core/java/android/app/FragmentManager.java b/core/java/android/app/FragmentManager.java
index 5e7921b..68daf44 100644
--- a/core/java/android/app/FragmentManager.java
+++ b/core/java/android/app/FragmentManager.java
@@ -623,7 +623,7 @@
         dest.writeInt(mNextFragmentIndex);
     }
     
-    public static final Parcelable.Creator<FragmentManagerState> CREATOR
+    public static final @android.annotation.NonNull Parcelable.Creator<FragmentManagerState> CREATOR
             = new Parcelable.Creator<FragmentManagerState>() {
         public FragmentManagerState createFromParcel(Parcel in) {
             return new FragmentManagerState(in);
diff --git a/core/java/android/app/FragmentState.java b/core/java/android/app/FragmentState.java
index a61da3bb..a66f069 100644
--- a/core/java/android/app/FragmentState.java
+++ b/core/java/android/app/FragmentState.java
@@ -122,7 +122,7 @@
         dest.writeBundle(mSavedFragmentState);
     }
 
-    public static final Parcelable.Creator<FragmentState> CREATOR =
+    public static final @android.annotation.NonNull Parcelable.Creator<FragmentState> CREATOR =
             new Parcelable.Creator<FragmentState>() {
                 @Override
                 public FragmentState createFromParcel(Parcel in) {
diff --git a/core/java/android/app/GrantedUriPermission.java b/core/java/android/app/GrantedUriPermission.java
index 9e84fe1..48d5b8c 100644
--- a/core/java/android/app/GrantedUriPermission.java
+++ b/core/java/android/app/GrantedUriPermission.java
@@ -54,7 +54,7 @@
         out.writeString(packageName);
     }
 
-    public static final Parcelable.Creator<GrantedUriPermission> CREATOR =
+    public static final @android.annotation.NonNull Parcelable.Creator<GrantedUriPermission> CREATOR =
             new Parcelable.Creator<GrantedUriPermission>() {
                 @Override
                 public GrantedUriPermission createFromParcel(Parcel in) {
diff --git a/core/java/android/app/IActivityManager.aidl b/core/java/android/app/IActivityManager.aidl
index 780dd63..16fe7db 100644
--- a/core/java/android/app/IActivityManager.aidl
+++ b/core/java/android/app/IActivityManager.aidl
@@ -102,15 +102,21 @@
     // Special low-level communication with activity manager.
     void handleApplicationCrash(in IBinder app,
             in ApplicationErrorReport.ParcelableCrashInfo crashInfo);
+    @UnsupportedAppUsage
     int startActivity(in IApplicationThread caller, in String callingPackage, in Intent intent,
             in String resolvedType, in IBinder resultTo, in String resultWho, int requestCode,
             int flags, in ProfilerInfo profilerInfo, in Bundle options);
+    @UnsupportedAppUsage
     void unhandledBack();
+    @UnsupportedAppUsage
     boolean finishActivity(in IBinder token, int code, in Intent data, int finishTask);
+    @UnsupportedAppUsage
     Intent registerReceiver(in IApplicationThread caller, in String callerPackage,
             in IIntentReceiver receiver, in IntentFilter filter,
             in String requiredPermission, int userId, int flags);
+    @UnsupportedAppUsage
     void unregisterReceiver(in IIntentReceiver receiver);
+    @UnsupportedAppUsage
     int broadcastIntent(in IApplicationThread caller, in Intent intent,
             in String resolvedType, in IIntentReceiver resultTo, int resultCode,
             in String resultData, in Bundle map, in String[] requiredPermissions,
@@ -120,21 +126,27 @@
             boolean abortBroadcast, int flags);
     void attachApplication(in IApplicationThread app, long startSeq);
     List<ActivityManager.RunningTaskInfo> getTasks(int maxNum);
+    @UnsupportedAppUsage
     List<ActivityManager.RunningTaskInfo> getFilteredTasks(int maxNum, int ignoreActivityType,
             int ignoreWindowingMode);
+    @UnsupportedAppUsage
     void moveTaskToFront(int task, int flags, in Bundle options);
+    @UnsupportedAppUsage
     int getTaskForActivity(in IBinder token, in boolean onlyRoot);
     ContentProviderHolder getContentProvider(in IApplicationThread caller, in String callingPackage,
             in String name, int userId, boolean stable);
+    @UnsupportedAppUsage
     void publishContentProviders(in IApplicationThread caller,
             in List<ContentProviderHolder> providers);
     boolean refContentProvider(in IBinder connection, int stableDelta, int unstableDelta);
     PendingIntent getRunningServiceControlPanel(in ComponentName service);
     ComponentName startService(in IApplicationThread caller, in Intent service,
             in String resolvedType, boolean requireForeground, in String callingPackage, int userId);
+    @UnsupportedAppUsage
     int stopService(in IApplicationThread caller, in Intent service,
             in String resolvedType, int userId);
     // Currently keeping old bindService because it is on the greylist
+    @UnsupportedAppUsage
     int bindService(in IApplicationThread caller, in IBinder token, in Intent service,
             in String resolvedType, in IServiceConnection connection, int flags,
             in String callingPackage, int userId);
@@ -142,11 +154,15 @@
             in String resolvedType, in IServiceConnection connection, int flags,
             in String instanceName, in String callingPackage, int userId);
     void updateServiceGroup(in IServiceConnection connection, int group, int importance);
+    @UnsupportedAppUsage
     boolean unbindService(in IServiceConnection connection);
     void publishService(in IBinder token, in Intent intent, in IBinder service);
+    @UnsupportedAppUsage
     void setDebugApp(in String packageName, boolean waitForDebugger, boolean persistent);
     void setAgentApp(in String packageName, @nullable String agent);
+    @UnsupportedAppUsage
     void setAlwaysFinish(boolean enabled);
+    @UnsupportedAppUsage
     boolean startInstrumentation(in ComponentName className, in String profileFile,
             int flags, in Bundle arguments, in IInstrumentationWatcher watcher,
             in IUiAutomationConnection connection, int userId,
@@ -159,6 +175,7 @@
      *         system. Corresponds to the configuration of the default display.
      * @throws RemoteException
      */
+    @UnsupportedAppUsage
     Configuration getConfiguration();
     /**
      * Updates global configuration and applies changes to the entire system.
@@ -167,10 +184,14 @@
      * @throws RemoteException
      * @return Returns true if the configuration was updated.
      */
+    @UnsupportedAppUsage
     boolean updateConfiguration(in Configuration values);
     boolean stopServiceToken(in ComponentName className, in IBinder token, int startId);
+    @UnsupportedAppUsage
     void setProcessLimit(int max);
+    @UnsupportedAppUsage
     int getProcessLimit();
+    @UnsupportedAppUsage
     int checkPermission(in String permission, int pid, int uid);
     int checkUriPermission(in Uri uri, int pid, int uid, int mode, int userId,
             in IBinder callerToken);
@@ -178,6 +199,7 @@
             int mode, int userId);
     void revokeUriPermission(in IApplicationThread caller, in String targetPkg, in Uri uri,
             int mode, int userId);
+    @UnsupportedAppUsage
     void setActivityController(in IActivityController watcher, boolean imAMonkey);
     void showWaitingForDebugger(in IApplicationThread who, boolean waiting);
     /*
@@ -186,8 +208,10 @@
      */
     void signalPersistentProcesses(int signal);
 
+    @UnsupportedAppUsage
     ParceledListSlice getRecentTasks(int maxNum, int flags, int userId);
     oneway void serviceDoneExecuting(in IBinder token, int type, int startId, int res);
+    @UnsupportedAppUsage
     IIntentSender getIntentSender(int type, in String packageName, in IBinder token,
             in String resultWho, int requestCode, in Intent[] intents, in String[] resolvedTypes,
             int flags, in Bundle options, int userId);
@@ -199,27 +223,39 @@
     void noteWakeupAlarm(in IIntentSender sender, in WorkSource workSource, int sourceUid,
             in String sourcePkg, in String tag);
     void removeContentProvider(in IBinder connection, boolean stable);
+    @UnsupportedAppUsage
     void setRequestedOrientation(in IBinder token, int requestedOrientation);
     void unbindFinished(in IBinder token, in Intent service, boolean doRebind);
+    @UnsupportedAppUsage
     void setProcessImportant(in IBinder token, int pid, boolean isForeground, String reason);
     void setServiceForeground(in ComponentName className, in IBinder token,
             int id, in Notification notification, int flags, int foregroundServiceType);
+    int getForegroundServiceType(in ComponentName className, in IBinder token);
+    @UnsupportedAppUsage
     boolean moveActivityTaskToBack(in IBinder token, boolean nonRoot);
+    @UnsupportedAppUsage
     void getMemoryInfo(out ActivityManager.MemoryInfo outInfo);
     List<ActivityManager.ProcessErrorStateInfo> getProcessesInErrorState();
     boolean clearApplicationUserData(in String packageName, boolean keepState,
             in IPackageDataObserver observer, int userId);
+    @UnsupportedAppUsage
     void forceStopPackage(in String packageName, int userId);
     boolean killPids(in int[] pids, in String reason, boolean secure);
+    @UnsupportedAppUsage
     List<ActivityManager.RunningServiceInfo> getServices(int maxNum, int flags);
     // Retrieve running application processes in the system
+    @UnsupportedAppUsage
     List<ActivityManager.RunningAppProcessInfo> getRunningAppProcesses();
     IBinder peekService(in Intent service, in String resolvedType, in String callingPackage);
     // Turn on/off profiling in a particular process.
+    @UnsupportedAppUsage
     boolean profileControl(in String process, int userId, boolean start,
             in ProfilerInfo profilerInfo, int profileType);
+    @UnsupportedAppUsage
     boolean shutdown(int timeout);
+    @UnsupportedAppUsage
     void stopAppSwitches();
+    @UnsupportedAppUsage
     void resumeAppSwitches();
     boolean bindBackupAgent(in String packageName, int backupRestoreMode, int targetUserId);
     void backupAgentCreated(in String packageName, in IBinder agent, int userId);
@@ -229,60 +265,83 @@
             boolean requireFull, in String name, in String callerPackage);
     void addPackageDependency(in String packageName);
     void killApplication(in String pkg, int appId, int userId, in String reason);
+    @UnsupportedAppUsage
     void closeSystemDialogs(in String reason);
+    @UnsupportedAppUsage
     Debug.MemoryInfo[] getProcessMemoryInfo(in int[] pids);
     void killApplicationProcess(in String processName, int uid);
     // Special low-level communication with activity manager.
     boolean handleApplicationWtf(in IBinder app, in String tag, boolean system,
             in ApplicationErrorReport.ParcelableCrashInfo crashInfo);
+    @UnsupportedAppUsage
     void killBackgroundProcesses(in String packageName, int userId);
     boolean isUserAMonkey();
     // Retrieve info of applications installed on external media that are currently
     // running.
     List<ApplicationInfo> getRunningExternalApplications();
+    @UnsupportedAppUsage
     void finishHeavyWeightApp();
     // A StrictMode violation to be handled.
+    @UnsupportedAppUsage
     void handleApplicationStrictModeViolation(in IBinder app, int penaltyMask,
             in StrictMode.ViolationInfo crashInfo);
     boolean isTopActivityImmersive();
     void crashApplication(int uid, int initialPid, in String packageName, int userId, in String message);
+    @UnsupportedAppUsage
     String getProviderMimeType(in Uri uri, int userId);
     // Cause the specified process to dump the specified heap.
     boolean dumpHeap(in String process, int userId, boolean managed, boolean mallocInfo,
             boolean runGc, in String path, in ParcelFileDescriptor fd,
             in RemoteCallback finishCallback);
+    @UnsupportedAppUsage
     boolean isUserRunning(int userid, int flags);
+    @UnsupportedAppUsage
     void setPackageScreenCompatMode(in String packageName, int mode);
+    @UnsupportedAppUsage
     boolean switchUser(int userid);
+    @UnsupportedAppUsage
     boolean removeTask(int taskId);
+    @UnsupportedAppUsage
     void registerProcessObserver(in IProcessObserver observer);
+    @UnsupportedAppUsage
     void unregisterProcessObserver(in IProcessObserver observer);
     boolean isIntentSenderTargetedToPackage(in IIntentSender sender);
+    @UnsupportedAppUsage
     void updatePersistentConfiguration(in Configuration values);
+    @UnsupportedAppUsage
     long[] getProcessPss(in int[] pids);
     void showBootMessage(in CharSequence msg, boolean always);
+    @UnsupportedAppUsage
     void killAllBackgroundProcesses();
     ContentProviderHolder getContentProviderExternal(in String name, int userId,
             in IBinder token, String tag);
     /** @deprecated - Use {@link #removeContentProviderExternalAsUser} which takes a user ID. */
+    @UnsupportedAppUsage
     void removeContentProviderExternal(in String name, in IBinder token);
     void removeContentProviderExternalAsUser(in String name, in IBinder token, int userId);
     // Get memory information about the calling process.
     void getMyMemoryState(out ActivityManager.RunningAppProcessInfo outInfo);
     boolean killProcessesBelowForeground(in String reason);
+    @UnsupportedAppUsage
     UserInfo getCurrentUser();
     // This is not public because you need to be very careful in how you
     // manage your activity to make sure it is always the uid you expect.
+    @UnsupportedAppUsage
     int getLaunchedFromUid(in IBinder activityToken);
+    @UnsupportedAppUsage
     void unstableProviderDied(in IBinder connection);
+    @UnsupportedAppUsage
     boolean isIntentSenderAnActivity(in IIntentSender sender);
     boolean isIntentSenderAForegroundService(in IIntentSender sender);
     boolean isIntentSenderABroadcast(in IIntentSender sender);
+    @UnsupportedAppUsage
     int startActivityAsUser(in IApplicationThread caller, in String callingPackage,
             in Intent intent, in String resolvedType, in IBinder resultTo, in String resultWho,
             int requestCode, int flags, in ProfilerInfo profilerInfo,
             in Bundle options, int userId);
+    @UnsupportedAppUsage
     int stopUser(int userid, boolean force, in IStopUserCallback callback);
+    @UnsupportedAppUsage
     void registerUserSwitchObserver(in IUserSwitchObserver observer, in String name);
     void unregisterUserSwitchObserver(in IUserSwitchObserver observer);
     int[] getRunningUserIds();
@@ -290,6 +349,7 @@
     // Deprecated - This method is only used by a few internal components and it will soon be
     // replaced by a proper bug report API (which will be restricted to a few, pre-defined apps).
     // No new code should be calling it.
+    @UnsupportedAppUsage
     void requestBugReport(int bugreportType);
 
     /**
@@ -318,15 +378,20 @@
      */
     void requestWifiBugReport(in String shareTitle, in String shareDescription);
 
+    @UnsupportedAppUsage
     Intent getIntentForIntentSender(in IIntentSender sender);
     // This is not public because you need to be very careful in how you
     // manage your activity to make sure it is always the uid you expect.
+    @UnsupportedAppUsage
     String getLaunchedFromPackage(in IBinder activityToken);
     void killUid(int appId, int userId, in String reason);
     void setUserIsMonkey(boolean monkey);
+    @UnsupportedAppUsage
     void hang(in IBinder who, boolean allowRestart);
 
+    @UnsupportedAppUsage
     List<ActivityManager.StackInfo> getAllStackInfos();
+    @UnsupportedAppUsage
     void moveTaskToStack(int taskId, int stackId, boolean toTop);
     /**
      * Resizes the input stack id to the given bounds.
@@ -342,60 +407,83 @@
      *                          default animation duration should be used.
      * @throws RemoteException
      */
+    @UnsupportedAppUsage
     void resizeStack(int stackId, in Rect bounds, boolean allowResizeInDockedMode,
             boolean preserveWindows, boolean animate, int animationDuration);
     void setFocusedStack(int stackId);
     ActivityManager.StackInfo getFocusedStackInfo();
+    @UnsupportedAppUsage
     void restart();
     void performIdleMaintenance();
     void appNotRespondingViaProvider(in IBinder connection);
+    @UnsupportedAppUsage
     Rect getTaskBounds(int taskId);
+    @UnsupportedAppUsage
     boolean setProcessMemoryTrimLevel(in String process, int uid, int level);
 
 
     // Start of L transactions
     String getTagForIntentSender(in IIntentSender sender, in String prefix);
+    @UnsupportedAppUsage
     boolean startUserInBackground(int userid);
+    @UnsupportedAppUsage
     boolean isInLockTaskMode();
+    @UnsupportedAppUsage
     void startRecentsActivity(in Intent intent, in IAssistDataReceiver assistDataReceiver,
             in IRecentsAnimationRunner recentsAnimationRunner);
+    @UnsupportedAppUsage
     void cancelRecentsAnimation(boolean restoreHomeStackPosition);
+    @UnsupportedAppUsage
     int startActivityFromRecents(int taskId, in Bundle options);
+    @UnsupportedAppUsage
     void startSystemLockTaskMode(int taskId);
+    @UnsupportedAppUsage
     boolean isTopOfTask(in IBinder token);
     void bootAnimationComplete();
     int checkPermissionWithToken(in String permission, int pid, int uid,
             in IBinder callerToken);
+    @UnsupportedAppUsage
     void registerTaskStackListener(in ITaskStackListener listener);
     void unregisterTaskStackListener(in ITaskStackListener listener);
     void notifyCleartextNetwork(int uid, in byte[] firstPacket);
+    @UnsupportedAppUsage
     void setTaskResizeable(int taskId, int resizeableMode);
+    @UnsupportedAppUsage
     void resizeTask(int taskId, in Rect bounds, int resizeMode);
+    @UnsupportedAppUsage
     int getLockTaskModeState();
+    @UnsupportedAppUsage
     void setDumpHeapDebugLimit(in String processName, int uid, long maxMemSize,
             in String reportPackage);
     void dumpHeapFinished(in String path);
     void updateLockTaskPackages(int userId, in String[] packages);
     void noteAlarmStart(in IIntentSender sender, in WorkSource workSource, int sourceUid, in String tag);
     void noteAlarmFinish(in IIntentSender sender, in WorkSource workSource, int sourceUid, in String tag);
+    @UnsupportedAppUsage
     int getPackageProcessState(in String packageName, in String callingPackage);
     void updateDeviceOwner(in String packageName);
 
     // Start of N transactions
     // Start Binder transaction tracking for all applications.
+    @UnsupportedAppUsage
     boolean startBinderTracking();
     // Stop Binder transaction tracking for all applications and dump trace data to the given file
     // descriptor.
+    @UnsupportedAppUsage
     boolean stopBinderTrackingAndDump(in ParcelFileDescriptor fd);
     /**
      * Try to place task to provided position. The final position might be different depending on
      * current user and stacks state. The task will be moved to target stack if it's currently in
      * different stack.
      */
+    @UnsupportedAppUsage
     void positionTaskInStack(int taskId, int stackId, int position);
+    @UnsupportedAppUsage
     void suppressResizeConfigChanges(boolean suppress);
+    @UnsupportedAppUsage
     boolean moveTopActivityToPinnedStack(int stackId, in Rect bounds);
     boolean isAppStartModeDisabled(int uid, in String packageName);
+    @UnsupportedAppUsage
     boolean unlockUser(int userid, in byte[] token, in byte[] secret,
             in IProgressListener listener);
     void killPackageDependents(in String packageName, int userId);
@@ -418,15 +506,18 @@
      *                                 stacks.
      * @throws RemoteException
      */
+    @UnsupportedAppUsage
     void resizeDockedStack(in Rect dockedBounds, in Rect tempDockedTaskBounds,
             in Rect tempDockedTaskInsetBounds,
             in Rect tempOtherTaskBounds, in Rect tempOtherTaskInsetBounds);
+    @UnsupportedAppUsage
     void removeStack(int stackId);
     void makePackageIdle(String packageName, int userId);
     int getMemoryTrimLevel();
     boolean isVrModePackageEnabled(in ComponentName packageName);
     void notifyLockedProfile(int userId);
     void startConfirmDeviceCredentialIntent(in Intent intent, in Bundle options);
+    @UnsupportedAppUsage
     void sendIdleJobTrigger();
     int sendIntentSender(in IIntentSender target, in IBinder whitelistToken, int code,
             in Intent intent, in String resolvedType, in IIntentReceiver finishedReceiver,
@@ -448,6 +539,7 @@
     // Start of O transactions
     int restartUserInBackground(int userId);
     /** Cancels the window transitions for the given task. */
+    @UnsupportedAppUsage
     void cancelTaskWindowTransition(int taskId);
     /**
      * @param taskId the id of the task to retrieve the sAutoapshots for
@@ -455,6 +547,7 @@
      *                          a reduced resolution of it, which is much faster
      * @return a graphic buffer representing a screenshot of a task
      */
+    @UnsupportedAppUsage
     ActivityManager.TaskSnapshot getTaskSnapshot(int taskId, boolean reducedResolution);
     void scheduleApplicationInfoChanged(in List<String> packageNames, int userId);
     void setPersistentVrThread(int tid);
diff --git a/core/java/android/app/IActivityTaskManager.aidl b/core/java/android/app/IActivityTaskManager.aidl
index b01cd0e..a6b76cb 100644
--- a/core/java/android/app/IActivityTaskManager.aidl
+++ b/core/java/android/app/IActivityTaskManager.aidl
@@ -129,6 +129,7 @@
     oneway void activityIdle(in IBinder token, in Configuration config,
             in boolean stopProfiling);
     void activityResumed(in IBinder token);
+    void activityTopResumedStateLost();
     void activityPaused(in IBinder token);
     void activityStopped(in IBinder token, in Bundle state,
             in PersistableBundle persistentState, in CharSequence description);
@@ -472,4 +473,14 @@
      * contain one task.
      */
     void setDisplayToSingleTaskInstance(int displayId);
+
+    /**
+     * Restarts the activity by killing its process if it is visible. If the activity is not
+     * visible, the activity will not be restarted immediately and just keep the activity record in
+     * the stack. It also resets the current override configuration so the activity will use the
+     * configuration according to the latest state.
+     *
+     * @param activityToken The token of the target activity to restart.
+     */
+    void restartActivityProcessIfVisible(in IBinder activityToken);
 }
diff --git a/core/java/android/app/IAlarmManager.aidl b/core/java/android/app/IAlarmManager.aidl
index ded4c49..6f624ee 100644
--- a/core/java/android/app/IAlarmManager.aidl
+++ b/core/java/android/app/IAlarmManager.aidl
@@ -29,13 +29,16 @@
  */
 interface IAlarmManager {
 	/** windowLength == 0 means exact; windowLength < 0 means the let the OS decide */
+    @UnsupportedAppUsage
     void set(String callingPackage, int type, long triggerAtTime, long windowLength,
             long interval, int flags, in PendingIntent operation, in IAlarmListener listener,
             String listenerTag, in WorkSource workSource, in AlarmManager.AlarmClockInfo alarmClock);
+    @UnsupportedAppUsage
     boolean setTime(long millis);
     void setTimeZone(String zone);
     void remove(in PendingIntent operation, in IAlarmListener listener);
     long getNextWakeFromIdleTime();
+    @UnsupportedAppUsage
     AlarmManager.AlarmClockInfo getNextAlarmClock(int userId);
     long currentNetworkTimeMillis();
 }
diff --git a/core/java/android/app/IAppTask.aidl b/core/java/android/app/IAppTask.aidl
index 37fead9..61f6264 100644
--- a/core/java/android/app/IAppTask.aidl
+++ b/core/java/android/app/IAppTask.aidl
@@ -23,6 +23,7 @@
 /** @hide */
 interface IAppTask {
     void finishAndRemoveTask();
+    @UnsupportedAppUsage
     ActivityManager.RecentTaskInfo getTaskInfo();
     void moveToFront();
     int startActivity(IBinder whoThread, String callingPackage,
diff --git a/core/java/android/app/IApplicationThread.aidl b/core/java/android/app/IApplicationThread.aidl
index b8af898..3a09c4c 100644
--- a/core/java/android/app/IApplicationThread.aidl
+++ b/core/java/android/app/IApplicationThread.aidl
@@ -60,8 +60,10 @@
             in CompatibilityInfo compatInfo,
             int resultCode, in String data, in Bundle extras, boolean sync,
             int sendingUser, int processState);
+    @UnsupportedAppUsage
     void scheduleCreateService(IBinder token, in ServiceInfo info,
             in CompatibilityInfo compatInfo, int processState);
+    @UnsupportedAppUsage
     void scheduleStopService(IBinder token);
     void bindApplication(in String packageName, in ApplicationInfo info,
             in List<ProviderInfo> providers, in ComponentName testName,
@@ -77,8 +79,10 @@
     void scheduleServiceArgs(IBinder token, in ParceledListSlice args);
     void updateTimeZone();
     void processInBackground();
+    @UnsupportedAppUsage
     void scheduleBindService(IBinder token,
             in Intent intent, boolean rebind, int processState);
+    @UnsupportedAppUsage
     void scheduleUnbindService(IBinder token,
             in Intent intent);
     void dumpService(in ParcelFileDescriptor fd, IBinder servicetoken,
@@ -106,6 +110,7 @@
     void updateHttpProxy();
     void setCoreSettings(in Bundle coreSettings);
     void updatePackageCompatibilityInfo(in String pkg, in CompatibilityInfo info);
+    @UnsupportedAppUsage
     void scheduleTrimMemory(int level);
     void dumpMemInfo(in ParcelFileDescriptor fd, in Debug.MemoryInfo mem, boolean checkin,
             boolean dumpInfo, boolean dumpDalvik, boolean dumpSummaryOnly, boolean dumpUnreachable,
diff --git a/core/java/android/app/IAssistDataReceiver.aidl b/core/java/android/app/IAssistDataReceiver.aidl
index 2d5daf9..0d69838 100644
--- a/core/java/android/app/IAssistDataReceiver.aidl
+++ b/core/java/android/app/IAssistDataReceiver.aidl
@@ -21,6 +21,8 @@
 
 /** @hide */
 oneway interface IAssistDataReceiver {
+    @UnsupportedAppUsage
     void onHandleAssistData(in Bundle resultData);
+    @UnsupportedAppUsage
     void onHandleAssistScreenshot(in Bitmap screenshot);
 }
diff --git a/core/java/android/app/IInstrumentationWatcher.aidl b/core/java/android/app/IInstrumentationWatcher.aidl
index 6c8c4d6..df42dec 100644
--- a/core/java/android/app/IInstrumentationWatcher.aidl
+++ b/core/java/android/app/IInstrumentationWatcher.aidl
@@ -23,6 +23,7 @@
 /** @hide */
 interface IInstrumentationWatcher
 {
+    @UnsupportedAppUsage
     void instrumentationStatus(in ComponentName name, int resultCode,
             in Bundle results);
     void instrumentationFinished(in ComponentName name, int resultCode,
diff --git a/core/java/android/app/INotificationManager.aidl b/core/java/android/app/INotificationManager.aidl
index df04a6b..29e6807 100644
--- a/core/java/android/app/INotificationManager.aidl
+++ b/core/java/android/app/INotificationManager.aidl
@@ -40,15 +40,19 @@
 /** {@hide} */
 interface INotificationManager
 {
+    @UnsupportedAppUsage
     void cancelAllNotifications(String pkg, int userId);
 
     void clearData(String pkg, int uid, boolean fromApp);
+    @UnsupportedAppUsage
     void enqueueToast(String pkg, ITransientNotification callback, int duration, int displayId);
+    @UnsupportedAppUsage
     void cancelToast(String pkg, ITransientNotification callback);
     void finishToken(String pkg, ITransientNotification callback);
 
     void enqueueNotificationWithTag(String pkg, String opPkg, String tag, int id,
             in Notification notification, int userId);
+    @UnsupportedAppUsage
     void cancelNotificationWithTag(String pkg, String tag, int id, int userId);
 
     void setShowBadge(String pkg, int uid, boolean showBadge);
@@ -61,6 +65,7 @@
      */
     void setNotificationsEnabledWithImportanceLockForPackage(String pkg, int uid, boolean enabled);
 
+    @UnsupportedAppUsage
     boolean areNotificationsEnabledForPackage(String pkg, int uid);
     boolean areNotificationsEnabled(String pkg);
     int getPackageImportance(String pkg);
@@ -102,7 +107,9 @@
 
     // TODO: Remove this when callers have been migrated to the equivalent
     // INotificationListener method.
+    @UnsupportedAppUsage
     StatusBarNotification[] getActiveNotifications(String callingPkg);
+    @UnsupportedAppUsage
     StatusBarNotification[] getHistoricalNotifications(String callingPkg, int count);
 
     void registerListener(in INotificationListener listener, in ComponentName component, int userid);
@@ -157,7 +164,9 @@
     ComponentName getAllowedNotificationAssistantForUser(int userId);
     ComponentName getAllowedNotificationAssistant();
 
+    @UnsupportedAppUsage
     int getZenMode();
+    @UnsupportedAppUsage
     ZenModeConfig getZenModeConfig();
     NotificationManager.Policy getConsolidatedNotificationPolicy();
     oneway void setZenMode(int mode, in Uri conditionId, String reason);
@@ -183,7 +192,6 @@
     ParceledListSlice getAppActiveNotifications(String callingPkg, int userId);
 
     void setNotificationDelegate(String callingPkg, String delegate);
-    void revokeNotificationDelegate(String callingPkg);
     String getNotificationDelegate(String callingPkg);
     boolean canNotifyAsPackage(String callingPkg, String targetPkg);
 
diff --git a/core/java/android/app/ISearchManager.aidl b/core/java/android/app/ISearchManager.aidl
index 0d09e4a..53f1a46 100644
--- a/core/java/android/app/ISearchManager.aidl
+++ b/core/java/android/app/ISearchManager.aidl
@@ -28,6 +28,7 @@
    SearchableInfo getSearchableInfo(in ComponentName launchActivity);
    List<SearchableInfo> getSearchablesInGlobalSearch();
    List<ResolveInfo> getGlobalSearchActivities();
+   @UnsupportedAppUsage
    ComponentName getGlobalSearchActivity();
    ComponentName getWebSearchActivity();
    void launchAssist(in Bundle args);
diff --git a/core/java/android/app/IServiceConnection.aidl b/core/java/android/app/IServiceConnection.aidl
index 97042aa..0115bcf 100644
--- a/core/java/android/app/IServiceConnection.aidl
+++ b/core/java/android/app/IServiceConnection.aidl
@@ -21,6 +21,7 @@
 
 /** @hide */
 oneway interface IServiceConnection {
+    @UnsupportedAppUsage
     void connected(in ComponentName name, IBinder service, boolean dead);
 }
 
diff --git a/core/java/android/app/IStopUserCallback.aidl b/core/java/android/app/IStopUserCallback.aidl
index 19ac1d5..d3c2ff7 100644
--- a/core/java/android/app/IStopUserCallback.aidl
+++ b/core/java/android/app/IStopUserCallback.aidl
@@ -22,6 +22,7 @@
  */
 interface IStopUserCallback
 {
+    @UnsupportedAppUsage
     void userStopped(int userId);
     void userStopAborted(int userId);
 }
diff --git a/core/java/android/app/ITaskStackListener.aidl b/core/java/android/app/ITaskStackListener.aidl
index 8615f00..841ff6a 100644
--- a/core/java/android/app/ITaskStackListener.aidl
+++ b/core/java/android/app/ITaskStackListener.aidl
@@ -81,6 +81,16 @@
             int requestedDisplayId);
 
     /**
+     * Called when an activity was requested to be launched on a secondary display but was rerouted
+     * to default display.
+     *
+     * @param taskInfo info about the Activity's task
+     * @param requestedDisplayId the id of the requested launch display
+     */
+    void onActivityLaunchOnSecondaryDisplayRerouted(in ActivityManager.RunningTaskInfo taskInfo,
+                int requestedDisplayId);
+
+    /**
      * Called when a task is added.
      *
      * @param taskId id of the task.
@@ -139,4 +149,16 @@
      * Called when a task snapshot got updated.
      */
     void onTaskSnapshotChanged(int taskId, in ActivityManager.TaskSnapshot snapshot);
+
+    /**
+     * Called when the resumed activity is in size compatibility mode and its override configuration
+     * is different from the current one of system.
+     *
+     * @param displayId Id of the display where the activity resides.
+     * @param activityToken Token of the size compatibility mode activity. It will be null when
+     *                      switching to a activity that is not in size compatibility mode or the
+     *                      configuration of the activity.
+     * @see com.android.server.wm.AppWindowToken#inSizeCompatMode
+     */
+    void onSizeCompatModeActivityChanged(int displayId, in IBinder activityToken);
 }
diff --git a/core/java/android/app/ITransientNotification.aidl b/core/java/android/app/ITransientNotification.aidl
index d5b3ed0..09a3ba0 100644
--- a/core/java/android/app/ITransientNotification.aidl
+++ b/core/java/android/app/ITransientNotification.aidl
@@ -19,6 +19,7 @@
 
 /** @hide */
 oneway interface ITransientNotification {
+    @UnsupportedAppUsage
     void show(IBinder windowToken);
     void hide();
 }
diff --git a/core/java/android/app/IWallpaperManager.aidl b/core/java/android/app/IWallpaperManager.aidl
index 666f721..7f5350d 100644
--- a/core/java/android/app/IWallpaperManager.aidl
+++ b/core/java/android/app/IWallpaperManager.aidl
@@ -55,11 +55,13 @@
     /**
      * Set the live wallpaper. This only affects the system wallpaper.
      */
+    @UnsupportedAppUsage
     void setWallpaperComponent(in ComponentName name);
 
     /**
      * Get the wallpaper for a given user.
      */
+    @UnsupportedAppUsage
     ParcelFileDescriptor getWallpaper(String callingPkg, IWallpaperManagerCallback cb, int which,
             out Bundle outParams, int userId);
 
@@ -73,6 +75,7 @@
      * information about that wallpaper.  Otherwise, if it is a static image,
      * simply return null.
      */
+    @UnsupportedAppUsage
     WallpaperInfo getWallpaperInfo(int userId);
 
     /**
@@ -83,6 +86,7 @@
     /**
      * Return whether the current system wallpaper has the given name.
      */
+    @UnsupportedAppUsage
     boolean hasNamedWallpaper(String name);
 
     /**
@@ -94,11 +98,13 @@
     /**
      * Returns the desired minimum width for the wallpaper in a particular display.
      */
+    @UnsupportedAppUsage
     int getWidthHint(int displayId);
 
     /**
      * Returns the desired minimum height for the wallpaper in a particular display.
      */
+    @UnsupportedAppUsage
     int getHeightHint(int displayId);
 
     /**
diff --git a/core/java/android/app/Instrumentation.java b/core/java/android/app/Instrumentation.java
index dda5569..4f94209 100644
--- a/core/java/android/app/Instrumentation.java
+++ b/core/java/android/app/Instrumentation.java
@@ -52,6 +52,7 @@
 import android.view.MotionEvent;
 import android.view.ViewConfiguration;
 import android.view.Window;
+import android.view.WindowManagerGlobal;
 
 import com.android.internal.content.ReferrerIntent;
 
@@ -1102,8 +1103,11 @@
         if ((event.getSource() & InputDevice.SOURCE_CLASS_POINTER) == 0) {
             event.setSource(InputDevice.SOURCE_TOUCHSCREEN);
         }
-        InputManager.getInstance().injectInputEvent(event,
-                InputManager.INJECT_INPUT_EVENT_MODE_WAIT_FOR_FINISH);
+        try {
+            WindowManagerGlobal.getWindowManagerService().injectInputAfterTransactionsApplied(event,
+                    InputManager.INJECT_INPUT_EVENT_MODE_WAIT_FOR_FINISH);
+        } catch (RemoteException e) {
+        }
     }
 
     /**
diff --git a/core/java/android/app/KeyguardManager.java b/core/java/android/app/KeyguardManager.java
index 17f645d..3ecb587 100644
--- a/core/java/android/app/KeyguardManager.java
+++ b/core/java/android/app/KeyguardManager.java
@@ -125,7 +125,7 @@
     public static final int RESULT_ALTERNATE = 1;
 
     /**
-     * @deprecated see {@link BiometricPrompt.Builder#setAllowDeviceCredential(boolean)}
+     * @deprecated see {@link BiometricPrompt.Builder#setDeviceCredentialAllowed(boolean)}
      *
      * Get an intent to prompt the user to confirm credentials (pin, pattern, password or biometrics
      * if enrolled) for the current user of the device. The caller is expected to launch this
diff --git a/core/java/android/app/LoadedApk.java b/core/java/android/app/LoadedApk.java
index 5c4c005..db8c905 100644
--- a/core/java/android/app/LoadedApk.java
+++ b/core/java/android/app/LoadedApk.java
@@ -76,6 +76,7 @@
 import java.util.List;
 import java.util.Objects;
 import java.util.Set;
+import java.util.concurrent.Executor;
 
 final class IntentReceiverLeaked extends AndroidRuntimeException {
     @UnsupportedAppUsage
@@ -232,7 +233,8 @@
         mResources = Resources.getSystem();
         mDefaultClassLoader = ClassLoader.getSystemClassLoader();
         mAppComponentFactory = createAppFactory(mApplicationInfo, mDefaultClassLoader);
-        mClassLoader = mAppComponentFactory.instantiateClassLoader(mDefaultClassLoader);
+        mClassLoader = mAppComponentFactory.instantiateClassLoader(mDefaultClassLoader,
+                new ApplicationInfo(mApplicationInfo));
     }
 
     /**
@@ -243,19 +245,15 @@
         mApplicationInfo = info;
         mDefaultClassLoader = classLoader;
         mAppComponentFactory = createAppFactory(info, mDefaultClassLoader);
-        mClassLoader = mAppComponentFactory.instantiateClassLoader(mDefaultClassLoader);
+        mClassLoader = mAppComponentFactory.instantiateClassLoader(mDefaultClassLoader,
+                new ApplicationInfo(mApplicationInfo));
     }
 
     private AppComponentFactory createAppFactory(ApplicationInfo appInfo, ClassLoader cl) {
         if (appInfo.appComponentFactory != null && cl != null) {
             try {
-                AppComponentFactory factory = (AppComponentFactory) cl.loadClass(
-                        appInfo.appComponentFactory).newInstance();
-                // Pass a copy of ApplicationInfo to the factory. Copying protects the framework
-                // from apps which would override the factory and change ApplicationInfo contents.
-                // ApplicationInfo is used to set up the default class loader.
-                factory.setApplicationInfo(new ApplicationInfo(appInfo));
-                return factory;
+                return (AppComponentFactory)
+                        cl.loadClass(appInfo.appComponentFactory).newInstance();
             } catch (InstantiationException | IllegalAccessException | ClassNotFoundException e) {
                 Slog.e(TAG, "Unable to instantiate appComponentFactory", e);
             }
@@ -729,8 +727,8 @@
                 mDefaultClassLoader = ClassLoader.getSystemClassLoader();
             }
             mAppComponentFactory = createAppFactory(mApplicationInfo, mDefaultClassLoader);
-            mClassLoader = mAppComponentFactory.instantiateClassLoader(mDefaultClassLoader);
-
+            mClassLoader = mAppComponentFactory.instantiateClassLoader(mDefaultClassLoader,
+                    new ApplicationInfo(mApplicationInfo));
             return;
         }
 
@@ -821,7 +819,8 @@
             }
 
             if (mClassLoader == null) {
-                mClassLoader = mAppComponentFactory.instantiateClassLoader(mDefaultClassLoader);
+                mClassLoader = mAppComponentFactory.instantiateClassLoader(mDefaultClassLoader,
+                        new ApplicationInfo(mApplicationInfo));
             }
 
             return;
@@ -935,8 +934,10 @@
         // Call AppComponentFactory to select/create the main class loader of this app.
         // Since this may call code in the app, mDefaultClassLoader must be fully set up
         // before invoking the factory.
+        // Invoke with a copy of ApplicationInfo to protect against the app changing it.
         if (mClassLoader == null) {
-            mClassLoader = mAppComponentFactory.instantiateClassLoader(mDefaultClassLoader);
+            mClassLoader = mAppComponentFactory.instantiateClassLoader(mDefaultClassLoader,
+                    new ApplicationInfo(mApplicationInfo));
         }
     }
 
@@ -1651,6 +1652,16 @@
     @UnsupportedAppUsage
     public final IServiceConnection getServiceDispatcher(ServiceConnection c,
             Context context, Handler handler, int flags) {
+        return getServiceDispatcherCommon(c, context, handler, null, flags);
+    }
+
+    public final IServiceConnection getServiceDispatcher(ServiceConnection c,
+            Context context, Executor executor, int flags) {
+        return getServiceDispatcherCommon(c, context, null, executor, flags);
+    }
+
+    private IServiceConnection getServiceDispatcherCommon(ServiceConnection c,
+            Context context, Handler handler, Executor executor, int flags) {
         synchronized (mServices) {
             LoadedApk.ServiceDispatcher sd = null;
             ArrayMap<ServiceConnection, LoadedApk.ServiceDispatcher> map = mServices.get(context);
@@ -1659,7 +1670,11 @@
                 sd = map.get(c);
             }
             if (sd == null) {
-                sd = new ServiceDispatcher(c, context, handler, flags);
+                if (executor != null) {
+                    sd = new ServiceDispatcher(c, context, executor, flags);
+                } else {
+                    sd = new ServiceDispatcher(c, context, handler, flags);
+                }
                 if (DEBUG) Slog.d(TAG, "Creating new dispatcher " + sd + " for conn " + c);
                 if (map == null) {
                     map = new ArrayMap<>();
@@ -1667,7 +1682,7 @@
                 }
                 map.put(c, sd);
             } else {
-                sd.validate(context, handler);
+                sd.validate(context, handler, executor);
             }
             return sd.getIServiceConnection();
         }
@@ -1744,6 +1759,7 @@
         @UnsupportedAppUsage(maxTargetSdk = Build.VERSION_CODES.P, trackingBug = 115609023)
         private final Context mContext;
         private final Handler mActivityThread;
+        private final Executor mActivityExecutor;
         private final ServiceConnectionLeaked mLocation;
         private final int mFlags;
 
@@ -1783,12 +1799,25 @@
             mConnection = conn;
             mContext = context;
             mActivityThread = activityThread;
+            mActivityExecutor = null;
             mLocation = new ServiceConnectionLeaked(null);
             mLocation.fillInStackTrace();
             mFlags = flags;
         }
 
-        void validate(Context context, Handler activityThread) {
+        ServiceDispatcher(ServiceConnection conn,
+                Context context, Executor activityExecutor, int flags) {
+            mIServiceConnection = new InnerConnection(this);
+            mConnection = conn;
+            mContext = context;
+            mActivityThread = null;
+            mActivityExecutor = activityExecutor;
+            mLocation = new ServiceConnectionLeaked(null);
+            mLocation.fillInStackTrace();
+            mFlags = flags;
+        }
+
+        void validate(Context context, Handler activityThread, Executor activityExecutor) {
             if (mContext != context) {
                 throw new RuntimeException(
                     "ServiceConnection " + mConnection +
@@ -1801,6 +1830,12 @@
                     " registered with differing handler (was " +
                     mActivityThread + " now " + activityThread + ")");
             }
+            if (mActivityExecutor != activityExecutor) {
+                throw new RuntimeException(
+                    "ServiceConnection " + mConnection +
+                    " registered with differing executor (was " +
+                    mActivityExecutor + " now " + activityExecutor + ")");
+            }
         }
 
         void doForget() {
@@ -1840,7 +1875,9 @@
         }
 
         public void connected(ComponentName name, IBinder service, boolean dead) {
-            if (mActivityThread != null) {
+            if (mActivityExecutor != null) {
+                mActivityExecutor.execute(new RunConnection(name, service, 0, dead));
+            } else if (mActivityThread != null) {
                 mActivityThread.post(new RunConnection(name, service, 0, dead));
             } else {
                 doConnected(name, service, dead);
@@ -1848,7 +1885,9 @@
         }
 
         public void death(ComponentName name, IBinder service) {
-            if (mActivityThread != null) {
+            if (mActivityExecutor != null) {
+                mActivityExecutor.execute(new RunConnection(name, service, 1, false));
+            } else if (mActivityThread != null) {
                 mActivityThread.post(new RunConnection(name, service, 1, false));
             } else {
                 doDeath(name, service);
diff --git a/core/java/android/app/Notification.java b/core/java/android/app/Notification.java
index 2e7093d..03806fa 100644
--- a/core/java/android/app/Notification.java
+++ b/core/java/android/app/Notification.java
@@ -31,6 +31,7 @@
 import android.annotation.UnsupportedAppUsage;
 import android.content.Context;
 import android.content.Intent;
+import android.content.LocusId;
 import android.content.pm.ApplicationInfo;
 import android.content.pm.PackageManager;
 import android.content.pm.PackageManager.NameNotFoundException;
@@ -77,6 +78,7 @@
 import android.view.NotificationHeaderView;
 import android.view.View;
 import android.view.ViewGroup;
+import android.view.contentcapture.ContentCaptureContext;
 import android.widget.ProgressBar;
 import android.widget.RemoteViews;
 
@@ -1271,6 +1273,7 @@
     private long mTimeout;
 
     private String mShortcutId;
+    private LocusId mLocusId;
     private CharSequence mSettingsText;
 
     private BubbleMetadata mBubbleMetadata;
@@ -1629,6 +1632,7 @@
              *
              * @see Notification.Action#extras
              */
+            @NonNull
             public Builder addExtras(Bundle extras) {
                 if (extras != null) {
                     mExtras.putAll(extras);
@@ -1652,6 +1656,7 @@
              * @param remoteInput a {@link RemoteInput} to add to the action
              * @return this object for method chaining
              */
+            @NonNull
             public Builder addRemoteInput(RemoteInput remoteInput) {
                 if (mRemoteInputs == null) {
                     mRemoteInputs = new ArrayList<RemoteInput>();
@@ -1669,6 +1674,7 @@
              * @return this object for method chaining
              * The default value is {@code true}
              */
+            @NonNull
             public Builder setAllowGeneratedReplies(boolean allowGeneratedReplies) {
                 mAllowGeneratedReplies = allowGeneratedReplies;
                 return this;
@@ -1682,6 +1688,7 @@
              * {@code SEMANTIC_ACTION_} prefixes
              * @return this object for method chaining
              */
+            @NonNull
             public Builder setSemanticAction(@SemanticAction int semanticAction) {
                 mSemanticAction = semanticAction;
                 return this;
@@ -1692,6 +1699,7 @@
              * dependent on the notification message body. An example of a contextual action could
              * be an action opening a map application with an address shown in the notification.
              */
+            @NonNull
             public Builder setContextual(boolean isContextual) {
                 mIsContextual = isContextual;
                 return this;
@@ -1701,6 +1709,7 @@
              * Apply an extender to this action builder. Extenders may be used to add
              * metadata or change options on this builder.
              */
+            @NonNull
             public Builder extend(Extender extender) {
                 extender.extend(this);
                 return this;
@@ -1728,6 +1737,7 @@
              * object.
              * @return the built action
              */
+            @NonNull
             public Action build() {
                 checkContextualActionNullFields();
 
@@ -1802,7 +1812,7 @@
             out.writeInt(mIsContextual ? 1 : 0);
         }
 
-        public static final Parcelable.Creator<Action> CREATOR =
+        public static final @android.annotation.NonNull Parcelable.Creator<Action> CREATOR =
                 new Parcelable.Creator<Action>() {
             public Action createFromParcel(Parcel in) {
                 return new Action(in);
@@ -2267,6 +2277,10 @@
             mShortcutId = parcel.readString();
         }
 
+        if (parcel.readInt() != 0) {
+            mLocusId = LocusId.CREATOR.createFromParcel(parcel);
+        }
+
         mBadgeIcon = parcel.readInt();
 
         if (parcel.readInt() != 0) {
@@ -2390,6 +2404,7 @@
         that.mChannelId = this.mChannelId;
         that.mTimeout = this.mTimeout;
         that.mShortcutId = this.mShortcutId;
+        that.mLocusId = this.mLocusId;
         that.mBadgeIcon = this.mBadgeIcon;
         that.mSettingsText = this.mSettingsText;
         that.mGroupAlertBehavior = this.mGroupAlertBehavior;
@@ -2705,6 +2720,13 @@
             parcel.writeInt(0);
         }
 
+        if (mLocusId != null) {
+            parcel.writeInt(1);
+            mLocusId.writeToParcel(parcel, 0);
+        } else {
+            parcel.writeInt(0);
+        }
+
         parcel.writeInt(mBadgeIcon);
 
         if (mSettingsText != null) {
@@ -2731,7 +2753,7 @@
     /**
      * Parcelable.Creator that instantiates Notification objects
      */
-    public static final Parcelable.Creator<Notification> CREATOR
+    public static final @android.annotation.NonNull Parcelable.Creator<Notification> CREATOR
             = new Parcelable.Creator<Notification>()
     {
         public Notification createFromParcel(Parcel parcel)
@@ -3018,6 +3040,10 @@
             sb.append(" publicVersion=");
             sb.append(publicVersion.toString());
         }
+        if (this.mLocusId != null) {
+            sb.append(" locusId=");
+            sb.append(this.mLocusId); // LocusId.toString() is PII safe.
+        }
         sb.append(")");
         return sb.toString();
     }
@@ -3120,6 +3146,16 @@
         return mShortcutId;
     }
 
+    /**
+     * Gets the {@link LocusId} associated with this notification.
+     *
+     * <p>Used by the device's intelligence services to correlate objects (such as
+     * {@link ShortcutInfo} and {@link ContentCaptureContext}) that are correlated.
+     */
+    @Nullable
+    public LocusId getLocusId() {
+        return mLocusId;
+    }
 
     /**
      * Returns the settings text provided to {@link Builder#setSettingsText(CharSequence)}.
@@ -3471,12 +3507,26 @@
          * @param shortcutId the {@link ShortcutInfo#getId() id} of the shortcut this notification
          *                   supersedes
          */
+        @NonNull
         public Builder setShortcutId(String shortcutId) {
             mN.mShortcutId = shortcutId;
             return this;
         }
 
         /**
+         * Sets the {@link LocusId} associated with this notification.
+         *
+         * <p>This method should be called when the {@link LocusId} is used in other places (such
+         * as {@link ShortcutInfo} and {@link ContentCaptureContext}) so the device's intelligence
+         * services can correlate them.
+         */
+        @NonNull
+        public Builder setLocusId(@Nullable LocusId locusId) {
+            mN.mLocusId = locusId;
+            return this;
+        }
+
+        /**
          * Sets which icon to display as a badge for this notification.
          *
          * Must be one of {@link #BADGE_ICON_NONE}, {@link #BADGE_ICON_SMALL},
@@ -3484,6 +3534,7 @@
          *
          * Note: This value might be ignored, for launchers that don't support badge icons.
          */
+        @NonNull
         public Builder setBadgeIconType(int icon) {
             mN.mBadgeIcon = icon;
             return this;
@@ -3499,6 +3550,7 @@
          *
          * <p> The default value is {@link #GROUP_ALERT_ALL}.</p>
          */
+        @NonNull
         public Builder setGroupAlertBehavior(@GroupAlertBehavior int groupAlertBehavior) {
             mN.mGroupAlertBehavior = groupAlertBehavior;
             return this;
@@ -3515,6 +3567,7 @@
          * outside of the notification shade on unlocked devices. When a user interacts with the
          * collapsed state, the bubble intent will be invoked and displayed.</b>
          */
+        @NonNull
         public Builder setBubbleMetadata(BubbleMetadata data) {
             mN.mBubbleMetadata = data;
             return this;
@@ -3530,6 +3583,7 @@
         /**
          * Specifies the channel the notification should be delivered on.
          */
+        @NonNull
         public Builder setChannelId(String channelId) {
             mN.mChannelId = channelId;
             return this;
@@ -3546,6 +3600,7 @@
          * Specifies a duration in milliseconds after which this notification should be canceled,
          * if it is not already canceled.
          */
+        @NonNull
         public Builder setTimeoutAfter(long durationMs) {
             mN.mTimeout = durationMs;
             return this;
@@ -3560,6 +3615,7 @@
          *
          * @see Notification#when
          */
+        @NonNull
         public Builder setWhen(long when) {
             mN.when = when;
             return this;
@@ -3571,6 +3627,7 @@
          * For apps targeting {@link android.os.Build.VERSION_CODES#N} and above, this defaults to
          * {@code false}. For earlier apps, the default is {@code true}.
          */
+        @NonNull
         public Builder setShowWhen(boolean show) {
             mN.extras.putBoolean(EXTRA_SHOW_WHEN, show);
             return this;
@@ -3591,6 +3648,7 @@
          * @see Notification#when
          * @see #setChronometerCountDown(boolean)
          */
+        @NonNull
         public Builder setUsesChronometer(boolean b) {
             mN.extras.putBoolean(EXTRA_SHOW_CHRONOMETER, b);
             return this;
@@ -3604,6 +3662,7 @@
          *
          * @see #setUsesChronometer(boolean)
          */
+        @NonNull
         public Builder setChronometerCountDown(boolean countDown) {
             mN.extras.putBoolean(EXTRA_CHRONOMETER_COUNT_DOWN, countDown);
             return this;
@@ -3623,6 +3682,7 @@
          *            A resource ID in the application's package of the drawable to use.
          * @see Notification#icon
          */
+        @NonNull
         public Builder setSmallIcon(@DrawableRes int icon) {
             return setSmallIcon(icon != 0
                     ? Icon.createWithResource(mContext, icon)
@@ -3640,6 +3700,7 @@
          * @see Notification#icon
          * @see Notification#iconLevel
          */
+        @NonNull
         public Builder setSmallIcon(@DrawableRes int icon, int level) {
             mN.iconLevel = level;
             return setSmallIcon(icon);
@@ -3653,6 +3714,7 @@
          * @param icon An Icon object to use.
          * @see Notification#icon
          */
+        @NonNull
         public Builder setSmallIcon(Icon icon) {
             mN.setSmallIcon(icon);
             if (icon != null && icon.getType() == Icon.TYPE_RESOURCE) {
@@ -3664,6 +3726,7 @@
         /**
          * Set the first line of text in the platform notification template.
          */
+        @NonNull
         public Builder setContentTitle(CharSequence title) {
             mN.extras.putCharSequence(EXTRA_TITLE, safeCharSequence(title));
             return this;
@@ -3672,6 +3735,7 @@
         /**
          * Set the second line of text in the platform notification template.
          */
+        @NonNull
         public Builder setContentText(CharSequence text) {
             mN.extras.putCharSequence(EXTRA_TEXT, safeCharSequence(text));
             return this;
@@ -3695,6 +3759,7 @@
          * same time on those versions; they occupy the same place.
          * </p>
          */
+        @NonNull
         public Builder setSubText(CharSequence text) {
             mN.extras.putCharSequence(EXTRA_SUB_TEXT, safeCharSequence(text));
             return this;
@@ -3713,6 +3778,7 @@
          * @param text
          * @return
          */
+        @NonNull
         public Builder setSettingsText(CharSequence text) {
             mN.mSettingsText = safeCharSequence(text);
             return this;
@@ -3732,6 +3798,7 @@
          * <p>Note: The reply text will only be shown on notifications that have least one action
          * with a {@code RemoteInput}.</p>
          */
+        @NonNull
         public Builder setRemoteInputHistory(CharSequence[] text) {
             if (text == null) {
                 mN.extras.putCharSequenceArray(EXTRA_REMOTE_INPUT_HISTORY, null);
@@ -3750,6 +3817,7 @@
          * Sets whether remote history entries view should have a spinner.
          * @hide
          */
+        @NonNull
         public Builder setShowRemoteInputSpinner(boolean showSpinner) {
             mN.extras.putBoolean(EXTRA_SHOW_REMOTE_INPUT_SPINNER, showSpinner);
             return this;
@@ -3759,6 +3827,7 @@
          * Sets whether smart reply buttons should be hidden.
          * @hide
          */
+        @NonNull
         public Builder setHideSmartReplies(boolean hideSmartReplies) {
             mN.extras.putBoolean(EXTRA_HIDE_SMART_REPLIES, hideSmartReplies);
             return this;
@@ -3768,6 +3837,7 @@
          * Sets the number of items this notification represents. May be displayed as a badge count
          * for Launchers that support badging.
          */
+        @NonNull
         public Builder setNumber(int number) {
             mN.number = number;
             return this;
@@ -3794,6 +3864,7 @@
          *
          * The platform template will represent this using a {@link ProgressBar}.
          */
+        @NonNull
         public Builder setProgress(int max, int progress, boolean indeterminate) {
             mN.extras.putInt(EXTRA_PROGRESS, progress);
             mN.extras.putInt(EXTRA_PROGRESS_MAX, max);
@@ -3817,6 +3888,7 @@
          * This will override the layout that would otherwise be constructed by this Builder
          * object.
          */
+        @NonNull
         public Builder setCustomContentView(RemoteViews contentView) {
             mN.contentView = contentView;
             return this;
@@ -3828,6 +3900,7 @@
          * This will override the expanded layout that would otherwise be constructed by this
          * Builder object.
          */
+        @NonNull
         public Builder setCustomBigContentView(RemoteViews contentView) {
             mN.bigContentView = contentView;
             return this;
@@ -3839,6 +3912,7 @@
          * This will override the heads-up layout that would otherwise be constructed by this
          * Builder object.
          */
+        @NonNull
         public Builder setCustomHeadsUpContentView(RemoteViews contentView) {
             mN.headsUpContentView = contentView;
             return this;
@@ -3855,6 +3929,7 @@
          *
          * @see Notification#contentIntent Notification.contentIntent
          */
+        @NonNull
         public Builder setContentIntent(PendingIntent intent) {
             mN.contentIntent = intent;
             return this;
@@ -3865,6 +3940,7 @@
          *
          * @see Notification#deleteIntent
          */
+        @NonNull
         public Builder setDeleteIntent(PendingIntent intent) {
             mN.deleteIntent = intent;
             return this;
@@ -3893,6 +3969,7 @@
          *
          * @see Notification#fullScreenIntent
          */
+        @NonNull
         public Builder setFullScreenIntent(PendingIntent intent, boolean highPriority) {
             mN.fullScreenIntent = intent;
             setFlag(FLAG_HIGH_PRIORITY, highPriority);
@@ -3904,6 +3981,7 @@
          *
          * @see Notification#tickerText
          */
+        @NonNull
         public Builder setTicker(CharSequence tickerText) {
             mN.tickerText = safeCharSequence(tickerText);
             return this;
@@ -3927,6 +4005,7 @@
          * in place of the {@link #setSmallIcon(Icon) small icon} (which will be placed in a small
          * badge atop the large icon).
          */
+        @NonNull
         public Builder setLargeIcon(Bitmap b) {
             return setLargeIcon(b != null ? Icon.createWithBitmap(b) : null);
         }
@@ -3938,6 +4017,7 @@
          * in place of the {@link #setSmallIcon(Icon) small icon} (which will be placed in a small
          * badge atop the large icon).
          */
+        @NonNull
         public Builder setLargeIcon(Icon icon) {
             mN.mLargeIcon = icon;
             mN.extras.putParcelable(EXTRA_LARGE_ICON, icon);
@@ -4045,6 +4125,7 @@
 
          * @see Notification#FLAG_ONGOING_EVENT
          */
+        @NonNull
         public Builder setOngoing(boolean ongoing) {
             setFlag(FLAG_ONGOING_EVENT, ongoing);
             return this;
@@ -4065,6 +4146,7 @@
          * @see #setColor(int)
          * @see MediaStyle#setMediaSession(MediaSession.Token)
          */
+        @NonNull
         public Builder setColorized(boolean colorize) {
             mN.extras.putBoolean(EXTRA_COLORIZED, colorize);
             return this;
@@ -4076,6 +4158,7 @@
          *
          * @see Notification#FLAG_ONLY_ALERT_ONCE
          */
+        @NonNull
         public Builder setOnlyAlertOnce(boolean onlyAlertOnce) {
             setFlag(FLAG_ONLY_ALERT_ONCE, onlyAlertOnce);
             return this;
@@ -4086,6 +4169,7 @@
          *
          * @see Notification#FLAG_AUTO_CANCEL
          */
+        @NonNull
         public Builder setAutoCancel(boolean autoCancel) {
             setFlag(FLAG_AUTO_CANCEL, autoCancel);
             return this;
@@ -4097,6 +4181,7 @@
          * <p>Some notifications can be bridged to other devices for remote display.
          * This hint can be set to recommend this notification not be bridged.
          */
+        @NonNull
         public Builder setLocalOnly(boolean localOnly) {
             setFlag(FLAG_LOCAL_ONLY, localOnly);
             return this;
@@ -4138,6 +4223,7 @@
          *
          * @see Notification#category
          */
+        @NonNull
         public Builder setCategory(String category) {
             mN.category = category;
             return this;
@@ -4195,6 +4281,7 @@
          * @param person the person to add.
          * @see Notification#EXTRA_PEOPLE_LIST
          */
+        @NonNull
         public Builder addPerson(Person person) {
             mPersonList.add(person);
             return this;
@@ -4211,6 +4298,7 @@
          * @param groupKey The group key of the group.
          * @return this object for method chaining
          */
+        @NonNull
         public Builder setGroup(String groupKey) {
             mN.mGroupKey = groupKey;
             return this;
@@ -4224,6 +4312,7 @@
          * @param isGroupSummary Whether this notification should be a group summary.
          * @return this object for method chaining
          */
+        @NonNull
         public Builder setGroupSummary(boolean isGroupSummary) {
             setFlag(FLAG_GROUP_SUMMARY, isGroupSummary);
             return this;
@@ -4241,6 +4330,7 @@
          *
          * @see String#compareTo(String)
          */
+        @NonNull
         public Builder setSortKey(String sortKey) {
             mN.mSortKey = sortKey;
             return this;
@@ -4253,6 +4343,7 @@
          *
          * @see Notification#extras
          */
+        @NonNull
         public Builder addExtras(Bundle extras) {
             if (extras != null) {
                 mUserExtras.putAll(extras);
@@ -4272,6 +4363,7 @@
          *
          * @see Notification#extras
          */
+        @NonNull
         public Builder setExtras(Bundle extras) {
             if (extras != null) {
                 mUserExtras = extras;
@@ -4339,6 +4431,7 @@
          *
          * @param action The action to add.
          */
+        @NonNull
         public Builder addAction(Action action) {
             if (action != null) {
                 mActions.add(action);
@@ -4353,6 +4446,7 @@
          * @param actions
          * @return
          */
+        @NonNull
         public Builder setActions(Action... actions) {
             mActions.clear();
             for (int i = 0; i < actions.length; i++) {
@@ -4368,6 +4462,7 @@
          *
          * @param style Object responsible for modifying the notification style.
          */
+        @NonNull
         public Builder setStyle(Style style) {
             if (mStyle != style) {
                 mStyle = style;
@@ -4393,6 +4488,7 @@
          *
          * @return The same Builder.
          */
+        @NonNull
         public Builder setVisibility(@Visibility int visibility) {
             mN.visibility = visibility;
             return this;
@@ -4404,6 +4500,7 @@
          * @param n A replacement notification, presumably with some or all info redacted.
          * @return The same Builder.
          */
+        @NonNull
         public Builder setPublicVersion(Notification n) {
             if (n != null) {
                 mN.publicVersion = new Notification();
@@ -4418,6 +4515,7 @@
          * Apply an extender to this notification builder. Extenders may be used to add
          * metadata or change options on this builder.
          */
+        @NonNull
         public Builder extend(Extender extender) {
             extender.extend(this);
             return this;
@@ -4426,6 +4524,7 @@
         /**
          * @hide
          */
+        @NonNull
         public Builder setFlag(int mask, boolean value) {
             if (value) {
                 mN.flags |= mask;
@@ -4442,6 +4541,7 @@
          *
          * @return The same Builder.
          */
+        @NonNull
         public Builder setColor(@ColorInt int argb) {
             mN.color = argb;
             sanitizeColor();
@@ -5674,6 +5774,7 @@
          * Apply the unstyled operations and return a new {@link Notification} object.
          * @hide
          */
+        @NonNull
         public Notification buildUnstyled() {
             if (mActions.size() > 0) {
                 mN.actions = new Action[mActions.size()];
@@ -5694,6 +5795,7 @@
          * @param context The context for your application / activity.
          * @param n The notification to create a Builder from.
          */
+        @NonNull
         public static Notification.Builder recoverBuilder(Context context, Notification n) {
             // Re-create notification context so we can access app resources.
             ApplicationInfo applicationInfo = n.extras.getParcelable(
@@ -5718,6 +5820,7 @@
          * Determines whether the platform can generate contextual actions for a notification.
          * By default this is true.
          */
+        @NonNull
         public Builder setAllowSystemGeneratedContextualActions(boolean allowed) {
             mN.mAllowSystemGeneratedContextualActions = allowed;
             return this;
@@ -5735,6 +5838,7 @@
          * Combine all of the options that have been set and return a new {@link Notification}
          * object.
          */
+        @NonNull
         public Notification build() {
             // first, add any extras from the calling code
             if (mUserExtras != null) {
@@ -5793,7 +5897,8 @@
          *
          * @hide
          */
-        public Notification buildInto(Notification n) {
+        @NonNull
+        public Notification buildInto(@NonNull Notification n) {
             build().cloneInto(n, true);
             return n;
         }
@@ -8511,7 +8616,7 @@
             return (mFlags & FLAG_SUPPRESS_INITIAL_NOTIFICATION) != 0;
         }
 
-        public static final Parcelable.Creator<BubbleMetadata> CREATOR =
+        public static final @android.annotation.NonNull Parcelable.Creator<BubbleMetadata> CREATOR =
                 new Parcelable.Creator<BubbleMetadata>() {
 
                     @Override
diff --git a/core/java/android/app/NotificationChannel.java b/core/java/android/app/NotificationChannel.java
index cfe27c7..5cdf85a 100644
--- a/core/java/android/app/NotificationChannel.java
+++ b/core/java/android/app/NotificationChannel.java
@@ -942,7 +942,7 @@
         return sb.toString();
     }
 
-    public static final Creator<NotificationChannel> CREATOR = new Creator<NotificationChannel>() {
+    public static final @android.annotation.NonNull Creator<NotificationChannel> CREATOR = new Creator<NotificationChannel>() {
         @Override
         public NotificationChannel createFromParcel(Parcel in) {
             return new NotificationChannel(in);
diff --git a/core/java/android/app/NotificationChannelGroup.java b/core/java/android/app/NotificationChannelGroup.java
index 34cd9f0..a8ee414 100644
--- a/core/java/android/app/NotificationChannelGroup.java
+++ b/core/java/android/app/NotificationChannelGroup.java
@@ -272,7 +272,7 @@
         return record;
     }
 
-    public static final Creator<NotificationChannelGroup> CREATOR =
+    public static final @android.annotation.NonNull Creator<NotificationChannelGroup> CREATOR =
             new Creator<NotificationChannelGroup>() {
         @Override
         public NotificationChannelGroup createFromParcel(Parcel in) {
diff --git a/core/java/android/app/NotificationManager.java b/core/java/android/app/NotificationManager.java
index 8207e0a..ed7aa4a 100644
--- a/core/java/android/app/NotificationManager.java
+++ b/core/java/android/app/NotificationManager.java
@@ -465,7 +465,7 @@
      *        show the user. Must not be null.
      */
     public void notifyAsPackage(@NonNull String targetPackage, @NonNull String tag, int id,
-            Notification notification) {
+            @NonNull Notification notification) {
         INotificationManager service = getService();
         String sender = mContext.getPackageName();
 
@@ -589,11 +589,11 @@
      * received on your behalf from the cloud, without your process having to wake up.
      *
      * You can check if you have an allowed delegate with {@link #getNotificationDelegate()} and
-     * revoke your delegate with {@link #revokeNotificationDelegate()}.
+     * revoke your delegate by passing null to this method.
      *
      * @param delegate Package name of the app which can send notifications on your behalf.
      */
-    public void setNotificationDelegate(@NonNull String delegate) {
+    public void setNotificationDelegate(@Nullable String delegate) {
         INotificationManager service = getService();
         String pkg = mContext.getPackageName();
         if (localLOGV) Log.v(TAG, pkg + ": cancelAll()");
@@ -605,20 +605,6 @@
     }
 
     /**
-     * Revokes permission for your {@link #setNotificationDelegate(String) notification delegate}
-     * to post notifications on your behalf.
-     */
-    public void revokeNotificationDelegate() {
-        INotificationManager service = getService();
-        String pkg = mContext.getPackageName();
-        try {
-            service.revokeNotificationDelegate(pkg);
-        } catch (RemoteException e) {
-            throw e.rethrowFromSystemServer();
-        }
-    }
-
-    /**
      * Returns the {@link #setNotificationDelegate(String) delegate} that can post notifications on
      * your behalf, if there currently is one.
      */
@@ -638,7 +624,7 @@
      *
      * See {@link #setNotificationDelegate(String)}.
      */
-    public boolean canNotifyAsPackage(String pkg) {
+    public boolean canNotifyAsPackage(@NonNull String pkg) {
         INotificationManager service = getService();
         try {
             return service.canNotifyAsPackage(mContext.getPackageName(), pkg);
@@ -1008,7 +994,7 @@
      * @param id The id of the rule whose state should change
      * @param condition The new state of this rule
      */
-    public void setAutomaticZenRuleState(String id, Condition condition) {
+    public void setAutomaticZenRuleState(@NonNull String id, @NonNull Condition condition) {
         INotificationManager service = getService();
         try {
             service.setAutomaticZenRuleState(id, condition);
@@ -1168,8 +1154,10 @@
      * matches the system intent action
      * TODO: STOPSHIP: Add correct intent
      * {@link android.provider.Settings#ACTION_MANAGE_DEFAULT_APPS_SETTINGS}.
+     * @hide
      */
-    public boolean isNotificationAssistantAccessGranted(ComponentName assistant) {
+    @SystemApi
+    public boolean isNotificationAssistantAccessGranted(@NonNull ComponentName assistant) {
         INotificationManager service = getService();
         try {
             return service.isNotificationAssistantAccessGranted(assistant);
@@ -1842,7 +1830,7 @@
             }
         }
 
-        public static final Parcelable.Creator<Policy> CREATOR = new Parcelable.Creator<Policy>() {
+        public static final @android.annotation.NonNull Parcelable.Creator<Policy> CREATOR = new Parcelable.Creator<Policy>() {
             @Override
             public Policy createFromParcel(Parcel in) {
                 return new Policy(in);
diff --git a/core/java/android/app/PendingIntent.java b/core/java/android/app/PendingIntent.java
index 55014eb..6f7a060 100644
--- a/core/java/android/app/PendingIntent.java
+++ b/core/java/android/app/PendingIntent.java
@@ -1208,7 +1208,7 @@
 
     }
 
-    public static final Parcelable.Creator<PendingIntent> CREATOR
+    public static final @android.annotation.NonNull Parcelable.Creator<PendingIntent> CREATOR
             = new Parcelable.Creator<PendingIntent>() {
         public PendingIntent createFromParcel(Parcel in) {
             IBinder target = in.readStrongBinder();
diff --git a/core/java/android/app/Person.java b/core/java/android/app/Person.java
index 0abc998..14a5589 100644
--- a/core/java/android/app/Person.java
+++ b/core/java/android/app/Person.java
@@ -278,7 +278,7 @@
         }
     }
 
-    public static final Creator<Person> CREATOR = new Creator<Person>() {
+    public static final @android.annotation.NonNull Creator<Person> CREATOR = new Creator<Person>() {
         @Override
         public Person createFromParcel(Parcel in) {
             return new Person(in);
diff --git a/core/java/android/app/PictureInPictureArgs.java b/core/java/android/app/PictureInPictureArgs.java
index adcc495..3ee5173 100644
--- a/core/java/android/app/PictureInPictureArgs.java
+++ b/core/java/android/app/PictureInPictureArgs.java
@@ -346,7 +346,7 @@
         }
     }
 
-    public static final Creator<PictureInPictureArgs> CREATOR =
+    public static final @android.annotation.NonNull Creator<PictureInPictureArgs> CREATOR =
             new Creator<PictureInPictureArgs>() {
                 public PictureInPictureArgs createFromParcel(Parcel in) {
                     return new PictureInPictureArgs(in);
diff --git a/core/java/android/app/PictureInPictureParams.java b/core/java/android/app/PictureInPictureParams.java
index edaae75..bfd966c5 100644
--- a/core/java/android/app/PictureInPictureParams.java
+++ b/core/java/android/app/PictureInPictureParams.java
@@ -275,7 +275,7 @@
         }
     }
 
-    public static final Creator<PictureInPictureParams> CREATOR =
+    public static final @android.annotation.NonNull Creator<PictureInPictureParams> CREATOR =
             new Creator<PictureInPictureParams>() {
                 public PictureInPictureParams createFromParcel(Parcel in) {
                     return new PictureInPictureParams(in);
diff --git a/core/java/android/app/ProcessMemoryHighWaterMark.java b/core/java/android/app/ProcessMemoryHighWaterMark.java
index 5fea8ef..d1cae94 100644
--- a/core/java/android/app/ProcessMemoryHighWaterMark.java
+++ b/core/java/android/app/ProcessMemoryHighWaterMark.java
@@ -40,7 +40,7 @@
         rssHighWaterMarkInBytes = in.readLong();
     }
 
-    public static final Creator<ProcessMemoryHighWaterMark> CREATOR =
+    public static final @android.annotation.NonNull Creator<ProcessMemoryHighWaterMark> CREATOR =
             new Creator<ProcessMemoryHighWaterMark>() {
                 @Override
                 public ProcessMemoryHighWaterMark createFromParcel(Parcel in) {
diff --git a/core/java/android/app/ProcessMemoryState.java b/core/java/android/app/ProcessMemoryState.java
index 95d5d19..e28d79c 100644
--- a/core/java/android/app/ProcessMemoryState.java
+++ b/core/java/android/app/ProcessMemoryState.java
@@ -60,7 +60,7 @@
         startTimeNanos = in.readLong();
     }
 
-    public static final Creator<ProcessMemoryState> CREATOR = new Creator<ProcessMemoryState>() {
+    public static final @android.annotation.NonNull Creator<ProcessMemoryState> CREATOR = new Creator<ProcessMemoryState>() {
         @Override
         public ProcessMemoryState createFromParcel(Parcel in) {
             return new ProcessMemoryState(in);
diff --git a/core/java/android/app/ProfilerInfo.java b/core/java/android/app/ProfilerInfo.java
index 6fbe9c6..25589f8 100644
--- a/core/java/android/app/ProfilerInfo.java
+++ b/core/java/android/app/ProfilerInfo.java
@@ -148,7 +148,7 @@
         proto.end(token);
     }
 
-    public static final Parcelable.Creator<ProfilerInfo> CREATOR =
+    public static final @android.annotation.NonNull Parcelable.Creator<ProfilerInfo> CREATOR =
             new Parcelable.Creator<ProfilerInfo>() {
                 @Override
                 public ProfilerInfo createFromParcel(Parcel in) {
diff --git a/core/java/android/app/RecoverableSecurityException.java b/core/java/android/app/RecoverableSecurityException.java
index 7cc3dab..21fb2a6 100644
--- a/core/java/android/app/RecoverableSecurityException.java
+++ b/core/java/android/app/RecoverableSecurityException.java
@@ -190,7 +190,7 @@
         mUserAction.writeToParcel(dest, flags);
     }
 
-    public static final Creator<RecoverableSecurityException> CREATOR =
+    public static final @android.annotation.NonNull Creator<RecoverableSecurityException> CREATOR =
             new Creator<RecoverableSecurityException>() {
         @Override
         public RecoverableSecurityException createFromParcel(Parcel source) {
diff --git a/core/java/android/app/RemoteAction.java b/core/java/android/app/RemoteAction.java
index c174665..1b13772 100644
--- a/core/java/android/app/RemoteAction.java
+++ b/core/java/android/app/RemoteAction.java
@@ -152,7 +152,7 @@
         pw.println();
     }
 
-    public static final Parcelable.Creator<RemoteAction> CREATOR =
+    public static final @android.annotation.NonNull Parcelable.Creator<RemoteAction> CREATOR =
             new Parcelable.Creator<RemoteAction>() {
                 public RemoteAction createFromParcel(Parcel in) {
                     return new RemoteAction(in);
diff --git a/core/java/android/app/RemoteInput.java b/core/java/android/app/RemoteInput.java
index 392921e..36c524b 100644
--- a/core/java/android/app/RemoteInput.java
+++ b/core/java/android/app/RemoteInput.java
@@ -561,7 +561,7 @@
         out.writeArraySet(mAllowedDataTypes);
     }
 
-    public static final Creator<RemoteInput> CREATOR = new Creator<RemoteInput>() {
+    public static final @android.annotation.NonNull Creator<RemoteInput> CREATOR = new Creator<RemoteInput>() {
         @Override
         public RemoteInput createFromParcel(Parcel in) {
             return new RemoteInput(in);
diff --git a/core/java/android/app/ResultInfo.java b/core/java/android/app/ResultInfo.java
index d916c94..9ee0f31 100644
--- a/core/java/android/app/ResultInfo.java
+++ b/core/java/android/app/ResultInfo.java
@@ -67,7 +67,7 @@
     }
 
     @UnsupportedAppUsage(maxTargetSdk = Build.VERSION_CODES.P, trackingBug = 115609023)
-    public static final Parcelable.Creator<ResultInfo> CREATOR
+    public static final @android.annotation.NonNull Parcelable.Creator<ResultInfo> CREATOR
             = new Parcelable.Creator<ResultInfo>() {
         public ResultInfo createFromParcel(Parcel in) {
             return new ResultInfo(in);
diff --git a/core/java/android/app/SearchDialog.java b/core/java/android/app/SearchDialog.java
index 4a45150..8493fb2 100644
--- a/core/java/android/app/SearchDialog.java
+++ b/core/java/android/app/SearchDialog.java
@@ -47,8 +47,10 @@
 import android.view.WindowManager;
 import android.view.inputmethod.InputMethodManager;
 import android.widget.AutoCompleteTextView;
+import android.widget.Filterable;
 import android.widget.ImageView;
 import android.widget.LinearLayout;
+import android.widget.ListPopupWindow;
 import android.widget.SearchView;
 import android.widget.TextView;
 
@@ -370,7 +372,10 @@
             updateSearchAppIcon();
             updateSearchBadge();
             if (isLandscapeMode(getContext())) {
-                mSearchAutoComplete.ensureImeVisible(true);
+                mSearchAutoComplete.setInputMethodMode(ListPopupWindow.INPUT_METHOD_NEEDED);
+                if (mSearchAutoComplete.isDropDownAlwaysVisible() || enoughToFilter()) {
+                    mSearchAutoComplete.showDropDown();
+                }
             }
         }
     }
@@ -381,6 +386,15 @@
                 == Configuration.ORIENTATION_LANDSCAPE;
     }
 
+    private boolean enoughToFilter() {
+        Filterable filterableAdapter = (Filterable) mSearchAutoComplete.getAdapter();
+        if (filterableAdapter == null || filterableAdapter.getFilter() == null) {
+            return false;
+        }
+
+        return mSearchAutoComplete.enoughToFilter();
+    }
+
     /**
      * Update the UI according to the info in the current value of {@link #mSearchable}.
      */
diff --git a/core/java/android/app/SearchableInfo.java b/core/java/android/app/SearchableInfo.java
index ae6d32a..a01cec7 100644
--- a/core/java/android/app/SearchableInfo.java
+++ b/core/java/android/app/SearchableInfo.java
@@ -800,7 +800,7 @@
     /**
      * Support for parcelable and aidl operations.
      */
-    public static final Parcelable.Creator<SearchableInfo> CREATOR
+    public static final @android.annotation.NonNull Parcelable.Creator<SearchableInfo> CREATOR
     = new Parcelable.Creator<SearchableInfo>() {
         public SearchableInfo createFromParcel(Parcel in) {
             return new SearchableInfo(in);
diff --git a/core/java/android/app/Service.java b/core/java/android/app/Service.java
index f116e13..1f91b3f 100644
--- a/core/java/android/app/Service.java
+++ b/core/java/android/app/Service.java
@@ -27,6 +27,7 @@
 import android.content.Context;
 import android.content.ContextWrapper;
 import android.content.Intent;
+import android.content.pm.ServiceInfo;
 import android.content.pm.ServiceInfo.ForegroundServiceType;
 import android.content.res.Configuration;
 import android.os.Build;
@@ -733,7 +734,7 @@
    * {@link android.R.attr#foregroundServiceType} flags.
    * @throws IllegalArgumentException if param foregroundServiceType is not subset of manifest
    *     attribute {@link android.R.attr#foregroundServiceType}.
-   * @see {@link android.content.pm.ServiceInfo} for the set of FOREGROUND_SERVICE_TYPE flags.
+   * @see android.content.pm.ServiceInfo#FOREGROUND_SERVICE_TYPE_MANIFEST
    */
     public final void startForeground(int id, @NonNull Notification notification,
             @ForegroundServiceType int foregroundServiceType) {
@@ -775,6 +776,30 @@
     }
 
     /**
+     * If the service has become a foreground service by calling
+     * {@link #startForeground(int, Notification)}
+     * or {@link #startForeground(int, Notification, int)}, {@link #getForegroundServiceType()}
+     * returns the current foreground service type.
+     *
+     * <p>If there is no foregroundServiceType specified
+     * in manifest, {@link ServiceInfo#FOREGROUND_SERVICE_TYPE_NONE} is returned. </p>
+     *
+     * <p>If the service is not a foreground service,
+     * {@link ServiceInfo#FOREGROUND_SERVICE_TYPE_NONE} is returned.</p>
+     *
+     * @return current foreground service type flags.
+     */
+    public final @ForegroundServiceType int getForegroundServiceType() {
+        int ret = ServiceInfo.FOREGROUND_SERVICE_TYPE_NONE;
+        try {
+            ret = mActivityManager.getForegroundServiceType(
+                    new ComponentName(this, mClassName), mToken);
+        } catch (RemoteException ex) {
+        }
+        return ret;
+    }
+
+    /**
      * Print the Service's state into the given stream.  This gets invoked if
      * you run "adb shell dumpsys activity service &lt;yourservicename&gt;"
      * (note that for this command to work, the service must be running, and
diff --git a/core/java/android/app/ServiceStartArgs.java b/core/java/android/app/ServiceStartArgs.java
index f030cba..0b000af5 100644
--- a/core/java/android/app/ServiceStartArgs.java
+++ b/core/java/android/app/ServiceStartArgs.java
@@ -58,7 +58,7 @@
         }
     }
 
-    public static final Parcelable.Creator<ServiceStartArgs> CREATOR
+    public static final @android.annotation.NonNull Parcelable.Creator<ServiceStartArgs> CREATOR
             = new Parcelable.Creator<ServiceStartArgs>() {
         public ServiceStartArgs createFromParcel(Parcel in) {
             return new ServiceStartArgs(in);
diff --git a/core/java/android/app/StatusBarManager.java b/core/java/android/app/StatusBarManager.java
index 077652c..9ff363d 100644
--- a/core/java/android/app/StatusBarManager.java
+++ b/core/java/android/app/StatusBarManager.java
@@ -17,7 +17,9 @@
 package android.app;
 
 import android.annotation.IntDef;
+import android.annotation.NonNull;
 import android.annotation.Nullable;
+import android.annotation.RequiresPermission;
 import android.annotation.SystemApi;
 import android.annotation.SystemService;
 import android.annotation.UnsupportedAppUsage;
@@ -364,6 +366,7 @@
      * @hide
      */
     @SystemApi
+    @RequiresPermission(android.Manifest.permission.STATUS_BAR)
     public void setDisabledForSetup(boolean disabled) {
         try {
             final int userId = Binder.getCallingUserHandle().getIdentifier();
@@ -387,6 +390,8 @@
      * @hide
      */
     @SystemApi
+    @RequiresPermission(android.Manifest.permission.STATUS_BAR)
+    @NonNull
     public DisableInfo getDisableInfo() {
         try {
             final int userId = Binder.getCallingUserHandle().getIdentifier();
@@ -518,7 +523,7 @@
          * @hide
          */
         @SystemApi
-        public boolean areNoComponentsDisabled() {
+        public boolean areAllComponentsEnabled() {
             return !mStatusBarExpansion && !mNavigateHome && !mNotificationPeeking && !mRecents
                     && !mSearch;
         }
diff --git a/core/java/android/app/SystemServiceRegistry.java b/core/java/android/app/SystemServiceRegistry.java
index 1faa2ac..90bc0a6 100644
--- a/core/java/android/app/SystemServiceRegistry.java
+++ b/core/java/android/app/SystemServiceRegistry.java
@@ -26,6 +26,7 @@
 import android.app.job.IJobScheduler;
 import android.app.job.JobScheduler;
 import android.app.prediction.AppPredictionManager;
+import android.app.role.RoleControllerManager;
 import android.app.role.RoleManager;
 import android.app.slice.SliceManager;
 import android.app.timedetector.TimeDetector;
@@ -1243,6 +1244,14 @@
                         return new RoleManager(ctx.getOuterContext());
                     }});
 
+        registerService(Context.ROLE_CONTROLLER_SERVICE, RoleControllerManager.class,
+                new CachedServiceFetcher<RoleControllerManager>() {
+                    @Override
+                    public RoleControllerManager createService(ContextImpl ctx)
+                            throws ServiceNotFoundException {
+                        return new RoleControllerManager(ctx.getOuterContext());
+                    }});
+
         registerService(Context.ROLLBACK_SERVICE, RollbackManager.class,
                 new CachedServiceFetcher<RollbackManager>() {
                     @Override
diff --git a/core/java/android/app/TEST_MAPPING b/core/java/android/app/TEST_MAPPING
index 65859c7..14c58e7 100644
--- a/core/java/android/app/TEST_MAPPING
+++ b/core/java/android/app/TEST_MAPPING
@@ -1,18 +1,31 @@
 {
-  "imports": [
-    {
-      "path": "frameworks/base/services/core/java/com/android/server/am"
-    },
-    {
-      "path": "frameworks/base/services/core/java/com/android/server/wm"
-    }
-  ],
-  "presubmit": [
-      {
-        "name": "CtsFragmentTestCases"
-      },
-      {
-        "name": "CtsFragmentTestCasesSdk26"
-      }
-  ]
+    "imports": [
+        {
+            "path": "frameworks/base/services/core/java/com/android/server/am"
+        },
+        {
+            "path": "frameworks/base/services/core/java/com/android/server/wm"
+        }
+    ],
+    "presubmit": [
+        {
+            "name": "CtsFragmentTestCases"
+        },
+        {
+            "name": "CtsFragmentTestCasesSdk26"
+        },
+        {
+            "file_patterns": ["(/|^)AppOpsManager.java"],
+            "name": "CtsAppOpsTestCases"
+        },
+        {
+            "file_patterns": ["(/|^)AppOpsManager.java"],
+            "name": "FrameworksServicesTests",
+            "options": [
+                {
+                    "include-filter": "com.android.server.appop"
+                }
+            ]
+        }
+    ]
 }
diff --git a/core/java/android/app/TaskStackListener.java b/core/java/android/app/TaskStackListener.java
index fcc76ac..97b9176 100644
--- a/core/java/android/app/TaskStackListener.java
+++ b/core/java/android/app/TaskStackListener.java
@@ -19,6 +19,7 @@
 import android.annotation.UnsupportedAppUsage;
 import android.app.ActivityManager.TaskSnapshot;
 import android.content.ComponentName;
+import android.os.IBinder;
 import android.os.RemoteException;
 
 /**
@@ -85,6 +86,12 @@
     }
 
     @Override
+    @UnsupportedAppUsage
+    public void onActivityLaunchOnSecondaryDisplayRerouted(ActivityManager.RunningTaskInfo taskInfo,
+            int requestedDisplayId) throws RemoteException {
+    }
+
+    @Override
     public void onTaskCreated(int taskId, ComponentName componentName) throws RemoteException {
     }
 
@@ -149,4 +156,10 @@
     @UnsupportedAppUsage
     public void onTaskSnapshotChanged(int taskId, TaskSnapshot snapshot) throws RemoteException {
     }
+
+    @Override
+    @UnsupportedAppUsage
+    public void onSizeCompatModeActivityChanged(int displayId, IBinder activityToken)
+            throws RemoteException {
+    }
 }
diff --git a/core/java/android/app/VoiceInteractor.java b/core/java/android/app/VoiceInteractor.java
index 823c427..36ba78b 100644
--- a/core/java/android/app/VoiceInteractor.java
+++ b/core/java/android/app/VoiceInteractor.java
@@ -500,7 +500,7 @@
                 dest.writeBundle(mExtras);
             }
 
-            public static final Parcelable.Creator<Option> CREATOR
+            public static final @android.annotation.NonNull Parcelable.Creator<Option> CREATOR
                     = new Parcelable.Creator<Option>() {
                 public Option createFromParcel(Parcel in) {
                     return new Option(in);
@@ -869,7 +869,7 @@
             dest.writeCharSequence(mVisualPrompt);
         }
 
-        public static final Creator<Prompt> CREATOR
+        public static final @android.annotation.NonNull Creator<Prompt> CREATOR
                 = new Creator<Prompt>() {
             public Prompt createFromParcel(Parcel in) {
                 return new Prompt(in);
diff --git a/core/java/android/app/Vr2dDisplayProperties.java b/core/java/android/app/Vr2dDisplayProperties.java
index 1752131..bcb8592 100644
--- a/core/java/android/app/Vr2dDisplayProperties.java
+++ b/core/java/android/app/Vr2dDisplayProperties.java
@@ -112,7 +112,7 @@
         dest.writeInt(mRemovedFlags);
     }
 
-    public static final Parcelable.Creator<Vr2dDisplayProperties> CREATOR
+    public static final @android.annotation.NonNull Parcelable.Creator<Vr2dDisplayProperties> CREATOR
             = new Parcelable.Creator<Vr2dDisplayProperties>() {
         @Override
         public Vr2dDisplayProperties createFromParcel(Parcel source) {
diff --git a/core/java/android/app/WaitResult.java b/core/java/android/app/WaitResult.java
index ad9f680..d65be9b 100644
--- a/core/java/android/app/WaitResult.java
+++ b/core/java/android/app/WaitResult.java
@@ -86,7 +86,7 @@
         dest.writeInt(launchState);
     }
 
-    public static final Parcelable.Creator<WaitResult> CREATOR
+    public static final @android.annotation.NonNull Parcelable.Creator<WaitResult> CREATOR
             = new Parcelable.Creator<WaitResult>() {
         @Override
         public WaitResult createFromParcel(Parcel source) {
diff --git a/core/java/android/app/WallpaperColors.java b/core/java/android/app/WallpaperColors.java
index 38a98d3c8..6765d0b 100644
--- a/core/java/android/app/WallpaperColors.java
+++ b/core/java/android/app/WallpaperColors.java
@@ -260,7 +260,7 @@
         mColorHints = colorHints;
     }
 
-    public static final Creator<WallpaperColors> CREATOR = new Creator<WallpaperColors>() {
+    public static final @android.annotation.NonNull Creator<WallpaperColors> CREATOR = new Creator<WallpaperColors>() {
         @Override
         public WallpaperColors createFromParcel(Parcel in) {
             return new WallpaperColors(in);
diff --git a/core/java/android/app/WallpaperInfo.java b/core/java/android/app/WallpaperInfo.java
index 28c79aa..e9b0175 100644
--- a/core/java/android/app/WallpaperInfo.java
+++ b/core/java/android/app/WallpaperInfo.java
@@ -16,6 +16,7 @@
 
 package android.app;
 
+import android.annotation.Nullable;
 import android.annotation.SystemApi;
 import android.app.slice.Slice;
 import android.content.ComponentName;
@@ -354,12 +355,17 @@
     
     /**
      * Returns an URI that provides a settings {@link Slice} for this wallpaper.
+     * The wallpaper should implement a SliceProvider associated with this URI.
+     * The system will display the Slice in the customization section while previewing the live
+     * wallpaper. Because this URI is accessible to other apps, it is recommended to protect it
+     * with the android.permission.BIND_WALLPAPER permission.
      *
      * <p>{@code null} will be returned if there is no settings Slice URI associated
      * with the wallpaper.
      *
      * @return The URI.
      */
+    @Nullable
     public Uri getSettingsSliceUri() {
         if (mSettingsSliceUri == null) {
             return null;
@@ -423,7 +429,7 @@
     /**
      * Used to make this class parcelable.
      */
-    public static final Parcelable.Creator<WallpaperInfo> CREATOR = new Parcelable.Creator<WallpaperInfo>() {
+    public static final @android.annotation.NonNull Parcelable.Creator<WallpaperInfo> CREATOR = new Parcelable.Creator<WallpaperInfo>() {
         public WallpaperInfo createFromParcel(Parcel source) {
             return new WallpaperInfo(source);
         }
diff --git a/core/java/android/app/WindowConfiguration.java b/core/java/android/app/WindowConfiguration.java
index e0a15a5..affc8b9 100644
--- a/core/java/android/app/WindowConfiguration.java
+++ b/core/java/android/app/WindowConfiguration.java
@@ -239,7 +239,7 @@
     }
 
     /** @hide */
-    public static final Creator<WindowConfiguration> CREATOR = new Creator<WindowConfiguration>() {
+    public static final @android.annotation.NonNull Creator<WindowConfiguration> CREATOR = new Creator<WindowConfiguration>() {
         @Override
         public WindowConfiguration createFromParcel(Parcel in) {
             return new WindowConfiguration(in);
diff --git a/core/java/android/app/ZygotePreload.java b/core/java/android/app/ZygotePreload.java
index a295af3..eaaeb54 100644
--- a/core/java/android/app/ZygotePreload.java
+++ b/core/java/android/app/ZygotePreload.java
@@ -15,6 +15,7 @@
  */
 package android.app;
 
+import android.annotation.NonNull;
 import android.content.pm.ApplicationInfo;
 
 /**
@@ -27,8 +28,7 @@
  * {@link android.R.styleable#AndroidManifestService_useAppZygote android:useAppZygote} attribute
  * of the &lt;service&gt; tag set to <code>true</code>.
  *
- * Note that this implementations of this class must provide a default constructor with no
- * arguments.
+ * Note that implementations of this class must provide a default constructor with no arguments.
  */
 public interface ZygotePreload {
     /**
@@ -38,5 +38,5 @@
      *
      * @param appInfo The ApplicationInfo object belonging to the application
      */
-    void doPreload(ApplicationInfo appInfo);
+    void doPreload(@NonNull ApplicationInfo appInfo);
 }
diff --git a/core/java/android/app/admin/ConnectEvent.java b/core/java/android/app/admin/ConnectEvent.java
index d511c57..dc32384 100644
--- a/core/java/android/app/admin/ConnectEvent.java
+++ b/core/java/android/app/admin/ConnectEvent.java
@@ -72,7 +72,7 @@
                 mPackageName);
     }
 
-    public static final Parcelable.Creator<ConnectEvent> CREATOR
+    public static final @android.annotation.NonNull Parcelable.Creator<ConnectEvent> CREATOR
             = new Parcelable.Creator<ConnectEvent>() {
         @Override
         public ConnectEvent createFromParcel(Parcel in) {
diff --git a/core/java/android/app/admin/DeviceAdminInfo.java b/core/java/android/app/admin/DeviceAdminInfo.java
index 121161e..00903c4 100644
--- a/core/java/android/app/admin/DeviceAdminInfo.java
+++ b/core/java/android/app/admin/DeviceAdminInfo.java
@@ -525,7 +525,7 @@
     /**
      * Used to make this class parcelable.
      */
-    public static final Parcelable.Creator<DeviceAdminInfo> CREATOR =
+    public static final @android.annotation.NonNull Parcelable.Creator<DeviceAdminInfo> CREATOR =
             new Parcelable.Creator<DeviceAdminInfo>() {
         public DeviceAdminInfo createFromParcel(Parcel source) {
             return new DeviceAdminInfo(source);
diff --git a/core/java/android/app/admin/DevicePolicyManager.java b/core/java/android/app/admin/DevicePolicyManager.java
index a32e01f..7cdd227 100644
--- a/core/java/android/app/admin/DevicePolicyManager.java
+++ b/core/java/android/app/admin/DevicePolicyManager.java
@@ -59,7 +59,6 @@
 import android.os.Bundle;
 import android.os.ParcelFileDescriptor;
 import android.os.Parcelable;
-import android.os.ParcelableException;
 import android.os.PersistableBundle;
 import android.os.Process;
 import android.os.RemoteCallback;
@@ -85,7 +84,6 @@
 import android.service.restrictions.RestrictionsReceiver;
 import android.telephony.TelephonyManager;
 import android.telephony.data.ApnSetting;
-import android.text.TextUtils;
 import android.util.ArraySet;
 import android.util.Log;
 
@@ -1453,7 +1451,7 @@
      * Constant for {@link #getPasswordComplexity()}: password satisfies one of the following:
      * <ul>
      * <li>PIN with <b>no</b> repeating (4444) or ordered (1234, 4321, 2468) sequences, length at
-     * least 4
+     * least 8
      * <li>alphabetic, length at least 6
      * <li>alphanumeric, length at least 6
      * </ul>
@@ -2211,7 +2209,7 @@
             PRIVATE_DNS_SET_ERROR_FAILURE_SETTING
     })
     @Retention(RetentionPolicy.SOURCE)
-    public @interface SetPrivateDnsModeResultConstants {}
+    public @interface PrivateDnsModeErrorCodes {}
 
     /**
      * Activity action: Starts the administrator to get the mode for the provisioning.
@@ -3154,7 +3152,7 @@
      * {@link #PASSWORD_QUALITY_ALPHANUMERIC} with {@link #setPasswordQuality}.
      * <p>
      * On devices not supporting {@link PackageManager#FEATURE_SECURE_LOCK_SCREEN} feature, the
-     * password is always treated as empty.
+     * password history length is always 0.
      * <p>
      * The calling device admin must have requested
      * {@link DeviceAdminInfo#USES_POLICY_LIMIT_PASSWORD} to be able to call this method; if it has
@@ -3192,6 +3190,9 @@
      * <p>
      * To disable password expiration, a value of 0 may be used for timeout.
      * <p>
+     * On devices not supporting {@link PackageManager#FEATURE_SECURE_LOCK_SCREEN} feature, the
+     * password expiration is always disabled.
+     * <p>
      * The calling device admin must have requested
      * {@link DeviceAdminInfo#USES_POLICY_EXPIRE_PASSWORD} to be able to call this method; if it has
      * not, a security exception will be thrown.
@@ -3231,6 +3232,9 @@
      * returned by {@link #getParentProfileInstance(ComponentName)} in order to retrieve
      * restrictions on the parent profile.
      *
+     * <p>On devices not supporting {@link PackageManager#FEATURE_SECURE_LOCK_SCREEN} feature, the
+     * password expiration is always disabled and this method always returns 0.
+     *
      * @param admin The name of the admin component to check, or {@code null} to aggregate all admins.
      * @return The timeout for the given admin or the minimum of all timeouts
      */
@@ -3256,6 +3260,9 @@
      * returned by {@link #getParentProfileInstance(ComponentName)} in order to retrieve
      * the password expiration for the parent profile.
      *
+     * <p>On devices not supporting {@link PackageManager#FEATURE_SECURE_LOCK_SCREEN} feature, the
+     * password expiration is always disabled and this method always returns 0.
+     *
      * @param admin The name of the admin component to check, or {@code null} to aggregate all admins.
      * @return The password expiration time, in milliseconds since epoch.
      */
@@ -3280,6 +3287,9 @@
      * returned by {@link #getParentProfileInstance(ComponentName)} in order to retrieve
      * restrictions on the parent profile.
      *
+     * <p>On devices not supporting {@link PackageManager#FEATURE_SECURE_LOCK_SCREEN} feature, the
+     * password history length is always 0.
+     *
      * @param admin The name of the admin component to check, or {@code null} to aggregate
      * all admins.
      * @return The length of the password history
@@ -3307,7 +3317,7 @@
      * Return the maximum password length that the device supports for a
      * particular password quality.
      * <p>On devices not supporting {@link PackageManager#FEATURE_SECURE_LOCK_SCREEN} feature, the
-     * password is always empty.
+     * password is always empty and this method always returns 0.
      * @param quality The quality being interrogated.
      * @return Returns the maximum length that the user can enter.
      */
@@ -3363,7 +3373,7 @@
      * #getParentProfileInstance}.
      *
      * <p>On devices not supporting {@link PackageManager#FEATURE_SECURE_LOCK_SCREEN} feature, the
-     * password is always treated as empty.
+     * password is always empty and this method returns {@link #PASSWORD_COMPLEXITY_NONE}.
      *
      * @throws IllegalStateException if the user is not unlocked.
      * @throws SecurityException if the calling application does not have the permission
@@ -3438,6 +3448,8 @@
      * <p>
      * The calling device admin must have requested {@link DeviceAdminInfo#USES_POLICY_WATCH_LOGIN}
      * to be able to call this method; if it has not, a security exception will be thrown.
+     * <p>On devices not supporting {@link PackageManager#FEATURE_SECURE_LOCK_SCREEN} feature, the
+     * password is always empty and this method always returns 0.
      *
      * @return The number of times user has entered an incorrect password since the last correct
      *         password entry.
@@ -3504,6 +3516,8 @@
      * This method can be called on the {@link DevicePolicyManager} instance returned by
      * {@link #getParentProfileInstance(ComponentName)} in order to set a value on the parent
      * profile.
+     * <p>On devices not supporting {@link PackageManager#FEATURE_SECURE_LOCK_SCREEN} feature, the
+     * password is always empty and this method has no effect - i.e. the policy is not set.
      *
      * @param admin Which {@link DeviceAdminReceiver} this request is associated with.
      * @param num The number of failed password attempts at which point the device or profile will
@@ -3533,6 +3547,10 @@
      * returned by {@link #getParentProfileInstance(ComponentName)} in order to retrieve
      * the value for the parent profile.
      *
+     * <p>On devices not supporting {@link PackageManager#FEATURE_SECURE_LOCK_SCREEN} feature, the
+     * password is always empty and this method returns a default value (0) indicating that the
+     * policy is not set.
+     *
      * @param admin The name of the admin component to check, or {@code null} to aggregate
      * all admins.
      */
@@ -3620,6 +3638,8 @@
      * {@link android.os.Build.VERSION_CODES#N} and later for managed profiles, or for device admins
      * that are not device owner or profile owner.  Once set, the password cannot be changed to null
      * or empty except by these admins.</em>
+     * <p>On devices not supporting {@link PackageManager#FEATURE_SECURE_LOCK_SCREEN} feature, this
+     * methods does nothing.
      * <p>
      * The calling device admin must have requested
      * {@link DeviceAdminInfo#USES_POLICY_RESET_PASSWORD} to be able to call this method; if it has
@@ -3670,6 +3690,8 @@
      * will be stored on your server and who will need access to them. Tokens may be the subject of
      * legal access requests.
      * </em>
+     * <p>On devices not supporting {@link PackageManager#FEATURE_SECURE_LOCK_SCREEN} feature, the
+     * reset token is not set and this method returns false.
      *
      * @param admin Which {@link DeviceAdminReceiver} this request is associated with.
      * @param token a secure token a least 32-byte long, which must be generated by a
@@ -3694,6 +3716,10 @@
     /**
      * Called by a profile or device owner to revoke the current password reset token.
      *
+     * <p>On devices not supporting {@link PackageManager#FEATURE_SECURE_LOCK_SCREEN} feature, this
+     * method has no effect - the reset token should not have been set in the first place - and
+     * false is returned.
+     *
      * @param admin Which {@link DeviceAdminReceiver} this request is associated with.
      * @return true if the operation is successful, false otherwise.
      * @throws SecurityException if admin is not a device or profile owner.
@@ -3714,6 +3740,9 @@
     /**
      * Called by a profile or device owner to check if the current reset password token is active.
      *
+     * <p>On devices not supporting {@link PackageManager#FEATURE_SECURE_LOCK_SCREEN} feature,
+     * false is always returned.
+     *
      * @param admin Which {@link DeviceAdminReceiver} this request is associated with.
      * @return true if the token is active, false otherwise.
      * @throws SecurityException if admin is not a device or profile owner.
@@ -3749,6 +3778,8 @@
      * <p>
      * Calling with a {@code null} or empty password will clear any existing PIN, pattern or
      * password if the current password constraints allow it.
+     * <p>On devices not supporting {@link PackageManager#FEATURE_SECURE_LOCK_SCREEN} feature,
+     * calling this methods has no effect - the password is always empty - and false is returned.
      *
      * @param admin Which {@link DeviceAdminReceiver} this request is associated with.
      * @param password The new password for the user. {@code null} or empty clears the password.
@@ -3856,6 +3887,9 @@
      * {@link #getParentProfileInstance(ComponentName)} in order to set restrictions on the parent
      * profile.
      *
+     * <p>On devices not supporting {@link PackageManager#FEATURE_SECURE_LOCK_SCREEN} feature,
+     * calling this methods has no effect - i.e. the timeout is not set.
+     *
      * @param admin Which {@link DeviceAdminReceiver} this request is associated with.
      * @param timeoutMs The new timeout in milliseconds, after which the user will have to unlock
      *         with strong authentication method. A value of 0 means the admin is not participating
@@ -3888,6 +3922,9 @@
      * returned by {@link #getParentProfileInstance(ComponentName)} in order to retrieve
      * restrictions on the parent profile.
      *
+     * <p>On devices not supporting {@link PackageManager#FEATURE_SECURE_LOCK_SCREEN} feature,
+     * 0 is returned to indicate that no timeout is configured.
+     *
      * @param admin The name of the admin component to check, or {@code null} to aggregate
      *         across all participating admins.
      * @return The timeout in milliseconds or 0 if not configured for the provided admin.
@@ -6618,6 +6655,9 @@
      * This method can be called on the {@link DevicePolicyManager} instance returned by
      * {@link #getParentProfileInstance(ComponentName)} in order to set the configuration for
      * the parent profile.
+     * <p>
+     * On devices not supporting {@link PackageManager#FEATURE_SECURE_LOCK_SCREEN} feature, calling
+     * this method has no effect - no trust agent configuration will be set.
      *
      * @param admin Which {@link DeviceAdminReceiver} this request is associated with.
      * @param target Component name of the agent to be configured.
@@ -6647,6 +6687,9 @@
      * This method can be called on the {@link DevicePolicyManager} instance returned by
      * {@link #getParentProfileInstance(ComponentName)} in order to retrieve the configuration set
      * on the parent profile.
+     * <p>
+     * On devices not supporting {@link PackageManager#FEATURE_SECURE_LOCK_SCREEN} feature, null is
+     * always returned.
      *
      * @param admin Which {@link DeviceAdminReceiver} this request is associated with. If null,
      * this function returns a list of configurations for all admins that declare
@@ -10406,13 +10449,41 @@
     }
 
     /**
-     * Sets the global Private DNS mode and host to be used.
+     * Sets the global Private DNS mode to opportunistic.
      * May only be called by the device owner.
      *
-     * <p>Note that in case a Private DNS resolver is specified, the method is blocking as it
-     * will perform a connectivity check to the resolver, to ensure it is valid. Because of that,
-     * the method should not be called on any thread that relates to user interaction, such as the
-     * UI thread.
+     * <p>In this mode, the DNS subsystem will attempt a TLS handshake to the network-supplied
+     * resolver prior to attempting name resolution in cleartext.
+     *
+     * @param admin which {@link DeviceAdminReceiver} this request is associated with.
+     *
+     * @return {@code PRIVATE_DNS_SET_SUCCESS} if the mode was set successfully, or
+     *         {@code PRIVATE_DNS_SET_ERROR_FAILURE_SETTING} if it could not be set.
+     *
+     * @throws SecurityException if the caller is not the device owner.
+     */
+    public @PrivateDnsModeErrorCodes int setGlobalPrivateDnsModeOpportunistic(
+            @NonNull ComponentName admin) {
+        throwIfParentInstance("setGlobalPrivateDnsModeOpportunistic");
+
+        if (mService == null) {
+            return PRIVATE_DNS_SET_ERROR_FAILURE_SETTING;
+        }
+
+        try {
+            return mService.setGlobalPrivateDns(admin, PRIVATE_DNS_MODE_OPPORTUNISTIC, null);
+        } catch (RemoteException re) {
+            throw re.rethrowFromSystemServer();
+        }
+    }
+
+    /**
+     * Sets the global Private DNS host to be used.
+     * May only be called by the device owner.
+     *
+     * <p>Note that the method is blocking as it will perform a connectivity check to the resolver,
+     * to ensure it is valid. Because of that, the method should not be called on any thread that
+     * relates to user interaction, such as the UI thread.
      *
      * <p>In case a VPN is used in conjunction with Private DNS resolver, the Private DNS resolver
      * must be reachable both from within and outside the VPN. Otherwise, the device may lose
@@ -10420,41 +10491,35 @@
      * VPN.
      *
      * @param admin which {@link DeviceAdminReceiver} this request is associated with.
-     * @param mode Which mode to set - either {@code PRIVATE_DNS_MODE_OPPORTUNISTIC} or
-     *             {@code PRIVATE_DNS_MODE_PROVIDER_HOSTNAME}.
-     *             Since the opportunistic mode defaults to ordinary DNS lookups, the
-     *             option to turn it completely off is not available, so this method
-     *             may not be called with {@code PRIVATE_DNS_MODE_OFF}.
-     * @param privateDnsHost The hostname of a server that implements DNS over TLS (RFC7858), if
-     *                       {@code PRIVATE_DNS_MODE_PROVIDER_HOSTNAME} was specified as the mode,
-     *                       null otherwise.
+     * @param privateDnsHost The hostname of a server that implements DNS over TLS (RFC7858).
      *
-     * @return One of the values in {@link SetPrivateDnsModeResultConstants}.
+     * @return {@code PRIVATE_DNS_SET_SUCCESS} if the mode was set successfully,
+     *         {@code PRIVATE_DNS_SET_ERROR_FAILURE_SETTING} if it could not be set or
+     *         {@code PRIVATE_DNS_SET_ERROR_HOST_NOT_SERVING} if the specified host does not
+     *         implement RFC7858.
      *
-     * @throws IllegalArgumentException in the following cases: if a {@code privateDnsHost} was
-     * provided but the mode was not {@code PRIVATE_DNS_MODE_PROVIDER_HOSTNAME}, if the mode
-     * specified was {@code PRIVATE_DNS_MODE_PROVIDER_HOSTNAME} but {@code privateDnsHost} does
-     * not look like a valid hostname, or if the mode specified is not one of the two valid modes.
+     * @throws IllegalArgumentException if the {@code privateDnsHost} is not a valid hostname.
      *
      * @throws SecurityException if the caller is not the device owner.
      */
-    public int setGlobalPrivateDns(@NonNull ComponentName admin,
-            @PrivateDnsMode int mode, @Nullable String privateDnsHost) {
-        throwIfParentInstance("setGlobalPrivateDns");
+    @WorkerThread public @PrivateDnsModeErrorCodes int setGlobalPrivateDnsModeSpecifiedHost(
+            @NonNull ComponentName admin, @NonNull String privateDnsHost) {
+        throwIfParentInstance("setGlobalPrivateDnsModeSpecifiedHost");
+        Preconditions.checkNotNull(privateDnsHost, "dns resolver is null");
 
         if (mService == null) {
             return PRIVATE_DNS_SET_ERROR_FAILURE_SETTING;
         }
 
-        if (mode == PRIVATE_DNS_MODE_PROVIDER_HOSTNAME && !TextUtils.isEmpty(privateDnsHost)
-                && NetworkUtils.isWeaklyValidatedHostname(privateDnsHost)) {
+        if (NetworkUtils.isWeaklyValidatedHostname(privateDnsHost)) {
             if (!PrivateDnsConnectivityChecker.canConnectToPrivateDnsServer(privateDnsHost)) {
                 return PRIVATE_DNS_SET_ERROR_HOST_NOT_SERVING;
             }
         }
 
         try {
-            return mService.setGlobalPrivateDns(admin, mode, privateDnsHost);
+            return mService.setGlobalPrivateDns(
+                    admin, PRIVATE_DNS_MODE_PROVIDER_HOSTNAME, privateDnsHost);
         } catch (RemoteException re) {
             throw re.rethrowFromSystemServer();
         }
@@ -10588,18 +10653,18 @@
     }
 
     /**
-     * Whitelists a set of packages that are allowed to access cross-profile calendar APIs.
+     * Allows a set of packages to access cross-profile calendar APIs.
      *
      * <p>Called by a profile owner of a managed profile.
      *
-     * <p>Calling with a null value for the set disables the restriction so that all packages
-     * are allowed to access cross-profile calendar APIs. Calling with an empty set disallows
-     * all packages from accessing cross-profile calendar APIs. If this method isn't called,
-     * no package will be allowed to access cross-profile calendar APIs by default.
+     * <p>Calling with a {@code null} value for the set disables the restriction so that all
+     * packages are allowed to access cross-profile calendar APIs. Calling with an empty set
+     * disallows all packages from accessing cross-profile calendar APIs. If this method isn't
+     * called, no package is allowed to access cross-profile calendar APIs by default.
      *
-     * @param admin which {@link DeviceAdminReceiver} this request is associated with.
-     * @param packageNames set of packages to be whitelisted.
-     * @throws SecurityException if {@code admin} is not a profile owner.
+     * @param admin which {@link DeviceAdminReceiver} this request is associated with
+     * @param packageNames set of packages to be whitelisted
+     * @throws SecurityException if {@code admin} is not a profile owner
      *
      * @see #getCrossProfileCalendarPackages(ComponentName)
      */
@@ -10617,15 +10682,15 @@
     }
 
     /**
-     * Gets a set of package names that are whitelisted to access cross-profile calendar APIs.
+     * Gets a set of package names that are allowed to access cross-profile calendar APIs.
      *
      * <p>Called by a profile owner of a managed profile.
      *
-     * @param admin which {@link DeviceAdminReceiver} this request is associated with.
-     * @return the set of names of packages that were previously whitelisted via
+     * @param admin which {@link DeviceAdminReceiver} this request is associated with
+     * @return the set of names of packages that were previously allowed via
      * {@link #setCrossProfileCalendarPackages(ComponentName, Set)}, or an
-     * empty set if none have been whitelisted.
-     * @throws SecurityException if {@code admin} is not a profile owner.
+     * empty set if none have been allowed
+     * @throws SecurityException if {@code admin} is not a profile owner
      *
      * @see #setCrossProfileCalendarPackages(ComponentName, Set)
      */
@@ -10655,8 +10720,8 @@
      * that user, and get a {@link DevicePolicyManager} from this context.
      *
      * @param packageName the name of the package
-     * @return {@code true} if the package is allowed to access cross-profile calendar APIs.
-     * {@code false} otherwise.
+     * @return {@code true} if the package is allowed to access cross-profile calendar APIs,
+     * {@code false} otherwise
      *
      * @see #setCrossProfileCalendarPackages(ComponentName, Set)
      * @see #getCrossProfileCalendarPackages(ComponentName)
@@ -10676,15 +10741,15 @@
     }
 
     /**
-     * Gets a set of package names that are whitelisted to access cross-profile calendar APIs.
+     * Gets a set of package names that are allowed to access cross-profile calendar APIs.
      *
      * <p>To query for a specific user, use
      * {@link Context#createPackageContextAsUser(String, int, UserHandle)} to create a context for
      * that user, and get a {@link DevicePolicyManager} from this context.
      *
-     * @return the set of names of packages that were previously whitelisted via
+     * @return the set of names of packages that were previously allowed via
      * {@link #setCrossProfileCalendarPackages(ComponentName, Set)}, or an
-     * empty set if none have been whitelisted.
+     * empty set if none have been allowed
      *
      * @see #setCrossProfileCalendarPackages(ComponentName, Set)
      * @see #getCrossProfileCalendarPackages(ComponentName)
@@ -10776,12 +10841,12 @@
     /**
      * Starts an activity to view calendar events in the managed profile.
      *
-     * @param eventId the id of the event to be viewed.
-     * @param start the start time of the event.
-     * @param end the end time of the event.
-     * @param allDay if the event is an all-day event.
+     * @param eventId the id of the event to be viewed
+     * @param start the start time of the event
+     * @param end the end time of the event
+     * @param allDay if the event is an all-day event
      * @param flags flags to be set for the intent
-     * @return {@code true} if the activity is started successfully. {@code false} otherwise.
+     * @return {@code true} if the activity is started successfully, {@code false} otherwise
      *
      * @see CalendarContract#startViewCalendarEventInManagedProfile(Context, String, long, long,
      * long, boolean, int)
diff --git a/core/java/android/app/admin/DnsEvent.java b/core/java/android/app/admin/DnsEvent.java
index a2d704b..aade934 100644
--- a/core/java/android/app/admin/DnsEvent.java
+++ b/core/java/android/app/admin/DnsEvent.java
@@ -101,7 +101,7 @@
                 mIpAddressesCount, mTimestamp, mPackageName);
     }
 
-    public static final Parcelable.Creator<DnsEvent> CREATOR
+    public static final @android.annotation.NonNull Parcelable.Creator<DnsEvent> CREATOR
             = new Parcelable.Creator<DnsEvent>() {
         @Override
         public DnsEvent createFromParcel(Parcel in) {
diff --git a/core/java/android/app/admin/IDevicePolicyManager.aidl b/core/java/android/app/admin/IDevicePolicyManager.aidl
index 9478a3c..3c389e4 100644
--- a/core/java/android/app/admin/IDevicePolicyManager.aidl
+++ b/core/java/android/app/admin/IDevicePolicyManager.aidl
@@ -124,6 +124,7 @@
     void setActiveAdmin(in ComponentName policyReceiver, boolean refreshing, int userHandle);
     boolean isAdminActive(in ComponentName policyReceiver, int userHandle);
     List<ComponentName> getActiveAdmins(int userHandle);
+    @UnsupportedAppUsage
     boolean packageHasActiveAdmins(String packageName, int userHandle);
     void getRemoveWarning(in ComponentName policyReceiver, in RemoteCallback result, int userHandle);
     void removeActiveAdmin(in ComponentName policyReceiver, int userHandle);
diff --git a/core/java/android/app/admin/NetworkEvent.java b/core/java/android/app/admin/NetworkEvent.java
index 947e4fe..c00ec83 100644
--- a/core/java/android/app/admin/NetworkEvent.java
+++ b/core/java/android/app/admin/NetworkEvent.java
@@ -85,7 +85,7 @@
         return 0;
     }
 
-    public static final Parcelable.Creator<NetworkEvent> CREATOR
+    public static final @android.annotation.NonNull Parcelable.Creator<NetworkEvent> CREATOR
             = new Parcelable.Creator<NetworkEvent>() {
         public NetworkEvent createFromParcel(Parcel in) {
             final int initialPosition = in.dataPosition();
diff --git a/core/java/android/app/admin/PasswordMetrics.java b/core/java/android/app/admin/PasswordMetrics.java
index a6bf501..d71d355 100644
--- a/core/java/android/app/admin/PasswordMetrics.java
+++ b/core/java/android/app/admin/PasswordMetrics.java
@@ -210,7 +210,7 @@
         dest.writeInt(nonLetter);
     }
 
-    public static final Parcelable.Creator<PasswordMetrics> CREATOR
+    public static final @android.annotation.NonNull Parcelable.Creator<PasswordMetrics> CREATOR
             = new Parcelable.Creator<PasswordMetrics>() {
         public PasswordMetrics createFromParcel(Parcel in) {
             return new PasswordMetrics(in);
diff --git a/core/java/android/app/admin/SecurityLog.java b/core/java/android/app/admin/SecurityLog.java
index 170c802..6386573 100644
--- a/core/java/android/app/admin/SecurityLog.java
+++ b/core/java/android/app/admin/SecurityLog.java
@@ -602,7 +602,7 @@
             dest.writeByteArray(mEvent.getBytes());
         }
 
-        public static final Parcelable.Creator<SecurityEvent> CREATOR =
+        public static final @android.annotation.NonNull Parcelable.Creator<SecurityEvent> CREATOR =
                 new Parcelable.Creator<SecurityEvent>() {
             @Override
             public SecurityEvent createFromParcel(Parcel source) {
diff --git a/core/java/android/app/admin/SystemUpdateInfo.java b/core/java/android/app/admin/SystemUpdateInfo.java
index b0376b5..4019290 100644
--- a/core/java/android/app/admin/SystemUpdateInfo.java
+++ b/core/java/android/app/admin/SystemUpdateInfo.java
@@ -111,7 +111,7 @@
         return mSecurityPatchState;
     }
 
-    public static final Creator<SystemUpdateInfo> CREATOR =
+    public static final @android.annotation.NonNull Creator<SystemUpdateInfo> CREATOR =
             new Creator<SystemUpdateInfo>() {
                 @Override
                 public SystemUpdateInfo createFromParcel(Parcel in) {
diff --git a/core/java/android/app/admin/SystemUpdatePolicy.java b/core/java/android/app/admin/SystemUpdatePolicy.java
index dd72845..2ba2c04 100644
--- a/core/java/android/app/admin/SystemUpdatePolicy.java
+++ b/core/java/android/app/admin/SystemUpdatePolicy.java
@@ -280,7 +280,7 @@
             dest.writeString(getMessage());
         }
 
-        public static final Parcelable.Creator<ValidationFailedException> CREATOR =
+        public static final @android.annotation.NonNull Parcelable.Creator<ValidationFailedException> CREATOR =
                 new Parcelable.Creator<ValidationFailedException>() {
             @Override
             public ValidationFailedException createFromParcel(Parcel source) {
@@ -710,7 +710,7 @@
         }
     }
 
-    public static final Parcelable.Creator<SystemUpdatePolicy> CREATOR =
+    public static final @android.annotation.NonNull Parcelable.Creator<SystemUpdatePolicy> CREATOR =
             new Parcelable.Creator<SystemUpdatePolicy>() {
 
                 @Override
diff --git a/core/java/android/app/assist/AssistContent.java b/core/java/android/app/assist/AssistContent.java
index ff7e181..db6ae4f 100644
--- a/core/java/android/app/assist/AssistContent.java
+++ b/core/java/android/app/assist/AssistContent.java
@@ -216,7 +216,7 @@
         writeToParcelInternal(dest, flags);
     }
 
-    public static final Parcelable.Creator<AssistContent> CREATOR
+    public static final @android.annotation.NonNull Parcelable.Creator<AssistContent> CREATOR
             = new Parcelable.Creator<AssistContent>() {
         public AssistContent createFromParcel(Parcel in) {
             return new AssistContent(in);
diff --git a/core/java/android/app/assist/AssistStructure.java b/core/java/android/app/assist/AssistStructure.java
index 2b1e7cd..ed3a296 100644
--- a/core/java/android/app/assist/AssistStructure.java
+++ b/core/java/android/app/assist/AssistStructure.java
@@ -2074,7 +2074,7 @@
         }
 
         @SuppressWarnings("hiding")
-        public static final Creator<HtmlInfoNode> CREATOR = new Creator<HtmlInfoNode>() {
+        public static final @android.annotation.NonNull Creator<HtmlInfoNode> CREATOR = new Creator<HtmlInfoNode>() {
             @Override
             public HtmlInfoNode createFromParcel(Parcel parcel) {
                 // Always go through the builder to ensure the data ingested by
@@ -2430,7 +2430,7 @@
         }
     }
 
-    public static final Parcelable.Creator<AssistStructure> CREATOR
+    public static final @android.annotation.NonNull Parcelable.Creator<AssistStructure> CREATOR
             = new Parcelable.Creator<AssistStructure>() {
         @Override
         public AssistStructure createFromParcel(Parcel in) {
diff --git a/core/java/android/app/backup/BackupProgress.java b/core/java/android/app/backup/BackupProgress.java
index 32e6212..56f69fb 100644
--- a/core/java/android/app/backup/BackupProgress.java
+++ b/core/java/android/app/backup/BackupProgress.java
@@ -52,7 +52,7 @@
         out.writeLong(bytesTransferred);
     }
 
-    public static final Creator<BackupProgress> CREATOR = new Creator<BackupProgress>() {
+    public static final @android.annotation.NonNull Creator<BackupProgress> CREATOR = new Creator<BackupProgress>() {
         public BackupProgress createFromParcel(Parcel in) {
             return new BackupProgress(in);
         }
diff --git a/core/java/android/app/backup/IBackupManager.aidl b/core/java/android/app/backup/IBackupManager.aidl
index 8386c72..70ecdae 100644
--- a/core/java/android/app/backup/IBackupManager.aidl
+++ b/core/java/android/app/backup/IBackupManager.aidl
@@ -54,6 +54,7 @@
     /**
      * {@link android.app.backup.IBackupManager.dataChangedForUser} for the calling user id.
      */
+    @UnsupportedAppUsage
     void dataChanged(String packageName);
 
     /**
@@ -73,6 +74,7 @@
     /**
      * {@link android.app.backup.IBackupManager.clearBackupDataForUser} for the calling user id.
      */
+    @UnsupportedAppUsage
     void clearBackupData(String transportName, String packageName);
 
     /**
@@ -155,6 +157,7 @@
     /**
      * {@link android.app.backup.IBackupManager.setBackupEnabledForUser} for the calling user id.
      */
+    @UnsupportedAppUsage
     void setBackupEnabled(boolean isEnabled);
 
     /**
@@ -178,6 +181,7 @@
     /**
      * {@link android.app.backup.IBackupManager.setAutoRestoreForUser} for the calling user id.
      */
+    @UnsupportedAppUsage
     void setAutoRestore(boolean doAutoRestore);
 
     /**
@@ -194,6 +198,7 @@
     /**
      * {@link android.app.backup.IBackupManager.isBackupEnabledForUser} for the calling user id.
      */
+    @UnsupportedAppUsage
     boolean isBackupEnabled();
 
     /**
@@ -322,6 +327,7 @@
      * {@link android.app.backup.IBackupManager.acknowledgeFullBackupOrRestoreForUser} for the
      * calling user id.
      */
+    @UnsupportedAppUsage
     void acknowledgeFullBackupOrRestore(int token, boolean allow,
             in String curPassword, in String encryptionPassword,
             IFullBackupRestoreObserver observer);
@@ -371,6 +377,7 @@
     /**
      * {@link android.app.backup.IBackupManager.getCurrentTransportForUser} for the calling user id.
      */
+    @UnsupportedAppUsage
     String getCurrentTransport();
 
      /**
@@ -397,6 +404,7 @@
     /**
      * {@link android.app.backup.IBackupManager.listAllTransportsForUser} for the calling user id.
      */
+    @UnsupportedAppUsage
     String[] listAllTransports();
 
     /**
@@ -434,6 +442,7 @@
      * {@link android.app.backup.IBackupManager.selectBackupTransportForUser} for the calling user
      * id.
      */
+    @UnsupportedAppUsage
     String selectBackupTransport(String transport);
 
     /**
@@ -590,6 +599,7 @@
      * @param whichUser User handle of the defined user whose backup active state
      *     is being queried.
      */
+    @UnsupportedAppUsage
     boolean isBackupServiceActive(int whichUser);
 
     /**
diff --git a/core/java/android/app/backup/RestoreDescription.java b/core/java/android/app/backup/RestoreDescription.java
index 0250326..7854394 100644
--- a/core/java/android/app/backup/RestoreDescription.java
+++ b/core/java/android/app/backup/RestoreDescription.java
@@ -89,7 +89,7 @@
         out.writeInt(mDataType);
     }
 
-    public static final Parcelable.Creator<RestoreDescription> CREATOR
+    public static final @android.annotation.NonNull Parcelable.Creator<RestoreDescription> CREATOR
             = new Parcelable.Creator<RestoreDescription>() {
         public RestoreDescription createFromParcel(Parcel in) {
             final RestoreDescription unparceled = new RestoreDescription(in);
diff --git a/core/java/android/app/backup/RestoreSet.java b/core/java/android/app/backup/RestoreSet.java
index 4a6316c..6759346 100644
--- a/core/java/android/app/backup/RestoreSet.java
+++ b/core/java/android/app/backup/RestoreSet.java
@@ -69,7 +69,7 @@
         out.writeLong(token);
     }
 
-    public static final Parcelable.Creator<RestoreSet> CREATOR
+    public static final @android.annotation.NonNull Parcelable.Creator<RestoreSet> CREATOR
             = new Parcelable.Creator<RestoreSet>() {
         public RestoreSet createFromParcel(Parcel in) {
             return new RestoreSet(in);
diff --git a/core/java/android/app/contentsuggestions/ClassificationsRequest.java b/core/java/android/app/contentsuggestions/ClassificationsRequest.java
index 9bb39e5..2051a55 100644
--- a/core/java/android/app/contentsuggestions/ClassificationsRequest.java
+++ b/core/java/android/app/contentsuggestions/ClassificationsRequest.java
@@ -54,10 +54,10 @@
     }
 
     /**
-     * Return the request extras or {@code null} if there are none.
+     * Return the request extras, can be an empty bundle.
      */
-    public @Nullable Bundle getExtras() {
-        return mExtras;
+    public @NonNull Bundle getExtras() {
+        return mExtras == null ? new Bundle() : mExtras;
     }
 
     @Override
@@ -71,7 +71,7 @@
         dest.writeBundle(mExtras);
     }
 
-    public static final Creator<ClassificationsRequest> CREATOR =
+    public static final @android.annotation.NonNull Creator<ClassificationsRequest> CREATOR =
             new Creator<ClassificationsRequest>() {
         @Override
         public ClassificationsRequest createFromParcel(Parcel source) {
@@ -103,7 +103,7 @@
         /**
          * Sets the request extras.
          */
-        public Builder setExtras(@NonNull Bundle extras) {
+        public @NonNull Builder setExtras(@NonNull Bundle extras) {
             mExtras = extras;
             return this;
         }
@@ -111,7 +111,7 @@
         /**
          * Builds a new request instance.
          */
-        public ClassificationsRequest build() {
+        public @NonNull ClassificationsRequest build() {
             return new ClassificationsRequest(mSelections, mExtras);
         }
     }
diff --git a/core/java/android/app/contentsuggestions/ContentClassification.java b/core/java/android/app/contentsuggestions/ContentClassification.java
index 2a00b40..2317e4a 100644
--- a/core/java/android/app/contentsuggestions/ContentClassification.java
+++ b/core/java/android/app/contentsuggestions/ContentClassification.java
@@ -71,7 +71,7 @@
         dest.writeBundle(mExtras);
     }
 
-    public static final Creator<ContentClassification> CREATOR =
+    public static final @android.annotation.NonNull Creator<ContentClassification> CREATOR =
             new Creator<ContentClassification>() {
         @Override
         public ContentClassification createFromParcel(Parcel source) {
diff --git a/core/java/android/app/contentsuggestions/ContentSelection.java b/core/java/android/app/contentsuggestions/ContentSelection.java
index 16b4f3f..4c83f59 100644
--- a/core/java/android/app/contentsuggestions/ContentSelection.java
+++ b/core/java/android/app/contentsuggestions/ContentSelection.java
@@ -71,7 +71,7 @@
         dest.writeBundle(mExtras);
     }
 
-    public static final Creator<ContentSelection> CREATOR =
+    public static final @android.annotation.NonNull Creator<ContentSelection> CREATOR =
             new Creator<ContentSelection>() {
         @Override
         public ContentSelection createFromParcel(Parcel source) {
diff --git a/core/java/android/app/contentsuggestions/SelectionsRequest.java b/core/java/android/app/contentsuggestions/SelectionsRequest.java
index e3c8bc5..84f33b5 100644
--- a/core/java/android/app/contentsuggestions/SelectionsRequest.java
+++ b/core/java/android/app/contentsuggestions/SelectionsRequest.java
@@ -63,10 +63,10 @@
     }
 
     /**
-     * Return the request extras or {@code null} if there aren't any.
+     * Return the request extras, may be an empty bundle if there aren't any.
      */
-    public @Nullable Bundle getExtras() {
-        return mExtras;
+    public @NonNull Bundle getExtras() {
+        return mExtras == null ? new Bundle() : mExtras;
     }
 
     @Override
@@ -81,7 +81,7 @@
         dest.writeBundle(mExtras);
     }
 
-    public static final Creator<SelectionsRequest> CREATOR =
+    public static final @android.annotation.NonNull Creator<SelectionsRequest> CREATOR =
             new Creator<SelectionsRequest>() {
         @Override
         public SelectionsRequest createFromParcel(Parcel source) {
@@ -118,7 +118,7 @@
         /**
          * Sets the request extras.
          */
-        public Builder setExtras(@NonNull Bundle extras) {
+        public @NonNull Builder setExtras(@NonNull Bundle extras) {
             mExtras = extras;
             return this;
         }
@@ -126,7 +126,7 @@
         /**
          * Sets the request interest point.
          */
-        public Builder setInterestPoint(@NonNull Point interestPoint) {
+        public @NonNull Builder setInterestPoint(@NonNull Point interestPoint) {
             mInterestPoint = interestPoint;
             return this;
         }
@@ -134,7 +134,7 @@
         /**
          * Builds a new request instance.
          */
-        public SelectionsRequest build() {
+        public @NonNull SelectionsRequest build() {
             return new SelectionsRequest(mTaskId, mInterestPoint, mExtras);
         }
     }
diff --git a/core/java/android/app/job/IJobCallback.aidl b/core/java/android/app/job/IJobCallback.aidl
index e7695e2..d281da0 100644
--- a/core/java/android/app/job/IJobCallback.aidl
+++ b/core/java/android/app/job/IJobCallback.aidl
@@ -36,6 +36,7 @@
      * @param ongoing True to indicate that the client is processing the job. False if the job is
      * complete
      */
+    @UnsupportedAppUsage
     void acknowledgeStartMessage(int jobId, boolean ongoing);
     /**
      * Immediate callback to the system after sending a stop signal, used to quickly detect ANR.
@@ -43,14 +44,17 @@
      * @param jobId Unique integer used to identify this job.
      * @param reschedule Whether or not to reschedule this job.
      */
+    @UnsupportedAppUsage
     void acknowledgeStopMessage(int jobId, boolean reschedule);
     /*
      * Called to deqeue next work item for the job.
      */
+    @UnsupportedAppUsage
     JobWorkItem dequeueWork(int jobId);
     /*
      * Called to report that job has completed processing a work item.
      */
+    @UnsupportedAppUsage
     boolean completeWork(int jobId, int workId);
     /*
      * Tell the job manager that the client is done with its execution, so that it can go on to
@@ -59,5 +63,6 @@
      * @param jobId Unique integer used to identify this job.
      * @param reschedule Whether or not to reschedule this job.
      */
+    @UnsupportedAppUsage
     void jobFinished(int jobId, boolean reschedule);
 }
diff --git a/core/java/android/app/job/IJobService.aidl b/core/java/android/app/job/IJobService.aidl
index 7f55d29..22ad252 100644
--- a/core/java/android/app/job/IJobService.aidl
+++ b/core/java/android/app/job/IJobService.aidl
@@ -26,7 +26,9 @@
  */
 oneway interface IJobService {
     /** Begin execution of application's job. */
+    @UnsupportedAppUsage
     void startJob(in JobParameters jobParams);
     /** Stop execution of application's job. */
+    @UnsupportedAppUsage
     void stopJob(in JobParameters jobParams);
 }
diff --git a/core/java/android/app/job/JobInfo.java b/core/java/android/app/job/JobInfo.java
index e7fe161..907d1f7 100644
--- a/core/java/android/app/job/JobInfo.java
+++ b/core/java/android/app/job/JobInfo.java
@@ -870,7 +870,7 @@
         out.writeInt(this.flags);
     }
 
-    public static final Creator<JobInfo> CREATOR = new Creator<JobInfo>() {
+    public static final @android.annotation.NonNull Creator<JobInfo> CREATOR = new Creator<JobInfo>() {
         @Override
         public JobInfo createFromParcel(Parcel in) {
             return new JobInfo(in);
@@ -963,7 +963,7 @@
             out.writeInt(mFlags);
         }
 
-        public static final Creator<TriggerContentUri> CREATOR = new Creator<TriggerContentUri>() {
+        public static final @android.annotation.NonNull Creator<TriggerContentUri> CREATOR = new Creator<TriggerContentUri>() {
             @Override
             public TriggerContentUri createFromParcel(Parcel in) {
                 return new TriggerContentUri(in);
diff --git a/core/java/android/app/job/JobParameters.java b/core/java/android/app/job/JobParameters.java
index 3cc56ae..dadfe3d 100644
--- a/core/java/android/app/job/JobParameters.java
+++ b/core/java/android/app/job/JobParameters.java
@@ -344,7 +344,7 @@
         dest.writeString(debugStopReason);
     }
 
-    public static final Creator<JobParameters> CREATOR = new Creator<JobParameters>() {
+    public static final @android.annotation.NonNull Creator<JobParameters> CREATOR = new Creator<JobParameters>() {
         @Override
         public JobParameters createFromParcel(Parcel in) {
             return new JobParameters(in);
diff --git a/core/java/android/app/job/JobSnapshot.java b/core/java/android/app/job/JobSnapshot.java
index ceeaab7..2c58908 100644
--- a/core/java/android/app/job/JobSnapshot.java
+++ b/core/java/android/app/job/JobSnapshot.java
@@ -105,7 +105,7 @@
         out.writeBoolean(mIsRunnable);
     }
 
-    public static final Creator<JobSnapshot> CREATOR = new Creator<JobSnapshot>() {
+    public static final @android.annotation.NonNull Creator<JobSnapshot> CREATOR = new Creator<JobSnapshot>() {
         @Override
         public JobSnapshot createFromParcel(Parcel in) {
             return new JobSnapshot(in);
diff --git a/core/java/android/app/job/JobWorkItem.java b/core/java/android/app/job/JobWorkItem.java
index f804681..a055ab4 100644
--- a/core/java/android/app/job/JobWorkItem.java
+++ b/core/java/android/app/job/JobWorkItem.java
@@ -214,7 +214,7 @@
         out.writeInt(mWorkId);
     }
 
-    public static final Parcelable.Creator<JobWorkItem> CREATOR
+    public static final @android.annotation.NonNull Parcelable.Creator<JobWorkItem> CREATOR
             = new Parcelable.Creator<JobWorkItem>() {
         public JobWorkItem createFromParcel(Parcel in) {
             return new JobWorkItem(in);
diff --git a/core/java/android/app/prediction/AppPredictionContext.java b/core/java/android/app/prediction/AppPredictionContext.java
index 2fbe6e36..2da4671 100644
--- a/core/java/android/app/prediction/AppPredictionContext.java
+++ b/core/java/android/app/prediction/AppPredictionContext.java
@@ -101,7 +101,7 @@
     /**
      * @see Parcelable.Creator
      */
-    public static final Parcelable.Creator<AppPredictionContext> CREATOR =
+    public static final @android.annotation.NonNull Parcelable.Creator<AppPredictionContext> CREATOR =
             new Parcelable.Creator<AppPredictionContext>() {
                 public AppPredictionContext createFromParcel(Parcel parcel) {
                     return new AppPredictionContext(parcel);
diff --git a/core/java/android/app/prediction/AppPredictionSessionId.java b/core/java/android/app/prediction/AppPredictionSessionId.java
index 1e76c24..1c5d8b4 100644
--- a/core/java/android/app/prediction/AppPredictionSessionId.java
+++ b/core/java/android/app/prediction/AppPredictionSessionId.java
@@ -75,7 +75,7 @@
     /**
      * @see Parcelable.Creator
      */
-    public static final Parcelable.Creator<AppPredictionSessionId> CREATOR =
+    public static final @android.annotation.NonNull Parcelable.Creator<AppPredictionSessionId> CREATOR =
             new Parcelable.Creator<AppPredictionSessionId>() {
                 public AppPredictionSessionId createFromParcel(Parcel parcel) {
                     return new AppPredictionSessionId(parcel);
diff --git a/core/java/android/app/prediction/AppTarget.java b/core/java/android/app/prediction/AppTarget.java
index b924cec..752c92b 100644
--- a/core/java/android/app/prediction/AppTarget.java
+++ b/core/java/android/app/prediction/AppTarget.java
@@ -183,7 +183,7 @@
     /**
      * @see Parcelable.Creator
      */
-    public static final Parcelable.Creator<AppTarget> CREATOR =
+    public static final @android.annotation.NonNull Parcelable.Creator<AppTarget> CREATOR =
             new Parcelable.Creator<AppTarget>() {
                 public AppTarget createFromParcel(Parcel parcel) {
                     return new AppTarget(parcel);
diff --git a/core/java/android/app/prediction/AppTargetEvent.java b/core/java/android/app/prediction/AppTargetEvent.java
index 37e41de..01452df 100644
--- a/core/java/android/app/prediction/AppTargetEvent.java
+++ b/core/java/android/app/prediction/AppTargetEvent.java
@@ -122,7 +122,7 @@
     /**
      * @see Creator
      */
-    public static final Creator<AppTargetEvent> CREATOR =
+    public static final @android.annotation.NonNull Creator<AppTargetEvent> CREATOR =
             new Creator<AppTargetEvent>() {
                 public AppTargetEvent createFromParcel(Parcel parcel) {
                     return new AppTargetEvent(parcel);
diff --git a/core/java/android/app/prediction/AppTargetId.java b/core/java/android/app/prediction/AppTargetId.java
index 639ba78..aa2ec1f 100644
--- a/core/java/android/app/prediction/AppTargetId.java
+++ b/core/java/android/app/prediction/AppTargetId.java
@@ -83,7 +83,7 @@
     /**
      * @see Creator
      */
-    public static final Creator<AppTargetId> CREATOR =
+    public static final @android.annotation.NonNull Creator<AppTargetId> CREATOR =
             new Creator<AppTargetId>() {
                 public AppTargetId createFromParcel(Parcel parcel) {
                     return new AppTargetId(parcel);
diff --git a/core/java/android/app/role/IRoleController.aidl b/core/java/android/app/role/IRoleController.aidl
new file mode 100644
index 0000000..a472eac
--- /dev/null
+++ b/core/java/android/app/role/IRoleController.aidl
@@ -0,0 +1,42 @@
+/*
+ * Copyright (C) 2018 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.app.role;
+
+import android.os.RemoteCallback;
+
+/**
+ * @hide
+ */
+oneway interface IRoleController {
+
+    void grantDefaultRoles(in RemoteCallback callback);
+
+    void onAddRoleHolder(in String roleName, in String packageName, int flags,
+            in RemoteCallback callback);
+
+    void onRemoveRoleHolder(in String roleName, in String packageName, int flags,
+            in RemoteCallback callback);
+
+    void onClearRoleHolders(in String roleName, int flags, in RemoteCallback callback);
+
+    void onSmsKillSwitchToggled(boolean enabled);
+
+    void isApplicationQualifiedForRole(in String roleName, in String packageName,
+            in RemoteCallback callback);
+
+    void isRoleVisible(in String roleName, in RemoteCallback callback);
+}
diff --git a/core/java/android/app/role/IRoleManager.aidl b/core/java/android/app/role/IRoleManager.aidl
index 76dbf7e..d8cea28 100644
--- a/core/java/android/app/role/IRoleManager.aidl
+++ b/core/java/android/app/role/IRoleManager.aidl
@@ -17,8 +17,8 @@
 package android.app.role;
 
 import android.app.role.IOnRoleHoldersChangedListener;
-import android.app.role.IRoleManagerCallback;
 import android.os.Bundle;
+import android.os.RemoteCallback;
 import android.telephony.IFinancialSmsCallback;
 
 /**
@@ -33,13 +33,13 @@
     List<String> getRoleHoldersAsUser(in String roleName, int userId);
 
     void addRoleHolderAsUser(in String roleName, in String packageName, int flags, int userId,
-            in IRoleManagerCallback callback);
+            in RemoteCallback callback);
 
     void removeRoleHolderAsUser(in String roleName, in String packageName, int flags, int userId,
-            in IRoleManagerCallback callback);
+            in RemoteCallback callback);
 
     void clearRoleHoldersAsUser(in String roleName, int flags, int userId,
-            in IRoleManagerCallback callback);
+            in RemoteCallback callback);
 
     void addOnRoleHoldersChangedListenerAsUser(IOnRoleHoldersChangedListener listener, int userId);
 
@@ -55,6 +55,7 @@
     List<String> getHeldRolesFromController(in String packageName);
 
     String getDefaultSmsPackage(int userId);
+
     /**
      * Get filtered SMS messages for financial app.
      */
diff --git a/core/java/android/app/role/OnRoleHoldersChangedListener.java b/core/java/android/app/role/OnRoleHoldersChangedListener.java
index 5958deb..d6f7679 100644
--- a/core/java/android/app/role/OnRoleHoldersChangedListener.java
+++ b/core/java/android/app/role/OnRoleHoldersChangedListener.java
@@ -18,6 +18,7 @@
 
 import android.annotation.NonNull;
 import android.annotation.SystemApi;
+import android.annotation.TestApi;
 import android.os.UserHandle;
 
 /**
@@ -26,6 +27,7 @@
  * @hide
  */
 @SystemApi
+@TestApi
 public interface OnRoleHoldersChangedListener {
 
     /**
diff --git a/core/java/android/app/role/RoleControllerManager.java b/core/java/android/app/role/RoleControllerManager.java
new file mode 100644
index 0000000..e96c9a5
--- /dev/null
+++ b/core/java/android/app/role/RoleControllerManager.java
@@ -0,0 +1,546 @@
+/*
+ * Copyright (C) 2019 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.app.role;
+
+import android.Manifest;
+import android.annotation.CallbackExecutor;
+import android.annotation.NonNull;
+import android.annotation.RequiresPermission;
+import android.annotation.SystemService;
+import android.annotation.UserIdInt;
+import android.content.ComponentName;
+import android.content.Context;
+import android.content.Intent;
+import android.content.pm.PackageManager;
+import android.content.pm.ResolveInfo;
+import android.os.Binder;
+import android.os.Handler;
+import android.os.IBinder;
+import android.os.RemoteCallback;
+import android.os.RemoteException;
+import android.util.Log;
+import android.util.SparseArray;
+
+import com.android.internal.annotations.GuardedBy;
+import com.android.internal.infra.AbstractMultiplePendingRequestsRemoteService;
+import com.android.internal.infra.AbstractRemoteService;
+
+import java.util.concurrent.Executor;
+import java.util.function.Consumer;
+
+/**
+ * Interface for communicating with the role controller.
+ *
+ * @hide
+ */
+@SystemService(Context.ROLE_CONTROLLER_SERVICE)
+public class RoleControllerManager {
+
+    private static final String LOG_TAG = RoleControllerManager.class.getSimpleName();
+
+    private static final Object sRemoteServicesLock = new Object();
+    /**
+     * Global remote services (per user) used by all {@link RoleControllerManager managers}.
+     */
+    @GuardedBy("sRemoteServicesLock")
+    private static final SparseArray<RemoteService> sRemoteServices = new SparseArray<>();
+
+    @NonNull
+    private final RemoteService mRemoteService;
+
+    public RoleControllerManager(@NonNull Context context, @NonNull Handler handler) {
+        synchronized (sRemoteServicesLock) {
+            int userId = context.getUserId();
+            RemoteService remoteService = sRemoteServices.get(userId);
+            if (remoteService == null) {
+                Intent intent = new Intent(RoleControllerService.SERVICE_INTERFACE);
+                PackageManager packageManager = context.getPackageManager();
+                intent.setPackage(packageManager.getPermissionControllerPackageName());
+                ResolveInfo resolveInfo = packageManager.resolveService(intent, 0);
+
+                remoteService = new RemoteService(context.getApplicationContext(),
+                        resolveInfo.getComponentInfo().getComponentName(), handler, userId);
+                sRemoteServices.put(userId, remoteService);
+            }
+            mRemoteService = remoteService;
+        }
+    }
+
+    public RoleControllerManager(@NonNull Context context) {
+        this(context, context.getMainThreadHandler());
+    }
+
+    /**
+     * @see RoleControllerService#onGrantDefaultRoles()
+     */
+    public void grantDefaultRoles(@NonNull @CallbackExecutor Executor executor,
+            @NonNull Consumer<Boolean> callback) {
+        mRemoteService.scheduleRequest(new GrantDefaultRolesRequest(mRemoteService, executor,
+                callback));
+    }
+
+    /**
+     * @see RoleControllerService#onAddRoleHolder(String, String, int)
+     */
+    public void onAddRoleHolder(@NonNull String roleName, @NonNull String packageName,
+            @RoleManager.ManageHoldersFlags int flags, @NonNull RemoteCallback callback) {
+        mRemoteService.scheduleRequest(new OnAddRoleHolderRequest(mRemoteService, roleName,
+                packageName, flags, callback));
+    }
+
+    /**
+     * @see RoleControllerService#onRemoveRoleHolder(String, String, int)
+     */
+    public void onRemoveRoleHolder(@NonNull String roleName, @NonNull String packageName,
+            @RoleManager.ManageHoldersFlags int flags, @NonNull RemoteCallback callback) {
+        mRemoteService.scheduleRequest(new OnRemoveRoleHolderRequest(mRemoteService, roleName,
+                packageName, flags, callback));
+    }
+
+    /**
+     * @see RoleControllerService#onClearRoleHolders(String, int)
+     */
+    public void onClearRoleHolders(@NonNull String roleName,
+            @RoleManager.ManageHoldersFlags int flags, @NonNull RemoteCallback callback) {
+        mRemoteService.scheduleRequest(new OnClearRoleHoldersRequest(mRemoteService, roleName,
+                flags, callback));
+    }
+
+    /**
+     * @see RoleControllerService#onSmsKillSwitchToggled(boolean)
+     */
+    public void onSmsKillSwitchToggled(boolean enabled) {
+        mRemoteService.scheduleAsyncRequest(new OnSmsKillSwitchToggledRequest(enabled));
+    }
+
+    /**
+     * @see RoleControllerService#onIsApplicationQualifiedForRole(String, String)
+     */
+    @RequiresPermission(Manifest.permission.MANAGE_ROLE_HOLDERS)
+    public void isApplicationQualifiedForRole(@NonNull String roleName, @NonNull String packageName,
+            @NonNull @CallbackExecutor Executor executor, @NonNull Consumer<Boolean> callback) {
+        mRemoteService.scheduleRequest(new IsApplicationQualifiedForRoleRequest(mRemoteService,
+                roleName, packageName, executor, callback));
+    }
+
+    /**
+     * @see RoleControllerService#onIsRoleVisible(String)
+     */
+    @RequiresPermission(Manifest.permission.MANAGE_ROLE_HOLDERS)
+    public void isRoleVisible(@NonNull String roleName,
+            @NonNull @CallbackExecutor Executor executor, @NonNull Consumer<Boolean> callback) {
+        mRemoteService.scheduleRequest(new IsRoleVisibleRequest(mRemoteService, roleName, executor,
+                callback));
+    }
+
+    /**
+     * Connection to the remote service.
+     */
+    private static final class RemoteService extends AbstractMultiplePendingRequestsRemoteService<
+            RemoteService, IRoleController> {
+
+        private static final long UNBIND_DELAY_MILLIS = 15 * 1000;
+        private static final long REQUEST_TIMEOUT_MILLIS = 15 * 1000;
+
+        /**
+         * Create a connection to the remote service
+         *
+         * @param context the context to use
+         * @param componentName the component of the service to connect to
+         * @param handler the handler for binding service and callbacks
+         * @param userId the user whom remote service should be connected as
+         */
+        RemoteService(@NonNull Context context, @NonNull ComponentName componentName,
+                @NonNull Handler handler, @UserIdInt int userId) {
+            super(context, RoleControllerService.SERVICE_INTERFACE, componentName, userId,
+                    service -> Log.e(LOG_TAG, "RemoteService " + service + " died"), handler, false,
+                    false, 1);
+        }
+
+        /**
+         * @return The default handler used by this service.
+         */
+        @NonNull
+        public Handler getHandler() {
+            return mHandler;
+        }
+
+        @Override
+        protected @NonNull IRoleController getServiceInterface(@NonNull IBinder binder) {
+            return IRoleController.Stub.asInterface(binder);
+        }
+
+        @Override
+        protected long getTimeoutIdleBindMillis() {
+            return UNBIND_DELAY_MILLIS;
+        }
+
+        @Override
+        protected long getRemoteRequestMillis() {
+            return REQUEST_TIMEOUT_MILLIS;
+        }
+
+        @Override
+        public void scheduleRequest(
+                @NonNull BasePendingRequest<RemoteService, IRoleController> pendingRequest) {
+            super.scheduleRequest(pendingRequest);
+        }
+
+        @Override
+        public void scheduleAsyncRequest(@NonNull AsyncRequest<IRoleController> request) {
+            super.scheduleAsyncRequest(request);
+        }
+    }
+
+    /**
+     * Request for {@link #grantDefaultRoles(Executor, Consumer)}.
+     */
+    private static final class GrantDefaultRolesRequest
+            extends AbstractRemoteService.PendingRequest<RemoteService, IRoleController> {
+
+        @NonNull
+        private final Executor mExecutor;
+        @NonNull
+        private final Consumer<Boolean> mCallback;
+
+        @NonNull
+        private final RemoteCallback mRemoteCallback;
+
+        private GrantDefaultRolesRequest(@NonNull RemoteService service,
+                @NonNull @CallbackExecutor Executor executor, @NonNull Consumer<Boolean> callback) {
+            super(service);
+
+            mExecutor = executor;
+            mCallback = callback;
+
+            mRemoteCallback = new RemoteCallback(result -> mExecutor.execute(() -> {
+                long token = Binder.clearCallingIdentity();
+                try {
+                    boolean successful = result != null;
+                    mCallback.accept(successful);
+                } finally {
+                    Binder.restoreCallingIdentity(token);
+                    finish();
+                }
+            }));
+        }
+
+        @Override
+        protected void onTimeout(@NonNull RemoteService remoteService) {
+            mExecutor.execute(() -> mCallback.accept(false));
+        }
+
+        @Override
+        public void run() {
+            try {
+                getService().getServiceInterface().grantDefaultRoles(mRemoteCallback);
+            } catch (RemoteException e) {
+                Log.e(LOG_TAG, "Error calling grantDefaultRoles()", e);
+            }
+        }
+    }
+
+    /**
+     * Request for {@link #onAddRoleHolder(String, String, int, RemoteCallback)}.
+     */
+    private static final class OnAddRoleHolderRequest
+            extends AbstractRemoteService.PendingRequest<RemoteService, IRoleController> {
+
+        @NonNull
+        private final String mRoleName;
+        @NonNull
+        private final String mPackageName;
+        @RoleManager.ManageHoldersFlags
+        private final int mFlags;
+        @NonNull
+        private final RemoteCallback mCallback;
+
+        @NonNull
+        private final RemoteCallback mRemoteCallback;
+
+        private OnAddRoleHolderRequest(@NonNull RemoteService service, @NonNull String roleName,
+                @NonNull String packageName, @RoleManager.ManageHoldersFlags int flags,
+                @NonNull RemoteCallback callback) {
+            super(service);
+
+            mRoleName = roleName;
+            mPackageName = packageName;
+            mFlags = flags;
+            mCallback = callback;
+
+            mRemoteCallback = new RemoteCallback(result -> {
+                long token = Binder.clearCallingIdentity();
+                try {
+                    mCallback.sendResult(result);
+                } finally {
+                    Binder.restoreCallingIdentity(token);
+                    finish();
+                }
+            });
+        }
+
+        @Override
+        protected void onTimeout(@NonNull RemoteService remoteService) {
+            mCallback.sendResult(null);
+        }
+
+        @Override
+        public void run() {
+            try {
+                getService().getServiceInterface().onAddRoleHolder(mRoleName, mPackageName, mFlags,
+                        mRemoteCallback);
+            } catch (RemoteException e) {
+                Log.e(LOG_TAG, "Error calling onAddRoleHolder()", e);
+            }
+        }
+    }
+
+    /**
+     * Request for {@link #onRemoveRoleHolder(String, String, int, RemoteCallback)}.
+     */
+    private static final class OnRemoveRoleHolderRequest
+            extends AbstractRemoteService.PendingRequest<RemoteService, IRoleController> {
+
+        @NonNull
+        private final String mRoleName;
+        @NonNull
+        private final String mPackageName;
+        @RoleManager.ManageHoldersFlags
+        private final int mFlags;
+        @NonNull
+        private final RemoteCallback mCallback;
+
+        @NonNull
+        private final RemoteCallback mRemoteCallback;
+
+        private OnRemoveRoleHolderRequest(@NonNull RemoteService service, @NonNull String roleName,
+                @NonNull String packageName, @RoleManager.ManageHoldersFlags int flags,
+                @NonNull RemoteCallback callback) {
+            super(service);
+
+            mRoleName = roleName;
+            mPackageName = packageName;
+            mFlags = flags;
+            mCallback = callback;
+
+            mRemoteCallback = new RemoteCallback(result -> {
+                long token = Binder.clearCallingIdentity();
+                try {
+                    mCallback.sendResult(result);
+                } finally {
+                    Binder.restoreCallingIdentity(token);
+                    finish();
+                }
+            });
+        }
+
+        @Override
+        protected void onTimeout(@NonNull RemoteService remoteService) {
+            mCallback.sendResult(null);
+        }
+
+        @Override
+        public void run() {
+            try {
+                getService().getServiceInterface().onRemoveRoleHolder(mRoleName, mPackageName,
+                        mFlags, mRemoteCallback);
+            } catch (RemoteException e) {
+                Log.e(LOG_TAG, "Error calling onRemoveRoleHolder()", e);
+            }
+        }
+    }
+
+    /**
+     * Request for {@link #onClearRoleHolders(String, int, RemoteCallback)}.
+     */
+    private static final class OnClearRoleHoldersRequest
+            extends AbstractRemoteService.PendingRequest<RemoteService, IRoleController> {
+
+        @NonNull
+        private final String mRoleName;
+        @RoleManager.ManageHoldersFlags
+        private final int mFlags;
+        @NonNull
+        private final RemoteCallback mCallback;
+
+        @NonNull
+        private final RemoteCallback mRemoteCallback;
+
+        private OnClearRoleHoldersRequest(@NonNull RemoteService service, @NonNull String roleName,
+                @RoleManager.ManageHoldersFlags int flags, @NonNull RemoteCallback callback) {
+            super(service);
+
+            mRoleName = roleName;
+            mFlags = flags;
+            mCallback = callback;
+
+            mRemoteCallback = new RemoteCallback(result -> {
+                long token = Binder.clearCallingIdentity();
+                try {
+                    mCallback.sendResult(result);
+                } finally {
+                    Binder.restoreCallingIdentity(token);
+                    finish();
+                }
+            });
+        }
+
+        @Override
+        protected void onTimeout(@NonNull RemoteService remoteService) {
+            mCallback.sendResult(null);
+        }
+
+        @Override
+        public void run() {
+            try {
+                getService().getServiceInterface().onClearRoleHolders(mRoleName, mFlags,
+                        mRemoteCallback);
+            } catch (RemoteException e) {
+                Log.e(LOG_TAG, "Error calling onClearRoleHolders()", e);
+            }
+        }
+    }
+
+    /**
+     * Request for {@link #onSmsKillSwitchToggled(boolean)}
+     */
+    private static final class OnSmsKillSwitchToggledRequest
+            implements AbstractRemoteService.AsyncRequest<IRoleController> {
+
+        private final boolean mEnabled;
+
+        private OnSmsKillSwitchToggledRequest(boolean enabled) {
+            mEnabled = enabled;
+        }
+
+        @Override
+        public void run(@NonNull IRoleController service) {
+            try {
+                service.onSmsKillSwitchToggled(mEnabled);
+            } catch (RemoteException e) {
+                Log.e(LOG_TAG, "Error calling onSmsKillSwitchToggled()", e);
+            }
+        }
+    }
+
+    /**
+     * Request for {@link #isApplicationQualifiedForRole(String, String, Executor, Consumer)}
+     */
+    private static final class IsApplicationQualifiedForRoleRequest extends
+            AbstractRemoteService.PendingRequest<RemoteService, IRoleController> {
+
+        @NonNull
+        private final String mRoleName;
+        @NonNull
+        private final String mPackageName;
+        @NonNull
+        private final Executor mExecutor;
+        @NonNull
+        private final Consumer<Boolean> mCallback;
+
+        @NonNull
+        private final RemoteCallback mRemoteCallback;
+
+        private IsApplicationQualifiedForRoleRequest(@NonNull RemoteService service,
+                @NonNull String roleName, @NonNull String packageName,
+                @CallbackExecutor @NonNull Executor executor, @NonNull Consumer<Boolean> callback) {
+            super(service);
+
+            mRoleName = roleName;
+            mPackageName = packageName;
+            mExecutor = executor;
+            mCallback = callback;
+
+            mRemoteCallback = new RemoteCallback(result -> mExecutor.execute(() -> {
+                long token = Binder.clearCallingIdentity();
+                try {
+                    boolean qualified = result != null;
+                    mCallback.accept(qualified);
+                } finally {
+                    Binder.restoreCallingIdentity(token);
+                    finish();
+                }
+            }));
+        }
+
+        @Override
+        protected void onTimeout(RemoteService remoteService) {
+            mExecutor.execute(() -> mCallback.accept(false));
+        }
+
+        @Override
+        public void run() {
+            try {
+                getService().getServiceInterface().isApplicationQualifiedForRole(mRoleName,
+                        mPackageName, mRemoteCallback);
+            } catch (RemoteException e) {
+                Log.e(LOG_TAG, "Error calling isApplicationQualifiedForRole()", e);
+            }
+        }
+    }
+
+    /**
+     * Request for {@link #isRoleVisible(String, Executor, Consumer)}
+     */
+    private static final class IsRoleVisibleRequest
+            extends AbstractRemoteService.PendingRequest<RemoteService, IRoleController> {
+
+        @NonNull
+        private final String mRoleName;
+        @NonNull
+        private final Executor mExecutor;
+        @NonNull
+        private final Consumer<Boolean> mCallback;
+
+        @NonNull
+        private final RemoteCallback mRemoteCallback;
+
+        private IsRoleVisibleRequest(@NonNull RemoteService service, @NonNull String roleName,
+                @CallbackExecutor @NonNull Executor executor, @NonNull Consumer<Boolean> callback) {
+            super(service);
+
+            mRoleName = roleName;
+            mExecutor = executor;
+            mCallback = callback;
+
+            mRemoteCallback = new RemoteCallback(result -> mExecutor.execute(() -> {
+                long token = Binder.clearCallingIdentity();
+                try {
+                    boolean visible = result != null;
+                    mCallback.accept(visible);
+                } finally {
+                    Binder.restoreCallingIdentity(token);
+                    finish();
+                }
+            }));
+        }
+
+        @Override
+        protected void onTimeout(RemoteService remoteService) {
+            mExecutor.execute(() -> mCallback.accept(false));
+        }
+
+        @Override
+        public void run() {
+            try {
+                getService().getServiceInterface().isRoleVisible(mRoleName, mRemoteCallback);
+            } catch (RemoteException e) {
+                Log.e(LOG_TAG, "Error calling isRoleVisible()", e);
+            }
+        }
+    }
+}
diff --git a/core/java/android/app/role/RoleControllerService.java b/core/java/android/app/role/RoleControllerService.java
new file mode 100644
index 0000000..312761d
--- /dev/null
+++ b/core/java/android/app/role/RoleControllerService.java
@@ -0,0 +1,291 @@
+/*
+ * Copyright (C) 2019 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.app.role;
+
+import android.Manifest;
+import android.annotation.NonNull;
+import android.annotation.Nullable;
+import android.annotation.SystemApi;
+import android.annotation.WorkerThread;
+import android.app.Service;
+import android.content.Intent;
+import android.os.Binder;
+import android.os.Bundle;
+import android.os.Handler;
+import android.os.HandlerThread;
+import android.os.IBinder;
+import android.os.Process;
+import android.os.RemoteCallback;
+import android.os.UserHandle;
+
+import com.android.internal.util.Preconditions;
+import com.android.internal.util.function.pooled.PooledLambda;
+
+import java.util.concurrent.Executor;
+
+/**
+ * Abstract base class for the role controller service.
+ * <p>
+ * Subclass should implement the business logic for role management, including enforcing role
+ * requirements and granting or revoking relevant privileges of roles. This class can only be
+ * implemented by the permission controller app which is registered in {@code PackageManager}.
+ *
+ * @hide
+ */
+@SystemApi
+public abstract class RoleControllerService extends Service {
+
+    /**
+     * The {@link Intent} that must be declared as handled by the service.
+     */
+    public static final String SERVICE_INTERFACE = "android.app.role.RoleControllerService";
+
+    private HandlerThread mWorkerThread;
+    private Handler mWorkerHandler;
+
+    @Override
+    public void onCreate() {
+        super.onCreate();
+
+        mWorkerThread = new HandlerThread(RoleControllerService.class.getSimpleName());
+        mWorkerThread.start();
+        mWorkerHandler = new Handler(mWorkerThread.getLooper());
+    }
+
+    @Override
+    public void onDestroy() {
+        super.onDestroy();
+
+        mWorkerThread.quitSafely();
+    }
+
+    @Nullable
+    @Override
+    public final IBinder onBind(@Nullable Intent intent) {
+        return new IRoleController.Stub() {
+
+            @Override
+            public void grantDefaultRoles(RemoteCallback callback) {
+                enforceCallerSystemUid("grantDefaultRoles");
+
+                Preconditions.checkNotNull(callback, "callback cannot be null");
+
+                mWorkerHandler.sendMessage(PooledLambda.obtainMessage(
+                        RoleControllerService::grantDefaultRoles, RoleControllerService.this,
+                        callback));
+            }
+
+            @Override
+            public void onAddRoleHolder(String roleName, String packageName, int flags,
+                    RemoteCallback callback) {
+                enforceCallerSystemUid("onAddRoleHolder");
+
+                Preconditions.checkStringNotEmpty(roleName, "roleName cannot be null or empty");
+                Preconditions.checkStringNotEmpty(packageName,
+                        "packageName cannot be null or empty");
+                Preconditions.checkNotNull(callback, "callback cannot be null");
+
+                mWorkerHandler.sendMessage(PooledLambda.obtainMessage(
+                        RoleControllerService::onAddRoleHolder, RoleControllerService.this,
+                        roleName, packageName, flags, callback));
+            }
+
+            @Override
+            public void onRemoveRoleHolder(String roleName, String packageName, int flags,
+                    RemoteCallback callback) {
+                enforceCallerSystemUid("onRemoveRoleHolder");
+
+                Preconditions.checkStringNotEmpty(roleName, "roleName cannot be null or empty");
+                Preconditions.checkStringNotEmpty(packageName,
+                        "packageName cannot be null or empty");
+                Preconditions.checkNotNull(callback, "callback cannot be null");
+
+                mWorkerHandler.sendMessage(PooledLambda.obtainMessage(
+                        RoleControllerService::onRemoveRoleHolder, RoleControllerService.this,
+                        roleName, packageName, flags, callback));
+            }
+
+            @Override
+            public void onClearRoleHolders(String roleName, int flags, RemoteCallback callback) {
+                enforceCallerSystemUid("onClearRoleHolders");
+
+                Preconditions.checkStringNotEmpty(roleName, "roleName cannot be null or empty");
+                Preconditions.checkNotNull(callback, "callback cannot be null");
+
+                mWorkerHandler.sendMessage(PooledLambda.obtainMessage(
+                        RoleControllerService::onClearRoleHolders, RoleControllerService.this,
+                        roleName, flags, callback));
+            }
+
+            @Override
+            public void onSmsKillSwitchToggled(boolean enabled) {
+                enforceCallerSystemUid("onSmsKillSwitchToggled");
+
+                mWorkerHandler.sendMessage(PooledLambda.obtainMessage(
+                        RoleControllerService::onSmsKillSwitchToggled, RoleControllerService.this,
+                        enabled));
+            }
+
+            private void enforceCallerSystemUid(@NonNull String methodName) {
+                if (Binder.getCallingUid() != Process.SYSTEM_UID) {
+                    throw new SecurityException("Only the system process can call " + methodName
+                            + "()");
+                }
+            }
+
+            @Override
+            public void isApplicationQualifiedForRole(String roleName, String packageName,
+                    RemoteCallback callback) {
+                enforceCallingPermission(Manifest.permission.MANAGE_ROLE_HOLDERS, null);
+
+                Preconditions.checkStringNotEmpty(roleName, "roleName cannot be null or empty");
+                Preconditions.checkStringNotEmpty(packageName,
+                        "packageName cannot be null or empty");
+                Preconditions.checkNotNull(callback, "callback cannot be null");
+
+                boolean qualified = onIsApplicationQualifiedForRole(roleName, packageName);
+                callback.sendResult(qualified ? Bundle.EMPTY : null);
+            }
+
+            @Override
+            public void isRoleVisible(String roleName, RemoteCallback callback) {
+                enforceCallingPermission(Manifest.permission.MANAGE_ROLE_HOLDERS, null);
+
+                Preconditions.checkStringNotEmpty(roleName, "roleName cannot be null or empty");
+                Preconditions.checkNotNull(callback, "callback cannot be null");
+
+                boolean visible = onIsRoleVisible(roleName);
+                callback.sendResult(visible ? Bundle.EMPTY : null);
+            }
+        };
+    }
+
+    private void grantDefaultRoles(@NonNull RemoteCallback callback) {
+        boolean successful = onGrantDefaultRoles();
+        callback.sendResult(successful ? Bundle.EMPTY : null);
+    }
+
+    private void onAddRoleHolder(@NonNull String roleName, @NonNull String packageName,
+            @RoleManager.ManageHoldersFlags int flags, @NonNull RemoteCallback callback) {
+        boolean successful = onAddRoleHolder(roleName, packageName, flags);
+        callback.sendResult(successful ? Bundle.EMPTY : null);
+    }
+
+    private void onRemoveRoleHolder(@NonNull String roleName, @NonNull String packageName,
+            @RoleManager.ManageHoldersFlags int flags, @NonNull RemoteCallback callback) {
+        boolean successful = onRemoveRoleHolder(roleName, packageName, flags);
+        callback.sendResult(successful ? Bundle.EMPTY : null);
+    }
+
+    private void onClearRoleHolders(@NonNull String roleName,
+            @RoleManager.ManageHoldersFlags int flags, @NonNull RemoteCallback callback) {
+        boolean successful = onClearRoleHolders(roleName, flags);
+        callback.sendResult(successful ? Bundle.EMPTY : null);
+    }
+
+    /**
+     * Called by system to grant default permissions and roles.
+     * <p>
+     * This is typically when creating a new user or upgrading either system or
+     * permission controller package
+     *
+     * @return whether this call was successful
+     */
+    @WorkerThread
+    public abstract boolean onGrantDefaultRoles();
+
+    /**
+     * Add a specific application to the holders of a role. If the role is exclusive, the previous
+     * holder will be replaced.
+     * <p>
+     * Implementation should enforce the role requirements and grant or revoke the relevant
+     * privileges of roles.
+     *
+     * @param roleName the name of the role to add the role holder for
+     * @param packageName the package name of the application to add to the role holders
+     * @param flags optional behavior flags
+     *
+     * @return whether this call was successful
+     *
+     * @see RoleManager#addRoleHolderAsUser(String, String, int, UserHandle, Executor,
+     *      RemoteCallback)
+     */
+    @WorkerThread
+    public abstract boolean onAddRoleHolder(@NonNull String roleName, @NonNull String packageName,
+            @RoleManager.ManageHoldersFlags int flags);
+
+    /**
+     * Remove a specific application from the holders of a role.
+     *
+     * @param roleName the name of the role to remove the role holder for
+     * @param packageName the package name of the application to remove from the role holders
+     * @param flags optional behavior flags
+     *
+     * @return whether this call was successful
+     *
+     * @see RoleManager#removeRoleHolderAsUser(String, String, int, UserHandle, Executor,
+     *      RemoteCallback)
+     */
+    @WorkerThread
+    public abstract boolean onRemoveRoleHolder(@NonNull String roleName,
+            @NonNull String packageName, @RoleManager.ManageHoldersFlags int flags);
+
+    /**
+     * Remove all holders of a role.
+     *
+     * @param roleName the name of the role to remove role holders for
+     * @param flags optional behavior flags
+     *
+     * @return whether this call was successful
+     *
+     * @see RoleManager#clearRoleHoldersAsUser(String, int, UserHandle, Executor, RemoteCallback)
+     */
+    @WorkerThread
+    public abstract boolean onClearRoleHolders(@NonNull String roleName,
+            @RoleManager.ManageHoldersFlags int flags);
+
+    /**
+     * Cleanup appop/permissions state in response to sms kill switch toggle
+     *
+     * @param enabled whether kill switch was turned on
+     *
+     * @hide
+     */
+    //STOPSHIP: remove this api before shipping a final version
+    @WorkerThread
+    public abstract void onSmsKillSwitchToggled(boolean enabled);
+
+    /**
+     * Check whether an application is qualified for a role.
+     *
+     * @param roleName name of the role to check for
+     * @param packageName package name of the application to check for
+     *
+     * @return whether the application is qualified for the role
+     */
+    public abstract boolean onIsApplicationQualifiedForRole(@NonNull String roleName,
+            @NonNull String packageName);
+
+    /**
+     * Check whether a role should be visible to user.
+     *
+     * @param roleName name of the role to check for
+     *
+     * @return whether the role should be visible to user
+     */
+    public abstract boolean onIsRoleVisible(@NonNull String roleName);
+}
diff --git a/core/java/android/app/role/RoleManager.java b/core/java/android/app/role/RoleManager.java
index 7ec21f6..d1f8ed2 100644
--- a/core/java/android/app/role/RoleManager.java
+++ b/core/java/android/app/role/RoleManager.java
@@ -30,6 +30,7 @@
 import android.content.Intent;
 import android.os.Binder;
 import android.os.Process;
+import android.os.RemoteCallback;
 import android.os.RemoteException;
 import android.os.ServiceManager;
 import android.os.UserHandle;
@@ -42,6 +43,7 @@
 
 import java.util.List;
 import java.util.concurrent.Executor;
+import java.util.function.Consumer;
 
 /**
  * This class provides information about and manages roles.
@@ -187,6 +189,7 @@
      * @hide
      */
     @SystemApi
+    @TestApi
     public static final int MANAGE_HOLDERS_FLAG_DONT_KILL_APP = 1;
 
     /**
@@ -314,9 +317,9 @@
      *
      * @return a list of package names of the role holders, or an empty list if none.
      *
-     * @see #addRoleHolderAsUser(String, String, int, UserHandle, Executor, RoleManagerCallback)
-     * @see #removeRoleHolderAsUser(String, String, int, UserHandle, Executor, RoleManagerCallback)
-     * @see #clearRoleHoldersAsUser(String, int, UserHandle, Executor, RoleManagerCallback)
+     * @see #addRoleHolderAsUser(String, String, int, UserHandle, Executor, Consumer)
+     * @see #removeRoleHolderAsUser(String, String, int, UserHandle, Executor, Consumer)
+     * @see #clearRoleHoldersAsUser(String, int, UserHandle, Executor, Consumer)
      *
      * @hide
      */
@@ -350,8 +353,8 @@
      * @param callback the callback for whether this call is successful
      *
      * @see #getRoleHoldersAsUser(String, UserHandle)
-     * @see #removeRoleHolderAsUser(String, String, int, UserHandle, Executor, RoleManagerCallback)
-     * @see #clearRoleHoldersAsUser(String, int, UserHandle, Executor, RoleManagerCallback)
+     * @see #removeRoleHolderAsUser(String, String, int, UserHandle, Executor, Consumer)
+     * @see #clearRoleHoldersAsUser(String, int, UserHandle, Executor, Consumer)
      *
      * @hide
      */
@@ -360,7 +363,7 @@
     @TestApi
     public void addRoleHolderAsUser(@NonNull String roleName, @NonNull String packageName,
             @ManageHoldersFlags int flags, @NonNull UserHandle user,
-            @CallbackExecutor @NonNull Executor executor, @NonNull RoleManagerCallback callback) {
+            @CallbackExecutor @NonNull Executor executor, @NonNull Consumer<Boolean> callback) {
         Preconditions.checkStringNotEmpty(roleName, "roleName cannot be null or empty");
         Preconditions.checkStringNotEmpty(packageName, "packageName cannot be null or empty");
         Preconditions.checkNotNull(user, "user cannot be null");
@@ -368,7 +371,7 @@
         Preconditions.checkNotNull(callback, "callback cannot be null");
         try {
             mService.addRoleHolderAsUser(roleName, packageName, flags, user.getIdentifier(),
-                    new RoleManagerCallbackDelegate(executor, callback));
+                    createRemoteCallback(executor, callback));
         } catch (RemoteException e) {
             throw e.rethrowFromSystemServer();
         }
@@ -389,8 +392,8 @@
      * @param callback the callback for whether this call is successful
      *
      * @see #getRoleHoldersAsUser(String, UserHandle)
-     * @see #addRoleHolderAsUser(String, String, int, UserHandle, Executor, RoleManagerCallback)
-     * @see #clearRoleHoldersAsUser(String, int, UserHandle, Executor, RoleManagerCallback)
+     * @see #addRoleHolderAsUser(String, String, int, UserHandle, Executor, Consumer)
+     * @see #clearRoleHoldersAsUser(String, int, UserHandle, Executor, Consumer)
      *
      * @hide
      */
@@ -399,7 +402,7 @@
     @TestApi
     public void removeRoleHolderAsUser(@NonNull String roleName, @NonNull String packageName,
             @ManageHoldersFlags int flags, @NonNull UserHandle user,
-            @CallbackExecutor @NonNull Executor executor, @NonNull RoleManagerCallback callback) {
+            @CallbackExecutor @NonNull Executor executor, @NonNull Consumer<Boolean> callback) {
         Preconditions.checkStringNotEmpty(roleName, "roleName cannot be null or empty");
         Preconditions.checkStringNotEmpty(packageName, "packageName cannot be null or empty");
         Preconditions.checkNotNull(user, "user cannot be null");
@@ -407,7 +410,7 @@
         Preconditions.checkNotNull(callback, "callback cannot be null");
         try {
             mService.removeRoleHolderAsUser(roleName, packageName, flags, user.getIdentifier(),
-                    new RoleManagerCallbackDelegate(executor, callback));
+                    createRemoteCallback(executor, callback));
         } catch (RemoteException e) {
             throw e.rethrowFromSystemServer();
         }
@@ -427,8 +430,8 @@
      * @param callback the callback for whether this call is successful
      *
      * @see #getRoleHoldersAsUser(String, UserHandle)
-     * @see #addRoleHolderAsUser(String, String, int, UserHandle, Executor, RoleManagerCallback)
-     * @see #removeRoleHolderAsUser(String, String, int, UserHandle, Executor, RoleManagerCallback)
+     * @see #addRoleHolderAsUser(String, String, int, UserHandle, Executor, Consumer)
+     * @see #removeRoleHolderAsUser(String, String, int, UserHandle, Executor, Consumer)
      *
      * @hide
      */
@@ -437,19 +440,33 @@
     @TestApi
     public void clearRoleHoldersAsUser(@NonNull String roleName, @ManageHoldersFlags int flags,
             @NonNull UserHandle user, @CallbackExecutor @NonNull Executor executor,
-            @NonNull RoleManagerCallback callback) {
+            @NonNull Consumer<Boolean> callback) {
         Preconditions.checkStringNotEmpty(roleName, "roleName cannot be null or empty");
         Preconditions.checkNotNull(user, "user cannot be null");
         Preconditions.checkNotNull(executor, "executor cannot be null");
         Preconditions.checkNotNull(callback, "callback cannot be null");
         try {
             mService.clearRoleHoldersAsUser(roleName, flags, user.getIdentifier(),
-                    new RoleManagerCallbackDelegate(executor, callback));
+                    createRemoteCallback(executor, callback));
         } catch (RemoteException e) {
             throw e.rethrowFromSystemServer();
         }
     }
 
+    @NonNull
+    private static RemoteCallback createRemoteCallback(@NonNull Executor executor,
+            @NonNull Consumer<Boolean> callback) {
+        return new RemoteCallback(result -> executor.execute(() -> {
+            boolean successful = result != null;
+            long token = Binder.clearCallingIdentity();
+            try {
+                callback.accept(successful);
+            } finally {
+                Binder.restoreCallingIdentity(token);
+            }
+        }));
+    }
+
     /**
      * Add a listener to observe role holder changes
      * <p>
@@ -467,6 +484,7 @@
      */
     @RequiresPermission(Manifest.permission.OBSERVE_ROLE_HOLDERS)
     @SystemApi
+    @TestApi
     public void addOnRoleHoldersChangedListenerAsUser(@CallbackExecutor @NonNull Executor executor,
             @NonNull OnRoleHoldersChangedListener listener, @NonNull UserHandle user) {
         Preconditions.checkNotNull(executor, "executor cannot be null");
@@ -512,6 +530,7 @@
      */
     @RequiresPermission(Manifest.permission.OBSERVE_ROLE_HOLDERS)
     @SystemApi
+    @TestApi
     public void removeOnRoleHoldersChangedListenerAsUser(
             @NonNull OnRoleHoldersChangedListener listener, @NonNull UserHandle user) {
         Preconditions.checkNotNull(listener, "listener cannot be null");
@@ -542,7 +561,7 @@
 
     /**
      * Set the names of all the available roles. Should only be called from
-     * {@link android.rolecontrollerservice.RoleControllerService}.
+     * {@link android.app.role.RoleControllerService}.
      * <p>
      * <strong>Note:</strong> Using this API requires holding
      * {@link #PERMISSION_MANAGE_ROLES_FROM_CONTROLLER}.
@@ -553,6 +572,7 @@
      */
     @RequiresPermission(PERMISSION_MANAGE_ROLES_FROM_CONTROLLER)
     @SystemApi
+    @TestApi
     public void setRoleNamesFromController(@NonNull List<String> roleNames) {
         Preconditions.checkNotNull(roleNames, "roleNames cannot be null");
         try {
@@ -565,7 +585,7 @@
     /**
      * Add a specific application to the holders of a role, only modifying records inside
      * {@link RoleManager}. Should only be called from
-     * {@link android.rolecontrollerservice.RoleControllerService}.
+     * {@link android.app.role.RoleControllerService}.
      * <p>
      * <strong>Note:</strong> Using this API requires holding
      * {@link #PERMISSION_MANAGE_ROLES_FROM_CONTROLLER}.
@@ -583,6 +603,7 @@
      */
     @RequiresPermission(PERMISSION_MANAGE_ROLES_FROM_CONTROLLER)
     @SystemApi
+    @TestApi
     public boolean addRoleHolderFromController(@NonNull String roleName,
             @NonNull String packageName) {
         Preconditions.checkStringNotEmpty(roleName, "roleName cannot be null or empty");
@@ -597,7 +618,7 @@
     /**
      * Remove a specific application from the holders of a role, only modifying records inside
      * {@link RoleManager}. Should only be called from
-     * {@link android.rolecontrollerservice.RoleControllerService}.
+     * {@link android.app.role.RoleControllerService}.
      * <p>
      * <strong>Note:</strong> Using this API requires holding
      * {@link #PERMISSION_MANAGE_ROLES_FROM_CONTROLLER}.
@@ -615,6 +636,7 @@
      */
     @RequiresPermission(PERMISSION_MANAGE_ROLES_FROM_CONTROLLER)
     @SystemApi
+    @TestApi
     public boolean removeRoleHolderFromController(@NonNull String roleName,
             @NonNull String packageName) {
         Preconditions.checkStringNotEmpty(roleName, "roleName cannot be null or empty");
@@ -634,9 +656,10 @@
      *
      * @hide
      */
+    @NonNull
     @RequiresPermission(PERMISSION_MANAGE_ROLES_FROM_CONTROLLER)
     @SystemApi
-    @NonNull
+    @TestApi
     public List<String> getHeldRolesFromController(@NonNull String packageName) {
         Preconditions.checkStringNotEmpty(packageName, "packageName cannot be null or empty");
         try {
@@ -662,40 +685,6 @@
         }
     }
 
-    private static class RoleManagerCallbackDelegate extends IRoleManagerCallback.Stub {
-
-        @NonNull
-        private final Executor mExecutor;
-        @NonNull
-        private final RoleManagerCallback mCallback;
-
-        RoleManagerCallbackDelegate(@NonNull Executor executor,
-                @NonNull RoleManagerCallback callback) {
-            mExecutor = executor;
-            mCallback = callback;
-        }
-
-        @Override
-        public void onSuccess() {
-            long token = Binder.clearCallingIdentity();
-            try {
-                mExecutor.execute(mCallback::onSuccess);
-            } finally {
-                Binder.restoreCallingIdentity(token);
-            }
-        }
-
-        @Override
-        public void onFailure() {
-            long token = Binder.clearCallingIdentity();
-            try {
-                mExecutor.execute(mCallback::onFailure);
-            } finally {
-                Binder.restoreCallingIdentity(token);
-            }
-        }
-    }
-
     private static class OnRoleHoldersChangedListenerDelegate
             extends IOnRoleHoldersChangedListener.Stub {
 
diff --git a/core/java/android/app/role/RoleManagerCallback.java b/core/java/android/app/role/RoleManagerCallback.java
deleted file mode 100644
index a92ef32..0000000
--- a/core/java/android/app/role/RoleManagerCallback.java
+++ /dev/null
@@ -1,56 +0,0 @@
-/*
- * Copyright (C) 2018 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.app.role;
-
-import android.annotation.SystemApi;
-import android.annotation.TestApi;
-
-import java.util.concurrent.CompletableFuture;
-
-/**
- * Callback for a {@link RoleManager} request.
- *
- * @hide
- */
-@SystemApi
-@TestApi
-public interface RoleManagerCallback {
-
-    /**
-     * Signals a success.
-     */
-    void onSuccess();
-
-    /**
-     * Signals a failure.
-     */
-    void onFailure();
-
-    /** @hide */
-    class Future extends CompletableFuture<Void> implements RoleManagerCallback {
-
-        @Override
-        public void onSuccess() {
-            complete(null);
-        }
-
-        @Override
-        public void onFailure() {
-            completeExceptionally(new RuntimeException());
-        }
-    }
-}
diff --git a/core/java/android/app/servertransaction/ActivityConfigurationChangeItem.java b/core/java/android/app/servertransaction/ActivityConfigurationChangeItem.java
index 8ee9e53..0d4e16b 100644
--- a/core/java/android/app/servertransaction/ActivityConfigurationChangeItem.java
+++ b/core/java/android/app/servertransaction/ActivityConfigurationChangeItem.java
@@ -86,7 +86,7 @@
         mConfiguration = in.readTypedObject(Configuration.CREATOR);
     }
 
-    public static final Creator<ActivityConfigurationChangeItem> CREATOR =
+    public static final @android.annotation.NonNull Creator<ActivityConfigurationChangeItem> CREATOR =
             new Creator<ActivityConfigurationChangeItem>() {
         public ActivityConfigurationChangeItem createFromParcel(Parcel in) {
             return new ActivityConfigurationChangeItem(in);
diff --git a/core/java/android/app/servertransaction/ActivityRelaunchItem.java b/core/java/android/app/servertransaction/ActivityRelaunchItem.java
index d8a7463..9844de7 100644
--- a/core/java/android/app/servertransaction/ActivityRelaunchItem.java
+++ b/core/java/android/app/servertransaction/ActivityRelaunchItem.java
@@ -130,7 +130,7 @@
         mPreserveWindow = in.readBoolean();
     }
 
-    public static final Creator<ActivityRelaunchItem> CREATOR =
+    public static final @android.annotation.NonNull Creator<ActivityRelaunchItem> CREATOR =
             new Creator<ActivityRelaunchItem>() {
                 public ActivityRelaunchItem createFromParcel(Parcel in) {
                     return new ActivityRelaunchItem(in);
diff --git a/core/java/android/app/servertransaction/ActivityResultItem.java b/core/java/android/app/servertransaction/ActivityResultItem.java
index bab17dc..52ec3e6 100644
--- a/core/java/android/app/servertransaction/ActivityResultItem.java
+++ b/core/java/android/app/servertransaction/ActivityResultItem.java
@@ -88,7 +88,7 @@
         mResultInfoList = in.createTypedArrayList(ResultInfo.CREATOR);
     }
 
-    public static final Parcelable.Creator<ActivityResultItem> CREATOR =
+    public static final @android.annotation.NonNull Parcelable.Creator<ActivityResultItem> CREATOR =
             new Parcelable.Creator<ActivityResultItem>() {
         public ActivityResultItem createFromParcel(Parcel in) {
             return new ActivityResultItem(in);
diff --git a/core/java/android/app/servertransaction/ClientTransaction.java b/core/java/android/app/servertransaction/ClientTransaction.java
index f1d87ac..b08e5973 100644
--- a/core/java/android/app/servertransaction/ClientTransaction.java
+++ b/core/java/android/app/servertransaction/ClientTransaction.java
@@ -204,7 +204,7 @@
         }
     }
 
-    public static final Creator<ClientTransaction> CREATOR =
+    public static final @android.annotation.NonNull Creator<ClientTransaction> CREATOR =
             new Creator<ClientTransaction>() {
         public ClientTransaction createFromParcel(Parcel in) {
             return new ClientTransaction(in);
diff --git a/core/java/android/app/servertransaction/ConfigurationChangeItem.java b/core/java/android/app/servertransaction/ConfigurationChangeItem.java
index 4ab7251..0f244d0 100644
--- a/core/java/android/app/servertransaction/ConfigurationChangeItem.java
+++ b/core/java/android/app/servertransaction/ConfigurationChangeItem.java
@@ -78,7 +78,7 @@
         mConfiguration = in.readTypedObject(Configuration.CREATOR);
     }
 
-    public static final Creator<ConfigurationChangeItem> CREATOR =
+    public static final @android.annotation.NonNull Creator<ConfigurationChangeItem> CREATOR =
             new Creator<ConfigurationChangeItem>() {
         public ConfigurationChangeItem createFromParcel(Parcel in) {
             return new ConfigurationChangeItem(in);
diff --git a/core/java/android/app/servertransaction/DestroyActivityItem.java b/core/java/android/app/servertransaction/DestroyActivityItem.java
index 5941486..3ee7614 100644
--- a/core/java/android/app/servertransaction/DestroyActivityItem.java
+++ b/core/java/android/app/servertransaction/DestroyActivityItem.java
@@ -92,7 +92,7 @@
         mConfigChanges = in.readInt();
     }
 
-    public static final Creator<DestroyActivityItem> CREATOR =
+    public static final @android.annotation.NonNull Creator<DestroyActivityItem> CREATOR =
             new Creator<DestroyActivityItem>() {
         public DestroyActivityItem createFromParcel(Parcel in) {
             return new DestroyActivityItem(in);
diff --git a/core/java/android/app/servertransaction/LaunchActivityItem.java b/core/java/android/app/servertransaction/LaunchActivityItem.java
index ed793bf..db22f8d 100644
--- a/core/java/android/app/servertransaction/LaunchActivityItem.java
+++ b/core/java/android/app/servertransaction/LaunchActivityItem.java
@@ -148,7 +148,7 @@
                 in.readTypedObject(ProfilerInfo.CREATOR));
     }
 
-    public static final Creator<LaunchActivityItem> CREATOR =
+    public static final @android.annotation.NonNull Creator<LaunchActivityItem> CREATOR =
             new Creator<LaunchActivityItem>() {
         public LaunchActivityItem createFromParcel(Parcel in) {
             return new LaunchActivityItem(in);
diff --git a/core/java/android/app/servertransaction/MoveToDisplayItem.java b/core/java/android/app/servertransaction/MoveToDisplayItem.java
index b3dddfb3..f6d3dbd 100644
--- a/core/java/android/app/servertransaction/MoveToDisplayItem.java
+++ b/core/java/android/app/servertransaction/MoveToDisplayItem.java
@@ -83,7 +83,7 @@
         mConfiguration = in.readTypedObject(Configuration.CREATOR);
     }
 
-    public static final Creator<MoveToDisplayItem> CREATOR = new Creator<MoveToDisplayItem>() {
+    public static final @android.annotation.NonNull Creator<MoveToDisplayItem> CREATOR = new Creator<MoveToDisplayItem>() {
         public MoveToDisplayItem createFromParcel(Parcel in) {
             return new MoveToDisplayItem(in);
         }
diff --git a/core/java/android/app/servertransaction/MultiWindowModeChangeItem.java b/core/java/android/app/servertransaction/MultiWindowModeChangeItem.java
index c3022d6..b150717 100644
--- a/core/java/android/app/servertransaction/MultiWindowModeChangeItem.java
+++ b/core/java/android/app/servertransaction/MultiWindowModeChangeItem.java
@@ -81,7 +81,7 @@
         mOverrideConfig = in.readTypedObject(Configuration.CREATOR);
     }
 
-    public static final Creator<MultiWindowModeChangeItem> CREATOR =
+    public static final @android.annotation.NonNull Creator<MultiWindowModeChangeItem> CREATOR =
             new Creator<MultiWindowModeChangeItem>() {
         public MultiWindowModeChangeItem createFromParcel(Parcel in) {
             return new MultiWindowModeChangeItem(in);
diff --git a/core/java/android/app/servertransaction/NewIntentItem.java b/core/java/android/app/servertransaction/NewIntentItem.java
index 4f28cd2..4c7f56d 100644
--- a/core/java/android/app/servertransaction/NewIntentItem.java
+++ b/core/java/android/app/servertransaction/NewIntentItem.java
@@ -92,7 +92,7 @@
         mIntents = in.createTypedArrayList(ReferrerIntent.CREATOR);
     }
 
-    public static final Parcelable.Creator<NewIntentItem> CREATOR =
+    public static final @android.annotation.NonNull Parcelable.Creator<NewIntentItem> CREATOR =
             new Parcelable.Creator<NewIntentItem>() {
         public NewIntentItem createFromParcel(Parcel in) {
             return new NewIntentItem(in);
diff --git a/core/java/android/app/servertransaction/PauseActivityItem.java b/core/java/android/app/servertransaction/PauseActivityItem.java
index cae93b3..f65c843 100644
--- a/core/java/android/app/servertransaction/PauseActivityItem.java
+++ b/core/java/android/app/servertransaction/PauseActivityItem.java
@@ -130,7 +130,7 @@
         mDontReport = in.readBoolean();
     }
 
-    public static final Creator<PauseActivityItem> CREATOR =
+    public static final @android.annotation.NonNull Creator<PauseActivityItem> CREATOR =
             new Creator<PauseActivityItem>() {
         public PauseActivityItem createFromParcel(Parcel in) {
             return new PauseActivityItem(in);
diff --git a/core/java/android/app/servertransaction/PipModeChangeItem.java b/core/java/android/app/servertransaction/PipModeChangeItem.java
index b999cd7..1955897 100644
--- a/core/java/android/app/servertransaction/PipModeChangeItem.java
+++ b/core/java/android/app/servertransaction/PipModeChangeItem.java
@@ -79,7 +79,7 @@
         mOverrideConfig = in.readTypedObject(Configuration.CREATOR);
     }
 
-    public static final Creator<PipModeChangeItem> CREATOR =
+    public static final @android.annotation.NonNull Creator<PipModeChangeItem> CREATOR =
             new Creator<PipModeChangeItem>() {
         public PipModeChangeItem createFromParcel(Parcel in) {
             return new PipModeChangeItem(in);
diff --git a/core/java/android/app/servertransaction/ResumeActivityItem.java b/core/java/android/app/servertransaction/ResumeActivityItem.java
index a5b6f7c..905076b 100644
--- a/core/java/android/app/servertransaction/ResumeActivityItem.java
+++ b/core/java/android/app/servertransaction/ResumeActivityItem.java
@@ -128,7 +128,7 @@
         mIsForward = in.readBoolean();
     }
 
-    public static final Creator<ResumeActivityItem> CREATOR =
+    public static final @android.annotation.NonNull Creator<ResumeActivityItem> CREATOR =
             new Creator<ResumeActivityItem>() {
         public ResumeActivityItem createFromParcel(Parcel in) {
             return new ResumeActivityItem(in);
diff --git a/core/java/android/app/servertransaction/StopActivityItem.java b/core/java/android/app/servertransaction/StopActivityItem.java
index 87db206..63efa6f 100644
--- a/core/java/android/app/servertransaction/StopActivityItem.java
+++ b/core/java/android/app/servertransaction/StopActivityItem.java
@@ -95,7 +95,7 @@
         mConfigChanges = in.readInt();
     }
 
-    public static final Creator<StopActivityItem> CREATOR =
+    public static final @android.annotation.NonNull Creator<StopActivityItem> CREATOR =
             new Creator<StopActivityItem>() {
         public StopActivityItem createFromParcel(Parcel in) {
             return new StopActivityItem(in);
diff --git a/core/java/android/app/servertransaction/TopResumedActivityChangeItem.java b/core/java/android/app/servertransaction/TopResumedActivityChangeItem.java
index 4064a02..c7e4c36 100644
--- a/core/java/android/app/servertransaction/TopResumedActivityChangeItem.java
+++ b/core/java/android/app/servertransaction/TopResumedActivityChangeItem.java
@@ -17,9 +17,11 @@
 
 import static android.os.Trace.TRACE_TAG_ACTIVITY_MANAGER;
 
+import android.app.ActivityTaskManager;
 import android.app.ClientTransactionHandler;
 import android.os.IBinder;
 import android.os.Parcel;
+import android.os.RemoteException;
 import android.os.Trace;
 
 /**
@@ -38,6 +40,26 @@
         Trace.traceEnd(TRACE_TAG_ACTIVITY_MANAGER);
     }
 
+    @Override
+    public void postExecute(ClientTransactionHandler client, IBinder token,
+            PendingTransactionActions pendingActions) {
+        if (mOnTop) {
+            return;
+        }
+
+        // The loss of top resumed state can always be reported immediately in postExecute
+        // because only three cases are possible:
+        // 1. Activity is in RESUMED state now and it just handled the callback in #execute().
+        // 2. Activity wasn't RESUMED yet, which means that it didn't receive the top state yet.
+        // 3. Activity is PAUSED or in other lifecycle state after PAUSED. In this case top resumed
+        // state loss was already called right before pausing.
+        try {
+            ActivityTaskManager.getService().activityTopResumedStateLost();
+        } catch (RemoteException ex) {
+            throw ex.rethrowFromSystemServer();
+        }
+    }
+
 
     // ObjectPoolItem implementation
 
@@ -75,7 +97,7 @@
         mOnTop = in.readBoolean();
     }
 
-    public static final Creator<TopResumedActivityChangeItem> CREATOR =
+    public static final @android.annotation.NonNull Creator<TopResumedActivityChangeItem> CREATOR =
             new Creator<TopResumedActivityChangeItem>() {
                 public TopResumedActivityChangeItem createFromParcel(Parcel in) {
                     return new TopResumedActivityChangeItem(in);
diff --git a/core/java/android/app/servertransaction/WindowVisibilityItem.java b/core/java/android/app/servertransaction/WindowVisibilityItem.java
index d9956b1..115d1ec 100644
--- a/core/java/android/app/servertransaction/WindowVisibilityItem.java
+++ b/core/java/android/app/servertransaction/WindowVisibilityItem.java
@@ -34,7 +34,8 @@
     @Override
     public void execute(ClientTransactionHandler client, IBinder token,
             PendingTransactionActions pendingActions) {
-        Trace.traceBegin(TRACE_TAG_ACTIVITY_MANAGER, "activityShowWindow");
+        Trace.traceBegin(TRACE_TAG_ACTIVITY_MANAGER,
+                mShowWindow ? "activityShowWindow" : "activityHideWindow");
         client.handleWindowVisibility(token, mShowWindow);
         Trace.traceEnd(TRACE_TAG_ACTIVITY_MANAGER);
     }
@@ -75,7 +76,7 @@
         mShowWindow = in.readBoolean();
     }
 
-    public static final Creator<WindowVisibilityItem> CREATOR =
+    public static final @android.annotation.NonNull Creator<WindowVisibilityItem> CREATOR =
             new Creator<WindowVisibilityItem>() {
         public WindowVisibilityItem createFromParcel(Parcel in) {
             return new WindowVisibilityItem(in);
diff --git a/core/java/android/app/slice/Slice.java b/core/java/android/app/slice/Slice.java
index d1aec04..a7319f6 100644
--- a/core/java/android/app/slice/Slice.java
+++ b/core/java/android/app/slice/Slice.java
@@ -543,7 +543,7 @@
         }
     }
 
-    public static final Creator<Slice> CREATOR = new Creator<Slice>() {
+    public static final @android.annotation.NonNull Creator<Slice> CREATOR = new Creator<Slice>() {
         @Override
         public Slice createFromParcel(Parcel in) {
             return new Slice(in);
diff --git a/core/java/android/app/slice/SliceItem.java b/core/java/android/app/slice/SliceItem.java
index c058a14..ed32a1b 100644
--- a/core/java/android/app/slice/SliceItem.java
+++ b/core/java/android/app/slice/SliceItem.java
@@ -378,7 +378,7 @@
         throw new RuntimeException("Unsupported type " + type);
     }
 
-    public static final Creator<SliceItem> CREATOR = new Creator<SliceItem>() {
+    public static final @android.annotation.NonNull Creator<SliceItem> CREATOR = new Creator<SliceItem>() {
         @Override
         public SliceItem createFromParcel(Parcel in) {
             return new SliceItem(in);
diff --git a/core/java/android/app/slice/SliceSpec.java b/core/java/android/app/slice/SliceSpec.java
index b3790e2..b1080e0 100644
--- a/core/java/android/app/slice/SliceSpec.java
+++ b/core/java/android/app/slice/SliceSpec.java
@@ -108,7 +108,7 @@
         return String.format("SliceSpec{%s,%d}", mType, mRevision);
     }
 
-    public static final Creator<SliceSpec> CREATOR = new Creator<SliceSpec>() {
+    public static final @android.annotation.NonNull Creator<SliceSpec> CREATOR = new Creator<SliceSpec>() {
         @Override
         public SliceSpec createFromParcel(Parcel source) {
             return new SliceSpec(source);
diff --git a/core/java/android/app/timedetector/TimeSignal.java b/core/java/android/app/timedetector/TimeSignal.java
index 7ba03cc..da21794 100644
--- a/core/java/android/app/timedetector/TimeSignal.java
+++ b/core/java/android/app/timedetector/TimeSignal.java
@@ -33,7 +33,7 @@
  */
 public final class TimeSignal implements Parcelable {
 
-    public static final Parcelable.Creator<TimeSignal> CREATOR =
+    public static final @android.annotation.NonNull Parcelable.Creator<TimeSignal> CREATOR =
             new Parcelable.Creator<TimeSignal>() {
                 public TimeSignal createFromParcel(Parcel in) {
                     return TimeSignal.createFromParcel(in);
diff --git a/core/java/android/app/timezone/DistroFormatVersion.java b/core/java/android/app/timezone/DistroFormatVersion.java
index be732e4..04e3142 100644
--- a/core/java/android/app/timezone/DistroFormatVersion.java
+++ b/core/java/android/app/timezone/DistroFormatVersion.java
@@ -45,7 +45,7 @@
         mMinorVersion = Utils.validateVersion("minor", minorVersion);
     }
 
-    public static final Creator<DistroFormatVersion> CREATOR = new Creator<DistroFormatVersion>() {
+    public static final @android.annotation.NonNull Creator<DistroFormatVersion> CREATOR = new Creator<DistroFormatVersion>() {
         public DistroFormatVersion createFromParcel(Parcel in) {
             int majorVersion = in.readInt();
             int minorVersion = in.readInt();
diff --git a/core/java/android/app/timezone/DistroRulesVersion.java b/core/java/android/app/timezone/DistroRulesVersion.java
index a680594..3fae161 100644
--- a/core/java/android/app/timezone/DistroRulesVersion.java
+++ b/core/java/android/app/timezone/DistroRulesVersion.java
@@ -46,7 +46,7 @@
         mRevision = validateVersion("revision", revision);
     }
 
-    public static final Creator<DistroRulesVersion> CREATOR = new Creator<DistroRulesVersion>() {
+    public static final @android.annotation.NonNull Creator<DistroRulesVersion> CREATOR = new Creator<DistroRulesVersion>() {
         public DistroRulesVersion createFromParcel(Parcel in) {
             String rulesVersion = in.readString();
             int revision = in.readInt();
diff --git a/core/java/android/app/timezone/RulesState.java b/core/java/android/app/timezone/RulesState.java
index 38dd1eb..d35967d 100644
--- a/core/java/android/app/timezone/RulesState.java
+++ b/core/java/android/app/timezone/RulesState.java
@@ -182,7 +182,7 @@
         return mBaseRulesVersion.compareTo(distroRulesVersion.getRulesVersion()) > 0;
     }
 
-    public static final Parcelable.Creator<RulesState> CREATOR =
+    public static final @android.annotation.NonNull Parcelable.Creator<RulesState> CREATOR =
             new Parcelable.Creator<RulesState>() {
         public RulesState createFromParcel(Parcel in) {
             return RulesState.createFromParcel(in);
diff --git a/core/java/android/app/usage/AppStandbyInfo.java b/core/java/android/app/usage/AppStandbyInfo.java
index 51fe0e2..ebdbf83 100644
--- a/core/java/android/app/usage/AppStandbyInfo.java
+++ b/core/java/android/app/usage/AppStandbyInfo.java
@@ -50,7 +50,7 @@
         dest.writeInt(mStandbyBucket);
     }
 
-    public static final Creator<AppStandbyInfo> CREATOR = new Creator<AppStandbyInfo>() {
+    public static final @android.annotation.NonNull Creator<AppStandbyInfo> CREATOR = new Creator<AppStandbyInfo>() {
         @Override
         public AppStandbyInfo createFromParcel(Parcel source) {
             return new AppStandbyInfo(source);
diff --git a/core/java/android/app/usage/CacheQuotaHint.java b/core/java/android/app/usage/CacheQuotaHint.java
index 1d5c2b0..b92d538 100644
--- a/core/java/android/app/usage/CacheQuotaHint.java
+++ b/core/java/android/app/usage/CacheQuotaHint.java
@@ -140,7 +140,7 @@
         }
     }
 
-    public static final Parcelable.Creator<CacheQuotaHint> CREATOR =
+    public static final @android.annotation.NonNull Parcelable.Creator<CacheQuotaHint> CREATOR =
             new Creator<CacheQuotaHint>() {
                 @Override
                 public CacheQuotaHint createFromParcel(Parcel in) {
diff --git a/core/java/android/app/usage/ConfigurationStats.java b/core/java/android/app/usage/ConfigurationStats.java
index 87a737d..da3b769 100644
--- a/core/java/android/app/usage/ConfigurationStats.java
+++ b/core/java/android/app/usage/ConfigurationStats.java
@@ -146,7 +146,7 @@
         dest.writeInt(mActivationCount);
     }
 
-    public static final Creator<ConfigurationStats> CREATOR = new Creator<ConfigurationStats>() {
+    public static final @android.annotation.NonNull Creator<ConfigurationStats> CREATOR = new Creator<ConfigurationStats>() {
         @Override
         public ConfigurationStats createFromParcel(Parcel source) {
             ConfigurationStats stats = new ConfigurationStats();
diff --git a/core/java/android/app/usage/EventStats.java b/core/java/android/app/usage/EventStats.java
index ea95a05..7ada092 100644
--- a/core/java/android/app/usage/EventStats.java
+++ b/core/java/android/app/usage/EventStats.java
@@ -160,7 +160,7 @@
         dest.writeInt(mCount);
     }
 
-    public static final Creator<EventStats> CREATOR = new Creator<EventStats>() {
+    public static final @android.annotation.NonNull Creator<EventStats> CREATOR = new Creator<EventStats>() {
         @Override
         public EventStats createFromParcel(Parcel in) {
             EventStats stats = new EventStats();
diff --git a/core/java/android/app/usage/ExternalStorageStats.java b/core/java/android/app/usage/ExternalStorageStats.java
index f00e5c2..3a51207 100644
--- a/core/java/android/app/usage/ExternalStorageStats.java
+++ b/core/java/android/app/usage/ExternalStorageStats.java
@@ -131,7 +131,7 @@
         dest.writeLong(obbBytes);
     }
 
-    public static final Creator<ExternalStorageStats> CREATOR = new Creator<ExternalStorageStats>() {
+    public static final @android.annotation.NonNull Creator<ExternalStorageStats> CREATOR = new Creator<ExternalStorageStats>() {
         @Override
         public ExternalStorageStats createFromParcel(Parcel in) {
             return new ExternalStorageStats(in);
diff --git a/core/java/android/app/usage/IUsageStatsManager.aidl b/core/java/android/app/usage/IUsageStatsManager.aidl
index b1500c1..62b24e9 100644
--- a/core/java/android/app/usage/IUsageStatsManager.aidl
+++ b/core/java/android/app/usage/IUsageStatsManager.aidl
@@ -28,8 +28,10 @@
  * {@hide}
  */
 interface IUsageStatsManager {
+    @UnsupportedAppUsage
     ParceledListSlice queryUsageStats(int bucketType, long beginTime, long endTime,
             String callingPackage);
+    @UnsupportedAppUsage
     ParceledListSlice queryConfigurationStats(int bucketType, long beginTime, long endTime,
             String callingPackage);
     ParceledListSlice queryEventStats(int bucketType, long beginTime, long endTime,
@@ -38,7 +40,9 @@
     UsageEvents queryEventsForPackage(long beginTime, long endTime, String callingPackage);
     UsageEvents queryEventsForUser(long beginTime, long endTime, int userId, String callingPackage);
     UsageEvents queryEventsForPackageForUser(long beginTime, long endTime, int userId, String pkg, String callingPackage);
+    @UnsupportedAppUsage
     void setAppInactive(String packageName, boolean inactive, int userId);
+    @UnsupportedAppUsage
     boolean isAppInactive(String packageName, int userId);
     void whitelistAppTemporarily(String packageName, long duration, int userId);
     void onCarrierPrivilegedAppsChanged();
@@ -56,7 +60,7 @@
             in PendingIntent sessionEndCallbackIntent, String callingPackage);
     void unregisterUsageSessionObserver(int sessionObserverId, String callingPackage);
     void registerAppUsageLimitObserver(int observerId, in String[] packages, long timeLimitMs,
-            in PendingIntent callback, String callingPackage);
+            long timeRemainingMs, in PendingIntent callback, String callingPackage);
     void unregisterAppUsageLimitObserver(int observerId, String callingPackage);
     void reportUsageStart(in IBinder activity, String token, String callingPackage);
     void reportPastUsageStart(in IBinder activity, String token, long timeAgoMs,
diff --git a/core/java/android/app/usage/StorageStats.java b/core/java/android/app/usage/StorageStats.java
index 3a27751..a2ff159 100644
--- a/core/java/android/app/usage/StorageStats.java
+++ b/core/java/android/app/usage/StorageStats.java
@@ -106,7 +106,7 @@
         dest.writeLong(cacheBytes);
     }
 
-    public static final Creator<StorageStats> CREATOR = new Creator<StorageStats>() {
+    public static final @android.annotation.NonNull Creator<StorageStats> CREATOR = new Creator<StorageStats>() {
         @Override
         public StorageStats createFromParcel(Parcel in) {
             return new StorageStats(in);
diff --git a/core/java/android/app/usage/UsageEvents.java b/core/java/android/app/usage/UsageEvents.java
index fafea34..b3d01fd 100644
--- a/core/java/android/app/usage/UsageEvents.java
+++ b/core/java/android/app/usage/UsageEvents.java
@@ -254,18 +254,32 @@
         public static final int FLUSH_TO_DISK = 25;
 
         /**
-         * An event type denoting that the device underwent a shutdown process.
+         * An event type denoting that the Android runtime underwent a shutdown process.
          * A DEVICE_SHUTDOWN event should be treated as if all started activities and foreground
          * services are now stopped and no explicit {@link #ACTIVITY_STOPPED} and
          * {@link #FOREGROUND_SERVICE_STOP} events will be generated for them.
+         *
+         * <p>The DEVICE_SHUTDOWN timestamp is actually the last time UsageStats database is
+         * persisted before the actual shutdown. Events (if there are any) between this timestamp
+         * and the actual shutdown is not persisted in the database. So any open events without
+         * matching close events between DEVICE_SHUTDOWN and {@link #DEVICE_STARTUP} should be
+         * ignored because the closing time is unknown.</p>
          */
         public static final int DEVICE_SHUTDOWN = 26;
 
         /**
+         * An event type denoting that the Android runtime started up. This could be after a
+         * shutdown or a runtime restart. Any open events without matching close events between
+         * {@link #DEVICE_SHUTDOWN} and DEVICE_STARTUP should be ignored because the closing time is
+         * unknown.
+         */
+        public static final int DEVICE_STARTUP = 27;
+
+        /**
          * Keep in sync with the greatest event type value.
          * @hide
          */
-        public static final int MAX_EVENT_TYPE = 26;
+        public static final int MAX_EVENT_TYPE = 27;
 
         /** @hide */
         public static final int FLAG_IS_PACKAGE_INSTANT_APP = 1 << 0;
@@ -880,7 +894,7 @@
         dest.writeBlob(data.marshall());
     }
 
-    public static final Creator<UsageEvents> CREATOR = new Creator<UsageEvents>() {
+    public static final @android.annotation.NonNull Creator<UsageEvents> CREATOR = new Creator<UsageEvents>() {
         @Override
         public UsageEvents createFromParcel(Parcel source) {
             return new UsageEvents(source);
diff --git a/core/java/android/app/usage/UsageStats.java b/core/java/android/app/usage/UsageStats.java
index 97efa01..2c021cc 100644
--- a/core/java/android/app/usage/UsageStats.java
+++ b/core/java/android/app/usage/UsageStats.java
@@ -636,7 +636,7 @@
         return bundle;
     }
 
-    public static final Creator<UsageStats> CREATOR = new Creator<UsageStats>() {
+    public static final @android.annotation.NonNull Creator<UsageStats> CREATOR = new Creator<UsageStats>() {
         @Override
         public UsageStats createFromParcel(Parcel in) {
             UsageStats stats = new UsageStats();
diff --git a/core/java/android/app/usage/UsageStatsManager.java b/core/java/android/app/usage/UsageStatsManager.java
index 9c6bd92..cee6b87 100644
--- a/core/java/android/app/usage/UsageStatsManager.java
+++ b/core/java/android/app/usage/UsageStatsManager.java
@@ -35,6 +35,7 @@
 
 import java.lang.annotation.Retention;
 import java.lang.annotation.RetentionPolicy;
+import java.time.Duration;
 import java.util.ArrayList;
 import java.util.Collections;
 import java.util.List;
@@ -195,6 +196,8 @@
     /** @hide */
     public static final int REASON_SUB_USAGE_EXEMPTED_SYNC_START = 0x000D;
     /** @hide */
+    public static final int REASON_SUB_USAGE_UNEXEMPTED_SYNC_SCHEDULED = 0x000E;
+    /** @hide */
     public static final int REASON_SUB_PREDICTED_RESTORED       = 0x0001;
 
 
@@ -736,6 +739,23 @@
     }
 
     /**
+     * @deprecated use
+     * {@link #registerAppUsageLimitObserver(int, String[], Duration, Duration, PendingIntent)}.
+     *
+     * @removed
+     * @hide
+     */
+    @Deprecated
+    @UnsupportedAppUsage
+    // STOPSHIP b/126917290: remove this method once ag/6591106 is merged and it's not being used.
+    public void registerAppUsageLimitObserver(int observerId, @NonNull String[] observedEntities,
+            long timeLimit, @NonNull TimeUnit timeUnit, @Nullable PendingIntent callbackIntent) {
+        final Duration timeLimitDuration = Duration.ofMillis(timeUnit.toMillis(timeLimit));
+        registerAppUsageLimitObserver(observerId, observedEntities,
+                timeLimitDuration, timeLimitDuration, callbackIntent);
+    }
+
+    /**
      * Register a usage limit observer that receives a callback on the provided intent when the
      * sum of usages of apps and tokens in the provided {@code observedEntities} array exceeds the
      * {@code timeLimit} specified. The structure of a token is a {@link String} with the reporting
@@ -757,19 +777,21 @@
      * @see android.content.pm.LauncherApps#getAppUsageLimit
      *
      * @param observerId A unique id associated with the group of apps to be monitored. There can
-     *                  be multiple groups with common packages and different time limits.
+     *                   be multiple groups with common packages and different time limits.
      * @param observedEntities The list of packages and token to observe for usage time. Cannot be
      *                         null and must include at least one package or token.
      * @param timeLimit The total time the set of apps can be in the foreground before the
-     *                  callbackIntent is delivered. Must be at least one minute. Note: a limit of
-     *                  0 can be set to indicate that the user has already exhausted the limit for
-     *                  a group, in which case, the given {@code callbackIntent} will be ignored.
-     * @param timeUnit The unit for time specified in {@code timeLimit}. Cannot be null.
+     *                  {@code callbackIntent} is delivered. Must be at least one minute.
+     * @param timeRemaining The remaining time the set of apps can be in the foreground before the
+     *                      {@code callbackIntent} is delivered. Must be greater than
+     *                      {@code timeLimit}. Note: a limit of 0 can be set to indicate that the
+     *                      user has already exhausted the limit for a group, in which case,
+     *                      the given {@code callbackIntent} will be ignored.
      * @param callbackIntent The PendingIntent that will be dispatched when the usage limit is
      *                       exceeded by the group of apps. The delivered Intent will also contain
      *                       the extras {@link #EXTRA_OBSERVER_ID}, {@link #EXTRA_TIME_LIMIT} and
      *                       {@link #EXTRA_TIME_USED}. Cannot be {@code null} unless the observer is
-     *                       being registered with a {@code timeLimit} of 0.
+     *                       being registered with a {@code timeRemaining} of 0.
      * @throws SecurityException if the caller doesn't have both SUSPEND_APPS and OBSERVE_APP_USAGE
      *                           permissions.
      * @hide
@@ -779,10 +801,12 @@
             android.Manifest.permission.SUSPEND_APPS,
             android.Manifest.permission.OBSERVE_APP_USAGE})
     public void registerAppUsageLimitObserver(int observerId, @NonNull String[] observedEntities,
-            long timeLimit, @NonNull TimeUnit timeUnit, @Nullable PendingIntent callbackIntent) {
+            @NonNull Duration timeLimit, @NonNull Duration timeRemaining,
+            @Nullable PendingIntent callbackIntent) {
         try {
             mService.registerAppUsageLimitObserver(observerId, observedEntities,
-                    timeUnit.toMillis(timeLimit), callbackIntent, mContext.getOpPackageName());
+                    timeLimit.toMillis(), timeRemaining.toMillis(), callbackIntent,
+                    mContext.getOpPackageName());
         } catch (RemoteException e) {
             throw e.rethrowFromSystemServer();
         }
@@ -972,6 +996,9 @@
                     case REASON_SUB_USAGE_EXEMPTED_SYNC_START:
                         sb.append("-es");
                         break;
+                    case REASON_SUB_USAGE_UNEXEMPTED_SYNC_SCHEDULED:
+                        sb.append("-uss");
+                        break;
                 }
                 break;
         }
diff --git a/core/java/android/app/usage/UsageStatsManagerInternal.java b/core/java/android/app/usage/UsageStatsManagerInternal.java
index 43ce521..bbec6b3 100644
--- a/core/java/android/app/usage/UsageStatsManagerInternal.java
+++ b/core/java/android/app/usage/UsageStatsManagerInternal.java
@@ -257,12 +257,14 @@
             int numDeferredJobs, long timeSinceLastJobRun);
 
     /**
-     * Report a sync is scheduled by a foreground app.
+     * Report a sync that was scheduled.
      *
      * @param packageName name of the package that owns the sync adapter.
      * @param userId which user the app is associated with
+     * @param exempted is sync app standby exempted
      */
-    public abstract void reportExemptedSyncScheduled(String packageName, @UserIdInt int userId);
+    public abstract void reportSyncScheduled(String packageName, @UserIdInt int userId,
+                                             boolean exempted);
 
     /**
      * Report a sync that was scheduled by a foreground app is about to be executed.
diff --git a/core/java/android/appwidget/AppWidgetProviderInfo.java b/core/java/android/appwidget/AppWidgetProviderInfo.java
index d148afb..2faa900 100644
--- a/core/java/android/appwidget/AppWidgetProviderInfo.java
+++ b/core/java/android/appwidget/AppWidgetProviderInfo.java
@@ -446,7 +446,7 @@
     /**
      * Parcelable.Creator that instantiates AppWidgetProviderInfo objects
      */
-    public static final Parcelable.Creator<AppWidgetProviderInfo> CREATOR
+    public static final @android.annotation.NonNull Parcelable.Creator<AppWidgetProviderInfo> CREATOR
             = new Parcelable.Creator<AppWidgetProviderInfo>()
     {
         public AppWidgetProviderInfo createFromParcel(Parcel parcel)
diff --git a/core/java/android/appwidget/PendingHostUpdate.java b/core/java/android/appwidget/PendingHostUpdate.java
index 5780319..e1bf159 100644
--- a/core/java/android/appwidget/PendingHostUpdate.java
+++ b/core/java/android/appwidget/PendingHostUpdate.java
@@ -112,7 +112,7 @@
     /**
      * Parcelable.Creator that instantiates PendingHostUpdate objects
      */
-    public static final Parcelable.Creator<PendingHostUpdate> CREATOR
+    public static final @android.annotation.NonNull Parcelable.Creator<PendingHostUpdate> CREATOR
             = new Parcelable.Creator<PendingHostUpdate>() {
         public PendingHostUpdate createFromParcel(Parcel parcel) {
             return new PendingHostUpdate(parcel);
diff --git a/core/java/android/bluetooth/BluetoothActivityEnergyInfo.java b/core/java/android/bluetooth/BluetoothActivityEnergyInfo.java
index 43b79db..df065bf 100644
--- a/core/java/android/bluetooth/BluetoothActivityEnergyInfo.java
+++ b/core/java/android/bluetooth/BluetoothActivityEnergyInfo.java
@@ -76,7 +76,7 @@
                 + " }";
     }
 
-    public static final Parcelable.Creator<BluetoothActivityEnergyInfo> CREATOR =
+    public static final @android.annotation.NonNull Parcelable.Creator<BluetoothActivityEnergyInfo> CREATOR =
             new Parcelable.Creator<BluetoothActivityEnergyInfo>() {
                 public BluetoothActivityEnergyInfo createFromParcel(Parcel in) {
                     return new BluetoothActivityEnergyInfo(in);
diff --git a/core/java/android/bluetooth/BluetoothAudioConfig.java b/core/java/android/bluetooth/BluetoothAudioConfig.java
index a441056..9591a70 100644
--- a/core/java/android/bluetooth/BluetoothAudioConfig.java
+++ b/core/java/android/bluetooth/BluetoothAudioConfig.java
@@ -64,7 +64,7 @@
         return 0;
     }
 
-    public static final Parcelable.Creator<BluetoothAudioConfig> CREATOR =
+    public static final @android.annotation.NonNull Parcelable.Creator<BluetoothAudioConfig> CREATOR =
             new Parcelable.Creator<BluetoothAudioConfig>() {
                 public BluetoothAudioConfig createFromParcel(Parcel in) {
                     int sampleRate = in.readInt();
diff --git a/core/java/android/bluetooth/BluetoothAvrcpPlayerSettings.java b/core/java/android/bluetooth/BluetoothAvrcpPlayerSettings.java
index 3d3d80e..30aea1a 100644
--- a/core/java/android/bluetooth/BluetoothAvrcpPlayerSettings.java
+++ b/core/java/android/bluetooth/BluetoothAvrcpPlayerSettings.java
@@ -118,7 +118,7 @@
         }
     }
 
-    public static final Parcelable.Creator<BluetoothAvrcpPlayerSettings> CREATOR =
+    public static final @android.annotation.NonNull Parcelable.Creator<BluetoothAvrcpPlayerSettings> CREATOR =
             new Parcelable.Creator<BluetoothAvrcpPlayerSettings>() {
         public BluetoothAvrcpPlayerSettings createFromParcel(Parcel in) {
             return new BluetoothAvrcpPlayerSettings(in);
diff --git a/core/java/android/bluetooth/BluetoothClass.java b/core/java/android/bluetooth/BluetoothClass.java
index 1edbacb..260e2fb 100755
--- a/core/java/android/bluetooth/BluetoothClass.java
+++ b/core/java/android/bluetooth/BluetoothClass.java
@@ -94,7 +94,7 @@
         return 0;
     }
 
-    public static final Parcelable.Creator<BluetoothClass> CREATOR =
+    public static final @android.annotation.NonNull Parcelable.Creator<BluetoothClass> CREATOR =
             new Parcelable.Creator<BluetoothClass>() {
                 public BluetoothClass createFromParcel(Parcel in) {
                     return new BluetoothClass(in.readInt());
diff --git a/core/java/android/bluetooth/BluetoothCodecConfig.java b/core/java/android/bluetooth/BluetoothCodecConfig.java
index c9d0ef2..591c418 100644
--- a/core/java/android/bluetooth/BluetoothCodecConfig.java
+++ b/core/java/android/bluetooth/BluetoothCodecConfig.java
@@ -247,7 +247,7 @@
         return 0;
     }
 
-    public static final Parcelable.Creator<BluetoothCodecConfig> CREATOR =
+    public static final @android.annotation.NonNull Parcelable.Creator<BluetoothCodecConfig> CREATOR =
             new Parcelable.Creator<BluetoothCodecConfig>() {
                 public BluetoothCodecConfig createFromParcel(Parcel in) {
                     final int codecType = in.readInt();
diff --git a/core/java/android/bluetooth/BluetoothCodecStatus.java b/core/java/android/bluetooth/BluetoothCodecStatus.java
index 2cb7b2d..58b6aea 100644
--- a/core/java/android/bluetooth/BluetoothCodecStatus.java
+++ b/core/java/android/bluetooth/BluetoothCodecStatus.java
@@ -75,8 +75,8 @@
      * @param c2 the second array of capabilities to compare
      * @return true if both arrays contain same capabilities
      */
-    private static boolean sameCapabilities(BluetoothCodecConfig[] c1,
-                                            BluetoothCodecConfig[] c2) {
+    public static boolean sameCapabilities(BluetoothCodecConfig[] c1,
+                                           BluetoothCodecConfig[] c2) {
         if (c1 == null) {
             return (c2 == null);
         }
@@ -108,7 +108,7 @@
         return 0;
     }
 
-    public static final Parcelable.Creator<BluetoothCodecStatus> CREATOR =
+    public static final @android.annotation.NonNull Parcelable.Creator<BluetoothCodecStatus> CREATOR =
             new Parcelable.Creator<BluetoothCodecStatus>() {
                 public BluetoothCodecStatus createFromParcel(Parcel in) {
                     final BluetoothCodecConfig codecConfig = in.readTypedObject(
diff --git a/core/java/android/bluetooth/BluetoothDevice.java b/core/java/android/bluetooth/BluetoothDevice.java
index 4d8dc35..f718415 100644
--- a/core/java/android/bluetooth/BluetoothDevice.java
+++ b/core/java/android/bluetooth/BluetoothDevice.java
@@ -959,7 +959,7 @@
         return 0;
     }
 
-    public static final Parcelable.Creator<BluetoothDevice> CREATOR =
+    public static final @android.annotation.NonNull Parcelable.Creator<BluetoothDevice> CREATOR =
             new Parcelable.Creator<BluetoothDevice>() {
                 public BluetoothDevice createFromParcel(Parcel in) {
                     return new BluetoothDevice(in.readString());
diff --git a/core/java/android/bluetooth/BluetoothGattCharacteristic.java b/core/java/android/bluetooth/BluetoothGattCharacteristic.java
index 6d46b3a..edacf3e 100644
--- a/core/java/android/bluetooth/BluetoothGattCharacteristic.java
+++ b/core/java/android/bluetooth/BluetoothGattCharacteristic.java
@@ -302,7 +302,7 @@
         out.writeTypedList(mDescriptors);
     }
 
-    public static final Parcelable.Creator<BluetoothGattCharacteristic> CREATOR =
+    public static final @android.annotation.NonNull Parcelable.Creator<BluetoothGattCharacteristic> CREATOR =
             new Parcelable.Creator<BluetoothGattCharacteristic>() {
         public BluetoothGattCharacteristic createFromParcel(Parcel in) {
             return new BluetoothGattCharacteristic(in);
diff --git a/core/java/android/bluetooth/BluetoothGattDescriptor.java b/core/java/android/bluetooth/BluetoothGattDescriptor.java
index 3ffbb9e..0783cd2 100644
--- a/core/java/android/bluetooth/BluetoothGattDescriptor.java
+++ b/core/java/android/bluetooth/BluetoothGattDescriptor.java
@@ -177,7 +177,7 @@
         out.writeInt(mPermissions);
     }
 
-    public static final Parcelable.Creator<BluetoothGattDescriptor> CREATOR =
+    public static final @android.annotation.NonNull Parcelable.Creator<BluetoothGattDescriptor> CREATOR =
             new Parcelable.Creator<BluetoothGattDescriptor>() {
         public BluetoothGattDescriptor createFromParcel(Parcel in) {
             return new BluetoothGattDescriptor(in);
diff --git a/core/java/android/bluetooth/BluetoothGattIncludedService.java b/core/java/android/bluetooth/BluetoothGattIncludedService.java
index bccf20e..5580619 100644
--- a/core/java/android/bluetooth/BluetoothGattIncludedService.java
+++ b/core/java/android/bluetooth/BluetoothGattIncludedService.java
@@ -64,7 +64,7 @@
         out.writeInt(mServiceType);
     }
 
-    public static final Parcelable.Creator<BluetoothGattIncludedService> CREATOR =
+    public static final @android.annotation.NonNull Parcelable.Creator<BluetoothGattIncludedService> CREATOR =
             new Parcelable.Creator<BluetoothGattIncludedService>() {
         public BluetoothGattIncludedService createFromParcel(Parcel in) {
             return new BluetoothGattIncludedService(in);
diff --git a/core/java/android/bluetooth/BluetoothGattService.java b/core/java/android/bluetooth/BluetoothGattService.java
index 8e740ee..c20faf9 100644
--- a/core/java/android/bluetooth/BluetoothGattService.java
+++ b/core/java/android/bluetooth/BluetoothGattService.java
@@ -165,7 +165,7 @@
         out.writeTypedList(includedServices);
     }
 
-    public static final Parcelable.Creator<BluetoothGattService> CREATOR =
+    public static final @android.annotation.NonNull Parcelable.Creator<BluetoothGattService> CREATOR =
             new Parcelable.Creator<BluetoothGattService>() {
         public BluetoothGattService createFromParcel(Parcel in) {
             return new BluetoothGattService(in);
diff --git a/core/java/android/bluetooth/BluetoothHeadsetClientCall.java b/core/java/android/bluetooth/BluetoothHeadsetClientCall.java
index e02a2f4..7165dd5 100644
--- a/core/java/android/bluetooth/BluetoothHeadsetClientCall.java
+++ b/core/java/android/bluetooth/BluetoothHeadsetClientCall.java
@@ -280,7 +280,7 @@
     /**
      * {@link Parcelable.Creator} interface implementation.
      */
-    public static final Parcelable.Creator<BluetoothHeadsetClientCall> CREATOR =
+    public static final @android.annotation.NonNull Parcelable.Creator<BluetoothHeadsetClientCall> CREATOR =
             new Parcelable.Creator<BluetoothHeadsetClientCall>() {
                 @Override
                 public BluetoothHeadsetClientCall createFromParcel(Parcel in) {
diff --git a/core/java/android/bluetooth/BluetoothHealthAppConfiguration.java b/core/java/android/bluetooth/BluetoothHealthAppConfiguration.java
index 9788bbf..88e06e5 100644
--- a/core/java/android/bluetooth/BluetoothHealthAppConfiguration.java
+++ b/core/java/android/bluetooth/BluetoothHealthAppConfiguration.java
@@ -90,7 +90,7 @@
      * {@link BluetoothDevice#createL2capChannel(int)}
      */
     @Deprecated
-    public static final Parcelable.Creator<BluetoothHealthAppConfiguration> CREATOR =
+    public static final @android.annotation.NonNull Parcelable.Creator<BluetoothHealthAppConfiguration> CREATOR =
             new Parcelable.Creator<BluetoothHealthAppConfiguration>() {
                 @Override
                 public BluetoothHealthAppConfiguration createFromParcel(Parcel in) {
diff --git a/core/java/android/bluetooth/BluetoothHearingAid.java b/core/java/android/bluetooth/BluetoothHearingAid.java
index 82cc1bc..b4eaab2 100644
--- a/core/java/android/bluetooth/BluetoothHearingAid.java
+++ b/core/java/android/bluetooth/BluetoothHearingAid.java
@@ -17,6 +17,7 @@
 package android.bluetooth;
 
 import android.Manifest;
+import android.annotation.NonNull;
 import android.annotation.Nullable;
 import android.annotation.RequiresPermission;
 import android.annotation.SdkConstant;
@@ -303,7 +304,7 @@
      * {@inheritDoc}
      */
     @Override
-    public List<BluetoothDevice> getConnectedDevices() {
+    public @NonNull List<BluetoothDevice> getConnectedDevices() {
         if (VDBG) log("getConnectedDevices()");
         try {
             mServiceLock.readLock().lock();
@@ -323,8 +324,8 @@
     /**
      * {@inheritDoc}
      */
-    @Override
-    public List<BluetoothDevice> getDevicesMatchingConnectionStates(int[] states) {
+    @Override public @NonNull List<BluetoothDevice> getDevicesMatchingConnectionStates(
+    @NonNull int[] states) {
         if (VDBG) log("getDevicesMatchingStates()");
         try {
             mServiceLock.readLock().lock();
@@ -345,7 +346,7 @@
      * {@inheritDoc}
      */
     @Override
-    public int getConnectionState(BluetoothDevice device) {
+    public int getConnectionState(@NonNull BluetoothDevice device) {
         if (VDBG) log("getState(" + device + ")");
         try {
             mServiceLock.readLock().lock();
diff --git a/core/java/android/bluetooth/BluetoothHidDeviceAppQosSettings.java b/core/java/android/bluetooth/BluetoothHidDeviceAppQosSettings.java
index a485b89..b21ebe5 100644
--- a/core/java/android/bluetooth/BluetoothHidDeviceAppQosSettings.java
+++ b/core/java/android/bluetooth/BluetoothHidDeviceAppQosSettings.java
@@ -98,7 +98,7 @@
         return 0;
     }
 
-    public static final Parcelable.Creator<BluetoothHidDeviceAppQosSettings> CREATOR =
+    public static final @android.annotation.NonNull Parcelable.Creator<BluetoothHidDeviceAppQosSettings> CREATOR =
             new Parcelable.Creator<BluetoothHidDeviceAppQosSettings>() {
 
                 @Override
diff --git a/core/java/android/bluetooth/BluetoothHidDeviceAppSdpSettings.java b/core/java/android/bluetooth/BluetoothHidDeviceAppSdpSettings.java
index 2f0b44f..4e1a2aa 100644
--- a/core/java/android/bluetooth/BluetoothHidDeviceAppSdpSettings.java
+++ b/core/java/android/bluetooth/BluetoothHidDeviceAppSdpSettings.java
@@ -92,7 +92,7 @@
         return 0;
     }
 
-    public static final Parcelable.Creator<BluetoothHidDeviceAppSdpSettings> CREATOR =
+    public static final @android.annotation.NonNull Parcelable.Creator<BluetoothHidDeviceAppSdpSettings> CREATOR =
             new Parcelable.Creator<BluetoothHidDeviceAppSdpSettings>() {
 
                 @Override
diff --git a/core/java/android/bluetooth/BluetoothMasInstance.java b/core/java/android/bluetooth/BluetoothMasInstance.java
index 7a31328..b64d049 100644
--- a/core/java/android/bluetooth/BluetoothMasInstance.java
+++ b/core/java/android/bluetooth/BluetoothMasInstance.java
@@ -57,7 +57,7 @@
         return 0;
     }
 
-    public static final Parcelable.Creator<BluetoothMasInstance> CREATOR =
+    public static final @android.annotation.NonNull Parcelable.Creator<BluetoothMasInstance> CREATOR =
             new Parcelable.Creator<BluetoothMasInstance>() {
                 public BluetoothMasInstance createFromParcel(Parcel in) {
                     return new BluetoothMasInstance(in.readInt(), in.readString(),
diff --git a/core/java/android/bluetooth/OobData.java b/core/java/android/bluetooth/OobData.java
index d632572..0d0c6ab 100644
--- a/core/java/android/bluetooth/OobData.java
+++ b/core/java/android/bluetooth/OobData.java
@@ -98,7 +98,7 @@
         out.writeByteArray(mLeSecureConnectionsRandom);
     }
 
-    public static final Parcelable.Creator<OobData> CREATOR =
+    public static final @android.annotation.NonNull Parcelable.Creator<OobData> CREATOR =
             new Parcelable.Creator<OobData>() {
         public OobData createFromParcel(Parcel in) {
             return new OobData(in);
diff --git a/core/java/android/bluetooth/UidTraffic.java b/core/java/android/bluetooth/UidTraffic.java
index cef362b..2ee786a 100644
--- a/core/java/android/bluetooth/UidTraffic.java
+++ b/core/java/android/bluetooth/UidTraffic.java
@@ -95,7 +95,7 @@
                 + mTxBytes + '}';
     }
 
-    public static final Creator<UidTraffic> CREATOR = new Creator<UidTraffic>() {
+    public static final @android.annotation.NonNull Creator<UidTraffic> CREATOR = new Creator<UidTraffic>() {
         @Override
         public UidTraffic createFromParcel(Parcel source) {
             return new UidTraffic(source);
diff --git a/core/java/android/bluetooth/le/AdvertiseData.java b/core/java/android/bluetooth/le/AdvertiseData.java
index b65c31d1d..5fd8258 100644
--- a/core/java/android/bluetooth/le/AdvertiseData.java
+++ b/core/java/android/bluetooth/le/AdvertiseData.java
@@ -159,7 +159,7 @@
         dest.writeByte((byte) (getIncludeDeviceName() ? 1 : 0));
     }
 
-    public static final Parcelable.Creator<AdvertiseData> CREATOR =
+    public static final @android.annotation.NonNull Parcelable.Creator<AdvertiseData> CREATOR =
             new Creator<AdvertiseData>() {
                 @Override
                 public AdvertiseData[] newArray(int size) {
diff --git a/core/java/android/bluetooth/le/AdvertiseSettings.java b/core/java/android/bluetooth/le/AdvertiseSettings.java
index 35e232c7..7129d76 100644
--- a/core/java/android/bluetooth/le/AdvertiseSettings.java
+++ b/core/java/android/bluetooth/le/AdvertiseSettings.java
@@ -139,7 +139,7 @@
         dest.writeInt(mAdvertiseTimeoutMillis);
     }
 
-    public static final Parcelable.Creator<AdvertiseSettings> CREATOR =
+    public static final @android.annotation.NonNull Parcelable.Creator<AdvertiseSettings> CREATOR =
             new Creator<AdvertiseSettings>() {
                 @Override
                 public AdvertiseSettings[] newArray(int size) {
diff --git a/core/java/android/bluetooth/le/AdvertisingSetParameters.java b/core/java/android/bluetooth/le/AdvertisingSetParameters.java
index 0c0291eb..e39b198 100644
--- a/core/java/android/bluetooth/le/AdvertisingSetParameters.java
+++ b/core/java/android/bluetooth/le/AdvertisingSetParameters.java
@@ -227,7 +227,7 @@
         dest.writeInt(mTxPowerLevel);
     }
 
-    public static final Parcelable.Creator<AdvertisingSetParameters> CREATOR =
+    public static final @android.annotation.NonNull Parcelable.Creator<AdvertisingSetParameters> CREATOR =
             new Creator<AdvertisingSetParameters>() {
                 @Override
                 public AdvertisingSetParameters[] newArray(int size) {
diff --git a/core/java/android/bluetooth/le/PeriodicAdvertisingReport.java b/core/java/android/bluetooth/le/PeriodicAdvertisingReport.java
index 73a2e74..7a8c2c6 100644
--- a/core/java/android/bluetooth/le/PeriodicAdvertisingReport.java
+++ b/core/java/android/bluetooth/le/PeriodicAdvertisingReport.java
@@ -171,7 +171,7 @@
                 + ", data=" + Objects.toString(mData) + ", timestampNanos=" + mTimestampNanos + '}';
     }
 
-    public static final Parcelable.Creator<PeriodicAdvertisingReport> CREATOR =
+    public static final @android.annotation.NonNull Parcelable.Creator<PeriodicAdvertisingReport> CREATOR =
             new Creator<PeriodicAdvertisingReport>() {
                 @Override
                 public PeriodicAdvertisingReport createFromParcel(Parcel source) {
diff --git a/core/java/android/bluetooth/le/ResultStorageDescriptor.java b/core/java/android/bluetooth/le/ResultStorageDescriptor.java
index 63bdf69..796c815 100644
--- a/core/java/android/bluetooth/le/ResultStorageDescriptor.java
+++ b/core/java/android/bluetooth/le/ResultStorageDescriptor.java
@@ -78,7 +78,7 @@
         mLength = in.readInt();
     }
 
-    public static final Parcelable.Creator<ResultStorageDescriptor> CREATOR =
+    public static final @android.annotation.NonNull Parcelable.Creator<ResultStorageDescriptor> CREATOR =
             new Creator<ResultStorageDescriptor>() {
         @Override
         public ResultStorageDescriptor createFromParcel(Parcel source) {
diff --git a/core/java/android/bluetooth/le/ScanFilter.java b/core/java/android/bluetooth/le/ScanFilter.java
index c5d435b..78140cf 100644
--- a/core/java/android/bluetooth/le/ScanFilter.java
+++ b/core/java/android/bluetooth/le/ScanFilter.java
@@ -161,7 +161,7 @@
     /**
      * A {@link android.os.Parcelable.Creator} to create {@link ScanFilter} from parcel.
      */
-    public static final Creator<ScanFilter> CREATOR =
+    public static final @android.annotation.NonNull Creator<ScanFilter> CREATOR =
             new Creator<ScanFilter>() {
 
         @Override
diff --git a/core/java/android/bluetooth/le/ScanResult.java b/core/java/android/bluetooth/le/ScanResult.java
index f87a47f..855d345 100644
--- a/core/java/android/bluetooth/le/ScanResult.java
+++ b/core/java/android/bluetooth/le/ScanResult.java
@@ -338,7 +338,7 @@
                 + ", periodicAdvertisingInterval=" + mPeriodicAdvertisingInterval + '}';
     }
 
-    public static final Parcelable.Creator<ScanResult> CREATOR = new Creator<ScanResult>() {
+    public static final @android.annotation.NonNull Parcelable.Creator<ScanResult> CREATOR = new Creator<ScanResult>() {
         @Override
         public ScanResult createFromParcel(Parcel source) {
             return new ScanResult(source);
diff --git a/core/java/android/bluetooth/le/ScanSettings.java b/core/java/android/bluetooth/le/ScanSettings.java
index 8fdcba8..504118e 100644
--- a/core/java/android/bluetooth/le/ScanSettings.java
+++ b/core/java/android/bluetooth/le/ScanSettings.java
@@ -242,7 +242,7 @@
         return 0;
     }
 
-    public static final Parcelable.Creator<ScanSettings> CREATOR =
+    public static final @android.annotation.NonNull Parcelable.Creator<ScanSettings> CREATOR =
             new Creator<ScanSettings>() {
         @Override
         public ScanSettings[] newArray(int size) {
diff --git a/core/java/android/companion/AssociationRequest.java b/core/java/android/companion/AssociationRequest.java
index db54f08..e4114c6 100644
--- a/core/java/android/companion/AssociationRequest.java
+++ b/core/java/android/companion/AssociationRequest.java
@@ -105,7 +105,7 @@
         return 0;
     }
 
-    public static final Creator<AssociationRequest> CREATOR = new Creator<AssociationRequest>() {
+    public static final @android.annotation.NonNull Creator<AssociationRequest> CREATOR = new Creator<AssociationRequest>() {
         @Override
         public AssociationRequest createFromParcel(Parcel in) {
             return new AssociationRequest(in);
diff --git a/core/java/android/companion/BluetoothDeviceFilter.java b/core/java/android/companion/BluetoothDeviceFilter.java
index 7507e17..fe0123c 100644
--- a/core/java/android/companion/BluetoothDeviceFilter.java
+++ b/core/java/android/companion/BluetoothDeviceFilter.java
@@ -146,7 +146,7 @@
         return 0;
     }
 
-    public static final Creator<BluetoothDeviceFilter> CREATOR
+    public static final @android.annotation.NonNull Creator<BluetoothDeviceFilter> CREATOR
             = new Creator<BluetoothDeviceFilter>() {
         @Override
         public BluetoothDeviceFilter createFromParcel(Parcel in) {
diff --git a/core/java/android/companion/BluetoothDeviceFilterUtils.java b/core/java/android/companion/BluetoothDeviceFilterUtils.java
index bd507a6..75e726b 100644
--- a/core/java/android/companion/BluetoothDeviceFilterUtils.java
+++ b/core/java/android/companion/BluetoothDeviceFilterUtils.java
@@ -30,6 +30,7 @@
 import android.util.Log;
 
 import java.util.Arrays;
+import java.util.Collections;
 import java.util.List;
 import java.util.regex.Pattern;
 
@@ -78,11 +79,12 @@
 
     static boolean matchesServiceUuid(ParcelUuid serviceUuid, ParcelUuid serviceUuidMask,
             BluetoothDevice device) {
+        ParcelUuid[] uuids = device.getUuids();
         final boolean result = serviceUuid == null ||
                 ScanFilter.matchesServiceUuids(
                         serviceUuid,
                         serviceUuidMask,
-                        Arrays.asList(device.getUuids()));
+                        uuids == null ? Collections.emptyList() : Arrays.asList(uuids));
         if (DEBUG) debugLogMatchResult(result, device, serviceUuid);
         return result;
     }
diff --git a/core/java/android/companion/BluetoothLeDeviceFilter.java b/core/java/android/companion/BluetoothLeDeviceFilter.java
index 1de931e..37c9cb6 100644
--- a/core/java/android/companion/BluetoothLeDeviceFilter.java
+++ b/core/java/android/companion/BluetoothLeDeviceFilter.java
@@ -247,7 +247,7 @@
                 '}';
     }
 
-    public static final Creator<BluetoothLeDeviceFilter> CREATOR
+    public static final @android.annotation.NonNull Creator<BluetoothLeDeviceFilter> CREATOR
             = new Creator<BluetoothLeDeviceFilter>() {
         @Override
         public BluetoothLeDeviceFilter createFromParcel(Parcel in) {
diff --git a/core/java/android/companion/WifiDeviceFilter.java b/core/java/android/companion/WifiDeviceFilter.java
index b6e704c..62098d5 100644
--- a/core/java/android/companion/WifiDeviceFilter.java
+++ b/core/java/android/companion/WifiDeviceFilter.java
@@ -98,7 +98,7 @@
         return 0;
     }
 
-    public static final Creator<WifiDeviceFilter> CREATOR
+    public static final @android.annotation.NonNull Creator<WifiDeviceFilter> CREATOR
             = new Creator<WifiDeviceFilter>() {
         @Override
         public WifiDeviceFilter createFromParcel(Parcel in) {
diff --git a/core/java/android/content/AutofillOptions.java b/core/java/android/content/AutofillOptions.java
index fd7e52a..f59bc98 100644
--- a/core/java/android/content/AutofillOptions.java
+++ b/core/java/android/content/AutofillOptions.java
@@ -16,12 +16,15 @@
 package android.content;
 
 import android.annotation.NonNull;
+import android.annotation.Nullable;
 import android.annotation.TestApi;
 import android.app.ActivityThread;
 import android.os.Parcel;
 import android.os.Parcelable;
+import android.util.ArraySet;
 import android.util.Log;
 import android.view.autofill.AutofillManager;
+import android.view.contentcapture.ContentCaptureManager.ContentCaptureClient;
 
 import java.io.PrintWriter;
 
@@ -51,8 +54,13 @@
     /**
      * Whether package is whitelisted for augmented autofill.
      */
-    public boolean augmentedEnabled;
-    // TODO(b/123100824): add (optional) list of activities
+    public boolean augmentedAutofillEnabled;
+
+    /**
+     * List of whitelisted activities.
+     */
+    @Nullable
+    public ArraySet<ComponentName> whitelistedActivitiesForAugmentedAutofill;
 
     public AutofillOptions(int loggingLevel, boolean compatModeEnabled) {
         this.loggingLevel = loggingLevel;
@@ -60,6 +68,20 @@
     }
 
     /**
+     * Returns whether activity is whitelisted for augmented autofill.
+     */
+    public boolean isAugmentedAutofillEnabled(@NonNull Context context) {
+        if (!augmentedAutofillEnabled) return false;
+
+        final ContentCaptureClient contentCaptureClient = context.getContentCaptureClient();
+        if (contentCaptureClient == null) return false;
+
+        final ComponentName component = contentCaptureClient.contentCaptureClientGetComponentName();
+        return whitelistedActivitiesForAugmentedAutofill == null
+                || whitelistedActivitiesForAugmentedAutofill.contains(component);
+    }
+
+    /**
      * @hide
      */
     @TestApi
@@ -78,7 +100,7 @@
 
         final AutofillOptions options = new AutofillOptions(
                 AutofillManager.FLAG_ADD_CLIENT_VERBOSE, /* compatModeAllowed= */ true);
-        options.augmentedEnabled = true;
+        options.augmentedAutofillEnabled = true;
         // Always log, as it's used by test only
         Log.i(TAG, "forWhitelistingItself(" + packageName + "): " + options);
 
@@ -87,15 +109,19 @@
 
     @Override
     public String toString() {
-        return "AutofillOptions [loggingLevel=" + loggingLevel + ", compatMode="
-                + compatModeEnabled + ", augmentedEnabled=" + augmentedEnabled + "]";
+        return "AutofillOptions [loggingLevel=" + loggingLevel + ", compatMode=" + compatModeEnabled
+                + ", augmentedAutofillEnabled=" + augmentedAutofillEnabled + "]";
     }
 
     /** @hide */
     public void dumpShort(@NonNull PrintWriter pw) {
         pw.print("logLvl="); pw.print(loggingLevel);
         pw.print(", compatMode="); pw.print(compatModeEnabled);
-        pw.print(", augmented="); pw.print(augmentedEnabled);
+        pw.print(", augmented="); pw.print(augmentedAutofillEnabled);
+        if (whitelistedActivitiesForAugmentedAutofill != null) {
+            pw.print(", whitelistedActivitiesForAugmentedAutofill=");
+            pw.print(whitelistedActivitiesForAugmentedAutofill);
+        }
     }
 
     @Override
@@ -107,10 +133,11 @@
     public void writeToParcel(Parcel parcel, int flags) {
         parcel.writeInt(loggingLevel);
         parcel.writeBoolean(compatModeEnabled);
-        parcel.writeBoolean(augmentedEnabled);
+        parcel.writeBoolean(augmentedAutofillEnabled);
+        parcel.writeArraySet(whitelistedActivitiesForAugmentedAutofill);
     }
 
-    public static final Parcelable.Creator<AutofillOptions> CREATOR =
+    public static final @android.annotation.NonNull Parcelable.Creator<AutofillOptions> CREATOR =
             new Parcelable.Creator<AutofillOptions>() {
 
                 @Override
@@ -118,7 +145,9 @@
                     final int loggingLevel = parcel.readInt();
                     final boolean compatMode = parcel.readBoolean();
                     final AutofillOptions options = new AutofillOptions(loggingLevel, compatMode);
-                    options.augmentedEnabled = parcel.readBoolean();
+                    options.augmentedAutofillEnabled = parcel.readBoolean();
+                    options.whitelistedActivitiesForAugmentedAutofill =
+                            (ArraySet<ComponentName>) parcel.readArraySet(null);
                     return options;
                 }
 
diff --git a/core/java/android/content/ClipData.java b/core/java/android/content/ClipData.java
index 8777b67..88e2c22 100644
--- a/core/java/android/content/ClipData.java
+++ b/core/java/android/content/ClipData.java
@@ -1176,7 +1176,7 @@
         }
     }
 
-    public static final Parcelable.Creator<ClipData> CREATOR =
+    public static final @android.annotation.NonNull Parcelable.Creator<ClipData> CREATOR =
         new Parcelable.Creator<ClipData>() {
 
             @Override
diff --git a/core/java/android/content/ClipDescription.java b/core/java/android/content/ClipDescription.java
index 19295fc..29acd5d 100644
--- a/core/java/android/content/ClipDescription.java
+++ b/core/java/android/content/ClipDescription.java
@@ -380,7 +380,7 @@
         mTimeStamp = in.readLong();
     }
 
-    public static final Parcelable.Creator<ClipDescription> CREATOR =
+    public static final @android.annotation.NonNull Parcelable.Creator<ClipDescription> CREATOR =
         new Parcelable.Creator<ClipDescription>() {
 
             public ClipDescription createFromParcel(Parcel source) {
diff --git a/core/java/android/content/ComponentName.java b/core/java/android/content/ComponentName.java
index e6ffe8b4..a5460e9 100644
--- a/core/java/android/content/ComponentName.java
+++ b/core/java/android/content/ComponentName.java
@@ -376,7 +376,7 @@
         return pkg != null ? new ComponentName(pkg, in) : null;
     }
 
-    public static final Parcelable.Creator<ComponentName> CREATOR
+    public static final @android.annotation.NonNull Parcelable.Creator<ComponentName> CREATOR
             = new Parcelable.Creator<ComponentName>() {
         public ComponentName createFromParcel(Parcel in) {
             return new ComponentName(in);
diff --git a/core/java/android/content/ContentCaptureOptions.java b/core/java/android/content/ContentCaptureOptions.java
index 2fe9f14..6be0bea 100644
--- a/core/java/android/content/ContentCaptureOptions.java
+++ b/core/java/android/content/ContentCaptureOptions.java
@@ -149,7 +149,7 @@
         parcel.writeArraySet(whitelistedComponents);
     }
 
-    public static final Parcelable.Creator<ContentCaptureOptions> CREATOR =
+    public static final @android.annotation.NonNull Parcelable.Creator<ContentCaptureOptions> CREATOR =
             new Parcelable.Creator<ContentCaptureOptions>() {
 
                 @Override
diff --git a/core/java/android/content/ContentProvider.java b/core/java/android/content/ContentProvider.java
index e06322df..ddfe755 100644
--- a/core/java/android/content/ContentProvider.java
+++ b/core/java/android/content/ContentProvider.java
@@ -209,9 +209,10 @@
      * @hide
      */
     class Transport extends ContentProviderNative {
-        AppOpsManager mAppOpsManager = null;
-        int mReadOp = AppOpsManager.OP_NONE;
-        int mWriteOp = AppOpsManager.OP_NONE;
+        volatile AppOpsManager mAppOpsManager = null;
+        volatile int mReadOp = AppOpsManager.OP_NONE;
+        volatile int mWriteOp = AppOpsManager.OP_NONE;
+        volatile ContentInterface mInterface = ContentProvider.this;
 
         ContentProvider getContentProvider() {
             return ContentProvider.this;
@@ -245,9 +246,11 @@
                 Cursor cursor;
                 final String original = setCallingPackage(callingPkg);
                 try {
-                    cursor = ContentProvider.this.query(
+                    cursor = mInterface.query(
                             uri, projection, queryArgs,
                             CancellationSignal.fromTransport(cancellationSignal));
+                } catch (RemoteException e) {
+                    throw e.rethrowAsRuntimeException();
                 } finally {
                     setCallingPackage(original);
                 }
@@ -261,9 +264,11 @@
             Trace.traceBegin(TRACE_TAG_DATABASE, "query");
             final String original = setCallingPackage(callingPkg);
             try {
-                return ContentProvider.this.query(
+                return mInterface.query(
                         uri, projection, queryArgs,
                         CancellationSignal.fromTransport(cancellationSignal));
+            } catch (RemoteException e) {
+                throw e.rethrowAsRuntimeException();
             } finally {
                 setCallingPackage(original);
                 Trace.traceEnd(TRACE_TAG_DATABASE);
@@ -277,7 +282,9 @@
             uri = maybeGetUriWithoutUserId(uri);
             Trace.traceBegin(TRACE_TAG_DATABASE, "getType");
             try {
-                return ContentProvider.this.getType(uri);
+                return mInterface.getType(uri);
+            } catch (RemoteException e) {
+                throw e.rethrowAsRuntimeException();
             } finally {
                 Trace.traceEnd(TRACE_TAG_DATABASE);
             }
@@ -299,7 +306,9 @@
             Trace.traceBegin(TRACE_TAG_DATABASE, "insert");
             final String original = setCallingPackage(callingPkg);
             try {
-                return maybeAddUserId(ContentProvider.this.insert(uri, initialValues), userId);
+                return maybeAddUserId(mInterface.insert(uri, initialValues), userId);
+            } catch (RemoteException e) {
+                throw e.rethrowAsRuntimeException();
             } finally {
                 setCallingPackage(original);
                 Trace.traceEnd(TRACE_TAG_DATABASE);
@@ -316,7 +325,9 @@
             Trace.traceBegin(TRACE_TAG_DATABASE, "bulkInsert");
             final String original = setCallingPackage(callingPkg);
             try {
-                return ContentProvider.this.bulkInsert(uri, initialValues);
+                return mInterface.bulkInsert(uri, initialValues);
+            } catch (RemoteException e) {
+                throw e.rethrowAsRuntimeException();
             } finally {
                 setCallingPackage(original);
                 Trace.traceEnd(TRACE_TAG_DATABASE);
@@ -357,7 +368,7 @@
             Trace.traceBegin(TRACE_TAG_DATABASE, "applyBatch");
             final String original = setCallingPackage(callingPkg);
             try {
-                ContentProviderResult[] results = ContentProvider.this.applyBatch(authority,
+                ContentProviderResult[] results = mInterface.applyBatch(authority,
                         operations);
                 if (results != null) {
                     for (int i = 0; i < results.length ; i++) {
@@ -368,6 +379,8 @@
                     }
                 }
                 return results;
+            } catch (RemoteException e) {
+                throw e.rethrowAsRuntimeException();
             } finally {
                 setCallingPackage(original);
                 Trace.traceEnd(TRACE_TAG_DATABASE);
@@ -384,7 +397,9 @@
             Trace.traceBegin(TRACE_TAG_DATABASE, "delete");
             final String original = setCallingPackage(callingPkg);
             try {
-                return ContentProvider.this.delete(uri, selection, selectionArgs);
+                return mInterface.delete(uri, selection, selectionArgs);
+            } catch (RemoteException e) {
+                throw e.rethrowAsRuntimeException();
             } finally {
                 setCallingPackage(original);
                 Trace.traceEnd(TRACE_TAG_DATABASE);
@@ -402,7 +417,9 @@
             Trace.traceBegin(TRACE_TAG_DATABASE, "update");
             final String original = setCallingPackage(callingPkg);
             try {
-                return ContentProvider.this.update(uri, values, selection, selectionArgs);
+                return mInterface.update(uri, values, selection, selectionArgs);
+            } catch (RemoteException e) {
+                throw e.rethrowAsRuntimeException();
             } finally {
                 setCallingPackage(original);
                 Trace.traceEnd(TRACE_TAG_DATABASE);
@@ -419,8 +436,10 @@
             Trace.traceBegin(TRACE_TAG_DATABASE, "openFile");
             final String original = setCallingPackage(callingPkg);
             try {
-                return ContentProvider.this.openFile(
+                return mInterface.openFile(
                         uri, mode, CancellationSignal.fromTransport(cancellationSignal));
+            } catch (RemoteException e) {
+                throw e.rethrowAsRuntimeException();
             } finally {
                 setCallingPackage(original);
                 Trace.traceEnd(TRACE_TAG_DATABASE);
@@ -437,8 +456,10 @@
             Trace.traceBegin(TRACE_TAG_DATABASE, "openAssetFile");
             final String original = setCallingPackage(callingPkg);
             try {
-                return ContentProvider.this.openAssetFile(
+                return mInterface.openAssetFile(
                         uri, mode, CancellationSignal.fromTransport(cancellationSignal));
+            } catch (RemoteException e) {
+                throw e.rethrowAsRuntimeException();
             } finally {
                 setCallingPackage(original);
                 Trace.traceEnd(TRACE_TAG_DATABASE);
@@ -453,7 +474,9 @@
             Trace.traceBegin(TRACE_TAG_DATABASE, "call");
             final String original = setCallingPackage(callingPkg);
             try {
-                return ContentProvider.this.call(authority, method, arg, extras);
+                return mInterface.call(authority, method, arg, extras);
+            } catch (RemoteException e) {
+                throw e.rethrowAsRuntimeException();
             } finally {
                 setCallingPackage(original);
                 Trace.traceEnd(TRACE_TAG_DATABASE);
@@ -467,7 +490,9 @@
             uri = maybeGetUriWithoutUserId(uri);
             Trace.traceBegin(TRACE_TAG_DATABASE, "getStreamTypes");
             try {
-                return ContentProvider.this.getStreamTypes(uri, mimeTypeFilter);
+                return mInterface.getStreamTypes(uri, mimeTypeFilter);
+            } catch (RemoteException e) {
+                throw e.rethrowAsRuntimeException();
             } finally {
                 Trace.traceEnd(TRACE_TAG_DATABASE);
             }
@@ -483,8 +508,10 @@
             Trace.traceBegin(TRACE_TAG_DATABASE, "openTypedAssetFile");
             final String original = setCallingPackage(callingPkg);
             try {
-                return ContentProvider.this.openTypedAssetFile(
+                return mInterface.openTypedAssetFile(
                         uri, mimeType, opts, CancellationSignal.fromTransport(cancellationSignal));
+            } catch (RemoteException e) {
+                throw e.rethrowAsRuntimeException();
             } finally {
                 setCallingPackage(original);
                 Trace.traceEnd(TRACE_TAG_DATABASE);
@@ -507,7 +534,9 @@
             Trace.traceBegin(TRACE_TAG_DATABASE, "canonicalize");
             final String original = setCallingPackage(callingPkg);
             try {
-                return maybeAddUserId(ContentProvider.this.canonicalize(uri), userId);
+                return maybeAddUserId(mInterface.canonicalize(uri), userId);
+            } catch (RemoteException e) {
+                throw e.rethrowAsRuntimeException();
             } finally {
                 setCallingPackage(original);
                 Trace.traceEnd(TRACE_TAG_DATABASE);
@@ -525,7 +554,9 @@
             Trace.traceBegin(TRACE_TAG_DATABASE, "uncanonicalize");
             final String original = setCallingPackage(callingPkg);
             try {
-                return maybeAddUserId(ContentProvider.this.uncanonicalize(uri), userId);
+                return maybeAddUserId(mInterface.uncanonicalize(uri), userId);
+            } catch (RemoteException e) {
+                throw e.rethrowAsRuntimeException();
             } finally {
                 setCallingPackage(original);
                 Trace.traceEnd(TRACE_TAG_DATABASE);
@@ -543,7 +574,7 @@
             Trace.traceBegin(TRACE_TAG_DATABASE, "refresh");
             final String original = setCallingPackage(callingPkg);
             try {
-                return ContentProvider.this.refresh(uri, args,
+                return mInterface.refresh(uri, args,
                         CancellationSignal.fromTransport(cancellationSignal));
             } finally {
                 setCallingPackage(original);
@@ -986,6 +1017,15 @@
         return mTransport.mAppOpsManager;
     }
 
+    /** @hide */
+    public final void setTransportLoggingEnabled(boolean enabled) {
+        if (enabled) {
+            mTransport.mInterface = new LoggingContentInterface(getClass().getSimpleName(), this);
+        } else {
+            mTransport.mInterface = this;
+        }
+    }
+
     /**
      * Implement this to initialize your content provider on startup.
      * This method is called for all registered content providers on the
diff --git a/core/java/android/content/ContentProviderNative.java b/core/java/android/content/ContentProviderNative.java
index ca657b1..9948338 100644
--- a/core/java/android/content/ContentProviderNative.java
+++ b/core/java/android/content/ContentProviderNative.java
@@ -800,5 +800,6 @@
         }
     }
 
+    @UnsupportedAppUsage
     private IBinder mRemote;
 }
diff --git a/core/java/android/content/ContentProviderOperation.java b/core/java/android/content/ContentProviderOperation.java
index 6a3fa6b2..a41b5d3 100644
--- a/core/java/android/content/ContentProviderOperation.java
+++ b/core/java/android/content/ContentProviderOperation.java
@@ -460,7 +460,7 @@
         return 0;
     }
 
-    public static final Creator<ContentProviderOperation> CREATOR =
+    public static final @android.annotation.NonNull Creator<ContentProviderOperation> CREATOR =
             new Creator<ContentProviderOperation>() {
         public ContentProviderOperation createFromParcel(Parcel source) {
             return new ContentProviderOperation(source);
diff --git a/core/java/android/content/ContentProviderResult.java b/core/java/android/content/ContentProviderResult.java
index 4196f27..d90173c 100644
--- a/core/java/android/content/ContentProviderResult.java
+++ b/core/java/android/content/ContentProviderResult.java
@@ -71,7 +71,7 @@
         return 0;
     }
 
-    public static final Creator<ContentProviderResult> CREATOR =
+    public static final @android.annotation.NonNull Creator<ContentProviderResult> CREATOR =
             new Creator<ContentProviderResult>() {
         public ContentProviderResult createFromParcel(Parcel source) {
             return new ContentProviderResult(source);
diff --git a/core/java/android/content/ContentResolver.java b/core/java/android/content/ContentResolver.java
index 1e4b1e7..fa85f0a 100644
--- a/core/java/android/content/ContentResolver.java
+++ b/core/java/android/content/ContentResolver.java
@@ -623,7 +623,7 @@
     }
 
     /** {@hide} */
-    public static ContentResolver wrap(@NonNull ContentInterface wrapped) {
+    public static @NonNull ContentResolver wrap(@NonNull ContentInterface wrapped) {
         Preconditions.checkNotNull(wrapped);
 
         return new ContentResolver(null, wrapped) {
@@ -654,7 +654,7 @@
      * Create a {@link ContentResolver} instance that redirects all its methods
      * to the given {@link ContentProvider}.
      */
-    public static ContentResolver wrap(@NonNull ContentProvider wrapped) {
+    public static @NonNull ContentResolver wrap(@NonNull ContentProvider wrapped) {
         return wrap((ContentInterface) wrapped);
     }
 
@@ -662,7 +662,7 @@
      * Create a {@link ContentResolver} instance that redirects all its methods
      * to the given {@link ContentProviderClient}.
      */
-    public static ContentResolver wrap(@NonNull ContentProviderClient wrapped) {
+    public static @NonNull ContentResolver wrap(@NonNull ContentProviderClient wrapped) {
         return wrap((ContentInterface) wrapped);
     }
 
diff --git a/core/java/android/content/ContentValues.java b/core/java/android/content/ContentValues.java
index 06d0f66..eafeed2 100644
--- a/core/java/android/content/ContentValues.java
+++ b/core/java/android/content/ContentValues.java
@@ -497,7 +497,7 @@
         return mMap.keySet();
     }
 
-    public static final Parcelable.Creator<ContentValues> CREATOR =
+    public static final @android.annotation.NonNull Parcelable.Creator<ContentValues> CREATOR =
             new Parcelable.Creator<ContentValues>() {
         @Override
         public ContentValues createFromParcel(Parcel in) {
diff --git a/core/java/android/content/Context.java b/core/java/android/content/Context.java
index 29added..f896274 100644
--- a/core/java/android/content/Context.java
+++ b/core/java/android/content/Context.java
@@ -17,6 +17,7 @@
 package android.content;
 
 import android.annotation.AttrRes;
+import android.annotation.CallbackExecutor;
 import android.annotation.CheckResult;
 import android.annotation.ColorInt;
 import android.annotation.ColorRes;
@@ -69,6 +70,7 @@
 import android.view.ViewDebug;
 import android.view.WindowManager;
 import android.view.autofill.AutofillManager.AutofillClient;
+import android.view.contentcapture.ContentCaptureManager.ContentCaptureClient;
 import android.view.textclassifier.TextClassificationManager;
 
 import java.io.File;
@@ -770,6 +772,7 @@
      * <p>
      * This is not generally intended for third party application developers.
      */
+    @NonNull
     public String getOpPackageName() {
         throw new RuntimeException("Not implemented. Must override in a subclass.");
     }
@@ -1741,7 +1744,8 @@
      */
     @RequiresPermission(android.Manifest.permission.INTERACT_ACROSS_USERS_FULL)
     @SystemApi
-    public void startActivityAsUser(@RequiresPermission Intent intent, UserHandle user) {
+    public void startActivityAsUser(@RequiresPermission @NonNull Intent intent,
+            @NonNull UserHandle user) {
         throw new RuntimeException("Not implemented. Must override in a subclass.");
     }
 
@@ -2964,26 +2968,40 @@
             @NonNull ServiceConnection conn, @BindServiceFlags int flags);
 
     /**
+     * Same as {@link #bindService(Intent, ServiceConnection, int)} with executor to control
+     * ServiceConnection callbacks.
+     * @param executor Callbacks on ServiceConnection will be called on executor. Must use same
+     *      instance for the same instance of ServiceConnection.
+     */
+    public boolean bindService(@RequiresPermission @NonNull Intent service,
+            @BindServiceFlags int flags, @NonNull @CallbackExecutor Executor executor,
+            @NonNull ServiceConnection conn) {
+        throw new RuntimeException("Not implemented. Must override in a subclass.");
+    }
+
+    /**
      * Variation of {@link #bindService} that, in the specific case of isolated
      * services, allows the caller to generate multiple instances of a service
      * from a single component declaration.
      *
      * @param service Identifies the service to connect to.  The Intent must
      *      specify an explicit component name.
-     * @param conn Receives information as the service is started and stopped.
-     *      This must be a valid ServiceConnection object; it must not be null.
      * @param flags Operation options for the binding as per {@link #bindService}.
      * @param instanceName Unique identifier for the service instance.  Each unique
      *      name here will result in a different service instance being created.
      * @return Returns success of binding as per {@link #bindService}.
+     * @param executor Callbacks on ServiceConnection will be called on executor.
+     *      Must use same instance for the same instance of ServiceConnection.
+     * @param conn Receives information as the service is started and stopped.
+     *      This must be a valid ServiceConnection object; it must not be null.
      *
      * @throws SecurityException If the caller does not have permission to access the service
      *
      * @see #bindService
      */
-    public boolean bindIsolatedService(@RequiresPermission Intent service,
-            @NonNull ServiceConnection conn, @BindServiceFlags int flags,
-            @NonNull String instanceName) {
+    public boolean bindIsolatedService(@RequiresPermission @NonNull Intent service,
+            @BindServiceFlags int flags, @NonNull String instanceName,
+            @NonNull @CallbackExecutor Executor executor, @NonNull ServiceConnection conn) {
         throw new RuntimeException("Not implemented. Must override in a subclass.");
     }
 
@@ -3158,6 +3176,7 @@
             RESTRICTIONS_SERVICE,
             APP_OPS_SERVICE,
             ROLE_SERVICE,
+            //@hide ROLE_CONTROLLER_SERVICE,
             CAMERA_SERVICE,
             PRINT_SERVICE,
             CONSUMER_IR_SERVICE,
@@ -4267,6 +4286,16 @@
     public static final String ROLE_SERVICE = "role";
 
     /**
+     * Official published name of the (internal) role controller service.
+     *
+     * @see #getSystemService(String)
+     * @see android.app.role.RoleControllerService
+     *
+     * @hide
+     */
+    public static final String ROLE_CONTROLLER_SERVICE = "role_controller";
+
+    /**
      * Use with {@link #getSystemService(String)} to retrieve a
      * {@link android.hardware.camera2.CameraManager} for interacting with
      * camera devices.
@@ -5341,6 +5370,14 @@
     /**
      * @hide
      */
+    @Nullable
+    public ContentCaptureClient getContentCaptureClient() {
+        return null;
+    }
+
+    /**
+     * @hide
+     */
     public final boolean isAutofillCompatibilityEnabled() {
         final AutofillOptions options = getAutofillOptions();
         return options != null && options.compatModeEnabled;
diff --git a/core/java/android/content/ContextWrapper.java b/core/java/android/content/ContextWrapper.java
index 40559d3..0859f97 100644
--- a/core/java/android/content/ContextWrapper.java
+++ b/core/java/android/content/ContextWrapper.java
@@ -706,9 +706,15 @@
     }
 
     @Override
-    public boolean bindIsolatedService(Intent service, ServiceConnection conn,
-            int flags, String instanceName) {
-        return mBase.bindIsolatedService(service, conn, flags, instanceName);
+    public boolean bindService(Intent service, int flags, Executor executor,
+            ServiceConnection conn) {
+        return mBase.bindService(service, flags, executor, conn);
+    }
+
+    @Override
+    public boolean bindIsolatedService(Intent service, int flags, String instanceName,
+            Executor executor, ServiceConnection conn) {
+        return mBase.bindIsolatedService(service, flags, instanceName, executor, conn);
     }
 
     /** @hide */
diff --git a/core/java/android/content/IContentService.aidl b/core/java/android/content/IContentService.aidl
index 9f6e236..a34a995 100644
--- a/core/java/android/content/IContentService.aidl
+++ b/core/java/android/content/IContentService.aidl
@@ -61,6 +61,7 @@
      */
     void sync(in SyncRequest request, String callingPackage);
     void syncAsUser(in SyncRequest request, int userId, String callingPackage);
+    @UnsupportedAppUsage
     void cancelSync(in Account account, String authority, in ComponentName cname);
     void cancelSyncAsUser(in Account account, String authority, in ComponentName cname, int userId);
 
@@ -118,6 +119,7 @@
      * Check if this account/provider is syncable.
      * @return >0 if it is syncable, 0 if not, and <0 if the state isn't known yet.
      */
+    @UnsupportedAppUsage
     int getIsSyncable(in Account account, String providerName);
     int getIsSyncableAsUser(in Account account, String providerName, int userId);
 
@@ -128,9 +130,11 @@
     void setIsSyncable(in Account account, String providerName, int syncable);
     void setIsSyncableAsUser(in Account account, String providerName, int syncable, int userId);
 
+    @UnsupportedAppUsage
     void setMasterSyncAutomatically(boolean flag);
     void setMasterSyncAutomaticallyAsUser(boolean flag, int userId);
 
+    @UnsupportedAppUsage
     boolean getMasterSyncAutomatically();
     boolean getMasterSyncAutomaticallyAsUser(int userId);
 
@@ -141,6 +145,7 @@
      * Returns the types of the SyncAdapters that are registered with the system.
      * @return Returns the types of the SyncAdapters that are registered with the system.
      */
+    @UnsupportedAppUsage
     SyncAdapterType[] getSyncAdapterTypes();
     SyncAdapterType[] getSyncAdapterTypesAsUser(int userId);
 
@@ -154,6 +159,7 @@
      * @param cname component to identify sync service, must be null if account/providerName are
      * non-null.
      */
+    @UnsupportedAppUsage
     boolean isSyncActive(in Account account, String authority, in ComponentName cname);
 
     /**
diff --git a/core/java/android/content/IIntentReceiver.aidl b/core/java/android/content/IIntentReceiver.aidl
index 3d92723..2b45021 100644
--- a/core/java/android/content/IIntentReceiver.aidl
+++ b/core/java/android/content/IIntentReceiver.aidl
@@ -27,6 +27,7 @@
  * {@hide}
  */
 oneway interface IIntentReceiver {
+    @UnsupportedAppUsage
     void performReceive(in Intent intent, int resultCode, String data,
             in Bundle extras, boolean ordered, boolean sticky, int sendingUser);
 }
diff --git a/core/java/android/content/ISyncAdapter.aidl b/core/java/android/content/ISyncAdapter.aidl
index 0eb581e..9242d02 100644
--- a/core/java/android/content/ISyncAdapter.aidl
+++ b/core/java/android/content/ISyncAdapter.aidl
@@ -32,6 +32,7 @@
      *
      * @param cb If called back with {@code false} accounts are not synced.
      */
+    @UnsupportedAppUsage
     void onUnsyncableAccount(ISyncAdapterUnsyncableAccountCallback cb);
 
     /**
@@ -44,6 +45,7 @@
      * @param account the account that should be synced
      * @param extras SyncAdapter-specific parameters
      */
+    @UnsupportedAppUsage
     void startSync(ISyncContext syncContext, String authority,
       in Account account, in Bundle extras);
 
@@ -52,5 +54,6 @@
      * after the ISyncContext.onFinished() for that sync was called.
      * @param syncContext the ISyncContext that was passed to {@link #startSync}
      */
+    @UnsupportedAppUsage
     void cancelSync(ISyncContext syncContext);
 }
diff --git a/core/java/android/content/ISyncServiceAdapter.aidl b/core/java/android/content/ISyncServiceAdapter.aidl
index d419307..29f3a40 100644
--- a/core/java/android/content/ISyncServiceAdapter.aidl
+++ b/core/java/android/content/ISyncServiceAdapter.aidl
@@ -35,11 +35,13 @@
      * @param extras SyncAdapter-specific parameters.
      *
      */
+    @UnsupportedAppUsage
     void startSync(ISyncContext syncContext, in Bundle extras);
 
     /**
      * Cancel the currently ongoing sync.
      */
+    @UnsupportedAppUsage
     void cancelSync(ISyncContext syncContext);
 
 }
diff --git a/core/java/android/content/ISyncStatusObserver.aidl b/core/java/android/content/ISyncStatusObserver.aidl
index eb26845..64bf3bd 100644
--- a/core/java/android/content/ISyncStatusObserver.aidl
+++ b/core/java/android/content/ISyncStatusObserver.aidl
@@ -20,5 +20,6 @@
  * @hide
  */
 oneway interface ISyncStatusObserver {
+    @UnsupportedAppUsage
     void onStatusChanged(int which);
 }
diff --git a/core/java/android/content/Intent.java b/core/java/android/content/Intent.java
index b67349f..0715572 100644
--- a/core/java/android/content/Intent.java
+++ b/core/java/android/content/Intent.java
@@ -27,6 +27,7 @@
 import android.annotation.SdkConstant;
 import android.annotation.SdkConstant.SdkConstantType;
 import android.annotation.SystemApi;
+import android.annotation.TestApi;
 import android.annotation.UnsupportedAppUsage;
 import android.content.pm.ActivityInfo;
 import android.content.pm.ApplicationInfo;
@@ -855,7 +856,7 @@
         /**
          * Used to read a ShortcutIconResource from a Parcel.
          */
-        public static final Parcelable.Creator<ShortcutIconResource> CREATOR =
+        public static final @android.annotation.NonNull Parcelable.Creator<ShortcutIconResource> CREATOR =
             new Parcelable.Creator<ShortcutIconResource>() {
 
                 public ShortcutIconResource createFromParcel(Parcel source) {
@@ -1902,6 +1903,7 @@
      * @hide
      */
     @SystemApi
+    @TestApi
     public static final String EXTRA_ROLE_NAME = "android.intent.extra.ROLE_NAME";
 
     /**
@@ -2122,6 +2124,7 @@
      * @hide
      */
     @SystemApi
+    @RequiresPermission(android.Manifest.permission.REVIEW_ACCESSIBILITY_SERVICES)
     @SdkConstant(SdkConstantType.ACTIVITY_INTENT_ACTION)
     public static final String ACTION_REVIEW_ACCESSIBILITY_SERVICES =
             "android.intent.action.REVIEW_ACCESSIBILITY_SERVICES";
@@ -10344,7 +10347,7 @@
         out.writeBundle(mExtras);
     }
 
-    public static final Parcelable.Creator<Intent> CREATOR
+    public static final @android.annotation.NonNull Parcelable.Creator<Intent> CREATOR
             = new Parcelable.Creator<Intent>() {
         public Intent createFromParcel(Parcel in) {
             return new Intent(in);
diff --git a/core/java/android/content/IntentFilter.java b/core/java/android/content/IntentFilter.java
index 36d8a37..9d52363 100644
--- a/core/java/android/content/IntentFilter.java
+++ b/core/java/android/content/IntentFilter.java
@@ -1896,7 +1896,7 @@
         }
     }
 
-    public static final Parcelable.Creator<IntentFilter> CREATOR
+    public static final @android.annotation.NonNull Parcelable.Creator<IntentFilter> CREATOR
             = new Parcelable.Creator<IntentFilter>() {
         public IntentFilter createFromParcel(Parcel source) {
             return new IntentFilter(source);
diff --git a/core/java/android/content/IntentSender.java b/core/java/android/content/IntentSender.java
index bfd1a43..ec0bac4 100644
--- a/core/java/android/content/IntentSender.java
+++ b/core/java/android/content/IntentSender.java
@@ -316,7 +316,7 @@
         out.writeStrongBinder(mTarget.asBinder());
     }
 
-    public static final Parcelable.Creator<IntentSender> CREATOR
+    public static final @android.annotation.NonNull Parcelable.Creator<IntentSender> CREATOR
             = new Parcelable.Creator<IntentSender>() {
         public IntentSender createFromParcel(Parcel in) {
             IBinder target = in.readStrongBinder();
diff --git a/core/java/android/content/LocusId.java b/core/java/android/content/LocusId.java
index 9548f9c..c67ff7c 100644
--- a/core/java/android/content/LocusId.java
+++ b/core/java/android/content/LocusId.java
@@ -16,7 +16,6 @@
 package android.content;
 
 import android.annotation.NonNull;
-import android.net.Uri;
 import android.os.Parcel;
 import android.os.Parcelable;
 
@@ -34,28 +33,30 @@
 // TODO(b/123577059): make sure this is well documented and understandable
 public final class LocusId implements Parcelable {
 
-    private final Uri mUri;
+    private final String mId;
 
     /**
      * Default constructor.
+     *
+     * @throws IllegalArgumentException if {@code id} is empty or {@code null}.
      */
-    public LocusId(@NonNull Uri uri) {
-        mUri = Preconditions.checkNotNull(uri);
+    public LocusId(@NonNull String id) {
+        mId = Preconditions.checkStringNotEmpty(id, "id cannot be empty");
     }
 
     /**
-     * Gets the {@code uri} associated with the locus.
+     * Gets the {@code id} associated with the locus.
      */
     @NonNull
-    public Uri getUri() {
-        return mUri;
+    public String getId() {
+        return mId;
     }
 
     @Override
     public int hashCode() {
         final int prime = 31;
         int result = 1;
-        result = prime * result + ((mUri == null) ? 0 : mUri.hashCode());
+        result = prime * result + ((mId == null) ? 0 : mId.hashCode());
         return result;
     }
 
@@ -65,26 +66,27 @@
         if (obj == null) return false;
         if (getClass() != obj.getClass()) return false;
         final LocusId other = (LocusId) obj;
-        if (mUri == null) {
-            if (other.mUri != null) return false;
+        if (mId == null) {
+            if (other.mId != null) return false;
         } else {
-            if (!mUri.equals(other.mUri)) return false;
+            if (!mId.equals(other.mId)) return false;
         }
         return true;
     }
 
     @Override
     public String toString() {
-        return "LocusId[uri=" + getSanitizedUri() + "]";
+        return "LocusId[" + getSanitizedId() + "]";
     }
 
     /** @hide */
     public void dump(@NonNull PrintWriter pw) {
-        pw.print("uri:"); pw.println(getSanitizedUri());
+        pw.print("id:"); pw.println(getSanitizedId());
     }
 
-    private String getSanitizedUri() {
-        final int size = mUri.toString().length();
+    @NonNull
+    private String getSanitizedId() {
+        final int size = mId.length();
         return size + "_chars";
     }
 
@@ -94,19 +96,20 @@
     }
 
     @Override
-    public void writeToParcel(Parcel dest, int flags) {
-        dest.writeParcelable(mUri, flags);
+    public void writeToParcel(Parcel parcel, int flags) {
+        parcel.writeString(mId);
     }
 
-    public static final Parcelable.Creator<LocusId> CREATOR =
+    public static final @android.annotation.NonNull Parcelable.Creator<LocusId> CREATOR =
             new Parcelable.Creator<LocusId>() {
 
+        @NonNull
         @Override
-        public LocusId createFromParcel(Parcel source) {
-            final Uri uri = source.readParcelable(null);
-            return new LocusId(uri);
+        public LocusId createFromParcel(Parcel parcel) {
+            return new LocusId(parcel.readString());
         }
 
+        @NonNull
         @Override
         public LocusId[] newArray(int size) {
             return new LocusId[size];
diff --git a/core/java/android/content/LoggingContentInterface.java b/core/java/android/content/LoggingContentInterface.java
new file mode 100644
index 0000000..26d01b9
--- /dev/null
+++ b/core/java/android/content/LoggingContentInterface.java
@@ -0,0 +1,199 @@
+/*
+ * Copyright (C) 2019 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.content;
+
+import android.annotation.NonNull;
+import android.annotation.Nullable;
+import android.content.res.AssetFileDescriptor;
+import android.database.Cursor;
+import android.database.DatabaseUtils;
+import android.net.Uri;
+import android.os.Binder;
+import android.os.Bundle;
+import android.os.CancellationSignal;
+import android.os.ParcelFileDescriptor;
+import android.os.RemoteException;
+import android.util.Log;
+
+import java.io.FileNotFoundException;
+import java.util.ArrayList;
+import java.util.Arrays;
+
+/**
+ * Instance of {@link ContentInterface} that logs all inputs and outputs while
+ * delegating to another {@link ContentInterface}.
+ *
+ * @hide
+ */
+public class LoggingContentInterface implements ContentInterface {
+    private final String tag;
+    private final ContentInterface delegate;
+
+    public LoggingContentInterface(String tag, ContentInterface delegate) {
+        this.tag = tag;
+        this.delegate = delegate;
+    }
+
+    private void log(String method, Object res, Object... args) {
+        // First, force-unparcel any bundles so we can log them
+        for (Object arg : args) {
+            if (arg instanceof Bundle) {
+                ((Bundle) arg).size();
+            }
+        }
+
+        final StringBuilder sb = new StringBuilder();
+        sb.append("callingUid=").append(Binder.getCallingUid()).append(' ');
+        sb.append(method);
+        sb.append('(').append(deepToString(args)).append(')');
+        if (res instanceof Cursor) {
+            sb.append('\n');
+            DatabaseUtils.dumpCursor((Cursor) res, sb);
+        } else {
+            sb.append(" = ").append(deepToString(res));
+        }
+        Log.v(tag, sb.toString());
+    }
+
+    private String deepToString(Object value) {
+        if (value != null && value.getClass().isArray()) {
+            return Arrays.deepToString((Object[]) value);
+        } else {
+            return String.valueOf(value);
+        }
+    }
+
+    @Override
+    public @Nullable Cursor query(@NonNull Uri uri, @Nullable String[] projection,
+            @Nullable Bundle queryArgs, @Nullable CancellationSignal cancellationSignal)
+            throws RemoteException {
+        final Cursor res = delegate.query(uri, projection, queryArgs, cancellationSignal);
+        log("query", res, uri, projection, queryArgs, cancellationSignal);
+        return res;
+    }
+
+    @Override
+    public @Nullable String getType(@NonNull Uri uri) throws RemoteException {
+        final String res = delegate.getType(uri);
+        log("getType", res, uri);
+        return res;
+    }
+
+    @Override
+    public @Nullable String[] getStreamTypes(@NonNull Uri uri, @NonNull String mimeTypeFilter)
+            throws RemoteException {
+        final String[] res = delegate.getStreamTypes(uri, mimeTypeFilter);
+        log("getStreamTypes", res, uri, mimeTypeFilter);
+        return res;
+    }
+
+    @Override
+    public @Nullable Uri canonicalize(@NonNull Uri uri) throws RemoteException {
+        final Uri res = delegate.canonicalize(uri);
+        log("canonicalize", res, uri);
+        return res;
+    }
+
+    @Override
+    public @Nullable Uri uncanonicalize(@NonNull Uri uri) throws RemoteException {
+        final Uri res = delegate.uncanonicalize(uri);
+        log("uncanonicalize", res, uri);
+        return res;
+    }
+
+    @Override
+    public boolean refresh(@NonNull Uri uri, @Nullable Bundle args,
+            @Nullable CancellationSignal cancellationSignal) throws RemoteException {
+        final boolean res = delegate.refresh(uri, args, cancellationSignal);
+        log("refresh", res, uri, args, cancellationSignal);
+        return res;
+    }
+
+    @Override
+    public @Nullable Uri insert(@NonNull Uri uri, @Nullable ContentValues initialValues)
+            throws RemoteException {
+        final Uri res = delegate.insert(uri, initialValues);
+        log("insert", res, uri, initialValues);
+        return res;
+    }
+
+    @Override
+    public int bulkInsert(@NonNull Uri uri, @NonNull ContentValues[] initialValues)
+            throws RemoteException {
+        final int res = delegate.bulkInsert(uri, initialValues);
+        log("bulkInsert", res, uri, initialValues);
+        return res;
+    }
+
+    @Override
+    public int delete(@NonNull Uri uri, @Nullable String selection,
+            @Nullable String[] selectionArgs) throws RemoteException {
+        final int res = delegate.delete(uri, selection, selectionArgs);
+        log("delete", res, uri, selection, selectionArgs);
+        return res;
+    }
+
+    @Override
+    public int update(@NonNull Uri uri, @Nullable ContentValues values, @Nullable String selection,
+            @Nullable String[] selectionArgs) throws RemoteException {
+        final int res = delegate.update(uri, values, selection, selectionArgs);
+        log("update", res, uri, values, selection, selectionArgs);
+        return res;
+    }
+
+    @Override
+    public @Nullable ParcelFileDescriptor openFile(@NonNull Uri uri, @NonNull String mode,
+            @Nullable CancellationSignal signal) throws RemoteException, FileNotFoundException {
+        final ParcelFileDescriptor res = delegate.openFile(uri, mode, signal);
+        log("openFile", res, uri, mode, signal);
+        return res;
+    }
+
+    @Override
+    public @Nullable AssetFileDescriptor openAssetFile(@NonNull Uri uri, @NonNull String mode,
+            @Nullable CancellationSignal signal) throws RemoteException, FileNotFoundException {
+        final AssetFileDescriptor res = delegate.openAssetFile(uri, mode, signal);
+        log("openAssetFile", res, uri, mode, signal);
+        return res;
+    }
+
+    @Override
+    public @Nullable AssetFileDescriptor openTypedAssetFile(@NonNull Uri uri,
+            @NonNull String mimeTypeFilter, @Nullable Bundle opts,
+            @Nullable CancellationSignal signal) throws RemoteException, FileNotFoundException {
+        final AssetFileDescriptor res = delegate.openTypedAssetFile(uri, mimeTypeFilter, opts, signal);
+        log("openTypedAssetFile", res, uri, mimeTypeFilter, opts, signal);
+        return res;
+    }
+
+    @Override
+    public @NonNull ContentProviderResult[] applyBatch(@NonNull String authority,
+            @NonNull ArrayList<ContentProviderOperation> operations)
+            throws RemoteException, OperationApplicationException {
+        final ContentProviderResult[] res = delegate.applyBatch(authority, operations);
+        log("applyBatch", res, authority, operations);
+        return res;
+    }
+
+    @Override
+    public @Nullable Bundle call(@NonNull String authority, @NonNull String method,
+            @Nullable String arg, @Nullable Bundle extras) throws RemoteException {
+        final Bundle res = delegate.call(authority, method, arg, extras);
+        log("call", res, authority, method, arg, extras);
+        return res;
+    }
+}
diff --git a/core/java/android/content/PeriodicSync.java b/core/java/android/content/PeriodicSync.java
index 0441ccc..a075148 100644
--- a/core/java/android/content/PeriodicSync.java
+++ b/core/java/android/content/PeriodicSync.java
@@ -104,7 +104,7 @@
         dest.writeLong(flexTime);
     }
 
-    public static final Creator<PeriodicSync> CREATOR = new Creator<PeriodicSync>() {
+    public static final @android.annotation.NonNull Creator<PeriodicSync> CREATOR = new Creator<PeriodicSync>() {
         @Override
         public PeriodicSync createFromParcel(Parcel source) {
             return new PeriodicSync(source);
diff --git a/core/java/android/content/RestrictionEntry.java b/core/java/android/content/RestrictionEntry.java
index 0473475..010992c 100644
--- a/core/java/android/content/RestrictionEntry.java
+++ b/core/java/android/content/RestrictionEntry.java
@@ -531,7 +531,7 @@
         dest.writeParcelableArray(mRestrictions, 0);
     }
 
-    public static final Creator<RestrictionEntry> CREATOR = new Creator<RestrictionEntry>() {
+    public static final @android.annotation.NonNull Creator<RestrictionEntry> CREATOR = new Creator<RestrictionEntry>() {
         public RestrictionEntry createFromParcel(Parcel source) {
             return new RestrictionEntry(source);
         }
diff --git a/core/java/android/content/SyncAdapterType.java b/core/java/android/content/SyncAdapterType.java
index 6cd4841..8c8fe5a 100644
--- a/core/java/android/content/SyncAdapterType.java
+++ b/core/java/android/content/SyncAdapterType.java
@@ -241,7 +241,7 @@
                 source.readString());
     }
 
-    public static final Creator<SyncAdapterType> CREATOR = new Creator<SyncAdapterType>() {
+    public static final @android.annotation.NonNull Creator<SyncAdapterType> CREATOR = new Creator<SyncAdapterType>() {
         public SyncAdapterType createFromParcel(Parcel source) {
             return new SyncAdapterType(source);
         }
diff --git a/core/java/android/content/SyncInfo.java b/core/java/android/content/SyncInfo.java
index 403cbcb..d3f2eed 100644
--- a/core/java/android/content/SyncInfo.java
+++ b/core/java/android/content/SyncInfo.java
@@ -106,7 +106,7 @@
 
     /** @hide */
     @UnsupportedAppUsage
-    public static final Creator<SyncInfo> CREATOR = new Creator<SyncInfo>() {
+    public static final @android.annotation.NonNull Creator<SyncInfo> CREATOR = new Creator<SyncInfo>() {
         public SyncInfo createFromParcel(Parcel in) {
             return new SyncInfo(in);
         }
diff --git a/core/java/android/content/SyncRequest.java b/core/java/android/content/SyncRequest.java
index c18b282..5f1f180 100644
--- a/core/java/android/content/SyncRequest.java
+++ b/core/java/android/content/SyncRequest.java
@@ -122,7 +122,7 @@
         return mSyncRunTimeSecs;
     }
 
-    public static final Creator<SyncRequest> CREATOR = new Creator<SyncRequest>() {
+    public static final @android.annotation.NonNull Creator<SyncRequest> CREATOR = new Creator<SyncRequest>() {
 
         @Override
         public SyncRequest createFromParcel(Parcel in) {
diff --git a/core/java/android/content/SyncResult.java b/core/java/android/content/SyncResult.java
index f67d7f5..8280f8e 100644
--- a/core/java/android/content/SyncResult.java
+++ b/core/java/android/content/SyncResult.java
@@ -235,7 +235,7 @@
         stats.clear();
     }
 
-    public static final Creator<SyncResult> CREATOR = new Creator<SyncResult>() {
+    public static final @android.annotation.NonNull Creator<SyncResult> CREATOR = new Creator<SyncResult>() {
         public SyncResult createFromParcel(Parcel in) {
             return new SyncResult(in);
         }
diff --git a/core/java/android/content/SyncStats.java b/core/java/android/content/SyncStats.java
index b7f2a85..03b2250e 100644
--- a/core/java/android/content/SyncStats.java
+++ b/core/java/android/content/SyncStats.java
@@ -166,7 +166,7 @@
         dest.writeLong(numSkippedEntries);
     }
 
-    public static final Creator<SyncStats> CREATOR = new Creator<SyncStats>() {
+    public static final @android.annotation.NonNull Creator<SyncStats> CREATOR = new Creator<SyncStats>() {
         public SyncStats createFromParcel(Parcel in) {
             return new SyncStats(in);
         }
diff --git a/core/java/android/content/SyncStatusInfo.java b/core/java/android/content/SyncStatusInfo.java
index a9065ca..3f64515 100644
--- a/core/java/android/content/SyncStatusInfo.java
+++ b/core/java/android/content/SyncStatusInfo.java
@@ -401,7 +401,7 @@
     }
 
     @UnsupportedAppUsage
-    public static final Creator<SyncStatusInfo> CREATOR = new Creator<SyncStatusInfo>() {
+    public static final @android.annotation.NonNull Creator<SyncStatusInfo> CREATOR = new Creator<SyncStatusInfo>() {
         public SyncStatusInfo createFromParcel(Parcel in) {
             return new SyncStatusInfo(in);
         }
diff --git a/core/java/android/content/UriPermission.java b/core/java/android/content/UriPermission.java
index df9200d..d3a9cb8 100644
--- a/core/java/android/content/UriPermission.java
+++ b/core/java/android/content/UriPermission.java
@@ -103,7 +103,7 @@
         dest.writeLong(mPersistedTime);
     }
 
-    public static final Creator<UriPermission> CREATOR = new Creator<UriPermission>() {
+    public static final @android.annotation.NonNull Creator<UriPermission> CREATOR = new Creator<UriPermission>() {
         @Override
         public UriPermission createFromParcel(Parcel source) {
             return new UriPermission(source);
diff --git a/core/java/android/content/om/IOverlayManager.aidl b/core/java/android/content/om/IOverlayManager.aidl
index 5b3c9dd..722c128 100644
--- a/core/java/android/content/om/IOverlayManager.aidl
+++ b/core/java/android/content/om/IOverlayManager.aidl
@@ -37,6 +37,7 @@
      *         mapped to lists of overlays; if no overlays exist for the
      *         requested user, an empty map is returned.
      */
+    @UnsupportedAppUsage
     Map getAllOverlays(in int userId);
 
     /**
@@ -60,6 +61,7 @@
      * @return The OverlayInfo for the overlay package; or null if no such
      *         overlay package exists.
      */
+    @UnsupportedAppUsage
     OverlayInfo getOverlayInfo(in String packageName, in int userId);
 
     /**
diff --git a/core/java/android/content/om/OverlayInfo.java b/core/java/android/content/om/OverlayInfo.java
index 1989f06..999d986 100644
--- a/core/java/android/content/om/OverlayInfo.java
+++ b/core/java/android/content/om/OverlayInfo.java
@@ -264,7 +264,7 @@
         dest.writeBoolean(isStatic);
     }
 
-    public static final Parcelable.Creator<OverlayInfo> CREATOR =
+    public static final @android.annotation.NonNull Parcelable.Creator<OverlayInfo> CREATOR =
             new Parcelable.Creator<OverlayInfo>() {
         @Override
         public OverlayInfo createFromParcel(Parcel source) {
diff --git a/core/java/android/content/pm/ActivityInfo.java b/core/java/android/content/pm/ActivityInfo.java
index 7cc4391..415c242 100644
--- a/core/java/android/content/pm/ActivityInfo.java
+++ b/core/java/android/content/pm/ActivityInfo.java
@@ -1314,7 +1314,7 @@
         }
     }
 
-    public static final Parcelable.Creator<ActivityInfo> CREATOR
+    public static final @android.annotation.NonNull Parcelable.Creator<ActivityInfo> CREATOR
             = new Parcelable.Creator<ActivityInfo>() {
         public ActivityInfo createFromParcel(Parcel source) {
             return new ActivityInfo(source);
diff --git a/core/java/android/content/pm/ApplicationInfo.java b/core/java/android/content/pm/ApplicationInfo.java
index 6c6fcb2..706cbbf 100644
--- a/core/java/android/content/pm/ApplicationInfo.java
+++ b/core/java/android/content/pm/ApplicationInfo.java
@@ -43,6 +43,7 @@
 import java.lang.annotation.Retention;
 import java.lang.annotation.RetentionPolicy;
 import java.text.Collator;
+import java.util.ArrayList;
 import java.util.Arrays;
 import java.util.Comparator;
 import java.util.List;
@@ -662,6 +663,14 @@
      */
     public static final int PRIVATE_FLAG_ALLOW_CLEAR_USER_DATA_ON_FAILED_RESTORE = 1 << 26;
 
+    /**
+     * Value for {@link #privateFlags}: true if the application allows its audio playback
+     * to be captured by other apps.
+     *
+     * @hide
+     */
+    public static final int PRIVATE_FLAG_ALLOW_AUDIO_PLAYBACK_CAPTURE  = 1 << 27;
+
     /** @hide */
     @IntDef(flag = true, prefix = { "PRIVATE_FLAG_" }, value = {
             PRIVATE_FLAG_ACTIVITIES_RESIZE_MODE_RESIZEABLE,
@@ -688,7 +697,8 @@
             PRIVATE_FLAG_VENDOR,
             PRIVATE_FLAG_VIRTUAL_PRELOAD,
             PRIVATE_FLAG_HAS_FRAGILE_USER_DATA,
-            PRIVATE_FLAG_ALLOW_CLEAR_USER_DATA_ON_FAILED_RESTORE
+            PRIVATE_FLAG_ALLOW_CLEAR_USER_DATA_ON_FAILED_RESTORE,
+            PRIVATE_FLAG_ALLOW_AUDIO_PLAYBACK_CAPTURE
     })
     @Retention(RetentionPolicy.SOURCE)
     public @interface ApplicationInfoPrivateFlags {}
@@ -1342,6 +1352,8 @@
             }
             pw.println(prefix + "HiddenApiEnforcementPolicy=" + getHiddenApiEnforcementPolicy());
             pw.println(prefix + "usesNonSdkApi=" + usesNonSdkApi());
+            pw.println(prefix + "allowsPlaybackCapture="
+                        + (isAudioPlaybackCaptureAllowed() ? "true" : "false"));
         }
         super.dumpBack(pw, prefix);
     }
@@ -1625,7 +1637,7 @@
         dest.writeString(zygotePreloadName);
     }
 
-    public static final Parcelable.Creator<ApplicationInfo> CREATOR
+    public static final @android.annotation.NonNull Parcelable.Creator<ApplicationInfo> CREATOR
             = new Parcelable.Creator<ApplicationInfo>() {
         public ApplicationInfo createFromParcel(Parcel source) {
             return new ApplicationInfo(source);
@@ -1790,6 +1802,17 @@
         return (privateFlags & PRIVATE_FLAG_HAS_FRAGILE_USER_DATA) != 0;
     }
 
+    /**
+     * Whether an app allows its playback audio to be captured by other apps.
+     *
+     * @return {@code true} if the app indicates that its audio can be captured by other apps.
+     *
+     * @hide
+     */
+    public boolean isAudioPlaybackCaptureAllowed() {
+        return (privateFlags & PRIVATE_FLAG_ALLOW_AUDIO_PLAYBACK_CAPTURE) != 0;
+    }
+
     private boolean isAllowedToUseHiddenApis() {
         if (isSignedWithPlatformKey()) {
             return true;
@@ -2006,6 +2029,27 @@
         return this;
     }
 
+    /**
+     * Return all the APK paths that may be required to load this application, including all
+     * splits, shared libraries, and resource overlays.
+     * @hide
+     */
+    public String[] getAllApkPaths() {
+        final String[][] inputLists = { splitSourceDirs, sharedLibraryFiles, resourceDirs };
+        final List<String> output = new ArrayList<>(10);
+        if (sourceDir != null) {
+            output.add(sourceDir);
+        }
+        for (String[] inputList : inputLists) {
+            if (inputList != null) {
+                for (String input : inputList) {
+                    output.add(input);
+                }
+            }
+        }
+        return output.toArray(new String[output.size()]);
+    }
+
     /** {@hide} */ public void setCodePath(String codePath) { scanSourceDir = codePath; }
     /** {@hide} */ public void setBaseCodePath(String baseCodePath) { sourceDir = baseCodePath; }
     /** {@hide} */ public void setSplitCodePaths(String[] splitCodePaths) { splitSourceDirs = splitCodePaths; }
diff --git a/core/java/android/content/pm/BaseParceledListSlice.java b/core/java/android/content/pm/BaseParceledListSlice.java
index a3e5d6d..4178309 100644
--- a/core/java/android/content/pm/BaseParceledListSlice.java
+++ b/core/java/android/content/pm/BaseParceledListSlice.java
@@ -128,8 +128,8 @@
     private static void verifySameType(final Class<?> expected, final Class<?> actual) {
         if (!actual.equals(expected)) {
             throw new IllegalArgumentException("Can't unparcel type "
-                    + actual.getName() + " in list of type "
-                    + expected.getName());
+                    + (actual == null ? null : actual.getName()) + " in list of type "
+                    + (expected == null ? null : expected.getName()));
         }
     }
 
diff --git a/core/java/android/content/pm/ChangedPackages.java b/core/java/android/content/pm/ChangedPackages.java
index b78c71d..950a29a 100644
--- a/core/java/android/content/pm/ChangedPackages.java
+++ b/core/java/android/content/pm/ChangedPackages.java
@@ -71,7 +71,7 @@
         return mPackageNames;
     }
 
-    public static final Parcelable.Creator<ChangedPackages> CREATOR =
+    public static final @android.annotation.NonNull Parcelable.Creator<ChangedPackages> CREATOR =
             new Parcelable.Creator<ChangedPackages>() {
         public ChangedPackages createFromParcel(Parcel in) {
             return new ChangedPackages(in);
diff --git a/core/java/android/content/pm/ConfigurationInfo.java b/core/java/android/content/pm/ConfigurationInfo.java
index 8edd436..20494e9 100644
--- a/core/java/android/content/pm/ConfigurationInfo.java
+++ b/core/java/android/content/pm/ConfigurationInfo.java
@@ -113,7 +113,7 @@
         dest.writeInt(reqGlEsVersion);
     }
 
-    public static final Creator<ConfigurationInfo> CREATOR =
+    public static final @android.annotation.NonNull Creator<ConfigurationInfo> CREATOR =
         new Creator<ConfigurationInfo>() {
         public ConfigurationInfo createFromParcel(Parcel source) {
             return new ConfigurationInfo(source);
diff --git a/core/java/android/content/pm/FeatureGroupInfo.java b/core/java/android/content/pm/FeatureGroupInfo.java
index 79a6eea..38c8f74 100644
--- a/core/java/android/content/pm/FeatureGroupInfo.java
+++ b/core/java/android/content/pm/FeatureGroupInfo.java
@@ -49,7 +49,7 @@
         dest.writeTypedArray(features, flags);
     }
 
-    public static final Creator<FeatureGroupInfo> CREATOR = new Creator<FeatureGroupInfo>() {
+    public static final @android.annotation.NonNull Creator<FeatureGroupInfo> CREATOR = new Creator<FeatureGroupInfo>() {
         @Override
         public FeatureGroupInfo createFromParcel(Parcel source) {
             FeatureGroupInfo group = new FeatureGroupInfo();
diff --git a/core/java/android/content/pm/FeatureInfo.java b/core/java/android/content/pm/FeatureInfo.java
index ff9fd8e..dc576e8 100644
--- a/core/java/android/content/pm/FeatureInfo.java
+++ b/core/java/android/content/pm/FeatureInfo.java
@@ -126,7 +126,7 @@
         proto.end(token);
     }
 
-    public static final Creator<FeatureInfo> CREATOR = new Creator<FeatureInfo>() {
+    public static final @android.annotation.NonNull Creator<FeatureInfo> CREATOR = new Creator<FeatureInfo>() {
         @Override
         public FeatureInfo createFromParcel(Parcel source) {
             return new FeatureInfo(source);
diff --git a/core/java/android/content/pm/IPackageDataObserver.aidl b/core/java/android/content/pm/IPackageDataObserver.aidl
index d010ee4..926ecda 100644
--- a/core/java/android/content/pm/IPackageDataObserver.aidl
+++ b/core/java/android/content/pm/IPackageDataObserver.aidl
@@ -24,5 +24,6 @@
  * {@hide}
  */
 oneway interface IPackageDataObserver {
+    @UnsupportedAppUsage
     void onRemoveCompleted(in String packageName, boolean succeeded);
 }
diff --git a/core/java/android/content/pm/IPackageDeleteObserver.aidl b/core/java/android/content/pm/IPackageDeleteObserver.aidl
index 2e2d16e..faae81e 100644
--- a/core/java/android/content/pm/IPackageDeleteObserver.aidl
+++ b/core/java/android/content/pm/IPackageDeleteObserver.aidl
@@ -23,6 +23,7 @@
  * {@hide}
  */
 oneway interface IPackageDeleteObserver {
+    @UnsupportedAppUsage
     void packageDeleted(in String packageName, in int returnCode);
 }
 
diff --git a/core/java/android/content/pm/IPackageDeleteObserver2.aidl b/core/java/android/content/pm/IPackageDeleteObserver2.aidl
index bff3baa..ea80967 100644
--- a/core/java/android/content/pm/IPackageDeleteObserver2.aidl
+++ b/core/java/android/content/pm/IPackageDeleteObserver2.aidl
@@ -21,5 +21,6 @@
 /** {@hide} */
 oneway interface IPackageDeleteObserver2 {
     void onUserActionRequired(in Intent intent);
+    @UnsupportedAppUsage
     void onPackageDeleted(String packageName, int returnCode, String msg);
 }
diff --git a/core/java/android/content/pm/IPackageInstallObserver2.aidl b/core/java/android/content/pm/IPackageInstallObserver2.aidl
index bb5f22a..ed2eb7d 100644
--- a/core/java/android/content/pm/IPackageInstallObserver2.aidl
+++ b/core/java/android/content/pm/IPackageInstallObserver2.aidl
@@ -25,6 +25,7 @@
  * @hide
  */
 oneway interface IPackageInstallObserver2 {
+    @UnsupportedAppUsage
     void onUserActionRequired(in Intent intent);
 
     /**
@@ -42,5 +43,6 @@
      * </tr>
      * </table>
      */
+    @UnsupportedAppUsage
     void onPackageInstalled(String basePackageName, int returnCode, String msg, in Bundle extras);
 }
diff --git a/core/java/android/content/pm/IPackageInstaller.aidl b/core/java/android/content/pm/IPackageInstaller.aidl
index 0cf83fd..8e84079 100644
--- a/core/java/android/content/pm/IPackageInstaller.aidl
+++ b/core/java/android/content/pm/IPackageInstaller.aidl
@@ -47,6 +47,7 @@
     void registerCallback(IPackageInstallerCallback callback, int userId);
     void unregisterCallback(IPackageInstallerCallback callback);
 
+    @UnsupportedAppUsage
     void uninstall(in VersionedPackage versionedPackage, String callerPackageName, int flags,
             in IntentSender statusReceiver, int userId);
 
diff --git a/core/java/android/content/pm/IPackageInstallerCallback.aidl b/core/java/android/content/pm/IPackageInstallerCallback.aidl
index 974eb1e..ee26500 100644
--- a/core/java/android/content/pm/IPackageInstallerCallback.aidl
+++ b/core/java/android/content/pm/IPackageInstallerCallback.aidl
@@ -18,9 +18,14 @@
 
 /** {@hide} */
 oneway interface IPackageInstallerCallback {
+    @UnsupportedAppUsage
     void onSessionCreated(int sessionId);
+    @UnsupportedAppUsage
     void onSessionBadgingChanged(int sessionId);
+    @UnsupportedAppUsage
     void onSessionActiveChanged(int sessionId, boolean active);
+    @UnsupportedAppUsage
     void onSessionProgressChanged(int sessionId, float progress);
+    @UnsupportedAppUsage
     void onSessionFinished(int sessionId, boolean success);
 }
diff --git a/core/java/android/content/pm/IPackageManager.aidl b/core/java/android/content/pm/IPackageManager.aidl
index dcbb4ac..fd3529b 100644
--- a/core/java/android/content/pm/IPackageManager.aidl
+++ b/core/java/android/content/pm/IPackageManager.aidl
@@ -63,45 +63,60 @@
  */
 interface IPackageManager {
     void checkPackageStartable(String packageName, int userId);
+    @UnsupportedAppUsage
     boolean isPackageAvailable(String packageName, int userId);
+    @UnsupportedAppUsage
     PackageInfo getPackageInfo(String packageName, int flags, int userId);
     PackageInfo getPackageInfoVersioned(in VersionedPackage versionedPackage,
             int flags, int userId);
+    @UnsupportedAppUsage
     int getPackageUid(String packageName, int flags, int userId);
     int[] getPackageGids(String packageName, int flags, int userId);
 
+    @UnsupportedAppUsage
     String[] currentToCanonicalPackageNames(in String[] names);
+    @UnsupportedAppUsage
     String[] canonicalToCurrentPackageNames(in String[] names);
 
     PermissionInfo getPermissionInfo(String name, String packageName, int flags);
 
     ParceledListSlice queryPermissionsByGroup(String group, int flags);
 
+    @UnsupportedAppUsage
     PermissionGroupInfo getPermissionGroupInfo(String name, int flags);
 
     ParceledListSlice getAllPermissionGroups(int flags);
 
+    @UnsupportedAppUsage
     ApplicationInfo getApplicationInfo(String packageName, int flags ,int userId);
 
+    @UnsupportedAppUsage
     ActivityInfo getActivityInfo(in ComponentName className, int flags, int userId);
 
     boolean activitySupportsIntent(in ComponentName className, in Intent intent,
             String resolvedType);
 
+    @UnsupportedAppUsage
     ActivityInfo getReceiverInfo(in ComponentName className, int flags, int userId);
 
+    @UnsupportedAppUsage
     ServiceInfo getServiceInfo(in ComponentName className, int flags, int userId);
 
+    @UnsupportedAppUsage
     ProviderInfo getProviderInfo(in ComponentName className, int flags, int userId);
 
+    @UnsupportedAppUsage
     int checkPermission(String permName, String pkgName, int userId);
 
     int checkUidPermission(String permName, int uid);
 
+    @UnsupportedAppUsage
     boolean addPermission(in PermissionInfo info);
 
+    @UnsupportedAppUsage
     void removePermission(String name);
 
+    @UnsupportedAppUsage
     void grantRuntimePermission(String packageName, String permissionName, int userId);
 
     void revokeRuntimePermission(String packageName, String permissionName, int userId);
@@ -120,33 +135,43 @@
 
     boolean isProtectedBroadcast(String actionName);
 
+    @UnsupportedAppUsage
     int checkSignatures(String pkg1, String pkg2);
 
+    @UnsupportedAppUsage
     int checkUidSignatures(int uid1, int uid2);
 
     List<String> getAllPackages();
 
+    @UnsupportedAppUsage
     String[] getPackagesForUid(int uid);
 
+    @UnsupportedAppUsage
     String getNameForUid(int uid);
     String[] getNamesForUids(in int[] uids);
 
+    @UnsupportedAppUsage
     int getUidForSharedUser(String sharedUserName);
 
+    @UnsupportedAppUsage
     int getFlagsForUid(int uid);
 
     int getPrivateFlagsForUid(int uid);
 
+    @UnsupportedAppUsage
     boolean isUidPrivileged(int uid);
 
+    @UnsupportedAppUsage
     String[] getAppOpPermissionPackages(String permissionName);
 
+    @UnsupportedAppUsage
     ResolveInfo resolveIntent(in Intent intent, String resolvedType, int flags, int userId);
 
     ResolveInfo findPersistentPreferredActivity(in Intent intent, int userId);
 
     boolean canForwardTo(in Intent intent, String resolvedType, int sourceUserId, int targetUserId);
 
+    @UnsupportedAppUsage
     ParceledListSlice queryIntentActivities(in Intent intent,
             String resolvedType, int flags, int userId);
 
@@ -173,6 +198,7 @@
      * limit that kicks in when flags are included that bloat up the data
      * returned.
      */
+    @UnsupportedAppUsage
     ParceledListSlice getInstalledPackages(int flags, in int userId);
 
     /**
@@ -190,6 +216,7 @@
      * limit that kicks in when flags are included that bloat up the data
      * returned.
      */
+    @UnsupportedAppUsage
     ParceledListSlice getInstalledApplications(int flags, int userId);
 
     /**
@@ -210,20 +237,24 @@
      * @param outInfo Filled in with a list of the ProviderInfo for each
      *                name in 'outNames'.
      */
+    @UnsupportedAppUsage
     void querySyncProviders(inout List<String> outNames,
             inout List<ProviderInfo> outInfo);
 
     ParceledListSlice queryContentProviders(
             String processName, int uid, int flags, String metaDataKey);
 
+    @UnsupportedAppUsage
     InstrumentationInfo getInstrumentationInfo(
             in ComponentName className, int flags);
 
+    @UnsupportedAppUsage
     ParceledListSlice queryInstrumentation(
             String targetPackage, int flags);
 
     void finishPackageInstall(int token, boolean didLaunch);
 
+    @UnsupportedAppUsage
     void setInstallerPackageName(in String targetPackage, in String installerPackageName);
 
     void setApplicationCategoryHint(String packageName, int categoryHint, String callerPackageName);
@@ -243,24 +274,30 @@
     void deletePackageVersioned(in VersionedPackage versionedPackage,
             IPackageDeleteObserver2 observer, int userId, int flags);
 
+    @UnsupportedAppUsage
     String getInstallerPackageName(in String packageName);
 
     void resetApplicationPreferences(int userId);
 
+    @UnsupportedAppUsage
     ResolveInfo getLastChosenActivity(in Intent intent,
             String resolvedType, int flags);
 
+    @UnsupportedAppUsage
     void setLastChosenActivity(in Intent intent, String resolvedType, int flags,
             in IntentFilter filter, int match, in ComponentName activity);
 
     void addPreferredActivity(in IntentFilter filter, int match,
             in ComponentName[] set, in ComponentName activity, int userId);
 
+    @UnsupportedAppUsage
     void replacePreferredActivity(in IntentFilter filter, int match,
             in ComponentName[] set, in ComponentName activity, int userId);
 
+    @UnsupportedAppUsage
     void clearPackagePreferredActivities(String packageName);
 
+    @UnsupportedAppUsage
     int getPreferredActivities(out List<IntentFilter> outFilters,
             out List<ComponentName> outActivities, String packageName);
 
@@ -300,6 +337,7 @@
      * Report the set of 'Home' activity candidates, plus (if any) which of them
      * is the current "always use this one" setting.
      */
+     @UnsupportedAppUsage
      ComponentName getHomeActivities(out List<ResolveInfo> outHomeCandidates);
 
     void setHomeActivity(in ComponentName className, int userId);
@@ -307,23 +345,27 @@
     /**
      * As per {@link android.content.pm.PackageManager#setComponentEnabledSetting}.
      */
+    @UnsupportedAppUsage
     void setComponentEnabledSetting(in ComponentName componentName,
             in int newState, in int flags, int userId);
 
     /**
      * As per {@link android.content.pm.PackageManager#getComponentEnabledSetting}.
      */
+    @UnsupportedAppUsage
     int getComponentEnabledSetting(in ComponentName componentName, int userId);
 
     /**
      * As per {@link android.content.pm.PackageManager#setApplicationEnabledSetting}.
      */
+    @UnsupportedAppUsage
     void setApplicationEnabledSetting(in String packageName, in int newState, int flags,
             int userId, String callingPackage);
 
     /**
      * As per {@link android.content.pm.PackageManager#getApplicationEnabledSetting}.
      */
+    @UnsupportedAppUsage
     int getApplicationEnabledSetting(in String packageName, int userId);
 
     /**
@@ -341,6 +383,7 @@
      * Set whether the given package should be considered stopped, making
      * it not visible to implicit intents that filter out stopped packages.
      */
+    @UnsupportedAppUsage
     void setPackageStoppedState(String packageName, boolean stopped, int userId);
 
     /**
@@ -396,6 +439,7 @@
      * files need to be deleted
      * @param observer a callback used to notify when the deletion is finished.
      */
+    @UnsupportedAppUsage
     void deleteApplicationCacheFiles(in String packageName, IPackageDataObserver observer);
 
     /**
@@ -436,6 +480,7 @@
      * Get a list of shared libraries that are available on the
      * system.
      */
+    @UnsupportedAppUsage
     String[] getSystemSharedLibraryNames();
 
     /**
@@ -447,8 +492,10 @@
     boolean hasSystemFeature(String name, int version);
 
     void enterSafeMode();
+    @UnsupportedAppUsage
     boolean isSafeMode();
     void systemReady();
+    @UnsupportedAppUsage
     boolean hasSystemUidErrors();
 
     /**
@@ -570,9 +617,11 @@
     int movePackage(in String packageName, in String volumeUuid);
     int movePrimaryStorage(in String volumeUuid);
 
+    @UnsupportedAppUsage
     boolean addPermissionAsync(in PermissionInfo info);
 
     boolean setInstallLocation(int loc);
+    @UnsupportedAppUsage
     int getInstallLocation();
 
     int installExistingPackageAsUser(String packageName, int userId, int installFlags,
@@ -600,17 +649,21 @@
     boolean isPermissionEnforced(String permission);
 
     /** Reflects current DeviceStorageMonitorService state */
+    @UnsupportedAppUsage
     boolean isStorageLow();
 
+    @UnsupportedAppUsage
     boolean setApplicationHiddenSettingAsUser(String packageName, boolean hidden, int userId);
     boolean getApplicationHiddenSettingAsUser(String packageName, int userId);
 
     void setSystemAppHiddenUntilInstalled(String packageName, boolean hidden);
     boolean setSystemAppInstallState(String packageName, boolean installed, int userId);
 
+    @UnsupportedAppUsage
     IPackageInstaller getPackageInstaller();
 
     boolean setBlockUninstallForUser(String packageName, boolean blockUninstall, int userId);
+    @UnsupportedAppUsage
     boolean getBlockUninstallForUser(String packageName, int userId);
 
     KeySet getKeySetByAlias(String packageName, String alias);
@@ -631,6 +684,7 @@
 
     boolean isPermissionRevokedByPolicy(String permission, String packageName, int userId);
 
+    @UnsupportedAppUsage
     String getPermissionControllerPackageName();
 
     ParceledListSlice getInstantApps(int userId);
@@ -647,7 +701,9 @@
      */
     void setUpdateAvailable(String packageName, boolean updateAvaialble);
 
+    @UnsupportedAppUsage
     String getServicesSystemSharedLibraryPackageName();
+    @UnsupportedAppUsage
     String getSharedSystemSharedLibraryPackageName();
 
     ChangedPackages getChangedPackages(int sequenceNumber, int userId);
diff --git a/core/java/android/content/pm/IPackageStatsObserver.aidl b/core/java/android/content/pm/IPackageStatsObserver.aidl
index ede4d1d..559a035 100644
--- a/core/java/android/content/pm/IPackageStatsObserver.aidl
+++ b/core/java/android/content/pm/IPackageStatsObserver.aidl
@@ -26,5 +26,6 @@
  */
 oneway interface IPackageStatsObserver {
     
+    @UnsupportedAppUsage
     void onGetStatsCompleted(in PackageStats pStats, boolean succeeded);
 }
diff --git a/core/java/android/content/pm/InstantAppInfo.java b/core/java/android/content/pm/InstantAppInfo.java
index cb04fc3..24d6a07 100644
--- a/core/java/android/content/pm/InstantAppInfo.java
+++ b/core/java/android/content/pm/InstantAppInfo.java
@@ -136,7 +136,7 @@
         parcel.writeParcelable(mApplicationInfo, flags);
     }
 
-    public static final Creator<InstantAppInfo> CREATOR =
+    public static final @android.annotation.NonNull Creator<InstantAppInfo> CREATOR =
             new Creator<InstantAppInfo>() {
         @Override
         public InstantAppInfo createFromParcel(Parcel parcel) {
diff --git a/core/java/android/content/pm/InstantAppIntentFilter.java b/core/java/android/content/pm/InstantAppIntentFilter.java
index 257ab967..7c63406 100644
--- a/core/java/android/content/pm/InstantAppIntentFilter.java
+++ b/core/java/android/content/pm/InstantAppIntentFilter.java
@@ -68,7 +68,7 @@
         out.writeList(mFilters);
     }
 
-    public static final Parcelable.Creator<InstantAppIntentFilter> CREATOR
+    public static final @android.annotation.NonNull Parcelable.Creator<InstantAppIntentFilter> CREATOR
             = new Parcelable.Creator<InstantAppIntentFilter>() {
         @Override
         public InstantAppIntentFilter createFromParcel(Parcel in) {
diff --git a/core/java/android/content/pm/InstantAppResolveInfo.java b/core/java/android/content/pm/InstantAppResolveInfo.java
index 8184361..4c963a6 100644
--- a/core/java/android/content/pm/InstantAppResolveInfo.java
+++ b/core/java/android/content/pm/InstantAppResolveInfo.java
@@ -208,7 +208,7 @@
         out.writeLong(mVersionCode);
     }
 
-    public static final Parcelable.Creator<InstantAppResolveInfo> CREATOR
+    public static final @android.annotation.NonNull Parcelable.Creator<InstantAppResolveInfo> CREATOR
             = new Parcelable.Creator<InstantAppResolveInfo>() {
         public InstantAppResolveInfo createFromParcel(Parcel in) {
             return new InstantAppResolveInfo(in);
@@ -383,7 +383,7 @@
         }
 
         @SuppressWarnings("hiding")
-        public static final Parcelable.Creator<InstantAppDigest> CREATOR =
+        public static final @android.annotation.NonNull Parcelable.Creator<InstantAppDigest> CREATOR =
                 new Parcelable.Creator<InstantAppDigest>() {
             @Override
             public InstantAppDigest createFromParcel(Parcel in) {
diff --git a/core/java/android/content/pm/InstrumentationInfo.java b/core/java/android/content/pm/InstrumentationInfo.java
index fb2e4a04..574a1ee 100644
--- a/core/java/android/content/pm/InstrumentationInfo.java
+++ b/core/java/android/content/pm/InstrumentationInfo.java
@@ -176,7 +176,7 @@
         dest.writeInt((functionalTest == false) ? 0 : 1);
     }
 
-    public static final Parcelable.Creator<InstrumentationInfo> CREATOR
+    public static final @android.annotation.NonNull Parcelable.Creator<InstrumentationInfo> CREATOR
             = new Parcelable.Creator<InstrumentationInfo>() {
         public InstrumentationInfo createFromParcel(Parcel source) {
             return new InstrumentationInfo(source);
diff --git a/core/java/android/content/pm/IntentFilterVerificationInfo.java b/core/java/android/content/pm/IntentFilterVerificationInfo.java
index 068973b..67bda2c 100644
--- a/core/java/android/content/pm/IntentFilterVerificationInfo.java
+++ b/core/java/android/content/pm/IntentFilterVerificationInfo.java
@@ -246,7 +246,7 @@
         dest.writeStringList(new ArrayList<>(mDomains));
     }
 
-    public static final Creator<IntentFilterVerificationInfo> CREATOR =
+    public static final @android.annotation.NonNull Creator<IntentFilterVerificationInfo> CREATOR =
             new Creator<IntentFilterVerificationInfo>() {
                 public IntentFilterVerificationInfo createFromParcel(Parcel source) {
                     return new IntentFilterVerificationInfo(source);
diff --git a/core/java/android/content/pm/KeySet.java b/core/java/android/content/pm/KeySet.java
index 643db7e..5c1d35e 100644
--- a/core/java/android/content/pm/KeySet.java
+++ b/core/java/android/content/pm/KeySet.java
@@ -63,7 +63,7 @@
      * Implement Parcelable
      * @hide
      */
-    public static final Parcelable.Creator<KeySet> CREATOR
+    public static final @android.annotation.NonNull Parcelable.Creator<KeySet> CREATOR
             = new Parcelable.Creator<KeySet>() {
 
         /**
diff --git a/core/java/android/content/pm/LabeledIntent.java b/core/java/android/content/pm/LabeledIntent.java
index 68b0046..ae41252 100644
--- a/core/java/android/content/pm/LabeledIntent.java
+++ b/core/java/android/content/pm/LabeledIntent.java
@@ -180,7 +180,7 @@
         mIcon = in.readInt();
     }
     
-    public static final Creator<LabeledIntent> CREATOR
+    public static final @android.annotation.NonNull Creator<LabeledIntent> CREATOR
             = new Creator<LabeledIntent>() {
         public LabeledIntent createFromParcel(Parcel source) {
             return new LabeledIntent(source);
diff --git a/core/java/android/content/pm/LauncherApps.java b/core/java/android/content/pm/LauncherApps.java
index bf556ba..0cc5f39 100644
--- a/core/java/android/content/pm/LauncherApps.java
+++ b/core/java/android/content/pm/LauncherApps.java
@@ -792,7 +792,7 @@
      *
      * @return an {@link AppUsageLimit} object describing the app time limit containing
      * the given package with the smallest time remaining, or {@code null} if none exist.
-     * @throws SecurityException when the caller is not the active launcher.
+     * @throws SecurityException when the caller is not the recents app.
      */
     @Nullable
     public LauncherApps.AppUsageLimit getAppUsageLimit(@NonNull String packageName,
@@ -1725,7 +1725,7 @@
             dest.writeStrongBinder(mInner.asBinder());
         }
 
-        public static final Creator<PinItemRequest> CREATOR =
+        public static final @android.annotation.NonNull Creator<PinItemRequest> CREATOR =
                 new Creator<PinItemRequest>() {
                     public PinItemRequest createFromParcel(Parcel source) {
                         return new PinItemRequest(source);
@@ -1785,7 +1785,7 @@
             mUsageRemaining = source.readLong();
         }
 
-        public static final Creator<AppUsageLimit> CREATOR = new Creator<AppUsageLimit>() {
+        public static final @android.annotation.NonNull Creator<AppUsageLimit> CREATOR = new Creator<AppUsageLimit>() {
             @Override
             public AppUsageLimit createFromParcel(Parcel source) {
                 return new AppUsageLimit(source);
diff --git a/core/java/android/content/pm/ModuleInfo.java b/core/java/android/content/pm/ModuleInfo.java
index 044e87d..d930c92 100644
--- a/core/java/android/content/pm/ModuleInfo.java
+++ b/core/java/android/content/pm/ModuleInfo.java
@@ -134,7 +134,7 @@
         mHidden = source.readBoolean();
     }
 
-    public static final Parcelable.Creator<ModuleInfo> CREATOR =
+    public static final @android.annotation.NonNull Parcelable.Creator<ModuleInfo> CREATOR =
             new Parcelable.Creator<ModuleInfo>() {
         public ModuleInfo createFromParcel(Parcel source) {
             return new ModuleInfo(source);
diff --git a/core/java/android/content/pm/PackageInfo.java b/core/java/android/content/pm/PackageInfo.java
index 27a5b39..725d601 100644
--- a/core/java/android/content/pm/PackageInfo.java
+++ b/core/java/android/content/pm/PackageInfo.java
@@ -489,7 +489,7 @@
         dest.writeBoolean(isApex);
     }
 
-    public static final Parcelable.Creator<PackageInfo> CREATOR
+    public static final @android.annotation.NonNull Parcelable.Creator<PackageInfo> CREATOR
             = new Parcelable.Creator<PackageInfo>() {
         @Override
         public PackageInfo createFromParcel(Parcel source) {
diff --git a/core/java/android/content/pm/PackageInfoLite.java b/core/java/android/content/pm/PackageInfoLite.java
index b878a95..f5442ec 100644
--- a/core/java/android/content/pm/PackageInfoLite.java
+++ b/core/java/android/content/pm/PackageInfoLite.java
@@ -118,7 +118,7 @@
     }
 
     @UnsupportedAppUsage(maxTargetSdk = Build.VERSION_CODES.P, trackingBug = 115609023)
-    public static final Parcelable.Creator<PackageInfoLite> CREATOR
+    public static final @android.annotation.NonNull Parcelable.Creator<PackageInfoLite> CREATOR
             = new Parcelable.Creator<PackageInfoLite>() {
         public PackageInfoLite createFromParcel(Parcel source) {
             return new PackageInfoLite(source);
diff --git a/core/java/android/content/pm/PackageInstaller.java b/core/java/android/content/pm/PackageInstaller.java
index 0304f19..7b4dd19 100644
--- a/core/java/android/content/pm/PackageInstaller.java
+++ b/core/java/android/content/pm/PackageInstaller.java
@@ -1342,7 +1342,8 @@
          * @hide
          */
         public boolean areHiddenOptionsSet() {
-            return (installFlags & (PackageManager.INSTALL_ALLOW_DOWNGRADE
+            return (installFlags & (PackageManager.INSTALL_REQUEST_DOWNGRADE
+                    | PackageManager.INSTALL_ALLOW_DOWNGRADE
                     | PackageManager.INSTALL_DONT_KILL_APP
                     | PackageManager.INSTALL_INSTANT_APP
                     | PackageManager.INSTALL_FULL_APP
@@ -1447,20 +1448,49 @@
 
         /**
          * Request that rollbacks be enabled for the given upgrade.
+         *
+         * @removed
+         * @deprecated use {@link #setEnableRollback(boolean)} instead.
          * @hide
          */
+        @Deprecated
         @SystemApi
         public void setEnableRollback() {
             installFlags |= PackageManager.INSTALL_ENABLE_ROLLBACK;
         }
 
+        /**
+         * Request that rollbacks be enabled or disabled for the given upgrade.
+         *
+         * @param enable set to {@code true} to enable, {@code false} to disable
+         * @hide
+         */
+        @SystemApi
+        public void setEnableRollback(boolean enable) {
+            if (enable) {
+                installFlags |= PackageManager.INSTALL_ENABLE_ROLLBACK;
+            } else {
+                installFlags &= ~PackageManager.INSTALL_ENABLE_ROLLBACK;
+            }
+        }
+
+        /**
+         * @deprecated use {@link #setRequestDowngrade(boolean)}.
+         * {@hide}
+         */
+        @SystemApi
+        @Deprecated
+        public void setAllowDowngrade(boolean allowDowngrade) {
+            setRequestDowngrade(allowDowngrade);
+        }
+
         /** {@hide} */
         @SystemApi
-        public void setAllowDowngrade(boolean allowDowngrade) {
-            if (allowDowngrade) {
-                installFlags |= PackageManager.INSTALL_ALLOW_DOWNGRADE;
+        public void setRequestDowngrade(boolean requestDowngrade) {
+            if (requestDowngrade) {
+                installFlags |= PackageManager.INSTALL_REQUEST_DOWNGRADE;
             } else {
-                installFlags &= ~PackageManager.INSTALL_ALLOW_DOWNGRADE;
+                installFlags &= ~PackageManager.INSTALL_REQUEST_DOWNGRADE;
             }
         }
 
@@ -1981,11 +2011,23 @@
         /**
          * Get the value set in {@link SessionParams#setAllowDowngrade(boolean)}.
          *
+         * @deprecated use {@link #getRequestDowngrade()}.
          * @hide
          */
         @SystemApi
+        @Deprecated
         public boolean getAllowDowngrade() {
-            return (installFlags & PackageManager.INSTALL_ALLOW_DOWNGRADE) != 0;
+            return getRequestDowngrade();
+        }
+
+        /**
+         * Get the value set in {@link SessionParams#setRequestDowngrade(boolean)}.
+         *
+         * @hide
+         */
+        @SystemApi
+        public boolean getRequestDowngrade() {
+            return (installFlags & PackageManager.INSTALL_REQUEST_DOWNGRADE) != 0;
         }
 
         /**
@@ -2035,6 +2077,16 @@
         }
 
         /**
+         * Return whether rollback is enabled or disabled for the given upgrade.
+         *
+         * @hide
+         */
+        @SystemApi
+        public boolean getEnableRollback() {
+            return (installFlags & PackageManager.INSTALL_ENABLE_ROLLBACK) != 0;
+        }
+
+        /**
          * Get the value set in {@link SessionParams#setAllocateAggressive(boolean)}.
          *
          * @hide
@@ -2129,7 +2181,7 @@
          * Text description of the error code returned by {@code getStagedSessionErrorCode}, or
          * empty string if no error was encountered.
          */
-        public String getStagedSessionErrorMessage() {
+        public @NonNull String getStagedSessionErrorMessage() {
             checkSessionIsStaged();
             return mStagedSessionErrorMessage;
         }
diff --git a/core/java/android/content/pm/PackageManager.java b/core/java/android/content/pm/PackageManager.java
index a5464c2..d1ebcfd 100644
--- a/core/java/android/content/pm/PackageManager.java
+++ b/core/java/android/content/pm/PackageManager.java
@@ -710,7 +710,7 @@
             INSTALL_INTERNAL,
             INSTALL_FROM_ADB,
             INSTALL_ALL_USERS,
-            INSTALL_ALLOW_DOWNGRADE,
+            INSTALL_REQUEST_DOWNGRADE,
             INSTALL_GRANT_RUNTIME_PERMISSIONS,
             INSTALL_FORCE_VOLUME_UUID,
             INSTALL_FORCE_PERMISSION_PROMPT,
@@ -721,6 +721,7 @@
             INSTALL_VIRTUAL_PRELOAD,
             INSTALL_APEX,
             INSTALL_ENABLE_ROLLBACK,
+            INSTALL_ALLOW_DOWNGRADE,
     })
     @Retention(RetentionPolicy.SOURCE)
     public @interface InstallFlags {}
@@ -767,14 +768,21 @@
     public static final int INSTALL_ALL_USERS = 0x00000040;
 
     /**
-     * Flag parameter for {@link #installPackage} to indicate that it is okay
-     * to install an update to an app where the newly installed app has a lower
-     * version code than the currently installed app. This is permitted only if
-     * the currently installed app is marked debuggable.
+     * Flag parameter for {@link #installPackage} to indicate that an upgrade to a lower version
+     * of a package than currently installed has been requested.
+     *
+     * <p>Note that this flag doesn't guarantee that downgrade will be performed. That decision
+     * depends
+     * on whenever:
+     * <ul>
+     * <li>An app is debuggable.
+     * <li>Or a build is debuggable.
+     * <li>Or {@link #INSTALL_ALLOW_DOWNGRADE} is set.
+     * </ul>
      *
      * @hide
      */
-    public static final int INSTALL_ALLOW_DOWNGRADE = 0x00000080;
+    public static final int INSTALL_REQUEST_DOWNGRADE = 0x00000080;
 
     /**
      * Flag parameter for {@link #installPackage} to indicate that all runtime
@@ -865,6 +873,14 @@
      */
     public static final int INSTALL_DISABLE_VERIFICATION = 0x00080000;
 
+    /**
+     * Flag parameter for {@link #installPackage} to indicate that
+     * {@link #INSTALL_REQUEST_DOWNGRADE} should be allowed.
+     *
+     * @hide
+     */
+    public static final int INSTALL_ALLOW_DOWNGRADE = 0x00100000;
+
     /** @hide */
     @IntDef(flag = true, prefix = { "DONT_KILL_APP" }, value = {
             DONT_KILL_APP
@@ -3031,14 +3047,44 @@
     public static final int FLAG_PERMISSION_REVOKE_WHEN_REQUESTED =  1 << 7;
 
     /**
-     * Mask for all permission flags.
+     * Permission flag: The permission's usage should be made highly visible to the user
+     * when granted.
      *
      * @hide
      */
     @SystemApi
+    public static final int FLAG_PERMISSION_USER_SENSITIVE_WHEN_GRANTED =  1 << 8;
+
+    /**
+     * Permission flag: The permission's usage should be made highly visible to the user
+     * when denied.
+     *
+     * @hide
+     */
+    @SystemApi
+    public static final int FLAG_PERMISSION_USER_SENSITIVE_WHEN_DENIED =  1 << 9;
+
+    /**
+     * Mask for all permission flags present in Android P
+     *
+     * @deprecated This constant does not contain useful information and should never have been
+     * exposed. When checking permission flags always flag each flag explicitly and ignore all
+     * flags that do not matter for this particular code.
+     *
+     * @hide
+     */
+    @Deprecated
+    @SystemApi
     public static final int MASK_PERMISSION_FLAGS = 0xFF;
 
     /**
+     * Mask for all permission flags.
+     *
+     * @hide
+     */
+    public static final int MASK_PERMISSION_FLAGS_ALL = 0x3FF;
+
+    /**
      * Injected activity in app that forwards user to setting activity of that app.
      *
      * @hide
@@ -3745,6 +3791,8 @@
             FLAG_PERMISSION_REVOKE_ON_UPGRADE,
             FLAG_PERMISSION_SYSTEM_FIXED,
             FLAG_PERMISSION_GRANTED_BY_DEFAULT,
+            FLAG_PERMISSION_USER_SENSITIVE_WHEN_GRANTED,
+            FLAG_PERMISSION_USER_SENSITIVE_WHEN_DENIED,
             /*
             FLAG_PERMISSION_REVOKE_WHEN_REQUESED
             */
@@ -3819,7 +3867,8 @@
     @TestApi
     @RequiresPermission(anyOf = {
             android.Manifest.permission.GRANT_RUNTIME_PERMISSIONS,
-            android.Manifest.permission.REVOKE_RUNTIME_PERMISSIONS
+            android.Manifest.permission.REVOKE_RUNTIME_PERMISSIONS,
+            android.Manifest.permission.GET_RUNTIME_PERMISSIONS
     })
     public abstract @PermissionFlags int getPermissionFlags(String permissionName,
             String packageName, @NonNull UserHandle user);
@@ -6532,6 +6581,8 @@
             case FLAG_PERMISSION_USER_FIXED: return "USER_FIXED";
             case FLAG_PERMISSION_REVIEW_REQUIRED: return "REVIEW_REQUIRED";
             case FLAG_PERMISSION_REVOKE_WHEN_REQUESTED: return "REVOKE_WHEN_REQUESTED";
+            case FLAG_PERMISSION_USER_SENSITIVE_WHEN_GRANTED: return "USER_SENSITIVE_WHEN_GRANTED";
+            case FLAG_PERMISSION_USER_SENSITIVE_WHEN_DENIED: return "USER_SENSITIVE_WHEN_DENIED";
             default: return Integer.toString(flag);
         }
     }
diff --git a/core/java/android/content/pm/PackageManagerInternal.java b/core/java/android/content/pm/PackageManagerInternal.java
index 270e387..2c1842c 100644
--- a/core/java/android/content/pm/PackageManagerInternal.java
+++ b/core/java/android/content/pm/PackageManagerInternal.java
@@ -160,6 +160,14 @@
          * @return whether the default browser was successfully set.
          */
         boolean setDefaultBrowser(@Nullable String packageName, @UserIdInt int userId);
+
+        /**
+         * Set the package name of the default browser asynchronously.
+         *
+         * @param packageName package name of the default browser, or {@code null} to remove
+         * @param userId the user id
+         */
+        void setDefaultBrowserAsync(@Nullable String packageName, @UserIdInt int userId);
     }
 
     /**
diff --git a/core/java/android/content/pm/PackageParser.java b/core/java/android/content/pm/PackageParser.java
index 8924d2b..89c0690 100644
--- a/core/java/android/content/pm/PackageParser.java
+++ b/core/java/android/content/pm/PackageParser.java
@@ -45,6 +45,7 @@
 import android.annotation.IntRange;
 import android.annotation.NonNull;
 import android.annotation.Nullable;
+import android.annotation.StringRes;
 import android.annotation.TestApi;
 import android.annotation.UnsupportedAppUsage;
 import android.app.ActivityTaskManager;
@@ -3261,10 +3262,21 @@
     private boolean parsePermissionGroup(Package owner, int flags, Resources res,
             XmlResourceParser parser, String[] outError)
             throws XmlPullParserException, IOException {
-        PermissionGroup perm = new PermissionGroup(owner);
-
         TypedArray sa = res.obtainAttributes(parser,
                 com.android.internal.R.styleable.AndroidManifestPermissionGroup);
+
+        int requestDetailResourceId = sa.getResourceId(
+                com.android.internal.R.styleable.AndroidManifestPermissionGroup_requestDetail, 0);
+        int backgroundRequestResourceId = sa.getResourceId(
+                com.android.internal.R.styleable.AndroidManifestPermissionGroup_backgroundRequest,
+                0);
+        int backgroundRequestDetailResourceId = sa.getResourceId(
+                com.android.internal.R.styleable
+                        .AndroidManifestPermissionGroup_backgroundRequestDetail, 0);
+
+        PermissionGroup perm = new PermissionGroup(owner, requestDetailResourceId,
+                backgroundRequestResourceId, backgroundRequestDetailResourceId);
+
         if (!parsePackageItemInfo(owner, perm.info, outError,
                 "<permission-group>", sa, true /*nameRequired*/,
                 com.android.internal.R.styleable.AndroidManifestPermissionGroup_name,
@@ -3283,14 +3295,6 @@
                 0);
         perm.info.requestRes = sa.getResourceId(
                 com.android.internal.R.styleable.AndroidManifestPermissionGroup_request, 0);
-        perm.info.requestDetailResourceId = sa.getResourceId(
-                com.android.internal.R.styleable.AndroidManifestPermissionGroup_requestDetail, 0);
-        perm.info.backgroundRequestResourceId = sa.getResourceId(
-                com.android.internal.R.styleable.AndroidManifestPermissionGroup_backgroundRequest,
-                0);
-        perm.info.backgroundRequestDetailResourceId = sa.getResourceId(
-                com.android.internal.R.styleable
-                        .AndroidManifestPermissionGroup_backgroundRequestDetail, 0);
         perm.info.flags = sa.getInt(
                 com.android.internal.R.styleable.AndroidManifestPermissionGroup_permissionGroupFlags, 0);
         perm.info.priority = sa.getInt(
@@ -3316,7 +3320,20 @@
         TypedArray sa = res.obtainAttributes(parser,
                 com.android.internal.R.styleable.AndroidManifestPermission);
 
-        Permission perm = new Permission(owner);
+        String backgroundPermission = null;
+        if (sa.hasValue(
+                com.android.internal.R.styleable.AndroidManifestPermission_backgroundPermission)) {
+            if ("android".equals(owner.packageName)) {
+                backgroundPermission = sa.getNonResourceString(
+                        com.android.internal.R.styleable
+                                .AndroidManifestPermission_backgroundPermission);
+            } else {
+                Slog.w(TAG, owner.packageName + " defines a background permission. Only the "
+                        + "'android' package can do that.");
+            }
+        }
+
+        Permission perm = new Permission(owner, backgroundPermission);
         if (!parsePackageItemInfo(owner, perm.info, outError,
                 "<permission>", sa, true /*nameRequired*/,
                 com.android.internal.R.styleable.AndroidManifestPermission_name,
@@ -3345,19 +3362,6 @@
         perm.info.requestRes = sa.getResourceId(
                 com.android.internal.R.styleable.AndroidManifestPermission_request, 0);
 
-        if (sa.hasValue(
-                com.android.internal.R.styleable.AndroidManifestPermission_backgroundPermission)) {
-            if ("android".equals(owner.packageName)) {
-                perm.info.backgroundPermission = sa.getNonResourceString(
-                        com.android.internal.R.styleable
-                                .AndroidManifestPermission_backgroundPermission);
-            } else {
-                Slog.w(TAG, owner.packageName + " defines permission '" + perm.info.name
-                        + "' with a background permission. Only the 'android' package can do "
-                        + "that.");
-            }
-        }
-
         perm.info.protectionLevel = sa.getInt(
                 com.android.internal.R.styleable.AndroidManifestPermission_protectionLevel,
                 PermissionInfo.PROTECTION_NORMAL);
@@ -3400,7 +3404,7 @@
     private boolean parsePermissionTree(Package owner, Resources res,
             XmlResourceParser parser, String[] outError)
         throws XmlPullParserException, IOException {
-        Permission perm = new Permission(owner);
+        Permission perm = new Permission(owner, (String) null);
 
         TypedArray sa = res.obtainAttributes(parser,
                 com.android.internal.R.styleable.AndroidManifestPermissionTree);
@@ -3756,6 +3760,12 @@
             ai.privateFlags |= ApplicationInfo.PRIVATE_FLAG_ALLOW_CLEAR_USER_DATA_ON_FAILED_RESTORE;
         }
 
+        if (sa.getBoolean(
+                R.styleable.AndroidManifestApplication_allowAudioPlaybackCapture,
+                owner.applicationInfo.targetSdkVersion >= Build.VERSION_CODES.Q)) {
+            ai.privateFlags |= ApplicationInfo.PRIVATE_FLAG_ALLOW_AUDIO_PLAYBACK_CAPTURE;
+        }
+
         ai.maxAspectRatio = sa.getFloat(R.styleable.AndroidManifestApplication_maxAspectRatio, 0);
         ai.minAspectRatio = sa.getFloat(R.styleable.AndroidManifestApplication_minAspectRatio, 0);
 
@@ -6402,7 +6412,7 @@
             this.pastSigningCertificates = in.createTypedArray(Signature.CREATOR);
         }
 
-        public static final Creator<SigningDetails> CREATOR = new Creator<SigningDetails>() {
+        public static final @android.annotation.NonNull Creator<SigningDetails> CREATOR = new Creator<SigningDetails>() {
             @Override
             public SigningDetails createFromParcel(Parcel source) {
                 if (source.readBoolean()) {
@@ -7603,9 +7613,12 @@
         @UnsupportedAppUsage
         public PermissionGroup group;
 
-        public Permission(Package _owner) {
-            super(_owner);
-            info = new PermissionInfo();
+        /**
+         * @hide
+         */
+        public Permission(Package owner, @Nullable String backgroundPermission) {
+            super(owner);
+            info = new PermissionInfo(backgroundPermission);
         }
 
         @UnsupportedAppUsage
@@ -7670,9 +7683,12 @@
         @UnsupportedAppUsage
         public final PermissionGroupInfo info;
 
-        public PermissionGroup(Package _owner) {
-            super(_owner);
-            info = new PermissionGroupInfo();
+        public PermissionGroup(Package owner, @StringRes int requestDetailResourceId,
+                @StringRes int backgroundRequestResourceId,
+                @StringRes int backgroundRequestDetailResourceId) {
+            super(owner);
+            info = new PermissionGroupInfo(requestDetailResourceId, backgroundRequestResourceId,
+                    backgroundRequestDetailResourceId);
         }
 
         public PermissionGroup(Package _owner, PermissionGroupInfo _info) {
@@ -8438,6 +8454,21 @@
     public static PackageInfo generatePackageInfoFromApex(File apexFile, boolean collectCerts)
             throws PackageParserException {
         PackageInfo pi = new PackageInfo();
+        int parseFlags = 0;
+        if (collectCerts) {
+            parseFlags |= PARSE_COLLECT_CERTIFICATES;
+            try {
+                if (apexFile.getCanonicalPath().startsWith("/system")) {
+                    // Don't need verify the APK integrity of APEXes on /system, just like
+                    // we don't do that for APKs.
+                    // TODO(b/126514108): we may be able to do this for APEXes on /data as well.
+                    parseFlags |= PARSE_IS_SYSTEM_DIR;
+                }
+            } catch (IOException e) {
+                throw new PackageParserException(INSTALL_PARSE_FAILED_UNEXPECTED_EXCEPTION,
+                        "Failed to get path for " + apexFile.getPath(), e);
+            }
+        }
 
         // TODO(b/123086053) properly fill in the ApplicationInfo with data from AndroidManifest
         // Add ApplicationInfo to the PackageInfo.
@@ -8452,8 +8483,7 @@
 
         // TODO(b/123052859): We should avoid these repeated calls to parseApkLite each time
         // we want to generate information for APEX modules.
-        PackageParser.ApkLite apk = PackageParser.parseApkLite(apexFile,
-            collectCerts ? PackageParser.PARSE_COLLECT_CERTIFICATES : 0);
+        PackageParser.ApkLite apk = PackageParser.parseApkLite(apexFile, parseFlags);
 
         pi.packageName = apk.packageName;
         ai.packageName = apk.packageName;
diff --git a/core/java/android/content/pm/PackageStats.java b/core/java/android/content/pm/PackageStats.java
index d3e86a3..b0fecfa 100644
--- a/core/java/android/content/pm/PackageStats.java
+++ b/core/java/android/content/pm/PackageStats.java
@@ -79,7 +79,7 @@
     /** Size of the package's OBBs placed on external media. */
     public long externalObbSize;
 
-    public static final Parcelable.Creator<PackageStats> CREATOR
+    public static final @android.annotation.NonNull Parcelable.Creator<PackageStats> CREATOR
             = new Parcelable.Creator<PackageStats>() {
         public PackageStats createFromParcel(Parcel in) {
             return new PackageStats(in);
diff --git a/core/java/android/content/pm/PathPermission.java b/core/java/android/content/pm/PathPermission.java
index 7e49d7d..11c9a7d 100644
--- a/core/java/android/content/pm/PathPermission.java
+++ b/core/java/android/content/pm/PathPermission.java
@@ -55,7 +55,7 @@
         mWritePermission = src.readString();
     }
     
-    public static final Parcelable.Creator<PathPermission> CREATOR
+    public static final @android.annotation.NonNull Parcelable.Creator<PathPermission> CREATOR
             = new Parcelable.Creator<PathPermission>() {
         public PathPermission createFromParcel(Parcel source) {
             return new PathPermission(source);
diff --git a/core/java/android/content/pm/PermissionGroupInfo.java b/core/java/android/content/pm/PermissionGroupInfo.java
index f21612a..e65e742 100644
--- a/core/java/android/content/pm/PermissionGroupInfo.java
+++ b/core/java/android/content/pm/PermissionGroupInfo.java
@@ -16,12 +16,20 @@
 
 package android.content.pm;
 
+import static android.content.res.Resources.ID_NULL;
+
+import android.annotation.IntDef;
+import android.annotation.NonNull;
+import android.annotation.Nullable;
 import android.annotation.StringRes;
 import android.annotation.SystemApi;
 import android.os.Parcel;
 import android.os.Parcelable;
 import android.text.TextUtils;
 
+import java.lang.annotation.Retention;
+import java.lang.annotation.RetentionPolicy;
+
 /**
  * Information you can retrieve about a particular security permission
  * group known to the system.  This corresponds to information collected from the
@@ -33,7 +41,7 @@
      * permission's description.  From the "description" attribute or,
      * if not set, 0.
      */
-    public int descriptionRes;
+    public @StringRes int descriptionRes;
 
     /**
      * A string resource identifier (in the package's resources) used to request the permissions.
@@ -54,7 +62,7 @@
      * @hide
      */
     @SystemApi
-    public @StringRes int requestDetailResourceId;
+    public final @StringRes int requestDetailResourceId;
 
     /**
      * A string resource identifier (in the package's resources) used when requesting background
@@ -66,7 +74,7 @@
      * @hide
      */
     @SystemApi
-    public @StringRes int backgroundRequestResourceId;
+    public final @StringRes int backgroundRequestResourceId;
 
     /**
      * A string resource identifier (in the package's resources) used as subtitle when requesting
@@ -78,7 +86,7 @@
      * @hide
      */
     @SystemApi
-    public @StringRes int backgroundRequestDetailResourceId;
+    public final @StringRes int backgroundRequestDetailResourceId;
 
     /**
      * The description string provided in the AndroidManifest file, if any.  You
@@ -86,7 +94,7 @@
      * is in a resource.  You probably want
      * {@link PermissionInfo#loadDescription} instead.
      */
-    public CharSequence nonLocalizedDescription;
+    public @Nullable CharSequence nonLocalizedDescription;
 
     /**
      * Flag for {@link #flags}, corresponding to <code>personalInfo</code>
@@ -94,21 +102,48 @@
      */
     public static final int FLAG_PERSONAL_INFO = 1<<0;
 
+    /** @hide */
+    @IntDef(flag = true, prefix = { "FLAG_" }, value = {
+            FLAG_PERSONAL_INFO,
+    })
+    @Retention(RetentionPolicy.SOURCE)
+    public @interface Flags {}
+
     /**
      * Additional flags about this group as given by
      * {@link android.R.attr#permissionGroupFlags}.
      */
-    public int flags;
+    public @Flags int flags;
 
     /**
      * Prioritization of this group, for visually sorting with other groups.
      */
     public int priority;
 
-    public PermissionGroupInfo() {
+    /**
+     * @hide
+     */
+    public PermissionGroupInfo(@StringRes int requestDetailResourceId,
+            @StringRes int backgroundRequestResourceId,
+            @StringRes int backgroundRequestDetailResourceId) {
+        this.requestDetailResourceId = requestDetailResourceId;
+        this.backgroundRequestResourceId = backgroundRequestResourceId;
+        this.backgroundRequestDetailResourceId = backgroundRequestDetailResourceId;
     }
 
-    public PermissionGroupInfo(PermissionGroupInfo orig) {
+    /**
+     * @deprecated Should only be created by the system.
+     */
+    @Deprecated
+    public PermissionGroupInfo() {
+        this(ID_NULL, ID_NULL, ID_NULL);
+    }
+
+    /**
+     * @deprecated Should only be created by the system.
+     */
+    @Deprecated
+    public PermissionGroupInfo(@NonNull PermissionGroupInfo orig) {
         super(orig);
         descriptionRes = orig.descriptionRes;
         requestRes = orig.requestRes;
@@ -131,7 +166,7 @@
      * @return Returns a CharSequence containing the permission's description.
      * If there is no description, null is returned.
      */
-    public CharSequence loadDescription(PackageManager pm) {
+    public @Nullable CharSequence loadDescription(@NonNull PackageManager pm) {
         if (nonLocalizedDescription != null) {
             return nonLocalizedDescription;
         }
@@ -166,7 +201,7 @@
         dest.writeInt(priority);
     }
 
-    public static final Creator<PermissionGroupInfo> CREATOR =
+    public static final @NonNull Creator<PermissionGroupInfo> CREATOR =
             new Creator<PermissionGroupInfo>() {
         public PermissionGroupInfo createFromParcel(Parcel source) {
             return new PermissionGroupInfo(source);
diff --git a/core/java/android/content/pm/PermissionInfo.java b/core/java/android/content/pm/PermissionInfo.java
index e245234..6a41f33 100644
--- a/core/java/android/content/pm/PermissionInfo.java
+++ b/core/java/android/content/pm/PermissionInfo.java
@@ -17,6 +17,9 @@
 package android.content.pm;
 
 import android.annotation.IntDef;
+import android.annotation.NonNull;
+import android.annotation.Nullable;
+import android.annotation.StringRes;
 import android.annotation.SystemApi;
 import android.annotation.TestApi;
 import android.annotation.UnsupportedAppUsage;
@@ -300,7 +303,7 @@
      * The group this permission is a part of, as per
      * {@link android.R.attr#permissionGroup}.
      */
-    public String group;
+    public @Nullable String group;
 
     /**
      * Flag for {@link #flags}, corresponding to <code>costsMoney</code>
@@ -322,18 +325,27 @@
      */
     public static final int FLAG_INSTALLED = 1<<30;
 
+    /** @hide */
+    @IntDef(flag = true, prefix = { "FLAG_" }, value = {
+            FLAG_COSTS_MONEY,
+            FLAG_INSTALLED,
+            FLAG_REMOVED
+    })
+    @Retention(RetentionPolicy.SOURCE)
+    public @interface Flags {}
+
     /**
      * Additional flags about this permission as given by
      * {@link android.R.attr#permissionFlags}.
      */
-    public int flags;
+    public @Flags int flags;
 
     /**
      * A string resource identifier (in the package's resources) of this
      * permission's description.  From the "description" attribute or,
      * if not set, 0.
      */
-    public int descriptionRes;
+    public @StringRes int descriptionRes;
 
     /**
      * A string resource identifier (in the package's resources) used to request the permissions.
@@ -342,7 +354,7 @@
      * @hide
      */
     @SystemApi
-    public int requestRes;
+    public @StringRes int requestRes;
 
     /**
      * Some permissions only grant access while the app is in foreground. Some of these permissions
@@ -357,7 +369,7 @@
      */
     @SystemApi
     @TestApi
-    public String backgroundPermission;
+    public final @Nullable String backgroundPermission;
 
     /**
      * The description string provided in the AndroidManifest file, if any.  You
@@ -365,7 +377,7 @@
      * is in a resource.  You probably want
      * {@link PermissionInfo#loadDescription} instead.
      */
-    public CharSequence nonLocalizedDescription;
+    public @Nullable CharSequence nonLocalizedDescription;
 
     /** @hide */
     public static int fixProtectionLevel(int level) {
@@ -383,7 +395,7 @@
 
     /** @hide */
     @UnsupportedAppUsage
-    public static String protectionToString(int level) {
+    public static @NonNull String protectionToString(int level) {
         String protLevel = "????";
         switch (level & PROTECTION_MASK_BASE) {
             case PermissionInfo.PROTECTION_DANGEROUS:
@@ -456,10 +468,26 @@
         return protLevel;
     }
 
-    public PermissionInfo() {
+    /**
+     * @hide
+     */
+    public PermissionInfo(@Nullable String backgroundPermission) {
+        this.backgroundPermission = backgroundPermission;
     }
 
-    public PermissionInfo(PermissionInfo orig) {
+    /**
+     * @deprecated Should only be created by the system.
+     */
+    @Deprecated
+    public PermissionInfo() {
+        this((String) null);
+    }
+
+    /**
+     * @deprecated Should only be created by the system.
+     */
+    @Deprecated
+    public PermissionInfo(@NonNull PermissionInfo orig) {
         super(orig);
         protectionLevel = orig.protectionLevel;
         flags = orig.flags;
@@ -481,7 +509,7 @@
      * @return Returns a CharSequence containing the permission's description.
      * If there is no description, null is returned.
      */
-    public CharSequence loadDescription(PackageManager pm) {
+    public @Nullable CharSequence loadDescription(@NonNull PackageManager pm) {
         if (nonLocalizedDescription != null) {
             return nonLocalizedDescription;
         }
@@ -551,7 +579,7 @@
         return (protectionLevel & PermissionInfo.PROTECTION_FLAG_APPOP) != 0;
     }
 
-    public static final Creator<PermissionInfo> CREATOR =
+    public static final @NonNull Creator<PermissionInfo> CREATOR =
         new Creator<PermissionInfo>() {
         @Override
         public PermissionInfo createFromParcel(Parcel source) {
diff --git a/core/java/android/content/pm/ProviderInfo.java b/core/java/android/content/pm/ProviderInfo.java
index f06a628..07d42dc 100644
--- a/core/java/android/content/pm/ProviderInfo.java
+++ b/core/java/android/content/pm/ProviderInfo.java
@@ -158,7 +158,7 @@
         out.writeInt(isSyncable ? 1 : 0);
     }
 
-    public static final Parcelable.Creator<ProviderInfo> CREATOR
+    public static final @android.annotation.NonNull Parcelable.Creator<ProviderInfo> CREATOR
             = new Parcelable.Creator<ProviderInfo>() {
         public ProviderInfo createFromParcel(Parcel in) {
             return new ProviderInfo(in);
diff --git a/core/java/android/content/pm/ResolveInfo.java b/core/java/android/content/pm/ResolveInfo.java
index 894de94..1734182 100644
--- a/core/java/android/content/pm/ResolveInfo.java
+++ b/core/java/android/content/pm/ResolveInfo.java
@@ -445,7 +445,7 @@
         dest.writeInt(isInstantAppAvailable ? 1 : 0);
     }
 
-    public static final Creator<ResolveInfo> CREATOR
+    public static final @android.annotation.NonNull Creator<ResolveInfo> CREATOR
             = new Creator<ResolveInfo>() {
         public ResolveInfo createFromParcel(Parcel source) {
             return new ResolveInfo(source);
diff --git a/core/java/android/content/pm/ServiceInfo.java b/core/java/android/content/pm/ServiceInfo.java
index 4a2f800..cd40c95 100644
--- a/core/java/android/content/pm/ServiceInfo.java
+++ b/core/java/android/content/pm/ServiceInfo.java
@@ -217,7 +217,7 @@
         dest.writeInt(mForegroundServiceType);
     }
 
-    public static final Creator<ServiceInfo> CREATOR =
+    public static final @android.annotation.NonNull Creator<ServiceInfo> CREATOR =
         new Creator<ServiceInfo>() {
         public ServiceInfo createFromParcel(Parcel source) {
             return new ServiceInfo(source);
diff --git a/core/java/android/content/pm/SharedLibraryInfo.java b/core/java/android/content/pm/SharedLibraryInfo.java
index 35609c9..13c49a0 100644
--- a/core/java/android/content/pm/SharedLibraryInfo.java
+++ b/core/java/android/content/pm/SharedLibraryInfo.java
@@ -342,7 +342,7 @@
         }
     }
 
-    public static final Parcelable.Creator<SharedLibraryInfo> CREATOR =
+    public static final @android.annotation.NonNull Parcelable.Creator<SharedLibraryInfo> CREATOR =
             new Parcelable.Creator<SharedLibraryInfo>() {
         public SharedLibraryInfo createFromParcel(Parcel source) {
             return new SharedLibraryInfo(source);
diff --git a/core/java/android/content/pm/ShortcutInfo.java b/core/java/android/content/pm/ShortcutInfo.java
index e674b8b..7b61807 100644
--- a/core/java/android/content/pm/ShortcutInfo.java
+++ b/core/java/android/content/pm/ShortcutInfo.java
@@ -22,11 +22,13 @@
 import android.annotation.TestApi;
 import android.annotation.UnsupportedAppUsage;
 import android.annotation.UserIdInt;
+import android.app.Notification;
 import android.app.Person;
 import android.app.TaskStackBuilder;
 import android.content.ComponentName;
 import android.content.Context;
 import android.content.Intent;
+import android.content.LocusId;
 import android.content.pm.LauncherApps.ShortcutQuery;
 import android.content.res.Resources;
 import android.content.res.Resources.NotFoundException;
@@ -41,6 +43,7 @@
 import android.text.TextUtils;
 import android.util.ArraySet;
 import android.util.Log;
+import android.view.contentcapture.ContentCaptureContext;
 
 import com.android.internal.annotations.VisibleForTesting;
 import com.android.internal.util.Preconditions;
@@ -354,6 +357,9 @@
     @Nullable
     private Person[] mPersons;
 
+    @Nullable
+    private LocusId mLocusId;
+
     private int mRank;
 
     /**
@@ -415,6 +421,8 @@
         }
         mRank = b.mRank;
         mExtras = b.mExtras;
+        mLocusId = b.mLocusId;
+
         updateTimestamp();
     }
 
@@ -521,6 +529,7 @@
         mFlags = source.mFlags;
         mLastChangedTimestamp = source.mLastChangedTimestamp;
         mDisabledReason = source.mDisabledReason;
+        mLocusId = source.mLocusId;
 
         // Just always keep it since it's cheep.
         mIconResId = source.mIconResId;
@@ -876,6 +885,10 @@
         if (source.mExtras != null) {
             mExtras = source.mExtras;
         }
+
+        if (source.mLocusId != null) {
+            mLocusId = source.mLocusId;
+        }
     }
 
     /**
@@ -941,6 +954,8 @@
 
         private PersistableBundle mExtras;
 
+        private LocusId mLocusId;
+
         /**
          * Old style constructor.
          * @hide
@@ -973,6 +988,19 @@
         }
 
         /**
+         * Sets the {@link LocusId} associated with this shortcut.
+         *
+         * <p>This method should be called when the {@link LocusId} is used in other places (such
+         * as {@link Notification} and {@link ContentCaptureContext}) so the device's intelligence
+         * services can correlate them.
+         */
+        @NonNull
+        public Builder setLocusId(@NonNull LocusId locusId) {
+            mLocusId = Preconditions.checkNotNull(locusId, "locusId cannot be null");
+            return this;
+        }
+
+        /**
          * Sets the target activity.  A shortcut will be shown along with this activity's icon
          * on the launcher.
          *
@@ -1295,6 +1323,17 @@
     }
 
     /**
+     * Gets the {@link LocusId} associated with this shortcut.
+     *
+     * <p>Used by the device's intelligence services to correlate objects (such as
+     * {@link Notification} and {@link ContentCaptureContext}) that are correlated.
+     */
+    @Nullable
+    public LocusId getLocusId() {
+        return mLocusId;
+    }
+
+    /**
      * Return the package name of the publisher app.
      */
     @NonNull
@@ -1999,6 +2038,7 @@
         }
 
         mPersons = source.readParcelableArray(cl, Person.class);
+        mLocusId = source.readParcelable(cl);
     }
 
     @Override
@@ -2048,9 +2088,10 @@
         }
 
         dest.writeParcelableArray(mPersons, flags);
+        dest.writeParcelable(mLocusId, flags);
     }
 
-    public static final Creator<ShortcutInfo> CREATOR =
+    public static final @android.annotation.NonNull Creator<ShortcutInfo> CREATOR =
             new Creator<ShortcutInfo>() {
                 public ShortcutInfo createFromParcel(Parcel source) {
                     return new ShortcutInfo(source);
@@ -2263,6 +2304,10 @@
             sb.append(mBitmapPath);
         }
 
+        if (mLocusId != null) {
+            sb.append("locusId="); sb.append(mLocusId); // LocusId.toString() is PII-safe.
+        }
+
         sb.append("}");
         return sb.toString();
     }
@@ -2276,7 +2321,7 @@
             Set<String> categories, Intent[] intentsWithExtras, int rank, PersistableBundle extras,
             long lastChangedTimestamp,
             int flags, int iconResId, String iconResName, String bitmapPath, int disabledReason,
-            Person[] persons) {
+            Person[] persons, LocusId locusId) {
         mUserId = userId;
         mId = id;
         mPackageName = packageName;
@@ -2303,5 +2348,6 @@
         mBitmapPath = bitmapPath;
         mDisabledReason = disabledReason;
         mPersons = persons;
+        mLocusId = locusId;
     }
 }
diff --git a/core/java/android/content/pm/ShortcutManager.java b/core/java/android/content/pm/ShortcutManager.java
index bd327b0..2287243 100644
--- a/core/java/android/content/pm/ShortcutManager.java
+++ b/core/java/android/content/pm/ShortcutManager.java
@@ -624,7 +624,7 @@
             dest.writeParcelable(mTargetComponent, flags);
         }
 
-        public static final Parcelable.Creator<ShareShortcutInfo> CREATOR =
+        public static final @android.annotation.NonNull Parcelable.Creator<ShareShortcutInfo> CREATOR =
                 new Parcelable.Creator<ShareShortcutInfo>() {
                     public ShareShortcutInfo createFromParcel(Parcel in) {
                         return new ShareShortcutInfo(in);
diff --git a/core/java/android/content/pm/Signature.java b/core/java/android/content/pm/Signature.java
index 349bb69..25a4dca 100644
--- a/core/java/android/content/pm/Signature.java
+++ b/core/java/android/content/pm/Signature.java
@@ -262,7 +262,7 @@
         dest.writeByteArray(mSignature);
     }
 
-    public static final Parcelable.Creator<Signature> CREATOR
+    public static final @android.annotation.NonNull Parcelable.Creator<Signature> CREATOR
             = new Parcelable.Creator<Signature>() {
         public Signature createFromParcel(Parcel source) {
             return new Signature(source);
diff --git a/core/java/android/content/pm/SigningInfo.java b/core/java/android/content/pm/SigningInfo.java
index ef87403..d14be9c 100644
--- a/core/java/android/content/pm/SigningInfo.java
+++ b/core/java/android/content/pm/SigningInfo.java
@@ -124,7 +124,7 @@
         mSigningDetails.writeToParcel(dest, parcelableFlags);
     }
 
-    public static final Parcelable.Creator<SigningInfo> CREATOR =
+    public static final @android.annotation.NonNull Parcelable.Creator<SigningInfo> CREATOR =
             new Parcelable.Creator<SigningInfo>() {
         @Override
         public SigningInfo createFromParcel(Parcel source) {
diff --git a/core/java/android/content/pm/SuspendDialogInfo.java b/core/java/android/content/pm/SuspendDialogInfo.java
index 53b52f5..db8f8c2 100644
--- a/core/java/android/content/pm/SuspendDialogInfo.java
+++ b/core/java/android/content/pm/SuspendDialogInfo.java
@@ -261,7 +261,7 @@
         mNeutralButtonTextResId = b.mNeutralButtonTextResId;
     }
 
-    public static final Creator<SuspendDialogInfo> CREATOR = new Creator<SuspendDialogInfo>() {
+    public static final @android.annotation.NonNull Creator<SuspendDialogInfo> CREATOR = new Creator<SuspendDialogInfo>() {
         @Override
         public SuspendDialogInfo createFromParcel(Parcel source) {
             return new SuspendDialogInfo(source);
diff --git a/core/java/android/content/pm/UserInfo.java b/core/java/android/content/pm/UserInfo.java
index b75ed35..2b1b32e 100644
--- a/core/java/android/content/pm/UserInfo.java
+++ b/core/java/android/content/pm/UserInfo.java
@@ -289,7 +289,7 @@
     }
 
     @UnsupportedAppUsage
-    public static final Parcelable.Creator<UserInfo> CREATOR
+    public static final @android.annotation.NonNull Parcelable.Creator<UserInfo> CREATOR
             = new Parcelable.Creator<UserInfo>() {
         public UserInfo createFromParcel(Parcel source) {
             return new UserInfo(source);
diff --git a/core/java/android/content/pm/VerificationParams.java b/core/java/android/content/pm/VerificationParams.java
index f90d295..f072167 100644
--- a/core/java/android/content/pm/VerificationParams.java
+++ b/core/java/android/content/pm/VerificationParams.java
@@ -198,7 +198,7 @@
         mInstallerUid = source.readInt();
     }
 
-    public static final Parcelable.Creator<VerificationParams> CREATOR =
+    public static final @android.annotation.NonNull Parcelable.Creator<VerificationParams> CREATOR =
             new Parcelable.Creator<VerificationParams>() {
         public VerificationParams createFromParcel(Parcel source) {
                 return new VerificationParams(source);
diff --git a/core/java/android/content/pm/VerifierDeviceIdentity.java b/core/java/android/content/pm/VerifierDeviceIdentity.java
index 90be6f31..f29aaec 100644
--- a/core/java/android/content/pm/VerifierDeviceIdentity.java
+++ b/core/java/android/content/pm/VerifierDeviceIdentity.java
@@ -230,7 +230,7 @@
         dest.writeLong(mIdentity);
     }
 
-    public static final Parcelable.Creator<VerifierDeviceIdentity> CREATOR
+    public static final @android.annotation.NonNull Parcelable.Creator<VerifierDeviceIdentity> CREATOR
             = new Parcelable.Creator<VerifierDeviceIdentity>() {
         public VerifierDeviceIdentity createFromParcel(Parcel source) {
             return new VerifierDeviceIdentity(source);
diff --git a/core/java/android/content/pm/VerifierInfo.java b/core/java/android/content/pm/VerifierInfo.java
index b4e72e6..224ca62 100644
--- a/core/java/android/content/pm/VerifierInfo.java
+++ b/core/java/android/content/pm/VerifierInfo.java
@@ -72,7 +72,7 @@
         dest.writeSerializable(publicKey);
     }
 
-    public static final Parcelable.Creator<VerifierInfo> CREATOR
+    public static final @android.annotation.NonNull Parcelable.Creator<VerifierInfo> CREATOR
             = new Parcelable.Creator<VerifierInfo>() {
         public VerifierInfo createFromParcel(Parcel source) {
             return new VerifierInfo(source);
diff --git a/core/java/android/content/pm/VersionedPackage.java b/core/java/android/content/pm/VersionedPackage.java
index 3953466..3e22eb2 100644
--- a/core/java/android/content/pm/VersionedPackage.java
+++ b/core/java/android/content/pm/VersionedPackage.java
@@ -106,7 +106,7 @@
         parcel.writeLong(mVersionCode);
     }
 
-    public static final Creator<VersionedPackage> CREATOR = new Creator<VersionedPackage>() {
+    public static final @android.annotation.NonNull Creator<VersionedPackage> CREATOR = new Creator<VersionedPackage>() {
         @Override
         public VersionedPackage createFromParcel(Parcel source) {
             return new VersionedPackage(source);
diff --git a/core/java/android/content/pm/permission/RuntimePermissionPresentationInfo.java b/core/java/android/content/pm/permission/RuntimePermissionPresentationInfo.java
index 9fa863c..97312c44 100644
--- a/core/java/android/content/pm/permission/RuntimePermissionPresentationInfo.java
+++ b/core/java/android/content/pm/permission/RuntimePermissionPresentationInfo.java
@@ -101,7 +101,7 @@
         parcel.writeInt(mFlags);
     }
 
-    public static final Creator<RuntimePermissionPresentationInfo> CREATOR =
+    public static final @android.annotation.NonNull Creator<RuntimePermissionPresentationInfo> CREATOR =
             new Creator<RuntimePermissionPresentationInfo>() {
         public RuntimePermissionPresentationInfo createFromParcel(Parcel source) {
             return new RuntimePermissionPresentationInfo(source);
diff --git a/core/java/android/content/res/AssetFileDescriptor.java b/core/java/android/content/res/AssetFileDescriptor.java
index b6cbf08..2ba5579 100644
--- a/core/java/android/content/res/AssetFileDescriptor.java
+++ b/core/java/android/content/res/AssetFileDescriptor.java
@@ -370,7 +370,7 @@
         }
     }
 
-    public static final Parcelable.Creator<AssetFileDescriptor> CREATOR
+    public static final @android.annotation.NonNull Parcelable.Creator<AssetFileDescriptor> CREATOR
             = new Parcelable.Creator<AssetFileDescriptor>() {
         public AssetFileDescriptor createFromParcel(Parcel in) {
             return new AssetFileDescriptor(in);
diff --git a/core/java/android/content/res/ColorStateList.java b/core/java/android/content/res/ColorStateList.java
index 16b9726..b5b097b 100644
--- a/core/java/android/content/res/ColorStateList.java
+++ b/core/java/android/content/res/ColorStateList.java
@@ -727,7 +727,7 @@
         dest.writeIntArray(mColors);
     }
 
-    public static final Parcelable.Creator<ColorStateList> CREATOR =
+    public static final @android.annotation.NonNull Parcelable.Creator<ColorStateList> CREATOR =
             new Parcelable.Creator<ColorStateList>() {
         @Override
         public ColorStateList[] newArray(int size) {
diff --git a/core/java/android/content/res/CompatibilityInfo.java b/core/java/android/content/res/CompatibilityInfo.java
index 7d101b8..a99a0b5 100644
--- a/core/java/android/content/res/CompatibilityInfo.java
+++ b/core/java/android/content/res/CompatibilityInfo.java
@@ -613,7 +613,7 @@
     }
 
     @UnsupportedAppUsage(maxTargetSdk = Build.VERSION_CODES.P, trackingBug = 115609023)
-    public static final Parcelable.Creator<CompatibilityInfo> CREATOR
+    public static final @android.annotation.NonNull Parcelable.Creator<CompatibilityInfo> CREATOR
             = new Parcelable.Creator<CompatibilityInfo>() {
         @Override
         public CompatibilityInfo createFromParcel(Parcel source) {
diff --git a/core/java/android/content/res/Configuration.java b/core/java/android/content/res/Configuration.java
index 8a92017..8b02cae 100644
--- a/core/java/android/content/res/Configuration.java
+++ b/core/java/android/content/res/Configuration.java
@@ -1829,7 +1829,7 @@
         seq = source.readInt();
     }
 
-    public static final Parcelable.Creator<Configuration> CREATOR
+    public static final @android.annotation.NonNull Parcelable.Creator<Configuration> CREATOR
             = new Parcelable.Creator<Configuration>() {
         public Configuration createFromParcel(Parcel source) {
             return new Configuration(source);
diff --git a/core/java/android/content/res/ObbInfo.java b/core/java/android/content/res/ObbInfo.java
index 1d10b4f..8af27ca 100644
--- a/core/java/android/content/res/ObbInfo.java
+++ b/core/java/android/content/res/ObbInfo.java
@@ -88,7 +88,7 @@
         dest.writeByteArray(salt);
     }
 
-    public static final Parcelable.Creator<ObbInfo> CREATOR
+    public static final @android.annotation.NonNull Parcelable.Creator<ObbInfo> CREATOR
             = new Parcelable.Creator<ObbInfo>() {
         public ObbInfo createFromParcel(Parcel source) {
             return new ObbInfo(source);
diff --git a/core/java/android/content/res/Resources.java b/core/java/android/content/res/Resources.java
index a2ae994..c855d45 100644
--- a/core/java/android/content/res/Resources.java
+++ b/core/java/android/content/res/Resources.java
@@ -1782,10 +1782,16 @@
          * @param explicitStyleRes A resource identifier of an explicit style resource.
          * @return ordered list of resource ID that are considered when resolving attribute values.
          */
+        @NonNull
         public int[] getAttributeResolutionStack(@AttrRes int defStyleAttr,
                 @StyleRes int defStyleRes, @StyleRes int explicitStyleRes) {
-            return mThemeImpl.getAttributeResolutionStack(
+            int[] stack = mThemeImpl.getAttributeResolutionStack(
                     defStyleAttr, defStyleRes, explicitStyleRes);
+            if (stack == null) {
+                return new int[0];
+            } else {
+                return stack;
+            }
         }
     }
 
diff --git a/core/java/android/content/res/ResourcesImpl.java b/core/java/android/content/res/ResourcesImpl.java
index da064c9..633966c 100644
--- a/core/java/android/content/res/ResourcesImpl.java
+++ b/core/java/android/content/res/ResourcesImpl.java
@@ -1303,7 +1303,7 @@
 
     @AnyRes
     static int getAttributeSetSourceResId(@Nullable AttributeSet set) {
-        if (set == null) {
+        if (set == null || !(set instanceof XmlBlock.Parser)) {
             return ID_NULL;
         }
         return ((XmlBlock.Parser) set).getSourceResId();
@@ -1507,6 +1507,7 @@
          * @param explicitStyleRes A resource identifier of an explicit style resource.
          * @return ordered list of resource ID that are considered when resolving attribute values.
          */
+        @Nullable
         public int[] getAttributeResolutionStack(@AttrRes int defStyleAttr,
                 @StyleRes int defStyleRes, @StyleRes int explicitStyleRes) {
             synchronized (mKey) {
diff --git a/core/java/android/content/res/TypedArray.java b/core/java/android/content/res/TypedArray.java
index d36e076..b79cf65 100644
--- a/core/java/android/content/res/TypedArray.java
+++ b/core/java/android/content/res/TypedArray.java
@@ -19,7 +19,6 @@
 import android.annotation.AnyRes;
 import android.annotation.ColorInt;
 import android.annotation.Nullable;
-import android.annotation.StyleRes;
 import android.annotation.StyleableRes;
 import android.annotation.UnsupportedAppUsage;
 import android.content.pm.ActivityInfo;
@@ -72,7 +71,7 @@
     static final int STYLE_RESOURCE_ID = 3;
     static final int STYLE_CHANGING_CONFIGURATIONS = 4;
     static final int STYLE_DENSITY = 5;
-    static final int SYTLE_SOURCE_RESOURCE_ID = 6;
+    static final int STYLE_SOURCE_RESOURCE_ID = 6;
 
     @UnsupportedAppUsage
     private final Resources mResources;
@@ -1134,14 +1133,14 @@
      * resolved in a style or layout.
      * @throws RuntimeException if the TypedArray has already been recycled.
      */
-    @StyleRes
-    public int getSourceResourceId(@StyleableRes int index, @StyleRes int defaultValue) {
+    @AnyRes
+    public int getSourceResourceId(@StyleableRes int index, @AnyRes int defaultValue) {
         if (mRecycled) {
             throw new RuntimeException("Cannot make calls to a recycled instance!");
         }
 
         index *= STYLE_NUM_ENTRIES;
-        final int resid = mData[index + SYTLE_SOURCE_RESOURCE_ID];
+        final int resid = mData[index + STYLE_SOURCE_RESOURCE_ID];
         if (resid != 0) {
             return resid;
         }
@@ -1360,7 +1359,7 @@
                 data[index + STYLE_CHANGING_CONFIGURATIONS]);
         outValue.density = data[index + STYLE_DENSITY];
         outValue.string = (type == TypedValue.TYPE_STRING) ? loadStringValueAt(index) : null;
-        outValue.sourceResourceId = data[index + SYTLE_SOURCE_RESOURCE_ID];
+        outValue.sourceResourceId = data[index + STYLE_SOURCE_RESOURCE_ID];
         return true;
     }
 
diff --git a/core/java/android/content/rollback/PackageRollbackInfo.java b/core/java/android/content/rollback/PackageRollbackInfo.java
index 7e5532c..c0414fc 100644
--- a/core/java/android/content/rollback/PackageRollbackInfo.java
+++ b/core/java/android/content/rollback/PackageRollbackInfo.java
@@ -89,6 +89,7 @@
     /**
      * Returns the name of the package to roll back from.
      */
+    @NonNull
     public String getPackageName() {
         return mVersionRolledBackFrom.getPackageName();
     }
@@ -96,6 +97,7 @@
     /**
      * Returns the version of the package rolled back from.
      */
+    @NonNull
     public VersionedPackage getVersionRolledBackFrom() {
         return mVersionRolledBackFrom;
     }
@@ -103,6 +105,7 @@
     /**
      * Returns the version of the package rolled back to.
      */
+    @NonNull
     public VersionedPackage getVersionRolledBackTo() {
         return mVersionRolledBackTo;
     }
@@ -208,7 +211,7 @@
         out.writeBoolean(mIsApex);
     }
 
-    public static final Parcelable.Creator<PackageRollbackInfo> CREATOR =
+    public static final @android.annotation.NonNull Parcelable.Creator<PackageRollbackInfo> CREATOR =
             new Parcelable.Creator<PackageRollbackInfo>() {
         public PackageRollbackInfo createFromParcel(Parcel in) {
             return new PackageRollbackInfo(in);
diff --git a/core/java/android/content/rollback/RollbackInfo.java b/core/java/android/content/rollback/RollbackInfo.java
index 0cde6ba..a363718 100644
--- a/core/java/android/content/rollback/RollbackInfo.java
+++ b/core/java/android/content/rollback/RollbackInfo.java
@@ -16,13 +16,12 @@
 
 package android.content.rollback;
 
+import android.annotation.NonNull;
 import android.annotation.SystemApi;
-import android.content.pm.PackageInstaller;
 import android.content.pm.VersionedPackage;
 import android.os.Parcel;
 import android.os.Parcelable;
 
-import java.util.Collections;
 import java.util.List;
 
 /**
@@ -44,13 +43,7 @@
     private final List<VersionedPackage> mCausePackages;
 
     private final boolean mIsStaged;
-    private final int mCommittedSessionId;
-
-    /** @hide */
-    public RollbackInfo(int rollbackId, List<PackageRollbackInfo> packages, boolean isStaged) {
-        this(rollbackId, packages, isStaged, Collections.emptyList(),
-                PackageInstaller.SessionInfo.INVALID_ID);
-    }
+    private int mCommittedSessionId;
 
     /** @hide */
     public RollbackInfo(int rollbackId, List<PackageRollbackInfo> packages, boolean isStaged,
@@ -80,6 +73,7 @@
     /**
      * Returns the list of package that are rolled back.
      */
+    @NonNull
     public List<PackageRollbackInfo> getPackages() {
         return mPackages;
     }
@@ -101,10 +95,19 @@
     }
 
     /**
+     * Sets the session ID for the committed rollback for staged rollbacks.
+     * @hide
+     */
+    public void setCommittedSessionId(int sessionId) {
+        mCommittedSessionId = sessionId;
+    }
+
+    /**
      * Gets the list of package versions that motivated this rollback.
      * As provided to {@link #commitRollback} when the rollback was committed.
      * This is only applicable for rollbacks that have been committed.
      */
+    @NonNull
     public List<VersionedPackage> getCausePackages() {
         return mCausePackages;
     }
@@ -123,7 +126,7 @@
         out.writeInt(mCommittedSessionId);
     }
 
-    public static final Parcelable.Creator<RollbackInfo> CREATOR =
+    public static final @android.annotation.NonNull Parcelable.Creator<RollbackInfo> CREATOR =
             new Parcelable.Creator<RollbackInfo>() {
         public RollbackInfo createFromParcel(Parcel in) {
             return new RollbackInfo(in);
diff --git a/core/java/android/content/rollback/RollbackManager.java b/core/java/android/content/rollback/RollbackManager.java
index 2788f82..4e8c254 100644
--- a/core/java/android/content/rollback/RollbackManager.java
+++ b/core/java/android/content/rollback/RollbackManager.java
@@ -57,6 +57,7 @@
      *            MANAGE_ROLLBACKS permission.
      */
     @RequiresPermission(android.Manifest.permission.MANAGE_ROLLBACKS)
+    @NonNull
     public List<RollbackInfo> getAvailableRollbacks() {
         try {
             return mBinder.getAvailableRollbacks().getList();
@@ -187,7 +188,8 @@
     /**
      * Expire the rollback data for a given package.
      * This API is meant to facilitate testing of rollback logic for
-     * expiring rollback data.
+     * expiring rollback data. Removes rollback data for available and
+     * recently committed rollbacks that contain the given package.
      *
      * @param packageName the name of the package to expire data for.
      * @throws SecurityException if the caller does not have the
diff --git a/core/java/android/database/BulkCursorDescriptor.java b/core/java/android/database/BulkCursorDescriptor.java
index c1e5e63..80a0319 100644
--- a/core/java/android/database/BulkCursorDescriptor.java
+++ b/core/java/android/database/BulkCursorDescriptor.java
@@ -26,7 +26,7 @@
  * {@hide}
  */
 public final class BulkCursorDescriptor implements Parcelable {
-    public static final Parcelable.Creator<BulkCursorDescriptor> CREATOR =
+    public static final @android.annotation.NonNull Parcelable.Creator<BulkCursorDescriptor> CREATOR =
             new Parcelable.Creator<BulkCursorDescriptor>() {
         @Override
         public BulkCursorDescriptor createFromParcel(Parcel in) {
diff --git a/core/java/android/database/BulkCursorNative.java b/core/java/android/database/BulkCursorNative.java
index d3c11e7..77a13cf 100644
--- a/core/java/android/database/BulkCursorNative.java
+++ b/core/java/android/database/BulkCursorNative.java
@@ -16,6 +16,7 @@
 
 package android.database;
 
+import android.annotation.UnsupportedAppUsage;
 import android.os.Binder;
 import android.os.Bundle;
 import android.os.IBinder;
@@ -138,6 +139,7 @@
 
 
 final class BulkCursorProxy implements IBulkCursor {
+    @UnsupportedAppUsage
     private IBinder mRemote;
     private Bundle mExtras;
 
diff --git a/core/java/android/database/Cursor.java b/core/java/android/database/Cursor.java
index 1379138..2afb755 100644
--- a/core/java/android/database/Cursor.java
+++ b/core/java/android/database/Cursor.java
@@ -17,6 +17,7 @@
 package android.database;
 
 import android.annotation.NonNull;
+import android.annotation.Nullable;
 import android.content.ContentResolver;
 import android.net.Uri;
 import android.os.Bundle;
@@ -473,7 +474,7 @@
      * ContentResolver.registerContentObserver} to find out about changes to this Cursor's
      * data. May be null if no notification URI has been set.
      */
-    default List<Uri> getNotificationUris() {
+    default @Nullable List<Uri> getNotificationUris() {
         final Uri notifyUri = getNotificationUri();
         return notifyUri == null ? null : Arrays.asList(notifyUri);
     }
diff --git a/core/java/android/database/CursorWindow.java b/core/java/android/database/CursorWindow.java
index d9443d9..44bd883 100644
--- a/core/java/android/database/CursorWindow.java
+++ b/core/java/android/database/CursorWindow.java
@@ -709,7 +709,7 @@
         }
     }
 
-    public static final Parcelable.Creator<CursorWindow> CREATOR
+    public static final @android.annotation.NonNull Parcelable.Creator<CursorWindow> CREATOR
             = new Parcelable.Creator<CursorWindow>() {
         public CursorWindow createFromParcel(Parcel source) {
             return new CursorWindow(source);
diff --git a/core/java/android/database/sqlite/SQLiteDatabase.java b/core/java/android/database/sqlite/SQLiteDatabase.java
index dffbd89..caf3e93 100644
--- a/core/java/android/database/sqlite/SQLiteDatabase.java
+++ b/core/java/android/database/sqlite/SQLiteDatabase.java
@@ -2655,26 +2655,24 @@
              * Sets the maximum number of milliseconds that SQLite connection is allowed to be idle
              * before it is closed and removed from the pool.
              *
-             * <p>DO NOT USE this method unless you fully understand the implication
-             * of what it does.
-             * A connection timeout allows the system to internally close a connection to a SQLite
-             * database after a given timeout.
-             * This is good for reducing app's memory consumption, but it has
-             * side effects that are hard to predict. For example, SQLite internally maintains
-             * a lot of "per-connection" states that apps can typically modify with a {@code PRAGMA}
-             * statement, and such states will be reset once the connection is closed.
-             * The system does not provide a callback that would allow apps to
-             * reconfigure a newly created connection and thus there's no way to re-configure
-             * connections when they're re-made internally. Do not use it unless you're sure
-             * your app uses no per-connection states.
+             * <p><b>DO NOT USE</b> this method.
+             * This feature has negative side effects that are very hard to foresee.
+             * <p>A connection timeout allows the system to internally close a connection to
+             * a SQLite database after a given timeout, which is good for reducing app's memory
+             * consumption.
+             * <b>However</b> the side effect is it <b>will reset all of SQLite's per-connection
+             * states</b>, which are typically modified with a {@code PRAGMA} statement, and
+             * these states <b>will not be restored</b> when a connection is re-established
+             * internally, and the system does not provide a callback for an app to reconfigure a
+             * connection.
+             * This feature may only be used if an app relies on none of such per-connection states.
              *
              * @param idleConnectionTimeoutMs timeout in milliseconds. Use {@link Long#MAX_VALUE}
              * to allow unlimited idle connections.
              *
              * @see SQLiteOpenHelper#setIdleConnectionTimeout(long)
              *
-             * @deprecated DO NOT USE this method unless you fully understand the implication
-             * of what it does.
+             * @deprecated DO NOT USE this method. See the javadoc for the details.
              */
             @NonNull
             @Deprecated
diff --git a/core/java/android/database/sqlite/SQLiteOpenHelper.java b/core/java/android/database/sqlite/SQLiteOpenHelper.java
index 8163c4d..62cec0e 100644
--- a/core/java/android/database/sqlite/SQLiteOpenHelper.java
+++ b/core/java/android/database/sqlite/SQLiteOpenHelper.java
@@ -267,8 +267,8 @@
      * <p>This method should be called from the constructor of the subclass,
      * before opening the database
      *
-     * <p>DO NOT USE this method unless you fully understand the implication
-     * of what it does.
+     * <p><b>DO NOT USE</b> this method.
+     * This feature has negative side effects that are very hard to foresee.
      * See the javadoc of
      * {@link SQLiteDatabase.OpenParams.Builder#setIdleConnectionTimeout(long)}
      * for the details.
@@ -278,8 +278,9 @@
      *
      * @see SQLiteDatabase.OpenParams.Builder#setIdleConnectionTimeout(long)
      *
-     * @deprecated DO NOT USE this method unless you fully understand the implication
-     * of what it does.
+     * @deprecated DO NOT USE this method. See the javadoc of
+     * {@link SQLiteDatabase.OpenParams.Builder#setIdleConnectionTimeout(long)}
+     * for the details.
      */
     @Deprecated
     public void setIdleConnectionTimeout(@IntRange(from = 0) final long idleConnectionTimeoutMs) {
diff --git a/core/java/android/database/sqlite/SQLiteQueryBuilder.java b/core/java/android/database/sqlite/SQLiteQueryBuilder.java
index 03e8507..a73a719 100644
--- a/core/java/android/database/sqlite/SQLiteQueryBuilder.java
+++ b/core/java/android/database/sqlite/SQLiteQueryBuilder.java
@@ -89,7 +89,7 @@
      *
      * @return the list of tables being queried
      */
-    public String getTables() {
+    public @Nullable String getTables() {
         return mTables;
     }
 
@@ -101,7 +101,7 @@
      *
      * @param inTables the list of tables to query on
      */
-    public void setTables(String inTables) {
+    public void setTables(@Nullable String inTables) {
         mTables = inTables;
     }
 
@@ -170,7 +170,7 @@
      *
      * @param columnMap maps from the user column names to the database column names
      */
-    public void setProjectionMap(Map<String, String> columnMap) {
+    public void setProjectionMap(@Nullable Map<String, String> columnMap) {
         mProjectionMap = columnMap;
     }
 
@@ -178,7 +178,7 @@
      * Gets the projection map for the query, as last configured by
      * {@link #setProjectionMap(Map)}.
      */
-    public Map<String, String> getProjectionMap() {
+    public @Nullable Map<String, String> getProjectionMap() {
         return mProjectionMap;
     }
 
@@ -189,7 +189,7 @@
      *
      * @hide
      */
-    public void setProjectionGreylist(List<Pattern> projectionGreylist) {
+    public void setProjectionGreylist(@Nullable List<Pattern> projectionGreylist) {
         mProjectionGreylist = projectionGreylist;
     }
 
@@ -199,7 +199,7 @@
      *
      * @hide
      */
-    public List<Pattern> getProjectionGreylist() {
+    public @Nullable List<Pattern> getProjectionGreylist() {
         return mProjectionGreylist;
     }
 
@@ -210,7 +210,7 @@
      *
      * @param factory the factory to use.
      */
-    public void setCursorFactory(SQLiteDatabase.CursorFactory factory) {
+    public void setCursorFactory(@Nullable SQLiteDatabase.CursorFactory factory) {
         mFactory = factory;
     }
 
@@ -218,7 +218,7 @@
      * Sets the cursor factory to be used for the query, as last configured by
      * {@link #setCursorFactory(android.database.sqlite.SQLiteDatabase.CursorFactory)}.
      */
-    public SQLiteDatabase.CursorFactory getCursorFactory() {
+    public @Nullable SQLiteDatabase.CursorFactory getCursorFactory() {
         return mFactory;
     }
 
diff --git a/core/java/android/gesture/Gesture.java b/core/java/android/gesture/Gesture.java
index c6a2a87..08920c1 100644
--- a/core/java/android/gesture/Gesture.java
+++ b/core/java/android/gesture/Gesture.java
@@ -280,7 +280,7 @@
         return gesture;
     }
 
-    public static final Parcelable.Creator<Gesture> CREATOR = new Parcelable.Creator<Gesture>() {
+    public static final @android.annotation.NonNull Parcelable.Creator<Gesture> CREATOR = new Parcelable.Creator<Gesture>() {
         public Gesture createFromParcel(Parcel in) {
             Gesture gesture = null;
             final long gestureID = in.readLong();
diff --git a/core/java/android/hardware/Camera.java b/core/java/android/hardware/Camera.java
index ac863b2..81abdea0 100644
--- a/core/java/android/hardware/Camera.java
+++ b/core/java/android/hardware/Camera.java
@@ -1174,6 +1174,7 @@
     {
         private final Camera mCamera;
 
+        @UnsupportedAppUsage
         public EventHandler(Camera c, Looper looper) {
             super(looper);
             mCamera = c;
diff --git a/core/java/android/hardware/CameraInfo.java b/core/java/android/hardware/CameraInfo.java
index 53da0ce..072be50 100644
--- a/core/java/android/hardware/CameraInfo.java
+++ b/core/java/android/hardware/CameraInfo.java
@@ -45,7 +45,7 @@
         info.orientation = in.readInt();
     }
 
-    public static final Parcelable.Creator<CameraInfo> CREATOR =
+    public static final @android.annotation.NonNull Parcelable.Creator<CameraInfo> CREATOR =
             new Parcelable.Creator<CameraInfo>() {
         @Override
         public CameraInfo createFromParcel(Parcel in) {
diff --git a/core/java/android/hardware/CameraStatus.java b/core/java/android/hardware/CameraStatus.java
index bc97e38..08b5b77 100644
--- a/core/java/android/hardware/CameraStatus.java
+++ b/core/java/android/hardware/CameraStatus.java
@@ -47,7 +47,7 @@
         status = in.readInt();
     }
 
-    public static final Parcelable.Creator<CameraStatus> CREATOR =
+    public static final @android.annotation.NonNull Parcelable.Creator<CameraStatus> CREATOR =
             new Parcelable.Creator<CameraStatus>() {
         @Override
         public CameraStatus createFromParcel(Parcel in) {
diff --git a/core/java/android/hardware/HardwareBuffer.java b/core/java/android/hardware/HardwareBuffer.java
index 87cffc9..c569e05 100644
--- a/core/java/android/hardware/HardwareBuffer.java
+++ b/core/java/android/hardware/HardwareBuffer.java
@@ -376,7 +376,7 @@
         nWriteHardwareBufferToParcel(mNativeObject, dest);
     }
 
-    public static final Parcelable.Creator<HardwareBuffer> CREATOR =
+    public static final @android.annotation.NonNull Parcelable.Creator<HardwareBuffer> CREATOR =
             new Parcelable.Creator<HardwareBuffer>() {
         public HardwareBuffer createFromParcel(Parcel in) {
             long nativeObject = nReadHardwareBufferFromParcel(in);
diff --git a/core/java/android/hardware/biometrics/BiometricConstants.java b/core/java/android/hardware/biometrics/BiometricConstants.java
index 1cb7eb0..27c04b4 100644
--- a/core/java/android/hardware/biometrics/BiometricConstants.java
+++ b/core/java/android/hardware/biometrics/BiometricConstants.java
@@ -128,7 +128,7 @@
 
     /**
      * The device does not have pin, pattern, or password set up. See
-     * {@link BiometricPrompt.Builder#setAllowDeviceCredential(boolean)} and
+     * {@link BiometricPrompt.Builder#setDeviceCredentialAllowed(boolean)} and
      * {@link KeyguardManager#isDeviceSecure()}
      */
     int BIOMETRIC_ERROR_NO_DEVICE_CREDENTIAL = 14;
diff --git a/core/java/android/hardware/biometrics/BiometricFaceConstants.java b/core/java/android/hardware/biometrics/BiometricFaceConstants.java
index 459ec62..3602a33 100644
--- a/core/java/android/hardware/biometrics/BiometricFaceConstants.java
+++ b/core/java/android/hardware/biometrics/BiometricFaceConstants.java
@@ -136,7 +136,7 @@
 
     /**
      * The device does not have pin, pattern, or password set up. See
-     * {@link BiometricPrompt.Builder#setAllowDeviceCredential(boolean)} and
+     * {@link BiometricPrompt.Builder#setDeviceCredentialAllowed(boolean)} and
      * {@link KeyguardManager#isDeviceSecure()}
      */
     public static final int BIOMETRIC_ERROR_NO_DEVICE_CREDENTIAL = 14;
diff --git a/core/java/android/hardware/biometrics/BiometricFingerprintConstants.java b/core/java/android/hardware/biometrics/BiometricFingerprintConstants.java
index 6cbab47..b025508 100644
--- a/core/java/android/hardware/biometrics/BiometricFingerprintConstants.java
+++ b/core/java/android/hardware/biometrics/BiometricFingerprintConstants.java
@@ -121,7 +121,7 @@
 
     /**
      * The device does not have pin, pattern, or password set up. See
-     * {@link BiometricPrompt.Builder#setAllowDeviceCredential(boolean)} and
+     * {@link BiometricPrompt.Builder#setDeviceCredentialAllowed(boolean)} and
      * {@link KeyguardManager#isDeviceSecure()}
      * @hide
      */
diff --git a/core/java/android/hardware/biometrics/BiometricPrompt.java b/core/java/android/hardware/biometrics/BiometricPrompt.java
index baf972b..e751b2c 100644
--- a/core/java/android/hardware/biometrics/BiometricPrompt.java
+++ b/core/java/android/hardware/biometrics/BiometricPrompt.java
@@ -139,7 +139,7 @@
          * @param title
          * @return
          */
-        public Builder setTitle(@NonNull CharSequence title) {
+        @NonNull public Builder setTitle(@NonNull CharSequence title) {
             mBundle.putCharSequence(KEY_TITLE, title);
             return this;
         }
@@ -150,7 +150,7 @@
          * @hide
          */
         @RequiresPermission(USE_BIOMETRIC_INTERNAL)
-        public Builder setUseDefaultTitle() {
+        @NonNull public Builder setUseDefaultTitle() {
             mBundle.putBoolean(KEY_USE_DEFAULT_TITLE, true);
             return this;
         }
@@ -160,7 +160,7 @@
          * @param subtitle
          * @return
          */
-        public Builder setSubtitle(@NonNull CharSequence subtitle) {
+        @NonNull public Builder setSubtitle(@NonNull CharSequence subtitle) {
             mBundle.putCharSequence(KEY_SUBTITLE, subtitle);
             return this;
         }
@@ -170,7 +170,7 @@
          * @param description
          * @return
          */
-        public Builder setDescription(@NonNull CharSequence description) {
+        @NonNull public Builder setDescription(@NonNull CharSequence description) {
             mBundle.putCharSequence(KEY_DESCRIPTION, description);
             return this;
         }
@@ -182,7 +182,7 @@
          * @return
          * @hide
          */
-        public Builder setPositiveButton(@NonNull CharSequence text,
+        @NonNull public Builder setPositiveButton(@NonNull CharSequence text,
                 @NonNull @CallbackExecutor Executor executor,
                 @NonNull DialogInterface.OnClickListener listener) {
             if (TextUtils.isEmpty(text)) {
@@ -204,13 +204,13 @@
          * "Cancel" button, but may be also used to show an alternative method for authentication,
          * such as screen that asks for a backup password.
          *
-         * Note that this should not be set if {@link #setAllowDeviceCredential(boolean)
+         * Note that this should not be set if {@link #setDeviceCredentialAllowed(boolean)}(boolean)
          * is set to true.
          *
          * @param text
          * @return
          */
-        public Builder setNegativeButton(@NonNull CharSequence text,
+        @NonNull public Builder setNegativeButton(@NonNull CharSequence text,
                 @NonNull @CallbackExecutor Executor executor,
                 @NonNull DialogInterface.OnClickListener listener) {
             if (TextUtils.isEmpty(text)) {
@@ -245,7 +245,7 @@
          *
          * @param requireConfirmation
          */
-        public Builder setRequireConfirmation(boolean requireConfirmation) {
+        @NonNull public Builder setConfirmationRequired(boolean requireConfirmation) {
             mBundle.putBoolean(KEY_REQUIRE_CONFIRMATION, requireConfirmation);
             return this;
         }
@@ -255,17 +255,18 @@
          * option to authenticate with their device PIN, pattern, or password. Developers should
          * first check {@link KeyguardManager#isDeviceSecure()} before enabling this. If the device
          * is not secure, {@link BiometricPrompt#BIOMETRIC_ERROR_NO_DEVICE_CREDENTIAL} will be
-         * returned in {@link AuthenticationCallback#onAuthenticationError(int, CharSequence)}}
+         * returned in {@link AuthenticationCallback#onAuthenticationError(int, CharSequence)}}.
+         * Defaults to false.
          *
          * Note that {@link #setNegativeButton(CharSequence, Executor,
          * DialogInterface.OnClickListener)} should not be set if this is set to true.
          *
-         * @param enable When true, the prompt will fall back to ask for the user's device
+         * @param allowed When true, the prompt will fall back to ask for the user's device
          *               credentials (PIN, pattern, or password).
          * @return
          */
-        public Builder setAllowDeviceCredential(boolean enable) {
-            mBundle.putBoolean(KEY_ALLOW_DEVICE_CREDENTIAL, enable);
+        @NonNull public Builder setDeviceCredentialAllowed(boolean allowed) {
+            mBundle.putBoolean(KEY_ALLOW_DEVICE_CREDENTIAL, allowed);
             return this;
         }
 
@@ -274,7 +275,7 @@
          * @return a {@link BiometricPrompt}
          * @throws IllegalArgumentException if any of the required fields are not set.
          */
-        public BiometricPrompt build() {
+        @NonNull public BiometricPrompt build() {
             final CharSequence title = mBundle.getCharSequence(KEY_TITLE);
             final CharSequence negative = mBundle.getCharSequence(KEY_NEGATIVE_TEXT);
             final boolean useDefaultTitle = mBundle.getBoolean(KEY_USE_DEFAULT_TITLE);
@@ -616,8 +617,15 @@
             mExecutor = executor;
             mAuthenticationCallback = callback;
             final long sessionId = crypto != null ? crypto.getOpId() : 0;
-            mService.authenticate(mToken, sessionId, userId, mBiometricServiceReceiver,
-                    mContext.getOpPackageName(), mBundle);
+            if (BiometricManager.hasBiometrics(mContext)) {
+                mService.authenticate(mToken, sessionId, userId, mBiometricServiceReceiver,
+                        mContext.getOpPackageName(), mBundle);
+            } else {
+                mExecutor.execute(() -> {
+                    callback.onAuthenticationError(BiometricPrompt.BIOMETRIC_ERROR_HW_NOT_PRESENT,
+                            mContext.getString(R.string.biometric_error_hw_unavailable));
+                });
+            }
         } catch (RemoteException e) {
             Log.e(TAG, "Remote exception while authenticating", e);
             mExecutor.execute(() -> {
diff --git a/core/java/android/hardware/biometrics/BiometricSourceType.java b/core/java/android/hardware/biometrics/BiometricSourceType.java
index 4a08cf2..f35958f 100644
--- a/core/java/android/hardware/biometrics/BiometricSourceType.java
+++ b/core/java/android/hardware/biometrics/BiometricSourceType.java
@@ -37,7 +37,7 @@
         dest.writeString(name());
     }
 
-    public static final Creator<BiometricSourceType> CREATOR = new Creator<BiometricSourceType>() {
+    public static final @android.annotation.NonNull Creator<BiometricSourceType> CREATOR = new Creator<BiometricSourceType>() {
         @Override
         public BiometricSourceType createFromParcel(final Parcel source) {
             return BiometricSourceType.valueOf(source.readString());
diff --git a/core/java/android/hardware/camera2/CameraCharacteristics.java b/core/java/android/hardware/camera2/CameraCharacteristics.java
index 0e4ff78..f8b2a5b 100644
--- a/core/java/android/hardware/camera2/CameraCharacteristics.java
+++ b/core/java/android/hardware/camera2/CameraCharacteristics.java
@@ -85,7 +85,8 @@
          *
          * @hide
          */
-        public Key(String name, String fallbackName, Class<T> type) {
+        @UnsupportedAppUsage
+        public Key(@NonNull String name, @NonNull String fallbackName, @NonNull Class<T> type) {
             mKey = new CameraMetadataNative.Key<T>(name,  fallbackName, type);
         }
 
@@ -97,7 +98,7 @@
          * they may be useful for testing purposes and for defining custom camera
          * characteristics.</p>
          */
-        public Key(String name, Class<T> type) {
+        public Key(@NonNull String name, @NonNull Class<T> type) {
             mKey = new CameraMetadataNative.Key<T>(name,  type);
         }
 
@@ -297,10 +298,10 @@
      * <p>Each key is only listed once in the list. The order of the keys is undefined.</p>
      *
      * @return List of camera characteristic keys that require the
-     *         {@link android.Manifest.permission#CAMERA} permission. The list can be null in case
+     *         {@link android.Manifest.permission#CAMERA} permission. The list can be empty in case
      *         there are no currently present keys that need additional permission.
      */
-    public List<Key<?>> getKeysNeedingPermission() {
+    public @NonNull List<Key<?>> getKeysNeedingPermission() {
         if (mKeysNeedingPermission == null) {
             Object crKey = CameraCharacteristics.Key.class;
             Class<CameraCharacteristics.Key<?>> crKeyTyped =
@@ -308,7 +309,9 @@
 
             int[] filterTags = get(REQUEST_CHARACTERISTIC_KEYS_NEEDING_PERMISSION);
             if (filterTags == null) {
-                return null;
+                mKeysNeedingPermission = Collections.unmodifiableList(
+                        new ArrayList<CameraCharacteristics.Key<?>> ());
+                return mKeysNeedingPermission;
             }
             mKeysNeedingPermission =
                 getAvailableKeyList(CameraCharacteristics.class, crKeyTyped, filterTags,
@@ -682,6 +685,7 @@
      * @see CaptureRequest#COLOR_CORRECTION_ABERRATION_MODE
      */
     @PublicKey
+    @NonNull
     public static final Key<int[]> COLOR_CORRECTION_AVAILABLE_ABERRATION_MODES =
             new Key<int[]>("android.colorCorrection.availableAberrationModes", int[].class);
 
@@ -700,6 +704,7 @@
      * @see CaptureRequest#CONTROL_AE_ANTIBANDING_MODE
      */
     @PublicKey
+    @NonNull
     public static final Key<int[]> CONTROL_AE_AVAILABLE_ANTIBANDING_MODES =
             new Key<int[]>("android.control.aeAvailableAntibandingModes", int[].class);
 
@@ -725,6 +730,7 @@
      * @see CaptureRequest#CONTROL_AE_MODE
      */
     @PublicKey
+    @NonNull
     public static final Key<int[]> CONTROL_AE_AVAILABLE_MODES =
             new Key<int[]>("android.control.aeAvailableModes", int[].class);
 
@@ -764,6 +770,7 @@
      * @see CaptureRequest#CONTROL_AE_TARGET_FPS_RANGE
      */
     @PublicKey
+    @NonNull
     public static final Key<android.util.Range<Integer>[]> CONTROL_AE_AVAILABLE_TARGET_FPS_RANGES =
             new Key<android.util.Range<Integer>[]>("android.control.aeAvailableTargetFpsRanges", new TypeReference<android.util.Range<Integer>[]>() {{ }});
 
@@ -784,6 +791,7 @@
      * @see CaptureRequest#CONTROL_AE_EXPOSURE_COMPENSATION
      */
     @PublicKey
+    @NonNull
     public static final Key<android.util.Range<Integer>> CONTROL_AE_COMPENSATION_RANGE =
             new Key<android.util.Range<Integer>>("android.control.aeCompensationRange", new TypeReference<android.util.Range<Integer>>() {{ }});
 
@@ -801,6 +809,7 @@
      * @see CaptureRequest#CONTROL_AE_EXPOSURE_COMPENSATION
      */
     @PublicKey
+    @NonNull
     public static final Key<Rational> CONTROL_AE_COMPENSATION_STEP =
             new Key<Rational>("android.control.aeCompensationStep", Rational.class);
 
@@ -825,6 +834,7 @@
      * @see CameraCharacteristics#LENS_INFO_MINIMUM_FOCUS_DISTANCE
      */
     @PublicKey
+    @NonNull
     public static final Key<int[]> CONTROL_AF_AVAILABLE_MODES =
             new Key<int[]>("android.control.afAvailableModes", int[].class);
 
@@ -848,6 +858,7 @@
      * @see CaptureRequest#CONTROL_MODE
      */
     @PublicKey
+    @NonNull
     public static final Key<int[]> CONTROL_AVAILABLE_EFFECTS =
             new Key<int[]>("android.control.availableEffects", int[].class);
 
@@ -871,6 +882,7 @@
      * @see CameraCharacteristics#STATISTICS_INFO_MAX_FACE_COUNT
      */
     @PublicKey
+    @NonNull
     public static final Key<int[]> CONTROL_AVAILABLE_SCENE_MODES =
             new Key<int[]>("android.control.availableSceneModes", int[].class);
 
@@ -885,6 +897,7 @@
      * @see CaptureRequest#CONTROL_VIDEO_STABILIZATION_MODE
      */
     @PublicKey
+    @NonNull
     public static final Key<int[]> CONTROL_AVAILABLE_VIDEO_STABILIZATION_MODES =
             new Key<int[]>("android.control.availableVideoStabilizationModes", int[].class);
 
@@ -909,6 +922,7 @@
      * @see CaptureRequest#CONTROL_AWB_MODE
      */
     @PublicKey
+    @NonNull
     public static final Key<int[]> CONTROL_AWB_AVAILABLE_MODES =
             new Key<int[]>("android.control.awbAvailableModes", int[].class);
 
@@ -945,6 +959,7 @@
      * @see CaptureRequest#CONTROL_AE_REGIONS
      */
     @PublicKey
+    @NonNull
     @SyntheticKey
     public static final Key<Integer> CONTROL_MAX_REGIONS_AE =
             new Key<Integer>("android.control.maxRegionsAe", int.class);
@@ -961,6 +976,7 @@
      * @see CaptureRequest#CONTROL_AWB_REGIONS
      */
     @PublicKey
+    @NonNull
     @SyntheticKey
     public static final Key<Integer> CONTROL_MAX_REGIONS_AWB =
             new Key<Integer>("android.control.maxRegionsAwb", int.class);
@@ -977,6 +993,7 @@
      * @see CaptureRequest#CONTROL_AF_REGIONS
      */
     @PublicKey
+    @NonNull
     @SyntheticKey
     public static final Key<Integer> CONTROL_MAX_REGIONS_AF =
             new Key<Integer>("android.control.maxRegionsAf", int.class);
@@ -1025,7 +1042,7 @@
      * normal capture session, or it will cause request error.</p>
      * <p><b>Range of valid values:</b><br></p>
      * <p>For each configuration, the fps_max &gt;= 120fps.</p>
-     * <p><b>Optional</b> - This value may be {@code null} on some devices.</p>
+     * <p><b>Optional</b> - The value for this key may be {@code null} on some devices.</p>
      * <p><b>Limited capability</b> -
      * Present on all camera devices that report being at least {@link CameraCharacteristics#INFO_SUPPORTED_HARDWARE_LEVEL_LIMITED HARDWARE_LEVEL_LIMITED} devices in the
      * {@link CameraCharacteristics#INFO_SUPPORTED_HARDWARE_LEVEL android.info.supportedHardwareLevel} key</p>
@@ -1046,6 +1063,7 @@
      * @see CaptureRequest#CONTROL_AE_LOCK
      */
     @PublicKey
+    @NonNull
     public static final Key<Boolean> CONTROL_AE_LOCK_AVAILABLE =
             new Key<Boolean>("android.control.aeLockAvailable", boolean.class);
 
@@ -1058,6 +1076,7 @@
      * @see CaptureRequest#CONTROL_AWB_LOCK
      */
     @PublicKey
+    @NonNull
     public static final Key<Boolean> CONTROL_AWB_LOCK_AVAILABLE =
             new Key<Boolean>("android.control.awbLockAvailable", boolean.class);
 
@@ -1074,6 +1093,7 @@
      * @see CaptureRequest#CONTROL_MODE
      */
     @PublicKey
+    @NonNull
     public static final Key<int[]> CONTROL_AVAILABLE_MODES =
             new Key<int[]>("android.control.availableModes", int[].class);
 
@@ -1088,12 +1108,13 @@
      * present, and if a device does not support post RAW sensitivity boost, it will
      * list <code>(100, 100)</code> in this key.</p>
      * <p><b>Units</b>: ISO arithmetic units, the same as {@link CaptureRequest#SENSOR_SENSITIVITY android.sensor.sensitivity}</p>
-     * <p><b>Optional</b> - This value may be {@code null} on some devices.</p>
+     * <p><b>Optional</b> - The value for this key may be {@code null} on some devices.</p>
      *
      * @see CaptureRequest#CONTROL_POST_RAW_SENSITIVITY_BOOST
      * @see CaptureRequest#SENSOR_SENSITIVITY
      */
     @PublicKey
+    @NonNull
     public static final Key<android.util.Range<Integer>> CONTROL_POST_RAW_SENSITIVITY_BOOST_RANGE =
             new Key<android.util.Range<Integer>>("android.control.postRawSensitivityBoostRange", new TypeReference<android.util.Range<Integer>>() {{ }});
 
@@ -1105,7 +1126,7 @@
      * list FAST.</p>
      * <p><b>Range of valid values:</b><br>
      * Any value listed in {@link CaptureRequest#EDGE_MODE android.edge.mode}</p>
-     * <p><b>Optional</b> - This value may be {@code null} on some devices.</p>
+     * <p><b>Optional</b> - The value for this key may be {@code null} on some devices.</p>
      * <p><b>Full capability</b> -
      * Present on all camera devices that report being {@link CameraCharacteristics#INFO_SUPPORTED_HARDWARE_LEVEL_FULL HARDWARE_LEVEL_FULL} devices in the
      * {@link CameraCharacteristics#INFO_SUPPORTED_HARDWARE_LEVEL android.info.supportedHardwareLevel} key</p>
@@ -1114,6 +1135,7 @@
      * @see CameraCharacteristics#INFO_SUPPORTED_HARDWARE_LEVEL
      */
     @PublicKey
+    @NonNull
     public static final Key<int[]> EDGE_AVAILABLE_EDGE_MODES =
             new Key<int[]>("android.edge.availableEdgeModes", int[].class);
 
@@ -1126,6 +1148,7 @@
      * This key is available on all devices.</p>
      */
     @PublicKey
+    @NonNull
     public static final Key<Boolean> FLASH_INFO_AVAILABLE =
             new Key<Boolean>("android.flash.info.available", boolean.class);
 
@@ -1135,11 +1158,12 @@
      * <p>FULL mode camera devices will always support FAST.</p>
      * <p><b>Range of valid values:</b><br>
      * Any value listed in {@link CaptureRequest#HOT_PIXEL_MODE android.hotPixel.mode}</p>
-     * <p><b>Optional</b> - This value may be {@code null} on some devices.</p>
+     * <p><b>Optional</b> - The value for this key may be {@code null} on some devices.</p>
      *
      * @see CaptureRequest#HOT_PIXEL_MODE
      */
     @PublicKey
+    @NonNull
     public static final Key<int[]> HOT_PIXEL_AVAILABLE_HOT_PIXEL_MODES =
             new Key<int[]>("android.hotPixel.availableHotPixelModes", int[].class);
 
@@ -1167,6 +1191,7 @@
      * @see CaptureRequest#JPEG_THUMBNAIL_SIZE
      */
     @PublicKey
+    @NonNull
     public static final Key<android.util.Size[]> JPEG_AVAILABLE_THUMBNAIL_SIZES =
             new Key<android.util.Size[]>("android.jpeg.availableThumbnailSizes", android.util.Size[].class);
 
@@ -1178,7 +1203,7 @@
      * <p>If the camera device supports a variable aperture, the aperture values
      * in this list will be sorted in ascending order.</p>
      * <p><b>Units</b>: The aperture f-number</p>
-     * <p><b>Optional</b> - This value may be {@code null} on some devices.</p>
+     * <p><b>Optional</b> - The value for this key may be {@code null} on some devices.</p>
      * <p><b>Full capability</b> -
      * Present on all camera devices that report being {@link CameraCharacteristics#INFO_SUPPORTED_HARDWARE_LEVEL_FULL HARDWARE_LEVEL_FULL} devices in the
      * {@link CameraCharacteristics#INFO_SUPPORTED_HARDWARE_LEVEL android.info.supportedHardwareLevel} key</p>
@@ -1187,6 +1212,7 @@
      * @see CaptureRequest#LENS_APERTURE
      */
     @PublicKey
+    @NonNull
     public static final Key<float[]> LENS_INFO_AVAILABLE_APERTURES =
             new Key<float[]>("android.lens.info.availableApertures", float[].class);
 
@@ -1199,7 +1225,7 @@
      * <p><b>Units</b>: Exposure value (EV)</p>
      * <p><b>Range of valid values:</b><br></p>
      * <p>Values are &gt;= 0</p>
-     * <p><b>Optional</b> - This value may be {@code null} on some devices.</p>
+     * <p><b>Optional</b> - The value for this key may be {@code null} on some devices.</p>
      * <p><b>Full capability</b> -
      * Present on all camera devices that report being {@link CameraCharacteristics#INFO_SUPPORTED_HARDWARE_LEVEL_FULL HARDWARE_LEVEL_FULL} devices in the
      * {@link CameraCharacteristics#INFO_SUPPORTED_HARDWARE_LEVEL android.info.supportedHardwareLevel} key</p>
@@ -1208,6 +1234,7 @@
      * @see CaptureRequest#LENS_FILTER_DENSITY
      */
     @PublicKey
+    @NonNull
     public static final Key<float[]> LENS_INFO_AVAILABLE_FILTER_DENSITIES =
             new Key<float[]>("android.lens.info.availableFilterDensities", float[].class);
 
@@ -1226,6 +1253,7 @@
      * @see CaptureRequest#LENS_FOCAL_LENGTH
      */
     @PublicKey
+    @NonNull
     public static final Key<float[]> LENS_INFO_AVAILABLE_FOCAL_LENGTHS =
             new Key<float[]>("android.lens.info.availableFocalLengths", float[].class);
 
@@ -1236,7 +1264,7 @@
      * contain only OFF.</p>
      * <p><b>Range of valid values:</b><br>
      * Any value listed in {@link CaptureRequest#LENS_OPTICAL_STABILIZATION_MODE android.lens.opticalStabilizationMode}</p>
-     * <p><b>Optional</b> - This value may be {@code null} on some devices.</p>
+     * <p><b>Optional</b> - The value for this key may be {@code null} on some devices.</p>
      * <p><b>Limited capability</b> -
      * Present on all camera devices that report being at least {@link CameraCharacteristics#INFO_SUPPORTED_HARDWARE_LEVEL_LIMITED HARDWARE_LEVEL_LIMITED} devices in the
      * {@link CameraCharacteristics#INFO_SUPPORTED_HARDWARE_LEVEL android.info.supportedHardwareLevel} key</p>
@@ -1245,6 +1273,7 @@
      * @see CaptureRequest#LENS_OPTICAL_STABILIZATION_MODE
      */
     @PublicKey
+    @NonNull
     public static final Key<int[]> LENS_INFO_AVAILABLE_OPTICAL_STABILIZATION =
             new Key<int[]>("android.lens.info.availableOpticalStabilization", int[].class);
 
@@ -1256,7 +1285,7 @@
      * <p><b>Range of valid values:</b><br>
      * If lens is fixed focus, &gt;= 0. If lens has focuser unit, the value is
      * within <code>(0.0f, {@link CameraCharacteristics#LENS_INFO_MINIMUM_FOCUS_DISTANCE android.lens.info.minimumFocusDistance}]</code></p>
-     * <p><b>Optional</b> - This value may be {@code null} on some devices.</p>
+     * <p><b>Optional</b> - The value for this key may be {@code null} on some devices.</p>
      * <p><b>Limited capability</b> -
      * Present on all camera devices that report being at least {@link CameraCharacteristics#INFO_SUPPORTED_HARDWARE_LEVEL_LIMITED HARDWARE_LEVEL_LIMITED} devices in the
      * {@link CameraCharacteristics#INFO_SUPPORTED_HARDWARE_LEVEL android.info.supportedHardwareLevel} key</p>
@@ -1267,6 +1296,7 @@
      * @see CameraCharacteristics#LENS_INFO_MINIMUM_FOCUS_DISTANCE
      */
     @PublicKey
+    @NonNull
     public static final Key<Float> LENS_INFO_HYPERFOCAL_DISTANCE =
             new Key<Float>("android.lens.info.hyperfocalDistance", float.class);
 
@@ -1278,7 +1308,7 @@
      * <p><b>Units</b>: See {@link CameraCharacteristics#LENS_INFO_FOCUS_DISTANCE_CALIBRATION android.lens.info.focusDistanceCalibration} for details</p>
      * <p><b>Range of valid values:</b><br>
      * &gt;= 0</p>
-     * <p><b>Optional</b> - This value may be {@code null} on some devices.</p>
+     * <p><b>Optional</b> - The value for this key may be {@code null} on some devices.</p>
      * <p><b>Limited capability</b> -
      * Present on all camera devices that report being at least {@link CameraCharacteristics#INFO_SUPPORTED_HARDWARE_LEVEL_LIMITED HARDWARE_LEVEL_LIMITED} devices in the
      * {@link CameraCharacteristics#INFO_SUPPORTED_HARDWARE_LEVEL android.info.supportedHardwareLevel} key</p>
@@ -1288,6 +1318,7 @@
      * @see CameraCharacteristics#LENS_INFO_FOCUS_DISTANCE_CALIBRATION
      */
     @PublicKey
+    @NonNull
     public static final Key<Float> LENS_INFO_MINIMUM_FOCUS_DISTANCE =
             new Key<Float>("android.lens.info.minimumFocusDistance", float.class);
 
@@ -1297,7 +1328,7 @@
      * must be smaller than 64x64.</p>
      * <p><b>Range of valid values:</b><br>
      * Both values &gt;= 1</p>
-     * <p><b>Optional</b> - This value may be {@code null} on some devices.</p>
+     * <p><b>Optional</b> - The value for this key may be {@code null} on some devices.</p>
      * <p><b>Full capability</b> -
      * Present on all camera devices that report being {@link CameraCharacteristics#INFO_SUPPORTED_HARDWARE_LEVEL_FULL HARDWARE_LEVEL_FULL} devices in the
      * {@link CameraCharacteristics#INFO_SUPPORTED_HARDWARE_LEVEL android.info.supportedHardwareLevel} key</p>
@@ -1329,7 +1360,7 @@
      *   <li>{@link #LENS_INFO_FOCUS_DISTANCE_CALIBRATION_APPROXIMATE APPROXIMATE}</li>
      *   <li>{@link #LENS_INFO_FOCUS_DISTANCE_CALIBRATION_CALIBRATED CALIBRATED}</li>
      * </ul></p>
-     * <p><b>Optional</b> - This value may be {@code null} on some devices.</p>
+     * <p><b>Optional</b> - The value for this key may be {@code null} on some devices.</p>
      * <p><b>Limited capability</b> -
      * Present on all camera devices that report being at least {@link CameraCharacteristics#INFO_SUPPORTED_HARDWARE_LEVEL_LIMITED HARDWARE_LEVEL_LIMITED} devices in the
      * {@link CameraCharacteristics#INFO_SUPPORTED_HARDWARE_LEVEL android.info.supportedHardwareLevel} key</p>
@@ -1344,6 +1375,7 @@
      * @see #LENS_INFO_FOCUS_DISTANCE_CALIBRATION_CALIBRATED
      */
     @PublicKey
+    @NonNull
     public static final Key<Integer> LENS_INFO_FOCUS_DISTANCE_CALIBRATION =
             new Key<Integer>("android.lens.info.focusDistanceCalibration", int.class);
 
@@ -1362,6 +1394,7 @@
      * @see #LENS_FACING_EXTERNAL
      */
     @PublicKey
+    @NonNull
     public static final Key<Integer> LENS_FACING =
             new Key<Integer>("android.lens.facing", int.class);
 
@@ -1396,10 +1429,11 @@
      *  <code>p'</code> is in the camera-oriented coordinate system.</p>
      * <p><b>Units</b>:
      * Quaternion coefficients</p>
-     * <p><b>Optional</b> - This value may be {@code null} on some devices.</p>
+     * <p><b>Optional</b> - The value for this key may be {@code null} on some devices.</p>
      * <p><b>Permission {@link android.Manifest.permission#CAMERA } is needed to access this property</b></p>
      */
     @PublicKey
+    @NonNull
     public static final Key<float[]> LENS_POSE_ROTATION =
             new Key<float[]>("android.lens.poseRotation", float[].class);
 
@@ -1432,7 +1466,7 @@
      * the center of the primary gyroscope on the device. The axis definitions are the same as
      * with PRIMARY_CAMERA.</p>
      * <p><b>Units</b>: Meters</p>
-     * <p><b>Optional</b> - This value may be {@code null} on some devices.</p>
+     * <p><b>Optional</b> - The value for this key may be {@code null} on some devices.</p>
      * <p><b>Permission {@link android.Manifest.permission#CAMERA } is needed to access this property</b></p>
      *
      * @see CameraCharacteristics#LENS_DISTORTION
@@ -1441,6 +1475,7 @@
      * @see CameraCharacteristics#LENS_POSE_ROTATION
      */
     @PublicKey
+    @NonNull
     public static final Key<float[]> LENS_POSE_TRANSLATION =
             new Key<float[]>("android.lens.poseTranslation", float[].class);
 
@@ -1504,7 +1539,7 @@
      * Pixels in the
      * {@link CameraCharacteristics#SENSOR_INFO_PRE_CORRECTION_ACTIVE_ARRAY_SIZE android.sensor.info.preCorrectionActiveArraySize}
      * coordinate system.</p>
-     * <p><b>Optional</b> - This value may be {@code null} on some devices.</p>
+     * <p><b>Optional</b> - The value for this key may be {@code null} on some devices.</p>
      * <p><b>Permission {@link android.Manifest.permission#CAMERA } is needed to access this property</b></p>
      *
      * @see CameraCharacteristics#LENS_DISTORTION
@@ -1514,6 +1549,7 @@
      * @see CameraCharacteristics#SENSOR_INFO_PRE_CORRECTION_ACTIVE_ARRAY_SIZE
      */
     @PublicKey
+    @NonNull
     public static final Key<float[]> LENS_INTRINSIC_CALIBRATION =
             new Key<float[]>("android.lens.intrinsicCalibration", float[].class);
 
@@ -1548,7 +1584,7 @@
      * <p>The distortion model used is the Brown-Conrady model.</p>
      * <p><b>Units</b>:
      * Unitless coefficients.</p>
-     * <p><b>Optional</b> - This value may be {@code null} on some devices.</p>
+     * <p><b>Optional</b> - The value for this key may be {@code null} on some devices.</p>
      * <p><b>Permission {@link android.Manifest.permission#CAMERA } is needed to access this property</b></p>
      *
      * @see CameraCharacteristics#LENS_INTRINSIC_CALIBRATION
@@ -1561,6 +1597,7 @@
      */
     @Deprecated
     @PublicKey
+    @NonNull
     public static final Key<float[]> LENS_RADIAL_DISTORTION =
             new Key<float[]>("android.lens.radialDistortion", float[].class);
 
@@ -1573,7 +1610,7 @@
      *   <li>{@link #LENS_POSE_REFERENCE_PRIMARY_CAMERA PRIMARY_CAMERA}</li>
      *   <li>{@link #LENS_POSE_REFERENCE_GYROSCOPE GYROSCOPE}</li>
      * </ul></p>
-     * <p><b>Optional</b> - This value may be {@code null} on some devices.</p>
+     * <p><b>Optional</b> - The value for this key may be {@code null} on some devices.</p>
      * <p><b>Permission {@link android.Manifest.permission#CAMERA } is needed to access this property</b></p>
      *
      * @see CameraCharacteristics#LENS_POSE_TRANSLATION
@@ -1581,6 +1618,7 @@
      * @see #LENS_POSE_REFERENCE_GYROSCOPE
      */
     @PublicKey
+    @NonNull
     public static final Key<Integer> LENS_POSE_REFERENCE =
             new Key<Integer>("android.lens.poseReference", int.class);
 
@@ -1615,13 +1653,14 @@
      * <p>The distortion model used is the Brown-Conrady model.</p>
      * <p><b>Units</b>:
      * Unitless coefficients.</p>
-     * <p><b>Optional</b> - This value may be {@code null} on some devices.</p>
+     * <p><b>Optional</b> - The value for this key may be {@code null} on some devices.</p>
      * <p><b>Permission {@link android.Manifest.permission#CAMERA } is needed to access this property</b></p>
      *
      * @see CameraCharacteristics#LENS_INTRINSIC_CALIBRATION
      * @see CameraCharacteristics#LENS_RADIAL_DISTORTION
      */
     @PublicKey
+    @NonNull
     public static final Key<float[]> LENS_DISTORTION =
             new Key<float[]>("android.lens.distortion", float[].class);
 
@@ -1634,7 +1673,7 @@
      * <p>Legacy-capability camera devices will only support FAST mode.</p>
      * <p><b>Range of valid values:</b><br>
      * Any value listed in {@link CaptureRequest#NOISE_REDUCTION_MODE android.noiseReduction.mode}</p>
-     * <p><b>Optional</b> - This value may be {@code null} on some devices.</p>
+     * <p><b>Optional</b> - The value for this key may be {@code null} on some devices.</p>
      * <p><b>Limited capability</b> -
      * Present on all camera devices that report being at least {@link CameraCharacteristics#INFO_SUPPORTED_HARDWARE_LEVEL_LIMITED HARDWARE_LEVEL_LIMITED} devices in the
      * {@link CameraCharacteristics#INFO_SUPPORTED_HARDWARE_LEVEL android.info.supportedHardwareLevel} key</p>
@@ -1643,6 +1682,7 @@
      * @see CaptureRequest#NOISE_REDUCTION_MODE
      */
     @PublicKey
+    @NonNull
     public static final Key<int[]> NOISE_REDUCTION_AVAILABLE_NOISE_REDUCTION_MODES =
             new Key<int[]>("android.noiseReduction.availableNoiseReductionModes", int[].class);
 
@@ -1655,7 +1695,7 @@
      * future versions of camera service. This quirk will stop
      * working at that point; DO NOT USE without careful
      * consideration of future support.</p>
-     * <p><b>Optional</b> - This value may be {@code null} on some devices.</p>
+     * <p><b>Optional</b> - The value for this key may be {@code null} on some devices.</p>
      * @deprecated
      * <p>Not used in HALv3 or newer; replaced by better partials mechanism</p>
 
@@ -1728,6 +1768,7 @@
      * @see CameraCharacteristics#SCALER_STREAM_CONFIGURATION_MAP
      */
     @PublicKey
+    @NonNull
     @SyntheticKey
     public static final Key<Integer> REQUEST_MAX_NUM_OUTPUT_RAW =
             new Key<Integer>("android.request.maxNumOutputRaw", int.class);
@@ -1764,6 +1805,7 @@
      * @see CameraCharacteristics#SCALER_STREAM_CONFIGURATION_MAP
      */
     @PublicKey
+    @NonNull
     @SyntheticKey
     public static final Key<Integer> REQUEST_MAX_NUM_OUTPUT_PROC =
             new Key<Integer>("android.request.maxNumOutputProc", int.class);
@@ -1790,6 +1832,7 @@
      * @see CameraCharacteristics#SCALER_STREAM_CONFIGURATION_MAP
      */
     @PublicKey
+    @NonNull
     @SyntheticKey
     public static final Key<Integer> REQUEST_MAX_NUM_OUTPUT_PROC_STALLING =
             new Key<Integer>("android.request.maxNumOutputProcStalling", int.class);
@@ -1809,7 +1852,7 @@
      * should be JPEG.</p>
      * <p><b>Range of valid values:</b><br></p>
      * <p>0 or 1.</p>
-     * <p><b>Optional</b> - This value may be {@code null} on some devices.</p>
+     * <p><b>Optional</b> - The value for this key may be {@code null} on some devices.</p>
      * <p><b>Full capability</b> -
      * Present on all camera devices that report being {@link CameraCharacteristics#INFO_SUPPORTED_HARDWARE_LEVEL_FULL HARDWARE_LEVEL_FULL} devices in the
      * {@link CameraCharacteristics#INFO_SUPPORTED_HARDWARE_LEVEL android.info.supportedHardwareLevel} key</p>
@@ -1817,6 +1860,7 @@
      * @see CameraCharacteristics#INFO_SUPPORTED_HARDWARE_LEVEL
      */
     @PublicKey
+    @NonNull
     public static final Key<Integer> REQUEST_MAX_NUM_INPUT_STREAMS =
             new Key<Integer>("android.request.maxNumInputStreams", int.class);
 
@@ -1841,6 +1885,7 @@
      * @see CaptureResult#REQUEST_PIPELINE_DEPTH
      */
     @PublicKey
+    @NonNull
     public static final Key<Byte> REQUEST_PIPELINE_MAX_DEPTH =
             new Key<Byte>("android.request.pipelineMaxDepth", byte.class);
 
@@ -1861,9 +1906,10 @@
      * partial results.</p>
      * <p><b>Range of valid values:</b><br>
      * &gt;= 1</p>
-     * <p><b>Optional</b> - This value may be {@code null} on some devices.</p>
+     * <p><b>Optional</b> - The value for this key may be {@code null} on some devices.</p>
      */
     @PublicKey
+    @NonNull
     public static final Key<Integer> REQUEST_PARTIAL_RESULT_COUNT =
             new Key<Integer>("android.request.partialResultCount", int.class);
 
@@ -1923,6 +1969,7 @@
      * @see #REQUEST_AVAILABLE_CAPABILITIES_SECURE_IMAGE_DATA
      */
     @PublicKey
+    @NonNull
     public static final Key<int[]> REQUEST_AVAILABLE_CAPABILITIES =
             new Key<int[]>("android.request.availableCapabilities", int[].class);
 
@@ -2036,7 +2083,7 @@
      * {@link CaptureRequest.Builder#getPhysicalCameraKey }. Capture requests that contain
      * individual physical device requests must be built via
      * {@link android.hardware.camera2.CameraDevice#createCaptureRequest(int, Set)}.</p>
-     * <p><b>Optional</b> - This value may be {@code null} on some devices.</p>
+     * <p><b>Optional</b> - The value for this key may be {@code null} on some devices.</p>
      * <p><b>Limited capability</b> -
      * Present on all camera devices that report being at least {@link CameraCharacteristics#INFO_SUPPORTED_HARDWARE_LEVEL_LIMITED HARDWARE_LEVEL_LIMITED} devices in the
      * {@link CameraCharacteristics#INFO_SUPPORTED_HARDWARE_LEVEL android.info.supportedHardwareLevel} key</p>
@@ -2067,7 +2114,7 @@
      * camera device for output streams.</p>
      * <p>All camera devices will support JPEG and YUV_420_888 formats.</p>
      * <p>When set to YUV_420_888, application can access the YUV420 data directly.</p>
-     * <p><b>Optional</b> - This value may be {@code null} on some devices.</p>
+     * <p><b>Optional</b> - The value for this key may be {@code null} on some devices.</p>
      * @deprecated
      * <p>Not used in HALv3 or newer</p>
 
@@ -2089,7 +2136,7 @@
      * <p><b>Units</b>: Nanoseconds</p>
      * <p><b>Range of valid values:</b><br>
      * TODO: Remove property.</p>
-     * <p><b>Optional</b> - This value may be {@code null} on some devices.</p>
+     * <p><b>Optional</b> - The value for this key may be {@code null} on some devices.</p>
      * @deprecated
      * <p>Not used in HALv3 or newer</p>
 
@@ -2105,7 +2152,7 @@
      * sensor maximum resolution (defined by {@link CameraCharacteristics#SENSOR_INFO_ACTIVE_ARRAY_SIZE android.sensor.info.activeArraySize}).</p>
      * <p><b>Range of valid values:</b><br>
      * TODO: Remove property.</p>
-     * <p><b>Optional</b> - This value may be {@code null} on some devices.</p>
+     * <p><b>Optional</b> - The value for this key may be {@code null} on some devices.</p>
      *
      * @see CameraCharacteristics#SENSOR_INFO_ACTIVE_ARRAY_SIZE
      * @deprecated
@@ -2135,6 +2182,7 @@
      * @see CaptureRequest#SCALER_CROP_REGION
      */
     @PublicKey
+    @NonNull
     public static final Key<Float> SCALER_AVAILABLE_MAX_DIGITAL_ZOOM =
             new Key<Float>("android.scaler.availableMaxDigitalZoom", float.class);
 
@@ -2148,7 +2196,7 @@
      * <p>When multiple streams are configured, the minimum frame duration will
      * be &gt;= max(individual stream min durations).</p>
      * <p><b>Units</b>: Nanoseconds</p>
-     * <p><b>Optional</b> - This value may be {@code null} on some devices.</p>
+     * <p><b>Optional</b> - The value for this key may be {@code null} on some devices.</p>
      * @deprecated
      * <p>Not used in HALv3 or newer</p>
 
@@ -2172,7 +2220,7 @@
      * can provide.</p>
      * <p>Please reference the documentation for the image data destination to
      * check if it limits the maximum size for image data.</p>
-     * <p><b>Optional</b> - This value may be {@code null} on some devices.</p>
+     * <p><b>Optional</b> - The value for this key may be {@code null} on some devices.</p>
      * @deprecated
      * <p>Not used in HALv3 or newer</p>
 
@@ -2257,7 +2305,7 @@
      * </tr>
      * </tbody>
      * </table>
-     * <p><b>Optional</b> - This value may be {@code null} on some devices.</p>
+     * <p><b>Optional</b> - The value for this key may be {@code null} on some devices.</p>
      *
      * @see CameraCharacteristics#REQUEST_AVAILABLE_CAPABILITIES
      * @see CameraCharacteristics#REQUEST_MAX_NUM_INPUT_STREAMS
@@ -2551,6 +2599,7 @@
      * @see CameraCharacteristics#SENSOR_INFO_ACTIVE_ARRAY_SIZE
      */
     @PublicKey
+    @NonNull
     @SyntheticKey
     public static final Key<android.hardware.camera2.params.StreamConfigurationMap> SCALER_STREAM_CONFIGURATION_MAP =
             new Key<android.hardware.camera2.params.StreamConfigurationMap>("android.scaler.streamConfigurationMap", android.hardware.camera2.params.StreamConfigurationMap.class);
@@ -2579,6 +2628,7 @@
      * @see #SCALER_CROPPING_TYPE_FREEFORM
      */
     @PublicKey
+    @NonNull
     public static final Key<Integer> SCALER_CROPPING_TYPE =
             new Key<Integer>("android.scaler.croppingType", int.class);
 
@@ -2591,7 +2641,7 @@
      * power and performance efficient for specific use cases. For more information about
      * retrieving the suggestions see
      * {@link android.hardware.camera2.CameraCharacteristics#getRecommendedStreamConfigurationMap }.</p>
-     * <p><b>Optional</b> - This value may be {@code null} on some devices.</p>
+     * <p><b>Optional</b> - The value for this key may be {@code null} on some devices.</p>
      * @hide
      */
     public static final Key<android.hardware.camera2.params.RecommendedStreamConfiguration[]> SCALER_AVAILABLE_RECOMMENDED_STREAM_CONFIGURATIONS =
@@ -2607,7 +2657,7 @@
      * If set, the information will be available in the ZERO_SHUTTER_LAG recommended stream
      * configuration see
      * {@link android.hardware.camera2.CameraCharacteristics#getRecommendedStreamConfigurationMap }.</p>
-     * <p><b>Optional</b> - This value may be {@code null} on some devices.</p>
+     * <p><b>Optional</b> - The value for this key may be {@code null} on some devices.</p>
      * @hide
      */
     public static final Key<android.hardware.camera2.params.ReprocessFormatsMap> SCALER_AVAILABLE_RECOMMENDED_INPUT_OUTPUT_FORMATS_MAP =
@@ -2634,7 +2684,7 @@
      * physical camera not independently exposed in
      * {@link android.hardware.camera2.CameraManager#getCameraIdList } or is not backward
      * compatible.</p>
-     * <p><b>Optional</b> - This value may be {@code null} on some devices.</p>
+     * <p><b>Optional</b> - The value for this key may be {@code null} on some devices.</p>
      * <p><b>Limited capability</b> -
      * Present on all camera devices that report being at least {@link CameraCharacteristics#INFO_SUPPORTED_HARDWARE_LEVEL_LIMITED HARDWARE_LEVEL_LIMITED} devices in the
      * {@link CameraCharacteristics#INFO_SUPPORTED_HARDWARE_LEVEL android.info.supportedHardwareLevel} key</p>
@@ -2642,6 +2692,7 @@
      * @see CameraCharacteristics#INFO_SUPPORTED_HARDWARE_LEVEL
      */
     @PublicKey
+    @NonNull
     @SyntheticKey
     public static final Key<android.hardware.camera2.params.MandatoryStreamCombination[]> SCALER_MANDATORY_STREAM_COMBINATIONS =
             new Key<android.hardware.camera2.params.MandatoryStreamCombination[]>("android.scaler.mandatoryStreamCombinations", android.hardware.camera2.params.MandatoryStreamCombination[].class);
@@ -2681,6 +2732,7 @@
      * @see CameraCharacteristics#SENSOR_INFO_PRE_CORRECTION_ACTIVE_ARRAY_SIZE
      */
     @PublicKey
+    @NonNull
     public static final Key<android.graphics.Rect> SENSOR_INFO_ACTIVE_ARRAY_SIZE =
             new Key<android.graphics.Rect>("android.sensor.info.activeArraySize", android.graphics.Rect.class);
 
@@ -2691,7 +2743,7 @@
      * as defined in ISO 12232:2006.</p>
      * <p><b>Range of valid values:</b><br>
      * Min &lt;= 100, Max &gt;= 800</p>
-     * <p><b>Optional</b> - This value may be {@code null} on some devices.</p>
+     * <p><b>Optional</b> - The value for this key may be {@code null} on some devices.</p>
      * <p><b>Full capability</b> -
      * Present on all camera devices that report being {@link CameraCharacteristics#INFO_SUPPORTED_HARDWARE_LEVEL_FULL HARDWARE_LEVEL_FULL} devices in the
      * {@link CameraCharacteristics#INFO_SUPPORTED_HARDWARE_LEVEL android.info.supportedHardwareLevel} key</p>
@@ -2700,6 +2752,7 @@
      * @see CaptureRequest#SENSOR_SENSITIVITY
      */
     @PublicKey
+    @NonNull
     public static final Key<android.util.Range<Integer>> SENSOR_INFO_SENSITIVITY_RANGE =
             new Key<android.util.Range<Integer>>("android.sensor.info.sensitivityRange", new TypeReference<android.util.Range<Integer>>() {{ }});
 
@@ -2718,7 +2771,7 @@
      *   <li>{@link #SENSOR_INFO_COLOR_FILTER_ARRANGEMENT_MONO MONO}</li>
      *   <li>{@link #SENSOR_INFO_COLOR_FILTER_ARRANGEMENT_NIR NIR}</li>
      * </ul></p>
-     * <p><b>Optional</b> - This value may be {@code null} on some devices.</p>
+     * <p><b>Optional</b> - The value for this key may be {@code null} on some devices.</p>
      * <p><b>Full capability</b> -
      * Present on all camera devices that report being {@link CameraCharacteristics#INFO_SUPPORTED_HARDWARE_LEVEL_FULL HARDWARE_LEVEL_FULL} devices in the
      * {@link CameraCharacteristics#INFO_SUPPORTED_HARDWARE_LEVEL android.info.supportedHardwareLevel} key</p>
@@ -2733,6 +2786,7 @@
      * @see #SENSOR_INFO_COLOR_FILTER_ARRANGEMENT_NIR
      */
     @PublicKey
+    @NonNull
     public static final Key<Integer> SENSOR_INFO_COLOR_FILTER_ARRANGEMENT =
             new Key<Integer>("android.sensor.info.colorFilterArrangement", int.class);
 
@@ -2744,7 +2798,7 @@
      * The minimum exposure time will be less than 100 us. For FULL
      * capability devices ({@link CameraCharacteristics#INFO_SUPPORTED_HARDWARE_LEVEL android.info.supportedHardwareLevel} == FULL),
      * the maximum exposure time will be greater than 100ms.</p>
-     * <p><b>Optional</b> - This value may be {@code null} on some devices.</p>
+     * <p><b>Optional</b> - The value for this key may be {@code null} on some devices.</p>
      * <p><b>Full capability</b> -
      * Present on all camera devices that report being {@link CameraCharacteristics#INFO_SUPPORTED_HARDWARE_LEVEL_FULL HARDWARE_LEVEL_FULL} devices in the
      * {@link CameraCharacteristics#INFO_SUPPORTED_HARDWARE_LEVEL android.info.supportedHardwareLevel} key</p>
@@ -2753,6 +2807,7 @@
      * @see CaptureRequest#SENSOR_EXPOSURE_TIME
      */
     @PublicKey
+    @NonNull
     public static final Key<android.util.Range<Long>> SENSOR_INFO_EXPOSURE_TIME_RANGE =
             new Key<android.util.Range<Long>>("android.sensor.info.exposureTimeRange", new TypeReference<android.util.Range<Long>>() {{ }});
 
@@ -2768,7 +2823,7 @@
      * <p><b>Range of valid values:</b><br>
      * For FULL capability devices
      * ({@link CameraCharacteristics#INFO_SUPPORTED_HARDWARE_LEVEL android.info.supportedHardwareLevel} == FULL), at least 100ms.</p>
-     * <p><b>Optional</b> - This value may be {@code null} on some devices.</p>
+     * <p><b>Optional</b> - The value for this key may be {@code null} on some devices.</p>
      * <p><b>Full capability</b> -
      * Present on all camera devices that report being {@link CameraCharacteristics#INFO_SUPPORTED_HARDWARE_LEVEL_FULL HARDWARE_LEVEL_FULL} devices in the
      * {@link CameraCharacteristics#INFO_SUPPORTED_HARDWARE_LEVEL android.info.supportedHardwareLevel} key</p>
@@ -2777,6 +2832,7 @@
      * @see CaptureRequest#SENSOR_FRAME_DURATION
      */
     @PublicKey
+    @NonNull
     public static final Key<Long> SENSOR_INFO_MAX_FRAME_DURATION =
             new Key<Long>("android.sensor.info.maxFrameDuration", long.class);
 
@@ -2791,6 +2847,7 @@
      * @see CameraCharacteristics#SENSOR_INFO_PIXEL_ARRAY_SIZE
      */
     @PublicKey
+    @NonNull
     public static final Key<android.util.SizeF> SENSOR_INFO_PHYSICAL_SIZE =
             new Key<android.util.SizeF>("android.sensor.info.physicalSize", android.util.SizeF.class);
 
@@ -2816,6 +2873,7 @@
      * @see CameraCharacteristics#SENSOR_INFO_PRE_CORRECTION_ACTIVE_ARRAY_SIZE
      */
     @PublicKey
+    @NonNull
     public static final Key<android.util.Size> SENSOR_INFO_PIXEL_ARRAY_SIZE =
             new Key<android.util.Size>("android.sensor.info.pixelArraySize", android.util.Size.class);
 
@@ -2837,13 +2895,14 @@
      * by the camera device, which provides more accurate white level values.</p>
      * <p><b>Range of valid values:</b><br>
      * &gt; 255 (8-bit output)</p>
-     * <p><b>Optional</b> - This value may be {@code null} on some devices.</p>
+     * <p><b>Optional</b> - The value for this key may be {@code null} on some devices.</p>
      *
      * @see CameraCharacteristics#SENSOR_BLACK_LEVEL_PATTERN
      * @see CaptureResult#SENSOR_DYNAMIC_WHITE_LEVEL
      * @see CaptureRequest#SENSOR_SENSITIVITY
      */
     @PublicKey
+    @NonNull
     public static final Key<Integer> SENSOR_INFO_WHITE_LEVEL =
             new Key<Integer>("android.sensor.info.whiteLevel", int.class);
 
@@ -2863,6 +2922,7 @@
      * @see #SENSOR_INFO_TIMESTAMP_SOURCE_REALTIME
      */
     @PublicKey
+    @NonNull
     public static final Key<Integer> SENSOR_INFO_TIMESTAMP_SOURCE =
             new Key<Integer>("android.sensor.info.timestampSource", int.class);
 
@@ -2875,11 +2935,12 @@
      * See {@link CameraCharacteristics#REQUEST_MAX_NUM_OUTPUT_RAW android.request.maxNumOutputRaw} for a list of RAW image formats.</p>
      * <p>This key will be <code>null</code> for all devices do not report this information.
      * Devices with RAW capability will always report this information in this key.</p>
-     * <p><b>Optional</b> - This value may be {@code null} on some devices.</p>
+     * <p><b>Optional</b> - The value for this key may be {@code null} on some devices.</p>
      *
      * @see CameraCharacteristics#REQUEST_MAX_NUM_OUTPUT_RAW
      */
     @PublicKey
+    @NonNull
     public static final Key<Boolean> SENSOR_INFO_LENS_SHADING_APPLIED =
             new Key<Boolean>("android.sensor.info.lensShadingApplied", boolean.class);
 
@@ -2945,6 +3006,7 @@
      * @see CameraCharacteristics#SENSOR_INFO_PRE_CORRECTION_ACTIVE_ARRAY_SIZE
      */
     @PublicKey
+    @NonNull
     public static final Key<android.graphics.Rect> SENSOR_INFO_PRE_CORRECTION_ACTIVE_ARRAY_SIZE =
             new Key<android.graphics.Rect>("android.sensor.info.preCorrectionActiveArraySize", android.graphics.Rect.class);
 
@@ -2986,7 +3048,7 @@
      *   <li>{@link #SENSOR_REFERENCE_ILLUMINANT1_D50 D50}</li>
      *   <li>{@link #SENSOR_REFERENCE_ILLUMINANT1_ISO_STUDIO_TUNGSTEN ISO_STUDIO_TUNGSTEN}</li>
      * </ul></p>
-     * <p><b>Optional</b> - This value may be {@code null} on some devices.</p>
+     * <p><b>Optional</b> - The value for this key may be {@code null} on some devices.</p>
      * <p><b>Permission {@link android.Manifest.permission#CAMERA } is needed to access this property</b></p>
      *
      * @see CameraCharacteristics#SENSOR_CALIBRATION_TRANSFORM1
@@ -3014,6 +3076,7 @@
      * @see #SENSOR_REFERENCE_ILLUMINANT1_ISO_STUDIO_TUNGSTEN
      */
     @PublicKey
+    @NonNull
     public static final Key<Integer> SENSOR_REFERENCE_ILLUMINANT1 =
             new Key<Integer>("android.sensor.referenceIlluminant1", int.class);
 
@@ -3030,7 +3093,7 @@
      * the camera device has RAW capability.</p>
      * <p><b>Range of valid values:</b><br>
      * Any value listed in {@link CameraCharacteristics#SENSOR_REFERENCE_ILLUMINANT1 android.sensor.referenceIlluminant1}</p>
-     * <p><b>Optional</b> - This value may be {@code null} on some devices.</p>
+     * <p><b>Optional</b> - The value for this key may be {@code null} on some devices.</p>
      * <p><b>Permission {@link android.Manifest.permission#CAMERA } is needed to access this property</b></p>
      *
      * @see CameraCharacteristics#SENSOR_CALIBRATION_TRANSFORM2
@@ -3039,6 +3102,7 @@
      * @see CameraCharacteristics#SENSOR_REFERENCE_ILLUMINANT1
      */
     @PublicKey
+    @NonNull
     public static final Key<Byte> SENSOR_REFERENCE_ILLUMINANT2 =
             new Key<Byte>("android.sensor.referenceIlluminant2", byte.class);
 
@@ -3055,12 +3119,13 @@
      * ({@link CameraCharacteristics#SENSOR_REFERENCE_ILLUMINANT1 android.sensor.referenceIlluminant1}).</p>
      * <p>Starting from Android Q, this key will not be present for a MONOCHROME camera, even if
      * the camera device has RAW capability.</p>
-     * <p><b>Optional</b> - This value may be {@code null} on some devices.</p>
+     * <p><b>Optional</b> - The value for this key may be {@code null} on some devices.</p>
      * <p><b>Permission {@link android.Manifest.permission#CAMERA } is needed to access this property</b></p>
      *
      * @see CameraCharacteristics#SENSOR_REFERENCE_ILLUMINANT1
      */
     @PublicKey
+    @NonNull
     public static final Key<android.hardware.camera2.params.ColorSpaceTransform> SENSOR_CALIBRATION_TRANSFORM1 =
             new Key<android.hardware.camera2.params.ColorSpaceTransform>("android.sensor.calibrationTransform1", android.hardware.camera2.params.ColorSpaceTransform.class);
 
@@ -3080,12 +3145,13 @@
      * illuminant is present.</p>
      * <p>Starting from Android Q, this key will not be present for a MONOCHROME camera, even if
      * the camera device has RAW capability.</p>
-     * <p><b>Optional</b> - This value may be {@code null} on some devices.</p>
+     * <p><b>Optional</b> - The value for this key may be {@code null} on some devices.</p>
      * <p><b>Permission {@link android.Manifest.permission#CAMERA } is needed to access this property</b></p>
      *
      * @see CameraCharacteristics#SENSOR_REFERENCE_ILLUMINANT2
      */
     @PublicKey
+    @NonNull
     public static final Key<android.hardware.camera2.params.ColorSpaceTransform> SENSOR_CALIBRATION_TRANSFORM2 =
             new Key<android.hardware.camera2.params.ColorSpaceTransform>("android.sensor.calibrationTransform2", android.hardware.camera2.params.ColorSpaceTransform.class);
 
@@ -3106,12 +3172,13 @@
      * (i.e. no chromatic adaptation will be applied by this transform).</p>
      * <p>Starting from Android Q, this key will not be present for a MONOCHROME camera, even if
      * the camera device has RAW capability.</p>
-     * <p><b>Optional</b> - This value may be {@code null} on some devices.</p>
+     * <p><b>Optional</b> - The value for this key may be {@code null} on some devices.</p>
      * <p><b>Permission {@link android.Manifest.permission#CAMERA } is needed to access this property</b></p>
      *
      * @see CameraCharacteristics#SENSOR_REFERENCE_ILLUMINANT1
      */
     @PublicKey
+    @NonNull
     public static final Key<android.hardware.camera2.params.ColorSpaceTransform> SENSOR_COLOR_TRANSFORM1 =
             new Key<android.hardware.camera2.params.ColorSpaceTransform>("android.sensor.colorTransform1", android.hardware.camera2.params.ColorSpaceTransform.class);
 
@@ -3134,12 +3201,13 @@
      * illuminant is present.</p>
      * <p>Starting from Android Q, this key will not be present for a MONOCHROME camera, even if
      * the camera device has RAW capability.</p>
-     * <p><b>Optional</b> - This value may be {@code null} on some devices.</p>
+     * <p><b>Optional</b> - The value for this key may be {@code null} on some devices.</p>
      * <p><b>Permission {@link android.Manifest.permission#CAMERA } is needed to access this property</b></p>
      *
      * @see CameraCharacteristics#SENSOR_REFERENCE_ILLUMINANT2
      */
     @PublicKey
+    @NonNull
     public static final Key<android.hardware.camera2.params.ColorSpaceTransform> SENSOR_COLOR_TRANSFORM2 =
             new Key<android.hardware.camera2.params.ColorSpaceTransform>("android.sensor.colorTransform2", android.hardware.camera2.params.ColorSpaceTransform.class);
 
@@ -3158,12 +3226,13 @@
      * CIE XYZ colorspace.</p>
      * <p>Starting from Android Q, this key will not be present for a MONOCHROME camera, even if
      * the camera device has RAW capability.</p>
-     * <p><b>Optional</b> - This value may be {@code null} on some devices.</p>
+     * <p><b>Optional</b> - The value for this key may be {@code null} on some devices.</p>
      * <p><b>Permission {@link android.Manifest.permission#CAMERA } is needed to access this property</b></p>
      *
      * @see CameraCharacteristics#SENSOR_REFERENCE_ILLUMINANT1
      */
     @PublicKey
+    @NonNull
     public static final Key<android.hardware.camera2.params.ColorSpaceTransform> SENSOR_FORWARD_MATRIX1 =
             new Key<android.hardware.camera2.params.ColorSpaceTransform>("android.sensor.forwardMatrix1", android.hardware.camera2.params.ColorSpaceTransform.class);
 
@@ -3184,12 +3253,13 @@
      * illuminant is present.</p>
      * <p>Starting from Android Q, this key will not be present for a MONOCHROME camera, even if
      * the camera device has RAW capability.</p>
-     * <p><b>Optional</b> - This value may be {@code null} on some devices.</p>
+     * <p><b>Optional</b> - The value for this key may be {@code null} on some devices.</p>
      * <p><b>Permission {@link android.Manifest.permission#CAMERA } is needed to access this property</b></p>
      *
      * @see CameraCharacteristics#SENSOR_REFERENCE_ILLUMINANT2
      */
     @PublicKey
+    @NonNull
     public static final Key<android.hardware.camera2.params.ColorSpaceTransform> SENSOR_FORWARD_MATRIX2 =
             new Key<android.hardware.camera2.params.ColorSpaceTransform>("android.sensor.forwardMatrix2", android.hardware.camera2.params.ColorSpaceTransform.class);
 
@@ -3215,7 +3285,7 @@
      * <p>For a MONOCHROME camera device, all of the 2x2 channels must have the same values.</p>
      * <p><b>Range of valid values:</b><br>
      * &gt;= 0 for each.</p>
-     * <p><b>Optional</b> - This value may be {@code null} on some devices.</p>
+     * <p><b>Optional</b> - The value for this key may be {@code null} on some devices.</p>
      *
      * @see CaptureResult#SENSOR_DYNAMIC_BLACK_LEVEL
      * @see CameraCharacteristics#SENSOR_INFO_COLOR_FILTER_ARRANGEMENT
@@ -3224,6 +3294,7 @@
      * @see CaptureRequest#SENSOR_SENSITIVITY
      */
     @PublicKey
+    @NonNull
     public static final Key<android.hardware.camera2.params.BlackLevelPattern> SENSOR_BLACK_LEVEL_PATTERN =
             new Key<android.hardware.camera2.params.BlackLevelPattern>("android.sensor.blackLevelPattern", android.hardware.camera2.params.BlackLevelPattern.class);
 
@@ -3234,7 +3305,7 @@
      * equal to this, all applied gain must be analog. For
      * values above this, the gain applied can be a mix of analog and
      * digital.</p>
-     * <p><b>Optional</b> - This value may be {@code null} on some devices.</p>
+     * <p><b>Optional</b> - The value for this key may be {@code null} on some devices.</p>
      * <p><b>Full capability</b> -
      * Present on all camera devices that report being {@link CameraCharacteristics#INFO_SUPPORTED_HARDWARE_LEVEL_FULL HARDWARE_LEVEL_FULL} devices in the
      * {@link CameraCharacteristics#INFO_SUPPORTED_HARDWARE_LEVEL android.info.supportedHardwareLevel} key</p>
@@ -3243,6 +3314,7 @@
      * @see CaptureRequest#SENSOR_SENSITIVITY
      */
     @PublicKey
+    @NonNull
     public static final Key<Integer> SENSOR_MAX_ANALOG_SENSITIVITY =
             new Key<Integer>("android.sensor.maxAnalogSensitivity", int.class);
 
@@ -3258,6 +3330,7 @@
      * <p>This key is available on all devices.</p>
      */
     @PublicKey
+    @NonNull
     public static final Key<Integer> SENSOR_ORIENTATION =
             new Key<Integer>("android.sensor.orientation", int.class);
 
@@ -3267,11 +3340,12 @@
      * <p>Defaults to OFF, and always includes OFF if defined.</p>
      * <p><b>Range of valid values:</b><br>
      * Any value listed in {@link CaptureRequest#SENSOR_TEST_PATTERN_MODE android.sensor.testPatternMode}</p>
-     * <p><b>Optional</b> - This value may be {@code null} on some devices.</p>
+     * <p><b>Optional</b> - The value for this key may be {@code null} on some devices.</p>
      *
      * @see CaptureRequest#SENSOR_TEST_PATTERN_MODE
      */
     @PublicKey
+    @NonNull
     public static final Key<int[]> SENSOR_AVAILABLE_TEST_PATTERN_MODES =
             new Key<int[]>("android.sensor.availableTestPatternModes", int[].class);
 
@@ -3291,13 +3365,14 @@
      * black level of each captured raw images.</p>
      * <p>When this key is reported, the {@link CaptureResult#SENSOR_DYNAMIC_BLACK_LEVEL android.sensor.dynamicBlackLevel} and
      * {@link CaptureResult#SENSOR_DYNAMIC_WHITE_LEVEL android.sensor.dynamicWhiteLevel} will also be reported.</p>
-     * <p><b>Optional</b> - This value may be {@code null} on some devices.</p>
+     * <p><b>Optional</b> - The value for this key may be {@code null} on some devices.</p>
      *
      * @see CameraCharacteristics#SENSOR_BLACK_LEVEL_PATTERN
      * @see CaptureResult#SENSOR_DYNAMIC_BLACK_LEVEL
      * @see CaptureResult#SENSOR_DYNAMIC_WHITE_LEVEL
      */
     @PublicKey
+    @NonNull
     public static final Key<android.graphics.Rect[]> SENSOR_OPTICAL_BLACK_REGIONS =
             new Key<android.graphics.Rect[]>("android.sensor.opticalBlackRegions", android.graphics.Rect[].class);
 
@@ -3314,6 +3389,7 @@
      * @see CaptureRequest#SHADING_MODE
      */
     @PublicKey
+    @NonNull
     public static final Key<int[]> SHADING_AVAILABLE_MODES =
             new Key<int[]>("android.shading.availableModes", int[].class);
 
@@ -3328,6 +3404,7 @@
      * @see CaptureRequest#STATISTICS_FACE_DETECT_MODE
      */
     @PublicKey
+    @NonNull
     public static final Key<int[]> STATISTICS_INFO_AVAILABLE_FACE_DETECT_MODES =
             new Key<int[]>("android.statistics.info.availableFaceDetectModes", int[].class);
 
@@ -3341,6 +3418,7 @@
      * <p>This key is available on all devices.</p>
      */
     @PublicKey
+    @NonNull
     public static final Key<Integer> STATISTICS_INFO_MAX_FACE_COUNT =
             new Key<Integer>("android.statistics.info.maxFaceCount", int.class);
 
@@ -3352,11 +3430,12 @@
      * <p>ON is always supported on devices with the RAW capability.</p>
      * <p><b>Range of valid values:</b><br>
      * Any value listed in {@link CaptureRequest#STATISTICS_HOT_PIXEL_MAP_MODE android.statistics.hotPixelMapMode}</p>
-     * <p><b>Optional</b> - This value may be {@code null} on some devices.</p>
+     * <p><b>Optional</b> - The value for this key may be {@code null} on some devices.</p>
      *
      * @see CaptureRequest#STATISTICS_HOT_PIXEL_MAP_MODE
      */
     @PublicKey
+    @NonNull
     public static final Key<boolean[]> STATISTICS_INFO_AVAILABLE_HOT_PIXEL_MAP_MODES =
             new Key<boolean[]>("android.statistics.info.availableHotPixelMapModes", boolean[].class);
 
@@ -3369,11 +3448,12 @@
      * LEGACY mode devices will always only support OFF.</p>
      * <p><b>Range of valid values:</b><br>
      * Any value listed in {@link CaptureRequest#STATISTICS_LENS_SHADING_MAP_MODE android.statistics.lensShadingMapMode}</p>
-     * <p><b>Optional</b> - This value may be {@code null} on some devices.</p>
+     * <p><b>Optional</b> - The value for this key may be {@code null} on some devices.</p>
      *
      * @see CaptureRequest#STATISTICS_LENS_SHADING_MAP_MODE
      */
     @PublicKey
+    @NonNull
     public static final Key<int[]> STATISTICS_INFO_AVAILABLE_LENS_SHADING_MAP_MODES =
             new Key<int[]>("android.statistics.info.availableLensShadingMapModes", int[].class);
 
@@ -3384,11 +3464,12 @@
      * contain only OFF.</p>
      * <p><b>Range of valid values:</b><br>
      * Any value listed in {@link CaptureRequest#STATISTICS_OIS_DATA_MODE android.statistics.oisDataMode}</p>
-     * <p><b>Optional</b> - This value may be {@code null} on some devices.</p>
+     * <p><b>Optional</b> - The value for this key may be {@code null} on some devices.</p>
      *
      * @see CaptureRequest#STATISTICS_OIS_DATA_MODE
      */
     @PublicKey
+    @NonNull
     public static final Key<int[]> STATISTICS_INFO_AVAILABLE_OIS_DATA_MODES =
             new Key<int[]>("android.statistics.info.availableOisDataModes", int[].class);
 
@@ -3401,7 +3482,7 @@
      * <p>The output curves in the result metadata may have a different number
      * of points than the input curves, and will represent the actual
      * hardware curves used as closely as possible when linearly interpolated.</p>
-     * <p><b>Optional</b> - This value may be {@code null} on some devices.</p>
+     * <p><b>Optional</b> - The value for this key may be {@code null} on some devices.</p>
      * <p><b>Full capability</b> -
      * Present on all camera devices that report being {@link CameraCharacteristics#INFO_SUPPORTED_HARDWARE_LEVEL_FULL HARDWARE_LEVEL_FULL} devices in the
      * {@link CameraCharacteristics#INFO_SUPPORTED_HARDWARE_LEVEL android.info.supportedHardwareLevel} key</p>
@@ -3410,6 +3491,7 @@
      * @see CaptureRequest#TONEMAP_CURVE
      */
     @PublicKey
+    @NonNull
     public static final Key<Integer> TONEMAP_MAX_CURVE_POINTS =
             new Key<Integer>("android.tonemap.maxCurvePoints", int.class);
 
@@ -3425,7 +3507,7 @@
      * <p>This includes all FULL level devices.</p>
      * <p><b>Range of valid values:</b><br>
      * Any value listed in {@link CaptureRequest#TONEMAP_MODE android.tonemap.mode}</p>
-     * <p><b>Optional</b> - This value may be {@code null} on some devices.</p>
+     * <p><b>Optional</b> - The value for this key may be {@code null} on some devices.</p>
      * <p><b>Full capability</b> -
      * Present on all camera devices that report being {@link CameraCharacteristics#INFO_SUPPORTED_HARDWARE_LEVEL_FULL HARDWARE_LEVEL_FULL} devices in the
      * {@link CameraCharacteristics#INFO_SUPPORTED_HARDWARE_LEVEL android.info.supportedHardwareLevel} key</p>
@@ -3434,6 +3516,7 @@
      * @see CaptureRequest#TONEMAP_MODE
      */
     @PublicKey
+    @NonNull
     public static final Key<int[]> TONEMAP_AVAILABLE_TONE_MAP_MODES =
             new Key<int[]>("android.tonemap.availableToneMapModes", int[].class);
 
@@ -3443,7 +3526,7 @@
      * <ul>
      *   <li>{@link #LED_AVAILABLE_LEDS_TRANSMIT TRANSMIT}</li>
      * </ul></p>
-     * <p><b>Optional</b> - This value may be {@code null} on some devices.</p>
+     * <p><b>Optional</b> - The value for this key may be {@code null} on some devices.</p>
      * @see #LED_AVAILABLE_LEDS_TRANSMIT
      * @hide
      */
@@ -3534,6 +3617,7 @@
      * @see #INFO_SUPPORTED_HARDWARE_LEVEL_EXTERNAL
      */
     @PublicKey
+    @NonNull
     public static final Key<Integer> INFO_SUPPORTED_HARDWARE_LEVEL =
             new Key<Integer>("android.info.supportedHardwareLevel", int.class);
 
@@ -3543,9 +3627,10 @@
      * <p>This can be used in {@link android.media.ExifInterface#TAG_IMAGE_DESCRIPTION TAG_IMAGE_DESCRIPTION}
      * in jpeg EXIF. This key may be absent if no version information is available on the
      * device.</p>
-     * <p><b>Optional</b> - This value may be {@code null} on some devices.</p>
+     * <p><b>Optional</b> - The value for this key may be {@code null} on some devices.</p>
      */
     @PublicKey
+    @NonNull
     public static final Key<String> INFO_VERSION =
             new Key<String>("android.info.version", String.class);
 
@@ -3572,6 +3657,7 @@
      * @see #SYNC_MAX_LATENCY_UNKNOWN
      */
     @PublicKey
+    @NonNull
     public static final Key<Integer> SYNC_MAX_LATENCY =
             new Key<Integer>("android.sync.maxLatency", int.class);
 
@@ -3598,7 +3684,7 @@
      * <p><b>Units</b>: Number of frames.</p>
      * <p><b>Range of valid values:</b><br>
      * &lt;= 4</p>
-     * <p><b>Optional</b> - This value may be {@code null} on some devices.</p>
+     * <p><b>Optional</b> - The value for this key may be {@code null} on some devices.</p>
      * <p><b>Limited capability</b> -
      * Present on all camera devices that report being at least {@link CameraCharacteristics#INFO_SUPPORTED_HARDWARE_LEVEL_LIMITED HARDWARE_LEVEL_LIMITED} devices in the
      * {@link CameraCharacteristics#INFO_SUPPORTED_HARDWARE_LEVEL android.info.supportedHardwareLevel} key</p>
@@ -3607,6 +3693,7 @@
      * @see CameraCharacteristics#REQUEST_AVAILABLE_CAPABILITIES
      */
     @PublicKey
+    @NonNull
     public static final Key<Integer> REPROCESS_MAX_CAPTURE_STALL =
             new Key<Integer>("android.reprocess.maxCaptureStall", int.class);
 
@@ -3625,7 +3712,7 @@
      * the format in this list as <code>(HAL_PIXEL_FORMAT_BLOB,
      * android.depth.maxDepthSamples, 1, OUTPUT)</code> in addition to
      * the entries for HAL_PIXEL_FORMAT_Y16.</p>
-     * <p><b>Optional</b> - This value may be {@code null} on some devices.</p>
+     * <p><b>Optional</b> - The value for this key may be {@code null} on some devices.</p>
      * <p><b>Limited capability</b> -
      * Present on all camera devices that report being at least {@link CameraCharacteristics#INFO_SUPPORTED_HARDWARE_LEVEL_LIMITED HARDWARE_LEVEL_LIMITED} devices in the
      * {@link CameraCharacteristics#INFO_SUPPORTED_HARDWARE_LEVEL android.info.supportedHardwareLevel} key</p>
@@ -3650,7 +3737,7 @@
      * android.scaler.availableStallDurations for more details about
      * calculating the max frame rate.</p>
      * <p><b>Units</b>: (format, width, height, ns) x n</p>
-     * <p><b>Optional</b> - This value may be {@code null} on some devices.</p>
+     * <p><b>Optional</b> - The value for this key may be {@code null} on some devices.</p>
      * <p><b>Limited capability</b> -
      * Present on all camera devices that report being at least {@link CameraCharacteristics#INFO_SUPPORTED_HARDWARE_LEVEL_LIMITED HARDWARE_LEVEL_LIMITED} devices in the
      * {@link CameraCharacteristics#INFO_SUPPORTED_HARDWARE_LEVEL android.info.supportedHardwareLevel} key</p>
@@ -3674,7 +3761,7 @@
      * <p>All depth output stream formats may have a nonzero stall
      * duration.</p>
      * <p><b>Units</b>: (format, width, height, ns) x n</p>
-     * <p><b>Optional</b> - This value may be {@code null} on some devices.</p>
+     * <p><b>Optional</b> - The value for this key may be {@code null} on some devices.</p>
      * <p><b>Limited capability</b> -
      * Present on all camera devices that report being at least {@link CameraCharacteristics#INFO_SUPPORTED_HARDWARE_LEVEL_LIMITED HARDWARE_LEVEL_LIMITED} devices in the
      * {@link CameraCharacteristics#INFO_SUPPORTED_HARDWARE_LEVEL android.info.supportedHardwareLevel} key</p>
@@ -3697,7 +3784,7 @@
      * need to emit a specific pattern or wavelength of light to
      * measure depth values, which causes the color image to be
      * corrupted during depth measurement.</p>
-     * <p><b>Optional</b> - This value may be {@code null} on some devices.</p>
+     * <p><b>Optional</b> - The value for this key may be {@code null} on some devices.</p>
      * <p><b>Limited capability</b> -
      * Present on all camera devices that report being at least {@link CameraCharacteristics#INFO_SUPPORTED_HARDWARE_LEVEL_LIMITED HARDWARE_LEVEL_LIMITED} devices in the
      * {@link CameraCharacteristics#INFO_SUPPORTED_HARDWARE_LEVEL android.info.supportedHardwareLevel} key</p>
@@ -3705,6 +3792,7 @@
      * @see CameraCharacteristics#INFO_SUPPORTED_HARDWARE_LEVEL
      */
     @PublicKey
+    @NonNull
     public static final Key<Boolean> DEPTH_DEPTH_IS_EXCLUSIVE =
             new Key<Boolean>("android.depth.depthIsExclusive", boolean.class);
 
@@ -3717,7 +3805,7 @@
      * power and performance efficient for specific use cases. For more information about
      * retrieving the suggestions see
      * {@link android.hardware.camera2.CameraCharacteristics#getRecommendedStreamConfigurationMap }.</p>
-     * <p><b>Optional</b> - This value may be {@code null} on some devices.</p>
+     * <p><b>Optional</b> - The value for this key may be {@code null} on some devices.</p>
      * @hide
      */
     public static final Key<android.hardware.camera2.params.RecommendedStreamConfiguration[]> DEPTH_AVAILABLE_RECOMMENDED_DEPTH_STREAM_CONFIGURATIONS =
@@ -3736,7 +3824,7 @@
      * the same aspect ratio can have dynamic depth dataspace
      * stream configuration. {@link CameraCharacteristics#DEPTH_DEPTH_IS_EXCLUSIVE android.depth.depthIsExclusive} also
      * needs to be set to FALSE.</p>
-     * <p><b>Optional</b> - This value may be {@code null} on some devices.</p>
+     * <p><b>Optional</b> - The value for this key may be {@code null} on some devices.</p>
      *
      * @see CameraCharacteristics#DEPTH_DEPTH_IS_EXCLUSIVE
      * @hide
@@ -3755,7 +3843,7 @@
      * <p>The minimum frame duration of a stream (of a particular format, size)
      * is the same regardless of whether the stream is input or output.</p>
      * <p><b>Units</b>: (format, width, height, ns) x n</p>
-     * <p><b>Optional</b> - This value may be {@code null} on some devices.</p>
+     * <p><b>Optional</b> - The value for this key may be {@code null} on some devices.</p>
      * @hide
      */
     public static final Key<android.hardware.camera2.params.StreamConfigurationDuration[]> DEPTH_AVAILABLE_DYNAMIC_DEPTH_MIN_FRAME_DURATIONS =
@@ -3770,7 +3858,7 @@
      * <p>All dynamic depth output streams may have a nonzero stall
      * duration.</p>
      * <p><b>Units</b>: (format, width, height, ns) x n</p>
-     * <p><b>Optional</b> - This value may be {@code null} on some devices.</p>
+     * <p><b>Optional</b> - The value for this key may be {@code null} on some devices.</p>
      * @hide
      */
     public static final Key<android.hardware.camera2.params.StreamConfigurationDuration[]> DEPTH_AVAILABLE_DYNAMIC_DEPTH_STALL_DURATIONS =
@@ -3785,7 +3873,7 @@
      * value of this tag will be ['2', '\0', '3', '\0'].</p>
      * <p>The number of physical camera IDs must be no less than 2.</p>
      * <p><b>Units</b>: UTF-8 null-terminated string</p>
-     * <p><b>Optional</b> - This value may be {@code null} on some devices.</p>
+     * <p><b>Optional</b> - The value for this key may be {@code null} on some devices.</p>
      * <p><b>Limited capability</b> -
      * Present on all camera devices that report being at least {@link CameraCharacteristics#INFO_SUPPORTED_HARDWARE_LEVEL_LIMITED HARDWARE_LEVEL_LIMITED} devices in the
      * {@link CameraCharacteristics#INFO_SUPPORTED_HARDWARE_LEVEL android.info.supportedHardwareLevel} key</p>
@@ -3811,7 +3899,7 @@
      *   <li>{@link #LOGICAL_MULTI_CAMERA_SENSOR_SYNC_TYPE_APPROXIMATE APPROXIMATE}</li>
      *   <li>{@link #LOGICAL_MULTI_CAMERA_SENSOR_SYNC_TYPE_CALIBRATED CALIBRATED}</li>
      * </ul></p>
-     * <p><b>Optional</b> - This value may be {@code null} on some devices.</p>
+     * <p><b>Optional</b> - The value for this key may be {@code null} on some devices.</p>
      * <p><b>Limited capability</b> -
      * Present on all camera devices that report being at least {@link CameraCharacteristics#INFO_SUPPORTED_HARDWARE_LEVEL_LIMITED HARDWARE_LEVEL_LIMITED} devices in the
      * {@link CameraCharacteristics#INFO_SUPPORTED_HARDWARE_LEVEL android.info.supportedHardwareLevel} key</p>
@@ -3821,6 +3909,7 @@
      * @see #LOGICAL_MULTI_CAMERA_SENSOR_SYNC_TYPE_CALIBRATED
      */
     @PublicKey
+    @NonNull
     public static final Key<Integer> LOGICAL_MULTI_CAMERA_SENSOR_SYNC_TYPE =
             new Key<Integer>("android.logicalMultiCamera.sensorSyncType", int.class);
 
@@ -3831,11 +3920,12 @@
      * All devices that support this API will list both FAST and HIGH_QUALITY.</p>
      * <p><b>Range of valid values:</b><br>
      * Any value listed in {@link CaptureRequest#DISTORTION_CORRECTION_MODE android.distortionCorrection.mode}</p>
-     * <p><b>Optional</b> - This value may be {@code null} on some devices.</p>
+     * <p><b>Optional</b> - The value for this key may be {@code null} on some devices.</p>
      *
      * @see CaptureRequest#DISTORTION_CORRECTION_MODE
      */
     @PublicKey
+    @NonNull
     public static final Key<int[]> DISTORTION_CORRECTION_AVAILABLE_MODES =
             new Key<int[]>("android.distortionCorrection.availableModes", int[].class);
 
@@ -3849,7 +3939,7 @@
      * image format as required by the device's hardware level and capabilities.</p>
      * <p>All the static, control, and dynamic metadata tags related to JPEG apply to HEIC formats.
      * Configuring JPEG and HEIC streams at the same time is not supported.</p>
-     * <p><b>Optional</b> - This value may be {@code null} on some devices.</p>
+     * <p><b>Optional</b> - The value for this key may be {@code null} on some devices.</p>
      * <p><b>Limited capability</b> -
      * Present on all camera devices that report being at least {@link CameraCharacteristics#INFO_SUPPORTED_HARDWARE_LEVEL_LIMITED HARDWARE_LEVEL_LIMITED} devices in the
      * {@link CameraCharacteristics#INFO_SUPPORTED_HARDWARE_LEVEL android.info.supportedHardwareLevel} key</p>
@@ -3872,7 +3962,7 @@
      * android.scaler.availableStallDurations for more details about
      * calculating the max frame rate.</p>
      * <p><b>Units</b>: (format, width, height, ns) x n</p>
-     * <p><b>Optional</b> - This value may be {@code null} on some devices.</p>
+     * <p><b>Optional</b> - The value for this key may be {@code null} on some devices.</p>
      * <p><b>Limited capability</b> -
      * Present on all camera devices that report being at least {@link CameraCharacteristics#INFO_SUPPORTED_HARDWARE_LEVEL_LIMITED HARDWARE_LEVEL_LIMITED} devices in the
      * {@link CameraCharacteristics#INFO_SUPPORTED_HARDWARE_LEVEL android.info.supportedHardwareLevel} key</p>
@@ -3896,7 +3986,7 @@
      * <p>All HEIC output stream formats may have a nonzero stall
      * duration.</p>
      * <p><b>Units</b>: (format, width, height, ns) x n</p>
-     * <p><b>Optional</b> - This value may be {@code null} on some devices.</p>
+     * <p><b>Optional</b> - The value for this key may be {@code null} on some devices.</p>
      * <p><b>Limited capability</b> -
      * Present on all camera devices that report being at least {@link CameraCharacteristics#INFO_SUPPORTED_HARDWARE_LEVEL_LIMITED HARDWARE_LEVEL_LIMITED} devices in the
      * {@link CameraCharacteristics#INFO_SUPPORTED_HARDWARE_LEVEL android.info.supportedHardwareLevel} key</p>
@@ -3913,4 +4003,7 @@
 
 
 
+
+
+
 }
diff --git a/core/java/android/hardware/camera2/CameraManager.java b/core/java/android/hardware/camera2/CameraManager.java
index 536c2e1..23401432 100644
--- a/core/java/android/hardware/camera2/CameraManager.java
+++ b/core/java/android/hardware/camera2/CameraManager.java
@@ -678,6 +678,31 @@
         public void onCameraUnavailable(@NonNull String cameraId) {
             // default empty implementation
         }
+
+        /**
+         * Notify registered clients about a change in the camera access priorities.
+         *
+         * <p>Notification that camera access priorities have changed and the camera may
+         * now be openable. An application that was previously denied camera access due to
+         * a higher-priority user already using the camera, or that was disconnected from an
+         * active camera session due to a higher-priority user trying to open the camera,
+         * should try to open the camera again if it still wants to use it.  Note that
+         * multiple applications may receive this callback at the same time, and only one of
+         * them will succeed in opening the camera in practice, depending on exact access
+         * priority levels and timing. This method is useful in cases where multiple
+         * applications may be in the resumed state at the same time, and the user switches
+         * focus between them, or if the current camera-using application moves between
+         * full-screen and Picture-in-Picture (PiP) states. In such cases, the camera
+         * available/unavailable callbacks will not be invoked, but another application may
+         * now have higher priority for camera access than the current camera-using
+         * application.</p>
+         *
+         * <p>The default implementation of this method does nothing.</p>
+         *
+         */
+        public void onCameraAccessPrioritiesChanged() {
+            // default empty implementation
+        }
     }
 
     /**
@@ -1098,6 +1123,22 @@
             }
         }
 
+        private void postSingleAccessPriorityChangeUpdate(final AvailabilityCallback callback,
+                final Executor executor) {
+            final long ident = Binder.clearCallingIdentity();
+            try {
+                executor.execute(
+                    new Runnable() {
+                        @Override
+                        public void run() {
+                            callback.onCameraAccessPrioritiesChanged();
+                        }
+                    });
+            } finally {
+                Binder.restoreCallingIdentity(ident);
+            }
+        }
+
         private void postSingleUpdate(final AvailabilityCallback callback, final Executor executor,
                 final String id, final int status) {
             if (isAvailable(status)) {
@@ -1347,6 +1388,19 @@
             }
         }
 
+        @Override
+        public void onCameraAccessPrioritiesChanged() {
+            synchronized (mLock) {
+                final int callbackCount = mCallbackMap.size();
+                for (int i = 0; i < callbackCount; i++) {
+                    Executor executor = mCallbackMap.valueAt(i);
+                    final AvailabilityCallback callback = mCallbackMap.keyAt(i);
+
+                    postSingleAccessPriorityChangeUpdate(callback, executor);
+                }
+            }
+        }
+
         /**
          * Try to connect to camera service after some delay if any client registered camera
          * availability callback or torch status callback.
diff --git a/core/java/android/hardware/camera2/CaptureRequest.java b/core/java/android/hardware/camera2/CaptureRequest.java
index 5250701..eddfd7d 100644
--- a/core/java/android/hardware/camera2/CaptureRequest.java
+++ b/core/java/android/hardware/camera2/CaptureRequest.java
@@ -120,7 +120,7 @@
          * {@link CaptureRequest}, and not need to construct their own Key objects. However, they
          * may be useful for testing purposes and for defining custom capture request fields.</p>
          */
-        public Key(String name, Class<T> type) {
+        public Key(@NonNull String name, @NonNull Class<T> type) {
             mKey = new CameraMetadataNative.Key<T>(name, type);
         }
 
@@ -493,7 +493,7 @@
         return HashCodeHelpers.hashCodeGeneric(mPhysicalCameraSettings, mSurfaceSet, mUserTag);
     }
 
-    public static final Parcelable.Creator<CaptureRequest> CREATOR =
+    public static final @android.annotation.NonNull Parcelable.Creator<CaptureRequest> CREATOR =
             new Parcelable.Creator<CaptureRequest>() {
         @Override
         public CaptureRequest createFromParcel(Parcel in) {
@@ -978,7 +978,7 @@
      *   <li>{@link #COLOR_CORRECTION_MODE_FAST FAST}</li>
      *   <li>{@link #COLOR_CORRECTION_MODE_HIGH_QUALITY HIGH_QUALITY}</li>
      * </ul></p>
-     * <p><b>Optional</b> - This value may be {@code null} on some devices.</p>
+     * <p><b>Optional</b> - The value for this key may be {@code null} on some devices.</p>
      * <p><b>Full capability</b> -
      * Present on all camera devices that report being {@link CameraCharacteristics#INFO_SUPPORTED_HARDWARE_LEVEL_FULL HARDWARE_LEVEL_FULL} devices in the
      * {@link CameraCharacteristics#INFO_SUPPORTED_HARDWARE_LEVEL android.info.supportedHardwareLevel} key</p>
@@ -992,6 +992,7 @@
      * @see #COLOR_CORRECTION_MODE_HIGH_QUALITY
      */
     @PublicKey
+    @NonNull
     public static final Key<Integer> COLOR_CORRECTION_MODE =
             new Key<Integer>("android.colorCorrection.mode", int.class);
 
@@ -1010,7 +1011,7 @@
      * <p>The valid range of each matrix element varies on different devices, but
      * values within [-1.5, 3.0] are guaranteed not to be clipped.</p>
      * <p><b>Units</b>: Unitless scale factors</p>
-     * <p><b>Optional</b> - This value may be {@code null} on some devices.</p>
+     * <p><b>Optional</b> - The value for this key may be {@code null} on some devices.</p>
      * <p><b>Full capability</b> -
      * Present on all camera devices that report being {@link CameraCharacteristics#INFO_SUPPORTED_HARDWARE_LEVEL_FULL HARDWARE_LEVEL_FULL} devices in the
      * {@link CameraCharacteristics#INFO_SUPPORTED_HARDWARE_LEVEL android.info.supportedHardwareLevel} key</p>
@@ -1019,6 +1020,7 @@
      * @see CameraCharacteristics#INFO_SUPPORTED_HARDWARE_LEVEL
      */
     @PublicKey
+    @NonNull
     public static final Key<android.hardware.camera2.params.ColorSpaceTransform> COLOR_CORRECTION_TRANSFORM =
             new Key<android.hardware.camera2.params.ColorSpaceTransform>("android.colorCorrection.transform", android.hardware.camera2.params.ColorSpaceTransform.class);
 
@@ -1037,7 +1039,7 @@
      * device allows gains below 1.0, this is usually not recommended because
      * this can create color artifacts.</p>
      * <p><b>Units</b>: Unitless gain factors</p>
-     * <p><b>Optional</b> - This value may be {@code null} on some devices.</p>
+     * <p><b>Optional</b> - The value for this key may be {@code null} on some devices.</p>
      * <p><b>Full capability</b> -
      * Present on all camera devices that report being {@link CameraCharacteristics#INFO_SUPPORTED_HARDWARE_LEVEL_FULL HARDWARE_LEVEL_FULL} devices in the
      * {@link CameraCharacteristics#INFO_SUPPORTED_HARDWARE_LEVEL android.info.supportedHardwareLevel} key</p>
@@ -1046,6 +1048,7 @@
      * @see CameraCharacteristics#INFO_SUPPORTED_HARDWARE_LEVEL
      */
     @PublicKey
+    @NonNull
     public static final Key<android.hardware.camera2.params.RggbChannelVector> COLOR_CORRECTION_GAINS =
             new Key<android.hardware.camera2.params.RggbChannelVector>("android.colorCorrection.gains", android.hardware.camera2.params.RggbChannelVector.class);
 
@@ -1078,6 +1081,7 @@
      * @see #COLOR_CORRECTION_ABERRATION_MODE_HIGH_QUALITY
      */
     @PublicKey
+    @NonNull
     public static final Key<Integer> COLOR_CORRECTION_ABERRATION_MODE =
             new Key<Integer>("android.colorCorrection.aberrationMode", int.class);
 
@@ -1134,6 +1138,7 @@
      * @see #CONTROL_AE_ANTIBANDING_MODE_AUTO
      */
     @PublicKey
+    @NonNull
     public static final Key<Integer> CONTROL_AE_ANTIBANDING_MODE =
             new Key<Integer>("android.control.aeAntibandingMode", int.class);
 
@@ -1167,6 +1172,7 @@
      * @see CaptureResult#CONTROL_AE_STATE
      */
     @PublicKey
+    @NonNull
     public static final Key<Integer> CONTROL_AE_EXPOSURE_COMPENSATION =
             new Key<Integer>("android.control.aeExposureCompensation", int.class);
 
@@ -1217,6 +1223,7 @@
      * @see CaptureRequest#SENSOR_SENSITIVITY
      */
     @PublicKey
+    @NonNull
     public static final Key<Boolean> CONTROL_AE_LOCK =
             new Key<Boolean>("android.control.aeLock", boolean.class);
 
@@ -1269,6 +1276,7 @@
      * @see #CONTROL_AE_MODE_ON_EXTERNAL_FLASH
      */
     @PublicKey
+    @NonNull
     public static final Key<Integer> CONTROL_AE_MODE =
             new Key<Integer>("android.control.aeMode", int.class);
 
@@ -1320,7 +1328,7 @@
      * Coordinates must be between <code>[(0,0), (width, height))</code> of
      * {@link CameraCharacteristics#SENSOR_INFO_ACTIVE_ARRAY_SIZE android.sensor.info.activeArraySize} or {@link CameraCharacteristics#SENSOR_INFO_PRE_CORRECTION_ACTIVE_ARRAY_SIZE android.sensor.info.preCorrectionActiveArraySize}
      * depending on distortion correction capability and mode</p>
-     * <p><b>Optional</b> - This value may be {@code null} on some devices.</p>
+     * <p><b>Optional</b> - The value for this key may be {@code null} on some devices.</p>
      *
      * @see CameraCharacteristics#CONTROL_MAX_REGIONS_AE
      * @see CaptureRequest#DISTORTION_CORRECTION_MODE
@@ -1329,6 +1337,7 @@
      * @see CameraCharacteristics#SENSOR_INFO_PRE_CORRECTION_ACTIVE_ARRAY_SIZE
      */
     @PublicKey
+    @NonNull
     public static final Key<android.hardware.camera2.params.MeteringRectangle[]> CONTROL_AE_REGIONS =
             new Key<android.hardware.camera2.params.MeteringRectangle[]>("android.control.aeRegions", android.hardware.camera2.params.MeteringRectangle[].class);
 
@@ -1349,6 +1358,7 @@
      * @see CaptureRequest#SENSOR_FRAME_DURATION
      */
     @PublicKey
+    @NonNull
     public static final Key<android.util.Range<Integer>> CONTROL_AE_TARGET_FPS_RANGE =
             new Key<android.util.Range<Integer>>("android.control.aeTargetFpsRange", new TypeReference<android.util.Range<Integer>>() {{ }});
 
@@ -1407,7 +1417,7 @@
      *   <li>{@link #CONTROL_AE_PRECAPTURE_TRIGGER_START START}</li>
      *   <li>{@link #CONTROL_AE_PRECAPTURE_TRIGGER_CANCEL CANCEL}</li>
      * </ul></p>
-     * <p><b>Optional</b> - This value may be {@code null} on some devices.</p>
+     * <p><b>Optional</b> - The value for this key may be {@code null} on some devices.</p>
      * <p><b>Limited capability</b> -
      * Present on all camera devices that report being at least {@link CameraCharacteristics#INFO_SUPPORTED_HARDWARE_LEVEL_LIMITED HARDWARE_LEVEL_LIMITED} devices in the
      * {@link CameraCharacteristics#INFO_SUPPORTED_HARDWARE_LEVEL android.info.supportedHardwareLevel} key</p>
@@ -1422,6 +1432,7 @@
      * @see #CONTROL_AE_PRECAPTURE_TRIGGER_CANCEL
      */
     @PublicKey
+    @NonNull
     public static final Key<Integer> CONTROL_AE_PRECAPTURE_TRIGGER =
             new Key<Integer>("android.control.aePrecaptureTrigger", int.class);
 
@@ -1463,6 +1474,7 @@
      * @see #CONTROL_AF_MODE_EDOF
      */
     @PublicKey
+    @NonNull
     public static final Key<Integer> CONTROL_AF_MODE =
             new Key<Integer>("android.control.afMode", int.class);
 
@@ -1515,7 +1527,7 @@
      * Coordinates must be between <code>[(0,0), (width, height))</code> of
      * {@link CameraCharacteristics#SENSOR_INFO_ACTIVE_ARRAY_SIZE android.sensor.info.activeArraySize} or {@link CameraCharacteristics#SENSOR_INFO_PRE_CORRECTION_ACTIVE_ARRAY_SIZE android.sensor.info.preCorrectionActiveArraySize}
      * depending on distortion correction capability and mode</p>
-     * <p><b>Optional</b> - This value may be {@code null} on some devices.</p>
+     * <p><b>Optional</b> - The value for this key may be {@code null} on some devices.</p>
      *
      * @see CameraCharacteristics#CONTROL_MAX_REGIONS_AF
      * @see CaptureRequest#DISTORTION_CORRECTION_MODE
@@ -1524,6 +1536,7 @@
      * @see CameraCharacteristics#SENSOR_INFO_PRE_CORRECTION_ACTIVE_ARRAY_SIZE
      */
     @PublicKey
+    @NonNull
     public static final Key<android.hardware.camera2.params.MeteringRectangle[]> CONTROL_AF_REGIONS =
             new Key<android.hardware.camera2.params.MeteringRectangle[]>("android.control.afRegions", android.hardware.camera2.params.MeteringRectangle[].class);
 
@@ -1561,6 +1574,7 @@
      * @see #CONTROL_AF_TRIGGER_CANCEL
      */
     @PublicKey
+    @NonNull
     public static final Key<Integer> CONTROL_AF_TRIGGER =
             new Key<Integer>("android.control.afTrigger", int.class);
 
@@ -1591,6 +1605,7 @@
      * @see CaptureRequest#CONTROL_AWB_MODE
      */
     @PublicKey
+    @NonNull
     public static final Key<Boolean> CONTROL_AWB_LOCK =
             new Key<Boolean>("android.control.awbLock", boolean.class);
 
@@ -1651,6 +1666,7 @@
      * @see #CONTROL_AWB_MODE_SHADE
      */
     @PublicKey
+    @NonNull
     public static final Key<Integer> CONTROL_AWB_MODE =
             new Key<Integer>("android.control.awbMode", int.class);
 
@@ -1703,7 +1719,7 @@
      * Coordinates must be between <code>[(0,0), (width, height))</code> of
      * {@link CameraCharacteristics#SENSOR_INFO_ACTIVE_ARRAY_SIZE android.sensor.info.activeArraySize} or {@link CameraCharacteristics#SENSOR_INFO_PRE_CORRECTION_ACTIVE_ARRAY_SIZE android.sensor.info.preCorrectionActiveArraySize}
      * depending on distortion correction capability and mode</p>
-     * <p><b>Optional</b> - This value may be {@code null} on some devices.</p>
+     * <p><b>Optional</b> - The value for this key may be {@code null} on some devices.</p>
      *
      * @see CameraCharacteristics#CONTROL_MAX_REGIONS_AWB
      * @see CaptureRequest#DISTORTION_CORRECTION_MODE
@@ -1712,6 +1728,7 @@
      * @see CameraCharacteristics#SENSOR_INFO_PRE_CORRECTION_ACTIVE_ARRAY_SIZE
      */
     @PublicKey
+    @NonNull
     public static final Key<android.hardware.camera2.params.MeteringRectangle[]> CONTROL_AWB_REGIONS =
             new Key<android.hardware.camera2.params.MeteringRectangle[]>("android.control.awbRegions", android.hardware.camera2.params.MeteringRectangle[].class);
 
@@ -1754,6 +1771,7 @@
      * @see #CONTROL_CAPTURE_INTENT_MOTION_TRACKING
      */
     @PublicKey
+    @NonNull
     public static final Key<Integer> CONTROL_CAPTURE_INTENT =
             new Key<Integer>("android.control.captureIntent", int.class);
 
@@ -1793,6 +1811,7 @@
      * @see #CONTROL_EFFECT_MODE_AQUA
      */
     @PublicKey
+    @NonNull
     public static final Key<Integer> CONTROL_EFFECT_MODE =
             new Key<Integer>("android.control.effectMode", int.class);
 
@@ -1833,6 +1852,7 @@
      * @see #CONTROL_MODE_OFF_KEEP_STATE
      */
     @PublicKey
+    @NonNull
     public static final Key<Integer> CONTROL_MODE =
             new Key<Integer>("android.control.mode", int.class);
 
@@ -1900,6 +1920,7 @@
      * @see #CONTROL_SCENE_MODE_HDR
      */
     @PublicKey
+    @NonNull
     public static final Key<Integer> CONTROL_SCENE_MODE =
             new Key<Integer>("android.control.sceneMode", int.class);
 
@@ -1943,6 +1964,7 @@
      * @see #CONTROL_VIDEO_STABILIZATION_MODE_ON
      */
     @PublicKey
+    @NonNull
     public static final Key<Integer> CONTROL_VIDEO_STABILIZATION_MODE =
             new Key<Integer>("android.control.videoStabilizationMode", int.class);
 
@@ -1969,7 +1991,7 @@
      * <p><b>Units</b>: ISO arithmetic units, the same as {@link CaptureRequest#SENSOR_SENSITIVITY android.sensor.sensitivity}</p>
      * <p><b>Range of valid values:</b><br>
      * {@link CameraCharacteristics#CONTROL_POST_RAW_SENSITIVITY_BOOST_RANGE android.control.postRawSensitivityBoostRange}</p>
-     * <p><b>Optional</b> - This value may be {@code null} on some devices.</p>
+     * <p><b>Optional</b> - The value for this key may be {@code null} on some devices.</p>
      *
      * @see CaptureRequest#CONTROL_AE_MODE
      * @see CaptureRequest#CONTROL_MODE
@@ -1978,6 +2000,7 @@
      * @see CaptureRequest#SENSOR_SENSITIVITY
      */
     @PublicKey
+    @NonNull
     public static final Key<Integer> CONTROL_POST_RAW_SENSITIVITY_BOOST =
             new Key<Integer>("android.control.postRawSensitivityBoost", int.class);
 
@@ -2005,12 +2028,13 @@
      * <p>For applications targeting SDK versions older than O, the value of enableZsl in all
      * capture templates is always <code>false</code> if present.</p>
      * <p>For application-operated ZSL, use CAMERA3_TEMPLATE_ZERO_SHUTTER_LAG template.</p>
-     * <p><b>Optional</b> - This value may be {@code null} on some devices.</p>
+     * <p><b>Optional</b> - The value for this key may be {@code null} on some devices.</p>
      *
      * @see CaptureRequest#CONTROL_CAPTURE_INTENT
      * @see CaptureResult#SENSOR_TIMESTAMP
      */
     @PublicKey
+    @NonNull
     public static final Key<Boolean> CONTROL_ENABLE_ZSL =
             new Key<Boolean>("android.control.enableZsl", boolean.class);
 
@@ -2045,7 +2069,7 @@
      * </ul></p>
      * <p><b>Available values for this device:</b><br>
      * {@link CameraCharacteristics#EDGE_AVAILABLE_EDGE_MODES android.edge.availableEdgeModes}</p>
-     * <p><b>Optional</b> - This value may be {@code null} on some devices.</p>
+     * <p><b>Optional</b> - The value for this key may be {@code null} on some devices.</p>
      * <p><b>Full capability</b> -
      * Present on all camera devices that report being {@link CameraCharacteristics#INFO_SUPPORTED_HARDWARE_LEVEL_FULL HARDWARE_LEVEL_FULL} devices in the
      * {@link CameraCharacteristics#INFO_SUPPORTED_HARDWARE_LEVEL android.info.supportedHardwareLevel} key</p>
@@ -2059,6 +2083,7 @@
      * @see #EDGE_MODE_ZERO_SHUTTER_LAG
      */
     @PublicKey
+    @NonNull
     public static final Key<Integer> EDGE_MODE =
             new Key<Integer>("android.edge.mode", int.class);
 
@@ -2094,6 +2119,7 @@
      * @see #FLASH_MODE_TORCH
      */
     @PublicKey
+    @NonNull
     public static final Key<Integer> FLASH_MODE =
             new Key<Integer>("android.flash.mode", int.class);
 
@@ -2110,7 +2136,7 @@
      * </ul></p>
      * <p><b>Available values for this device:</b><br>
      * {@link CameraCharacteristics#HOT_PIXEL_AVAILABLE_HOT_PIXEL_MODES android.hotPixel.availableHotPixelModes}</p>
-     * <p><b>Optional</b> - This value may be {@code null} on some devices.</p>
+     * <p><b>Optional</b> - The value for this key may be {@code null} on some devices.</p>
      *
      * @see CameraCharacteristics#HOT_PIXEL_AVAILABLE_HOT_PIXEL_MODES
      * @see #HOT_PIXEL_MODE_OFF
@@ -2118,6 +2144,7 @@
      * @see #HOT_PIXEL_MODE_HIGH_QUALITY
      */
     @PublicKey
+    @NonNull
     public static final Key<Integer> HOT_PIXEL_MODE =
             new Key<Integer>("android.hotPixel.mode", int.class);
 
@@ -2130,6 +2157,7 @@
      * <p>This key is available on all devices.</p>
      */
     @PublicKey
+    @NonNull
     @SyntheticKey
     public static final Key<android.location.Location> JPEG_GPS_LOCATION =
             new Key<android.location.Location>("android.jpeg.gpsLocation", android.location.Location.class);
@@ -2211,6 +2239,7 @@
      * @see CameraCharacteristics#SENSOR_ORIENTATION
      */
     @PublicKey
+    @NonNull
     public static final Key<Integer> JPEG_ORIENTATION =
             new Key<Integer>("android.jpeg.orientation", int.class);
 
@@ -2224,6 +2253,7 @@
      * <p>This key is available on all devices.</p>
      */
     @PublicKey
+    @NonNull
     public static final Key<Byte> JPEG_QUALITY =
             new Key<Byte>("android.jpeg.quality", byte.class);
 
@@ -2236,6 +2266,7 @@
      * <p>This key is available on all devices.</p>
      */
     @PublicKey
+    @NonNull
     public static final Key<Byte> JPEG_THUMBNAIL_QUALITY =
             new Key<Byte>("android.jpeg.thumbnailQuality", byte.class);
 
@@ -2275,6 +2306,7 @@
      * @see CaptureRequest#JPEG_ORIENTATION
      */
     @PublicKey
+    @NonNull
     public static final Key<android.util.Size> JPEG_THUMBNAIL_SIZE =
             new Key<android.util.Size>("android.jpeg.thumbnailSize", android.util.Size.class);
 
@@ -2298,7 +2330,7 @@
      * <p><b>Units</b>: The f-number (f/N)</p>
      * <p><b>Range of valid values:</b><br>
      * {@link CameraCharacteristics#LENS_INFO_AVAILABLE_APERTURES android.lens.info.availableApertures}</p>
-     * <p><b>Optional</b> - This value may be {@code null} on some devices.</p>
+     * <p><b>Optional</b> - The value for this key may be {@code null} on some devices.</p>
      * <p><b>Full capability</b> -
      * Present on all camera devices that report being {@link CameraCharacteristics#INFO_SUPPORTED_HARDWARE_LEVEL_FULL HARDWARE_LEVEL_FULL} devices in the
      * {@link CameraCharacteristics#INFO_SUPPORTED_HARDWARE_LEVEL android.info.supportedHardwareLevel} key</p>
@@ -2312,6 +2344,7 @@
      * @see CaptureRequest#SENSOR_SENSITIVITY
      */
     @PublicKey
+    @NonNull
     public static final Key<Float> LENS_APERTURE =
             new Key<Float>("android.lens.aperture", float.class);
 
@@ -2332,7 +2365,7 @@
      * <p><b>Units</b>: Exposure Value (EV)</p>
      * <p><b>Range of valid values:</b><br>
      * {@link CameraCharacteristics#LENS_INFO_AVAILABLE_FILTER_DENSITIES android.lens.info.availableFilterDensities}</p>
-     * <p><b>Optional</b> - This value may be {@code null} on some devices.</p>
+     * <p><b>Optional</b> - The value for this key may be {@code null} on some devices.</p>
      * <p><b>Full capability</b> -
      * Present on all camera devices that report being {@link CameraCharacteristics#INFO_SUPPORTED_HARDWARE_LEVEL_FULL HARDWARE_LEVEL_FULL} devices in the
      * {@link CameraCharacteristics#INFO_SUPPORTED_HARDWARE_LEVEL android.info.supportedHardwareLevel} key</p>
@@ -2342,6 +2375,7 @@
      * @see CaptureResult#LENS_STATE
      */
     @PublicKey
+    @NonNull
     public static final Key<Float> LENS_FILTER_DENSITY =
             new Key<Float>("android.lens.filterDensity", float.class);
 
@@ -2367,6 +2401,7 @@
      * @see CaptureResult#LENS_STATE
      */
     @PublicKey
+    @NonNull
     public static final Key<Float> LENS_FOCAL_LENGTH =
             new Key<Float>("android.lens.focalLength", float.class);
 
@@ -2387,7 +2422,7 @@
      * <p><b>Units</b>: See {@link CameraCharacteristics#LENS_INFO_FOCUS_DISTANCE_CALIBRATION android.lens.info.focusDistanceCalibration} for details</p>
      * <p><b>Range of valid values:</b><br>
      * &gt;= 0</p>
-     * <p><b>Optional</b> - This value may be {@code null} on some devices.</p>
+     * <p><b>Optional</b> - The value for this key may be {@code null} on some devices.</p>
      * <p><b>Full capability</b> -
      * Present on all camera devices that report being {@link CameraCharacteristics#INFO_SUPPORTED_HARDWARE_LEVEL_FULL HARDWARE_LEVEL_FULL} devices in the
      * {@link CameraCharacteristics#INFO_SUPPORTED_HARDWARE_LEVEL android.info.supportedHardwareLevel} key</p>
@@ -2399,6 +2434,7 @@
      * @see CaptureResult#LENS_STATE
      */
     @PublicKey
+    @NonNull
     public static final Key<Float> LENS_FOCUS_DISTANCE =
             new Key<Float>("android.lens.focusDistance", float.class);
 
@@ -2429,7 +2465,7 @@
      * </ul></p>
      * <p><b>Available values for this device:</b><br>
      * {@link CameraCharacteristics#LENS_INFO_AVAILABLE_OPTICAL_STABILIZATION android.lens.info.availableOpticalStabilization}</p>
-     * <p><b>Optional</b> - This value may be {@code null} on some devices.</p>
+     * <p><b>Optional</b> - The value for this key may be {@code null} on some devices.</p>
      * <p><b>Limited capability</b> -
      * Present on all camera devices that report being at least {@link CameraCharacteristics#INFO_SUPPORTED_HARDWARE_LEVEL_LIMITED HARDWARE_LEVEL_LIMITED} devices in the
      * {@link CameraCharacteristics#INFO_SUPPORTED_HARDWARE_LEVEL android.info.supportedHardwareLevel} key</p>
@@ -2441,6 +2477,7 @@
      * @see #LENS_OPTICAL_STABILIZATION_MODE_ON
      */
     @PublicKey
+    @NonNull
     public static final Key<Integer> LENS_OPTICAL_STABILIZATION_MODE =
             new Key<Integer>("android.lens.opticalStabilizationMode", int.class);
 
@@ -2481,7 +2518,7 @@
      * </ul></p>
      * <p><b>Available values for this device:</b><br>
      * {@link CameraCharacteristics#NOISE_REDUCTION_AVAILABLE_NOISE_REDUCTION_MODES android.noiseReduction.availableNoiseReductionModes}</p>
-     * <p><b>Optional</b> - This value may be {@code null} on some devices.</p>
+     * <p><b>Optional</b> - The value for this key may be {@code null} on some devices.</p>
      * <p><b>Full capability</b> -
      * Present on all camera devices that report being {@link CameraCharacteristics#INFO_SUPPORTED_HARDWARE_LEVEL_FULL HARDWARE_LEVEL_FULL} devices in the
      * {@link CameraCharacteristics#INFO_SUPPORTED_HARDWARE_LEVEL android.info.supportedHardwareLevel} key</p>
@@ -2496,6 +2533,7 @@
      * @see #NOISE_REDUCTION_MODE_ZERO_SHUTTER_LAG
      */
     @PublicKey
+    @NonNull
     public static final Key<Integer> NOISE_REDUCTION_MODE =
             new Key<Integer>("android.noiseReduction.mode", int.class);
 
@@ -2506,7 +2544,7 @@
      * <p><b>Units</b>: arbitrary integer assigned by application</p>
      * <p><b>Range of valid values:</b><br>
      * Any int</p>
-     * <p><b>Optional</b> - This value may be {@code null} on some devices.</p>
+     * <p><b>Optional</b> - The value for this key may be {@code null} on some devices.</p>
      * @hide
      */
     public static final Key<Integer> REQUEST_ID =
@@ -2570,6 +2608,7 @@
      * @see CameraCharacteristics#SENSOR_INFO_PRE_CORRECTION_ACTIVE_ARRAY_SIZE
      */
     @PublicKey
+    @NonNull
     public static final Key<android.graphics.Rect> SCALER_CROP_REGION =
             new Key<android.graphics.Rect>("android.scaler.cropRegion", android.graphics.Rect.class);
 
@@ -2584,7 +2623,7 @@
      * <p><b>Units</b>: Nanoseconds</p>
      * <p><b>Range of valid values:</b><br>
      * {@link CameraCharacteristics#SENSOR_INFO_EXPOSURE_TIME_RANGE android.sensor.info.exposureTimeRange}</p>
-     * <p><b>Optional</b> - This value may be {@code null} on some devices.</p>
+     * <p><b>Optional</b> - The value for this key may be {@code null} on some devices.</p>
      * <p><b>Full capability</b> -
      * Present on all camera devices that report being {@link CameraCharacteristics#INFO_SUPPORTED_HARDWARE_LEVEL_FULL HARDWARE_LEVEL_FULL} devices in the
      * {@link CameraCharacteristics#INFO_SUPPORTED_HARDWARE_LEVEL android.info.supportedHardwareLevel} key</p>
@@ -2595,6 +2634,7 @@
      * @see CameraCharacteristics#SENSOR_INFO_EXPOSURE_TIME_RANGE
      */
     @PublicKey
+    @NonNull
     public static final Key<Long> SENSOR_EXPOSURE_TIME =
             new Key<Long>("android.sensor.exposureTime", long.class);
 
@@ -2665,7 +2705,7 @@
      * <p><b>Range of valid values:</b><br>
      * See {@link CameraCharacteristics#SENSOR_INFO_MAX_FRAME_DURATION android.sensor.info.maxFrameDuration}, {@link android.hardware.camera2.params.StreamConfigurationMap }.
      * The duration is capped to <code>max(duration, exposureTime + overhead)</code>.</p>
-     * <p><b>Optional</b> - This value may be {@code null} on some devices.</p>
+     * <p><b>Optional</b> - The value for this key may be {@code null} on some devices.</p>
      * <p><b>Full capability</b> -
      * Present on all camera devices that report being {@link CameraCharacteristics#INFO_SUPPORTED_HARDWARE_LEVEL_FULL HARDWARE_LEVEL_FULL} devices in the
      * {@link CameraCharacteristics#INFO_SUPPORTED_HARDWARE_LEVEL android.info.supportedHardwareLevel} key</p>
@@ -2676,6 +2716,7 @@
      * @see CameraCharacteristics#SENSOR_INFO_MAX_FRAME_DURATION
      */
     @PublicKey
+    @NonNull
     public static final Key<Long> SENSOR_FRAME_DURATION =
             new Key<Long>("android.sensor.frameDuration", long.class);
 
@@ -2696,7 +2737,7 @@
      * <p><b>Units</b>: ISO arithmetic units</p>
      * <p><b>Range of valid values:</b><br>
      * {@link CameraCharacteristics#SENSOR_INFO_SENSITIVITY_RANGE android.sensor.info.sensitivityRange}</p>
-     * <p><b>Optional</b> - This value may be {@code null} on some devices.</p>
+     * <p><b>Optional</b> - The value for this key may be {@code null} on some devices.</p>
      * <p><b>Full capability</b> -
      * Present on all camera devices that report being {@link CameraCharacteristics#INFO_SUPPORTED_HARDWARE_LEVEL_FULL HARDWARE_LEVEL_FULL} devices in the
      * {@link CameraCharacteristics#INFO_SUPPORTED_HARDWARE_LEVEL android.info.supportedHardwareLevel} key</p>
@@ -2708,6 +2749,7 @@
      * @see CameraCharacteristics#SENSOR_MAX_ANALOG_SENSITIVITY
      */
     @PublicKey
+    @NonNull
     public static final Key<Integer> SENSOR_SENSITIVITY =
             new Key<Integer>("android.sensor.sensitivity", int.class);
 
@@ -2720,11 +2762,12 @@
      * output.</p>
      * <p>For example, a sensor with RAW10 Bayer output would use the
      * 10 most significant bits from each color channel.</p>
-     * <p><b>Optional</b> - This value may be {@code null} on some devices.</p>
+     * <p><b>Optional</b> - The value for this key may be {@code null} on some devices.</p>
      *
      * @see CaptureRequest#SENSOR_TEST_PATTERN_MODE
      */
     @PublicKey
+    @NonNull
     public static final Key<int[]> SENSOR_TEST_PATTERN_DATA =
             new Key<int[]>("android.sensor.testPatternData", int[].class);
 
@@ -2749,7 +2792,7 @@
      * </ul></p>
      * <p><b>Available values for this device:</b><br>
      * {@link CameraCharacteristics#SENSOR_AVAILABLE_TEST_PATTERN_MODES android.sensor.availableTestPatternModes}</p>
-     * <p><b>Optional</b> - This value may be {@code null} on some devices.</p>
+     * <p><b>Optional</b> - The value for this key may be {@code null} on some devices.</p>
      *
      * @see CameraCharacteristics#SENSOR_AVAILABLE_TEST_PATTERN_MODES
      * @see #SENSOR_TEST_PATTERN_MODE_OFF
@@ -2760,6 +2803,7 @@
      * @see #SENSOR_TEST_PATTERN_MODE_CUSTOM1
      */
     @PublicKey
+    @NonNull
     public static final Key<Integer> SENSOR_TEST_PATTERN_MODE =
             new Key<Integer>("android.sensor.testPatternMode", int.class);
 
@@ -2797,7 +2841,7 @@
      * </ul></p>
      * <p><b>Available values for this device:</b><br>
      * {@link CameraCharacteristics#SHADING_AVAILABLE_MODES android.shading.availableModes}</p>
-     * <p><b>Optional</b> - This value may be {@code null} on some devices.</p>
+     * <p><b>Optional</b> - The value for this key may be {@code null} on some devices.</p>
      * <p><b>Full capability</b> -
      * Present on all camera devices that report being {@link CameraCharacteristics#INFO_SUPPORTED_HARDWARE_LEVEL_FULL HARDWARE_LEVEL_FULL} devices in the
      * {@link CameraCharacteristics#INFO_SUPPORTED_HARDWARE_LEVEL android.info.supportedHardwareLevel} key</p>
@@ -2813,6 +2857,7 @@
      * @see #SHADING_MODE_HIGH_QUALITY
      */
     @PublicKey
+    @NonNull
     public static final Key<Integer> SHADING_MODE =
             new Key<Integer>("android.shading.mode", int.class);
 
@@ -2838,6 +2883,7 @@
      * @see #STATISTICS_FACE_DETECT_MODE_FULL
      */
     @PublicKey
+    @NonNull
     public static final Key<Integer> STATISTICS_FACE_DETECT_MODE =
             new Key<Integer>("android.statistics.faceDetectMode", int.class);
 
@@ -2847,12 +2893,13 @@
      * If set to <code>false</code>, no hot pixel map will be returned.</p>
      * <p><b>Range of valid values:</b><br>
      * {@link CameraCharacteristics#STATISTICS_INFO_AVAILABLE_HOT_PIXEL_MAP_MODES android.statistics.info.availableHotPixelMapModes}</p>
-     * <p><b>Optional</b> - This value may be {@code null} on some devices.</p>
+     * <p><b>Optional</b> - The value for this key may be {@code null} on some devices.</p>
      *
      * @see CaptureResult#STATISTICS_HOT_PIXEL_MAP
      * @see CameraCharacteristics#STATISTICS_INFO_AVAILABLE_HOT_PIXEL_MAP_MODES
      */
     @PublicKey
+    @NonNull
     public static final Key<Boolean> STATISTICS_HOT_PIXEL_MAP_MODE =
             new Key<Boolean>("android.statistics.hotPixelMapMode", boolean.class);
 
@@ -2870,7 +2917,7 @@
      * </ul></p>
      * <p><b>Available values for this device:</b><br>
      * {@link CameraCharacteristics#STATISTICS_INFO_AVAILABLE_LENS_SHADING_MAP_MODES android.statistics.info.availableLensShadingMapModes}</p>
-     * <p><b>Optional</b> - This value may be {@code null} on some devices.</p>
+     * <p><b>Optional</b> - The value for this key may be {@code null} on some devices.</p>
      * <p><b>Full capability</b> -
      * Present on all camera devices that report being {@link CameraCharacteristics#INFO_SUPPORTED_HARDWARE_LEVEL_FULL HARDWARE_LEVEL_FULL} devices in the
      * {@link CameraCharacteristics#INFO_SUPPORTED_HARDWARE_LEVEL android.info.supportedHardwareLevel} key</p>
@@ -2881,6 +2928,7 @@
      * @see #STATISTICS_LENS_SHADING_MAP_MODE_ON
      */
     @PublicKey
+    @NonNull
     public static final Key<Integer> STATISTICS_LENS_SHADING_MAP_MODE =
             new Key<Integer>("android.statistics.lensShadingMapMode", int.class);
 
@@ -2900,13 +2948,14 @@
      * </ul></p>
      * <p><b>Available values for this device:</b><br>
      * {@link CameraCharacteristics#STATISTICS_INFO_AVAILABLE_OIS_DATA_MODES android.statistics.info.availableOisDataModes}</p>
-     * <p><b>Optional</b> - This value may be {@code null} on some devices.</p>
+     * <p><b>Optional</b> - The value for this key may be {@code null} on some devices.</p>
      *
      * @see CameraCharacteristics#STATISTICS_INFO_AVAILABLE_OIS_DATA_MODES
      * @see #STATISTICS_OIS_DATA_MODE_OFF
      * @see #STATISTICS_OIS_DATA_MODE_ON
      */
     @PublicKey
+    @NonNull
     public static final Key<Integer> STATISTICS_OIS_DATA_MODE =
             new Key<Integer>("android.statistics.oisDataMode", int.class);
 
@@ -2915,7 +2964,7 @@
      * channel, to use when {@link CaptureRequest#TONEMAP_MODE android.tonemap.mode} is
      * CONTRAST_CURVE.</p>
      * <p>See android.tonemap.curveRed for more details.</p>
-     * <p><b>Optional</b> - This value may be {@code null} on some devices.</p>
+     * <p><b>Optional</b> - The value for this key may be {@code null} on some devices.</p>
      * <p><b>Full capability</b> -
      * Present on all camera devices that report being {@link CameraCharacteristics#INFO_SUPPORTED_HARDWARE_LEVEL_FULL HARDWARE_LEVEL_FULL} devices in the
      * {@link CameraCharacteristics#INFO_SUPPORTED_HARDWARE_LEVEL android.info.supportedHardwareLevel} key</p>
@@ -2932,7 +2981,7 @@
      * channel, to use when {@link CaptureRequest#TONEMAP_MODE android.tonemap.mode} is
      * CONTRAST_CURVE.</p>
      * <p>See android.tonemap.curveRed for more details.</p>
-     * <p><b>Optional</b> - This value may be {@code null} on some devices.</p>
+     * <p><b>Optional</b> - The value for this key may be {@code null} on some devices.</p>
      * <p><b>Full capability</b> -
      * Present on all camera devices that report being {@link CameraCharacteristics#INFO_SUPPORTED_HARDWARE_LEVEL_FULL HARDWARE_LEVEL_FULL} devices in the
      * {@link CameraCharacteristics#INFO_SUPPORTED_HARDWARE_LEVEL android.info.supportedHardwareLevel} key</p>
@@ -2993,7 +3042,7 @@
      * <p><b>Range of valid values:</b><br>
      * 0-1 on both input and output coordinates, normalized
      * as a floating-point value such that 0 == black and 1 == white.</p>
-     * <p><b>Optional</b> - This value may be {@code null} on some devices.</p>
+     * <p><b>Optional</b> - The value for this key may be {@code null} on some devices.</p>
      * <p><b>Full capability</b> -
      * Present on all camera devices that report being {@link CameraCharacteristics#INFO_SUPPORTED_HARDWARE_LEVEL_FULL HARDWARE_LEVEL_FULL} devices in the
      * {@link CameraCharacteristics#INFO_SUPPORTED_HARDWARE_LEVEL android.info.supportedHardwareLevel} key</p>
@@ -3054,7 +3103,7 @@
      *   (0.8000, 0.9063), (0.8667, 0.9389), (0.9333, 0.9701), (1.0000, 1.0000) ]
      * </code></pre>
      * <p><img alt="sRGB tonemapping curve" src="/reference/images/camera2/metadata/android.tonemap.curveRed/srgb_tonemap.png" /></p>
-     * <p><b>Optional</b> - This value may be {@code null} on some devices.</p>
+     * <p><b>Optional</b> - The value for this key may be {@code null} on some devices.</p>
      * <p><b>Full capability</b> -
      * Present on all camera devices that report being {@link CameraCharacteristics#INFO_SUPPORTED_HARDWARE_LEVEL_FULL HARDWARE_LEVEL_FULL} devices in the
      * {@link CameraCharacteristics#INFO_SUPPORTED_HARDWARE_LEVEL android.info.supportedHardwareLevel} key</p>
@@ -3064,6 +3113,7 @@
      * @see CaptureRequest#TONEMAP_MODE
      */
     @PublicKey
+    @NonNull
     @SyntheticKey
     public static final Key<android.hardware.camera2.params.TonemapCurve> TONEMAP_CURVE =
             new Key<android.hardware.camera2.params.TonemapCurve>("android.tonemap.curve", android.hardware.camera2.params.TonemapCurve.class);
@@ -3098,7 +3148,7 @@
      * </ul></p>
      * <p><b>Available values for this device:</b><br>
      * {@link CameraCharacteristics#TONEMAP_AVAILABLE_TONE_MAP_MODES android.tonemap.availableToneMapModes}</p>
-     * <p><b>Optional</b> - This value may be {@code null} on some devices.</p>
+     * <p><b>Optional</b> - The value for this key may be {@code null} on some devices.</p>
      * <p><b>Full capability</b> -
      * Present on all camera devices that report being {@link CameraCharacteristics#INFO_SUPPORTED_HARDWARE_LEVEL_FULL HARDWARE_LEVEL_FULL} devices in the
      * {@link CameraCharacteristics#INFO_SUPPORTED_HARDWARE_LEVEL android.info.supportedHardwareLevel} key</p>
@@ -3114,6 +3164,7 @@
      * @see #TONEMAP_MODE_PRESET_CURVE
      */
     @PublicKey
+    @NonNull
     public static final Key<Integer> TONEMAP_MODE =
             new Key<Integer>("android.tonemap.mode", int.class);
 
@@ -3130,11 +3181,12 @@
      * value will be returned in capture result.</p>
      * <p>The valid range of gamma value varies on different devices, but values
      * within [1.0, 5.0] are guaranteed not to be clipped.</p>
-     * <p><b>Optional</b> - This value may be {@code null} on some devices.</p>
+     * <p><b>Optional</b> - The value for this key may be {@code null} on some devices.</p>
      *
      * @see CaptureRequest#TONEMAP_MODE
      */
     @PublicKey
+    @NonNull
     public static final Key<Float> TONEMAP_GAMMA =
             new Key<Float>("android.tonemap.gamma", float.class);
 
@@ -3153,13 +3205,14 @@
      *   <li>{@link #TONEMAP_PRESET_CURVE_SRGB SRGB}</li>
      *   <li>{@link #TONEMAP_PRESET_CURVE_REC709 REC709}</li>
      * </ul></p>
-     * <p><b>Optional</b> - This value may be {@code null} on some devices.</p>
+     * <p><b>Optional</b> - The value for this key may be {@code null} on some devices.</p>
      *
      * @see CaptureRequest#TONEMAP_MODE
      * @see #TONEMAP_PRESET_CURVE_SRGB
      * @see #TONEMAP_PRESET_CURVE_REC709
      */
     @PublicKey
+    @NonNull
     public static final Key<Integer> TONEMAP_PRESET_CURVE =
             new Key<Integer>("android.tonemap.presetCurve", int.class);
 
@@ -3174,7 +3227,7 @@
      * data is stored locally on the device.</p>
      * <p>The LED <em>may</em> be off if a trusted application is using the data that
      * doesn't violate the above rules.</p>
-     * <p><b>Optional</b> - This value may be {@code null} on some devices.</p>
+     * <p><b>Optional</b> - The value for this key may be {@code null} on some devices.</p>
      * @hide
      */
     public static final Key<Boolean> LED_TRANSMIT =
@@ -3218,7 +3271,7 @@
      * possible, only overriding the lock to OFF when changes to
      * other request parameters require a black level recalculation
      * or reset.</p>
-     * <p><b>Optional</b> - This value may be {@code null} on some devices.</p>
+     * <p><b>Optional</b> - The value for this key may be {@code null} on some devices.</p>
      * <p><b>Full capability</b> -
      * Present on all camera devices that report being {@link CameraCharacteristics#INFO_SUPPORTED_HARDWARE_LEVEL_FULL HARDWARE_LEVEL_FULL} devices in the
      * {@link CameraCharacteristics#INFO_SUPPORTED_HARDWARE_LEVEL android.info.supportedHardwareLevel} key</p>
@@ -3226,6 +3279,7 @@
      * @see CameraCharacteristics#INFO_SUPPORTED_HARDWARE_LEVEL
      */
     @PublicKey
+    @NonNull
     public static final Key<Boolean> BLACK_LEVEL_LOCK =
             new Key<Boolean>("android.blackLevel.lock", boolean.class);
 
@@ -3265,7 +3319,7 @@
      * <p><b>Units</b>: Relative exposure time increase factor.</p>
      * <p><b>Range of valid values:</b><br>
      * &gt;= 1.0</p>
-     * <p><b>Optional</b> - This value may be {@code null} on some devices.</p>
+     * <p><b>Optional</b> - The value for this key may be {@code null} on some devices.</p>
      * <p><b>Limited capability</b> -
      * Present on all camera devices that report being at least {@link CameraCharacteristics#INFO_SUPPORTED_HARDWARE_LEVEL_LIMITED HARDWARE_LEVEL_LIMITED} devices in the
      * {@link CameraCharacteristics#INFO_SUPPORTED_HARDWARE_LEVEL android.info.supportedHardwareLevel} key</p>
@@ -3276,6 +3330,7 @@
      * @see CameraCharacteristics#REQUEST_AVAILABLE_CAPABILITIES
      */
     @PublicKey
+    @NonNull
     public static final Key<Float> REPROCESS_EFFECTIVE_EXPOSURE_FACTOR =
             new Key<Float>("android.reprocess.effectiveExposureFactor", float.class);
 
@@ -3322,7 +3377,7 @@
      * </ul></p>
      * <p><b>Available values for this device:</b><br>
      * {@link CameraCharacteristics#DISTORTION_CORRECTION_AVAILABLE_MODES android.distortionCorrection.availableModes}</p>
-     * <p><b>Optional</b> - This value may be {@code null} on some devices.</p>
+     * <p><b>Optional</b> - The value for this key may be {@code null} on some devices.</p>
      *
      * @see CaptureRequest#CONTROL_AE_REGIONS
      * @see CaptureRequest#CONTROL_AF_REGIONS
@@ -3338,6 +3393,7 @@
      * @see #DISTORTION_CORRECTION_MODE_HIGH_QUALITY
      */
     @PublicKey
+    @NonNull
     public static final Key<Integer> DISTORTION_CORRECTION_MODE =
             new Key<Integer>("android.distortionCorrection.mode", int.class);
 
@@ -3347,4 +3403,7 @@
 
 
 
+
+
+
 }
diff --git a/core/java/android/hardware/camera2/CaptureResult.java b/core/java/android/hardware/camera2/CaptureResult.java
index 13ad092..7382ac4 100644
--- a/core/java/android/hardware/camera2/CaptureResult.java
+++ b/core/java/android/hardware/camera2/CaptureResult.java
@@ -89,7 +89,8 @@
          *
          * @hide
          */
-        public Key(String name, String fallbackName, Class<T> type) {
+        @UnsupportedAppUsage
+        public Key(@NonNull String name, @NonNull String fallbackName, @NonNull Class<T> type) {
             mKey = new CameraMetadataNative.Key<T>(name, fallbackName, type);
         }
 
@@ -100,7 +101,7 @@
          * {@link CaptureResult}, and not need to construct their own Key objects. However, they may
          * be useful for testing purposes and for defining custom capture result fields.</p>
          */
-        public Key(String name, Class<T> type) {
+        public Key(@NonNull String name, @NonNull Class<T> type) {
             mKey = new CameraMetadataNative.Key<T>(name, type);
         }
 
@@ -437,7 +438,7 @@
      *   <li>{@link #COLOR_CORRECTION_MODE_FAST FAST}</li>
      *   <li>{@link #COLOR_CORRECTION_MODE_HIGH_QUALITY HIGH_QUALITY}</li>
      * </ul></p>
-     * <p><b>Optional</b> - This value may be {@code null} on some devices.</p>
+     * <p><b>Optional</b> - The value for this key may be {@code null} on some devices.</p>
      * <p><b>Full capability</b> -
      * Present on all camera devices that report being {@link CameraCharacteristics#INFO_SUPPORTED_HARDWARE_LEVEL_FULL HARDWARE_LEVEL_FULL} devices in the
      * {@link CameraCharacteristics#INFO_SUPPORTED_HARDWARE_LEVEL android.info.supportedHardwareLevel} key</p>
@@ -451,6 +452,7 @@
      * @see #COLOR_CORRECTION_MODE_HIGH_QUALITY
      */
     @PublicKey
+    @NonNull
     public static final Key<Integer> COLOR_CORRECTION_MODE =
             new Key<Integer>("android.colorCorrection.mode", int.class);
 
@@ -469,7 +471,7 @@
      * <p>The valid range of each matrix element varies on different devices, but
      * values within [-1.5, 3.0] are guaranteed not to be clipped.</p>
      * <p><b>Units</b>: Unitless scale factors</p>
-     * <p><b>Optional</b> - This value may be {@code null} on some devices.</p>
+     * <p><b>Optional</b> - The value for this key may be {@code null} on some devices.</p>
      * <p><b>Full capability</b> -
      * Present on all camera devices that report being {@link CameraCharacteristics#INFO_SUPPORTED_HARDWARE_LEVEL_FULL HARDWARE_LEVEL_FULL} devices in the
      * {@link CameraCharacteristics#INFO_SUPPORTED_HARDWARE_LEVEL android.info.supportedHardwareLevel} key</p>
@@ -478,6 +480,7 @@
      * @see CameraCharacteristics#INFO_SUPPORTED_HARDWARE_LEVEL
      */
     @PublicKey
+    @NonNull
     public static final Key<android.hardware.camera2.params.ColorSpaceTransform> COLOR_CORRECTION_TRANSFORM =
             new Key<android.hardware.camera2.params.ColorSpaceTransform>("android.colorCorrection.transform", android.hardware.camera2.params.ColorSpaceTransform.class);
 
@@ -496,7 +499,7 @@
      * device allows gains below 1.0, this is usually not recommended because
      * this can create color artifacts.</p>
      * <p><b>Units</b>: Unitless gain factors</p>
-     * <p><b>Optional</b> - This value may be {@code null} on some devices.</p>
+     * <p><b>Optional</b> - The value for this key may be {@code null} on some devices.</p>
      * <p><b>Full capability</b> -
      * Present on all camera devices that report being {@link CameraCharacteristics#INFO_SUPPORTED_HARDWARE_LEVEL_FULL HARDWARE_LEVEL_FULL} devices in the
      * {@link CameraCharacteristics#INFO_SUPPORTED_HARDWARE_LEVEL android.info.supportedHardwareLevel} key</p>
@@ -505,6 +508,7 @@
      * @see CameraCharacteristics#INFO_SUPPORTED_HARDWARE_LEVEL
      */
     @PublicKey
+    @NonNull
     public static final Key<android.hardware.camera2.params.RggbChannelVector> COLOR_CORRECTION_GAINS =
             new Key<android.hardware.camera2.params.RggbChannelVector>("android.colorCorrection.gains", android.hardware.camera2.params.RggbChannelVector.class);
 
@@ -537,6 +541,7 @@
      * @see #COLOR_CORRECTION_ABERRATION_MODE_HIGH_QUALITY
      */
     @PublicKey
+    @NonNull
     public static final Key<Integer> COLOR_CORRECTION_ABERRATION_MODE =
             new Key<Integer>("android.colorCorrection.aberrationMode", int.class);
 
@@ -593,6 +598,7 @@
      * @see #CONTROL_AE_ANTIBANDING_MODE_AUTO
      */
     @PublicKey
+    @NonNull
     public static final Key<Integer> CONTROL_AE_ANTIBANDING_MODE =
             new Key<Integer>("android.control.aeAntibandingMode", int.class);
 
@@ -626,6 +632,7 @@
      * @see CaptureResult#CONTROL_AE_STATE
      */
     @PublicKey
+    @NonNull
     public static final Key<Integer> CONTROL_AE_EXPOSURE_COMPENSATION =
             new Key<Integer>("android.control.aeExposureCompensation", int.class);
 
@@ -676,6 +683,7 @@
      * @see CaptureRequest#SENSOR_SENSITIVITY
      */
     @PublicKey
+    @NonNull
     public static final Key<Boolean> CONTROL_AE_LOCK =
             new Key<Boolean>("android.control.aeLock", boolean.class);
 
@@ -728,6 +736,7 @@
      * @see #CONTROL_AE_MODE_ON_EXTERNAL_FLASH
      */
     @PublicKey
+    @NonNull
     public static final Key<Integer> CONTROL_AE_MODE =
             new Key<Integer>("android.control.aeMode", int.class);
 
@@ -779,7 +788,7 @@
      * Coordinates must be between <code>[(0,0), (width, height))</code> of
      * {@link CameraCharacteristics#SENSOR_INFO_ACTIVE_ARRAY_SIZE android.sensor.info.activeArraySize} or {@link CameraCharacteristics#SENSOR_INFO_PRE_CORRECTION_ACTIVE_ARRAY_SIZE android.sensor.info.preCorrectionActiveArraySize}
      * depending on distortion correction capability and mode</p>
-     * <p><b>Optional</b> - This value may be {@code null} on some devices.</p>
+     * <p><b>Optional</b> - The value for this key may be {@code null} on some devices.</p>
      *
      * @see CameraCharacteristics#CONTROL_MAX_REGIONS_AE
      * @see CaptureRequest#DISTORTION_CORRECTION_MODE
@@ -788,6 +797,7 @@
      * @see CameraCharacteristics#SENSOR_INFO_PRE_CORRECTION_ACTIVE_ARRAY_SIZE
      */
     @PublicKey
+    @NonNull
     public static final Key<android.hardware.camera2.params.MeteringRectangle[]> CONTROL_AE_REGIONS =
             new Key<android.hardware.camera2.params.MeteringRectangle[]>("android.control.aeRegions", android.hardware.camera2.params.MeteringRectangle[].class);
 
@@ -808,6 +818,7 @@
      * @see CaptureRequest#SENSOR_FRAME_DURATION
      */
     @PublicKey
+    @NonNull
     public static final Key<android.util.Range<Integer>> CONTROL_AE_TARGET_FPS_RANGE =
             new Key<android.util.Range<Integer>>("android.control.aeTargetFpsRange", new TypeReference<android.util.Range<Integer>>() {{ }});
 
@@ -866,7 +877,7 @@
      *   <li>{@link #CONTROL_AE_PRECAPTURE_TRIGGER_START START}</li>
      *   <li>{@link #CONTROL_AE_PRECAPTURE_TRIGGER_CANCEL CANCEL}</li>
      * </ul></p>
-     * <p><b>Optional</b> - This value may be {@code null} on some devices.</p>
+     * <p><b>Optional</b> - The value for this key may be {@code null} on some devices.</p>
      * <p><b>Limited capability</b> -
      * Present on all camera devices that report being at least {@link CameraCharacteristics#INFO_SUPPORTED_HARDWARE_LEVEL_LIMITED HARDWARE_LEVEL_LIMITED} devices in the
      * {@link CameraCharacteristics#INFO_SUPPORTED_HARDWARE_LEVEL android.info.supportedHardwareLevel} key</p>
@@ -881,6 +892,7 @@
      * @see #CONTROL_AE_PRECAPTURE_TRIGGER_CANCEL
      */
     @PublicKey
+    @NonNull
     public static final Key<Integer> CONTROL_AE_PRECAPTURE_TRIGGER =
             new Key<Integer>("android.control.aePrecaptureTrigger", int.class);
 
@@ -1108,7 +1120,7 @@
      *   <li>{@link #CONTROL_AE_STATE_FLASH_REQUIRED FLASH_REQUIRED}</li>
      *   <li>{@link #CONTROL_AE_STATE_PRECAPTURE PRECAPTURE}</li>
      * </ul></p>
-     * <p><b>Optional</b> - This value may be {@code null} on some devices.</p>
+     * <p><b>Optional</b> - The value for this key may be {@code null} on some devices.</p>
      * <p><b>Limited capability</b> -
      * Present on all camera devices that report being at least {@link CameraCharacteristics#INFO_SUPPORTED_HARDWARE_LEVEL_LIMITED HARDWARE_LEVEL_LIMITED} devices in the
      * {@link CameraCharacteristics#INFO_SUPPORTED_HARDWARE_LEVEL android.info.supportedHardwareLevel} key</p>
@@ -1129,6 +1141,7 @@
      * @see #CONTROL_AE_STATE_PRECAPTURE
      */
     @PublicKey
+    @NonNull
     public static final Key<Integer> CONTROL_AE_STATE =
             new Key<Integer>("android.control.aeState", int.class);
 
@@ -1170,6 +1183,7 @@
      * @see #CONTROL_AF_MODE_EDOF
      */
     @PublicKey
+    @NonNull
     public static final Key<Integer> CONTROL_AF_MODE =
             new Key<Integer>("android.control.afMode", int.class);
 
@@ -1222,7 +1236,7 @@
      * Coordinates must be between <code>[(0,0), (width, height))</code> of
      * {@link CameraCharacteristics#SENSOR_INFO_ACTIVE_ARRAY_SIZE android.sensor.info.activeArraySize} or {@link CameraCharacteristics#SENSOR_INFO_PRE_CORRECTION_ACTIVE_ARRAY_SIZE android.sensor.info.preCorrectionActiveArraySize}
      * depending on distortion correction capability and mode</p>
-     * <p><b>Optional</b> - This value may be {@code null} on some devices.</p>
+     * <p><b>Optional</b> - The value for this key may be {@code null} on some devices.</p>
      *
      * @see CameraCharacteristics#CONTROL_MAX_REGIONS_AF
      * @see CaptureRequest#DISTORTION_CORRECTION_MODE
@@ -1231,6 +1245,7 @@
      * @see CameraCharacteristics#SENSOR_INFO_PRE_CORRECTION_ACTIVE_ARRAY_SIZE
      */
     @PublicKey
+    @NonNull
     public static final Key<android.hardware.camera2.params.MeteringRectangle[]> CONTROL_AF_REGIONS =
             new Key<android.hardware.camera2.params.MeteringRectangle[]>("android.control.afRegions", android.hardware.camera2.params.MeteringRectangle[].class);
 
@@ -1268,6 +1283,7 @@
      * @see #CONTROL_AF_TRIGGER_CANCEL
      */
     @PublicKey
+    @NonNull
     public static final Key<Integer> CONTROL_AF_TRIGGER =
             new Key<Integer>("android.control.afTrigger", int.class);
 
@@ -1677,6 +1693,7 @@
      * @see #CONTROL_AF_STATE_PASSIVE_UNFOCUSED
      */
     @PublicKey
+    @NonNull
     public static final Key<Integer> CONTROL_AF_STATE =
             new Key<Integer>("android.control.afState", int.class);
 
@@ -1707,6 +1724,7 @@
      * @see CaptureRequest#CONTROL_AWB_MODE
      */
     @PublicKey
+    @NonNull
     public static final Key<Boolean> CONTROL_AWB_LOCK =
             new Key<Boolean>("android.control.awbLock", boolean.class);
 
@@ -1767,6 +1785,7 @@
      * @see #CONTROL_AWB_MODE_SHADE
      */
     @PublicKey
+    @NonNull
     public static final Key<Integer> CONTROL_AWB_MODE =
             new Key<Integer>("android.control.awbMode", int.class);
 
@@ -1819,7 +1838,7 @@
      * Coordinates must be between <code>[(0,0), (width, height))</code> of
      * {@link CameraCharacteristics#SENSOR_INFO_ACTIVE_ARRAY_SIZE android.sensor.info.activeArraySize} or {@link CameraCharacteristics#SENSOR_INFO_PRE_CORRECTION_ACTIVE_ARRAY_SIZE android.sensor.info.preCorrectionActiveArraySize}
      * depending on distortion correction capability and mode</p>
-     * <p><b>Optional</b> - This value may be {@code null} on some devices.</p>
+     * <p><b>Optional</b> - The value for this key may be {@code null} on some devices.</p>
      *
      * @see CameraCharacteristics#CONTROL_MAX_REGIONS_AWB
      * @see CaptureRequest#DISTORTION_CORRECTION_MODE
@@ -1828,6 +1847,7 @@
      * @see CameraCharacteristics#SENSOR_INFO_PRE_CORRECTION_ACTIVE_ARRAY_SIZE
      */
     @PublicKey
+    @NonNull
     public static final Key<android.hardware.camera2.params.MeteringRectangle[]> CONTROL_AWB_REGIONS =
             new Key<android.hardware.camera2.params.MeteringRectangle[]>("android.control.awbRegions", android.hardware.camera2.params.MeteringRectangle[].class);
 
@@ -1870,6 +1890,7 @@
      * @see #CONTROL_CAPTURE_INTENT_MOTION_TRACKING
      */
     @PublicKey
+    @NonNull
     public static final Key<Integer> CONTROL_CAPTURE_INTENT =
             new Key<Integer>("android.control.captureIntent", int.class);
 
@@ -1997,7 +2018,7 @@
      *   <li>{@link #CONTROL_AWB_STATE_CONVERGED CONVERGED}</li>
      *   <li>{@link #CONTROL_AWB_STATE_LOCKED LOCKED}</li>
      * </ul></p>
-     * <p><b>Optional</b> - This value may be {@code null} on some devices.</p>
+     * <p><b>Optional</b> - The value for this key may be {@code null} on some devices.</p>
      * <p><b>Limited capability</b> -
      * Present on all camera devices that report being at least {@link CameraCharacteristics#INFO_SUPPORTED_HARDWARE_LEVEL_LIMITED HARDWARE_LEVEL_LIMITED} devices in the
      * {@link CameraCharacteristics#INFO_SUPPORTED_HARDWARE_LEVEL android.info.supportedHardwareLevel} key</p>
@@ -2013,6 +2034,7 @@
      * @see #CONTROL_AWB_STATE_LOCKED
      */
     @PublicKey
+    @NonNull
     public static final Key<Integer> CONTROL_AWB_STATE =
             new Key<Integer>("android.control.awbState", int.class);
 
@@ -2052,6 +2074,7 @@
      * @see #CONTROL_EFFECT_MODE_AQUA
      */
     @PublicKey
+    @NonNull
     public static final Key<Integer> CONTROL_EFFECT_MODE =
             new Key<Integer>("android.control.effectMode", int.class);
 
@@ -2092,6 +2115,7 @@
      * @see #CONTROL_MODE_OFF_KEEP_STATE
      */
     @PublicKey
+    @NonNull
     public static final Key<Integer> CONTROL_MODE =
             new Key<Integer>("android.control.mode", int.class);
 
@@ -2159,6 +2183,7 @@
      * @see #CONTROL_SCENE_MODE_HDR
      */
     @PublicKey
+    @NonNull
     public static final Key<Integer> CONTROL_SCENE_MODE =
             new Key<Integer>("android.control.sceneMode", int.class);
 
@@ -2202,6 +2227,7 @@
      * @see #CONTROL_VIDEO_STABILIZATION_MODE_ON
      */
     @PublicKey
+    @NonNull
     public static final Key<Integer> CONTROL_VIDEO_STABILIZATION_MODE =
             new Key<Integer>("android.control.videoStabilizationMode", int.class);
 
@@ -2228,7 +2254,7 @@
      * <p><b>Units</b>: ISO arithmetic units, the same as {@link CaptureRequest#SENSOR_SENSITIVITY android.sensor.sensitivity}</p>
      * <p><b>Range of valid values:</b><br>
      * {@link CameraCharacteristics#CONTROL_POST_RAW_SENSITIVITY_BOOST_RANGE android.control.postRawSensitivityBoostRange}</p>
-     * <p><b>Optional</b> - This value may be {@code null} on some devices.</p>
+     * <p><b>Optional</b> - The value for this key may be {@code null} on some devices.</p>
      *
      * @see CaptureRequest#CONTROL_AE_MODE
      * @see CaptureRequest#CONTROL_MODE
@@ -2237,6 +2263,7 @@
      * @see CaptureRequest#SENSOR_SENSITIVITY
      */
     @PublicKey
+    @NonNull
     public static final Key<Integer> CONTROL_POST_RAW_SENSITIVITY_BOOST =
             new Key<Integer>("android.control.postRawSensitivityBoost", int.class);
 
@@ -2264,12 +2291,13 @@
      * <p>For applications targeting SDK versions older than O, the value of enableZsl in all
      * capture templates is always <code>false</code> if present.</p>
      * <p>For application-operated ZSL, use CAMERA3_TEMPLATE_ZERO_SHUTTER_LAG template.</p>
-     * <p><b>Optional</b> - This value may be {@code null} on some devices.</p>
+     * <p><b>Optional</b> - The value for this key may be {@code null} on some devices.</p>
      *
      * @see CaptureRequest#CONTROL_CAPTURE_INTENT
      * @see CaptureResult#SENSOR_TIMESTAMP
      */
     @PublicKey
+    @NonNull
     public static final Key<Boolean> CONTROL_ENABLE_ZSL =
             new Key<Boolean>("android.control.enableZsl", boolean.class);
 
@@ -2287,11 +2315,12 @@
      *   <li>{@link #CONTROL_AF_SCENE_CHANGE_NOT_DETECTED NOT_DETECTED}</li>
      *   <li>{@link #CONTROL_AF_SCENE_CHANGE_DETECTED DETECTED}</li>
      * </ul></p>
-     * <p><b>Optional</b> - This value may be {@code null} on some devices.</p>
+     * <p><b>Optional</b> - The value for this key may be {@code null} on some devices.</p>
      * @see #CONTROL_AF_SCENE_CHANGE_NOT_DETECTED
      * @see #CONTROL_AF_SCENE_CHANGE_DETECTED
      */
     @PublicKey
+    @NonNull
     public static final Key<Integer> CONTROL_AF_SCENE_CHANGE =
             new Key<Integer>("android.control.afSceneChange", int.class);
 
@@ -2326,7 +2355,7 @@
      * </ul></p>
      * <p><b>Available values for this device:</b><br>
      * {@link CameraCharacteristics#EDGE_AVAILABLE_EDGE_MODES android.edge.availableEdgeModes}</p>
-     * <p><b>Optional</b> - This value may be {@code null} on some devices.</p>
+     * <p><b>Optional</b> - The value for this key may be {@code null} on some devices.</p>
      * <p><b>Full capability</b> -
      * Present on all camera devices that report being {@link CameraCharacteristics#INFO_SUPPORTED_HARDWARE_LEVEL_FULL HARDWARE_LEVEL_FULL} devices in the
      * {@link CameraCharacteristics#INFO_SUPPORTED_HARDWARE_LEVEL android.info.supportedHardwareLevel} key</p>
@@ -2340,6 +2369,7 @@
      * @see #EDGE_MODE_ZERO_SHUTTER_LAG
      */
     @PublicKey
+    @NonNull
     public static final Key<Integer> EDGE_MODE =
             new Key<Integer>("android.edge.mode", int.class);
 
@@ -2375,6 +2405,7 @@
      * @see #FLASH_MODE_TORCH
      */
     @PublicKey
+    @NonNull
     public static final Key<Integer> FLASH_MODE =
             new Key<Integer>("android.flash.mode", int.class);
 
@@ -2402,7 +2433,7 @@
      *   <li>{@link #FLASH_STATE_FIRED FIRED}</li>
      *   <li>{@link #FLASH_STATE_PARTIAL PARTIAL}</li>
      * </ul></p>
-     * <p><b>Optional</b> - This value may be {@code null} on some devices.</p>
+     * <p><b>Optional</b> - The value for this key may be {@code null} on some devices.</p>
      * <p><b>Limited capability</b> -
      * Present on all camera devices that report being at least {@link CameraCharacteristics#INFO_SUPPORTED_HARDWARE_LEVEL_LIMITED HARDWARE_LEVEL_LIMITED} devices in the
      * {@link CameraCharacteristics#INFO_SUPPORTED_HARDWARE_LEVEL android.info.supportedHardwareLevel} key</p>
@@ -2418,6 +2449,7 @@
      * @see #FLASH_STATE_PARTIAL
      */
     @PublicKey
+    @NonNull
     public static final Key<Integer> FLASH_STATE =
             new Key<Integer>("android.flash.state", int.class);
 
@@ -2434,7 +2466,7 @@
      * </ul></p>
      * <p><b>Available values for this device:</b><br>
      * {@link CameraCharacteristics#HOT_PIXEL_AVAILABLE_HOT_PIXEL_MODES android.hotPixel.availableHotPixelModes}</p>
-     * <p><b>Optional</b> - This value may be {@code null} on some devices.</p>
+     * <p><b>Optional</b> - The value for this key may be {@code null} on some devices.</p>
      *
      * @see CameraCharacteristics#HOT_PIXEL_AVAILABLE_HOT_PIXEL_MODES
      * @see #HOT_PIXEL_MODE_OFF
@@ -2442,6 +2474,7 @@
      * @see #HOT_PIXEL_MODE_HIGH_QUALITY
      */
     @PublicKey
+    @NonNull
     public static final Key<Integer> HOT_PIXEL_MODE =
             new Key<Integer>("android.hotPixel.mode", int.class);
 
@@ -2454,6 +2487,7 @@
      * <p>This key is available on all devices.</p>
      */
     @PublicKey
+    @NonNull
     @SyntheticKey
     public static final Key<android.location.Location> JPEG_GPS_LOCATION =
             new Key<android.location.Location>("android.jpeg.gpsLocation", android.location.Location.class);
@@ -2535,6 +2569,7 @@
      * @see CameraCharacteristics#SENSOR_ORIENTATION
      */
     @PublicKey
+    @NonNull
     public static final Key<Integer> JPEG_ORIENTATION =
             new Key<Integer>("android.jpeg.orientation", int.class);
 
@@ -2548,6 +2583,7 @@
      * <p>This key is available on all devices.</p>
      */
     @PublicKey
+    @NonNull
     public static final Key<Byte> JPEG_QUALITY =
             new Key<Byte>("android.jpeg.quality", byte.class);
 
@@ -2560,6 +2596,7 @@
      * <p>This key is available on all devices.</p>
      */
     @PublicKey
+    @NonNull
     public static final Key<Byte> JPEG_THUMBNAIL_QUALITY =
             new Key<Byte>("android.jpeg.thumbnailQuality", byte.class);
 
@@ -2599,6 +2636,7 @@
      * @see CaptureRequest#JPEG_ORIENTATION
      */
     @PublicKey
+    @NonNull
     public static final Key<android.util.Size> JPEG_THUMBNAIL_SIZE =
             new Key<android.util.Size>("android.jpeg.thumbnailSize", android.util.Size.class);
 
@@ -2622,7 +2660,7 @@
      * <p><b>Units</b>: The f-number (f/N)</p>
      * <p><b>Range of valid values:</b><br>
      * {@link CameraCharacteristics#LENS_INFO_AVAILABLE_APERTURES android.lens.info.availableApertures}</p>
-     * <p><b>Optional</b> - This value may be {@code null} on some devices.</p>
+     * <p><b>Optional</b> - The value for this key may be {@code null} on some devices.</p>
      * <p><b>Full capability</b> -
      * Present on all camera devices that report being {@link CameraCharacteristics#INFO_SUPPORTED_HARDWARE_LEVEL_FULL HARDWARE_LEVEL_FULL} devices in the
      * {@link CameraCharacteristics#INFO_SUPPORTED_HARDWARE_LEVEL android.info.supportedHardwareLevel} key</p>
@@ -2636,6 +2674,7 @@
      * @see CaptureRequest#SENSOR_SENSITIVITY
      */
     @PublicKey
+    @NonNull
     public static final Key<Float> LENS_APERTURE =
             new Key<Float>("android.lens.aperture", float.class);
 
@@ -2656,7 +2695,7 @@
      * <p><b>Units</b>: Exposure Value (EV)</p>
      * <p><b>Range of valid values:</b><br>
      * {@link CameraCharacteristics#LENS_INFO_AVAILABLE_FILTER_DENSITIES android.lens.info.availableFilterDensities}</p>
-     * <p><b>Optional</b> - This value may be {@code null} on some devices.</p>
+     * <p><b>Optional</b> - The value for this key may be {@code null} on some devices.</p>
      * <p><b>Full capability</b> -
      * Present on all camera devices that report being {@link CameraCharacteristics#INFO_SUPPORTED_HARDWARE_LEVEL_FULL HARDWARE_LEVEL_FULL} devices in the
      * {@link CameraCharacteristics#INFO_SUPPORTED_HARDWARE_LEVEL android.info.supportedHardwareLevel} key</p>
@@ -2666,6 +2705,7 @@
      * @see CaptureResult#LENS_STATE
      */
     @PublicKey
+    @NonNull
     public static final Key<Float> LENS_FILTER_DENSITY =
             new Key<Float>("android.lens.filterDensity", float.class);
 
@@ -2691,6 +2731,7 @@
      * @see CaptureResult#LENS_STATE
      */
     @PublicKey
+    @NonNull
     public static final Key<Float> LENS_FOCAL_LENGTH =
             new Key<Float>("android.lens.focalLength", float.class);
 
@@ -2701,7 +2742,7 @@
      * <p><b>Units</b>: See {@link CameraCharacteristics#LENS_INFO_FOCUS_DISTANCE_CALIBRATION android.lens.info.focusDistanceCalibration} for details</p>
      * <p><b>Range of valid values:</b><br>
      * &gt;= 0</p>
-     * <p><b>Optional</b> - This value may be {@code null} on some devices.</p>
+     * <p><b>Optional</b> - The value for this key may be {@code null} on some devices.</p>
      * <p><b>Full capability</b> -
      * Present on all camera devices that report being {@link CameraCharacteristics#INFO_SUPPORTED_HARDWARE_LEVEL_FULL HARDWARE_LEVEL_FULL} devices in the
      * {@link CameraCharacteristics#INFO_SUPPORTED_HARDWARE_LEVEL android.info.supportedHardwareLevel} key</p>
@@ -2710,6 +2751,7 @@
      * @see CameraCharacteristics#LENS_INFO_FOCUS_DISTANCE_CALIBRATION
      */
     @PublicKey
+    @NonNull
     public static final Key<Float> LENS_FOCUS_DISTANCE =
             new Key<Float>("android.lens.focusDistance", float.class);
 
@@ -2722,7 +2764,7 @@
      * far); see {@link CameraCharacteristics#LENS_INFO_FOCUS_DISTANCE_CALIBRATION android.lens.info.focusDistanceCalibration} for details.</p>
      * <p><b>Range of valid values:</b><br>
      * &gt;=0</p>
-     * <p><b>Optional</b> - This value may be {@code null} on some devices.</p>
+     * <p><b>Optional</b> - The value for this key may be {@code null} on some devices.</p>
      * <p><b>Limited capability</b> -
      * Present on all camera devices that report being at least {@link CameraCharacteristics#INFO_SUPPORTED_HARDWARE_LEVEL_LIMITED HARDWARE_LEVEL_LIMITED} devices in the
      * {@link CameraCharacteristics#INFO_SUPPORTED_HARDWARE_LEVEL android.info.supportedHardwareLevel} key</p>
@@ -2731,6 +2773,7 @@
      * @see CameraCharacteristics#LENS_INFO_FOCUS_DISTANCE_CALIBRATION
      */
     @PublicKey
+    @NonNull
     public static final Key<android.util.Pair<Float,Float>> LENS_FOCUS_RANGE =
             new Key<android.util.Pair<Float,Float>>("android.lens.focusRange", new TypeReference<android.util.Pair<Float,Float>>() {{ }});
 
@@ -2761,7 +2804,7 @@
      * </ul></p>
      * <p><b>Available values for this device:</b><br>
      * {@link CameraCharacteristics#LENS_INFO_AVAILABLE_OPTICAL_STABILIZATION android.lens.info.availableOpticalStabilization}</p>
-     * <p><b>Optional</b> - This value may be {@code null} on some devices.</p>
+     * <p><b>Optional</b> - The value for this key may be {@code null} on some devices.</p>
      * <p><b>Limited capability</b> -
      * Present on all camera devices that report being at least {@link CameraCharacteristics#INFO_SUPPORTED_HARDWARE_LEVEL_LIMITED HARDWARE_LEVEL_LIMITED} devices in the
      * {@link CameraCharacteristics#INFO_SUPPORTED_HARDWARE_LEVEL android.info.supportedHardwareLevel} key</p>
@@ -2773,6 +2816,7 @@
      * @see #LENS_OPTICAL_STABILIZATION_MODE_ON
      */
     @PublicKey
+    @NonNull
     public static final Key<Integer> LENS_OPTICAL_STABILIZATION_MODE =
             new Key<Integer>("android.lens.opticalStabilizationMode", int.class);
 
@@ -2802,7 +2846,7 @@
      *   <li>{@link #LENS_STATE_STATIONARY STATIONARY}</li>
      *   <li>{@link #LENS_STATE_MOVING MOVING}</li>
      * </ul></p>
-     * <p><b>Optional</b> - This value may be {@code null} on some devices.</p>
+     * <p><b>Optional</b> - The value for this key may be {@code null} on some devices.</p>
      * <p><b>Limited capability</b> -
      * Present on all camera devices that report being at least {@link CameraCharacteristics#INFO_SUPPORTED_HARDWARE_LEVEL_LIMITED HARDWARE_LEVEL_LIMITED} devices in the
      * {@link CameraCharacteristics#INFO_SUPPORTED_HARDWARE_LEVEL android.info.supportedHardwareLevel} key</p>
@@ -2820,6 +2864,7 @@
      * @see #LENS_STATE_MOVING
      */
     @PublicKey
+    @NonNull
     public static final Key<Integer> LENS_STATE =
             new Key<Integer>("android.lens.state", int.class);
 
@@ -2854,10 +2899,11 @@
      *  <code>p'</code> is in the camera-oriented coordinate system.</p>
      * <p><b>Units</b>:
      * Quaternion coefficients</p>
-     * <p><b>Optional</b> - This value may be {@code null} on some devices.</p>
+     * <p><b>Optional</b> - The value for this key may be {@code null} on some devices.</p>
      * <p><b>Permission {@link android.Manifest.permission#CAMERA } is needed to access this property</b></p>
      */
     @PublicKey
+    @NonNull
     public static final Key<float[]> LENS_POSE_ROTATION =
             new Key<float[]>("android.lens.poseRotation", float[].class);
 
@@ -2890,7 +2936,7 @@
      * the center of the primary gyroscope on the device. The axis definitions are the same as
      * with PRIMARY_CAMERA.</p>
      * <p><b>Units</b>: Meters</p>
-     * <p><b>Optional</b> - This value may be {@code null} on some devices.</p>
+     * <p><b>Optional</b> - The value for this key may be {@code null} on some devices.</p>
      * <p><b>Permission {@link android.Manifest.permission#CAMERA } is needed to access this property</b></p>
      *
      * @see CameraCharacteristics#LENS_DISTORTION
@@ -2899,6 +2945,7 @@
      * @see CameraCharacteristics#LENS_POSE_ROTATION
      */
     @PublicKey
+    @NonNull
     public static final Key<float[]> LENS_POSE_TRANSLATION =
             new Key<float[]>("android.lens.poseTranslation", float[].class);
 
@@ -2962,7 +3009,7 @@
      * Pixels in the
      * {@link CameraCharacteristics#SENSOR_INFO_PRE_CORRECTION_ACTIVE_ARRAY_SIZE android.sensor.info.preCorrectionActiveArraySize}
      * coordinate system.</p>
-     * <p><b>Optional</b> - This value may be {@code null} on some devices.</p>
+     * <p><b>Optional</b> - The value for this key may be {@code null} on some devices.</p>
      * <p><b>Permission {@link android.Manifest.permission#CAMERA } is needed to access this property</b></p>
      *
      * @see CameraCharacteristics#LENS_DISTORTION
@@ -2972,6 +3019,7 @@
      * @see CameraCharacteristics#SENSOR_INFO_PRE_CORRECTION_ACTIVE_ARRAY_SIZE
      */
     @PublicKey
+    @NonNull
     public static final Key<float[]> LENS_INTRINSIC_CALIBRATION =
             new Key<float[]>("android.lens.intrinsicCalibration", float[].class);
 
@@ -3006,7 +3054,7 @@
      * <p>The distortion model used is the Brown-Conrady model.</p>
      * <p><b>Units</b>:
      * Unitless coefficients.</p>
-     * <p><b>Optional</b> - This value may be {@code null} on some devices.</p>
+     * <p><b>Optional</b> - The value for this key may be {@code null} on some devices.</p>
      * <p><b>Permission {@link android.Manifest.permission#CAMERA } is needed to access this property</b></p>
      *
      * @see CameraCharacteristics#LENS_INTRINSIC_CALIBRATION
@@ -3019,6 +3067,7 @@
      */
     @Deprecated
     @PublicKey
+    @NonNull
     public static final Key<float[]> LENS_RADIAL_DISTORTION =
             new Key<float[]>("android.lens.radialDistortion", float[].class);
 
@@ -3053,13 +3102,14 @@
      * <p>The distortion model used is the Brown-Conrady model.</p>
      * <p><b>Units</b>:
      * Unitless coefficients.</p>
-     * <p><b>Optional</b> - This value may be {@code null} on some devices.</p>
+     * <p><b>Optional</b> - The value for this key may be {@code null} on some devices.</p>
      * <p><b>Permission {@link android.Manifest.permission#CAMERA } is needed to access this property</b></p>
      *
      * @see CameraCharacteristics#LENS_INTRINSIC_CALIBRATION
      * @see CameraCharacteristics#LENS_RADIAL_DISTORTION
      */
     @PublicKey
+    @NonNull
     public static final Key<float[]> LENS_DISTORTION =
             new Key<float[]>("android.lens.distortion", float[].class);
 
@@ -3100,7 +3150,7 @@
      * </ul></p>
      * <p><b>Available values for this device:</b><br>
      * {@link CameraCharacteristics#NOISE_REDUCTION_AVAILABLE_NOISE_REDUCTION_MODES android.noiseReduction.availableNoiseReductionModes}</p>
-     * <p><b>Optional</b> - This value may be {@code null} on some devices.</p>
+     * <p><b>Optional</b> - The value for this key may be {@code null} on some devices.</p>
      * <p><b>Full capability</b> -
      * Present on all camera devices that report being {@link CameraCharacteristics#INFO_SUPPORTED_HARDWARE_LEVEL_FULL HARDWARE_LEVEL_FULL} devices in the
      * {@link CameraCharacteristics#INFO_SUPPORTED_HARDWARE_LEVEL android.info.supportedHardwareLevel} key</p>
@@ -3115,6 +3165,7 @@
      * @see #NOISE_REDUCTION_MODE_ZERO_SHUTTER_LAG
      */
     @PublicKey
+    @NonNull
     public static final Key<Integer> NOISE_REDUCTION_MODE =
             new Key<Integer>("android.noiseReduction.mode", int.class);
 
@@ -3134,7 +3185,7 @@
      * only be used by the camera device if quirks.usePartialResult is set to 1.</p>
      * <p><b>Range of valid values:</b><br>
      * Optional. Default value is FINAL.</p>
-     * <p><b>Optional</b> - This value may be {@code null} on some devices.</p>
+     * <p><b>Optional</b> - The value for this key may be {@code null} on some devices.</p>
      * @deprecated
      * <p>Not used in HALv3 or newer</p>
 
@@ -3152,7 +3203,7 @@
      * <p><b>Units</b>: count of frames</p>
      * <p><b>Range of valid values:</b><br>
      * &gt; 0</p>
-     * <p><b>Optional</b> - This value may be {@code null} on some devices.</p>
+     * <p><b>Optional</b> - The value for this key may be {@code null} on some devices.</p>
      * @deprecated
      * <p>Not used in HALv3 or newer</p>
 
@@ -3169,7 +3220,7 @@
      * <p><b>Units</b>: arbitrary integer assigned by application</p>
      * <p><b>Range of valid values:</b><br>
      * Any int</p>
-     * <p><b>Optional</b> - This value may be {@code null} on some devices.</p>
+     * <p><b>Optional</b> - The value for this key may be {@code null} on some devices.</p>
      * @hide
      */
     public static final Key<Integer> REQUEST_ID =
@@ -3190,6 +3241,7 @@
      * @see CameraCharacteristics#REQUEST_PIPELINE_MAX_DEPTH
      */
     @PublicKey
+    @NonNull
     public static final Key<Byte> REQUEST_PIPELINE_DEPTH =
             new Key<Byte>("android.request.pipelineDepth", byte.class);
 
@@ -3251,6 +3303,7 @@
      * @see CameraCharacteristics#SENSOR_INFO_PRE_CORRECTION_ACTIVE_ARRAY_SIZE
      */
     @PublicKey
+    @NonNull
     public static final Key<android.graphics.Rect> SCALER_CROP_REGION =
             new Key<android.graphics.Rect>("android.scaler.cropRegion", android.graphics.Rect.class);
 
@@ -3265,7 +3318,7 @@
      * <p><b>Units</b>: Nanoseconds</p>
      * <p><b>Range of valid values:</b><br>
      * {@link CameraCharacteristics#SENSOR_INFO_EXPOSURE_TIME_RANGE android.sensor.info.exposureTimeRange}</p>
-     * <p><b>Optional</b> - This value may be {@code null} on some devices.</p>
+     * <p><b>Optional</b> - The value for this key may be {@code null} on some devices.</p>
      * <p><b>Full capability</b> -
      * Present on all camera devices that report being {@link CameraCharacteristics#INFO_SUPPORTED_HARDWARE_LEVEL_FULL HARDWARE_LEVEL_FULL} devices in the
      * {@link CameraCharacteristics#INFO_SUPPORTED_HARDWARE_LEVEL android.info.supportedHardwareLevel} key</p>
@@ -3276,6 +3329,7 @@
      * @see CameraCharacteristics#SENSOR_INFO_EXPOSURE_TIME_RANGE
      */
     @PublicKey
+    @NonNull
     public static final Key<Long> SENSOR_EXPOSURE_TIME =
             new Key<Long>("android.sensor.exposureTime", long.class);
 
@@ -3346,7 +3400,7 @@
      * <p><b>Range of valid values:</b><br>
      * See {@link CameraCharacteristics#SENSOR_INFO_MAX_FRAME_DURATION android.sensor.info.maxFrameDuration}, {@link android.hardware.camera2.params.StreamConfigurationMap }.
      * The duration is capped to <code>max(duration, exposureTime + overhead)</code>.</p>
-     * <p><b>Optional</b> - This value may be {@code null} on some devices.</p>
+     * <p><b>Optional</b> - The value for this key may be {@code null} on some devices.</p>
      * <p><b>Full capability</b> -
      * Present on all camera devices that report being {@link CameraCharacteristics#INFO_SUPPORTED_HARDWARE_LEVEL_FULL HARDWARE_LEVEL_FULL} devices in the
      * {@link CameraCharacteristics#INFO_SUPPORTED_HARDWARE_LEVEL android.info.supportedHardwareLevel} key</p>
@@ -3357,6 +3411,7 @@
      * @see CameraCharacteristics#SENSOR_INFO_MAX_FRAME_DURATION
      */
     @PublicKey
+    @NonNull
     public static final Key<Long> SENSOR_FRAME_DURATION =
             new Key<Long>("android.sensor.frameDuration", long.class);
 
@@ -3377,7 +3432,7 @@
      * <p><b>Units</b>: ISO arithmetic units</p>
      * <p><b>Range of valid values:</b><br>
      * {@link CameraCharacteristics#SENSOR_INFO_SENSITIVITY_RANGE android.sensor.info.sensitivityRange}</p>
-     * <p><b>Optional</b> - This value may be {@code null} on some devices.</p>
+     * <p><b>Optional</b> - The value for this key may be {@code null} on some devices.</p>
      * <p><b>Full capability</b> -
      * Present on all camera devices that report being {@link CameraCharacteristics#INFO_SUPPORTED_HARDWARE_LEVEL_FULL HARDWARE_LEVEL_FULL} devices in the
      * {@link CameraCharacteristics#INFO_SUPPORTED_HARDWARE_LEVEL android.info.supportedHardwareLevel} key</p>
@@ -3389,6 +3444,7 @@
      * @see CameraCharacteristics#SENSOR_MAX_ANALOG_SENSITIVITY
      */
     @PublicKey
+    @NonNull
     public static final Key<Integer> SENSOR_SENSITIVITY =
             new Key<Integer>("android.sensor.sensitivity", int.class);
 
@@ -3419,6 +3475,7 @@
      * @see CameraCharacteristics#SENSOR_INFO_TIMESTAMP_SOURCE
      */
     @PublicKey
+    @NonNull
     public static final Key<Long> SENSOR_TIMESTAMP =
             new Key<Long>("android.sensor.timestamp", long.class);
 
@@ -3433,9 +3490,10 @@
      * <p>The order of the values is R, G, B; where R is in the lowest index.</p>
      * <p>Starting from Android Q, this key will not be present for a MONOCHROME camera, even if
      * the camera device has RAW capability.</p>
-     * <p><b>Optional</b> - This value may be {@code null} on some devices.</p>
+     * <p><b>Optional</b> - The value for this key may be {@code null} on some devices.</p>
      */
     @PublicKey
+    @NonNull
     public static final Key<Rational[]> SENSOR_NEUTRAL_COLOR_POINT =
             new Key<Rational[]>("android.sensor.neutralColorPoint", Rational[].class);
 
@@ -3460,11 +3518,12 @@
      * Adobe DNG specification for the NoiseProfile tag.</p>
      * <p>For a MONOCHROME camera, there is only one color channel. So the noise model coefficients
      * will only contain one S and one O.</p>
-     * <p><b>Optional</b> - This value may be {@code null} on some devices.</p>
+     * <p><b>Optional</b> - The value for this key may be {@code null} on some devices.</p>
      *
      * @see CameraCharacteristics#SENSOR_INFO_COLOR_FILTER_ARRANGEMENT
      */
     @PublicKey
+    @NonNull
     public static final Key<android.util.Pair<Double,Double>[]> SENSOR_NOISE_PROFILE =
             new Key<android.util.Pair<Double,Double>[]>("android.sensor.noiseProfile", new TypeReference<android.util.Pair<Double,Double>[]>() {{ }});
 
@@ -3504,9 +3563,10 @@
      * the camera device has RAW capability.</p>
      * <p><b>Range of valid values:</b><br></p>
      * <p>&gt;= 0</p>
-     * <p><b>Optional</b> - This value may be {@code null} on some devices.</p>
+     * <p><b>Optional</b> - The value for this key may be {@code null} on some devices.</p>
      */
     @PublicKey
+    @NonNull
     public static final Key<Float> SENSOR_GREEN_SPLIT =
             new Key<Float>("android.sensor.greenSplit", float.class);
 
@@ -3519,11 +3579,12 @@
      * output.</p>
      * <p>For example, a sensor with RAW10 Bayer output would use the
      * 10 most significant bits from each color channel.</p>
-     * <p><b>Optional</b> - This value may be {@code null} on some devices.</p>
+     * <p><b>Optional</b> - The value for this key may be {@code null} on some devices.</p>
      *
      * @see CaptureRequest#SENSOR_TEST_PATTERN_MODE
      */
     @PublicKey
+    @NonNull
     public static final Key<int[]> SENSOR_TEST_PATTERN_DATA =
             new Key<int[]>("android.sensor.testPatternData", int[].class);
 
@@ -3548,7 +3609,7 @@
      * </ul></p>
      * <p><b>Available values for this device:</b><br>
      * {@link CameraCharacteristics#SENSOR_AVAILABLE_TEST_PATTERN_MODES android.sensor.availableTestPatternModes}</p>
-     * <p><b>Optional</b> - This value may be {@code null} on some devices.</p>
+     * <p><b>Optional</b> - The value for this key may be {@code null} on some devices.</p>
      *
      * @see CameraCharacteristics#SENSOR_AVAILABLE_TEST_PATTERN_MODES
      * @see #SENSOR_TEST_PATTERN_MODE_OFF
@@ -3559,6 +3620,7 @@
      * @see #SENSOR_TEST_PATTERN_MODE_CUSTOM1
      */
     @PublicKey
+    @NonNull
     public static final Key<Integer> SENSOR_TEST_PATTERN_MODE =
             new Key<Integer>("android.sensor.testPatternMode", int.class);
 
@@ -3575,7 +3637,7 @@
      * <p><b>Range of valid values:</b><br>
      * &gt;= 0 and &lt;
      * {@link android.hardware.camera2.params.StreamConfigurationMap#getOutputMinFrameDuration }.</p>
-     * <p><b>Optional</b> - This value may be {@code null} on some devices.</p>
+     * <p><b>Optional</b> - The value for this key may be {@code null} on some devices.</p>
      * <p><b>Limited capability</b> -
      * Present on all camera devices that report being at least {@link CameraCharacteristics#INFO_SUPPORTED_HARDWARE_LEVEL_LIMITED HARDWARE_LEVEL_LIMITED} devices in the
      * {@link CameraCharacteristics#INFO_SUPPORTED_HARDWARE_LEVEL android.info.supportedHardwareLevel} key</p>
@@ -3584,6 +3646,7 @@
      * @see CameraCharacteristics#SENSOR_INFO_ACTIVE_ARRAY_SIZE
      */
     @PublicKey
+    @NonNull
     public static final Key<Long> SENSOR_ROLLING_SHUTTER_SKEW =
             new Key<Long>("android.sensor.rollingShutterSkew", long.class);
 
@@ -3617,7 +3680,7 @@
      * camera device advertises this key via {@link android.hardware.camera2.CameraCharacteristics#getAvailableCaptureResultKeys }.</p>
      * <p><b>Range of valid values:</b><br>
      * &gt;= 0 for each.</p>
-     * <p><b>Optional</b> - This value may be {@code null} on some devices.</p>
+     * <p><b>Optional</b> - The value for this key may be {@code null} on some devices.</p>
      *
      * @see CameraCharacteristics#SENSOR_BLACK_LEVEL_PATTERN
      * @see CameraCharacteristics#SENSOR_INFO_COLOR_FILTER_ARRANGEMENT
@@ -3625,6 +3688,7 @@
      * @see CaptureRequest#SENSOR_SENSITIVITY
      */
     @PublicKey
+    @NonNull
     public static final Key<float[]> SENSOR_DYNAMIC_BLACK_LEVEL =
             new Key<float[]>("android.sensor.dynamicBlackLevel", float[].class);
 
@@ -3640,7 +3704,7 @@
      * {@link android.hardware.camera2.CameraCharacteristics#getAvailableCaptureRequestKeys }.</p>
      * <p><b>Range of valid values:</b><br>
      * &gt;= 0</p>
-     * <p><b>Optional</b> - This value may be {@code null} on some devices.</p>
+     * <p><b>Optional</b> - The value for this key may be {@code null} on some devices.</p>
      *
      * @see CameraCharacteristics#SENSOR_BLACK_LEVEL_PATTERN
      * @see CameraCharacteristics#SENSOR_INFO_WHITE_LEVEL
@@ -3648,6 +3712,7 @@
      * @see CaptureRequest#SENSOR_SENSITIVITY
      */
     @PublicKey
+    @NonNull
     public static final Key<Integer> SENSOR_DYNAMIC_WHITE_LEVEL =
             new Key<Integer>("android.sensor.dynamicWhiteLevel", int.class);
 
@@ -3685,7 +3750,7 @@
      * </ul></p>
      * <p><b>Available values for this device:</b><br>
      * {@link CameraCharacteristics#SHADING_AVAILABLE_MODES android.shading.availableModes}</p>
-     * <p><b>Optional</b> - This value may be {@code null} on some devices.</p>
+     * <p><b>Optional</b> - The value for this key may be {@code null} on some devices.</p>
      * <p><b>Full capability</b> -
      * Present on all camera devices that report being {@link CameraCharacteristics#INFO_SUPPORTED_HARDWARE_LEVEL_FULL HARDWARE_LEVEL_FULL} devices in the
      * {@link CameraCharacteristics#INFO_SUPPORTED_HARDWARE_LEVEL android.info.supportedHardwareLevel} key</p>
@@ -3701,6 +3766,7 @@
      * @see #SHADING_MODE_HIGH_QUALITY
      */
     @PublicKey
+    @NonNull
     public static final Key<Integer> SHADING_MODE =
             new Key<Integer>("android.shading.mode", int.class);
 
@@ -3726,6 +3792,7 @@
      * @see #STATISTICS_FACE_DETECT_MODE_FULL
      */
     @PublicKey
+    @NonNull
     public static final Key<Integer> STATISTICS_FACE_DETECT_MODE =
             new Key<Integer>("android.statistics.faceDetectMode", int.class);
 
@@ -3818,6 +3885,7 @@
      * @see CaptureRequest#STATISTICS_FACE_DETECT_MODE
      */
     @PublicKey
+    @NonNull
     @SyntheticKey
     public static final Key<android.hardware.camera2.params.Face[]> STATISTICS_FACES =
             new Key<android.hardware.camera2.params.Face[]>("android.statistics.faces", android.hardware.camera2.params.Face[].class);
@@ -3886,7 +3954,7 @@
      * </code></pre>
      * <p><b>Range of valid values:</b><br>
      * Each gain factor is &gt;= 1</p>
-     * <p><b>Optional</b> - This value may be {@code null} on some devices.</p>
+     * <p><b>Optional</b> - The value for this key may be {@code null} on some devices.</p>
      * <p><b>Full capability</b> -
      * Present on all camera devices that report being {@link CameraCharacteristics#INFO_SUPPORTED_HARDWARE_LEVEL_FULL HARDWARE_LEVEL_FULL} devices in the
      * {@link CameraCharacteristics#INFO_SUPPORTED_HARDWARE_LEVEL android.info.supportedHardwareLevel} key</p>
@@ -3896,6 +3964,7 @@
      * @see CameraCharacteristics#SENSOR_INFO_LENS_SHADING_APPLIED
      */
     @PublicKey
+    @NonNull
     public static final Key<android.hardware.camera2.params.LensShadingMap> STATISTICS_LENS_SHADING_CORRECTION_MAP =
             new Key<android.hardware.camera2.params.LensShadingMap>("android.statistics.lensShadingCorrectionMap", android.hardware.camera2.params.LensShadingMap.class);
 
@@ -3976,7 +4045,7 @@
      * formats.</p>
      * <p><b>Range of valid values:</b><br>
      * Each gain factor is &gt;= 1</p>
-     * <p><b>Optional</b> - This value may be {@code null} on some devices.</p>
+     * <p><b>Optional</b> - The value for this key may be {@code null} on some devices.</p>
      * <p><b>Full capability</b> -
      * Present on all camera devices that report being {@link CameraCharacteristics#INFO_SUPPORTED_HARDWARE_LEVEL_FULL HARDWARE_LEVEL_FULL} devices in the
      * {@link CameraCharacteristics#INFO_SUPPORTED_HARDWARE_LEVEL android.info.supportedHardwareLevel} key</p>
@@ -4001,7 +4070,7 @@
      * see {@link CaptureRequest#COLOR_CORRECTION_GAINS android.colorCorrection.gains} for details.</p>
      * <p>This value should always be calculated by the auto-white balance (AWB) block,
      * regardless of the android.control.* current values.</p>
-     * <p><b>Optional</b> - This value may be {@code null} on some devices.</p>
+     * <p><b>Optional</b> - The value for this key may be {@code null} on some devices.</p>
      *
      * @see CaptureRequest#COLOR_CORRECTION_GAINS
      * @deprecated
@@ -4029,7 +4098,7 @@
      * capture settings and color transforms are set by the application.</p>
      * <p>This value should always be calculated by the auto-white balance (AWB) block,
      * regardless of the android.control.* current values.</p>
-     * <p><b>Optional</b> - This value may be {@code null} on some devices.</p>
+     * <p><b>Optional</b> - The value for this key may be {@code null} on some devices.</p>
      * @deprecated
      * <p>Never fully implemented or specified; do not use</p>
 
@@ -4061,7 +4130,7 @@
      *   <li>{@link #STATISTICS_SCENE_FLICKER_50HZ 50HZ}</li>
      *   <li>{@link #STATISTICS_SCENE_FLICKER_60HZ 60HZ}</li>
      * </ul></p>
-     * <p><b>Optional</b> - This value may be {@code null} on some devices.</p>
+     * <p><b>Optional</b> - The value for this key may be {@code null} on some devices.</p>
      * <p><b>Full capability</b> -
      * Present on all camera devices that report being {@link CameraCharacteristics#INFO_SUPPORTED_HARDWARE_LEVEL_FULL HARDWARE_LEVEL_FULL} devices in the
      * {@link CameraCharacteristics#INFO_SUPPORTED_HARDWARE_LEVEL android.info.supportedHardwareLevel} key</p>
@@ -4075,6 +4144,7 @@
      * @see #STATISTICS_SCENE_FLICKER_60HZ
      */
     @PublicKey
+    @NonNull
     public static final Key<Integer> STATISTICS_SCENE_FLICKER =
             new Key<Integer>("android.statistics.sceneFlicker", int.class);
 
@@ -4084,12 +4154,13 @@
      * If set to <code>false</code>, no hot pixel map will be returned.</p>
      * <p><b>Range of valid values:</b><br>
      * {@link CameraCharacteristics#STATISTICS_INFO_AVAILABLE_HOT_PIXEL_MAP_MODES android.statistics.info.availableHotPixelMapModes}</p>
-     * <p><b>Optional</b> - This value may be {@code null} on some devices.</p>
+     * <p><b>Optional</b> - The value for this key may be {@code null} on some devices.</p>
      *
      * @see CaptureResult#STATISTICS_HOT_PIXEL_MAP
      * @see CameraCharacteristics#STATISTICS_INFO_AVAILABLE_HOT_PIXEL_MAP_MODES
      */
     @PublicKey
+    @NonNull
     public static final Key<Boolean> STATISTICS_HOT_PIXEL_MAP_MODE =
             new Key<Boolean>("android.statistics.hotPixelMapMode", boolean.class);
 
@@ -4105,12 +4176,13 @@
      * <p>n &lt;= number of pixels on the sensor.
      * The <code>(x, y)</code> coordinates must be bounded by
      * {@link CameraCharacteristics#SENSOR_INFO_PIXEL_ARRAY_SIZE android.sensor.info.pixelArraySize}.</p>
-     * <p><b>Optional</b> - This value may be {@code null} on some devices.</p>
+     * <p><b>Optional</b> - The value for this key may be {@code null} on some devices.</p>
      *
      * @see CameraCharacteristics#SENSOR_INFO_ACTIVE_ARRAY_SIZE
      * @see CameraCharacteristics#SENSOR_INFO_PIXEL_ARRAY_SIZE
      */
     @PublicKey
+    @NonNull
     public static final Key<android.graphics.Point[]> STATISTICS_HOT_PIXEL_MAP =
             new Key<android.graphics.Point[]>("android.statistics.hotPixelMap", android.graphics.Point[].class);
 
@@ -4128,7 +4200,7 @@
      * </ul></p>
      * <p><b>Available values for this device:</b><br>
      * {@link CameraCharacteristics#STATISTICS_INFO_AVAILABLE_LENS_SHADING_MAP_MODES android.statistics.info.availableLensShadingMapModes}</p>
-     * <p><b>Optional</b> - This value may be {@code null} on some devices.</p>
+     * <p><b>Optional</b> - The value for this key may be {@code null} on some devices.</p>
      * <p><b>Full capability</b> -
      * Present on all camera devices that report being {@link CameraCharacteristics#INFO_SUPPORTED_HARDWARE_LEVEL_FULL HARDWARE_LEVEL_FULL} devices in the
      * {@link CameraCharacteristics#INFO_SUPPORTED_HARDWARE_LEVEL android.info.supportedHardwareLevel} key</p>
@@ -4139,6 +4211,7 @@
      * @see #STATISTICS_LENS_SHADING_MAP_MODE_ON
      */
     @PublicKey
+    @NonNull
     public static final Key<Integer> STATISTICS_LENS_SHADING_MAP_MODE =
             new Key<Integer>("android.statistics.lensShadingMapMode", int.class);
 
@@ -4158,13 +4231,14 @@
      * </ul></p>
      * <p><b>Available values for this device:</b><br>
      * {@link CameraCharacteristics#STATISTICS_INFO_AVAILABLE_OIS_DATA_MODES android.statistics.info.availableOisDataModes}</p>
-     * <p><b>Optional</b> - This value may be {@code null} on some devices.</p>
+     * <p><b>Optional</b> - The value for this key may be {@code null} on some devices.</p>
      *
      * @see CameraCharacteristics#STATISTICS_INFO_AVAILABLE_OIS_DATA_MODES
      * @see #STATISTICS_OIS_DATA_MODE_OFF
      * @see #STATISTICS_OIS_DATA_MODE_ON
      */
     @PublicKey
+    @NonNull
     public static final Key<Integer> STATISTICS_OIS_DATA_MODE =
             new Key<Integer>("android.statistics.oisDataMode", int.class);
 
@@ -4173,11 +4247,12 @@
      * <p>The array contains the timestamps of OIS samples. The timestamps are in the same
      * timebase as and comparable to {@link CaptureResult#SENSOR_TIMESTAMP android.sensor.timestamp}.</p>
      * <p><b>Units</b>: nanoseconds</p>
-     * <p><b>Optional</b> - This value may be {@code null} on some devices.</p>
+     * <p><b>Optional</b> - The value for this key may be {@code null} on some devices.</p>
      *
      * @see CaptureResult#SENSOR_TIMESTAMP
      * @hide
      */
+    @UnsupportedAppUsage
     public static final Key<long[]> STATISTICS_OIS_TIMESTAMPS =
             new Key<long[]>("android.statistics.oisTimestamps", long[].class);
 
@@ -4194,9 +4269,10 @@
      * since the scaling of OIS shifts would depend on the specific spot on the sensor the shift
      * is needed.</p>
      * <p><b>Units</b>: Pixels in active array.</p>
-     * <p><b>Optional</b> - This value may be {@code null} on some devices.</p>
+     * <p><b>Optional</b> - The value for this key may be {@code null} on some devices.</p>
      * @hide
      */
+    @UnsupportedAppUsage
     public static final Key<float[]> STATISTICS_OIS_X_SHIFTS =
             new Key<float[]>("android.statistics.oisXShifts", float[].class);
 
@@ -4213,9 +4289,10 @@
      * since the scaling of OIS shifts would depend on the specific spot on the sensor the shift
      * is needed.</p>
      * <p><b>Units</b>: Pixels in active array.</p>
-     * <p><b>Optional</b> - This value may be {@code null} on some devices.</p>
+     * <p><b>Optional</b> - The value for this key may be {@code null} on some devices.</p>
      * @hide
      */
+    @UnsupportedAppUsage
     public static final Key<float[]> STATISTICS_OIS_Y_SHIFTS =
             new Key<float[]>("android.statistics.oisYShifts", float[].class);
 
@@ -4235,9 +4312,10 @@
      * supporting devices). They are always reported in pre-correction active array coordinates,
      * since the scaling of OIS shifts would depend on the specific spot on the sensor the shift
      * is needed.</p>
-     * <p><b>Optional</b> - This value may be {@code null} on some devices.</p>
+     * <p><b>Optional</b> - The value for this key may be {@code null} on some devices.</p>
      */
     @PublicKey
+    @NonNull
     @SyntheticKey
     public static final Key<android.hardware.camera2.params.OisSample[]> STATISTICS_OIS_SAMPLES =
             new Key<android.hardware.camera2.params.OisSample[]>("android.statistics.oisSamples", android.hardware.camera2.params.OisSample[].class);
@@ -4247,7 +4325,7 @@
      * channel, to use when {@link CaptureRequest#TONEMAP_MODE android.tonemap.mode} is
      * CONTRAST_CURVE.</p>
      * <p>See android.tonemap.curveRed for more details.</p>
-     * <p><b>Optional</b> - This value may be {@code null} on some devices.</p>
+     * <p><b>Optional</b> - The value for this key may be {@code null} on some devices.</p>
      * <p><b>Full capability</b> -
      * Present on all camera devices that report being {@link CameraCharacteristics#INFO_SUPPORTED_HARDWARE_LEVEL_FULL HARDWARE_LEVEL_FULL} devices in the
      * {@link CameraCharacteristics#INFO_SUPPORTED_HARDWARE_LEVEL android.info.supportedHardwareLevel} key</p>
@@ -4264,7 +4342,7 @@
      * channel, to use when {@link CaptureRequest#TONEMAP_MODE android.tonemap.mode} is
      * CONTRAST_CURVE.</p>
      * <p>See android.tonemap.curveRed for more details.</p>
-     * <p><b>Optional</b> - This value may be {@code null} on some devices.</p>
+     * <p><b>Optional</b> - The value for this key may be {@code null} on some devices.</p>
      * <p><b>Full capability</b> -
      * Present on all camera devices that report being {@link CameraCharacteristics#INFO_SUPPORTED_HARDWARE_LEVEL_FULL HARDWARE_LEVEL_FULL} devices in the
      * {@link CameraCharacteristics#INFO_SUPPORTED_HARDWARE_LEVEL android.info.supportedHardwareLevel} key</p>
@@ -4325,7 +4403,7 @@
      * <p><b>Range of valid values:</b><br>
      * 0-1 on both input and output coordinates, normalized
      * as a floating-point value such that 0 == black and 1 == white.</p>
-     * <p><b>Optional</b> - This value may be {@code null} on some devices.</p>
+     * <p><b>Optional</b> - The value for this key may be {@code null} on some devices.</p>
      * <p><b>Full capability</b> -
      * Present on all camera devices that report being {@link CameraCharacteristics#INFO_SUPPORTED_HARDWARE_LEVEL_FULL HARDWARE_LEVEL_FULL} devices in the
      * {@link CameraCharacteristics#INFO_SUPPORTED_HARDWARE_LEVEL android.info.supportedHardwareLevel} key</p>
@@ -4386,7 +4464,7 @@
      *   (0.8000, 0.9063), (0.8667, 0.9389), (0.9333, 0.9701), (1.0000, 1.0000) ]
      * </code></pre>
      * <p><img alt="sRGB tonemapping curve" src="/reference/images/camera2/metadata/android.tonemap.curveRed/srgb_tonemap.png" /></p>
-     * <p><b>Optional</b> - This value may be {@code null} on some devices.</p>
+     * <p><b>Optional</b> - The value for this key may be {@code null} on some devices.</p>
      * <p><b>Full capability</b> -
      * Present on all camera devices that report being {@link CameraCharacteristics#INFO_SUPPORTED_HARDWARE_LEVEL_FULL HARDWARE_LEVEL_FULL} devices in the
      * {@link CameraCharacteristics#INFO_SUPPORTED_HARDWARE_LEVEL android.info.supportedHardwareLevel} key</p>
@@ -4396,6 +4474,7 @@
      * @see CaptureRequest#TONEMAP_MODE
      */
     @PublicKey
+    @NonNull
     @SyntheticKey
     public static final Key<android.hardware.camera2.params.TonemapCurve> TONEMAP_CURVE =
             new Key<android.hardware.camera2.params.TonemapCurve>("android.tonemap.curve", android.hardware.camera2.params.TonemapCurve.class);
@@ -4430,7 +4509,7 @@
      * </ul></p>
      * <p><b>Available values for this device:</b><br>
      * {@link CameraCharacteristics#TONEMAP_AVAILABLE_TONE_MAP_MODES android.tonemap.availableToneMapModes}</p>
-     * <p><b>Optional</b> - This value may be {@code null} on some devices.</p>
+     * <p><b>Optional</b> - The value for this key may be {@code null} on some devices.</p>
      * <p><b>Full capability</b> -
      * Present on all camera devices that report being {@link CameraCharacteristics#INFO_SUPPORTED_HARDWARE_LEVEL_FULL HARDWARE_LEVEL_FULL} devices in the
      * {@link CameraCharacteristics#INFO_SUPPORTED_HARDWARE_LEVEL android.info.supportedHardwareLevel} key</p>
@@ -4446,6 +4525,7 @@
      * @see #TONEMAP_MODE_PRESET_CURVE
      */
     @PublicKey
+    @NonNull
     public static final Key<Integer> TONEMAP_MODE =
             new Key<Integer>("android.tonemap.mode", int.class);
 
@@ -4462,11 +4542,12 @@
      * value will be returned in capture result.</p>
      * <p>The valid range of gamma value varies on different devices, but values
      * within [1.0, 5.0] are guaranteed not to be clipped.</p>
-     * <p><b>Optional</b> - This value may be {@code null} on some devices.</p>
+     * <p><b>Optional</b> - The value for this key may be {@code null} on some devices.</p>
      *
      * @see CaptureRequest#TONEMAP_MODE
      */
     @PublicKey
+    @NonNull
     public static final Key<Float> TONEMAP_GAMMA =
             new Key<Float>("android.tonemap.gamma", float.class);
 
@@ -4485,13 +4566,14 @@
      *   <li>{@link #TONEMAP_PRESET_CURVE_SRGB SRGB}</li>
      *   <li>{@link #TONEMAP_PRESET_CURVE_REC709 REC709}</li>
      * </ul></p>
-     * <p><b>Optional</b> - This value may be {@code null} on some devices.</p>
+     * <p><b>Optional</b> - The value for this key may be {@code null} on some devices.</p>
      *
      * @see CaptureRequest#TONEMAP_MODE
      * @see #TONEMAP_PRESET_CURVE_SRGB
      * @see #TONEMAP_PRESET_CURVE_REC709
      */
     @PublicKey
+    @NonNull
     public static final Key<Integer> TONEMAP_PRESET_CURVE =
             new Key<Integer>("android.tonemap.presetCurve", int.class);
 
@@ -4506,7 +4588,7 @@
      * data is stored locally on the device.</p>
      * <p>The LED <em>may</em> be off if a trusted application is using the data that
      * doesn't violate the above rules.</p>
-     * <p><b>Optional</b> - This value may be {@code null} on some devices.</p>
+     * <p><b>Optional</b> - The value for this key may be {@code null} on some devices.</p>
      * @hide
      */
     public static final Key<Boolean> LED_TRANSMIT =
@@ -4519,7 +4601,7 @@
      * ON if {@link CaptureRequest#BLACK_LEVEL_LOCK android.blackLevel.lock} was ON in the capture request, unless
      * a change in other capture settings forced the camera device to
      * perform a black level reset.</p>
-     * <p><b>Optional</b> - This value may be {@code null} on some devices.</p>
+     * <p><b>Optional</b> - The value for this key may be {@code null} on some devices.</p>
      * <p><b>Full capability</b> -
      * Present on all camera devices that report being {@link CameraCharacteristics#INFO_SUPPORTED_HARDWARE_LEVEL_FULL HARDWARE_LEVEL_FULL} devices in the
      * {@link CameraCharacteristics#INFO_SUPPORTED_HARDWARE_LEVEL android.info.supportedHardwareLevel} key</p>
@@ -4528,6 +4610,7 @@
      * @see CameraCharacteristics#INFO_SUPPORTED_HARDWARE_LEVEL
      */
     @PublicKey
+    @NonNull
     public static final Key<Boolean> BLACK_LEVEL_LOCK =
             new Key<Boolean>("android.blackLevel.lock", boolean.class);
 
@@ -4637,7 +4720,7 @@
      * <p><b>Units</b>: Relative exposure time increase factor.</p>
      * <p><b>Range of valid values:</b><br>
      * &gt;= 1.0</p>
-     * <p><b>Optional</b> - This value may be {@code null} on some devices.</p>
+     * <p><b>Optional</b> - The value for this key may be {@code null} on some devices.</p>
      * <p><b>Limited capability</b> -
      * Present on all camera devices that report being at least {@link CameraCharacteristics#INFO_SUPPORTED_HARDWARE_LEVEL_LIMITED HARDWARE_LEVEL_LIMITED} devices in the
      * {@link CameraCharacteristics#INFO_SUPPORTED_HARDWARE_LEVEL android.info.supportedHardwareLevel} key</p>
@@ -4648,6 +4731,7 @@
      * @see CameraCharacteristics#REQUEST_AVAILABLE_CAPABILITIES
      */
     @PublicKey
+    @NonNull
     public static final Key<Float> REPROCESS_EFFECTIVE_EXPOSURE_FACTOR =
             new Key<Float>("android.reprocess.effectiveExposureFactor", float.class);
 
@@ -4655,16 +4739,21 @@
      * <p>String containing the ID of the underlying active physical camera.</p>
      * <p>The ID of the active physical camera that's backing the logical camera. All camera
      * streams and metadata that are not physical camera specific will be originating from this
-     * physical camera. This must be one of valid physical IDs advertised in the physicalIds
-     * static tag.</p>
+     * physical camera.</p>
      * <p>For a logical camera made up of physical cameras where each camera's lenses have
      * different characteristics, the camera device may choose to switch between the physical
      * cameras when application changes FOCAL_LENGTH or SCALER_CROP_REGION.
      * At the time of lens switch, this result metadata reflects the new active physical camera
      * ID.</p>
-     * <p><b>Optional</b> - This value may be {@code null} on some devices.</p>
+     * <p>This key will be available if the camera device advertises this key via {@link android.hardware.camera2.CameraCharacteristics#getAvailableCaptureResultKeys }.
+     * When available, this must be one of valid physical IDs backing this logical multi-camera.
+     * If this key is not available for a logical multi-camera, the camera device implementation
+     * may still switch between different active physical cameras based on use case, but the
+     * current active physical camera information won't be available to the application.</p>
+     * <p><b>Optional</b> - The value for this key may be {@code null} on some devices.</p>
      */
     @PublicKey
+    @NonNull
     public static final Key<String> LOGICAL_MULTI_CAMERA_ACTIVE_PHYSICAL_ID =
             new Key<String>("android.logicalMultiCamera.activePhysicalId", String.class);
 
@@ -4711,7 +4800,7 @@
      * </ul></p>
      * <p><b>Available values for this device:</b><br>
      * {@link CameraCharacteristics#DISTORTION_CORRECTION_AVAILABLE_MODES android.distortionCorrection.availableModes}</p>
-     * <p><b>Optional</b> - This value may be {@code null} on some devices.</p>
+     * <p><b>Optional</b> - The value for this key may be {@code null} on some devices.</p>
      *
      * @see CaptureRequest#CONTROL_AE_REGIONS
      * @see CaptureRequest#CONTROL_AF_REGIONS
@@ -4727,6 +4816,7 @@
      * @see #DISTORTION_CORRECTION_MODE_HIGH_QUALITY
      */
     @PublicKey
+    @NonNull
     public static final Key<Integer> DISTORTION_CORRECTION_MODE =
             new Key<Integer>("android.distortionCorrection.mode", int.class);
 
@@ -4736,4 +4826,7 @@
 
 
 
+
+
+
 }
diff --git a/core/java/android/hardware/camera2/impl/CameraMetadataNative.java b/core/java/android/hardware/camera2/impl/CameraMetadataNative.java
index 65026b6..1cdf235 100644
--- a/core/java/android/hardware/camera2/impl/CameraMetadataNative.java
+++ b/core/java/android/hardware/camera2/impl/CameraMetadataNative.java
@@ -350,7 +350,7 @@
         return newObject;
     }
 
-    public static final Parcelable.Creator<CameraMetadataNative> CREATOR =
+    public static final @android.annotation.NonNull Parcelable.Creator<CameraMetadataNative> CREATOR =
             new Parcelable.Creator<CameraMetadataNative>() {
         @Override
         public CameraMetadataNative createFromParcel(Parcel in) {
diff --git a/core/java/android/hardware/camera2/impl/CaptureResultExtras.java b/core/java/android/hardware/camera2/impl/CaptureResultExtras.java
index 40535e2..edc3d91 100644
--- a/core/java/android/hardware/camera2/impl/CaptureResultExtras.java
+++ b/core/java/android/hardware/camera2/impl/CaptureResultExtras.java
@@ -30,7 +30,7 @@
     private int partialResultCount;
     private int errorStreamId;
 
-    public static final Parcelable.Creator<CaptureResultExtras> CREATOR =
+    public static final @android.annotation.NonNull Parcelable.Creator<CaptureResultExtras> CREATOR =
             new Parcelable.Creator<CaptureResultExtras>() {
         @Override
         public CaptureResultExtras createFromParcel(Parcel in) {
diff --git a/core/java/android/hardware/camera2/impl/PhysicalCaptureResultInfo.java b/core/java/android/hardware/camera2/impl/PhysicalCaptureResultInfo.java
index 30eaf13..09619d0 100644
--- a/core/java/android/hardware/camera2/impl/PhysicalCaptureResultInfo.java
+++ b/core/java/android/hardware/camera2/impl/PhysicalCaptureResultInfo.java
@@ -27,7 +27,7 @@
     private String cameraId;
     private CameraMetadataNative cameraMetadata;
 
-    public static final Parcelable.Creator<PhysicalCaptureResultInfo> CREATOR =
+    public static final @android.annotation.NonNull Parcelable.Creator<PhysicalCaptureResultInfo> CREATOR =
             new Parcelable.Creator<PhysicalCaptureResultInfo>() {
         @Override
         public PhysicalCaptureResultInfo createFromParcel(Parcel in) {
diff --git a/core/java/android/hardware/camera2/params/MandatoryStreamCombination.java b/core/java/android/hardware/camera2/params/MandatoryStreamCombination.java
index b8e2d7a..d44b6b5 100644
--- a/core/java/android/hardware/camera2/params/MandatoryStreamCombination.java
+++ b/core/java/android/hardware/camera2/params/MandatoryStreamCombination.java
@@ -19,9 +19,12 @@
 import static com.android.internal.util.Preconditions.*;
 import static android.hardware.camera2.params.StreamConfigurationMap.checkArgumentFormat;
 
+import android.annotation.IntRange;
 import android.annotation.NonNull;
+import android.annotation.Nullable;
 import android.content.Context;
 import android.graphics.ImageFormat;
+import android.graphics.ImageFormat.Format;
 import android.hardware.camera2.CameraCharacteristics;
 import android.hardware.camera2.CameraCharacteristics.Key;
 import android.hardware.camera2.CameraDevice;
@@ -44,8 +47,9 @@
 /**
  * Immutable class to store the available mandatory stream combination.
  *
- * <p>The individual stream combinations are generated according to the guidelines
- * at {@link CameraDevice#createCaptureSession}.</p>
+ * <p>A mandatory stream combination refers to a specific entry in the documented sets of
+ * required stream {@link CameraDevice#createCaptureSession combinations}.
+ * These combinations of streams are required to be supported by the camera device.
  *
  * <p>The list of stream combinations is available by invoking
  * {@link CameraCharacteristics#get} and passing key
@@ -88,7 +92,7 @@
          *              ImageFormat/PixelFormat.
          * @hide
          */
-        public MandatoryStreamInformation(@NonNull List<Size> availableSizes, int format,
+        public MandatoryStreamInformation(@NonNull List<Size> availableSizes, @Format int format,
                 boolean isInput) {
             if (availableSizes.isEmpty()) {
                 throw new IllegalArgumentException("No available sizes");
@@ -118,7 +122,7 @@
          *
          * @return non-modifiable ascending list of available sizes.
          */
-        public List<Size> getAvailableSizes() {
+        public @NonNull List<Size> getAvailableSizes() {
             return Collections.unmodifiableList(mAvailableSizes);
         }
 
@@ -127,7 +131,7 @@
          *
          * @return integer format.
          */
-        public int getFormat() {
+        public @Format int getFormat() {
             return mFormat;
         }
 
@@ -187,7 +191,7 @@
      * @hide
      */
     public MandatoryStreamCombination(@NonNull List<MandatoryStreamInformation> streamsInformation,
-            String description, boolean isReprocessable) {
+            @NonNull String description, boolean isReprocessable) {
         if (streamsInformation.isEmpty()) {
             throw new IllegalArgumentException("Empty stream information");
         }
@@ -199,14 +203,16 @@
     /**
      * Get the mandatory stream combination description.
      *
-     * @return String with the mandatory combination description.
+     * @return CharSequence with the mandatory combination description.
      */
-    public String getDescription() {
+    public @NonNull CharSequence getDescription() {
         return mDescription;
     }
 
     /**
-     * Indicates whether the mandatory stream combination is reprocessable.
+     * Indicates whether the mandatory stream combination is reprocessable. Reprocessable is defined
+     * as a stream combination that contains one input stream
+     * ({@link MandatoryStreamInformation#isInput} return true).
      *
      * @return {@code true} in case the mandatory stream combination contains an input,
      *         {@code false} otherwise.
@@ -221,7 +227,7 @@
      * @return Non-modifiable list of stream information.
      *
      */
-    public List<MandatoryStreamInformation> getStreamsInformation() {
+    public @NonNull List<MandatoryStreamInformation> getStreamsInformation() {
         return Collections.unmodifiableList(mStreamsInformation);
     }
 
@@ -274,7 +280,8 @@
             this(format, sizeThreshold, /*isInput*/false);
         }
 
-        public StreamTemplate(int format, SizeThreshold sizeThreshold, boolean isInput) {
+        public StreamTemplate(@Format int format, @NonNull SizeThreshold sizeThreshold,
+                boolean isInput) {
             mFormat = format;
             mSizeThreshold = sizeThreshold;
             mIsInput = isInput;
@@ -286,11 +293,13 @@
         public String mDescription;
         public ReprocessType mReprocessType;
 
-        public StreamCombinationTemplate(StreamTemplate[] streamTemplates, String description) {
+        public StreamCombinationTemplate(@NonNull StreamTemplate[] streamTemplates,
+                @NonNull String description) {
             this(streamTemplates, description, /*reprocessType*/ReprocessType.NONE);
         }
 
-        public StreamCombinationTemplate(StreamTemplate[] streamTemplates, String description,
+        public StreamCombinationTemplate(@NonNull StreamTemplate[] streamTemplates,
+                @NonNull String description,
                 ReprocessType reprocessType) {
             mStreamTemplates = streamTemplates;
             mReprocessType = reprocessType;
@@ -680,7 +689,8 @@
          *         null in case device is not backward compatible or the method encounters
          *         an error.
          */
-        public List<MandatoryStreamCombination> getAvailableMandatoryStreamCombinations() {
+        public @Nullable List<MandatoryStreamCombination>
+            getAvailableMandatoryStreamCombinations() {
             if (!isColorOutputSupported()) {
                 Log.v(TAG, "Device is not backward compatible!");
                 return null;
@@ -767,8 +777,8 @@
          * @return a non-modifiable list of supported mandatory stream combinations or
          *         null in case of errors.
          */
-        private List<MandatoryStreamCombination> generateAvailableCombinations(
-                ArrayList<StreamCombinationTemplate> availableTemplates) {
+        private @Nullable List<MandatoryStreamCombination> generateAvailableCombinations(
+                @NonNull ArrayList<StreamCombinationTemplate> availableTemplates) {
             if (availableTemplates.isEmpty()) {
                 Log.e(TAG, "No available stream templates!");
                 return null;
@@ -873,7 +883,8 @@
         /**
          * Helper method to enumerate all available sizes according to size threshold and format.
          */
-        private HashMap<Pair<SizeThreshold, Integer>, List<Size>> enumerateAvailableSizes() {
+        private @Nullable HashMap<Pair<SizeThreshold, Integer>, List<Size>>
+            enumerateAvailableSizes() {
             final int[] formats = {
                 ImageFormat.PRIVATE,
                 ImageFormat.YUV_420_888,
@@ -935,12 +946,8 @@
          * Compile a list of sizes smaller than or equal to given bound.
          * Return an empty list if there is no size smaller than or equal to the bound.
          */
-        private static List<Size> getSizesWithinBound(Size[] sizes, Size bound) {
-            if (sizes == null || sizes.length == 0) {
-                Log.e(TAG, "Empty or invalid size array!");
-                return null;
-            }
-
+        private static @Nullable List<Size> getSizesWithinBound(@NonNull Size[] sizes,
+                @NonNull Size bound) {
             ArrayList<Size> ret = new ArrayList<Size>();
             for (Size size : sizes) {
                 if (size.getWidth() <= bound.getWidth() && size.getHeight() <= bound.getHeight()) {
@@ -960,7 +967,7 @@
          *
          * @throws IllegalArgumentException if sizes was null or had 0 elements
          */
-        public static Size getMaxSize(Size... sizes) {
+        public static @Nullable Size getMaxSize(@NonNull Size... sizes) {
             if (sizes == null || sizes.length == 0) {
                 throw new IllegalArgumentException("sizes was empty");
             }
@@ -1089,7 +1096,7 @@
          *
          * @return Maximum supported video size.
          */
-        private Size getMaxRecordingSize() {
+        private @Nullable Size getMaxRecordingSize() {
             int quality =
                     CamcorderProfile.hasProfile(mCameraId, CamcorderProfile.QUALITY_2160P) ?
                         CamcorderProfile.QUALITY_2160P :
@@ -1121,7 +1128,7 @@
          *
          * @return Maximum supported video size.
          */
-        private Size getMaxExternalRecordingSize() {
+        private @NonNull Size getMaxExternalRecordingSize() {
             final Size FULLHD = new Size(1920, 1080);
 
             Size[] videoSizeArr = mStreamConfigMap.getOutputSizes(
@@ -1146,7 +1153,7 @@
             return FULLHD; // doesn't matter what size is returned here
         }
 
-        private Size getMaxPreviewSize(List<Size> orderedPreviewSizes) {
+        private @NonNull Size getMaxPreviewSize(List<Size> orderedPreviewSizes) {
             if (orderedPreviewSizes != null) {
                 for (Size size : orderedPreviewSizes) {
                     if ((mDisplaySize.getWidth() >= size.getWidth()) &&
@@ -1181,7 +1188,7 @@
          */
         public static class SizeComparator implements Comparator<Size> {
             @Override
-            public int compare(Size lhs, Size rhs) {
+            public int compare(@NonNull Size lhs, @NonNull Size rhs) {
                 return compareSizes(lhs.getWidth(), lhs.getHeight(), rhs.getWidth(),
                         rhs.getHeight());
             }
@@ -1199,12 +1206,8 @@
          * @param ascending True if the order is ascending, otherwise descending order
          * @return The ordered list of sizes
          */
-        private static List<Size> getAscendingOrderSizes(final List<Size> sizeList,
-                boolean ascending) {
-            if (sizeList == null) {
-                return null;
-            }
-
+        private static @NonNull List<Size> getAscendingOrderSizes(
+                @NonNull final List<Size> sizeList, boolean ascending) {
             Comparator<Size> comparator = new SizeComparator();
             List<Size> sortedSizes = new ArrayList<Size>();
             sortedSizes.addAll(sizeList);
diff --git a/core/java/android/hardware/camera2/params/OutputConfiguration.java b/core/java/android/hardware/camera2/params/OutputConfiguration.java
index cb33659..d7db1f5 100644
--- a/core/java/android/hardware/camera2/params/OutputConfiguration.java
+++ b/core/java/android/hardware/camera2/params/OutputConfiguration.java
@@ -626,7 +626,7 @@
         return mSurfaceGroupId;
     }
 
-    public static final Parcelable.Creator<OutputConfiguration> CREATOR =
+    public static final @android.annotation.NonNull Parcelable.Creator<OutputConfiguration> CREATOR =
             new Parcelable.Creator<OutputConfiguration>() {
         @Override
         public OutputConfiguration createFromParcel(Parcel source) {
diff --git a/core/java/android/hardware/camera2/params/SessionConfiguration.java b/core/java/android/hardware/camera2/params/SessionConfiguration.java
index 3ea58ad..555ff9a 100644
--- a/core/java/android/hardware/camera2/params/SessionConfiguration.java
+++ b/core/java/android/hardware/camera2/params/SessionConfiguration.java
@@ -134,7 +134,7 @@
         mOutputConfigurations = outConfigs;
     }
 
-    public static final Parcelable.Creator<SessionConfiguration> CREATOR =
+    public static final @android.annotation.NonNull Parcelable.Creator<SessionConfiguration> CREATOR =
             new Parcelable.Creator<SessionConfiguration> () {
         @Override
         public SessionConfiguration createFromParcel(Parcel source) {
diff --git a/core/java/android/hardware/camera2/params/VendorTagDescriptor.java b/core/java/android/hardware/camera2/params/VendorTagDescriptor.java
index ea424e5..4845ec3 100644
--- a/core/java/android/hardware/camera2/params/VendorTagDescriptor.java
+++ b/core/java/android/hardware/camera2/params/VendorTagDescriptor.java
@@ -32,7 +32,7 @@
     private VendorTagDescriptor(Parcel source) {
     }
 
-    public static final Parcelable.Creator<VendorTagDescriptor> CREATOR =
+    public static final @android.annotation.NonNull Parcelable.Creator<VendorTagDescriptor> CREATOR =
             new Parcelable.Creator<VendorTagDescriptor>() {
         @Override
         public VendorTagDescriptor createFromParcel(Parcel source) {
diff --git a/core/java/android/hardware/camera2/params/VendorTagDescriptorCache.java b/core/java/android/hardware/camera2/params/VendorTagDescriptorCache.java
index 1f92f6d..450b70b 100644
--- a/core/java/android/hardware/camera2/params/VendorTagDescriptorCache.java
+++ b/core/java/android/hardware/camera2/params/VendorTagDescriptorCache.java
@@ -32,7 +32,7 @@
     private VendorTagDescriptorCache(Parcel source) {
     }
 
-    public static final Parcelable.Creator<VendorTagDescriptorCache> CREATOR =
+    public static final @android.annotation.NonNull Parcelable.Creator<VendorTagDescriptorCache> CREATOR =
             new Parcelable.Creator<VendorTagDescriptorCache>() {
         @Override
         public VendorTagDescriptorCache createFromParcel(Parcel source) {
diff --git a/core/java/android/hardware/camera2/utils/LongParcelable.java b/core/java/android/hardware/camera2/utils/LongParcelable.java
index c89b339..d36736e 100644
--- a/core/java/android/hardware/camera2/utils/LongParcelable.java
+++ b/core/java/android/hardware/camera2/utils/LongParcelable.java
@@ -32,7 +32,7 @@
         this.number = number;
     }
 
-    public static final Parcelable.Creator<LongParcelable> CREATOR =
+    public static final @android.annotation.NonNull Parcelable.Creator<LongParcelable> CREATOR =
             new Parcelable.Creator<LongParcelable>() {
         @Override
         public LongParcelable createFromParcel(Parcel in) {
diff --git a/core/java/android/hardware/camera2/utils/SubmitInfo.java b/core/java/android/hardware/camera2/utils/SubmitInfo.java
index d1692b5..9df09c4 100644
--- a/core/java/android/hardware/camera2/utils/SubmitInfo.java
+++ b/core/java/android/hardware/camera2/utils/SubmitInfo.java
@@ -43,7 +43,7 @@
         mLastFrameNumber = lastFrameNumber;
     }
 
-    public static final Parcelable.Creator<SubmitInfo> CREATOR =
+    public static final @android.annotation.NonNull Parcelable.Creator<SubmitInfo> CREATOR =
             new Parcelable.Creator<SubmitInfo>() {
         @Override
         public SubmitInfo createFromParcel(Parcel in) {
diff --git a/core/java/android/hardware/display/AmbientBrightnessDayStats.java b/core/java/android/hardware/display/AmbientBrightnessDayStats.java
index 1aa2557..b25ef8d 100644
--- a/core/java/android/hardware/display/AmbientBrightnessDayStats.java
+++ b/core/java/android/hardware/display/AmbientBrightnessDayStats.java
@@ -121,7 +121,7 @@
         mStats = source.createFloatArray();
     }
 
-    public static final Creator<AmbientBrightnessDayStats> CREATOR =
+    public static final @android.annotation.NonNull Creator<AmbientBrightnessDayStats> CREATOR =
             new Creator<AmbientBrightnessDayStats>() {
 
                 @Override
diff --git a/core/java/android/hardware/display/BrightnessChangeEvent.java b/core/java/android/hardware/display/BrightnessChangeEvent.java
index c6186bb..7fa1cfb 100644
--- a/core/java/android/hardware/display/BrightnessChangeEvent.java
+++ b/core/java/android/hardware/display/BrightnessChangeEvent.java
@@ -153,7 +153,7 @@
         colorSampleDuration = source.readLong();
     }
 
-    public static final Creator<BrightnessChangeEvent> CREATOR =
+    public static final @android.annotation.NonNull Creator<BrightnessChangeEvent> CREATOR =
             new Creator<BrightnessChangeEvent>() {
                 public BrightnessChangeEvent createFromParcel(Parcel source) {
                     return new BrightnessChangeEvent(source);
diff --git a/core/java/android/hardware/display/BrightnessConfiguration.java b/core/java/android/hardware/display/BrightnessConfiguration.java
index ed8a97c..5b63dcf 100644
--- a/core/java/android/hardware/display/BrightnessConfiguration.java
+++ b/core/java/android/hardware/display/BrightnessConfiguration.java
@@ -198,7 +198,7 @@
                 && Objects.equals(mDescription, other.mDescription);
     }
 
-    public static final Creator<BrightnessConfiguration> CREATOR =
+    public static final @android.annotation.NonNull Creator<BrightnessConfiguration> CREATOR =
             new Creator<BrightnessConfiguration>() {
         public BrightnessConfiguration createFromParcel(Parcel in) {
             float[] lux = in.createFloatArray();
@@ -444,6 +444,7 @@
          *      {@link #getMaxCorrectionsByPackageName}).
          *
          */
+        @NonNull
         public Builder addCorrectionByPackageName(@NonNull String packageName,
                 @NonNull BrightnessCorrection correction) {
             Objects.requireNonNull(packageName, "packageName must not be null");
@@ -472,6 +473,7 @@
          *      {@link #getMaxCorrectionsByCategory}).
          *
          */
+        @NonNull
         public Builder addCorrectionByCategory(@ApplicationInfo.Category int category,
                 @NonNull BrightnessCorrection correction) {
             Objects.requireNonNull(correction, "correction must not be null");
@@ -488,6 +490,7 @@
          * @param description brief text describing the curve pushed. It maybe truncated
          *                    and will not be displayed in the UI
          */
+        @NonNull
         public Builder setDescription(@Nullable String description) {
             mDescription = description;
             return this;
@@ -496,6 +499,7 @@
         /**
          * Builds the {@link BrightnessConfiguration}.
          */
+        @NonNull
         public BrightnessConfiguration build() {
             if (mCurveLux == null || mCurveNits == null) {
                 throw new IllegalStateException("A curve must be set!");
diff --git a/core/java/android/hardware/display/BrightnessCorrection.java b/core/java/android/hardware/display/BrightnessCorrection.java
index ee8d846..b029acc 100644
--- a/core/java/android/hardware/display/BrightnessCorrection.java
+++ b/core/java/android/hardware/display/BrightnessCorrection.java
@@ -120,7 +120,7 @@
         return mImplementation.hashCode();
     }
 
-    public static final Creator<BrightnessCorrection> CREATOR =
+    public static final @android.annotation.NonNull Creator<BrightnessCorrection> CREATOR =
             new Creator<BrightnessCorrection>() {
                 public BrightnessCorrection createFromParcel(Parcel in) {
                     final int type = in.readInt();
diff --git a/core/java/android/hardware/display/Curve.java b/core/java/android/hardware/display/Curve.java
index 41f66f5..0010515 100644
--- a/core/java/android/hardware/display/Curve.java
+++ b/core/java/android/hardware/display/Curve.java
@@ -37,7 +37,7 @@
         return mY;
     }
 
-    public static final Creator<Curve> CREATOR = new Creator<Curve>() {
+    public static final @android.annotation.NonNull Creator<Curve> CREATOR = new Creator<Curve>() {
         public Curve createFromParcel(Parcel in) {
             float[] x = in.createFloatArray();
             float[] y = in.createFloatArray();
diff --git a/core/java/android/hardware/display/DisplayManagerGlobal.java b/core/java/android/hardware/display/DisplayManagerGlobal.java
index ac44fe9..ea63776 100644
--- a/core/java/android/hardware/display/DisplayManagerGlobal.java
+++ b/core/java/android/hardware/display/DisplayManagerGlobal.java
@@ -185,6 +185,21 @@
     }
 
     /**
+     * Check if specified UID's content is present on display and should be granted access to it.
+     *
+     * @param uid UID to be checked.
+     * @param displayId id of the display where presence of the content is checked.
+     * @return {@code true} if UID is present on display, {@code false} otherwise.
+     */
+    public boolean isUidPresentOnDisplay(int uid, int displayId) {
+        try {
+            return mDm.isUidPresentOnDisplay(uid, displayId);
+        } catch (RemoteException ex) {
+            throw ex.rethrowFromSystemServer();
+        }
+    }
+
+    /**
      * Gets information about a logical display.
      *
      * The display metrics may be adjusted to provide compatibility
diff --git a/core/java/android/hardware/display/DisplayManagerInternal.java b/core/java/android/hardware/display/DisplayManagerInternal.java
index 43ea682..8231985 100644
--- a/core/java/android/hardware/display/DisplayManagerInternal.java
+++ b/core/java/android/hardware/display/DisplayManagerInternal.java
@@ -187,14 +187,6 @@
     public abstract void setDisplayAccessUIDs(SparseArray<IntArray> displayAccessUIDs);
 
     /**
-     * Check if specified UID's content is present on display and should be granted access to it.
-     *
-     * @param uid UID to be checked.
-     * @param displayId id of the display where presence of the content is checked.
-     * */
-    public abstract boolean isUidPresentOnDisplay(int uid, int displayId);
-
-    /**
      * Persist brightness slider events and ambient brightness stats.
      */
     public abstract void persistBrightnessTrackerState();
diff --git a/core/java/android/hardware/display/IDisplayManager.aidl b/core/java/android/hardware/display/IDisplayManager.aidl
index 5ea8bd6..0143c91 100644
--- a/core/java/android/hardware/display/IDisplayManager.aidl
+++ b/core/java/android/hardware/display/IDisplayManager.aidl
@@ -30,9 +30,12 @@
 
 /** @hide */
 interface IDisplayManager {
+    @UnsupportedAppUsage
     DisplayInfo getDisplayInfo(int displayId);
     int[] getDisplayIds();
 
+    boolean isUidPresentOnDisplay(int uid, int displayId);
+
     void registerCallback(in IDisplayManagerCallback callback);
 
     // Requires CONFIGURE_WIFI_DISPLAY permission.
diff --git a/core/java/android/hardware/display/Time.java b/core/java/android/hardware/display/Time.java
index b943ac6..87e5b38 100644
--- a/core/java/android/hardware/display/Time.java
+++ b/core/java/android/hardware/display/Time.java
@@ -62,7 +62,7 @@
         return LocalTime.of(mHour, mMinute, mSecond, mNano);
     }
 
-    public static final Parcelable.Creator<Time> CREATOR = new Parcelable.Creator<Time>() {
+    public static final @android.annotation.NonNull Parcelable.Creator<Time> CREATOR = new Parcelable.Creator<Time>() {
 
         @Override
         public Time createFromParcel(Parcel source) {
diff --git a/core/java/android/hardware/display/WifiDisplay.java b/core/java/android/hardware/display/WifiDisplay.java
index 12486e8..55e6051 100644
--- a/core/java/android/hardware/display/WifiDisplay.java
+++ b/core/java/android/hardware/display/WifiDisplay.java
@@ -40,7 +40,7 @@
 
     public static final WifiDisplay[] EMPTY_ARRAY = new WifiDisplay[0];
 
-    public static final Creator<WifiDisplay> CREATOR = new Creator<WifiDisplay>() {
+    public static final @android.annotation.NonNull Creator<WifiDisplay> CREATOR = new Creator<WifiDisplay>() {
         public WifiDisplay createFromParcel(Parcel in) {
             String deviceAddress = in.readString();
             String deviceName = in.readString();
diff --git a/core/java/android/hardware/display/WifiDisplaySessionInfo.java b/core/java/android/hardware/display/WifiDisplaySessionInfo.java
index 33d2725..9fb85f9 100644
--- a/core/java/android/hardware/display/WifiDisplaySessionInfo.java
+++ b/core/java/android/hardware/display/WifiDisplaySessionInfo.java
@@ -36,7 +36,7 @@
     private final String mPassphrase;
     private final String mIP;
 
-    public static final Creator<WifiDisplaySessionInfo> CREATOR =
+    public static final @android.annotation.NonNull Creator<WifiDisplaySessionInfo> CREATOR =
             new Creator<WifiDisplaySessionInfo>() {
         @Override
         public WifiDisplaySessionInfo createFromParcel(Parcel in) {
diff --git a/core/java/android/hardware/display/WifiDisplayStatus.java b/core/java/android/hardware/display/WifiDisplayStatus.java
index c267834..1973e51 100644
--- a/core/java/android/hardware/display/WifiDisplayStatus.java
+++ b/core/java/android/hardware/display/WifiDisplayStatus.java
@@ -69,7 +69,7 @@
     @UnsupportedAppUsage
     public static final int DISPLAY_STATE_CONNECTED = 2;
 
-    public static final Creator<WifiDisplayStatus> CREATOR = new Creator<WifiDisplayStatus>() {
+    public static final @android.annotation.NonNull Creator<WifiDisplayStatus> CREATOR = new Creator<WifiDisplayStatus>() {
         public WifiDisplayStatus createFromParcel(Parcel in) {
             int featureState = in.readInt();
             int scanState = in.readInt();
diff --git a/core/java/android/hardware/face/Face.java b/core/java/android/hardware/face/Face.java
index d6724d7..b90fafe 100644
--- a/core/java/android/hardware/face/Face.java
+++ b/core/java/android/hardware/face/Face.java
@@ -54,7 +54,7 @@
         out.writeLong(getDeviceId());
     }
 
-    public static final Parcelable.Creator<Face> CREATOR = new Parcelable.Creator<Face>() {
+    public static final @android.annotation.NonNull Parcelable.Creator<Face> CREATOR = new Parcelable.Creator<Face>() {
             public Face createFromParcel(Parcel in) {
                 return new Face(in);
             }
diff --git a/core/java/android/hardware/face/FaceManager.java b/core/java/android/hardware/face/FaceManager.java
index 55b340f..139a5ee 100644
--- a/core/java/android/hardware/face/FaceManager.java
+++ b/core/java/android/hardware/face/FaceManager.java
@@ -286,14 +286,15 @@
      * @hide
      */
     @RequiresPermission(MANAGE_BIOMETRIC)
-    public void setFeature(int feature, boolean enabled, byte[] token) {
+    public boolean setFeature(int feature, boolean enabled, byte[] token) {
         if (mService != null) {
             try {
-                mService.setFeature(feature, enabled, token);
+                return mService.setFeature(feature, enabled, token);
             } catch (RemoteException e) {
                 throw e.rethrowFromSystemServer();
             }
         }
+        return false;
     }
 
     /**
diff --git a/core/java/android/hardware/face/IFaceService.aidl b/core/java/android/hardware/face/IFaceService.aidl
index 9609e99..5043d4c 100644
--- a/core/java/android/hardware/face/IFaceService.aidl
+++ b/core/java/android/hardware/face/IFaceService.aidl
@@ -98,7 +98,7 @@
     // Enumerate all faces
     void enumerate(IBinder token, int userId, IFaceServiceReceiver receiver);
 
-    int setFeature(int feature, boolean enabled, in byte [] token);
+    boolean setFeature(int feature, boolean enabled, in byte [] token);
 
     boolean getFeature(int feature);
 
diff --git a/core/java/android/hardware/fingerprint/Fingerprint.java b/core/java/android/hardware/fingerprint/Fingerprint.java
index bbd3d05..57e52d9 100644
--- a/core/java/android/hardware/fingerprint/Fingerprint.java
+++ b/core/java/android/hardware/fingerprint/Fingerprint.java
@@ -55,7 +55,7 @@
         out.writeInt(mGroupId);
     }
 
-    public static final Parcelable.Creator<Fingerprint> CREATOR
+    public static final @android.annotation.NonNull Parcelable.Creator<Fingerprint> CREATOR
             = new Parcelable.Creator<Fingerprint>() {
         public Fingerprint createFromParcel(Parcel in) {
             return new Fingerprint(in);
diff --git a/core/java/android/hardware/hdmi/HdmiControlManager.java b/core/java/android/hardware/hdmi/HdmiControlManager.java
index 56020b2..aff385d 100644
--- a/core/java/android/hardware/hdmi/HdmiControlManager.java
+++ b/core/java/android/hardware/hdmi/HdmiControlManager.java
@@ -19,6 +19,7 @@
 import static com.android.internal.os.RoSystemProperties.PROPERTY_HDMI_IS_DEVICE_HDMI_CEC_SWITCH;
 
 import android.annotation.IntDef;
+import android.annotation.NonNull;
 import android.annotation.Nullable;
 import android.annotation.RequiresFeature;
 import android.annotation.RequiresPermission;
@@ -456,7 +457,7 @@
      * @hide
      */
     @SystemApi
-    public void powerOffRemoteDevice(HdmiDeviceInfo deviceInfo) {
+    public void powerOffRemoteDevice(@NonNull HdmiDeviceInfo deviceInfo) {
         Preconditions.checkNotNull(deviceInfo);
         try {
             mService.powerOffRemoteDevice(
@@ -495,7 +496,7 @@
      * @hide
      */
     @SystemApi
-    public void requestRemoteDeviceToBecomeActiveSource(HdmiDeviceInfo deviceInfo) {
+    public void requestRemoteDeviceToBecomeActiveSource(@NonNull HdmiDeviceInfo deviceInfo) {
         Preconditions.checkNotNull(deviceInfo);
         try {
             mService.askRemoteDeviceToBecomeActiveSource(deviceInfo.getPhysicalAddress());
@@ -566,7 +567,7 @@
      * @hide
      */
     @SystemApi
-    public boolean isRemoteDeviceConnected(HdmiDeviceInfo targetDevice) {
+    public boolean isRemoteDeviceConnected(@NonNull HdmiDeviceInfo targetDevice) {
         Preconditions.checkNotNull(targetDevice);
         mPhysicalAddress = getPhysicalAddress();
         if (mPhysicalAddress == INVALID_PHYSICAL_ADDRESS) {
diff --git a/core/java/android/hardware/hdmi/HdmiDeviceInfo.java b/core/java/android/hardware/hdmi/HdmiDeviceInfo.java
index 48ea9a6..1362116 100644
--- a/core/java/android/hardware/hdmi/HdmiDeviceInfo.java
+++ b/core/java/android/hardware/hdmi/HdmiDeviceInfo.java
@@ -116,7 +116,7 @@
     /**
      * A helper class to deserialize {@link HdmiDeviceInfo} for a parcel.
      */
-    public static final Parcelable.Creator<HdmiDeviceInfo> CREATOR =
+    public static final @android.annotation.NonNull Parcelable.Creator<HdmiDeviceInfo> CREATOR =
             new Parcelable.Creator<HdmiDeviceInfo>() {
                 @Override
                 public HdmiDeviceInfo createFromParcel(Parcel source) {
diff --git a/core/java/android/hardware/hdmi/HdmiHotplugEvent.java b/core/java/android/hardware/hdmi/HdmiHotplugEvent.java
index 9476742..07cbdcc 100644
--- a/core/java/android/hardware/hdmi/HdmiHotplugEvent.java
+++ b/core/java/android/hardware/hdmi/HdmiHotplugEvent.java
@@ -83,7 +83,7 @@
         dest.writeByte((byte) (mConnected ? 1 : 0));
     }
 
-    public static final Parcelable.Creator<HdmiHotplugEvent> CREATOR
+    public static final @android.annotation.NonNull Parcelable.Creator<HdmiHotplugEvent> CREATOR
             = new Parcelable.Creator<HdmiHotplugEvent>() {
         /**
          * Rebuilds a {@link HdmiHotplugEvent} previously stored with
diff --git a/core/java/android/hardware/hdmi/HdmiPortInfo.java b/core/java/android/hardware/hdmi/HdmiPortInfo.java
index 1f0f45a..f17cfba 100644
--- a/core/java/android/hardware/hdmi/HdmiPortInfo.java
+++ b/core/java/android/hardware/hdmi/HdmiPortInfo.java
@@ -126,7 +126,7 @@
     /**
      * A helper class to deserialize {@link HdmiPortInfo} for a parcel.
      */
-    public static final Parcelable.Creator<HdmiPortInfo> CREATOR =
+    public static final @android.annotation.NonNull Parcelable.Creator<HdmiPortInfo> CREATOR =
             new Parcelable.Creator<HdmiPortInfo>() {
                 @Override
                 public HdmiPortInfo createFromParcel(Parcel source) {
diff --git a/core/java/android/hardware/input/IInputManager.aidl b/core/java/android/hardware/input/IInputManager.aidl
index 64448fd..2923bbf 100644
--- a/core/java/android/hardware/input/IInputManager.aidl
+++ b/core/java/android/hardware/input/IInputManager.aidl
@@ -45,6 +45,7 @@
 
     // Injects an input event into the system.  To inject into windows owned by other
     // applications, the caller must have the INJECT_EVENTS permission.
+    @UnsupportedAppUsage
     boolean injectInputEvent(in InputEvent ev, int mode);
 
     // Calibrate input device position
diff --git a/core/java/android/hardware/input/InputDeviceIdentifier.java b/core/java/android/hardware/input/InputDeviceIdentifier.java
index 801da88..26f2393 100644
--- a/core/java/android/hardware/input/InputDeviceIdentifier.java
+++ b/core/java/android/hardware/input/InputDeviceIdentifier.java
@@ -83,7 +83,7 @@
         return Objects.hash(mDescriptor, mVendorId, mProductId);
     }
 
-    public static final Parcelable.Creator<InputDeviceIdentifier> CREATOR =
+    public static final @android.annotation.NonNull Parcelable.Creator<InputDeviceIdentifier> CREATOR =
             new Parcelable.Creator<InputDeviceIdentifier>() {
 
         @Override
diff --git a/core/java/android/hardware/input/KeyboardLayout.java b/core/java/android/hardware/input/KeyboardLayout.java
index d395578..5bdbae3 100644
--- a/core/java/android/hardware/input/KeyboardLayout.java
+++ b/core/java/android/hardware/input/KeyboardLayout.java
@@ -39,7 +39,7 @@
     private final int mVendorId;
     private final int mProductId;
 
-    public static final Parcelable.Creator<KeyboardLayout> CREATOR =
+    public static final @android.annotation.NonNull Parcelable.Creator<KeyboardLayout> CREATOR =
             new Parcelable.Creator<KeyboardLayout>() {
         public KeyboardLayout createFromParcel(Parcel source) {
             return new KeyboardLayout(source);
diff --git a/core/java/android/hardware/input/TouchCalibration.java b/core/java/android/hardware/input/TouchCalibration.java
index 025fad0..7a6eba2 100644
--- a/core/java/android/hardware/input/TouchCalibration.java
+++ b/core/java/android/hardware/input/TouchCalibration.java
@@ -28,7 +28,7 @@
 
     public static final TouchCalibration IDENTITY = new TouchCalibration();
 
-    public static final Parcelable.Creator<TouchCalibration> CREATOR
+    public static final @android.annotation.NonNull Parcelable.Creator<TouchCalibration> CREATOR
             = new Parcelable.Creator<TouchCalibration>() {
         public TouchCalibration createFromParcel(Parcel in) {
             return new TouchCalibration(in);
diff --git a/core/java/android/hardware/location/ActivityChangedEvent.java b/core/java/android/hardware/location/ActivityChangedEvent.java
index 16cfe6e..d538f57 100644
--- a/core/java/android/hardware/location/ActivityChangedEvent.java
+++ b/core/java/android/hardware/location/ActivityChangedEvent.java
@@ -46,7 +46,7 @@
         return mActivityRecognitionEvents;
     }
 
-    public static final Creator<ActivityChangedEvent> CREATOR =
+    public static final @android.annotation.NonNull Creator<ActivityChangedEvent> CREATOR =
             new Creator<ActivityChangedEvent>() {
         @Override
         public ActivityChangedEvent createFromParcel(Parcel source) {
diff --git a/core/java/android/hardware/location/ActivityRecognitionEvent.java b/core/java/android/hardware/location/ActivityRecognitionEvent.java
index 190030a..08ce86f 100644
--- a/core/java/android/hardware/location/ActivityRecognitionEvent.java
+++ b/core/java/android/hardware/location/ActivityRecognitionEvent.java
@@ -47,7 +47,7 @@
         return mTimestampNs;
     }
 
-    public static final Creator<ActivityRecognitionEvent> CREATOR =
+    public static final @android.annotation.NonNull Creator<ActivityRecognitionEvent> CREATOR =
             new Creator<ActivityRecognitionEvent>() {
         @Override
         public ActivityRecognitionEvent createFromParcel(Parcel source) {
diff --git a/core/java/android/hardware/location/ContextHubInfo.java b/core/java/android/hardware/location/ContextHubInfo.java
index 51daa92..b5da381 100644
--- a/core/java/android/hardware/location/ContextHubInfo.java
+++ b/core/java/android/hardware/location/ContextHubInfo.java
@@ -345,7 +345,7 @@
         out.writeTypedArray(mMemoryRegions, flags);
     }
 
-    public static final Parcelable.Creator<ContextHubInfo> CREATOR
+    public static final @android.annotation.NonNull Parcelable.Creator<ContextHubInfo> CREATOR
             = new Parcelable.Creator<ContextHubInfo>() {
         public ContextHubInfo createFromParcel(Parcel in) {
             return new ContextHubInfo(in);
diff --git a/core/java/android/hardware/location/ContextHubMessage.java b/core/java/android/hardware/location/ContextHubMessage.java
index e1c69d7..bf10048 100644
--- a/core/java/android/hardware/location/ContextHubMessage.java
+++ b/core/java/android/hardware/location/ContextHubMessage.java
@@ -125,7 +125,7 @@
         out.writeByteArray(mData);
     }
 
-    public static final Parcelable.Creator<ContextHubMessage> CREATOR
+    public static final @android.annotation.NonNull Parcelable.Creator<ContextHubMessage> CREATOR
             = new Parcelable.Creator<ContextHubMessage>() {
         public ContextHubMessage createFromParcel(Parcel in) {
             return new ContextHubMessage(in);
diff --git a/core/java/android/hardware/location/GeofenceHardwareMonitorEvent.java b/core/java/android/hardware/location/GeofenceHardwareMonitorEvent.java
index 7079237..fbbf687 100644
--- a/core/java/android/hardware/location/GeofenceHardwareMonitorEvent.java
+++ b/core/java/android/hardware/location/GeofenceHardwareMonitorEvent.java
@@ -72,7 +72,7 @@
         return mLocation;
     }
 
-    public static final Creator<GeofenceHardwareMonitorEvent> CREATOR =
+    public static final @android.annotation.NonNull Creator<GeofenceHardwareMonitorEvent> CREATOR =
             new Creator<GeofenceHardwareMonitorEvent>() {
                 @Override
                 public GeofenceHardwareMonitorEvent createFromParcel(Parcel source) {
diff --git a/core/java/android/hardware/location/GeofenceHardwareRequestParcelable.java b/core/java/android/hardware/location/GeofenceHardwareRequestParcelable.java
index d3311f5..df13ade 100644
--- a/core/java/android/hardware/location/GeofenceHardwareRequestParcelable.java
+++ b/core/java/android/hardware/location/GeofenceHardwareRequestParcelable.java
@@ -134,7 +134,7 @@
     /**
      * Method definitions to support Parcelable operations.
      */
-    public static final Parcelable.Creator<GeofenceHardwareRequestParcelable> CREATOR =
+    public static final @android.annotation.NonNull Parcelable.Creator<GeofenceHardwareRequestParcelable> CREATOR =
             new Parcelable.Creator<GeofenceHardwareRequestParcelable>() {
         @Override
         public GeofenceHardwareRequestParcelable createFromParcel(Parcel parcel) {
diff --git a/core/java/android/hardware/location/IActivityRecognitionHardwareClient.aidl b/core/java/android/hardware/location/IActivityRecognitionHardwareClient.aidl
index 3fe645c..2dfaf60 100644
--- a/core/java/android/hardware/location/IActivityRecognitionHardwareClient.aidl
+++ b/core/java/android/hardware/location/IActivityRecognitionHardwareClient.aidl
@@ -32,5 +32,6 @@
      * @param isSupported whether the platform has hardware support for the feature
      * @param instance the available instance to provide access to the feature
      */
+    @UnsupportedAppUsage
     void onAvailabilityChanged(in boolean isSupported, in IActivityRecognitionHardware instance);
 }
diff --git a/core/java/android/hardware/location/MemoryRegion.java b/core/java/android/hardware/location/MemoryRegion.java
index 3d9e859..ecd369a 100644
--- a/core/java/android/hardware/location/MemoryRegion.java
+++ b/core/java/android/hardware/location/MemoryRegion.java
@@ -147,7 +147,7 @@
         mIsExecutable = source.readInt() != 0;
     }
 
-    public static final Parcelable.Creator<MemoryRegion> CREATOR
+    public static final @android.annotation.NonNull Parcelable.Creator<MemoryRegion> CREATOR
             = new Parcelable.Creator<MemoryRegion>() {
         public MemoryRegion createFromParcel(Parcel in) {
             return new MemoryRegion(in);
diff --git a/core/java/android/hardware/location/NanoApp.java b/core/java/android/hardware/location/NanoApp.java
index 62e7182..3fbb069 100644
--- a/core/java/android/hardware/location/NanoApp.java
+++ b/core/java/android/hardware/location/NanoApp.java
@@ -359,7 +359,7 @@
         out.writeByteArray(mAppBinary);
     }
 
-    public static final Parcelable.Creator<NanoApp> CREATOR
+    public static final @android.annotation.NonNull Parcelable.Creator<NanoApp> CREATOR
             = new Parcelable.Creator<NanoApp>() {
         public NanoApp createFromParcel(Parcel in) {
             return new NanoApp(in);
diff --git a/core/java/android/hardware/location/NanoAppBinary.java b/core/java/android/hardware/location/NanoAppBinary.java
index ba01ca2..b311a92 100644
--- a/core/java/android/hardware/location/NanoAppBinary.java
+++ b/core/java/android/hardware/location/NanoAppBinary.java
@@ -237,7 +237,7 @@
         out.writeByteArray(mNanoAppBinary);
     }
 
-    public static final Creator<NanoAppBinary> CREATOR =
+    public static final @android.annotation.NonNull Creator<NanoAppBinary> CREATOR =
             new Creator<NanoAppBinary>() {
                 @Override
                 public NanoAppBinary createFromParcel(Parcel in) {
diff --git a/core/java/android/hardware/location/NanoAppFilter.java b/core/java/android/hardware/location/NanoAppFilter.java
index 562065e..0700dd1 100644
--- a/core/java/android/hardware/location/NanoAppFilter.java
+++ b/core/java/android/hardware/location/NanoAppFilter.java
@@ -139,7 +139,7 @@
                 + ", vendorMask: " + mAppIdVendorMask;
     }
 
-    public static final Parcelable.Creator<NanoAppFilter> CREATOR
+    public static final @android.annotation.NonNull Parcelable.Creator<NanoAppFilter> CREATOR
             = new Parcelable.Creator<NanoAppFilter>() {
         public NanoAppFilter createFromParcel(Parcel in) {
             return new NanoAppFilter(in);
diff --git a/core/java/android/hardware/location/NanoAppInstanceInfo.java b/core/java/android/hardware/location/NanoAppInstanceInfo.java
index 2db6a79..a6c754d 100644
--- a/core/java/android/hardware/location/NanoAppInstanceInfo.java
+++ b/core/java/android/hardware/location/NanoAppInstanceInfo.java
@@ -208,7 +208,7 @@
         out.writeIntArray(mOutputEvents);
     }
 
-    public static final Parcelable.Creator<NanoAppInstanceInfo> CREATOR
+    public static final @android.annotation.NonNull Parcelable.Creator<NanoAppInstanceInfo> CREATOR
             = new Parcelable.Creator<NanoAppInstanceInfo>() {
         public NanoAppInstanceInfo createFromParcel(Parcel in) {
             return new NanoAppInstanceInfo(in);
diff --git a/core/java/android/hardware/location/NanoAppMessage.java b/core/java/android/hardware/location/NanoAppMessage.java
index 9f90d59..d5e3529 100644
--- a/core/java/android/hardware/location/NanoAppMessage.java
+++ b/core/java/android/hardware/location/NanoAppMessage.java
@@ -134,7 +134,7 @@
         out.writeByteArray(mMessageBody);
     }
 
-    public static final Creator<NanoAppMessage> CREATOR =
+    public static final @android.annotation.NonNull Creator<NanoAppMessage> CREATOR =
             new Creator<NanoAppMessage>() {
                 @Override
                 public NanoAppMessage createFromParcel(Parcel in) {
diff --git a/core/java/android/hardware/location/NanoAppState.java b/core/java/android/hardware/location/NanoAppState.java
index d05277d..8de7ecd 100644
--- a/core/java/android/hardware/location/NanoAppState.java
+++ b/core/java/android/hardware/location/NanoAppState.java
@@ -75,7 +75,7 @@
         out.writeInt(mIsEnabled ? 1 : 0);
     }
 
-    public static final Creator<NanoAppState> CREATOR =
+    public static final @android.annotation.NonNull Creator<NanoAppState> CREATOR =
             new Creator<NanoAppState>() {
                 @Override
                 public NanoAppState createFromParcel(Parcel in) {
diff --git a/core/java/android/hardware/radio/Announcement.java b/core/java/android/hardware/radio/Announcement.java
index 166fe60..8febed3 100644
--- a/core/java/android/hardware/radio/Announcement.java
+++ b/core/java/android/hardware/radio/Announcement.java
@@ -108,7 +108,7 @@
         return 0;
     }
 
-    public static final Parcelable.Creator<Announcement> CREATOR =
+    public static final @android.annotation.NonNull Parcelable.Creator<Announcement> CREATOR =
             new Parcelable.Creator<Announcement>() {
         public Announcement createFromParcel(Parcel in) {
             return new Announcement(in);
diff --git a/core/java/android/hardware/radio/ProgramList.java b/core/java/android/hardware/radio/ProgramList.java
index e6f523c..69f9273 100644
--- a/core/java/android/hardware/radio/ProgramList.java
+++ b/core/java/android/hardware/radio/ProgramList.java
@@ -304,7 +304,7 @@
             return 0;
         }
 
-        public static final Parcelable.Creator<Filter> CREATOR = new Parcelable.Creator<Filter>() {
+        public static final @android.annotation.NonNull Parcelable.Creator<Filter> CREATOR = new Parcelable.Creator<Filter>() {
             public Filter createFromParcel(Parcel in) {
                 return new Filter(in);
             }
@@ -409,7 +409,7 @@
             return 0;
         }
 
-        public static final Parcelable.Creator<Chunk> CREATOR = new Parcelable.Creator<Chunk>() {
+        public static final @android.annotation.NonNull Parcelable.Creator<Chunk> CREATOR = new Parcelable.Creator<Chunk>() {
             public Chunk createFromParcel(Parcel in) {
                 return new Chunk(in);
             }
diff --git a/core/java/android/hardware/radio/ProgramSelector.java b/core/java/android/hardware/radio/ProgramSelector.java
index 90d407c..277a186 100644
--- a/core/java/android/hardware/radio/ProgramSelector.java
+++ b/core/java/android/hardware/radio/ProgramSelector.java
@@ -534,7 +534,7 @@
         return 0;
     }
 
-    public static final Parcelable.Creator<ProgramSelector> CREATOR =
+    public static final @android.annotation.NonNull Parcelable.Creator<ProgramSelector> CREATOR =
             new Parcelable.Creator<ProgramSelector>() {
         public ProgramSelector createFromParcel(Parcel in) {
             return new ProgramSelector(in);
@@ -632,7 +632,7 @@
             return 0;
         }
 
-        public static final Parcelable.Creator<Identifier> CREATOR =
+        public static final @android.annotation.NonNull Parcelable.Creator<Identifier> CREATOR =
                 new Parcelable.Creator<Identifier>() {
             public Identifier createFromParcel(Parcel in) {
                 return new Identifier(in);
diff --git a/core/java/android/hardware/radio/RadioManager.java b/core/java/android/hardware/radio/RadioManager.java
index 8263bb8..92653d18 100644
--- a/core/java/android/hardware/radio/RadioManager.java
+++ b/core/java/android/hardware/radio/RadioManager.java
@@ -448,7 +448,7 @@
             mVendorInfo = Utils.readStringMap(in);
         }
 
-        public static final Parcelable.Creator<ModuleProperties> CREATOR
+        public static final @android.annotation.NonNull Parcelable.Creator<ModuleProperties> CREATOR
                 = new Parcelable.Creator<ModuleProperties>() {
             public ModuleProperties createFromParcel(Parcel in) {
                 return new ModuleProperties(in);
@@ -625,7 +625,7 @@
             return type;
         }
 
-        public static final Parcelable.Creator<BandDescriptor> CREATOR
+        public static final @android.annotation.NonNull Parcelable.Creator<BandDescriptor> CREATOR
                 = new Parcelable.Creator<BandDescriptor>() {
             public BandDescriptor createFromParcel(Parcel in) {
                 int type = lookupTypeFromParcel(in);
@@ -762,7 +762,7 @@
             mEa = in.readByte() == 1;
         }
 
-        public static final Parcelable.Creator<FmBandDescriptor> CREATOR
+        public static final @android.annotation.NonNull Parcelable.Creator<FmBandDescriptor> CREATOR
                 = new Parcelable.Creator<FmBandDescriptor>() {
             public FmBandDescriptor createFromParcel(Parcel in) {
                 return new FmBandDescriptor(in);
@@ -855,7 +855,7 @@
             mStereo = in.readByte() == 1;
         }
 
-        public static final Parcelable.Creator<AmBandDescriptor> CREATOR
+        public static final @android.annotation.NonNull Parcelable.Creator<AmBandDescriptor> CREATOR
                 = new Parcelable.Creator<AmBandDescriptor>() {
             public AmBandDescriptor createFromParcel(Parcel in) {
                 return new AmBandDescriptor(in);
@@ -966,7 +966,7 @@
         }
 
 
-        public static final Parcelable.Creator<BandConfig> CREATOR
+        public static final @android.annotation.NonNull Parcelable.Creator<BandConfig> CREATOR
                 = new Parcelable.Creator<BandConfig>() {
             public BandConfig createFromParcel(Parcel in) {
                 int type = BandDescriptor.lookupTypeFromParcel(in);
@@ -1099,7 +1099,7 @@
             mEa = in.readByte() == 1;
         }
 
-        public static final Parcelable.Creator<FmBandConfig> CREATOR
+        public static final @android.annotation.NonNull Parcelable.Creator<FmBandConfig> CREATOR
                 = new Parcelable.Creator<FmBandConfig>() {
             public FmBandConfig createFromParcel(Parcel in) {
                 return new FmBandConfig(in);
@@ -1295,7 +1295,7 @@
             mStereo = in.readByte() == 1;
         }
 
-        public static final Parcelable.Creator<AmBandConfig> CREATOR
+        public static final @android.annotation.NonNull Parcelable.Creator<AmBandConfig> CREATOR
                 = new Parcelable.Creator<AmBandConfig>() {
             public AmBandConfig createFromParcel(Parcel in) {
                 return new AmBandConfig(in);
@@ -1628,7 +1628,7 @@
             mVendorInfo = Utils.readStringMap(in);
         }
 
-        public static final Parcelable.Creator<ProgramInfo> CREATOR
+        public static final @android.annotation.NonNull Parcelable.Creator<ProgramInfo> CREATOR
                 = new Parcelable.Creator<ProgramInfo>() {
             public ProgramInfo createFromParcel(Parcel in) {
                 return new ProgramInfo(in);
diff --git a/core/java/android/hardware/radio/RadioMetadata.java b/core/java/android/hardware/radio/RadioMetadata.java
index baa7a50..1cbb171 100644
--- a/core/java/android/hardware/radio/RadioMetadata.java
+++ b/core/java/android/hardware/radio/RadioMetadata.java
@@ -225,7 +225,7 @@
             out.writeInt(mTimezoneOffsetMinutes);
         }
 
-        public static final Parcelable.Creator<Clock> CREATOR
+        public static final @android.annotation.NonNull Parcelable.Creator<Clock> CREATOR
                 = new Parcelable.Creator<Clock>() {
             public Clock createFromParcel(Parcel in) {
                 return new Clock(in);
@@ -426,7 +426,7 @@
         return NATIVE_KEY_MAPPING.get(nativeKey, null);
     }
 
-    public static final Parcelable.Creator<RadioMetadata> CREATOR =
+    public static final @android.annotation.NonNull Parcelable.Creator<RadioMetadata> CREATOR =
             new Parcelable.Creator<RadioMetadata>() {
                 @Override
                 public RadioMetadata createFromParcel(Parcel in) {
diff --git a/core/java/android/hardware/soundtrigger/SoundTrigger.java b/core/java/android/hardware/soundtrigger/SoundTrigger.java
index dc4f0b7..cf3395a 100644
--- a/core/java/android/hardware/soundtrigger/SoundTrigger.java
+++ b/core/java/android/hardware/soundtrigger/SoundTrigger.java
@@ -140,7 +140,7 @@
             this.returnsTriggerInEvent = returnsTriggerInEvent;
         }
 
-        public static final Parcelable.Creator<ModuleProperties> CREATOR
+        public static final @android.annotation.NonNull Parcelable.Creator<ModuleProperties> CREATOR
                 = new Parcelable.Creator<ModuleProperties>() {
             public ModuleProperties createFromParcel(Parcel in) {
                 return ModuleProperties.fromParcel(in);
@@ -326,7 +326,7 @@
             this.users = users;
         }
 
-        public static final Parcelable.Creator<Keyphrase> CREATOR
+        public static final @android.annotation.NonNull Parcelable.Creator<Keyphrase> CREATOR
                 = new Parcelable.Creator<Keyphrase>() {
             public Keyphrase createFromParcel(Parcel in) {
                 return Keyphrase.fromParcel(in);
@@ -436,7 +436,7 @@
             this.keyphrases = keyphrases;
         }
 
-        public static final Parcelable.Creator<KeyphraseSoundModel> CREATOR
+        public static final @android.annotation.NonNull Parcelable.Creator<KeyphraseSoundModel> CREATOR
                 = new Parcelable.Creator<KeyphraseSoundModel>() {
             public KeyphraseSoundModel createFromParcel(Parcel in) {
                 return KeyphraseSoundModel.fromParcel(in);
@@ -516,7 +516,7 @@
      ****************************************************************************/
     public static class GenericSoundModel extends SoundModel implements Parcelable {
 
-        public static final Parcelable.Creator<GenericSoundModel> CREATOR
+        public static final @android.annotation.NonNull Parcelable.Creator<GenericSoundModel> CREATOR
                 = new Parcelable.Creator<GenericSoundModel>() {
             public GenericSoundModel createFromParcel(Parcel in) {
                 return GenericSoundModel.fromParcel(in);
@@ -746,7 +746,7 @@
         }
 
         /** @hide */
-        public static final Parcelable.Creator<RecognitionEvent> CREATOR
+        public static final @android.annotation.NonNull Parcelable.Creator<RecognitionEvent> CREATOR
                 = new Parcelable.Creator<RecognitionEvent>() {
             public RecognitionEvent createFromParcel(Parcel in) {
                 return RecognitionEvent.fromParcel(in);
@@ -920,7 +920,7 @@
             this.data = data;
         }
 
-        public static final Parcelable.Creator<RecognitionConfig> CREATOR
+        public static final @android.annotation.NonNull Parcelable.Creator<RecognitionConfig> CREATOR
                 = new Parcelable.Creator<RecognitionConfig>() {
             public RecognitionConfig createFromParcel(Parcel in) {
                 return RecognitionConfig.fromParcel(in);
@@ -983,7 +983,7 @@
             this.confidenceLevel = confidenceLevel;
         }
 
-        public static final Parcelable.Creator<ConfidenceLevel> CREATOR
+        public static final @android.annotation.NonNull Parcelable.Creator<ConfidenceLevel> CREATOR
                 = new Parcelable.Creator<ConfidenceLevel>() {
             public ConfidenceLevel createFromParcel(Parcel in) {
                 return ConfidenceLevel.fromParcel(in);
@@ -1077,7 +1077,7 @@
             this.confidenceLevels = confidenceLevels;
         }
 
-        public static final Parcelable.Creator<KeyphraseRecognitionExtra> CREATOR
+        public static final @android.annotation.NonNull Parcelable.Creator<KeyphraseRecognitionExtra> CREATOR
                 = new Parcelable.Creator<KeyphraseRecognitionExtra>() {
             public KeyphraseRecognitionExtra createFromParcel(Parcel in) {
                 return KeyphraseRecognitionExtra.fromParcel(in);
@@ -1169,7 +1169,7 @@
             this.keyphraseExtras = keyphraseExtras;
         }
 
-        public static final Parcelable.Creator<KeyphraseRecognitionEvent> CREATOR
+        public static final @android.annotation.NonNull Parcelable.Creator<KeyphraseRecognitionEvent> CREATOR
                 = new Parcelable.Creator<KeyphraseRecognitionEvent>() {
             public KeyphraseRecognitionEvent createFromParcel(Parcel in) {
                 return KeyphraseRecognitionEvent.fromParcelForKeyphrase(in);
@@ -1290,7 +1290,7 @@
                     data);
         }
 
-        public static final Parcelable.Creator<GenericRecognitionEvent> CREATOR
+        public static final @android.annotation.NonNull Parcelable.Creator<GenericRecognitionEvent> CREATOR
                 = new Parcelable.Creator<GenericRecognitionEvent>() {
             public GenericRecognitionEvent createFromParcel(Parcel in) {
                 return GenericRecognitionEvent.fromParcelForGeneric(in);
@@ -1357,7 +1357,7 @@
             this.data = data;
         }
 
-        public static final Parcelable.Creator<SoundModelEvent> CREATOR
+        public static final @android.annotation.NonNull Parcelable.Creator<SoundModelEvent> CREATOR
                 = new Parcelable.Creator<SoundModelEvent>() {
             public SoundModelEvent createFromParcel(Parcel in) {
                 return SoundModelEvent.fromParcel(in);
diff --git a/core/java/android/hardware/usb/ParcelableUsbPort.java b/core/java/android/hardware/usb/ParcelableUsbPort.java
index 30388af..19655ed 100644
--- a/core/java/android/hardware/usb/ParcelableUsbPort.java
+++ b/core/java/android/hardware/usb/ParcelableUsbPort.java
@@ -89,7 +89,7 @@
         dest.writeBoolean(mSupportsEnableContaminantPresenceDetection);
     }
 
-    public static final Creator<ParcelableUsbPort> CREATOR =
+    public static final @android.annotation.NonNull Creator<ParcelableUsbPort> CREATOR =
             new Creator<ParcelableUsbPort>() {
                 @Override
                 public ParcelableUsbPort createFromParcel(Parcel in) {
diff --git a/core/java/android/hardware/usb/UsbAccessory.java b/core/java/android/hardware/usb/UsbAccessory.java
index b418d43..a76e4ad 100644
--- a/core/java/android/hardware/usb/UsbAccessory.java
+++ b/core/java/android/hardware/usb/UsbAccessory.java
@@ -215,7 +215,7 @@
                             ", mSerialNumberReader=" + mSerialNumberReader + "]";
     }
 
-    public static final Parcelable.Creator<UsbAccessory> CREATOR =
+    public static final @android.annotation.NonNull Parcelable.Creator<UsbAccessory> CREATOR =
         new Parcelable.Creator<UsbAccessory>() {
         public UsbAccessory createFromParcel(Parcel in) {
             String manufacturer = in.readString();
diff --git a/core/java/android/hardware/usb/UsbConfiguration.java b/core/java/android/hardware/usb/UsbConfiguration.java
index 6ce4201..66269cb 100644
--- a/core/java/android/hardware/usb/UsbConfiguration.java
+++ b/core/java/android/hardware/usb/UsbConfiguration.java
@@ -165,7 +165,7 @@
         return builder.toString();
     }
 
-    public static final Parcelable.Creator<UsbConfiguration> CREATOR =
+    public static final @android.annotation.NonNull Parcelable.Creator<UsbConfiguration> CREATOR =
         new Parcelable.Creator<UsbConfiguration>() {
         public UsbConfiguration createFromParcel(Parcel in) {
             int id = in.readInt();
diff --git a/core/java/android/hardware/usb/UsbDevice.java b/core/java/android/hardware/usb/UsbDevice.java
index b08212c..08c9eea 100644
--- a/core/java/android/hardware/usb/UsbDevice.java
+++ b/core/java/android/hardware/usb/UsbDevice.java
@@ -300,7 +300,7 @@
         return builder.toString();
     }
 
-    public static final Parcelable.Creator<UsbDevice> CREATOR =
+    public static final @android.annotation.NonNull Parcelable.Creator<UsbDevice> CREATOR =
         new Parcelable.Creator<UsbDevice>() {
         public UsbDevice createFromParcel(Parcel in) {
             String name = in.readString();
diff --git a/core/java/android/hardware/usb/UsbEndpoint.java b/core/java/android/hardware/usb/UsbEndpoint.java
index c346700..82117e7 100644
--- a/core/java/android/hardware/usb/UsbEndpoint.java
+++ b/core/java/android/hardware/usb/UsbEndpoint.java
@@ -133,7 +133,7 @@
                 ",mMaxPacketSize=" + mMaxPacketSize + ",mInterval=" + mInterval +"]";
     }
 
-    public static final Parcelable.Creator<UsbEndpoint> CREATOR =
+    public static final @android.annotation.NonNull Parcelable.Creator<UsbEndpoint> CREATOR =
         new Parcelable.Creator<UsbEndpoint>() {
         public UsbEndpoint createFromParcel(Parcel in) {
             int address = in.readInt();
diff --git a/core/java/android/hardware/usb/UsbInterface.java b/core/java/android/hardware/usb/UsbInterface.java
index 4b5278c..5cb55a2 100644
--- a/core/java/android/hardware/usb/UsbInterface.java
+++ b/core/java/android/hardware/usb/UsbInterface.java
@@ -162,7 +162,7 @@
         return builder.toString();
     }
 
-    public static final Parcelable.Creator<UsbInterface> CREATOR =
+    public static final @android.annotation.NonNull Parcelable.Creator<UsbInterface> CREATOR =
         new Parcelable.Creator<UsbInterface>() {
         public UsbInterface createFromParcel(Parcel in) {
             int id = in.readInt();
diff --git a/core/java/android/hardware/usb/UsbPortStatus.java b/core/java/android/hardware/usb/UsbPortStatus.java
index 426dba8..5e9a410 100644
--- a/core/java/android/hardware/usb/UsbPortStatus.java
+++ b/core/java/android/hardware/usb/UsbPortStatus.java
@@ -352,7 +352,7 @@
         dest.writeInt(mContaminantDetectionStatus);
     }
 
-    public static final Parcelable.Creator<UsbPortStatus> CREATOR =
+    public static final @android.annotation.NonNull Parcelable.Creator<UsbPortStatus> CREATOR =
             new Parcelable.Creator<UsbPortStatus>() {
         @Override
         public UsbPortStatus createFromParcel(Parcel in) {
diff --git a/core/java/android/net/CaptivePortal.java b/core/java/android/net/CaptivePortal.java
index 3ab35e1..f208724 100644
--- a/core/java/android/net/CaptivePortal.java
+++ b/core/java/android/net/CaptivePortal.java
@@ -61,7 +61,7 @@
         out.writeStrongBinder(mBinder);
     }
 
-    public static final Parcelable.Creator<CaptivePortal> CREATOR
+    public static final @android.annotation.NonNull Parcelable.Creator<CaptivePortal> CREATOR
             = new Parcelable.Creator<CaptivePortal>() {
         @Override
         public CaptivePortal createFromParcel(Parcel in) {
diff --git a/core/java/android/net/ConnectionInfo.java b/core/java/android/net/ConnectionInfo.java
index 58d0e05..4514a84 100644
--- a/core/java/android/net/ConnectionInfo.java
+++ b/core/java/android/net/ConnectionInfo.java
@@ -54,7 +54,7 @@
         out.writeInt(remote.getPort());
     }
 
-    public static final Creator<ConnectionInfo> CREATOR = new Creator<ConnectionInfo>() {
+    public static final @android.annotation.NonNull Creator<ConnectionInfo> CREATOR = new Creator<ConnectionInfo>() {
         public ConnectionInfo createFromParcel(Parcel in) {
             int protocol = in.readInt();
             InetAddress localAddress;
diff --git a/core/java/android/net/ConnectivityManager.java b/core/java/android/net/ConnectivityManager.java
index c1bce5e..fb0821e 100644
--- a/core/java/android/net/ConnectivityManager.java
+++ b/core/java/android/net/ConnectivityManager.java
@@ -56,6 +56,7 @@
 import android.util.Log;
 import android.util.SparseIntArray;
 
+import com.android.internal.annotations.GuardedBy;
 import com.android.internal.telephony.ITelephony;
 import com.android.internal.telephony.PhoneConstants;
 import com.android.internal.util.Preconditions;
@@ -2542,6 +2543,94 @@
     }
 
     /**
+     * Callback for use with {@link registerTetheringEventCallback} to find out tethering
+     * upstream status.
+     *
+     *@hide
+     */
+    @SystemApi
+    public abstract static class OnTetheringEventCallback {
+
+        /**
+         * Called when tethering upstream changed. This can be called multiple times and can be
+         * called any time.
+         *
+         * @param network the {@link Network} of tethering upstream. Null means tethering doesn't
+         * have any upstream.
+         */
+        public void onUpstreamChanged(@Nullable Network network) {}
+    }
+
+    @GuardedBy("mTetheringEventCallbacks")
+    private final ArrayMap<OnTetheringEventCallback, ITetheringEventCallback>
+            mTetheringEventCallbacks = new ArrayMap<>();
+
+    /**
+     * Start listening to tethering change events. Any new added callback will receive the last
+     * tethering status right away. If callback is registered when tethering loses its upstream or
+     * disabled, {@link OnTetheringEventCallback#onUpstreamChanged} will immediately be called
+     * with a null argument. The same callback object cannot be registered twice.
+     *
+     * @param executor the executor on which callback will be invoked.
+     * @param callback the callback to be called when tethering has change events.
+     * @hide
+     */
+    @SystemApi
+    @RequiresPermission(android.Manifest.permission.TETHER_PRIVILEGED)
+    public void registerTetheringEventCallback(
+            @NonNull @CallbackExecutor Executor executor,
+            @NonNull final OnTetheringEventCallback callback) {
+        Preconditions.checkNotNull(callback, "OnTetheringEventCallback cannot be null.");
+
+        synchronized (mTetheringEventCallbacks) {
+            Preconditions.checkArgument(!mTetheringEventCallbacks.containsKey(callback),
+                    "callback was already registered.");
+            ITetheringEventCallback remoteCallback = new ITetheringEventCallback.Stub() {
+                @Override
+                public void onUpstreamChanged(Network network) throws RemoteException {
+                    Binder.withCleanCallingIdentity(() ->
+                            executor.execute(() -> {
+                                callback.onUpstreamChanged(network);
+                            }));
+                }
+            };
+            try {
+                String pkgName = mContext.getOpPackageName();
+                Log.i(TAG, "registerTetheringUpstreamCallback:" + pkgName);
+                mService.registerTetheringEventCallback(remoteCallback, pkgName);
+                mTetheringEventCallbacks.put(callback, remoteCallback);
+            } catch (RemoteException e) {
+                throw e.rethrowFromSystemServer();
+            }
+        }
+    }
+
+    /**
+     * Remove tethering event callback previously registered with
+     * {@link #registerTetheringEventCallback}.
+     *
+     * @param callback previously registered callback.
+     * @hide
+     */
+    @SystemApi
+    @RequiresPermission(android.Manifest.permission.TETHER_PRIVILEGED)
+    public void unregisterTetheringEventCallback(
+            @NonNull final OnTetheringEventCallback callback) {
+        synchronized (mTetheringEventCallbacks) {
+            ITetheringEventCallback remoteCallback = mTetheringEventCallbacks.remove(callback);
+            Preconditions.checkNotNull(remoteCallback, "callback was not registered.");
+            try {
+                String pkgName = mContext.getOpPackageName();
+                Log.i(TAG, "unregisterTetheringEventCallback:" + pkgName);
+                mService.unregisterTetheringEventCallback(remoteCallback, pkgName);
+            } catch (RemoteException e) {
+                throw e.rethrowFromSystemServer();
+            }
+        }
+    }
+
+
+    /**
      * Get the list of regular expressions that define any tetherable
      * USB network interfaces.  If USB tethering is not supported by the
      * device, this list should be empty.
@@ -2681,12 +2770,39 @@
         }
     }
 
+    /** @hide */
+    @Retention(RetentionPolicy.SOURCE)
+    @IntDef(value = {
+            TETHER_ERROR_NO_ERROR,
+            TETHER_ERROR_PROVISION_FAILED,
+            TETHER_ERROR_ENTITLEMENT_UNKONWN,
+    })
+    public @interface EntitlementResultCode {
+    }
+
     /**
-     * Callback for use with {@link #getLatestTetheringEntitlementValue} to find out whether
+     * Callback for use with {@link #getLatestTetheringEntitlementResult} to find out whether
      * entitlement succeeded.
      * @hide
      */
     @SystemApi
+    public interface OnTetheringEntitlementResultListener  {
+        /**
+         * Called to notify entitlement result.
+         *
+         * @param resultCode an int value of entitlement result. It may be one of
+         *         {@link #TETHER_ERROR_NO_ERROR},
+         *         {@link #TETHER_ERROR_PROVISION_FAILED}, or
+         *         {@link #TETHER_ERROR_ENTITLEMENT_UNKONWN}.
+         */
+        void onEntitlementResult(@EntitlementResultCode int resultCode);
+    }
+
+    /**
+     * @removed
+     * @deprecated This API would be removed when all of caller has been updated.
+     * */
+    @Deprecated
     public abstract static class TetheringEntitlementValueListener  {
         /**
          * Called to notify entitlement result.
@@ -2712,14 +2828,43 @@
      *         {@link #TETHERING_USB}, or
      *         {@link #TETHERING_BLUETOOTH}.
      * @param showEntitlementUi a boolean indicating whether to run UI-based entitlement check.
-     * @param listener an {@link TetheringEntitlementValueListener} which will be called to notify
-     *         the caller of the result of entitlement check. The listener may be called zero or
-     *         one time.
-     * @param handler {@link Handler} to specify the thread upon which the listener will be invoked.
+     * @param executor the executor on which callback will be invoked.
+     * @param listener an {@link OnTetheringEntitlementResultListener} which will be called to
+     *         notify the caller of the result of entitlement check. The listener may be called zero
+     *         or one time.
      * {@hide}
      */
     @SystemApi
     @RequiresPermission(android.Manifest.permission.TETHER_PRIVILEGED)
+    public void getLatestTetheringEntitlementResult(int type, boolean showEntitlementUi,
+            @NonNull @CallbackExecutor Executor executor,
+            @NonNull final OnTetheringEntitlementResultListener listener) {
+        Preconditions.checkNotNull(listener, "TetheringEntitlementResultListener cannot be null.");
+        ResultReceiver wrappedListener = new ResultReceiver(null) {
+            @Override
+            protected void onReceiveResult(int resultCode, Bundle resultData) {
+                Binder.withCleanCallingIdentity(() ->
+                            executor.execute(() -> {
+                                listener.onEntitlementResult(resultCode);
+                            }));
+            }
+        };
+
+        try {
+            String pkgName = mContext.getOpPackageName();
+            Log.i(TAG, "getLatestTetheringEntitlementResult:" + pkgName);
+            mService.getLatestTetheringEntitlementResult(type, wrappedListener,
+                    showEntitlementUi, pkgName);
+        } catch (RemoteException e) {
+            throw e.rethrowFromSystemServer();
+        }
+    }
+
+    /**
+     * @removed
+     * @deprecated This API would be removed when all of caller has been updated.
+     * */
+    @Deprecated
     public void getLatestTetheringEntitlementValue(int type, boolean showEntitlementUi,
             @NonNull final TetheringEntitlementValueListener listener, @Nullable Handler handler) {
         Preconditions.checkNotNull(listener, "TetheringEntitlementValueListener cannot be null.");
@@ -2733,7 +2878,7 @@
         try {
             String pkgName = mContext.getOpPackageName();
             Log.i(TAG, "getLatestTetheringEntitlementValue:" + pkgName);
-            mService.getLatestTetheringEntitlementValue(type, wrappedListener,
+            mService.getLatestTetheringEntitlementResult(type, wrappedListener,
                     showEntitlementUi, pkgName);
         } catch (RemoteException e) {
             throw e.rethrowFromSystemServer();
@@ -3684,7 +3829,8 @@
     /**
      * Registers to receive notifications about all networks which satisfy the given
      * {@link NetworkRequest}.  The callbacks will continue to be called until
-     * either the application exits or link #unregisterNetworkCallback(NetworkCallback)} is called.
+     * either the application exits or {@link #unregisterNetworkCallback(NetworkCallback)} is
+     * called.
      *
      * @param request {@link NetworkRequest} describing this request.
      * @param networkCallback The {@link NetworkCallback} that the system will call as suitable
@@ -3700,7 +3846,8 @@
     /**
      * Registers to receive notifications about all networks which satisfy the given
      * {@link NetworkRequest}.  The callbacks will continue to be called until
-     * either the application exits or link #unregisterNetworkCallback(NetworkCallback)} is called.
+     * either the application exits or {@link #unregisterNetworkCallback(NetworkCallback)} is
+     * called.
      *
      * @param request {@link NetworkRequest} describing this request.
      * @param networkCallback The {@link NetworkCallback} that the system will call as suitable
@@ -4291,6 +4438,8 @@
      * @return {@code uid} if the connection is found and the app has permission to observe it
      * (e.g., if it is associated with the calling VPN app's tunnel) or
      * {@link android.os.Process#INVALID_UID} if the connection is not found.
+     * Throws {@link SecurityException} if the caller is not the active VPN for the current user.
+     * Throws {@link IllegalArgumentException} if an unsupported protocol is requested.
      */
     public int getConnectionOwnerUid(int protocol, @NonNull InetSocketAddress local,
             @NonNull InetSocketAddress remote) {
diff --git a/core/java/android/net/ConnectivityMetricsEvent.java b/core/java/android/net/ConnectivityMetricsEvent.java
index 394ac42..522add1 100644
--- a/core/java/android/net/ConnectivityMetricsEvent.java
+++ b/core/java/android/net/ConnectivityMetricsEvent.java
@@ -51,7 +51,7 @@
     }
 
     /** Implement the Parcelable interface */
-    public static final Parcelable.Creator<ConnectivityMetricsEvent> CREATOR
+    public static final @android.annotation.NonNull Parcelable.Creator<ConnectivityMetricsEvent> CREATOR
             = new Parcelable.Creator<ConnectivityMetricsEvent> (){
         public ConnectivityMetricsEvent createFromParcel(Parcel source) {
             return new ConnectivityMetricsEvent(source);
diff --git a/core/java/android/net/DataUsageRequest.java b/core/java/android/net/DataUsageRequest.java
index ac9a5a3..0ac8f7e7 100644
--- a/core/java/android/net/DataUsageRequest.java
+++ b/core/java/android/net/DataUsageRequest.java
@@ -69,7 +69,7 @@
         dest.writeLong(thresholdInBytes);
     }
 
-    public static final Creator<DataUsageRequest> CREATOR =
+    public static final @android.annotation.NonNull Creator<DataUsageRequest> CREATOR =
             new Creator<DataUsageRequest>() {
                 @Override
                 public DataUsageRequest createFromParcel(Parcel in) {
diff --git a/core/java/android/net/DhcpInfo.java b/core/java/android/net/DhcpInfo.java
index 788d7d9..98bab44 100644
--- a/core/java/android/net/DhcpInfo.java
+++ b/core/java/android/net/DhcpInfo.java
@@ -84,7 +84,7 @@
     }
 
     /** Implement the Parcelable interface {@hide} */
-    public static final Creator<DhcpInfo> CREATOR =
+    public static final @android.annotation.NonNull Creator<DhcpInfo> CREATOR =
         new Creator<DhcpInfo>() {
             public DhcpInfo createFromParcel(Parcel in) {
                 DhcpInfo info = new DhcpInfo();
diff --git a/core/java/android/net/DhcpResults.java b/core/java/android/net/DhcpResults.java
index 6f9e65f..1a3a6f8 100644
--- a/core/java/android/net/DhcpResults.java
+++ b/core/java/android/net/DhcpResults.java
@@ -164,7 +164,7 @@
     /**
      * Implement the Parcelable interface
      */
-    public static final Creator<DhcpResults> CREATOR =
+    public static final @android.annotation.NonNull Creator<DhcpResults> CREATOR =
         new Creator<DhcpResults>() {
             public DhcpResults createFromParcel(Parcel in) {
                 return readFromParcel(in);
diff --git a/core/java/android/net/DnsPacket.java b/core/java/android/net/DnsPacket.java
index 458fb34..0ac02b1 100644
--- a/core/java/android/net/DnsPacket.java
+++ b/core/java/android/net/DnsPacket.java
@@ -28,7 +28,6 @@
 import java.text.FieldPosition;
 import java.util.ArrayList;
 import java.util.List;
-import java.util.StringJoiner;
 
 /**
  * Defines basic data for DNS protocol based on RFC 1035.
@@ -42,7 +41,7 @@
         public final int id;
         public final int flags;
         public final int rcode;
-        private final int[] mSectionCount;
+        private final int[] mRecordCount;
 
         /**
          * Create a new DnsHeader from a positioned ByteBuffer.
@@ -52,27 +51,32 @@
          * When this constructor returns, the reading position of the ByteBuffer has been
          * advanced to the end of the DNS header record.
          * This is meant to chain with other methods reading a DNS response in sequence.
-         *
          */
         DnsHeader(@NonNull ByteBuffer buf) throws BufferUnderflowException {
             id = BitUtils.uint16(buf.getShort());
             flags = BitUtils.uint16(buf.getShort());
             rcode = flags & 0xF;
-            mSectionCount = new int[NUM_SECTIONS];
+            mRecordCount = new int[NUM_SECTIONS];
             for (int i = 0; i < NUM_SECTIONS; ++i) {
-                mSectionCount[i] = BitUtils.uint16(buf.getShort());
+                mRecordCount[i] = BitUtils.uint16(buf.getShort());
             }
         }
 
         /**
-         * Get section count by section type.
+         * Get record count by type.
          */
-        public int getSectionCount(int sectionType) {
-            return mSectionCount[sectionType];
+        public int getRecordCount(int type) {
+            return mRecordCount[type];
         }
     }
 
-    public class DnsSection {
+    /**
+     * It's used both for DNS questions and DNS resource records.
+     *
+     * DNS questions (No TTL/RDATA)
+     * DNS resource records (With TTL/RDATA)
+     */
+    public class DnsRecord {
         private static final int MAXNAMESIZE = 255;
         private static final int MAXLABELSIZE = 63;
         private static final int MAXLABELCOUNT = 128;
@@ -81,57 +85,57 @@
         private final DecimalFormat byteFormat = new DecimalFormat();
         private final FieldPosition pos = new FieldPosition(0);
 
-        private static final String TAG = "DnsSection";
+        private static final String TAG = "DnsRecord";
 
         public final String dName;
         public final int nsType;
         public final int nsClass;
         public final long ttl;
-        private final byte[] mRR;
+        private final byte[] mRdata;
 
         /**
-         * Create a new DnsSection from a positioned ByteBuffer.
+         * Create a new DnsRecord from a positioned ByteBuffer.
          *
-         * The ByteBuffer must be in network byte order (which is the default).
-         * Reads the passed ByteBuffer from its current position and decodes a DNS section.
+         * @param ByteBuffer input of record, must be in network byte order
+         *         (which is the default).
+         * Reads the passed ByteBuffer from its current position and decodes a DNS record.
          * When this constructor returns, the reading position of the ByteBuffer has been
          * advanced to the end of the DNS header record.
          * This is meant to chain with other methods reading a DNS response in sequence.
-         *
          */
-        DnsSection(int sectionType, @NonNull ByteBuffer buf)
+        DnsRecord(int recordType, @NonNull ByteBuffer buf)
                 throws BufferUnderflowException, ParseException {
             dName = parseName(buf, 0 /* Parse depth */);
             if (dName.length() > MAXNAMESIZE) {
-                throw new ParseException("Parse name fail, name size is too long");
+                throw new ParseException(
+                        "Parse name fail, name size is too long: " + dName.length());
             }
             nsType = BitUtils.uint16(buf.getShort());
             nsClass = BitUtils.uint16(buf.getShort());
 
-            if (sectionType != QDSECTION) {
+            if (recordType != QDSECTION) {
                 ttl = BitUtils.uint32(buf.getInt());
                 final int length = BitUtils.uint16(buf.getShort());
-                mRR = new byte[length];
-                buf.get(mRR);
+                mRdata = new byte[length];
+                buf.get(mRdata);
             } else {
                 ttl = 0;
-                mRR = null;
+                mRdata = null;
             }
         }
 
         /**
-         * Get a copy of rr.
+         * Get a copy of rdata.
          */
-        @Nullable public byte[] getRR() {
-            return (mRR == null) ? null : mRR.clone();
+        @Nullable
+        public byte[] getRR() {
+            return (mRdata == null) ? null : mRdata.clone();
         }
 
         /**
          * Convert label from {@code byte[]} to {@code String}
          *
-         * It follows the same converting rule as native layer.
-         * (See ns_name.c in libc)
-         *
+         * Follows the same conversion rules of the native code (ns_name.c in libc)
          */
         private String labelToString(@NonNull byte[] label) {
             final StringBuffer sb = new StringBuffer();
@@ -139,13 +143,16 @@
                 int b = BitUtils.uint8(label[i]);
                 // Control characters and non-ASCII characters.
                 if (b <= 0x20 || b >= 0x7f) {
+                    // Append the byte as an escaped decimal number, e.g., "\19" for 0x13.
                     sb.append('\\');
                     byteFormat.format(b, sb, pos);
                 } else if (b == '"' || b == '.' || b == ';' || b == '\\'
                         || b == '(' || b == ')' || b == '@' || b == '$') {
+                    // Append the byte as an escaped character, e.g., "\:" for 0x3a.
                     sb.append('\\');
                     sb.append((char) b);
                 } else {
+                    // Append the byte as a character, e.g., "a" for 0x61.
                     sb.append((char) b);
                 }
             }
@@ -154,7 +161,9 @@
 
         private String parseName(@NonNull ByteBuffer buf, int depth) throws
                 BufferUnderflowException, ParseException {
-            if (depth > MAXLABELCOUNT) throw new ParseException("Parse name fails, too many labels");
+            if (depth > MAXLABELCOUNT) {
+                throw new ParseException("Failed to parse name, too many labels");
+            }
             final int len = BitUtils.uint8(buf.get());
             final int mask = len & NAME_COMPRESSION;
             if (0 == len) {
@@ -194,7 +203,7 @@
     private static final String TAG = DnsPacket.class.getSimpleName();
 
     protected final DnsHeader mHeader;
-    protected final List<DnsSection>[] mSections;
+    protected final List<DnsRecord>[] mRecords;
 
     public static class ParseException extends Exception {
         public ParseException(String msg) {
@@ -216,18 +225,18 @@
             throw new ParseException("Parse Header fail, bad input data", e);
         }
 
-        mSections = new ArrayList[NUM_SECTIONS];
+        mRecords = new ArrayList[NUM_SECTIONS];
 
         for (int i = 0; i < NUM_SECTIONS; ++i) {
-            final int count = mHeader.getSectionCount(i);
+            final int count = mHeader.getRecordCount(i);
             if (count > 0) {
-                mSections[i] = new ArrayList(count);
+                mRecords[i] = new ArrayList(count);
             }
             for (int j = 0; j < count; ++j) {
                 try {
-                    mSections[i].add(new DnsSection(i, buffer));
+                    mRecords[i].add(new DnsRecord(i, buffer));
                 } catch (BufferUnderflowException e) {
-                    throw new ParseException("Parse section fail", e);
+                    throw new ParseException("Parse record fail", e);
                 }
             }
         }
diff --git a/core/java/android/net/DnsResolver.java b/core/java/android/net/DnsResolver.java
index 6d54264..d3bc3e6 100644
--- a/core/java/android/net/DnsResolver.java
+++ b/core/java/android/net/DnsResolver.java
@@ -43,6 +43,9 @@
 /**
  * Dns resolver class for asynchronous dns querying
  *
+ * Note that if a client sends a query with more than 1 record in the question section but
+ * the remote dns server does not support this, it may not respond at all, leading to a timeout.
+ *
  */
 public final class DnsResolver {
     private static final String TAG = "DnsResolver";
@@ -226,19 +229,19 @@
             if (mHeader.rcode != 0) {
                 throw new ParseException("Response error, rcode:" + mHeader.rcode);
             }
-            if (mHeader.getSectionCount(ANSECTION) == 0) {
+            if (mHeader.getRecordCount(ANSECTION) == 0) {
                 throw new ParseException("No available answer");
             }
-            if (mHeader.getSectionCount(QDSECTION) == 0) {
+            if (mHeader.getRecordCount(QDSECTION) == 0) {
                 throw new ParseException("No question found");
             }
-            // Assume only one question per answer packet. (RFC1035)
-            mQueryType = mSections[QDSECTION].get(0).nsType;
+            // Expect only one question in question section.
+            mQueryType = mRecords[QDSECTION].get(0).nsType;
         }
 
         public @NonNull List<InetAddress> getAddresses() {
             final List<InetAddress> results = new ArrayList<InetAddress>();
-            for (final DnsSection ansSec : mSections[ANSECTION]) {
+            for (final DnsRecord ansSec : mRecords[ANSECTION]) {
                 // Only support A and AAAA, also ignore answers if query type != answer type.
                 int nsType = ansSec.nsType;
                 if (nsType != mQueryType || (nsType != TYPE_A && nsType != TYPE_AAAA)) {
diff --git a/core/java/android/net/IConnectivityManager.aidl b/core/java/android/net/IConnectivityManager.aidl
index 87c62d2..a425a91 100644
--- a/core/java/android/net/IConnectivityManager.aidl
+++ b/core/java/android/net/IConnectivityManager.aidl
@@ -19,6 +19,7 @@
 import android.app.PendingIntent;
 import android.net.ConnectionInfo;
 import android.net.LinkProperties;
+import android.net.ITetheringEventCallback;
 import android.net.Network;
 import android.net.NetworkCapabilities;
 import android.net.NetworkInfo;
@@ -47,10 +48,12 @@
 {
     Network getActiveNetwork();
     Network getActiveNetworkForUid(int uid, boolean ignoreBlocked);
+    @UnsupportedAppUsage
     NetworkInfo getActiveNetworkInfo();
     NetworkInfo getActiveNetworkInfoForUid(int uid, boolean ignoreBlocked);
     NetworkInfo getNetworkInfo(int networkType);
     NetworkInfo getNetworkInfoForUid(in Network network, int uid, boolean ignoreBlocked);
+    @UnsupportedAppUsage
     NetworkInfo[] getAllNetworkInfo();
     Network getNetworkForType(int networkType);
     Network[] getAllNetworks();
@@ -58,12 +61,14 @@
 
     boolean isNetworkSupported(int networkType);
 
+    @UnsupportedAppUsage
     LinkProperties getActiveLinkProperties();
     LinkProperties getLinkPropertiesForType(int networkType);
     LinkProperties getLinkProperties(in Network network);
 
     NetworkCapabilities getNetworkCapabilities(in Network network);
 
+    @UnsupportedAppUsage
     NetworkState[] getAllNetworkState();
 
     NetworkQuotaInfo getActiveNetworkQuotaInfo();
@@ -75,6 +80,7 @@
 
     int untether(String iface, String callerPkg);
 
+    @UnsupportedAppUsage
     int getLastTetherError(String iface);
 
     boolean isTetheringSupported(String callerPkg);
@@ -84,16 +90,21 @@
 
     void stopTethering(int type, String callerPkg);
 
+    @UnsupportedAppUsage
     String[] getTetherableIfaces();
 
+    @UnsupportedAppUsage
     String[] getTetheredIfaces();
 
+    @UnsupportedAppUsage
     String[] getTetheringErroredIfaces();
 
     String[] getTetheredDhcpRanges();
 
+    @UnsupportedAppUsage
     String[] getTetherableUsbRegexs();
 
+    @UnsupportedAppUsage
     String[] getTetherableWifiRegexs();
 
     String[] getTetherableBluetoothRegexs();
@@ -118,12 +129,11 @@
 
     VpnConfig getVpnConfig(int userId);
 
+    @UnsupportedAppUsage
     void startLegacyVpn(in VpnProfile profile);
 
     LegacyVpnInfo getLegacyVpnInfo(int userId);
 
-    VpnInfo[] getAllVpnInfo();
-
     boolean updateLockdownVpn();
     boolean isAlwaysOnVpnPackageSupported(int userId, String packageName);
     boolean setAlwaysOnVpnPackage(int userId, String packageName, boolean lockdown,
@@ -203,6 +213,9 @@
     boolean isCallerCurrentAlwaysOnVpnApp();
     boolean isCallerCurrentAlwaysOnVpnLockdownApp();
 
-    void getLatestTetheringEntitlementValue(int type, in ResultReceiver receiver,
+    void getLatestTetheringEntitlementResult(int type, in ResultReceiver receiver,
             boolean showEntitlementUi, String callerPkg);
+
+    void registerTetheringEventCallback(ITetheringEventCallback callback, String callerPkg);
+    void unregisterTetheringEventCallback(ITetheringEventCallback callback, String callerPkg);
 }
diff --git a/core/java/android/net/INetworkPolicyManager.aidl b/core/java/android/net/INetworkPolicyManager.aidl
index e92302a..385cb1d 100644
--- a/core/java/android/net/INetworkPolicyManager.aidl
+++ b/core/java/android/net/INetworkPolicyManager.aidl
@@ -31,9 +31,11 @@
 interface INetworkPolicyManager {
 
     /** Control UID policies. */
+    @UnsupportedAppUsage
     void setUidPolicy(int uid, int policy);
     void addUidPolicy(int uid, int policy);
     void removeUidPolicy(int uid, int policy);
+    @UnsupportedAppUsage
     int getUidPolicy(int uid);
     int[] getUidsWithPolicy(int policy);
 
@@ -41,14 +43,18 @@
     void unregisterListener(INetworkPolicyListener listener);
 
     /** Control network policies atomically. */
+    @UnsupportedAppUsage
     void setNetworkPolicies(in NetworkPolicy[] policies);
     NetworkPolicy[] getNetworkPolicies(String callingPackage);
 
     /** Snooze limit on policy matching given template. */
+    @UnsupportedAppUsage
     void snoozeLimit(in NetworkTemplate template);
 
     /** Control if background data is restricted system-wide. */
+    @UnsupportedAppUsage
     void setRestrictBackground(boolean restrictBackground);
+    @UnsupportedAppUsage
     boolean getRestrictBackground();
 
     /** Callback used to change internal state on tethering */
@@ -64,6 +70,7 @@
     void setDeviceIdleMode(boolean enabled);
     void setWifiMeteredOverride(String networkId, int meteredOverride);
 
+    @UnsupportedAppUsage
     NetworkQuotaInfo getNetworkQuotaInfo(in NetworkState state);
 
     SubscriptionPlan[] getSubscriptionPlans(int subId, String callingPackage);
diff --git a/core/java/android/net/INetworkStatsService.aidl b/core/java/android/net/INetworkStatsService.aidl
index 8e6f272..41efc50 100644
--- a/core/java/android/net/INetworkStatsService.aidl
+++ b/core/java/android/net/INetworkStatsService.aidl
@@ -19,16 +19,19 @@
 import android.net.DataUsageRequest;
 import android.net.INetworkStatsSession;
 import android.net.Network;
+import android.net.NetworkState;
 import android.net.NetworkStats;
 import android.net.NetworkStatsHistory;
 import android.net.NetworkTemplate;
 import android.os.IBinder;
 import android.os.Messenger;
+import com.android.internal.net.VpnInfo;
 
 /** {@hide} */
 interface INetworkStatsService {
 
     /** Start a statistics query session. */
+    @UnsupportedAppUsage
     INetworkStatsSession openSession();
 
     /** Start a statistics query session. If calling package is profile or device owner then it is
@@ -37,9 +40,11 @@
      *  PACKAGE_USAGE_STATS permission is always checked. If PACKAGE_USAGE_STATS is not granted
      *  READ_NETWORK_USAGE_STATS is checked for.
      */
+    @UnsupportedAppUsage
     INetworkStatsSession openSessionForUsageStats(int flags, String callingPackage);
 
     /** Return data layer snapshot of UID network usage. */
+    @UnsupportedAppUsage
     NetworkStats getDataLayerSnapshotForUid(int uid);
 
     /** Get a detailed snapshot of stats since boot for all UIDs.
@@ -52,14 +57,20 @@
     NetworkStats getDetailedUidStats(in String[] requiredIfaces);
 
     /** Return set of any ifaces associated with mobile networks since boot. */
+    @UnsupportedAppUsage
     String[] getMobileIfaces();
 
     /** Increment data layer count of operations performed for UID and tag. */
     void incrementOperationCount(int uid, int tag, int operationCount);
 
     /** Force update of ifaces. */
-    void forceUpdateIfaces(in Network[] defaultNetworks);
+    void forceUpdateIfaces(
+         in Network[] defaultNetworks,
+         in VpnInfo[] vpnArray,
+         in NetworkState[] networkStates,
+         in String activeIface);
     /** Force update of statistics. */
+    @UnsupportedAppUsage
     void forceUpdate();
 
     /** Registers a callback on data usage. */
diff --git a/core/java/android/net/INetworkStatsSession.aidl b/core/java/android/net/INetworkStatsSession.aidl
index 5229a3b..f13f2cb 100644
--- a/core/java/android/net/INetworkStatsSession.aidl
+++ b/core/java/android/net/INetworkStatsSession.aidl
@@ -27,13 +27,17 @@
     NetworkStats getDeviceSummaryForNetwork(in NetworkTemplate template, long start, long end);
 
     /** Return network layer usage summary for traffic that matches template. */
+    @UnsupportedAppUsage
     NetworkStats getSummaryForNetwork(in NetworkTemplate template, long start, long end);
     /** Return historical network layer stats for traffic that matches template. */
+    @UnsupportedAppUsage
     NetworkStatsHistory getHistoryForNetwork(in NetworkTemplate template, int fields);
 
     /** Return network layer usage summary per UID for traffic that matches template. */
+    @UnsupportedAppUsage
     NetworkStats getSummaryForAllUid(in NetworkTemplate template, long start, long end, boolean includeTags);
     /** Return historical network layer stats for specific UID traffic that matches template. */
+    @UnsupportedAppUsage
     NetworkStatsHistory getHistoryForUid(in NetworkTemplate template, int uid, int set, int tag, int fields);
     /** Return historical network layer stats for specific UID traffic that matches template. */
     NetworkStatsHistory getHistoryIntervalForUid(in NetworkTemplate template, int uid, int set, int tag, int fields, long start, long end);
@@ -41,6 +45,7 @@
     /** Return array of uids that have stats and are accessible to the calling user */
     int[] getRelevantUids();
 
+    @UnsupportedAppUsage
     void close();
 
 }
diff --git a/core/java/android/net/ITestNetworkManager.aidl b/core/java/android/net/ITestNetworkManager.aidl
new file mode 100644
index 0000000..119a30c
--- /dev/null
+++ b/core/java/android/net/ITestNetworkManager.aidl
@@ -0,0 +1,36 @@
+/**
+ * Copyright (c) 2018, 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.net;
+
+import android.net.LinkAddress;
+import android.net.TestNetworkInterface;
+import android.os.IBinder;
+import android.os.ParcelFileDescriptor;
+
+/**
+ * Interface that allows for creation and management of test-only networks.
+ *
+ * @hide
+ */
+interface ITestNetworkManager
+{
+    TestNetworkInterface createTunInterface(in LinkAddress[] linkAddrs);
+
+    void setupTestNetwork(in String iface, in IBinder binder);
+
+    void teardownTestNetwork(int netId);
+}
diff --git a/core/java/android/app/role/IRoleManagerCallback.aidl b/core/java/android/net/ITetheringEventCallback.aidl
similarity index 69%
copy from core/java/android/app/role/IRoleManagerCallback.aidl
copy to core/java/android/net/ITetheringEventCallback.aidl
index c0f8eea..d502088 100644
--- a/core/java/android/app/role/IRoleManagerCallback.aidl
+++ b/core/java/android/net/ITetheringEventCallback.aidl
@@ -1,5 +1,5 @@
 /*
- * Copyright (C) 2018 The Android Open Source Project
+ * Copyright (C) 2019 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.
@@ -14,14 +14,15 @@
  * limitations under the License.
  */
 
-package android.app.role;
+package android.net;
+
+import android.net.Network;
 
 /**
+ * Callback class for receiving tethering changed events
  * @hide
  */
-oneway interface IRoleManagerCallback {
-
-    void onSuccess();
-
-    void onFailure();
+oneway interface ITetheringEventCallback
+{
+    void onUpstreamChanged(in Network network);
 }
diff --git a/core/java/android/net/InetAddresses.java b/core/java/android/net/InetAddresses.java
index 8e6c69a..01b795e 100644
--- a/core/java/android/net/InetAddresses.java
+++ b/core/java/android/net/InetAddresses.java
@@ -16,6 +16,8 @@
 
 package android.net;
 
+import android.annotation.NonNull;
+
 import libcore.net.InetAddressUtils;
 
 import java.net.InetAddress;
@@ -40,7 +42,7 @@
      * @param address the address to parse.
      * @return true if the supplied address is numeric, false otherwise.
      */
-    public static boolean isNumericAddress(String address) {
+    public static boolean isNumericAddress(@NonNull String address) {
         return InetAddressUtils.isNumericAddress(address);
     }
 
@@ -57,7 +59,7 @@
      * @return an {@link InetAddress} instance corresponding to the address.
      * @throws IllegalArgumentException if {@code address} is not a numeric address.
      */
-    public static InetAddress parseNumericAddress(String address) {
+    public static @NonNull InetAddress parseNumericAddress(@NonNull String address) {
         return InetAddressUtils.parseNumericAddress(address);
     }
 }
diff --git a/core/java/android/net/InterfaceConfiguration.java b/core/java/android/net/InterfaceConfiguration.java
index b9d49c1..c638491 100644
--- a/core/java/android/net/InterfaceConfiguration.java
+++ b/core/java/android/net/InterfaceConfiguration.java
@@ -194,7 +194,7 @@
         }
     }
 
-    public static final Creator<InterfaceConfiguration> CREATOR = new Creator<
+    public static final @android.annotation.NonNull Creator<InterfaceConfiguration> CREATOR = new Creator<
             InterfaceConfiguration>() {
         public InterfaceConfiguration createFromParcel(Parcel in) {
             InterfaceConfiguration info = new InterfaceConfiguration();
diff --git a/core/java/android/net/IpConfiguration.java b/core/java/android/net/IpConfiguration.java
index 3319f33..2af82d7 100644
--- a/core/java/android/net/IpConfiguration.java
+++ b/core/java/android/net/IpConfiguration.java
@@ -189,7 +189,7 @@
     }
 
     /** Implement the Parcelable interface */
-    public static final Creator<IpConfiguration> CREATOR =
+    public static final @android.annotation.NonNull Creator<IpConfiguration> CREATOR =
         new Creator<IpConfiguration>() {
             public IpConfiguration createFromParcel(Parcel in) {
                 IpConfiguration config = new IpConfiguration();
diff --git a/core/java/android/net/IpMemoryStore.java b/core/java/android/net/IpMemoryStore.java
index b35f097..2f4d9bc 100644
--- a/core/java/android/net/IpMemoryStore.java
+++ b/core/java/android/net/IpMemoryStore.java
@@ -171,4 +171,9 @@
             throw e.rethrowFromSystemServer();
         }
     }
+
+    /** Gets an instance of the memory store */
+    public static IpMemoryStore getMemoryStore(final Context context) {
+        return (IpMemoryStore) context.getSystemService(Context.IP_MEMORY_STORE_SERVICE);
+    }
 }
diff --git a/core/java/android/net/IpPrefix.java b/core/java/android/net/IpPrefix.java
index 175263f..21bbd30 100644
--- a/core/java/android/net/IpPrefix.java
+++ b/core/java/android/net/IpPrefix.java
@@ -285,7 +285,7 @@
     /**
      * Implement the Parcelable interface.
      */
-    public static final Creator<IpPrefix> CREATOR =
+    public static final @android.annotation.NonNull Creator<IpPrefix> CREATOR =
             new Creator<IpPrefix>() {
                 public IpPrefix createFromParcel(Parcel in) {
                     byte[] address = in.createByteArray();
diff --git a/core/java/android/net/IpSecAlgorithm.java b/core/java/android/net/IpSecAlgorithm.java
index 8034bb6..38d9883 100644
--- a/core/java/android/net/IpSecAlgorithm.java
+++ b/core/java/android/net/IpSecAlgorithm.java
@@ -191,7 +191,7 @@
     }
 
     /** Parcelable Creator */
-    public static final Parcelable.Creator<IpSecAlgorithm> CREATOR =
+    public static final @android.annotation.NonNull Parcelable.Creator<IpSecAlgorithm> CREATOR =
             new Parcelable.Creator<IpSecAlgorithm>() {
                 public IpSecAlgorithm createFromParcel(Parcel in) {
                     final String name = in.readString();
diff --git a/core/java/android/net/IpSecConfig.java b/core/java/android/net/IpSecConfig.java
index 3552655..a64014f 100644
--- a/core/java/android/net/IpSecConfig.java
+++ b/core/java/android/net/IpSecConfig.java
@@ -322,7 +322,7 @@
         return strBuilder.toString();
     }
 
-    public static final Parcelable.Creator<IpSecConfig> CREATOR =
+    public static final @android.annotation.NonNull Parcelable.Creator<IpSecConfig> CREATOR =
             new Parcelable.Creator<IpSecConfig>() {
                 public IpSecConfig createFromParcel(Parcel in) {
                     return new IpSecConfig(in);
diff --git a/core/java/android/net/IpSecSpiResponse.java b/core/java/android/net/IpSecSpiResponse.java
index 71dfa03..f99e570 100644
--- a/core/java/android/net/IpSecSpiResponse.java
+++ b/core/java/android/net/IpSecSpiResponse.java
@@ -65,7 +65,7 @@
         spi = in.readInt();
     }
 
-    public static final Parcelable.Creator<IpSecSpiResponse> CREATOR =
+    public static final @android.annotation.NonNull Parcelable.Creator<IpSecSpiResponse> CREATOR =
             new Parcelable.Creator<IpSecSpiResponse>() {
                 public IpSecSpiResponse createFromParcel(Parcel in) {
                     return new IpSecSpiResponse(in);
diff --git a/core/java/android/net/IpSecTransformResponse.java b/core/java/android/net/IpSecTransformResponse.java
index cfc1762..a384889 100644
--- a/core/java/android/net/IpSecTransformResponse.java
+++ b/core/java/android/net/IpSecTransformResponse.java
@@ -60,7 +60,7 @@
         resourceId = in.readInt();
     }
 
-    public static final Parcelable.Creator<IpSecTransformResponse> CREATOR =
+    public static final @android.annotation.NonNull Parcelable.Creator<IpSecTransformResponse> CREATOR =
             new Parcelable.Creator<IpSecTransformResponse>() {
                 public IpSecTransformResponse createFromParcel(Parcel in) {
                     return new IpSecTransformResponse(in);
diff --git a/core/java/android/net/IpSecTunnelInterfaceResponse.java b/core/java/android/net/IpSecTunnelInterfaceResponse.java
index c23d831..e3411e0 100644
--- a/core/java/android/net/IpSecTunnelInterfaceResponse.java
+++ b/core/java/android/net/IpSecTunnelInterfaceResponse.java
@@ -65,7 +65,7 @@
         interfaceName = in.readString();
     }
 
-    public static final Parcelable.Creator<IpSecTunnelInterfaceResponse> CREATOR =
+    public static final @android.annotation.NonNull Parcelable.Creator<IpSecTunnelInterfaceResponse> CREATOR =
             new Parcelable.Creator<IpSecTunnelInterfaceResponse>() {
                 public IpSecTunnelInterfaceResponse createFromParcel(Parcel in) {
                     return new IpSecTunnelInterfaceResponse(in);
diff --git a/core/java/android/net/IpSecUdpEncapResponse.java b/core/java/android/net/IpSecUdpEncapResponse.java
index 4679267..4e7ba9b 100644
--- a/core/java/android/net/IpSecUdpEncapResponse.java
+++ b/core/java/android/net/IpSecUdpEncapResponse.java
@@ -83,7 +83,7 @@
         fileDescriptor = in.readParcelable(ParcelFileDescriptor.class.getClassLoader());
     }
 
-    public static final Parcelable.Creator<IpSecUdpEncapResponse> CREATOR =
+    public static final @android.annotation.NonNull Parcelable.Creator<IpSecUdpEncapResponse> CREATOR =
             new Parcelable.Creator<IpSecUdpEncapResponse>() {
                 public IpSecUdpEncapResponse createFromParcel(Parcel in) {
                     return new IpSecUdpEncapResponse(in);
diff --git a/core/java/android/net/KeepalivePacketData.java b/core/java/android/net/KeepalivePacketData.java
index 18726f7..9b8b732 100644
--- a/core/java/android/net/KeepalivePacketData.java
+++ b/core/java/android/net/KeepalivePacketData.java
@@ -105,7 +105,7 @@
     }
 
     /** Parcelable Creator */
-    public static final Parcelable.Creator<KeepalivePacketData> CREATOR =
+    public static final @android.annotation.NonNull Parcelable.Creator<KeepalivePacketData> CREATOR =
             new Parcelable.Creator<KeepalivePacketData>() {
                 public KeepalivePacketData createFromParcel(Parcel in) {
                     return new KeepalivePacketData(in);
diff --git a/core/java/android/net/LinkAddress.java b/core/java/android/net/LinkAddress.java
index 8d779aa..78a4e72 100644
--- a/core/java/android/net/LinkAddress.java
+++ b/core/java/android/net/LinkAddress.java
@@ -25,6 +25,7 @@
 import static android.system.OsConstants.RT_SCOPE_SITE;
 import static android.system.OsConstants.RT_SCOPE_UNIVERSE;
 
+import android.annotation.NonNull;
 import android.annotation.SystemApi;
 import android.annotation.TestApi;
 import android.annotation.UnsupportedAppUsage;
@@ -177,7 +178,7 @@
      */
     @SystemApi
     @TestApi
-    public LinkAddress(InetAddress address, int prefixLength) {
+    public LinkAddress(@NonNull InetAddress address, int prefixLength) {
         this(address, prefixLength, 0, 0);
         this.scope = scopeForUnicastAddress(address);
     }
@@ -196,12 +197,12 @@
     /**
      * Constructs a new {@code LinkAddress} from a string such as "192.0.2.5/24" or
      * "2001:db8::1/64". The flags are set to zero and the scope is determined from the address.
-     * @param string The string to parse.
+     * @param address The string to parse.
      * @hide
      */
     @SystemApi
     @TestApi
-    public LinkAddress(String address) {
+    public LinkAddress(@NonNull String address) {
         this(address, 0, 0);
         this.scope = scopeForUnicastAddress(this.address);
     }
@@ -209,7 +210,7 @@
     /**
      * Constructs a new {@code LinkAddress} from a string such as "192.0.2.5/24" or
      * "2001:db8::1/64", with the specified flags and scope.
-     * @param string The string to parse.
+     * @param address The string to parse.
      * @param flags The address flags.
      * @param scope The address scope.
      * @hide
@@ -356,7 +357,7 @@
     /**
      * Implement the Parcelable interface.
      */
-    public static final Creator<LinkAddress> CREATOR =
+    public static final @android.annotation.NonNull Creator<LinkAddress> CREATOR =
         new Creator<LinkAddress>() {
             public LinkAddress createFromParcel(Parcel in) {
                 InetAddress address = null;
diff --git a/core/java/android/net/LinkProperties.java b/core/java/android/net/LinkProperties.java
index 42db0fd..b52b15e 100644
--- a/core/java/android/net/LinkProperties.java
+++ b/core/java/android/net/LinkProperties.java
@@ -1574,7 +1574,7 @@
     /**
      * Implement the Parcelable interface.
      */
-    public static final Creator<LinkProperties> CREATOR =
+    public static final @android.annotation.NonNull Creator<LinkProperties> CREATOR =
         new Creator<LinkProperties>() {
             public LinkProperties createFromParcel(Parcel in) {
                 LinkProperties netProp = new LinkProperties();
diff --git a/core/java/android/net/LinkQualityInfo.java b/core/java/android/net/LinkQualityInfo.java
index b6f8825..3c5d474 100644
--- a/core/java/android/net/LinkQualityInfo.java
+++ b/core/java/android/net/LinkQualityInfo.java
@@ -111,7 +111,7 @@
     /**
      * @hide
      */
-    public static final Creator<LinkQualityInfo> CREATOR =
+    public static final @android.annotation.NonNull Creator<LinkQualityInfo> CREATOR =
             new Creator<LinkQualityInfo>() {
                 public LinkQualityInfo createFromParcel(Parcel in) {
                     int objectType = in.readInt();
diff --git a/core/java/android/net/MacAddress.java b/core/java/android/net/MacAddress.java
index 77d83f5..aa8e010 100644
--- a/core/java/android/net/MacAddress.java
+++ b/core/java/android/net/MacAddress.java
@@ -167,7 +167,7 @@
         return 0;
     }
 
-    public static final Parcelable.Creator<MacAddress> CREATOR =
+    public static final @android.annotation.NonNull Parcelable.Creator<MacAddress> CREATOR =
             new Parcelable.Creator<MacAddress>() {
                 public MacAddress createFromParcel(Parcel in) {
                     return new MacAddress(in.readLong());
diff --git a/core/java/android/net/MatchAllNetworkSpecifier.java b/core/java/android/net/MatchAllNetworkSpecifier.java
index 7aafc93..ab4f627 100644
--- a/core/java/android/net/MatchAllNetworkSpecifier.java
+++ b/core/java/android/net/MatchAllNetworkSpecifier.java
@@ -68,7 +68,7 @@
         // Nothing to write.
     }
 
-    public static final Parcelable.Creator<MatchAllNetworkSpecifier> CREATOR =
+    public static final @android.annotation.NonNull Parcelable.Creator<MatchAllNetworkSpecifier> CREATOR =
             new Parcelable.Creator<MatchAllNetworkSpecifier>() {
         public MatchAllNetworkSpecifier createFromParcel(Parcel in) {
             return new MatchAllNetworkSpecifier();
diff --git a/core/java/android/net/Network.java b/core/java/android/net/Network.java
index e04b5fc..0fafdf7 100644
--- a/core/java/android/net/Network.java
+++ b/core/java/android/net/Network.java
@@ -470,7 +470,7 @@
         dest.writeInt(netId);
     }
 
-    public static final Creator<Network> CREATOR =
+    public static final @android.annotation.NonNull Creator<Network> CREATOR =
         new Creator<Network>() {
             public Network createFromParcel(Parcel in) {
                 int netId = in.readInt();
diff --git a/core/java/android/net/NetworkCapabilities.java b/core/java/android/net/NetworkCapabilities.java
index 1d2d81d..eb0fe33 100644
--- a/core/java/android/net/NetworkCapabilities.java
+++ b/core/java/android/net/NetworkCapabilities.java
@@ -143,6 +143,7 @@
             NET_CAPABILITY_NOT_CONGESTED,
             NET_CAPABILITY_NOT_SUSPENDED,
             NET_CAPABILITY_OEM_PAID,
+            NET_CAPABILITY_MCX
     })
     public @interface NetCapability { }
 
@@ -297,8 +298,14 @@
     @SystemApi
     public static final int NET_CAPABILITY_OEM_PAID = 22;
 
+    /**
+     * Indicates this is a network that has the ability to reach a carrier's Mission Critical
+     * servers.
+     */
+    public static final int NET_CAPABILITY_MCX = 23;
+
     private static final int MIN_NET_CAPABILITY = NET_CAPABILITY_MMS;
-    private static final int MAX_NET_CAPABILITY = NET_CAPABILITY_OEM_PAID;
+    private static final int MAX_NET_CAPABILITY = NET_CAPABILITY_MCX;
 
     /**
      * Network capabilities that are expected to be mutable, i.e., can change while a particular
@@ -346,7 +353,8 @@
             (1 << NET_CAPABILITY_IA) |
             (1 << NET_CAPABILITY_IMS) |
             (1 << NET_CAPABILITY_RCS) |
-            (1 << NET_CAPABILITY_XCAP);
+            (1 << NET_CAPABILITY_XCAP) |
+            (1 << NET_CAPABILITY_MCX);
 
     /**
      * Capabilities that force network to be restricted.
@@ -1442,7 +1450,7 @@
         dest.writeString(mSSID);
     }
 
-    public static final Creator<NetworkCapabilities> CREATOR =
+    public static final @android.annotation.NonNull Creator<NetworkCapabilities> CREATOR =
         new Creator<NetworkCapabilities>() {
             @Override
             public NetworkCapabilities createFromParcel(Parcel in) {
@@ -1614,6 +1622,7 @@
             case NET_CAPABILITY_NOT_CONGESTED:  return "NOT_CONGESTED";
             case NET_CAPABILITY_NOT_SUSPENDED:  return "NOT_SUSPENDED";
             case NET_CAPABILITY_OEM_PAID:       return "OEM_PAID";
+            case NET_CAPABILITY_MCX:            return "MCX";
             default:                            return Integer.toString(capability);
         }
     }
diff --git a/core/java/android/net/NetworkInfo.java b/core/java/android/net/NetworkInfo.java
index 89d9961..cd83531 100644
--- a/core/java/android/net/NetworkInfo.java
+++ b/core/java/android/net/NetworkInfo.java
@@ -557,7 +557,7 @@
         }
     }
 
-    public static final Creator<NetworkInfo> CREATOR = new Creator<NetworkInfo>() {
+    public static final @android.annotation.NonNull Creator<NetworkInfo> CREATOR = new Creator<NetworkInfo>() {
         @Override
         public NetworkInfo createFromParcel(Parcel in) {
             int netType = in.readInt();
diff --git a/core/java/android/net/NetworkKey.java b/core/java/android/net/NetworkKey.java
index 31a74dc..0a9a3c8 100644
--- a/core/java/android/net/NetworkKey.java
+++ b/core/java/android/net/NetworkKey.java
@@ -178,7 +178,7 @@
         }
     }
 
-    public static final Parcelable.Creator<NetworkKey> CREATOR =
+    public static final @android.annotation.NonNull Parcelable.Creator<NetworkKey> CREATOR =
             new Parcelable.Creator<NetworkKey>() {
                 @Override
                 public NetworkKey createFromParcel(Parcel in) {
diff --git a/core/java/android/net/NetworkMisc.java b/core/java/android/net/NetworkMisc.java
index c0487b5..ed0b61e 100644
--- a/core/java/android/net/NetworkMisc.java
+++ b/core/java/android/net/NetworkMisc.java
@@ -100,7 +100,7 @@
         out.writeInt(skip464xlat ? 1 : 0);
     }
 
-    public static final Creator<NetworkMisc> CREATOR = new Creator<NetworkMisc>() {
+    public static final @android.annotation.NonNull Creator<NetworkMisc> CREATOR = new Creator<NetworkMisc>() {
         @Override
         public NetworkMisc createFromParcel(Parcel in) {
             NetworkMisc networkMisc = new NetworkMisc();
diff --git a/core/java/android/net/NetworkPolicy.java b/core/java/android/net/NetworkPolicy.java
index f8973eb..33baebb 100644
--- a/core/java/android/net/NetworkPolicy.java
+++ b/core/java/android/net/NetworkPolicy.java
@@ -237,7 +237,7 @@
     }
 
     @UnsupportedAppUsage
-    public static final Creator<NetworkPolicy> CREATOR = new Creator<NetworkPolicy>() {
+    public static final @android.annotation.NonNull Creator<NetworkPolicy> CREATOR = new Creator<NetworkPolicy>() {
         @Override
         public NetworkPolicy createFromParcel(Parcel in) {
             return new NetworkPolicy(in);
diff --git a/core/java/android/net/NetworkQuotaInfo.java b/core/java/android/net/NetworkQuotaInfo.java
index e7182f7..a46cdde 100644
--- a/core/java/android/net/NetworkQuotaInfo.java
+++ b/core/java/android/net/NetworkQuotaInfo.java
@@ -62,7 +62,7 @@
     }
 
     @UnsupportedAppUsage
-    public static final Creator<NetworkQuotaInfo> CREATOR = new Creator<NetworkQuotaInfo>() {
+    public static final @android.annotation.NonNull Creator<NetworkQuotaInfo> CREATOR = new Creator<NetworkQuotaInfo>() {
         @Override
         public NetworkQuotaInfo createFromParcel(Parcel in) {
             return new NetworkQuotaInfo(in);
diff --git a/core/java/android/net/NetworkRequest.java b/core/java/android/net/NetworkRequest.java
index 9508217..dcb027d 100644
--- a/core/java/android/net/NetworkRequest.java
+++ b/core/java/android/net/NetworkRequest.java
@@ -363,7 +363,7 @@
         dest.writeInt(requestId);
         dest.writeString(type.name());
     }
-    public static final Creator<NetworkRequest> CREATOR =
+    public static final @android.annotation.NonNull Creator<NetworkRequest> CREATOR =
         new Creator<NetworkRequest>() {
             public NetworkRequest createFromParcel(Parcel in) {
                 NetworkCapabilities nc = NetworkCapabilities.CREATOR.createFromParcel(in);
diff --git a/core/java/android/net/NetworkScorerAppData.java b/core/java/android/net/NetworkScorerAppData.java
index 1734b34..116e39e 100644
--- a/core/java/android/net/NetworkScorerAppData.java
+++ b/core/java/android/net/NetworkScorerAppData.java
@@ -61,7 +61,7 @@
         return 0;
     }
 
-    public static final Creator<NetworkScorerAppData> CREATOR =
+    public static final @android.annotation.NonNull Creator<NetworkScorerAppData> CREATOR =
             new Creator<NetworkScorerAppData>() {
                 @Override
                 public NetworkScorerAppData createFromParcel(Parcel in) {
diff --git a/core/java/android/net/NetworkState.java b/core/java/android/net/NetworkState.java
index 97fb3fb..292cf50 100644
--- a/core/java/android/net/NetworkState.java
+++ b/core/java/android/net/NetworkState.java
@@ -87,7 +87,7 @@
     }
 
     @UnsupportedAppUsage
-    public static final Creator<NetworkState> CREATOR = new Creator<NetworkState>() {
+    public static final @android.annotation.NonNull Creator<NetworkState> CREATOR = new Creator<NetworkState>() {
         @Override
         public NetworkState createFromParcel(Parcel in) {
             return new NetworkState(in);
diff --git a/core/java/android/net/NetworkStats.java b/core/java/android/net/NetworkStats.java
index 9cf582b..e892b65 100644
--- a/core/java/android/net/NetworkStats.java
+++ b/core/java/android/net/NetworkStats.java
@@ -1153,7 +1153,7 @@
     }
 
     @UnsupportedAppUsage
-    public static final Creator<NetworkStats> CREATOR = new Creator<NetworkStats>() {
+    public static final @android.annotation.NonNull Creator<NetworkStats> CREATOR = new Creator<NetworkStats>() {
         @Override
         public NetworkStats createFromParcel(Parcel in) {
             return new NetworkStats(in);
diff --git a/core/java/android/net/NetworkStatsHistory.java b/core/java/android/net/NetworkStatsHistory.java
index d53e032..f61260e 100644
--- a/core/java/android/net/NetworkStatsHistory.java
+++ b/core/java/android/net/NetworkStatsHistory.java
@@ -719,7 +719,7 @@
     }
 
     @UnsupportedAppUsage
-    public static final Creator<NetworkStatsHistory> CREATOR = new Creator<NetworkStatsHistory>() {
+    public static final @android.annotation.NonNull Creator<NetworkStatsHistory> CREATOR = new Creator<NetworkStatsHistory>() {
         @Override
         public NetworkStatsHistory createFromParcel(Parcel in) {
             return new NetworkStatsHistory(in);
diff --git a/core/java/android/net/NetworkTemplate.java b/core/java/android/net/NetworkTemplate.java
index bb75c63..d42fce3 100644
--- a/core/java/android/net/NetworkTemplate.java
+++ b/core/java/android/net/NetworkTemplate.java
@@ -482,7 +482,7 @@
     }
 
     @UnsupportedAppUsage
-    public static final Creator<NetworkTemplate> CREATOR = new Creator<NetworkTemplate>() {
+    public static final @android.annotation.NonNull Creator<NetworkTemplate> CREATOR = new Creator<NetworkTemplate>() {
         @Override
         public NetworkTemplate createFromParcel(Parcel in) {
             return new NetworkTemplate(in);
diff --git a/core/java/android/net/OWNERS b/core/java/android/net/OWNERS
index 15f4913..a1c7fce 100644
--- a/core/java/android/net/OWNERS
+++ b/core/java/android/net/OWNERS
@@ -1,12 +1,11 @@
 set noparent
 
 codewiz@google.com
-ek@google.com
-jsharkey@android.com
 jchalard@google.com
+jsharkey@android.com
+junyulai@google.com
 lorenzo@google.com
 reminv@google.com
 satk@google.com
-silberst@google.com
 
 per-file SSL*, Uri*, Url* = flooey@google.com, narayan@google.com, tobiast@google.com
diff --git a/core/java/android/net/ParseException.java b/core/java/android/net/ParseException.java
index 68b209b..2380e86 100644
--- a/core/java/android/net/ParseException.java
+++ b/core/java/android/net/ParseException.java
@@ -24,6 +24,7 @@
     public String response;
 
     ParseException(String response) {
+        super(response);
         this.response = response;
     }
 }
diff --git a/core/java/android/net/ProxyInfo.java b/core/java/android/net/ProxyInfo.java
index ef2269a..807c467 100644
--- a/core/java/android/net/ProxyInfo.java
+++ b/core/java/android/net/ProxyInfo.java
@@ -342,7 +342,7 @@
         dest.writeStringArray(mParsedExclusionList);
     }
 
-    public static final Creator<ProxyInfo> CREATOR =
+    public static final @android.annotation.NonNull Creator<ProxyInfo> CREATOR =
         new Creator<ProxyInfo>() {
             public ProxyInfo createFromParcel(Parcel in) {
                 String host = null;
diff --git a/core/java/android/net/RouteInfo.java b/core/java/android/net/RouteInfo.java
index 5c0f758..c1c8f6e 100644
--- a/core/java/android/net/RouteInfo.java
+++ b/core/java/android/net/RouteInfo.java
@@ -486,7 +486,7 @@
     /**
      * Implement the Parcelable interface.
      */
-    public static final Creator<RouteInfo> CREATOR =
+    public static final @android.annotation.NonNull Creator<RouteInfo> CREATOR =
         new Creator<RouteInfo>() {
         public RouteInfo createFromParcel(Parcel in) {
             IpPrefix dest = in.readParcelable(null);
diff --git a/core/java/android/net/RssiCurve.java b/core/java/android/net/RssiCurve.java
index 5b81f52..a173b0c 100644
--- a/core/java/android/net/RssiCurve.java
+++ b/core/java/android/net/RssiCurve.java
@@ -209,7 +209,7 @@
         return sb.toString();
     }
 
-    public static final Creator<RssiCurve> CREATOR =
+    public static final @android.annotation.NonNull Creator<RssiCurve> CREATOR =
             new Creator<RssiCurve>() {
                 @Override
                 public RssiCurve createFromParcel(Parcel in) {
diff --git a/core/java/android/net/ScoredNetwork.java b/core/java/android/net/ScoredNetwork.java
index e38d227..effc1aa 100644
--- a/core/java/android/net/ScoredNetwork.java
+++ b/core/java/android/net/ScoredNetwork.java
@@ -302,7 +302,7 @@
         return NetworkBadging.BADGING_NONE;
     }
 
-    public static final Parcelable.Creator<ScoredNetwork> CREATOR =
+    public static final @android.annotation.NonNull Parcelable.Creator<ScoredNetwork> CREATOR =
             new Parcelable.Creator<ScoredNetwork>() {
                 @Override
                 public ScoredNetwork createFromParcel(Parcel in) {
diff --git a/core/java/android/net/StaticIpConfiguration.java b/core/java/android/net/StaticIpConfiguration.java
index 99cf3a9..8b264ee 100644
--- a/core/java/android/net/StaticIpConfiguration.java
+++ b/core/java/android/net/StaticIpConfiguration.java
@@ -212,7 +212,7 @@
     }
 
     /** Implement the Parcelable interface */
-    public static final Creator<StaticIpConfiguration> CREATOR =
+    public static final @android.annotation.NonNull Creator<StaticIpConfiguration> CREATOR =
         new Creator<StaticIpConfiguration>() {
             public StaticIpConfiguration createFromParcel(Parcel in) {
                 return readFromParcel(in);
diff --git a/core/java/android/net/StringNetworkSpecifier.java b/core/java/android/net/StringNetworkSpecifier.java
index b5d12f9..21dee55 100644
--- a/core/java/android/net/StringNetworkSpecifier.java
+++ b/core/java/android/net/StringNetworkSpecifier.java
@@ -69,7 +69,7 @@
         dest.writeString(specifier);
     }
 
-    public static final Parcelable.Creator<StringNetworkSpecifier> CREATOR =
+    public static final @android.annotation.NonNull Parcelable.Creator<StringNetworkSpecifier> CREATOR =
             new Parcelable.Creator<StringNetworkSpecifier>() {
         public StringNetworkSpecifier createFromParcel(Parcel in) {
             return new StringNetworkSpecifier(in.readString());
diff --git a/core/java/android/net/TcpKeepalivePacketData.java b/core/java/android/net/TcpKeepalivePacketData.java
index f07dfb6..99d36c5 100644
--- a/core/java/android/net/TcpKeepalivePacketData.java
+++ b/core/java/android/net/TcpKeepalivePacketData.java
@@ -194,7 +194,7 @@
     }
 
     /** Parcelable Creator. */
-    public static final Parcelable.Creator<TcpKeepalivePacketData> CREATOR =
+    public static final @android.annotation.NonNull Parcelable.Creator<TcpKeepalivePacketData> CREATOR =
             new Parcelable.Creator<TcpKeepalivePacketData>() {
                 public TcpKeepalivePacketData createFromParcel(Parcel in) {
                     return new TcpKeepalivePacketData(in);
diff --git a/core/java/android/app/role/IRoleManagerCallback.aidl b/core/java/android/net/TestNetworkInterface.aidl
similarity index 74%
rename from core/java/android/app/role/IRoleManagerCallback.aidl
rename to core/java/android/net/TestNetworkInterface.aidl
index c0f8eea..e1f4f9f 100644
--- a/core/java/android/app/role/IRoleManagerCallback.aidl
+++ b/core/java/android/net/TestNetworkInterface.aidl
@@ -1,5 +1,5 @@
 /*
- * Copyright (C) 2018 The Android Open Source Project
+ * Copyright (C) 2019 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.
@@ -14,14 +14,7 @@
  * limitations under the License.
  */
 
-package android.app.role;
+package android.net;
 
-/**
- * @hide
- */
-oneway interface IRoleManagerCallback {
-
-    void onSuccess();
-
-    void onFailure();
-}
+/** @hide */
+parcelable TestNetworkInterface;
diff --git a/core/java/android/net/TestNetworkInterface.java b/core/java/android/net/TestNetworkInterface.java
new file mode 100644
index 0000000..30e68f5
--- /dev/null
+++ b/core/java/android/net/TestNetworkInterface.java
@@ -0,0 +1,74 @@
+/*
+ * Copyright (C) 2019 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.net;
+
+import android.annotation.TestApi;
+import android.os.Parcel;
+import android.os.ParcelFileDescriptor;
+import android.os.Parcelable;
+
+/**
+ * This class is used to return the interface name and fd of the test interface
+ *
+ * @hide
+ */
+@TestApi
+public final class TestNetworkInterface implements Parcelable {
+    private static final String TAG = "TestNetworkInterface";
+
+    private final ParcelFileDescriptor mFileDescriptor;
+    private final String mInterfaceName;
+
+    @Override
+    public int describeContents() {
+        return (mFileDescriptor != null) ? Parcelable.CONTENTS_FILE_DESCRIPTOR : 0;
+    }
+
+    @Override
+    public void writeToParcel(Parcel out, int flags) {
+        out.writeParcelable(mFileDescriptor, PARCELABLE_WRITE_RETURN_VALUE);
+        out.writeString(mInterfaceName);
+    }
+
+    public TestNetworkInterface(ParcelFileDescriptor pfd, String intf) {
+        mFileDescriptor = pfd;
+        mInterfaceName = intf;
+    }
+
+    private TestNetworkInterface(Parcel in) {
+        mFileDescriptor = in.readParcelable(ParcelFileDescriptor.class.getClassLoader());
+        mInterfaceName = in.readString();
+    }
+
+    public ParcelFileDescriptor getFileDescriptor() {
+        return mFileDescriptor;
+    }
+
+    public String getInterfaceName() {
+        return mInterfaceName;
+    }
+
+    public static final Parcelable.Creator<TestNetworkInterface> CREATOR =
+            new Parcelable.Creator<TestNetworkInterface>() {
+                public TestNetworkInterface createFromParcel(Parcel in) {
+                    return new TestNetworkInterface(in);
+                }
+
+                public TestNetworkInterface[] newArray(int size) {
+                    return new TestNetworkInterface[size];
+                }
+            };
+}
diff --git a/core/java/android/net/TestNetworkManager.java b/core/java/android/net/TestNetworkManager.java
new file mode 100644
index 0000000..cd58e66
--- /dev/null
+++ b/core/java/android/net/TestNetworkManager.java
@@ -0,0 +1,91 @@
+/*
+ * Copyright (C) 2018 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.net;
+
+import android.annotation.NonNull;
+import android.annotation.TestApi;
+import android.content.Context;
+import android.os.IBinder;
+import android.os.RemoteException;
+
+import com.android.internal.util.Preconditions;
+
+/**
+ * Class that allows creation and management of per-app, test-only networks
+ *
+ * @hide
+ */
+@TestApi
+public class TestNetworkManager {
+    @NonNull private static final String TAG = TestNetworkManager.class.getSimpleName();
+
+    @NonNull private final ITestNetworkManager mService;
+    @NonNull private final Context mContext;
+
+    /** @hide */
+    public TestNetworkManager(@NonNull Context context, @NonNull ITestNetworkManager service) {
+        mContext = Preconditions.checkNotNull(context, "missing Context");
+        mService = Preconditions.checkNotNull(service, "missing ITestNetworkManager");
+    }
+
+    /**
+     * Teardown the capability-limited, testing-only network for a given interface
+     *
+     * @param network The test network that should be torn down
+     * @hide
+     */
+    @TestApi
+    public void teardownTestNetwork(@NonNull Network network) {
+        try {
+            mService.teardownTestNetwork(network.netId);
+        } catch (RemoteException e) {
+            throw e.rethrowFromSystemServer();
+        }
+    }
+
+    /**
+     * Sets up a capability-limited, testing-only network for a given interface
+     *
+     * @param iface the name of the interface to be used for the Network LinkProperties.
+     * @param binder A binder object guarding the lifecycle of this test network.
+     * @hide
+     */
+    @TestApi
+    public void setupTestNetwork(@NonNull String iface, @NonNull IBinder binder) {
+        try {
+            mService.setupTestNetwork(iface, binder);
+        } catch (RemoteException e) {
+            throw e.rethrowFromSystemServer();
+        }
+    }
+
+    /**
+     * Create a tun interface for testing purposes
+     *
+     * @param linkAddrs an array of LinkAddresses to assign to the TUN interface
+     * @return A ParcelFileDescriptor of the underlying TUN interface. Close this to tear down the
+     *     TUN interface.
+     * @hide
+     */
+    @TestApi
+    public TestNetworkInterface createTunInterface(@NonNull LinkAddress[] linkAddrs) {
+        try {
+            return mService.createTunInterface(linkAddrs);
+        } catch (RemoteException e) {
+            throw e.rethrowFromSystemServer();
+        }
+    }
+}
diff --git a/core/java/android/net/UidRange.java b/core/java/android/net/UidRange.java
index 793c82d..d4a4cf4 100644
--- a/core/java/android/net/UidRange.java
+++ b/core/java/android/net/UidRange.java
@@ -91,7 +91,7 @@
      * The parceling code is autogenerated by the superclass.
      */
 
-    public static final Creator<UidRange> CREATOR =
+    public static final @android.annotation.NonNull Creator<UidRange> CREATOR =
         new Creator<UidRange>() {
             @Override
             public UidRange createFromParcel(Parcel in) {
diff --git a/core/java/android/net/Uri.java b/core/java/android/net/Uri.java
index af3ee09..fdf5321 100644
--- a/core/java/android/net/Uri.java
+++ b/core/java/android/net/Uri.java
@@ -402,7 +402,7 @@
                 }
                 return builder.toString();
             } else if (scheme.equalsIgnoreCase("http") || scheme.equalsIgnoreCase("https")
-                    || scheme.equalsIgnoreCase("ftp")) {
+                    || scheme.equalsIgnoreCase("ftp") || scheme.equalsIgnoreCase("rtsp")) {
                 ssp = "//" + ((getHost() != null) ? getHost() : "")
                         + ((getPort() != -1) ? (":" + getPort()) : "")
                         + "/...";
@@ -1799,7 +1799,7 @@
     /**
      * Reads Uris from Parcels.
      */
-    public static final Parcelable.Creator<Uri> CREATOR
+    public static final @android.annotation.NonNull Parcelable.Creator<Uri> CREATOR
             = new Parcelable.Creator<Uri>() {
         public Uri createFromParcel(Parcel in) {
             int type = in.readInt();
diff --git a/core/java/android/net/VpnService.java b/core/java/android/net/VpnService.java
index ebb1ae4..870d8b1 100644
--- a/core/java/android/net/VpnService.java
+++ b/core/java/android/net/VpnService.java
@@ -20,6 +20,7 @@
 import static android.system.OsConstants.AF_INET6;
 
 import android.annotation.NonNull;
+import android.annotation.Nullable;
 import android.annotation.RequiresPermission;
 import android.annotation.SystemApi;
 import android.annotation.UnsupportedAppUsage;
@@ -479,7 +480,8 @@
          * system-managed dialogs and notifications. This is recommended
          * not required.
          */
-        public Builder setSession(String session) {
+        @NonNull
+        public Builder setSession(@NonNull String session) {
             mConfig.session = session;
             return this;
         }
@@ -489,7 +491,8 @@
          * configure the VPN connection. If it is not set, the button
          * to configure will not be shown in system-managed dialogs.
          */
-        public Builder setConfigureIntent(PendingIntent intent) {
+        @NonNull
+        public Builder setConfigureIntent(@NonNull PendingIntent intent) {
             mConfig.configureIntent = intent;
             return this;
         }
@@ -501,6 +504,7 @@
          *
          * @throws IllegalArgumentException if the value is not positive.
          */
+        @NonNull
         public Builder setMtu(int mtu) {
             if (mtu <= 0) {
                 throw new IllegalArgumentException("Bad mtu");
@@ -513,6 +517,7 @@
          * Sets an HTTP proxy for the VPN network. This proxy is only a recommendation
          * and it is possible that some apps will ignore it.
          */
+        @NonNull
         public Builder setHttpProxy(@NonNull ProxyInfo proxyInfo) {
             mConfig.proxyInfo = proxyInfo;
             return this;
@@ -528,7 +533,8 @@
          *
          * @throws IllegalArgumentException if the address is invalid.
          */
-        public Builder addAddress(InetAddress address, int prefixLength) {
+        @NonNull
+        public Builder addAddress(@NonNull InetAddress address, int prefixLength) {
             check(address, prefixLength);
 
             if (address.isAnyLocalAddress()) {
@@ -550,7 +556,8 @@
          * @throws IllegalArgumentException if the address is invalid.
          * @see #addAddress(InetAddress, int)
          */
-        public Builder addAddress(String address, int prefixLength) {
+        @NonNull
+        public Builder addAddress(@NonNull String address, int prefixLength) {
             return addAddress(InetAddress.parseNumericAddress(address), prefixLength);
         }
 
@@ -563,7 +570,8 @@
          *
          * @throws IllegalArgumentException if the route is invalid.
          */
-        public Builder addRoute(InetAddress address, int prefixLength) {
+        @NonNull
+        public Builder addRoute(@NonNull InetAddress address, int prefixLength) {
             check(address, prefixLength);
 
             int offset = prefixLength / 8;
@@ -591,7 +599,8 @@
          * @throws IllegalArgumentException if the route is invalid.
          * @see #addRoute(InetAddress, int)
          */
-        public Builder addRoute(String address, int prefixLength) {
+        @NonNull
+        public Builder addRoute(@NonNull String address, int prefixLength) {
             return addRoute(InetAddress.parseNumericAddress(address), prefixLength);
         }
 
@@ -605,7 +614,8 @@
          *
          * @throws IllegalArgumentException if the address is invalid.
          */
-        public Builder addDnsServer(InetAddress address) {
+        @NonNull
+        public Builder addDnsServer(@NonNull InetAddress address) {
             if (address.isLoopbackAddress() || address.isAnyLocalAddress()) {
                 throw new IllegalArgumentException("Bad address");
             }
@@ -627,14 +637,16 @@
          * @throws IllegalArgumentException if the address is invalid.
          * @see #addDnsServer(InetAddress)
          */
-        public Builder addDnsServer(String address) {
+        @NonNull
+        public Builder addDnsServer(@NonNull String address) {
             return addDnsServer(InetAddress.parseNumericAddress(address));
         }
 
         /**
          * Add a search domain to the DNS resolver.
          */
-        public Builder addSearchDomain(String domain) {
+        @NonNull
+        public Builder addSearchDomain(@NonNull String domain) {
             if (mConfig.searchDomains == null) {
                 mConfig.searchDomains = new ArrayList<String>();
             }
@@ -660,6 +672,7 @@
          *
          * @return this {@link Builder} object to facilitate chaining of method calls.
          */
+        @NonNull
         public Builder allowFamily(int family) {
             if (family == AF_INET) {
                 mConfig.allowIPv4 = true;
@@ -703,7 +716,8 @@
          *
          * @return this {@link Builder} object to facilitate chaining method calls.
          */
-        public Builder addAllowedApplication(String packageName)
+        @NonNull
+        public Builder addAllowedApplication(@NonNull String packageName)
                 throws PackageManager.NameNotFoundException {
             if (mConfig.disallowedApplications != null) {
                 throw new UnsupportedOperationException("addDisallowedApplication already called");
@@ -735,7 +749,8 @@
          *
          * @return this {@link Builder} object to facilitate chaining method calls.
          */
-        public Builder addDisallowedApplication(String packageName)
+        @NonNull
+        public Builder addDisallowedApplication(@NonNull String packageName)
                 throws PackageManager.NameNotFoundException {
             if (mConfig.allowedApplications != null) {
                 throw new UnsupportedOperationException("addAllowedApplication already called");
@@ -758,6 +773,7 @@
          *
          * @return this {@link Builder} object to facilitate chaining of method calls.
          */
+        @NonNull
         public Builder allowBypass() {
             mConfig.allowBypass = true;
             return this;
@@ -772,6 +788,7 @@
          *
          * @return this {@link Builder} object to facilitate chaining method calls.
          */
+        @NonNull
         public Builder setBlocking(boolean blocking) {
             mConfig.blocking = blocking;
             return this;
@@ -786,7 +803,8 @@
          *
          * @return this {@link Builder} object to facilitate chaining method calls.
          */
-        public Builder setUnderlyingNetworks(Network[] networks) {
+        @NonNull
+        public Builder setUnderlyingNetworks(@Nullable Network[] networks) {
             mConfig.underlyingNetworks = networks != null ? networks.clone() : null;
             return this;
         }
@@ -807,6 +825,7 @@
          * @see #setUnderlyingNetworks(Networks[])
          * @see ConnectivityManager#isActiveNetworkMetered()
          */
+        @NonNull
         public Builder setMetered(boolean isMetered) {
             mConfig.isMetered = isMetered;
             return this;
@@ -855,6 +874,7 @@
          *         in {@code AndroidManifest.xml}.
          * @see VpnService
          */
+        @Nullable
         public ParcelFileDescriptor establish() {
             mConfig.addresses = mAddresses;
             mConfig.routes = mRoutes;
diff --git a/core/java/android/net/WifiKey.java b/core/java/android/net/WifiKey.java
index 68b505d..e3a93a8 100644
--- a/core/java/android/net/WifiKey.java
+++ b/core/java/android/net/WifiKey.java
@@ -110,7 +110,7 @@
         return "WifiKey[SSID=" + ssid + ",BSSID=" + bssid + "]";
     }
 
-    public static final Creator<WifiKey> CREATOR =
+    public static final @android.annotation.NonNull Creator<WifiKey> CREATOR =
             new Creator<WifiKey>() {
                 @Override
                 public WifiKey createFromParcel(Parcel in) {
diff --git a/core/java/android/net/http/SslCertificate.java b/core/java/android/net/http/SslCertificate.java
index 6fcd6eb..01dd08f 100644
--- a/core/java/android/net/http/SslCertificate.java
+++ b/core/java/android/net/http/SslCertificate.java
@@ -16,6 +16,7 @@
 
 package android.net.http;
 
+import android.annotation.Nullable;
 import android.annotation.UnsupportedAppUsage;
 import android.content.Context;
 import android.os.Bundle;
@@ -252,7 +253,7 @@
      * @return The {@code X509Certificate} used to create this {@code SslCertificate} or
      * {@code null} if no certificate was provided.
      */
-    public X509Certificate getX509Certificate() {
+    public @Nullable X509Certificate getX509Certificate() {
         return mX509Certificate;
     }
 
diff --git a/core/java/android/net/metrics/ApfProgramEvent.java b/core/java/android/net/metrics/ApfProgramEvent.java
index 8601005..b30d8cb 100644
--- a/core/java/android/net/metrics/ApfProgramEvent.java
+++ b/core/java/android/net/metrics/ApfProgramEvent.java
@@ -185,7 +185,7 @@
     }
 
     /** @hide */
-    public static final Parcelable.Creator<ApfProgramEvent> CREATOR
+    public static final @android.annotation.NonNull Parcelable.Creator<ApfProgramEvent> CREATOR
             = new Parcelable.Creator<ApfProgramEvent>() {
         public ApfProgramEvent createFromParcel(Parcel in) {
             return new ApfProgramEvent(in);
diff --git a/core/java/android/net/metrics/ApfStats.java b/core/java/android/net/metrics/ApfStats.java
index 844a134..e1c8888 100644
--- a/core/java/android/net/metrics/ApfStats.java
+++ b/core/java/android/net/metrics/ApfStats.java
@@ -264,7 +264,7 @@
     }
 
     /** @hide */
-    public static final Parcelable.Creator<ApfStats> CREATOR = new Parcelable.Creator<ApfStats>() {
+    public static final @android.annotation.NonNull Parcelable.Creator<ApfStats> CREATOR = new Parcelable.Creator<ApfStats>() {
         public ApfStats createFromParcel(Parcel in) {
             return new ApfStats(in);
         }
diff --git a/core/java/android/net/metrics/DhcpClientEvent.java b/core/java/android/net/metrics/DhcpClientEvent.java
index 3008115..e4faea9 100644
--- a/core/java/android/net/metrics/DhcpClientEvent.java
+++ b/core/java/android/net/metrics/DhcpClientEvent.java
@@ -98,7 +98,7 @@
     }
 
     /** @hide */
-    public static final Parcelable.Creator<DhcpClientEvent> CREATOR
+    public static final @android.annotation.NonNull Parcelable.Creator<DhcpClientEvent> CREATOR
         = new Parcelable.Creator<DhcpClientEvent>() {
         public DhcpClientEvent createFromParcel(Parcel in) {
             return new DhcpClientEvent(in);
diff --git a/core/java/android/net/metrics/DhcpErrorEvent.java b/core/java/android/net/metrics/DhcpErrorEvent.java
index 18fde80..91318a2 100644
--- a/core/java/android/net/metrics/DhcpErrorEvent.java
+++ b/core/java/android/net/metrics/DhcpErrorEvent.java
@@ -87,7 +87,7 @@
     }
 
     /** @hide */
-    public static final Parcelable.Creator<DhcpErrorEvent> CREATOR
+    public static final @android.annotation.NonNull Parcelable.Creator<DhcpErrorEvent> CREATOR
         = new Parcelable.Creator<DhcpErrorEvent>() {
         public DhcpErrorEvent createFromParcel(Parcel in) {
             return new DhcpErrorEvent(in);
diff --git a/core/java/android/net/metrics/IpManagerEvent.java b/core/java/android/net/metrics/IpManagerEvent.java
index 013e353..9d358d1 100644
--- a/core/java/android/net/metrics/IpManagerEvent.java
+++ b/core/java/android/net/metrics/IpManagerEvent.java
@@ -84,7 +84,7 @@
     }
 
     /** @hide */
-    public static final Parcelable.Creator<IpManagerEvent> CREATOR
+    public static final @android.annotation.NonNull Parcelable.Creator<IpManagerEvent> CREATOR
         = new Parcelable.Creator<IpManagerEvent>() {
         public IpManagerEvent createFromParcel(Parcel in) {
             return new IpManagerEvent(in);
diff --git a/core/java/android/net/metrics/IpReachabilityEvent.java b/core/java/android/net/metrics/IpReachabilityEvent.java
index c736297..80c8211 100644
--- a/core/java/android/net/metrics/IpReachabilityEvent.java
+++ b/core/java/android/net/metrics/IpReachabilityEvent.java
@@ -74,7 +74,7 @@
     }
 
     /** @hide */
-    public static final Parcelable.Creator<IpReachabilityEvent> CREATOR
+    public static final @android.annotation.NonNull Parcelable.Creator<IpReachabilityEvent> CREATOR
         = new Parcelable.Creator<IpReachabilityEvent>() {
         public IpReachabilityEvent createFromParcel(Parcel in) {
             return new IpReachabilityEvent(in);
diff --git a/core/java/android/net/metrics/NetworkEvent.java b/core/java/android/net/metrics/NetworkEvent.java
index f5b2ff1..ed58843 100644
--- a/core/java/android/net/metrics/NetworkEvent.java
+++ b/core/java/android/net/metrics/NetworkEvent.java
@@ -101,7 +101,7 @@
     }
 
     /** @hide */
-    public static final Parcelable.Creator<NetworkEvent> CREATOR
+    public static final @android.annotation.NonNull Parcelable.Creator<NetworkEvent> CREATOR
         = new Parcelable.Creator<NetworkEvent>() {
         public NetworkEvent createFromParcel(Parcel in) {
             return new NetworkEvent(in);
diff --git a/core/java/android/net/metrics/RaEvent.java b/core/java/android/net/metrics/RaEvent.java
index 04a2e6e..0d43f12 100644
--- a/core/java/android/net/metrics/RaEvent.java
+++ b/core/java/android/net/metrics/RaEvent.java
@@ -97,7 +97,7 @@
     }
 
     /** @hide */
-    public static final Parcelable.Creator<RaEvent> CREATOR = new Parcelable.Creator<RaEvent>() {
+    public static final @android.annotation.NonNull Parcelable.Creator<RaEvent> CREATOR = new Parcelable.Creator<RaEvent>() {
         public RaEvent createFromParcel(Parcel in) {
             return new RaEvent(in);
         }
diff --git a/core/java/android/net/metrics/ValidationProbeEvent.java b/core/java/android/net/metrics/ValidationProbeEvent.java
index a43dc60..052758d 100644
--- a/core/java/android/net/metrics/ValidationProbeEvent.java
+++ b/core/java/android/net/metrics/ValidationProbeEvent.java
@@ -133,7 +133,7 @@
     }
 
     /** @hide */
-    public static final Parcelable.Creator<ValidationProbeEvent> CREATOR
+    public static final @android.annotation.NonNull Parcelable.Creator<ValidationProbeEvent> CREATOR
         = new Parcelable.Creator<ValidationProbeEvent>() {
         public ValidationProbeEvent createFromParcel(Parcel in) {
             return new ValidationProbeEvent(in);
diff --git a/core/java/android/net/nsd/DnsSdTxtRecord.java b/core/java/android/net/nsd/DnsSdTxtRecord.java
index 2f20d44..e4a91c5 100644
--- a/core/java/android/net/nsd/DnsSdTxtRecord.java
+++ b/core/java/android/net/nsd/DnsSdTxtRecord.java
@@ -310,7 +310,7 @@
     }
 
     /** Implement the Parcelable interface */
-    public static final Creator<DnsSdTxtRecord> CREATOR =
+    public static final @android.annotation.NonNull Creator<DnsSdTxtRecord> CREATOR =
         new Creator<DnsSdTxtRecord>() {
             public DnsSdTxtRecord createFromParcel(Parcel in) {
                 DnsSdTxtRecord info = new DnsSdTxtRecord();
diff --git a/core/java/android/net/nsd/NsdServiceInfo.java b/core/java/android/net/nsd/NsdServiceInfo.java
index 9ba17ed..459b140 100644
--- a/core/java/android/net/nsd/NsdServiceInfo.java
+++ b/core/java/android/net/nsd/NsdServiceInfo.java
@@ -355,7 +355,7 @@
     }
 
     /** Implement the Parcelable interface */
-    public static final Creator<NsdServiceInfo> CREATOR =
+    public static final @android.annotation.NonNull Creator<NsdServiceInfo> CREATOR =
         new Creator<NsdServiceInfo>() {
             public NsdServiceInfo createFromParcel(Parcel in) {
                 NsdServiceInfo info = new NsdServiceInfo();
diff --git a/core/java/android/net/util/SocketUtils.java b/core/java/android/net/util/SocketUtils.java
index fbb15ed..5827f9e 100644
--- a/core/java/android/net/util/SocketUtils.java
+++ b/core/java/android/net/util/SocketUtils.java
@@ -19,6 +19,8 @@
 import static android.system.OsConstants.SOL_SOCKET;
 import static android.system.OsConstants.SO_BINDTODEVICE;
 
+import android.annotation.NonNull;
+import android.annotation.Nullable;
 import android.annotation.SystemApi;
 import android.annotation.TestApi;
 import android.net.MacAddress;
@@ -49,7 +51,7 @@
      *
      * <p>Data sent through the socket will go directly to the underlying network, ignoring VPNs.
      */
-    public static void bindSocketToInterface(FileDescriptor socket, String iface)
+    public static void bindSocketToInterface(@NonNull FileDescriptor socket, @NonNull String iface)
             throws ErrnoException {
         // SO_BINDTODEVICE actually takes a string. This works because the first member
         // of struct ifreq is a NULL-terminated interface name.
@@ -75,7 +77,7 @@
     /**
      * Make a socket address that packet socket can send packets to.
      */
-    public static SocketAddress makePacketSocketAddress(int ifIndex, byte[] hwAddr) {
+    public static SocketAddress makePacketSocketAddress(int ifIndex, @NonNull byte[] hwAddr) {
         return new PacketSocketAddress(ifIndex, hwAddr);
     }
 
@@ -83,45 +85,21 @@
      * Set an option on a socket that takes a time value argument.
      */
     public static void setSocketTimeValueOption(
-            FileDescriptor fd, int level, int option, long millis) throws ErrnoException {
+            @NonNull FileDescriptor fd, int level, int option, long millis) throws ErrnoException {
         Os.setsockoptTimeval(fd, level, option, StructTimeval.fromMillis(millis));
     }
 
     /**
-     * Bind a socket to the specified address.
-     */
-    public static void bindSocket(FileDescriptor fd, SocketAddress addr)
-            throws ErrnoException, SocketException {
-        Os.bind(fd, addr);
-    }
-
-    /**
-     * Connect a socket to the specified address.
-     */
-    public static void connectSocket(FileDescriptor fd, SocketAddress addr)
-            throws ErrnoException, SocketException {
-        Os.connect(fd, addr);
-    }
-
-    /**
-     * Send a message on a socket, using the specified SocketAddress.
-     */
-    public static void sendTo(FileDescriptor fd, byte[] bytes, int byteOffset, int byteCount,
-            int flags, SocketAddress addr) throws ErrnoException, SocketException {
-        Os.sendto(fd, bytes, byteOffset, byteCount, flags, addr);
-    }
-
-    /**
      * @see IoBridge#closeAndSignalBlockedThreads(FileDescriptor)
      */
-    public static void closeSocket(FileDescriptor fd) throws IOException {
+    public static void closeSocket(@Nullable FileDescriptor fd) throws IOException {
         IoBridge.closeAndSignalBlockedThreads(fd);
     }
 
     /**
      * Attaches a socket filter that accepts DHCP packets to the given socket.
      */
-    public static void attachDhcpFilter(FileDescriptor fd) throws SocketException {
+    public static void attachDhcpFilter(@NonNull FileDescriptor fd) throws SocketException {
         NetworkUtils.attachDhcpFilter(fd);
     }
 
@@ -130,7 +108,8 @@
      * @param fd the socket's {@link FileDescriptor}.
      * @param packetType the hardware address type, one of ARPHRD_*.
      */
-    public static void attachRaFilter(FileDescriptor fd, int packetType) throws SocketException {
+    public static void attachRaFilter(@NonNull FileDescriptor fd, int packetType)
+            throws SocketException {
         NetworkUtils.attachRaFilter(fd, packetType);
     }
 
@@ -142,7 +121,7 @@
      * @param fd the socket's {@link FileDescriptor}.
      * @param packetType the hardware address type, one of ARPHRD_*.
      */
-    public static void attachControlPacketFilter(FileDescriptor fd, int packetType)
+    public static void attachControlPacketFilter(@NonNull FileDescriptor fd, int packetType)
             throws SocketException {
         NetworkUtils.attachControlPacketFilter(fd, packetType);
     }
@@ -150,8 +129,8 @@
     /**
      * Add an entry into the ARP cache.
      */
-    public static void addArpEntry(Inet4Address ipv4Addr, MacAddress ethAddr, String ifname,
-            FileDescriptor fd) throws IOException {
+    public static void addArpEntry(@NonNull Inet4Address ipv4Addr, @NonNull MacAddress ethAddr,
+            @NonNull String ifname, @NonNull FileDescriptor fd) throws IOException {
         NetworkUtils.addArpEntry(ipv4Addr, ethAddr, ifname, fd);
     }
 
diff --git a/core/java/android/nfc/ApduList.java b/core/java/android/nfc/ApduList.java
index 85b0547..027141d 100644
--- a/core/java/android/nfc/ApduList.java
+++ b/core/java/android/nfc/ApduList.java
@@ -24,7 +24,7 @@
         return commands;
     }
 
-    public static final Parcelable.Creator<ApduList> CREATOR =
+    public static final @android.annotation.NonNull Parcelable.Creator<ApduList> CREATOR =
         new Parcelable.Creator<ApduList>() {
         @Override
         public ApduList createFromParcel(Parcel in) {
diff --git a/core/java/android/nfc/BeamShareData.java b/core/java/android/nfc/BeamShareData.java
index 918ec3d..ed3b74a 100644
--- a/core/java/android/nfc/BeamShareData.java
+++ b/core/java/android/nfc/BeamShareData.java
@@ -42,7 +42,7 @@
         dest.writeInt(this.flags);
     }
 
-    public static final Parcelable.Creator<BeamShareData> CREATOR =
+    public static final @android.annotation.NonNull Parcelable.Creator<BeamShareData> CREATOR =
             new Parcelable.Creator<BeamShareData>() {
         @Override
         public BeamShareData createFromParcel(Parcel source) {
diff --git a/core/java/android/nfc/INfcAdapterExtras.aidl b/core/java/android/nfc/INfcAdapterExtras.aidl
index 41ebf63..dd260bc 100644
--- a/core/java/android/nfc/INfcAdapterExtras.aidl
+++ b/core/java/android/nfc/INfcAdapterExtras.aidl
@@ -23,11 +23,18 @@
  * {@hide}
  */
 interface INfcAdapterExtras {
+    @UnsupportedAppUsage
     Bundle open(in String pkg, IBinder b);
+    @UnsupportedAppUsage
     Bundle close(in String pkg, IBinder b);
+    @UnsupportedAppUsage
     Bundle transceive(in String pkg, in byte[] data_in);
+    @UnsupportedAppUsage
     int getCardEmulationRoute(in String pkg);
+    @UnsupportedAppUsage
     void setCardEmulationRoute(in String pkg, int route);
+    @UnsupportedAppUsage
     void authenticate(in String pkg, in byte[] token);
+    @UnsupportedAppUsage
     String getDriverName(in String pkg);
 }
diff --git a/core/java/android/nfc/NdefMessage.java b/core/java/android/nfc/NdefMessage.java
index 0bb1108..57d79c8 100644
--- a/core/java/android/nfc/NdefMessage.java
+++ b/core/java/android/nfc/NdefMessage.java
@@ -213,7 +213,7 @@
         dest.writeTypedArray(mRecords, flags);
     }
 
-    public static final Parcelable.Creator<NdefMessage> CREATOR =
+    public static final @android.annotation.NonNull Parcelable.Creator<NdefMessage> CREATOR =
             new Parcelable.Creator<NdefMessage>() {
         @Override
         public NdefMessage createFromParcel(Parcel in) {
diff --git a/core/java/android/nfc/NdefRecord.java b/core/java/android/nfc/NdefRecord.java
index b0090ca..5044a86 100644
--- a/core/java/android/nfc/NdefRecord.java
+++ b/core/java/android/nfc/NdefRecord.java
@@ -992,7 +992,7 @@
         dest.writeByteArray(mPayload);
     }
 
-    public static final Parcelable.Creator<NdefRecord> CREATOR =
+    public static final @android.annotation.NonNull Parcelable.Creator<NdefRecord> CREATOR =
             new Parcelable.Creator<NdefRecord>() {
         @Override
         public NdefRecord createFromParcel(Parcel in) {
diff --git a/core/java/android/nfc/NfcAdapter.java b/core/java/android/nfc/NfcAdapter.java
index a7d2ee9..8970c62 100644
--- a/core/java/android/nfc/NfcAdapter.java
+++ b/core/java/android/nfc/NfcAdapter.java
@@ -1704,11 +1704,12 @@
     /**
      * Sets Secure NFC feature.
      * <p>This API is for the Settings application.
+     * @return True if successful
      * @hide
      */
     @SystemApi
     @RequiresPermission(android.Manifest.permission.WRITE_SECURE_SETTINGS)
-    public boolean setNfcSecure(boolean enable) {
+    public boolean enableSecureNfc(boolean enable) {
         if (!sHasNfcFeature) {
             throw new UnsupportedOperationException();
         }
@@ -1726,7 +1727,7 @@
      * @return True if device supports Secure NFC, false otherwise
      * @throws UnsupportedOperationException if FEATURE_NFC is unavailable.
      */
-    public boolean deviceSupportsNfcSecure() {
+    public boolean isSecureNfcSupported() {
         if (!sHasNfcFeature) {
             throw new UnsupportedOperationException();
         }
@@ -1741,12 +1742,12 @@
     /**
      * Checks Secure NFC feature is enabled.
      *
-     * @return True if device supports Secure NFC is enabled, false otherwise
+     * @return True if Secure NFC is enabled, false otherwise
      * @throws UnsupportedOperationException if FEATURE_NFC is unavailable.
      * @throws UnsupportedOperationException if device doesn't support
-     *         Secure NFC functionality. {@link #deviceSupportsNfcSecure}
+     *         Secure NFC functionality. {@link #isSecureNfcSupported}
      */
-    public boolean isNfcSecureEnabled() {
+    public boolean isSecureNfcEnabled() {
         if (!sHasNfcFeature) {
             throw new UnsupportedOperationException();
         }
diff --git a/core/java/android/nfc/Tag.java b/core/java/android/nfc/Tag.java
index ce684cf..5a4c465 100644
--- a/core/java/android/nfc/Tag.java
+++ b/core/java/android/nfc/Tag.java
@@ -421,7 +421,7 @@
         }
     }
 
-    public static final Parcelable.Creator<Tag> CREATOR =
+    public static final @android.annotation.NonNull Parcelable.Creator<Tag> CREATOR =
             new Parcelable.Creator<Tag>() {
         @Override
         public Tag createFromParcel(Parcel in) {
diff --git a/core/java/android/nfc/TechListParcel.java b/core/java/android/nfc/TechListParcel.java
index 396f0f1..90645dd 100644
--- a/core/java/android/nfc/TechListParcel.java
+++ b/core/java/android/nfc/TechListParcel.java
@@ -47,7 +47,7 @@
         }
     }
 
-    public static final Creator<TechListParcel> CREATOR = new Creator<TechListParcel>() {
+    public static final @android.annotation.NonNull Creator<TechListParcel> CREATOR = new Creator<TechListParcel>() {
         @Override
         public TechListParcel createFromParcel(Parcel source) {
             int count = source.readInt();
diff --git a/core/java/android/nfc/TransceiveResult.java b/core/java/android/nfc/TransceiveResult.java
index 3538825..7992094 100644
--- a/core/java/android/nfc/TransceiveResult.java
+++ b/core/java/android/nfc/TransceiveResult.java
@@ -67,7 +67,7 @@
         }
     }
 
-    public static final Parcelable.Creator<TransceiveResult> CREATOR =
+    public static final @android.annotation.NonNull Parcelable.Creator<TransceiveResult> CREATOR =
             new Parcelable.Creator<TransceiveResult>() {
         @Override
         public TransceiveResult createFromParcel(Parcel in) {
diff --git a/core/java/android/nfc/cardemulation/AidGroup.java b/core/java/android/nfc/cardemulation/AidGroup.java
index 63776c4..77b5552 100644
--- a/core/java/android/nfc/cardemulation/AidGroup.java
+++ b/core/java/android/nfc/cardemulation/AidGroup.java
@@ -132,7 +132,7 @@
     }
 
     @UnsupportedAppUsage
-    public static final Parcelable.Creator<AidGroup> CREATOR =
+    public static final @android.annotation.NonNull Parcelable.Creator<AidGroup> CREATOR =
             new Parcelable.Creator<AidGroup>() {
 
         @Override
diff --git a/core/java/android/nfc/cardemulation/ApduServiceInfo.java b/core/java/android/nfc/cardemulation/ApduServiceInfo.java
index 911ec84..6f9858c 100644
--- a/core/java/android/nfc/cardemulation/ApduServiceInfo.java
+++ b/core/java/android/nfc/cardemulation/ApduServiceInfo.java
@@ -540,7 +540,7 @@
     };
 
     @UnsupportedAppUsage
-    public static final Parcelable.Creator<ApduServiceInfo> CREATOR =
+    public static final @android.annotation.NonNull Parcelable.Creator<ApduServiceInfo> CREATOR =
             new Parcelable.Creator<ApduServiceInfo>() {
         @Override
         public ApduServiceInfo createFromParcel(Parcel source) {
diff --git a/core/java/android/nfc/cardemulation/CardEmulation.java b/core/java/android/nfc/cardemulation/CardEmulation.java
index 01932ab..f23dc2d 100644
--- a/core/java/android/nfc/cardemulation/CardEmulation.java
+++ b/core/java/android/nfc/cardemulation/CardEmulation.java
@@ -16,6 +16,7 @@
 
 package android.nfc.cardemulation;
 
+import android.annotation.NonNull;
 import android.annotation.SdkConstant;
 import android.annotation.SdkConstant.SdkConstantType;
 import android.app.Activity;
@@ -359,7 +360,7 @@
      * @param service The component name of the service
      * @return whether the registration was successful.
      */
-    public boolean unsetOffHostForService(ComponentName service) {
+    public boolean unsetOffHostForService(@NonNull ComponentName service) {
         NfcAdapter adapter = NfcAdapter.getDefaultAdapter(mContext);
         if (adapter == null) {
             return false;
@@ -405,7 +406,8 @@
      * @param offHostSecureElement Secure Element to register the AID to
      * @return whether the registration was successful.
      */
-    public boolean setOffHostForService(ComponentName service, String offHostSecureElement) {
+    public boolean setOffHostForService(@NonNull ComponentName service,
+            @NonNull String offHostSecureElement) {
         boolean validSecureElement = false;
 
         NfcAdapter adapter = NfcAdapter.getDefaultAdapter(mContext);
diff --git a/core/java/android/nfc/cardemulation/NfcFServiceInfo.java b/core/java/android/nfc/cardemulation/NfcFServiceInfo.java
index 1d3f9c2..bda14299 100644
--- a/core/java/android/nfc/cardemulation/NfcFServiceInfo.java
+++ b/core/java/android/nfc/cardemulation/NfcFServiceInfo.java
@@ -289,7 +289,7 @@
         dest.writeString(mT3tPmm);
     };
 
-    public static final Parcelable.Creator<NfcFServiceInfo> CREATOR =
+    public static final @android.annotation.NonNull Parcelable.Creator<NfcFServiceInfo> CREATOR =
             new Parcelable.Creator<NfcFServiceInfo>() {
         @Override
         public NfcFServiceInfo createFromParcel(Parcel source) {
diff --git a/core/java/android/os/BatteryProperty.java b/core/java/android/os/BatteryProperty.java
index b7e7b17..b40988a 100644
--- a/core/java/android/os/BatteryProperty.java
+++ b/core/java/android/os/BatteryProperty.java
@@ -67,7 +67,7 @@
         p.writeLong(mValueLong);
     }
 
-    public static final Parcelable.Creator<BatteryProperty> CREATOR
+    public static final @android.annotation.NonNull Parcelable.Creator<BatteryProperty> CREATOR
         = new Parcelable.Creator<BatteryProperty>() {
         public BatteryProperty createFromParcel(Parcel p) {
             return new BatteryProperty(p);
diff --git a/core/java/android/os/BatterySaverPolicyConfig.java b/core/java/android/os/BatterySaverPolicyConfig.java
index a107a7a..bda4e27 100644
--- a/core/java/android/os/BatterySaverPolicyConfig.java
+++ b/core/java/android/os/BatterySaverPolicyConfig.java
@@ -111,7 +111,7 @@
                 Math.min(in.readInt(), PowerManager.MAX_LOCATION_MODE));
     }
 
-    public static final Creator<BatterySaverPolicyConfig> CREATOR =
+    public static final @android.annotation.NonNull Creator<BatterySaverPolicyConfig> CREATOR =
             new Creator<BatterySaverPolicyConfig>() {
                 @Override
                 public BatterySaverPolicyConfig createFromParcel(Parcel in) {
@@ -476,10 +476,6 @@
          */
         @NonNull
         public BatterySaverPolicyConfig build() {
-            if (!mEnableAdjustBrightness && Float.compare(1f, mAdjustBrightnessFactor) != 0) {
-                throw new IllegalArgumentException("Brightness adjustment factor changed without "
-                        + "enabling brightness adjustment");
-            }
             return new BatterySaverPolicyConfig(this);
         }
     }
diff --git a/core/java/android/os/Binder.java b/core/java/android/os/Binder.java
index b28c2f4..d5ef249 100644
--- a/core/java/android/os/Binder.java
+++ b/core/java/android/os/Binder.java
@@ -653,7 +653,8 @@
          *
          * @return an object that will be passed back to #onTransactEnded (or null).
          */
-        Object onTransactStarted(IBinder binder, int transactionCode);
+        @Nullable
+        Object onTransactStarted(@NonNull IBinder binder, int transactionCode);
 
         /**
          * Called after onTranact (even when an exception is thrown).
diff --git a/core/java/android/os/BugreportManager.java b/core/java/android/os/BugreportManager.java
index 684369a..672624c 100644
--- a/core/java/android/os/BugreportManager.java
+++ b/core/java/android/os/BugreportManager.java
@@ -17,6 +17,7 @@
 package android.os;
 
 import android.annotation.CallbackExecutor;
+import android.annotation.FloatRange;
 import android.annotation.IntDef;
 import android.annotation.NonNull;
 import android.annotation.Nullable;
@@ -39,7 +40,7 @@
  */
 @SystemApi
 @SystemService(Context.BUGREPORT_SERVICE)
-public class BugreportManager {
+public final class BugreportManager {
     private final Context mContext;
     private final IDumpstate mBinder;
 
@@ -90,7 +91,7 @@
          * Called when there is a progress update.
          * @param progress the progress in [0.0, 100.0]
          */
-        public void onProgress(float progress) {}
+        public void onProgress(@FloatRange(from = 0f, to = 100f) float progress) {}
 
         /**
          * Called when taking bugreport resulted in an error.
diff --git a/core/java/android/os/BugreportParams.java b/core/java/android/os/BugreportParams.java
index 3871375..279ccae 100644
--- a/core/java/android/os/BugreportParams.java
+++ b/core/java/android/os/BugreportParams.java
@@ -41,6 +41,7 @@
 
     /**
      * Defines acceptable types of bugreports.
+     * @hide
      */
     @Retention(RetentionPolicy.SOURCE)
     @IntDef(prefix = { "BUGREPORT_MODE_" }, value = {
diff --git a/core/java/android/os/Bundle.java b/core/java/android/os/Bundle.java
index 7ae5a67..8e6a554 100644
--- a/core/java/android/os/Bundle.java
+++ b/core/java/android/os/Bundle.java
@@ -1196,7 +1196,7 @@
         }
     }
 
-    public static final Parcelable.Creator<Bundle> CREATOR =
+    public static final @android.annotation.NonNull Parcelable.Creator<Bundle> CREATOR =
         new Parcelable.Creator<Bundle>() {
         @Override
         public Bundle createFromParcel(Parcel in) {
diff --git a/core/java/android/os/CpuUsageInfo.java b/core/java/android/os/CpuUsageInfo.java
index 54caa15..444579f 100644
--- a/core/java/android/os/CpuUsageInfo.java
+++ b/core/java/android/os/CpuUsageInfo.java
@@ -23,7 +23,7 @@
     private long mActive;
     private long mTotal;
 
-    public static final Parcelable.Creator<CpuUsageInfo> CREATOR = new
+    public static final @android.annotation.NonNull Parcelable.Creator<CpuUsageInfo> CREATOR = new
             Parcelable.Creator<CpuUsageInfo>() {
                     public CpuUsageInfo createFromParcel(Parcel in) {
                         return new CpuUsageInfo(in);
diff --git a/core/java/android/os/Debug.java b/core/java/android/os/Debug.java
index 149ef54..a395ed4 100644
--- a/core/java/android/os/Debug.java
+++ b/core/java/android/os/Debug.java
@@ -859,7 +859,7 @@
             otherStats = source.createIntArray();
         }
 
-        public static final Creator<MemoryInfo> CREATOR = new Creator<MemoryInfo>() {
+        public static final @android.annotation.NonNull Creator<MemoryInfo> CREATOR = new Creator<MemoryInfo>() {
             public MemoryInfo createFromParcel(Parcel source) {
                 return new MemoryInfo(source);
             }
diff --git a/core/java/android/os/DropBoxManager.java b/core/java/android/os/DropBoxManager.java
index eeae25e..1be7b6b 100644
--- a/core/java/android/os/DropBoxManager.java
+++ b/core/java/android/os/DropBoxManager.java
@@ -227,7 +227,7 @@
             return (mFlags & IS_GZIPPED) != 0 ? new GZIPInputStream(is) : is;
         }
 
-        public static final Parcelable.Creator<Entry> CREATOR = new Parcelable.Creator() {
+        public static final @android.annotation.NonNull Parcelable.Creator<Entry> CREATOR = new Parcelable.Creator() {
             public Entry[] newArray(int size) { return new Entry[size]; }
             public Entry createFromParcel(Parcel in) {
                 String tag = in.readString();
diff --git a/core/java/android/os/Environment.java b/core/java/android/os/Environment.java
index 0aed981..fea69c0 100644
--- a/core/java/android/os/Environment.java
+++ b/core/java/android/os/Environment.java
@@ -16,6 +16,7 @@
 
 package android.os;
 
+import android.annotation.NonNull;
 import android.annotation.SystemApi;
 import android.annotation.TestApi;
 import android.app.admin.DevicePolicyManager;
@@ -155,13 +156,13 @@
      * Return root of the "system" partition holding the core Android OS.
      * Always present and mounted read-only.
      */
-    public static File getRootDirectory() {
+    public static @NonNull File getRootDirectory() {
         return DIR_ANDROID_ROOT;
     }
 
     /** {@hide} */
     @TestApi
-    public static File getStorageDirectory() {
+    public static @NonNull File getStorageDirectory() {
         return DIR_ANDROID_STORAGE;
     }
 
@@ -172,7 +173,7 @@
      * @hide
      */
     @SystemApi
-    public static File getOemDirectory() {
+    public static @NonNull File getOemDirectory() {
         return DIR_OEM_ROOT;
     }
 
@@ -183,7 +184,7 @@
      * @hide
      */
     @SystemApi
-    public static File getOdmDirectory() {
+    public static @NonNull File getOdmDirectory() {
         return DIR_ODM_ROOT;
     }
 
@@ -193,7 +194,7 @@
      * @hide
      */
     @SystemApi
-    public static File getVendorDirectory() {
+    public static @NonNull File getVendorDirectory() {
         return DIR_VENDOR_ROOT;
     }
 
@@ -205,7 +206,7 @@
      */
     @SystemApi
     @TestApi
-    public static File getProductDirectory() {
+    public static @NonNull File getProductDirectory() {
         return DIR_PRODUCT_ROOT;
     }
 
@@ -216,7 +217,7 @@
      * @hide
      */
     @SystemApi
-    public static File getProductServicesDirectory() {
+    public static @NonNull File getProductServicesDirectory() {
         return DIR_PRODUCT_SERVICES_ROOT;
     }
 
@@ -388,7 +389,7 @@
 
     /** {@hide} */
     public static File getDataStagingDirectory(String volumeUuid) {
-        return new File(getDataDirectory(volumeUuid), "pkg_staging");
+        return new File(getDataDirectory(volumeUuid), "app-staging");
     }
 
     /** {@hide} */
diff --git a/core/java/android/os/ExternalVibration.java b/core/java/android/os/ExternalVibration.java
index 69ab1d9..b93bef8 100644
--- a/core/java/android/os/ExternalVibration.java
+++ b/core/java/android/os/ExternalVibration.java
@@ -156,7 +156,7 @@
         return 0;
     }
 
-    public static final Parcelable.Creator<ExternalVibration> CREATOR =
+    public static final @android.annotation.NonNull Parcelable.Creator<ExternalVibration> CREATOR =
             new Parcelable.Creator<ExternalVibration>() {
                 @Override
                 public ExternalVibration createFromParcel(Parcel in) {
diff --git a/core/java/android/os/GraphicsEnvironment.java b/core/java/android/os/GraphicsEnvironment.java
index 650d217..39e9138 100644
--- a/core/java/android/os/GraphicsEnvironment.java
+++ b/core/java/android/os/GraphicsEnvironment.java
@@ -16,6 +16,8 @@
 
 package android.os;
 
+import android.app.Activity;
+import android.content.BroadcastReceiver;
 import android.content.ContentResolver;
 import android.content.Context;
 import android.content.Intent;
@@ -65,6 +67,9 @@
     private static final String ANGLE_RULES_FILE = "a4a_rules.json";
     private static final String ANGLE_TEMP_RULES = "debug.angle.rules";
     private static final String ACTION_ANGLE_FOR_ANDROID = "android.app.action.ANGLE_FOR_ANDROID";
+    private static final String ACTION_ANGLE_FOR_ANDROID_TOAST_MESSAGE =
+            "android.app.action.ANGLE_FOR_ANDROID_TOAST_MESSAGE";
+    private static final String INTENT_KEY_A4A_TOAST_MESSAGE = "A4A Toast Message";
     private static final String GAME_DRIVER_WHITELIST_ALL = "*";
 
     private ClassLoader mClassLoader;
@@ -557,9 +562,20 @@
         final String packageName = context.getPackageName();
 
         if (shouldShowAngleInUseDialogBox(context) && shouldUseAngle(context, packageName)) {
-            final String toastMsg = packageName + " is using ANGLE";
-            final Toast toast = Toast.makeText(context, toastMsg, Toast.LENGTH_LONG);
-            toast.show();
+            final Intent intent = new Intent(ACTION_ANGLE_FOR_ANDROID_TOAST_MESSAGE);
+            String anglePkg = getAnglePackageName(context.getPackageManager());
+            intent.setPackage(anglePkg);
+
+            context.sendOrderedBroadcast(intent, null, new BroadcastReceiver() {
+                @Override
+                public void onReceive(Context context, Intent intent) {
+                    Bundle results = getResultExtras(true);
+
+                    String toastMsg = results.getString(INTENT_KEY_A4A_TOAST_MESSAGE);
+                    final Toast toast = Toast.makeText(context, toastMsg, Toast.LENGTH_LONG);
+                    toast.show();
+                }
+            }, null, Activity.RESULT_OK, null, null);
         }
     }
 
diff --git a/core/java/android/os/Handler.java b/core/java/android/os/Handler.java
index e6c12c7..a039742 100644
--- a/core/java/android/os/Handler.java
+++ b/core/java/android/os/Handler.java
@@ -82,19 +82,19 @@
          * @param msg A {@link android.os.Message Message} object
          * @return True if no further handling is desired
          */
-        public boolean handleMessage(Message msg);
+        boolean handleMessage(@NonNull Message msg);
     }
     
     /**
      * Subclasses must implement this to receive messages.
      */
-    public void handleMessage(Message msg) {
+    public void handleMessage(@NonNull Message msg) {
     }
     
     /**
      * Handle system messages here.
      */
-    public void dispatchMessage(Message msg) {
+    public void dispatchMessage(@NonNull Message msg) {
         if (msg.callback != null) {
             handleCallback(msg);
         } else {
@@ -128,7 +128,7 @@
      *
      * @param callback The callback interface in which to handle messages, or null.
      */
-    public Handler(Callback callback) {
+    public Handler(@Nullable Callback callback) {
         this(callback, false);
     }
 
@@ -137,7 +137,7 @@
      *
      * @param looper The looper, must not be null.
      */
-    public Handler(Looper looper) {
+    public Handler(@NonNull Looper looper) {
         this(looper, null, false);
     }
 
@@ -148,7 +148,7 @@
      * @param looper The looper, must not be null.
      * @param callback The callback interface in which to handle messages, or null.
      */
-    public Handler(Looper looper, Callback callback) {
+    public Handler(@NonNull Looper looper, @Nullable Callback callback) {
         this(looper, callback, false);
     }
 
@@ -189,7 +189,7 @@
      *
      * @hide
      */
-    public Handler(Callback callback, boolean async) {
+    public Handler(@Nullable Callback callback, boolean async) {
         if (FIND_POTENTIAL_LEAKS) {
             final Class<? extends Handler> klass = getClass();
             if ((klass.isAnonymousClass() || klass.isMemberClass() || klass.isLocalClass()) &&
@@ -229,7 +229,7 @@
      *
      * @hide
      */
-    public Handler(Looper looper, Callback callback, boolean async) {
+    public Handler(@NonNull Looper looper, @Nullable Callback callback, boolean async) {
         mLooper = looper;
         mQueue = looper.mQueue;
         mCallback = callback;
@@ -289,7 +289,8 @@
     }
 
     /** {@hide} */
-    public String getTraceName(Message message) {
+    @NonNull
+    public String getTraceName(@NonNull Message message) {
         final StringBuilder sb = new StringBuilder();
         sb.append(getClass().getName()).append(": ");
         if (message.callback != null) {
@@ -308,7 +309,8 @@
      *  
      * @param message The message whose name is being queried 
      */
-    public String getMessageName(Message message) {
+    @NonNull
+    public String getMessageName(@NonNull Message message) {
         if (message.callback != null) {
             return message.callback.getClass().getName();
         }
@@ -320,6 +322,7 @@
      * creating and allocating new instances. The retrieved message has its handler set to this instance (Message.target == this).
      *  If you don't want that facility, just call Message.obtain() instead.
      */
+    @NonNull
     public final Message obtainMessage()
     {
         return Message.obtain(this);
@@ -331,6 +334,7 @@
      * @param what Value to assign to the returned Message.what field.
      * @return A Message from the global message pool.
      */
+    @NonNull
     public final Message obtainMessage(int what)
     {
         return Message.obtain(this, what);
@@ -345,8 +349,8 @@
      * @param obj Value to assign to the returned Message.obj field.
      * @return A Message from the global message pool.
      */
-    public final Message obtainMessage(int what, Object obj)
-    {
+    @NonNull
+    public final Message obtainMessage(int what, @Nullable Object obj) {
         return Message.obtain(this, what, obj);
     }
 
@@ -359,6 +363,7 @@
      * @param arg2 Value to assign to the returned Message.arg2 field.
      * @return A Message from the global message pool.
      */
+    @NonNull
     public final Message obtainMessage(int what, int arg1, int arg2)
     {
         return Message.obtain(this, what, arg1, arg2);
@@ -374,8 +379,8 @@
      * @param obj Value to assign to the returned Message.obj field.
      * @return A Message from the global message pool.
      */
-    public final Message obtainMessage(int what, int arg1, int arg2, Object obj)
-    {
+    @NonNull
+    public final Message obtainMessage(int what, int arg1, int arg2, @Nullable Object obj) {
         return Message.obtain(this, what, arg1, arg2, obj);
     }
 
@@ -390,8 +395,7 @@
      *         message queue.  Returns false on failure, usually because the
      *         looper processing the message queue is exiting.
      */
-    public final boolean post(Runnable r)
-    {
+    public final boolean post(@NonNull Runnable r) {
        return  sendMessageDelayed(getPostMessage(r), 0);
     }
     
@@ -413,8 +417,7 @@
      *         the looper is quit before the delivery time of the message
      *         occurs then the message will be dropped.
      */
-    public final boolean postAtTime(Runnable r, long uptimeMillis)
-    {
+    public final boolean postAtTime(@NonNull Runnable r, long uptimeMillis) {
         return sendMessageAtTime(getPostMessage(r), uptimeMillis);
     }
     
@@ -440,8 +443,8 @@
      *         
      * @see android.os.SystemClock#uptimeMillis
      */
-    public final boolean postAtTime(Runnable r, Object token, long uptimeMillis)
-    {
+    public final boolean postAtTime(
+            @NonNull Runnable r, @Nullable Object token, long uptimeMillis) {
         return sendMessageAtTime(getPostMessage(r, token), uptimeMillis);
     }
     
@@ -464,8 +467,7 @@
      *         if the looper is quit before the delivery time of the message
      *         occurs then the message will be dropped.
      */
-    public final boolean postDelayed(Runnable r, long delayMillis)
-    {
+    public final boolean postDelayed(@NonNull Runnable r, long delayMillis) {
         return sendMessageDelayed(getPostMessage(r), delayMillis);
     }
     
@@ -495,8 +497,8 @@
      *         if the looper is quit before the delivery time of the message
      *         occurs then the message will be dropped.
      */
-    public final boolean postDelayed(Runnable r, Object token, long delayMillis)
-    {
+    public final boolean postDelayed(
+            @NonNull Runnable r, @Nullable Object token, long delayMillis) {
         return sendMessageDelayed(getPostMessage(r, token), delayMillis);
     }
 
@@ -515,8 +517,7 @@
      *         message queue.  Returns false on failure, usually because the
      *         looper processing the message queue is exiting.
      */
-    public final boolean postAtFrontOfQueue(Runnable r)
-    {
+    public final boolean postAtFrontOfQueue(@NonNull Runnable r) {
         return sendMessageAtFrontOfQueue(getPostMessage(r));
     }
 
@@ -560,7 +561,7 @@
      * If we ever do make it part of the API, we might want to rename it to something
      * less funny like runUnsafe().
      */
-    public final boolean runWithScissors(final Runnable r, long timeout) {
+    public final boolean runWithScissors(@NonNull Runnable r, long timeout) {
         if (r == null) {
             throw new IllegalArgumentException("runnable must not be null");
         }
@@ -580,8 +581,7 @@
     /**
      * Remove any pending posts of Runnable r that are in the message queue.
      */
-    public final void removeCallbacks(Runnable r)
-    {
+    public final void removeCallbacks(@NonNull Runnable r) {
         mQueue.removeMessages(this, r, null);
     }
 
@@ -590,8 +590,7 @@
      * <var>token</var> that are in the message queue.  If <var>token</var> is null,
      * all callbacks will be removed.
      */
-    public final void removeCallbacks(Runnable r, Object token)
-    {
+    public final void removeCallbacks(@NonNull Runnable r, @Nullable Object token) {
         mQueue.removeMessages(this, r, token);
     }
 
@@ -604,8 +603,7 @@
      *         message queue.  Returns false on failure, usually because the
      *         looper processing the message queue is exiting.
      */
-    public final boolean sendMessage(Message msg)
-    {
+    public final boolean sendMessage(@NonNull Message msg) {
         return sendMessageDelayed(msg, 0);
     }
 
@@ -664,8 +662,7 @@
      *         the looper is quit before the delivery time of the message
      *         occurs then the message will be dropped.
      */
-    public final boolean sendMessageDelayed(Message msg, long delayMillis)
-    {
+    public final boolean sendMessageDelayed(@NonNull Message msg, long delayMillis) {
         if (delayMillis < 0) {
             delayMillis = 0;
         }
@@ -691,7 +688,7 @@
      *         the looper is quit before the delivery time of the message
      *         occurs then the message will be dropped.
      */
-    public boolean sendMessageAtTime(Message msg, long uptimeMillis) {
+    public boolean sendMessageAtTime(@NonNull Message msg, long uptimeMillis) {
         MessageQueue queue = mQueue;
         if (queue == null) {
             RuntimeException e = new RuntimeException(
@@ -714,7 +711,7 @@
      *         message queue.  Returns false on failure, usually because the
      *         looper processing the message queue is exiting.
      */
-    public final boolean sendMessageAtFrontOfQueue(Message msg) {
+    public final boolean sendMessageAtFrontOfQueue(@NonNull Message msg) {
         MessageQueue queue = mQueue;
         if (queue == null) {
             RuntimeException e = new RuntimeException(
@@ -734,7 +731,7 @@
      *         looper processing the message queue is exiting.
      * @hide
      */
-    public final boolean executeOrSendMessage(Message msg) {
+    public final boolean executeOrSendMessage(@NonNull Message msg) {
         if (mLooper == Looper.myLooper()) {
             dispatchMessage(msg);
             return true;
@@ -742,7 +739,8 @@
         return sendMessage(msg);
     }
 
-    private boolean enqueueMessage(MessageQueue queue, Message msg, long uptimeMillis) {
+    private boolean enqueueMessage(@NonNull MessageQueue queue, @NonNull Message msg,
+            long uptimeMillis) {
         msg.target = this;
         msg.workSourceUid = ThreadLocalWorkSource.getUid();
 
@@ -765,7 +763,7 @@
      * 'object' that are in the message queue.  If <var>object</var> is null,
      * all messages will be removed.
      */
-    public final void removeMessages(int what, Object object) {
+    public final void removeMessages(int what, @Nullable Object object) {
         mQueue.removeMessages(this, what, object);
     }
 
@@ -774,7 +772,7 @@
      * <var>obj</var> is <var>token</var>.  If <var>token</var> is null,
      * all callbacks and messages will be removed.
      */
-    public final void removeCallbacksAndMessages(Object token) {
+    public final void removeCallbacksAndMessages(@Nullable Object token) {
         mQueue.removeCallbacksAndMessages(this, token);
     }
 
@@ -798,7 +796,7 @@
      * Check if there are any pending posts of messages with code 'what' and
      * whose obj is 'object' in the message queue.
      */
-    public final boolean hasMessages(int what, Object object) {
+    public final boolean hasMessages(int what, @Nullable Object object) {
         return mQueue.hasMessages(this, what, object);
     }
 
@@ -806,17 +804,18 @@
      * Check if there are any pending posts of messages with callback r in
      * the message queue.
      */
-    public final boolean hasCallbacks(Runnable r) {
+    public final boolean hasCallbacks(@NonNull Runnable r) {
         return mQueue.hasMessages(this, r, null);
     }
 
     // if we can get rid of this method, the handler need not remember its loop
     // we could instead export a getMessageQueue() method... 
+    @NonNull
     public final Looper getLooper() {
         return mLooper;
     }
 
-    public final void dump(Printer pw, String prefix) {
+    public final void dump(@NonNull Printer pw, @NonNull String prefix) {
         pw.println(prefix + this + " @ " + SystemClock.uptimeMillis());
         if (mLooper == null) {
             pw.println(prefix + "looper uninitialized");
@@ -828,7 +827,7 @@
     /**
      * @hide
      */
-    public final void dumpMine(Printer pw, String prefix) {
+    public final void dumpMine(@NonNull Printer pw, @NonNull String prefix) {
         pw.println(prefix + this + " @ " + SystemClock.uptimeMillis());
         if (mLooper == null) {
             pw.println(prefix + "looper uninitialized");
diff --git a/core/java/android/os/HwBlob.java b/core/java/android/os/HwBlob.java
index 0ec63b5..2c453bf 100644
--- a/core/java/android/os/HwBlob.java
+++ b/core/java/android/os/HwBlob.java
@@ -17,6 +17,7 @@
 package android.os;
 
 import android.annotation.NonNull;
+import android.annotation.Nullable;
 import android.annotation.SystemApi;
 import android.annotation.TestApi;
 
@@ -241,7 +242,7 @@
      * @param x a {@link NativeHandle} instance to write
      * @throws IndexOutOfBoundsException when [offset, offset + sizeof(jobject)] is out of range
      */
-    public native final void putNativeHandle(long offset, NativeHandle x);
+    public native final void putNativeHandle(long offset, @Nullable NativeHandle x);
 
     /**
      * Put a boolean array contiguously at an offset in the blob.
diff --git a/core/java/android/os/HwParcel.java b/core/java/android/os/HwParcel.java
index 7919a00..dc640c9 100644
--- a/core/java/android/os/HwParcel.java
+++ b/core/java/android/os/HwParcel.java
@@ -17,6 +17,8 @@
 package android.os;
 
 import android.annotation.IntDef;
+import android.annotation.NonNull;
+import android.annotation.Nullable;
 import android.annotation.SystemApi;
 import android.annotation.TestApi;
 
@@ -123,7 +125,7 @@
      *
      * @param val to write
      */
-    public native final void writeNativeHandle(NativeHandle val);
+    public native final void writeNativeHandle(@Nullable NativeHandle val);
 
     /**
      * Writes an array of boolean values to the end of the parcel.
@@ -170,6 +172,9 @@
     private native final void writeStringVector(String[] val);
     /**
      * Writes an array of native handles to the end of the parcel.
+     *
+     * Individual elements may be null but not the whole array.
+     *
      * @param val array of {@link NativeHandle} objects to write
      */
     private native final void writeNativeHandleVector(NativeHandle[] val);
@@ -284,7 +289,7 @@
      * Helper method to write a list of native handles to the end of the parcel.
      * @param val list of {@link NativeHandle} objects to write
      */
-    public final void writeNativeHandleVector(ArrayList<NativeHandle> val) {
+    public final void writeNativeHandleVector(@NonNull ArrayList<NativeHandle> val) {
         writeNativeHandleVector(val.toArray(new NativeHandle[val.size()]));
     }
 
@@ -359,7 +364,7 @@
      * @return a {@link NativeHandle} instance parsed from the parcel
      * @throws IllegalArgumentException if the parcel has no more data
      */
-    public native final NativeHandle readNativeHandle();
+    public native final @Nullable NativeHandle readNativeHandle();
     /**
      * Reads an embedded native handle (without duplicating the underlying
      * file descriptors) from the parcel. These file descriptors will only
@@ -372,7 +377,7 @@
      * @return a {@link NativeHandle} instance parsed from the parcel
      * @throws IllegalArgumentException if the parcel has no more data
      */
-    public native final NativeHandle readEmbeddedNativeHandle(
+    public native final @Nullable NativeHandle readEmbeddedNativeHandle(
             long parentHandle, long offset);
 
     /**
@@ -521,7 +526,7 @@
      * @return array of {@link NativeHandle} objects.
      * @throws IllegalArgumentException if the parcel has no more data
      */
-    public final ArrayList<NativeHandle> readNativeHandleVector() {
+    public final @NonNull ArrayList<NativeHandle> readNativeHandleVector() {
         return new ArrayList<NativeHandle>(Arrays.asList(readNativeHandleAsArray()));
     }
 
diff --git a/core/java/android/os/IncidentManager.java b/core/java/android/os/IncidentManager.java
index a1c7b08..0bdf6f1 100644
--- a/core/java/android/os/IncidentManager.java
+++ b/core/java/android/os/IncidentManager.java
@@ -323,7 +323,7 @@
         /**
          * {@link Parcelable.Creator Creator} for {@link IncidentReport}.
          */
-        public static final Parcelable.Creator<IncidentReport> CREATOR = new Parcelable.Creator() {
+        public static final @android.annotation.NonNull Parcelable.Creator<IncidentReport> CREATOR = new Parcelable.Creator() {
             /**
              * @inheritDoc
              */
diff --git a/core/java/android/os/IncidentReportArgs.java b/core/java/android/os/IncidentReportArgs.java
index 8d44727..a1f2430 100644
--- a/core/java/android/os/IncidentReportArgs.java
+++ b/core/java/android/os/IncidentReportArgs.java
@@ -36,6 +36,8 @@
     private final ArrayList<byte[]> mHeaders = new ArrayList<byte[]>();
     private boolean mAll;
     private int mPrivacyPolicy;
+    private String mReceiverPkg;
+    private String mReceiverCls;
 
     /**
      * Construct an incident report args with no fields.
@@ -73,6 +75,10 @@
         }
 
         out.writeInt(mPrivacyPolicy);
+
+        out.writeString(mReceiverPkg);
+
+        out.writeString(mReceiverCls);
     }
 
     public void readFromParcel(Parcel in) {
@@ -91,9 +97,13 @@
         }
 
         mPrivacyPolicy = in.readInt();
+
+        mReceiverPkg = in.readString();
+
+        mReceiverCls = in.readString();
     }
 
-    public static final Parcelable.Creator<IncidentReportArgs> CREATOR
+    public static final @android.annotation.NonNull Parcelable.Creator<IncidentReportArgs> CREATOR
             = new Parcelable.Creator<IncidentReportArgs>() {
         public IncidentReportArgs createFromParcel(Parcel in) {
             return new IncidentReportArgs(in);
@@ -126,6 +136,8 @@
         sb.append(mHeaders.size());
         sb.append(" headers), ");
         sb.append("privacy: ").append(mPrivacyPolicy);
+        sb.append("receiver pkg: ").append(mReceiverPkg);
+        sb.append("receiver cls: ").append(mReceiverCls);
         return sb.toString();
     }
 
diff --git a/core/java/android/os/LocaleList.java b/core/java/android/os/LocaleList.java
index 1420e2f..a9da080 100644
--- a/core/java/android/os/LocaleList.java
+++ b/core/java/android/os/LocaleList.java
@@ -256,7 +256,7 @@
         mStringRepresentation = sb.toString();
     }
 
-    public static final Parcelable.Creator<LocaleList> CREATOR
+    public static final @android.annotation.NonNull Parcelable.Creator<LocaleList> CREATOR
             = new Parcelable.Creator<LocaleList>() {
         @Override
         public LocaleList createFromParcel(Parcel source) {
diff --git a/core/java/android/os/Message.java b/core/java/android/os/Message.java
index 5d5e5e2..317579e 100644
--- a/core/java/android/os/Message.java
+++ b/core/java/android/os/Message.java
@@ -595,7 +595,7 @@
         proto.end(messageToken);
     }
 
-    public static final Parcelable.Creator<Message> CREATOR
+    public static final @android.annotation.NonNull Parcelable.Creator<Message> CREATOR
             = new Parcelable.Creator<Message>() {
         public Message createFromParcel(Parcel source) {
             Message msg = Message.obtain();
diff --git a/core/java/android/os/Messenger.java b/core/java/android/os/Messenger.java
index f362f56..ed5c470 100644
--- a/core/java/android/os/Messenger.java
+++ b/core/java/android/os/Messenger.java
@@ -95,7 +95,7 @@
         out.writeStrongBinder(mTarget.asBinder());
     }
 
-    public static final Parcelable.Creator<Messenger> CREATOR
+    public static final @android.annotation.NonNull Parcelable.Creator<Messenger> CREATOR
             = new Parcelable.Creator<Messenger>() {
         public Messenger createFromParcel(Parcel in) {
             IBinder target = in.readStrongBinder();
diff --git a/core/java/android/os/NativeHandle.java b/core/java/android/os/NativeHandle.java
index f13bf5f..8d341b6 100644
--- a/core/java/android/os/NativeHandle.java
+++ b/core/java/android/os/NativeHandle.java
@@ -99,6 +99,8 @@
      * @return a boolean value
      */
     public boolean hasSingleFileDescriptor() {
+        checkOpen();
+
         return mFds.length == 1 && mInts.length == 0;
     }
 
@@ -108,7 +110,7 @@
      * If this method is called, this must also be explicitly closed with
      * {@link #close()}.
      */
-    public NativeHandle dup() throws java.io.IOException {
+    public @NonNull NativeHandle dup() throws java.io.IOException {
         FileDescriptor[] fds = new FileDescriptor[mFds.length];
         try {
             for (int i = 0; i < mFds.length; i++) {
@@ -123,6 +125,12 @@
         return new NativeHandle(fds, mInts, true /*own*/);
     }
 
+    private void checkOpen() {
+        if (mFds == null) {
+            throw new IllegalStateException("NativeHandle is invalidated after close.");
+        }
+    }
+
     /**
      * Closes the file descriptors if they are owned by this object.
      *
@@ -130,19 +138,20 @@
      */
     @Override
     public void close() throws java.io.IOException {
-        if (!mOwn) {
-            return;
-        }
+        checkOpen();
 
-        try {
-            for (FileDescriptor fd : mFds) {
-                Os.close(fd);
+        if (mOwn) {
+            try {
+                for (FileDescriptor fd : mFds) {
+                    Os.close(fd);
+                }
+            } catch (ErrnoException e) {
+                e.rethrowAsIOException();
             }
-        } catch (ErrnoException e) {
-            e.rethrowAsIOException();
+
+            mOwn = false;
         }
 
-        mOwn = false;
         mFds = null;
         mInts = null;
     }
@@ -154,7 +163,9 @@
      * @throws IllegalStateException if this object contains either zero or
      *         more than one file descriptor, or a non-empty data stream.
      */
-    public FileDescriptor getFileDescriptor() {
+    public @NonNull FileDescriptor getFileDescriptor() {
+        checkOpen();
+
         if (!hasSingleFileDescriptor()) {
             throw new IllegalStateException(
                     "NativeHandle is not single file descriptor. Contents must"
@@ -171,6 +182,8 @@
      * @hide
      */
     private int[] getFdsAsIntArray() {
+        checkOpen();
+
         int numFds = mFds.length;
         int[] fds = new int[numFds];
 
@@ -182,11 +195,13 @@
     }
 
     /**
-     * Fetch file descriptors.
+     * Fetch file descriptors
      *
      * @return the fds.
      */
-    public FileDescriptor[] getFileDescriptors() {
+    public @NonNull FileDescriptor[] getFileDescriptors() {
+        checkOpen();
+
         return mFds;
     }
 
@@ -195,7 +210,9 @@
      *
      * @return the opaque data stream.
      */
-    public int[] getInts() {
+    public @NonNull int[] getInts() {
+        checkOpen();
+
         return mInts;
     }
 }
diff --git a/core/java/android/os/ParcelFileDescriptor.java b/core/java/android/os/ParcelFileDescriptor.java
index d68eeed..7a8727c 100644
--- a/core/java/android/os/ParcelFileDescriptor.java
+++ b/core/java/android/os/ParcelFileDescriptor.java
@@ -1032,7 +1032,7 @@
         }
     }
 
-    public static final Parcelable.Creator<ParcelFileDescriptor> CREATOR
+    public static final @android.annotation.NonNull Parcelable.Creator<ParcelFileDescriptor> CREATOR
             = new Parcelable.Creator<ParcelFileDescriptor>() {
         @Override
         public ParcelFileDescriptor createFromParcel(Parcel in) {
diff --git a/core/java/android/os/ParcelUuid.java b/core/java/android/os/ParcelUuid.java
index 5b45ac2..cc50c89 100644
--- a/core/java/android/os/ParcelUuid.java
+++ b/core/java/android/os/ParcelUuid.java
@@ -109,7 +109,7 @@
        return (this.mUuid.equals(that.mUuid));
    }
 
-   public static final Parcelable.Creator<ParcelUuid> CREATOR =
+   public static final @android.annotation.NonNull Parcelable.Creator<ParcelUuid> CREATOR =
                new Parcelable.Creator<ParcelUuid>() {
         @UnsupportedAppUsage
         public ParcelUuid createFromParcel(Parcel source) {
diff --git a/core/java/android/os/ParcelableException.java b/core/java/android/os/ParcelableException.java
index 7f71905..81b9d15 100644
--- a/core/java/android/os/ParcelableException.java
+++ b/core/java/android/os/ParcelableException.java
@@ -76,7 +76,7 @@
         writeToParcel(dest, getCause());
     }
 
-    public static final Creator<ParcelableException> CREATOR = new Creator<ParcelableException>() {
+    public static final @android.annotation.NonNull Creator<ParcelableException> CREATOR = new Creator<ParcelableException>() {
         @Override
         public ParcelableException createFromParcel(Parcel source) {
             return new ParcelableException(readFromParcel(source));
diff --git a/core/java/android/os/PatternMatcher.java b/core/java/android/os/PatternMatcher.java
index 76b2142..ef03e8c 100644
--- a/core/java/android/os/PatternMatcher.java
+++ b/core/java/android/os/PatternMatcher.java
@@ -158,7 +158,7 @@
         mParsedPattern = src.createIntArray();
     }
     
-    public static final Parcelable.Creator<PatternMatcher> CREATOR
+    public static final @android.annotation.NonNull Parcelable.Creator<PatternMatcher> CREATOR
             = new Parcelable.Creator<PatternMatcher>() {
         public PatternMatcher createFromParcel(Parcel source) {
             return new PatternMatcher(source);
diff --git a/core/java/android/os/PersistableBundle.java b/core/java/android/os/PersistableBundle.java
index 40eceb8..6f1bf71 100644
--- a/core/java/android/os/PersistableBundle.java
+++ b/core/java/android/os/PersistableBundle.java
@@ -212,7 +212,7 @@
         }
     }
 
-    public static final Parcelable.Creator<PersistableBundle> CREATOR =
+    public static final @android.annotation.NonNull Parcelable.Creator<PersistableBundle> CREATOR =
             new Parcelable.Creator<PersistableBundle>() {
                 @Override
                 public PersistableBundle createFromParcel(Parcel in) {
diff --git a/core/java/android/os/PowerManager.java b/core/java/android/os/PowerManager.java
index 91ddf82..728b215 100644
--- a/core/java/android/os/PowerManager.java
+++ b/core/java/android/os/PowerManager.java
@@ -694,9 +694,11 @@
             ServiceType.BATTERY_STATS,
             ServiceType.DATA_SAVER,
             ServiceType.FORCE_ALL_APPS_STANDBY,
+            ServiceType.FORCE_BACKGROUND_CHECK,
             ServiceType.OPTIONAL_SENSORS,
             ServiceType.AOD,
             ServiceType.QUICK_DOZE,
+            ServiceType.NIGHT_MODE,
     })
     public @interface ServiceType {
         int NULL = 0;
@@ -762,8 +764,14 @@
      */
     public static final int LOCATION_MODE_FOREGROUND_ONLY = 3;
 
+    /**
+     * In this mode, location will not be turned off, but LocationManager will throttle all
+     * requests to providers when the device is non-interactive.
+     */
+    public static final int LOCATION_MODE_THROTTLE_REQUESTS_WHEN_SCREEN_OFF = 4;
+
     static final int MIN_LOCATION_MODE = LOCATION_MODE_NO_CHANGE;
-    static final int MAX_LOCATION_MODE = LOCATION_MODE_FOREGROUND_ONLY;
+    static final int MAX_LOCATION_MODE = LOCATION_MODE_THROTTLE_REQUESTS_WHEN_SCREEN_OFF;
 
     /**
      * @hide
@@ -774,15 +782,35 @@
             LOCATION_MODE_GPS_DISABLED_WHEN_SCREEN_OFF,
             LOCATION_MODE_ALL_DISABLED_WHEN_SCREEN_OFF,
             LOCATION_MODE_FOREGROUND_ONLY,
+            LOCATION_MODE_THROTTLE_REQUESTS_WHEN_SCREEN_OFF,
     })
     public @interface LocationPowerSaveMode {}
 
+    /** @hide */
+    public static String locationPowerSaveModeToString(@LocationPowerSaveMode int mode) {
+        switch (mode) {
+            case LOCATION_MODE_NO_CHANGE:
+                return "NO_CHANGE";
+            case LOCATION_MODE_GPS_DISABLED_WHEN_SCREEN_OFF:
+                return "GPS_DISABLED_WHEN_SCREEN_OFF";
+            case LOCATION_MODE_ALL_DISABLED_WHEN_SCREEN_OFF:
+                return "ALL_DISABLED_WHEN_SCREEN_OFF";
+            case LOCATION_MODE_FOREGROUND_ONLY:
+                return "FOREGROUND_ONLY";
+            case LOCATION_MODE_THROTTLE_REQUESTS_WHEN_SCREEN_OFF:
+                return "THROTTLE_REQUESTS_WHEN_SCREEN_OFF";
+            default:
+                return Integer.toString(mode);
+        }
+    }
+
     final Context mContext;
     final IPowerManager mService;
     final Handler mHandler;
 
     IThermalService mThermalService;
-    private ArrayMap<ThermalStatusCallback, IThermalStatusListener> mCallbackMap = new ArrayMap<>();
+    private final ArrayMap<OnThermalStatusChangedListener, IThermalStatusListener>
+            mListenerMap = new ArrayMap<>();
 
     IDeviceIdleController mIDeviceIdleController;
 
@@ -1742,51 +1770,73 @@
     }
 
     /**
-     * Callback passed to
-     * {@link PowerManager#registerThermalStatusCallback} and
-     * {@link PowerManager#unregisterThermalStatusCallback}
-     * to notify caller of thermal status.
+     * Listener passed to
+     * {@link PowerManager#addThermalStatusListener} and
+     * {@link PowerManager#removeThermalStatusListener}
+     * to notify caller of thermal status has changed.
      */
-    public abstract static class ThermalStatusCallback {
+    public interface OnThermalStatusChangedListener {
 
         /**
          * Called when overall thermal throttling status changed.
          * @param status defined in {@link android.os.Temperature}.
          */
-        public void onStatusChange(@ThermalStatus int status) {}
+        void onThermalStatusChanged(@ThermalStatus int status);
     }
 
+
     /**
-     * This function registers a callback for thermal status change.
+     * This function adds a listener for thermal status change, listen call back will be
+     * enqueued tasks on the main thread
      *
-     * @param callback callback to be registered.
-     * @param executor {@link Executor} to handle the callbacks.
+     * @param listener listener to be added,
      */
-    public void registerThermalStatusCallback(
-            @NonNull ThermalStatusCallback callback, @NonNull @CallbackExecutor Executor executor) {
-        Preconditions.checkNotNull(callback, "callback cannnot be null");
-        Preconditions.checkNotNull(executor, "executor cannnot be null");
+    public void addThermalStatusListener(@NonNull OnThermalStatusChangedListener listener) {
+        Preconditions.checkNotNull(listener, "listener cannot be null");
         synchronized (this) {
             if (mThermalService == null) {
                 mThermalService = IThermalService.Stub.asInterface(
                         ServiceManager.getService(Context.THERMAL_SERVICE));
             }
-            try {
-                if (mCallbackMap.containsKey(callback)) {
-                    throw new IllegalArgumentException("ThermalStatusCallback already registered");
-                }
-                IThermalStatusListener listener = new IThermalStatusListener.Stub() {
-                    @Override
-                    public void onStatusChange(int status) {
+            this.addThermalStatusListener(mContext.getMainExecutor(), listener);
+        }
+    }
+
+    /**
+     * This function adds a listener for thermal status change.
+     *
+     * @param executor {@link Executor} to handle listener callback.
+     * @param listener listener to be added.
+     */
+    public void addThermalStatusListener(@NonNull @CallbackExecutor Executor executor,
+            @NonNull OnThermalStatusChangedListener listener) {
+        Preconditions.checkNotNull(listener, "listener cannot be null");
+        Preconditions.checkNotNull(executor, "executor cannot be null");
+        synchronized (this) {
+            if (mThermalService == null) {
+                mThermalService = IThermalService.Stub.asInterface(
+                        ServiceManager.getService(Context.THERMAL_SERVICE));
+            }
+            Preconditions.checkArgument(!mListenerMap.containsKey(listener),
+                    "Listener already registered: " + listener);
+            IThermalStatusListener internalListener = new IThermalStatusListener.Stub() {
+                @Override
+                public void onStatusChange(int status) {
+                    final long token = Binder.clearCallingIdentity();
+                    try {
                         executor.execute(() -> {
-                            callback.onStatusChange(status);
+                            listener.onThermalStatusChanged(status);
                         });
+                    } finally {
+                        Binder.restoreCallingIdentity(token);
                     }
-                };
-                if (mThermalService.registerThermalStatusListener(listener)) {
-                    mCallbackMap.put(callback, listener);
+                }
+            };
+            try {
+                if (mThermalService.registerThermalStatusListener(internalListener)) {
+                    mListenerMap.put(listener, internalListener);
                 } else {
-                    throw new RuntimeException("ThermalStatusCallback failed to register");
+                    throw new RuntimeException("Listener failed to set");
                 }
             } catch (RemoteException e) {
                 throw e.rethrowFromSystemServer();
@@ -1795,28 +1845,24 @@
     }
 
     /**
-     * This function unregisters a callback for thermal status change.
+     * This function removes a listener for thermal status change
      *
-     * @param callback to be unregistered.
-     *
-     * see {@link #registerThermalStatusCallback}
+     * @param listener listener to be removed
      */
-    public void unregisterThermalStatusCallback(@NonNull ThermalStatusCallback callback) {
-        Preconditions.checkNotNull(callback, "callback cannnot be null");
+    public void removeThermalStatusListener(@NonNull OnThermalStatusChangedListener listener) {
+        Preconditions.checkNotNull(listener, "listener cannot be null");
         synchronized (this) {
             if (mThermalService == null) {
                 mThermalService = IThermalService.Stub.asInterface(
                         ServiceManager.getService(Context.THERMAL_SERVICE));
             }
+            IThermalStatusListener internalListener = mListenerMap.get(listener);
+            Preconditions.checkArgument(internalListener != null, "Listener was not added");
             try {
-                IThermalStatusListener listener = mCallbackMap.get(callback);
-                if (listener == null) {
-                    throw new IllegalArgumentException("ThermalStatusCallback not registered");
-                }
-                if (mThermalService.unregisterThermalStatusListener(listener)) {
-                    mCallbackMap.remove(callback);
+                if (mThermalService.unregisterThermalStatusListener(internalListener)) {
+                    mListenerMap.remove(listener);
                 } else {
-                    throw new RuntimeException("ThermalStatusCallback failed to unregister");
+                    throw new RuntimeException("Listener failed to remove");
                 }
             } catch (RemoteException e) {
                 throw e.rethrowFromSystemServer();
diff --git a/core/java/android/os/Process.java b/core/java/android/os/Process.java
index cd43b42..03fc2a9 100644
--- a/core/java/android/os/Process.java
+++ b/core/java/android/os/Process.java
@@ -529,7 +529,8 @@
         return ZYGOTE_PROCESS.start(processClass, niceName, uid, gid, gids,
                     runtimeFlags, mountExternal, targetSdkVersion, seInfo,
                     abi, instructionSet, appDataDir, invokeWith, packageName,
-                    packagesForUid, sandboxId, /*useBlastulaPool=*/ true, zygoteArgs);
+                    packagesForUid, sandboxId, /*useUnspecializedAppProcessPool=*/ true,
+                    zygoteArgs);
     }
 
     /** @hide */
@@ -550,7 +551,8 @@
         return WebViewZygote.getProcess().start(processClass, niceName, uid, gid, gids,
                     runtimeFlags, mountExternal, targetSdkVersion, seInfo,
                     abi, instructionSet, appDataDir, invokeWith, packageName,
-                    packagesForUid, sandboxId, /*useBlastulaPool=*/ false, zygoteArgs);
+                    packagesForUid, sandboxId, /*useUnspecializedAppProcessPool=*/ false,
+                    zygoteArgs);
     }
 
     /**
diff --git a/core/java/android/os/RemoteCallback.java b/core/java/android/os/RemoteCallback.java
index 5914739..22cf404 100644
--- a/core/java/android/os/RemoteCallback.java
+++ b/core/java/android/os/RemoteCallback.java
@@ -94,7 +94,7 @@
         parcel.writeStrongBinder(mCallback.asBinder());
     }
 
-    public static final Parcelable.Creator<RemoteCallback> CREATOR
+    public static final @android.annotation.NonNull Parcelable.Creator<RemoteCallback> CREATOR
             = new Parcelable.Creator<RemoteCallback>() {
         public RemoteCallback createFromParcel(Parcel parcel) {
             return new RemoteCallback(parcel);
diff --git a/core/java/android/os/ResultReceiver.java b/core/java/android/os/ResultReceiver.java
index 34a66b6..f2d8fe4 100644
--- a/core/java/android/os/ResultReceiver.java
+++ b/core/java/android/os/ResultReceiver.java
@@ -125,7 +125,7 @@
         mReceiver = IResultReceiver.Stub.asInterface(in.readStrongBinder());
     }
     
-    public static final Parcelable.Creator<ResultReceiver> CREATOR
+    public static final @android.annotation.NonNull Parcelable.Creator<ResultReceiver> CREATOR
             = new Parcelable.Creator<ResultReceiver>() {
         public ResultReceiver createFromParcel(Parcel in) {
             return new ResultReceiver(in);
diff --git a/core/java/android/os/SharedMemory.java b/core/java/android/os/SharedMemory.java
index e6c7a17..395485b 100644
--- a/core/java/android/os/SharedMemory.java
+++ b/core/java/android/os/SharedMemory.java
@@ -270,7 +270,7 @@
         dest.writeFileDescriptor(mFileDescriptor);
     }
 
-    public static final Parcelable.Creator<SharedMemory> CREATOR =
+    public static final @android.annotation.NonNull Parcelable.Creator<SharedMemory> CREATOR =
             new Parcelable.Creator<SharedMemory>() {
         @Override
         public SharedMemory createFromParcel(Parcel source) {
diff --git a/core/java/android/os/ShellCallback.java b/core/java/android/os/ShellCallback.java
index 6a62424..632f6c8 100644
--- a/core/java/android/os/ShellCallback.java
+++ b/core/java/android/os/ShellCallback.java
@@ -110,7 +110,7 @@
         }
     }
 
-    public static final Parcelable.Creator<ShellCallback> CREATOR
+    public static final @android.annotation.NonNull Parcelable.Creator<ShellCallback> CREATOR
             = new Parcelable.Creator<ShellCallback>() {
         public ShellCallback createFromParcel(Parcel in) {
             return new ShellCallback(in);
diff --git a/core/java/android/os/StatsDimensionsValue.java b/core/java/android/os/StatsDimensionsValue.java
index 257cc52..da13ea1 100644
--- a/core/java/android/os/StatsDimensionsValue.java
+++ b/core/java/android/os/StatsDimensionsValue.java
@@ -264,7 +264,7 @@
     /**
      * Parcelable Creator for StatsDimensionsValue.
      */
-    public static final Parcelable.Creator<StatsDimensionsValue> CREATOR = new
+    public static final @android.annotation.NonNull Parcelable.Creator<StatsDimensionsValue> CREATOR = new
             Parcelable.Creator<StatsDimensionsValue>() {
                 public StatsDimensionsValue createFromParcel(Parcel in) {
                     return new StatsDimensionsValue(in);
diff --git a/core/java/android/os/StatsLogEventWrapper.java b/core/java/android/os/StatsLogEventWrapper.java
index 2334242..89c9bb2 100644
--- a/core/java/android/os/StatsLogEventWrapper.java
+++ b/core/java/android/os/StatsLogEventWrapper.java
@@ -54,7 +54,7 @@
     /**
      * Boilerplate for Parcel.
      */
-    public static final Parcelable.Creator<StatsLogEventWrapper> CREATOR = new
+    public static final @android.annotation.NonNull Parcelable.Creator<StatsLogEventWrapper> CREATOR = new
             Parcelable.Creator<StatsLogEventWrapper>() {
                 public StatsLogEventWrapper createFromParcel(Parcel in) {
                     return new StatsLogEventWrapper(in);
diff --git a/core/java/android/os/StrictMode.java b/core/java/android/os/StrictMode.java
index 5ff6e55..f0b83d8 100644
--- a/core/java/android/os/StrictMode.java
+++ b/core/java/android/os/StrictMode.java
@@ -482,7 +482,7 @@
              * <p>As of the Gingerbread release this includes network and disk operations but will
              * likely expand in future releases.
              */
-            public Builder detectAll() {
+            public @NonNull Builder detectAll() {
                 detectDiskReads();
                 detectDiskWrites();
                 detectNetwork();
@@ -501,52 +501,52 @@
             }
 
             /** Disable the detection of everything. */
-            public Builder permitAll() {
+            public @NonNull Builder permitAll() {
                 return disable(DETECT_THREAD_ALL);
             }
 
             /** Enable detection of network operations. */
-            public Builder detectNetwork() {
+            public @NonNull Builder detectNetwork() {
                 return enable(DETECT_THREAD_NETWORK);
             }
 
             /** Disable detection of network operations. */
-            public Builder permitNetwork() {
+            public @NonNull Builder permitNetwork() {
                 return disable(DETECT_THREAD_NETWORK);
             }
 
             /** Enable detection of disk reads. */
-            public Builder detectDiskReads() {
+            public @NonNull Builder detectDiskReads() {
                 return enable(DETECT_THREAD_DISK_READ);
             }
 
             /** Disable detection of disk reads. */
-            public Builder permitDiskReads() {
+            public @NonNull Builder permitDiskReads() {
                 return disable(DETECT_THREAD_DISK_READ);
             }
 
             /** Enable detection of slow calls. */
-            public Builder detectCustomSlowCalls() {
+            public @NonNull Builder detectCustomSlowCalls() {
                 return enable(DETECT_THREAD_CUSTOM);
             }
 
             /** Disable detection of slow calls. */
-            public Builder permitCustomSlowCalls() {
+            public @NonNull Builder permitCustomSlowCalls() {
                 return disable(DETECT_THREAD_CUSTOM);
             }
 
             /** Disable detection of mismatches between defined resource types and getter calls. */
-            public Builder permitResourceMismatches() {
+            public @NonNull Builder permitResourceMismatches() {
                 return disable(DETECT_THREAD_RESOURCE_MISMATCH);
             }
 
             /** Detect unbuffered input/output operations. */
-            public Builder detectUnbufferedIo() {
+            public @NonNull Builder detectUnbufferedIo() {
                 return enable(DETECT_THREAD_UNBUFFERED_IO);
             }
 
             /** Disable detection of unbuffered input/output operations. */
-            public Builder permitUnbufferedIo() {
+            public @NonNull Builder permitUnbufferedIo() {
                 return disable(DETECT_THREAD_UNBUFFERED_IO);
             }
 
@@ -562,17 +562,17 @@
              * call will return a value without crashing; however, the developer should format the
              * resource as an integer to avoid unnecessary type conversion.
              */
-            public Builder detectResourceMismatches() {
+            public @NonNull Builder detectResourceMismatches() {
                 return enable(DETECT_THREAD_RESOURCE_MISMATCH);
             }
 
             /** Enable detection of disk writes. */
-            public Builder detectDiskWrites() {
+            public @NonNull Builder detectDiskWrites() {
                 return enable(DETECT_THREAD_DISK_WRITE);
             }
 
             /** Disable detection of disk writes. */
-            public Builder permitDiskWrites() {
+            public @NonNull Builder permitDiskWrites() {
                 return disable(DETECT_THREAD_DISK_WRITE);
             }
 
@@ -582,7 +582,7 @@
              * @hide
              */
             @TestApi
-            public Builder detectExplicitGc() {
+            public @NonNull Builder detectExplicitGc() {
                 // TODO(b/3400644): Un-hide this for next API update
                 // TODO(b/3400644): Un-hide ExplicitGcViolation for next API update
                 // TODO(b/3400644): Make DETECT_EXPLICIT_GC a @TestApi for next API update
@@ -595,7 +595,7 @@
              *
              * @hide
              */
-            public Builder permitExplicitGc() {
+            public @NonNull Builder permitExplicitGc() {
                 // TODO(b/3400644): Un-hide this for next API update
                 return disable(DETECT_THREAD_EXPLICIT_GC);
             }
@@ -604,7 +604,7 @@
              * Show an annoying dialog to the developer on detected violations, rate-limited to be
              * only a little annoying.
              */
-            public Builder penaltyDialog() {
+            public @NonNull Builder penaltyDialog() {
                 return enable(PENALTY_DIALOG);
             }
 
@@ -616,7 +616,7 @@
              * <p>Unlike {@link #penaltyDeathOnNetwork}, this applies to disk reads, disk writes,
              * and network usage if their corresponding detect flags are set.
              */
-            public Builder penaltyDeath() {
+            public @NonNull Builder penaltyDeath() {
                 return enable(PENALTY_DEATH);
             }
 
@@ -627,17 +627,17 @@
              *
              * <p>In the Honeycomb or later SDKs, this is on by default.
              */
-            public Builder penaltyDeathOnNetwork() {
+            public @NonNull Builder penaltyDeathOnNetwork() {
                 return enable(PENALTY_DEATH_ON_NETWORK);
             }
 
             /** Flash the screen during a violation. */
-            public Builder penaltyFlashScreen() {
+            public @NonNull Builder penaltyFlashScreen() {
                 return enable(PENALTY_FLASH);
             }
 
             /** Log detected violations to the system log. */
-            public Builder penaltyLog() {
+            public @NonNull Builder penaltyLog() {
                 return enable(PENALTY_LOG);
             }
 
@@ -646,7 +646,7 @@
              * android.os.DropBoxManager DropBox} on policy violation. Intended mostly for platform
              * integrators doing beta user field data collection.
              */
-            public Builder penaltyDropBox() {
+            public @NonNull Builder penaltyDropBox() {
                 return enable(PENALTY_DROPBOX);
             }
 
@@ -654,7 +654,7 @@
              * Call #{@link OnThreadViolationListener#onThreadViolation(Violation)} on specified
              * executor every violation.
              */
-            public Builder penaltyListener(
+            public @NonNull Builder penaltyListener(
                     @NonNull Executor executor, @NonNull OnThreadViolationListener listener) {
                 if (executor == null) {
                     throw new NullPointerException("executor must not be null");
@@ -665,7 +665,7 @@
             }
 
             /** @removed */
-            public Builder penaltyListener(
+            public @NonNull Builder penaltyListener(
                     @NonNull OnThreadViolationListener listener, @NonNull Executor executor) {
                 return penaltyListener(executor, listener);
             }
@@ -782,7 +782,7 @@
              * Set an upper bound on how many instances of a class can be in memory at once. Helps
              * to prevent object leaks.
              */
-            public Builder setClassInstanceLimit(Class klass, int instanceLimit) {
+            public @NonNull Builder setClassInstanceLimit(Class klass, int instanceLimit) {
                 if (klass == null) {
                     throw new NullPointerException("klass == null");
                 }
@@ -803,12 +803,12 @@
             }
 
             /** Detect leaks of {@link android.app.Activity} subclasses. */
-            public Builder detectActivityLeaks() {
+            public @NonNull Builder detectActivityLeaks() {
                 return enable(DETECT_VM_ACTIVITY_LEAKS);
             }
 
             /** @hide */
-            public Builder permitActivityLeaks() {
+            public @NonNull Builder permitActivityLeaks() {
                 return disable(DETECT_VM_ACTIVITY_LEAKS);
             }
 
@@ -819,7 +819,7 @@
              * enabled may not be detected. To ensure that all such API accesses are detected,
              * you should apply this policy as early as possible after process creation.
              */
-            public Builder detectNonSdkApiUsage() {
+            public @NonNull Builder detectNonSdkApiUsage() {
                 return enable(DETECT_VM_NON_SDK_API_USAGE);
             }
 
@@ -829,7 +829,7 @@
              * continue to restrict or warn on access to methods that are not part of the
              * public SDK.
              */
-            public Builder permitNonSdkApiUsage() {
+            public @NonNull Builder permitNonSdkApiUsage() {
                 return disable(DETECT_VM_NON_SDK_API_USAGE);
             }
 
@@ -839,7 +839,7 @@
              * <p>In the Honeycomb release this includes leaks of SQLite cursors, Activities, and
              * other closable objects but will likely expand in future releases.
              */
-            public Builder detectAll() {
+            public @NonNull Builder detectAll() {
                 detectLeakedSqlLiteObjects();
 
                 final int targetSdk = VMRuntime.getRuntime().getTargetSdkVersion();
@@ -881,7 +881,7 @@
              * <p>You always want to explicitly close your SQLite cursors to avoid unnecessary
              * database contention and temporary memory leaks.
              */
-            public Builder detectLeakedSqlLiteObjects() {
+            public @NonNull Builder detectLeakedSqlLiteObjects() {
                 return enable(DETECT_VM_CURSOR_LEAKS);
             }
 
@@ -892,7 +892,7 @@
              * <p>You always want to explicitly close such objects to avoid unnecessary resources
              * leaks.
              */
-            public Builder detectLeakedClosableObjects() {
+            public @NonNull Builder detectLeakedClosableObjects() {
                 return enable(DETECT_VM_CLOSABLE_LEAKS);
             }
 
@@ -900,7 +900,7 @@
              * Detect when a {@link BroadcastReceiver} or {@link ServiceConnection} is leaked during
              * {@link Context} teardown.
              */
-            public Builder detectLeakedRegistrationObjects() {
+            public @NonNull Builder detectLeakedRegistrationObjects() {
                 return enable(DETECT_VM_REGISTRATION_LEAKS);
             }
 
@@ -919,7 +919,7 @@
              * @see android.support.v4.content.FileProvider
              * @see Intent#FLAG_GRANT_READ_URI_PERMISSION
              */
-            public Builder detectFileUriExposure() {
+            public @NonNull Builder detectFileUriExposure() {
                 return enable(DETECT_VM_FILE_URI_EXPOSURE);
             }
 
@@ -938,7 +938,7 @@
              * <p>This inspects both IPv4/IPv6 and TCP/UDP network traffic, but it may be subject to
              * false positives, such as when STARTTLS protocols or HTTP proxies are used.
              */
-            public Builder detectCleartextNetwork() {
+            public @NonNull Builder detectCleartextNetwork() {
                 return enable(DETECT_VM_CLEARTEXT_NETWORK);
             }
 
@@ -954,7 +954,7 @@
              * @see Intent#FLAG_GRANT_READ_URI_PERMISSION
              * @see Intent#FLAG_GRANT_WRITE_URI_PERMISSION
              */
-            public Builder detectContentUriWithoutPermission() {
+            public @NonNull Builder detectContentUriWithoutPermission() {
                 return enable(DETECT_VM_CONTENT_URI_WITHOUT_PERMISSION);
             }
 
@@ -969,12 +969,12 @@
              * @see TrafficStats#tagSocket(java.net.Socket)
              * @see TrafficStats#tagDatagramSocket(java.net.DatagramSocket)
              */
-            public Builder detectUntaggedSockets() {
+            public @NonNull Builder detectUntaggedSockets() {
                 return enable(DETECT_VM_UNTAGGED_SOCKET);
             }
 
             /** @hide */
-            public Builder permitUntaggedSockets() {
+            public @NonNull Builder permitUntaggedSockets() {
                 return disable(DETECT_VM_UNTAGGED_SOCKET);
             }
 
@@ -992,12 +992,12 @@
              * <li>{@link PackageManager#MATCH_DIRECT_BOOT_AUTO}
              * </ul>
              */
-            public Builder detectImplicitDirectBoot() {
+            public @NonNull Builder detectImplicitDirectBoot() {
                 return enable(DETECT_VM_IMPLICIT_DIRECT_BOOT);
             }
 
             /** @hide */
-            public Builder permitImplicitDirectBoot() {
+            public @NonNull Builder permitImplicitDirectBoot() {
                 return disable(DETECT_VM_IMPLICIT_DIRECT_BOOT);
             }
 
@@ -1014,12 +1014,12 @@
              * @see Context#createCredentialProtectedStorageContext()
              * @see Context#createDeviceProtectedStorageContext()
              */
-            public Builder detectCredentialProtectedWhileLocked() {
+            public @NonNull Builder detectCredentialProtectedWhileLocked() {
                 return enable(DETECT_VM_CREDENTIAL_PROTECTED_WHILE_LOCKED);
             }
 
             /** @hide */
-            public Builder permitCredentialProtectedWhileLocked() {
+            public @NonNull Builder permitCredentialProtectedWhileLocked() {
                 return disable(DETECT_VM_CREDENTIAL_PROTECTED_WHILE_LOCKED);
             }
 
@@ -1028,7 +1028,7 @@
              * penalties so you'll still get your logging or other violations before the process
              * dies.
              */
-            public Builder penaltyDeath() {
+            public @NonNull Builder penaltyDeath() {
                 return enable(PENALTY_DEATH);
             }
 
@@ -1037,7 +1037,7 @@
              *
              * @see #detectCleartextNetwork()
              */
-            public Builder penaltyDeathOnCleartextNetwork() {
+            public @NonNull Builder penaltyDeathOnCleartextNetwork() {
                 return enable(PENALTY_DEATH_ON_CLEARTEXT_NETWORK);
             }
 
@@ -1047,12 +1047,12 @@
              *
              * @see #detectFileUriExposure()
              */
-            public Builder penaltyDeathOnFileUriExposure() {
+            public @NonNull Builder penaltyDeathOnFileUriExposure() {
                 return enable(PENALTY_DEATH_ON_FILE_URI_EXPOSURE);
             }
 
             /** Log detected violations to the system log. */
-            public Builder penaltyLog() {
+            public @NonNull Builder penaltyLog() {
                 return enable(PENALTY_LOG);
             }
 
@@ -1061,14 +1061,14 @@
              * android.os.DropBoxManager DropBox} on policy violation. Intended mostly for platform
              * integrators doing beta user field data collection.
              */
-            public Builder penaltyDropBox() {
+            public @NonNull Builder penaltyDropBox() {
                 return enable(PENALTY_DROPBOX);
             }
 
             /**
              * Call #{@link OnVmViolationListener#onVmViolation(Violation)} on every violation.
              */
-            public Builder penaltyListener(
+            public @NonNull Builder penaltyListener(
                     @NonNull Executor executor, @NonNull OnVmViolationListener listener) {
                 if (executor == null) {
                     throw new NullPointerException("executor must not be null");
@@ -1079,7 +1079,7 @@
             }
 
             /** @removed */
-            public Builder penaltyListener(
+            public @NonNull Builder penaltyListener(
                     @NonNull OnVmViolationListener listener, @NonNull Executor executor) {
                 return penaltyListener(executor, listener);
             }
@@ -2853,7 +2853,7 @@
             return 0;
         }
 
-        public static final Parcelable.Creator<ViolationInfo> CREATOR =
+        public static final @android.annotation.NonNull Parcelable.Creator<ViolationInfo> CREATOR =
                 new Parcelable.Creator<ViolationInfo>() {
                     @Override
                     public ViolationInfo createFromParcel(Parcel in) {
diff --git a/core/java/android/os/Temperature.java b/core/java/android/os/Temperature.java
index eee2b52..be7e824 100644
--- a/core/java/android/os/Temperature.java
+++ b/core/java/android/os/Temperature.java
@@ -177,7 +177,7 @@
         p.writeInt(mStatus);
     }
 
-    public static final Parcelable.Creator<Temperature> CREATOR =
+    public static final @android.annotation.NonNull Parcelable.Creator<Temperature> CREATOR =
             new Parcelable.Creator<Temperature>() {
                 @Override
                 public Temperature createFromParcel(Parcel p) {
diff --git a/core/java/android/os/UpdateEngine.java b/core/java/android/os/UpdateEngine.java
index 1df3dad..5cf3b97 100644
--- a/core/java/android/os/UpdateEngine.java
+++ b/core/java/android/os/UpdateEngine.java
@@ -39,8 +39,9 @@
  *
  * The APIs defined in this class and UpdateEngineCallback class must be in
  * sync with the ones in
- * system/update_engine/binder_bindings/android/os/IUpdateEngine.aidl and
- * system/update_engine/binder_bindings/android/os/IUpdateEngineCallback.aidl.
+ * {@code system/update_engine/binder_bindings/android/os/IUpdateEngine.aidl}
+ * and
+ * {@code system/update_engine/binder_bindings/android/os/IUpdateEngineCallback.aidl}.
  *
  * {@hide}
  */
@@ -51,39 +52,150 @@
     private static final String UPDATE_ENGINE_SERVICE = "android.os.UpdateEngineService";
 
     /**
-     * Error code from the update engine. Values must agree with the ones in
-     * system/update_engine/common/error_code.h.
+     * Error codes from update engine upon finishing a call to
+     * {@link applyPayload}. Values will be passed via the callback function
+     * {@link UpdateEngineCallback#onPayloadApplicationComplete}. Values must
+     * agree with the ones in {@code system/update_engine/common/error_code.h}.
      */
     public static final class ErrorCodeConstants {
+        /**
+         * Error code: a request finished successfully.
+         */
         public static final int SUCCESS = 0;
+        /**
+         * Error code: a request failed due to a generic error.
+         */
         public static final int ERROR = 1;
+        /**
+         * Error code: an update failed to apply due to filesystem copier
+         * error.
+         */
         public static final int FILESYSTEM_COPIER_ERROR = 4;
+        /**
+         * Error code: an update failed to apply due to an error in running
+         * post-install hooks.
+         */
         public static final int POST_INSTALL_RUNNER_ERROR = 5;
+        /**
+         * Error code: an update failed to apply due to a mismatching payload.
+         *
+         * <p>For example, the given payload uses a feature that's not
+         * supported by the current update engine.
+         */
         public static final int PAYLOAD_MISMATCHED_TYPE_ERROR = 6;
+        /**
+         * Error code: an update failed to apply due to an error in opening
+         * devices.
+         */
         public static final int INSTALL_DEVICE_OPEN_ERROR = 7;
+        /**
+         * Error code: an update failed to apply due to an error in opening
+         * kernel device.
+         */
         public static final int KERNEL_DEVICE_OPEN_ERROR = 8;
+        /**
+         * Error code: an update failed to apply due to an error in fetching
+         * the payload.
+         *
+         * <p>For example, this could be a result of bad network connection
+         * when streaming an update.
+         */
         public static final int DOWNLOAD_TRANSFER_ERROR = 9;
+        /**
+         * Error code: an update failed to apply due to a mismatch in payload
+         * hash.
+         *
+         * <p>Update engine does sanity checks for the given payload and its
+         * metadata.
+         */
         public static final int PAYLOAD_HASH_MISMATCH_ERROR = 10;
+
+        /**
+         * Error code: an update failed to apply due to a mismatch in payload
+         * size.
+         */
         public static final int PAYLOAD_SIZE_MISMATCH_ERROR = 11;
+
+        /**
+         * Error code: an update failed to apply due to failing to verify
+         * payload signatures.
+         */
         public static final int DOWNLOAD_PAYLOAD_VERIFICATION_ERROR = 12;
+
+        /**
+         * Error code: an update failed to apply due to a downgrade in payload
+         * timestamp.
+         *
+         * <p>The timestamp of a build is encoded into the payload, which will
+         * be enforced during install to prevent downgrading a device.
+         */
         public static final int PAYLOAD_TIMESTAMP_ERROR = 51;
+
+        /**
+         * Error code: an update has been applied successfully but the new slot
+         * hasn't been set to active.
+         *
+         * <p>It indicates a successful finish of calling {@link #applyPayload} with
+         * {@code SWITCH_SLOT_ON_REBOOT=0}. See {@link #applyPayload}.
+         */
         public static final int UPDATED_BUT_NOT_ACTIVE = 52;
     }
 
     /**
-     * Update status code from the update engine. Values must agree with the
-     * ones in system/update_engine/client_library/include/update_engine/update_status.h.
+     * Status codes for update engine. Values must agree with the ones in
+     * {@code system/update_engine/client_library/include/update_engine/update_status.h}.
      */
     public static final class UpdateStatusConstants {
+        /**
+         * Update status code: update engine is in idle state.
+         */
         public static final int IDLE = 0;
+
+        /**
+         * Update status code: update engine is checking for update.
+         */
         public static final int CHECKING_FOR_UPDATE = 1;
+
+        /**
+         * Update status code: an update is available.
+         */
         public static final int UPDATE_AVAILABLE = 2;
+
+        /**
+         * Update status code: update engine is downloading an update.
+         */
         public static final int DOWNLOADING = 3;
+
+        /**
+         * Update status code: update engine is verifying an update.
+         */
         public static final int VERIFYING = 4;
+
+        /**
+         * Update status code: update engine is finalizing an update.
+         */
         public static final int FINALIZING = 5;
+
+        /**
+         * Update status code: an update has been applied and is pending for
+         * reboot.
+         */
         public static final int UPDATED_NEED_REBOOT = 6;
+
+        /**
+         * Update status code: update engine is reporting an error event.
+         */
         public static final int REPORTING_ERROR_EVENT = 7;
+
+        /**
+         * Update status code: update engine is attempting to rollback an
+         * update.
+         */
         public static final int ATTEMPTING_ROLLBACK = 8;
+
+        /**
+         * Update status code: update engine is in disabled state.
+         */
         public static final int DISABLED = 9;
     }
 
@@ -178,6 +290,18 @@
      *   "METADATA_SIZE=70604"
      * };
      * </pre>
+     *
+     * <p>The callback functions registered via {@code #bind} will be called
+     * during and at the end of the payload application.
+     *
+     * <p>By default the newly updated slot will be set active upon
+     * successfully finishing an update. Device will attempt to boot into the
+     * new slot on next reboot. This behavior can be customized by specifying
+     * {@code SWITCH_SLOT_ON_REBOOT=0} in {@code headerKeyValuePairs}, which
+     * allows the caller to later determine a good time to boot into the new
+     * slot. Calling {@code applyPayload} again with the same payload but with
+     * {@code SWITCH_SLOT_ON_REBOOT=1} will do the minimal work to set the new
+     * slot active, after verifying its integrity.
      */
     public void applyPayload(String url, long offset, long size, String[] headerKeyValuePairs) {
         try {
diff --git a/core/java/android/os/UserHandle.java b/core/java/android/os/UserHandle.java
index 40c48a0..286185b 100644
--- a/core/java/android/os/UserHandle.java
+++ b/core/java/android/os/UserHandle.java
@@ -17,6 +17,7 @@
 package android.os;
 
 import android.annotation.AppIdInt;
+import android.annotation.NonNull;
 import android.annotation.SystemApi;
 import android.annotation.TestApi;
 import android.annotation.UserIdInt;
@@ -40,7 +41,7 @@
     /** @hide A user handle to indicate all users on the device */
     @SystemApi
     @TestApi
-    public static final UserHandle ALL = new UserHandle(USER_ALL);
+    public static final @NonNull UserHandle ALL = new UserHandle(USER_ALL);
 
     /** @hide A user id to indicate the currently active user */
     public static final @UserIdInt int USER_CURRENT = -2;
@@ -48,7 +49,7 @@
     /** @hide A user handle to indicate the current user of the device */
     @SystemApi
     @TestApi
-    public static final UserHandle CURRENT = new UserHandle(USER_CURRENT);
+    public static final @NonNull UserHandle CURRENT = new UserHandle(USER_CURRENT);
 
     /** @hide A user id to indicate that we would like to send to the current
      *  user, but if this is calling from a user process then we will send it
@@ -58,7 +59,7 @@
     /** @hide A user handle to indicate that we would like to send to the current
      *  user, but if this is calling from a user process then we will send it
      *  to the caller's user instead of failing with a security exception */
-    public static final UserHandle CURRENT_OR_SELF = new UserHandle(USER_CURRENT_OR_SELF);
+    public static final @NonNull UserHandle CURRENT_OR_SELF = new UserHandle(USER_CURRENT_OR_SELF);
 
     /** @hide An undefined user id */
     public static final @UserIdInt int USER_NULL = -10000;
@@ -77,7 +78,7 @@
      * check the target user's flag {@link android.content.pm.UserInfo#isAdmin}.
      */
     @Deprecated
-    public static final UserHandle OWNER = new UserHandle(USER_OWNER);
+    public static final @NonNull UserHandle OWNER = new UserHandle(USER_OWNER);
 
     /** @hide A user id constant to indicate the "system" user of the device */
     public static final @UserIdInt int USER_SYSTEM = 0;
@@ -88,7 +89,7 @@
     /** @hide A user handle to indicate the "system" user of the device */
     @SystemApi
     @TestApi
-    public static final UserHandle SYSTEM = new UserHandle(USER_SYSTEM);
+    public static final @NonNull UserHandle SYSTEM = new UserHandle(USER_SYSTEM);
 
     /**
      * @hide Enable multi-user related side effects. Set this to false if
@@ -481,7 +482,7 @@
         return h != USER_NULL ? new UserHandle(h) : null;
     }
     
-    public static final Parcelable.Creator<UserHandle> CREATOR
+    public static final @android.annotation.NonNull Parcelable.Creator<UserHandle> CREATOR
             = new Parcelable.Creator<UserHandle>() {
         public UserHandle createFromParcel(Parcel in) {
             return new UserHandle(in);
diff --git a/core/java/android/os/UserManager.java b/core/java/android/os/UserManager.java
index 0673755..4263377 100644
--- a/core/java/android/os/UserManager.java
+++ b/core/java/android/os/UserManager.java
@@ -2705,7 +2705,7 @@
      */
     @SystemApi
     @RequiresPermission(android.Manifest.permission.MANAGE_USERS)
-    public void setUserName(String name) {
+    public void setUserName(@Nullable String name) {
         setUserName(getUserHandle(), name);
     }
 
@@ -2732,7 +2732,7 @@
      */
     @SystemApi
     @RequiresPermission(android.Manifest.permission.MANAGE_USERS)
-    public void setUserIcon(Bitmap icon) {
+    public void setUserIcon(@NonNull Bitmap icon) {
         setUserIcon(getUserHandle(), icon);
     }
 
@@ -2772,7 +2772,7 @@
      */
     @SystemApi
     @RequiresPermission(android.Manifest.permission.MANAGE_USERS)
-    public Bitmap getUserIcon() {
+    public @Nullable Bitmap getUserIcon() {
         return getUserIcon(getUserHandle());
     }
 
@@ -3021,7 +3021,7 @@
             userRestrictionSource = in.readInt();
         }
 
-        public static final Creator<EnforcingUser> CREATOR = new Creator<EnforcingUser>() {
+        public static final @android.annotation.NonNull Creator<EnforcingUser> CREATOR = new Creator<EnforcingUser>() {
             @Override
             public EnforcingUser createFromParcel(Parcel in) {
                 return new EnforcingUser(in);
diff --git a/core/java/android/os/VibrationEffect.java b/core/java/android/os/VibrationEffect.java
index 99fb608..c74cbff 100644
--- a/core/java/android/os/VibrationEffect.java
+++ b/core/java/android/os/VibrationEffect.java
@@ -17,6 +17,7 @@
 package android.os;
 
 import android.annotation.IntDef;
+import android.annotation.NonNull;
 import android.annotation.Nullable;
 import android.annotation.TestApi;
 import android.content.ContentResolver;
@@ -240,7 +241,8 @@
      *
      * @return The desired effect.
      */
-    public static VibrationEffect createPrebaked(@EffectType int effectId) {
+    @NonNull
+    public static VibrationEffect createPredefined(@EffectType int effectId) {
         return get(effectId, true);
     }
 
@@ -471,7 +473,7 @@
             out.writeInt(mAmplitude);
         }
 
-        public static final Parcelable.Creator<OneShot> CREATOR =
+        public static final @android.annotation.NonNull Parcelable.Creator<OneShot> CREATOR =
             new Parcelable.Creator<OneShot>() {
                 @Override
                 public OneShot createFromParcel(Parcel in) {
@@ -659,7 +661,7 @@
         }
 
 
-        public static final Parcelable.Creator<Waveform> CREATOR =
+        public static final @android.annotation.NonNull Parcelable.Creator<Waveform> CREATOR =
             new Parcelable.Creator<Waveform>() {
                 @Override
                 public Waveform createFromParcel(Parcel in) {
@@ -796,7 +798,7 @@
             out.writeInt(mEffectStrength);
         }
 
-        public static final Parcelable.Creator<Prebaked> CREATOR =
+        public static final @android.annotation.NonNull Parcelable.Creator<Prebaked> CREATOR =
             new Parcelable.Creator<Prebaked>() {
                 @Override
                 public Prebaked createFromParcel(Parcel in) {
@@ -811,7 +813,7 @@
             };
     }
 
-    public static final Parcelable.Creator<VibrationEffect> CREATOR =
+    public static final @android.annotation.NonNull Parcelable.Creator<VibrationEffect> CREATOR =
             new Parcelable.Creator<VibrationEffect>() {
                 @Override
                 public VibrationEffect createFromParcel(Parcel in) {
diff --git a/core/java/android/os/WorkSource.java b/core/java/android/os/WorkSource.java
index 76fe560..9980ade 100644
--- a/core/java/android/os/WorkSource.java
+++ b/core/java/android/os/WorkSource.java
@@ -1030,7 +1030,7 @@
             dest.writeStringArray(mTags);
         }
 
-        public static final Parcelable.Creator<WorkChain> CREATOR =
+        public static final @android.annotation.NonNull Parcelable.Creator<WorkChain> CREATOR =
                 new Parcelable.Creator<WorkChain>() {
                     public WorkChain createFromParcel(Parcel in) {
                         return new WorkChain(in);
@@ -1171,7 +1171,7 @@
         proto.end(workSourceToken);
     }
 
-    public static final Parcelable.Creator<WorkSource> CREATOR
+    public static final @android.annotation.NonNull Parcelable.Creator<WorkSource> CREATOR
             = new Parcelable.Creator<WorkSource>() {
         public WorkSource createFromParcel(Parcel in) {
             return new WorkSource(in);
diff --git a/core/java/android/os/ZygoteProcess.java b/core/java/android/os/ZygoteProcess.java
index e49b65e..60f4f06 100644
--- a/core/java/android/os/ZygoteProcess.java
+++ b/core/java/android/os/ZygoteProcess.java
@@ -82,9 +82,9 @@
     private static final String LOG_TAG = "ZygoteProcess";
 
     /**
-     * The default value for enabling the blastula pool.
+     * The default value for enabling the unspecialized app process (USAP) pool.
      */
-    private static final String BLASTULA_POOL_ENABLED_DEFAULT = "false";
+    private static final String USAP_POOL_ENABLED_DEFAULT = "false";
 
     /**
      * The name of the socket used to communicate with the primary zygote.
@@ -97,14 +97,14 @@
     private final LocalSocketAddress mZygoteSecondarySocketAddress;
 
     /**
-     * The name of the socket used to communicate with the primary blastula pool.
+     * The name of the socket used to communicate with the primary USAP pool.
      */
-    private final LocalSocketAddress mBlastulaPoolSocketAddress;
+    private final LocalSocketAddress mUsapPoolSocketAddress;
 
     /**
-     * The name of the socket used to communicate with the secondary (alternate ABI) blastula pool.
+     * The name of the socket used to communicate with the secondary (alternate ABI) USAP pool.
      */
-    private final LocalSocketAddress mBlastulaPoolSecondarySocketAddress;
+    private final LocalSocketAddress mUsapPoolSecondarySocketAddress;
 
     public ZygoteProcess() {
         mZygoteSocketAddress =
@@ -114,15 +114,15 @@
                 new LocalSocketAddress(Zygote.SECONDARY_SOCKET_NAME,
                                        LocalSocketAddress.Namespace.RESERVED);
 
-        mBlastulaPoolSocketAddress =
-                new LocalSocketAddress(Zygote.BLASTULA_POOL_PRIMARY_SOCKET_NAME,
+        mUsapPoolSocketAddress =
+                new LocalSocketAddress(Zygote.USAP_POOL_PRIMARY_SOCKET_NAME,
                                        LocalSocketAddress.Namespace.RESERVED);
-        mBlastulaPoolSecondarySocketAddress =
-                new LocalSocketAddress(Zygote.BLASTULA_POOL_SECONDARY_SOCKET_NAME,
+        mUsapPoolSecondarySocketAddress =
+                new LocalSocketAddress(Zygote.USAP_POOL_SECONDARY_SOCKET_NAME,
                                        LocalSocketAddress.Namespace.RESERVED);
 
-        if (fetchBlastulaPoolEnabledProp()) {
-            informZygotesOfBlastulaPoolStatus();
+        if (fetchUsapPoolEnabledProp()) {
+            informZygotesOfUsapPoolStatus();
         }
     }
 
@@ -131,8 +131,8 @@
         mZygoteSocketAddress = primarySocketAddress;
         mZygoteSecondarySocketAddress = secondarySocketAddress;
 
-        mBlastulaPoolSocketAddress = null;
-        mBlastulaPoolSecondarySocketAddress = null;
+        mUsapPoolSocketAddress = null;
+        mUsapPoolSecondarySocketAddress = null;
     }
 
     public LocalSocketAddress getPrimarySocketAddress() {
@@ -144,7 +144,7 @@
      */
     public static class ZygoteState {
         final LocalSocketAddress mZygoteSocketAddress;
-        final LocalSocketAddress mBlastulaSocketAddress;
+        final LocalSocketAddress mUsapSocketAddress;
 
         private final LocalSocket mZygoteSessionSocket;
 
@@ -156,13 +156,13 @@
         private boolean mClosed;
 
         private ZygoteState(LocalSocketAddress zygoteSocketAddress,
-                            LocalSocketAddress blastulaSocketAddress,
+                            LocalSocketAddress usapSocketAddress,
                             LocalSocket zygoteSessionSocket,
                             DataInputStream zygoteInputStream,
                             BufferedWriter zygoteOutputWriter,
                             List<String> abiList) {
             this.mZygoteSocketAddress = zygoteSocketAddress;
-            this.mBlastulaSocketAddress = blastulaSocketAddress;
+            this.mUsapSocketAddress = usapSocketAddress;
             this.mZygoteSessionSocket = zygoteSessionSocket;
             this.mZygoteInputStream = zygoteInputStream;
             this.mZygoteOutputWriter = zygoteOutputWriter;
@@ -171,16 +171,16 @@
 
         /**
          * Create a new ZygoteState object by connecting to the given Zygote socket and saving the
-         * given blastula socket address.
+         * given USAP socket address.
          *
          * @param zygoteSocketAddress  Zygote socket to connect to
-         * @param blastulaSocketAddress  Blastula socket address to save for later
+         * @param usapSocketAddress  USAP socket address to save for later
          * @return  A new ZygoteState object containing a session socket for the given Zygote socket
          * address
          * @throws IOException
          */
         public static ZygoteState connect(LocalSocketAddress zygoteSocketAddress,
-                                          LocalSocketAddress blastulaSocketAddress)
+                                          LocalSocketAddress usapSocketAddress)
                 throws IOException {
 
             DataInputStream zygoteInputStream = null;
@@ -202,16 +202,16 @@
                 throw ex;
             }
 
-            return new ZygoteState(zygoteSocketAddress, blastulaSocketAddress,
+            return new ZygoteState(zygoteSocketAddress, usapSocketAddress,
                                    zygoteSessionSocket, zygoteInputStream, zygoteOutputWriter,
                                    getAbiList(zygoteOutputWriter, zygoteInputStream));
         }
 
-        LocalSocket getBlastulaSessionSocket() throws IOException {
-            final LocalSocket blastulaSessionSocket = new LocalSocket();
-            blastulaSessionSocket.connect(this.mBlastulaSocketAddress);
+        LocalSocket getUsapSessionSocket() throws IOException {
+            final LocalSocket usapSessionSocket = new LocalSocket();
+            usapSessionSocket.connect(this.mUsapSocketAddress);
 
-            return blastulaSessionSocket;
+            return usapSessionSocket;
         }
 
         boolean matches(String abi) {
@@ -253,6 +253,11 @@
     private int mHiddenApiAccessLogSampleRate;
 
     /**
+     * Proportion of hidden API accesses that should be logged to statslog; 0 - 0x10000.
+     */
+    private int mHiddenApiAccessStatslogSampleRate;
+
+    /**
      * The state of the connection to the primary zygote.
      */
     private ZygoteState primaryZygoteState;
@@ -263,13 +268,13 @@
     private ZygoteState secondaryZygoteState;
 
     /**
-     * If the blastula pool should be created and used to start applications.
+     * If the USAP pool should be created and used to start applications.
      *
-     * Setting this value to false will disable the creation, maintenance, and use of the blastula
-     * pool.  When the blastula pool is disabled the application lifecycle will be identical to
+     * Setting this value to false will disable the creation, maintenance, and use of the USAP
+     * pool.  When the USAP pool is disabled the application lifecycle will be identical to
      * previous versions of Android.
      */
-    private boolean mBlastulaPoolEnabled = false;
+    private boolean mUsapPoolEnabled = false;
 
     /**
      * Start a new process.
@@ -323,11 +328,11 @@
                                                   @Nullable String packageName,
                                                   @Nullable String[] packagesForUid,
                                                   @Nullable String sandboxId,
-                                                  boolean useBlastulaPool,
+                                                  boolean useUsapPool,
                                                   @Nullable String[] zygoteArgs) {
         // TODO (chriswailes): Is there a better place to check this value?
-        if (fetchBlastulaPoolEnabledPropWithMinInterval()) {
-            informZygotesOfBlastulaPoolStatus();
+        if (fetchUsapPoolEnabledPropWithMinInterval()) {
+            informZygotesOfUsapPoolStatus();
         }
 
         try {
@@ -335,7 +340,7 @@
                     runtimeFlags, mountExternal, targetSdkVersion, seInfo,
                     abi, instructionSet, appDataDir, invokeWith, /*startChildZygote=*/false,
                     packageName, packagesForUid, sandboxId,
-                    useBlastulaPool, zygoteArgs);
+                    useUsapPool, zygoteArgs);
         } catch (ZygoteStartFailedEx ex) {
             Log.e(LOG_TAG,
                     "Starting VM process through Zygote failed");
@@ -383,7 +388,7 @@
      */
     @GuardedBy("mLock")
     private Process.ProcessStartResult zygoteSendArgsAndGetResult(
-            ZygoteState zygoteState, boolean useBlastulaPool, ArrayList<String> args)
+            ZygoteState zygoteState, boolean useUsapPool, ArrayList<String> args)
             throws ZygoteStartFailedEx {
         // Throw early if any of the arguments are malformed. This means we can
         // avoid writing a partial response to the zygote.
@@ -410,41 +415,41 @@
         Process.ProcessStartResult result = new Process.ProcessStartResult();
 
         // TODO (chriswailes): Move branch body into separate function.
-        if (useBlastulaPool && mBlastulaPoolEnabled && isValidBlastulaCommand(args)) {
-            LocalSocket blastulaSessionSocket = null;
+        if (useUsapPool && mUsapPoolEnabled && isValidUsapCommand(args)) {
+            LocalSocket usapSessionSocket = null;
 
             try {
-                blastulaSessionSocket = zygoteState.getBlastulaSessionSocket();
+                usapSessionSocket = zygoteState.getUsapSessionSocket();
 
-                final BufferedWriter blastulaWriter =
+                final BufferedWriter usapWriter =
                         new BufferedWriter(
-                                new OutputStreamWriter(blastulaSessionSocket.getOutputStream()),
+                                new OutputStreamWriter(usapSessionSocket.getOutputStream()),
                                 Zygote.SOCKET_BUFFER_SIZE);
-                final DataInputStream blastulaReader =
-                        new DataInputStream(blastulaSessionSocket.getInputStream());
+                final DataInputStream usapReader =
+                        new DataInputStream(usapSessionSocket.getInputStream());
 
-                blastulaWriter.write(msgStr);
-                blastulaWriter.flush();
+                usapWriter.write(msgStr);
+                usapWriter.flush();
 
-                result.pid = blastulaReader.readInt();
-                // Blastulas can't be used to spawn processes that need wrappers.
+                result.pid = usapReader.readInt();
+                // USAPs can't be used to spawn processes that need wrappers.
                 result.usingWrapper = false;
 
                 if (result.pid < 0) {
-                    throw new ZygoteStartFailedEx("Blastula specialization failed");
+                    throw new ZygoteStartFailedEx("USAP specialization failed");
                 }
 
                 return result;
             } catch (IOException ex) {
-                // If there was an IOException using the blastula pool we will log the error and
+                // If there was an IOException using the USAP pool we will log the error and
                 // attempt to start the process through the Zygote.
-                Log.e(LOG_TAG, "IO Exception while communicating with blastula pool - "
+                Log.e(LOG_TAG, "IO Exception while communicating with USAP pool - "
                                + ex.getMessage());
             } finally {
                 try {
-                    blastulaSessionSocket.close();
+                    usapSessionSocket.close();
                 } catch (IOException ex) {
-                    Log.e(LOG_TAG, "Failed to close blastula session socket: " + ex.getMessage());
+                    Log.e(LOG_TAG, "Failed to close USAP session socket: " + ex.getMessage());
                 }
             }
         }
@@ -476,9 +481,9 @@
     }
 
     /**
-     * Flags that may not be passed to a blastula.
+     * Flags that may not be passed to a USAP.
      */
-    private static final String[] INVALID_BLASTULA_FLAGS = {
+    private static final String[] INVALID_USAP_FLAGS = {
         "--query-abi-list",
         "--get-pid",
         "--preload-default",
@@ -487,17 +492,18 @@
         "--start-child-zygote",
         "--set-api-blacklist-exemptions",
         "--hidden-api-log-sampling-rate",
+        "--hidden-api-statslog-sampling-rate",
         "--invoke-with"
     };
 
     /**
-     * Tests a command list to see if it is valid to send to a blastula.
-     * @param args  Zygote/Blastula command arguments
-     * @return  True if the command can be passed to a blastula; false otherwise
+     * Tests a command list to see if it is valid to send to a USAP.
+     * @param args  Zygote/USAP command arguments
+     * @return  True if the command can be passed to a USAP; false otherwise
      */
-    private static boolean isValidBlastulaCommand(ArrayList<String> args) {
+    private static boolean isValidUsapCommand(ArrayList<String> args) {
         for (String flag : args) {
-            for (String badFlag : INVALID_BLASTULA_FLAGS) {
+            for (String badFlag : INVALID_USAP_FLAGS) {
                 if (flag.startsWith(badFlag)) {
                     return false;
                 }
@@ -545,7 +551,7 @@
                                                       @Nullable String packageName,
                                                       @Nullable String[] packagesForUid,
                                                       @Nullable String sandboxId,
-                                                      boolean useBlastulaPool,
+                                                      boolean useUnspecializedAppProcessPool,
                                                       @Nullable String[] extraArgs)
                                                       throws ZygoteStartFailedEx {
         ArrayList<String> argsForZygote = new ArrayList<String>();
@@ -645,41 +651,41 @@
 
         synchronized(mLock) {
             return zygoteSendArgsAndGetResult(openZygoteSocketIfNeeded(abi),
-                                              useBlastulaPool,
+                                              useUnspecializedAppProcessPool,
                                               argsForZygote);
         }
     }
 
-    private boolean fetchBlastulaPoolEnabledProp() {
-        boolean origVal = mBlastulaPoolEnabled;
+    private boolean fetchUsapPoolEnabledProp() {
+        boolean origVal = mUsapPoolEnabled;
 
         final String propertyString =
                 Zygote.getSystemProperty(
-                        DeviceConfig.RuntimeNative.BLASTULA_POOL_ENABLED,
-                        BLASTULA_POOL_ENABLED_DEFAULT);
+                        DeviceConfig.RuntimeNative.USAP_POOL_ENABLED,
+                        USAP_POOL_ENABLED_DEFAULT);
 
         if (!propertyString.isEmpty()) {
-            mBlastulaPoolEnabled =
+            mUsapPoolEnabled =
                     Zygote.getSystemPropertyBoolean(
-                            DeviceConfig.RuntimeNative.BLASTULA_POOL_ENABLED,
-                            Boolean.parseBoolean(BLASTULA_POOL_ENABLED_DEFAULT));
+                            DeviceConfig.RuntimeNative.USAP_POOL_ENABLED,
+                            Boolean.parseBoolean(USAP_POOL_ENABLED_DEFAULT));
         }
 
-        if (origVal != mBlastulaPoolEnabled) {
-            Log.i(LOG_TAG, "blastulaPoolEnabled = " + mBlastulaPoolEnabled);
+        if (origVal != mUsapPoolEnabled) {
+            Log.i(LOG_TAG, "usapPoolEnabled = " + mUsapPoolEnabled);
         }
 
-        return origVal != mBlastulaPoolEnabled;
+        return origVal != mUsapPoolEnabled;
     }
 
     private long mLastPropCheckTimestamp = 0;
 
-    private boolean fetchBlastulaPoolEnabledPropWithMinInterval() {
+    private boolean fetchUsapPoolEnabledPropWithMinInterval() {
         final long currentTimestamp = SystemClock.elapsedRealtime();
 
         if (currentTimestamp - mLastPropCheckTimestamp >= Zygote.PROPERTY_CHECK_INTERVAL) {
             mLastPropCheckTimestamp = currentTimestamp;
-            return fetchBlastulaPoolEnabledProp();
+            return fetchUsapPoolEnabledProp();
         }
 
         return false;
@@ -776,6 +782,21 @@
         }
     }
 
+    /**
+     * Set the precentage of detected hidden API accesses that are logged to the new event log.
+     *
+     * <p>This rate will take affect for all new processes forked from the zygote after this call.
+     *
+     * @param rate An integer between 0 and 0x10000 inclusive. 0 means no event logging.
+     */
+    public void setHiddenApiAccessStatslogSampleRate(int rate) {
+        synchronized (mLock) {
+            mHiddenApiAccessStatslogSampleRate = rate;
+            maybeSetHiddenApiAccessStatslogSampleRate(primaryZygoteState);
+            maybeSetHiddenApiAccessStatslogSampleRate(secondaryZygoteState);
+        }
+    }
+
     @GuardedBy("mLock")
     private boolean maybeSetApiBlacklistExemptions(ZygoteState state, boolean sendIfEmpty) {
         if (state == null || state.isClosed()) {
@@ -830,6 +851,30 @@
         }
     }
 
+    private void maybeSetHiddenApiAccessStatslogSampleRate(ZygoteState state) {
+        if (state == null || state.isClosed()) {
+            return;
+        }
+        if (mHiddenApiAccessStatslogSampleRate == -1) {
+            return;
+        }
+        try {
+            state.mZygoteOutputWriter.write(Integer.toString(1));
+            state.mZygoteOutputWriter.newLine();
+            state.mZygoteOutputWriter.write("--hidden-api-statslog-sampling-rate="
+                    + Integer.toString(mHiddenApiAccessStatslogSampleRate));
+            state.mZygoteOutputWriter.newLine();
+            state.mZygoteOutputWriter.flush();
+            int status = state.mZygoteInputStream.readInt();
+            if (status != 0) {
+                Slog.e(LOG_TAG, "Failed to set hidden API statslog sampling rate; status "
+                        + status);
+            }
+        } catch (IOException ioe) {
+            Slog.e(LOG_TAG, "Failed to set hidden API statslog sampling rate", ioe);
+        }
+    }
+
     /**
      * Creates a ZygoteState for the primary zygote if it doesn't exist or has been disconnected.
      */
@@ -837,7 +882,7 @@
     private void attemptConnectionToPrimaryZygote() throws IOException {
         if (primaryZygoteState == null || primaryZygoteState.isClosed()) {
             primaryZygoteState =
-                    ZygoteState.connect(mZygoteSocketAddress, mBlastulaPoolSocketAddress);
+                    ZygoteState.connect(mZygoteSocketAddress, mUsapPoolSocketAddress);
 
             maybeSetApiBlacklistExemptions(primaryZygoteState, false);
             maybeSetHiddenApiAccessLogSampleRate(primaryZygoteState);
@@ -852,7 +897,7 @@
         if (secondaryZygoteState == null || secondaryZygoteState.isClosed()) {
             secondaryZygoteState =
                     ZygoteState.connect(mZygoteSecondarySocketAddress,
-                            mBlastulaPoolSecondarySocketAddress);
+                            mUsapPoolSecondarySocketAddress);
 
             maybeSetApiBlacklistExemptions(secondaryZygoteState, false);
             maybeSetHiddenApiAccessLogSampleRate(secondaryZygoteState);
@@ -1007,11 +1052,11 @@
     }
 
     /**
-     * Sends messages to the zygotes telling them to change the status of their blastula pools.  If
+     * Sends messages to the zygotes telling them to change the status of their USAP pools.  If
      * this notification fails the ZygoteProcess will fall back to the previous behavior.
      */
-    private void informZygotesOfBlastulaPoolStatus() {
-        final String command = "1\n--blastula-pool-enabled=" + mBlastulaPoolEnabled + "\n";
+    private void informZygotesOfUsapPoolStatus() {
+        final String command = "1\n--usap-pool-enabled=" + mUsapPoolEnabled + "\n";
 
         synchronized (mLock) {
             try {
@@ -1020,8 +1065,8 @@
                 primaryZygoteState.mZygoteOutputWriter.write(command);
                 primaryZygoteState.mZygoteOutputWriter.flush();
             } catch (IOException ioe) {
-                mBlastulaPoolEnabled = !mBlastulaPoolEnabled;
-                Log.w(LOG_TAG, "Failed to inform zygotes of blastula pool status: "
+                mUsapPoolEnabled = !mUsapPoolEnabled;
+                Log.w(LOG_TAG, "Failed to inform zygotes of USAP pool status: "
                         + ioe.getMessage());
                 return;
             }
@@ -1037,7 +1082,7 @@
                     secondaryZygoteState.mZygoteInputStream.readInt();
                 } catch (IOException ioe) {
                     throw new IllegalStateException(
-                            "Blastula pool state change cause an irrecoverable error",
+                            "USAP pool state change cause an irrecoverable error",
                             ioe);
                 }
             } catch (IOException ioe) {
@@ -1051,7 +1096,7 @@
                 primaryZygoteState.mZygoteInputStream.readInt();
             } catch (IOException ioe) {
                 throw new IllegalStateException(
-                        "Blastula pool state change cause an irrecoverable error",
+                        "USAP pool state change cause an irrecoverable error",
                         ioe);
             }
         }
@@ -1105,7 +1150,7 @@
                     abi, instructionSet, null /* appDataDir */, null /* invokeWith */,
                     true /* startChildZygote */, null /* packageName */,
                     null /* packagesForUid */, null /* sandboxId */,
-                    false /* useBlastulaPool */, extraArgs);
+                    false /* useUsapPool */, extraArgs);
         } catch (ZygoteStartFailedEx ex) {
             throw new RuntimeException("Starting child-zygote through Zygote failed", ex);
         }
diff --git a/core/java/android/os/connectivity/CellularBatteryStats.java b/core/java/android/os/connectivity/CellularBatteryStats.java
index c99ecb32..2e09040 100644
--- a/core/java/android/os/connectivity/CellularBatteryStats.java
+++ b/core/java/android/os/connectivity/CellularBatteryStats.java
@@ -46,7 +46,7 @@
   private long[] mTxTimeMs;
   private long mMonitoredRailChargeConsumedMaMs;
 
-  public static final Parcelable.Creator<CellularBatteryStats> CREATOR = new
+  public static final @android.annotation.NonNull Parcelable.Creator<CellularBatteryStats> CREATOR = new
       Parcelable.Creator<CellularBatteryStats>() {
         public CellularBatteryStats createFromParcel(Parcel in) {
           return new CellularBatteryStats(in);
diff --git a/core/java/android/os/connectivity/GpsBatteryStats.java b/core/java/android/os/connectivity/GpsBatteryStats.java
index f2ac5ef..ef03caa 100644
--- a/core/java/android/os/connectivity/GpsBatteryStats.java
+++ b/core/java/android/os/connectivity/GpsBatteryStats.java
@@ -33,7 +33,7 @@
   private long mEnergyConsumedMaMs;
   private long[] mTimeInGpsSignalQualityLevel;
 
-  public static final Parcelable.Creator<GpsBatteryStats> CREATOR = new
+  public static final @android.annotation.NonNull Parcelable.Creator<GpsBatteryStats> CREATOR = new
       Parcelable.Creator<GpsBatteryStats>() {
         public GpsBatteryStats createFromParcel(Parcel in) {
           return new GpsBatteryStats(in);
diff --git a/core/java/android/os/connectivity/WifiBatteryStats.java b/core/java/android/os/connectivity/WifiBatteryStats.java
index 3639c71..9d2d5d8 100644
--- a/core/java/android/os/connectivity/WifiBatteryStats.java
+++ b/core/java/android/os/connectivity/WifiBatteryStats.java
@@ -46,7 +46,7 @@
   private long[] mTimeInRxSignalStrengthLevelMs;
   private long mMonitoredRailChargeConsumedMaMs;
 
-  public static final Parcelable.Creator<WifiBatteryStats> CREATOR = new
+  public static final @android.annotation.NonNull Parcelable.Creator<WifiBatteryStats> CREATOR = new
       Parcelable.Creator<WifiBatteryStats>() {
         public WifiBatteryStats createFromParcel(Parcel in) {
           return new WifiBatteryStats(in);
diff --git a/core/java/android/os/health/HealthStatsParceler.java b/core/java/android/os/health/HealthStatsParceler.java
index d358a2e..de98359 100644
--- a/core/java/android/os/health/HealthStatsParceler.java
+++ b/core/java/android/os/health/HealthStatsParceler.java
@@ -41,7 +41,7 @@
     private HealthStatsWriter mWriter;
     private HealthStats mHealthStats;
 
-    public static final Parcelable.Creator<HealthStatsParceler> CREATOR
+    public static final @android.annotation.NonNull Parcelable.Creator<HealthStatsParceler> CREATOR
             = new Parcelable.Creator<HealthStatsParceler>() {
         public HealthStatsParceler createFromParcel(Parcel in) {
             return new HealthStatsParceler(in);
diff --git a/core/java/android/os/health/TimerStat.java b/core/java/android/os/health/TimerStat.java
index 6af1faf..4aaa85f 100644
--- a/core/java/android/os/health/TimerStat.java
+++ b/core/java/android/os/health/TimerStat.java
@@ -34,7 +34,7 @@
     /**
      * The CREATOR instance for use by aidl Binder interfaces.
      */
-    public static final Parcelable.Creator<TimerStat> CREATOR
+    public static final @android.annotation.NonNull Parcelable.Creator<TimerStat> CREATOR
             = new Parcelable.Creator<TimerStat>() {
         public TimerStat createFromParcel(Parcel in) {
             return new TimerStat(in);
diff --git a/core/java/android/os/storage/DiskInfo.java b/core/java/android/os/storage/DiskInfo.java
index 828f1c3..b797324 100644
--- a/core/java/android/os/storage/DiskInfo.java
+++ b/core/java/android/os/storage/DiskInfo.java
@@ -198,7 +198,7 @@
     }
 
     @UnsupportedAppUsage(maxTargetSdk = Build.VERSION_CODES.P, trackingBug = 115609023)
-    public static final Creator<DiskInfo> CREATOR = new Creator<DiskInfo>() {
+    public static final @android.annotation.NonNull Creator<DiskInfo> CREATOR = new Creator<DiskInfo>() {
         @Override
         public DiskInfo createFromParcel(Parcel in) {
             return new DiskInfo(in);
diff --git a/core/java/android/os/storage/StorageManager.java b/core/java/android/os/storage/StorageManager.java
index 90a5f76..27e3914 100644
--- a/core/java/android/os/storage/StorageManager.java
+++ b/core/java/android/os/storage/StorageManager.java
@@ -136,6 +136,8 @@
     public static final String PROP_ISOLATED_STORAGE = "persist.sys.isolated_storage";
     /** {@hide} */
     public static final String PROP_ISOLATED_STORAGE_SNAPSHOT = "sys.isolated_storage_snapshot";
+    /** {@hide} */
+    public static final String PROP_LEGACY_GREYLIST = "persist.sys.legacy_greylist";
 
     /** {@hide} */
     public static final String PROP_FORCE_AUDIO = "persist.fw.force_audio";
@@ -233,6 +235,8 @@
     public static final int DEBUG_ISOLATED_STORAGE_FORCE_ON = 1 << 6;
     /** {@hide} */
     public static final int DEBUG_ISOLATED_STORAGE_FORCE_OFF = 1 << 7;
+    /** {@hide} */
+    public static final int DEBUG_LEGACY_GREYLIST = 1 << 8;
 
     /** {@hide} */
     public static final int FLAG_STORAGE_DE = IInstalld.FLAG_STORAGE_DE;
diff --git a/core/java/android/os/storage/StorageVolume.java b/core/java/android/os/storage/StorageVolume.java
index 714a061..225ecfa 100644
--- a/core/java/android/os/storage/StorageVolume.java
+++ b/core/java/android/os/storage/StorageVolume.java
@@ -431,7 +431,7 @@
         pw.decreaseIndent();
     }
 
-    public static final Creator<StorageVolume> CREATOR = new Creator<StorageVolume>() {
+    public static final @android.annotation.NonNull Creator<StorageVolume> CREATOR = new Creator<StorageVolume>() {
         @Override
         public StorageVolume createFromParcel(Parcel in) {
             return new StorageVolume(in);
diff --git a/core/java/android/os/storage/VolumeInfo.java b/core/java/android/os/storage/VolumeInfo.java
index 5d310e1..7699a05 100644
--- a/core/java/android/os/storage/VolumeInfo.java
+++ b/core/java/android/os/storage/VolumeInfo.java
@@ -527,7 +527,7 @@
     }
 
     @UnsupportedAppUsage
-    public static final Creator<VolumeInfo> CREATOR = new Creator<VolumeInfo>() {
+    public static final @android.annotation.NonNull Creator<VolumeInfo> CREATOR = new Creator<VolumeInfo>() {
         @Override
         public VolumeInfo createFromParcel(Parcel in) {
             return new VolumeInfo(in);
diff --git a/core/java/android/os/storage/VolumeRecord.java b/core/java/android/os/storage/VolumeRecord.java
index bc2d55a..b6ee261 100644
--- a/core/java/android/os/storage/VolumeRecord.java
+++ b/core/java/android/os/storage/VolumeRecord.java
@@ -130,7 +130,7 @@
     }
 
     @UnsupportedAppUsage
-    public static final Creator<VolumeRecord> CREATOR = new Creator<VolumeRecord>() {
+    public static final @android.annotation.NonNull Creator<VolumeRecord> CREATOR = new Creator<VolumeRecord>() {
         @Override
         public VolumeRecord createFromParcel(Parcel in) {
             return new VolumeRecord(in);
diff --git a/core/java/android/permission/IPermissionController.aidl b/core/java/android/permission/IPermissionController.aidl
index cb2517e..4f65d24 100644
--- a/core/java/android/permission/IPermissionController.aidl
+++ b/core/java/android/permission/IPermissionController.aidl
@@ -38,8 +38,6 @@
     void countPermissionApps(in List<String> permissionNames, int flags,
             in RemoteCallback callback);
     void getPermissionUsages(boolean countSystem, long numMillis, in RemoteCallback callback);
-    void isApplicationQualifiedForRole(String roleName, String packageName,
-            in RemoteCallback callback);
     void setRuntimePermissionGrantStateByDeviceAdmin(String callerPackageName, String packageName,
             String permission, int grantState, in RemoteCallback callback);
 }
diff --git a/core/java/android/permission/PermissionControllerManager.java b/core/java/android/permission/PermissionControllerManager.java
index 9d58064..61511aa 100644
--- a/core/java/android/permission/PermissionControllerManager.java
+++ b/core/java/android/permission/PermissionControllerManager.java
@@ -454,28 +454,6 @@
     }
 
     /**
-     * Check whether an application is qualified for a role.
-     *
-     * @param roleName name of the role to check for
-     * @param packageName package name of the application to check for
-     * @param executor Executor on which to invoke the callback
-     * @param callback Callback to receive the result
-     *
-     * @hide
-     */
-    @RequiresPermission(Manifest.permission.MANAGE_ROLE_HOLDERS)
-    public void isApplicationQualifiedForRole(@NonNull String roleName, @NonNull String packageName,
-            @NonNull @CallbackExecutor Executor executor, @NonNull Consumer<Boolean> callback) {
-        checkStringNotEmpty(roleName);
-        checkStringNotEmpty(packageName);
-        checkNotNull(executor);
-        checkNotNull(callback);
-
-        mRemoteService.scheduleRequest(new PendingIsApplicationQualifiedForRoleRequest(
-                mRemoteService, roleName, packageName, executor, callback));
-    }
-
-    /**
      * A connection to the remote service
      */
     static final class RemoteService extends
@@ -493,7 +471,8 @@
         RemoteService(@NonNull Context context, @NonNull ComponentName componentName,
                 @NonNull UserHandle user) {
             super(context, SERVICE_INTERFACE, componentName, user.getIdentifier(),
-                    service -> Log.e(TAG, "RemoteService " + service + " died"), false, false, 1);
+                    service -> Log.e(TAG, "RemoteService " + service + " died"),
+                    context.getMainThreadHandler(), false, false, 1);
         }
 
         /**
@@ -1168,58 +1147,4 @@
             }
         }
     }
-
-    /**
-     * Request for {@link #isApplicationQualifiedForRole}.
-     */
-    private static final class PendingIsApplicationQualifiedForRoleRequest extends
-            AbstractRemoteService.PendingRequest<RemoteService, IPermissionController> {
-
-        private final @NonNull String mRoleName;
-        private final @NonNull String mPackageName;
-        private final @NonNull Consumer<Boolean> mCallback;
-
-        private final @NonNull RemoteCallback mRemoteCallback;
-
-        private PendingIsApplicationQualifiedForRoleRequest(@NonNull RemoteService service,
-                @NonNull String roleName, @NonNull String packageName,
-                @NonNull @CallbackExecutor Executor executor, @NonNull Consumer<Boolean> callback) {
-            super(service);
-
-            mRoleName = roleName;
-            mPackageName = packageName;
-            mCallback = callback;
-
-            mRemoteCallback = new RemoteCallback(result -> executor.execute(() -> {
-                long token = Binder.clearCallingIdentity();
-                try {
-                    boolean qualified;
-                    if (result != null) {
-                        qualified = result.getBoolean(KEY_RESULT);
-                    } else {
-                        qualified = false;
-                    }
-                    callback.accept(qualified);
-                } finally {
-                    Binder.restoreCallingIdentity(token);
-                    finish();
-                }
-            }), null);
-        }
-
-        @Override
-        protected void onTimeout(RemoteService remoteService) {
-            mCallback.accept(false);
-        }
-
-        @Override
-        public void run() {
-            try {
-                getService().getServiceInterface().isApplicationQualifiedForRole(mRoleName,
-                        mPackageName, mRemoteCallback);
-            } catch (RemoteException e) {
-                Log.e(TAG, "Error checking whether application qualifies for role", e);
-            }
-        }
-    }
 }
diff --git a/core/java/android/permission/PermissionControllerService.java b/core/java/android/permission/PermissionControllerService.java
index e883d25..2313d59 100644
--- a/core/java/android/permission/PermissionControllerService.java
+++ b/core/java/android/permission/PermissionControllerService.java
@@ -112,6 +112,9 @@
     /**
      * Restore a backup of the runtime permissions.
      *
+     * <p>If an app mentioned in the backup is not installed the state should be saved to later
+     * be restored via {@link #onRestoreDelayedRuntimePermissionsBackup}.
+     *
      * @param user The user to restore
      * @param backup The stream to read the backup from
      */
@@ -120,7 +123,8 @@
             @NonNull InputStream backup);
 
     /**
-     * Restore a delayed backup of the runtime permissions.
+     * Restore the permission state of an app that was provided in
+     * {@link #onRestoreRuntimePermissionsBackup} but could not be restored back then.
      *
      * @param packageName The app to restore
      * @param user The user to restore
@@ -174,17 +178,6 @@
             boolean countSystem, long numMillis);
 
     /**
-     * Check whether an application is qualified for a role.
-     *
-     * @param roleName name of the role to check for
-     * @param packageName package name of the application to check for
-     *
-     * @return whether the application is qualified for the role.
-     */
-    public abstract boolean onIsApplicationQualifiedForRole(@NonNull String roleName,
-            @NonNull String packageName);
-
-    /**
      * Set the runtime permission state from a device admin.
      *
      * @param callerPackageName The package name of the admin requesting the change
@@ -197,7 +190,7 @@
             @NonNull String permission, @PermissionGrantState int grantState);
 
     @Override
-    public final IBinder onBind(Intent intent) {
+    public final @NonNull IBinder onBind(Intent intent) {
         return new IPermissionController.Stub() {
             @Override
             public void revokeRuntimePermissions(
@@ -330,20 +323,6 @@
             }
 
             @Override
-            public void isApplicationQualifiedForRole(String roleName, String packageName,
-                    RemoteCallback callback) {
-                checkStringNotEmpty(roleName);
-                checkStringNotEmpty(packageName);
-                checkNotNull(callback, "callback");
-
-                enforceCallingPermission(Manifest.permission.MANAGE_ROLE_HOLDERS, null);
-
-                mHandler.sendMessage(obtainMessage(
-                        PermissionControllerService::isApplicationQualifiedForRole,
-                        PermissionControllerService.this, roleName, packageName, callback));
-            }
-
-            @Override
             public void setRuntimePermissionGrantStateByDeviceAdmin(String callerPackageName,
                     String packageName, String permission, int grantState,
                     RemoteCallback callback) {
@@ -437,14 +416,6 @@
         }
     }
 
-    private void isApplicationQualifiedForRole(@NonNull String roleName,
-            @NonNull String packageName, @NonNull RemoteCallback callback) {
-        boolean qualified = onIsApplicationQualifiedForRole(roleName, packageName);
-        Bundle result = new Bundle();
-        result.putBoolean(PermissionControllerManager.KEY_RESULT, qualified);
-        callback.sendResult(result);
-    }
-
     private void setRuntimePermissionGrantStateByDeviceAdmin(@NonNull String callerPackageName,
             @NonNull String packageName, @NonNull String permission,
             @PermissionGrantState int grantState, @NonNull RemoteCallback callback) {
diff --git a/core/java/android/permission/RuntimePermissionPresentationInfo.java b/core/java/android/permission/RuntimePermissionPresentationInfo.java
index ed7b05c..4fce14c 100644
--- a/core/java/android/permission/RuntimePermissionPresentationInfo.java
+++ b/core/java/android/permission/RuntimePermissionPresentationInfo.java
@@ -21,6 +21,8 @@
 import android.os.Parcel;
 import android.os.Parcelable;
 
+import com.android.internal.util.Preconditions;
+
 /**
  * This class contains information about how a runtime permission
  * is to be presented in the UI. A single runtime permission
@@ -35,7 +37,7 @@
     private static final int FLAG_GRANTED = 1 << 0;
     private static final int FLAG_STANDARD = 1 << 1;
 
-    private final CharSequence mLabel;
+    private final @NonNull CharSequence mLabel;
     private final int mFlags;
 
     /**
@@ -45,8 +47,10 @@
      * @param granted Whether the permission is granted.
      * @param standard Whether this is a platform-defined permission.
      */
-    public RuntimePermissionPresentationInfo(CharSequence label,
+    public RuntimePermissionPresentationInfo(@NonNull CharSequence label,
             boolean granted, boolean standard) {
+        Preconditions.checkNotNull(label);
+
         mLabel = label;
         int flags = 0;
         if (granted) {
@@ -58,11 +62,6 @@
         mFlags = flags;
     }
 
-    private RuntimePermissionPresentationInfo(Parcel parcel) {
-        mLabel = parcel.readCharSequence();
-        mFlags = parcel.readInt();
-    }
-
     /**
      * @return Whether the permission is granted.
      */
@@ -97,10 +96,14 @@
         parcel.writeInt(mFlags);
     }
 
-    public static final Creator<RuntimePermissionPresentationInfo> CREATOR =
+    public static final @NonNull Creator<RuntimePermissionPresentationInfo> CREATOR =
             new Creator<RuntimePermissionPresentationInfo>() {
         public RuntimePermissionPresentationInfo createFromParcel(Parcel source) {
-            return new RuntimePermissionPresentationInfo(source);
+            CharSequence label = source.readCharSequence();
+            int flags = source.readInt();
+
+            return new RuntimePermissionPresentationInfo(label, (flags & FLAG_GRANTED) != 0,
+                    (flags & FLAG_STANDARD) != 0);
         }
 
         public RuntimePermissionPresentationInfo[] newArray(int size) {
diff --git a/core/java/android/permission/RuntimePermissionUsageInfo.java b/core/java/android/permission/RuntimePermissionUsageInfo.java
index af1a1be..9f954f7 100644
--- a/core/java/android/permission/RuntimePermissionUsageInfo.java
+++ b/core/java/android/permission/RuntimePermissionUsageInfo.java
@@ -83,7 +83,7 @@
         parcel.writeInt(mNumUsers);
     }
 
-    public static final Creator<RuntimePermissionUsageInfo> CREATOR =
+    public static final @android.annotation.NonNull Creator<RuntimePermissionUsageInfo> CREATOR =
             new Creator<RuntimePermissionUsageInfo>() {
         public RuntimePermissionUsageInfo createFromParcel(Parcel source) {
             return new RuntimePermissionUsageInfo(source);
diff --git a/core/java/android/preference/DialogPreference.java b/core/java/android/preference/DialogPreference.java
index 96c8589..e656466 100644
--- a/core/java/android/preference/DialogPreference.java
+++ b/core/java/android/preference/DialogPreference.java
@@ -349,16 +349,31 @@
         dialog.show();
     }
 
+    /**
+     * Get the DecorView.
+     * @return the DecorView for the current dialog window, if it exists.
+     * If the window does not exist, null is returned.
+     */
+    private View getDecorView() {
+        if (mDialog != null && mDialog.getWindow() != null) {
+            return mDialog.getWindow().getDecorView();
+        }
+        return null;
+    }
+
     void postDismiss() {
         removeDismissCallbacks();
-        View decorView = mDialog.getWindow().getDecorView();
-        decorView.post(mDismissRunnable);
+        View decorView = getDecorView();
+        if (decorView != null) {
+            // If decorView is null, dialog was already dismissed
+            decorView.post(mDismissRunnable);
+        }
     }
 
     private void removeDismissCallbacks() {
-        if (mDialog != null && mDialog.getWindow() != null
-                && mDialog.getWindow().getDecorView() != null) {
-            mDialog.getWindow().getDecorView().removeCallbacks(mDismissRunnable);
+        View decorView = getDecorView();
+        if (decorView != null) {
+            decorView.removeCallbacks(mDismissRunnable);
         }
     }
 
@@ -519,7 +534,7 @@
             super(superState);
         }
 
-        public static final Parcelable.Creator<SavedState> CREATOR =
+        public static final @android.annotation.NonNull Parcelable.Creator<SavedState> CREATOR =
                 new Parcelable.Creator<SavedState>() {
             public SavedState createFromParcel(Parcel in) {
                 return new SavedState(in);
diff --git a/core/java/android/preference/EditTextPreference.java b/core/java/android/preference/EditTextPreference.java
index c09cec8..74c5e3e 100644
--- a/core/java/android/preference/EditTextPreference.java
+++ b/core/java/android/preference/EditTextPreference.java
@@ -234,7 +234,7 @@
             super(superState);
         }
 
-        public static final Parcelable.Creator<SavedState> CREATOR =
+        public static final @android.annotation.NonNull Parcelable.Creator<SavedState> CREATOR =
                 new Parcelable.Creator<SavedState>() {
             public SavedState createFromParcel(Parcel in) {
                 return new SavedState(in);
diff --git a/core/java/android/preference/ListPreference.java b/core/java/android/preference/ListPreference.java
index 14c1dc81..830de525 100644
--- a/core/java/android/preference/ListPreference.java
+++ b/core/java/android/preference/ListPreference.java
@@ -348,7 +348,7 @@
             super(superState);
         }
 
-        public static final Parcelable.Creator<SavedState> CREATOR =
+        public static final @android.annotation.NonNull Parcelable.Creator<SavedState> CREATOR =
                 new Parcelable.Creator<SavedState>() {
             public SavedState createFromParcel(Parcel in) {
                 return new SavedState(in);
diff --git a/core/java/android/preference/MultiCheckPreference.java b/core/java/android/preference/MultiCheckPreference.java
index e3d0e26..4b854ad 100644
--- a/core/java/android/preference/MultiCheckPreference.java
+++ b/core/java/android/preference/MultiCheckPreference.java
@@ -329,7 +329,7 @@
             super(superState);
         }
 
-        public static final Parcelable.Creator<SavedState> CREATOR =
+        public static final @android.annotation.NonNull Parcelable.Creator<SavedState> CREATOR =
                 new Parcelable.Creator<SavedState>() {
             public SavedState createFromParcel(Parcel in) {
                 return new SavedState(in);
diff --git a/core/java/android/preference/MultiSelectListPreference.java b/core/java/android/preference/MultiSelectListPreference.java
index 43182d9..3d80717 100644
--- a/core/java/android/preference/MultiSelectListPreference.java
+++ b/core/java/android/preference/MultiSelectListPreference.java
@@ -279,7 +279,7 @@
             dest.writeStringArray(values.toArray(new String[0]));
         }
 
-        public static final Parcelable.Creator<SavedState> CREATOR =
+        public static final @android.annotation.NonNull Parcelable.Creator<SavedState> CREATOR =
                 new Parcelable.Creator<SavedState>() {
             public SavedState createFromParcel(Parcel in) {
                 return new SavedState(in);
diff --git a/core/java/android/preference/Preference.java b/core/java/android/preference/Preference.java
index 3c1ba9d..e82e60d 100644
--- a/core/java/android/preference/Preference.java
+++ b/core/java/android/preference/Preference.java
@@ -2108,7 +2108,7 @@
             super(superState);
         }
 
-        public static final Parcelable.Creator<BaseSavedState> CREATOR =
+        public static final @android.annotation.NonNull Parcelable.Creator<BaseSavedState> CREATOR =
                 new Parcelable.Creator<BaseSavedState>() {
                     public BaseSavedState createFromParcel(Parcel in) {
                         return new BaseSavedState(in);
diff --git a/core/java/android/preference/PreferenceActivity.java b/core/java/android/preference/PreferenceActivity.java
index eab5937..4750971 100644
--- a/core/java/android/preference/PreferenceActivity.java
+++ b/core/java/android/preference/PreferenceActivity.java
@@ -518,7 +518,7 @@
             readFromParcel(in);
         }
 
-        public static final Creator<Header> CREATOR = new Creator<Header>() {
+        public static final @android.annotation.NonNull Creator<Header> CREATOR = new Creator<Header>() {
             public Header createFromParcel(Parcel source) {
                 return new Header(source);
             }
diff --git a/core/java/android/preference/PreferenceScreen.java b/core/java/android/preference/PreferenceScreen.java
index c7653c8..a353dbc 100644
--- a/core/java/android/preference/PreferenceScreen.java
+++ b/core/java/android/preference/PreferenceScreen.java
@@ -315,7 +315,7 @@
             super(superState);
         }
 
-        public static final Parcelable.Creator<SavedState> CREATOR =
+        public static final @android.annotation.NonNull Parcelable.Creator<SavedState> CREATOR =
                 new Parcelable.Creator<SavedState>() {
             public SavedState createFromParcel(Parcel in) {
                 return new SavedState(in);
diff --git a/core/java/android/preference/SeekBarPreference.java b/core/java/android/preference/SeekBarPreference.java
index f789e31..99ab9db 100644
--- a/core/java/android/preference/SeekBarPreference.java
+++ b/core/java/android/preference/SeekBarPreference.java
@@ -249,7 +249,7 @@
         }
 
         @SuppressWarnings("unused")
-        public static final Parcelable.Creator<SavedState> CREATOR =
+        public static final @android.annotation.NonNull Parcelable.Creator<SavedState> CREATOR =
                 new Parcelable.Creator<SavedState>() {
             public SavedState createFromParcel(Parcel in) {
                 return new SavedState(in);
diff --git a/core/java/android/preference/TwoStatePreference.java b/core/java/android/preference/TwoStatePreference.java
index 454472a..bb771d7 100644
--- a/core/java/android/preference/TwoStatePreference.java
+++ b/core/java/android/preference/TwoStatePreference.java
@@ -278,7 +278,7 @@
             super(superState);
         }
 
-        public static final Parcelable.Creator<SavedState> CREATOR =
+        public static final @android.annotation.NonNull Parcelable.Creator<SavedState> CREATOR =
                 new Parcelable.Creator<SavedState>() {
             public SavedState createFromParcel(Parcel in) {
                 return new SavedState(in);
diff --git a/core/java/android/preference/VolumePreference.java b/core/java/android/preference/VolumePreference.java
index 92d848a..a2d5a23 100644
--- a/core/java/android/preference/VolumePreference.java
+++ b/core/java/android/preference/VolumePreference.java
@@ -236,7 +236,7 @@
             super(superState);
         }
 
-        public static final Parcelable.Creator<SavedState> CREATOR =
+        public static final @android.annotation.NonNull Parcelable.Creator<SavedState> CREATOR =
                 new Parcelable.Creator<SavedState>() {
             public SavedState createFromParcel(Parcel in) {
                 return new SavedState(in);
diff --git a/core/java/android/print/PageRange.java b/core/java/android/print/PageRange.java
index 2941283..1345038 100644
--- a/core/java/android/print/PageRange.java
+++ b/core/java/android/print/PageRange.java
@@ -162,7 +162,7 @@
         return builder.toString();
     }
 
-    public static final Parcelable.Creator<PageRange> CREATOR =
+    public static final @android.annotation.NonNull Parcelable.Creator<PageRange> CREATOR =
             new Creator<PageRange>() {
         @Override
         public PageRange createFromParcel(Parcel parcel) {
diff --git a/core/java/android/print/PrintAttributes.java b/core/java/android/print/PrintAttributes.java
index f0d9a0c..e607ced 100644
--- a/core/java/android/print/PrintAttributes.java
+++ b/core/java/android/print/PrintAttributes.java
@@ -1465,7 +1465,7 @@
         }
     }
 
-    public static final Parcelable.Creator<PrintAttributes> CREATOR =
+    public static final @android.annotation.NonNull Parcelable.Creator<PrintAttributes> CREATOR =
             new Creator<PrintAttributes>() {
         @Override
         public PrintAttributes createFromParcel(Parcel parcel) {
diff --git a/core/java/android/print/PrintDocumentInfo.java b/core/java/android/print/PrintDocumentInfo.java
index 55c902e..e10c507 100644
--- a/core/java/android/print/PrintDocumentInfo.java
+++ b/core/java/android/print/PrintDocumentInfo.java
@@ -367,7 +367,7 @@
         }
     }
 
-    public static final Parcelable.Creator<PrintDocumentInfo> CREATOR =
+    public static final @android.annotation.NonNull Parcelable.Creator<PrintDocumentInfo> CREATOR =
             new Creator<PrintDocumentInfo>() {
         @Override
         public PrintDocumentInfo createFromParcel(Parcel parcel) {
diff --git a/core/java/android/print/PrintJobId.java b/core/java/android/print/PrintJobId.java
index 186ae9b..606cbb8 100644
--- a/core/java/android/print/PrintJobId.java
+++ b/core/java/android/print/PrintJobId.java
@@ -109,7 +109,7 @@
         return new PrintJobId(string);
     }
 
-    public static final Parcelable.Creator<PrintJobId> CREATOR =
+    public static final @android.annotation.NonNull Parcelable.Creator<PrintJobId> CREATOR =
             new Parcelable.Creator<PrintJobId>() {
         @Override
         public PrintJobId createFromParcel(Parcel parcel) {
diff --git a/core/java/android/print/PrintJobInfo.java b/core/java/android/print/PrintJobInfo.java
index 41f261b..25f383c 100644
--- a/core/java/android/print/PrintJobInfo.java
+++ b/core/java/android/print/PrintJobInfo.java
@@ -881,7 +881,7 @@
         }
     }
 
-    public static final Parcelable.Creator<PrintJobInfo> CREATOR =
+    public static final @android.annotation.NonNull Parcelable.Creator<PrintJobInfo> CREATOR =
             new Creator<PrintJobInfo>() {
         @Override
         public PrintJobInfo createFromParcel(Parcel parcel) {
diff --git a/core/java/android/print/PrinterCapabilitiesInfo.java b/core/java/android/print/PrinterCapabilitiesInfo.java
index 01c23f6..e465d3b 100644
--- a/core/java/android/print/PrinterCapabilitiesInfo.java
+++ b/core/java/android/print/PrinterCapabilitiesInfo.java
@@ -646,7 +646,7 @@
         }
     }
 
-    public static final Parcelable.Creator<PrinterCapabilitiesInfo> CREATOR =
+    public static final @android.annotation.NonNull Parcelable.Creator<PrinterCapabilitiesInfo> CREATOR =
             new Parcelable.Creator<PrinterCapabilitiesInfo>() {
         @Override
         public PrinterCapabilitiesInfo createFromParcel(Parcel parcel) {
diff --git a/core/java/android/print/PrinterId.java b/core/java/android/print/PrinterId.java
index 659e56f..42570c6 100644
--- a/core/java/android/print/PrinterId.java
+++ b/core/java/android/print/PrinterId.java
@@ -124,7 +124,7 @@
         return builder.toString();
     }
 
-    public static final Parcelable.Creator<PrinterId> CREATOR =
+    public static final @android.annotation.NonNull Parcelable.Creator<PrinterId> CREATOR =
             new Creator<PrinterId>() {
         @Override
         public PrinterId createFromParcel(Parcel parcel) {
diff --git a/core/java/android/print/PrinterInfo.java b/core/java/android/print/PrinterInfo.java
index e79cc65..4d5ccc0 100644
--- a/core/java/android/print/PrinterInfo.java
+++ b/core/java/android/print/PrinterInfo.java
@@ -563,7 +563,7 @@
         }
     }
 
-    public static final Parcelable.Creator<PrinterInfo> CREATOR =
+    public static final @android.annotation.NonNull Parcelable.Creator<PrinterInfo> CREATOR =
             new Parcelable.Creator<PrinterInfo>() {
         @Override
         public PrinterInfo createFromParcel(Parcel parcel) {
diff --git a/core/java/android/printservice/PrintServiceInfo.java b/core/java/android/printservice/PrintServiceInfo.java
index 57f1229..565843e 100644
--- a/core/java/android/printservice/PrintServiceInfo.java
+++ b/core/java/android/printservice/PrintServiceInfo.java
@@ -328,7 +328,7 @@
         return builder.toString();
     }
 
-    public static final Parcelable.Creator<PrintServiceInfo> CREATOR =
+    public static final @android.annotation.NonNull Parcelable.Creator<PrintServiceInfo> CREATOR =
             new Parcelable.Creator<PrintServiceInfo>() {
         @Override
         public PrintServiceInfo createFromParcel(Parcel parcel) {
diff --git a/core/java/android/printservice/recommendation/RecommendationInfo.java b/core/java/android/printservice/recommendation/RecommendationInfo.java
index a327956..156f182 100644
--- a/core/java/android/printservice/recommendation/RecommendationInfo.java
+++ b/core/java/android/printservice/recommendation/RecommendationInfo.java
@@ -182,7 +182,7 @@
      *
      * @see #RecommendationInfo(Parcel)
      */
-    public static final Creator<RecommendationInfo> CREATOR =
+    public static final @android.annotation.NonNull Creator<RecommendationInfo> CREATOR =
             new Creator<RecommendationInfo>() {
                 @Override
                 public RecommendationInfo createFromParcel(Parcel in) {
diff --git a/core/java/android/provider/CalendarContract.java b/core/java/android/provider/CalendarContract.java
index 3e5bd4b..5d34aa6 100644
--- a/core/java/android/provider/CalendarContract.java
+++ b/core/java/android/provider/CalendarContract.java
@@ -183,6 +183,22 @@
     public static final Uri CONTENT_URI = Uri.parse("content://" + AUTHORITY);
 
     /**
+     * The content:// style URL for the top-level cross-profile calendar uris.
+     * {@link android.database.ContentObserver} for this URL in the primary profile will be
+     * notified when there is a change in the managed profile calendar provider.
+     *
+     * @see Events#ENTERPRISE_CONTENT_URI
+     * @see Calendars#ENTERPRISE_CONTENT_URI
+     * @see Instances#ENTERPRISE_CONTENT_URI
+     * @see Instances#ENTERPRISE_CONTENT_BY_DAY_URI
+     * @see Instances#ENTERPRISE_CONTENT_SEARCH_URI
+     * @see Instances#ENTERPRISE_CONTENT_SEARCH_BY_DAY_URI
+     * @hide
+     */
+    public static final Uri ENTERPRISE_CONTENT_URI = Uri.parse(
+            "content://" + AUTHORITY + "/enterprise");
+
+    /**
      * An optional insert, update or delete URI parameter that allows the caller
      * to specify that it is a sync adapter. The default value is false. If set
      * to true, the modified row is not marked as "dirty" (needs to be synced)
diff --git a/core/java/android/provider/DeviceConfig.java b/core/java/android/provider/DeviceConfig.java
index ce28c30..e4593e5 100644
--- a/core/java/android/provider/DeviceConfig.java
+++ b/core/java/android/provider/DeviceConfig.java
@@ -30,13 +30,16 @@
 import android.database.ContentObserver;
 import android.net.Uri;
 import android.provider.Settings.ResetMode;
+import android.util.ArrayMap;
 import android.util.Pair;
 
 import com.android.internal.annotations.GuardedBy;
+import com.android.internal.util.Preconditions;
 
 import java.util.HashMap;
 import java.util.List;
 import java.util.Map;
+import java.util.Set;
 import java.util.concurrent.Executor;
 
 /**
@@ -55,12 +58,23 @@
     public static final Uri CONTENT_URI = Uri.parse("content://" + Settings.AUTHORITY + "/config");
 
     /**
-     * Namespace for all Game Driver features.
+     * Namespace for activity manager related features. These features will be applied
+     * immediately upon change.
      *
      * @hide
      */
     @SystemApi
-    public static final String NAMESPACE_GAME_DRIVER = "game_driver";
+    public static final String NAMESPACE_ACTIVITY_MANAGER = "activity_manager";
+
+    /**
+     * Namespace for all activity manager related features that are used at the native level.
+     * These features are applied at reboot.
+     *
+     * @hide
+     */
+    @SystemApi
+    public static final String NAMESPACE_ACTIVITY_MANAGER_NATIVE_BOOT =
+            "activity_manager_native_boot";
 
     /**
      * Namespace for autofill feature that provides suggestions across all apps when
@@ -73,6 +87,14 @@
     public static final String NAMESPACE_AUTOFILL = "autofill";
 
     /**
+     * Namespace for all networking connectivity related features.
+     *
+     * @hide
+     */
+    @SystemApi
+    public static final String NAMESPACE_CONNECTIVITY = "connectivity";
+
+    /**
      * Namespace for content capture feature used by on-device machine intelligence
      * to provide suggestions in a privacy-safe manner.
      *
@@ -83,6 +105,14 @@
     public static final String NAMESPACE_CONTENT_CAPTURE = "content_capture";
 
     /**
+     * Namespace for all Game Driver features.
+     *
+     * @hide
+     */
+    @SystemApi
+    public static final String NAMESPACE_GAME_DRIVER = "game_driver";
+
+    /**
      * Namespace for all input-related features that are used at the native level.
      * These features are applied at reboot.
      *
@@ -92,6 +122,14 @@
     public static final String NAMESPACE_INPUT_NATIVE_BOOT = "input_native_boot";
 
     /**
+     * Namespace for all media native related features.
+     *
+     * @hide
+     */
+    @SystemApi
+    public static final String NAMESPACE_MEDIA_NATIVE = "media_native";
+
+    /**
      * Namespace for all netd related features.
      *
      * @hide
@@ -100,27 +138,29 @@
     public static final String NAMESPACE_NETD_NATIVE = "netd_native";
 
     /**
-     * Namespace for features related to the ExtServices Notification Assistant.
-     * These features are applied immediately.
+     * Namespace for all runtime native boot related features. Boot in this case refers to the
+     * fact that the properties only take affect after rebooting the device.
      *
      * @hide
      */
     @SystemApi
-    public interface NotificationAssistant {
-        String NAMESPACE = "notification_assistant";
-        /**
-         * Whether the Notification Assistant should generate replies for notifications.
-         */
-        String GENERATE_REPLIES = "generate_replies";
-        /**
-         * Whether the Notification Assistant should generate contextual actions for notifications.
-         */
-        String GENERATE_ACTIONS = "generate_actions";
+    public static final String NAMESPACE_RUNTIME_NATIVE_BOOT = "runtime_native_boot";
 
-        String MAX_MESSAGES_TO_EXTRACT = "max_messages_to_extract";
+    /**
+     * Namespace for System UI related features.
+     *
+     * @hide
+     */
+    @SystemApi
+    public static final String NAMESPACE_SYSTEMUI = "systemui";
 
-        String MAX_SUGGESTIONS = "max_suggestions";
-    }
+    /**
+     * Namespace for TextClassifier related features.
+     *
+     * @hide
+     */
+    @SystemApi
+    public static final String NAMESPACE_TEXTCLASSIFIER = "textclassifier";
 
     /**
      * Namespace for all runtime related features.
@@ -151,66 +191,32 @@
          */
 
         /**
-         * If {@code true}, enables the blastula pool feature.
+         * If {@code true}, enables the unspecialized app process (USAP) pool feature.
          *
          * @hide for internal use only
          */
-        String BLASTULA_POOL_ENABLED = "blastula_pool_enabled";
+        String USAP_POOL_ENABLED = "usap_pool_enabled";
 
         /**
-         * The maximum number of processes to keep in the blastula pool.
+         * The maximum number of processes to keep in the USAP pool.
          *
          * @hide for internal use only
          */
-        String BLASTULA_POOL_SIZE_MAX = "blastula_pool_size_max";
+        String USAP_POOL_SIZE_MAX = "usap_pool_size_max";
 
         /**
-         * The minimum number of processes to keep in the blastula pool.
+         * The minimum number of processes to keep in the USAP pool.
          *
          * @hide for internal use only
          */
-        String BLASTULA_POOL_SIZE_MIN = "blastula_pool_size_min";
+        String USAP_POOL_SIZE_MIN = "usap_pool_size_min";
 
         /**
          * The threshold used to determine if the pool should be refilled.
          *
          * @hide for internal use only
          */
-        String BLASTULA_POOL_REFILL_THRESHOLD = "blastula_refill_threshold";
-    }
-
-    /**
-     * Namespace for all runtime native boot related features. Boot in this case refers to the
-     * fact that the properties only take affect after rebooting the device.
-     *
-     * @hide
-     */
-    @SystemApi
-    public interface RuntimeNativeBoot {
-        String NAMESPACE = "runtime_native_boot";
-    }
-
-    /**
-     * Namespace for all media native related features.
-     *
-     * @hide
-     */
-    @SystemApi
-    public interface MediaNative {
-        /** The flag namespace for media native features. */
-        String NAMESPACE = "media_native";
-    }
-
-    /**
-     * Namespace for all activity manager related features that are used at the native level.
-     * These features are applied at reboot.
-     *
-     * @hide
-     */
-    @SystemApi
-    public interface ActivityManagerNativeBoot {
-        String NAMESPACE = "activity_manager_native_boot";
-        String OFFLOAD_QUEUE_ENABLED = "offload_queue_enabled";
+        String USAP_POOL_REFILL_THRESHOLD = "usap_refill_threshold";
     }
 
     /**
@@ -296,35 +302,6 @@
     }
 
     /**
-     * Namespace for activity manager related features. These features will be applied
-     * immediately upon change.
-     *
-     * @hide
-     */
-    @SystemApi
-    public interface ActivityManager {
-        String NAMESPACE = "activity_manager";
-
-        /**
-         * App compaction flags. See {@link com.android.server.am.AppCompactor}.
-         */
-        String KEY_USE_COMPACTION = "use_compaction";
-        String KEY_COMPACT_ACTION_1 = "compact_action_1";
-        String KEY_COMPACT_ACTION_2 = "compact_action_2";
-        String KEY_COMPACT_THROTTLE_1 = "compact_throttle_1";
-        String KEY_COMPACT_THROTTLE_2 = "compact_throttle_2";
-        String KEY_COMPACT_THROTTLE_3 = "compact_throttle_3";
-        String KEY_COMPACT_THROTTLE_4 = "compact_throttle_4";
-        String KEY_COMPACT_STATSD_SAMPLE_RATE = "compact_statsd_sample_rate";
-
-        /**
-         * Maximum number of cached processes. See
-         * {@link com.android.server.am.ActivityManagerConstants}.
-         */
-        String KEY_MAX_CACHED_PROCESSES = "max_cached_processes";
-    }
-
-    /**
      * Namespace for {@link AttentionManagerService} related features.
      *
      * @hide
@@ -347,18 +324,40 @@
      */
     @SystemApi
     public interface Rollback {
+
+        /**
+         * Namespace for flags that can be changed immediately after becoming available on device.
+         */
         String NAMESPACE = "rollback";
 
+        /**
+         * Namespace for flags that can be changed only after reboot.
+         */
         String BOOT_NAMESPACE = "rollback_boot";
 
         /**
-         * Timeout in milliseconds for enabling package rollback.
+         * Timeout duration in milliseconds for enabling package rollback. If we fail to enable
+         * rollback within that period, the install will proceed without rollback enabled.
+         *
+         * <p>If flag value is negative, the default value will be assigned.
+         *
+         * Flag type: {@code long}
+         * Namespace: Rollback.NAMESPACE
          */
         String ENABLE_ROLLBACK_TIMEOUT = "enable_rollback_timeout";
 
-       /**
-        * The lifetime duration of rollback packages in millis
-        */
+        /**
+         * Lifetime duration of rollback packages in millis. A rollback will be available for
+         * at most that duration of time after a package is installed with
+         * {@link PackageInstaller.SessionParams#setEnableRollback()}.
+         *
+         * <p>If flag value is negative, the default value will be assigned.
+         *
+         * @see RollbackManager
+         *
+         * Flag type: {@code long}
+         * Namespace: Rollback.BOOT_NAMESPACE
+         */
         String ROLLBACK_LIFETIME_IN_MILLIS = "rollback_lifetime_in_millis";
     }
 
@@ -400,8 +399,11 @@
 
     private static final Object sLock = new Object();
     @GuardedBy("sLock")
-    private static Map<OnPropertyChangedListener, Pair<String, Executor>> sListeners =
-            new HashMap<>();
+    private static ArrayMap<OnPropertyChangedListener, Pair<String, Executor>> sSingleListeners =
+            new ArrayMap<>();
+    @GuardedBy("sLock")
+    private static ArrayMap<OnPropertiesChangedListener, Pair<String, Executor>> sListeners =
+            new ArrayMap<>();
     @GuardedBy("sLock")
     private static Map<String, Pair<ContentObserver, Integer>> sNamespaces = new HashMap<>();
 
@@ -427,6 +429,110 @@
     }
 
     /**
+     * Look up the String value of a property for a particular namespace.
+     *
+     * @param namespace    The namespace containing the property to look up.
+     * @param name         The name of the property to look up.
+     * @param defaultValue The value to return if the property does not exist or has no non-null
+     *                     value.
+     * @return the corresponding value, or defaultValue if none exists.
+     * @hide
+     */
+    @SystemApi
+    @TestApi
+    @RequiresPermission(READ_DEVICE_CONFIG)
+    public static String getString(String namespace, String name, String defaultValue) {
+        String value = getProperty(namespace, name);
+        return value != null ? value : defaultValue;
+    }
+
+    /**
+     * Look up the boolean value of a property for a particular namespace.
+     *
+     * @param namespace The namespace containing the property to look up.
+     * @param name      The name of the property to look up.
+     * @param defaultValue The value to return if the property does not exist or has no non-null
+     *                     value.
+     * @return the corresponding value, or defaultValue if none exists.
+     * @hide
+     */
+    @SystemApi
+    @TestApi
+    @RequiresPermission(READ_DEVICE_CONFIG)
+    public static boolean getBoolean(String namespace, String name, boolean defaultValue) {
+        String value = getProperty(namespace, name);
+        return value != null ? Boolean.parseBoolean(value) : defaultValue;
+    }
+
+    /**
+     * Look up the int value of a property for a particular namespace.
+     *
+     * @param namespace The namespace containing the property to look up.
+     * @param name      The name of the property to look up.
+     * @param defaultValue The value to return if the property does not exist, has no non-null
+     *                     value, or fails to parse into an int.
+     * @return the corresponding value, or defaultValue if either none exists or it does not parse.
+     * @hide
+     */
+    @SystemApi
+    @TestApi
+    @RequiresPermission(READ_DEVICE_CONFIG)
+    public static int getInt(String namespace, String name, int defaultValue) {
+        String value = getProperty(namespace, name);
+        try {
+            return Integer.parseInt(value);
+        } catch (NumberFormatException e) {
+            return defaultValue;
+        }
+    }
+
+    /**
+     * Look up the long value of a property for a particular namespace.
+     *
+     * @param namespace The namespace containing the property to look up.
+     * @param name      The name of the property to look up.
+     * @param defaultValue The value to return if the property does not exist, has no non-null
+     *                     value, or fails to parse into a long.
+     * @return the corresponding value, or defaultValue if either none exists or it does not parse.
+     * @hide
+     */
+    @SystemApi
+    @TestApi
+    @RequiresPermission(READ_DEVICE_CONFIG)
+    public static long getLong(String namespace, String name, long defaultValue) {
+        String value = getProperty(namespace, name);
+        try {
+            return Long.parseLong(value);
+        } catch (NumberFormatException e) {
+            return defaultValue;
+        }
+    }
+
+    /**
+     * Look up the float value of a property for a particular namespace.
+     *
+     * @param namespace The namespace containing the property to look up.
+     * @param name      The name of the property to look up.
+     * @param defaultValue The value to return if the property does not exist, has no non-null
+     *                     value, or fails to parse into a float.
+     * @return the corresponding value, or defaultValue if either none exists or it does not parse.
+     * @hide
+     */
+    @SystemApi
+    @TestApi
+    @RequiresPermission(READ_DEVICE_CONFIG)
+    public static float getFloat(String namespace, String name, float defaultValue) {
+        String value = getProperty(namespace, name);
+        try {
+            return Float.parseFloat(value);
+        } catch (NumberFormatException e) {
+            return defaultValue;
+        } catch (NullPointerException e) {
+            return defaultValue;
+        }
+    }
+
+    /**
      * Create a new property with the the provided name and value in the provided namespace, or
      * update the value of such a property if it already exists. The same name can exist in multiple
      * namespaces and might have different values in any or all namespaces.
@@ -495,20 +601,58 @@
             @NonNull String namespace,
             @NonNull @CallbackExecutor Executor executor,
             @NonNull OnPropertyChangedListener onPropertyChangedListener) {
-        // TODO enforce READ_DEVICE_CONFIG permission
         synchronized (sLock) {
-            Pair<String, Executor> oldNamespace = sListeners.get(onPropertyChangedListener);
+            Pair<String, Executor> oldNamespace = sSingleListeners.get(onPropertyChangedListener);
             if (oldNamespace == null) {
                 // Brand new listener, add it to the list.
-                sListeners.put(onPropertyChangedListener, new Pair<>(namespace, executor));
+                sSingleListeners.put(onPropertyChangedListener, new Pair<>(namespace, executor));
                 incrementNamespace(namespace);
             } else if (namespace.equals(oldNamespace.first)) {
                 // Listener is already registered for this namespace, update executor just in case.
-                sListeners.put(onPropertyChangedListener, new Pair<>(namespace, executor));
+                sSingleListeners.put(onPropertyChangedListener, new Pair<>(namespace, executor));
             } else {
                 // Update this listener from an old namespace to the new one.
-                decrementNamespace(sListeners.get(onPropertyChangedListener).first);
-                sListeners.put(onPropertyChangedListener, new Pair<>(namespace, executor));
+                decrementNamespace(sSingleListeners.get(onPropertyChangedListener).first);
+                sSingleListeners.put(onPropertyChangedListener, new Pair<>(namespace, executor));
+                incrementNamespace(namespace);
+            }
+        }
+    }
+
+    /**
+     * Add a listener for property changes.
+     * <p>
+     * This listener will be called whenever properties in the specified namespace change. Callbacks
+     * will be made on the specified executor. Future calls to this method with the same listener
+     * will replace the old namespace and executor. Remove the listener entirely by calling
+     * {@link #removeOnPropertiesChangedListener(OnPropertiesChangedListener)}.
+     *
+     * @param namespace                   The namespace containing properties to monitor.
+     * @param executor                    The executor which will be used to run callbacks.
+     * @param onPropertiesChangedListener The listener to add.
+     * @hide
+     * @see #removeOnPropertiesChangedListener(OnPropertiesChangedListener)
+     */
+    @SystemApi
+    @TestApi
+    @RequiresPermission(READ_DEVICE_CONFIG)
+    public static void addOnPropertiesChangedListener(
+            @NonNull String namespace,
+            @NonNull @CallbackExecutor Executor executor,
+            @NonNull OnPropertiesChangedListener onPropertiesChangedListener) {
+        synchronized (sLock) {
+            Pair<String, Executor> oldNamespace = sListeners.get(onPropertiesChangedListener);
+            if (oldNamespace == null) {
+                // Brand new listener, add it to the list.
+                sListeners.put(onPropertiesChangedListener, new Pair<>(namespace, executor));
+                incrementNamespace(namespace);
+            } else if (namespace.equals(oldNamespace.first)) {
+                // Listener is already registered for this namespace, update executor just in case.
+                sListeners.put(onPropertiesChangedListener, new Pair<>(namespace, executor));
+            } else {
+                // Update this listener from an old namespace to the new one.
+                decrementNamespace(sListeners.get(onPropertiesChangedListener).first);
+                sListeners.put(onPropertiesChangedListener, new Pair<>(namespace, executor));
                 incrementNamespace(namespace);
             }
         }
@@ -525,11 +669,33 @@
     @SystemApi
     @TestApi
     public static void removeOnPropertyChangedListener(
-            OnPropertyChangedListener onPropertyChangedListener) {
+            @NonNull OnPropertyChangedListener onPropertyChangedListener) {
+        Preconditions.checkNotNull(onPropertyChangedListener);
         synchronized (sLock) {
-            if (sListeners.containsKey(onPropertyChangedListener)) {
-                decrementNamespace(sListeners.get(onPropertyChangedListener).first);
-                sListeners.remove(onPropertyChangedListener);
+            if (sSingleListeners.containsKey(onPropertyChangedListener)) {
+                decrementNamespace(sSingleListeners.get(onPropertyChangedListener).first);
+                sSingleListeners.remove(onPropertyChangedListener);
+            }
+        }
+    }
+
+    /**
+     * Remove a listener for property changes. The listener will receive no further notification of
+     * property changes.
+     *
+     * @param onPropertiesChangedListener The listener to remove.
+     * @hide
+     * @see #addOnPropertiesChangedListener(String, Executor, OnPropertiesChangedListener)
+     */
+    @SystemApi
+    @TestApi
+    public static void removeOnPropertiesChangedListener(
+            @NonNull OnPropertiesChangedListener onPropertiesChangedListener) {
+        Preconditions.checkNotNull(onPropertiesChangedListener);
+        synchronized (sLock) {
+            if (sListeners.containsKey(onPropertiesChangedListener)) {
+                decrementNamespace(sListeners.get(onPropertiesChangedListener).first);
+                sListeners.remove(onPropertiesChangedListener);
             }
         }
     }
@@ -594,16 +760,34 @@
     private static void handleChange(Uri uri) {
         List<String> pathSegments = uri.getPathSegments();
         // pathSegments(0) is "config"
-        String namespace = pathSegments.get(1);
-        String name = pathSegments.get(2);
-        String value = getProperty(namespace, name);
+        final String namespace = pathSegments.get(1);
+        final String name = pathSegments.get(2);
+        final String value = getProperty(namespace, name);
         synchronized (sLock) {
-            for (OnPropertyChangedListener listener : sListeners.keySet()) {
-                if (namespace.equals(sListeners.get(listener).first)) {
-                    sListeners.get(listener).second.execute(new Runnable() {
+            // OnPropertiesChangedListeners
+            for (int i = 0; i < sListeners.size(); i++) {
+                if (namespace.equals(sListeners.valueAt(i).first)) {
+                    final int j = i;
+                    sListeners.valueAt(i).second.execute(new Runnable() {
                         @Override
                         public void run() {
-                            listener.onPropertyChanged(namespace, name, value);
+                            Map<String, String> propertyMap = new HashMap(1);
+                            propertyMap.put(name, value);
+                            sListeners.keyAt(j)
+                                    .onPropertiesChanged(new Properties(namespace, propertyMap));
+                        }
+
+                    });
+                }
+            }
+            // OnPropertyChangedListeners
+            for (int i = 0; i < sSingleListeners.size(); i++) {
+                if (namespace.equals(sSingleListeners.valueAt(i).first)) {
+                    final int j = i;
+                    sSingleListeners.valueAt(i).second.execute(new Runnable() {
+                        @Override
+                        public void run() {
+                            sSingleListeners.keyAt(j).onPropertyChanged(namespace, name, value);
                         }
 
                     });
@@ -613,7 +797,7 @@
     }
 
     /**
-     * Interface for monitoring to properties.
+     * Interface for monitoring single property changes.
      * <p>
      * Override {@link #onPropertyChanged(String, String, String)} to handle callbacks for changes.
      *
@@ -631,4 +815,149 @@
          */
         void onPropertyChanged(String namespace, String name, String value);
     }
+
+    /**
+     * Interface for monitoring changes to properties.
+     * <p>
+     * Override {@link #onPropertiesChanged(Properties)} to handle callbacks for changes.
+     *
+     * @hide
+     */
+    @SystemApi
+    @TestApi
+    public interface OnPropertiesChangedListener {
+        /**
+         * Called when one or more properties have changed.
+         *
+         * @param properties Contains the complete collection of properties which have changed for a
+         *                   single namespace.
+         */
+        void onPropertiesChanged(@NonNull Properties properties);
+    }
+
+    /**
+     * A mapping of properties to values, as well as a single namespace which they all belong to.
+     *
+     * @hide
+     */
+    @SystemApi
+    @TestApi
+    public static class Properties {
+        private final String mNamespace;
+        private final HashMap<String, String> mMap;
+
+        /**
+         * Create a mapping of properties to values and the namespace they belong to.
+         *
+         * @param namespace The namespace these properties belong to.
+         * @param keyValueMap A map between property names and property values.
+         */
+        Properties(@NonNull String namespace, @Nullable Map<String, String> keyValueMap) {
+            Preconditions.checkNotNull(namespace);
+            mNamespace = namespace;
+            mMap = new HashMap();
+            if (keyValueMap != null) {
+                mMap.putAll(keyValueMap);
+            }
+        }
+
+        /**
+         * @return the namespace all properties within this instance belong to.
+         */
+        @NonNull
+        public String getNamespace() {
+            return mNamespace;
+        }
+
+        /**
+         * @return the non-null set of property names.
+         */
+        @NonNull
+        public Set<String> getKeyset() {
+            return mMap.keySet();
+        }
+
+        /**
+         * Look up the String value of a property.
+         *
+         * @param name         The name of the property to look up.
+         * @param defaultValue The value to return if the property has not been defined.
+         * @return the corresponding value, or defaultValue if none exists.
+         */
+        @Nullable
+        public String getString(@NonNull String name, @Nullable String defaultValue) {
+            Preconditions.checkNotNull(name);
+            String value = mMap.get(name);
+            return value != null ? value : defaultValue;
+        }
+
+        /**
+         * Look up the boolean value of a property.
+         *
+         * @param name         The name of the property to look up.
+         * @param defaultValue The value to return if the property has not been defined.
+         * @return the corresponding value, or defaultValue if none exists.
+         */
+        public boolean getBoolean(@NonNull String name, boolean defaultValue) {
+            Preconditions.checkNotNull(name);
+            String value = mMap.get(name);
+            return value != null ? Boolean.parseBoolean(value) : defaultValue;
+        }
+
+        /**
+         * Look up the int value of a property.
+         *
+         * @param name         The name of the property to look up.
+         * @param defaultValue The value to return if the property has not been defined or fails to
+         *                     parse into an int.
+         * @return the corresponding value, or defaultValue if no valid int is available.
+         */
+        public int getInt(@NonNull String name, int defaultValue) {
+            Preconditions.checkNotNull(name);
+            String value = mMap.get(name);
+            try {
+                return Integer.parseInt(value);
+            } catch (NumberFormatException e) {
+                return defaultValue;
+            }
+        }
+
+        /**
+         * Look up the long value of a property.
+         *
+         * @param name         The name of the property to look up.
+         * @param defaultValue The value to return if the property has not been defined. or fails to
+         *                     parse into a long.
+         * @return the corresponding value, or defaultValue if no valid long is available.
+         */
+        public long getLong(@NonNull String name, long defaultValue) {
+            Preconditions.checkNotNull(name);
+            String value = mMap.get(name);
+            try {
+                return Long.parseLong(value);
+            } catch (NumberFormatException e) {
+                return defaultValue;
+            }
+        }
+
+        /**
+         * Look up the int value of a property.
+         *
+         * @param name         The name of the property to look up.
+         * @param defaultValue The value to return if the property has not been defined. or fails to
+         *                     parse into a float.
+         * @return the corresponding value, or defaultValue if no valid float is available.
+         */
+        public float getFloat(@NonNull String name, float defaultValue) {
+            Preconditions.checkNotNull(name);
+            String value = mMap.get(name);
+            try {
+                return Float.parseFloat(value);
+            } catch (NumberFormatException e) {
+                return defaultValue;
+            } catch (NullPointerException e) {
+                return defaultValue;
+            }
+        }
+    }
 }
diff --git a/core/java/android/provider/DocumentsContract.java b/core/java/android/provider/DocumentsContract.java
index d282967..4632b75 100644
--- a/core/java/android/provider/DocumentsContract.java
+++ b/core/java/android/provider/DocumentsContract.java
@@ -1252,7 +1252,8 @@
      * {@hide}
      */
     @SystemApi
-    public static Uri setManageMode(Uri uri) {
+    public static @NonNull Uri setManageMode(@NonNull Uri uri) {
+        Preconditions.checkNotNull(uri, "uri can not be null");
         return uri.buildUpon().appendQueryParameter(PARAM_MANAGE, "true").build();
     }
 
@@ -1262,7 +1263,8 @@
      * {@hide}
      */
     @SystemApi
-    public static boolean isManageMode(Uri uri) {
+    public static boolean isManageMode(@NonNull Uri uri) {
+        Preconditions.checkNotNull(uri, "uri can not be null");
         return uri.getBooleanQueryParameter(PARAM_MANAGE, false);
     }
 
@@ -1794,7 +1796,7 @@
             return 0;
         }
 
-        public static final Creator<Path> CREATOR = new Creator<Path>() {
+        public static final @android.annotation.NonNull Creator<Path> CREATOR = new Creator<Path>() {
             @Override
             public Path createFromParcel(Parcel in) {
                 final String rootId = in.readString();
diff --git a/core/java/android/provider/DocumentsProvider.java b/core/java/android/provider/DocumentsProvider.java
index 9b9e2de..2143a0d 100644
--- a/core/java/android/provider/DocumentsProvider.java
+++ b/core/java/android/provider/DocumentsProvider.java
@@ -471,10 +471,12 @@
      * the most recently modified documents.
      * <p>
      * If this method is overriden by the concrete DocumentsProvider and
-     * QUERY_ARGS_LIMIT is specified with a nonnegative int under queryArgs, the
-     * result will be limited by that number and QUERY_ARG_LIMIT will be
-     * specified under EXTRA_HONORED_ARGS. Otherwise, a default 64 limit will
-     * be used and no QUERY_ARG* will be specified under EXTRA_HONORED_ARGS.
+     * {@link ContentResolver#QUERY_ARG_LIMIT} is specified with a nonnegative
+     * int under queryArgs, the result will be limited by that number and
+     * {@link ContentResolver#QUERY_ARG_LIMIT} will be specified under
+     * {@link ContentResolver#EXTRA_HONORED_ARGS}. Otherwise, a default 64 limit
+     * will be used and no QUERY_ARG* will be specified under
+     * {@link ContentResolver#EXTRA_HONORED_ARGS}.
      * <p>
      * Recent documents do not support change notifications.
      *
@@ -487,10 +489,12 @@
      * @see DocumentsContract#EXTRA_LOADING
      */
     @SuppressWarnings("unused")
+    @Nullable
     public Cursor queryRecentDocuments(
-            String rootId, String[] projection, @Nullable Bundle queryArgs,
-            @Nullable CancellationSignal signal)
-            throws FileNotFoundException {
+            @NonNull String rootId, @Nullable String[] projection, @Nullable Bundle queryArgs,
+            @Nullable CancellationSignal signal) throws FileNotFoundException {
+        Preconditions.checkNotNull(rootId, "rootId can not be null");
+
         Cursor c = queryRecentDocuments(rootId, projection);
         Bundle extras = new Bundle();
         c.setExtras(extras);
@@ -697,8 +701,9 @@
      * @see DocumentsContract#EXTRA_ERROR
      */
     @SuppressWarnings("unused")
-    public Cursor querySearchDocuments(@NonNull String rootId, @Nullable String[] projection,
-            @NonNull Bundle queryArgs) throws FileNotFoundException {
+    @Nullable
+    public Cursor querySearchDocuments(@NonNull String rootId,
+            @Nullable String[] projection, @NonNull Bundle queryArgs) throws FileNotFoundException {
         Preconditions.checkNotNull(rootId, "rootId can not be null");
         Preconditions.checkNotNull(queryArgs, "queryArgs can not be null");
         return querySearchDocuments(rootId, DocumentsContract.getSearchDocumentsQuery(queryArgs),
diff --git a/core/java/android/provider/MediaStore.java b/core/java/android/provider/MediaStore.java
index 643307e..1486333 100644
--- a/core/java/android/provider/MediaStore.java
+++ b/core/java/android/provider/MediaStore.java
@@ -98,7 +98,7 @@
     /** The authority for the media provider */
     public static final String AUTHORITY = "media";
     /** A content:// style uri to the authority for the media provider */
-    public static final Uri AUTHORITY_URI = Uri.parse("content://" + AUTHORITY);
+    public static final @NonNull Uri AUTHORITY_URI = Uri.parse("content://" + AUTHORITY);
 
     /**
      * Volume name used for content on "internal" storage of device. This
@@ -146,6 +146,8 @@
     public static final String RETRANSLATE_CALL = "update_titles";
 
     /** {@hide} */
+    public static final String GET_VERSION_CALL = "get_version";
+    /** {@hide} */
     public static final String GET_DOCUMENT_URI_CALL = "get_document_uri";
     /** {@hide} */
     public static final String GET_MEDIA_URI_CALL = "get_media_uri";
@@ -529,7 +531,6 @@
      *
      * @see MediaColumns#IS_PENDING
      * @see MediaStore#setIncludePending(Uri)
-     * @see MediaStore#createPending(Context, PendingParams)
      */
     public static @NonNull Uri setIncludePending(@NonNull Uri uri) {
         return setIncludePending(uri.buildUpon()).build();
@@ -586,7 +587,9 @@
      * @see MediaColumns#IS_PENDING
      * @see MediaStore#setIncludePending(Uri)
      * @see MediaStore#createPending(Context, PendingParams)
+     * @removed
      */
+    @Deprecated
     public static @NonNull Uri createPending(@NonNull Context context,
             @NonNull PendingParams params) {
         return context.getContentResolver().insert(params.insertUri, params.insertValues);
@@ -599,14 +602,19 @@
      *
      * @param uri token which was previously returned from
      *            {@link #createPending(Context, PendingParams)}.
+     * @removed
      */
+    @Deprecated
     public static @NonNull PendingSession openPending(@NonNull Context context, @NonNull Uri uri) {
         return new PendingSession(context, uri);
     }
 
     /**
      * Parameters that describe a pending media item.
+     *
+     * @removed
      */
+    @Deprecated
     public static class PendingParams {
         /** {@hide} */
         public final Uri insertUri;
@@ -711,7 +719,10 @@
      * expected to have a short lifetime, and owners should either
      * {@link PendingSession#publish()} or {@link PendingSession#abandon()} a
      * pending item within a few hours after first creating it.
+     *
+     * @removed
      */
+    @Deprecated
     public static class PendingSession implements AutoCloseable {
         /** {@hide} */
         private final Context mContext;
@@ -976,9 +987,7 @@
          * Flag indicating if a media item is pending, and still being inserted
          * by its owner.
          *
-         * @see MediaColumns#IS_PENDING
          * @see MediaStore#setIncludePending(Uri)
-         * @see MediaStore#createPending(Context, PendingParams)
          */
         @Column(Cursor.FIELD_TYPE_INTEGER)
         public static final String IS_PENDING = "is_pending";
@@ -998,12 +1007,8 @@
 
         /**
          * The time the media item should be considered expired. Typically only
-         * meaningful in the context of {@link #IS_PENDING} or
-         * {@link #IS_TRASHED}.
-         *
-         * @removed
+         * meaningful in the context of {@link #IS_PENDING}.
          */
-        @Deprecated
         @CurrentTimeSecondsLong
         @Column(Cursor.FIELD_TYPE_INTEGER)
         public static final String DATE_EXPIRES = "date_expires";
@@ -1030,8 +1035,6 @@
         /**
          * The primary directory name this media exists under. The value may be
          * {@code NULL} if the media doesn't have a primary directory name.
-         *
-         * @see PendingParams#setPrimaryDirectory(String)
          */
         @Column(Cursor.FIELD_TYPE_STRING)
         public static final String PRIMARY_DIRECTORY = "primary_directory";
@@ -1039,8 +1042,6 @@
         /**
          * The secondary directory name this media exists under. The value may
          * be {@code NULL} if the media doesn't have a secondary directory name.
-         *
-         * @see PendingParams#setSecondaryDirectory(String)
          */
         @Column(Cursor.FIELD_TYPE_STRING)
         public static final String SECONDARY_DIRECTORY = "secondary_directory";
@@ -1292,12 +1293,7 @@
     }
 
     /**
-     * Container for downloaded files.
-     *
-     * <p>
-     * Querying for downloads from this table will return files contributed via
-     * {@link PendingSession} and also ones which were downloaded using
-     * {@link android.app.DownloadManager} APIs.
+     * Collection of downloaded items.
      */
     public static final class Downloads implements DownloadColumns {
         private Downloads() {}
@@ -1305,6 +1301,7 @@
         /**
          * The content:// style URI for the internal storage.
          */
+        @NonNull
         public static final Uri INTERNAL_CONTENT_URI =
                 getContentUri("internal");
 
@@ -1312,6 +1309,7 @@
          * The content:// style URI for the "primary" external storage
          * volume.
          */
+        @NonNull
         public static final Uri EXTERNAL_CONTENT_URI =
                 getContentUri("external");
 
@@ -1336,13 +1334,13 @@
          * @param volumeName the name of the volume to get the URI for
          * @return the URI to the image media table on the given volume
          */
-        public static Uri getContentUri(String volumeName) {
+        public static @NonNull Uri getContentUri(@NonNull String volumeName) {
             return AUTHORITY_URI.buildUpon().appendPath(volumeName)
                     .appendPath("downloads").build();
         }
 
         /** @hide */
-        public static Uri getContentUriForPath(@NonNull String path) {
+        public static @NonNull Uri getContentUriForPath(@NonNull String path) {
             return getContentUri(getVolumeName(new File(path)));
         }
 
@@ -1620,9 +1618,9 @@
              * @param name The name of the image
              * @param description The description of the image
              * @return The URL to the newly created image
-             * @deprecated inserting of images should be performed through
-             *             {@link MediaStore#createPending(Context, PendingParams)},
-             *             which offers richer control over lifecycle.
+             * @deprecated inserting of images should be performed using
+             *             {@link MediaColumns#IS_PENDING}, which offers richer
+             *             control over lifecycle.
              */
             @Deprecated
             public static final String insertImage(ContentResolver cr, String imagePath,
@@ -1651,9 +1649,9 @@
              * @param description The description of the image
              * @return The URL to the newly created image, or <code>null</code> if the image failed to be stored
              *              for any reason.
-             * @deprecated inserting of images should be performed through
-             *             {@link MediaStore#createPending(Context, PendingParams)},
-             *             which offers richer control over lifecycle.
+             * @deprecated inserting of images should be performed using
+             *             {@link MediaColumns#IS_PENDING}, which offers richer
+             *             control over lifecycle.
              */
             @Deprecated
             public static final String insertImage(ContentResolver cr, Bitmap source,
@@ -3180,7 +3178,7 @@
      * {@link MediaStore.Images.Media#getContentUri(String)} to query media at
      * that location.
      */
-    public static @NonNull Set<String> getAllVolumeNames(Context context) {
+    public static @NonNull Set<String> getAllVolumeNames(@NonNull Context context) {
         final StorageManager sm = context.getSystemService(StorageManager.class);
         final Set<String> volumeNames = new ArraySet<>();
         volumeNames.add(VOLUME_INTERNAL);
@@ -3322,21 +3320,41 @@
     public static final String MEDIA_IGNORE_FILENAME = ".nomedia";
 
     /**
-     * Get the media provider's version.
-     * Applications that import data from the media provider into their own caches
-     * can use this to detect that the media provider changed, and reimport data
-     * as needed. No other assumptions should be made about the meaning of the version.
-     * @param context Context to use for performing the query.
-     * @return A version string, or null if the version could not be determined.
+     * Return an opaque version string describing the {@link MediaStore} state.
+     * <p>
+     * Applications that import data from {@link MediaStore} into their own
+     * caches can use this to detect that {@link MediaStore} has undergone
+     * substantial changes, and that data should be rescanned.
+     * <p>
+     * No other assumptions should be made about the meaning of the version.
+     * <p>
+     * This method returns the version for {@link MediaStore#VOLUME_EXTERNAL};
+     * to obtain a version for a different volume, use
+     * {@link #getVersion(Context, String)}.
      */
-    public static String getVersion(Context context) {
-        final Uri uri = AUTHORITY_URI.buildUpon().appendPath("none").appendPath("version").build();
-        try (Cursor c = context.getContentResolver().query(uri, null, null, null, null)) {
-            if (c.moveToFirst()) {
-                return c.getString(0);
-            }
+    public static @NonNull String getVersion(@NonNull Context context) {
+        return getVersion(context, VOLUME_EXTERNAL);
+    }
+
+    /**
+     * Return an opaque version string describing the {@link MediaStore} state.
+     * <p>
+     * Applications that import data from {@link MediaStore} into their own
+     * caches can use this to detect that {@link MediaStore} has undergone
+     * substantial changes, and that data should be rescanned.
+     * <p>
+     * No other assumptions should be made about the meaning of the version.
+     */
+    public static @NonNull String getVersion(@NonNull Context context, @NonNull String volumeName) {
+        final ContentResolver resolver = context.getContentResolver();
+        try (ContentProviderClient client = resolver.acquireContentProviderClient(AUTHORITY)) {
+            final Bundle in = new Bundle();
+            in.putString(Intent.EXTRA_TEXT, volumeName);
+            final Bundle out = client.call(GET_VERSION_CALL, null, in);
+            return out.getString(Intent.EXTRA_TEXT);
+        } catch (RemoteException e) {
+            throw e.rethrowAsRuntimeException();
         }
-        return null;
     }
 
     /**
@@ -3354,7 +3372,7 @@
      *         if no equivalent was found.
      * @see #getMediaUri(Context, Uri)
      */
-    public static Uri getDocumentUri(Context context, Uri mediaUri) {
+    public static @Nullable Uri getDocumentUri(@NonNull Context context, @NonNull Uri mediaUri) {
         final ContentResolver resolver = context.getContentResolver();
         final List<UriPermission> uriPermissions = resolver.getPersistedUriPermissions();
 
@@ -3384,7 +3402,7 @@
      *         equivalent was found.
      * @see #getDocumentUri(Context, Uri)
      */
-    public static Uri getMediaUri(Context context, Uri documentUri) {
+    public static @Nullable Uri getMediaUri(@NonNull Context context, @NonNull Uri documentUri) {
         final ContentResolver resolver = context.getContentResolver();
         final List<UriPermission> uriPermissions = resolver.getPersistedUriPermissions();
 
diff --git a/core/java/android/provider/Settings.java b/core/java/android/provider/Settings.java
index 0d7e00f..4836e6c 100644
--- a/core/java/android/provider/Settings.java
+++ b/core/java/android/provider/Settings.java
@@ -308,6 +308,22 @@
             "android.settings.ACCESSIBILITY_SETTINGS";
 
     /**
+     * Activity Action: Show detail settings of a particular accessibility service.
+     * <p>
+     * In some cases, a matching Activity may not exist, so ensure you safeguard against this.
+     * <p>
+     * Input: {@link Intent#EXTRA_COMPONENT_NAME} must specify the accessibility service component
+     * name to be shown.
+     * <p>
+     * Output: Nothing.
+     * @hide
+     **/
+    @SystemApi
+    @SdkConstant(SdkConstantType.ACTIVITY_INTENT_ACTION)
+    public static final String ACTION_ACCESSIBILITY_DETAILS_SETTINGS =
+            "android.settings.ACCESSIBILITY_DETAILS_SETTINGS";
+
+    /**
      * Activity Action: Show settings to control access to usage information.
      * <p>
      * In some cases, a matching Activity may not exist, so ensure you
@@ -496,25 +512,16 @@
      * In some cases, a matching Activity may not exist, so ensure you safeguard
      * against this by checking WifiManager.isEasyConnectSupported();
      * <p>
-     * Input:
-     * The following keys in the bundle with their associated value.
-     * <ul>
-     *     <li>"qrCode": Standard Easy Connect (Wi-Fi DPP) URI bootstrapping information as a
-     *     string.</li>
-     * </ul>
+     * Input: The Intent's data URI specifies bootstrapping information for authenticating and
+     * provisioning the peer, with the "DPP" scheme.
      * <p>
-     * Output: Nothing.
+     * Output: After {@code startActivityForResult}, the callback {@code onActivityResult} will have
+     *         resultCode {@link android.app.Activity#RESULT_OK} if Wi-Fi Easy Connect configuration
+     *         success and the user clicks 'Done' button.
      */
     @SdkConstant(SdkConstantType.ACTIVITY_INTENT_ACTION)
-    public static final String ACTION_PROCESS_WIFI_EASY_CONNECT_QR_CODE =
-            "android.settings.PROCESS_WIFI_EASY_CONNECT_QR_CODE";
-
-    /**
-     * An extra to put in the bundle for {@link #ACTION_PROCESS_WIFI_EASY_CONNECT_QR_CODE} intents.
-     * It must contain properly formatted Easy Connect (Wi-Fi DPP) URI bootstrapping information for
-     * the process to proceed.
-     */
-    public static final String EXTRA_QR_CODE = "android.provider.extra.QR_CODE";
+    public static final String ACTION_PROCESS_WIFI_EASY_CONNECT_URI =
+            "android.settings.PROCESS_WIFI_EASY_CONNECT_URI";
 
     /**
      * Activity Action: Show settings to allow configuration of data and view data usage.
@@ -1679,14 +1686,7 @@
      * Input: Nothing.
      *
      * <p>
-     * Output: {@link android.app.Activity#RESULT_OK} if user enabled Content Capture,
-     * {@link android.app.Activity#RESULT_CANCELED} if user disabled it, cancelled, or if the caller
-     * is not the Content Capture service associated with the user.
-     *
-     * <p>
-     * <b>NOTE: </b> Caller should call
-     * {@link android.view.contentcapture.ContentCaptureManager#isContentCaptureFeatureEnabled()}
-     * first to check whether the feature is already enabled.
+     * Output: Nothing
      *
      * @hide
      */
@@ -3314,6 +3314,17 @@
                         ColorDisplayManager.COLOR_MODE_AUTOMATIC);
 
         /**
+         * The user selected peak refresh rate in frames per second.
+         *
+         * If this isn't set, the system falls back to a device specific default.
+         * @hide
+         */
+        public static final String PEAK_REFRESH_RATE = "peak_refresh_rate";
+
+        private static final Validator PEAK_REFRESH_RATE_VALIDATOR =
+                new SettingsValidators.InclusiveFloatRangeValidator(24f, Float.MAX_VALUE);
+
+        /**
          * The amount of time in milliseconds before the device goes to sleep or begins
          * to dream after a period of inactivity.  This value is also known as the
          * user activity timeout period since the screen isn't necessarily turned off
@@ -5740,7 +5751,11 @@
                 "autofill_user_data_min_value_length";
 
         /**
-         * Defines whether Content Capture is enabled  for the user.
+         * Defines whether Content Capture is enabled for the user.
+         *
+         * <p>Type: {@code int} ({@code 0} for disabled, {@code 1} for enabled).
+         * <p>Default: enabled
+         *
          * @hide
          */
         @TestApi
@@ -7535,6 +7550,15 @@
         private static final Validator SKIP_GESTURE_VALIDATOR = BOOLEAN_VALIDATOR;
 
         /**
+         * Count of successful gestures.
+         * @hide
+         */
+        public static final String SKIP_GESTURE_COUNT = "skip_gesture_count";
+
+        private static final Validator SKIP_GESTURE_COUNT_VALIDATOR =
+                NON_NEGATIVE_INTEGER_VALIDATOR;
+
+        /**
          * Gesture that silences sound (alarms, notification, calls).
          * @hide
          */
@@ -7543,6 +7567,34 @@
         private static final Validator SILENCE_GESTURE_VALIDATOR = BOOLEAN_VALIDATOR;
 
         /**
+         * Count of successful silence alarms gestures.
+         * @hide
+         */
+        public static final String SILENCE_ALARMS_GESTURE_COUNT = "silence_alarms_gesture_count";
+
+        /**
+         * Count of successful silence timer gestures.
+         * @hide
+         */
+        public static final String SILENCE_TIMER_GESTURE_COUNT = "silence_timer_gesture_count";
+
+        /**
+         * Count of successful silence call gestures.
+         * @hide
+         */
+        public static final String SILENCE_CALL_GESTURE_COUNT = "silence_call_gesture_count";
+
+        /**
+         * Count of successful silence notification gestures.
+         * @hide
+         */
+        public static final String SILENCE_NOTIFICATION_GESTURE_COUNT =
+                "silence_notification_gesture_count";
+
+        private static final Validator SILENCE_GESTURE_COUNT_VALIDATOR =
+                NON_NEGATIVE_INTEGER_VALIDATOR;
+
+        /**
          * The current night mode that has been selected by the user.  Owned
          * and controlled by UiModeManagerService.  Constants are as per
          * UiModeManager.
@@ -7989,6 +8041,16 @@
                 BOOLEAN_VALIDATOR;
 
         /**
+         * Whether or not face unlock dismisses the keyguard.
+         * @hide
+         */
+        public static final String FACE_UNLOCK_DISMISSES_KEYGUARD =
+                "face_unlock_dismisses_keyguard";
+
+        private static final Validator FACE_UNLOCK_DISMISSES_KEYGUARD_VALIDATOR =
+                BOOLEAN_VALIDATOR;
+
+        /**
          * Whether or not face unlock is allowed for apps (through BiometricPrompt).
          * @hide
          */
@@ -7999,9 +8061,9 @@
 
         /**
          * Whether or not face unlock always requires user confirmation, meaning {@link
-         * android.hardware.biometrics.BiometricPrompt.Builder#setRequireConfirmation(boolean)}
+         * android.hardware.biometrics.BiometricPrompt.Builder#setConfirmationRequired(boolean)}
          * is always 'true'. This overrides the behavior that apps choose in the
-         * setRequireConfirmation API.
+         * setConfirmationRequired API.
          * @hide
          */
         public static final String FACE_UNLOCK_ALWAYS_REQUIRE_CONFIRMATION =
@@ -8541,6 +8603,19 @@
         public static final String LOCATION_ACCESS_CHECK_DELAY_MILLIS =
                 "location_access_check_delay_millis";
 
+        /**
+         * What should happen to the location permissions when upgraded to Android Q.
+         *
+         * <ul>
+         *     <li>0/unset == revoke permissions</li>
+         *     <li>anything else == Don't do anything</li>
+         * </ul>
+         *
+         * @hide
+         */
+        @SystemApi
+        public static final String LOCATION_PERMISSIONS_UPGRADE_TO_Q_MODE =
+                "location_permissions_upgrade_to_q_mode";
 
         /**
          * Comma separated list of enabled overlay packages for all android.theme.customization.*
@@ -8649,6 +8724,7 @@
             NFC_PAYMENT_DEFAULT_COMPONENT,
             AUTOMATIC_STORAGE_MANAGER_DAYS_TO_RETAIN,
             FACE_UNLOCK_KEYGUARD_ENABLED,
+            FACE_UNLOCK_DISMISSES_KEYGUARD,
             FACE_UNLOCK_APP_ENABLED,
             FACE_UNLOCK_ALWAYS_REQUIRE_CONFIRMATION,
             ASSIST_GESTURE_ENABLED,
@@ -8688,6 +8764,11 @@
             SILENCE_GESTURE,
             THEME_CUSTOMIZATION_OVERLAY_PACKAGES,
             AWARE_ENABLED,
+            SKIP_GESTURE_COUNT,
+            SILENCE_ALARMS_GESTURE_COUNT,
+            SILENCE_NOTIFICATION_GESTURE_COUNT,
+            SILENCE_CALL_GESTURE_COUNT,
+            SILENCE_TIMER_GESTURE_COUNT,
         };
 
         /**
@@ -8810,6 +8891,8 @@
             VALIDATORS.put(AUTOMATIC_STORAGE_MANAGER_DAYS_TO_RETAIN,
                     AUTOMATIC_STORAGE_MANAGER_DAYS_TO_RETAIN_VALIDATOR);
             VALIDATORS.put(FACE_UNLOCK_KEYGUARD_ENABLED, FACE_UNLOCK_KEYGUARD_ENABLED_VALIDATOR);
+            VALIDATORS.put(FACE_UNLOCK_DISMISSES_KEYGUARD,
+                    FACE_UNLOCK_DISMISSES_KEYGUARD_VALIDATOR);
             VALIDATORS.put(FACE_UNLOCK_APP_ENABLED, FACE_UNLOCK_APP_ENABLED_VALIDATOR);
             VALIDATORS.put(FACE_UNLOCK_ALWAYS_REQUIRE_CONFIRMATION,
                     FACE_UNLOCK_ALWAYS_REQUIRE_CONFIRMATION_VALIDATOR);
@@ -8862,6 +8945,11 @@
             VALIDATORS.put(THEME_CUSTOMIZATION_OVERLAY_PACKAGES,
                     THEME_CUSTOMIZATION_OVERLAY_PACKAGES_VALIDATOR);
             VALIDATORS.put(AWARE_ENABLED, AWARE_ENABLED_VALIDATOR);
+            VALIDATORS.put(SKIP_GESTURE_COUNT, SKIP_GESTURE_COUNT_VALIDATOR);
+            VALIDATORS.put(SILENCE_ALARMS_GESTURE_COUNT, SILENCE_GESTURE_COUNT_VALIDATOR);
+            VALIDATORS.put(SILENCE_TIMER_GESTURE_COUNT, SILENCE_GESTURE_COUNT_VALIDATOR);
+            VALIDATORS.put(SILENCE_CALL_GESTURE_COUNT, SILENCE_GESTURE_COUNT_VALIDATOR);
+            VALIDATORS.put(SILENCE_NOTIFICATION_GESTURE_COUNT, SILENCE_GESTURE_COUNT_VALIDATOR);
         }
 
         /**
@@ -9048,6 +9136,8 @@
          */
         public static final String APPLY_RAMPING_RINGER = "apply_ramping_ringer";
 
+        private static final Validator APPLY_RAMPING_RINGER_VALIDATOR = BOOLEAN_VALIDATOR;
+
         /**
          * Setting whether the global gesture for enabling accessibility is enabled.
          * If this gesture is enabled the user will be able to perfrom it to enable
@@ -9635,6 +9725,7 @@
          * when user location settings are off), for emergency purposes.
          * @hide
          */
+        @TestApi
         public static final String LOCATION_IGNORE_SETTINGS_PACKAGE_WHITELIST =
                 "location_ignore_settings_package_whitelist";
 
@@ -10665,7 +10756,7 @@
 
         /**
          * Setting to enable the Wi-Fi link probing.
-         * Disabled by default, and setting it to 1 will enable it.
+         * Enabled by default, and setting it to 0 will disable it.
          * The value is boolean (0 or 1).
          * @hide
          */
@@ -11118,8 +11209,9 @@
 
         /**
          * The threshold value for the number of consecutive dns timeout events received to be a
-         * signal of data stall. Set the value to 0 or less than 0 to disable. Note that the value
-         * should be larger than 0 if the DNS data stall detection is enabled.
+         * signal of data stall. The number of consecutive timeouts needs to be {@code >=} this
+         * threshold to be considered a data stall. Set the value to {@code <= 0} to disable. Note
+         * that the value should be {@code > 0} if the DNS data stall detection is enabled.
          *
          * @hide
          */
@@ -11150,9 +11242,12 @@
                 "data_stall_valid_dns_time_threshold";
 
         /**
-         * Which data stall detection signal to use. Possible values are a union of the powers of 2
-         * of DATA_STALL_EVALUATION_TYPE_*.
+         * Which data stall detection signal to use. This is a bitmask constructed by bitwise-or-ing
+         * (i.e. {@code |}) the DATA_STALL_EVALUATION_TYPE_* values.
          *
+         * Type: int
+         * Valid values:
+         *   {@link #DATA_STALL_EVALUATION_TYPE_DNS} : Use dns as a signal.
          * @hide
          */
         @SystemApi
@@ -11160,6 +11255,15 @@
         public static final String DATA_STALL_EVALUATION_TYPE = "data_stall_evaluation_type";
 
         /**
+         * Use dns timeout counts to detect data stall.
+         *
+         * @hide
+         */
+        @SystemApi
+        @TestApi
+        public static final int DATA_STALL_EVALUATION_TYPE_DNS = 1;
+
+        /**
          * Whether to try cellular data recovery when a bad network is reported.
          *
          * @hide
@@ -11434,6 +11538,15 @@
                 "background_activity_starts_enabled";
 
         /**
+         * The packages temporarily whitelisted to be able so start activities from background.
+         * The list of packages is {@code ":"} colon delimited.
+         *
+         * @hide
+         */
+        public static final String BACKGROUND_ACTIVITY_STARTS_PACKAGE_NAMES_WHITELIST =
+                "background_activity_starts_package_names_whitelist";
+
+        /**
          * @hide
          * @see com.android.server.appbinding.AppBindingConstants
          */
@@ -11876,22 +11989,24 @@
          * entity_list_default use ":" as delimiter for values. Ex:
          *
          * <pre>
-         * smart_linkify_enabled                    (boolean)
-         * system_textclassifier_enabled            (boolean)
-         * model_dark_launch_enabled                (boolean)
-         * smart_selection_enabled                  (boolean)
-         * smart_text_share_enabled                 (boolean)
-         * smart_linkify_enabled                    (boolean)
-         * smart_select_animation_enabled           (boolean)
-         * suggest_selection_max_range_length       (int)
-         * classify_text_max_range_length           (int)
-         * generate_links_max_text_length           (int)
-         * generate_links_log_sample_rate           (int)
-         * entity_list_default                      (String[])
-         * entity_list_not_editable                 (String[])
-         * entity_list_editable                     (String[])
-         * lang_id_threshold_override               (float)
-         * template_intent_factory_enabled          (boolean)
+         * smart_linkify_enabled                            (boolean)
+         * system_textclassifier_enabled                    (boolean)
+         * model_dark_launch_enabled                        (boolean)
+         * smart_selection_enabled                          (boolean)
+         * smart_text_share_enabled                         (boolean)
+         * smart_linkify_enabled                            (boolean)
+         * smart_select_animation_enabled                   (boolean)
+         * suggest_selection_max_range_length               (int)
+         * classify_text_max_range_length                   (int)
+         * generate_links_max_text_length                   (int)
+         * generate_links_log_sample_rate                   (int)
+         * entity_list_default                              (String[])
+         * entity_list_not_editable                         (String[])
+         * entity_list_editable                             (String[])
+         * in_app_conversation_action_types_default         (String[])
+         * notification_conversation_action_types_default   (String[])
+         * lang_id_threshold_override                       (float)
+         * template_intent_factory_enabled                  (boolean)
          * </pre>
          *
          * <p>
@@ -13376,8 +13491,8 @@
                 "hidden_api_blacklist_exemptions";
 
         /**
-         * Sampling rate for hidden API access event logs, as an integer in the range 0 to 0x10000
-         * inclusive.
+         * Sampling rate for hidden API access event logs with libmetricslogger, as an integer in
+         * the range 0 to 0x10000 inclusive.
          *
          * @hide
          */
@@ -13385,6 +13500,15 @@
                 "hidden_api_access_log_sampling_rate";
 
         /**
+         * Sampling rate for hidden API access event logging with statslog, as an integer in the
+         * range 0 to 0x10000 inclusive.
+         *
+         * @hide
+         */
+        public static final String HIDDEN_API_ACCESS_STATSLOG_SAMPLING_RATE =
+                "hidden_api_access_statslog_sampling_rate";
+
+        /**
          * Hidden API enforcement policy for apps.
          *
          * Values correspond to @{@link
@@ -13449,6 +13573,7 @@
          * @hide
          */
         public static final String[] SETTINGS_TO_BACKUP = {
+            APPLY_RAMPING_RINGER,
             BUGREPORT_IN_POWER_MENU,
             STAY_ON_WHILE_PLUGGED_IN,
             APP_AUTO_RESTRICTION_ENABLED,
@@ -13489,6 +13614,7 @@
          */
         public static final Map<String, Validator> VALIDATORS = new ArrayMap<>();
         static {
+            VALIDATORS.put(APPLY_RAMPING_RINGER, APPLY_RAMPING_RINGER_VALIDATOR);
             VALIDATORS.put(BUGREPORT_IN_POWER_MENU, BUGREPORT_IN_POWER_MENU_VALIDATOR);
             VALIDATORS.put(STAY_ON_WHILE_PLUGGED_IN, STAY_ON_WHILE_PLUGGED_IN_VALIDATOR);
             VALIDATORS.put(AUTO_TIME, AUTO_TIME_VALIDATOR);
@@ -14537,6 +14663,14 @@
          */
         public static final String BATTERY_CHARGING_STATE_UPDATE_DELAY =
                 "battery_charging_state_update_delay";
+
+        /**
+         * A serialized string of params that will be loaded into a text classifier action model.
+         *
+         * @hide
+         */
+        public static final String TEXT_CLASSIFIER_ACTION_MODEL_PARAMS =
+                "text_classifier_action_model_params";
     }
 
     /**
@@ -14871,6 +15005,17 @@
                 "android.settings.panel.action.NFC";
 
         /**
+         * Activity Action: Show a settings dialog containing controls for Wifi.
+         * <p>
+         * Input: Nothing.
+         * <p>
+         * Output: Nothing.
+         */
+        @SdkConstant(SdkConstant.SdkConstantType.ACTIVITY_INTENT_ACTION)
+        public static final String ACTION_WIFI =
+                "android.settings.panel.action.WIFI";
+
+        /**
          * Activity Action: Show a settings dialog containing all volume streams.
          * <p>
          * Input: Nothing.
diff --git a/core/java/android/rolecontrollerservice/IRoleControllerService.aidl b/core/java/android/rolecontrollerservice/IRoleControllerService.aidl
deleted file mode 100644
index 40852ea..0000000
--- a/core/java/android/rolecontrollerservice/IRoleControllerService.aidl
+++ /dev/null
@@ -1,37 +0,0 @@
-/*
- * Copyright (C) 2018 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.rolecontrollerservice;
-
-import android.app.role.IRoleManagerCallback;
-
-/**
- * @hide
- */
-oneway interface IRoleControllerService {
-
-    void onAddRoleHolder(in String roleName, in String packageName, int flags,
-                         in IRoleManagerCallback callback);
-
-    void onRemoveRoleHolder(in String roleName, in String packageName, int flags,
-                           in IRoleManagerCallback callback);
-
-    void onClearRoleHolders(in String roleName, int flags, in IRoleManagerCallback callback);
-
-    void onGrantDefaultRoles(in IRoleManagerCallback callback);
-
-    void onSmsKillSwitchToggled(boolean smsRestrictionEnabled);
-}
diff --git a/core/java/android/rolecontrollerservice/RoleControllerService.java b/core/java/android/rolecontrollerservice/RoleControllerService.java
deleted file mode 100644
index c846b07..0000000
--- a/core/java/android/rolecontrollerservice/RoleControllerService.java
+++ /dev/null
@@ -1,197 +0,0 @@
-/*
- * Copyright (C) 2018 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.rolecontrollerservice;
-
-import android.annotation.NonNull;
-import android.annotation.Nullable;
-import android.annotation.SystemApi;
-import android.app.Service;
-import android.app.role.IRoleManagerCallback;
-import android.app.role.RoleManager;
-import android.app.role.RoleManagerCallback;
-import android.content.Intent;
-import android.os.IBinder;
-import android.os.RemoteException;
-import android.os.UserHandle;
-import android.util.Log;
-
-import com.android.internal.util.Preconditions;
-
-import java.util.concurrent.Executor;
-
-/**
- * Abstract base class for the role controller service.
- * <p>
- * Subclass should implement the business logic for role management, including enforcing role
- * requirements and granting or revoking relevant privileges of roles. This class can only be
- * implemented by the permission controller app which is registered in {@code PackageManager}.
- *
- * @hide
- */
-@SystemApi
-public abstract class RoleControllerService extends Service {
-
-    private static final String LOG_TAG = RoleControllerService.class.getSimpleName();
-
-    /**
-     * The {@link Intent} that must be declared as handled by the service. The service should also
-     * require the {@link android.Manifest.permission#BIND_ROLE_CONTROLLER_SERVICE} permission so
-     * that other applications can not abuse it.
-     */
-    public static final String SERVICE_INTERFACE =
-            "android.rolecontrollerservice.RoleControllerService";
-
-    @Nullable
-    @Override
-    public final IBinder onBind(@Nullable Intent intent) {
-        return new IRoleControllerService.Stub() {
-
-            @Override
-            public void onAddRoleHolder(String roleName, String packageName, int flags,
-                    IRoleManagerCallback callback) {
-                Preconditions.checkStringNotEmpty(roleName, "roleName cannot be null or empty");
-                Preconditions.checkStringNotEmpty(packageName,
-                        "packageName cannot be null or empty");
-                Preconditions.checkNotNull(callback, "callback cannot be null");
-                RoleControllerService.this.onAddRoleHolder(roleName, packageName, flags,
-                        new RoleManagerCallbackDelegate(callback));
-            }
-
-            @Override
-            public void onRemoveRoleHolder(String roleName, String packageName, int flags,
-                    IRoleManagerCallback callback) {
-                Preconditions.checkStringNotEmpty(roleName, "roleName cannot be null or empty");
-                Preconditions.checkStringNotEmpty(packageName,
-                        "packageName cannot be null or empty");
-                Preconditions.checkNotNull(callback, "callback cannot be null");
-                RoleControllerService.this.onRemoveRoleHolder(roleName, packageName, flags,
-                        new RoleManagerCallbackDelegate(callback));
-            }
-
-            @Override
-            public void onClearRoleHolders(String roleName, int flags,
-                    IRoleManagerCallback callback) {
-                Preconditions.checkStringNotEmpty(roleName, "roleName cannot be null or empty");
-                Preconditions.checkNotNull(callback, "callback cannot be null");
-                RoleControllerService.this.onClearRoleHolders(roleName, flags,
-                        new RoleManagerCallbackDelegate(callback));
-            }
-
-            @Override
-            public void onGrantDefaultRoles(IRoleManagerCallback callback) {
-                Preconditions.checkNotNull(callback, "callback cannot be null");
-                RoleControllerService.this.onGrantDefaultRoles(new RoleManagerCallbackDelegate(
-                        callback));
-            }
-
-            @Override
-            public void onSmsKillSwitchToggled(boolean smsRestrictionEnabled) {
-                RoleControllerService.this.onSmsKillSwitchToggled(smsRestrictionEnabled);
-            }
-        };
-    }
-
-    /**
-     * Add a specific application to the holders of a role. If the role is exclusive, the previous
-     * holder will be replaced.
-     * <p>
-     * Implementation should enforce the role requirements and grant or revoke the relevant
-     * privileges of roles.
-     *
-     * @param roleName the name of the role to add the role holder for
-     * @param packageName the package name of the application to add to the role holders
-     * @param flags optional behavior flags
-     * @param callback the callback for whether this call is successful
-     *
-     * @see RoleManager#addRoleHolderAsUser(String, String, int, UserHandle, Executor,
-     *      RoleManagerCallback)
-     */
-    public abstract void onAddRoleHolder(@NonNull String roleName, @NonNull String packageName,
-            @RoleManager.ManageHoldersFlags int flags, @NonNull RoleManagerCallback callback);
-
-    /**
-     * Remove a specific application from the holders of a role.
-     *
-     * @param roleName the name of the role to remove the role holder for
-     * @param packageName the package name of the application to remove from the role holders
-     * @param flags optional behavior flags
-     * @param callback the callback for whether this call is successful
-     *
-     * @see RoleManager#removeRoleHolderAsUser(String, String, int, UserHandle, Executor,
-     *      RoleManagerCallback)
-     */
-    public abstract void onRemoveRoleHolder(@NonNull String roleName, @NonNull String packageName,
-            @RoleManager.ManageHoldersFlags int flags, @NonNull RoleManagerCallback callback);
-
-    /**
-     * Remove all holders of a role.
-     *
-     * @param roleName the name of the role to remove role holders for
-     * @param flags optional behavior flags
-     * @param callback the callback for whether this call is successful
-     *
-     * @see RoleManager#clearRoleHoldersAsUser(String, int, UserHandle, Executor,
-     *      RoleManagerCallback)
-     */
-    public abstract void onClearRoleHolders(@NonNull String roleName,
-            @RoleManager.ManageHoldersFlags int flags, @NonNull RoleManagerCallback callback);
-
-    /**
-     * Cleanup appop/permissions state in response to sms kill switch toggle
-     *
-     * @param smsRestrictionEnabled whether kill switch was turned on
-     */
-    //STOPSHIP: remove this api before shipping a final version
-    public abstract void onSmsKillSwitchToggled(boolean smsRestrictionEnabled);
-
-    /**
-     * Called by system to grant default permissions and roles.
-     * <p>
-     * This is typically when creating a new user or upgrading either system or
-     * permission controller package
-     *
-     * @param callback the callback for whether this call is successful
-     */
-    public abstract void onGrantDefaultRoles(@NonNull RoleManagerCallback callback);
-
-    private static class RoleManagerCallbackDelegate implements RoleManagerCallback {
-
-        private IRoleManagerCallback mCallback;
-
-        RoleManagerCallbackDelegate(IRoleManagerCallback callback) {
-            mCallback = callback;
-        }
-
-        @Override
-        public void onSuccess() {
-            try {
-                mCallback.onSuccess();
-            } catch (RemoteException e) {
-                Log.e(LOG_TAG, "Error calling onSuccess() callback");
-            }
-        }
-
-        @Override
-        public void onFailure() {
-            try {
-                mCallback.onFailure();
-            } catch (RemoteException e) {
-                Log.e(LOG_TAG, "Error calling onFailure() callback");
-            }
-        }
-    }
-}
diff --git a/core/java/android/security/KeystoreArguments.java b/core/java/android/security/KeystoreArguments.java
index 7d85ca7..e634234 100644
--- a/core/java/android/security/KeystoreArguments.java
+++ b/core/java/android/security/KeystoreArguments.java
@@ -29,7 +29,7 @@
     public byte[][] args;
 
     @UnsupportedAppUsage
-    public static final Parcelable.Creator<KeystoreArguments> CREATOR = new
+    public static final @android.annotation.NonNull Parcelable.Creator<KeystoreArguments> CREATOR = new
             Parcelable.Creator<KeystoreArguments>() {
                 public KeystoreArguments createFromParcel(Parcel in) {
                     return new KeystoreArguments(in);
diff --git a/core/java/android/security/keymaster/ExportResult.java b/core/java/android/security/keymaster/ExportResult.java
index 1ab79fb..1be5ae9 100644
--- a/core/java/android/security/keymaster/ExportResult.java
+++ b/core/java/android/security/keymaster/ExportResult.java
@@ -34,7 +34,7 @@
     }
 
     @UnsupportedAppUsage
-    public static final Parcelable.Creator<ExportResult> CREATOR = new
+    public static final @android.annotation.NonNull Parcelable.Creator<ExportResult> CREATOR = new
             Parcelable.Creator<ExportResult>() {
                 public ExportResult createFromParcel(Parcel in) {
                     return new ExportResult(in);
diff --git a/core/java/android/security/keymaster/KeyAttestationApplicationId.java b/core/java/android/security/keymaster/KeyAttestationApplicationId.java
index 8e585f4b..670f30e1b 100644
--- a/core/java/android/security/keymaster/KeyAttestationApplicationId.java
+++ b/core/java/android/security/keymaster/KeyAttestationApplicationId.java
@@ -55,7 +55,7 @@
         dest.writeTypedArray(mAttestationPackageInfos, flags);
     }
 
-    public static final Parcelable.Creator<KeyAttestationApplicationId> CREATOR
+    public static final @android.annotation.NonNull Parcelable.Creator<KeyAttestationApplicationId> CREATOR
             = new Parcelable.Creator<KeyAttestationApplicationId>() {
         @Override
         public KeyAttestationApplicationId createFromParcel(Parcel source) {
diff --git a/core/java/android/security/keymaster/KeyAttestationPackageInfo.java b/core/java/android/security/keymaster/KeyAttestationPackageInfo.java
index a93d1e1..c0b8d8d 100644
--- a/core/java/android/security/keymaster/KeyAttestationPackageInfo.java
+++ b/core/java/android/security/keymaster/KeyAttestationPackageInfo.java
@@ -74,7 +74,7 @@
         dest.writeTypedArray(mPackageSignatures, flags);
     }
 
-    public static final Parcelable.Creator<KeyAttestationPackageInfo> CREATOR
+    public static final @android.annotation.NonNull Parcelable.Creator<KeyAttestationPackageInfo> CREATOR
             = new Parcelable.Creator<KeyAttestationPackageInfo>() {
         @Override
         public KeyAttestationPackageInfo createFromParcel(Parcel source) {
diff --git a/core/java/android/security/keymaster/KeyCharacteristics.java b/core/java/android/security/keymaster/KeyCharacteristics.java
index a4fe75d..2eb2cef 100644
--- a/core/java/android/security/keymaster/KeyCharacteristics.java
+++ b/core/java/android/security/keymaster/KeyCharacteristics.java
@@ -32,7 +32,7 @@
     public KeymasterArguments swEnforced;
     public KeymasterArguments hwEnforced;
 
-    public static final Parcelable.Creator<KeyCharacteristics> CREATOR =
+    public static final @android.annotation.NonNull Parcelable.Creator<KeyCharacteristics> CREATOR =
             new Parcelable.Creator<KeyCharacteristics>() {
                 @Override
                 public KeyCharacteristics createFromParcel(Parcel in) {
diff --git a/core/java/android/security/keymaster/KeymasterArgument.java b/core/java/android/security/keymaster/KeymasterArgument.java
index 6ad53a4..8b86d41 100644
--- a/core/java/android/security/keymaster/KeymasterArgument.java
+++ b/core/java/android/security/keymaster/KeymasterArgument.java
@@ -30,7 +30,7 @@
 abstract class KeymasterArgument implements Parcelable {
     public final int tag;
 
-    public static final Parcelable.Creator<KeymasterArgument> CREATOR = new
+    public static final @android.annotation.NonNull Parcelable.Creator<KeymasterArgument> CREATOR = new
             Parcelable.Creator<KeymasterArgument>() {
                 @Override
                 public KeymasterArgument createFromParcel(Parcel in) {
diff --git a/core/java/android/security/keymaster/KeymasterArguments.java b/core/java/android/security/keymaster/KeymasterArguments.java
index 5aa0f91..d2dbdec 100644
--- a/core/java/android/security/keymaster/KeymasterArguments.java
+++ b/core/java/android/security/keymaster/KeymasterArguments.java
@@ -42,7 +42,7 @@
     private List<KeymasterArgument> mArguments;
 
     @UnsupportedAppUsage
-    public static final Parcelable.Creator<KeymasterArguments> CREATOR = new
+    public static final @android.annotation.NonNull Parcelable.Creator<KeymasterArguments> CREATOR = new
             Parcelable.Creator<KeymasterArguments>() {
                 @Override
                 public KeymasterArguments createFromParcel(Parcel in) {
diff --git a/core/java/android/security/keymaster/KeymasterBlob.java b/core/java/android/security/keymaster/KeymasterBlob.java
index 0659a22..6a2024f 100644
--- a/core/java/android/security/keymaster/KeymasterBlob.java
+++ b/core/java/android/security/keymaster/KeymasterBlob.java
@@ -30,7 +30,7 @@
         this.blob = blob;
     }
     @UnsupportedAppUsage
-    public static final Parcelable.Creator<KeymasterBlob> CREATOR = new
+    public static final @android.annotation.NonNull Parcelable.Creator<KeymasterBlob> CREATOR = new
             Parcelable.Creator<KeymasterBlob>() {
                 public KeymasterBlob createFromParcel(Parcel in) {
                     return new KeymasterBlob(in);
diff --git a/core/java/android/security/keymaster/KeymasterCertificateChain.java b/core/java/android/security/keymaster/KeymasterCertificateChain.java
index 00a1a1c..4bad462 100644
--- a/core/java/android/security/keymaster/KeymasterCertificateChain.java
+++ b/core/java/android/security/keymaster/KeymasterCertificateChain.java
@@ -32,7 +32,7 @@
 
     private List<byte[]> mCertificates;
 
-    public static final Parcelable.Creator<KeymasterCertificateChain> CREATOR = new
+    public static final @android.annotation.NonNull Parcelable.Creator<KeymasterCertificateChain> CREATOR = new
             Parcelable.Creator<KeymasterCertificateChain>() {
                 public KeymasterCertificateChain createFromParcel(Parcel in) {
                     return new KeymasterCertificateChain(in);
diff --git a/core/java/android/security/keymaster/OperationResult.java b/core/java/android/security/keymaster/OperationResult.java
index bc4f360..c278eb3 100644
--- a/core/java/android/security/keymaster/OperationResult.java
+++ b/core/java/android/security/keymaster/OperationResult.java
@@ -35,7 +35,7 @@
     public final KeymasterArguments outParams;
 
     @UnsupportedAppUsage
-    public static final Parcelable.Creator<OperationResult> CREATOR = new
+    public static final @android.annotation.NonNull Parcelable.Creator<OperationResult> CREATOR = new
             Parcelable.Creator<OperationResult>() {
                 @Override
                 public OperationResult createFromParcel(Parcel in) {
diff --git a/core/java/android/security/keystore/recovery/KeyChainProtectionParams.java b/core/java/android/security/keystore/recovery/KeyChainProtectionParams.java
index 4af1af5..8801217 100644
--- a/core/java/android/security/keystore/recovery/KeyChainProtectionParams.java
+++ b/core/java/android/security/keystore/recovery/KeyChainProtectionParams.java
@@ -165,7 +165,7 @@
          * @param userSecretType The secret type
          * @return This builder.
          */
-        public Builder setUserSecretType(@UserSecretType int userSecretType) {
+        public @NonNull Builder setUserSecretType(@UserSecretType int userSecretType) {
             mInstance.mUserSecretType = userSecretType;
             return this;
         }
@@ -179,7 +179,7 @@
          * @param lockScreenUiFormat The UI format
          * @return This builder.
          */
-        public Builder setLockScreenUiFormat(@LockScreenUiFormat int lockScreenUiFormat) {
+        public @NonNull Builder setLockScreenUiFormat(@LockScreenUiFormat int lockScreenUiFormat) {
             mInstance.mLockScreenUiFormat = lockScreenUiFormat;
             return this;
         }
@@ -190,7 +190,7 @@
          * @param keyDerivationParams Key derivation parameters
          * @return This builder.
          */
-        public Builder setKeyDerivationParams(@NonNull KeyDerivationParams
+        public @NonNull Builder setKeyDerivationParams(@NonNull KeyDerivationParams
                 keyDerivationParams) {
             mInstance.mKeyDerivationParams = keyDerivationParams;
             return this;
@@ -202,7 +202,7 @@
          * @param secret The secret.
          * @return This builder.
          */
-        public Builder setSecret(@NonNull byte[] secret) {
+        public @NonNull Builder setSecret(@NonNull byte[] secret) {
             mInstance.mSecret = secret;
             return this;
         }
@@ -216,7 +216,7 @@
          * @return new instance
          * @throws NullPointerException if some required fields were not set.
          */
-        @NonNull public KeyChainProtectionParams build() {
+        public @NonNull KeyChainProtectionParams build() {
             if (mInstance.mUserSecretType == null) {
                 mInstance.mUserSecretType = TYPE_LOCKSCREEN;
             }
@@ -236,7 +236,7 @@
         Arrays.fill(mSecret, (byte) 0);
     }
 
-    public static final Parcelable.Creator<KeyChainProtectionParams> CREATOR =
+    public static final @NonNull Parcelable.Creator<KeyChainProtectionParams> CREATOR =
             new Parcelable.Creator<KeyChainProtectionParams>() {
         public KeyChainProtectionParams createFromParcel(Parcel in) {
             return new KeyChainProtectionParams(in);
diff --git a/core/java/android/security/keystore/recovery/KeyChainSnapshot.java b/core/java/android/security/keystore/recovery/KeyChainSnapshot.java
index 035b226..2f58471 100644
--- a/core/java/android/security/keystore/recovery/KeyChainSnapshot.java
+++ b/core/java/android/security/keystore/recovery/KeyChainSnapshot.java
@@ -147,7 +147,7 @@
         return mEncryptedRecoveryKeyBlob;
     }
 
-    public static final Creator<KeyChainSnapshot> CREATOR =
+    public static final @NonNull Creator<KeyChainSnapshot> CREATOR =
             new Creator<KeyChainSnapshot>() {
         public KeyChainSnapshot createFromParcel(Parcel in) {
             return new KeyChainSnapshot(in);
@@ -171,7 +171,7 @@
          * @param snapshotVersion The snapshot version
          * @return This builder.
          */
-        public Builder setSnapshotVersion(int snapshotVersion) {
+        public @NonNull Builder setSnapshotVersion(int snapshotVersion) {
             mInstance.mSnapshotVersion = snapshotVersion;
             return this;
         }
@@ -182,7 +182,7 @@
          * @param maxAttempts The maximum number of guesses.
          * @return This builder.
          */
-        public Builder setMaxAttempts(int maxAttempts) {
+        public @NonNull Builder setMaxAttempts(int maxAttempts) {
             mInstance.mMaxAttempts = maxAttempts;
             return this;
         }
@@ -193,7 +193,7 @@
          * @param counterId The counter id.
          * @return This builder.
          */
-        public Builder setCounterId(long counterId) {
+        public @NonNull Builder setCounterId(long counterId) {
             mInstance.mCounterId = counterId;
             return this;
         }
@@ -204,7 +204,7 @@
          * @param serverParams The server parameters
          * @return This builder.
          */
-        public Builder setServerParams(byte[] serverParams) {
+        public @NonNull Builder setServerParams(byte[] serverParams) {
             mInstance.mServerParams = serverParams;
             return this;
         }
@@ -218,7 +218,7 @@
          * @throws CertificateException if the given certificate path cannot be encoded properly
          * @return This builder.
          */
-        public Builder setTrustedHardwareCertPath(@NonNull CertPath certPath)
+        public @NonNull Builder setTrustedHardwareCertPath(@NonNull CertPath certPath)
                 throws CertificateException {
             mInstance.mCertPath = RecoveryCertPath.createRecoveryCertPath(certPath);
             return this;
@@ -230,7 +230,7 @@
          * @param keyChainProtectionParams The UI and key derivation parameters
          * @return This builder.
          */
-        public Builder setKeyChainProtectionParams(
+        public @NonNull Builder setKeyChainProtectionParams(
                 @NonNull List<KeyChainProtectionParams> keyChainProtectionParams) {
             mInstance.mKeyChainProtectionParams = keyChainProtectionParams;
             return this;
@@ -242,7 +242,8 @@
          * @param entryRecoveryData List of application keys
          * @return This builder.
          */
-        public Builder setWrappedApplicationKeys(List<WrappedApplicationKey> entryRecoveryData) {
+        public @NonNull Builder setWrappedApplicationKeys(
+                @NonNull List<WrappedApplicationKey> entryRecoveryData) {
             mInstance.mEntryRecoveryData = entryRecoveryData;
             return this;
         }
@@ -253,7 +254,8 @@
          * @param encryptedRecoveryKeyBlob The recovery key blob.
          * @return This builder.
          */
-        public Builder setEncryptedRecoveryKeyBlob(@NonNull byte[] encryptedRecoveryKeyBlob) {
+        public @NonNull Builder setEncryptedRecoveryKeyBlob(
+                @NonNull byte[] encryptedRecoveryKeyBlob) {
             mInstance.mEncryptedRecoveryKeyBlob = encryptedRecoveryKeyBlob;
             return this;
         }
@@ -265,7 +267,7 @@
          * @return new instance
          * @throws NullPointerException if some of the required fields were not set.
          */
-        @NonNull public KeyChainSnapshot build() {
+        public @NonNull KeyChainSnapshot build() {
             Preconditions.checkCollectionElementsNotNull(mInstance.mKeyChainProtectionParams,
                     "keyChainProtectionParams");
             Preconditions.checkCollectionElementsNotNull(mInstance.mEntryRecoveryData,
diff --git a/core/java/android/security/keystore/recovery/KeyDerivationParams.java b/core/java/android/security/keystore/recovery/KeyDerivationParams.java
index 5165f0c..d036d14 100644
--- a/core/java/android/security/keystore/recovery/KeyDerivationParams.java
+++ b/core/java/android/security/keystore/recovery/KeyDerivationParams.java
@@ -140,7 +140,7 @@
         return mMemoryDifficulty;
     }
 
-    public static final Parcelable.Creator<KeyDerivationParams> CREATOR =
+    public static final @NonNull Parcelable.Creator<KeyDerivationParams> CREATOR =
             new Parcelable.Creator<KeyDerivationParams>() {
         public KeyDerivationParams createFromParcel(Parcel in) {
                 return new KeyDerivationParams(in);
diff --git a/core/java/android/security/keystore/recovery/RecoveryCertPath.java b/core/java/android/security/keystore/recovery/RecoveryCertPath.java
index f3604fe..51bd2ae 100644
--- a/core/java/android/security/keystore/recovery/RecoveryCertPath.java
+++ b/core/java/android/security/keystore/recovery/RecoveryCertPath.java
@@ -74,7 +74,7 @@
         mEncodedCertPath = in.createByteArray();
     }
 
-    public static final Parcelable.Creator<RecoveryCertPath> CREATOR =
+    public static final @NonNull Parcelable.Creator<RecoveryCertPath> CREATOR =
             new Parcelable.Creator<RecoveryCertPath>() {
         public RecoveryCertPath createFromParcel(Parcel in) {
             return new RecoveryCertPath(in);
diff --git a/core/java/android/security/keystore/recovery/RecoveryController.java b/core/java/android/security/keystore/recovery/RecoveryController.java
index a88aa8c..cc3e578 100644
--- a/core/java/android/security/keystore/recovery/RecoveryController.java
+++ b/core/java/android/security/keystore/recovery/RecoveryController.java
@@ -283,6 +283,7 @@
      */
     @RequiresPermission(android.Manifest.permission.RECOVER_KEYSTORE)
     @NonNull public static RecoveryController getInstance(@NonNull Context context) {
+        // lockSettings may be null.
         ILockSettings lockSettings =
                 ILockSettings.Stub.asInterface(ServiceManager.getService("lock_settings"));
         return new RecoveryController(lockSettings, KeyStore.getInstance());
diff --git a/core/java/android/security/keystore/recovery/RecoverySession.java b/core/java/android/security/keystore/recovery/RecoverySession.java
index 2b2438a..3e595e0 100644
--- a/core/java/android/security/keystore/recovery/RecoverySession.java
+++ b/core/java/android/security/keystore/recovery/RecoverySession.java
@@ -193,7 +193,7 @@
      *
      * @hide
      */
-    String getSessionId() {
+    @NonNull String getSessionId() {
         return mSessionId;
     }
 
diff --git a/core/java/android/security/keystore/recovery/WrappedApplicationKey.java b/core/java/android/security/keystore/recovery/WrappedApplicationKey.java
index dbfd655..665c937 100644
--- a/core/java/android/security/keystore/recovery/WrappedApplicationKey.java
+++ b/core/java/android/security/keystore/recovery/WrappedApplicationKey.java
@@ -72,7 +72,7 @@
          * @param alias The alias.
          * @return This builder.
          */
-        public Builder setAlias(@NonNull String alias) {
+        public @NonNull Builder setAlias(@NonNull String alias) {
             mInstance.mAlias = alias;
             return this;
         }
@@ -83,7 +83,7 @@
          * @param encryptedKeyMaterial The key material
          * @return This builder
          */
-        public Builder setEncryptedKeyMaterial(@NonNull byte[] encryptedKeyMaterial) {
+        public @NonNull Builder setEncryptedKeyMaterial(@NonNull byte[] encryptedKeyMaterial) {
             mInstance.mEncryptedKeyMaterial = encryptedKeyMaterial;
             return this;
         }
@@ -94,7 +94,7 @@
          * @param metadata The metadata
          * @return This builder
          */
-        public Builder setMetadata(@Nullable byte[] metadata) {
+        public @NonNull Builder setMetadata(@Nullable byte[] metadata) {
             mInstance.mMetadata = metadata;
             return this;
         }
@@ -105,7 +105,7 @@
          * @return new instance
          * @throws NullPointerException if some required fields were not set.
          */
-        @NonNull public WrappedApplicationKey build() {
+        public @NonNull WrappedApplicationKey build() {
             Preconditions.checkNotNull(mInstance.mAlias);
             Preconditions.checkNotNull(mInstance.mEncryptedKeyMaterial);
             return mInstance;
@@ -143,7 +143,7 @@
         return mMetadata;
     }
 
-    public static final Parcelable.Creator<WrappedApplicationKey> CREATOR =
+    public static final @NonNull Parcelable.Creator<WrappedApplicationKey> CREATOR =
             new Parcelable.Creator<WrappedApplicationKey>() {
                 public WrappedApplicationKey createFromParcel(Parcel in) {
                     return new WrappedApplicationKey(in);
diff --git a/core/java/android/service/autofill/AutofillFieldClassificationService.java b/core/java/android/service/autofill/AutofillFieldClassificationService.java
index 2612917..5f64755 100644
--- a/core/java/android/service/autofill/AutofillFieldClassificationService.java
+++ b/core/java/android/service/autofill/AutofillFieldClassificationService.java
@@ -349,7 +349,7 @@
             }
         }
 
-        public static final Creator<Scores> CREATOR = new Creator<Scores>() {
+        public static final @android.annotation.NonNull Creator<Scores> CREATOR = new Creator<Scores>() {
             @Override
             public Scores createFromParcel(Parcel parcel) {
                 return new Scores(parcel);
diff --git a/core/java/android/service/autofill/BatchUpdates.java b/core/java/android/service/autofill/BatchUpdates.java
index 2ba0376..e0b1c2f 100644
--- a/core/java/android/service/autofill/BatchUpdates.java
+++ b/core/java/android/service/autofill/BatchUpdates.java
@@ -187,7 +187,7 @@
         }
         dest.writeParcelable(mUpdates, flags);
     }
-    public static final Parcelable.Creator<BatchUpdates> CREATOR =
+    public static final @android.annotation.NonNull Parcelable.Creator<BatchUpdates> CREATOR =
             new Parcelable.Creator<BatchUpdates>() {
         @Override
         public BatchUpdates createFromParcel(Parcel parcel) {
diff --git a/core/java/android/service/autofill/CharSequenceTransformation.java b/core/java/android/service/autofill/CharSequenceTransformation.java
index 271707a..e3e8844 100644
--- a/core/java/android/service/autofill/CharSequenceTransformation.java
+++ b/core/java/android/service/autofill/CharSequenceTransformation.java
@@ -208,7 +208,7 @@
         parcel.writeStringArray(substs);
     }
 
-    public static final Parcelable.Creator<CharSequenceTransformation> CREATOR =
+    public static final @android.annotation.NonNull Parcelable.Creator<CharSequenceTransformation> CREATOR =
             new Parcelable.Creator<CharSequenceTransformation>() {
         @Override
         public CharSequenceTransformation createFromParcel(Parcel parcel) {
diff --git a/core/java/android/service/autofill/CompositeUserData.java b/core/java/android/service/autofill/CompositeUserData.java
index 2df4ddf..c7dc15a 100644
--- a/core/java/android/service/autofill/CompositeUserData.java
+++ b/core/java/android/service/autofill/CompositeUserData.java
@@ -191,7 +191,7 @@
         parcel.writeParcelable(mPackageUserData, 0);
     }
 
-    public static final Parcelable.Creator<CompositeUserData> CREATOR =
+    public static final @android.annotation.NonNull Parcelable.Creator<CompositeUserData> CREATOR =
             new Parcelable.Creator<CompositeUserData>() {
                 @Override
                 public CompositeUserData createFromParcel(Parcel parcel) {
diff --git a/core/java/android/service/autofill/CustomDescription.java b/core/java/android/service/autofill/CustomDescription.java
index fdbb1c2..c28d2bb 100644
--- a/core/java/android/service/autofill/CustomDescription.java
+++ b/core/java/android/service/autofill/CustomDescription.java
@@ -176,6 +176,7 @@
          * by the Android System.
          * @throws IllegalStateException if {@link #build()} was already called.
          */
+        @NonNull
         public Builder addChild(int id, @NonNull Transformation transformation) {
             throwIfDestroyed();
             Preconditions.checkArgument((transformation instanceof InternalTransformation),
@@ -270,6 +271,7 @@
          * by the Android System.
          * @throws IllegalStateException if {@link #build()} was already called.
          */
+        @NonNull
         public Builder batchUpdate(@NonNull Validator condition, @NonNull BatchUpdates updates) {
             throwIfDestroyed();
             Preconditions.checkArgument((condition instanceof InternalValidator),
@@ -323,6 +325,7 @@
          * by the Android System.
          * @throws IllegalStateException if {@link #build()} was already called.
          */
+        @NonNull
         public Builder addOnClickAction(int id, @NonNull OnClickAction action) {
             throwIfDestroyed();
             Preconditions.checkArgument((action instanceof InternalOnClickAction),
@@ -338,6 +341,7 @@
         /**
          * Creates a new {@link CustomDescription} instance.
          */
+        @NonNull
         public CustomDescription build() {
             throwIfDestroyed();
             mDestroyed = true;
@@ -425,7 +429,7 @@
             dest.writeParcelableArray(values, flags);
         }
     }
-    public static final Parcelable.Creator<CustomDescription> CREATOR =
+    public static final @android.annotation.NonNull Parcelable.Creator<CustomDescription> CREATOR =
             new Parcelable.Creator<CustomDescription>() {
         @Override
         public CustomDescription createFromParcel(Parcel parcel) {
diff --git a/core/java/android/service/autofill/Dataset.java b/core/java/android/service/autofill/Dataset.java
index f8408be..d53e62a 100644
--- a/core/java/android/service/autofill/Dataset.java
+++ b/core/java/android/service/autofill/Dataset.java
@@ -500,7 +500,7 @@
         parcel.writeString(mId);
     }
 
-    public static final Creator<Dataset> CREATOR = new Creator<Dataset>() {
+    public static final @android.annotation.NonNull Creator<Dataset> CREATOR = new Creator<Dataset>() {
         @Override
         public Dataset createFromParcel(Parcel parcel) {
             // Always go through the builder to ensure the data ingested by
@@ -572,7 +572,7 @@
         }
 
         @SuppressWarnings("hiding")
-        public static final Creator<DatasetFieldFilter> CREATOR =
+        public static final @android.annotation.NonNull Creator<DatasetFieldFilter> CREATOR =
                 new Creator<DatasetFieldFilter>() {
 
             @Override
diff --git a/core/java/android/service/autofill/DateTransformation.java b/core/java/android/service/autofill/DateTransformation.java
index ec24a09..338ba74 100644
--- a/core/java/android/service/autofill/DateTransformation.java
+++ b/core/java/android/service/autofill/DateTransformation.java
@@ -111,7 +111,7 @@
         parcel.writeSerializable(mDateFormat);
     }
 
-    public static final Parcelable.Creator<DateTransformation> CREATOR =
+    public static final @android.annotation.NonNull Parcelable.Creator<DateTransformation> CREATOR =
             new Parcelable.Creator<DateTransformation>() {
         @Override
         public DateTransformation createFromParcel(Parcel parcel) {
diff --git a/core/java/android/service/autofill/DateValueSanitizer.java b/core/java/android/service/autofill/DateValueSanitizer.java
index 4f797f4..707bab1 100644
--- a/core/java/android/service/autofill/DateValueSanitizer.java
+++ b/core/java/android/service/autofill/DateValueSanitizer.java
@@ -108,7 +108,7 @@
         parcel.writeSerializable(mDateFormat);
     }
 
-    public static final Parcelable.Creator<DateValueSanitizer> CREATOR =
+    public static final @android.annotation.NonNull Parcelable.Creator<DateValueSanitizer> CREATOR =
             new Parcelable.Creator<DateValueSanitizer>() {
         @Override
         public DateValueSanitizer createFromParcel(Parcel parcel) {
diff --git a/core/java/android/service/autofill/FillContext.java b/core/java/android/service/autofill/FillContext.java
index 535c00b..70f434c 100644
--- a/core/java/android/service/autofill/FillContext.java
+++ b/core/java/android/service/autofill/FillContext.java
@@ -49,6 +49,7 @@
 public final class FillContext implements Parcelable {
     private final int mRequestId;
     private final @NonNull AssistStructure mStructure;
+    private final @NonNull AutofillId mFocusedId;
 
     /**
      * Lookup table AutofillId->ViewNode to speed up {@link #findViewNodesByAutofillIds}
@@ -58,13 +59,15 @@
 
 
     /** @hide */
-    public FillContext(int requestId, @NonNull AssistStructure structure) {
+    public FillContext(int requestId, @NonNull AssistStructure structure,
+            @NonNull AutofillId autofillId) {
         mRequestId = requestId;
         mStructure = structure;
+        mFocusedId = autofillId;
     }
 
     private FillContext(Parcel parcel) {
-        this(parcel.readInt(), parcel.readParcelable(null));
+        this(parcel.readInt(), parcel.readParcelable(null), parcel.readParcelable(null));
     }
 
     /**
@@ -82,15 +85,24 @@
     /**
      * @return The screen content.
      */
+    @NonNull
     public AssistStructure getStructure() {
         return mStructure;
     }
 
+    /**
+     * @return the AutofillId of the view that triggered autofill.
+     */
+    @NonNull
+    public AutofillId getFocusedId() {
+        return mFocusedId;
+    }
+
     @Override
     public String toString() {
         if (!sDebug)  return super.toString();
 
-        return "FillContext [reqId=" + mRequestId + "]";
+        return "FillContext [reqId=" + mRequestId + ", focusedId=" + mFocusedId + "]";
     }
 
     @Override
@@ -102,6 +114,7 @@
     public void writeToParcel(Parcel parcel, int flags) {
         parcel.writeInt(mRequestId);
         parcel.writeParcelable(mStructure, flags);
+        parcel.writeParcelable(mFocusedId, flags);
     }
 
     /**
@@ -177,14 +190,16 @@
         return foundNodes;
     }
 
-    public static final Parcelable.Creator<FillContext> CREATOR =
+    public static final @android.annotation.NonNull Parcelable.Creator<FillContext> CREATOR =
             new Parcelable.Creator<FillContext>() {
         @Override
+        @NonNull
         public FillContext createFromParcel(Parcel parcel) {
             return new FillContext(parcel);
         }
 
         @Override
+        @NonNull
         public FillContext[] newArray(int size) {
             return new FillContext[size];
         }
diff --git a/core/java/android/service/autofill/FillEventHistory.java b/core/java/android/service/autofill/FillEventHistory.java
index 6e5bacf..c65e773 100644
--- a/core/java/android/service/autofill/FillEventHistory.java
+++ b/core/java/android/service/autofill/FillEventHistory.java
@@ -517,7 +517,7 @@
         }
     }
 
-    public static final Parcelable.Creator<FillEventHistory> CREATOR =
+    public static final @android.annotation.NonNull Parcelable.Creator<FillEventHistory> CREATOR =
             new Parcelable.Creator<FillEventHistory>() {
                 @Override
                 public FillEventHistory createFromParcel(Parcel parcel) {
diff --git a/core/java/android/service/autofill/FillRequest.java b/core/java/android/service/autofill/FillRequest.java
index cbd0cd9..66864c6 100644
--- a/core/java/android/service/autofill/FillRequest.java
+++ b/core/java/android/service/autofill/FillRequest.java
@@ -176,7 +176,7 @@
         parcel.writeInt(mFlags);
     }
 
-    public static final Parcelable.Creator<FillRequest> CREATOR =
+    public static final @android.annotation.NonNull Parcelable.Creator<FillRequest> CREATOR =
             new Parcelable.Creator<FillRequest>() {
         @Override
         public FillRequest createFromParcel(Parcel parcel) {
diff --git a/core/java/android/service/autofill/FillResponse.java b/core/java/android/service/autofill/FillResponse.java
index 93ee8c3..6b3009f 100644
--- a/core/java/android/service/autofill/FillResponse.java
+++ b/core/java/android/service/autofill/FillResponse.java
@@ -272,7 +272,8 @@
          *
          * @see android.app.PendingIntent#getIntentSender()
          */
-        public @NonNull Builder setAuthentication(@NonNull AutofillId[] ids,
+        @NonNull
+        public Builder setAuthentication(@NonNull AutofillId[] ids,
                 @Nullable IntentSender authentication, @Nullable RemoteViews presentation) {
             throwIfDestroyed();
             throwIfDisableAutofillCalled();
@@ -298,6 +299,7 @@
          * <p>This is typically used when the service cannot autofill the view; for example, a
          * text field representing the result of a Captcha challenge.
          */
+        @NonNull
         public Builder setIgnoredIds(AutofillId...ids) {
             throwIfDestroyed();
             mIgnoredIds = ids;
@@ -318,7 +320,8 @@
          *
          * @return This builder.
          */
-        public @NonNull Builder addDataset(@Nullable Dataset dataset) {
+        @NonNull
+        public Builder addDataset(@Nullable Dataset dataset) {
             throwIfDestroyed();
             throwIfDisableAutofillCalled();
             if (dataset == null) {
@@ -359,6 +362,7 @@
          * @param clientState The custom client state.
          * @return This builder.
          */
+        @NonNull
         public Builder setClientState(@Nullable Bundle clientState) {
             throwIfDestroyed();
             throwIfDisableAutofillCalled();
@@ -379,6 +383,7 @@
          * already called.
          * @throws NullPointerException if {@code ids} or any element on it is {@code null}.
          */
+        @NonNull
         public Builder setFieldClassificationIds(@NonNull AutofillId... ids) {
             throwIfDestroyed();
             throwIfDisableAutofillCalled();
@@ -398,6 +403,7 @@
          *
          * @return This builder.
          */
+        @NonNull
         public Builder setFlags(@FillResponseFlags int flags) {
             throwIfDestroyed();
             mFlags = Preconditions.checkFlagsArgument(flags,
@@ -437,6 +443,7 @@
          *       {@link #setSaveInfo(SaveInfo)}, {@link #setClientState(Bundle)}, or
          *       {@link #setFieldClassificationIds(AutofillId...)} was already called.
          */
+        @NonNull
         public Builder disableAutofill(long duration) {
             throwIfDestroyed();
             if (duration <= 0) {
@@ -475,6 +482,7 @@
          * already set for this builder.
          */
         // TODO(b/69796626): make it sticky / update javadoc
+        @NonNull
         public Builder setHeader(@NonNull RemoteViews header) {
             throwIfDestroyed();
             throwIfAuthenticationCalled();
@@ -506,6 +514,7 @@
          * requires authentication}.
          */
         // TODO(b/69796626): make it sticky / update javadoc
+        @NonNull
         public Builder setFooter(@NonNull RemoteViews footer) {
             throwIfDestroyed();
             throwIfAuthenticationCalled();
@@ -524,6 +533,7 @@
          * {@link #setAuthentication(AutofillId[], IntentSender, RemoteViews)
          * requires authentication}.
          */
+        @NonNull
         public Builder setUserData(@NonNull UserData userData) {
             throwIfDestroyed();
             throwIfAuthenticationCalled();
@@ -548,6 +558,7 @@
          *
          * @return A built response.
          */
+        @NonNull
         public FillResponse build() {
             throwIfDestroyed();
             if (mAuthentication == null && mDatasets == null && mSaveInfo == null
@@ -658,7 +669,7 @@
         parcel.writeInt(mRequestId);
     }
 
-    public static final Parcelable.Creator<FillResponse> CREATOR =
+    public static final @android.annotation.NonNull Parcelable.Creator<FillResponse> CREATOR =
             new Parcelable.Creator<FillResponse>() {
         @Override
         public FillResponse createFromParcel(Parcel parcel) {
diff --git a/core/java/android/service/autofill/ImageTransformation.java b/core/java/android/service/autofill/ImageTransformation.java
index 4afda24..12376e8 100644
--- a/core/java/android/service/autofill/ImageTransformation.java
+++ b/core/java/android/service/autofill/ImageTransformation.java
@@ -242,7 +242,7 @@
         parcel.writeCharSequenceArray(contentDescriptions);
     }
 
-    public static final Parcelable.Creator<ImageTransformation> CREATOR =
+    public static final @android.annotation.NonNull Parcelable.Creator<ImageTransformation> CREATOR =
             new Parcelable.Creator<ImageTransformation>() {
         @Override
         public ImageTransformation createFromParcel(Parcel parcel) {
diff --git a/core/java/android/service/autofill/LuhnChecksumValidator.java b/core/java/android/service/autofill/LuhnChecksumValidator.java
index c56ae84..ef0bd74 100644
--- a/core/java/android/service/autofill/LuhnChecksumValidator.java
+++ b/core/java/android/service/autofill/LuhnChecksumValidator.java
@@ -124,7 +124,7 @@
         parcel.writeParcelableArray(mIds, flags);
     }
 
-    public static final Parcelable.Creator<LuhnChecksumValidator> CREATOR =
+    public static final @android.annotation.NonNull Parcelable.Creator<LuhnChecksumValidator> CREATOR =
             new Parcelable.Creator<LuhnChecksumValidator>() {
         @Override
         public LuhnChecksumValidator createFromParcel(Parcel parcel) {
diff --git a/core/java/android/service/autofill/NegationValidator.java b/core/java/android/service/autofill/NegationValidator.java
index a963f9f..2f098e2 100644
--- a/core/java/android/service/autofill/NegationValidator.java
+++ b/core/java/android/service/autofill/NegationValidator.java
@@ -64,7 +64,7 @@
         dest.writeParcelable(mValidator, flags);
     }
 
-    public static final Parcelable.Creator<NegationValidator> CREATOR =
+    public static final @android.annotation.NonNull Parcelable.Creator<NegationValidator> CREATOR =
             new Parcelable.Creator<NegationValidator>() {
         @Override
         public NegationValidator createFromParcel(Parcel parcel) {
diff --git a/core/java/android/service/autofill/OptionalValidators.java b/core/java/android/service/autofill/OptionalValidators.java
index 7aec59f..7189c88 100644
--- a/core/java/android/service/autofill/OptionalValidators.java
+++ b/core/java/android/service/autofill/OptionalValidators.java
@@ -79,7 +79,7 @@
         dest.writeParcelableArray(mValidators, flags);
     }
 
-    public static final Parcelable.Creator<OptionalValidators> CREATOR =
+    public static final @android.annotation.NonNull Parcelable.Creator<OptionalValidators> CREATOR =
             new Parcelable.Creator<OptionalValidators>() {
         @Override
         public OptionalValidators createFromParcel(Parcel parcel) {
diff --git a/core/java/android/service/autofill/RegexValidator.java b/core/java/android/service/autofill/RegexValidator.java
index 9dfe78d..8cb67d0 100644
--- a/core/java/android/service/autofill/RegexValidator.java
+++ b/core/java/android/service/autofill/RegexValidator.java
@@ -93,7 +93,7 @@
         parcel.writeSerializable(mRegex);
     }
 
-    public static final Parcelable.Creator<RegexValidator> CREATOR =
+    public static final @android.annotation.NonNull Parcelable.Creator<RegexValidator> CREATOR =
             new Parcelable.Creator<RegexValidator>() {
         @Override
         public RegexValidator createFromParcel(Parcel parcel) {
diff --git a/core/java/android/service/autofill/RequiredValidators.java b/core/java/android/service/autofill/RequiredValidators.java
index 9e1db2b..619eba0 100644
--- a/core/java/android/service/autofill/RequiredValidators.java
+++ b/core/java/android/service/autofill/RequiredValidators.java
@@ -78,7 +78,7 @@
         dest.writeParcelableArray(mValidators, flags);
     }
 
-    public static final Parcelable.Creator<RequiredValidators> CREATOR =
+    public static final @android.annotation.NonNull Parcelable.Creator<RequiredValidators> CREATOR =
             new Parcelable.Creator<RequiredValidators>() {
         @Override
         public RequiredValidators createFromParcel(Parcel parcel) {
diff --git a/core/java/android/service/autofill/SaveInfo.java b/core/java/android/service/autofill/SaveInfo.java
index dfaf49a..94b9d05 100644
--- a/core/java/android/service/autofill/SaveInfo.java
+++ b/core/java/android/service/autofill/SaveInfo.java
@@ -776,7 +776,7 @@
         parcel.writeInt(mFlags);
     }
 
-    public static final Parcelable.Creator<SaveInfo> CREATOR = new Parcelable.Creator<SaveInfo>() {
+    public static final @android.annotation.NonNull Parcelable.Creator<SaveInfo> CREATOR = new Parcelable.Creator<SaveInfo>() {
         @Override
         public SaveInfo createFromParcel(Parcel parcel) {
 
diff --git a/core/java/android/service/autofill/SaveRequest.java b/core/java/android/service/autofill/SaveRequest.java
index c9b5b55..5dd07c4 100644
--- a/core/java/android/service/autofill/SaveRequest.java
+++ b/core/java/android/service/autofill/SaveRequest.java
@@ -101,7 +101,7 @@
         parcel.writeStringList(mDatasetIds);
     }
 
-    public static final Creator<SaveRequest> CREATOR =
+    public static final @android.annotation.NonNull Creator<SaveRequest> CREATOR =
             new Creator<SaveRequest>() {
         @Override
         public SaveRequest createFromParcel(Parcel parcel) {
diff --git a/core/java/android/service/autofill/TextValueSanitizer.java b/core/java/android/service/autofill/TextValueSanitizer.java
index a8c080a..cc48fcb 100644
--- a/core/java/android/service/autofill/TextValueSanitizer.java
+++ b/core/java/android/service/autofill/TextValueSanitizer.java
@@ -116,7 +116,7 @@
         parcel.writeString(mSubst);
     }
 
-    public static final Parcelable.Creator<TextValueSanitizer> CREATOR =
+    public static final @android.annotation.NonNull Parcelable.Creator<TextValueSanitizer> CREATOR =
             new Parcelable.Creator<TextValueSanitizer>() {
         @Override
         public TextValueSanitizer createFromParcel(Parcel parcel) {
diff --git a/core/java/android/service/autofill/UserData.java b/core/java/android/service/autofill/UserData.java
index a793e09..7814f70 100644
--- a/core/java/android/service/autofill/UserData.java
+++ b/core/java/android/service/autofill/UserData.java
@@ -266,6 +266,7 @@
          *
          * @return this builder
          */
+        @NonNull
         public Builder setFieldClassificationAlgorithm(@Nullable String name,
                 @Nullable Bundle args) {
             throwIfDestroyed();
@@ -291,6 +292,7 @@
          *
          * @return this builder
          */
+        @NonNull
         public Builder setFieldClassificationAlgorithmForCategory(@NonNull String categoryId,
                 @Nullable String name, @Nullable Bundle args) {
             throwIfDestroyed();
@@ -333,6 +335,7 @@
          *       {@link UserData#getMaxValueLength()}</li>
          * </ul>
          */
+        @NonNull
         public Builder add(@NonNull String value, @NonNull String categoryId) {
             throwIfDestroyed();
             checkNotEmpty("categoryId", categoryId);
@@ -386,6 +389,7 @@
          *
          * @return The built dataset.
          */
+        @NonNull
         public UserData build() {
             throwIfDestroyed();
             mDestroyed = true;
@@ -435,7 +439,7 @@
         parcel.writeMap(mCategoryArgs);
     }
 
-    public static final Parcelable.Creator<UserData> CREATOR =
+    public static final @android.annotation.NonNull Parcelable.Creator<UserData> CREATOR =
             new Parcelable.Creator<UserData>() {
         @Override
         public UserData createFromParcel(Parcel parcel) {
diff --git a/core/java/android/service/autofill/VisibilitySetterAction.java b/core/java/android/service/autofill/VisibilitySetterAction.java
index 9f977d7..e29a23f 100644
--- a/core/java/android/service/autofill/VisibilitySetterAction.java
+++ b/core/java/android/service/autofill/VisibilitySetterAction.java
@@ -70,7 +70,7 @@
     /**
      * Builder for {@link VisibilitySetterAction} objects.
      */
-    public static class Builder {
+    public static final class Builder {
         private final SparseIntArray mVisibilities = new SparseIntArray();
         private boolean mDestroyed;
 
@@ -96,6 +96,7 @@
          * @throws IllegalArgumentException if visibility is not one of {@link View#VISIBLE},
          * {@link View#INVISIBLE}, or {@link View#GONE}.
          */
+        @NonNull
         public Builder setVisibility(@IdRes int id, @Visibility int visibility) {
             throwIfDestroyed();
             switch (visibility) {
@@ -111,6 +112,7 @@
         /**
          * Creates a new {@link VisibilitySetterAction} instance.
          */
+        @NonNull
         public VisibilitySetterAction build() {
             throwIfDestroyed();
             mDestroyed = true;
@@ -145,8 +147,10 @@
         parcel.writeSparseIntArray(mVisibilities);
     }
 
-    public static final Parcelable.Creator<VisibilitySetterAction> CREATOR =
+    public static final @android.annotation.NonNull Parcelable.Creator<VisibilitySetterAction> CREATOR =
             new Parcelable.Creator<VisibilitySetterAction>() {
+
+        @NonNull
         @Override
         public VisibilitySetterAction createFromParcel(Parcel parcel) {
             // Always go through the builder to ensure the data ingested by
@@ -165,6 +169,7 @@
             return builder == null ? null : builder.build();
         }
 
+        @NonNull
         @Override
         public VisibilitySetterAction[] newArray(int size) {
             return new VisibilitySetterAction[size];
diff --git a/core/java/android/service/autofill/augmented/AugmentedAutofillService.java b/core/java/android/service/autofill/augmented/AugmentedAutofillService.java
index 463eae68..cd54930 100644
--- a/core/java/android/service/autofill/augmented/AugmentedAutofillService.java
+++ b/core/java/android/service/autofill/augmented/AugmentedAutofillService.java
@@ -253,6 +253,7 @@
     }
 
     @Override
+    /** @hide */
     protected final void dump(FileDescriptor fd, PrintWriter pw, String[] args) {
         if (mAutofillProxies != null) {
             final int size = mAutofillProxies.size();
diff --git a/core/java/android/service/autofill/augmented/FillResponse.java b/core/java/android/service/autofill/augmented/FillResponse.java
index 2ac406c..48a3c1b 100644
--- a/core/java/android/service/autofill/augmented/FillResponse.java
+++ b/core/java/android/service/autofill/augmented/FillResponse.java
@@ -19,9 +19,6 @@
 import android.annotation.Nullable;
 import android.annotation.SystemApi;
 import android.annotation.TestApi;
-import android.view.autofill.AutofillId;
-
-import java.util.List;
 
 /**
  * Response to a {@link FillRequest}.
@@ -63,6 +60,7 @@
          *
          * @return this builder
          */
+        @NonNull
         public Builder setFillWindow(@NonNull FillWindow fillWindow) {
             // TODO(b/123100712): check not null / unit test / throw exception if FillWindow not
             // updated yet
@@ -71,19 +69,6 @@
         }
 
         /**
-         * Tells the Android System that the given {@code ids} should not trigger further
-         * {@link FillRequest requests} when focused.
-         *
-         * @param ids ids of the fields that should be ignored
-         *
-         * @return this builder
-         */
-        public Builder setIgnoredIds(@NonNull List<AutofillId> ids) {
-            // TODO(b/123100695): implement / check not null / unit test
-            return this;
-        }
-
-        /**
          * Builds a new {@link FillResponse} instance.
          *
          * @throws IllegalStateException if any of the following conditions occur:
@@ -95,6 +80,7 @@
          *
          * @return A built response.
          */
+        @NonNull
         public FillResponse build() {
             // TODO(b/123100712): check conditions / add unit test
             return new FillResponse(this);
diff --git a/core/java/android/service/carrier/ApnService.java b/core/java/android/service/carrier/ApnService.java
index d53eb37..57e4b1b 100644
--- a/core/java/android/service/carrier/ApnService.java
+++ b/core/java/android/service/carrier/ApnService.java
@@ -16,6 +16,8 @@
 
 package android.service.carrier;
 
+import android.annotation.NonNull;
+import android.annotation.Nullable;
 import android.annotation.SystemApi;
 import android.annotation.WorkerThread;
 import android.app.Service;
@@ -60,7 +62,8 @@
     };
 
     @Override
-    public IBinder onBind(Intent intent) {
+    @NonNull
+    public IBinder onBind(@Nullable Intent intent) {
         return mBinder;
     }
 
@@ -73,5 +76,6 @@
      * subId.
      */
     @WorkerThread
+    @NonNull
     public abstract List<ContentValues> onRestoreApns(int subId);
 }
diff --git a/core/java/android/service/carrier/CarrierIdentifier.java b/core/java/android/service/carrier/CarrierIdentifier.java
index 568ca0f..6629233 100644
--- a/core/java/android/service/carrier/CarrierIdentifier.java
+++ b/core/java/android/service/carrier/CarrierIdentifier.java
@@ -16,6 +16,7 @@
 
 package android.service.carrier;
 
+import android.annotation.NonNull;
 import android.annotation.Nullable;
 import android.os.Parcel;
 import android.os.Parcelable;
@@ -35,7 +36,7 @@
 public class CarrierIdentifier implements Parcelable {
 
     /** Used to create a {@link CarrierIdentifier} from a {@link Parcel}. */
-    public static final Creator<CarrierIdentifier> CREATOR = new Creator<CarrierIdentifier>() {
+    public static final @android.annotation.NonNull Creator<CarrierIdentifier> CREATOR = new Creator<CarrierIdentifier>() {
             @Override
         public CarrierIdentifier createFromParcel(Parcel parcel) {
             return new CarrierIdentifier(parcel);
@@ -54,7 +55,7 @@
     private @Nullable String mGid1;
     private @Nullable String mGid2;
     private int mCarrierId = TelephonyManager.UNKNOWN_CARRIER_ID;
-    private int mPreciseCarrierId = TelephonyManager.UNKNOWN_CARRIER_ID;
+    private int mSpecificCarrierId = TelephonyManager.UNKNOWN_CARRIER_ID;
 
     public CarrierIdentifier(String mcc, String mnc, @Nullable String spn, @Nullable String imsi,
             @Nullable String gid1, @Nullable String gid2) {
@@ -71,12 +72,12 @@
      * @param gid2 group id level 2
      * @param carrierid carrier unique identifier {@link TelephonyManager#getSimCarrierId()}, used
      *                  to uniquely identify the carrier and look up the carrier configurations.
-     * @param preciseCarrierId precise carrier identifier
-     * {@link TelephonyManager#getSimPreciseCarrierId()}
+     * @param specificCarrierId specific carrier identifier
+     * {@link TelephonyManager#getSimSpecificCarrierId()}
      */
-    public CarrierIdentifier(String mcc, String mnc, @Nullable String spn,
+    public CarrierIdentifier(@NonNull String mcc, @NonNull String mnc, @Nullable String spn,
                              @Nullable String imsi, @Nullable String gid1, @Nullable String gid2,
-                             int carrierid, int preciseCarrierId) {
+                             int carrierid, int specificCarrierId) {
         mMcc = mcc;
         mMnc = mnc;
         mSpn = spn;
@@ -84,7 +85,7 @@
         mGid1 = gid1;
         mGid2 = gid2;
         mCarrierId = carrierid;
-        mPreciseCarrierId = preciseCarrierId;
+        mSpecificCarrierId = specificCarrierId;
     }
 
     /**
@@ -161,11 +162,17 @@
     }
 
     /**
-     * Returns the precise carrier id.
-     * @see TelephonyManager#getSimPreciseCarrierId()
+     * A specific carrier ID returns the fine-grained carrier ID of the current subscription.
+     * It can represent the fact that a carrier may be in effect an aggregation of other carriers
+     * (ie in an MVNO type scenario) where each of these specific carriers which are used to make
+     * up the actual carrier service may have different carrier configurations.
+     * A specific carrier ID could also be used, for example, in a scenario where a carrier requires
+     * different carrier configuration for different service offering such as a prepaid plan.
+     *
+     * @see TelephonyManager#getSimSpecificCarrierId()
      */
-    public int getPreciseCarrierId() {
-        return mPreciseCarrierId;
+    public int getSpecificCarrierId() {
+        return mSpecificCarrierId;
     }
 
     @Override
@@ -185,12 +192,12 @@
                 && Objects.equals(mGid1, that.mGid1)
                 && Objects.equals(mGid2, that.mGid2)
                 && Objects.equals(mCarrierId, that.mCarrierId)
-                && Objects.equals(mPreciseCarrierId, that.mPreciseCarrierId);
+                && Objects.equals(mSpecificCarrierId, that.mSpecificCarrierId);
     }
 
     @Override
     public int hashCode(){
-        return Objects.hash(mMcc, mMnc, mSpn, mImsi, mGid1, mGid2, mCarrierId, mPreciseCarrierId);
+        return Objects.hash(mMcc, mMnc, mSpn, mImsi, mGid1, mGid2, mCarrierId, mSpecificCarrierId);
     }
 
     @Override
@@ -207,7 +214,7 @@
         out.writeString(mGid1);
         out.writeString(mGid2);
         out.writeInt(mCarrierId);
-        out.writeInt(mPreciseCarrierId);
+        out.writeInt(mSpecificCarrierId);
     }
 
     @Override
@@ -220,7 +227,7 @@
               + ",gid1=" + mGid1
               + ",gid2=" + mGid2
               + ",carrierid=" + mCarrierId
-              + ",mPreciseCarrierId=" + mPreciseCarrierId
+              + ",specificCarrierId=" + mSpecificCarrierId
               + "}";
     }
 
@@ -233,7 +240,7 @@
         mGid1 = in.readString();
         mGid2 = in.readString();
         mCarrierId = in.readInt();
-        mPreciseCarrierId = in.readInt();
+        mSpecificCarrierId = in.readInt();
     }
 
     /** @hide */
diff --git a/core/java/android/service/carrier/CarrierMessagingClientService.java b/core/java/android/service/carrier/CarrierMessagingClientService.java
index 13f4fc4..767c1d1 100644
--- a/core/java/android/service/carrier/CarrierMessagingClientService.java
+++ b/core/java/android/service/carrier/CarrierMessagingClientService.java
@@ -15,6 +15,8 @@
  */
 package android.service.carrier;
 
+import android.annotation.NonNull;
+import android.annotation.Nullable;
 import android.app.Service;
 import android.content.ComponentName;
 import android.content.Intent;
@@ -71,7 +73,8 @@
     }
 
     @Override
-    public final IBinder onBind(Intent intent) {
+    @NonNull
+    public final IBinder onBind(@Nullable Intent intent) {
         return mImpl.asBinder();
     }
 
diff --git a/core/java/android/service/carrier/MessagePdu.java b/core/java/android/service/carrier/MessagePdu.java
index ca18e53..19c41b1 100644
--- a/core/java/android/service/carrier/MessagePdu.java
+++ b/core/java/android/service/carrier/MessagePdu.java
@@ -72,7 +72,7 @@
     /**
      * Constructs a {@link MessagePdu} from a {@link Parcel}.
      */
-    public static final Parcelable.Creator<MessagePdu> CREATOR
+    public static final @android.annotation.NonNull Parcelable.Creator<MessagePdu> CREATOR
             = new Parcelable.Creator<MessagePdu>() {
                 @Override
                 public MessagePdu createFromParcel(Parcel source) {
diff --git a/core/java/android/service/chooser/ChooserTarget.java b/core/java/android/service/chooser/ChooserTarget.java
index c2f70cc..5d2d667 100644
--- a/core/java/android/service/chooser/ChooserTarget.java
+++ b/core/java/android/service/chooser/ChooserTarget.java
@@ -202,7 +202,7 @@
         dest.writeBundle(mIntentExtras);
     }
 
-    public static final Creator<ChooserTarget> CREATOR
+    public static final @android.annotation.NonNull Creator<ChooserTarget> CREATOR
             = new Creator<ChooserTarget>() {
         @Override
         public ChooserTarget createFromParcel(Parcel source) {
diff --git a/core/java/android/app/role/IRoleManagerCallback.aidl b/core/java/android/service/contentcapture/ActivityEvent.aidl
similarity index 68%
copy from core/java/android/app/role/IRoleManagerCallback.aidl
copy to core/java/android/service/contentcapture/ActivityEvent.aidl
index c0f8eea..558cac4 100644
--- a/core/java/android/app/role/IRoleManagerCallback.aidl
+++ b/core/java/android/service/contentcapture/ActivityEvent.aidl
@@ -1,11 +1,11 @@
-/*
- * Copyright (C) 2018 The Android Open Source Project
+/**
+ * Copyright (c) 2019, 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
+ *     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,
@@ -14,14 +14,6 @@
  * limitations under the License.
  */
 
-package android.app.role;
+package android.service.contentcapture;
 
-/**
- * @hide
- */
-oneway interface IRoleManagerCallback {
-
-    void onSuccess();
-
-    void onFailure();
-}
+parcelable ActivityEvent;
diff --git a/core/java/android/service/contentcapture/ActivityEvent.java b/core/java/android/service/contentcapture/ActivityEvent.java
new file mode 100644
index 0000000..7ac380d
--- /dev/null
+++ b/core/java/android/service/contentcapture/ActivityEvent.java
@@ -0,0 +1,131 @@
+/*
+ * Copyright (C) 2019 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.service.contentcapture;
+
+import android.annotation.IntDef;
+import android.annotation.NonNull;
+import android.annotation.SystemApi;
+import android.annotation.TestApi;
+import android.app.usage.UsageEvents.Event;
+import android.content.ComponentName;
+import android.os.Parcel;
+import android.os.Parcelable;
+
+import java.lang.annotation.Retention;
+import java.lang.annotation.RetentionPolicy;
+
+/**
+ * Represents an activity-level event that is not associated with a session.
+ *
+ * @hide
+ */
+@SystemApi
+@TestApi
+public final class ActivityEvent implements Parcelable {
+
+    /**
+     * The activity resumed.
+     */
+    public static final int TYPE_ACTIVITY_RESUMED = Event.ACTIVITY_RESUMED;
+
+    /**
+     * The activity paused.
+     */
+    public static final int TYPE_ACTIVITY_PAUSED = Event.ACTIVITY_PAUSED;
+
+    /** @hide */
+    @IntDef(prefix = { "TYPE_" }, value = {
+            TYPE_ACTIVITY_RESUMED,
+            TYPE_ACTIVITY_PAUSED
+    })
+    @Retention(RetentionPolicy.SOURCE)
+    public @interface ActivityEventType{}
+
+    private final @NonNull ComponentName mComponentName;
+    private final @ActivityEventType int mType;
+
+    /** @hide */
+    public ActivityEvent(@NonNull ComponentName componentName, @ActivityEventType int type) {
+        mComponentName = componentName;
+        mType = type;
+    }
+
+    /**
+     * Gests the {@link ComponentName} of the activity associated with the event.
+     */
+    @NonNull
+    public ComponentName getComponentName() {
+        return mComponentName;
+    }
+
+    /**
+     * Gets the event type.
+     *
+     * @return either {@link #TYPE_ACTIVITY_RESUMED} or {@value #TYPE_ACTIVITY_PAUSED}.
+     */
+    @ActivityEventType
+    public int getEventType() {
+        return mType;
+    }
+
+    /** @hide */
+    public static String getTypeAsString(@ActivityEventType int type) {
+        switch (type) {
+            case TYPE_ACTIVITY_RESUMED:
+                return "ACTIVITY_RESUMED";
+            case TYPE_ACTIVITY_PAUSED:
+                return "ACTIVITY_PAUSED";
+            default:
+                return "UKNOWN_TYPE: " + type;
+        }
+    }
+
+    @Override
+    public String toString() {
+        return new StringBuilder("ActivityEvent[").append(mComponentName.toShortString())
+                .append("]:").append(getTypeAsString(mType)).toString();
+    }
+
+    @Override
+    public int describeContents() {
+        return 0;
+    }
+
+    @Override
+    public void writeToParcel(@NonNull Parcel parcel, int flags) {
+        parcel.writeParcelable(mComponentName, flags);
+        parcel.writeInt(mType);
+    }
+
+    public static final @android.annotation.NonNull Creator<ActivityEvent> CREATOR =
+            new Creator<ActivityEvent>() {
+
+        @Override
+        @NonNull
+        public ActivityEvent createFromParcel(@NonNull Parcel parcel) {
+            final ComponentName componentName = parcel.readParcelable(null);
+            final int eventType = parcel.readInt();
+            return new ActivityEvent(componentName, eventType);
+        }
+
+        @Override
+        @NonNull
+        public ActivityEvent[] newArray(int size) {
+            return new ActivityEvent[size];
+        }
+    };
+}
diff --git a/core/java/android/service/contentcapture/ContentCaptureService.java b/core/java/android/service/contentcapture/ContentCaptureService.java
index 9c4669f..192abd5 100644
--- a/core/java/android/service/contentcapture/ContentCaptureService.java
+++ b/core/java/android/service/contentcapture/ContentCaptureService.java
@@ -37,7 +37,6 @@
 import android.os.RemoteException;
 import android.service.autofill.AutofillService;
 import android.util.ArrayMap;
-import android.util.ArraySet;
 import android.util.Log;
 import android.util.Slog;
 import android.view.contentcapture.ContentCaptureContext;
@@ -127,6 +126,13 @@
                     obtainMessage(ContentCaptureService::handleOnUserDataRemovalRequest,
                             ContentCaptureService.this, request));
         }
+
+        @Override
+        public void onActivityEvent(ActivityEvent event) {
+            mHandler.sendMessage(obtainMessage(ContentCaptureService::handleOnActivityEvent,
+                    ContentCaptureService.this, event));
+
+        }
     };
 
     /**
@@ -168,19 +174,6 @@
     }
 
     /**
-     * @deprecated use {@link #setContentCaptureWhitelist(Set, Set)} instead
-     */
-    @Deprecated
-    public final void setContentCaptureWhitelist(@Nullable List<String> packages,
-            @Nullable List<ComponentName> activities) {
-        setContentCaptureWhitelist(toSet(packages), toSet(activities));
-    }
-
-    private <T> ArraySet<T> toSet(@Nullable List<T> set) {
-        return set == null ? null : new ArraySet<T>(set);
-    }
-
-    /**
      * Explicitly limits content capture to the given packages and activities.
      *
      * <p>To reset the whitelist, call it passing {@code null} to both arguments.
@@ -261,7 +254,21 @@
      * @param snapshotData the data
      */
     public void onActivitySnapshot(@NonNull ContentCaptureSessionId sessionId,
-            @NonNull SnapshotData snapshotData) {}
+            @NonNull SnapshotData snapshotData) {
+        if (sVerbose) Log.v(TAG, "onActivitySnapshot(id=" + sessionId + ")");
+    }
+
+    /**
+     * Notifies the service of an activity-level event that is not associated with a session.
+     *
+     * <p>This method can be used to track some high-level events for all activities, even those
+     * that are not whitelisted for Content Capture.
+     *
+     * @param event high-level activity event
+     */
+    public void onActivityEvent(@NonNull ActivityEvent event) {
+        if (sVerbose) Log.v(TAG, "onActivityEvent(): " + event);
+    }
 
     /**
      * Destroys the content capture session.
@@ -397,6 +404,10 @@
         onUserDataRemovalRequest(request);
     }
 
+    private void handleOnActivityEvent(@NonNull ActivityEvent event) {
+        onActivityEvent(event);
+    }
+
     /**
      * Checks if the given {@code uid} owns the session associated with the event.
      */
diff --git a/core/java/android/service/contentcapture/IContentCaptureService.aidl b/core/java/android/service/contentcapture/IContentCaptureService.aidl
index eb65032..f32432f 100644
--- a/core/java/android/service/contentcapture/IContentCaptureService.aidl
+++ b/core/java/android/service/contentcapture/IContentCaptureService.aidl
@@ -16,7 +16,9 @@
 
 package android.service.contentcapture;
 
+import android.content.ComponentName;
 import android.os.IBinder;
+import android.service.contentcapture.ActivityEvent;
 import android.service.contentcapture.SnapshotData;
 import android.view.contentcapture.ContentCaptureContext;
 import android.view.contentcapture.UserDataRemovalRequest;
@@ -38,4 +40,5 @@
     void onSessionFinished(String sessionId);
     void onActivitySnapshot(String sessionId, in SnapshotData snapshotData);
     void onUserDataRemovalRequest(in UserDataRemovalRequest request);
+    void onActivityEvent(in ActivityEvent event);
 }
diff --git a/core/java/android/service/contentcapture/SnapshotData.java b/core/java/android/service/contentcapture/SnapshotData.java
index c3af1f0..5b3930a 100644
--- a/core/java/android/service/contentcapture/SnapshotData.java
+++ b/core/java/android/service/contentcapture/SnapshotData.java
@@ -60,6 +60,7 @@
     /**
      * Returns the assist data for this snapshot.
      */
+    @NonNull
     public Bundle getAssistData() {
         return mAssistData;
     }
@@ -67,6 +68,7 @@
     /**
      * Returns the assist structure for this snapshot.
      */
+    @NonNull
     public AssistStructure getAssistStructure() {
         return mAssistStructure;
     }
@@ -74,6 +76,7 @@
     /**
      * Returns the assist context for this snapshot.
      */
+    @Nullable
     public AssistContent getAssistContent() {
         return mAssistContent;
     }
@@ -90,15 +93,17 @@
         parcel.writeParcelable(mAssistContent, flags);
     }
 
-    public static final Creator<SnapshotData> CREATOR =
+    public static final @android.annotation.NonNull Creator<SnapshotData> CREATOR =
             new Creator<SnapshotData>() {
 
         @Override
+        @NonNull
         public SnapshotData createFromParcel(@NonNull Parcel parcel) {
             return new SnapshotData(parcel);
         }
 
         @Override
+        @NonNull
         public SnapshotData[] newArray(int size) {
             return new SnapshotData[size];
         }
diff --git a/core/java/android/service/contentsuggestions/ContentSuggestionsService.java b/core/java/android/service/contentsuggestions/ContentSuggestionsService.java
index 333f4be..45a8466 100644
--- a/core/java/android/service/contentsuggestions/ContentSuggestionsService.java
+++ b/core/java/android/service/contentsuggestions/ContentSuggestionsService.java
@@ -52,6 +52,10 @@
 
     /**
      * The action for the intent used to define the content suggestions service.
+     *
+     * <p>To be supported, the service must also require the
+     * * {@link android.Manifest.permission#BIND_CONTENT_SUGGESTIONS_SERVICE} permission so
+     * * that other applications can not abuse it.
      */
     public static final String SERVICE_INTERFACE =
             "android.service.contentsuggestions.ContentSuggestionsService";
@@ -60,18 +64,25 @@
         @Override
         public void provideContextImage(int taskId, GraphicBuffer contextImage,
                 Bundle imageContextRequestExtras) {
+
+            Bitmap wrappedBuffer = null;
+            if (contextImage != null) {
+                wrappedBuffer = Bitmap.wrapHardwareBuffer(
+                        HardwareBuffer.createFromGraphicBuffer(contextImage), null);
+            }
+
             mHandler.sendMessage(
-                    obtainMessage(ContentSuggestionsService::processContextImage,
+                    obtainMessage(ContentSuggestionsService::onProcessContextImage,
                             ContentSuggestionsService.this, taskId,
-                            Bitmap.wrapHardwareBuffer(
-                                    HardwareBuffer.createFromGraphicBuffer(contextImage), null),
+                            wrappedBuffer,
                             imageContextRequestExtras));
         }
 
         @Override
         public void suggestContentSelections(SelectionsRequest request,
                 ISelectionsCallback callback) {
-            mHandler.sendMessage(obtainMessage(ContentSuggestionsService::suggestContentSelections,
+            mHandler.sendMessage(obtainMessage(
+                    ContentSuggestionsService::onSuggestContentSelections,
                     ContentSuggestionsService.this, request, wrapSelectionsCallback(callback)));
 
         }
@@ -79,14 +90,15 @@
         @Override
         public void classifyContentSelections(ClassificationsRequest request,
                 IClassificationsCallback callback) {
-            mHandler.sendMessage(obtainMessage(ContentSuggestionsService::classifyContentSelections,
+            mHandler.sendMessage(obtainMessage(
+                    ContentSuggestionsService::onClassifyContentSelections,
                     ContentSuggestionsService.this, request, wrapClassificationCallback(callback)));
         }
 
         @Override
         public void notifyInteraction(String requestId, Bundle interaction) {
             mHandler.sendMessage(
-                    obtainMessage(ContentSuggestionsService::notifyInteraction,
+                    obtainMessage(ContentSuggestionsService::onNotifyInteraction,
                             ContentSuggestionsService.this, requestId, interaction));
         }
     };
@@ -112,25 +124,41 @@
      * Called by the system to provide the snapshot for the task associated with the given
      * {@param taskId}.
      */
-    public abstract void processContextImage(
-            int taskId, @Nullable Bitmap contextImage, @NonNull Bundle extras);
+    public void onProcessContextImage(
+            int taskId, @Nullable Bitmap contextImage, @NonNull Bundle extras) {
+        // TODO(b/127532182): remove after next prebuilt drop.
+        processContextImage(taskId, contextImage, extras);
+    }
 
     /**
-     * Called by a client app to make a request for content selections.
+     * Content selections have been request through {@link ContentSuggestionsManager}, implementer
+     * should reply on the callback with selections.
      */
-    public abstract void suggestContentSelections(@NonNull SelectionsRequest request,
-            @NonNull ContentSuggestionsManager.SelectionsCallback callback);
+    public void onSuggestContentSelections(@NonNull SelectionsRequest request,
+            @NonNull ContentSuggestionsManager.SelectionsCallback callback) {
+        // TODO(b/127532182): remove after next prebuilt drop.
+        suggestContentSelections(request, callback);
+    }
 
     /**
-     * Called by a client app to classify the provided content selections.
+     * Content classifications have been request through {@link ContentSuggestionsManager},
+     * implementer should reply on the callback with classifications.
      */
-    public abstract void classifyContentSelections(@NonNull ClassificationsRequest request,
-            @NonNull ContentSuggestionsManager.ClassificationsCallback callback);
+    public void onClassifyContentSelections(@NonNull ClassificationsRequest request,
+            @NonNull ContentSuggestionsManager.ClassificationsCallback callback) {
+        // TODO(b/127532182): remove after next prebuilt drop.
+        classifyContentSelections(request, callback);
+    }
 
     /**
-     * Called by a client app to report an interaction.
+     * User interactions have been reported through {@link ContentSuggestionsManager}, implementer
+     * should handle those interactions.
      */
-    public abstract void notifyInteraction(@NonNull String requestId, @NonNull Bundle interaction);
+    public void onNotifyInteraction(
+            @NonNull String requestId, @NonNull Bundle interaction) {
+        // TODO(b/127532182): remove after next prebuilt drop.
+        notifyInteraction(requestId, interaction);
+    }
 
     private ContentSuggestionsManager.SelectionsCallback wrapSelectionsCallback(
             ISelectionsCallback callback) {
@@ -153,4 +181,42 @@
             }
         });
     }
+
+
+    /**
+     * For temporary compat reason, remove with b/127532182
+     * @deprecated use {@link #onProcessContextImage(int, Bitmap, Bundle)} instead.
+     */
+    @Deprecated
+    public void processContextImage(
+            int taskId, @Nullable Bitmap contextImage, @NonNull Bundle extras) {
+    }
+
+    /**
+     * For temporary compat reason, remove with b/127532182
+     * @deprecated use {@link #onSuggestContentSelections(SelectionsRequest,
+     * ContentSuggestionsManager.SelectionsCallback)} instead.
+     */
+    @Deprecated
+    public void suggestContentSelections(@NonNull SelectionsRequest request,
+            @NonNull ContentSuggestionsManager.SelectionsCallback callback) {
+    }
+
+    /**
+     * For temporary compat reason, remove with b/127532182
+     * @deprecated use {@link #onClassifyContentSelections(ClassificationsRequest,
+     * ContentSuggestionsManager.ClassificationsCallback)} instead.
+     */
+    @Deprecated
+    public void classifyContentSelections(@NonNull ClassificationsRequest request,
+            @NonNull ContentSuggestionsManager.ClassificationsCallback callback) {
+    }
+
+    /**
+     * For temporary compat reason, remove with b/127532182
+     * @deprecated use {@link #onNotifyInteraction(String, Bundle)} instead.
+     */
+    @Deprecated
+    public void notifyInteraction(@NonNull String requestId, @NonNull Bundle interaction) {
+    }
 }
diff --git a/core/java/android/service/euicc/DownloadSubscriptionResult.java b/core/java/android/service/euicc/DownloadSubscriptionResult.java
index b410e35..3b1a2c9 100644
--- a/core/java/android/service/euicc/DownloadSubscriptionResult.java
+++ b/core/java/android/service/euicc/DownloadSubscriptionResult.java
@@ -28,7 +28,7 @@
 @SystemApi
 public final class DownloadSubscriptionResult implements Parcelable {
 
-    public static final Creator<DownloadSubscriptionResult> CREATOR =
+    public static final @android.annotation.NonNull Creator<DownloadSubscriptionResult> CREATOR =
             new Creator<DownloadSubscriptionResult>() {
         @Override
         public DownloadSubscriptionResult createFromParcel(Parcel in) {
diff --git a/core/java/android/service/euicc/EuiccProfileInfo.java b/core/java/android/service/euicc/EuiccProfileInfo.java
index 4a39782..702837b 100644
--- a/core/java/android/service/euicc/EuiccProfileInfo.java
+++ b/core/java/android/service/euicc/EuiccProfileInfo.java
@@ -126,7 +126,7 @@
      */
     private final @Nullable UiccAccessRule[] mAccessRules;
 
-    public static final Creator<EuiccProfileInfo> CREATOR = new Creator<EuiccProfileInfo>() {
+    public static final @android.annotation.NonNull Creator<EuiccProfileInfo> CREATOR = new Creator<EuiccProfileInfo>() {
         @Override
         public EuiccProfileInfo createFromParcel(Parcel in) {
             return new EuiccProfileInfo(in);
diff --git a/core/java/android/service/euicc/GetDefaultDownloadableSubscriptionListResult.java b/core/java/android/service/euicc/GetDefaultDownloadableSubscriptionListResult.java
index bd91ca0..c7a9851 100644
--- a/core/java/android/service/euicc/GetDefaultDownloadableSubscriptionListResult.java
+++ b/core/java/android/service/euicc/GetDefaultDownloadableSubscriptionListResult.java
@@ -32,7 +32,7 @@
 @SystemApi
 public final class GetDefaultDownloadableSubscriptionListResult implements Parcelable {
 
-    public static final Creator<GetDefaultDownloadableSubscriptionListResult> CREATOR =
+    public static final @android.annotation.NonNull Creator<GetDefaultDownloadableSubscriptionListResult> CREATOR =
             new Creator<GetDefaultDownloadableSubscriptionListResult>() {
         @Override
         public GetDefaultDownloadableSubscriptionListResult createFromParcel(Parcel in) {
diff --git a/core/java/android/service/euicc/GetDownloadableSubscriptionMetadataResult.java b/core/java/android/service/euicc/GetDownloadableSubscriptionMetadataResult.java
index 71f1d22..abd4065 100644
--- a/core/java/android/service/euicc/GetDownloadableSubscriptionMetadataResult.java
+++ b/core/java/android/service/euicc/GetDownloadableSubscriptionMetadataResult.java
@@ -29,7 +29,7 @@
 @SystemApi
 public final class GetDownloadableSubscriptionMetadataResult implements Parcelable {
 
-    public static final Creator<GetDownloadableSubscriptionMetadataResult> CREATOR =
+    public static final @android.annotation.NonNull Creator<GetDownloadableSubscriptionMetadataResult> CREATOR =
             new Creator<GetDownloadableSubscriptionMetadataResult>() {
         @Override
         public GetDownloadableSubscriptionMetadataResult createFromParcel(Parcel in) {
diff --git a/core/java/android/service/euicc/GetEuiccProfileInfoListResult.java b/core/java/android/service/euicc/GetEuiccProfileInfoListResult.java
index 464d136..7a9d8a0 100644
--- a/core/java/android/service/euicc/GetEuiccProfileInfoListResult.java
+++ b/core/java/android/service/euicc/GetEuiccProfileInfoListResult.java
@@ -30,7 +30,7 @@
 @SystemApi
 public final class GetEuiccProfileInfoListResult implements Parcelable {
 
-    public static final Creator<GetEuiccProfileInfoListResult> CREATOR =
+    public static final @android.annotation.NonNull Creator<GetEuiccProfileInfoListResult> CREATOR =
             new Creator<GetEuiccProfileInfoListResult>() {
                 @Override
                 public GetEuiccProfileInfoListResult createFromParcel(Parcel in) {
diff --git a/core/java/android/service/euicc/IDeleteSubscriptionCallback.aidl b/core/java/android/service/euicc/IDeleteSubscriptionCallback.aidl
index 4667066..aff8f1b 100644
--- a/core/java/android/service/euicc/IDeleteSubscriptionCallback.aidl
+++ b/core/java/android/service/euicc/IDeleteSubscriptionCallback.aidl
@@ -18,5 +18,6 @@
 
 /** @hide */
 oneway interface IDeleteSubscriptionCallback {
+    @UnsupportedAppUsage
     void onComplete(int result);
 }
\ No newline at end of file
diff --git a/core/java/android/service/euicc/IEraseSubscriptionsCallback.aidl b/core/java/android/service/euicc/IEraseSubscriptionsCallback.aidl
index c975f18..34b53cc 100644
--- a/core/java/android/service/euicc/IEraseSubscriptionsCallback.aidl
+++ b/core/java/android/service/euicc/IEraseSubscriptionsCallback.aidl
@@ -18,5 +18,6 @@
 
 /** @hide */
 oneway interface IEraseSubscriptionsCallback {
+    @UnsupportedAppUsage
     void onComplete(int result);
 }
\ No newline at end of file
diff --git a/core/java/android/service/euicc/IGetDefaultDownloadableSubscriptionListCallback.aidl b/core/java/android/service/euicc/IGetDefaultDownloadableSubscriptionListCallback.aidl
index 0c5a0c6..ad69ef1 100644
--- a/core/java/android/service/euicc/IGetDefaultDownloadableSubscriptionListCallback.aidl
+++ b/core/java/android/service/euicc/IGetDefaultDownloadableSubscriptionListCallback.aidl
@@ -20,5 +20,6 @@
 
 /** @hide */
 oneway interface IGetDefaultDownloadableSubscriptionListCallback {
+    @UnsupportedAppUsage
     void onComplete(in GetDefaultDownloadableSubscriptionListResult result);
 }
\ No newline at end of file
diff --git a/core/java/android/service/euicc/IGetDownloadableSubscriptionMetadataCallback.aidl b/core/java/android/service/euicc/IGetDownloadableSubscriptionMetadataCallback.aidl
index 3353061..01f187e 100644
--- a/core/java/android/service/euicc/IGetDownloadableSubscriptionMetadataCallback.aidl
+++ b/core/java/android/service/euicc/IGetDownloadableSubscriptionMetadataCallback.aidl
@@ -20,5 +20,6 @@
 
 /** @hide */
 oneway interface IGetDownloadableSubscriptionMetadataCallback {
+    @UnsupportedAppUsage
     void onComplete(in GetDownloadableSubscriptionMetadataResult result);
 }
\ No newline at end of file
diff --git a/core/java/android/service/euicc/IGetEidCallback.aidl b/core/java/android/service/euicc/IGetEidCallback.aidl
index 35ee9c2..e405a98 100644
--- a/core/java/android/service/euicc/IGetEidCallback.aidl
+++ b/core/java/android/service/euicc/IGetEidCallback.aidl
@@ -18,5 +18,6 @@
 
 /** @hide */
 oneway interface IGetEidCallback {
+    @UnsupportedAppUsage
     void onSuccess(String eid);
 }
\ No newline at end of file
diff --git a/core/java/android/service/euicc/IGetEuiccInfoCallback.aidl b/core/java/android/service/euicc/IGetEuiccInfoCallback.aidl
index 6d28148..c061182 100644
--- a/core/java/android/service/euicc/IGetEuiccInfoCallback.aidl
+++ b/core/java/android/service/euicc/IGetEuiccInfoCallback.aidl
@@ -20,5 +20,6 @@
 
 /** @hide */
 oneway interface IGetEuiccInfoCallback {
+    @UnsupportedAppUsage
     void onSuccess(in EuiccInfo euiccInfo);
 }
\ No newline at end of file
diff --git a/core/java/android/service/euicc/IGetEuiccProfileInfoListCallback.aidl b/core/java/android/service/euicc/IGetEuiccProfileInfoListCallback.aidl
index 761ec1f..0485f7b 100644
--- a/core/java/android/service/euicc/IGetEuiccProfileInfoListCallback.aidl
+++ b/core/java/android/service/euicc/IGetEuiccProfileInfoListCallback.aidl
@@ -20,5 +20,6 @@
 
 /** @hide */
 oneway interface IGetEuiccProfileInfoListCallback {
+    @UnsupportedAppUsage
     void onComplete(in GetEuiccProfileInfoListResult result);
 }
\ No newline at end of file
diff --git a/core/java/android/service/euicc/IRetainSubscriptionsForFactoryResetCallback.aidl b/core/java/android/service/euicc/IRetainSubscriptionsForFactoryResetCallback.aidl
index 1276830..340401f 100644
--- a/core/java/android/service/euicc/IRetainSubscriptionsForFactoryResetCallback.aidl
+++ b/core/java/android/service/euicc/IRetainSubscriptionsForFactoryResetCallback.aidl
@@ -18,5 +18,6 @@
 
 /** @hide */
 oneway interface IRetainSubscriptionsForFactoryResetCallback {
+    @UnsupportedAppUsage
     void onComplete(int result);
 }
\ No newline at end of file
diff --git a/core/java/android/service/euicc/ISwitchToSubscriptionCallback.aidl b/core/java/android/service/euicc/ISwitchToSubscriptionCallback.aidl
index 0f91a6b..b8f984d 100644
--- a/core/java/android/service/euicc/ISwitchToSubscriptionCallback.aidl
+++ b/core/java/android/service/euicc/ISwitchToSubscriptionCallback.aidl
@@ -18,5 +18,6 @@
 
 /** @hide */
 oneway interface ISwitchToSubscriptionCallback {
+    @UnsupportedAppUsage
     void onComplete(int result);
 }
\ No newline at end of file
diff --git a/core/java/android/service/euicc/IUpdateSubscriptionNicknameCallback.aidl b/core/java/android/service/euicc/IUpdateSubscriptionNicknameCallback.aidl
index 6666933..0aa6697 100644
--- a/core/java/android/service/euicc/IUpdateSubscriptionNicknameCallback.aidl
+++ b/core/java/android/service/euicc/IUpdateSubscriptionNicknameCallback.aidl
@@ -18,5 +18,6 @@
 
 /** @hide */
 oneway interface IUpdateSubscriptionNicknameCallback {
+    @UnsupportedAppUsage
     void onComplete(int result);
 }
\ No newline at end of file
diff --git a/core/java/android/service/gatekeeper/GateKeeperResponse.java b/core/java/android/service/gatekeeper/GateKeeperResponse.java
index 9b52934..66fee1e 100644
--- a/core/java/android/service/gatekeeper/GateKeeperResponse.java
+++ b/core/java/android/service/gatekeeper/GateKeeperResponse.java
@@ -66,7 +66,7 @@
         return 0;
     }
 
-    public static final Parcelable.Creator<GateKeeperResponse> CREATOR
+    public static final @android.annotation.NonNull Parcelable.Creator<GateKeeperResponse> CREATOR
             = new Parcelable.Creator<GateKeeperResponse>() {
         @Override
         public GateKeeperResponse createFromParcel(Parcel source) {
diff --git a/core/java/android/service/notification/Adjustment.java b/core/java/android/service/notification/Adjustment.java
index bddc5ef..1cdb62f 100644
--- a/core/java/android/service/notification/Adjustment.java
+++ b/core/java/android/service/notification/Adjustment.java
@@ -15,6 +15,7 @@
  */
 package android.service.notification;
 
+import android.annotation.NonNull;
 import android.annotation.SystemApi;
 import android.app.Notification;
 import android.os.Bundle;
@@ -31,7 +32,10 @@
  * realizes on the notification rankings.
  *
  * Notifications affected by the Adjustment will be re-ranked if necessary.
+ *
+ * @hide
  */
+@SystemApi
 public final class Adjustment implements Parcelable {
     private final String mPackage;
     private final String mKey;
@@ -132,8 +136,9 @@
      * @param explanation A human-readable justification for the adjustment.
      * @param userHandle User handle for for whose the adjustments will be applied.
      */
-    public Adjustment(String pkg, String key, Bundle signals, CharSequence explanation,
-            UserHandle userHandle) {
+    public Adjustment(@NonNull String pkg, @NonNull String key, @NonNull Bundle signals,
+            @NonNull CharSequence explanation,
+            @NonNull UserHandle userHandle) {
         mPackage = pkg;
         mKey = key;
         mSignals = signals;
@@ -165,7 +170,7 @@
         mUser = in.readInt();
     }
 
-    public static final Creator<Adjustment> CREATOR = new Creator<Adjustment>() {
+    public static final @android.annotation.NonNull Creator<Adjustment> CREATOR = new Creator<Adjustment>() {
         @Override
         public Adjustment createFromParcel(Parcel in) {
             return new Adjustment(in);
@@ -177,19 +182,19 @@
         }
     };
 
-    public String getPackage() {
+    public @NonNull String getPackage() {
         return mPackage;
     }
 
-    public String getKey() {
+    public @NonNull String getKey() {
         return mKey;
     }
 
-    public CharSequence getExplanation() {
+    public @NonNull CharSequence getExplanation() {
         return mExplanation;
     }
 
-    public Bundle getSignals() {
+    public @NonNull Bundle getSignals() {
         return mSignals;
     }
 
@@ -199,7 +204,7 @@
         return mUser;
     }
 
-    public UserHandle getUserHandle() {
+    public @NonNull UserHandle getUserHandle() {
         return UserHandle.of(mUser);
     }
 
diff --git a/core/java/android/service/notification/Condition.java b/core/java/android/service/notification/Condition.java
index 30d9804..e506509 100644
--- a/core/java/android/service/notification/Condition.java
+++ b/core/java/android/service/notification/Condition.java
@@ -227,7 +227,7 @@
         return id != null && SCHEME.equals(id.getScheme()) && pkg.equals(id.getAuthority());
     }
 
-    public static final Parcelable.Creator<Condition> CREATOR
+    public static final @android.annotation.NonNull Parcelable.Creator<Condition> CREATOR
             = new Parcelable.Creator<Condition>() {
         @Override
         public Condition createFromParcel(Parcel source) {
diff --git a/core/java/android/service/notification/NotificationAssistantService.java b/core/java/android/service/notification/NotificationAssistantService.java
index a697248..780b576 100644
--- a/core/java/android/service/notification/NotificationAssistantService.java
+++ b/core/java/android/service/notification/NotificationAssistantService.java
@@ -20,6 +20,7 @@
 
 import android.annotation.IntDef;
 import android.annotation.NonNull;
+import android.annotation.Nullable;
 import android.annotation.SdkConstant;
 import android.annotation.SystemApi;
 import android.app.Notification;
@@ -60,7 +61,9 @@
  * <p>
  *     All callbacks are called on the main thread.
  * </p>
+ * @hide
  */
+@SystemApi
 public abstract class NotificationAssistantService extends NotificationListenerService {
     private static final String TAG = "NotificationAssistants";
 
@@ -68,7 +71,14 @@
     @Retention(SOURCE)
     @IntDef({SOURCE_FROM_APP, SOURCE_FROM_ASSISTANT})
     public @interface Source {}
+
+    /**
+     * To indicate an adjustment is from an app.
+     */
     public static final int SOURCE_FROM_APP = 0;
+    /**
+     * To indicate an adjustment is from a {@link NotificationAssistantService}.
+     */
     public static final int SOURCE_FROM_ASSISTANT = 1;
 
     /**
@@ -90,7 +100,7 @@
     }
 
     @Override
-    public final IBinder onBind(Intent intent) {
+    public final @NonNull IBinder onBind(@Nullable Intent intent) {
         if (mWrapper == null) {
             mWrapper = new NotificationAssistantServiceWrapper();
         }
@@ -105,8 +115,8 @@
      * @param sbn the notification to snooze
      * @param snoozeCriterionId the {@link SnoozeCriterion#getId()} representing a device context.
      */
-    abstract public void onNotificationSnoozedUntilContext(StatusBarNotification sbn,
-            String snoozeCriterionId);
+    abstract public void onNotificationSnoozedUntilContext(@NonNull StatusBarNotification sbn,
+            @NonNull String snoozeCriterionId);
 
     /**
      * A notification was posted by an app. Called before post.
@@ -117,7 +127,7 @@
      * @param sbn the new notification
      * @return an adjustment or null to take no action, within 100ms.
      */
-    abstract public Adjustment onNotificationEnqueued(StatusBarNotification sbn);
+    abstract public @Nullable Adjustment onNotificationEnqueued(@NonNull StatusBarNotification sbn);
 
     /**
      * A notification was posted by an app. Called before post.
@@ -126,8 +136,8 @@
      * @param channel the channel the notification was posted to
      * @return an adjustment or null to take no action, within 100ms.
      */
-    public Adjustment onNotificationEnqueued(StatusBarNotification sbn,
-            NotificationChannel channel) {
+    public @Nullable Adjustment onNotificationEnqueued(@NonNull StatusBarNotification sbn,
+            @NonNull NotificationChannel channel) {
         return onNotificationEnqueued(sbn);
     }
 
@@ -155,8 +165,9 @@
      * @param reason see {@link #REASON_LISTENER_CANCEL}, etc.
      */
     @Override
-    public void onNotificationRemoved(StatusBarNotification sbn, RankingMap rankingMap,
-            NotificationStats stats, int reason) {
+    public void onNotificationRemoved(@NonNull StatusBarNotification sbn,
+            @NonNull RankingMap rankingMap,
+            @NonNull NotificationStats stats, int reason) {
         onNotificationRemoved(sbn, rankingMap, reason);
     }
 
@@ -164,7 +175,7 @@
      * Implement this to know when a user has seen notifications, as triggered by
      * {@link #setNotificationsShown(String[])}.
      */
-    public void onNotificationsSeen(List<String> keys) {
+    public void onNotificationsSeen(@NonNull List<String> keys) {
 
     }
 
@@ -211,7 +222,7 @@
      *
      * @param adjustment the adjustment with an explanation
      */
-    public final void adjustNotification(Adjustment adjustment) {
+    public final void adjustNotification(@NonNull Adjustment adjustment) {
         if (!isBound()) return;
         try {
             getNotificationInterface().applyAdjustmentFromAssistant(mWrapper, adjustment);
@@ -228,7 +239,7 @@
      *
      * @param adjustments a list of adjustments with explanations
      */
-    public final void adjustNotifications(List<Adjustment> adjustments) {
+    public final void adjustNotifications(@NonNull List<Adjustment> adjustments) {
         if (!isBound()) return;
         try {
             getNotificationInterface().applyAdjustmentsFromAssistant(mWrapper, adjustments);
@@ -247,7 +258,7 @@
      * notification.
      * @param key The key of the notification to snooze
      */
-    public final void unsnoozeNotification(String key) {
+    public final void unsnoozeNotification(@NonNull String key) {
         if (!isBound()) return;
         try {
             getNotificationInterface().unsnoozeNotificationFromAssistant(mWrapper, key);
@@ -362,7 +373,10 @@
                     args.recycle();
                     Adjustment adjustment = onNotificationEnqueued(sbn, channel);
                     if (adjustment != null) {
-                        if (!isBound()) return;
+                        if (!isBound()) {
+                            Log.w(TAG, "MSG_ON_NOTIFICATION_ENQUEUED: service not bound, skip.");
+                            return;
+                        }
                         try {
                             getNotificationInterface().applyEnqueuedAdjustmentFromAssistant(
                                     mWrapper, adjustment);
diff --git a/core/java/android/service/notification/NotificationListenerService.java b/core/java/android/service/notification/NotificationListenerService.java
index d3285bb..23607eb 100644
--- a/core/java/android/service/notification/NotificationListenerService.java
+++ b/core/java/android/service/notification/NotificationListenerService.java
@@ -425,8 +425,9 @@
      * @hide
      */
     @TestApi
-    public void onNotificationRemoved(StatusBarNotification sbn, RankingMap rankingMap,
-            NotificationStats stats, int reason) {
+    @SystemApi
+    public void onNotificationRemoved(@NonNull StatusBarNotification sbn,
+            @NonNull RankingMap rankingMap, @NonNull NotificationStats stats, int reason) {
         onNotificationRemoved(sbn, rankingMap, reason);
     }
 
@@ -1638,7 +1639,7 @@
          * Returns a list of smart {@link Notification.Action} that can be added by the
          * {@link NotificationAssistantService}
          */
-        public List<Notification.Action> getSmartActions() {
+        public @NonNull List<Notification.Action> getSmartActions() {
             return mSmartActions;
         }
 
@@ -1646,7 +1647,7 @@
          * Returns a list of smart replies that can be added by the
          * {@link NotificationAssistantService}
          */
-        public List<CharSequence> getSmartReplies() {
+        public @NonNull List<CharSequence> getSmartReplies() {
             return mSmartReplies;
         }
 
@@ -2163,7 +2164,7 @@
             dest.writeParcelable(mRankingUpdate, flags);
         }
 
-        public static final Creator<RankingMap> CREATOR = new Creator<RankingMap>() {
+        public static final @android.annotation.NonNull Creator<RankingMap> CREATOR = new Creator<RankingMap>() {
             @Override
             public RankingMap createFromParcel(Parcel source) {
                 NotificationRankingUpdate rankingUpdate = source.readParcelable(null);
diff --git a/core/java/android/service/notification/NotificationRankingUpdate.java b/core/java/android/service/notification/NotificationRankingUpdate.java
index 230ae27..c5c70f8 100644
--- a/core/java/android/service/notification/NotificationRankingUpdate.java
+++ b/core/java/android/service/notification/NotificationRankingUpdate.java
@@ -119,7 +119,7 @@
         out.writeBooleanArray(mCanBubble);
     }
 
-    public static final Parcelable.Creator<NotificationRankingUpdate> CREATOR
+    public static final @android.annotation.NonNull Parcelable.Creator<NotificationRankingUpdate> CREATOR
             = new Parcelable.Creator<NotificationRankingUpdate>() {
         public NotificationRankingUpdate createFromParcel(Parcel parcel) {
             return new NotificationRankingUpdate(parcel);
diff --git a/core/java/android/service/notification/NotificationStats.java b/core/java/android/service/notification/NotificationStats.java
index ebfabbf..2b4c24c 100644
--- a/core/java/android/service/notification/NotificationStats.java
+++ b/core/java/android/service/notification/NotificationStats.java
@@ -17,6 +17,7 @@
 
 import android.annotation.IntDef;
 import android.annotation.SystemApi;
+import android.annotation.TestApi;
 import android.app.RemoteInput;
 import android.os.Parcel;
 import android.os.Parcelable;
@@ -24,6 +25,12 @@
 import java.lang.annotation.Retention;
 import java.lang.annotation.RetentionPolicy;
 
+/**
+ * Information about how the user has interacted with a given notification.
+ * @hide
+ */
+@TestApi
+@SystemApi
 public final class NotificationStats implements Parcelable {
 
     private boolean mSeen;
@@ -131,7 +138,7 @@
         return 0;
     }
 
-    public static final Creator<NotificationStats> CREATOR = new Creator<NotificationStats>() {
+    public static final @android.annotation.NonNull Creator<NotificationStats> CREATOR = new Creator<NotificationStats>() {
         @Override
         public NotificationStats createFromParcel(Parcel in) {
             return new NotificationStats(in);
diff --git a/core/java/android/service/notification/NotifyingApp.java b/core/java/android/service/notification/NotifyingApp.java
index 38f18c6..a560623 100644
--- a/core/java/android/service/notification/NotifyingApp.java
+++ b/core/java/android/service/notification/NotifyingApp.java
@@ -74,7 +74,7 @@
         return this;
     }
 
-    public static final Creator<NotifyingApp> CREATOR = new Creator<NotifyingApp>() {
+    public static final @android.annotation.NonNull Creator<NotifyingApp> CREATOR = new Creator<NotifyingApp>() {
         @Override
         public NotifyingApp createFromParcel(Parcel in) {
             return new NotifyingApp(in);
diff --git a/core/java/android/service/notification/SnoozeCriterion.java b/core/java/android/service/notification/SnoozeCriterion.java
index bd93eff..938cc10 100644
--- a/core/java/android/service/notification/SnoozeCriterion.java
+++ b/core/java/android/service/notification/SnoozeCriterion.java
@@ -78,7 +78,7 @@
         return mConfirmation;
     }
 
-    public static final Creator<SnoozeCriterion> CREATOR = new Creator<SnoozeCriterion>() {
+    public static final @android.annotation.NonNull Creator<SnoozeCriterion> CREATOR = new Creator<SnoozeCriterion>() {
         @Override
         public SnoozeCriterion createFromParcel(Parcel in) {
             return new SnoozeCriterion(in);
diff --git a/core/java/android/service/notification/StatusBarNotification.java b/core/java/android/service/notification/StatusBarNotification.java
index 954dc39..cc74e1a 100644
--- a/core/java/android/service/notification/StatusBarNotification.java
+++ b/core/java/android/service/notification/StatusBarNotification.java
@@ -16,6 +16,7 @@
 
 package android.service.notification;
 
+import android.annotation.NonNull;
 import android.annotation.UnsupportedAppUsage;
 import android.app.Notification;
 import android.app.NotificationManager;
@@ -62,9 +63,6 @@
 
     private Context mContext; // used for inflation & icon expansion
 
-    // Contains the basic logging data of the notification.
-    private LogMaker mLogMaker;
-
     /** @hide */
     public StatusBarNotification(String pkg, String opPkg, int id,
             String tag, int uid, int initialPid, Notification notification, UserHandle user,
@@ -205,7 +203,7 @@
         return 0;
     }
 
-    public static final Parcelable.Creator<StatusBarNotification> CREATOR
+    public static final @android.annotation.NonNull Parcelable.Creator<StatusBarNotification> CREATOR
             = new Parcelable.Creator<StatusBarNotification>()
     {
         public StatusBarNotification createFromParcel(Parcel parcel)
@@ -299,7 +297,7 @@
      * Might be different from {@link #getPackageName()} if the app owning the notification has
      * a {@link NotificationManager#setNotificationDelegate(String) notification delegate}.
      */
-    public String getOpPkg() {
+    public @NonNull String getOpPkg() {
         return opPkg;
     }
 
@@ -403,24 +401,15 @@
      * @hide
      */
     public LogMaker getLogMaker() {
-        if (mLogMaker == null) {
-            // Initialize fields that only change on update (so a new record).
-            mLogMaker = new LogMaker(MetricsEvent.VIEW_UNKNOWN)
-                .setPackageName(getPackageName())
+        return new LogMaker(MetricsEvent.VIEW_UNKNOWN).setPackageName(getPackageName())
                 .addTaggedData(MetricsEvent.NOTIFICATION_ID, getId())
                 .addTaggedData(MetricsEvent.NOTIFICATION_TAG, getTag())
-                .addTaggedData(MetricsEvent.FIELD_NOTIFICATION_CHANNEL_ID, getChannelIdLogTag());
-        }
-        // Reset fields that can change between updates, or are used by multiple logs.
-        return mLogMaker
-            .clearCategory()
-            .clearType()
-            .clearSubtype()
-            .addTaggedData(MetricsEvent.FIELD_NOTIFICATION_GROUP_ID, getGroupLogTag())
-            .addTaggedData(MetricsEvent.FIELD_NOTIFICATION_GROUP_SUMMARY,
-                getNotification().isGroupSummary() ? 1 : 0)
-            .addTaggedData(MetricsProto.MetricsEvent.FIELD_NOTIFICATION_CATEGORY,
-                    getNotification().category);
+                .addTaggedData(MetricsEvent.FIELD_NOTIFICATION_CHANNEL_ID, getChannelIdLogTag())
+                .addTaggedData(MetricsEvent.FIELD_NOTIFICATION_GROUP_ID, getGroupLogTag())
+                .addTaggedData(MetricsEvent.FIELD_NOTIFICATION_GROUP_SUMMARY,
+                        getNotification().isGroupSummary() ? 1 : 0)
+                .addTaggedData(MetricsProto.MetricsEvent.FIELD_NOTIFICATION_CATEGORY,
+                        getNotification().category);
     }
 
     private String getGroupLogTag() {
diff --git a/core/java/android/service/notification/ZenModeConfig.java b/core/java/android/service/notification/ZenModeConfig.java
index bff118e..cb7d41b 100644
--- a/core/java/android/service/notification/ZenModeConfig.java
+++ b/core/java/android/service/notification/ZenModeConfig.java
@@ -921,7 +921,7 @@
         }
     }
 
-    public static final Parcelable.Creator<ZenModeConfig> CREATOR
+    public static final @android.annotation.NonNull Parcelable.Creator<ZenModeConfig> CREATOR
             = new Parcelable.Creator<ZenModeConfig>() {
         @Override
         public ZenModeConfig createFromParcel(Parcel source) {
@@ -1860,7 +1860,7 @@
                     || condition.state == Condition.STATE_UNKNOWN);
         }
 
-        public static final Parcelable.Creator<ZenRule> CREATOR
+        public static final @android.annotation.NonNull Parcelable.Creator<ZenRule> CREATOR
                 = new Parcelable.Creator<ZenRule>() {
             @Override
             public ZenRule createFromParcel(Parcel source) {
diff --git a/core/java/android/service/notification/ZenPolicy.java b/core/java/android/service/notification/ZenPolicy.java
index 6392704..9694998 100644
--- a/core/java/android/service/notification/ZenPolicy.java
+++ b/core/java/android/service/notification/ZenPolicy.java
@@ -17,6 +17,7 @@
 package android.service.notification;
 
 import android.annotation.IntDef;
+import android.annotation.NonNull;
 import android.app.Notification;
 import android.app.NotificationChannel;
 import android.os.Parcel;
@@ -357,7 +358,7 @@
      * Provides a convenient way to set the various fields of a {@link ZenPolicy}.  If a field
      * is not set, it is (@link STATE_UNSET} and will not change the current set policy.
      */
-    public static class Builder {
+    public static final class Builder {
         private ZenPolicy mZenPolicy;
 
         public Builder() {
@@ -378,14 +379,14 @@
         /**
          * Builds the current ZenPolicy.
          */
-        public ZenPolicy build() {
+        public @NonNull ZenPolicy build() {
             return mZenPolicy.copy();
         }
 
         /**
          * Allows all notifications to bypass DND and unmutes all streams.
          */
-        public Builder allowAllSounds() {
+        public @NonNull Builder allowAllSounds() {
             for (int i = 0; i < mZenPolicy.mPriorityCategories.size(); i++) {
                 mZenPolicy.mPriorityCategories.set(i, STATE_ALLOW);
             }
@@ -401,7 +402,7 @@
          * {@link NotificationChannel#canBypassDnd can bypass DND}. If no channels can bypass DND,
          * the ringer stream is also muted.
          */
-        public Builder disallowAllSounds() {
+        public @NonNull Builder disallowAllSounds() {
             for (int i = 0; i < mZenPolicy.mPriorityCategories.size(); i++) {
                 mZenPolicy.mPriorityCategories.set(i, STATE_DISALLOW);
             }
@@ -413,7 +414,7 @@
         /**
          * Allows notifications intercepted by DND to show on all surfaces when DND is active.
          */
-        public Builder showAllVisualEffects() {
+        public @NonNull Builder showAllVisualEffects() {
             for (int i = 0; i < mZenPolicy.mVisualEffects.size(); i++) {
                 mZenPolicy.mVisualEffects.set(i, STATE_ALLOW);
             }
@@ -423,7 +424,7 @@
         /**
          * Disallows notifications intercepted by DND from showing when DND is active.
          */
-        public Builder hideAllVisualEffects() {
+        public @NonNull Builder hideAllVisualEffects() {
             for (int i = 0; i < mZenPolicy.mVisualEffects.size(); i++) {
                 mZenPolicy.mVisualEffects.set(i, STATE_DISALLOW);
             }
@@ -435,7 +436,7 @@
          * unset categories will default to the current applied policy.
          * @hide
          */
-        public Builder unsetPriorityCategory(@PriorityCategory int category) {
+        public @NonNull Builder unsetPriorityCategory(@PriorityCategory int category) {
             mZenPolicy.mPriorityCategories.set(category, STATE_UNSET);
 
             if (category == PRIORITY_CATEGORY_MESSAGES) {
@@ -452,7 +453,7 @@
          * unset effects will default to the current applied policy.
          * @hide
          */
-        public Builder unsetVisualEffect(@VisualEffect int effect) {
+        public @NonNull Builder unsetVisualEffect(@VisualEffect int effect) {
             mZenPolicy.mVisualEffects.set(effect, STATE_UNSET);
             return this;
         }
@@ -461,7 +462,7 @@
          * Whether to allow notifications with category {@link Notification#CATEGORY_REMINDER}
          * to play sounds and visually appear or to intercept them when DND is active.
          */
-        public Builder allowReminders(boolean allow) {
+        public @NonNull Builder allowReminders(boolean allow) {
             mZenPolicy.mPriorityCategories.set(PRIORITY_CATEGORY_REMINDERS,
                     allow ? STATE_ALLOW : STATE_DISALLOW);
             return this;
@@ -471,7 +472,7 @@
          * Whether to allow notifications with category {@link Notification#CATEGORY_EVENT}
          * to play sounds and visually appear or to intercept them when DND is active.
          */
-        public Builder allowEvents(boolean allow) {
+        public @NonNull Builder allowEvents(boolean allow) {
             mZenPolicy.mPriorityCategories.set(PRIORITY_CATEGORY_EVENTS,
                     allow ? STATE_ALLOW : STATE_DISALLOW);
             return this;
@@ -483,7 +484,7 @@
          * them when DND is active.
          * @param audienceType message senders that are allowed to bypass DND
          */
-        public Builder allowMessages(@PeopleType int audienceType) {
+        public @NonNull Builder allowMessages(@PeopleType int audienceType) {
             if (audienceType == STATE_UNSET) {
                 return unsetPriorityCategory(PRIORITY_CATEGORY_MESSAGES);
             }
@@ -507,7 +508,7 @@
          * them when DND is active.
          * @param audienceType callers that are allowed to bypass DND
          */
-        public Builder allowCalls(@PeopleType int audienceType) {
+        public @NonNull  Builder allowCalls(@PeopleType int audienceType) {
             if (audienceType == STATE_UNSET) {
                 return unsetPriorityCategory(PRIORITY_CATEGORY_CALLS);
             }
@@ -530,7 +531,7 @@
          * {@link Notification#CATEGORY_CALL} that have recently called
          * to play sounds and visually appear.
          */
-        public Builder allowRepeatCallers(boolean allow) {
+        public @NonNull Builder allowRepeatCallers(boolean allow) {
             mZenPolicy.mPriorityCategories.set(PRIORITY_CATEGORY_REPEAT_CALLERS,
                     allow ? STATE_ALLOW : STATE_DISALLOW);
             return this;
@@ -542,7 +543,7 @@
          * to play sounds and visually appear or to intercept them when DND is active.
          * Disallowing alarms will mute the alarm stream when DND is active.
          */
-        public Builder allowAlarms(boolean allow) {
+        public @NonNull Builder allowAlarms(boolean allow) {
             mZenPolicy.mPriorityCategories.set(PRIORITY_CATEGORY_ALARMS,
                     allow ? STATE_ALLOW : STATE_DISALLOW);
             return this;
@@ -553,7 +554,7 @@
          * appear or to intercept them when DND is active.
          * Disallowing media will mute the media stream when DND is active.
          */
-        public Builder allowMedia(boolean allow) {
+        public @NonNull Builder allowMedia(boolean allow) {
             mZenPolicy.mPriorityCategories.set(PRIORITY_CATEGORY_MEDIA,
                     allow ? STATE_ALLOW : STATE_DISALLOW);
             return this;
@@ -563,7 +564,7 @@
          * Whether to allow system sounds to play when DND is active.
          * Disallowing system sounds will mute the system stream when DND is active.
          */
-        public Builder allowSystem(boolean allow) {
+        public @NonNull Builder allowSystem(boolean allow) {
             mZenPolicy.mPriorityCategories.set(PRIORITY_CATEGORY_SYSTEM,
                     allow ? STATE_ALLOW : STATE_DISALLOW);
             return this;
@@ -573,7 +574,7 @@
          * Whether to allow {@link PriorityCategory} sounds to play when DND is active.
          * @hide
          */
-        public Builder allowCategory(@PriorityCategory int category, boolean allow) {
+        public @NonNull Builder allowCategory(@PriorityCategory int category, boolean allow) {
             switch (category) {
                 case PRIORITY_CATEGORY_ALARMS:
                     allowAlarms(allow);
@@ -601,7 +602,7 @@
          * Whether {@link Notification#fullScreenIntent full screen intents} that are intercepted
          * by DND are shown.
          */
-        public Builder showFullScreenIntent(boolean show) {
+        public @NonNull Builder showFullScreenIntent(boolean show) {
             mZenPolicy.mVisualEffects.set(VISUAL_EFFECT_FULL_SCREEN_INTENT,
                     show ? STATE_ALLOW : STATE_DISALLOW);
             return this;
@@ -611,7 +612,7 @@
          * Whether {@link NotificationChannel#shouldShowLights() notification lights} from
          * notifications intercepted by DND are blocked.
          */
-        public Builder showLights(boolean show) {
+        public @NonNull Builder showLights(boolean show) {
             mZenPolicy.mVisualEffects.set(VISUAL_EFFECT_LIGHTS,
                     show ? STATE_ALLOW : STATE_DISALLOW);
             return this;
@@ -620,7 +621,7 @@
         /**
          * Whether notifications intercepted by DND are prevented from peeking.
          */
-        public Builder showPeeking(boolean show) {
+        public @NonNull Builder showPeeking(boolean show) {
             mZenPolicy.mVisualEffects.set(VISUAL_EFFECT_PEEK,
                     show ? STATE_ALLOW : STATE_DISALLOW);
             return this;
@@ -630,7 +631,7 @@
          * Whether notifications intercepted by DND are prevented from appearing in the status bar
          * on devices that support status bars.
          */
-        public Builder showStatusBarIcons(boolean show) {
+        public @NonNull Builder showStatusBarIcons(boolean show) {
             mZenPolicy.mVisualEffects.set(VISUAL_EFFECT_STATUS_BAR,
                     show ? STATE_ALLOW : STATE_DISALLOW);
             return this;
@@ -640,7 +641,7 @@
          * Whether {@link NotificationChannel#canShowBadge() badges} from
          * notifications intercepted by DND are allowed on devices that support badging.
          */
-        public Builder showBadges(boolean show) {
+        public @NonNull Builder showBadges(boolean show) {
             mZenPolicy.mVisualEffects.set(VISUAL_EFFECT_BADGE,
                     show ? STATE_ALLOW : STATE_DISALLOW);
             return this;
@@ -650,7 +651,7 @@
          * Whether notification intercepted by DND are prevented from appearing on ambient displays
          * on devices that support ambient display.
          */
-        public Builder showInAmbientDisplay(boolean show) {
+        public @NonNull Builder showInAmbientDisplay(boolean show) {
             mZenPolicy.mVisualEffects.set(VISUAL_EFFECT_AMBIENT,
                     show ? STATE_ALLOW : STATE_DISALLOW);
             return this;
@@ -661,7 +662,7 @@
          * list views like the notification shade or lockscreen on devices that support those
          * views.
          */
-        public Builder showInNotificationList(boolean show) {
+        public @NonNull Builder showInNotificationList(boolean show) {
             mZenPolicy.mVisualEffects.set(VISUAL_EFFECT_NOTIFICATION_LIST,
                     show ? STATE_ALLOW : STATE_DISALLOW);
             return this;
@@ -672,7 +673,7 @@
          * {@link VisualEffect}
          * @hide
          */
-        public Builder showVisualEffect(@VisualEffect int effect, boolean show) {
+        public @NonNull Builder showVisualEffect(@VisualEffect int effect, boolean show) {
             switch (effect) {
                 case VISUAL_EFFECT_FULL_SCREEN_INTENT:
                     showFullScreenIntent(show);
@@ -713,7 +714,7 @@
         dest.writeInt(mPriorityMessages);
     }
 
-    public static final Parcelable.Creator<ZenPolicy> CREATOR =
+    public static final @android.annotation.NonNull Parcelable.Creator<ZenPolicy> CREATOR =
             new Parcelable.Creator<ZenPolicy>() {
         @Override
         public ZenPolicy createFromParcel(Parcel source) {
@@ -1001,7 +1002,7 @@
      * Makes deep copy of this ZenPolicy.
      * @hide
      */
-    public ZenPolicy copy() {
+    public @NonNull ZenPolicy copy() {
         final Parcel parcel = Parcel.obtain();
         try {
             writeToParcel(parcel, 0);
diff --git a/core/java/android/service/quicksettings/Tile.java b/core/java/android/service/quicksettings/Tile.java
index 6b569cf..4191040 100644
--- a/core/java/android/service/quicksettings/Tile.java
+++ b/core/java/android/service/quicksettings/Tile.java
@@ -229,7 +229,7 @@
         mContentDescription = TextUtils.CHAR_SEQUENCE_CREATOR.createFromParcel(source);
     }
 
-    public static final Creator<Tile> CREATOR = new Creator<Tile>() {
+    public static final @android.annotation.NonNull Creator<Tile> CREATOR = new Creator<Tile>() {
         @Override
         public Tile createFromParcel(Parcel source) {
             return new Tile(source);
diff --git a/core/java/android/service/resolver/ResolverTarget.java b/core/java/android/service/resolver/ResolverTarget.java
index fb3e2d7..33b3283 100644
--- a/core/java/android/service/resolver/ResolverTarget.java
+++ b/core/java/android/service/resolver/ResolverTarget.java
@@ -201,7 +201,7 @@
     }
 
     // creator definition for the class.
-    public static final Creator<ResolverTarget> CREATOR
+    public static final @android.annotation.NonNull Creator<ResolverTarget> CREATOR
             = new Creator<ResolverTarget>() {
         @Override
         public ResolverTarget createFromParcel(Parcel source) {
diff --git a/core/java/android/service/settings/suggestions/Suggestion.java b/core/java/android/service/settings/suggestions/Suggestion.java
index e97f963a..3e63efb 100644
--- a/core/java/android/service/settings/suggestions/Suggestion.java
+++ b/core/java/android/service/settings/suggestions/Suggestion.java
@@ -125,7 +125,7 @@
         mPendingIntent = in.readParcelable(PendingIntent.class.getClassLoader());
     }
 
-    public static final Creator<Suggestion> CREATOR = new Creator<Suggestion>() {
+    public static final @android.annotation.NonNull Creator<Suggestion> CREATOR = new Creator<Suggestion>() {
         @Override
         public Suggestion createFromParcel(Parcel in) {
             return new Suggestion(in);
diff --git a/core/java/android/service/textclassifier/IConversationActionsCallback.aidl b/core/java/android/service/textclassifier/IConversationActionsCallback.aidl
deleted file mode 100644
index c35d424..0000000
--- a/core/java/android/service/textclassifier/IConversationActionsCallback.aidl
+++ /dev/null
@@ -1,28 +0,0 @@
-/*
- * Copyright (C) 2018 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.service.textclassifier;
-
-import android.view.textclassifier.ConversationActions;
-
-/**
- * Callback for a ConversationActions request.
- * @hide
- */
-oneway interface IConversationActionsCallback {
-    void onSuccess(in ConversationActions conversationActions);
-    void onFailure();
-}
\ No newline at end of file
diff --git a/core/java/android/service/textclassifier/ITextClassificationCallback.aidl b/core/java/android/service/textclassifier/ITextClassificationCallback.aidl
deleted file mode 100644
index 10bfe63..0000000
--- a/core/java/android/service/textclassifier/ITextClassificationCallback.aidl
+++ /dev/null
@@ -1,28 +0,0 @@
-/*
- * Copyright (C) 2018 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.service.textclassifier;
-
-import android.view.textclassifier.TextClassification;
-
-/**
- * Callback for a TextClassification request.
- * @hide
- */
-oneway interface ITextClassificationCallback {
-    void onSuccess(in TextClassification classification);
-    void onFailure();
-}
diff --git a/core/java/android/service/textclassifier/ITextSelectionCallback.aidl b/core/java/android/service/textclassifier/ITextClassifierCallback.aidl
similarity index 82%
rename from core/java/android/service/textclassifier/ITextSelectionCallback.aidl
rename to core/java/android/service/textclassifier/ITextClassifierCallback.aidl
index 1b4c4d1..2926734 100644
--- a/core/java/android/service/textclassifier/ITextSelectionCallback.aidl
+++ b/core/java/android/service/textclassifier/ITextClassifierCallback.aidl
@@ -16,13 +16,14 @@
 
 package android.service.textclassifier;
 
+import android.os.Bundle;
 import android.view.textclassifier.TextSelection;
 
 /**
- * Callback for a TextSelection request.
+ * Callback for all requests from SystemTextClassifier.
  * @hide
  */
-oneway interface ITextSelectionCallback {
-    void onSuccess(in TextSelection selection);
+oneway interface ITextClassifierCallback {
+    void onSuccess(in Bundle result);
     void onFailure();
 }
\ No newline at end of file
diff --git a/core/java/android/service/textclassifier/ITextClassifierService.aidl b/core/java/android/service/textclassifier/ITextClassifierService.aidl
index 7941794..2f8d67b 100644
--- a/core/java/android/service/textclassifier/ITextClassifierService.aidl
+++ b/core/java/android/service/textclassifier/ITextClassifierService.aidl
@@ -16,11 +16,7 @@
 
 package android.service.textclassifier;
 
-import android.service.textclassifier.IConversationActionsCallback;
-import android.service.textclassifier.ITextClassificationCallback;
-import android.service.textclassifier.ITextLanguageCallback;
-import android.service.textclassifier.ITextLinksCallback;
-import android.service.textclassifier.ITextSelectionCallback;
+import android.service.textclassifier.ITextClassifierCallback;
 import android.view.textclassifier.ConversationActions;
 import android.view.textclassifier.SelectionEvent;
 import android.view.textclassifier.TextClassification;
@@ -41,17 +37,17 @@
     void onSuggestSelection(
             in TextClassificationSessionId sessionId,
             in TextSelection.Request request,
-            in ITextSelectionCallback callback);
+            in ITextClassifierCallback callback);
 
     void onClassifyText(
             in TextClassificationSessionId sessionId,
             in TextClassification.Request request,
-            in ITextClassificationCallback callback);
+            in ITextClassifierCallback callback);
 
     void onGenerateLinks(
             in TextClassificationSessionId sessionId,
             in TextLinks.Request request,
-            in ITextLinksCallback callback);
+            in ITextClassifierCallback callback);
 
     // TODO: Remove
     void onSelectionEvent(
@@ -72,10 +68,10 @@
     void onDetectLanguage(
             in TextClassificationSessionId sessionId,
             in TextLanguage.Request request,
-            in ITextLanguageCallback callback);
+            in ITextClassifierCallback callback);
 
     void onSuggestConversationActions(
             in TextClassificationSessionId sessionId,
             in ConversationActions.Request request,
-            in IConversationActionsCallback callback);
+            in ITextClassifierCallback callback);
 }
diff --git a/core/java/android/service/textclassifier/ITextLanguageCallback.aidl b/core/java/android/service/textclassifier/ITextLanguageCallback.aidl
deleted file mode 100644
index 263d99af..0000000
--- a/core/java/android/service/textclassifier/ITextLanguageCallback.aidl
+++ /dev/null
@@ -1,28 +0,0 @@
-/*
- * Copyright (C) 2018 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.service.textclassifier;
-
-import android.view.textclassifier.TextLanguage;
-
-/**
- * Callback for a TextLanguage request.
- * @hide
- */
-oneway interface ITextLanguageCallback {
-    void onSuccess(in TextLanguage textLanguage);
-    void onFailure();
-}
\ No newline at end of file
diff --git a/core/java/android/service/textclassifier/ITextLinksCallback.aidl b/core/java/android/service/textclassifier/ITextLinksCallback.aidl
deleted file mode 100644
index a9e0dde..0000000
--- a/core/java/android/service/textclassifier/ITextLinksCallback.aidl
+++ /dev/null
@@ -1,28 +0,0 @@
-/*
- * Copyright (C) 2018 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.service.textclassifier;
-
-import android.view.textclassifier.TextLinks;
-
-/**
- * Callback for a TextLinks request.
- * @hide
- */
-oneway interface ITextLinksCallback {
-    void onSuccess(in TextLinks links);
-    void onFailure();
-}
\ No newline at end of file
diff --git a/core/java/android/service/textclassifier/TextClassifierService.java b/core/java/android/service/textclassifier/TextClassifierService.java
index 235b8e8..4088ce8 100644
--- a/core/java/android/service/textclassifier/TextClassifierService.java
+++ b/core/java/android/service/textclassifier/TextClassifierService.java
@@ -17,6 +17,7 @@
 package android.service.textclassifier;
 
 import android.Manifest;
+import android.annotation.MainThread;
 import android.annotation.NonNull;
 import android.annotation.Nullable;
 import android.annotation.SystemApi;
@@ -27,8 +28,12 @@
 import android.content.pm.PackageManager;
 import android.content.pm.ResolveInfo;
 import android.content.pm.ServiceInfo;
+import android.os.Bundle;
 import android.os.CancellationSignal;
+import android.os.Handler;
 import android.os.IBinder;
+import android.os.Looper;
+import android.os.Parcelable;
 import android.os.RemoteException;
 import android.text.TextUtils;
 import android.util.Slog;
@@ -46,6 +51,10 @@
 
 import com.android.internal.util.Preconditions;
 
+import java.lang.ref.WeakReference;
+import java.util.concurrent.ExecutorService;
+import java.util.concurrent.Executors;
+
 /**
  * Abstract base class for the TextClassifier service.
  *
@@ -68,6 +77,11 @@
  *     </intent-filter>
  * </service>}</pre>
  *
+ * <p>From {@link android.os.Build.VERSION_CODES#Q} onward, all callbacks are called on the main
+ * thread. Prior to Q, there is no guarantee on what thread the callback will happen. You should
+ * make sure the callbacks are executed in your desired thread by using a executor, a handler or
+ * something else along the line.
+ *
  * @see TextClassifier
  * @hide
  */
@@ -85,201 +99,102 @@
     public static final String SERVICE_INTERFACE =
             "android.service.textclassifier.TextClassifierService";
 
+    /** @hide **/
+    private static final String KEY_RESULT = "key_result";
+
+    private final Handler mMainThreadHandler = new Handler(Looper.getMainLooper(), null, true);
+    private final ExecutorService mSingleThreadExecutor = Executors.newSingleThreadExecutor();
+
     private final ITextClassifierService.Stub mBinder = new ITextClassifierService.Stub() {
 
         // TODO(b/72533911): Implement cancellation signal
         @NonNull private final CancellationSignal mCancellationSignal = new CancellationSignal();
 
-        /** {@inheritDoc} */
         @Override
         public void onSuggestSelection(
                 TextClassificationSessionId sessionId,
-                TextSelection.Request request, ITextSelectionCallback callback) {
+                TextSelection.Request request, ITextClassifierCallback callback) {
             Preconditions.checkNotNull(request);
             Preconditions.checkNotNull(callback);
-            TextClassifierService.this.onSuggestSelection(
-                    sessionId, request, mCancellationSignal,
-                    new Callback<TextSelection>() {
-                        @Override
-                        public void onSuccess(TextSelection result) {
-                            try {
-                                callback.onSuccess(result);
-                            } catch (RemoteException e) {
-                                Slog.d(LOG_TAG, "Error calling callback");
-                            }
-                        }
+            mMainThreadHandler.post(() -> TextClassifierService.this.onSuggestSelection(
+                    sessionId, request, mCancellationSignal, new ProxyCallback<>(callback)));
 
-                        @Override
-                        public void onFailure(CharSequence error) {
-                            try {
-                                if (callback.asBinder().isBinderAlive()) {
-                                    callback.onFailure();
-                                }
-                            } catch (RemoteException e) {
-                                Slog.d(LOG_TAG, "Error calling callback");
-                            }
-                        }
-                    });
         }
 
-        /** {@inheritDoc} */
         @Override
         public void onClassifyText(
                 TextClassificationSessionId sessionId,
-                TextClassification.Request request, ITextClassificationCallback callback) {
+                TextClassification.Request request, ITextClassifierCallback callback) {
             Preconditions.checkNotNull(request);
             Preconditions.checkNotNull(callback);
-            TextClassifierService.this.onClassifyText(
-                    sessionId, request, mCancellationSignal,
-                    new Callback<TextClassification>() {
-                        @Override
-                        public void onSuccess(TextClassification result) {
-                            try {
-                                callback.onSuccess(result);
-                            } catch (RemoteException e) {
-                                Slog.d(LOG_TAG, "Error calling callback");
-                            }
-                        }
-
-                        @Override
-                        public void onFailure(CharSequence error) {
-                            try {
-                                callback.onFailure();
-                            } catch (RemoteException e) {
-                                Slog.d(LOG_TAG, "Error calling callback");
-                            }
-                        }
-                    });
+            mMainThreadHandler.post(() -> TextClassifierService.this.onClassifyText(
+                    sessionId, request, mCancellationSignal, new ProxyCallback<>(callback)));
         }
 
-        /** {@inheritDoc} */
         @Override
         public void onGenerateLinks(
                 TextClassificationSessionId sessionId,
-                TextLinks.Request request, ITextLinksCallback callback) {
+                TextLinks.Request request, ITextClassifierCallback callback) {
             Preconditions.checkNotNull(request);
             Preconditions.checkNotNull(callback);
-            TextClassifierService.this.onGenerateLinks(
-                    sessionId, request,
-                    mCancellationSignal,
-                    new Callback<TextLinks>() {
-                        @Override
-                        public void onSuccess(TextLinks result) {
-                            try {
-                                callback.onSuccess(result);
-                            } catch (RemoteException e) {
-                                Slog.d(LOG_TAG, "Error calling callback");
-                            }
-                        }
-
-                        @Override
-                        public void onFailure(CharSequence error) {
-                            try {
-                                callback.onFailure();
-                            } catch (RemoteException e) {
-                                Slog.d(LOG_TAG, "Error calling callback");
-                            }
-                        }
-                    });
+            mMainThreadHandler.post(() -> TextClassifierService.this.onGenerateLinks(
+                    sessionId, request, mCancellationSignal, new ProxyCallback<>(callback)));
         }
 
-        /** {@inheritDoc} */
         @Override
         public void onSelectionEvent(
                 TextClassificationSessionId sessionId,
                 SelectionEvent event) {
             Preconditions.checkNotNull(event);
-            TextClassifierService.this.onSelectionEvent(sessionId, event);
+            mMainThreadHandler.post(
+                    () -> TextClassifierService.this.onSelectionEvent(sessionId, event));
         }
 
-        /** {@inheritDoc} */
         @Override
         public void onTextClassifierEvent(
                 TextClassificationSessionId sessionId,
                 TextClassifierEvent event) {
             Preconditions.checkNotNull(event);
-            TextClassifierService.this.onTextClassifierEvent(sessionId, event);
+            mMainThreadHandler.post(
+                    () -> TextClassifierService.this.onTextClassifierEvent(sessionId, event));
         }
 
-        /** {@inheritDoc} */
         @Override
         public void onDetectLanguage(
                 TextClassificationSessionId sessionId,
                 TextLanguage.Request request,
-                ITextLanguageCallback callback) {
+                ITextClassifierCallback callback) {
             Preconditions.checkNotNull(request);
             Preconditions.checkNotNull(callback);
-            TextClassifierService.this.onDetectLanguage(
-                    sessionId,
-                    request,
-                    mCancellationSignal,
-                    new Callback<TextLanguage>() {
-                        @Override
-                        public void onSuccess(TextLanguage result) {
-                            try {
-                                callback.onSuccess(result);
-                            } catch (RemoteException e) {
-                                Slog.d(LOG_TAG, "Error calling callback");
-                            }
-                        }
-
-                        @Override
-                        public void onFailure(CharSequence error) {
-                            try {
-                                callback.onFailure();
-                            } catch (RemoteException e) {
-                                Slog.d(LOG_TAG, "Error calling callback");
-                            }
-                        };
-                    });
+            mMainThreadHandler.post(() -> TextClassifierService.this.onDetectLanguage(
+                    sessionId, request, mCancellationSignal, new ProxyCallback<>(callback)));
         }
 
-        /** {@inheritDoc} */
         @Override
         public void onSuggestConversationActions(
                 TextClassificationSessionId sessionId,
                 ConversationActions.Request request,
-                IConversationActionsCallback callback) {
+                ITextClassifierCallback callback) {
             Preconditions.checkNotNull(request);
             Preconditions.checkNotNull(callback);
-            TextClassifierService.this.onSuggestConversationActions(
-                    sessionId,
-                    request,
-                    mCancellationSignal,
-                    new Callback<ConversationActions>() {
-                        @Override
-                        public void onSuccess(ConversationActions result) {
-                            try {
-                                callback.onSuccess(result);
-                            } catch (RemoteException e) {
-                                Slog.d(LOG_TAG, "Error calling callback");
-                            }
-                        }
-
-                        @Override
-                        public void onFailure(CharSequence error) {
-                            try {
-                                callback.onFailure();
-                            } catch (RemoteException e) {
-                                Slog.d(LOG_TAG, "Error calling callback");
-                            }
-                        }
-                    });
+            mMainThreadHandler.post(() -> TextClassifierService.this.onSuggestConversationActions(
+                    sessionId, request, mCancellationSignal, new ProxyCallback<>(callback)));
         }
 
-        /** {@inheritDoc} */
         @Override
         public void onCreateTextClassificationSession(
                 TextClassificationContext context, TextClassificationSessionId sessionId) {
             Preconditions.checkNotNull(context);
             Preconditions.checkNotNull(sessionId);
-            TextClassifierService.this.onCreateTextClassificationSession(context, sessionId);
+            mMainThreadHandler.post(
+                    () -> TextClassifierService.this.onCreateTextClassificationSession(
+                            context, sessionId));
         }
 
-        /** {@inheritDoc} */
         @Override
         public void onDestroyTextClassificationSession(TextClassificationSessionId sessionId) {
-            TextClassifierService.this.onDestroyTextClassificationSession(sessionId);
+            mMainThreadHandler.post(
+                    () -> TextClassifierService.this.onDestroyTextClassificationSession(sessionId));
         }
     };
 
@@ -301,6 +216,7 @@
      * @param cancellationSignal object to watch for canceling the current operation
      * @param callback the callback to return the result to
      */
+    @MainThread
     public abstract void onSuggestSelection(
             @Nullable TextClassificationSessionId sessionId,
             @NonNull TextSelection.Request request,
@@ -316,6 +232,7 @@
      * @param cancellationSignal object to watch for canceling the current operation
      * @param callback the callback to return the result to
      */
+    @MainThread
     public abstract void onClassifyText(
             @Nullable TextClassificationSessionId sessionId,
             @NonNull TextClassification.Request request,
@@ -331,6 +248,7 @@
      * @param cancellationSignal object to watch for canceling the current operation
      * @param callback the callback to return the result to
      */
+    @MainThread
     public abstract void onGenerateLinks(
             @Nullable TextClassificationSessionId sessionId,
             @NonNull TextLinks.Request request,
@@ -345,12 +263,14 @@
      * @param cancellationSignal object to watch for canceling the current operation
      * @param callback the callback to return the result to
      */
+    @MainThread
     public void onDetectLanguage(
             @Nullable TextClassificationSessionId sessionId,
             @NonNull TextLanguage.Request request,
             @NonNull CancellationSignal cancellationSignal,
             @NonNull Callback<TextLanguage> callback) {
-        callback.onSuccess(getLocalTextClassifier().detectLanguage(request));
+        mSingleThreadExecutor.submit(() ->
+                callback.onSuccess(getLocalTextClassifier().detectLanguage(request)));
     }
 
     /**
@@ -361,12 +281,14 @@
      * @param cancellationSignal object to watch for canceling the current operation
      * @param callback the callback to return the result to
      */
+    @MainThread
     public void onSuggestConversationActions(
             @Nullable TextClassificationSessionId sessionId,
             @NonNull ConversationActions.Request request,
             @NonNull CancellationSignal cancellationSignal,
             @NonNull Callback<ConversationActions> callback) {
-        callback.onSuccess(getLocalTextClassifier().suggestConversationActions(request));
+        mSingleThreadExecutor.submit(() ->
+                callback.onSuccess(getLocalTextClassifier().suggestConversationActions(request)));
     }
 
     /**
@@ -383,6 +305,7 @@
      *      instead
      */
     @Deprecated
+    @MainThread
     public void onSelectionEvent(
             @Nullable TextClassificationSessionId sessionId, @NonNull SelectionEvent event) {}
 
@@ -396,6 +319,7 @@
      * @param sessionId the session id
      * @param event the TextClassifier event
      */
+    @MainThread
     public void onTextClassifierEvent(
             @Nullable TextClassificationSessionId sessionId, @NonNull TextClassifierEvent event) {}
 
@@ -405,6 +329,7 @@
      * @param context the text classification context
      * @param sessionId the session's Id
      */
+    @MainThread
     public void onCreateTextClassificationSession(
             @NonNull TextClassificationContext context,
             @NonNull TextClassificationSessionId sessionId) {}
@@ -414,6 +339,7 @@
      *
      * @param sessionId the id of the session to destroy
      */
+    @MainThread
     public void onDestroyTextClassificationSession(
             @NonNull TextClassificationSessionId sessionId) {}
 
@@ -441,6 +367,11 @@
         return TextClassifier.NO_OP;
     }
 
+    /** @hide **/
+    public static <T extends Parcelable> T getResponse(Bundle bundle) {
+        return bundle.getParcelable(KEY_RESULT);
+    }
+
     /**
      * Callbacks for TextClassifierService results.
      *
@@ -494,4 +425,44 @@
                 si.permission));
         return null;
     }
+
+    /**
+     * Forwards the callback result to a wrapped binder callback.
+     */
+    private static final class ProxyCallback<T extends Parcelable> implements Callback<T> {
+        private WeakReference<ITextClassifierCallback> mTextClassifierCallback;
+
+        private ProxyCallback(ITextClassifierCallback textClassifierCallback) {
+            mTextClassifierCallback =
+                    new WeakReference<>(Preconditions.checkNotNull(textClassifierCallback));
+        }
+
+        @Override
+        public void onSuccess(T result) {
+            ITextClassifierCallback callback = mTextClassifierCallback.get();
+            if (callback == null) {
+                return;
+            }
+            try {
+                Bundle bundle = new Bundle(1);
+                bundle.putParcelable(KEY_RESULT, result);
+                callback.onSuccess(bundle);
+            } catch (RemoteException e) {
+                Slog.d(LOG_TAG, "Error calling callback");
+            }
+        }
+
+        @Override
+        public void onFailure(CharSequence error) {
+            ITextClassifierCallback callback = mTextClassifierCallback.get();
+            if (callback == null) {
+                return;
+            }
+            try {
+                callback.onFailure();
+            } catch (RemoteException e) {
+                Slog.d(LOG_TAG, "Error calling callback");
+            }
+        }
+    }
 }
diff --git a/core/java/android/service/vr/IVrManager.aidl b/core/java/android/service/vr/IVrManager.aidl
index b0269e3..a8293b4 100644
--- a/core/java/android/service/vr/IVrManager.aidl
+++ b/core/java/android/service/vr/IVrManager.aidl
@@ -57,6 +57,7 @@
      *
      * @return {@code true} if VR mode is enabled.
      */
+    @UnsupportedAppUsage
     boolean getVrModeState();
 
     /**
@@ -93,6 +94,7 @@
      * @return {@link android.view.Display.INVALID_DISPLAY} if there is no virtual display
      * currently, else return the display id of the virtual display
      */
+    @UnsupportedAppUsage
     int getVr2dDisplayId();
 
     /**
diff --git a/core/java/android/service/wallpaper/IWallpaperEngine.aidl b/core/java/android/service/wallpaper/IWallpaperEngine.aidl
index ebce484..00e0b7c 100644
--- a/core/java/android/service/wallpaper/IWallpaperEngine.aidl
+++ b/core/java/android/service/wallpaper/IWallpaperEngine.aidl
@@ -26,11 +26,15 @@
 oneway interface IWallpaperEngine {
     void setDesiredSize(int width, int height);
     void setDisplayPadding(in Rect padding);
+    @UnsupportedAppUsage
     void setVisibility(boolean visible);
     void setInAmbientMode(boolean inAmbientDisplay, long animationDuration);
+    @UnsupportedAppUsage
     void dispatchPointer(in MotionEvent event);
+    @UnsupportedAppUsage
     void dispatchWallpaperCommand(String action, int x, int y,
             int z, in Bundle extras);
     void requestWallpaperColors();
+    @UnsupportedAppUsage
     void destroy();
 }
diff --git a/core/java/android/speech/IRecognitionListener.aidl b/core/java/android/speech/IRecognitionListener.aidl
index 3d3c44b..e77851b 100644
--- a/core/java/android/speech/IRecognitionListener.aidl
+++ b/core/java/android/speech/IRecognitionListener.aidl
@@ -83,5 +83,6 @@
      * @param eventType the type of the occurred event
      * @param params a Bundle containing the passed parameters
      */
+    @UnsupportedAppUsage
     void onEvent(in int eventType, in Bundle params);
 }
diff --git a/core/java/android/speech/tts/Voice.java b/core/java/android/speech/tts/Voice.java
index dcf5980..fefc35e 100644
--- a/core/java/android/speech/tts/Voice.java
+++ b/core/java/android/speech/tts/Voice.java
@@ -106,7 +106,7 @@
         return 0;
     }
 
-    public static final Parcelable.Creator<Voice> CREATOR = new Parcelable.Creator<Voice>() {
+    public static final @android.annotation.NonNull Parcelable.Creator<Voice> CREATOR = new Parcelable.Creator<Voice>() {
         @Override
         public Voice createFromParcel(Parcel in) {
             return new Voice(in);
diff --git a/core/java/android/text/StaticLayout.java b/core/java/android/text/StaticLayout.java
index 24d746e..defe2ce 100644
--- a/core/java/android/text/StaticLayout.java
+++ b/core/java/android/text/StaticLayout.java
@@ -643,7 +643,7 @@
                 .setBreakStrategy(b.mBreakStrategy)
                 .setHyphenationFrequency(b.mHyphenationFrequency)
                 // TODO: Support more justification mode, e.g. letter spacing, stretching.
-                .setJustified(b.mJustificationMode)
+                .setJustificationMode(b.mJustificationMode)
                 .setIndents(indents)
                 .build();
 
diff --git a/core/java/android/text/style/AccessibilityClickableSpan.java b/core/java/android/text/style/AccessibilityClickableSpan.java
index 7f39cc1..534ce63 100644
--- a/core/java/android/text/style/AccessibilityClickableSpan.java
+++ b/core/java/android/text/style/AccessibilityClickableSpan.java
@@ -144,7 +144,7 @@
                 R.id.accessibilityActionClickOnClickableSpan, arguments);
     }
 
-    public static final Parcelable.Creator<AccessibilityClickableSpan> CREATOR =
+    public static final @android.annotation.NonNull Parcelable.Creator<AccessibilityClickableSpan> CREATOR =
             new Parcelable.Creator<AccessibilityClickableSpan>() {
                 @Override
                 public AccessibilityClickableSpan createFromParcel(Parcel parcel) {
diff --git a/core/java/android/text/style/LineHeightSpan.java b/core/java/android/text/style/LineHeightSpan.java
index a5d5af2..7fb0f95 100644
--- a/core/java/android/text/style/LineHeightSpan.java
+++ b/core/java/android/text/style/LineHeightSpan.java
@@ -88,7 +88,7 @@
         /**
          * Constructor called from {@link TextUtils} to restore the span from a parcel
          */
-        public Standard(Parcel src) {
+        public Standard(@NonNull Parcel src) {
             mHeight = src.readInt();
         }
 
diff --git a/core/java/android/text/style/SuggestionSpan.java b/core/java/android/text/style/SuggestionSpan.java
index dd073e9..c000ae3 100644
--- a/core/java/android/text/style/SuggestionSpan.java
+++ b/core/java/android/text/style/SuggestionSpan.java
@@ -344,7 +344,7 @@
                 languageTag, localeStringForCompatibility});
     }
 
-    public static final Parcelable.Creator<SuggestionSpan> CREATOR =
+    public static final @android.annotation.NonNull Parcelable.Creator<SuggestionSpan> CREATOR =
             new Parcelable.Creator<SuggestionSpan>() {
         @Override
         public SuggestionSpan createFromParcel(Parcel source) {
diff --git a/core/java/android/util/ArrayMap.java b/core/java/android/util/ArrayMap.java
index 294a179..e2af6f5 100644
--- a/core/java/android/util/ArrayMap.java
+++ b/core/java/android/util/ArrayMap.java
@@ -16,9 +16,12 @@
 
 package android.util;
 
+import android.annotation.UnsupportedAppUsage;
+
+import com.android.internal.util.ArrayUtils;
+
 import libcore.util.EmptyArray;
 
-import android.annotation.UnsupportedAppUsage;
 import java.util.Collection;
 import java.util.ConcurrentModificationException;
 import java.util.Map;
@@ -450,6 +453,10 @@
      * @return Returns the key stored at the given index.
      */
     public K keyAt(int index) {
+        if (index >= mSize) {
+            // The array might be slightly bigger than mSize, in which case, indexing won't fail.
+            throw new ArrayIndexOutOfBoundsException(index);
+        }
         return (K)mArray[index << 1];
     }
 
@@ -459,6 +466,10 @@
      * @return Returns the value stored at the given index.
      */
     public V valueAt(int index) {
+        if (index >= mSize) {
+            // The array might be slightly bigger than mSize, in which case, indexing won't fail.
+            throw new ArrayIndexOutOfBoundsException(index);
+        }
         return (V)mArray[(index << 1) + 1];
     }
 
@@ -469,6 +480,10 @@
      * @return Returns the previous value at the given index.
      */
     public V setValueAt(int index, V value) {
+        if (index >= mSize) {
+            // The array might be slightly bigger than mSize, in which case, indexing won't fail.
+            throw new ArrayIndexOutOfBoundsException(index);
+        }
         index = (index << 1) + 1;
         V old = (V)mArray[index];
         mArray[index] = value;
@@ -662,6 +677,11 @@
      * @return Returns the value that was stored at this index.
      */
     public V removeAt(int index) {
+        if (index >= mSize) {
+            // The array might be slightly bigger than mSize, in which case, indexing won't fail.
+            throw new ArrayIndexOutOfBoundsException(index);
+        }
+
         final Object old = mArray[(index << 1) + 1];
         final int osize = mSize;
         final int nsize;
@@ -816,7 +836,7 @@
             buffer.append('=');
             Object value = valueAt(i);
             if (value != this) {
-                buffer.append(value);
+                buffer.append(ArrayUtils.deepToString(value));
             } else {
                 buffer.append("(this Map)");
             }
diff --git a/core/java/android/util/DocumentsStatsLog.java b/core/java/android/util/DocumentsStatsLog.java
index f483944..a67bbde 100644
--- a/core/java/android/util/DocumentsStatsLog.java
+++ b/core/java/android/util/DocumentsStatsLog.java
@@ -16,6 +16,7 @@
 
 package android.util;
 
+import android.annotation.Nullable;
 import android.annotation.SystemApi;
 import android.provider.DocumentsContract;
 import android.provider.DocumentsProvider;
@@ -126,7 +127,7 @@
      *
      * @param packageName
      */
-    public static void logPickerLaunchedFrom(String packageName) {
+    public static void logPickerLaunchedFrom(@Nullable String packageName) {
         StatsLog.write(StatsLog.DOCS_UI_PICKER_LAUNCHED_FROM_REPORTED, packageName);
     }
 
diff --git a/core/java/android/util/FeatureFlagUtils.java b/core/java/android/util/FeatureFlagUtils.java
index 140c34f..7747a55 100644
--- a/core/java/android/util/FeatureFlagUtils.java
+++ b/core/java/android/util/FeatureFlagUtils.java
@@ -39,25 +39,27 @@
     public static final String SAFETY_HUB = "settings_safety_hub";
     public static final String SCREENRECORD_LONG_PRESS = "settings_screenrecord_long_press";
     public static final String GLOBAL_ACTIONS_GRID_ENABLED = "settings_global_actions_grid_enabled";
+    public static final String GLOBAL_ACTIONS_PANEL_ENABLED =
+            "settings_global_actions_panel_enabled";
 
     private static final Map<String, String> DEFAULT_FLAGS;
 
     static {
         DEFAULT_FLAGS = new HashMap<>();
         DEFAULT_FLAGS.put("settings_audio_switcher", "true");
-        DEFAULT_FLAGS.put("settings_dynamic_homepage", "true");
         DEFAULT_FLAGS.put("settings_mobile_network_v2", "true");
-        DEFAULT_FLAGS.put("settings_network_and_internet_v2", "false");
+        DEFAULT_FLAGS.put("settings_network_and_internet_v2", "true");
         DEFAULT_FLAGS.put("settings_slice_injection", "true");
         DEFAULT_FLAGS.put("settings_systemui_theme", "true");
         DEFAULT_FLAGS.put("settings_wifi_mac_randomization", "true");
-        DEFAULT_FLAGS.put("settings_mainline_module", "true");
+        DEFAULT_FLAGS.put("settings_mainline_module", "false");
         DEFAULT_FLAGS.put("settings_dynamic_android", "false");
         DEFAULT_FLAGS.put(SEAMLESS_TRANSFER, "false");
         DEFAULT_FLAGS.put(HEARING_AID_SETTINGS, "false");
         DEFAULT_FLAGS.put(SAFETY_HUB, "false");
         DEFAULT_FLAGS.put(SCREENRECORD_LONG_PRESS, "false");
-        DEFAULT_FLAGS.put(GLOBAL_ACTIONS_GRID_ENABLED, "false");
+        DEFAULT_FLAGS.put(GLOBAL_ACTIONS_GRID_ENABLED, "true");
+        DEFAULT_FLAGS.put(GLOBAL_ACTIONS_PANEL_ENABLED, "true");
     }
 
     /**
diff --git a/core/java/android/util/LocalLog.java b/core/java/android/util/LocalLog.java
index adfa4fc..8b5659b 100644
--- a/core/java/android/util/LocalLog.java
+++ b/core/java/android/util/LocalLog.java
@@ -17,6 +17,7 @@
 package android.util;
 
 import android.annotation.UnsupportedAppUsage;
+
 import java.io.FileDescriptor;
 import java.io.PrintWriter;
 import java.time.LocalDateTime;
@@ -55,6 +56,10 @@
 
     @UnsupportedAppUsage
     public synchronized void dump(FileDescriptor fd, PrintWriter pw, String[] args) {
+        dump(pw);
+    }
+
+    public synchronized void dump(PrintWriter pw) {
         Iterator<String> itr = mLog.iterator();
         while (itr.hasNext()) {
             pw.println(itr.next());
@@ -62,6 +67,10 @@
     }
 
     public synchronized void reverseDump(FileDescriptor fd, PrintWriter pw, String[] args) {
+        reverseDump(pw);
+    }
+
+    public synchronized void reverseDump(PrintWriter pw) {
         Iterator<String> itr = mLog.descendingIterator();
         while (itr.hasNext()) {
             pw.println(itr.next());
@@ -75,10 +84,16 @@
         }
         @UnsupportedAppUsage
         public void dump(FileDescriptor fd, PrintWriter pw, String[] args) {
-            mLog.dump(fd, pw, args);
+            mLog.dump(pw);
+        }
+        public void dump(PrintWriter pw) {
+            mLog.dump(pw);
         }
         public void reverseDump(FileDescriptor fd, PrintWriter pw, String[] args) {
-            mLog.reverseDump(fd, pw, args);
+            mLog.reverseDump(pw);
+        }
+        public void reverseDump(PrintWriter pw) {
+            mLog.reverseDump(pw);
         }
     }
 
diff --git a/core/java/android/util/LongSparseArray.java b/core/java/android/util/LongSparseArray.java
index 9ba0f5d..e4de704 100644
--- a/core/java/android/util/LongSparseArray.java
+++ b/core/java/android/util/LongSparseArray.java
@@ -144,6 +144,10 @@
      * Removes the mapping at the specified index.
      */
     public void removeAt(int index) {
+        if (index >= mSize) {
+            // The array might be slightly bigger than mSize, in which case, indexing won't fail.
+            throw new ArrayIndexOutOfBoundsException(index);
+        }
         if (mValues[index] != DELETED) {
             mValues[index] = DELETED;
             mGarbage = true;
@@ -233,6 +237,10 @@
      * key.</p>
      */
     public long keyAt(int index) {
+        if (index >= mSize) {
+            // The array might be slightly bigger than mSize, in which case, indexing won't fail.
+            throw new ArrayIndexOutOfBoundsException(index);
+        }
         if (mGarbage) {
             gc();
         }
@@ -253,6 +261,10 @@
      */
     @SuppressWarnings("unchecked")
     public E valueAt(int index) {
+        if (index >= mSize) {
+            // The array might be slightly bigger than mSize, in which case, indexing won't fail.
+            throw new ArrayIndexOutOfBoundsException(index);
+        }
         if (mGarbage) {
             gc();
         }
@@ -266,6 +278,10 @@
      * LongSparseArray stores.
      */
     public void setValueAt(int index, E value) {
+        if (index >= mSize) {
+            // The array might be slightly bigger than mSize, in which case, indexing won't fail.
+            throw new ArrayIndexOutOfBoundsException(index);
+        }
         if (mGarbage) {
             gc();
         }
diff --git a/core/java/android/util/LongSparseLongArray.java b/core/java/android/util/LongSparseLongArray.java
index af163ac..f167f00 100644
--- a/core/java/android/util/LongSparseLongArray.java
+++ b/core/java/android/util/LongSparseLongArray.java
@@ -16,10 +16,11 @@
 
 package android.util;
 
+import android.annotation.UnsupportedAppUsage;
+
 import com.android.internal.util.ArrayUtils;
 import com.android.internal.util.GrowingArrayUtils;
 
-import android.annotation.UnsupportedAppUsage;
 import libcore.util.EmptyArray;
 
 /**
@@ -171,6 +172,10 @@
      * key.</p>
      */
     public long keyAt(int index) {
+        if (index >= mSize) {
+            // The array might be slightly bigger than mSize, in which case, indexing won't fail.
+            throw new ArrayIndexOutOfBoundsException(index);
+        }
         return mKeys[index];
     }
 
@@ -186,6 +191,10 @@
      * associated with the largest key.</p>
      */
     public long valueAt(int index) {
+        if (index >= mSize) {
+            // The array might be slightly bigger than mSize, in which case, indexing won't fail.
+            throw new ArrayIndexOutOfBoundsException(index);
+        }
         return mValues[index];
     }
 
diff --git a/core/java/android/util/MemoryIntArray.java b/core/java/android/util/MemoryIntArray.java
index d5bec0f..74fea3f 100644
--- a/core/java/android/util/MemoryIntArray.java
+++ b/core/java/android/util/MemoryIntArray.java
@@ -235,7 +235,7 @@
         return MAX_SIZE;
     }
 
-    public static final Parcelable.Creator<MemoryIntArray> CREATOR =
+    public static final @android.annotation.NonNull Parcelable.Creator<MemoryIntArray> CREATOR =
             new Parcelable.Creator<MemoryIntArray>() {
         @Override
         public MemoryIntArray createFromParcel(Parcel parcel) {
diff --git a/core/java/android/util/MergedConfiguration.java b/core/java/android/util/MergedConfiguration.java
index ae66050..2399ada 100644
--- a/core/java/android/util/MergedConfiguration.java
+++ b/core/java/android/util/MergedConfiguration.java
@@ -74,7 +74,7 @@
         return 0;
     }
 
-    public static final Creator<MergedConfiguration> CREATOR = new Creator<MergedConfiguration>() {
+    public static final @android.annotation.NonNull Creator<MergedConfiguration> CREATOR = new Creator<MergedConfiguration>() {
         @Override
         public MergedConfiguration createFromParcel(Parcel in) {
             return new MergedConfiguration(in);
diff --git a/core/java/android/util/RecurrenceRule.java b/core/java/android/util/RecurrenceRule.java
index 209a5912..9c60228 100644
--- a/core/java/android/util/RecurrenceRule.java
+++ b/core/java/android/util/RecurrenceRule.java
@@ -140,7 +140,7 @@
         return false;
     }
 
-    public static final Parcelable.Creator<RecurrenceRule> CREATOR = new Parcelable.Creator<RecurrenceRule>() {
+    public static final @android.annotation.NonNull Parcelable.Creator<RecurrenceRule> CREATOR = new Parcelable.Creator<RecurrenceRule>() {
         @Override
         public RecurrenceRule createFromParcel(Parcel source) {
             return new RecurrenceRule(source);
diff --git a/core/java/android/util/SparseArray.java b/core/java/android/util/SparseArray.java
index 89ea2d3..67dfb02 100644
--- a/core/java/android/util/SparseArray.java
+++ b/core/java/android/util/SparseArray.java
@@ -16,10 +16,11 @@
 
 package android.util;
 
+import android.annotation.UnsupportedAppUsage;
+
 import com.android.internal.util.ArrayUtils;
 import com.android.internal.util.GrowingArrayUtils;
 
-import android.annotation.UnsupportedAppUsage;
 import libcore.util.EmptyArray;
 
 /**
@@ -171,6 +172,10 @@
      * the behavior is undefined.</p>
      */
     public void removeAt(int index) {
+        if (index >= mSize) {
+            // The array might be slightly bigger than mSize, in which case, indexing won't fail.
+            throw new ArrayIndexOutOfBoundsException(index);
+        }
         if (mValues[index] != DELETED) {
             mValues[index] = DELETED;
             mGarbage = true;
@@ -279,6 +284,10 @@
      * the behavior is undefined.</p>
      */
     public int keyAt(int index) {
+        if (index >= mSize) {
+            // The array might be slightly bigger than mSize, in which case, indexing won't fail.
+            throw new ArrayIndexOutOfBoundsException(index);
+        }
         if (mGarbage) {
             gc();
         }
@@ -302,6 +311,10 @@
      */
     @SuppressWarnings("unchecked")
     public E valueAt(int index) {
+        if (index >= mSize) {
+            // The array might be slightly bigger than mSize, in which case, indexing won't fail.
+            throw new ArrayIndexOutOfBoundsException(index);
+        }
         if (mGarbage) {
             gc();
         }
@@ -317,6 +330,10 @@
      * <p>For indices outside of the range <code>0...size()-1</code>, the behavior is undefined.</p>
      */
     public void setValueAt(int index, E value) {
+        if (index >= mSize) {
+            // The array might be slightly bigger than mSize, in which case, indexing won't fail.
+            throw new ArrayIndexOutOfBoundsException(index);
+        }
         if (mGarbage) {
             gc();
         }
diff --git a/core/java/android/util/SparseBooleanArray.java b/core/java/android/util/SparseBooleanArray.java
index d4c4095..03fa1c9 100644
--- a/core/java/android/util/SparseBooleanArray.java
+++ b/core/java/android/util/SparseBooleanArray.java
@@ -16,10 +16,11 @@
 
 package android.util;
 
+import android.annotation.UnsupportedAppUsage;
+
 import com.android.internal.util.ArrayUtils;
 import com.android.internal.util.GrowingArrayUtils;
 
-import android.annotation.UnsupportedAppUsage;
 import libcore.util.EmptyArray;
 
 /**
@@ -167,6 +168,10 @@
      * key.</p>
      */
     public int keyAt(int index) {
+        if (index >= mSize) {
+            // The array might be slightly bigger than mSize, in which case, indexing won't fail.
+            throw new ArrayIndexOutOfBoundsException(index);
+        }
         return mKeys[index];
     }
 
@@ -182,6 +187,10 @@
      * associated with the largest key.</p>
      */
     public boolean valueAt(int index) {
+        if (index >= mSize) {
+            // The array might be slightly bigger than mSize, in which case, indexing won't fail.
+            throw new ArrayIndexOutOfBoundsException(index);
+        }
         return mValues[index];
     }
 
@@ -189,11 +198,19 @@
      * Directly set the value at a particular index.
      */
     public void setValueAt(int index, boolean value) {
+        if (index >= mSize) {
+            // The array might be slightly bigger than mSize, in which case, indexing won't fail.
+            throw new ArrayIndexOutOfBoundsException(index);
+        }
         mValues[index] = value;
     }
 
     /** @hide */
     public void setKeyAt(int index, int key) {
+        if (index >= mSize) {
+            // The array might be slightly bigger than mSize, in which case, indexing won't fail.
+            throw new ArrayIndexOutOfBoundsException(index);
+        }
         mKeys[index] = key;
     }
 
diff --git a/core/java/android/util/SparseIntArray.java b/core/java/android/util/SparseIntArray.java
index 9e6bad1..c68dc4e 100644
--- a/core/java/android/util/SparseIntArray.java
+++ b/core/java/android/util/SparseIntArray.java
@@ -16,14 +16,15 @@
 
 package android.util;
 
+import android.annotation.UnsupportedAppUsage;
+
 import com.android.internal.util.ArrayUtils;
 import com.android.internal.util.GrowingArrayUtils;
 
-import java.util.Arrays;
-
-import android.annotation.UnsupportedAppUsage;
 import libcore.util.EmptyArray;
 
+import java.util.Arrays;
+
 /**
  * SparseIntArrays map integers to integers.  Unlike a normal array of integers,
  * there can be gaps in the indices.  It is intended to be more memory efficient
@@ -171,6 +172,10 @@
      * key.</p>
      */
     public int keyAt(int index) {
+        if (index >= mSize) {
+            // The array might be slightly bigger than mSize, in which case, indexing won't fail.
+            throw new ArrayIndexOutOfBoundsException(index);
+        }
         return mKeys[index];
     }
 
@@ -186,6 +191,10 @@
      * associated with the largest key.</p>
      */
     public int valueAt(int index) {
+        if (index >= mSize) {
+            // The array might be slightly bigger than mSize, in which case, indexing won't fail.
+            throw new ArrayIndexOutOfBoundsException(index);
+        }
         return mValues[index];
     }
 
@@ -193,6 +202,10 @@
      * Directly set the value at a particular index.
      */
     public void setValueAt(int index, int value) {
+        if (index >= mSize) {
+            // The array might be slightly bigger than mSize, in which case, indexing won't fail.
+            throw new ArrayIndexOutOfBoundsException(index);
+        }
         mValues[index] = value;
     }
 
diff --git a/core/java/android/util/SparseLongArray.java b/core/java/android/util/SparseLongArray.java
index 81db2b7..37a9202 100644
--- a/core/java/android/util/SparseLongArray.java
+++ b/core/java/android/util/SparseLongArray.java
@@ -182,6 +182,10 @@
      * key.</p>
      */
     public int keyAt(int index) {
+        if (index >= mSize) {
+            // The array might be slightly bigger than mSize, in which case, indexing won't fail.
+            throw new ArrayIndexOutOfBoundsException(index);
+        }
         return mKeys[index];
     }
 
@@ -197,6 +201,10 @@
      * associated with the largest key.</p>
      */
     public long valueAt(int index) {
+        if (index >= mSize) {
+            // The array might be slightly bigger than mSize, in which case, indexing won't fail.
+            throw new ArrayIndexOutOfBoundsException(index);
+        }
         return mValues[index];
     }
 
diff --git a/core/java/android/util/StatsLog.java b/core/java/android/util/StatsLog.java
index 29ced3e..bf46e95 100644
--- a/core/java/android/util/StatsLog.java
+++ b/core/java/android/util/StatsLog.java
@@ -190,6 +190,12 @@
             case PERMISSION_GRANT_REQUEST_RESULT_REPORTED:
                 write(id, (long) params[0], (int) params[1], (String) params[2], (String) params[3],
                         (boolean) params[4], (int) params[5]);
+                break;
+            case DATA_STALL_EVENT:
+                // Refer to the defintion in frameworks/base/cmds/statsd/src/atoms.proto.
+                write(id, (int) params[0], (int) params[1], (int) params[2], (byte[]) params[3],
+                        (byte[]) params[4], (byte[]) params[5]);
+                break;
         }
     }
 
diff --git a/core/java/android/util/apk/ApkSignatureVerifier.java b/core/java/android/util/apk/ApkSignatureVerifier.java
index ab67d37..71c8e98 100644
--- a/core/java/android/util/apk/ApkSignatureVerifier.java
+++ b/core/java/android/util/apk/ApkSignatureVerifier.java
@@ -393,15 +393,18 @@
     /**
      * @return the verity root hash in the Signing Block.
      */
-    public static byte[] getVerityRootHash(String apkPath)
-            throws IOException, SignatureNotFoundException, SecurityException {
+    public static byte[] getVerityRootHash(String apkPath) throws IOException, SecurityException {
         // first try v3
         try {
             return ApkSignatureSchemeV3Verifier.getVerityRootHash(apkPath);
         } catch (SignatureNotFoundException e) {
             // try older version
         }
-        return ApkSignatureSchemeV2Verifier.getVerityRootHash(apkPath);
+        try {
+            return ApkSignatureSchemeV2Verifier.getVerityRootHash(apkPath);
+        } catch (SignatureNotFoundException e) {
+            return null;
+        }
     }
 
     /**
diff --git a/core/java/android/view/AbsSavedState.java b/core/java/android/view/AbsSavedState.java
index 6b616c0..009898e 100644
--- a/core/java/android/view/AbsSavedState.java
+++ b/core/java/android/view/AbsSavedState.java
@@ -80,7 +80,7 @@
         dest.writeParcelable(mSuperState, flags);
     }
 
-    public static final Parcelable.Creator<AbsSavedState> CREATOR
+    public static final @android.annotation.NonNull Parcelable.Creator<AbsSavedState> CREATOR
             = new Parcelable.ClassLoaderCreator<AbsSavedState>() {
 
         @Override
diff --git a/core/java/android/view/AppTransitionAnimationSpec.java b/core/java/android/view/AppTransitionAnimationSpec.java
index 6585e40..4c0ed52 100644
--- a/core/java/android/view/AppTransitionAnimationSpec.java
+++ b/core/java/android/view/AppTransitionAnimationSpec.java
@@ -44,7 +44,7 @@
         dest.writeParcelable(buffer, 0);
     }
 
-    public static final Parcelable.Creator<AppTransitionAnimationSpec> CREATOR
+    public static final @android.annotation.NonNull Parcelable.Creator<AppTransitionAnimationSpec> CREATOR
             = new Parcelable.Creator<AppTransitionAnimationSpec>() {
         public AppTransitionAnimationSpec createFromParcel(Parcel in) {
             return new AppTransitionAnimationSpec(in);
diff --git a/core/java/android/view/Display.java b/core/java/android/view/Display.java
index 94a9a1c..b3d98b8 100644
--- a/core/java/android/view/Display.java
+++ b/core/java/android/view/Display.java
@@ -231,7 +231,6 @@
      * bar, navigation bar, home activity or IME.
      * </p>
      *
-     * @see #supportsSystemDecorations
      * @hide
      */
     // TODO (b/114338689): Remove the flag and use IWindowManager#setShouldShowSystemDecors
@@ -907,18 +906,6 @@
     }
 
     /**
-     * Returns whether this display should support showing system decorations.
-     *
-     * @see #FLAG_SHOULD_SHOW_SYSTEM_DECORATIONS
-     * @hide
-     */
-    @TestApi
-    // TODO (b/114338689): Remove the method and use IWindowManager#shouldShowSystemDecors
-    public boolean supportsSystemDecorations() {
-        return (mDisplayInfo.flags & FLAG_SHOULD_SHOW_SYSTEM_DECORATIONS) != 0;
-    }
-
-    /**
      * Returns the display's HDR capabilities.
      *
      * @see #isHdr()
@@ -1110,16 +1097,19 @@
      * Returns true if the specified UID has access to this display.
      * @hide
      */
+    @TestApi
     public boolean hasAccess(int uid) {
-        return Display.hasAccess(uid, mFlags, mOwnerUid);
+        return hasAccess(uid, mFlags, mOwnerUid, mDisplayId);
     }
 
     /** @hide */
-    public static boolean hasAccess(int uid, int flags, int ownerUid) {
+    public static boolean hasAccess(int uid, int flags, int ownerUid, int displayId) {
         return (flags & Display.FLAG_PRIVATE) == 0
                 || uid == ownerUid
                 || uid == Process.SYSTEM_UID
-                || uid == 0;
+                || uid == 0
+                // Check if the UID is present on given display.
+                || DisplayManagerGlobal.getInstance().isUidPresentOnDisplay(uid, displayId);
     }
 
     /**
@@ -1375,7 +1365,7 @@
         }
 
         @SuppressWarnings("hiding")
-        public static final Parcelable.Creator<Mode> CREATOR
+        public static final @android.annotation.NonNull Parcelable.Creator<Mode> CREATOR
                 = new Parcelable.Creator<Mode>() {
             @Override
             public Mode createFromParcel(Parcel in) {
@@ -1504,7 +1494,7 @@
             return hash;
         }
 
-        public static final Creator<HdrCapabilities> CREATOR = new Creator<HdrCapabilities>() {
+        public static final @android.annotation.NonNull Creator<HdrCapabilities> CREATOR = new Creator<HdrCapabilities>() {
             @Override
             public HdrCapabilities createFromParcel(Parcel source) {
                 return new HdrCapabilities(source);
diff --git a/core/java/android/view/DisplayAddress.java b/core/java/android/view/DisplayAddress.java
index 17ea4c4..1360815 100644
--- a/core/java/android/view/DisplayAddress.java
+++ b/core/java/android/view/DisplayAddress.java
@@ -109,7 +109,7 @@
             mPhysicalDisplayId = physicalDisplayId;
         }
 
-        public static final Parcelable.Creator<Physical> CREATOR =
+        public static final @android.annotation.NonNull Parcelable.Creator<Physical> CREATOR =
                 new Parcelable.Creator<Physical>() {
                     @Override
                     public Physical createFromParcel(Parcel in) {
@@ -153,7 +153,7 @@
             mMacAddress = macAddress;
         }
 
-        public static final Parcelable.Creator<Network> CREATOR =
+        public static final @android.annotation.NonNull Parcelable.Creator<Network> CREATOR =
                 new Parcelable.Creator<Network>() {
                     @Override
                     public Network createFromParcel(Parcel in) {
diff --git a/core/java/android/view/DisplayCutout.java b/core/java/android/view/DisplayCutout.java
index e9f1edf..610f7ed 100644
--- a/core/java/android/view/DisplayCutout.java
+++ b/core/java/android/view/DisplayCutout.java
@@ -233,6 +233,9 @@
     /**
      * Creates a DisplayCutout instance.
      *
+     * <p>Note that this is only useful for tests. For production code, developers should always
+     * use a {@link DisplayCutout} obtained from the system.</p>
+     *
      * @param safeInsets the insets from each edge which avoid the display cutout as returned by
      *                   {@link #getSafeInsetTop()} etc.
      * @param boundLeft the left bounding rect of the display cutout in pixels. If null is passed,
@@ -253,6 +256,9 @@
     /**
      * Creates a DisplayCutout instance.
      *
+     * <p>Note that this is only useful for tests. For production code, developers should always
+     * use a {@link DisplayCutout} obtained from the system.</p>
+     *
      * @param safeInsets the insets from each edge which avoid the display cutout as returned by
      *                   {@link #getSafeInsetTop()} etc.
      * @param boundingRects the bounding rects of the display cutouts as returned by
@@ -765,7 +771,7 @@
             mInner = readCutoutFromParcel(in);
         }
 
-        public static final Creator<ParcelableWrapper> CREATOR = new Creator<ParcelableWrapper>() {
+        public static final @android.annotation.NonNull Creator<ParcelableWrapper> CREATOR = new Creator<ParcelableWrapper>() {
             @Override
             public ParcelableWrapper createFromParcel(Parcel in) {
                 return new ParcelableWrapper(readCutoutFromParcel(in));
diff --git a/core/java/android/view/DisplayInfo.java b/core/java/android/view/DisplayInfo.java
index 3aa779b..2efebf6 100644
--- a/core/java/android/view/DisplayInfo.java
+++ b/core/java/android/view/DisplayInfo.java
@@ -58,6 +58,11 @@
     public int type;
 
     /**
+     * Logical display identifier.
+     */
+    public int displayId;
+
+    /**
      * Display address, or null if none.
      * Interpretation varies by display type.
      */
@@ -271,7 +276,7 @@
     // TODO (b/114338689): Remove the flag and use IWindowManager#getRemoveContentMode
     public int removeMode = Display.REMOVE_MODE_MOVE_CONTENT_TO_PRIMARY;
 
-    public static final Creator<DisplayInfo> CREATOR = new Creator<DisplayInfo>() {
+    public static final @android.annotation.NonNull Creator<DisplayInfo> CREATOR = new Creator<DisplayInfo>() {
         @Override
         public DisplayInfo createFromParcel(Parcel source) {
             return new DisplayInfo(source);
@@ -305,6 +310,7 @@
                 && layerStack == other.layerStack
                 && flags == other.flags
                 && type == other.type
+                && displayId == other.displayId
                 && Objects.equals(address, other.address)
                 && Objects.equals(uniqueId, other.uniqueId)
                 && appWidth == other.appWidth
@@ -346,6 +352,7 @@
         layerStack = other.layerStack;
         flags = other.flags;
         type = other.type;
+        displayId = other.displayId;
         address = other.address;
         name = other.name;
         uniqueId = other.uniqueId;
@@ -385,6 +392,7 @@
         layerStack = source.readInt();
         flags = source.readInt();
         type = source.readInt();
+        displayId = source.readInt();
         address = source.readParcelable(null);
         name = source.readString();
         appWidth = source.readInt();
@@ -432,6 +440,7 @@
         dest.writeInt(layerStack);
         dest.writeInt(this.flags);
         dest.writeInt(type);
+        dest.writeInt(displayId);
         dest.writeParcelable(address, flags);
         dest.writeString(name);
         dest.writeInt(appWidth);
@@ -579,7 +588,7 @@
      * Returns true if the specified UID has access to this display.
      */
     public boolean hasAccess(int uid) {
-        return Display.hasAccess(uid, flags, ownerUid);
+        return Display.hasAccess(uid, flags, ownerUid, displayId);
     }
 
     private void getMetricsWithSize(DisplayMetrics outMetrics, CompatibilityInfo compatInfo,
@@ -610,6 +619,8 @@
         StringBuilder sb = new StringBuilder();
         sb.append("DisplayInfo{\"");
         sb.append(name);
+        sb.append(", displayId ");
+        sb.append(displayId);
         sb.append("\", uniqueId \"");
         sb.append(uniqueId);
         sb.append("\", app ");
diff --git a/core/java/android/view/DragAndDropPermissions.java b/core/java/android/view/DragAndDropPermissions.java
index c198e1f..e72ff38 100644
--- a/core/java/android/view/DragAndDropPermissions.java
+++ b/core/java/android/view/DragAndDropPermissions.java
@@ -117,7 +117,7 @@
         }
     }
 
-    public static final Parcelable.Creator<DragAndDropPermissions> CREATOR =
+    public static final @android.annotation.NonNull Parcelable.Creator<DragAndDropPermissions> CREATOR =
             new Parcelable.Creator<DragAndDropPermissions> () {
         @Override
         public DragAndDropPermissions createFromParcel(Parcel source) {
diff --git a/core/java/android/view/DragEvent.java b/core/java/android/view/DragEvent.java
index bd4dda2..2a43bcc 100644
--- a/core/java/android/view/DragEvent.java
+++ b/core/java/android/view/DragEvent.java
@@ -528,7 +528,7 @@
     /**
      * A container for creating a DragEvent from a Parcel.
      */
-    public static final Parcelable.Creator<DragEvent> CREATOR =
+    public static final @android.annotation.NonNull Parcelable.Creator<DragEvent> CREATOR =
         new Parcelable.Creator<DragEvent>() {
         public DragEvent createFromParcel(Parcel in) {
             DragEvent event = DragEvent.obtain();
diff --git a/core/java/android/view/GestureExclusionTracker.java b/core/java/android/view/GestureExclusionTracker.java
new file mode 100644
index 0000000..8eccc04
--- /dev/null
+++ b/core/java/android/view/GestureExclusionTracker.java
@@ -0,0 +1,125 @@
+/*
+ * Copyright (C) 2019 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package android.view;
+
+import android.annotation.NonNull;
+import android.annotation.Nullable;
+import android.graphics.Rect;
+
+import java.lang.ref.WeakReference;
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.Iterator;
+import java.util.List;
+
+/**
+ * Used by {@link ViewRootImpl} to track system gesture exclusion rects reported by views.
+ */
+class GestureExclusionTracker {
+    private boolean mGestureExclusionViewsChanged = false;
+    private List<GestureExclusionViewInfo> mGestureExclusionViewInfos = new ArrayList<>();
+    private List<Rect> mGestureExclusionRects = Collections.emptyList();
+
+    public void updateRectsForView(@NonNull View view) {
+        boolean found = false;
+        final Iterator<GestureExclusionViewInfo> i = mGestureExclusionViewInfos.iterator();
+        while (i.hasNext()) {
+            final GestureExclusionViewInfo info = i.next();
+            final View v = info.getView();
+            if (v == null || !v.isAttachedToWindow()) {
+                mGestureExclusionViewsChanged = true;
+                i.remove();
+                continue;
+            }
+            if (v == view) {
+                found = true;
+                info.mDirty = true;
+                break;
+            }
+        }
+        if (!found && view.isAttachedToWindow()) {
+            mGestureExclusionViewInfos.add(new GestureExclusionViewInfo(view));
+            mGestureExclusionViewsChanged = true;
+        }
+    }
+
+    @Nullable
+    public List<Rect> computeChangedRects() {
+        boolean changed = false;
+        final Iterator<GestureExclusionViewInfo> i = mGestureExclusionViewInfos.iterator();
+        final List<Rect> rects = new ArrayList<>();
+        while (i.hasNext()) {
+            final GestureExclusionViewInfo info = i.next();
+            switch (info.update()) {
+                case GestureExclusionViewInfo.CHANGED:
+                    changed = true;
+                    // Deliberate fall-through
+                case GestureExclusionViewInfo.UNCHANGED:
+                    rects.addAll(info.mExclusionRects);
+                    break;
+                case GestureExclusionViewInfo.GONE:
+                    mGestureExclusionViewsChanged = true;
+                    i.remove();
+                    break;
+            }
+        }
+        if (changed || mGestureExclusionViewsChanged) {
+            mGestureExclusionViewsChanged = false;
+            if (!mGestureExclusionRects.equals(rects)) {
+                mGestureExclusionRects = rects;
+                return rects;
+            }
+        }
+        return null;
+    }
+
+    private static class GestureExclusionViewInfo {
+        public static final int CHANGED = 0;
+        public static final int UNCHANGED = 1;
+        public static final int GONE = 2;
+
+        private final WeakReference<View> mView;
+        boolean mDirty = true;
+        List<Rect> mExclusionRects = Collections.emptyList();
+
+        GestureExclusionViewInfo(View view) {
+            mView = new WeakReference<>(view);
+        }
+
+        public View getView() {
+            return mView.get();
+        }
+
+        public int update() {
+            final View excludedView = getView();
+            if (excludedView == null || !excludedView.isAttachedToWindow()) return GONE;
+            final List<Rect> localRects = excludedView.getSystemGestureExclusionRects();
+            final List<Rect> newRects = new ArrayList<>(localRects.size());
+            for (Rect src : localRects) {
+                Rect mappedRect = new Rect(src);
+                ViewParent p = excludedView.getParent();
+                if (p != null && p.getChildVisibleRect(excludedView, mappedRect, null)) {
+                    newRects.add(mappedRect);
+                }
+            }
+
+            if (mExclusionRects.equals(localRects)) return UNCHANGED;
+            mExclusionRects = newRects;
+            return CHANGED;
+        }
+    }
+}
diff --git a/core/java/android/view/IRecentsAnimationController.aidl b/core/java/android/view/IRecentsAnimationController.aidl
index 94b9bc0..b1f934a 100644
--- a/core/java/android/view/IRecentsAnimationController.aidl
+++ b/core/java/android/view/IRecentsAnimationController.aidl
@@ -33,6 +33,7 @@
      * Takes a screenshot of the task associated with the given {@param taskId}. Only valid for the
      * current set of task ids provided to the handler.
      */
+    @UnsupportedAppUsage
     ActivityManager.TaskSnapshot screenshotTask(int taskId);
 
     /**
@@ -41,6 +42,7 @@
      * the home activity should be moved to the top. Otherwise, the home activity is hidden and the
      * user is returned to the app.
      */
+    @UnsupportedAppUsage
     void finish(boolean moveHomeToTop);
 
     /**
@@ -50,6 +52,7 @@
      * may register the recents animation input consumer prior to starting the recents animation
      * and then enable it mid-animation to start receiving touch events.
      */
+    @UnsupportedAppUsage
     void setInputConsumerEnabled(boolean enabled);
 
     /**
@@ -58,6 +61,7 @@
     * they can control the SystemUI flags, otherwise the SystemUI flags from home activity will be
     * taken.
     */
+    @UnsupportedAppUsage
     void setAnimationTargetsBehindSystemBars(boolean behindSystemBars);
 
     /**
diff --git a/core/java/android/view/IRecentsAnimationRunner.aidl b/core/java/android/view/IRecentsAnimationRunner.aidl
index 4cdf664..6e382f4 100644
--- a/core/java/android/view/IRecentsAnimationRunner.aidl
+++ b/core/java/android/view/IRecentsAnimationRunner.aidl
@@ -33,6 +33,7 @@
      * wallpaper not drawing in time, or the handler not finishing the animation within a predefined
      * amount of time.
      */
+    @UnsupportedAppUsage
     void onAnimationCanceled() = 1;
 
     /**
@@ -42,6 +43,7 @@
      * @param minimizedHomeBounds Specifies the bounds of the minimized home app, will be
      *                            {@code null} if the device is not currently in split screen
      */
+    @UnsupportedAppUsage
     void onAnimationStart(in IRecentsAnimationController controller,
             in RemoteAnimationTarget[] apps, in Rect homeContentInsets,
             in Rect minimizedHomeBounds) = 2;
diff --git a/core/java/android/view/IRemoteAnimationFinishedCallback.aidl b/core/java/android/view/IRemoteAnimationFinishedCallback.aidl
index ae58b22..a99162b 100644
--- a/core/java/android/view/IRemoteAnimationFinishedCallback.aidl
+++ b/core/java/android/view/IRemoteAnimationFinishedCallback.aidl
@@ -23,5 +23,6 @@
  * {@hide}
  */
 interface IRemoteAnimationFinishedCallback {
+    @UnsupportedAppUsage
     void onAnimationFinished();
 }
diff --git a/core/java/android/view/IRemoteAnimationRunner.aidl b/core/java/android/view/IRemoteAnimationRunner.aidl
index 1350ebf..73b023c 100644
--- a/core/java/android/view/IRemoteAnimationRunner.aidl
+++ b/core/java/android/view/IRemoteAnimationRunner.aidl
@@ -33,6 +33,7 @@
      * @param apps The list of apps to animate.
      * @param finishedCallback The callback to invoke when the animation is finished.
      */
+    @UnsupportedAppUsage
     void onAnimationStart(in RemoteAnimationTarget[] apps,
             in IRemoteAnimationFinishedCallback finishedCallback);
 
@@ -40,5 +41,6 @@
      * Called when the animation was cancelled. From this point on, any updates onto the leashes
      * won't have any effect anymore.
      */
+    @UnsupportedAppUsage
     void onAnimationCancelled();
 }
diff --git a/core/java/android/view/IWindowManager.aidl b/core/java/android/view/IWindowManager.aidl
index 5dc54a5..e32c4e1 100644
--- a/core/java/android/view/IWindowManager.aidl
+++ b/core/java/android/view/IWindowManager.aidl
@@ -74,10 +74,13 @@
 
     IWindowSession openSession(in IWindowSessionCallback callback);
 
+    @UnsupportedAppUsage
     void getInitialDisplaySize(int displayId, out Point size);
+    @UnsupportedAppUsage
     void getBaseDisplaySize(int displayId, out Point size);
     void setForcedDisplaySize(int displayId, int width, int height);
     void clearForcedDisplaySize(int displayId);
+    @UnsupportedAppUsage
     int getInitialDisplayDensity(int displayId);
     int getBaseDisplayDensity(int displayId);
     void setForcedDisplayDensityForUser(int displayId, int density, int userId);
@@ -97,17 +100,21 @@
      * used for recents, where generating the thumbnails of the specs takes a non-trivial amount of
      * time, so we want to move that off the critical path for starting the new activity.
      */
+    @UnsupportedAppUsage
     void overridePendingAppTransitionMultiThumbFuture(
             IAppTransitionAnimationSpecsFuture specsFuture, IRemoteCallback startedCallback,
             boolean scaleUp, int displayId);
+    @UnsupportedAppUsage
     void overridePendingAppTransitionRemote(in RemoteAnimationAdapter remoteAnimationAdapter,
             int displayId);
+    @UnsupportedAppUsage
     void executeAppTransition();
 
     /**
       * Used by system ui to report that recents has shown itself.
       * @deprecated to be removed once prebuilts are updated
       */
+    @UnsupportedAppUsage
     void endProlongedAnimations();
 
     void startFreezingScreen(int exitAnim, int enterAnim);
@@ -119,7 +126,9 @@
     /** @deprecated use Activity.setShowWhenLocked instead. */
     void reenableKeyguard(IBinder token, int userId);
     void exitKeyguardSecurely(IOnKeyguardExitResult callback);
+    @UnsupportedAppUsage
     boolean isKeyguardLocked();
+    @UnsupportedAppUsage
     boolean isKeyguardSecure();
     void dismissKeyguard(IKeyguardDismissCallback callback, CharSequence message);
 
@@ -129,9 +138,13 @@
     void closeSystemDialogs(String reason);
 
     // These can only be called with the SET_ANIMATON_SCALE permission.
+    @UnsupportedAppUsage
     float getAnimationScale(int which);
+    @UnsupportedAppUsage
     float[] getAnimationScales();
+    @UnsupportedAppUsage
     void setAnimationScale(int which, float scale);
+    @UnsupportedAppUsage
     void setAnimationScales(in float[] scales);
 
     float getCurrentAnimatorScale();
@@ -150,6 +163,7 @@
     // should be enabled.  The 'enabled' value is null or blank for
     // the system default (differs per build variant) or any valid
     // boolean string as parsed by SystemProperties.getBoolean().
+    @UnsupportedAppUsage
     void setStrictModeVisualIndicatorPreference(String enabled);
 
     /**
@@ -188,6 +202,7 @@
      * Remove a rotation watcher set using watchRotation.
      * @hide
      */
+    @UnsupportedAppUsage
     void removeRotationWatcher(IRotationWatcher watcher);
 
     /**
@@ -203,12 +218,14 @@
      * Equivalent to calling {@link #freezeDisplayRotation(int, int)} with {@link
      * android.view.Display#DEFAULT_DISPLAY} and given rotation.
      */
+    @UnsupportedAppUsage
     void freezeRotation(int rotation);
 
     /**
      * Equivalent to calling {@link #thawDisplayRotation(int)} with {@link
      * android.view.Display#DEFAULT_DISPLAY}.
      */
+    @UnsupportedAppUsage
     void thawRotation();
 
     /**
@@ -286,11 +303,13 @@
     /**
      * Called by System UI to notify of changes to the visibility and height of the shelf.
      */
+    @UnsupportedAppUsage
     void setShelfHeight(boolean visible, int shelfHeight);
 
     /**
      * Called by System UI to enable or disable haptic feedback on the navigation bar buttons.
      */
+    @UnsupportedAppUsage
     void setNavBarVirtualKeyHapticFeedbackEnabled(boolean enabled);
 
     /**
@@ -298,6 +317,7 @@
      *
      * @param displayId the id of display to check if there is a software navigation bar.
      */
+    @UnsupportedAppUsage
     boolean hasNavigationBar(int displayId);
 
     /**
@@ -308,11 +328,13 @@
     /**
      * Lock the device immediately with the specified options (can be null).
      */
+    @UnsupportedAppUsage
     void lockNow(in Bundle options);
 
     /**
      * Device is in safe mode.
      */
+    @UnsupportedAppUsage
     boolean isSafeModeEnabled();
 
     /**
@@ -340,6 +362,7 @@
      * @return the dock side the current docked stack is at; must be one of the
      *         WindowManagerGlobal.DOCKED_* values
      */
+    @UnsupportedAppUsage
     int getDockedStackSide();
 
     /**
@@ -352,6 +375,7 @@
      * Registers a listener that will be called when the dock divider changes its visibility or when
      * the docked stack gets added/removed.
      */
+    @UnsupportedAppUsage
     void registerDockedStackListener(IDockedStackListener listener);
 
     /**
@@ -378,6 +402,7 @@
     /**
      * Retrieves the current stable insets from the primary display.
      */
+    @UnsupportedAppUsage
     void getStableInsets(int displayId, out Rect outInsets);
 
     /**
@@ -400,6 +425,7 @@
     /**
      * Create an input consumer by name and display id.
      */
+    @UnsupportedAppUsage
     void createInputConsumer(IBinder token, String name, int displayId,
         out InputChannel inputChannel);
 
@@ -407,6 +433,7 @@
      * Destroy an input consumer by name and display id.
      * This method will also dispose the input channels associated with that InputConsumer.
      */
+    @UnsupportedAppUsage
     boolean destroyInputConsumer(String name, int displayId);
 
     /**
diff --git a/core/java/android/view/IWindowSession.aidl b/core/java/android/view/IWindowSession.aidl
index 240aad5..1fcd432 100644
--- a/core/java/android/view/IWindowSession.aidl
+++ b/core/java/android/view/IWindowSession.aidl
@@ -46,6 +46,7 @@
     int addToDisplayWithoutInputChannel(IWindow window, int seq, in WindowManager.LayoutParams attrs,
             in int viewVisibility, in int layerStackId, out Rect outContentInsets,
             out Rect outStableInsets, out InsetsState insetsState);
+    @UnsupportedAppUsage
     void remove(IWindow window);
 
     /**
@@ -122,6 +123,7 @@
      * completely transparent, allowing it to work with the surface flinger
      * to optimize compositing of this part of the window.
      */
+    @UnsupportedAppUsage
     void setTransparentRegion(IWindow window, in Region region);
 
     /**
@@ -143,11 +145,15 @@
      */
     void getDisplayFrame(IWindow window, out Rect outDisplayFrame);
 
+    @UnsupportedAppUsage
     void finishDrawing(IWindow window);
 
+    @UnsupportedAppUsage
     void setInTouchMode(boolean showFocus);
+    @UnsupportedAppUsage
     boolean getInTouchMode();
 
+    @UnsupportedAppUsage
     boolean performHapticFeedback(int effectId, boolean always);
 
     /**
@@ -166,6 +172,7 @@
      * @param data Data transferred by drag and drop
      * @return Token of drag operation which will be passed to cancelDragAndDrop.
      */
+    @UnsupportedAppUsage
     IBinder performDrag(IWindow window, int flags, in SurfaceControl surface, int touchSource,
             float touchX, float touchY, float thumbCenterX, float thumbCenterY, in ClipData data);
 
@@ -199,6 +206,7 @@
      */
     void setWallpaperPosition(IBinder windowToken, float x, float y, float xstep, float ystep);
 
+    @UnsupportedAppUsage
     void wallpaperOffsetsComplete(IBinder window);
 
     /**
@@ -209,6 +217,7 @@
     Bundle sendWallpaperCommand(IBinder window, String action, int x, int y,
             int z, in Bundle extras, boolean sync);
 
+    @UnsupportedAppUsage
     void wallpaperCommandComplete(IBinder window, in Bundle result);
 
     /**
diff --git a/core/java/android/view/InputChannel.java b/core/java/android/view/InputChannel.java
index 84c8e7a..af2b992 100644
--- a/core/java/android/view/InputChannel.java
+++ b/core/java/android/view/InputChannel.java
@@ -35,7 +35,7 @@
     private static final boolean DEBUG = false;
     
     @UnsupportedAppUsage
-    public static final Parcelable.Creator<InputChannel> CREATOR
+    public static final @android.annotation.NonNull Parcelable.Creator<InputChannel> CREATOR
             = new Parcelable.Creator<InputChannel>() {
         public InputChannel createFromParcel(Parcel source) {
             InputChannel result = new InputChannel();
diff --git a/core/java/android/view/InputDevice.java b/core/java/android/view/InputDevice.java
index 868a9de..e723f91 100644
--- a/core/java/android/view/InputDevice.java
+++ b/core/java/android/view/InputDevice.java
@@ -397,7 +397,7 @@
 
     private static final int MAX_RANGES = 1000;
 
-    public static final Parcelable.Creator<InputDevice> CREATOR =
+    public static final @android.annotation.NonNull Parcelable.Creator<InputDevice> CREATOR =
             new Parcelable.Creator<InputDevice>() {
         public InputDevice createFromParcel(Parcel in) {
             return new InputDevice(in);
diff --git a/core/java/android/view/InputEvent.java b/core/java/android/view/InputEvent.java
index c2848d4..4b88a6a 100644
--- a/core/java/android/view/InputEvent.java
+++ b/core/java/android/view/InputEvent.java
@@ -237,7 +237,7 @@
         return 0;
     }
 
-    public static final Parcelable.Creator<InputEvent> CREATOR
+    public static final @android.annotation.NonNull Parcelable.Creator<InputEvent> CREATOR
             = new Parcelable.Creator<InputEvent>() {
         public InputEvent createFromParcel(Parcel in) {
             int token = in.readInt();
diff --git a/core/java/android/view/InsetsSource.java b/core/java/android/view/InsetsSource.java
index fbc72a0..16e00da 100644
--- a/core/java/android/view/InsetsSource.java
+++ b/core/java/android/view/InsetsSource.java
@@ -151,7 +151,7 @@
         dest.writeBoolean(mVisible);
     }
 
-    public static final Creator<InsetsSource> CREATOR = new Creator<InsetsSource>() {
+    public static final @android.annotation.NonNull Creator<InsetsSource> CREATOR = new Creator<InsetsSource>() {
 
         public InsetsSource createFromParcel(Parcel in) {
             return new InsetsSource(in);
diff --git a/core/java/android/view/InsetsSourceControl.java b/core/java/android/view/InsetsSourceControl.java
index 9fb6bdb..4940981 100644
--- a/core/java/android/view/InsetsSourceControl.java
+++ b/core/java/android/view/InsetsSourceControl.java
@@ -76,7 +76,7 @@
         dest.writeParcelable(mSurfacePosition, 0 /* flags*/);
     }
 
-    public static final Creator<InsetsSourceControl> CREATOR
+    public static final @android.annotation.NonNull Creator<InsetsSourceControl> CREATOR
             = new Creator<InsetsSourceControl>() {
         public InsetsSourceControl createFromParcel(Parcel in) {
             return new InsetsSourceControl(in);
diff --git a/core/java/android/view/InsetsState.java b/core/java/android/view/InsetsState.java
index 69f86aa..1382fbc 100644
--- a/core/java/android/view/InsetsState.java
+++ b/core/java/android/view/InsetsState.java
@@ -386,7 +386,7 @@
         }
     }
 
-    public static final Creator<InsetsState> CREATOR = new Creator<InsetsState>() {
+    public static final @android.annotation.NonNull Creator<InsetsState> CREATOR = new Creator<InsetsState>() {
 
         public InsetsState createFromParcel(Parcel in) {
             return new InsetsState(in);
diff --git a/core/java/android/view/KeyCharacterMap.java b/core/java/android/view/KeyCharacterMap.java
index 989bf67..bd03348 100644
--- a/core/java/android/view/KeyCharacterMap.java
+++ b/core/java/android/view/KeyCharacterMap.java
@@ -272,7 +272,7 @@
         sDeadKeyCache.put(combination, result);
     }
 
-    public static final Parcelable.Creator<KeyCharacterMap> CREATOR =
+    public static final @android.annotation.NonNull Parcelable.Creator<KeyCharacterMap> CREATOR =
             new Parcelable.Creator<KeyCharacterMap>() {
         public KeyCharacterMap createFromParcel(Parcel in) {
             return new KeyCharacterMap(in);
diff --git a/core/java/android/view/KeyEvent.java b/core/java/android/view/KeyEvent.java
index f9a46b1..f700d32 100644
--- a/core/java/android/view/KeyEvent.java
+++ b/core/java/android/view/KeyEvent.java
@@ -3065,7 +3065,7 @@
         return result.toString();
     }
 
-    public static final Parcelable.Creator<KeyEvent> CREATOR
+    public static final @android.annotation.NonNull Parcelable.Creator<KeyEvent> CREATOR
             = new Parcelable.Creator<KeyEvent>() {
         @Override
         public KeyEvent createFromParcel(Parcel in) {
diff --git a/core/java/android/view/KeyboardShortcutGroup.java b/core/java/android/view/KeyboardShortcutGroup.java
index 52e9832..763ca26 100644
--- a/core/java/android/view/KeyboardShortcutGroup.java
+++ b/core/java/android/view/KeyboardShortcutGroup.java
@@ -125,7 +125,7 @@
         dest.writeInt(mSystemGroup ? 1 : 0);
     }
 
-    public static final Creator<KeyboardShortcutGroup> CREATOR =
+    public static final @android.annotation.NonNull Creator<KeyboardShortcutGroup> CREATOR =
             new Creator<KeyboardShortcutGroup>() {
                 public KeyboardShortcutGroup createFromParcel(Parcel source) {
                     return new KeyboardShortcutGroup(source);
diff --git a/core/java/android/view/KeyboardShortcutInfo.java b/core/java/android/view/KeyboardShortcutInfo.java
index c934a4e..2660e74 100644
--- a/core/java/android/view/KeyboardShortcutInfo.java
+++ b/core/java/android/view/KeyboardShortcutInfo.java
@@ -156,7 +156,7 @@
         dest.writeInt(mModifiers);
     }
 
-    public static final Creator<KeyboardShortcutInfo> CREATOR =
+    public static final @android.annotation.NonNull Creator<KeyboardShortcutInfo> CREATOR =
             new Creator<KeyboardShortcutInfo>() {
         public KeyboardShortcutInfo createFromParcel(Parcel source) {
             return new KeyboardShortcutInfo(source);
diff --git a/core/java/android/view/LayoutInflater.java b/core/java/android/view/LayoutInflater.java
index f13cb5a..2e27737 100644
--- a/core/java/android/view/LayoutInflater.java
+++ b/core/java/android/view/LayoutInflater.java
@@ -714,7 +714,8 @@
                 ie.setStackTrace(EMPTY_STACK_TRACE);
                 throw ie;
             } catch (Exception e) {
-                final InflateException ie = new InflateException(parser.getPositionDescription()
+                final InflateException ie = new InflateException(
+                        getParserStateDescription(inflaterContext, attrs)
                         + ": " + e.getMessage(), e);
                 ie.setStackTrace(EMPTY_STACK_TRACE);
                 throw ie;
@@ -730,6 +731,16 @@
         }
     }
 
+    private static String getParserStateDescription(Context context, AttributeSet attrs) {
+        int sourceResId = Resources.getAttributeSetSourceResId(attrs);
+        if (sourceResId == Resources.ID_NULL) {
+            return attrs.getPositionDescription();
+        } else {
+            return attrs.getPositionDescription() + " in "
+                    + context.getResources().getResourceName(sourceResId);
+        }
+    }
+
     private static final ClassLoader BOOT_CLASS_LOADER = LayoutInflater.class.getClassLoader();
 
     private final boolean verifyClassLoader(Constructor<? extends View> constructor) {
@@ -818,7 +829,7 @@
                 if (mFilter != null && clazz != null) {
                     boolean allowed = mFilter.onLoadClass(clazz);
                     if (!allowed) {
-                        failNotAllowed(name, prefix, attrs);
+                        failNotAllowed(name, prefix, viewContext, attrs);
                     }
                 }
                 constructor = clazz.getConstructor(mConstructorSignature);
@@ -837,10 +848,10 @@
                         boolean allowed = clazz != null && mFilter.onLoadClass(clazz);
                         mFilterMap.put(name, allowed);
                         if (!allowed) {
-                            failNotAllowed(name, prefix, attrs);
+                            failNotAllowed(name, prefix, viewContext, attrs);
                         }
                     } else if (allowedState.equals(Boolean.FALSE)) {
-                        failNotAllowed(name, prefix, attrs);
+                        failNotAllowed(name, prefix, viewContext, attrs);
                     }
                 }
             }
@@ -862,14 +873,16 @@
                 mConstructorArgs[0] = lastContext;
             }
         } catch (NoSuchMethodException e) {
-            final InflateException ie = new InflateException(attrs.getPositionDescription()
+            final InflateException ie = new InflateException(
+                    getParserStateDescription(viewContext, attrs)
                     + ": Error inflating class " + (prefix != null ? (prefix + name) : name), e);
             ie.setStackTrace(EMPTY_STACK_TRACE);
             throw ie;
 
         } catch (ClassCastException e) {
             // If loaded class is not a View subclass
-            final InflateException ie = new InflateException(attrs.getPositionDescription()
+            final InflateException ie = new InflateException(
+                    getParserStateDescription(viewContext, attrs)
                     + ": Class is not a View " + (prefix != null ? (prefix + name) : name), e);
             ie.setStackTrace(EMPTY_STACK_TRACE);
             throw ie;
@@ -878,7 +891,7 @@
             throw e;
         } catch (Exception e) {
             final InflateException ie = new InflateException(
-                    attrs.getPositionDescription() + ": Error inflating class "
+                    getParserStateDescription(viewContext, attrs) + ": Error inflating class "
                             + (clazz == null ? "<unknown>" : clazz.getName()), e);
             ie.setStackTrace(EMPTY_STACK_TRACE);
             throw ie;
@@ -890,8 +903,8 @@
     /**
      * Throw an exception because the specified class is not allowed to be inflated.
      */
-    private void failNotAllowed(String name, String prefix, AttributeSet attrs) {
-        throw new InflateException(attrs.getPositionDescription()
+    private void failNotAllowed(String name, String prefix, Context context, AttributeSet attrs) {
+        throw new InflateException(getParserStateDescription(context, attrs)
                 + ": Class not allowed to be inflated "+ (prefix != null ? (prefix + name) : name));
     }
 
@@ -1013,13 +1026,15 @@
             throw e;
 
         } catch (ClassNotFoundException e) {
-            final InflateException ie = new InflateException(attrs.getPositionDescription()
+            final InflateException ie = new InflateException(
+                    getParserStateDescription(context, attrs)
                     + ": Error inflating class " + name, e);
             ie.setStackTrace(EMPTY_STACK_TRACE);
             throw ie;
 
         } catch (Exception e) {
-            final InflateException ie = new InflateException(attrs.getPositionDescription()
+            final InflateException ie = new InflateException(
+                    getParserStateDescription(context, attrs)
                     + ": Error inflating class " + name, e);
             ie.setStackTrace(EMPTY_STACK_TRACE);
             throw ie;
@@ -1215,8 +1230,8 @@
                 }
 
                 if (type != XmlPullParser.START_TAG) {
-                    throw new InflateException(childParser.getPositionDescription() +
-                        ": No start tag found!");
+                    throw new InflateException(getParserStateDescription(context, childAttrs)
+                            + ": No start tag found!");
                 }
 
                 final String childName = childParser.getName();
diff --git a/core/java/android/view/MagnificationSpec.java b/core/java/android/view/MagnificationSpec.java
index 956a211..aea337e 100644
--- a/core/java/android/view/MagnificationSpec.java
+++ b/core/java/android/view/MagnificationSpec.java
@@ -146,7 +146,7 @@
         offsetY = parcel.readFloat();
     }
 
-    public static final Creator<MagnificationSpec> CREATOR = new Creator<MagnificationSpec>() {
+    public static final @android.annotation.NonNull Creator<MagnificationSpec> CREATOR = new Creator<MagnificationSpec>() {
         @Override
         public MagnificationSpec[] newArray(int size) {
             return new MagnificationSpec[size];
diff --git a/core/java/android/view/MotionEvent.java b/core/java/android/view/MotionEvent.java
index b6c4cbb..86e94f4 100644
--- a/core/java/android/view/MotionEvent.java
+++ b/core/java/android/view/MotionEvent.java
@@ -3660,7 +3660,7 @@
         return (getButtonState() & button) == button;
     }
 
-    public static final Parcelable.Creator<MotionEvent> CREATOR
+    public static final @android.annotation.NonNull Parcelable.Creator<MotionEvent> CREATOR
             = new Parcelable.Creator<MotionEvent>() {
         public MotionEvent createFromParcel(Parcel in) {
             in.readInt(); // skip token, we already know this is a MotionEvent
diff --git a/core/java/android/view/NotificationHeaderView.java b/core/java/android/view/NotificationHeaderView.java
index f8d5014..b2f3f5e 100644
--- a/core/java/android/view/NotificationHeaderView.java
+++ b/core/java/android/view/NotificationHeaderView.java
@@ -67,6 +67,7 @@
     private boolean mExpanded;
     private boolean mShowExpandButtonAtEnd;
     private boolean mShowWorkBadgeAtEnd;
+    private int mHeaderTextMarginEnd;
     private Drawable mBackground;
     private boolean mEntireHeaderClickable;
     private boolean mExpandOnlyOnButton;
@@ -133,7 +134,8 @@
                 MeasureSpec.AT_MOST);
         int wrapContentHeightSpec = MeasureSpec.makeMeasureSpec(givenHeight,
                 MeasureSpec.AT_MOST);
-        int totalWidth = getPaddingStart() + getPaddingEnd();
+        int totalWidth = getPaddingStart();
+        int iconWidth = getPaddingEnd();
         for (int i = 0; i < getChildCount(); i++) {
             final View child = getChildAt(i);
             if (child.getVisibility() == GONE) {
@@ -146,10 +148,19 @@
             int childHeightSpec = getChildMeasureSpec(wrapContentHeightSpec,
                     lp.topMargin + lp.bottomMargin, lp.height);
             child.measure(childWidthSpec, childHeightSpec);
-            totalWidth += lp.leftMargin + lp.rightMargin + child.getMeasuredWidth();
+            if ((child == mExpandButton && mShowExpandButtonAtEnd)
+                    || child == mProfileBadge
+                    || child == mAppOps) {
+                iconWidth += lp.leftMargin + lp.rightMargin + child.getMeasuredWidth();
+            } else {
+                totalWidth += lp.leftMargin + lp.rightMargin + child.getMeasuredWidth();
+            }
         }
-        if (totalWidth > givenWidth) {
-            int overFlow = totalWidth - givenWidth;
+
+        // Ensure that there is at least enough space for the icons
+        int endMargin = Math.max(mHeaderTextMarginEnd, iconWidth);
+        if (totalWidth > givenWidth - endMargin) {
+            int overFlow = totalWidth - givenWidth + endMargin;
             // We are overflowing, lets shrink the app name first
             overFlow = shrinkViewForOverflow(wrapContentHeightSpec, overFlow, mAppName,
                     mChildMinWidth);
@@ -161,6 +172,7 @@
             shrinkViewForOverflow(wrapContentHeightSpec, overFlow, mSecondaryHeaderText,
                     0);
         }
+        totalWidth += getPaddingEnd();
         mTotalWidth = Math.min(totalWidth, givenWidth);
         setMeasuredDimension(givenWidth, givenHeight);
     }
@@ -383,6 +395,26 @@
         return mIcon;
     }
 
+    /**
+     * Sets the margin end for the text portion of the header, excluding right-aligned elements
+     * @param headerTextMarginEnd margin size
+     */
+    @RemotableViewMethod
+    public void setHeaderTextMarginEnd(int headerTextMarginEnd) {
+        if (mHeaderTextMarginEnd != headerTextMarginEnd) {
+            mHeaderTextMarginEnd = headerTextMarginEnd;
+            requestLayout();
+        }
+    }
+
+    /**
+     * Get the current margin end value for the header text
+     * @return margin size
+     */
+    public int getHeaderTextMarginEnd() {
+        return mHeaderTextMarginEnd;
+    }
+
     public class HeaderTouchListener implements View.OnTouchListener {
 
         private final ArrayList<Rect> mTouchRects = new ArrayList<>();
diff --git a/core/java/android/view/PointerIcon.java b/core/java/android/view/PointerIcon.java
index c3d13bd..dfe34c8 100644
--- a/core/java/android/view/PointerIcon.java
+++ b/core/java/android/view/PointerIcon.java
@@ -361,7 +361,7 @@
         return mType;
     }
 
-    public static final Parcelable.Creator<PointerIcon> CREATOR
+    public static final @android.annotation.NonNull Parcelable.Creator<PointerIcon> CREATOR
             = new Parcelable.Creator<PointerIcon>() {
         public PointerIcon createFromParcel(Parcel in) {
             int type = in.readInt();
diff --git a/core/java/android/view/RemoteAnimationAdapter.java b/core/java/android/view/RemoteAnimationAdapter.java
index 6f5a85d..bc2fe54 100644
--- a/core/java/android/view/RemoteAnimationAdapter.java
+++ b/core/java/android/view/RemoteAnimationAdapter.java
@@ -129,7 +129,7 @@
         dest.writeBoolean(mChangeNeedsSnapshot);
     }
 
-    public static final Creator<RemoteAnimationAdapter> CREATOR
+    public static final @android.annotation.NonNull Creator<RemoteAnimationAdapter> CREATOR
             = new Creator<RemoteAnimationAdapter>() {
         public RemoteAnimationAdapter createFromParcel(Parcel in) {
             return new RemoteAnimationAdapter(in);
diff --git a/core/java/android/view/RemoteAnimationDefinition.java b/core/java/android/view/RemoteAnimationDefinition.java
index beb1c1d..884cae4 100644
--- a/core/java/android/view/RemoteAnimationDefinition.java
+++ b/core/java/android/view/RemoteAnimationDefinition.java
@@ -139,7 +139,7 @@
         }
     }
 
-    public static final Creator<RemoteAnimationDefinition> CREATOR =
+    public static final @android.annotation.NonNull Creator<RemoteAnimationDefinition> CREATOR =
             new Creator<RemoteAnimationDefinition>() {
         public RemoteAnimationDefinition createFromParcel(Parcel in) {
             return new RemoteAnimationDefinition(in);
@@ -181,7 +181,7 @@
             return 0;
         }
 
-        private static final Creator<RemoteAnimationAdapterEntry> CREATOR
+        private static final @android.annotation.NonNull Creator<RemoteAnimationAdapterEntry> CREATOR
                 = new Creator<RemoteAnimationAdapterEntry>() {
 
             @Override
diff --git a/core/java/android/view/RemoteAnimationTarget.java b/core/java/android/view/RemoteAnimationTarget.java
index 9b3efe1..ae3e1d0 100644
--- a/core/java/android/view/RemoteAnimationTarget.java
+++ b/core/java/android/view/RemoteAnimationTarget.java
@@ -255,7 +255,7 @@
         proto.end(token);
     }
 
-    public static final Creator<RemoteAnimationTarget> CREATOR
+    public static final @android.annotation.NonNull Creator<RemoteAnimationTarget> CREATOR
             = new Creator<RemoteAnimationTarget>() {
         public RemoteAnimationTarget createFromParcel(Parcel in) {
             return new RemoteAnimationTarget(in);
diff --git a/core/java/android/view/RenderNodeAnimator.java b/core/java/android/view/RenderNodeAnimator.java
index 23f2b8a..7ab9534 100644
--- a/core/java/android/view/RenderNodeAnimator.java
+++ b/core/java/android/view/RenderNodeAnimator.java
@@ -336,6 +336,7 @@
         return mUnscaledStartDelay;
     }
 
+    @UnsupportedAppUsage
     @Override
     public RenderNodeAnimator setDuration(long duration) {
         checkMutable();
diff --git a/core/java/android/view/Surface.java b/core/java/android/view/Surface.java
index a15a20a..6ff699e 100644
--- a/core/java/android/view/Surface.java
+++ b/core/java/android/view/Surface.java
@@ -84,7 +84,7 @@
     private static native int nativeSetSharedBufferModeEnabled(long nativeObject, boolean enabled);
     private static native int nativeSetAutoRefreshEnabled(long nativeObject, boolean enabled);
 
-    public static final Parcelable.Creator<Surface> CREATOR =
+    public static final @android.annotation.NonNull Parcelable.Creator<Surface> CREATOR =
             new Parcelable.Creator<Surface>() {
         @Override
         public Surface createFromParcel(Parcel source) {
diff --git a/core/java/android/view/SurfaceControl.java b/core/java/android/view/SurfaceControl.java
index ea7f31d..5e2aaae 100644
--- a/core/java/android/view/SurfaceControl.java
+++ b/core/java/android/view/SurfaceControl.java
@@ -117,6 +117,8 @@
             float dtdy, float dsdy);
     private static native void nativeSetColorTransform(long transactionObj, long nativeObject,
             float[] matrix, float[] translation);
+    private static native void nativeSetColorSpaceAgnostic(long transactionObj, long nativeObject,
+            boolean agnostic);
     private static native void nativeSetGeometry(long transactionObj, long nativeObject,
             Rect sourceCrop, Rect dest, long orientation);
     private static native void nativeSetColor(long transactionObj, long nativeObject, float[] color);
@@ -160,6 +162,7 @@
     private static native boolean nativeSetActiveConfig(IBinder displayToken, int id);
     private static native boolean nativeSetAllowedDisplayConfigs(IBinder displayToken,
                                                                  int[] allowedConfigs);
+    private static native int[] nativeGetAllowedDisplayConfigs(IBinder displayToken);
     private static native int[] nativeGetDisplayColorModes(IBinder displayToken);
     private static native SurfaceControl.DisplayPrimaries nativeGetDisplayNativePrimaries(
             IBinder displayToken);
@@ -818,7 +821,7 @@
         proto.end(token);
     }
 
-    public static final Creator<SurfaceControl> CREATOR
+    public static final @android.annotation.NonNull Creator<SurfaceControl> CREATOR
             = new Creator<SurfaceControl>() {
         public SurfaceControl createFromParcel(Parcel in) {
             return new SurfaceControl(in);
@@ -1206,6 +1209,19 @@
     }
 
     /**
+     * Sets the Surface to be color space agnostic. If a surface is color space agnostic,
+     * the color can be interpreted in any color space.
+     * @param agnostic A boolean to indicate whether the surface is color space agnostic
+     * @hide
+     */
+    public void setColorSpaceAgnostic(boolean agnostic) {
+        checkNotReleased();
+        synchronized (SurfaceControl.class) {
+            sGlobalTransaction.setColorSpaceAgnostic(this, agnostic);
+        }
+    }
+
+    /**
      * Bounds the surface and its children to the bounds specified. Size of the surface will be
      * ignored and only the crop and buffer size will be used to determine the bounds of the
      * surface. If no crop is specified and the surface has no buffer, the surface bounds is only
@@ -1538,6 +1554,16 @@
     /**
      * @hide
      */
+    public static int[] getAllowedDisplayConfigs(IBinder displayToken) {
+        if (displayToken == null) {
+            throw new IllegalArgumentException("displayToken must not be null");
+        }
+        return nativeGetAllowedDisplayConfigs(displayToken);
+    }
+
+    /**
+     * @hide
+     */
     public static int[] getDisplayColorModes(IBinder displayToken) {
         if (displayToken == null) {
             throw new IllegalArgumentException("displayToken must not be null");
@@ -2216,6 +2242,18 @@
         }
 
         /**
+         * Sets the Surface to be color space agnostic. If a surface is color space agnostic,
+         * the color can be interpreted in any color space.
+         * @param agnostic A boolean to indicate whether the surface is color space agnostic
+         * @hide
+         */
+        public Transaction setColorSpaceAgnostic(SurfaceControl sc, boolean agnostic) {
+            sc.checkNotReleased();
+            nativeSetColorSpaceAgnostic(mNativeObject, sc.mNativeObject, agnostic);
+            return this;
+        }
+
+        /**
          * @hide
          */
         @UnsupportedAppUsage
diff --git a/core/java/android/view/SurfaceView.java b/core/java/android/view/SurfaceView.java
index fe9aa23..ee8d663 100644
--- a/core/java/android/view/SurfaceView.java
+++ b/core/java/android/view/SurfaceView.java
@@ -210,7 +210,7 @@
 
     public SurfaceView(Context context, AttributeSet attrs, int defStyleAttr, int defStyleRes) {
         super(context, attrs, defStyleAttr, defStyleRes);
-        mRenderNode.requestPositionUpdates(mPositionListener);
+        mRenderNode.addPositionUpdateListener(mPositionListener);
 
         setWillNotDraw(true);
     }
diff --git a/core/java/android/view/TEST_MAPPING b/core/java/android/view/TEST_MAPPING
new file mode 100644
index 0000000..87d428a
--- /dev/null
+++ b/core/java/android/view/TEST_MAPPING
@@ -0,0 +1,10 @@
+{
+  "presubmit": [
+    {
+      "name": "CtsUiRenderingTestCases"
+    },
+    {
+      "name": "CtsAccelerationTestCases"
+    }
+  ]
+}
\ No newline at end of file
diff --git a/core/java/android/view/View.java b/core/java/android/view/View.java
index 7afdc70..7fcce6d 100644
--- a/core/java/android/view/View.java
+++ b/core/java/android/view/View.java
@@ -881,12 +881,6 @@
     private static boolean sAlwaysRemeasureExactly = false;
 
     /**
-     * Relax constraints around whether setLayoutParams() must be called after
-     * modifying the layout params.
-     */
-    private static boolean sLayoutParamsAlwaysChanged = false;
-
-    /**
      * Allow setForeground/setBackground to be called (and ignored) on a textureview,
      * without throwing
      */
@@ -4603,6 +4597,16 @@
         private ArrayList<OnUnhandledKeyEventListener> mUnhandledKeyListeners;
 
         private WindowInsetsAnimationListener mWindowInsetsAnimationListener;
+
+        /**
+         * This lives here since it's only valid for interactive views.
+         */
+        private List<Rect> mSystemGestureExclusionRects;
+
+        /**
+         * Used to track {@link #mSystemGestureExclusionRects}
+         */
+        public RenderNode.PositionUpdateListener mPositionUpdateListener;
     }
 
     @UnsupportedAppUsage
@@ -5170,11 +5174,6 @@
             // modes, so we always need to run an additional EXACTLY pass.
             sAlwaysRemeasureExactly = targetSdkVersion <= Build.VERSION_CODES.M;
 
-            // Prior to N, layout params could change without requiring a
-            // subsequent call to setLayoutParams() and they would usually
-            // work. Partial layout breaks this assumption.
-            sLayoutParamsAlwaysChanged = targetSdkVersion <= Build.VERSION_CODES.M;
-
             // Prior to N, TextureView would silently ignore calls to setBackground/setForeground.
             // On N+, we throw, but that breaks compatibility with apps that use these methods.
             sTextureViewIgnoresDrawableSetters = targetSdkVersion <= Build.VERSION_CODES.M;
@@ -5804,6 +5803,11 @@
                         setImportantForAutofill(a.getInt(attr, IMPORTANT_FOR_AUTOFILL_AUTO));
                     }
                     break;
+                case R.styleable.View_importantForContentCapture:
+                    if (a.peekValue(attr) != null) {
+                        setImportantForContentCapture(a.getInt(attr,
+                                IMPORTANT_FOR_CONTENT_CAPTURE_AUTO));
+                    }
                 case R.styleable.View_defaultFocusHighlightEnabled:
                     if (a.peekValue(attr) != null) {
                         setDefaultFocusHighlightEnabled(a.getBoolean(attr, true));
@@ -5970,20 +5974,28 @@
      * this {@link View}.
      */
     @NonNull
-    public List<Integer> getAttributeResolutionStack(@AttrRes int attribute) {
-        ArrayList<Integer> stack = new ArrayList<>();
-        if (!sDebugViewAttributes) {
-            return stack;
-        }
-        if (mSourceLayoutId != ID_NULL) {
-            stack.add(mSourceLayoutId);
+    public int[] getAttributeResolutionStack(@AttrRes int attribute) {
+        if (!sDebugViewAttributes
+                || mAttributeResolutionStacks == null
+                || mAttributeResolutionStacks.get(attribute) == null) {
+            return new int[0];
         }
         int[] attributeResolutionStack = mAttributeResolutionStacks.get(attribute);
-        if (attributeResolutionStack == null) {
-            return stack;
+        int stackSize = attributeResolutionStack.length;
+        if (mSourceLayoutId != ID_NULL) {
+            stackSize++;
+        }
+
+        int currentIndex = 0;
+        int[] stack = new int[stackSize];
+
+        if (mSourceLayoutId != ID_NULL) {
+            stack[currentIndex] = mSourceLayoutId;
+            currentIndex++;
         }
         for (int i = 0; i < attributeResolutionStack.length; i++) {
-            stack.add(attributeResolutionStack[i]);
+            stack[currentIndex] = attributeResolutionStack[i];
+            currentIndex++;
         }
         return stack;
     }
@@ -6004,7 +6016,7 @@
     @NonNull
     public Map<Integer, Integer> getAttributeSourceResourceMap() {
         HashMap<Integer, Integer> map = new HashMap<>();
-        if (!sDebugViewAttributes) {
+        if (!sDebugViewAttributes || mAttributeSourceResId == null) {
             return map;
         }
         for (int i = 0; i < mAttributeSourceResId.size(); i++) {
@@ -6134,7 +6146,9 @@
 
     /**
      * Stores debugging information about attributes. This should be called in a constructor by
-     * every custom {@link View} that uses a custom styleable.
+     * every custom {@link View} that uses a custom styleable. If the custom view does not call it,
+     * then the custom attributes used by this view will not be visible in layout inspection tools.
+     *
      *  @param context Context under which this view is created.
      * @param styleable A reference to styleable array R.styleable.Foo
      * @param attrs AttributeSet used to construct this view.
@@ -9531,8 +9545,7 @@
             // View is not important for "regular" autofill, so we must check if Augmented Autofill
             // is enabled for the activity
             final AutofillOptions options = mContext.getAutofillOptions();
-            if (options == null || !options.augmentedEnabled) {
-                // TODO(b/123100824): should also check if activity is whitelisted
+            if (options == null || !options.isAugmentedAutofillEnabled(mContext)) {
                 return false;
             }
             final AutofillManager afm = getAutofillManager();
@@ -10298,7 +10311,7 @@
      * @see #setImportantForAccessibility(int)
      */
     @RemotableViewMethod
-    public void setAccessibilityTraversalBefore(int beforeId) {
+    public void setAccessibilityTraversalBefore(@IdRes int beforeId) {
         if (mAccessibilityTraversalBeforeId == beforeId) {
             return;
         }
@@ -10315,6 +10328,7 @@
      *
      * @see #setAccessibilityTraversalBefore(int)
      */
+    @IdRes
     @InspectableProperty
     public int getAccessibilityTraversalBefore() {
         return mAccessibilityTraversalBeforeId;
@@ -10343,7 +10357,7 @@
      * @see #setImportantForAccessibility(int)
      */
     @RemotableViewMethod
-    public void setAccessibilityTraversalAfter(int afterId) {
+    public void setAccessibilityTraversalAfter(@IdRes int afterId) {
         if (mAccessibilityTraversalAfterId == afterId) {
             return;
         }
@@ -10360,6 +10374,7 @@
      *
      * @see #setAccessibilityTraversalAfter(int)
      */
+    @IdRes
     @InspectableProperty
     public int getAccessibilityTraversalAfter() {
         return mAccessibilityTraversalAfterId;
@@ -10371,6 +10386,7 @@
      *
      * @return The labeled view id.
      */
+    @IdRes
     @ViewDebug.ExportedProperty(category = "accessibility")
     @InspectableProperty
     public int getLabelFor() {
@@ -10592,6 +10608,7 @@
      *
      * @attr ref android.R.styleable#View_nextFocusLeft
      */
+    @IdRes
     @InspectableProperty(name = "nextFocusLeft")
     public int getNextFocusLeftId() {
         return mNextFocusLeftId;
@@ -10604,7 +10621,7 @@
      *
      * @attr ref android.R.styleable#View_nextFocusLeft
      */
-    public void setNextFocusLeftId(int nextFocusLeftId) {
+    public void setNextFocusLeftId(@IdRes int nextFocusLeftId) {
         mNextFocusLeftId = nextFocusLeftId;
     }
 
@@ -10614,6 +10631,7 @@
      *
      * @attr ref android.R.styleable#View_nextFocusRight
      */
+    @IdRes
     @InspectableProperty(name = "nextFocusRight")
     public int getNextFocusRightId() {
         return mNextFocusRightId;
@@ -10626,7 +10644,7 @@
      *
      * @attr ref android.R.styleable#View_nextFocusRight
      */
-    public void setNextFocusRightId(int nextFocusRightId) {
+    public void setNextFocusRightId(@IdRes int nextFocusRightId) {
         mNextFocusRightId = nextFocusRightId;
     }
 
@@ -10636,6 +10654,7 @@
      *
      * @attr ref android.R.styleable#View_nextFocusUp
      */
+    @IdRes
     @InspectableProperty(name = "nextFocusUp")
     public int getNextFocusUpId() {
         return mNextFocusUpId;
@@ -10648,7 +10667,7 @@
      *
      * @attr ref android.R.styleable#View_nextFocusUp
      */
-    public void setNextFocusUpId(int nextFocusUpId) {
+    public void setNextFocusUpId(@IdRes int nextFocusUpId) {
         mNextFocusUpId = nextFocusUpId;
     }
 
@@ -10658,6 +10677,7 @@
      *
      * @attr ref android.R.styleable#View_nextFocusDown
      */
+    @IdRes
     @InspectableProperty(name = "nextFocusDown")
     public int getNextFocusDownId() {
         return mNextFocusDownId;
@@ -10670,7 +10690,7 @@
      *
      * @attr ref android.R.styleable#View_nextFocusDown
      */
-    public void setNextFocusDownId(int nextFocusDownId) {
+    public void setNextFocusDownId(@IdRes int nextFocusDownId) {
         mNextFocusDownId = nextFocusDownId;
     }
 
@@ -10680,6 +10700,7 @@
      *
      * @attr ref android.R.styleable#View_nextFocusForward
      */
+    @IdRes
     @InspectableProperty(name = "nextFocusForward")
     public int getNextFocusForwardId() {
         return mNextFocusForwardId;
@@ -10692,7 +10713,7 @@
      *
      * @attr ref android.R.styleable#View_nextFocusForward
      */
-    public void setNextFocusForwardId(int nextFocusForwardId) {
+    public void setNextFocusForwardId(@IdRes int nextFocusForwardId) {
         mNextFocusForwardId = nextFocusForwardId;
     }
 
@@ -10703,6 +10724,7 @@
      *
      * @attr ref android.R.styleable#View_nextClusterForward
      */
+    @IdRes
     @InspectableProperty(name = "nextClusterForward")
     public int getNextClusterForwardId() {
         return mNextClusterForwardId;
@@ -10715,7 +10737,7 @@
      *
      * @attr ref android.R.styleable#View_nextClusterForward
      */
-    public void setNextClusterForwardId(int nextClusterForwardId) {
+    public void setNextClusterForwardId(@IdRes int nextClusterForwardId) {
         mNextClusterForwardId = nextClusterForwardId;
     }
 
@@ -10974,6 +10996,95 @@
     }
 
     /**
+     * Sets a list of areas within this view's post-layout coordinate space where the system
+     * should not intercept touch or other pointing device gestures. <em>This method should
+     * be called by {@link #onLayout(boolean, int, int, int, int)} or {@link #onDraw(Canvas)}.</em>
+     *
+     * <p>Use this to tell the system which specific sub-areas of a view need to receive gesture
+     * input in order to function correctly in the presence of global system gestures that may
+     * conflict. For example, if the system wishes to capture swipe-in-from-screen-edge gestures
+     * to provide system-level navigation functionality, a view such as a navigation drawer
+     * container can mark the left (or starting) edge of itself as requiring gesture capture
+     * priority using this API. The system may then choose to relax its own gesture recognition
+     * to allow the app to consume the user's gesture. It is not necessary for an app to register
+     * exclusion rects for broadly spanning regions such as the entirety of a
+     * <code>ScrollView</code> or for simple press and release click targets such as
+     * <code>Button</code>. Mark an exclusion rect when interacting with a view requires
+     * a precision touch gesture in a small area in either the X or Y dimension, such as
+     * an edge swipe or dragging a <code>SeekBar</code> thumb.</p>
+     *
+     * <p>Do not modify the provided list after this method is called.</p>
+     *
+     * @param rects A list of precision gesture regions that this view needs to function correctly
+     */
+    public void setSystemGestureExclusionRects(@NonNull List<Rect> rects) {
+        if (rects.isEmpty() && mListenerInfo == null) return;
+
+        final ListenerInfo info = getListenerInfo();
+        if (rects.isEmpty()) {
+            info.mSystemGestureExclusionRects = null;
+            if (info.mPositionUpdateListener != null) {
+                mRenderNode.removePositionUpdateListener(info.mPositionUpdateListener);
+            }
+        } else {
+            info.mSystemGestureExclusionRects = rects;
+            if (info.mPositionUpdateListener == null) {
+                info.mPositionUpdateListener = new RenderNode.PositionUpdateListener() {
+                    @Override
+                    public void positionChanged(long n, int l, int t, int r, int b) {
+                        postUpdateSystemGestureExclusionRects();
+                    }
+
+                    @Override
+                    public void positionLost(long frameNumber) {
+                        postUpdateSystemGestureExclusionRects();
+                    }
+                };
+                mRenderNode.addPositionUpdateListener(info.mPositionUpdateListener);
+            }
+        }
+        postUpdateSystemGestureExclusionRects();
+    }
+
+    /**
+     * WARNING: this can be called by a hwui worker thread, not just the UI thread!
+     */
+    void postUpdateSystemGestureExclusionRects() {
+        // Potentially racey from a background thread. It's ok if it's not perfect.
+        final Handler h = getHandler();
+        if (h != null) {
+            h.postAtFrontOfQueue(this::updateSystemGestureExclusionRects);
+        }
+    }
+
+    void updateSystemGestureExclusionRects() {
+        final AttachInfo ai = mAttachInfo;
+        if (ai != null) {
+            ai.mViewRootImpl.updateSystemGestureExclusionRectsForView(this);
+        }
+    }
+
+    /**
+     * Retrieve the list of areas within this view's post-layout coordinate space where the system
+     * should not intercept touch or other pointing device gestures.
+     *
+     * <p>Do not modify the returned list.</p>
+     *
+     * @return the list set by {@link #setSystemGestureExclusionRects(List)}
+     */
+    @NonNull
+    public List<Rect> getSystemGestureExclusionRects() {
+        final ListenerInfo info = mListenerInfo;
+        if (info != null) {
+            final List<Rect> list = info.mSystemGestureExclusionRects;
+            if (list != null) {
+                return list;
+            }
+        }
+        return Collections.emptyList();
+    }
+
+    /**
      * Compute the view's coordinate within the surface.
      *
      * <p>Computes the coordinates of this view in its surface. The argument
@@ -17988,21 +18099,6 @@
     }
 
     /**
-     * Utility method to transform a given Rect by the current matrix of this view.
-     */
-    void transformRect(final Rect rect) {
-        if (!getMatrix().isIdentity()) {
-            RectF boundingRect = mAttachInfo.mTmpTransformRect;
-            boundingRect.set(rect);
-            getMatrix().mapRect(boundingRect);
-            rect.set((int) Math.floor(boundingRect.left),
-                    (int) Math.floor(boundingRect.top),
-                    (int) Math.ceil(boundingRect.right),
-                    (int) Math.ceil(boundingRect.bottom));
-        }
-    }
-
-    /**
      * Used to indicate that the parent of this view should clear its caches. This functionality
      * is used to force the parent to rebuild its display list (when hardware-accelerated),
      * which is necessary when various parent-managed properties of the view change, such as
@@ -18516,7 +18612,7 @@
             @FlagMap(target = FADING_EDGE_VERTICAL, name = "vertical"),
             @FlagMap(target = FADING_EDGE_HORIZONTAL, name = "horizontal")
     })
-    int getFadingEdge() {
+    public int getFadingEdge() {
         return mViewFlags & FADING_EDGE_MASK;
     }
 
@@ -18527,7 +18623,7 @@
      * @hide
      */
     @InspectableProperty
-    int getFadingEdgeLength() {
+    public int getFadingEdgeLength() {
         if (mScrollCache != null && (mViewFlags & FADING_EDGE_MASK) != FADING_EDGE_NONE) {
             return mScrollCache.fadingEdgeLength;
         }
@@ -24020,7 +24116,7 @@
      *
      * @param matrix input matrix to modify
      */
-    public void transformMatrixToGlobal(Matrix matrix) {
+    public void transformMatrixToGlobal(@NonNull Matrix matrix) {
         final ViewParent parent = mParent;
         if (parent instanceof View) {
             final View vp = (View) parent;
@@ -24045,7 +24141,7 @@
      *
      * @param matrix input matrix to modify
      */
-    public void transformMatrixToLocal(Matrix matrix) {
+    public void transformMatrixToLocal(@NonNull Matrix matrix) {
         final ViewParent parent = mParent;
         if (parent instanceof View) {
             final View vp = (View) parent;
@@ -27916,7 +28012,7 @@
             out.writeInt(mAutofillViewId);
         }
 
-        public static final Parcelable.Creator<BaseSavedState> CREATOR
+        public static final @android.annotation.NonNull Parcelable.Creator<BaseSavedState> CREATOR
                 = new Parcelable.ClassLoaderCreator<BaseSavedState>() {
             @Override
             public BaseSavedState createFromParcel(Parcel in) {
diff --git a/core/java/android/view/ViewGroup.java b/core/java/android/view/ViewGroup.java
index f2474a5..4dc20d4 100644
--- a/core/java/android/view/ViewGroup.java
+++ b/core/java/android/view/ViewGroup.java
@@ -7845,6 +7845,10 @@
             @ViewDebug.IntToString(from = MATCH_PARENT, to = "MATCH_PARENT"),
             @ViewDebug.IntToString(from = WRAP_CONTENT, to = "WRAP_CONTENT")
         })
+        @InspectableProperty(name = "layout_width", enumMapping = {
+                @InspectableProperty.EnumMap(name = "match_parent", value = MATCH_PARENT),
+                @InspectableProperty.EnumMap(name = "wrap_content", value = WRAP_CONTENT)
+        })
         public int width;
 
         /**
@@ -7856,6 +7860,10 @@
             @ViewDebug.IntToString(from = MATCH_PARENT, to = "MATCH_PARENT"),
             @ViewDebug.IntToString(from = WRAP_CONTENT, to = "WRAP_CONTENT")
         })
+        @InspectableProperty(name = "layout_height", enumMapping = {
+                @InspectableProperty.EnumMap(name = "match_parent", value = MATCH_PARENT),
+                @InspectableProperty.EnumMap(name = "wrap_content", value = WRAP_CONTENT)
+        })
         public int height;
 
         /**
@@ -8028,6 +8036,7 @@
          * to this field.
          */
         @ViewDebug.ExportedProperty(category = "layout")
+        @InspectableProperty(name = "layout_marginLeft")
         public int leftMargin;
 
         /**
@@ -8036,6 +8045,7 @@
          * to this field.
          */
         @ViewDebug.ExportedProperty(category = "layout")
+        @InspectableProperty(name = "layout_marginTop")
         public int topMargin;
 
         /**
@@ -8044,6 +8054,7 @@
          * to this field.
          */
         @ViewDebug.ExportedProperty(category = "layout")
+        @InspectableProperty(name = "layout_marginRight")
         public int rightMargin;
 
         /**
@@ -8052,6 +8063,7 @@
          * to this field.
          */
         @ViewDebug.ExportedProperty(category = "layout")
+        @InspectableProperty(name = "layout_marginBottom")
         public int bottomMargin;
 
         /**
diff --git a/core/java/android/view/ViewRootImpl.java b/core/java/android/view/ViewRootImpl.java
index ad0aaa6..9222bd6 100644
--- a/core/java/android/view/ViewRootImpl.java
+++ b/core/java/android/view/ViewRootImpl.java
@@ -605,6 +605,8 @@
 
     private final InsetsController mInsetsController = new InsetsController(this);
 
+    private final GestureExclusionTracker mGestureExclusionTracker = new GestureExclusionTracker();
+
     static final class SystemUiVisibilityInfo {
         int seq;
         int globalVisibility;
@@ -2370,6 +2372,9 @@
                     mAttachInfo.mOutsets.set(mPendingOutsets);
                     mApplyInsetsRequested = false;
                     dispatchApplyInsets(host);
+                    // We applied insets so force contentInsetsChanged to ensure the
+                    // hierarchy is measured below.
+                    contentInsetsChanged = true;
                 }
                 if (visibleInsetsChanged) {
                     mAttachInfo.mVisibleInsets.set(mPendingVisibleInsets);
@@ -3475,7 +3480,7 @@
                 usingAsyncReport = true;
                 final Handler handler = mAttachInfo.mHandler;
                 mAttachInfo.mThreadedRenderer.setFrameCompleteCallback((long frameNr) ->
-                        handler.post(() -> {
+                        handler.postAtFrontOfQueue(() -> {
                             // TODO: Use the frame number
                             pendingDrawFinished();
                             if (commitCallbacks != null) {
@@ -3487,7 +3492,7 @@
             } else if (commitCallbacks != null && commitCallbacks.size() > 0) {
                 final Handler handler = mAttachInfo.mHandler;
                 mAttachInfo.mThreadedRenderer.setFrameCompleteCallback((long frameNr) ->
-                        handler.post(() -> {
+                        handler.postAtFrontOfQueue(() -> {
                             for (int i = 0; i < commitCallbacks.size(); i++) {
                                 commitCallbacks.get(i).run();
                             }
@@ -3977,6 +3982,20 @@
         return mAttachInfo.mAccessibilityFocusDrawable;
     }
 
+    void updateSystemGestureExclusionRectsForView(View view) {
+        mGestureExclusionTracker.updateRectsForView(view);
+        mHandler.sendEmptyMessage(MSG_SYSTEM_GESTURE_EXCLUSION_CHANGED);
+    }
+
+    void systemGestureExclusionChanged() {
+        final List<Rect> rectsForWindowManager = mGestureExclusionTracker.computeChangedRects();
+        if (rectsForWindowManager != null) {
+            // TODO Send to WM
+            mAttachInfo.mTreeObserver
+                    .dispatchOnSystemGestureExclusionRectsChanged(rectsForWindowManager);
+        }
+    }
+
     /**
      * Requests that the root render node is invalidated next time we perform a draw, such that
      * {@link WindowCallbacks#onPostDraw} gets called.
@@ -4433,35 +4452,36 @@
         }
     }
 
-    private final static int MSG_INVALIDATE = 1;
-    private final static int MSG_INVALIDATE_RECT = 2;
-    private final static int MSG_DIE = 3;
-    private final static int MSG_RESIZED = 4;
-    private final static int MSG_RESIZED_REPORT = 5;
-    private final static int MSG_WINDOW_FOCUS_CHANGED = 6;
-    private final static int MSG_DISPATCH_INPUT_EVENT = 7;
-    private final static int MSG_DISPATCH_APP_VISIBILITY = 8;
-    private final static int MSG_DISPATCH_GET_NEW_SURFACE = 9;
-    private final static int MSG_DISPATCH_KEY_FROM_IME = 11;
-    private final static int MSG_DISPATCH_KEY_FROM_AUTOFILL = 12;
-    private final static int MSG_CHECK_FOCUS = 13;
-    private final static int MSG_CLOSE_SYSTEM_DIALOGS = 14;
-    private final static int MSG_DISPATCH_DRAG_EVENT = 15;
-    private final static int MSG_DISPATCH_DRAG_LOCATION_EVENT = 16;
-    private final static int MSG_DISPATCH_SYSTEM_UI_VISIBILITY = 17;
-    private final static int MSG_UPDATE_CONFIGURATION = 18;
-    private final static int MSG_PROCESS_INPUT_EVENTS = 19;
-    private final static int MSG_CLEAR_ACCESSIBILITY_FOCUS_HOST = 21;
-    private final static int MSG_INVALIDATE_WORLD = 22;
-    private final static int MSG_WINDOW_MOVED = 23;
-    private final static int MSG_SYNTHESIZE_INPUT_EVENT = 24;
-    private final static int MSG_DISPATCH_WINDOW_SHOWN = 25;
-    private final static int MSG_REQUEST_KEYBOARD_SHORTCUTS = 26;
-    private final static int MSG_UPDATE_POINTER_ICON = 27;
-    private final static int MSG_POINTER_CAPTURE_CHANGED = 28;
-    private final static int MSG_DRAW_FINISHED = 29;
-    private final static int MSG_INSETS_CHANGED = 30;
-    private final static int MSG_INSETS_CONTROL_CHANGED = 31;
+    private static final int MSG_INVALIDATE = 1;
+    private static final int MSG_INVALIDATE_RECT = 2;
+    private static final int MSG_DIE = 3;
+    private static final int MSG_RESIZED = 4;
+    private static final int MSG_RESIZED_REPORT = 5;
+    private static final int MSG_WINDOW_FOCUS_CHANGED = 6;
+    private static final int MSG_DISPATCH_INPUT_EVENT = 7;
+    private static final int MSG_DISPATCH_APP_VISIBILITY = 8;
+    private static final int MSG_DISPATCH_GET_NEW_SURFACE = 9;
+    private static final int MSG_DISPATCH_KEY_FROM_IME = 11;
+    private static final int MSG_DISPATCH_KEY_FROM_AUTOFILL = 12;
+    private static final int MSG_CHECK_FOCUS = 13;
+    private static final int MSG_CLOSE_SYSTEM_DIALOGS = 14;
+    private static final int MSG_DISPATCH_DRAG_EVENT = 15;
+    private static final int MSG_DISPATCH_DRAG_LOCATION_EVENT = 16;
+    private static final int MSG_DISPATCH_SYSTEM_UI_VISIBILITY = 17;
+    private static final int MSG_UPDATE_CONFIGURATION = 18;
+    private static final int MSG_PROCESS_INPUT_EVENTS = 19;
+    private static final int MSG_CLEAR_ACCESSIBILITY_FOCUS_HOST = 21;
+    private static final int MSG_INVALIDATE_WORLD = 22;
+    private static final int MSG_WINDOW_MOVED = 23;
+    private static final int MSG_SYNTHESIZE_INPUT_EVENT = 24;
+    private static final int MSG_DISPATCH_WINDOW_SHOWN = 25;
+    private static final int MSG_REQUEST_KEYBOARD_SHORTCUTS = 26;
+    private static final int MSG_UPDATE_POINTER_ICON = 27;
+    private static final int MSG_POINTER_CAPTURE_CHANGED = 28;
+    private static final int MSG_DRAW_FINISHED = 29;
+    private static final int MSG_INSETS_CHANGED = 30;
+    private static final int MSG_INSETS_CONTROL_CHANGED = 31;
+    private static final int MSG_SYSTEM_GESTURE_EXCLUSION_CHANGED = 32;
 
     final class ViewRootHandler extends Handler {
         @Override
@@ -4519,6 +4539,10 @@
                     return "MSG_DRAW_FINISHED";
                 case MSG_INSETS_CHANGED:
                     return "MSG_INSETS_CHANGED";
+                case MSG_INSETS_CONTROL_CHANGED:
+                    return "MSG_INSETS_CONTROL_CHANGED";
+                case MSG_SYSTEM_GESTURE_EXCLUSION_CHANGED:
+                    return "MSG_SYSTEM_GESTURE_EXCLUSION_CHANGED";
             }
             return super.getMessageName(message);
         }
@@ -4750,6 +4774,9 @@
                 case MSG_DRAW_FINISHED: {
                     pendingDrawFinished();
                 } break;
+                case MSG_SYSTEM_GESTURE_EXCLUSION_CHANGED: {
+                    systemGestureExclusionChanged();
+                } break;
             }
         }
     }
diff --git a/core/java/android/view/ViewTreeObserver.java b/core/java/android/view/ViewTreeObserver.java
index 763ce4f..2896bd0 100644
--- a/core/java/android/view/ViewTreeObserver.java
+++ b/core/java/android/view/ViewTreeObserver.java
@@ -26,7 +26,9 @@
 import android.util.Log;
 
 import java.util.ArrayList;
+import java.util.List;
 import java.util.concurrent.CopyOnWriteArrayList;
+import java.util.function.Consumer;
 
 /**
  * A view tree observer is used to register listeners that can be notified of global
@@ -57,6 +59,7 @@
     private CopyOnWriteArray<OnScrollChangedListener> mOnScrollChangedListeners;
     private CopyOnWriteArray<OnPreDrawListener> mOnPreDrawListeners;
     private CopyOnWriteArray<OnWindowShownListener> mOnWindowShownListeners;
+    private CopyOnWriteArray<Consumer<List<Rect>>> mGestureExclusionListeners;
 
     // These listeners cannot be mutated during dispatch
     private boolean mInDispatchOnDraw;
@@ -450,6 +453,14 @@
             }
         }
 
+        if (observer.mGestureExclusionListeners != null) {
+            if (mGestureExclusionListeners != null) {
+                mGestureExclusionListeners.addAll(observer.mGestureExclusionListeners);
+            } else {
+                mGestureExclusionListeners = observer.mGestureExclusionListeners;
+            }
+        }
+
         observer.kill();
     }
 
@@ -913,6 +924,35 @@
         mOnEnterAnimationCompleteListeners.remove(listener);
     }
 
+    /**
+     * Add a listener to be notified when the tree's <em>transformed</em> gesture exclusion rects
+     * change. This could be the result of an animation or other layout change, or a view calling
+     * {@link View#setSystemGestureExclusionRects(List)}.
+     *
+     * @param listener listener to add
+     * @see View#setSystemGestureExclusionRects(List)
+     */
+    public void addOnSystemGestureExclusionRectsChangedListener(Consumer<List<Rect>> listener) {
+        checkIsAlive();
+        if (mGestureExclusionListeners == null) {
+            mGestureExclusionListeners = new CopyOnWriteArray<>();
+        }
+        mGestureExclusionListeners.add(listener);
+    }
+
+    /**
+     * Unsubscribe the given listener from gesture exclusion rect changes.
+     * @see #addOnSystemGestureExclusionRectsChangedListener(Consumer)
+     * @see View#setSystemGestureExclusionRects(List)
+     */
+    public void removeOnSystemGestureExclusionRectsChangedListener(Consumer<List<Rect>> listener) {
+        checkIsAlive();
+        if (mGestureExclusionListeners == null) {
+            return;
+        }
+        mGestureExclusionListeners.remove(listener);
+    }
+
     private void checkIsAlive() {
         if (!mAlive) {
             throw new IllegalStateException("This ViewTreeObserver is not alive, call "
@@ -1178,6 +1218,21 @@
         }
     }
 
+    void dispatchOnSystemGestureExclusionRectsChanged(@NonNull List<Rect> rects) {
+        final CopyOnWriteArray<Consumer<List<Rect>>> listeners = mGestureExclusionListeners;
+        if (listeners != null && listeners.size() > 0) {
+            CopyOnWriteArray.Access<Consumer<List<Rect>>> access = listeners.start();
+            try {
+                final int count = access.size();
+                for (int i = 0; i < count; i++) {
+                    access.get(i).accept(rects);
+                }
+            } finally {
+                listeners.end();
+            }
+        }
+    }
+
     /**
      * Copy on write array. This array is not thread safe, and only one loop can
      * iterate over this array at any given time. This class avoids allocations
diff --git a/core/java/android/view/WindowAnimationFrameStats.java b/core/java/android/view/WindowAnimationFrameStats.java
index 0233c86..399dfba 100644
--- a/core/java/android/view/WindowAnimationFrameStats.java
+++ b/core/java/android/view/WindowAnimationFrameStats.java
@@ -81,7 +81,7 @@
         return builder.toString();
     }
 
-    public static final Creator<WindowAnimationFrameStats> CREATOR =
+    public static final @android.annotation.NonNull Creator<WindowAnimationFrameStats> CREATOR =
             new Creator<WindowAnimationFrameStats>() {
                 @Override
                 public WindowAnimationFrameStats createFromParcel(Parcel parcel) {
diff --git a/core/java/android/view/WindowContentFrameStats.java b/core/java/android/view/WindowContentFrameStats.java
index 96878e9..9fa5a00 100644
--- a/core/java/android/view/WindowContentFrameStats.java
+++ b/core/java/android/view/WindowContentFrameStats.java
@@ -139,7 +139,7 @@
         return builder.toString();
     }
 
-    public static final Parcelable.Creator<WindowContentFrameStats> CREATOR =
+    public static final @android.annotation.NonNull Parcelable.Creator<WindowContentFrameStats> CREATOR =
             new Creator<WindowContentFrameStats>() {
                 @Override
                 public WindowContentFrameStats createFromParcel(Parcel parcel) {
diff --git a/core/java/android/view/WindowId.java b/core/java/android/view/WindowId.java
index 12e58f1..26d3405 100644
--- a/core/java/android/view/WindowId.java
+++ b/core/java/android/view/WindowId.java
@@ -196,7 +196,7 @@
         out.writeStrongBinder(mToken.asBinder());
     }
 
-    public static final Parcelable.Creator<WindowId> CREATOR = new Parcelable.Creator<WindowId>() {
+    public static final @android.annotation.NonNull Parcelable.Creator<WindowId> CREATOR = new Parcelable.Creator<WindowId>() {
         @Override
         public WindowId createFromParcel(Parcel in) {
             IBinder target = in.readStrongBinder();
diff --git a/core/java/android/view/WindowInfo.java b/core/java/android/view/WindowInfo.java
index 82e9a5c..74fc15a 100644
--- a/core/java/android/view/WindowInfo.java
+++ b/core/java/android/view/WindowInfo.java
@@ -176,7 +176,7 @@
         hasFlagWatchOutsideTouch = false;
     }
 
-    public static final Parcelable.Creator<WindowInfo> CREATOR =
+    public static final @android.annotation.NonNull Parcelable.Creator<WindowInfo> CREATOR =
             new Creator<WindowInfo>() {
         @Override
         public WindowInfo createFromParcel(Parcel parcel) {
diff --git a/core/java/android/view/WindowInsets.java b/core/java/android/view/WindowInsets.java
index 135a891..f3bbca3 100644
--- a/core/java/android/view/WindowInsets.java
+++ b/core/java/android/view/WindowInsets.java
@@ -22,6 +22,7 @@
 import static android.view.WindowInsets.Type.LAST;
 import static android.view.WindowInsets.Type.SIDE_BARS;
 import static android.view.WindowInsets.Type.SIZE;
+import static android.view.WindowInsets.Type.SYSTEM_GESTURES;
 import static android.view.WindowInsets.Type.TOP_BAR;
 import static android.view.WindowInsets.Type.all;
 import static android.view.WindowInsets.Type.compatSystemInsets;
@@ -35,7 +36,6 @@
 import android.graphics.Insets;
 import android.graphics.Rect;
 import android.util.SparseArray;
-import android.view.InsetsState.InternalInsetType;
 import android.view.WindowInsets.Type.InsetType;
 import android.view.inputmethod.EditorInfo;
 import android.view.inputmethod.InputMethod;
@@ -229,6 +229,7 @@
     static void assignCompatInsets(Insets[] typeInsetMap, Rect insets) {
         typeInsetMap[indexOf(TOP_BAR)] = Insets.of(0, insets.top, 0, 0);
         typeInsetMap[indexOf(SIDE_BARS)] = Insets.of(insets.left, 0, insets.right, insets.bottom);
+        typeInsetMap[indexOf(SYSTEM_GESTURES)] = Insets.of(insets);
     }
 
     private static boolean[] createCompatVisibilityMap(@Nullable Insets[] typeInsetMap) {
@@ -630,6 +631,28 @@
     }
 
     /**
+     * Returns the system gesture insets.
+     *
+     * <p>The system gesture insets represent the area of a window where system gestures have
+     * priority and may consume some or all touch input, e.g. due to the a system bar
+     * occupying it, or it being reserved for touch-only gestures.
+     *
+     * <p>Simple taps are guaranteed to reach the window even within the system gesture insets,
+     * as long as they are outside the {@link #getSystemWindowInsets() system window insets}.
+     *
+     * <p>When {@link View#SYSTEM_UI_FLAG_LAYOUT_STABLE} is requested, an inset will be returned
+     * even when the system gestures are inactive due to
+     * {@link View#SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN} or
+     * {@link View#SYSTEM_UI_FLAG_LAYOUT_HIDE_NAVIGATION}.
+     *
+     * <p>This inset does not affect the result of {@link #isConsumed()} and cannot be consumed.
+     */
+    @NonNull
+    public Insets getSystemGestureInsets() {
+        return getInsets(mTypeInsetsMap, SYSTEM_GESTURES);
+    }
+
+    /**
      * Returns a copy of this WindowInsets with the stable insets fully consumed.
      *
      * @return A modified copy of this WindowInsets
@@ -853,6 +876,22 @@
         }
 
         /**
+         * Sets system gesture insets in pixels.
+         *
+         * <p>The system gesture insets represent the area of a window where system gestures have
+         * priority and may consume some or all touch input, e.g. due to the a system bar
+         * occupying it, or it being reserved for touch-only gestures.
+         *
+         * @see #getSystemGestureInsets()
+         * @return itself
+         */
+        @NonNull
+        public Builder setSystemGestureInsets(@NonNull Insets insets) {
+            WindowInsets.setInsets(mTypeInsetsMap, SYSTEM_GESTURES, insets);
+            return this;
+        }
+
+        /**
          * Sets the insets of a specific window type in pixels.
          *
          * <p>The insets represents the area of a a window that is partially or fully obscured by
@@ -1005,8 +1044,10 @@
         static final int IME = 0x2;
         static final int SIDE_BARS = 0x4;
 
-        static final int LAST = 0x8;
-        static final int SIZE = 4;
+        static final int SYSTEM_GESTURES = 0x8;
+
+        static final int LAST = 0x10;
+        static final int SIZE = 5;
         static final int WINDOW_DECOR = LAST;
 
         static int indexOf(@InsetType int type) {
@@ -1017,8 +1058,10 @@
                     return 1;
                 case SIDE_BARS:
                     return 2;
-                case WINDOW_DECOR:
+                case SYSTEM_GESTURES:
                     return 3;
+                case WINDOW_DECOR:
+                    return 4;
                 default:
                     throw new IllegalArgumentException("type needs to be >= FIRST and <= LAST,"
                             + " type=" + type);
@@ -1030,7 +1073,7 @@
 
         /** @hide */
         @Retention(RetentionPolicy.SOURCE)
-        @IntDef(flag = true, value = { TOP_BAR, IME, SIDE_BARS, WINDOW_DECOR })
+        @IntDef(flag = true, value = { TOP_BAR, IME, SIDE_BARS, WINDOW_DECOR, SYSTEM_GESTURES })
         public @interface InsetType {
         }
 
@@ -1064,6 +1107,27 @@
         }
 
         /**
+         * Returns an inset type representing the system gesture insets.
+         *
+         * <p>The system gesture insets represent the area of a window where system gestures have
+         * priority and may consume some or all touch input, e.g. due to the a system bar
+         * occupying it, or it being reserved for touch-only gestures.
+         *
+         * <p>Simple taps are guaranteed to reach the window even within the system gesture insets,
+         * as long as they are outside the {@link #getSystemWindowInsets() system window insets}.
+         *
+         * <p>When {@link View#SYSTEM_UI_FLAG_LAYOUT_STABLE} is requested, an inset will be returned
+         * even when the system gestures are inactive due to
+         * {@link View#SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN} or
+         * {@link View#SYSTEM_UI_FLAG_LAYOUT_HIDE_NAVIGATION}.
+         *
+         * @see #getSystemGestureInsets()
+         */
+        public static @InsetType int systemGestures() {
+            return SYSTEM_GESTURES;
+        }
+
+        /**
          * @return All system bars. Includes {@link #topBar()} as well as {@link #sideBars()}, but
          *         not {@link #ime()}.
          */
@@ -1082,6 +1146,9 @@
 
         /**
          * @return All inset types combined.
+         *
+         * TODO: Figure out if this makes sense at all, mixing e.g {@link #systemGestures()} and
+         *       {@link #ime()} does not seem very useful.
          */
         public static @InsetType int all() {
             return 0xFFFFFFFF;
diff --git a/core/java/android/view/WindowManager.java b/core/java/android/view/WindowManager.java
index 6326c59..bd38327 100644
--- a/core/java/android/view/WindowManager.java
+++ b/core/java/android/view/WindowManager.java
@@ -481,6 +481,7 @@
      *
      * @param displayId The id of the display.
      * @param shouldShow Indicates that the display should show system decors.
+     * @see #shouldShowSystemDecors(int)
      * @hide
      */
     @TestApi
@@ -488,6 +489,21 @@
     }
 
     /**
+     * Checks if the display supports showing system decors.
+     * <p>
+     * System decors include status bar, navigation bar, launcher.
+     * </p>
+     *
+     * @param displayId The id of the display.
+     * @see #setShouldShowSystemDecors(int, boolean)
+     * @hide
+     */
+    @TestApi
+    default boolean shouldShowSystemDecors(int displayId) {
+        return false;
+    }
+
+    /**
      * Sets that the display should show IME.
      *
      * @param displayId Display ID.
@@ -1777,6 +1793,13 @@
         public static final int PRIVATE_FLAG_STATUS_FORCE_SHOW_NAVIGATION = 0x00800000;
 
         /**
+         * Flag to indicate that the window is color space agnostic, and the color can be
+         * interpreted to any color space.
+         * @hide
+         */
+        public static final int PRIVATE_FLAG_COLOR_SPACE_AGNOSTIC = 0x01000000;
+
+        /**
          * An internal annotation for flags that can be specified to {@link #softInputMode}.
          *
          * @hide
@@ -1876,7 +1899,11 @@
                 @ViewDebug.FlagToString(
                         mask = PRIVATE_FLAG_STATUS_FORCE_SHOW_NAVIGATION,
                         equals = PRIVATE_FLAG_STATUS_FORCE_SHOW_NAVIGATION,
-                        name = "STATUS_FORCE_SHOW_NAVIGATION")
+                        name = "STATUS_FORCE_SHOW_NAVIGATION"),
+                @ViewDebug.FlagToString(
+                        mask = PRIVATE_FLAG_COLOR_SPACE_AGNOSTIC,
+                        equals = PRIVATE_FLAG_COLOR_SPACE_AGNOSTIC,
+                        name = "COLOR_SPACE_AGNOSTIC")
         })
         @TestApi
         public int privateFlags;
@@ -2724,7 +2751,7 @@
             out.writeLong(hideTimeoutMilliseconds);
         }
 
-        public static final Parcelable.Creator<LayoutParams> CREATOR
+        public static final @android.annotation.NonNull Parcelable.Creator<LayoutParams> CREATOR
                     = new Parcelable.Creator<LayoutParams>() {
             public LayoutParams createFromParcel(Parcel in) {
                 return new LayoutParams(in);
diff --git a/core/java/android/view/WindowManagerImpl.java b/core/java/android/view/WindowManagerImpl.java
index a102f6c..2e4db5c 100644
--- a/core/java/android/view/WindowManagerImpl.java
+++ b/core/java/android/view/WindowManagerImpl.java
@@ -177,6 +177,15 @@
     }
 
     @Override
+    public boolean shouldShowSystemDecors(int displayId) {
+        try {
+            return WindowManagerGlobal.getWindowManagerService().shouldShowSystemDecors(displayId);
+        } catch (RemoteException e) {
+        }
+        return false;
+    }
+
+    @Override
     public void setShouldShowIme(int displayId, boolean shouldShow) {
         try {
             WindowManagerGlobal.getWindowManagerService().setShouldShowIme(displayId, shouldShow);
diff --git a/core/java/android/view/accessibility/AccessibilityCache.java b/core/java/android/view/accessibility/AccessibilityCache.java
index 87e18b7..df8690d 100644
--- a/core/java/android/view/accessibility/AccessibilityCache.java
+++ b/core/java/android/view/accessibility/AccessibilityCache.java
@@ -360,7 +360,7 @@
             }
             clearWindowCache();
             final int nodesForWindowCount = mNodeCache.size();
-            for (int i = 0; i < nodesForWindowCount; i++) {
+            for (int i = nodesForWindowCount - 1; i >= 0; i--) {
                 final int windowId = mNodeCache.keyAt(i);
                 clearNodesForWindowLocked(windowId);
             }
@@ -424,20 +424,28 @@
      *
      * @param nodes The nodes in the hosting window.
      * @param rootNodeId The id of the root to evict.
+     *
+     * @return {@code true} if the cache was cleared
      */
-    private void clearSubTreeRecursiveLocked(LongSparseArray<AccessibilityNodeInfo> nodes,
+    private boolean clearSubTreeRecursiveLocked(LongSparseArray<AccessibilityNodeInfo> nodes,
             long rootNodeId) {
         AccessibilityNodeInfo current = nodes.get(rootNodeId);
         if (current == null) {
-            return;
+            // The node isn't in the cache, but its descendents might be.
+            clear();
+            return true;
         }
         nodes.remove(rootNodeId);
         final int childCount = current.getChildCount();
         for (int i = 0; i < childCount; i++) {
             final long childNodeId = current.getChildId(i);
-            clearSubTreeRecursiveLocked(nodes, childNodeId);
+            if (clearSubTreeRecursiveLocked(nodes, childNodeId)) {
+                current.recycle();
+                return true;
+            }
         }
         current.recycle();
+        return false;
     }
 
     /**
diff --git a/core/java/android/view/accessibility/AccessibilityEvent.java b/core/java/android/view/accessibility/AccessibilityEvent.java
index dccf9d4..2ac44d2 100644
--- a/core/java/android/view/accessibility/AccessibilityEvent.java
+++ b/core/java/android/view/accessibility/AccessibilityEvent.java
@@ -1430,7 +1430,7 @@
     /**
      * @see Parcelable.Creator
      */
-    public static final Parcelable.Creator<AccessibilityEvent> CREATOR =
+    public static final @android.annotation.NonNull Parcelable.Creator<AccessibilityEvent> CREATOR =
             new Parcelable.Creator<AccessibilityEvent>() {
         public AccessibilityEvent createFromParcel(Parcel parcel) {
             AccessibilityEvent event = AccessibilityEvent.obtain();
diff --git a/core/java/android/view/accessibility/AccessibilityNodeIdManager.java b/core/java/android/view/accessibility/AccessibilityNodeIdManager.java
index 1ac7047..0f5e950 100644
--- a/core/java/android/view/accessibility/AccessibilityNodeIdManager.java
+++ b/core/java/android/view/accessibility/AccessibilityNodeIdManager.java
@@ -45,7 +45,9 @@
      * @param id The accessibilityViewId of the view.
      */
     public void registerViewWithId(View view, int id) {
-        mIdsToViews.append(id, view);
+        synchronized (mIdsToViews) {
+            mIdsToViews.append(id, view);
+        }
     }
 
     /**
@@ -53,7 +55,9 @@
      * @param id The id returned from registerView when the view as first associated.
      */
     public void unregisterViewWithId(int id) {
-        mIdsToViews.remove(id);
+        synchronized (mIdsToViews) {
+            mIdsToViews.remove(id);
+        }
     }
 
     /**
@@ -62,7 +66,10 @@
      * @return The view.
      */
     public View findView(int id) {
-        final View view = mIdsToViews.get(id);
+        View view = null;
+        synchronized (mIdsToViews) {
+            view = mIdsToViews.get(id);
+        }
         return view != null && view.includeForAccessibility() ? view : null;
     }
 }
diff --git a/core/java/android/view/accessibility/AccessibilityNodeInfo.java b/core/java/android/view/accessibility/AccessibilityNodeInfo.java
index 793c315..a8a787e 100644
--- a/core/java/android/view/accessibility/AccessibilityNodeInfo.java
+++ b/core/java/android/view/accessibility/AccessibilityNodeInfo.java
@@ -5144,7 +5144,7 @@
         /**
          * @see android.os.Parcelable.Creator
          */
-        public static final Parcelable.Creator<TouchDelegateInfo> CREATOR =
+        public static final @android.annotation.NonNull Parcelable.Creator<TouchDelegateInfo> CREATOR =
                 new Parcelable.Creator<TouchDelegateInfo>() {
             @Override
             public TouchDelegateInfo createFromParcel(Parcel parcel) {
@@ -5173,7 +5173,7 @@
     /**
      * @see android.os.Parcelable.Creator
      */
-    public static final Parcelable.Creator<AccessibilityNodeInfo> CREATOR =
+    public static final @android.annotation.NonNull Parcelable.Creator<AccessibilityNodeInfo> CREATOR =
             new Parcelable.Creator<AccessibilityNodeInfo>() {
         @Override
         public AccessibilityNodeInfo createFromParcel(Parcel parcel) {
diff --git a/core/java/android/view/accessibility/AccessibilityWindowInfo.java b/core/java/android/view/accessibility/AccessibilityWindowInfo.java
index c1c9174..4383f8a 100644
--- a/core/java/android/view/accessibility/AccessibilityWindowInfo.java
+++ b/core/java/android/view/accessibility/AccessibilityWindowInfo.java
@@ -770,7 +770,7 @@
         return changes;
     }
 
-    public static final Parcelable.Creator<AccessibilityWindowInfo> CREATOR =
+    public static final @android.annotation.NonNull Parcelable.Creator<AccessibilityWindowInfo> CREATOR =
             new Creator<AccessibilityWindowInfo>() {
         @Override
         public AccessibilityWindowInfo createFromParcel(Parcel parcel) {
diff --git a/core/java/android/view/animation/Animation.java b/core/java/android/view/animation/Animation.java
index e095094..3b60aee 100644
--- a/core/java/android/view/animation/Animation.java
+++ b/core/java/android/view/animation/Animation.java
@@ -207,6 +207,7 @@
     private float mScaleFactor = 1f;
 
     private boolean mShowWallpaper;
+    private boolean mHasRoundedCorners;
 
     private boolean mMore = true;
     private boolean mOneMoreTime = true;
@@ -263,6 +264,8 @@
                 a.getBoolean(com.android.internal.R.styleable.Animation_detachWallpaper, false));
         setShowWallpaper(
                 a.getBoolean(com.android.internal.R.styleable.Animation_showWallpaper, false));
+        setHasRoundedCorners(
+                a.getBoolean(com.android.internal.R.styleable.Animation_hasRoundedCorners, false));
 
         final int resID = a.getResourceId(com.android.internal.R.styleable.Animation_interpolator, 0);
 
@@ -678,6 +681,19 @@
     }
 
     /**
+     * If this is a window animation, the window will have rounded corners matching the display
+     * corner radius.
+     *
+     * @param hasRoundedCorners Whether the window should have rounded corners or not.
+     * @attr ref android.R.styleable#Animation_hasRoundedCorners
+     * @see com.android.internal.policy.ScreenDecorationsUtils#getWindowCornerRadius(Resources)
+     * @hide
+     */
+    public void setHasRoundedCorners(boolean hasRoundedCorners) {
+        mHasRoundedCorners = hasRoundedCorners;
+    }
+
+    /**
      * Gets the acceleration curve type for this animation.
      *
      * @return the {@link Interpolator} associated to this animation
@@ -804,6 +820,16 @@
     }
 
     /**
+     * @return if a window animation should have rounded corners or not.
+     *
+     * @attr ref android.R.styleable#Animation_hasRoundedCorners
+     * @hide
+     */
+    public boolean hasRoundedCorners() {
+        return mHasRoundedCorners;
+    }
+
+    /**
      * <p>Indicates whether or not this animation will affect the transformation
      * matrix. For instance, a fade animation will not affect the matrix whereas
      * a scale animation will.</p>
diff --git a/core/java/android/view/autofill/AutofillId.java b/core/java/android/view/autofill/AutofillId.java
index 5608bb3..8fa29f3 100644
--- a/core/java/android/view/autofill/AutofillId.java
+++ b/core/java/android/view/autofill/AutofillId.java
@@ -206,7 +206,7 @@
         }
     }
 
-    public static final Parcelable.Creator<AutofillId> CREATOR =
+    public static final @android.annotation.NonNull Parcelable.Creator<AutofillId> CREATOR =
             new Parcelable.Creator<AutofillId>() {
         @Override
         public AutofillId createFromParcel(Parcel source) {
diff --git a/core/java/android/view/autofill/AutofillManager.java b/core/java/android/view/autofill/AutofillManager.java
index 70fe230..0c0a555 100644
--- a/core/java/android/view/autofill/AutofillManager.java
+++ b/core/java/android/view/autofill/AutofillManager.java
@@ -1827,22 +1827,6 @@
     }
 
     /**
-     * @deprecated use {@link #setAugmentedAutofillWhitelist(Set, Set)} instead.
-     * @hide
-     */
-    @SystemApi
-    @TestApi
-    @Deprecated
-    public void setAugmentedAutofillWhitelist(@Nullable List<String> packages,
-            @Nullable List<ComponentName> activities) {
-        setAugmentedAutofillWhitelist(toSet(packages), toSet(activities));
-    }
-
-    private <T> ArraySet<T> toSet(@Nullable List<T> set) {
-        return set == null ? null : new ArraySet<T>(set);
-    }
-
-    /**
      * Explicitly limits augmented autofill to the given packages and activities.
      *
      * <p>To reset the whitelist, call it passing {@code null} to both arguments.
diff --git a/core/java/android/view/autofill/AutofillValue.java b/core/java/android/view/autofill/AutofillValue.java
index 186a97d..64c8777 100644
--- a/core/java/android/view/autofill/AutofillValue.java
+++ b/core/java/android/view/autofill/AutofillValue.java
@@ -241,7 +241,7 @@
         }
     }
 
-    public static final Parcelable.Creator<AutofillValue> CREATOR =
+    public static final @android.annotation.NonNull Parcelable.Creator<AutofillValue> CREATOR =
             new Parcelable.Creator<AutofillValue>() {
         @Override
         public AutofillValue createFromParcel(Parcel source) {
diff --git a/core/java/android/view/autofill/ParcelableMap.java b/core/java/android/view/autofill/ParcelableMap.java
index f97b1a0..d8459aa 100644
--- a/core/java/android/view/autofill/ParcelableMap.java
+++ b/core/java/android/view/autofill/ParcelableMap.java
@@ -47,7 +47,7 @@
         }
     }
 
-    public static final Parcelable.Creator<ParcelableMap> CREATOR =
+    public static final @android.annotation.NonNull Parcelable.Creator<ParcelableMap> CREATOR =
             new Parcelable.Creator<ParcelableMap>() {
                 @Override
                 public ParcelableMap createFromParcel(Parcel source) {
diff --git a/core/java/android/view/contentcapture/ContentCaptureContext.java b/core/java/android/view/contentcapture/ContentCaptureContext.java
index 8bb4d21..b9dc0dd 100644
--- a/core/java/android/view/contentcapture/ContentCaptureContext.java
+++ b/core/java/android/view/contentcapture/ContentCaptureContext.java
@@ -24,7 +24,6 @@
 import android.content.ComponentName;
 import android.content.Context;
 import android.content.LocusId;
-import android.net.Uri;
 import android.os.Bundle;
 import android.os.Parcel;
 import android.os.Parcelable;
@@ -212,10 +211,11 @@
     }
 
     /**
-     * Helper that creates a {@link ContentCaptureContext} associated with the given {@code uri}.
+     * Helper that creates a {@link ContentCaptureContext} associated with the given {@code id}.
      */
-    public static ContentCaptureContext forLocusId(@NonNull Uri uri) {
-        return new Builder(new LocusId(uri)).build();
+    @NonNull
+    public static ContentCaptureContext forLocusId(@NonNull String id) {
+        return new Builder(new LocusId(id)).build();
     }
 
     /**
@@ -269,6 +269,7 @@
          *
          * @return the built {@code ContentCaptureContext}
          */
+        @NonNull
         public ContentCaptureContext build() {
             throwIfDestroyed();
             mDestroyed = true;
@@ -351,10 +352,11 @@
         }
     }
 
-    public static final Parcelable.Creator<ContentCaptureContext> CREATOR =
+    public static final @android.annotation.NonNull Parcelable.Creator<ContentCaptureContext> CREATOR =
             new Parcelable.Creator<ContentCaptureContext>() {
 
         @Override
+        @NonNull
         public ContentCaptureContext createFromParcel(Parcel parcel) {
             final boolean hasClientContext = parcel.readInt() == 1;
 
@@ -383,6 +385,7 @@
         }
 
         @Override
+        @NonNull
         public ContentCaptureContext[] newArray(int size) {
             return new ContentCaptureContext[size];
         }
diff --git a/core/java/android/view/contentcapture/ContentCaptureEvent.java b/core/java/android/view/contentcapture/ContentCaptureEvent.java
index 2585b74..67d3629 100644
--- a/core/java/android/view/contentcapture/ContentCaptureEvent.java
+++ b/core/java/android/view/contentcapture/ContentCaptureEvent.java
@@ -383,10 +383,11 @@
         }
     }
 
-    public static final Parcelable.Creator<ContentCaptureEvent> CREATOR =
+    public static final @android.annotation.NonNull Parcelable.Creator<ContentCaptureEvent> CREATOR =
             new Parcelable.Creator<ContentCaptureEvent>() {
 
         @Override
+        @NonNull
         public ContentCaptureEvent createFromParcel(Parcel parcel) {
             final String sessionId = parcel.readString();
             final int type = parcel.readInt();
@@ -415,6 +416,7 @@
         }
 
         @Override
+        @NonNull
         public ContentCaptureEvent[] newArray(int size) {
             return new ContentCaptureEvent[size];
         }
diff --git a/core/java/android/view/contentcapture/ContentCaptureHelper.java b/core/java/android/view/contentcapture/ContentCaptureHelper.java
index 6e84ff0..6bc3829 100644
--- a/core/java/android/view/contentcapture/ContentCaptureHelper.java
+++ b/core/java/android/view/contentcapture/ContentCaptureHelper.java
@@ -20,7 +20,6 @@
 import static android.view.contentcapture.ContentCaptureManager.LOGGING_LEVEL_OFF;
 import static android.view.contentcapture.ContentCaptureManager.LOGGING_LEVEL_VERBOSE;
 
-import android.annotation.NonNull;
 import android.annotation.Nullable;
 import android.os.Build;
 import android.provider.DeviceConfig;
@@ -48,21 +47,6 @@
     }
 
     /**
-     * Gets the value of a device config property from the Content Capture namespace.
-     */
-    public static int getIntDeviceConfigProperty(@NonNull String key, int defaultValue) {
-        final String value = DeviceConfig.getProperty(DeviceConfig.NAMESPACE_CONTENT_CAPTURE, key);
-        if (value == null) return defaultValue;
-
-        try {
-            return Integer.parseInt(value);
-        } catch (Exception e) {
-            Log.w(TAG, "error parsing value (" + value + ") of property " + key + ": " + e);
-            return defaultValue;
-        }
-    }
-
-    /**
      * Gets the default logging level for the device.
      */
     @LoggingLevel
@@ -75,8 +59,8 @@
      */
     public static void setLoggingLevel() {
         final int defaultLevel = getDefaultLoggingLevel();
-        final int level = getIntDeviceConfigProperty(DEVICE_CONFIG_PROPERTY_LOGGING_LEVEL,
-                defaultLevel);
+        final int level = DeviceConfig.getInt(DeviceConfig.NAMESPACE_CONTENT_CAPTURE,
+                DEVICE_CONFIG_PROPERTY_LOGGING_LEVEL, defaultLevel);
         setLoggingLevel(level);
     }
 
diff --git a/core/java/android/view/contentcapture/ContentCaptureManager.java b/core/java/android/view/contentcapture/ContentCaptureManager.java
index 885bd2a..a3e6549 100644
--- a/core/java/android/view/contentcapture/ContentCaptureManager.java
+++ b/core/java/android/view/contentcapture/ContentCaptureManager.java
@@ -193,6 +193,15 @@
     private MainContentCaptureSession mMainSession;
 
     /** @hide */
+    public interface ContentCaptureClient {
+        /**
+         * Gets the component name of the client.
+         */
+        @NonNull
+        ComponentName contentCaptureClientGetComponentName();
+    }
+
+    /** @hide */
     public ContentCaptureManager(@NonNull Context context,
             @NonNull IContentCaptureManager service, @NonNull ContentCaptureOptions options) {
         mContext = Preconditions.checkNotNull(context, "context cannot be null");
diff --git a/core/java/android/view/contentcapture/ContentCaptureSession.java b/core/java/android/view/contentcapture/ContentCaptureSession.java
index ab8f346..1f0971e 100644
--- a/core/java/android/view/contentcapture/ContentCaptureSession.java
+++ b/core/java/android/view/contentcapture/ContentCaptureSession.java
@@ -121,11 +121,11 @@
     public static final int STATE_INTERNAL_ERROR = 0x100;
 
     /**
-     * Session is disabled because service didn't whitelist package.
+     * Session is disabled because service didn't whitelist package or activity.
      *
      * @hide
      */
-    public static final int STATE_PACKAGE_NOT_WHITELISTED = 0x200;
+    public static final int STATE_NOT_WHITELISTED = 0x200;
 
     private static final int INITIAL_CHILDREN_CAPACITY = 5;
 
@@ -208,6 +208,7 @@
     /**
      * Gets the id used to identify this session.
      */
+    @NonNull
     public final ContentCaptureSessionId getContentCaptureSessionId() {
         if (mContentCaptureSessionId == null) {
             mContentCaptureSessionId = new ContentCaptureSessionId(mId);
diff --git a/core/java/android/view/contentcapture/ContentCaptureSessionId.java b/core/java/android/view/contentcapture/ContentCaptureSessionId.java
index d7f9fcc..e7c350a 100644
--- a/core/java/android/view/contentcapture/ContentCaptureSessionId.java
+++ b/core/java/android/view/contentcapture/ContentCaptureSessionId.java
@@ -96,15 +96,17 @@
         parcel.writeString(mValue);
     }
 
-    public static final Parcelable.Creator<ContentCaptureSessionId> CREATOR =
+    public static final @android.annotation.NonNull Parcelable.Creator<ContentCaptureSessionId> CREATOR =
             new Parcelable.Creator<ContentCaptureSessionId>() {
 
         @Override
+        @NonNull
         public ContentCaptureSessionId createFromParcel(Parcel parcel) {
             return new ContentCaptureSessionId(parcel.readString());
         }
 
         @Override
+        @NonNull
         public ContentCaptureSessionId[] newArray(int size) {
             return new ContentCaptureSessionId[size];
         }
diff --git a/core/java/android/view/contentcapture/UserDataRemovalRequest.java b/core/java/android/view/contentcapture/UserDataRemovalRequest.java
index 7d66af9..3e1e4ab 100644
--- a/core/java/android/view/contentcapture/UserDataRemovalRequest.java
+++ b/core/java/android/view/contentcapture/UserDataRemovalRequest.java
@@ -15,6 +15,7 @@
  */
 package android.view.contentcapture;
 
+import android.annotation.IntDef;
 import android.annotation.NonNull;
 import android.app.ActivityThread;
 import android.content.LocusId;
@@ -24,6 +25,8 @@
 
 import com.android.internal.util.Preconditions;
 
+import java.lang.annotation.Retention;
+import java.lang.annotation.RetentionPolicy;
 import java.util.ArrayList;
 import java.util.List;
 
@@ -33,6 +36,19 @@
  */
 public final class UserDataRemovalRequest implements Parcelable {
 
+    /**
+     * When set, service should use the {@link LocusId#getId()} as prefix for the data to be
+     * removed.
+     */
+    public static final int FLAG_IS_PREFIX = 0x1;
+
+    /** @hide */
+    @IntDef(prefix = { "FLAG" }, flag = true, value = {
+            FLAG_IS_PREFIX
+    })
+    @Retention(RetentionPolicy.SOURCE)
+    @interface Flags {}
+
     private final String mPackageName;
 
     private final boolean mForEverything;
@@ -46,7 +62,7 @@
             mLocusIdRequests = new ArrayList<>(size);
             for (int i = 0; i < size; i++) {
                 mLocusIdRequests.add(new LocusIdRequest(builder.mLocusIds.get(i),
-                        builder.mRecursive.get(i) == 1));
+                        builder.mFlags.get(i)));
             }
         }
     }
@@ -59,7 +75,7 @@
             mLocusIdRequests = new ArrayList<>(size);
             for (int i = 0; i < size; i++) {
                 mLocusIdRequests.add(new LocusIdRequest((LocusId) parcel.readValue(null),
-                        parcel.readBoolean()));
+                        parcel.readInt()));
             }
         }
     }
@@ -94,7 +110,7 @@
 
         private boolean mForEverything;
         private ArrayList<LocusId> mLocusIds;
-        private IntArray mRecursive;
+        private IntArray mFlags;
 
         private boolean mDestroyed;
 
@@ -116,23 +132,24 @@
          * Request service to remove data associated with a given {@link LocusId}.
          *
          * @param locusId the {@link LocusId} being requested to be removed.
-         * @param recursive whether it should remove the data associated with just the
-         * {@code LocusId} or its tree of descendants.
+         * @param flags either {@link UserDataRemovalRequest#FLAG_IS_PREFIX} or {@code 0}
          *
          * @return this builder
          */
-        public Builder addLocusId(@NonNull LocusId locusId, boolean recursive) {
+        @NonNull
+        public Builder addLocusId(@NonNull LocusId locusId, @Flags int flags) {
             throwIfDestroyed();
             Preconditions.checkState(!mForEverything, "Already is for everything");
             Preconditions.checkNotNull(locusId);
+            // felipeal: check flags
 
             if (mLocusIds == null) {
                 mLocusIds = new ArrayList<>();
-                mRecursive = new IntArray();
+                mFlags = new IntArray();
             }
 
             mLocusIds.add(locusId);
-            mRecursive.add(recursive ? 1 : 0);
+            mFlags.add(flags);
             return this;
         }
 
@@ -143,7 +160,8 @@
         public UserDataRemovalRequest build() {
             throwIfDestroyed();
 
-            Preconditions.checkState(mForEverything || mLocusIds != null);
+            Preconditions.checkState(mForEverything || mLocusIds != null,
+                    "must call either #forEverything() or add one #addLocusId()");
 
             mDestroyed = true;
             return new UserDataRemovalRequest(this);
@@ -169,20 +187,22 @@
             for (int i = 0; i < size; i++) {
                 final LocusIdRequest request = mLocusIdRequests.get(i);
                 parcel.writeValue(request.getLocusId());
-                parcel.writeBoolean(request.isRecursive());
+                parcel.writeInt(request.getFlags());
             }
         }
     }
 
-    public static final Parcelable.Creator<UserDataRemovalRequest> CREATOR =
+    public static final @android.annotation.NonNull Parcelable.Creator<UserDataRemovalRequest> CREATOR =
             new Parcelable.Creator<UserDataRemovalRequest>() {
 
         @Override
+        @NonNull
         public UserDataRemovalRequest createFromParcel(Parcel parcel) {
             return new UserDataRemovalRequest(parcel);
         }
 
         @Override
+        @NonNull
         public UserDataRemovalRequest[] newArray(int size) {
             return new UserDataRemovalRequest[size];
         }
@@ -193,11 +213,11 @@
      */
     public final class LocusIdRequest {
         private final @NonNull LocusId mLocusId;
-        private final boolean mRecursive;
+        private final @Flags int mFlags;
 
-        private LocusIdRequest(@NonNull LocusId locusId, boolean recursive) {
+        private LocusIdRequest(@NonNull LocusId locusId, @Flags int flags) {
             this.mLocusId = locusId;
-            this.mRecursive = recursive;
+            this.mFlags = flags;
         }
 
         /**
@@ -209,12 +229,13 @@
         }
 
         /**
-         * Checks whether the request is to remove just the data associated with the {@link LocusId}
-         *  per se, or also its descendants.
+         * Gets the flags associates with request.
+         *
+         * @return either {@link UserDataRemovalRequest#FLAG_IS_PREFIX} or {@code 0}.
          */
         @NonNull
-        public boolean isRecursive() {
-            return mRecursive;
+        public @Flags int getFlags() {
+            return mFlags;
         }
     }
 }
diff --git a/core/java/android/view/inputmethod/CompletionInfo.java b/core/java/android/view/inputmethod/CompletionInfo.java
index 70b8059..eee8a62 100644
--- a/core/java/android/view/inputmethod/CompletionInfo.java
+++ b/core/java/android/view/inputmethod/CompletionInfo.java
@@ -153,7 +153,7 @@
     /**
      * Used to make this class parcelable.
      */
-    public static final Parcelable.Creator<CompletionInfo> CREATOR
+    public static final @android.annotation.NonNull Parcelable.Creator<CompletionInfo> CREATOR
             = new Parcelable.Creator<CompletionInfo>() {
         public CompletionInfo createFromParcel(Parcel source) {
             return new CompletionInfo(source);
diff --git a/core/java/android/view/inputmethod/CorrectionInfo.java b/core/java/android/view/inputmethod/CorrectionInfo.java
index a43dfe8..6db5784 100644
--- a/core/java/android/view/inputmethod/CorrectionInfo.java
+++ b/core/java/android/view/inputmethod/CorrectionInfo.java
@@ -88,7 +88,7 @@
     /**
      * Used to make this class parcelable.
      */
-    public static final Parcelable.Creator<CorrectionInfo> CREATOR =
+    public static final @android.annotation.NonNull Parcelable.Creator<CorrectionInfo> CREATOR =
             new Parcelable.Creator<CorrectionInfo>() {
                 public CorrectionInfo createFromParcel(Parcel source) {
                     return new CorrectionInfo(source);
diff --git a/core/java/android/view/inputmethod/CursorAnchorInfo.java b/core/java/android/view/inputmethod/CursorAnchorInfo.java
index 24739bf..ee5b3ec 100644
--- a/core/java/android/view/inputmethod/CursorAnchorInfo.java
+++ b/core/java/android/view/inputmethod/CursorAnchorInfo.java
@@ -559,7 +559,7 @@
     /**
      * Used to make this class parcelable.
      */
-    public static final Parcelable.Creator<CursorAnchorInfo> CREATOR
+    public static final @android.annotation.NonNull Parcelable.Creator<CursorAnchorInfo> CREATOR
             = new Parcelable.Creator<CursorAnchorInfo>() {
         @Override
         public CursorAnchorInfo createFromParcel(Parcel source) {
diff --git a/core/java/android/view/inputmethod/EditorInfo.java b/core/java/android/view/inputmethod/EditorInfo.java
index 8e7b0db..e1a9898 100644
--- a/core/java/android/view/inputmethod/EditorInfo.java
+++ b/core/java/android/view/inputmethod/EditorInfo.java
@@ -585,7 +585,7 @@
     /**
      * Used to make this class parcelable.
      */
-    public static final Parcelable.Creator<EditorInfo> CREATOR =
+    public static final @android.annotation.NonNull Parcelable.Creator<EditorInfo> CREATOR =
             new Parcelable.Creator<EditorInfo>() {
                 public EditorInfo createFromParcel(Parcel source) {
                     EditorInfo res = new EditorInfo();
diff --git a/core/java/android/view/inputmethod/ExtractedText.java b/core/java/android/view/inputmethod/ExtractedText.java
index 1eb300e..159d2aa 100644
--- a/core/java/android/view/inputmethod/ExtractedText.java
+++ b/core/java/android/view/inputmethod/ExtractedText.java
@@ -115,7 +115,7 @@
     /**
      * Used to make this class parcelable.
      */
-    public static final Parcelable.Creator<ExtractedText> CREATOR
+    public static final @android.annotation.NonNull Parcelable.Creator<ExtractedText> CREATOR
             = new Parcelable.Creator<ExtractedText>() {
                 public ExtractedText createFromParcel(Parcel source) {
                     ExtractedText res = new ExtractedText();
diff --git a/core/java/android/view/inputmethod/ExtractedTextRequest.java b/core/java/android/view/inputmethod/ExtractedTextRequest.java
index bf0bef3..e442185 100644
--- a/core/java/android/view/inputmethod/ExtractedTextRequest.java
+++ b/core/java/android/view/inputmethod/ExtractedTextRequest.java
@@ -63,7 +63,7 @@
     /**
      * Used to make this class parcelable.
      */
-    public static final Parcelable.Creator<ExtractedTextRequest> CREATOR
+    public static final @android.annotation.NonNull Parcelable.Creator<ExtractedTextRequest> CREATOR
             = new Parcelable.Creator<ExtractedTextRequest>() {
         public ExtractedTextRequest createFromParcel(Parcel source) {
             ExtractedTextRequest res = new ExtractedTextRequest();
diff --git a/core/java/android/view/inputmethod/InputBinding.java b/core/java/android/view/inputmethod/InputBinding.java
index bcd459e..2bfeb5a 100644
--- a/core/java/android/view/inputmethod/InputBinding.java
+++ b/core/java/android/view/inputmethod/InputBinding.java
@@ -135,7 +135,7 @@
     /**
      * Used to make this class parcelable.
      */
-    public static final Parcelable.Creator<InputBinding> CREATOR = new Parcelable.Creator<InputBinding>() {
+    public static final @android.annotation.NonNull Parcelable.Creator<InputBinding> CREATOR = new Parcelable.Creator<InputBinding>() {
         public InputBinding createFromParcel(Parcel source) {
             return new InputBinding(source);
         }
diff --git a/core/java/android/view/inputmethod/InputContentInfo.java b/core/java/android/view/inputmethod/InputContentInfo.java
index 0d0fea6..9aa410f 100644
--- a/core/java/android/view/inputmethod/InputContentInfo.java
+++ b/core/java/android/view/inputmethod/InputContentInfo.java
@@ -265,7 +265,7 @@
     /**
      * Used to make this class parcelable.
      */
-    public static final Parcelable.Creator<InputContentInfo> CREATOR
+    public static final @android.annotation.NonNull Parcelable.Creator<InputContentInfo> CREATOR
             = new Parcelable.Creator<InputContentInfo>() {
         @Override
         public InputContentInfo createFromParcel(Parcel source) {
diff --git a/core/java/android/view/inputmethod/InputMethodInfo.java b/core/java/android/view/inputmethod/InputMethodInfo.java
index 04028ae..fe07fee 100644
--- a/core/java/android/view/inputmethod/InputMethodInfo.java
+++ b/core/java/android/view/inputmethod/InputMethodInfo.java
@@ -548,7 +548,7 @@
     /**
      * Used to make this class parcelable.
      */
-    public static final Parcelable.Creator<InputMethodInfo> CREATOR
+    public static final @android.annotation.NonNull Parcelable.Creator<InputMethodInfo> CREATOR
             = new Parcelable.Creator<InputMethodInfo>() {
         @Override
         public InputMethodInfo createFromParcel(Parcel source) {
diff --git a/core/java/android/view/inputmethod/InputMethodSubtype.java b/core/java/android/view/inputmethod/InputMethodSubtype.java
index 14c879e..5989847 100644
--- a/core/java/android/view/inputmethod/InputMethodSubtype.java
+++ b/core/java/android/view/inputmethod/InputMethodSubtype.java
@@ -636,7 +636,7 @@
         dest.writeInt(mIsAsciiCapable ? 1 : 0);
     }
 
-    public static final Parcelable.Creator<InputMethodSubtype> CREATOR
+    public static final @android.annotation.NonNull Parcelable.Creator<InputMethodSubtype> CREATOR
             = new Parcelable.Creator<InputMethodSubtype>() {
         @Override
         public InputMethodSubtype createFromParcel(Parcel source) {
diff --git a/core/java/android/view/inputmethod/SparseRectFArray.java b/core/java/android/view/inputmethod/SparseRectFArray.java
index 484fe46..596ea86 100644
--- a/core/java/android/view/inputmethod/SparseRectFArray.java
+++ b/core/java/android/view/inputmethod/SparseRectFArray.java
@@ -292,7 +292,7 @@
     /**
      * Used to make this class parcelable.
      */
-    public static final Parcelable.Creator<SparseRectFArray> CREATOR =
+    public static final @android.annotation.NonNull Parcelable.Creator<SparseRectFArray> CREATOR =
             new Parcelable.Creator<SparseRectFArray>() {
                 @Override
                 public SparseRectFArray createFromParcel(Parcel source) {
diff --git a/core/java/android/view/inspector/InspectableProperty.java b/core/java/android/view/inspector/InspectableProperty.java
index f859521..97ede86 100644
--- a/core/java/android/view/inspector/InspectableProperty.java
+++ b/core/java/android/view/inspector/InspectableProperty.java
@@ -16,6 +16,7 @@
 
 package android.view.inspector;
 
+import static java.lang.annotation.ElementType.FIELD;
 import static java.lang.annotation.ElementType.METHOD;
 import static java.lang.annotation.ElementType.TYPE;
 import static java.lang.annotation.RetentionPolicy.SOURCE;
@@ -39,7 +40,7 @@
  * @see InspectionCompanion#readProperties(Object, PropertyReader)
  * @hide
  */
-@Target({METHOD})
+@Target({METHOD, FIELD})
 @Retention(SOURCE)
 @TestApi
 public @interface InspectableProperty {
@@ -232,6 +233,17 @@
          * @hide
          */
         @TestApi
-        GRAVITY
+        GRAVITY,
+
+        /**
+         * Value is a resource ID
+         *
+         * This type is inferred from the presence of a resource ID annotation such as
+         * {@link android.annotation.AnyRes}.
+         *
+         * @hide
+         */
+        @TestApi
+        RESOURCE_ID
     }
 }
diff --git a/core/java/android/view/inspector/PropertyMapper.java b/core/java/android/view/inspector/PropertyMapper.java
index 00b18d1..54d99df 100644
--- a/core/java/android/view/inspector/PropertyMapper.java
+++ b/core/java/android/view/inspector/PropertyMapper.java
@@ -157,6 +157,16 @@
             @NonNull IntEnumMapping mapping);
 
     /**
+     * Map a string name to an integer ID for an attribute that contains resource IDs.
+     *
+     * @param name The name of the property
+     * @param attributeId If the property is from an XML attribute, the resource ID of the property
+     * @return An integer ID for the property
+     * @throws PropertyConflictException If the property name is already mapped as another type.
+     */
+    int mapResourceId(@NonNull String name, @AttrRes int attributeId);
+
+    /**
      * Map a string name to an integer ID for a flag set packed into an int property.
      *
      * @param name The name of the property
diff --git a/core/java/android/view/inspector/PropertyReader.java b/core/java/android/view/inspector/PropertyReader.java
index a8b7ecc..b5020ce 100644
--- a/core/java/android/view/inspector/PropertyReader.java
+++ b/core/java/android/view/inspector/PropertyReader.java
@@ -16,6 +16,7 @@
 
 package android.view.inspector;
 
+import android.annotation.AnyRes;
 import android.annotation.ColorInt;
 import android.annotation.ColorLong;
 import android.annotation.NonNull;
@@ -150,7 +151,7 @@
     void readColor(int id, @Nullable Color value);
 
     /**
-     * Read {@link android.view.Gravity} packed into an primitive {int}.
+     * Read {@link android.view.Gravity} packed into an primitive {@code int}.
      *
      * @param id Identifier of the property from a {@link PropertyMapper}
      * @param value Value of the property
@@ -159,7 +160,7 @@
     void readGravity(int id, int value);
 
     /**
-     * Read an enumeration packed into a primitive {int}.
+     * Read an enumeration packed into a primitive {@code int}.
      *
      * @param id Identifier of the property from a {@link PropertyMapper}
      * @param value Value of the property
@@ -168,7 +169,7 @@
     void readIntEnum(int id, int value);
 
     /**
-     * Read a flag packed into a primitive {int}.
+     * Read a flag packed into a primitive {@code int}.
      *
      * @param id Identifier of the property from a {@link PropertyMapper}
      * @param value Value of the property
@@ -177,6 +178,15 @@
     void readIntFlag(int id, int value);
 
     /**
+     * Read an integer that contains a resource ID.
+     *
+     * @param id Identifier of the property from a {@link PropertyMapper}
+     * @param value Value of the property
+     * @throws PropertyTypeMismatchException If the property ID is not mapped as a resource ID.
+     */
+    void readResourceId(int id, @AnyRes int value);
+
+    /**
      * Thrown if a client calls a typed read method for a property of a different type.
      */
     class PropertyTypeMismatchException extends RuntimeException {
diff --git a/core/java/android/view/inspector/GeneratedInspectionCompanionProvider.java b/core/java/android/view/inspector/StaticInspectionCompanionProvider.java
similarity index 76%
rename from core/java/android/view/inspector/GeneratedInspectionCompanionProvider.java
rename to core/java/android/view/inspector/StaticInspectionCompanionProvider.java
index d4b7e85..42a892d 100644
--- a/core/java/android/view/inspector/GeneratedInspectionCompanionProvider.java
+++ b/core/java/android/view/inspector/StaticInspectionCompanionProvider.java
@@ -20,15 +20,15 @@
 import android.annotation.Nullable;
 
 /**
- * An inspection companion provider that loads pre-generated inspection companions
+ * An inspection companion provider that finds companions as inner classes or generated code.
  *
  * @see android.processor.view.inspector.PlatformInspectableProcessor
  */
-public class GeneratedInspectionCompanionProvider implements InspectionCompanionProvider {
+public class StaticInspectionCompanionProvider implements InspectionCompanionProvider {
     /**
-     * The suffix used for the generated class
+     * The suffix used for the generated classes and inner classes
      */
-    private static final String COMPANION_SUFFIX = "$$InspectionCompanion";
+    private static final String COMPANION_SUFFIX = "$InspectionCompanion";
 
     @Override
     @Nullable
@@ -39,7 +39,12 @@
         try {
             final Class<InspectionCompanion<T>> companionClass =
                     (Class<InspectionCompanion<T>>) cls.getClassLoader().loadClass(companionName);
-            return companionClass.newInstance();
+
+            if (InspectionCompanion.class.isAssignableFrom(companionClass)) {
+                return companionClass.newInstance();
+            } else {
+                return null;
+            }
         } catch (ClassNotFoundException e) {
             return null;
         } catch (IllegalAccessException e) {
diff --git a/core/java/android/view/textclassifier/ConfigParser.java b/core/java/android/view/textclassifier/ConfigParser.java
new file mode 100644
index 0000000..8e0bdf9
--- /dev/null
+++ b/core/java/android/view/textclassifier/ConfigParser.java
@@ -0,0 +1,86 @@
+/*
+ * Copyright (C) 2019 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package android.view.textclassifier;
+
+import android.annotation.Nullable;
+import android.provider.DeviceConfig;
+import android.util.KeyValueListParser;
+
+import com.android.internal.annotations.VisibleForTesting;
+
+/**
+ * Retrieves settings from {@link DeviceConfig} and {@link android.provider.Settings}.
+ * It will try DeviceConfig first and then Settings.
+ *
+ * @hide
+ */
+@VisibleForTesting
+public final class ConfigParser {
+    private static final String TAG = "ConfigParser";
+
+    private final KeyValueListParser mParser;
+
+    public ConfigParser(@Nullable String textClassifierConstants) {
+        final KeyValueListParser parser = new KeyValueListParser(',');
+        try {
+            parser.setString(textClassifierConstants);
+        } catch (IllegalArgumentException e) {
+            // Failed to parse the settings string, log this and move on with defaults.
+            Log.w(TAG, "Bad text_classifier_constants: " + textClassifierConstants);
+        }
+        mParser = parser;
+    }
+
+    /**
+     * Reads a boolean flag.
+     */
+    public boolean getBoolean(String key, boolean defaultValue) {
+        return DeviceConfig.getBoolean(
+                DeviceConfig.NAMESPACE_TEXTCLASSIFIER,
+                key,
+                mParser.getBoolean(key, defaultValue));
+    }
+
+    /**
+     * Reads an integer flag.
+     */
+    public int getInt(String key, int defaultValue) {
+        return DeviceConfig.getInt(
+                DeviceConfig.NAMESPACE_TEXTCLASSIFIER,
+                key,
+                mParser.getInt(key, defaultValue));
+    }
+
+    /**
+     * Reads a float flag.
+     */
+    public float getFloat(String key, float defaultValue) {
+        return DeviceConfig.getFloat(
+                DeviceConfig.NAMESPACE_TEXTCLASSIFIER,
+                key,
+                mParser.getFloat(key, defaultValue));
+    }
+
+    /**
+     * Reads a string flag.
+     */
+    public String getString(String key, String defaultValue) {
+        return DeviceConfig.getString(
+                DeviceConfig.NAMESPACE_TEXTCLASSIFIER,
+                key,
+                mParser.getString(key, defaultValue));
+    }
+}
diff --git a/core/java/android/view/textclassifier/ConversationAction.java b/core/java/android/view/textclassifier/ConversationAction.java
index ae6a645..2b952a3 100644
--- a/core/java/android/view/textclassifier/ConversationAction.java
+++ b/core/java/android/view/textclassifier/ConversationAction.java
@@ -95,7 +95,7 @@
     /** @hide **/
     public static final String TYPE_ADD_CONTACT = "add_contact";
 
-    public static final Creator<ConversationAction> CREATOR =
+    public static final @android.annotation.NonNull Creator<ConversationAction> CREATOR =
             new Creator<ConversationAction>() {
                 @Override
                 public ConversationAction createFromParcel(Parcel in) {
diff --git a/core/java/android/view/textclassifier/ConversationActions.java b/core/java/android/view/textclassifier/ConversationActions.java
index cf31445..dc75212 100644
--- a/core/java/android/view/textclassifier/ConversationActions.java
+++ b/core/java/android/view/textclassifier/ConversationActions.java
@@ -44,7 +44,7 @@
  */
 public final class ConversationActions implements Parcelable {
 
-    public static final Creator<ConversationActions> CREATOR =
+    public static final @android.annotation.NonNull Creator<ConversationActions> CREATOR =
             new Creator<ConversationActions>() {
                 @Override
                 public ConversationActions createFromParcel(Parcel in) {
@@ -109,6 +109,7 @@
          *
          * @see Builder#Builder(Person)
          */
+        @NonNull
         public static final Person PERSON_USER_SELF =
                 new Person.Builder()
                         .setKey("text-classifier-conversation-actions-user-self")
@@ -123,6 +124,7 @@
          *
          * @see Builder#Builder(Person)
          */
+        @NonNull
         public static final Person PERSON_USER_OTHERS =
                 new Person.Builder()
                         .setKey("text-classifier-conversation-actions-user-others")
@@ -175,7 +177,7 @@
             return 0;
         }
 
-        public static final Creator<Message> CREATOR =
+        public static final @android.annotation.NonNull Creator<Message> CREATOR =
                 new Creator<Message>() {
                     @Override
                     public Message createFromParcel(Parcel in) {
@@ -316,19 +318,15 @@
         private final List<String> mHints;
         @Nullable
         private String mCallingPackageName;
-        @Nullable
-        private final String mConversationId;
 
         private Request(
                 @NonNull List<Message> conversation,
                 @NonNull TextClassifier.EntityConfig typeConfig,
                 int maxSuggestions,
-                String conversationId,
                 @Nullable @Hint List<String> hints) {
             mConversation = Preconditions.checkNotNull(conversation);
             mTypeConfig = Preconditions.checkNotNull(typeConfig);
             mMaxSuggestions = maxSuggestions;
-            mConversationId = conversationId;
             mHints = hints;
         }
 
@@ -337,7 +335,6 @@
             in.readParcelableList(conversation, null);
             TextClassifier.EntityConfig typeConfig = in.readParcelable(null);
             int maxSuggestions = in.readInt();
-            String conversationId = in.readString();
             List<String> hints = new ArrayList<>();
             in.readStringList(hints);
             String callingPackageName = in.readString();
@@ -346,7 +343,6 @@
                     conversation,
                     typeConfig,
                     maxSuggestions,
-                    conversationId,
                     hints);
             request.setCallingPackageName(callingPackageName);
             return request;
@@ -357,7 +353,6 @@
             parcel.writeParcelableList(mConversation, flags);
             parcel.writeParcelable(mTypeConfig, flags);
             parcel.writeInt(mMaxSuggestions);
-            parcel.writeString(mConversationId);
             parcel.writeStringList(mHints);
             parcel.writeString(mCallingPackageName);
         }
@@ -367,7 +362,7 @@
             return 0;
         }
 
-        public static final Creator<Request> CREATOR =
+        public static final @android.annotation.NonNull Creator<Request> CREATOR =
                 new Creator<Request>() {
                     @Override
                     public Request createFromParcel(Parcel in) {
@@ -401,16 +396,6 @@
             return mMaxSuggestions;
         }
 
-        /**
-         * Return an unique identifier of the conversation that is generating actions for. This
-         * identifier is unique within the calling package only, so use it with
-         * {@link #getCallingPackageName()}.
-         */
-        @Nullable
-        public String getConversationId() {
-            return mConversationId;
-        }
-
         /** Returns an immutable list of hints */
         @Nullable
         @Hint
@@ -446,8 +431,6 @@
             private TextClassifier.EntityConfig mTypeConfig;
             private int mMaxSuggestions = -1;
             @Nullable
-            private String mConversationId;
-            @Nullable
             @Hint
             private List<String> mHints;
 
@@ -465,6 +448,7 @@
              * Sets the hints to help text classifier to generate actions. It could be used to help
              * text classifier to infer what types of actions the caller may be interested in.
              */
+            @NonNull
             public Builder setHints(@Nullable @Hint List<String> hints) {
                 mHints = hints;
                 return this;
@@ -487,15 +471,6 @@
                 return this;
             }
 
-            /**
-             * Sets an unique identifier of the conversation that is generating actions for.
-             */
-            @NonNull
-            public Builder setConversationId(@Nullable String conversationId) {
-                mConversationId = conversationId;
-                return this;
-            }
-
             /** Builds the {@link Request} object. */
             @NonNull
             public Request build() {
@@ -505,7 +480,6 @@
                                 ? new TextClassifier.EntityConfig.Builder().build()
                                 : mTypeConfig,
                         mMaxSuggestions,
-                        mConversationId,
                         mHints == null
                                 ? Collections.emptyList()
                                 : Collections.unmodifiableList(mHints));
diff --git a/core/java/android/view/textclassifier/EntityConfidence.java b/core/java/android/view/textclassifier/EntityConfidence.java
index 69a59a5..3c51c38 100644
--- a/core/java/android/view/textclassifier/EntityConfidence.java
+++ b/core/java/android/view/textclassifier/EntityConfidence.java
@@ -108,7 +108,7 @@
         }
     }
 
-    public static final Parcelable.Creator<EntityConfidence> CREATOR =
+    public static final @android.annotation.NonNull Parcelable.Creator<EntityConfidence> CREATOR =
             new Parcelable.Creator<EntityConfidence>() {
                 @Override
                 public EntityConfidence createFromParcel(Parcel in) {
diff --git a/core/java/android/view/textclassifier/SelectionEvent.java b/core/java/android/view/textclassifier/SelectionEvent.java
index b073596..105cbcc 100644
--- a/core/java/android/view/textclassifier/SelectionEvent.java
+++ b/core/java/android/view/textclassifier/SelectionEvent.java
@@ -643,7 +643,7 @@
                 mSessionId, mStart, mEnd, mSmartStart, mSmartEnd);
     }
 
-    public static final Creator<SelectionEvent> CREATOR = new Creator<SelectionEvent>() {
+    public static final @android.annotation.NonNull Creator<SelectionEvent> CREATOR = new Creator<SelectionEvent>() {
         @Override
         public SelectionEvent createFromParcel(Parcel in) {
             return new SelectionEvent(in);
diff --git a/core/java/android/view/textclassifier/SystemTextClassifier.java b/core/java/android/view/textclassifier/SystemTextClassifier.java
index 8b370f5..8f8766e 100644
--- a/core/java/android/view/textclassifier/SystemTextClassifier.java
+++ b/core/java/android/view/textclassifier/SystemTextClassifier.java
@@ -20,15 +20,14 @@
 import android.annotation.Nullable;
 import android.annotation.WorkerThread;
 import android.content.Context;
+import android.os.Bundle;
 import android.os.Looper;
+import android.os.Parcelable;
 import android.os.RemoteException;
 import android.os.ServiceManager;
-import android.service.textclassifier.IConversationActionsCallback;
-import android.service.textclassifier.ITextClassificationCallback;
+import android.service.textclassifier.ITextClassifierCallback;
 import android.service.textclassifier.ITextClassifierService;
-import android.service.textclassifier.ITextLanguageCallback;
-import android.service.textclassifier.ITextLinksCallback;
-import android.service.textclassifier.ITextSelectionCallback;
+import android.service.textclassifier.TextClassifierService;
 
 import com.android.internal.annotations.VisibleForTesting;
 import com.android.internal.annotations.VisibleForTesting.Visibility;
@@ -73,9 +72,10 @@
         Utils.checkMainThread();
         try {
             request.setCallingPackageName(mPackageName);
-            final TextSelectionCallback callback = new TextSelectionCallback();
+            final BlockingCallback<TextSelection> callback =
+                    new BlockingCallback<>("textselection");
             mManagerService.onSuggestSelection(mSessionId, request, callback);
-            final TextSelection selection = callback.mReceiver.get();
+            final TextSelection selection = callback.get();
             if (selection != null) {
                 return selection;
             }
@@ -95,9 +95,10 @@
         Utils.checkMainThread();
         try {
             request.setCallingPackageName(mPackageName);
-            final TextClassificationCallback callback = new TextClassificationCallback();
+            final BlockingCallback<TextClassification> callback =
+                    new BlockingCallback<>("textclassification");
             mManagerService.onClassifyText(mSessionId, request, callback);
-            final TextClassification classification = callback.mReceiver.get();
+            final TextClassification classification = callback.get();
             if (classification != null) {
                 return classification;
             }
@@ -122,9 +123,10 @@
 
         try {
             request.setCallingPackageName(mPackageName);
-            final TextLinksCallback callback = new TextLinksCallback();
+            final BlockingCallback<TextLinks> callback =
+                    new BlockingCallback<>("textlinks");
             mManagerService.onGenerateLinks(mSessionId, request, callback);
-            final TextLinks links = callback.mReceiver.get();
+            final TextLinks links = callback.get();
             if (links != null) {
                 return links;
             }
@@ -165,9 +167,10 @@
 
         try {
             request.setCallingPackageName(mPackageName);
-            final TextLanguageCallback callback = new TextLanguageCallback();
+            final BlockingCallback<TextLanguage> callback =
+                    new BlockingCallback<>("textlanguage");
             mManagerService.onDetectLanguage(mSessionId, request, callback);
-            final TextLanguage textLanguage = callback.mReceiver.get();
+            final TextLanguage textLanguage = callback.get();
             if (textLanguage != null) {
                 return textLanguage;
             }
@@ -184,9 +187,10 @@
 
         try {
             request.setCallingPackageName(mPackageName);
-            final ConversationActionsCallback callback = new ConversationActionsCallback();
+            final BlockingCallback<ConversationActions> callback =
+                    new BlockingCallback<>("conversation-actions");
             mManagerService.onSuggestConversationActions(mSessionId, request, callback);
-            final ConversationActions conversationActions = callback.mReceiver.get();
+            final ConversationActions conversationActions = callback.get();
             if (conversationActions != null) {
                 return conversationActions;
             }
@@ -245,82 +249,28 @@
         }
     }
 
-    private static final class TextSelectionCallback extends ITextSelectionCallback.Stub {
+    private static final class BlockingCallback<T extends Parcelable>
+            extends ITextClassifierCallback.Stub {
+        private final ResponseReceiver<T> mReceiver;
 
-        final ResponseReceiver<TextSelection> mReceiver = new ResponseReceiver<>("textselection");
+        BlockingCallback(String name) {
+            mReceiver = new ResponseReceiver<>(name);
+        }
 
         @Override
-        public void onSuccess(TextSelection selection) {
-            mReceiver.onSuccess(selection);
+        public void onSuccess(Bundle result) {
+            mReceiver.onSuccess(TextClassifierService.getResponse(result));
         }
 
         @Override
         public void onFailure() {
             mReceiver.onFailure();
         }
-    }
 
-    private static final class TextClassificationCallback extends ITextClassificationCallback.Stub {
-
-        final ResponseReceiver<TextClassification> mReceiver =
-                new ResponseReceiver<>("textclassification");
-
-        @Override
-        public void onSuccess(TextClassification classification) {
-            mReceiver.onSuccess(classification);
+        public T get() {
+            return mReceiver.get();
         }
 
-        @Override
-        public void onFailure() {
-            mReceiver.onFailure();
-        }
-    }
-
-    private static final class TextLinksCallback extends ITextLinksCallback.Stub {
-
-        final ResponseReceiver<TextLinks> mReceiver = new ResponseReceiver<>("textlinks");
-
-        @Override
-        public void onSuccess(TextLinks links) {
-            mReceiver.onSuccess(links);
-        }
-
-        @Override
-        public void onFailure() {
-            mReceiver.onFailure();
-        }
-    }
-
-    private static final class TextLanguageCallback extends ITextLanguageCallback.Stub {
-
-        final ResponseReceiver<TextLanguage> mReceiver = new ResponseReceiver<>("textlanguage");
-
-        @Override
-        public void onSuccess(TextLanguage textLanguage) {
-            mReceiver.onSuccess(textLanguage);
-        }
-
-        @Override
-        public void onFailure() {
-            mReceiver.onFailure();
-        }
-    }
-
-    private static final class ConversationActionsCallback
-            extends IConversationActionsCallback.Stub {
-
-        final ResponseReceiver<ConversationActions> mReceiver =
-                new ResponseReceiver<>("conversationaction");
-
-        @Override
-        public void onSuccess(ConversationActions conversationActions) {
-            mReceiver.onSuccess(conversationActions);
-        }
-
-        @Override
-        public void onFailure() {
-            mReceiver.onFailure();
-        }
     }
 
     private static final class ResponseReceiver<T> {
diff --git a/core/java/android/view/textclassifier/TextClassification.java b/core/java/android/view/textclassifier/TextClassification.java
index 052ee95..034da01 100644
--- a/core/java/android/view/textclassifier/TextClassification.java
+++ b/core/java/android/view/textclassifier/TextClassification.java
@@ -756,7 +756,7 @@
             return request;
         }
 
-        public static final Parcelable.Creator<Request> CREATOR =
+        public static final @android.annotation.NonNull Parcelable.Creator<Request> CREATOR =
                 new Parcelable.Creator<Request>() {
                     @Override
                     public Request createFromParcel(Parcel in) {
@@ -785,7 +785,7 @@
         dest.writeBundle(mExtras);
     }
 
-    public static final Parcelable.Creator<TextClassification> CREATOR =
+    public static final @android.annotation.NonNull Parcelable.Creator<TextClassification> CREATOR =
             new Parcelable.Creator<TextClassification>() {
                 @Override
                 public TextClassification createFromParcel(Parcel in) {
diff --git a/core/java/android/view/textclassifier/TextClassificationConstants.java b/core/java/android/view/textclassifier/TextClassificationConstants.java
index 2ef8d04..125b0d3 100644
--- a/core/java/android/view/textclassifier/TextClassificationConstants.java
+++ b/core/java/android/view/textclassifier/TextClassificationConstants.java
@@ -17,8 +17,6 @@
 package android.view.textclassifier;
 
 import android.annotation.Nullable;
-import android.util.KeyValueListParser;
-import android.util.Slog;
 
 import com.android.internal.util.IndentingPrintWriter;
 
@@ -32,22 +30,24 @@
  * This is encoded as a key=value list, separated by commas. Ex:
  *
  * <pre>
- * smart_linkify_enabled                    (boolean)
- * system_textclassifier_enabled            (boolean)
- * model_dark_launch_enabled                (boolean)
- * smart_selection_enabled                  (boolean)
- * smart_text_share_enabled                 (boolean)
- * smart_linkify_enabled                    (boolean)
- * smart_select_animation_enabled           (boolean)
- * suggest_selection_max_range_length       (int)
- * classify_text_max_range_length           (int)
- * generate_links_max_text_length           (int)
- * generate_links_log_sample_rate           (int)
- * entity_list_default                      (String[])
- * entity_list_not_editable                 (String[])
- * entity_list_editable                     (String[])
- * lang_id_threshold_override               (float)
- * template_intent_factory_enabled          (boolean)
+ * smart_linkify_enabled                            (boolean)
+ * system_textclassifier_enabled                    (boolean)
+ * model_dark_launch_enabled                        (boolean)
+ * smart_selection_enabled                          (boolean)
+ * smart_text_share_enabled                         (boolean)
+ * smart_linkify_enabled                            (boolean)
+ * smart_select_animation_enabled                   (boolean)
+ * suggest_selection_max_range_length               (int)
+ * classify_text_max_range_length                   (int)
+ * generate_links_max_text_length                   (int)
+ * generate_links_log_sample_rate                   (int)
+ * entity_list_default                              (String[])
+ * entity_list_not_editable                         (String[])
+ * entity_list_editable                             (String[])
+ * in_app_conversation_action_types_default         (String[])
+ * notification_conversation_action_types_default   (String[])
+ * lang_id_threshold_override                       (float)
+ * template_intent_factory_enabled                  (boolean)
  * </pre>
  *
  * <p>
@@ -61,43 +61,90 @@
  * @hide
  */
 public final class TextClassificationConstants {
-
     private static final String LOG_TAG = "TextClassificationConstants";
 
-    private static final String LOCAL_TEXT_CLASSIFIER_ENABLED =
-            "local_textclassifier_enabled";
-    private static final String SYSTEM_TEXT_CLASSIFIER_ENABLED =
-            "system_textclassifier_enabled";
-    private static final String MODEL_DARK_LAUNCH_ENABLED =
-            "model_dark_launch_enabled";
-    private static final String SMART_SELECTION_ENABLED =
-            "smart_selection_enabled";
-    private static final String SMART_TEXT_SHARE_ENABLED =
-            "smart_text_share_enabled";
-    private static final String SMART_LINKIFY_ENABLED =
-            "smart_linkify_enabled";
+    /**
+     * Whether the smart linkify feature is enabled.
+     */
+    private static final String SMART_LINKIFY_ENABLED = "smart_linkify_enabled";
+    /**
+     * Whether SystemTextClassifier is enabled.
+     */
+    private static final String SYSTEM_TEXT_CLASSIFIER_ENABLED = "system_textclassifier_enabled";
+    /**
+     * Whether TextClassifierImpl is enabled.
+     */
+    private static final String LOCAL_TEXT_CLASSIFIER_ENABLED = "local_textclassifier_enabled";
+    /**
+     * Enable smart selection without a visible UI changes.
+     */
+    private static final String MODEL_DARK_LAUNCH_ENABLED = "model_dark_launch_enabled";
+
+    /**
+     * Whether the smart selection feature is enabled.
+     */
+    private static final String SMART_SELECTION_ENABLED = "smart_selection_enabled";
+    /**
+     * Whether the smart text share feature is enabled.
+     */
+    private static final String SMART_TEXT_SHARE_ENABLED = "smart_text_share_enabled";
+    /**
+     * Whether animation for smart selection is enabled.
+     */
     private static final String SMART_SELECT_ANIMATION_ENABLED =
             "smart_select_animation_enabled";
+    /**
+     * Max length of text that suggestSelection can accept.
+     */
     private static final String SUGGEST_SELECTION_MAX_RANGE_LENGTH =
             "suggest_selection_max_range_length";
-    private static final String CLASSIFY_TEXT_MAX_RANGE_LENGTH =
-            "classify_text_max_range_length";
-    private static final String GENERATE_LINKS_MAX_TEXT_LENGTH =
-            "generate_links_max_text_length";
+    /**
+     * Max length of text that classifyText can accept.
+     */
+    private static final String CLASSIFY_TEXT_MAX_RANGE_LENGTH = "classify_text_max_range_length";
+    /**
+     * Max length of text that generateLinks can accept.
+     */
+    private static final String GENERATE_LINKS_MAX_TEXT_LENGTH = "generate_links_max_text_length";
+    /**
+     * Sampling rate for generateLinks logging.
+     */
     private static final String GENERATE_LINKS_LOG_SAMPLE_RATE =
             "generate_links_log_sample_rate";
-    private static final String ENTITY_LIST_DEFAULT =
-            "entity_list_default";
-    private static final String ENTITY_LIST_NOT_EDITABLE =
-            "entity_list_not_editable";
-    private static final String ENTITY_LIST_EDITABLE =
-            "entity_list_editable";
+    /**
+     * A colon(:) separated string that specifies the default entities types for
+     * generateLinks when hint is not given.
+     */
+    private static final String ENTITY_LIST_DEFAULT = "entity_list_default";
+    /**
+     * A colon(:) separated string that specifies the default entities types for
+     * generateLinks when the text is in a not editable UI widget.
+     */
+    private static final String ENTITY_LIST_NOT_EDITABLE = "entity_list_not_editable";
+    /**
+     * A colon(:) separated string that specifies the default entities types for
+     * generateLinks when the text is in an editable UI widget.
+     */
+    private static final String ENTITY_LIST_EDITABLE = "entity_list_editable";
+    /**
+     * A colon(:) separated string that specifies the default action types for
+     * suggestConversationActions when the suggestions are used in an app.
+     */
     private static final String IN_APP_CONVERSATION_ACTION_TYPES_DEFAULT =
             "in_app_conversation_action_types_default";
+    /**
+     * A colon(:) separated string that specifies the default action types for
+     * suggestConversationActions when the suggestions are used in a notification.
+     */
     private static final String NOTIFICATION_CONVERSATION_ACTION_TYPES_DEFAULT =
             "notification_conversation_action_types_default";
-    private static final String LANG_ID_THRESHOLD_OVERRIDE =
-            "lang_id_threshold_override";
+    /**
+     * Threshold in classifyText to consider a text is in a foreign language.
+     */
+    private static final String LANG_ID_THRESHOLD_OVERRIDE = "lang_id_threshold_override";
+    /**
+     * Whether to enable {@link android.view.textclassifier.TemplateIntentFactory}.
+     */
     private static final String TEMPLATE_INTENT_FACTORY_ENABLED = "template_intent_factory_enabled";
 
     private static final boolean LOCAL_TEXT_CLASSIFIER_ENABLED_DEFAULT = true;
@@ -162,66 +209,77 @@
     private final boolean mTemplateIntentFactoryEnabled;
 
     private TextClassificationConstants(@Nullable String settings) {
-        final KeyValueListParser parser = new KeyValueListParser(',');
-        try {
-            parser.setString(settings);
-        } catch (IllegalArgumentException e) {
-            // Failed to parse the settings string, log this and move on with defaults.
-            Slog.e(LOG_TAG, "Bad TextClassifier settings: " + settings);
-        }
-        mSystemTextClassifierEnabled = parser.getBoolean(
-                SYSTEM_TEXT_CLASSIFIER_ENABLED,
-                SYSTEM_TEXT_CLASSIFIER_ENABLED_DEFAULT);
-        mLocalTextClassifierEnabled = parser.getBoolean(
-                LOCAL_TEXT_CLASSIFIER_ENABLED,
-                LOCAL_TEXT_CLASSIFIER_ENABLED_DEFAULT);
-        mModelDarkLaunchEnabled = parser.getBoolean(
-                MODEL_DARK_LAUNCH_ENABLED,
-                MODEL_DARK_LAUNCH_ENABLED_DEFAULT);
-        mSmartSelectionEnabled = parser.getBoolean(
-                SMART_SELECTION_ENABLED,
-                SMART_SELECTION_ENABLED_DEFAULT);
-        mSmartTextShareEnabled = parser.getBoolean(
-                SMART_TEXT_SHARE_ENABLED,
-                SMART_TEXT_SHARE_ENABLED_DEFAULT);
-        mSmartLinkifyEnabled = parser.getBoolean(
-                SMART_LINKIFY_ENABLED,
-                SMART_LINKIFY_ENABLED_DEFAULT);
-        mSmartSelectionAnimationEnabled = parser.getBoolean(
-                SMART_SELECT_ANIMATION_ENABLED,
-                SMART_SELECT_ANIMATION_ENABLED_DEFAULT);
-        mSuggestSelectionMaxRangeLength = parser.getInt(
-                SUGGEST_SELECTION_MAX_RANGE_LENGTH,
-                SUGGEST_SELECTION_MAX_RANGE_LENGTH_DEFAULT);
-        mClassifyTextMaxRangeLength = parser.getInt(
-                CLASSIFY_TEXT_MAX_RANGE_LENGTH,
-                CLASSIFY_TEXT_MAX_RANGE_LENGTH_DEFAULT);
-        mGenerateLinksMaxTextLength = parser.getInt(
-                GENERATE_LINKS_MAX_TEXT_LENGTH,
-                GENERATE_LINKS_MAX_TEXT_LENGTH_DEFAULT);
-        mGenerateLinksLogSampleRate = parser.getInt(
-                GENERATE_LINKS_LOG_SAMPLE_RATE,
-                GENERATE_LINKS_LOG_SAMPLE_RATE_DEFAULT);
-        mEntityListDefault = parseStringList(parser.getString(
+        ConfigParser configParser = new ConfigParser(settings);
+        mSystemTextClassifierEnabled =
+                configParser.getBoolean(
+                        SYSTEM_TEXT_CLASSIFIER_ENABLED,
+                        SYSTEM_TEXT_CLASSIFIER_ENABLED_DEFAULT);
+        mLocalTextClassifierEnabled =
+                configParser.getBoolean(
+                        LOCAL_TEXT_CLASSIFIER_ENABLED,
+                        LOCAL_TEXT_CLASSIFIER_ENABLED_DEFAULT);
+        mModelDarkLaunchEnabled =
+                configParser.getBoolean(
+                        MODEL_DARK_LAUNCH_ENABLED,
+                        MODEL_DARK_LAUNCH_ENABLED_DEFAULT);
+        mSmartSelectionEnabled =
+                configParser.getBoolean(
+                        SMART_SELECTION_ENABLED,
+                        SMART_SELECTION_ENABLED_DEFAULT);
+        mSmartTextShareEnabled =
+                configParser.getBoolean(
+                        SMART_TEXT_SHARE_ENABLED,
+                        SMART_TEXT_SHARE_ENABLED_DEFAULT);
+        mSmartLinkifyEnabled =
+                configParser.getBoolean(
+                        SMART_LINKIFY_ENABLED,
+                        SMART_LINKIFY_ENABLED_DEFAULT);
+        mSmartSelectionAnimationEnabled =
+                configParser.getBoolean(
+                        SMART_SELECT_ANIMATION_ENABLED,
+                        SMART_SELECT_ANIMATION_ENABLED_DEFAULT);
+        mSuggestSelectionMaxRangeLength =
+                configParser.getInt(
+                        SUGGEST_SELECTION_MAX_RANGE_LENGTH,
+                        SUGGEST_SELECTION_MAX_RANGE_LENGTH_DEFAULT);
+        mClassifyTextMaxRangeLength =
+                configParser.getInt(
+                        CLASSIFY_TEXT_MAX_RANGE_LENGTH,
+                        CLASSIFY_TEXT_MAX_RANGE_LENGTH_DEFAULT);
+        mGenerateLinksMaxTextLength =
+                configParser.getInt(
+                        GENERATE_LINKS_MAX_TEXT_LENGTH,
+                        GENERATE_LINKS_MAX_TEXT_LENGTH_DEFAULT);
+        mGenerateLinksLogSampleRate =
+                configParser.getInt(
+                        GENERATE_LINKS_LOG_SAMPLE_RATE,
+                        GENERATE_LINKS_LOG_SAMPLE_RATE_DEFAULT);
+        mEntityListDefault = parseStringList(configParser.getString(
                 ENTITY_LIST_DEFAULT,
                 ENTITY_LIST_DEFAULT_VALUE));
-        mEntityListNotEditable = parseStringList(parser.getString(
-                ENTITY_LIST_NOT_EDITABLE,
-                ENTITY_LIST_DEFAULT_VALUE));
-        mEntityListEditable = parseStringList(parser.getString(
-                ENTITY_LIST_EDITABLE,
-                ENTITY_LIST_DEFAULT_VALUE));
-        mInAppConversationActionTypesDefault = parseStringList(parser.getString(
-                IN_APP_CONVERSATION_ACTION_TYPES_DEFAULT,
-                CONVERSATION_ACTIONS_TYPES_DEFAULT_VALUES));
-        mNotificationConversationActionTypesDefault = parseStringList(parser.getString(
-                NOTIFICATION_CONVERSATION_ACTION_TYPES_DEFAULT,
-                CONVERSATION_ACTIONS_TYPES_DEFAULT_VALUES));
-        mLangIdThresholdOverride = parser.getFloat(
-                LANG_ID_THRESHOLD_OVERRIDE,
-                LANG_ID_THRESHOLD_OVERRIDE_DEFAULT);
-        mTemplateIntentFactoryEnabled = parser.getBoolean(
-                TEMPLATE_INTENT_FACTORY_ENABLED, TEMPLATE_INTENT_FACTORY_ENABLED_DEFAULT);
+        mEntityListNotEditable = parseStringList(
+                configParser.getString(
+                        ENTITY_LIST_NOT_EDITABLE,
+                        ENTITY_LIST_DEFAULT_VALUE));
+        mEntityListEditable = parseStringList(
+                configParser.getString(
+                        ENTITY_LIST_EDITABLE,
+                        ENTITY_LIST_DEFAULT_VALUE));
+        mInAppConversationActionTypesDefault = parseStringList(
+                configParser.getString(
+                        IN_APP_CONVERSATION_ACTION_TYPES_DEFAULT,
+                        CONVERSATION_ACTIONS_TYPES_DEFAULT_VALUES));
+        mNotificationConversationActionTypesDefault = parseStringList(
+                configParser.getString(
+                        NOTIFICATION_CONVERSATION_ACTION_TYPES_DEFAULT,
+                        CONVERSATION_ACTIONS_TYPES_DEFAULT_VALUES));
+        mLangIdThresholdOverride =
+                configParser.getFloat(
+                        LANG_ID_THRESHOLD_OVERRIDE,
+                        LANG_ID_THRESHOLD_OVERRIDE_DEFAULT);
+        mTemplateIntentFactoryEnabled = configParser.getBoolean(
+                TEMPLATE_INTENT_FACTORY_ENABLED,
+                TEMPLATE_INTENT_FACTORY_ENABLED_DEFAULT);
     }
 
     /** Load from a settings string. */
diff --git a/core/java/android/view/textclassifier/TextClassificationContext.java b/core/java/android/view/textclassifier/TextClassificationContext.java
index a15411f..3bf8e9b 100644
--- a/core/java/android/view/textclassifier/TextClassificationContext.java
+++ b/core/java/android/view/textclassifier/TextClassificationContext.java
@@ -141,7 +141,7 @@
         mWidgetVersion = in.readString();
     }
 
-    public static final Parcelable.Creator<TextClassificationContext> CREATOR =
+    public static final @android.annotation.NonNull Parcelable.Creator<TextClassificationContext> CREATOR =
             new Parcelable.Creator<TextClassificationContext>() {
                 @Override
                 public TextClassificationContext createFromParcel(Parcel parcel) {
diff --git a/core/java/android/view/textclassifier/TextClassificationManager.java b/core/java/android/view/textclassifier/TextClassificationManager.java
index d047c55..868cbb1 100644
--- a/core/java/android/view/textclassifier/TextClassificationManager.java
+++ b/core/java/android/view/textclassifier/TextClassificationManager.java
@@ -20,9 +20,11 @@
 import android.annotation.Nullable;
 import android.annotation.SystemService;
 import android.annotation.UnsupportedAppUsage;
+import android.app.ActivityThread;
 import android.content.Context;
 import android.database.ContentObserver;
 import android.os.ServiceManager;
+import android.provider.DeviceConfig;
 import android.provider.Settings;
 import android.service.textclassifier.TextClassifierService;
 import android.view.textclassifier.TextClassifier.TextClassifierType;
@@ -195,6 +197,7 @@
             if (mSettingsObserver != null) {
                 getApplicationContext().getContentResolver()
                         .unregisterContentObserver(mSettingsObserver);
+                DeviceConfig.removeOnPropertyChangedListener(mSettingsObserver);
             }
         } finally {
             super.finalize();
@@ -277,7 +280,8 @@
         }
     }
 
-    private static final class SettingsObserver extends ContentObserver {
+    private static final class SettingsObserver extends ContentObserver
+            implements DeviceConfig.OnPropertyChangedListener {
 
         private final WeakReference<TextClassificationManager> mTcm;
 
@@ -288,10 +292,23 @@
                     Settings.Global.getUriFor(Settings.Global.TEXT_CLASSIFIER_CONSTANTS),
                     false /* notifyForDescendants */,
                     this);
+            DeviceConfig.addOnPropertyChangedListener(
+                    DeviceConfig.NAMESPACE_TEXTCLASSIFIER,
+                    ActivityThread.currentApplication().getMainExecutor(),
+                    this);
         }
 
         @Override
         public void onChange(boolean selfChange) {
+            invalidateSettings();
+        }
+
+        @Override
+        public void onPropertyChanged(String namespace, String name, String value) {
+            invalidateSettings();
+        }
+
+        private void invalidateSettings() {
             final TextClassificationManager tcm = mTcm.get();
             if (tcm != null) {
                 tcm.invalidate();
diff --git a/core/java/android/view/textclassifier/TextClassificationSessionId.java b/core/java/android/view/textclassifier/TextClassificationSessionId.java
index 1378bd9..5e62a11 100644
--- a/core/java/android/view/textclassifier/TextClassificationSessionId.java
+++ b/core/java/android/view/textclassifier/TextClassificationSessionId.java
@@ -115,7 +115,7 @@
         return new TextClassificationSessionId(string);
     }
 
-    public static final Parcelable.Creator<TextClassificationSessionId> CREATOR =
+    public static final @android.annotation.NonNull Parcelable.Creator<TextClassificationSessionId> CREATOR =
             new Parcelable.Creator<TextClassificationSessionId>() {
                 @Override
                 public TextClassificationSessionId createFromParcel(Parcel parcel) {
diff --git a/core/java/android/view/textclassifier/TextClassifier.java b/core/java/android/view/textclassifier/TextClassifier.java
index e010155..a4e5502 100644
--- a/core/java/android/view/textclassifier/TextClassifier.java
+++ b/core/java/android/view/textclassifier/TextClassifier.java
@@ -353,6 +353,7 @@
      * Suggests and returns a list of actions according to the given conversation.
      */
     @WorkerThread
+    @NonNull
     default ConversationActions suggestConversationActions(
             @NonNull ConversationActions.Request request) {
         Preconditions.checkNotNull(request);
@@ -550,7 +551,7 @@
             return 0;
         }
 
-        public static final Parcelable.Creator<EntityConfig> CREATOR =
+        public static final @android.annotation.NonNull Parcelable.Creator<EntityConfig> CREATOR =
                 new Parcelable.Creator<EntityConfig>() {
                     @Override
                     public EntityConfig createFromParcel(Parcel in) {
@@ -609,7 +610,8 @@
              * These hints will only be used if {@link #includeTypesFromTextClassifier} is
              * set to be true.
              */
-            public Builder setHints(Collection<String> hints) {
+            @NonNull
+            public Builder setHints(@Nullable Collection<String> hints) {
                 mHints = hints;
                 return this;
             }
diff --git a/core/java/android/view/textclassifier/TextClassifierEvent.java b/core/java/android/view/textclassifier/TextClassifierEvent.java
index 0d4338b..236f89b 100644
--- a/core/java/android/view/textclassifier/TextClassifierEvent.java
+++ b/core/java/android/view/textclassifier/TextClassifierEvent.java
@@ -35,7 +35,7 @@
 // TODO: Comprehensive javadoc.
 public final class TextClassifierEvent implements Parcelable {
 
-    public static final Creator<TextClassifierEvent> CREATOR = new Creator<TextClassifierEvent>() {
+    public static final @android.annotation.NonNull Creator<TextClassifierEvent> CREATOR = new Creator<TextClassifierEvent>() {
         @Override
         public TextClassifierEvent createFromParcel(Parcel in) {
             return readFromParcel(in);
diff --git a/core/java/android/view/textclassifier/TextLanguage.java b/core/java/android/view/textclassifier/TextLanguage.java
index 735c3eb..eaf4d7f 100644
--- a/core/java/android/view/textclassifier/TextLanguage.java
+++ b/core/java/android/view/textclassifier/TextLanguage.java
@@ -43,7 +43,7 @@
  */
 public final class TextLanguage implements Parcelable {
 
-    public static final Creator<TextLanguage> CREATOR = new Creator<TextLanguage>() {
+    public static final @android.annotation.NonNull Creator<TextLanguage> CREATOR = new Creator<TextLanguage>() {
         @Override
         public TextLanguage createFromParcel(Parcel in) {
             return readFromParcel(in);
@@ -212,7 +212,7 @@
      */
     public static final class Request implements Parcelable {
 
-        public static final Creator<Request> CREATOR = new Creator<Request>() {
+        public static final @android.annotation.NonNull Creator<Request> CREATOR = new Creator<Request>() {
             @Override
             public Request createFromParcel(Parcel in) {
                 return readFromParcel(in);
diff --git a/core/java/android/view/textclassifier/TextLinks.java b/core/java/android/view/textclassifier/TextLinks.java
index ab34178..cde27a0 100644
--- a/core/java/android/view/textclassifier/TextLinks.java
+++ b/core/java/android/view/textclassifier/TextLinks.java
@@ -180,7 +180,7 @@
         dest.writeBundle(mExtras);
     }
 
-    public static final Parcelable.Creator<TextLinks> CREATOR =
+    public static final @android.annotation.NonNull Parcelable.Creator<TextLinks> CREATOR =
             new Parcelable.Creator<TextLinks>() {
                 @Override
                 public TextLinks createFromParcel(Parcel in) {
@@ -315,7 +315,7 @@
             return new TextLink(start, end, entityConfidence, extras, null /* urlSpan */);
         }
 
-        public static final Parcelable.Creator<TextLink> CREATOR =
+        public static final @android.annotation.NonNull Parcelable.Creator<TextLink> CREATOR =
                 new Parcelable.Creator<TextLink>() {
                     @Override
                     public TextLink createFromParcel(Parcel in) {
@@ -528,7 +528,7 @@
             return request;
         }
 
-        public static final Parcelable.Creator<Request> CREATOR =
+        public static final @android.annotation.NonNull Parcelable.Creator<Request> CREATOR =
                 new Parcelable.Creator<Request>() {
                     @Override
                     public Request createFromParcel(Parcel in) {
@@ -692,6 +692,7 @@
          *
          * @return this builder
          */
+        @NonNull
         public Builder setExtras(@Nullable Bundle extras) {
             mExtras = extras;
             return this;
diff --git a/core/java/android/view/textclassifier/TextSelection.java b/core/java/android/view/textclassifier/TextSelection.java
index 4a6f3e5..5298939 100644
--- a/core/java/android/view/textclassifier/TextSelection.java
+++ b/core/java/android/view/textclassifier/TextSelection.java
@@ -184,6 +184,7 @@
          *
          * @return this builder
          */
+        @NonNull
         public Builder setExtras(@Nullable Bundle extras) {
             mExtras = extras;
             return this;
@@ -368,6 +369,7 @@
              *
              * @return this builder
              */
+            @NonNull
             public Builder setExtras(@Nullable Bundle extras) {
                 mExtras = extras;
                 return this;
@@ -413,7 +415,7 @@
             return request;
         }
 
-        public static final Parcelable.Creator<Request> CREATOR =
+        public static final @android.annotation.NonNull Parcelable.Creator<Request> CREATOR =
                 new Parcelable.Creator<Request>() {
                     @Override
                     public Request createFromParcel(Parcel in) {
@@ -441,7 +443,7 @@
         dest.writeBundle(mExtras);
     }
 
-    public static final Parcelable.Creator<TextSelection> CREATOR =
+    public static final @android.annotation.NonNull Parcelable.Creator<TextSelection> CREATOR =
             new Parcelable.Creator<TextSelection>() {
                 @Override
                 public TextSelection createFromParcel(Parcel in) {
diff --git a/core/java/android/view/textservice/SentenceSuggestionsInfo.java b/core/java/android/view/textservice/SentenceSuggestionsInfo.java
index afd62eb..0d37632 100644
--- a/core/java/android/view/textservice/SentenceSuggestionsInfo.java
+++ b/core/java/android/view/textservice/SentenceSuggestionsInfo.java
@@ -129,7 +129,7 @@
     /**
      * Used to make this class parcelable.
      */
-    public static final Parcelable.Creator<SentenceSuggestionsInfo> CREATOR
+    public static final @android.annotation.NonNull Parcelable.Creator<SentenceSuggestionsInfo> CREATOR
             = new Parcelable.Creator<SentenceSuggestionsInfo>() {
         @Override
         public SentenceSuggestionsInfo createFromParcel(Parcel source) {
diff --git a/core/java/android/view/textservice/SpellCheckerInfo.java b/core/java/android/view/textservice/SpellCheckerInfo.java
index 7aa2c23..13d44da 100644
--- a/core/java/android/view/textservice/SpellCheckerInfo.java
+++ b/core/java/android/view/textservice/SpellCheckerInfo.java
@@ -192,7 +192,7 @@
     /**
      * Used to make this class parcelable.
      */
-    public static final Parcelable.Creator<SpellCheckerInfo> CREATOR
+    public static final @android.annotation.NonNull Parcelable.Creator<SpellCheckerInfo> CREATOR
             = new Parcelable.Creator<SpellCheckerInfo>() {
         @Override
         public SpellCheckerInfo createFromParcel(Parcel source) {
diff --git a/core/java/android/view/textservice/SpellCheckerSubtype.java b/core/java/android/view/textservice/SpellCheckerSubtype.java
index d904d467..8224e0e 100644
--- a/core/java/android/view/textservice/SpellCheckerSubtype.java
+++ b/core/java/android/view/textservice/SpellCheckerSubtype.java
@@ -271,7 +271,7 @@
         dest.writeInt(mSubtypeId);
     }
 
-    public static final Parcelable.Creator<SpellCheckerSubtype> CREATOR
+    public static final @android.annotation.NonNull Parcelable.Creator<SpellCheckerSubtype> CREATOR
             = new Parcelable.Creator<SpellCheckerSubtype>() {
         @Override
         public SpellCheckerSubtype createFromParcel(Parcel source) {
diff --git a/core/java/android/view/textservice/SuggestionsInfo.java b/core/java/android/view/textservice/SuggestionsInfo.java
index dc2051c..e69b6e7 100644
--- a/core/java/android/view/textservice/SuggestionsInfo.java
+++ b/core/java/android/view/textservice/SuggestionsInfo.java
@@ -162,7 +162,7 @@
     /**
      * Used to make this class parcelable.
      */
-    public static final Parcelable.Creator<SuggestionsInfo> CREATOR
+    public static final @android.annotation.NonNull Parcelable.Creator<SuggestionsInfo> CREATOR
             = new Parcelable.Creator<SuggestionsInfo>() {
         @Override
         public SuggestionsInfo createFromParcel(Parcel source) {
diff --git a/core/java/android/view/textservice/TextInfo.java b/core/java/android/view/textservice/TextInfo.java
index 5499918..571bdf3 100644
--- a/core/java/android/view/textservice/TextInfo.java
+++ b/core/java/android/view/textservice/TextInfo.java
@@ -138,7 +138,7 @@
     /**
      * Used to make this class parcelable.
      */
-    public static final Parcelable.Creator<TextInfo> CREATOR
+    public static final @android.annotation.NonNull Parcelable.Creator<TextInfo> CREATOR
             = new Parcelable.Creator<TextInfo>() {
         @Override
         public TextInfo createFromParcel(Parcel source) {
diff --git a/core/java/android/webkit/IWebViewUpdateService.aidl b/core/java/android/webkit/IWebViewUpdateService.aidl
index dbca7ff..10cfea1 100644
--- a/core/java/android/webkit/IWebViewUpdateService.aidl
+++ b/core/java/android/webkit/IWebViewUpdateService.aidl
@@ -51,6 +51,7 @@
      * DevelopmentSettings uses this to get the current available WebView
      * providers (to display as choices to the user).
      */
+    @UnsupportedAppUsage
     WebViewProviderInfo[] getValidWebViewPackages();
 
     /**
@@ -61,6 +62,7 @@
     /**
      * Used by DevelopmentSetting to get the name of the WebView provider currently in use.
      */
+    @UnsupportedAppUsage
     String getCurrentWebViewPackageName();
 
     /**
@@ -72,6 +74,7 @@
      * Used by Settings to determine whether a certain package can be enabled/disabled by the user -
      * the package should not be modifiable in this way if it is a fallback package.
      */
+    @UnsupportedAppUsage
     boolean isFallbackPackage(String packageName);
 
     /**
diff --git a/core/java/android/webkit/WebViewDelegate.java b/core/java/android/webkit/WebViewDelegate.java
index ef69b63..3d3d941 100644
--- a/core/java/android/webkit/WebViewDelegate.java
+++ b/core/java/android/webkit/WebViewDelegate.java
@@ -79,7 +79,10 @@
     /**
      * Returns {@code true} if the draw GL functor can be invoked (see {@link #invokeDrawGlFunctor})
      * and {@code false} otherwise.
+     *
+     * @deprecated Use {@link #drawWebViewFunctor(Canvas, int)}
      */
+    @Deprecated
     public boolean canInvokeDrawGlFunctor(View containerView) {
         return true;
     }
@@ -90,7 +93,9 @@
      *
      * @param nativeDrawGLFunctor the pointer to the native functor that implements
      *        system/core/include/utils/Functor.h
+     * @deprecated Use {@link #drawWebViewFunctor(Canvas, int)}
      */
+    @Deprecated
     public void invokeDrawGlFunctor(View containerView, long nativeDrawGLFunctor,
             boolean waitForCompletion) {
         ViewRootImpl.invokeFunctor(nativeDrawGLFunctor, waitForCompletion);
@@ -105,7 +110,9 @@
      * @param nativeDrawGLFunctor the pointer to the native functor that implements
      *        system/core/include/utils/Functor.h
      * @throws IllegalArgumentException if the canvas is not hardware accelerated
+     * @deprecated Use {@link #drawWebViewFunctor(Canvas, int)}
      */
+    @Deprecated
     public void callDrawGlFunction(Canvas canvas, long nativeDrawGLFunctor) {
         if (!(canvas instanceof RecordingCanvas)) {
             // Canvas#isHardwareAccelerated() is only true for subclasses of HardwareCanvas.
@@ -126,7 +133,9 @@
      * @param releasedRunnable Called when this nativeDrawGLFunctor is no longer referenced by this
      *        canvas, so is safe to be destroyed.
      * @throws IllegalArgumentException if the canvas is not hardware accelerated
+     * @deprecated Use {@link #drawWebViewFunctor(Canvas, int)}
      */
+    @Deprecated
     public void callDrawGlFunction(@NonNull Canvas canvas, long nativeDrawGLFunctor,
             @Nullable Runnable releasedRunnable) {
         if (!(canvas instanceof RecordingCanvas)) {
@@ -139,7 +148,7 @@
 
     /**
      * Call webview draw functor. See API in draw_fn.h.
-     * @param canvas a hardware accelerated canvas (see {@link Canvas#isHardwareAccelerated()}).
+     * @param canvas a {@link RecordingCanvas}.
      * @param functor created by AwDrawFn_CreateFunctor in draw_fn.h.
      */
     public void drawWebViewFunctor(@NonNull Canvas canvas, int functor) {
@@ -156,7 +165,9 @@
      *
      * @param nativeDrawGLFunctor the pointer to the native functor that implements
      *        system/core/include/utils/Functor.h
+     * @deprecated Use {@link #drawWebViewFunctor(Canvas, int)}
      */
+    @Deprecated
     public void detachDrawGlFunctor(View containerView, long nativeDrawGLFunctor) {
         ViewRootImpl viewRootImpl = containerView.getViewRootImpl();
         if (nativeDrawGLFunctor != 0 && viewRootImpl != null) {
diff --git a/core/java/android/webkit/WebViewProvider.java b/core/java/android/webkit/WebViewProvider.java
index baf5826..4c8f72a 100644
--- a/core/java/android/webkit/WebViewProvider.java
+++ b/core/java/android/webkit/WebViewProvider.java
@@ -351,7 +351,7 @@
         }
 
         default void onProvideContentCaptureStructure(
-                @SuppressWarnings("unused") android.view.ViewStructure structure,
+                @NonNull @SuppressWarnings("unused") android.view.ViewStructure structure,
                 @SuppressWarnings("unused") int flags) {
         }
 
diff --git a/core/java/android/webkit/WebViewProviderInfo.java b/core/java/android/webkit/WebViewProviderInfo.java
index 1704757..7e00cde 100644
--- a/core/java/android/webkit/WebViewProviderInfo.java
+++ b/core/java/android/webkit/WebViewProviderInfo.java
@@ -46,7 +46,7 @@
     }
 
     // aidl stuff
-    public static final Parcelable.Creator<WebViewProviderInfo> CREATOR =
+    public static final @android.annotation.NonNull Parcelable.Creator<WebViewProviderInfo> CREATOR =
         new Parcelable.Creator<WebViewProviderInfo>() {
             public WebViewProviderInfo createFromParcel(Parcel in) {
                 return new WebViewProviderInfo(in);
diff --git a/core/java/android/webkit/WebViewProviderResponse.java b/core/java/android/webkit/WebViewProviderResponse.java
index 0edcb6f..5622abe 100644
--- a/core/java/android/webkit/WebViewProviderResponse.java
+++ b/core/java/android/webkit/WebViewProviderResponse.java
@@ -30,7 +30,7 @@
     }
 
     // aidl stuff
-    public static final Parcelable.Creator<WebViewProviderResponse> CREATOR =
+    public static final @android.annotation.NonNull Parcelable.Creator<WebViewProviderResponse> CREATOR =
         new Parcelable.Creator<WebViewProviderResponse>() {
             public WebViewProviderResponse createFromParcel(Parcel in) {
                 return new WebViewProviderResponse(in);
diff --git a/core/java/android/widget/AbsListView.java b/core/java/android/widget/AbsListView.java
index f01babe..24f1fb5 100644
--- a/core/java/android/widget/AbsListView.java
+++ b/core/java/android/widget/AbsListView.java
@@ -1803,7 +1803,7 @@
                     + " checkState=" + checkState + "}";
         }
 
-        public static final Parcelable.Creator<SavedState> CREATOR
+        public static final @android.annotation.NonNull Parcelable.Creator<SavedState> CREATOR
                 = new Parcelable.Creator<SavedState>() {
             @Override
             public SavedState createFromParcel(Parcel in) {
@@ -2821,7 +2821,7 @@
      * @attr ref android.R.styleable#AbsListView_drawSelectorOnTop
      */
     @InspectableProperty
-    public boolean getDrawSelectorOnTop() {
+    public boolean isDrawSelectorOnTop() {
         return mDrawSelectorOnTop;
     }
 
@@ -7794,6 +7794,11 @@
                 mLastSeenPos = firstPos;
 
                 final int childCount = getChildCount();
+
+                if (childCount <= 0) {
+                    return;
+                }
+
                 final int position = mTargetPos;
                 final int lastPos = firstPos + childCount - 1;
 
diff --git a/core/java/android/widget/AbsSpinner.java b/core/java/android/widget/AbsSpinner.java
index 3dcba48..daf6914 100644
--- a/core/java/android/widget/AbsSpinner.java
+++ b/core/java/android/widget/AbsSpinner.java
@@ -415,7 +415,7 @@
                     + " position=" + position + "}";
         }
 
-        public static final Parcelable.Creator<SavedState> CREATOR
+        public static final @android.annotation.NonNull Parcelable.Creator<SavedState> CREATOR
                 = new Parcelable.Creator<SavedState>() {
             public SavedState createFromParcel(Parcel in) {
                 return new SavedState(in);
diff --git a/core/java/android/widget/AbsoluteLayout.java b/core/java/android/widget/AbsoluteLayout.java
index 4ce0d5d..e3499f9 100644
--- a/core/java/android/widget/AbsoluteLayout.java
+++ b/core/java/android/widget/AbsoluteLayout.java
@@ -21,6 +21,7 @@
 import android.util.AttributeSet;
 import android.view.View;
 import android.view.ViewGroup;
+import android.view.inspector.InspectableProperty;
 import android.widget.RemoteViews.RemoteView;
 
 
@@ -159,10 +160,12 @@
         /**
          * The horizontal, or X, location of the child within the view group.
          */
+        @InspectableProperty(name = "layout_x")
         public int x;
         /**
          * The vertical, or Y, location of the child within the view group.
          */
+        @InspectableProperty(name = "layout_y")
         public int y;
 
         /**
diff --git a/core/java/android/widget/ActionMenuPresenter.java b/core/java/android/widget/ActionMenuPresenter.java
index eb20a76..cfb93ec 100644
--- a/core/java/android/widget/ActionMenuPresenter.java
+++ b/core/java/android/widget/ActionMenuPresenter.java
@@ -830,7 +830,7 @@
             dest.writeInt(openSubMenuId);
         }
 
-        public static final Parcelable.Creator<SavedState> CREATOR
+        public static final @android.annotation.NonNull Parcelable.Creator<SavedState> CREATOR
                 = new Parcelable.Creator<SavedState>() {
             public SavedState createFromParcel(Parcel in) {
                 return new SavedState(in);
diff --git a/core/java/android/widget/AdapterViewAnimator.java b/core/java/android/widget/AdapterViewAnimator.java
index 5174c1a..d93b635 100644
--- a/core/java/android/widget/AdapterViewAnimator.java
+++ b/core/java/android/widget/AdapterViewAnimator.java
@@ -804,7 +804,7 @@
             return "AdapterViewAnimator.SavedState{ whichChild = " + this.whichChild + " }";
         }
 
-        public static final Parcelable.Creator<SavedState> CREATOR
+        public static final @android.annotation.NonNull Parcelable.Creator<SavedState> CREATOR
                 = new Parcelable.Creator<SavedState>() {
             public SavedState createFromParcel(Parcel in) {
                 return new SavedState(in);
diff --git a/core/java/android/widget/CheckedTextView.java b/core/java/android/widget/CheckedTextView.java
index 99440f8..a211b46 100644
--- a/core/java/android/widget/CheckedTextView.java
+++ b/core/java/android/widget/CheckedTextView.java
@@ -493,7 +493,7 @@
                     + " checked=" + checked + "}";
         }
 
-        public static final Parcelable.Creator<SavedState> CREATOR
+        public static final @android.annotation.NonNull Parcelable.Creator<SavedState> CREATOR
                 = new Parcelable.Creator<SavedState>() {
             public SavedState createFromParcel(Parcel in) {
                 return new SavedState(in);
diff --git a/core/java/android/widget/CompoundButton.java b/core/java/android/widget/CompoundButton.java
index 3cfd373..80ec1c6 100644
--- a/core/java/android/widget/CompoundButton.java
+++ b/core/java/android/widget/CompoundButton.java
@@ -545,7 +545,7 @@
         }
 
         @SuppressWarnings("hiding")
-        public static final Parcelable.Creator<SavedState> CREATOR =
+        public static final @android.annotation.NonNull Parcelable.Creator<SavedState> CREATOR =
                 new Parcelable.Creator<SavedState>() {
             @Override
             public SavedState createFromParcel(Parcel in) {
diff --git a/core/java/android/widget/DatePicker.java b/core/java/android/widget/DatePicker.java
index ada4f00..ecb846b 100644
--- a/core/java/android/widget/DatePicker.java
+++ b/core/java/android/widget/DatePicker.java
@@ -791,7 +791,7 @@
 
             @SuppressWarnings("all")
             // suppress unused and hiding
-            public static final Parcelable.Creator<SavedState> CREATOR = new Creator<SavedState>() {
+            public static final @android.annotation.NonNull Parcelable.Creator<SavedState> CREATOR = new Creator<SavedState>() {
 
                 public SavedState createFromParcel(Parcel in) {
                     return new SavedState(in);
diff --git a/core/java/android/widget/ExpandableListConnector.java b/core/java/android/widget/ExpandableListConnector.java
index bda64ba..f04f605 100644
--- a/core/java/android/widget/ExpandableListConnector.java
+++ b/core/java/android/widget/ExpandableListConnector.java
@@ -927,7 +927,7 @@
             dest.writeLong(gId);
         }
         
-        public static final Parcelable.Creator<GroupMetadata> CREATOR =
+        public static final @android.annotation.NonNull Parcelable.Creator<GroupMetadata> CREATOR =
                 new Parcelable.Creator<GroupMetadata>() {
             
             public GroupMetadata createFromParcel(Parcel in) {
diff --git a/core/java/android/widget/ExpandableListView.java b/core/java/android/widget/ExpandableListView.java
index 2cc013e..cae91fc 100644
--- a/core/java/android/widget/ExpandableListView.java
+++ b/core/java/android/widget/ExpandableListView.java
@@ -1318,7 +1318,7 @@
             out.writeList(expandedGroupMetadataList);
         }
 
-        public static final Parcelable.Creator<SavedState> CREATOR
+        public static final @android.annotation.NonNull Parcelable.Creator<SavedState> CREATOR
                 = new Parcelable.Creator<SavedState>() {
             public SavedState createFromParcel(Parcel in) {
                 return new SavedState(in);
diff --git a/core/java/android/widget/FrameLayout.java b/core/java/android/widget/FrameLayout.java
index 3570c79..69da911 100644
--- a/core/java/android/widget/FrameLayout.java
+++ b/core/java/android/widget/FrameLayout.java
@@ -443,6 +443,9 @@
          * @see android.view.Gravity
          * @attr ref android.R.styleable#FrameLayout_Layout_layout_gravity
          */
+        @InspectableProperty(
+                name = "layout_gravity",
+                valueType = InspectableProperty.ValueType.GRAVITY)
         public int gravity = UNSPECIFIED_GRAVITY;
 
         public LayoutParams(@NonNull Context c, @Nullable AttributeSet attrs) {
diff --git a/core/java/android/widget/HorizontalScrollView.java b/core/java/android/widget/HorizontalScrollView.java
index 25cfdc7..5921feb 100644
--- a/core/java/android/widget/HorizontalScrollView.java
+++ b/core/java/android/widget/HorizontalScrollView.java
@@ -1844,7 +1844,7 @@
                     + "}";
         }
 
-        public static final Parcelable.Creator<SavedState> CREATOR
+        public static final @android.annotation.NonNull Parcelable.Creator<SavedState> CREATOR
                 = new Parcelable.Creator<SavedState>() {
             public SavedState createFromParcel(Parcel in) {
                 return new SavedState(in);
diff --git a/core/java/android/widget/LinearLayout.java b/core/java/android/widget/LinearLayout.java
index e833df9..bdde435 100644
--- a/core/java/android/widget/LinearLayout.java
+++ b/core/java/android/widget/LinearLayout.java
@@ -1987,6 +1987,7 @@
          * will be pro-rated among all views whose weight is greater than 0.
          */
         @ViewDebug.ExportedProperty(category = "layout")
+        @InspectableProperty(name = "layout_weight")
         public float weight;
 
         /**
@@ -2010,6 +2011,9 @@
             @ViewDebug.IntToString(from = Gravity.CENTER,            to = "CENTER"),
             @ViewDebug.IntToString(from = Gravity.FILL,              to = "FILL")
         })
+        @InspectableProperty(
+                name = "layout_gravity",
+                valueType = InspectableProperty.ValueType.GRAVITY)
         public int gravity = -1;
 
         /**
diff --git a/core/java/android/widget/Magnifier.java b/core/java/android/widget/Magnifier.java
index b7cdad2..50e8836 100644
--- a/core/java/android/widget/Magnifier.java
+++ b/core/java/android/widget/Magnifier.java
@@ -1116,7 +1116,7 @@
     /**
      * Builder class for {@link Magnifier} objects.
      */
-    public static class Builder {
+    public static final class Builder {
         private @NonNull View mView;
         private @Px @IntRange(from = 0) int mWidth;
         private @Px @IntRange(from = 0) int mHeight;
diff --git a/core/java/android/widget/NumberPicker.java b/core/java/android/widget/NumberPicker.java
index dad2669..685e8de 100644
--- a/core/java/android/widget/NumberPicker.java
+++ b/core/java/android/widget/NumberPicker.java
@@ -1587,6 +1587,7 @@
      * others.
      * @return The height of the divider
      */
+    @Px
     public int getSelectionDividerHeight() {
         return mSelectionDividerHeight;
     }
diff --git a/core/java/android/widget/ProgressBar.java b/core/java/android/widget/ProgressBar.java
index 8113b40..0b433b1 100644
--- a/core/java/android/widget/ProgressBar.java
+++ b/core/java/android/widget/ProgressBar.java
@@ -2061,7 +2061,7 @@
             out.writeInt(secondaryProgress);
         }
 
-        public static final Parcelable.Creator<SavedState> CREATOR
+        public static final @android.annotation.NonNull Parcelable.Creator<SavedState> CREATOR
                 = new Parcelable.Creator<SavedState>() {
             public SavedState createFromParcel(Parcel in) {
                 return new SavedState(in);
diff --git a/core/java/android/widget/RelativeLayout.java b/core/java/android/widget/RelativeLayout.java
index 109c0a4..8ee31e2 100644
--- a/core/java/android/widget/RelativeLayout.java
+++ b/core/java/android/widget/RelativeLayout.java
@@ -1286,6 +1286,7 @@
          * the anchor's visibility is GONE.
          */
         @ViewDebug.ExportedProperty(category = "layout")
+        @InspectableProperty(name = "layout_alignWithParentIfMissing")
         public boolean alignWithParent;
 
         public LayoutParams(Context c, AttributeSet attrs) {
diff --git a/core/java/android/widget/RemoteViews.java b/core/java/android/widget/RemoteViews.java
index 8514b85..564d972 100644
--- a/core/java/android/widget/RemoteViews.java
+++ b/core/java/android/widget/RemoteViews.java
@@ -2803,7 +2803,7 @@
      * @param viewId The id of the view that will trigger the {@link RemoteResponse} when clicked
      * @param response The {@link RemoteResponse} to send when user clicks
      */
-    public void setOnClickResponse(int viewId, RemoteResponse response) {
+    public void setOnClickResponse(int viewId, @NonNull RemoteResponse response) {
         addAction(new SetOnClickResponse(viewId, response));
     }
 
@@ -3783,7 +3783,7 @@
     /**
      * Parcelable.Creator that instantiates RemoteViews objects
      */
-    public static final Parcelable.Creator<RemoteViews> CREATOR = new Parcelable.Creator<RemoteViews>() {
+    public static final @android.annotation.NonNull Parcelable.Creator<RemoteViews> CREATOR = new Parcelable.Creator<RemoteViews>() {
         public RemoteViews createFromParcel(Parcel parcel) {
             return new RemoteViews(parcel);
         }
@@ -3926,7 +3926,8 @@
          *
          * @param pendingIntent The {@link PendingIntent} to send as part of the response
          */
-        public static RemoteResponse fromPendingIntent(PendingIntent pendingIntent) {
+        @NonNull
+        public static RemoteResponse fromPendingIntent(@NonNull PendingIntent pendingIntent) {
             RemoteResponse response = new RemoteResponse();
             response.mPendingIntent = pendingIntent;
             return response;
@@ -3957,7 +3958,8 @@
          * @see RemoteViews#setOnClickFillInIntent(int, Intent)
          * @return
          */
-        public static RemoteResponse fromFillInIntent(Intent fillIntent) {
+        @NonNull
+        public static RemoteResponse fromFillInIntent(@NonNull Intent fillIntent) {
             RemoteResponse response = new RemoteResponse();
             response.mFillIntent = fillIntent;
             return response;
@@ -3974,7 +3976,8 @@
          *
          * @see ActivityOptions#makeSceneTransitionAnimation(Activity, Pair[])
          */
-        public RemoteResponse addSharedElement(int viewId, String sharedElementName) {
+        @NonNull
+        public RemoteResponse addSharedElement(int viewId, @NonNull String sharedElementName) {
             if (mViewIds == null) {
                 mViewIds = new IntArray();
                 mElementNames = new ArrayList<>();
diff --git a/core/java/android/widget/ScrollView.java b/core/java/android/widget/ScrollView.java
index 7e72c6a..a3e89c8 100644
--- a/core/java/android/widget/ScrollView.java
+++ b/core/java/android/widget/ScrollView.java
@@ -1474,7 +1474,7 @@
      *
      * @param child the View to scroll to
      */
-    public void scrollToDescendant(View child) {
+    public void scrollToDescendant(@NonNull View child) {
         if (!mIsLayoutDirty) {
             child.getDrawingRect(mTempRect);
 
@@ -1978,7 +1978,7 @@
                     + " scrollPosition=" + scrollPosition + "}";
         }
 
-        public static final Parcelable.Creator<SavedState> CREATOR
+        public static final @android.annotation.NonNull Parcelable.Creator<SavedState> CREATOR
                 = new Parcelable.Creator<SavedState>() {
             public SavedState createFromParcel(Parcel in) {
                 return new SavedState(in);
diff --git a/core/java/android/widget/SearchView.java b/core/java/android/widget/SearchView.java
index 172f1d8..89d9e97 100644
--- a/core/java/android/widget/SearchView.java
+++ b/core/java/android/widget/SearchView.java
@@ -1433,7 +1433,7 @@
                     + " isIconified=" + isIconified + "}";
         }
 
-        public static final Parcelable.Creator<SavedState> CREATOR =
+        public static final @android.annotation.NonNull Parcelable.Creator<SavedState> CREATOR =
                 new Parcelable.Creator<SavedState>() {
                     public SavedState createFromParcel(Parcel in) {
                         return new SavedState(in);
diff --git a/core/java/android/widget/Spinner.java b/core/java/android/widget/Spinner.java
index d6c657b..92fcea3 100644
--- a/core/java/android/widget/Spinner.java
+++ b/core/java/android/widget/Spinner.java
@@ -944,7 +944,7 @@
             out.writeByte((byte) (showDropdown ? 1 : 0));
         }
 
-        public static final Parcelable.Creator<SavedState> CREATOR =
+        public static final @android.annotation.NonNull Parcelable.Creator<SavedState> CREATOR =
                 new Parcelable.Creator<SavedState>() {
             public SavedState createFromParcel(Parcel in) {
                 return new SavedState(in);
diff --git a/core/java/android/widget/TableRow.java b/core/java/android/widget/TableRow.java
index 22931fc..ac23093 100644
--- a/core/java/android/widget/TableRow.java
+++ b/core/java/android/widget/TableRow.java
@@ -26,6 +26,7 @@
 import android.view.ViewDebug;
 import android.view.ViewGroup;
 import android.view.ViewHierarchyEncoder;
+import android.view.inspector.InspectableProperty;
 
 /**
  * <p>A layout that arranges its children horizontally. A TableRow should
@@ -398,12 +399,14 @@
          * <p>The column index of the cell represented by the widget.</p>
          */
         @ViewDebug.ExportedProperty(category = "layout")
+        @InspectableProperty(name = "layout_column")
         public int column;
 
         /**
          * <p>The number of columns the widgets spans over.</p>
          */
         @ViewDebug.ExportedProperty(category = "layout")
+        @InspectableProperty(name = "layout_span")
         public int span;
 
         private static final int LOCATION = 0;
diff --git a/core/java/android/widget/TextView.java b/core/java/android/widget/TextView.java
index 51eaa12..04bcb14 100644
--- a/core/java/android/widget/TextView.java
+++ b/core/java/android/widget/TextView.java
@@ -12744,7 +12744,7 @@
      * return value may not be the same as the one TextView uses if the View's layout direction is
      * not resolved or detached from parent root view.
      */
-    public TextDirectionHeuristic getTextDirectionHeuristic() {
+    public @NonNull TextDirectionHeuristic getTextDirectionHeuristic() {
         if (hasPasswordTransformationMethod()) {
             // passwords fields should be LTR
             return TextDirectionHeuristics.LTR;
@@ -13062,7 +13062,7 @@
         }
 
         @SuppressWarnings("hiding")
-        public static final Parcelable.Creator<SavedState> CREATOR =
+        public static final @android.annotation.NonNull Parcelable.Creator<SavedState> CREATOR =
                 new Parcelable.Creator<SavedState>() {
                     public SavedState createFromParcel(Parcel in) {
                         return new SavedState(in);
diff --git a/core/java/android/widget/TimePicker.java b/core/java/android/widget/TimePicker.java
index 97a8ade..c7a2980 100644
--- a/core/java/android/widget/TimePicker.java
+++ b/core/java/android/widget/TimePicker.java
@@ -552,7 +552,7 @@
             }
 
             @SuppressWarnings({"unused", "hiding"})
-            public static final Creator<SavedState> CREATOR = new Creator<SavedState>() {
+            public static final @android.annotation.NonNull Creator<SavedState> CREATOR = new Creator<SavedState>() {
                 public SavedState createFromParcel(Parcel in) {
                     return new SavedState(in);
                 }
diff --git a/core/java/android/widget/ToggleButton.java b/core/java/android/widget/ToggleButton.java
index b76c2ca..9255ccb 100644
--- a/core/java/android/widget/ToggleButton.java
+++ b/core/java/android/widget/ToggleButton.java
@@ -16,6 +16,7 @@
 
 package android.widget;
 
+import android.annotation.FloatRange;
 import android.content.Context;
 import android.content.res.TypedArray;
 import android.graphics.drawable.Drawable;
@@ -129,6 +130,7 @@
      * @return the alpha value, 0.0-1.0
      */
     @InspectableProperty
+    @FloatRange(from = 0.0, to = 1.0)
     public float getDisabledAlpha() {
         return mDisabledAlpha;
     }
diff --git a/core/java/android/widget/Toolbar.java b/core/java/android/widget/Toolbar.java
index f25109e..a21fb41 100644
--- a/core/java/android/widget/Toolbar.java
+++ b/core/java/android/widget/Toolbar.java
@@ -2384,7 +2384,7 @@
             out.writeInt(isOverflowOpen ? 1 : 0);
         }
 
-        public static final Creator<SavedState> CREATOR = new Creator<SavedState>() {
+        public static final @android.annotation.NonNull Creator<SavedState> CREATOR = new Creator<SavedState>() {
 
             @Override
             public SavedState createFromParcel(Parcel source) {
diff --git a/core/java/android/widget/ViewFlipper.java b/core/java/android/widget/ViewFlipper.java
index 414b136..b962298 100644
--- a/core/java/android/widget/ViewFlipper.java
+++ b/core/java/android/widget/ViewFlipper.java
@@ -16,6 +16,7 @@
 
 package android.widget;
 
+import android.annotation.IntRange;
 import android.annotation.UnsupportedAppUsage;
 import android.content.BroadcastReceiver;
 import android.content.Context;
@@ -130,7 +131,7 @@
      *            time in milliseconds
      */
     @android.view.RemotableViewMethod
-    public void setFlipInterval(int milliseconds) {
+    public void setFlipInterval(@IntRange(from = 0) int milliseconds) {
         mFlipInterval = milliseconds;
     }
 
@@ -140,6 +141,7 @@
      * @return delay time in milliseconds
      */
     @InspectableProperty
+    @IntRange(from = 0)
     public int getFlipInterval() {
         return mFlipInterval;
     }
diff --git a/core/java/android/widget/ZoomControls.java b/core/java/android/widget/ZoomControls.java
index dd6a27b8f..7a5b7e8 100644
--- a/core/java/android/widget/ZoomControls.java
+++ b/core/java/android/widget/ZoomControls.java
@@ -30,7 +30,11 @@
 
 /**
  * The {@code ZoomControls} class displays a simple set of controls used for zooming and
- * provides callbacks to register for events. */
+ * provides callbacks to register for events.
+ * @deprecated This functionality and UI is better handled with custom views and layouts
+ * rather than a dedicated zoom-control widget
+ */
+@Deprecated
 @Widget
 public class ZoomControls extends LinearLayout {
 
diff --git a/core/java/com/android/internal/app/ChooserActivity.java b/core/java/com/android/internal/app/ChooserActivity.java
index 89e3d6b..91928b5 100644
--- a/core/java/com/android/internal/app/ChooserActivity.java
+++ b/core/java/com/android/internal/app/ChooserActivity.java
@@ -18,6 +18,11 @@
 
 import static java.lang.annotation.RetentionPolicy.SOURCE;
 
+import android.animation.Animator;
+import android.animation.AnimatorListenerAdapter;
+import android.animation.AnimatorSet;
+import android.animation.ObjectAnimator;
+import android.animation.ValueAnimator;
 import android.annotation.IntDef;
 import android.app.Activity;
 import android.app.ActivityManager;
@@ -90,6 +95,8 @@
 import android.view.View.OnLongClickListener;
 import android.view.ViewGroup;
 import android.view.ViewGroup.LayoutParams;
+import android.view.animation.AccelerateInterpolator;
+import android.view.animation.DecelerateInterpolator;
 import android.widget.AbsListView;
 import android.widget.BaseAdapter;
 import android.widget.ImageView;
@@ -152,11 +159,17 @@
     private static final boolean USE_SHORTCUT_MANAGER_FOR_DIRECT_TARGETS = true;
     private static final boolean USE_CHOOSER_TARGET_SERVICE_FOR_DIRECT_TARGETS = true;
 
+    /**
+     * The transition time between placeholders for direct share to a message
+     * indicating that non are available.
+     */
+    private static final int NO_DIRECT_SHARE_ANIM_IN_MILLIS = 200;
+
     // TODO(b/121287224): Re-evaluate this limit
     private static final int SHARE_TARGET_QUERY_PACKAGE_LIMIT = 20;
 
     private static final int QUERY_TARGET_SERVICE_LIMIT = 5;
-    private static final int WATCHDOG_TIMEOUT_MILLIS = 2000;
+    private static final int WATCHDOG_TIMEOUT_MILLIS = 3000;
 
     private Bundle mReplacementExtras;
     private IntentSender mChosenComponentSender;
@@ -172,6 +185,8 @@
 
     private ChooserListAdapter mChooserListAdapter;
     private ChooserRowAdapter mChooserRowAdapter;
+    private Drawable mChooserRowLayer;
+    private int mChooserRowServiceSpacing;
 
     private SharedPreferences mPinnedSharedPrefs;
     private static final float PINNED_TARGET_SCORE_BOOST = 1000.f;
@@ -220,7 +235,6 @@
                     sri.connection.destroy();
                     mServiceConnections.remove(sri.connection);
                     if (mServiceConnections.isEmpty()) {
-                        mChooserHandler.removeMessages(CHOOSER_TARGET_SERVICE_WATCHDOG_TIMEOUT);
                         sendVoiceChoicesIfNeeded();
                         mChooserListAdapter.setShowServiceTargets(true);
                     }
@@ -230,8 +244,12 @@
                     if (DEBUG) {
                         Log.d(TAG, "CHOOSER_TARGET_SERVICE_WATCHDOG_TIMEOUT; unbinding services");
                     }
+                    if (isDestroyed()) {
+                        break;
+                    }
                     unbindRemainingServices();
                     sendVoiceChoicesIfNeeded();
+                    mChooserListAdapter.completeServiceTargetLoading();
                     mChooserListAdapter.setShowServiceTargets(true);
                     break;
 
@@ -399,11 +417,21 @@
                     .setExtras(extras)
                     .build());
             mAppPredictorCallback = resultList -> {
+                if (isFinishing() || isDestroyed()) {
+                    return;
+                }
+                // May be null if there are no apps to perform share/open action.
+                if (mChooserListAdapter == null) {
+                    return;
+                }
                 final List<DisplayResolveInfo> driList =
                         getDisplayResolveInfos(mChooserListAdapter);
                 final List<ShortcutManager.ShareShortcutInfo> shareShortcutInfos =
                         new ArrayList<>();
                 for (AppTarget appTarget : resultList) {
+                    if (appTarget.getShortcutInfo() == null) {
+                        continue;
+                    }
                     shareShortcutInfos.add(new ShortcutManager.ShareShortcutInfo(
                             appTarget.getShortcutInfo(),
                             new ComponentName(
@@ -414,6 +442,10 @@
             mAppPredictor.registerPredictionUpdates(this.getMainExecutor(), mAppPredictorCallback);
         }
 
+        mChooserRowLayer = getResources().getDrawable(R.drawable.chooser_row_layer_list, null);
+        mChooserRowServiceSpacing = getResources()
+                                        .getDimensionPixelSize(R.dimen.chooser_service_spacing);
+
         if (DEBUG) {
             Log.d(TAG, "System Time Cost is " + systemCost);
         }
@@ -919,6 +951,10 @@
 
     @Override
     protected boolean onTargetSelected(TargetInfo target, boolean alwaysCheck) {
+        if (target instanceof NotSelectableTargetInfo) {
+            return false;
+        }
+
         if (mRefinementIntentSender != null) {
             final Intent fillIn = new Intent();
             final List<Intent> sourceIntents = target.getAllSourceIntents();
@@ -1064,14 +1100,14 @@
             }
         }
 
-        if (!mServiceConnections.isEmpty()) {
-            if (DEBUG) {
-                Log.d(TAG, "queryTargets setting watchdog timer for "
-                        + WATCHDOG_TIMEOUT_MILLIS + "ms");
-            }
-            mChooserHandler.sendEmptyMessageDelayed(CHOOSER_TARGET_SERVICE_WATCHDOG_TIMEOUT,
-                    WATCHDOG_TIMEOUT_MILLIS);
-        } else {
+        if (DEBUG) {
+            Log.d(TAG, "queryTargets setting watchdog timer for "
+                    + WATCHDOG_TIMEOUT_MILLIS + "ms");
+        }
+        mChooserHandler.sendEmptyMessageDelayed(CHOOSER_TARGET_SERVICE_WATCHDOG_TIMEOUT,
+                WATCHDOG_TIMEOUT_MILLIS);
+
+        if (mServiceConnections.isEmpty()) {
             sendVoiceChoicesIfNeeded();
         }
     }
@@ -1213,7 +1249,6 @@
             conn.destroy();
         }
         mServiceConnections.clear();
-        mChooserHandler.removeMessages(CHOOSER_TARGET_SERVICE_WATCHDOG_TIMEOUT);
     }
 
     public void onSetupVoiceInteraction() {
@@ -1420,7 +1455,93 @@
         return null;
     }
 
-    final class ChooserTargetInfo implements TargetInfo {
+    interface ChooserTargetInfo extends TargetInfo {
+        float getModifiedScore();
+
+        ChooserTarget getChooserTarget();
+    }
+
+    /**
+      * Distinguish between targets that selectable by the user, vs those that are
+      * placeholders for the system while information is loading in an async manner.
+      */
+    abstract class NotSelectableTargetInfo implements ChooserTargetInfo {
+
+        public Intent getResolvedIntent() {
+            return null;
+        }
+
+        public ComponentName getResolvedComponentName() {
+            return null;
+        }
+
+        public boolean start(Activity activity, Bundle options) {
+            return false;
+        }
+
+        public boolean startAsCaller(ResolverActivity activity, Bundle options, int userId) {
+            return false;
+        }
+
+        public boolean startAsUser(Activity activity, Bundle options, UserHandle user) {
+            return false;
+        }
+
+        public ResolveInfo getResolveInfo() {
+            return null;
+        }
+
+        public CharSequence getDisplayLabel() {
+            return null;
+        }
+
+        public CharSequence getExtendedInfo() {
+            return null;
+        }
+
+        public Drawable getBadgeIcon() {
+            return null;
+        }
+
+        public CharSequence getBadgeContentDescription() {
+            return null;
+        }
+
+        public TargetInfo cloneFilledIn(Intent fillInIntent, int flags) {
+            return null;
+        }
+
+        public List<Intent> getAllSourceIntents() {
+            return null;
+        }
+
+        public boolean isPinned() {
+            return false;
+        }
+
+        public float getModifiedScore() {
+            return 0.1f;
+        }
+
+        public ChooserTarget getChooserTarget() {
+            return null;
+        }
+    }
+
+    final class PlaceHolderTargetInfo extends NotSelectableTargetInfo {
+        public Drawable getDisplayIcon() {
+            return getDrawable(R.drawable.resolver_icon_placeholder);
+        }
+    }
+
+
+    final class EmptyTargetInfo extends NotSelectableTargetInfo {
+        public Drawable getDisplayIcon() {
+            return null;
+        }
+    }
+
+    final class SelectableTargetInfo implements ChooserTargetInfo {
         private final DisplayResolveInfo mSourceInfo;
         private final ResolveInfo mBackupResolveInfo;
         private final ChooserTarget mChooserTarget;
@@ -1431,7 +1552,7 @@
         private final int mFillInFlags;
         private final float mModifiedScore;
 
-        public ChooserTargetInfo(DisplayResolveInfo sourceInfo, ChooserTarget chooserTarget,
+        SelectableTargetInfo(DisplayResolveInfo sourceInfo, ChooserTarget chooserTarget,
                 float modifiedScore) {
             mSourceInfo = sourceInfo;
             mChooserTarget = chooserTarget;
@@ -1460,7 +1581,7 @@
             mFillInFlags = 0;
         }
 
-        private ChooserTargetInfo(ChooserTargetInfo other, Intent fillInIntent, int flags) {
+        private SelectableTargetInfo(SelectableTargetInfo other, Intent fillInIntent, int flags) {
             mSourceInfo = other.mSourceInfo;
             mBackupResolveInfo = other.mBackupResolveInfo;
             mChooserTarget = other.mChooserTarget;
@@ -1616,7 +1737,7 @@
 
         @Override
         public TargetInfo cloneFilledIn(Intent fillInIntent, int flags) {
-            return new ChooserTargetInfo(this, fillInIntent, flags);
+            return new SelectableTargetInfo(this, fillInIntent, flags);
         }
 
         @Override
@@ -1644,7 +1765,9 @@
         private static final int MAX_SERVICE_TARGETS = 4;
         private static final int MAX_TARGETS_PER_SERVICE = 2;
 
-        private final List<ChooserTargetInfo> mServiceTargets = new ArrayList<>();
+        // Reserve spots for incoming direct share targets by adding placeholders
+        private ChooserTargetInfo mPlaceHolderTargetInfo = new PlaceHolderTargetInfo();
+        private List<ChooserTargetInfo> mServiceTargets;
         private final List<TargetInfo> mCallerTargets = new ArrayList<>();
         private boolean mShowServiceTargets;
 
@@ -1663,6 +1786,8 @@
             super(context, payloadIntents, null, rList, launchedFromUid, filterLastUsed,
                     resolverListController);
 
+            mServiceTargets = createPlaceHolders();
+
             if (initialIntents != null) {
                 final PackageManager pm = getPackageManager();
                 for (int i = 0; i < initialIntents.length; i++) {
@@ -1715,6 +1840,14 @@
             }
         }
 
+        private List<ChooserTargetInfo> createPlaceHolders() {
+            List<ChooserTargetInfo> list = new ArrayList<>();
+            for (int i = 0; i < MAX_SERVICE_TARGETS; i++) {
+                list.add(mPlaceHolderTargetInfo);
+            }
+            return list;
+        }
+
         @Override
         public boolean showsExtendedInfo(TargetInfo info) {
             // We have badges so we don't need this text shown.
@@ -1770,22 +1903,33 @@
 
         @Override
         public int getCount() {
-            return super.getCount() + getServiceTargetCount() + getCallerTargetCount();
+            return super.getCount() + getSelectableServiceTargetCount() + getCallerTargetCount();
         }
 
         @Override
         public int getUnfilteredCount() {
-            return super.getUnfilteredCount() + getServiceTargetCount() + getCallerTargetCount();
+            return super.getUnfilteredCount() + getSelectableServiceTargetCount()
+                    + getCallerTargetCount();
         }
 
         public int getCallerTargetCount() {
             return mCallerTargets.size();
         }
 
-        public int getServiceTargetCount() {
-            if (!mShowServiceTargets) {
-                return 0;
+        /**
+          * Filter out placeholders and non-selectable service targets
+          */
+        public int getSelectableServiceTargetCount() {
+            int count = 0;
+            for (ChooserTargetInfo info : mServiceTargets) {
+                if (info instanceof SelectableTargetInfo) {
+                    count++;
+                }
             }
+            return count;
+        }
+
+        public int getServiceTargetCount() {
             return Math.min(mServiceTargets.size(), MAX_SERVICE_TARGETS);
         }
 
@@ -1831,7 +1975,8 @@
             }
             offset += callerTargetCount;
 
-            final int serviceTargetCount = getServiceTargetCount();
+            final int serviceTargetCount = filtered ? getServiceTargetCount() :
+                                               getSelectableServiceTargetCount();
             if (position - offset < serviceTargetCount) {
                 return mServiceTargets.get(position - offset);
             }
@@ -1850,8 +1995,14 @@
             if (mTargetsNeedPruning && targets.size() > 0) {
                 // First proper update since we got an onListRebuilt() with (transient) 0 items.
                 // Clear out the target list and rebuild.
-                mServiceTargets.clear();
+                mServiceTargets = createPlaceHolders();
                 mTargetsNeedPruning = false;
+
+                // Add back any app-supplied direct share targets that may have been
+                // wiped by this clear
+                if (mCallerChooserTargets != null) {
+                    addServiceResults(null, Lists.newArrayList(mCallerChooserTargets));
+                }
             }
 
             final float parentScore = getScore(origTarget);
@@ -1867,7 +2018,7 @@
                     // This incents ChooserTargetServices to define what's truly better.
                     targetScore = lastScore * 0.95f;
                 }
-                insertServiceTarget(new ChooserTargetInfo(origTarget, target, targetScore));
+                insertServiceTarget(new SelectableTargetInfo(origTarget, target, targetScore));
 
                 if (DEBUG) {
                     Log.d(TAG, " => " + target.toString() + " score=" + targetScore
@@ -1889,19 +2040,49 @@
          * Set to true to reveal all service targets at once.
          */
         public void setShowServiceTargets(boolean show) {
+            // mShowServiceTargets is only flipped once to show direct share targets. But after the
+            // initial display the list can be re-sorted and the user will see the target list
+            // change. This will log the initial show and the subsequent shuffle to help us get
+            // accurate timing of the UX.
+            if (show) {
+                getMetricsLogger().write(
+                        new LogMaker(MetricsEvent.ACTION_ACTIVITY_CHOOSER_SHOWN_DIRECT_TARGET)
+                                .setSubtype(mShowServiceTargets ? MetricsEvent.PREVIOUSLY_VISIBLE
+                                        : MetricsEvent.PREVIOUSLY_HIDDEN));
+            }
             if (show != mShowServiceTargets) {
                 mShowServiceTargets = show;
                 notifyDataSetChanged();
-                getMetricsLogger().write(
-                        new LogMaker(MetricsEvent.ACTION_ACTIVITY_CHOOSER_SHOWN_DIRECT_TARGET));
             }
         }
 
+        /**
+         * Calling this marks service target loading complete, and will attempt to no longer
+         * update the direct share area.
+         */
+        public void completeServiceTargetLoading() {
+            mServiceTargets.removeIf(o -> o instanceof PlaceHolderTargetInfo);
+
+            if (mServiceTargets.isEmpty()) {
+                mServiceTargets.add(new EmptyTargetInfo());
+            }
+            notifyDataSetChanged();
+        }
+
         private void insertServiceTarget(ChooserTargetInfo chooserTargetInfo) {
+            // Avoid inserting any potentially late results
+            if (mServiceTargets.size() == 1
+                    && mServiceTargets.get(0) instanceof EmptyTargetInfo) {
+                return;
+            }
+
             final float newScore = chooserTargetInfo.getModifiedScore();
             for (int i = 0, N = mServiceTargets.size(); i < N; i++) {
                 final ChooserTargetInfo serviceTarget = mServiceTargets.get(i);
-                if (newScore > serviceTarget.getModifiedScore()) {
+                if (serviceTarget == null) {
+                    mServiceTargets.set(i, chooserTargetInfo);
+                    return;
+                } else if (newScore > serviceTarget.getModifiedScore()) {
                     mServiceTargets.add(i, chooserTargetInfo);
                     return;
                 }
@@ -1960,7 +2141,7 @@
 
         // There can be at most one row of service targets.
         public int getServiceTargetRowCount() {
-            return (int) mChooserListAdapter.getServiceTargetCount() == 0 ? 0 : 1;
+            return 1;
         }
 
         @Override
@@ -2046,58 +2227,81 @@
             final int start = getFirstRowPosition(rowPosition);
             final int startType = mChooserListAdapter.getPositionTargetType(start);
 
+            final int lastStartType = mChooserListAdapter.getPositionTargetType(
+                    getFirstRowPosition(rowPosition - 1));
+
+            if (startType != lastStartType || rowPosition == 0) {
+                holder.row.setBackground(mChooserRowLayer);
+                setVertPadding(holder, mChooserRowServiceSpacing, 0);
+            } else {
+                holder.row.setBackground(null);
+                setVertPadding(holder, 0, 0);
+            }
+
             int end = start + mColumnCount - 1;
             while (mChooserListAdapter.getPositionTargetType(end) != startType && end >= start) {
                 end--;
             }
 
-            if (startType == ChooserListAdapter.TARGET_SERVICE) {
-                int nextStartType = mChooserListAdapter.getPositionTargetType(
-                        getFirstRowPosition(rowPosition + 1));
-                int serviceSpacing = holder.row.getContext().getResources()
-                        .getDimensionPixelSize(R.dimen.chooser_service_spacing);
-                if (rowPosition == 0 && nextStartType != ChooserListAdapter.TARGET_SERVICE) {
-                    // if the row is the only row for target service
-                    setVertPadding(holder, 0, 0);
-                } else {
-                    int top = rowPosition == 0 ? serviceSpacing : 0;
-                    if (nextStartType != ChooserListAdapter.TARGET_SERVICE) {
-                        setVertPadding(holder, top, serviceSpacing);
-                    } else {
-                        setVertPadding(holder, top, 0);
-                    }
-                }
-            } else {
-                holder.row.setBackgroundColor(Color.TRANSPARENT);
-                int lastStartType = mChooserListAdapter.getPositionTargetType(
-                        getFirstRowPosition(rowPosition - 1));
-                if (lastStartType == ChooserListAdapter.TARGET_SERVICE || rowPosition == 0) {
-                    int serviceSpacing = holder.row.getContext().getResources()
-                            .getDimensionPixelSize(R.dimen.chooser_service_spacing);
-                    setVertPadding(holder, serviceSpacing, 0);
-                } else {
-                    setVertPadding(holder, 0, 0);
-                }
-            }
+            if (end == start && mChooserListAdapter.getItem(start) instanceof EmptyTargetInfo) {
+                final TextView textView = holder.row.findViewById(R.id.chooser_row_text_option);
 
-            final int oldHeight = holder.row.getLayoutParams().height;
-            holder.row.getLayoutParams().height = Math.max(1, holder.measuredRowHeight);
-            if (holder.row.getLayoutParams().height != oldHeight) {
-                holder.row.requestLayout();
+                if (textView.getVisibility() != View.VISIBLE) {
+                    textView.setAlpha(0.0f);
+                    textView.setVisibility(View.VISIBLE);
+                    textView.setText(R.string.chooser_no_direct_share_targets);
+
+                    ValueAnimator fadeAnim = ObjectAnimator.ofFloat(textView, "alpha", 0.0f, 1.0f);
+                    fadeAnim.setInterpolator(new DecelerateInterpolator(1.0f));
+
+                    float translationInPx = getResources().getDimensionPixelSize(
+                            R.dimen.chooser_row_text_option_translate);
+                    textView.setTranslationY(translationInPx);
+                    ValueAnimator translateAnim = ObjectAnimator.ofFloat(textView, "translationY",
+                            0.0f);
+                    translateAnim.setInterpolator(new DecelerateInterpolator(1.0f));
+
+                    AnimatorSet animSet = new AnimatorSet();
+                    animSet.setDuration(NO_DIRECT_SHARE_ANIM_IN_MILLIS);
+                    animSet.setStartDelay(NO_DIRECT_SHARE_ANIM_IN_MILLIS);
+                    animSet.playTogether(fadeAnim, translateAnim);
+                    animSet.start();
+                }
             }
 
             for (int i = 0; i < mColumnCount; i++) {
                 final View v = holder.cells[i];
                 if (start + i <= end) {
-                    v.setVisibility(View.VISIBLE);
+                    setCellVisibility(holder, i, View.VISIBLE);
                     holder.itemIndices[i] = start + i;
                     mChooserListAdapter.bindView(holder.itemIndices[i], v);
                 } else {
-                    v.setVisibility(View.INVISIBLE);
+                    setCellVisibility(holder, i, View.INVISIBLE);
                 }
             }
         }
 
+        private void setCellVisibility(RowViewHolder holder, int i, int visibility) {
+            final View v = holder.cells[i];
+            if (visibility == View.VISIBLE) {
+                holder.cellVisibility[i] = true;
+                v.setVisibility(visibility);
+                v.setAlpha(1.0f);
+            } else if (visibility == View.INVISIBLE && holder.cellVisibility[i]) {
+                holder.cellVisibility[i] = false;
+
+                ValueAnimator fadeAnim = ObjectAnimator.ofFloat(v, "alpha", 1.0f, 0f);
+                fadeAnim.setDuration(NO_DIRECT_SHARE_ANIM_IN_MILLIS);
+                fadeAnim.setInterpolator(new AccelerateInterpolator(1.0f));
+                fadeAnim.addListener(new AnimatorListenerAdapter() {
+                    public void onAnimationEnd(Animator animation) {
+                        v.setVisibility(View.INVISIBLE);
+                    }
+                });
+                fadeAnim.start();
+            }
+        }
+
         private void setVertPadding(RowViewHolder holder, int top, int bottom) {
             holder.row.setPadding(holder.row.getPaddingLeft(), top,
                     holder.row.getPaddingRight(), bottom);
@@ -2124,14 +2328,16 @@
     }
 
     static class RowViewHolder {
-        final View[] cells;
-        final ViewGroup row;
+        public final View[] cells;
+        public final boolean [] cellVisibility;
+        public final ViewGroup row;
         int measuredRowHeight;
         int[] itemIndices;
 
         public RowViewHolder(ViewGroup row, int cellCount) {
             this.row = row;
             this.cells = new View[cellCount];
+            this.cellVisibility = new boolean[cellCount];
             this.itemIndices = new int[cellCount];
         }
 
@@ -2209,8 +2415,6 @@
                 mChooserActivity.unbindService(this);
                 mChooserActivity.mServiceConnections.remove(this);
                 if (mChooserActivity.mServiceConnections.isEmpty()) {
-                    mChooserActivity.mChooserHandler.removeMessages(
-                            CHOOSER_TARGET_SERVICE_WATCHDOG_TIMEOUT);
                     mChooserActivity.sendVoiceChoicesIfNeeded();
                 }
                 mConnectedComponent = null;
diff --git a/core/java/com/android/internal/app/IAppOpsService.aidl b/core/java/com/android/internal/app/IAppOpsService.aidl
index 8a90cad..c4af4c7 100644
--- a/core/java/com/android/internal/app/IAppOpsService.aidl
+++ b/core/java/com/android/internal/app/IAppOpsService.aidl
@@ -32,6 +32,7 @@
     int noteOperation(int code, int uid, String packageName);
     int startOperation(IBinder token, int code, int uid, String packageName,
             boolean startIfModeDefault);
+    @UnsupportedAppUsage
     void finishOperation(IBinder token, int code, int uid, String packageName);
     void startWatchingMode(int op, String packageName, IAppOpsCallback callback);
     void stopWatchingMode(IAppOpsCallback callback);
@@ -42,12 +43,14 @@
 
     // Remaining methods are only used in Java.
     int checkPackage(int uid, String packageName);
+    @UnsupportedAppUsage
     List<AppOpsManager.PackageOps> getPackagesForOps(in int[] ops);
+    @UnsupportedAppUsage
     List<AppOpsManager.PackageOps> getOpsForPackage(int uid, String packageName, in int[] ops);
     void getHistoricalOps(int uid, String packageName, in List<String> ops, long beginTimeMillis,
-            long endTimeMillis, in RemoteCallback callback);
+            long endTimeMillis, int flags, in RemoteCallback callback);
     void getHistoricalOpsFromDiskRaw(int uid, String packageName, in List<String> ops,
-            long beginTimeMillis, long endTimeMillis, in RemoteCallback callback);
+            long beginTimeMillis, long endTimeMillis, int flags, in RemoteCallback callback);
     void offsetHistory(long duration);
     void setHistoryParameters(int mode, long baseSnapshotInterval, int compressionStep);
     void addHistoricalOps(in AppOpsManager.HistoricalOps ops);
@@ -55,7 +58,9 @@
     void clearHistory();
     List<AppOpsManager.PackageOps> getUidOps(int uid, in int[] ops);
     void setUidMode(int code, int uid, int mode);
+    @UnsupportedAppUsage
     void setMode(int code, int uid, String packageName, int mode);
+    @UnsupportedAppUsage
     void resetAllModes(int reqUserId, String reqPackageName);
     int checkAudioOperation(int code, int usage, int uid, String packageName);
     void setAudioRestriction(int code, int usage, int uid, int mode, in String[] exceptionPackages);
diff --git a/core/java/com/android/internal/app/IBatteryStats.aidl b/core/java/com/android/internal/app/IBatteryStats.aidl
index d7514d1..114d31f 100644
--- a/core/java/com/android/internal/app/IBatteryStats.aidl
+++ b/core/java/com/android/internal/app/IBatteryStats.aidl
@@ -49,11 +49,13 @@
     void noteResetFlashlight();
 
     // Remaining methods are only used in Java.
+    @UnsupportedAppUsage
     byte[] getStatistics();
 
     ParcelFileDescriptor getStatisticsStream();
 
     // Return true if we see the battery as currently charging.
+    @UnsupportedAppUsage
     boolean isCharging();
 
     // Return the computed amount of time remaining on battery, in milliseconds.
@@ -62,6 +64,7 @@
 
     // Return the computed amount of time remaining to fully charge, in milliseconds.
     // Returns -1 if nothing could be computed.
+    @UnsupportedAppUsage
     long computeChargeTimeRemaining();
 
     void noteEvent(int code, String name, int uid);
@@ -131,6 +134,7 @@
     void noteDeviceIdleMode(int mode, String activeReason, int activeUid);
     void setBatteryState(int status, int health, int plugType, int level, int temp, int volt,
             int chargeUAh, int chargeFullUAh);
+    @UnsupportedAppUsage
     long getAwakeTimeBattery();
     long getAwakeTimePlugged();
 
diff --git a/core/java/com/android/internal/app/IVoiceInteractionManagerService.aidl b/core/java/com/android/internal/app/IVoiceInteractionManagerService.aidl
index 9ce7ed1..420749e 100644
--- a/core/java/com/android/internal/app/IVoiceInteractionManagerService.aidl
+++ b/core/java/com/android/internal/app/IVoiceInteractionManagerService.aidl
@@ -51,6 +51,7 @@
      * @param keyphraseId The unique identifier for the keyphrase.
      * @param bcp47Locale The BCP47 language tag  for the keyphrase's locale.
      */
+    @UnsupportedAppUsage
     SoundTrigger.KeyphraseSoundModel getKeyphraseSoundModel(int keyphraseId, in String bcp47Locale);
     /**
      * Add/Update the given keyphrase sound model.
diff --git a/core/java/com/android/internal/app/ResolverActivity.java b/core/java/com/android/internal/app/ResolverActivity.java
index 0919911..011cc04 100644
--- a/core/java/com/android/internal/app/ResolverActivity.java
+++ b/core/java/com/android/internal/app/ResolverActivity.java
@@ -28,6 +28,7 @@
 import android.app.VoiceInteractor.PickOptionRequest;
 import android.app.VoiceInteractor.PickOptionRequest.Option;
 import android.app.VoiceInteractor.Prompt;
+import android.app.role.RoleManager;
 import android.content.ComponentName;
 import android.content.Context;
 import android.content.Intent;
@@ -194,7 +195,7 @@
                 com.android.internal.R.string.whichHomeApplicationNamed,
                 com.android.internal.R.string.whichHomeApplicationLabel);
 
-        // SpR.id.buttonecial titles for BROWSABLE components
+        // titles for layout that deals with http(s) intents
         public static final int BROWSABLE_TITLE_RES =
                 com.android.internal.R.string.whichGiveAccessToApplication;
         public static final int BROWSABLE_NAMED_TITLE_RES =
@@ -302,7 +303,7 @@
 
         mUseLayoutForBrowsables = getTargetIntent() == null
                 ? false
-                : getTargetIntent().hasCategory(Intent.CATEGORY_BROWSABLE);
+                : isHttpSchemeAndViewAction(getTargetIntent());
 
         // We don't want to support Always Use if browsable layout is being used,
         // as to mitigate Intent Capturing vulnerability
@@ -473,8 +474,8 @@
         final boolean named = mAdapter.getFilteredPosition() >= 0;
         if (title == ActionTitle.DEFAULT && defaultTitleRes != 0) {
             return getString(defaultTitleRes);
-        } else if (intent.hasCategory(Intent.CATEGORY_BROWSABLE)) {
-            // If the Intent is BROWSABLE then we need to warn the user that
+        } else if (isHttpSchemeAndViewAction(intent)) {
+            // If the Intent's scheme is http(s) then we need to warn the user that
             // they're giving access for the activity to open URLs from this specific host
             return named
                     ? getString(ActionTitle.BROWSABLE_NAMED_TITLE_RES, intent.getData().getHost(),
@@ -583,6 +584,12 @@
         resetButtonBar();
     }
 
+    private boolean isHttpSchemeAndViewAction(Intent intent) {
+        return (IntentFilter.SCHEME_HTTP.equals(intent.getScheme())
+                || IntentFilter.SCHEME_HTTPS.equals(intent.getScheme()))
+                && Intent.ACTION_VIEW.equals(intent.getAction());
+    }
+
     private boolean hasManagedProfile() {
         UserManager userManager = (UserManager) getSystemService(Context.USER_SERVICE);
         if (userManager == null) {
@@ -645,10 +652,18 @@
 
     private void showSettingsForSelected(int which, boolean hasIndexBeenFiltered) {
         ResolveInfo ri = mAdapter.resolveInfoForPosition(which, hasIndexBeenFiltered);
-        Intent in = new Intent().setAction(Settings.ACTION_APP_OPEN_BY_DEFAULT_SETTINGS)
-                .setData(Uri.fromParts("package", ri.activityInfo.packageName, null))
-                .addFlags(Intent.FLAG_ACTIVITY_NEW_DOCUMENT);
-        startActivity(in);
+        Intent intent = new Intent();
+        // For browsers, we open the Default Browser page
+        // For regular apps, we open the Open by Default page
+        if (ri.handleAllWebDataURI) {
+            intent.setAction(Intent.ACTION_MANAGE_DEFAULT_APP)
+                    .putExtra(Intent.EXTRA_ROLE_NAME, RoleManager.ROLE_BROWSER);
+        } else {
+            intent.setAction(Settings.ACTION_APP_OPEN_BY_DEFAULT_SETTINGS)
+                    .setData(Uri.fromParts("package", ri.activityInfo.packageName, null))
+                    .addFlags(Intent.FLAG_ACTIVITY_NEW_DOCUMENT);
+        }
+        startActivity(intent);
     }
 
     public void startSelected(int which, boolean always, boolean hasIndexBeenFiltered) {
diff --git a/core/java/com/android/internal/appwidget/IAppWidgetService.aidl b/core/java/com/android/internal/appwidget/IAppWidgetService.aidl
index f9bf373..6d1d1ab 100644
--- a/core/java/com/android/internal/appwidget/IAppWidgetService.aidl
+++ b/core/java/com/android/internal/appwidget/IAppWidgetService.aidl
@@ -42,6 +42,7 @@
     void deleteAppWidgetId(String callingPackage, int appWidgetId);
     void deleteHost(String packageName, int hostId);
     void deleteAllHosts();
+    @UnsupportedAppUsage
     RemoteViews getAppWidgetViews(String callingPackage, int appWidgetId);
     int[] getAppWidgetIdsForHost(String callingPackage, int hostId);
     IntentSender createAppWidgetConfigIntentSender(String callingPackage, int appWidgetId,
@@ -63,11 +64,14 @@
     AppWidgetProviderInfo getAppWidgetInfo(String callingPackage, int appWidgetId);
     boolean hasBindAppWidgetPermission(in String packageName, int userId);
     void setBindAppWidgetPermission(in String packageName, int userId, in boolean permission);
+    @UnsupportedAppUsage
     boolean bindAppWidgetId(in String callingPackage, int appWidgetId,
             int providerProfileId, in ComponentName providerComponent, in Bundle options);
+    @UnsupportedAppUsage
     boolean bindRemoteViewsService(String callingPackage, int appWidgetId, in Intent intent,
             IApplicationThread caller, IBinder token, IServiceConnection connection, int flags);
 
+    @UnsupportedAppUsage
     int[] getAppWidgetIds(in ComponentName providerComponent);
     boolean isBoundWidgetPackage(String packageName, int userId);
     boolean requestPinAppWidget(String packageName, in ComponentName providerComponent,
diff --git a/core/java/com/android/internal/colorextraction/types/Tonal.java b/core/java/com/android/internal/colorextraction/types/Tonal.java
index d6a8934..9d85a03 100644
--- a/core/java/com/android/internal/colorextraction/types/Tonal.java
+++ b/core/java/com/android/internal/colorextraction/types/Tonal.java
@@ -56,7 +56,6 @@
 
     private final TonalPalette mGreyPalette;
     private final ArrayList<TonalPalette> mTonalPalettes;
-    private final ArrayList<ColorRange> mBlacklistedColors;
 
     // Temporary variable to avoid allocations
     private float[] mTmpHSL = new float[3];
@@ -65,7 +64,6 @@
 
         ConfigParser parser = new ConfigParser(context);
         mTonalPalettes = parser.getTonalPalettes();
-        mBlacklistedColors = parser.getBlacklistedColors();
 
         mGreyPalette = mTonalPalettes.get(0);
         mTonalPalettes.remove(0);
@@ -131,7 +129,7 @@
                     Color.blue(colorValue), hsl);
 
             // Stop when we find a color that meets our criteria
-            if (!generatedFromBitmap || !isBlacklisted(hsl)) {
+            if (!generatedFromBitmap) {
                 bestColor = color;
                 break;
             }
@@ -300,22 +298,6 @@
         return getColorPalette(palette.h, palette.s, palette.l);
     }
 
-
-    /**
-     * Checks if a given color exists in the blacklist
-     * @param hsl float array with 3 components (H 0..360, S 0..1 and L 0..1)
-     * @return true if color should be avoided
-     */
-    private boolean isBlacklisted(float[] hsl) {
-        for (int i = mBlacklistedColors.size() - 1; i >= 0; i--) {
-            ColorRange badRange = mBlacklistedColors.get(i);
-            if (badRange.containsColor(hsl[0], hsl[1], hsl[2])) {
-                return true;
-            }
-        }
-        return false;
-    }
-
     /**
      * Offsets all colors by a delta, clamping values that go beyond what's
      * supported on the color space.
@@ -364,11 +346,6 @@
         return minErrorIndex;
     }
 
-    @VisibleForTesting
-    public List<ColorRange> getBlacklistedColors() {
-        return mBlacklistedColors;
-    }
-
     @Nullable
     private TonalPalette findTonalPalette(float h, float s) {
         // Fallback to a grey palette if the color is too desaturated.
@@ -502,11 +479,9 @@
     @VisibleForTesting
     public static class ConfigParser {
         private final ArrayList<TonalPalette> mTonalPalettes;
-        private final ArrayList<ColorRange> mBlacklistedColors;
 
         public ConfigParser(Context context) {
             mTonalPalettes = new ArrayList<>();
-            mBlacklistedColors = new ArrayList<>();
 
             // Load all palettes and the blacklist from an XML.
             try {
@@ -520,8 +495,6 @@
                         String tagName = parser.getName();
                         if (tagName.equals("palettes")) {
                             parsePalettes(parser);
-                        } else if (tagName.equals("blacklist")) {
-                            parseBlacklist(parser);
                         }
                     } else {
                         throw new XmlPullParserException("Invalid XML event " + eventType + " - "
@@ -538,28 +511,6 @@
             return mTonalPalettes;
         }
 
-        public ArrayList<ColorRange> getBlacklistedColors() {
-            return mBlacklistedColors;
-        }
-
-        private void parseBlacklist(XmlPullParser parser)
-                throws XmlPullParserException, IOException {
-            parser.require(XmlPullParser.START_TAG, null, "blacklist");
-            while (parser.next() != XmlPullParser.END_TAG) {
-                if (parser.getEventType() != XmlPullParser.START_TAG) {
-                    continue;
-                }
-                String name = parser.getName();
-                // Starts by looking for the entry tag
-                if (name.equals("range")) {
-                    mBlacklistedColors.add(readRange(parser));
-                    parser.next();
-                } else {
-                    throw new XmlPullParserException("Invalid tag: " + name, parser, null);
-                }
-            }
-        }
-
         private ColorRange readRange(XmlPullParser parser)
                 throws XmlPullParserException, IOException {
             parser.require(XmlPullParser.START_TAG, null, "range");
diff --git a/core/java/com/android/internal/config/sysui/SystemUiDeviceConfigFlags.java b/core/java/com/android/internal/config/sysui/SystemUiDeviceConfigFlags.java
new file mode 100644
index 0000000..fd74c04
--- /dev/null
+++ b/core/java/com/android/internal/config/sysui/SystemUiDeviceConfigFlags.java
@@ -0,0 +1,99 @@
+/**
+ * Copyright (C) 2019 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 com.android.internal.config.sysui;
+
+/**
+ * Keeps the flags related to the SystemUI namespace in {@link DeviceConfig}.
+ *
+ * @hide
+ */
+public final class SystemUiDeviceConfigFlags {
+
+    // Flags related to NotificationAssistant
+
+    /**
+     * Whether the Notification Assistant should generate replies for notifications.
+     */
+    public static final String NAS_GENERATE_REPLIES = "nas_generate_replies";
+
+    /**
+     * Whether the Notification Assistant should generate contextual actions for notifications.
+     */
+    public static final String NAS_GENERATE_ACTIONS = "nas_generate_actions";
+
+    /**
+     * The maximum number of messages the Notification Assistant should extract from a
+     * conversation when constructing responses for that conversation.
+     */
+    public static final String NAS_MAX_MESSAGES_TO_EXTRACT = "nas_max_messages_to_extract";
+
+    /**
+     * The maximum number of suggestions the Notification Assistant should provide for a
+     * messaging conversation.
+     */
+    public static final String NAS_MAX_SUGGESTIONS = "nas_max_suggestions";
+
+    // Flags related to Smart Suggestions - these are read in SmartReplyConstants.
+
+    /** (boolean) Whether to enable smart suggestions in notifications. */
+    public static final String SSIN_ENABLED = "ssin_enabled";
+
+    /**
+     * (boolean) Whether apps need to target at least P to provide their own smart replies (this
+     * doesn't apply to actions!).
+     */
+    public static final String SSIN_REQUIRES_TARGETING_P = "ssin_requires_targeting_p";
+
+    /**
+     * (int) The number of times we'll try to find a better line-break for double-line smart
+     * suggestion buttons.
+     */
+    public static final String SSIN_MAX_SQUEEZE_REMEASURE_ATTEMPTS =
+            "ssin_max_squeeze_remeasure_attempts";
+
+    /** (boolean) Whether to let the user edit smart replies before sending. */
+    public static final String SSIN_EDIT_CHOICES_BEFORE_SENDING =
+            "ssin_edit_choices_before_sending";
+
+    /** (boolean) Whether smart suggestions should be enabled in heads-up notifications. */
+    public static final String SSIN_SHOW_IN_HEADS_UP = "ssin_show_in_heads_up";
+
+    /** (int) Minimum number of system generated replies to show in a notification. */
+    public static final String SSIN_MIN_NUM_SYSTEM_GENERATED_REPLIES =
+            "ssin_min_num_system_generated_replies";
+
+    /**
+     * (int) Maximum number of actions to show in a notification, -1 if there shouldn't be a limit
+     */
+    public static final String SSIN_MAX_NUM_ACTIONS = "ssin_max_num_actions";
+
+    /**
+     * The default component of
+     * {@link android.service.notification.NotificationAssistantService}.
+     */
+    public static final String NAS_DEFAULT_SERVICE = "nas_default_service";
+
+    // Flags related to media notifications
+
+    /**
+     * (boolean) If {@code true}, enables the seekbar in compact media notifications.
+     */
+    public static final String COMPACT_MEDIA_SEEKBAR_ENABLED =
+            "compact_media_notification_seekbar_enabled";
+
+    private SystemUiDeviceConfigFlags() { }
+}
diff --git a/core/java/com/android/internal/infra/AbstractMultiplePendingRequestsRemoteService.java b/core/java/com/android/internal/infra/AbstractMultiplePendingRequestsRemoteService.java
index 293ffd3..37f61bf 100644
--- a/core/java/com/android/internal/infra/AbstractMultiplePendingRequestsRemoteService.java
+++ b/core/java/com/android/internal/infra/AbstractMultiplePendingRequestsRemoteService.java
@@ -19,6 +19,7 @@
 import android.annotation.NonNull;
 import android.content.ComponentName;
 import android.content.Context;
+import android.os.Handler;
 import android.os.IInterface;
 import android.util.Slog;
 
@@ -43,10 +44,10 @@
 
     public AbstractMultiplePendingRequestsRemoteService(@NonNull Context context,
             @NonNull String serviceInterface, @NonNull ComponentName componentName, int userId,
-            @NonNull VultureCallback<S> callback, boolean bindInstantServiceAllowed,
-            boolean verbose, int initialCapacity) {
-        super(context, serviceInterface, componentName, userId, callback, bindInstantServiceAllowed,
-                verbose);
+            @NonNull VultureCallback<S> callback, @NonNull Handler handler,
+            boolean bindInstantServiceAllowed, boolean verbose, int initialCapacity) {
+        super(context, serviceInterface, componentName, userId, callback, handler,
+                bindInstantServiceAllowed, verbose);
         mInitialCapacity = initialCapacity;
     }
 
diff --git a/core/java/com/android/internal/infra/AbstractRemoteService.java b/core/java/com/android/internal/infra/AbstractRemoteService.java
index f4c904d..2e709de 100644
--- a/core/java/com/android/internal/infra/AbstractRemoteService.java
+++ b/core/java/com/android/internal/infra/AbstractRemoteService.java
@@ -28,7 +28,6 @@
 import android.os.IBinder;
 import android.os.IBinder.DeathRecipient;
 import android.os.IInterface;
-import android.os.Looper;
 import android.os.RemoteException;
 import android.os.SystemClock;
 import android.os.UserHandle;
@@ -114,14 +113,14 @@
     // NOTE: must be package-protected so this class is not extended outside
     AbstractRemoteService(@NonNull Context context, @NonNull String serviceInterface,
             @NonNull ComponentName componentName, int userId, @NonNull VultureCallback<S> callback,
-            boolean bindInstantServiceAllowed, boolean verbose) {
+            @NonNull Handler handler, boolean bindInstantServiceAllowed, boolean verbose) {
         mContext = context;
         mVultureCallback = callback;
         mVerbose = verbose;
         mComponentName = componentName;
         mIntent = new Intent(serviceInterface).setComponent(mComponentName);
         mUserId = userId;
-        mHandler = new Handler(Looper.getMainLooper());
+        mHandler = new Handler(handler.getLooper());
         mBindInstantServiceAllowed = bindInstantServiceAllowed;
     }
 
@@ -480,6 +479,11 @@
         return mDestroyed;
     }
 
+    @Override
+    public String toString() {
+        return getClass().getSimpleName() + "[" + mComponentName + "]";
+    }
+
     /**
      * Base class for the requests serviced by the remote service.
      *
diff --git a/core/java/com/android/internal/infra/AbstractSinglePendingRequestRemoteService.java b/core/java/com/android/internal/infra/AbstractSinglePendingRequestRemoteService.java
index 3e92a0b..a70fc3e 100644
--- a/core/java/com/android/internal/infra/AbstractSinglePendingRequestRemoteService.java
+++ b/core/java/com/android/internal/infra/AbstractSinglePendingRequestRemoteService.java
@@ -19,6 +19,7 @@
 import android.annotation.NonNull;
 import android.content.ComponentName;
 import android.content.Context;
+import android.os.Handler;
 import android.os.IInterface;
 import android.util.Slog;
 
@@ -42,10 +43,10 @@
 
     public AbstractSinglePendingRequestRemoteService(@NonNull Context context,
             @NonNull String serviceInterface, @NonNull ComponentName componentName, int userId,
-            @NonNull VultureCallback<S> callback, boolean bindInstantServiceAllowed,
-            boolean verbose) {
-        super(context, serviceInterface, componentName, userId, callback, bindInstantServiceAllowed,
-                verbose);
+            @NonNull VultureCallback<S> callback, @NonNull Handler handler,
+            boolean bindInstantServiceAllowed, boolean verbose) {
+        super(context, serviceInterface, componentName, userId, callback, handler,
+                bindInstantServiceAllowed, verbose);
     }
 
     @Override // from AbstractRemoteService
diff --git a/core/java/com/android/internal/infra/WhitelistHelper.java b/core/java/com/android/internal/infra/WhitelistHelper.java
new file mode 100644
index 0000000..183b465
--- /dev/null
+++ b/core/java/com/android/internal/infra/WhitelistHelper.java
@@ -0,0 +1,177 @@
+/*
+ * Copyright (C) 2019 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 com.android.internal.infra;
+
+import android.annotation.NonNull;
+import android.annotation.Nullable;
+import android.content.ComponentName;
+import android.util.ArrayMap;
+import android.util.ArraySet;
+import android.util.Log;
+
+import com.android.internal.util.Preconditions;
+
+import java.io.PrintWriter;
+import java.util.List;
+
+/**
+ * Helper class for keeping track of whitelisted packages/activities.
+ *
+ * @hide
+ */
+public final class WhitelistHelper {
+
+    private static final String TAG = "WhitelistHelper";
+
+    /**
+     * Map of whitelisted packages/activities. The whole package is whitelisted if its
+     * corresponding value is {@code null}.
+     */
+    @Nullable
+    private ArrayMap<String, ArraySet<ComponentName>> mWhitelistedPackages;
+
+    /**
+     * Sets the whitelist with the given packages and activities. The list is cleared if both
+     * packageNames and components are {@code null}.
+     *
+     * @param packageNames packages to be whitelisted.
+     * @param components activities to be whitelisted.
+     *
+     * @throws IllegalArgumentException if packages or components are empty.
+     */
+    public void setWhitelist(@Nullable ArraySet<String> packageNames,
+            @Nullable ArraySet<ComponentName> components) {
+        mWhitelistedPackages = null;
+        if (packageNames == null && components == null) return;
+
+        if ((packageNames != null && packageNames.isEmpty())
+                || (components != null && components.isEmpty())) {
+            throw new IllegalArgumentException("Packages or Components cannot be empty.");
+        }
+
+        mWhitelistedPackages = new ArrayMap<>();
+
+        if (packageNames != null) {
+            for (int i = 0; i < packageNames.size(); i++) {
+                mWhitelistedPackages.put(packageNames.valueAt(i), null);
+            }
+        }
+
+        if (components != null) {
+            for (int i = 0; i < components.size(); i++) {
+                final ComponentName component = components.valueAt(i);
+                if (component == null) {
+                    Log.w(TAG, "setWhitelist(): component is null");
+                    continue;
+                }
+
+                final String packageName = component.getPackageName();
+                ArraySet<ComponentName> set = mWhitelistedPackages.get(packageName);
+                if (set == null) {
+                    set = new ArraySet<>();
+                    mWhitelistedPackages.put(packageName, set);
+                }
+                set.add(component);
+            }
+        }
+    }
+
+    /**
+     * Helper to use {@link #setWhitelist(ArraySet, ArraySet)} with {@link List Lists}.
+     */
+    public void setWhitelist(@Nullable List<String> packageNames,
+            @Nullable List<ComponentName> components) {
+        final ArraySet<String> packageNamesSet = packageNames == null ? null
+                : new ArraySet<>(packageNames);
+        final ArraySet<ComponentName> componentssSet = components == null ? null
+                : new ArraySet<>(components);
+        setWhitelist(packageNamesSet, componentssSet);
+    }
+
+    /**
+     * Returns {@code true} if the entire package is whitelisted.
+     */
+    public boolean isWhitelisted(@NonNull String packageName) {
+        Preconditions.checkNotNull(packageName);
+
+        if (mWhitelistedPackages == null) return false;
+
+        return mWhitelistedPackages.containsKey(packageName)
+                && mWhitelistedPackages.get(packageName) == null;
+    }
+
+    /**
+     * Returns {@code true} if the specified activity is whitelisted.
+     */
+    public boolean isWhitelisted(@NonNull ComponentName componentName) {
+        Preconditions.checkNotNull(componentName);
+
+        final String packageName = componentName.getPackageName();
+        final ArraySet<ComponentName> whitelistedComponents = getWhitelistedComponents(packageName);
+        if (whitelistedComponents != null) {
+            return whitelistedComponents.contains(componentName);
+        }
+
+        return isWhitelisted(packageName);
+    }
+
+    /**
+     * Returns a set of whitelisted components with the given package, or null if nothing is
+     * whitelisted.
+     */
+    @Nullable
+    public ArraySet<ComponentName> getWhitelistedComponents(@NonNull String packageName) {
+        Preconditions.checkNotNull(packageName);
+
+        return mWhitelistedPackages == null ? null : mWhitelistedPackages.get(packageName);
+    }
+
+    @Override
+    public String toString() {
+        return "WhitelistHelper[" + mWhitelistedPackages + ']';
+    }
+
+    /**
+     * Dumps it!
+     */
+    public void dump(@NonNull String prefix, @NonNull String message, @NonNull PrintWriter pw) {
+        if (mWhitelistedPackages == null || mWhitelistedPackages.size() == 0) {
+            pw.print(prefix); pw.print(message); pw.println(": (no whitelisted packages)");
+            return;
+        }
+
+        final String prefix2 = prefix + "  ";
+        final int size = mWhitelistedPackages.size();
+        pw.print(prefix); pw.print(message); pw.print(": "); pw.print(size);
+        pw.println(" packages");
+        for (int i = 0; i < mWhitelistedPackages.size(); i++) {
+            final String packageName = mWhitelistedPackages.keyAt(i);
+            final ArraySet<ComponentName> components = mWhitelistedPackages.valueAt(i);
+            pw.print(prefix2); pw.print(i); pw.print("."); pw.print(packageName); pw.print(": ");
+            if (components == null) {
+                pw.println("(whole package)");
+                continue;
+            }
+
+            pw.print("["); pw.print(components.valueAt(0));
+            for (int j = 1; j < components.size(); j++) {
+                pw.print(", "); pw.print(components.valueAt(i));
+            }
+            pw.println("]");
+        }
+    }
+}
diff --git a/core/java/com/android/internal/net/VpnProfile.java b/core/java/com/android/internal/net/VpnProfile.java
index ec02432..940cc36 100644
--- a/core/java/com/android/internal/net/VpnProfile.java
+++ b/core/java/com/android/internal/net/VpnProfile.java
@@ -18,6 +18,8 @@
 
 import android.annotation.UnsupportedAppUsage;
 import android.os.Build;
+import android.net.ProxyInfo;
+import android.net.Uri;
 import android.os.Parcel;
 import android.os.Parcelable;
 import android.text.TextUtils;
@@ -46,6 +48,10 @@
     public static final int TYPE_IPSEC_HYBRID_RSA = 5;
     public static final int TYPE_MAX = 5;
 
+    // Match these constants with R.array.vpn_proxy_settings.
+    public static final int PROXY_NONE = 0;
+    public static final int PROXY_MANUAL = 1;
+
     // Entity fields.
     @UnsupportedAppUsage
     public final String key;           // -1
@@ -68,6 +74,7 @@
     public String ipsecUserCert = "";  // 12
     public String ipsecCaCert = "";    // 13
     public String ipsecServerCert = "";// 14
+    public ProxyInfo proxy = null;     // 15~18
 
     // Helper fields.
     @UnsupportedAppUsage
@@ -96,6 +103,7 @@
         ipsecCaCert = in.readString();
         ipsecServerCert = in.readString();
         saveLogin = in.readInt() != 0;
+        proxy = in.readParcelable(null);
     }
 
     @Override
@@ -117,6 +125,7 @@
         out.writeString(ipsecCaCert);
         out.writeString(ipsecServerCert);
         out.writeInt(saveLogin ? 1 : 0);
+        out.writeParcelable(proxy, flags);
     }
 
     @UnsupportedAppUsage
@@ -127,8 +136,8 @@
             }
 
             String[] values = new String(value, StandardCharsets.UTF_8).split("\0", -1);
-            // There can be 14 or 15 values in ICS MR1.
-            if (values.length < 14 || values.length > 15) {
+            // There can be 14 - 19 Bytes in values.length.
+            if (values.length < 14 || values.length > 19) {
                 return null;
             }
 
@@ -151,7 +160,18 @@
             profile.ipsecUserCert = values[12];
             profile.ipsecCaCert = values[13];
             profile.ipsecServerCert = (values.length > 14) ? values[14] : "";
-
+            if (values.length > 15) {
+                String host = (values.length > 15) ? values[15] : "";
+                String port = (values.length > 16) ? values[16] : "";
+                String exclList = (values.length > 17) ? values[17] : "";
+                String pacFileUrl = (values.length > 18) ? values[18] : "";
+                if (pacFileUrl.isEmpty()) {
+                    profile.proxy = new ProxyInfo(host, port.isEmpty() ?
+                            0 : Integer.parseInt(port), exclList);
+                } else {
+                    profile.proxy = new ProxyInfo(pacFileUrl);
+                }
+            } // else profle.proxy = null
             profile.saveLogin = !profile.username.isEmpty() || !profile.password.isEmpty();
             return profile;
         } catch (Exception e) {
@@ -176,6 +196,13 @@
         builder.append('\0').append(ipsecUserCert);
         builder.append('\0').append(ipsecCaCert);
         builder.append('\0').append(ipsecServerCert);
+        if (proxy != null) {
+            builder.append('\0').append(proxy.getHost() != null ? proxy.getHost() : "");
+            builder.append('\0').append(proxy.getPort());
+            builder.append('\0').append(proxy.getExclusionListAsString() != null ?
+                    proxy.getExclusionListAsString() : "");
+            builder.append('\0').append(proxy.getPacFileUrl().toString());
+        }
         return builder.toString().getBytes(StandardCharsets.UTF_8);
     }
 
diff --git a/core/java/com/android/internal/os/BinderCallsStats.java b/core/java/com/android/internal/os/BinderCallsStats.java
index bab4787..0fb2728 100644
--- a/core/java/com/android/internal/os/BinderCallsStats.java
+++ b/core/java/com/android/internal/os/BinderCallsStats.java
@@ -54,7 +54,7 @@
     public static final int PERIODIC_SAMPLING_INTERVAL_DEFAULT = 1000;
     public static final boolean DEFAULT_TRACK_SCREEN_INTERACTIVE = false;
     public static final boolean DEFAULT_TRACK_DIRECT_CALLING_UID = true;
-    public static final int MAX_BINDER_CALL_STATS_COUNT_DEFAULT = 5000;
+    public static final int MAX_BINDER_CALL_STATS_COUNT_DEFAULT = 1500;
     private static final String DEBUG_ENTRY_PREFIX = "__DEBUG_";
 
     private static class OverflowBinder extends Binder {}
@@ -212,7 +212,7 @@
                 // It helps to keep the memory usage down when sampling is enabled.
                 final CallStat callStat = uidEntry.get(
                         callingUid, s.binderClass, s.transactionCode,
-                        mDeviceState.isScreenInteractive());
+                        screenInteractive);
                 if (callStat != null) {
                     callStat.callCount++;
                 }
@@ -344,6 +344,7 @@
             resultCallStats.add(createDebugEntry("end_time_millis", SystemClock.elapsedRealtime()));
             resultCallStats.add(
                     createDebugEntry("battery_time_millis", mBatteryStopwatch.getMillis()));
+            resultCallStats.add(createDebugEntry("sampling_interval", mPeriodicSamplingInterval));
         }
 
         return resultCallStats;
diff --git a/core/java/com/android/internal/os/ClassLoaderFactory.java b/core/java/com/android/internal/os/ClassLoaderFactory.java
index c5bc45a..99a1a19 100644
--- a/core/java/com/android/internal/os/ClassLoaderFactory.java
+++ b/core/java/com/android/internal/os/ClassLoaderFactory.java
@@ -115,20 +115,13 @@
         final ClassLoader classLoader = createClassLoader(dexPath, librarySearchPath, parent,
                 classLoaderName, sharedLibraries);
 
-        boolean isForVendor = false;
-        for (String path : dexPath.split(":")) {
-            if (path.startsWith("/vendor/")) {
-                isForVendor = true;
-                break;
-            }
-        }
         Trace.traceBegin(Trace.TRACE_TAG_ACTIVITY_MANAGER, "createClassloaderNamespace");
         String errorMessage = createClassloaderNamespace(classLoader,
                                                          targetSdkVersion,
                                                          librarySearchPath,
                                                          libraryPermittedPath,
                                                          isNamespaceShared,
-                                                         isForVendor);
+                                                         dexPath);
         Trace.traceEnd(Trace.TRACE_TAG_ACTIVITY_MANAGER);
 
         if (errorMessage != null) {
@@ -144,5 +137,5 @@
                                                             String librarySearchPath,
                                                             String libraryPermittedPath,
                                                             boolean isNamespaceShared,
-                                                            boolean isForVendor);
+                                                            String dexPath);
 }
diff --git a/core/java/com/android/internal/os/IDropBoxManagerService.aidl b/core/java/com/android/internal/os/IDropBoxManagerService.aidl
index 70844ee..5e60394 100644
--- a/core/java/com/android/internal/os/IDropBoxManagerService.aidl
+++ b/core/java/com/android/internal/os/IDropBoxManagerService.aidl
@@ -37,5 +37,6 @@
     boolean isTagEnabled(String tag);
 
     /** @see DropBoxManager#getNextEntry */
+    @UnsupportedAppUsage
     DropBoxManager.Entry getNextEntry(String tag, long millis, String packageName);
 }
diff --git a/core/java/com/android/internal/os/KernelCpuThreadReader.java b/core/java/com/android/internal/os/KernelCpuThreadReader.java
index 6bbfc2b..6a9db10 100644
--- a/core/java/com/android/internal/os/KernelCpuThreadReader.java
+++ b/core/java/com/android/internal/os/KernelCpuThreadReader.java
@@ -103,6 +103,16 @@
     private static final int ID_ERROR = -1;
 
     /**
+     * Thread ID used when reporting CPU used by other threads
+     */
+    private static final int OTHER_THREADS_ID = -1;
+
+    /**
+     * Thread name used when reporting CPU used by other threads
+     */
+    private static final String OTHER_THREADS_NAME = "__OTHER_THREADS";
+
+    /**
      * When checking whether to report data for a thread, we check the UID of the thread's owner
      * against this predicate
      */
@@ -140,9 +150,10 @@
     /**
      * Create with a path where `proc` is mounted. Used primarily for testing
      *
-     * @param procPath where `proc` is mounted (to find, see {@code mount | grep ^proc})
+     * @param procPath               where `proc` is mounted (to find, see {@code mount | grep
+     *                               ^proc})
      * @param initialTimeInStatePath where the initial {@code time_in_state} file exists to define
-     * format
+     *                               format
      */
     @VisibleForTesting
     public KernelCpuThreadReader(
@@ -250,8 +261,8 @@
      * Read all of the CPU usage statistics for each child thread of a process
      *
      * @param processPath the {@code /proc} path of the thread
-     * @param processId the ID of the process
-     * @param uid the ID of the user who owns the process
+     * @param processId   the ID of the process
+     * @param uid         the ID of the user who owns the process
      * @return process CPU usage containing usage of all child threads. Null if the process exited
      * and its {@code proc} directory was removed while collecting information
      */
@@ -263,14 +274,24 @@
                     + " and user ID " + uid);
         }
 
+        int[] filteredThreadsCpuUsage = null;
         final Path allThreadsPath = processPath.resolve("task");
         final ArrayList<ThreadCpuUsage> threadCpuUsages = new ArrayList<>();
         try (DirectoryStream<Path> threadPaths = Files.newDirectoryStream(allThreadsPath)) {
             for (Path threadDirectory : threadPaths) {
                 ThreadCpuUsage threadCpuUsage = getThreadCpuUsage(threadDirectory);
-                if (threadCpuUsage != null) {
-                    threadCpuUsages.add(threadCpuUsage);
+                if (threadCpuUsage == null) {
+                    continue;
                 }
+                if (mMinimumTotalCpuUsageMillis < totalCpuUsage(threadCpuUsage.usageTimesMillis)) {
+                    if (filteredThreadsCpuUsage == null) {
+                        filteredThreadsCpuUsage = new int[mFrequenciesKhz.length];
+                    }
+                    filteredThreadsCpuUsage =
+                            sumCpuUsage(filteredThreadsCpuUsage, threadCpuUsage.usageTimesMillis);
+                    continue;
+                }
+                threadCpuUsages.add(threadCpuUsage);
             }
         } catch (IOException e) {
             // Expected when a process finishes
@@ -282,6 +303,12 @@
             return null;
         }
 
+        // Add the filtered out thread CPU usage under an "other threads" ThreadCpuUsage
+        if (filteredThreadsCpuUsage != null) {
+            threadCpuUsages.add(new ThreadCpuUsage(
+                    OTHER_THREADS_ID, OTHER_THREADS_NAME, filteredThreadsCpuUsage));
+        }
+
         if (DEBUG) {
             Slog.d(TAG, "Read CPU usage of " + threadCpuUsages.size() + " threads");
         }
@@ -368,15 +395,6 @@
         }
         int[] cpuUsages = mFrequencyBucketCreator.getBucketedValues(cpuUsagesLong);
 
-        // Check if the total CPU usage below the threshold
-        int totalCpuUsage = 0;
-        for (int i = 0; i < cpuUsages.length; i++) {
-            totalCpuUsage += cpuUsages[i];
-        }
-        if (totalCpuUsage < mMinimumTotalCpuUsageMillis) {
-            return null;
-        }
-
         return new ThreadCpuUsage(threadId, threadName, cpuUsages);
     }
 
@@ -424,6 +442,28 @@
     }
 
     /**
+     * Get the sum of all CPU usage across all frequencies
+     */
+    private static int totalCpuUsage(int[] cpuUsage) {
+        int total = 0;
+        for (int i = 0; i < cpuUsage.length; i++) {
+            total += cpuUsage[i];
+        }
+        return total;
+    }
+
+    /**
+     * Add two CPU frequency usages together
+     */
+    private static int[] sumCpuUsage(int[] a, int[] b) {
+        int[] summed = new int[a.length];
+        for (int i = 0; i < a.length; i++) {
+            summed[i] = a[i] + b[i];
+        }
+        return summed;
+    }
+
+    /**
      * Puts frequencies and usage times into buckets
      */
     @VisibleForTesting
@@ -440,7 +480,7 @@
          * Buckets based of a list of frequencies
          *
          * @param frequencies the frequencies to base buckets off
-         * @param numBuckets how many buckets to create
+         * @param numBuckets  how many buckets to create
          */
         @VisibleForTesting
         public FrequencyBucketCreator(long[] frequencies, int numBuckets) {
diff --git a/core/java/com/android/internal/os/KernelCpuThreadReaderSettingsObserver.java b/core/java/com/android/internal/os/KernelCpuThreadReaderSettingsObserver.java
index 718bcb4..b8dfe0d 100644
--- a/core/java/com/android/internal/os/KernelCpuThreadReaderSettingsObserver.java
+++ b/core/java/com/android/internal/os/KernelCpuThreadReaderSettingsObserver.java
@@ -57,14 +57,14 @@
      * List of UIDs to report data for
      */
     private static final String COLLECTED_UIDS_SETTINGS_KEY = "collected_uids";
-    private static final String COLLECTED_UIDS_DEFAULT = "1000-1000";
+    private static final String COLLECTED_UIDS_DEFAULT = "0-0;1000-1000";
 
     /**
      * Minimum total CPU usage to report
      */
     private static final String MINIMUM_TOTAL_CPU_USAGE_MILLIS_SETTINGS_KEY =
             "minimum_total_cpu_usage_millis";
-    private static final int MINIMUM_TOTAL_CPU_USAGE_MILLIS_DEFAULT = 0;
+    private static final int MINIMUM_TOTAL_CPU_USAGE_MILLIS_DEFAULT = 10000;
 
     private final Context mContext;
 
diff --git a/core/java/com/android/internal/os/LooperStats.java b/core/java/com/android/internal/os/LooperStats.java
index c059721..932ff57 100644
--- a/core/java/com/android/internal/os/LooperStats.java
+++ b/core/java/com/android/internal/os/LooperStats.java
@@ -165,6 +165,7 @@
             exportedEntries.add(createDebugEntry("end_time_millis", SystemClock.elapsedRealtime()));
             exportedEntries.add(
                     createDebugEntry("battery_time_millis", mBatteryStopwatch.getMillis()));
+            exportedEntries.add(createDebugEntry("sampling_interval", mSamplingInterval));
         }
         return exportedEntries;
     }
diff --git a/core/java/com/android/internal/os/Zygote.java b/core/java/com/android/internal/os/Zygote.java
index 58b48d8..70d8b45 100644
--- a/core/java/com/android/internal/os/Zygote.java
+++ b/core/java/com/android/internal/os/Zygote.java
@@ -126,8 +126,8 @@
     /** Read-write external storage should be mounted instead of package sandbox */
     public static final int MOUNT_EXTERNAL_FULL = IVold.REMOUNT_MODE_FULL;
 
-    /** Number of bytes sent to the Zygote over blastula pipes or the pool event FD */
-    public static final int BLASTULA_MANAGEMENT_MESSAGE_BYTES = 8;
+    /** Number of bytes sent to the Zygote over USAP pipes or the pool event FD */
+    public static final int USAP_MANAGEMENT_MESSAGE_BYTES = 8;
 
     /**
      * An extraArg passed when a zygote process is forking a child-zygote, specifying a name
@@ -187,12 +187,12 @@
     /**
      * @hide for internal use only
      */
-    public static final String BLASTULA_POOL_PRIMARY_SOCKET_NAME = "blastula_pool";
+    public static final String USAP_POOL_PRIMARY_SOCKET_NAME = "usap_pool_primary";
 
     /**
      * @hide for internal use only
      */
-    public static final String BLASTULA_POOL_SECONDARY_SOCKET_NAME = "blastula_pool_secondary";
+    public static final String USAP_POOL_SECONDARY_SOCKET_NAME = "usap_pool_secondary";
 
     private Zygote() {}
 
@@ -262,7 +262,7 @@
             String sandboxId);
 
     /**
-     * Specialize a Blastula instance.  The current VM must have been started
+     * Specialize an unspecialized app process.  The current VM must have been started
      * with the -Xzygote flag.
      *
      * @param uid  The UNIX uid that the new process should setuid() to before spawning any threads
@@ -282,12 +282,11 @@
      * @param instructionSet null-ok  The instruction set to use.
      * @param appDataDir null-ok  The data directory of the app.
      */
-    public static void specializeBlastula(int uid, int gid, int[] gids, int runtimeFlags,
+    public static void specializeAppProcess(int uid, int gid, int[] gids, int runtimeFlags,
             int[][] rlimits, int mountExternal, String seInfo, String niceName,
             boolean startChildZygote, String instructionSet, String appDataDir, String packageName,
             String[] packagesForUID, String sandboxId) {
-
-        nativeSpecializeBlastula(uid, gid, gids, runtimeFlags, rlimits, mountExternal, seInfo,
+        nativeSpecializeAppProcess(uid, gid, gids, runtimeFlags, rlimits, mountExternal, seInfo,
                                  niceName, startChildZygote, instructionSet, appDataDir,
                                  packageName, packagesForUID, sandboxId);
 
@@ -306,7 +305,7 @@
         ZygoteHooks.postForkCommon();
     }
 
-    private static native void nativeSpecializeBlastula(int uid, int gid, int[] gids,
+    private static native void nativeSpecializeAppProcess(int uid, int gid, int[] gids,
             int runtimeFlags, int[][] rlimits, int mountExternal, String seInfo, String niceName,
             boolean startChildZygote, String instructionSet, String appDataDir, String packageName,
             String[] packagesForUID, String sandboxId);
@@ -370,17 +369,8 @@
      * @param appInfo ApplicationInfo of the application
      */
     protected static void allowAppFilesAcrossFork(ApplicationInfo appInfo) {
-        Zygote.nativeAllowFileAcrossFork(appInfo.sourceDir);
-        if (appInfo.splitSourceDirs != null) {
-            for (String path : appInfo.splitSourceDirs) {
-                Zygote.nativeAllowFileAcrossFork(path);
-            }
-        }
-        // As well as its shared libs
-        if (appInfo.sharedLibraryFiles != null) {
-            for (String path : appInfo.sharedLibraryFiles) {
-                Zygote.nativeAllowFileAcrossFork(path);
-            }
+        for (String path : appInfo.getAllApkPaths()) {
+            Zygote.nativeAllowFileAcrossFork(path);
         }
     }
 
@@ -427,11 +417,11 @@
                 defaultValue);
     }
 
-    protected static void emptyBlastulaPool() {
-        nativeEmptyBlastulaPool();
+    protected static void emptyUsapPool() {
+        nativeEmptyUsapPool();
     }
 
-    private static native void nativeEmptyBlastulaPool();
+    private static native void nativeEmptyUsapPool();
 
     /**
      * Returns the value of a system property converted to a boolean using specific logic.
@@ -454,105 +444,105 @@
     }
 
     /**
-     * @return Number of blastulas currently in the pool
+     * @return Number of unspecialized app processes currently in the pool
      */
-    static int getBlastulaPoolCount() {
-        return nativeGetBlastulaPoolCount();
+    static int getUsapPoolCount() {
+        return nativeGetUsapPoolCount();
     }
 
-    private static native int nativeGetBlastulaPoolCount();
+    private static native int nativeGetUsapPoolCount();
 
     /**
      * @return The event FD used for communication between the signal handler and the ZygoteServer
      *         poll loop
      */
-    static FileDescriptor getBlastulaPoolEventFD() {
+    static FileDescriptor getUsapPoolEventFD() {
         FileDescriptor fd = new FileDescriptor();
-        fd.setInt$(nativeGetBlastulaPoolEventFD());
+        fd.setInt$(nativeGetUsapPoolEventFD());
 
         return fd;
     }
 
-    private static native int nativeGetBlastulaPoolEventFD();
+    private static native int nativeGetUsapPoolEventFD();
 
     /**
-     * Fork a new blastula process from the zygote
+     * Fork a new unspecialized app process from the zygote
      *
      * @param sessionSocketRawFDs  Anonymous session sockets that are currently open
-     * @return In the Zygote process this function will always return null; in blastula processes
-     *         this function will return a Runnable object representing the new application that is
-     *         passed up from blastulaMain.
+     * @return In the Zygote process this function will always return null; in unspecialized app
+     *         processes this function will return a Runnable object representing the new
+     *         application that is passed up from usapMain.
      */
-    static Runnable forkBlastula(LocalServerSocket blastulaPoolSocket,
-                                 int[] sessionSocketRawFDs) {
+    static Runnable forkUsap(LocalServerSocket usapPoolSocket,
+                             int[] sessionSocketRawFDs) {
         FileDescriptor[] pipeFDs = null;
 
         try {
             pipeFDs = Os.pipe2(O_CLOEXEC);
         } catch (ErrnoException errnoEx) {
-            throw new IllegalStateException("Unable to create blastula pipe.", errnoEx);
+            throw new IllegalStateException("Unable to create USAP pipe.", errnoEx);
         }
 
         int pid =
-                nativeForkBlastula(pipeFDs[0].getInt$(), pipeFDs[1].getInt$(), sessionSocketRawFDs);
+                nativeForkUsap(pipeFDs[0].getInt$(), pipeFDs[1].getInt$(), sessionSocketRawFDs);
 
         if (pid == 0) {
             IoUtils.closeQuietly(pipeFDs[0]);
-            return blastulaMain(blastulaPoolSocket, pipeFDs[1]);
+            return usapMain(usapPoolSocket, pipeFDs[1]);
         } else {
             // The read-end of the pipe will be closed by the native code.
-            // See removeBlastulaTableEntry();
+            // See removeUsapTableEntry();
             IoUtils.closeQuietly(pipeFDs[1]);
             return null;
         }
     }
 
-    private static native int nativeForkBlastula(int readPipeFD,
+    private static native int nativeForkUsap(int readPipeFD,
                                                  int writePipeFD,
                                                  int[] sessionSocketRawFDs);
 
     /**
-     * This function is used by blastulas to wait for specialization requests from the system
-     * server.
+     * This function is used by unspecialized app processes to wait for specialization requests from
+     * the system server.
      *
      * @param writePipe  The write end of the reporting pipe used to communicate with the poll loop
      *                   of the ZygoteServer.
      * @return A runnable oject representing the new application.
      */
-    private static Runnable blastulaMain(LocalServerSocket blastulaPoolSocket,
-                                         FileDescriptor writePipe) {
+    private static Runnable usapMain(LocalServerSocket usapPoolSocket,
+                                     FileDescriptor writePipe) {
         final int pid = Process.myPid();
 
         LocalSocket sessionSocket = null;
-        DataOutputStream blastulaOutputStream = null;
+        DataOutputStream usapOutputStream = null;
         Credentials peerCredentials = null;
         ZygoteArguments args = null;
 
         while (true) {
             try {
-                sessionSocket = blastulaPoolSocket.accept();
+                sessionSocket = usapPoolSocket.accept();
 
-                BufferedReader blastulaReader =
+                BufferedReader usapReader =
                         new BufferedReader(new InputStreamReader(sessionSocket.getInputStream()));
-                blastulaOutputStream =
+                usapOutputStream =
                         new DataOutputStream(sessionSocket.getOutputStream());
 
                 peerCredentials = sessionSocket.getPeerCredentials();
 
-                String[] argStrings = readArgumentList(blastulaReader);
+                String[] argStrings = readArgumentList(usapReader);
 
                 if (argStrings != null) {
                     args = new ZygoteArguments(argStrings);
 
                     // TODO (chriswailes): Should this only be run for debug builds?
-                    validateBlastulaCommand(args);
+                    validateUsapCommand(args);
                     break;
                 } else {
-                    Log.e("Blastula", "Truncated command received.");
+                    Log.e("USAP", "Truncated command received.");
                     IoUtils.closeQuietly(sessionSocket);
                 }
             } catch (Exception ex) {
-                Log.e("Blastula", ex.getMessage());
+                Log.e("USAP", ex.getMessage());
                 IoUtils.closeQuietly(sessionSocket);
             }
         }
@@ -571,29 +561,29 @@
         try {
             // Used by ZygoteProcess.zygoteSendArgsAndGetResult to fill in a
             // Process.ProcessStartResult object.
-            blastulaOutputStream.writeInt(pid);
+            usapOutputStream.writeInt(pid);
         } catch (IOException ioEx) {
-            Log.e("Blastula", "Failed to write response to session socket: " + ioEx.getMessage());
+            Log.e("USAP", "Failed to write response to session socket: " + ioEx.getMessage());
             System.exit(-1);
         } finally {
             IoUtils.closeQuietly(sessionSocket);
-            IoUtils.closeQuietly(blastulaPoolSocket);
+            IoUtils.closeQuietly(usapPoolSocket);
         }
 
         try {
             ByteArrayOutputStream buffer =
-                    new ByteArrayOutputStream(Zygote.BLASTULA_MANAGEMENT_MESSAGE_BYTES);
+                    new ByteArrayOutputStream(Zygote.USAP_MANAGEMENT_MESSAGE_BYTES);
             DataOutputStream outputStream = new DataOutputStream(buffer);
 
-            // This is written as a long so that the blastula reporting pipe and blastula pool
-            // event FD handlers in ZygoteServer.runSelectLoop can be unified.  These two cases
-            // should both send/receive 8 bytes.
+            // This is written as a long so that the USAP reporting pipe and USAP pool event FD
+            // handlers in ZygoteServer.runSelectLoop can be unified.  These two cases should both
+            // send/receive 8 bytes.
             outputStream.writeLong(pid);
             outputStream.flush();
 
             Os.write(writePipe, buffer.toByteArray(), 0, buffer.size());
         } catch (Exception ex) {
-            Log.e("Blastula",
+            Log.e("USAP",
                     String.format("Failed to write PID (%d) to pipe (%d): %s",
                             pid, writePipe.getInt$(), ex.getMessage()));
             System.exit(-1);
@@ -601,7 +591,7 @@
             IoUtils.closeQuietly(writePipe);
         }
 
-        specializeBlastula(args.mUid, args.mGid, args.mGids,
+        specializeAppProcess(args.mUid, args.mGid, args.mGids,
                            args.mRuntimeFlags, rlimits, args.mMountExternal,
                            args.mSeInfo, args.mNiceName, args.mStartChildZygote,
                            args.mInstructionSet, args.mAppDataDir, args.mPackageName,
@@ -619,34 +609,37 @@
                                      null /* classLoader */);
     }
 
-    private static final String BLASTULA_ERROR_PREFIX = "Invalid command to blastula: ";
+    private static final String USAP_ERROR_PREFIX = "Invalid command to USAP: ";
 
     /**
-     * Checks a set of zygote arguments to see if they can be handled by a blastula.  Throws an
+     * Checks a set of zygote arguments to see if they can be handled by a USAP.  Throws an
      * exception if an invalid arugment is encountered.
      * @param args  The arguments to test
      */
-    private static void validateBlastulaCommand(ZygoteArguments args) {
+    private static void validateUsapCommand(ZygoteArguments args) {
         if (args.mAbiListQuery) {
-            throw new IllegalArgumentException(BLASTULA_ERROR_PREFIX + "--query-abi-list");
+            throw new IllegalArgumentException(USAP_ERROR_PREFIX + "--query-abi-list");
         } else if (args.mPidQuery) {
-            throw new IllegalArgumentException(BLASTULA_ERROR_PREFIX + "--get-pid");
+            throw new IllegalArgumentException(USAP_ERROR_PREFIX + "--get-pid");
         } else if (args.mPreloadDefault) {
-            throw new IllegalArgumentException(BLASTULA_ERROR_PREFIX + "--preload-default");
+            throw new IllegalArgumentException(USAP_ERROR_PREFIX + "--preload-default");
         } else if (args.mPreloadPackage != null) {
-            throw new IllegalArgumentException(BLASTULA_ERROR_PREFIX + "--preload-package");
+            throw new IllegalArgumentException(USAP_ERROR_PREFIX + "--preload-package");
         } else if (args.mPreloadApp != null) {
-            throw new IllegalArgumentException(BLASTULA_ERROR_PREFIX + "--preload-app");
+            throw new IllegalArgumentException(USAP_ERROR_PREFIX + "--preload-app");
         } else if (args.mStartChildZygote) {
-            throw new IllegalArgumentException(BLASTULA_ERROR_PREFIX + "--start-child-zygote");
+            throw new IllegalArgumentException(USAP_ERROR_PREFIX + "--start-child-zygote");
         } else if (args.mApiBlacklistExemptions != null) {
             throw new IllegalArgumentException(
-                BLASTULA_ERROR_PREFIX + "--set-api-blacklist-exemptions");
+                USAP_ERROR_PREFIX + "--set-api-blacklist-exemptions");
         } else if (args.mHiddenApiAccessLogSampleRate != -1) {
             throw new IllegalArgumentException(
-                BLASTULA_ERROR_PREFIX + "--hidden-api-log-sampling-rate=");
+                    USAP_ERROR_PREFIX + "--hidden-api-log-sampling-rate=");
+        } else if (args.mHiddenApiAccessStatslogSampleRate != -1) {
+            throw new IllegalArgumentException(
+                    USAP_ERROR_PREFIX + "--hidden-api-statslog-sampling-rate=");
         } else if (args.mInvokeWith != null) {
-            throw new IllegalArgumentException(BLASTULA_ERROR_PREFIX + "--invoke-with");
+            throw new IllegalArgumentException(USAP_ERROR_PREFIX + "--invoke-with");
         } else if (args.mPermittedCapabilities != 0 || args.mEffectiveCapabilities != 0) {
             throw new ZygoteSecurityException("Client may not specify capabilities: "
                 + "permitted=0x" + Long.toHexString(args.mPermittedCapabilities)
@@ -655,25 +648,25 @@
     }
 
     /**
-     * @return  Raw file descriptors for the read-end of blastula reporting pipes.
+     * @return  Raw file descriptors for the read-end of USAP reporting pipes.
      */
-    protected static int[] getBlastulaPipeFDs() {
-        return nativeGetBlastulaPipeFDs();
+    protected static int[] getUsapPipeFDs() {
+        return nativeGetUsapPipeFDs();
     }
 
-    private static native int[] nativeGetBlastulaPipeFDs();
+    private static native int[] nativeGetUsapPipeFDs();
 
     /**
-     * Remove the blastula table entry for the provided process ID.
+     * Remove the USAP table entry for the provided process ID.
      *
-     * @param blastulaPID  Process ID of the entry to remove
+     * @param usapPID  Process ID of the entry to remove
      * @return True if the entry was removed; false if it doesn't exist
      */
-    protected static boolean removeBlastulaTableEntry(int blastulaPID) {
-        return nativeRemoveBlastulaTableEntry(blastulaPID);
+    protected static boolean removeUsapTableEntry(int usapPID) {
+        return nativeRemoveUsapTableEntry(usapPID);
     }
 
-    private static native boolean nativeRemoveBlastulaTableEntry(int blastulaPID);
+    private static native boolean nativeRemoveUsapTableEntry(int usapPID);
 
     /**
      * uid 1000 (Process.SYSTEM_UID) may specify any uid &gt; 1000 in normal
diff --git a/core/java/com/android/internal/os/ZygoteArguments.java b/core/java/com/android/internal/os/ZygoteArguments.java
index 9cb5820..28642d8 100644
--- a/core/java/com/android/internal/os/ZygoteArguments.java
+++ b/core/java/com/android/internal/os/ZygoteArguments.java
@@ -103,8 +103,8 @@
     /**
      *
      */
-    boolean mBlastulaPoolEnabled;
-    boolean mBlastulaPoolStatusSpecified = false;
+    boolean mUsapPoolEnabled;
+    boolean mUsapPoolStatusSpecified = false;
 
     /**
      * from all --rlimit=r,c,m
@@ -205,6 +205,12 @@
     int mHiddenApiAccessLogSampleRate = -1;
 
     /**
+     * Sampling rate for logging hidden API accesses to statslog. This is sent to the
+     * pre-forked zygote at boot time, or when it changes, via --hidden-api-statslog-sampling-rate.
+     */
+    int mHiddenApiAccessStatslogSampleRate = -1;
+
+    /**
      * Constructs instance and parses args
      *
      * @param args zygote command-line args
@@ -391,6 +397,15 @@
                         "Invalid log sampling rate: " + rateStr, nfe);
                 }
                 expectRuntimeArgs = false;
+            } else if (arg.startsWith("--hidden-api-statslog-sampling-rate=")) {
+                String rateStr = arg.substring(arg.indexOf('=') + 1);
+                try {
+                    mHiddenApiAccessStatslogSampleRate = Integer.parseInt(rateStr);
+                } catch (NumberFormatException nfe) {
+                    throw new IllegalArgumentException(
+                        "Invalid statslog sampling rate: " + rateStr, nfe);
+                }
+                expectRuntimeArgs = false;
             } else if (arg.startsWith("--package-name=")) {
                 if (mPackageName != null) {
                     throw new IllegalArgumentException("Duplicate arg specified");
@@ -403,9 +418,9 @@
                     throw new IllegalArgumentException("Duplicate arg specified");
                 }
                 mSandboxId = arg.substring(arg.indexOf('=') + 1);
-            } else if (arg.startsWith("--blastula-pool-enabled=")) {
-                mBlastulaPoolStatusSpecified = true;
-                mBlastulaPoolEnabled = Boolean.parseBoolean(arg.substring(arg.indexOf('=') + 1));
+            } else if (arg.startsWith("--usap-pool-enabled=")) {
+                mUsapPoolStatusSpecified = true;
+                mUsapPoolEnabled = Boolean.parseBoolean(arg.substring(arg.indexOf('=') + 1));
                 expectRuntimeArgs = false;
             } else {
                 break;
diff --git a/core/java/com/android/internal/os/ZygoteConnection.java b/core/java/com/android/internal/os/ZygoteConnection.java
index c7ba22d..87adce7 100644
--- a/core/java/com/android/internal/os/ZygoteConnection.java
+++ b/core/java/com/android/internal/os/ZygoteConnection.java
@@ -37,6 +37,7 @@
 import android.system.Os;
 import android.system.StructPollfd;
 import android.util.Log;
+import android.util.StatsLog;
 
 import com.android.internal.logging.MetricsLogger;
 import com.android.internal.logging.nano.MetricsProto.MetricsEvent;
@@ -158,8 +159,8 @@
             return null;
         }
 
-        if (parsedArgs.mBlastulaPoolStatusSpecified) {
-            return handleBlastulaPoolStatusChange(zygoteServer, parsedArgs.mBlastulaPoolEnabled);
+        if (parsedArgs.mUsapPoolStatusSpecified) {
+            return handleUsapPoolStatusChange(zygoteServer, parsedArgs.mUsapPoolEnabled);
         }
 
         if (parsedArgs.mPreloadDefault) {
@@ -192,9 +193,11 @@
             return handleApiBlacklistExemptions(zygoteServer, parsedArgs.mApiBlacklistExemptions);
         }
 
-        if (parsedArgs.mHiddenApiAccessLogSampleRate != -1) {
+        if (parsedArgs.mHiddenApiAccessLogSampleRate != -1
+                || parsedArgs.mHiddenApiAccessStatslogSampleRate != -1) {
             return handleHiddenApiAccessLogSampleRate(zygoteServer,
-                    parsedArgs.mHiddenApiAccessLogSampleRate);
+                    parsedArgs.mHiddenApiAccessLogSampleRate,
+                    parsedArgs.mHiddenApiAccessStatslogSampleRate);
         }
 
         if (parsedArgs.mPermittedCapabilities != 0 || parsedArgs.mEffectiveCapabilities != 0) {
@@ -328,18 +331,18 @@
         }
     }
 
-    private Runnable stateChangeWithBlastulaPoolReset(ZygoteServer zygoteServer,
+    private Runnable stateChangeWithUsapPoolReset(ZygoteServer zygoteServer,
             Runnable stateChangeCode) {
         try {
-            if (zygoteServer.isBlastulaPoolEnabled()) {
-                Zygote.emptyBlastulaPool();
+            if (zygoteServer.isUsapPoolEnabled()) {
+                Zygote.emptyUsapPool();
             }
 
             stateChangeCode.run();
 
-            if (zygoteServer.isBlastulaPoolEnabled()) {
+            if (zygoteServer.isUsapPoolEnabled()) {
                 Runnable fpResult =
-                        zygoteServer.fillBlastulaPool(
+                        zygoteServer.fillUsapPool(
                                 new int[]{mSocket.getFileDescriptor().getInt$()});
 
                 if (fpResult != null) {
@@ -360,24 +363,24 @@
      * Makes the necessary changes to implement a new API blacklist exemption policy, and then
      * responds to the system server, letting it know that the task has been completed.
      *
-     * This necessitates a change to the internal state of the Zygote.  As such, if the blastula
-     * pool is enabled all existing blastulas have an incorrect API blacklist exemption list.  To
+     * This necessitates a change to the internal state of the Zygote.  As such, if the USAP
+     * pool is enabled all existing USAPs have an incorrect API blacklist exemption list.  To
      * properly handle this request the pool must be emptied and refilled.  This process can return
      * a Runnable object that must be returned to ZygoteServer.runSelectLoop to be invoked.
      *
      * @param zygoteServer  The server object that received the request
      * @param exemptions  The new exemption list.
-     * @return A Runnable object representing a new app in any blastulas spawned from here; the
+     * @return A Runnable object representing a new app in any USAPs spawned from here; the
      *         zygote process will always receive a null value from this function.
      */
     private Runnable handleApiBlacklistExemptions(ZygoteServer zygoteServer, String[] exemptions) {
-        return stateChangeWithBlastulaPoolReset(zygoteServer,
+        return stateChangeWithUsapPoolReset(zygoteServer,
                 () -> ZygoteInit.setApiBlacklistExemptions(exemptions));
     }
 
-    private Runnable handleBlastulaPoolStatusChange(ZygoteServer zygoteServer, boolean newStatus) {
+    private Runnable handleUsapPoolStatusChange(ZygoteServer zygoteServer, boolean newStatus) {
         try {
-            Runnable fpResult = zygoteServer.setBlastulaPoolStatus(newStatus, mSocket);
+            Runnable fpResult = zygoteServer.setUsapPoolStatus(newStatus, mSocket);
 
             if (fpResult == null) {
                 mSocketOutStream.writeInt(0);
@@ -396,9 +399,11 @@
         private final MetricsLogger mMetricsLogger = new MetricsLogger();
         private static HiddenApiUsageLogger sInstance = new HiddenApiUsageLogger();
         private int mHiddenApiAccessLogSampleRate = 0;
+        private int mHiddenApiAccessStatslogSampleRate = 0;
 
-        public static void setHiddenApiAccessLogSampleRate(int sampleRate) {
+        public static void setHiddenApiAccessLogSampleRates(int sampleRate, int newSampleRate) {
             sInstance.mHiddenApiAccessLogSampleRate = sampleRate;
+            sInstance.mHiddenApiAccessStatslogSampleRate = newSampleRate;
         }
 
         public static HiddenApiUsageLogger getInstance() {
@@ -410,6 +415,9 @@
             if (sampledValue < mHiddenApiAccessLogSampleRate) {
                 logUsage(packageName, signature, accessMethod, accessDenied);
             }
+            if (sampledValue < mHiddenApiAccessStatslogSampleRate) {
+                newLogUsage(signature, accessMethod, accessDenied);
+            }
         }
 
         private void logUsage(String packageName, String signature, int accessMethod,
@@ -439,26 +447,49 @@
             }
             mMetricsLogger.write(logMaker);
         }
+
+        private void newLogUsage(String signature, int accessMethod, boolean accessDenied) {
+            int accessMethodProto = StatsLog.HIDDEN_API_USED__ACCESS_METHOD__NONE;
+            switch(accessMethod) {
+                case HiddenApiUsageLogger.ACCESS_METHOD_NONE:
+                    accessMethodProto = StatsLog.HIDDEN_API_USED__ACCESS_METHOD__NONE;
+                    break;
+                case HiddenApiUsageLogger.ACCESS_METHOD_REFLECTION:
+                    accessMethodProto = StatsLog.HIDDEN_API_USED__ACCESS_METHOD__REFLECTION;
+                    break;
+                case HiddenApiUsageLogger.ACCESS_METHOD_JNI:
+                    accessMethodProto = StatsLog.HIDDEN_API_USED__ACCESS_METHOD__JNI;
+                    break;
+                case HiddenApiUsageLogger.ACCESS_METHOD_LINKING:
+                    accessMethodProto = StatsLog.HIDDEN_API_USED__ACCESS_METHOD__LINKING;
+                    break;
+            }
+            int uid = Process.myUid();
+            StatsLog.write(StatsLog.HIDDEN_API_USED, uid, signature,
+                                   accessMethodProto, accessDenied);
+        }
     }
 
     /**
      * Changes the API access log sample rate for the Zygote and processes spawned from it.
      *
-     * This necessitates a change to the internal state of the Zygote.  As such, if the blastula
-     * pool is enabled all existing blastulas have an incorrect API access log sample rate.  To
+     * This necessitates a change to the internal state of the Zygote.  As such, if the USAP
+     * pool is enabled all existing USAPs have an incorrect API access log sample rate.  To
      * properly handle this request the pool must be emptied and refilled.  This process can return
      * a Runnable object that must be returned to ZygoteServer.runSelectLoop to be invoked.
      *
      * @param zygoteServer  The server object that received the request
-     * @param samplingRate  The new sample rate
+     * @param samplingRate  The new sample rate for regular logging
+     * @param statsdSamplingRate  The new sample rate for statslog logging
      * @return A Runnable object representing a new app in any blastulas spawned from here; the
      *         zygote process will always receive a null value from this function.
      */
     private Runnable handleHiddenApiAccessLogSampleRate(ZygoteServer zygoteServer,
-            int samplingRate) {
-        return stateChangeWithBlastulaPoolReset(zygoteServer, () -> {
-            ZygoteInit.setHiddenApiAccessLogSampleRate(samplingRate);
-            HiddenApiUsageLogger.setHiddenApiAccessLogSampleRate(samplingRate);
+            int samplingRate, int statsdSamplingRate) {
+        return stateChangeWithUsapPoolReset(zygoteServer, () -> {
+            int maxSamplingRate = Math.max(samplingRate, statsdSamplingRate);
+            ZygoteInit.setHiddenApiAccessLogSampleRate(maxSamplingRate);
+            HiddenApiUsageLogger.setHiddenApiAccessLogSampleRates(samplingRate, statsdSamplingRate);
             ZygoteInit.setHiddenApiUsageLogger(HiddenApiUsageLogger.getInstance());
         });
     }
diff --git a/core/java/com/android/internal/os/ZygoteInit.java b/core/java/com/android/internal/os/ZygoteInit.java
index 7cddf75..5f23719 100644
--- a/core/java/com/android/internal/os/ZygoteInit.java
+++ b/core/java/com/android/internal/os/ZygoteInit.java
@@ -41,7 +41,6 @@
 import android.system.StructCapUserData;
 import android.system.StructCapUserHeader;
 import android.text.Hyphenator;
-import android.text.TextUtils;
 import android.util.EventLog;
 import android.util.Log;
 import android.util.Slog;
@@ -85,8 +84,6 @@
 
     private static final String PROPERTY_DISABLE_OPENGL_PRELOADING = "ro.zygote.disable_gl_preload";
     private static final String PROPERTY_GFX_DRIVER = "ro.gfx.driver.0";
-    private static final String PROPERTY_USE_APP_IMAGE_STARTUP_CACHE =
-            "persist.device_config.runtime_native.use_app_image_startup_cache";
 
     private static final int LOG_BOOT_PROGRESS_PRELOAD_START = 3020;
     private static final int LOG_BOOT_PROGRESS_PRELOAD_END = 3030;
@@ -99,7 +96,7 @@
     private static final String ABI_LIST_ARG = "--abi-list=";
 
     // TODO (chriswailes): Re-name this --zygote-socket-name= and then add a
-    // --blastula-socket-name parameter.
+    // --usap-socket-name parameter.
     private static final String SOCKET_NAME_ARG = "--socket-name=";
 
     /**
@@ -708,13 +705,6 @@
                 parsedArgs.mRuntimeFlags |= Zygote.PROFILE_SYSTEM_SERVER;
             }
 
-            String use_app_image_cache = SystemProperties.get(
-                    PROPERTY_USE_APP_IMAGE_STARTUP_CACHE, "");
-            // Property defaults to true currently.
-            if (!TextUtils.isEmpty(use_app_image_cache) && !use_app_image_cache.equals("false")) {
-                parsedArgs.mRuntimeFlags |= Zygote.USE_APP_IMAGE_STARTUP_CACHE;
-            }
-
             /* Request to fork the system server process */
             pid = Zygote.forkSystemServer(
                     parsedArgs.mUid, parsedArgs.mGid,
diff --git a/core/java/com/android/internal/os/ZygoteServer.java b/core/java/com/android/internal/os/ZygoteServer.java
index c4c98ba..6595317 100644
--- a/core/java/com/android/internal/os/ZygoteServer.java
+++ b/core/java/com/android/internal/os/ZygoteServer.java
@@ -51,39 +51,40 @@
     public static final String TAG = "ZygoteServer";
 
     /**
-     * The maximim value that will be accepted from the BLASTULA_POOL_SIZE_MAX device property.
-     * is a mirror of BLASTULA_POOL_MAX_LIMIT found in com_android_internal_os_Zygote.cpp.
+     * The maximim value that will be accepted from the USAP_POOL_SIZE_MAX device property.
+     * is a mirror of USAP_POOL_MAX_LIMIT found in com_android_internal_os_Zygote.cpp.
      */
-    private static final int BLASTULA_POOL_SIZE_MAX_LIMIT = 100;
+    private static final int USAP_POOL_SIZE_MAX_LIMIT = 100;
 
     /**
-     * The minimum value that will be accepted from the BLASTULA_POOL_SIZE_MIN device property.
+     * The minimum value that will be accepted from the USAP_POOL_SIZE_MIN device property.
      */
-    private static final int BLASTULA_POOL_SIZE_MIN_LIMIT = 1;
+    private static final int USAP_POOL_SIZE_MIN_LIMIT = 1;
 
-    /** The default value used for the BLASTULA_POOL_SIZE_MAX device property */
-    private static final String BLASTULA_POOL_SIZE_MAX_DEFAULT = "10";
+    /** The default value used for the USAP_POOL_SIZE_MAX device property */
+    private static final String USAP_POOL_SIZE_MAX_DEFAULT = "10";
 
-    /** The default value used for the BLASTULA_POOL_SIZE_MIN device property */
-    private static final String BLASTULA_POOL_SIZE_MIN_DEFAULT = "1";
+    /** The default value used for the USAP_POOL_SIZE_MIN device property */
+    private static final String USAP_POOL_SIZE_MIN_DEFAULT = "1";
 
     /**
-     * Indicates if this Zygote server can support a blastula pool.  Currently this should only be
-     * true for the primary and secondary Zygotes, and not the App Zygotes or the WebView Zygote.
+     * Indicates if this Zygote server can support a unspecialized app process pool.  Currently this
+     * should only be true for the primary and secondary Zygotes, and not the App Zygotes or the
+     * WebView Zygote.
      *
      * TODO (chriswailes): Make this an explicit argument to the constructor
      */
 
-    private final boolean mBlastulaPoolSupported;
+    private final boolean mUsapPoolSupported;
 
     /**
-     * If the blastula pool should be created and used to start applications.
+     * If the unspecialized app process pool should be created and used to start applications.
      *
-     * Setting this value to false will disable the creation, maintenance, and use of the blastula
-     * pool.  When the blastula pool is disabled the application lifecycle will be identical to
+     * Setting this value to false will disable the creation, maintenance, and use of the USAP
+     * pool.  When the USAP pool is disabled the application lifecycle will be identical to
      * previous versions of Android.
      */
-    private boolean mBlastulaPoolEnabled = false;
+    private boolean mUsapPoolEnabled = false;
 
     /**
      * Listening socket that accepts new server connections.
@@ -91,15 +92,15 @@
     private LocalServerSocket mZygoteSocket;
 
     /**
-     * The name of the blastula socket to use if the blastula pool is enabled.
+     * The name of the unspecialized app process pool socket to use if the USAP pool is enabled.
      */
-    private LocalServerSocket mBlastulaPoolSocket;
+    private LocalServerSocket mUsapPoolSocket;
 
     /**
      * File descriptor used for communication between the signal handler and the ZygoteServer poll
      * loop.
      * */
-    private FileDescriptor mBlastulaPoolEventFD;
+    private FileDescriptor mUsapPoolEventFD;
 
     /**
      * Whether or not mZygoteSocket's underlying FD should be closed directly.
@@ -116,62 +117,61 @@
     private boolean mIsForkChild;
 
     /**
-     * The runtime-adjustable maximum Blastula pool size.
+     * The runtime-adjustable maximum USAP pool size.
      */
-    private int mBlastulaPoolSizeMax = 0;
+    private int mUsapPoolSizeMax = 0;
 
     /**
-     * The runtime-adjustable minimum Blastula pool size.
+     * The runtime-adjustable minimum USAP pool size.
      */
-    private int mBlastulaPoolSizeMin = 0;
+    private int mUsapPoolSizeMin = 0;
 
     /**
-     * The runtime-adjustable value used to determine when to re-fill the
-     * blastula pool.  The pool will be re-filled when
-     * (sBlastulaPoolMax - gBlastulaPoolCount) >= sBlastulaPoolRefillThreshold.
+     * The runtime-adjustable value used to determine when to re-fill the USAP pool.  The pool will
+     * be re-filled when (mUsapPoolMax - gUsapPoolCount) >= sUsapPoolRefillThreshold.
      */
-    private int mBlastulaPoolRefillThreshold = 0;
+    private int mUsapPoolRefillThreshold = 0;
 
     ZygoteServer() {
-        mBlastulaPoolEventFD = null;
+        mUsapPoolEventFD = null;
         mZygoteSocket = null;
-        mBlastulaPoolSocket = null;
+        mUsapPoolSocket = null;
 
-        mBlastulaPoolSupported = false;
+        mUsapPoolSupported = false;
     }
 
     /**
-     * Initialize the Zygote server with the Zygote server socket, blastula pool server socket,
-     * and blastula pool event FD.
+     * Initialize the Zygote server with the Zygote server socket, USAP pool server socket, and USAP
+     * pool event FD.
      *
      * @param isPrimaryZygote  If this is the primary Zygote or not.
      */
     ZygoteServer(boolean isPrimaryZygote) {
-        mBlastulaPoolEventFD = Zygote.getBlastulaPoolEventFD();
+        mUsapPoolEventFD = Zygote.getUsapPoolEventFD();
 
         if (isPrimaryZygote) {
             mZygoteSocket = Zygote.createManagedSocketFromInitSocket(Zygote.PRIMARY_SOCKET_NAME);
-            mBlastulaPoolSocket =
+            mUsapPoolSocket =
                     Zygote.createManagedSocketFromInitSocket(
-                            Zygote.BLASTULA_POOL_PRIMARY_SOCKET_NAME);
+                            Zygote.USAP_POOL_PRIMARY_SOCKET_NAME);
         } else {
             mZygoteSocket = Zygote.createManagedSocketFromInitSocket(Zygote.SECONDARY_SOCKET_NAME);
-            mBlastulaPoolSocket =
+            mUsapPoolSocket =
                     Zygote.createManagedSocketFromInitSocket(
-                            Zygote.BLASTULA_POOL_SECONDARY_SOCKET_NAME);
+                            Zygote.USAP_POOL_SECONDARY_SOCKET_NAME);
         }
 
-        fetchBlastulaPoolPolicyProps();
+        fetchUsapPoolPolicyProps();
 
-        mBlastulaPoolSupported = true;
+        mUsapPoolSupported = true;
     }
 
     void setForkChild() {
         mIsForkChild = true;
     }
 
-    public boolean isBlastulaPoolEnabled() {
-        return mBlastulaPoolEnabled;
+    public boolean isUsapPoolEnabled() {
+        return mUsapPoolEnabled;
     }
 
     /**
@@ -240,95 +240,95 @@
         return mZygoteSocket.getFileDescriptor();
     }
 
-    private void fetchBlastulaPoolPolicyProps() {
-        if (mBlastulaPoolSupported) {
-            final String blastulaPoolSizeMaxPropString =
+    private void fetchUsapPoolPolicyProps() {
+        if (mUsapPoolSupported) {
+            final String usapPoolSizeMaxPropString =
                     Zygote.getSystemProperty(
-                            DeviceConfig.RuntimeNative.BLASTULA_POOL_SIZE_MAX,
-                            BLASTULA_POOL_SIZE_MAX_DEFAULT);
+                            DeviceConfig.RuntimeNative.USAP_POOL_SIZE_MAX,
+                            USAP_POOL_SIZE_MAX_DEFAULT);
 
-            if (!blastulaPoolSizeMaxPropString.isEmpty()) {
-                mBlastulaPoolSizeMax =
+            if (!usapPoolSizeMaxPropString.isEmpty()) {
+                mUsapPoolSizeMax =
                         Integer.min(
-                                Integer.parseInt(blastulaPoolSizeMaxPropString),
-                                BLASTULA_POOL_SIZE_MAX_LIMIT);
+                                Integer.parseInt(usapPoolSizeMaxPropString),
+                                USAP_POOL_SIZE_MAX_LIMIT);
             }
 
-            final String blastulaPoolSizeMinPropString =
+            final String usapPoolSizeMinPropString =
                     Zygote.getSystemProperty(
-                            DeviceConfig.RuntimeNative.BLASTULA_POOL_SIZE_MIN,
-                            BLASTULA_POOL_SIZE_MIN_DEFAULT);
+                            DeviceConfig.RuntimeNative.USAP_POOL_SIZE_MIN,
+                            USAP_POOL_SIZE_MIN_DEFAULT);
 
-            if (!blastulaPoolSizeMinPropString.isEmpty()) {
-                mBlastulaPoolSizeMin =
+            if (!usapPoolSizeMinPropString.isEmpty()) {
+                mUsapPoolSizeMin =
                         Integer.max(
-                                Integer.parseInt(blastulaPoolSizeMinPropString),
-                                BLASTULA_POOL_SIZE_MIN_LIMIT);
+                                Integer.parseInt(usapPoolSizeMinPropString),
+                                USAP_POOL_SIZE_MIN_LIMIT);
             }
 
-            final String blastulaPoolRefillThresholdPropString =
+            final String usapPoolRefillThresholdPropString =
                     Zygote.getSystemProperty(
-                            DeviceConfig.RuntimeNative.BLASTULA_POOL_REFILL_THRESHOLD,
-                            Integer.toString(mBlastulaPoolSizeMax / 2));
+                            DeviceConfig.RuntimeNative.USAP_POOL_REFILL_THRESHOLD,
+                            Integer.toString(mUsapPoolSizeMax / 2));
 
-            if (!blastulaPoolRefillThresholdPropString.isEmpty()) {
-                mBlastulaPoolRefillThreshold =
+            if (!usapPoolRefillThresholdPropString.isEmpty()) {
+                mUsapPoolRefillThreshold =
                         Integer.min(
-                                Integer.parseInt(blastulaPoolRefillThresholdPropString),
-                                mBlastulaPoolSizeMax);
+                                Integer.parseInt(usapPoolRefillThresholdPropString),
+                                mUsapPoolSizeMax);
             }
         }
     }
 
     private long mLastPropCheckTimestamp = 0;
 
-    private void fetchBlastulaPoolPolicyPropsWithMinInterval() {
+    private void fetchUsapPoolPolicyPropsWithMinInterval() {
         final long currentTimestamp = SystemClock.elapsedRealtime();
 
         if (currentTimestamp - mLastPropCheckTimestamp >= Zygote.PROPERTY_CHECK_INTERVAL) {
-            fetchBlastulaPoolPolicyProps();
+            fetchUsapPoolPolicyProps();
             mLastPropCheckTimestamp = currentTimestamp;
         }
     }
 
     /**
-     * Checks to see if the current policy says that pool should be refilled, and spawns new
-     * blastulas if necessary.
+     * Checks to see if the current policy says that pool should be refilled, and spawns new USAPs
+     * if necessary.
      *
      * @param sessionSocketRawFDs  Anonymous session sockets that are currently open
-     * @return In the Zygote process this function will always return null; in blastula processes
-     *         this function will return a Runnable object representing the new application that is
-     *         passed up from blastulaMain.
+     * @return In the Zygote process this function will always return null; in unspecialized app
+     *         processes this function will return a Runnable object representing the new
+     *         application that is passed up from usapMain.
      */
 
-    Runnable fillBlastulaPool(int[] sessionSocketRawFDs) {
-        Trace.traceBegin(Trace.TRACE_TAG_ACTIVITY_MANAGER, "Zygote:FillBlastulaPool");
+    Runnable fillUsapPool(int[] sessionSocketRawFDs) {
+        Trace.traceBegin(Trace.TRACE_TAG_ACTIVITY_MANAGER, "Zygote:FillUsapPool");
 
-        int blastulaPoolCount = Zygote.getBlastulaPoolCount();
-        int numBlastulasToSpawn = mBlastulaPoolSizeMax - blastulaPoolCount;
+        int usapPoolCount = Zygote.getUsapPoolCount();
+        int numUsapsToSpawn = mUsapPoolSizeMax - usapPoolCount;
 
-        if (blastulaPoolCount < mBlastulaPoolSizeMin
-                || numBlastulasToSpawn >= mBlastulaPoolRefillThreshold) {
+        if (usapPoolCount < mUsapPoolSizeMin
+                || numUsapsToSpawn >= mUsapPoolRefillThreshold) {
 
             // Disable some VM functionality and reset some system values
             // before forking.
             ZygoteHooks.preFork();
             Zygote.resetNicePriority();
 
-            while (blastulaPoolCount++ < mBlastulaPoolSizeMax) {
-                Runnable caller = Zygote.forkBlastula(mBlastulaPoolSocket, sessionSocketRawFDs);
+            while (usapPoolCount++ < mUsapPoolSizeMax) {
+                Runnable caller = Zygote.forkUsap(mUsapPoolSocket, sessionSocketRawFDs);
 
                 if (caller != null) {
                     return caller;
                 }
             }
 
-            // Re-enable runtime services for the Zygote.  Blastula services
-            // are re-enabled in specializeBlastula.
+            // Re-enable runtime services for the Zygote.  Services for unspecialized app process
+            // are re-enabled in specializeAppProcess.
             ZygoteHooks.postForkCommon();
 
             Log.i("zygote",
-                    "Filled the blastula pool. New blastulas: " + numBlastulasToSpawn);
+                    "Filled the USAP pool. New USAPs: " + numUsapsToSpawn);
         }
 
         Trace.traceEnd(Trace.TRACE_TAG_ACTIVITY_MANAGER);
@@ -337,23 +337,23 @@
     }
 
     /**
-     * Empty or fill the blastula pool as dictated by the current and new blastula pool statuses.
+     * Empty or fill the USAP pool as dictated by the current and new USAP pool statuses.
      */
-    Runnable setBlastulaPoolStatus(boolean newStatus, LocalSocket sessionSocket) {
-        if (!mBlastulaPoolSupported) {
+    Runnable setUsapPoolStatus(boolean newStatus, LocalSocket sessionSocket) {
+        if (!mUsapPoolSupported) {
             Log.w(TAG,
-                    "Attempting to enable a blastula pool for a Zygote that doesn't support it.");
+                    "Attempting to enable a USAP pool for a Zygote that doesn't support it.");
             return null;
-        } else if (mBlastulaPoolEnabled == newStatus) {
+        } else if (mUsapPoolEnabled == newStatus) {
             return null;
         }
 
-        mBlastulaPoolEnabled = newStatus;
+        mUsapPoolEnabled = newStatus;
 
         if (newStatus) {
-            return fillBlastulaPool(new int[]{ sessionSocket.getFileDescriptor().getInt$() });
+            return fillUsapPool(new int[]{ sessionSocket.getFileDescriptor().getInt$() });
         } else {
-            Zygote.emptyBlastulaPool();
+            Zygote.emptyUsapPool();
             return null;
         }
     }
@@ -371,25 +371,25 @@
         peers.add(null);
 
         while (true) {
-            fetchBlastulaPoolPolicyPropsWithMinInterval();
+            fetchUsapPoolPolicyPropsWithMinInterval();
 
-            int[] blastulaPipeFDs = null;
+            int[] usapPipeFDs = null;
             StructPollfd[] pollFDs = null;
 
             // Allocate enough space for the poll structs, taking into account
-            // the state of the blastula pool for this Zygote (could be a
+            // the state of the USAP pool for this Zygote (could be a
             // regular Zygote, a WebView Zygote, or an AppZygote).
-            if (mBlastulaPoolEnabled) {
-                blastulaPipeFDs = Zygote.getBlastulaPipeFDs();
-                pollFDs = new StructPollfd[socketFDs.size() + 1 + blastulaPipeFDs.length];
+            if (mUsapPoolEnabled) {
+                usapPipeFDs = Zygote.getUsapPipeFDs();
+                pollFDs = new StructPollfd[socketFDs.size() + 1 + usapPipeFDs.length];
             } else {
                 pollFDs = new StructPollfd[socketFDs.size()];
             }
 
             /*
-             * For reasons of correctness the blastula pool pipe and event FDs
+             * For reasons of correctness the USAP pool pipe and event FDs
              * must be processed before the session and server sockets.  This
-             * is to ensure that the blastula pool accounting information is
+             * is to ensure that the USAP pool accounting information is
              * accurate when handling other requests like API blacklist
              * exemptions.
              */
@@ -402,17 +402,17 @@
                 ++pollIndex;
             }
 
-            final int blastulaPoolEventFDIndex = pollIndex;
+            final int usapPoolEventFDIndex = pollIndex;
 
-            if (mBlastulaPoolEnabled) {
+            if (mUsapPoolEnabled) {
                 pollFDs[pollIndex] = new StructPollfd();
-                pollFDs[pollIndex].fd = mBlastulaPoolEventFD;
+                pollFDs[pollIndex].fd = mUsapPoolEventFD;
                 pollFDs[pollIndex].events = (short) POLLIN;
                 ++pollIndex;
 
-                for (int blastulaPipeFD : blastulaPipeFDs) {
+                for (int usapPipeFD : usapPipeFDs) {
                     FileDescriptor managedFd = new FileDescriptor();
-                    managedFd.setInt$(blastulaPipeFD);
+                    managedFd.setInt$(usapPipeFD);
 
                     pollFDs[pollIndex] = new StructPollfd();
                     pollFDs[pollIndex].fd = managedFd;
@@ -427,7 +427,7 @@
                 throw new RuntimeException("poll failed", ex);
             }
 
-            boolean blastulaPoolFDRead = false;
+            boolean usapPoolFDRead = false;
 
             while (--pollIndex >= 0) {
                 if ((pollFDs[pollIndex].revents & POLLIN) == 0) {
@@ -441,7 +441,7 @@
                     peers.add(newPeer);
                     socketFDs.add(newPeer.getFileDescriptor());
 
-                } else if (pollIndex < blastulaPoolEventFDIndex) {
+                } else if (pollIndex < usapPoolEventFDIndex) {
                     // Session socket accepted from the Zygote server socket
 
                     try {
@@ -502,56 +502,56 @@
                         mIsForkChild = false;
                     }
                 } else {
-                    // Either the blastula pool event FD or a blastula reporting pipe.
+                    // Either the USAP pool event FD or a USAP reporting pipe.
 
-                    // If this is the event FD the payload will be the number of blastulas removed.
-                    // If this is a reporting pipe FD the payload will be the PID of the blastula
+                    // If this is the event FD the payload will be the number of USAPs removed.
+                    // If this is a reporting pipe FD the payload will be the PID of the USAP
                     // that was just specialized.
                     long messagePayload = -1;
 
                     try {
-                        byte[] buffer = new byte[Zygote.BLASTULA_MANAGEMENT_MESSAGE_BYTES];
+                        byte[] buffer = new byte[Zygote.USAP_MANAGEMENT_MESSAGE_BYTES];
                         int readBytes = Os.read(pollFDs[pollIndex].fd, buffer, 0, buffer.length);
 
-                        if (readBytes == Zygote.BLASTULA_MANAGEMENT_MESSAGE_BYTES) {
+                        if (readBytes == Zygote.USAP_MANAGEMENT_MESSAGE_BYTES) {
                             DataInputStream inputStream =
                                     new DataInputStream(new ByteArrayInputStream(buffer));
 
                             messagePayload = inputStream.readLong();
                         } else {
-                            Log.e(TAG, "Incomplete read from blastula management FD of size "
+                            Log.e(TAG, "Incomplete read from USAP management FD of size "
                                     + readBytes);
                             continue;
                         }
                     } catch (Exception ex) {
-                        if (pollIndex == blastulaPoolEventFDIndex) {
-                            Log.e(TAG, "Failed to read from blastula pool event FD: "
+                        if (pollIndex == usapPoolEventFDIndex) {
+                            Log.e(TAG, "Failed to read from USAP pool event FD: "
                                     + ex.getMessage());
                         } else {
-                            Log.e(TAG, "Failed to read from blastula reporting pipe: "
+                            Log.e(TAG, "Failed to read from USAP reporting pipe: "
                                     + ex.getMessage());
                         }
 
                         continue;
                     }
 
-                    if (pollIndex > blastulaPoolEventFDIndex) {
-                        Zygote.removeBlastulaTableEntry((int) messagePayload);
+                    if (pollIndex > usapPoolEventFDIndex) {
+                        Zygote.removeUsapTableEntry((int) messagePayload);
                     }
 
-                    blastulaPoolFDRead = true;
+                    usapPoolFDRead = true;
                 }
             }
 
-            // Check to see if the blastula pool needs to be refilled.
-            if (blastulaPoolFDRead) {
+            // Check to see if the USAP pool needs to be refilled.
+            if (usapPoolFDRead) {
                 int[] sessionSocketRawFDs =
                         socketFDs.subList(1, socketFDs.size())
                                 .stream()
                                 .mapToInt(fd -> fd.getInt$())
                                 .toArray();
 
-                final Runnable command = fillBlastulaPool(sessionSocketRawFDs);
+                final Runnable command = fillUsapPool(sessionSocketRawFDs);
 
                 if (command != null) {
                     return command;
diff --git a/core/java/com/android/internal/policy/DecorView.java b/core/java/com/android/internal/policy/DecorView.java
index cdaf33f..c4626c2 100644
--- a/core/java/com/android/internal/policy/DecorView.java
+++ b/core/java/com/android/internal/policy/DecorView.java
@@ -1639,6 +1639,9 @@
     @Override
     public void onRootViewScrollYChanged(int rootScrollY) {
         mRootScrollY = rootScrollY;
+        if (mDecorCaptionView != null) {
+            mDecorCaptionView.onRootViewScrollYChanged(rootScrollY);
+        }
         updateColorViewTranslations();
     }
 
diff --git a/core/java/com/android/internal/policy/IKeyguardService.aidl b/core/java/com/android/internal/policy/IKeyguardService.aidl
index e5d5685..54f31f9 100644
--- a/core/java/com/android/internal/policy/IKeyguardService.aidl
+++ b/core/java/com/android/internal/policy/IKeyguardService.aidl
@@ -88,8 +88,10 @@
      */
     void onScreenTurnedOff();
 
+    @UnsupportedAppUsage
     void setKeyguardEnabled(boolean enabled);
     void onSystemReady();
+    @UnsupportedAppUsage
     void doKeyguardTimeout(in Bundle options);
     void setSwitchingUser(boolean switching);
     void setCurrentUser(int userId);
diff --git a/core/java/com/android/internal/statusbar/IStatusBarService.aidl b/core/java/com/android/internal/statusbar/IStatusBarService.aidl
index bfb5084..3437614 100644
--- a/core/java/com/android/internal/statusbar/IStatusBarService.aidl
+++ b/core/java/com/android/internal/statusbar/IStatusBarService.aidl
@@ -31,16 +31,21 @@
 /** @hide */
 interface IStatusBarService
 {
+    @UnsupportedAppUsage
     void expandNotificationsPanel();
+    @UnsupportedAppUsage
     void collapsePanels();
     void togglePanel();
+    @UnsupportedAppUsage
     void disable(int what, IBinder token, String pkg);
     void disableForUser(int what, IBinder token, String pkg, int userId);
     void disable2(int what, IBinder token, String pkg);
     void disable2ForUser(int what, IBinder token, String pkg, int userId);
     int[] getDisableFlags(IBinder token, int userId);
     void setIcon(String slot, String iconPackage, int iconId, int iconLevel, String contentDescription);
+    @UnsupportedAppUsage
     void setIconVisibility(String slot, boolean visible);
+    @UnsupportedAppUsage
     void removeIcon(String slot);
     // TODO(b/117478341): support back button change when IME is showing on a external display.
     void setImeWindowStatus(in IBinder token, int vis, int backDisposition,
@@ -87,6 +92,7 @@
     void addTile(in ComponentName tile);
     void remTile(in ComponentName tile);
     void clickTile(in ComponentName tile);
+    @UnsupportedAppUsage
     void handleSystemKey(in int key);
 
     /**
diff --git a/core/java/com/android/internal/util/ArrayUtils.java b/core/java/com/android/internal/util/ArrayUtils.java
index b04ebec..ff5b996 100644
--- a/core/java/com/android/internal/util/ArrayUtils.java
+++ b/core/java/com/android/internal/util/ArrayUtils.java
@@ -712,4 +712,30 @@
         }
         return null;
     }
+
+    public static String deepToString(Object value) {
+        if (value != null && value.getClass().isArray()) {
+            if (value.getClass() == boolean[].class) {
+                return Arrays.toString((boolean[]) value);
+            } else if (value.getClass() == byte[].class) {
+                return Arrays.toString((byte[]) value);
+            } else if (value.getClass() == char[].class) {
+                return Arrays.toString((char[]) value);
+            } else if (value.getClass() == double[].class) {
+                return Arrays.toString((double[]) value);
+            } else if (value.getClass() == float[].class) {
+                return Arrays.toString((float[]) value);
+            } else if (value.getClass() == int[].class) {
+                return Arrays.toString((int[]) value);
+            } else if (value.getClass() == long[].class) {
+                return Arrays.toString((long[]) value);
+            } else if (value.getClass() == short[].class) {
+                return Arrays.toString((short[]) value);
+            } else {
+                return Arrays.deepToString((Object[]) value);
+            }
+        } else {
+            return String.valueOf(value);
+        }
+    }
 }
diff --git a/core/java/com/android/internal/util/ContrastColorUtil.java b/core/java/com/android/internal/util/ContrastColorUtil.java
index e0ba317f..d037d4b 100644
--- a/core/java/com/android/internal/util/ContrastColorUtil.java
+++ b/core/java/com/android/internal/util/ContrastColorUtil.java
@@ -522,27 +522,6 @@
         return ColorUtilsFromCompat.LABToColor(result[0], result[1], result[2]);
     }
 
-    public static int resolveAmbientColor(Context context, int notificationColor) {
-        final int resolvedColor = notificationColor == Notification.COLOR_DEFAULT
-                ? context.getColor(com.android.internal.R.color.notification_default_color_dark)
-                : notificationColor;
-
-        int color = resolvedColor;
-        color = ContrastColorUtil.ensureTextContrastOnBlack(color);
-
-        if (color != resolvedColor) {
-            if (DEBUG){
-                Log.w(TAG, String.format(
-                        "Ambient contrast of notification for %s is %s (over black)"
-                                + " by changing #%s to #%s",
-                        context.getPackageName(),
-                        ContrastColorUtil.contrastChange(resolvedColor, color, Color.BLACK),
-                        Integer.toHexString(resolvedColor), Integer.toHexString(color)));
-            }
-        }
-        return color;
-    }
-
     public static int resolvePrimaryColor(Context context, int backgroundColor,
                                           boolean defaultBackgroundIsDark) {
         boolean useDark = shouldUseDark(backgroundColor, defaultBackgroundIsDark);
diff --git a/core/java/com/android/internal/widget/DecorCaptionView.java b/core/java/com/android/internal/widget/DecorCaptionView.java
index e90a8d5..19b68e5 100644
--- a/core/java/com/android/internal/widget/DecorCaptionView.java
+++ b/core/java/com/android/internal/widget/DecorCaptionView.java
@@ -103,6 +103,7 @@
     private final Rect mCloseRect = new Rect();
     private final Rect mMaximizeRect = new Rect();
     private View mClickTarget;
+    private int mRootScrollY;
 
     public DecorCaptionView(Context context) {
         super(context);
@@ -154,10 +155,11 @@
         if (ev.getAction() == MotionEvent.ACTION_DOWN) {
             final int x = (int) ev.getX();
             final int y = (int) ev.getY();
-            if (mMaximizeRect.contains(x, y)) {
+            // Only offset y for containment tests because the actual views are already translated.
+            if (mMaximizeRect.contains(x, y - mRootScrollY)) {
                 mClickTarget = mMaximize;
             }
-            if (mCloseRect.contains(x, y)) {
+            if (mCloseRect.contains(x, y - mRootScrollY)) {
                 mClickTarget = mClose;
             }
         }
@@ -417,4 +419,16 @@
     public boolean onFling(MotionEvent e1, MotionEvent e2, float velocityX, float velocityY) {
         return false;
     }
+
+    /**
+     * Called when {@link android.view.ViewRootImpl} scrolls for adjustPan.
+     */
+    public void onRootViewScrollYChanged(int scrollY) {
+        // Offset the caption opposite the root scroll. This keeps the caption at the
+        // top of the window during adjustPan.
+        if (mCaption != null) {
+            mRootScrollY = scrollY;
+            mCaption.setTranslationY(scrollY);
+        }
+    }
 }
diff --git a/core/java/com/android/internal/widget/ILockSettings.aidl b/core/java/com/android/internal/widget/ILockSettings.aidl
index 1c5816c..3be7c3e 100644
--- a/core/java/com/android/internal/widget/ILockSettings.aidl
+++ b/core/java/com/android/internal/widget/ILockSettings.aidl
@@ -30,11 +30,17 @@
 
 /** {@hide} */
 interface ILockSettings {
+    @UnsupportedAppUsage
     void setBoolean(in String key, in boolean value, in int userId);
+    @UnsupportedAppUsage
     void setLong(in String key, in long value, in int userId);
+    @UnsupportedAppUsage
     void setString(in String key, in String value, in int userId);
+    @UnsupportedAppUsage
     boolean getBoolean(in String key, in boolean defaultValue, in int userId);
+    @UnsupportedAppUsage
     long getLong(in String key, in long defaultValue, in int userId);
+    @UnsupportedAppUsage
     String getString(in String key, in String defaultValue, in int userId);
     void setLockCredential(in byte[] credential, int type, in byte[] savedCredential, int requestedQuality, int userId);
     void resetKeyStore(int userId);
@@ -43,7 +49,9 @@
     VerifyCredentialResponse verifyCredential(in byte[] credential, int type, long challenge, int userId);
     VerifyCredentialResponse verifyTiedProfileChallenge(in byte[] credential, int type, long challenge, int userId);
     boolean checkVoldPassword(int userId);
+    @UnsupportedAppUsage
     boolean havePattern(int userId);
+    @UnsupportedAppUsage
     boolean havePassword(int userId);
     byte[] getHashFactor(in byte[] currentCredential, int userId);
     void setSeparateProfileChallengeEnabled(int userId, boolean enabled, in byte[] managedUserPassword);
diff --git a/core/java/com/android/internal/widget/IRemoteViewsFactory.aidl b/core/java/com/android/internal/widget/IRemoteViewsFactory.aidl
index 7317ecf..d6efca5 100644
--- a/core/java/com/android/internal/widget/IRemoteViewsFactory.aidl
+++ b/core/java/com/android/internal/widget/IRemoteViewsFactory.aidl
@@ -21,15 +21,23 @@
 
 /** {@hide} */
 interface IRemoteViewsFactory {
+    @UnsupportedAppUsage
     void onDataSetChanged();
     oneway void onDataSetChangedAsync();
     oneway void onDestroy(in Intent intent);
+    @UnsupportedAppUsage
     int getCount();
+    @UnsupportedAppUsage
     RemoteViews getViewAt(int position);
+    @UnsupportedAppUsage
     RemoteViews getLoadingView();
+    @UnsupportedAppUsage
     int getViewTypeCount();
+    @UnsupportedAppUsage
     long getItemId(int position);
+    @UnsupportedAppUsage
     boolean hasStableIds();
+    @UnsupportedAppUsage
     boolean isCreated();
 }
 
diff --git a/core/java/com/android/internal/widget/LockPatternUtils.java b/core/java/com/android/internal/widget/LockPatternUtils.java
index 17ed2a0..c095376 100644
--- a/core/java/com/android/internal/widget/LockPatternUtils.java
+++ b/core/java/com/android/internal/widget/LockPatternUtils.java
@@ -1687,8 +1687,21 @@
      *
      * @return a unique 64-bit token handle which is needed to refer to this token later.
      */
-    public long addEscrowToken(byte[] token, int userId) {
-        return getLockSettingsInternal().addEscrowToken(token, userId);
+    public long addEscrowToken(byte[] token, int userId,
+            @Nullable EscrowTokenStateChangeCallback callback) {
+        return getLockSettingsInternal().addEscrowToken(token, userId, callback);
+    }
+
+    /**
+     * Callback interface to notify when an added escrow token has been activated.
+     */
+    public interface EscrowTokenStateChangeCallback {
+        /**
+         * The method to be called when the token is activated.
+         * @param handle 64 bit handle corresponding to the escrow token
+         * @param userid user for whom the escrow token has been added
+         */
+        void onEscrowTokenActivated(long handle, int userid);
     }
 
     /**
diff --git a/core/java/com/android/internal/widget/LockSettingsInternal.java b/core/java/com/android/internal/widget/LockSettingsInternal.java
index 90397df..d459bfb 100644
--- a/core/java/com/android/internal/widget/LockSettingsInternal.java
+++ b/core/java/com/android/internal/widget/LockSettingsInternal.java
@@ -29,15 +29,18 @@
      * or change user password.
      *
      * After adding, if the user currently has lockscreen password, he will need to perform a
-     * confirm credential operation in order to activate the token for future use. If the user
+     * confirm credential operation in order to activate the token for future use.
+     * Once the token is activated, the callback that is passed here is called.   If the user
      * has no secure lockscreen, then the token is activated immediately.
      *
      * @return a unique 64-bit token handle which is needed to refer to this token later.
      */
-    public abstract long addEscrowToken(byte[] token, int userId);
+    public abstract long addEscrowToken(byte[] token, int userId,
+            LockPatternUtils.EscrowTokenStateChangeCallback callback);
 
     /**
      * Remove an escrow token.
+     *
      * @return true if the given handle refers to a valid token previously returned from
      * {@link #addEscrowToken}, whether it's active or not. return false otherwise.
      */
@@ -51,6 +54,7 @@
 
     /**
      * Set the lock credential.
+     *
      * @return true if password is set.
      */
     public abstract boolean setLockCredentialWithToken(byte[] credential, int type,
diff --git a/core/java/com/android/internal/widget/MediaNotificationView.java b/core/java/com/android/internal/widget/MediaNotificationView.java
index 498bc5a..e7d240a 100644
--- a/core/java/com/android/internal/widget/MediaNotificationView.java
+++ b/core/java/com/android/internal/widget/MediaNotificationView.java
@@ -19,6 +19,7 @@
 import android.annotation.Nullable;
 import android.content.Context;
 import android.util.AttributeSet;
+import android.view.NotificationHeaderView;
 import android.view.View;
 import android.view.ViewGroup;
 import android.widget.FrameLayout;
@@ -37,7 +38,7 @@
     private final int mNotificationContentImageMarginEnd;
     private ImageView mRightIcon;
     private View mActions;
-    private View mHeader;
+    private NotificationHeaderView mHeader;
     private View mMainColumn;
     private View mMediaContent;
     private int mImagePushIn;
@@ -94,7 +95,14 @@
                 mMainColumn.setLayoutParams(params);
                 reMeasure = true;
             }
-            int headerMarginEnd = size + imageEndMargin;
+            // margin for the entire header line
+            int headerMarginEnd = imageEndMargin;
+            // margin for the header text (not including the expand button and other icons)
+            int headerTextMarginEnd = size + imageEndMargin;
+            if (headerTextMarginEnd != mHeader.getHeaderTextMarginEnd()) {
+                mHeader.setHeaderTextMarginEnd(headerTextMarginEnd);
+                reMeasure = true;
+            }
             params = (MarginLayoutParams) mHeader.getLayoutParams();
             if (params.getMarginEnd() != headerMarginEnd) {
                 params.setMarginEnd(headerMarginEnd);
@@ -118,6 +126,9 @@
     protected void onLayout(boolean changed, int left, int top, int right, int bottom) {
         super.onLayout(changed, left, top, right, bottom);
         if (mImagePushIn > 0) {
+            if (this.getLayoutDirection() == View.LAYOUT_DIRECTION_RTL) {
+                mImagePushIn *= -1;
+            }
             mRightIcon.layout(mRightIcon.getLeft() + mImagePushIn, mRightIcon.getTop(),
                     mRightIcon.getRight()  + mImagePushIn, mRightIcon.getBottom());
         }
diff --git a/core/java/com/android/internal/widget/ViewPager.java b/core/java/com/android/internal/widget/ViewPager.java
index 64bdc6e..f48b56d7 100644
--- a/core/java/com/android/internal/widget/ViewPager.java
+++ b/core/java/com/android/internal/widget/ViewPager.java
@@ -46,6 +46,7 @@
 import android.view.accessibility.AccessibilityNodeInfo;
 import android.view.accessibility.AccessibilityNodeInfo.AccessibilityAction;
 import android.view.animation.Interpolator;
+import android.view.inspector.InspectableProperty;
 import android.widget.EdgeEffect;
 import android.widget.Scroller;
 
@@ -2779,6 +2780,9 @@
          * Where to position the view page within the overall ViewPager
          * container; constants are defined in {@link android.view.Gravity}.
          */
+        @InspectableProperty(
+                name = "layout_gravity",
+                valueType = InspectableProperty.ValueType.GRAVITY)
         public int gravity;
 
         /**
diff --git a/core/java/com/android/server/SystemConfig.java b/core/java/com/android/server/SystemConfig.java
index 3537465..958bb18 100644
--- a/core/java/com/android/server/SystemConfig.java
+++ b/core/java/com/android/server/SystemConfig.java
@@ -206,6 +206,8 @@
     // associate with any other apps, but does not limit what apps B can associate with.
     final ArrayMap<String, ArraySet<String>> mAllowedAssociations = new ArrayMap<>();
 
+    private final ArraySet<String> mBugreportWhitelistedPackages = new ArraySet<>();
+
     public static SystemConfig getInstance() {
         synchronized (SystemConfig.class) {
             if (sInstance == null) {
@@ -339,6 +341,10 @@
         return mAllowedAssociations;
     }
 
+    public ArraySet<String> getBugreportWhitelistedPackages() {
+        return mBugreportWhitelistedPackages;
+    }
+
     SystemConfig() {
         // Read configuration from system
         readPermissions(Environment.buildPath(
@@ -924,6 +930,15 @@
                         }
                         XmlUtils.skipCurrentTag(parser);
                     } break;
+                    case "bugreport-whitelisted": {
+                        String pkgname = parser.getAttributeValue(null, "package");
+                        if (pkgname == null) {
+                            Slog.w(TAG, "<" + name + "> without package in " + permFile
+                                    + " at " + parser.getPositionDescription());
+                        } else {
+                            mBugreportWhitelistedPackages.add(pkgname);
+                        }
+                    } break;
                     default: {
                         Slog.w(TAG, "Tag " + name + " is unknown in "
                                 + permFile + " at " + parser.getPositionDescription());
diff --git a/core/java/com/android/server/net/OWNERS b/core/java/com/android/server/net/OWNERS
index 7311eee..d3836d4 100644
--- a/core/java/com/android/server/net/OWNERS
+++ b/core/java/com/android/server/net/OWNERS
@@ -1,8 +1,8 @@
 set noparent
 
 codewiz@google.com
-ek@google.com
 jchalard@google.com
+junyulai@google.com
 lorenzo@google.com
 reminv@google.com
 satk@google.com
diff --git a/core/jni/Android.bp b/core/jni/Android.bp
index c309f27..cd34d2e 100644
--- a/core/jni/Android.bp
+++ b/core/jni/Android.bp
@@ -165,6 +165,8 @@
         "android_media_AudioTrack.cpp",
         "android_media_AudioAttributes.cpp",
         "android_media_AudioProductStrategies.cpp",
+        "android_media_AudioVolumeGroups.cpp",
+        "android_media_AudioVolumeGroupCallback.cpp",
         "android_media_DeviceCallback.cpp",
         "android_media_JetPlayer.cpp",
         "android_media_MediaMetricsJNI.cpp",
diff --git a/core/jni/AndroidRuntime.cpp b/core/jni/AndroidRuntime.cpp
index 16517bf..da27852 100644
--- a/core/jni/AndroidRuntime.cpp
+++ b/core/jni/AndroidRuntime.cpp
@@ -110,6 +110,8 @@
 extern int register_android_media_AudioTrack(JNIEnv *env);
 extern int register_android_media_AudioAttributes(JNIEnv *env);
 extern int register_android_media_AudioProductStrategies(JNIEnv *env);
+extern int register_android_media_AudioVolumeGroups(JNIEnv *env);
+extern int register_android_media_AudioVolumeGroupChangeHandler(JNIEnv *env);
 extern int register_android_media_MicrophoneInfo(JNIEnv *env);
 extern int register_android_media_JetPlayer(JNIEnv *env);
 extern int register_android_media_ToneGenerator(JNIEnv *env);
@@ -1524,6 +1526,8 @@
     REG_JNI(register_android_media_AudioTrack),
     REG_JNI(register_android_media_AudioAttributes),
     REG_JNI(register_android_media_AudioProductStrategies),
+    REG_JNI(register_android_media_AudioVolumeGroups),
+    REG_JNI(register_android_media_AudioVolumeGroupChangeHandler),
     REG_JNI(register_android_media_JetPlayer),
     REG_JNI(register_android_media_MicrophoneInfo),
     REG_JNI(register_android_media_RemoteDisplay),
diff --git a/core/jni/android/graphics/AnimatedImageDrawable.cpp b/core/jni/android/graphics/AnimatedImageDrawable.cpp
index 8dd5f5f..1290026 100644
--- a/core/jni/android/graphics/AnimatedImageDrawable.cpp
+++ b/core/jni/android/graphics/AnimatedImageDrawable.cpp
@@ -35,14 +35,14 @@
 // Note: jpostProcess holds a handle to the ImageDecoder.
 static jlong AnimatedImageDrawable_nCreate(JNIEnv* env, jobject /*clazz*/,
                                            jlong nativeImageDecoder, jobject jpostProcess,
-                                           jint width, jint height, jobject jsubset) {
+                                           jint width, jint height, jlong colorSpaceHandle,
+                                           jboolean extended, jobject jsubset) {
     if (nativeImageDecoder == 0) {
         doThrowIOE(env, "Cannot create AnimatedImageDrawable from null!");
         return 0;
     }
 
     auto* imageDecoder = reinterpret_cast<ImageDecoder*>(nativeImageDecoder);
-    const SkISize scaledSize = SkISize::Make(width, height);
     SkIRect subset;
     if (jsubset) {
         GraphicsJNI::jrect_to_irect(env, jsubset, &subset);
@@ -50,15 +50,8 @@
         subset = SkIRect::MakeWH(width, height);
     }
 
-    auto info = imageDecoder->mCodec->getInfo();
     bool hasRestoreFrame = false;
-    if (imageDecoder->mCodec->getEncodedFormat() == SkEncodedImageFormat::kWEBP) {
-        if (width < info.width() && height < info.height()) {
-            // WebP will scale its SkBitmap to the scaled size.
-            // FIXME: b/73529447 GIF should do the same.
-            info = info.makeWH(width, height);
-        }
-    } else {
+    if (imageDecoder->mCodec->getEncodedFormat() != SkEncodedImageFormat::kWEBP) {
         const int frameCount = imageDecoder->mCodec->codec()->getFrameCount();
         for (int i = 0; i < frameCount; ++i) {
             SkCodec::FrameInfo frameInfo;
@@ -73,6 +66,12 @@
         }
     }
 
+    auto info = imageDecoder->mCodec->getInfo().makeWH(width, height)
+        .makeColorSpace(GraphicsJNI::getNativeColorSpace(colorSpaceHandle));
+    if (extended) {
+        info = info.makeColorType(kRGBA_F16_SkColorType);
+    }
+
     size_t bytesUsed = info.computeMinByteSize();
     // SkAnimatedImage has one SkBitmap for decoding, plus an extra one if there is a
     // kRestorePrevious frame. AnimatedImageDrawable has two SkPictures storing the current
@@ -96,7 +95,7 @@
 
 
     sk_sp<SkAnimatedImage> animatedImg = SkAnimatedImage::Make(std::move(imageDecoder->mCodec),
-                                                               scaledSize, subset,
+                                                               info, subset,
                                                                std::move(picture));
     if (!animatedImg) {
         doThrowIOE(env, "Failed to create drawable");
@@ -246,7 +245,7 @@
 }
 
 static const JNINativeMethod gAnimatedImageDrawableMethods[] = {
-    { "nCreate",             "(JLandroid/graphics/ImageDecoder;IILandroid/graphics/Rect;)J", (void*) AnimatedImageDrawable_nCreate },
+    { "nCreate",             "(JLandroid/graphics/ImageDecoder;IIJZLandroid/graphics/Rect;)J",(void*) AnimatedImageDrawable_nCreate },
     { "nGetNativeFinalizer", "()J",                                                          (void*) AnimatedImageDrawable_nGetNativeFinalizer },
     { "nDraw",               "(JJ)J",                                                        (void*) AnimatedImageDrawable_nDraw },
     { "nSetAlpha",           "(JI)V",                                                        (void*) AnimatedImageDrawable_nSetAlpha },
diff --git a/core/jni/android/graphics/TEST_MAPPING b/core/jni/android/graphics/TEST_MAPPING
new file mode 100644
index 0000000..10bd0ee
--- /dev/null
+++ b/core/jni/android/graphics/TEST_MAPPING
@@ -0,0 +1,7 @@
+{
+  "presubmit": [
+    {
+      "name": "CtsGraphicsTestCases"
+    }
+  ]
+}
diff --git a/core/jni/android_media_AudioProductStrategies.cpp b/core/jni/android_media_AudioProductStrategies.cpp
index d7d31e5..822b74a 100644
--- a/core/jni/android_media_AudioProductStrategies.cpp
+++ b/core/jni/android_media_AudioProductStrategies.cpp
@@ -57,7 +57,7 @@
 static jclass gAudioAttributesGroupClass;
 static jmethodID gAudioAttributesGroupCstor;
 static struct {
-    jfieldID    mGroupId;
+    jfieldID    mVolumeGroupId;
     jfieldID    mLegacyStreamType;
     jfieldID    mAudioAttributes;
 } gAudioAttributesGroupsFields;
@@ -207,7 +207,7 @@
     }
     product_strategy_t psId;
     status_t status = AudioSystem::getProductStrategyFromAudioAttributes(
-            AudioAttributes(*attributes.get()), psId);
+                AudioAttributes(*attributes.get()), psId);
     if (status != NO_ERROR) {
         return nativeToJavaStatus(status);
     }
@@ -249,8 +249,8 @@
     gAudioAttributesGroupClass = MakeGlobalRefOrDie(env, audioAttributesGroupClass);
     gAudioAttributesGroupCstor = GetMethodIDOrDie(env, audioAttributesGroupClass, "<init>",
                                                   "(II[Landroid/media/AudioAttributes;)V");
-    gAudioAttributesGroupsFields.mGroupId = GetFieldIDOrDie(
-                env, audioAttributesGroupClass, "mGroupId", "I");
+    gAudioAttributesGroupsFields.mVolumeGroupId = GetFieldIDOrDie(
+                env, audioAttributesGroupClass, "mVolumeGroupId", "I");
     gAudioAttributesGroupsFields.mLegacyStreamType = GetFieldIDOrDie(
                 env, audioAttributesGroupClass, "mLegacyStreamType", "I");
     gAudioAttributesGroupsFields.mAudioAttributes = GetFieldIDOrDie(
diff --git a/core/jni/android_media_AudioSystem.cpp b/core/jni/android_media_AudioSystem.cpp
index bd998999..1a90ebf 100644
--- a/core/jni/android_media_AudioSystem.cpp
+++ b/core/jni/android_media_AudioSystem.cpp
@@ -573,6 +573,81 @@
 }
 
 static jint
+android_media_AudioSystem_setVolumeIndexForAttributes(JNIEnv *env,
+                                                      jobject thiz,
+                                                      jobject jaa,
+                                                      jint index,
+                                                      jint device)
+{
+    // read the AudioAttributes values
+    JNIAudioAttributeHelper::UniqueAaPtr paa = JNIAudioAttributeHelper::makeUnique();
+    jint jStatus = JNIAudioAttributeHelper::nativeFromJava(env, jaa, paa.get());
+    if (jStatus != (jint)AUDIO_JAVA_SUCCESS) {
+        return jStatus;
+    }
+    return (jint) check_AudioSystem_Command(
+            AudioSystem::setVolumeIndexForAttributes(*(paa.get()), index, (audio_devices_t)device));
+}
+
+static jint
+android_media_AudioSystem_getVolumeIndexForAttributes(JNIEnv *env,
+                                                      jobject thiz,
+                                                      jobject jaa,
+                                                      jint device)
+{
+    // read the AudioAttributes values
+    JNIAudioAttributeHelper::UniqueAaPtr paa = JNIAudioAttributeHelper::makeUnique();
+    jint jStatus = JNIAudioAttributeHelper::nativeFromJava(env, jaa, paa.get());
+    if (jStatus != (jint)AUDIO_JAVA_SUCCESS) {
+        return jStatus;
+    }
+    int index;
+    if (AudioSystem::getVolumeIndexForAttributes(*(paa.get()), index, (audio_devices_t)device)
+            != NO_ERROR) {
+        index = -1;
+    }
+    return (jint) index;
+}
+
+static jint
+android_media_AudioSystem_getMinVolumeIndexForAttributes(JNIEnv *env,
+                                                         jobject thiz,
+                                                         jobject jaa)
+{
+    // read the AudioAttributes values
+    JNIAudioAttributeHelper::UniqueAaPtr paa = JNIAudioAttributeHelper::makeUnique();
+    jint jStatus = JNIAudioAttributeHelper::nativeFromJava(env, jaa, paa.get());
+    if (jStatus != (jint)AUDIO_JAVA_SUCCESS) {
+        return jStatus;
+    }
+    int index;
+    if (AudioSystem::getMinVolumeIndexForAttributes(*(paa.get()), index)
+            != NO_ERROR) {
+        index = -1;
+    }
+    return (jint) index;
+}
+
+static jint
+android_media_AudioSystem_getMaxVolumeIndexForAttributes(JNIEnv *env,
+                                                         jobject thiz,
+                                                         jobject jaa)
+{
+    // read the AudioAttributes values
+    JNIAudioAttributeHelper::UniqueAaPtr paa = JNIAudioAttributeHelper::makeUnique();
+    jint jStatus = JNIAudioAttributeHelper::nativeFromJava(env, jaa, paa.get());
+    if (jStatus != (jint)AUDIO_JAVA_SUCCESS) {
+        return jStatus;
+    }
+    int index;
+    if (AudioSystem::getMaxVolumeIndexForAttributes(*(paa.get()), index)
+            != NO_ERROR) {
+        index = -1;
+    }
+    return (jint) index;
+}
+
+static jint
 android_media_AudioSystem_setMasterVolume(JNIEnv *env, jobject thiz, jfloat value)
 {
     return (jint) check_AudioSystem_Command(AudioSystem::setMasterVolume(value));
@@ -2172,6 +2247,10 @@
     {"initStreamVolume",    "(III)I",   (void *)android_media_AudioSystem_initStreamVolume},
     {"setStreamVolumeIndex","(III)I",   (void *)android_media_AudioSystem_setStreamVolumeIndex},
     {"getStreamVolumeIndex","(II)I",    (void *)android_media_AudioSystem_getStreamVolumeIndex},
+    {"setVolumeIndexForAttributes","(Landroid/media/AudioAttributes;II)I",   (void *)android_media_AudioSystem_setVolumeIndexForAttributes},
+    {"getVolumeIndexForAttributes","(Landroid/media/AudioAttributes;I)I",    (void *)android_media_AudioSystem_getVolumeIndexForAttributes},
+    {"getMinVolumeIndexForAttributes","(Landroid/media/AudioAttributes;)I",    (void *)android_media_AudioSystem_getMinVolumeIndexForAttributes},
+    {"getMaxVolumeIndexForAttributes","(Landroid/media/AudioAttributes;)I",    (void *)android_media_AudioSystem_getMaxVolumeIndexForAttributes},
     {"setMasterVolume",     "(F)I",     (void *)android_media_AudioSystem_setMasterVolume},
     {"getMasterVolume",     "()F",      (void *)android_media_AudioSystem_getMasterVolume},
     {"setMasterMute",       "(Z)I",     (void *)android_media_AudioSystem_setMasterMute},
diff --git a/core/jni/android_media_AudioVolumeGroupCallback.cpp b/core/jni/android_media_AudioVolumeGroupCallback.cpp
new file mode 100644
index 0000000..cb4ddbd
--- /dev/null
+++ b/core/jni/android_media_AudioVolumeGroupCallback.cpp
@@ -0,0 +1,175 @@
+/*
+ * Copyright (C) 2018 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_NDEBUG 0
+
+#define LOG_TAG "AudioVolumeGroupCallback-JNI"
+
+#include <utils/Log.h>
+#include <nativehelper/JNIHelp.h>
+#include "core_jni_helpers.h"
+
+#include "android_media_AudioVolumeGroupCallback.h"
+
+
+// ----------------------------------------------------------------------------
+using namespace android;
+
+static const char* const kAudioVolumeGroupChangeHandlerClassPathName =
+        "android/media/audiopolicy/AudioVolumeGroupChangeHandler";
+
+static struct {
+    jfieldID    mJniCallback;
+} gAudioVolumeGroupChangeHandlerFields;
+
+static struct {
+    jmethodID    postEventFromNative;
+} gAudioVolumeGroupChangeHandlerMethods;
+
+static Mutex gLock;
+
+JNIAudioVolumeGroupCallback::JNIAudioVolumeGroupCallback(JNIEnv* env,
+                                                         jobject thiz,
+                                                         jobject weak_thiz)
+{
+    jclass clazz = env->GetObjectClass(thiz);
+    if (clazz == NULL) {
+        ALOGE("Can't find class %s", kAudioVolumeGroupChangeHandlerClassPathName);
+        return;
+    }
+    mClass = (jclass)env->NewGlobalRef(clazz);
+
+    // We use a weak reference so the AudioVolumeGroupChangeHandler object can be garbage collected.
+    // The reference is only used as a proxy for callbacks.
+    mObject  = env->NewGlobalRef(weak_thiz);
+}
+
+JNIAudioVolumeGroupCallback::~JNIAudioVolumeGroupCallback()
+{
+    // remove global references
+    JNIEnv *env = AndroidRuntime::getJNIEnv();
+    if (env == NULL) {
+        return;
+    }
+    env->DeleteGlobalRef(mObject);
+    env->DeleteGlobalRef(mClass);
+}
+
+void JNIAudioVolumeGroupCallback::onAudioVolumeGroupChanged(volume_group_t group, int flags)
+{
+    JNIEnv *env = AndroidRuntime::getJNIEnv();
+    if (env == NULL) {
+        return;
+    }
+    ALOGV("%s volume group id %d", __FUNCTION__, group);
+    env->CallStaticVoidMethod(mClass,
+                              gAudioVolumeGroupChangeHandlerMethods.postEventFromNative,
+                              mObject,
+                              AUDIOVOLUMEGROUP_EVENT_VOLUME_CHANGED, group, flags, NULL);
+    if (env->ExceptionCheck()) {
+        ALOGW("An exception occurred while notifying an event.");
+        env->ExceptionClear();
+    }
+}
+
+void JNIAudioVolumeGroupCallback::onServiceDied()
+{
+    JNIEnv *env = AndroidRuntime::getJNIEnv();
+    if (env == NULL) {
+        return;
+    }
+    env->CallStaticVoidMethod(mClass,
+                              gAudioVolumeGroupChangeHandlerMethods.postEventFromNative,
+                              mObject,
+                              AUDIOVOLUMEGROUP_EVENT_SERVICE_DIED, 0, 0, NULL);
+    if (env->ExceptionCheck()) {
+        ALOGW("An exception occurred while notifying an event.");
+        env->ExceptionClear();
+    }
+}
+
+static
+sp<JNIAudioVolumeGroupCallback> setJniCallback(JNIEnv* env,
+                                               jobject thiz,
+                                               const sp<JNIAudioVolumeGroupCallback>& callback)
+{
+    Mutex::Autolock l(gLock);
+    sp<JNIAudioVolumeGroupCallback> old = (JNIAudioVolumeGroupCallback*)env->GetLongField(
+                thiz, gAudioVolumeGroupChangeHandlerFields.mJniCallback);
+    if (callback.get()) {
+        callback->incStrong((void*)setJniCallback);
+    }
+    if (old != 0) {
+        old->decStrong((void*)setJniCallback);
+    }
+    env->SetLongField(thiz, gAudioVolumeGroupChangeHandlerFields.mJniCallback,
+                      (jlong)callback.get());
+    return old;
+}
+
+static void
+android_media_AudioVolumeGroupChangeHandler_eventHandlerSetup(JNIEnv *env,
+                                                              jobject thiz,
+                                                              jobject weak_this)
+{
+    ALOGV("%s", __FUNCTION__);
+    sp<JNIAudioVolumeGroupCallback> callback =
+            new JNIAudioVolumeGroupCallback(env, thiz, weak_this);
+
+    if (AudioSystem::addAudioVolumeGroupCallback(callback) == NO_ERROR) {
+        setJniCallback(env, thiz, callback);
+    }
+}
+
+static void
+android_media_AudioVolumeGroupChangeHandler_eventHandlerFinalize(JNIEnv *env, jobject thiz)
+{
+    ALOGV("%s", __FUNCTION__);
+    sp<JNIAudioVolumeGroupCallback> callback = setJniCallback(env, thiz, 0);
+    if (callback != 0) {
+        AudioSystem::removeAudioVolumeGroupCallback(callback);
+    }
+}
+
+/*
+ * JNI registration.
+ */
+static const JNINativeMethod gMethods[] = {
+    {"native_setup", "(Ljava/lang/Object;)V",
+        (void *)android_media_AudioVolumeGroupChangeHandler_eventHandlerSetup},
+    {"native_finalize",  "()V",
+        (void *)android_media_AudioVolumeGroupChangeHandler_eventHandlerFinalize},
+};
+
+int register_android_media_AudioVolumeGroupChangeHandler(JNIEnv *env)
+{
+    jclass audioVolumeGroupChangeHandlerClass =
+            FindClassOrDie(env, kAudioVolumeGroupChangeHandlerClassPathName);
+    gAudioVolumeGroupChangeHandlerMethods.postEventFromNative =
+            GetStaticMethodIDOrDie(env, audioVolumeGroupChangeHandlerClass, "postEventFromNative",
+                                   "(Ljava/lang/Object;IIILjava/lang/Object;)V");
+
+    gAudioVolumeGroupChangeHandlerFields.mJniCallback =
+            GetFieldIDOrDie(env, audioVolumeGroupChangeHandlerClass, "mJniCallback", "J");
+
+    env->DeleteLocalRef(audioVolumeGroupChangeHandlerClass);
+
+    return RegisterMethodsOrDie(env,
+                                kAudioVolumeGroupChangeHandlerClassPathName,
+                                gMethods,
+                                NELEM(gMethods));
+}
+
diff --git a/core/jni/android_media_AudioVolumeGroupCallback.h b/core/jni/android_media_AudioVolumeGroupCallback.h
new file mode 100644
index 0000000..de06549
--- /dev/null
+++ b/core/jni/android_media_AudioVolumeGroupCallback.h
@@ -0,0 +1,44 @@
+/*
+ * Copyright (C) 2018 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.
+ */
+
+#pragma once
+
+#include <system/audio.h>
+#include <media/AudioSystem.h>
+
+namespace android {
+
+// keep in sync with AudioManager.AudioVolumeGroupChangeHandler.java
+#define AUDIOVOLUMEGROUP_EVENT_VOLUME_CHANGED      1000
+#define AUDIOVOLUMEGROUP_EVENT_SERVICE_DIED        1001
+
+class JNIAudioVolumeGroupCallback: public AudioSystem::AudioVolumeGroupCallback
+{
+public:
+    JNIAudioVolumeGroupCallback(JNIEnv* env, jobject thiz, jobject weak_thiz);
+    ~JNIAudioVolumeGroupCallback();
+
+    void onAudioVolumeGroupChanged(volume_group_t group, int flags) override;
+    void onServiceDied() override;
+
+private:
+    void sendEvent(int event);
+
+    jclass      mClass; /**< Reference to AudioVolumeGroupChangeHandler class. */
+    jobject     mObject; /**< Weak ref to AudioVolumeGroupChangeHandler object to call on. */
+};
+
+} // namespace android
diff --git a/core/jni/android_media_AudioVolumeGroups.cpp b/core/jni/android_media_AudioVolumeGroups.cpp
new file mode 100644
index 0000000..64f0c1e
--- /dev/null
+++ b/core/jni/android_media_AudioVolumeGroups.cpp
@@ -0,0 +1,183 @@
+/*
+ * Copyright (C) 2018 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_NDEBUG 0
+
+#define LOG_TAG "AudioVolumeGroups-JNI"
+
+#include <inttypes.h>
+#include <jni.h>
+#include <nativehelper/JNIHelp.h>
+#include "core_jni_helpers.h"
+
+#include <utils/Log.h>
+#include <vector>
+
+#include <media/AudioSystem.h>
+#include <media/AudioPolicy.h>
+
+#include <nativehelper/ScopedUtfChars.h>
+
+#include "android_media_AudioAttributes.h"
+#include "android_media_AudioErrors.h"
+
+// ----------------------------------------------------------------------------
+
+using namespace android;
+
+// ----------------------------------------------------------------------------
+static const char* const kClassPathName = "android/media/audiopolicy/AudioVolumeGroups";
+static const char* const kAudioVolumeGroupClassPathName =
+        "android/media/audiopolicy/AudioVolumeGroup";
+
+static jclass gAudioVolumeGroupClass;
+static jmethodID gAudioVolumeGroupCstor;
+static struct {
+    jfieldID    mName;
+    jfieldID    mId;
+} gAudioVolumeGroupFields;
+
+static jclass gArrayListClass;
+static jmethodID gArrayListCstor;
+static struct {
+    jmethodID    add;
+    jmethodID    toArray;
+} gArrayListMethods;
+
+
+static jint convertAudioVolumeGroupsFromNative(
+        JNIEnv *env, jobject *jGroup, const AudioVolumeGroup &group)
+{
+    jint jStatus = (jint)AUDIO_JAVA_SUCCESS;
+    jstring jName = NULL;
+    jint Id = NULL;
+
+    jintArray jLegacyStreamTypes = NULL;
+    jobjectArray jAudioAttributes = NULL;
+    jint numAttributes;
+    jobject jAudioAttribute = NULL;
+
+    jName = env->NewStringUTF(group.getName().c_str());
+    Id = static_cast<jint>(group.getId());
+
+    // Legacy stream types array
+    jLegacyStreamTypes = env->NewIntArray(group.getStreamTypes().size());
+    if (jLegacyStreamTypes == NULL) {
+        jStatus = (jint)AUDIO_JAVA_ERROR;
+        goto exit;
+    }
+    for (size_t streamIndex = 0; streamIndex < group.getStreamTypes().size(); streamIndex++) {
+        jint jStream = group.getStreamTypes()[streamIndex];
+        env->SetIntArrayRegion(jLegacyStreamTypes, streamIndex, 1, &jStream);
+    }
+
+    // Audio Attributes array
+    numAttributes = group.getAudioAttributes().size();
+    jStatus = JNIAudioAttributeHelper::getJavaArray(env, &jAudioAttributes, numAttributes);
+    if (jStatus != (jint)AUDIO_JAVA_SUCCESS) {
+        goto exit;
+    }
+
+    for (size_t j = 0; j < static_cast<size_t>(numAttributes); j++) {
+        auto attributes = group.getAudioAttributes()[j];
+
+        jStatus = JNIAudioAttributeHelper::nativeToJava(env, &jAudioAttribute, attributes);
+        if (jStatus != AUDIO_JAVA_SUCCESS) {
+            goto exit;
+        }
+        env->SetObjectArrayElement(jAudioAttributes, j, jAudioAttribute);
+    }
+
+    *jGroup = env->NewObject(gAudioVolumeGroupClass, gAudioVolumeGroupCstor,
+                             jName, Id, jAudioAttributes, jLegacyStreamTypes);
+exit:
+    if (jName != NULL) {
+        env->DeleteLocalRef(jName);
+    }
+    return jStatus;
+}
+
+static jint
+android_media_AudioSystem_listAudioVolumeGroups(JNIEnv *env, jobject clazz, jobject jVolumeGroups)
+{
+    if (env == NULL) {
+        return AUDIO_JAVA_DEAD_OBJECT;
+    }
+    if (jVolumeGroups == NULL) {
+        ALOGE("listAudioVolumeGroups NULL AudioVolumeGroups");
+        return (jint)AUDIO_JAVA_BAD_VALUE;
+    }
+    if (!env->IsInstanceOf(jVolumeGroups, gArrayListClass)) {
+        ALOGE("listAudioVolumeGroups not an arraylist");
+        return (jint)AUDIO_JAVA_BAD_VALUE;
+    }
+
+    status_t status;
+    AudioVolumeGroupVector groups;
+    jint jStatus;
+    jobject jGroup = NULL;
+
+    status = AudioSystem::listAudioVolumeGroups(groups);
+    if (status != NO_ERROR) {
+        ALOGE("AudioSystem::listAudioVolumeGroups error %d", status);
+        return nativeToJavaStatus(status);
+    }
+    for (const auto &group : groups) {
+        jStatus = convertAudioVolumeGroupsFromNative(env, &jGroup, group);
+        if (jStatus != AUDIO_JAVA_SUCCESS) {
+            goto exit;
+        }
+        env->CallBooleanMethod(jVolumeGroups, gArrayListMethods.add, jGroup);
+    }
+exit:
+    if (jGroup != NULL) {
+        env->DeleteLocalRef(jGroup);
+    }
+    return jStatus;
+}
+
+/*
+ * JNI registration.
+ */
+static const JNINativeMethod gMethods[] = {
+    {"native_list_audio_volume_groups", "(Ljava/util/ArrayList;)I",
+                        (void *)android_media_AudioSystem_listAudioVolumeGroups},
+};
+
+int register_android_media_AudioVolumeGroups(JNIEnv *env)
+{
+    jclass arrayListClass = FindClassOrDie(env, "java/util/ArrayList");
+    gArrayListClass = MakeGlobalRefOrDie(env, arrayListClass);
+    gArrayListCstor = GetMethodIDOrDie(env, arrayListClass, "<init>", "()V");
+    gArrayListMethods.add = GetMethodIDOrDie(env, arrayListClass, "add", "(Ljava/lang/Object;)Z");
+    gArrayListMethods.toArray = GetMethodIDOrDie(env, arrayListClass,
+                                                 "toArray", "()[Ljava/lang/Object;");
+
+    jclass audioVolumeGroupClass = FindClassOrDie(env, kAudioVolumeGroupClassPathName);
+    gAudioVolumeGroupClass = MakeGlobalRefOrDie(env, audioVolumeGroupClass);
+    gAudioVolumeGroupCstor = GetMethodIDOrDie(
+                env, audioVolumeGroupClass, "<init>",
+                "(Ljava/lang/String;I[Landroid/media/AudioAttributes;[I)V");
+
+    gAudioVolumeGroupFields.mName = GetFieldIDOrDie(
+                env, audioVolumeGroupClass, "mName", "Ljava/lang/String;");
+    gAudioVolumeGroupFields.mId = GetFieldIDOrDie(
+                env, audioVolumeGroupClass, "mId", "I");
+
+    env->DeleteLocalRef(audioVolumeGroupClass);
+
+    return RegisterMethodsOrDie(env, kClassPathName, gMethods, NELEM(gMethods));
+}
diff --git a/core/jni/android_util_AssetManager.cpp b/core/jni/android_util_AssetManager.cpp
index af2d413..bf56ef4 100644
--- a/core/jni/android_util_AssetManager.cpp
+++ b/core/jni/android_util_AssetManager.cpp
@@ -238,6 +238,11 @@
     return env->NewObjectArray(0, g_stringClass, nullptr);
   }
 
+  if (access("/system/bin/idmap2", X_OK) == -1) {
+    PLOG(WARNING) << "unable to execute idmap2";
+    return nullptr;
+  }
+
   std::vector<std::string> argv{"/system/bin/idmap2",
     "scan",
     "--recursive",
diff --git a/core/jni/android_view_CompositionSamplingListener.cpp b/core/jni/android_view_CompositionSamplingListener.cpp
index 283ba0d..7141e6e 100644
--- a/core/jni/android_view_CompositionSamplingListener.cpp
+++ b/core/jni/android_view_CompositionSamplingListener.cpp
@@ -28,6 +28,7 @@
 
 #include <gui/IRegionSamplingListener.h>
 #include <gui/ISurfaceComposer.h>
+#include <gui/SurfaceComposerClient.h>
 #include <ui/Rect.h>
 
 namespace android {
@@ -83,28 +84,22 @@
     sp<CompositionSamplingListener> listener = reinterpret_cast<CompositionSamplingListener*>(ptr);
     sp<IBinder> stopLayerHandle = ibinderForJavaObject(env, stopLayerTokenObj);
 
-    // TODO: Use SurfaceComposerClient once it has addRegionSamplingListener.
-    sp<ISurfaceComposer> composer;
-    if (getService(String16("SurfaceFlinger"), &composer) != NO_ERROR) {
-        jniThrowRuntimeException(env, "Couldn't retrieve SurfaceFlinger");
-        return;
+    if (SurfaceComposerClient::addRegionSamplingListener(
+            Rect(left, top, right, bottom), stopLayerHandle, listener) != OK) {
+        constexpr auto error_msg = "Couldn't addRegionSamplingListener";
+        ALOGE(error_msg);
+        jniThrowRuntimeException(env, error_msg);
     }
-
-    composer->addRegionSamplingListener(
-            Rect(left, top, right, bottom), stopLayerHandle, listener);
 }
 
 void nativeUnregister(JNIEnv* env, jclass clazz, jlong ptr) {
     sp<CompositionSamplingListener> listener = reinterpret_cast<CompositionSamplingListener*>(ptr);
 
-    // TODO: Use SurfaceComposerClient once it has addRegionSamplingListener.
-    sp<ISurfaceComposer> composer;
-    if (getService(String16("SurfaceFlinger"), &composer) != NO_ERROR) {
-        jniThrowRuntimeException(env, "Couldn't retrieve SurfaceFlinger");
-        return;
+    if (SurfaceComposerClient::removeRegionSamplingListener(listener) != OK) {
+        constexpr auto error_msg = "Couldn't removeRegionSamplingListener";
+        ALOGE(error_msg);
+        jniThrowRuntimeException(env, error_msg);
     }
-
-    composer->removeRegionSamplingListener(listener);
 }
 
 const JNINativeMethod gMethods[] = {
diff --git a/core/jni/android_view_InputEventReceiver.cpp b/core/jni/android_view_InputEventReceiver.cpp
index fb6dd93..7975c86 100644
--- a/core/jni/android_view_InputEventReceiver.cpp
+++ b/core/jni/android_view_InputEventReceiver.cpp
@@ -23,10 +23,9 @@
 #include <nativehelper/JNIHelp.h>
 
 #include <android_runtime/AndroidRuntime.h>
-#include <utils/Log.h>
+#include <log/log.h>
 #include <utils/Looper.h>
 #include <utils/Vector.h>
-#include <utils/threads.h>
 #include <input/InputTransport.h>
 #include "android_os_MessageQueue.h"
 #include "android_view_InputChannel.h"
diff --git a/core/jni/android_view_InputEventSender.cpp b/core/jni/android_view_InputEventSender.cpp
index aa10a2f..2542286 100644
--- a/core/jni/android_view_InputEventSender.cpp
+++ b/core/jni/android_view_InputEventSender.cpp
@@ -21,10 +21,8 @@
 #include <nativehelper/JNIHelp.h>
 
 #include <android_runtime/AndroidRuntime.h>
-#include <utils/Log.h>
+#include <log/log.h>
 #include <utils/Looper.h>
-#include <utils/threads.h>
-#include <utils/KeyedVector.h>
 #include <input/InputTransport.h>
 #include "android_os_MessageQueue.h"
 #include "android_view_InputChannel.h"
@@ -32,6 +30,7 @@
 #include "android_view_MotionEvent.h"
 
 #include <nativehelper/ScopedLocalRef.h>
+#include <unordered_map>
 
 #include "core_jni_helpers.h"
 
@@ -65,7 +64,8 @@
     jobject mSenderWeakGlobal;
     InputPublisher mInputPublisher;
     sp<MessageQueue> mMessageQueue;
-    KeyedVector<uint32_t, uint32_t> mPublishedSeqMap;
+    std::unordered_map<uint32_t, uint32_t> mPublishedSeqMap;
+
     uint32_t mNextPublishedSeq;
 
     const std::string getInputChannelName() {
@@ -122,7 +122,7 @@
                 getInputChannelName().c_str(), status);
         return status;
     }
-    mPublishedSeqMap.add(publishedSeq, seq);
+    mPublishedSeqMap.emplace(publishedSeq, seq);
     return OK;
 }
 
@@ -150,7 +150,7 @@
             return status;
         }
     }
-    mPublishedSeqMap.add(publishedSeq, seq);
+    mPublishedSeqMap.emplace(publishedSeq, seq);
     return OK;
 }
 
@@ -199,35 +199,37 @@
             return status;
         }
 
-        ssize_t index = mPublishedSeqMap.indexOfKey(publishedSeq);
-        if (index >= 0) {
-            uint32_t seq = mPublishedSeqMap.valueAt(index);
-            mPublishedSeqMap.removeItemsAt(index);
+        auto it = mPublishedSeqMap.find(publishedSeq);
+        if (it == mPublishedSeqMap.end()) {
+            continue;
+        }
 
-            if (kDebugDispatchCycle) {
-                ALOGD("channel '%s' ~ Received finished signal, seq=%u, handled=%s, "
-                        "pendingEvents=%zu.",
-                        getInputChannelName().c_str(), seq, handled ? "true" : "false",
-                        mPublishedSeqMap.size());
+        uint32_t seq = it->second;
+        mPublishedSeqMap.erase(it);
+
+        if (kDebugDispatchCycle) {
+            ALOGD("channel '%s' ~ Received finished signal, seq=%u, handled=%s, "
+                    "pendingEvents=%zu.",
+                    getInputChannelName().c_str(), seq, handled ? "true" : "false",
+                    mPublishedSeqMap.size());
+        }
+
+        if (!skipCallbacks) {
+            if (!senderObj.get()) {
+                senderObj.reset(jniGetReferent(env, mSenderWeakGlobal));
+                if (!senderObj.get()) {
+                    ALOGW("channel '%s' ~ Sender object was finalized "
+                            "without being disposed.", getInputChannelName().c_str());
+                    return DEAD_OBJECT;
+                }
             }
 
-            if (!skipCallbacks) {
-                if (!senderObj.get()) {
-                    senderObj.reset(jniGetReferent(env, mSenderWeakGlobal));
-                    if (!senderObj.get()) {
-                        ALOGW("channel '%s' ~ Sender object was finalized "
-                                "without being disposed.", getInputChannelName().c_str());
-                        return DEAD_OBJECT;
-                    }
-                }
-
-                env->CallVoidMethod(senderObj.get(),
-                        gInputEventSenderClassInfo.dispatchInputEventFinished,
-                        jint(seq), jboolean(handled));
-                if (env->ExceptionCheck()) {
-                    ALOGE("Exception dispatching finished signal.");
-                    skipCallbacks = true;
-                }
+            env->CallVoidMethod(senderObj.get(),
+                    gInputEventSenderClassInfo.dispatchInputEventFinished,
+                    jint(seq), jboolean(handled));
+            if (env->ExceptionCheck()) {
+                ALOGE("Exception dispatching finished signal.");
+                skipCallbacks = true;
             }
         }
     }
diff --git a/core/jni/android_view_Surface.cpp b/core/jni/android_view_Surface.cpp
index 464f249..a900294 100644
--- a/core/jni/android_view_Surface.cpp
+++ b/core/jni/android_view_Surface.cpp
@@ -58,8 +58,6 @@
 
 namespace android {
 
-using ui::Dataspace;
-
 static const char* const OutOfResourcesException =
     "android/view/Surface$OutOfResourcesException";
 
@@ -129,135 +127,17 @@
 }
 
 int android_view_Surface_mapPublicFormatToHalFormat(PublicFormat f) {
-
-    switch(f) {
-        case PublicFormat::JPEG:
-        case PublicFormat::DEPTH_POINT_CLOUD:
-        case PublicFormat::DEPTH_JPEG:
-        case PublicFormat::HEIC:
-            return HAL_PIXEL_FORMAT_BLOB;
-        case PublicFormat::DEPTH16:
-            return HAL_PIXEL_FORMAT_Y16;
-        case PublicFormat::RAW_SENSOR:
-        case PublicFormat::RAW_DEPTH:
-            return HAL_PIXEL_FORMAT_RAW16;
-        default:
-            // Most formats map 1:1
-            return static_cast<int>(f);
-    }
+    return mapPublicFormatToHalFormat(f);
 }
 
 android_dataspace android_view_Surface_mapPublicFormatToHalDataspace(
         PublicFormat f) {
-    Dataspace dataspace;
-    switch(f) {
-        case PublicFormat::JPEG:
-            dataspace = Dataspace::V0_JFIF;
-            break;
-        case PublicFormat::DEPTH_POINT_CLOUD:
-        case PublicFormat::DEPTH16:
-        case PublicFormat::RAW_DEPTH:
-            dataspace = Dataspace::DEPTH;
-            break;
-        case PublicFormat::RAW_SENSOR:
-        case PublicFormat::RAW_PRIVATE:
-        case PublicFormat::RAW10:
-        case PublicFormat::RAW12:
-            dataspace = Dataspace::ARBITRARY;
-            break;
-        case PublicFormat::YUV_420_888:
-        case PublicFormat::NV21:
-        case PublicFormat::YV12:
-            dataspace = Dataspace::V0_JFIF;
-            break;
-        case PublicFormat::DEPTH_JPEG:
-            dataspace = Dataspace::DYNAMIC_DEPTH;
-            break;
-        case PublicFormat::HEIC:
-            dataspace = Dataspace::HEIF;
-            break;
-        default:
-            // Most formats map to UNKNOWN
-            dataspace = Dataspace::UNKNOWN;
-            break;
-    }
-    return static_cast<android_dataspace>(dataspace);
+    return mapPublicFormatToHalDataspace(f);
 }
 
 PublicFormat android_view_Surface_mapHalFormatDataspaceToPublicFormat(
         int format, android_dataspace dataSpace) {
-    Dataspace ds = static_cast<Dataspace>(dataSpace);
-    switch(format) {
-        case HAL_PIXEL_FORMAT_RGBA_8888:
-        case HAL_PIXEL_FORMAT_RGBX_8888:
-        case HAL_PIXEL_FORMAT_RGBA_FP16:
-        case HAL_PIXEL_FORMAT_RGBA_1010102:
-        case HAL_PIXEL_FORMAT_RGB_888:
-        case HAL_PIXEL_FORMAT_RGB_565:
-        case HAL_PIXEL_FORMAT_Y8:
-        case HAL_PIXEL_FORMAT_RAW10:
-        case HAL_PIXEL_FORMAT_RAW12:
-        case HAL_PIXEL_FORMAT_YCbCr_420_888:
-        case HAL_PIXEL_FORMAT_YV12:
-            // Enums overlap in both name and value
-            return static_cast<PublicFormat>(format);
-        case HAL_PIXEL_FORMAT_RAW16:
-            switch (ds) {
-                case Dataspace::DEPTH:
-                  return PublicFormat::RAW_DEPTH;
-                default:
-                  return PublicFormat::RAW_SENSOR;
-            }
-        case HAL_PIXEL_FORMAT_RAW_OPAQUE:
-            // Name differs, though value is the same
-            return PublicFormat::RAW_PRIVATE;
-        case HAL_PIXEL_FORMAT_YCbCr_422_SP:
-            // Name differs, though the value is the same
-            return PublicFormat::NV16;
-        case HAL_PIXEL_FORMAT_YCrCb_420_SP:
-            // Name differs, though the value is the same
-            return PublicFormat::NV21;
-        case HAL_PIXEL_FORMAT_YCbCr_422_I:
-            // Name differs, though the value is the same
-            return PublicFormat::YUY2;
-        case HAL_PIXEL_FORMAT_IMPLEMENTATION_DEFINED:
-            // Name differs, though the value is the same
-            return PublicFormat::PRIVATE;
-        case HAL_PIXEL_FORMAT_Y16:
-            // Dataspace-dependent
-            switch (ds) {
-                case Dataspace::DEPTH:
-                    return PublicFormat::DEPTH16;
-                default:
-                    // Assume non-depth Y16 is just Y16.
-                    return PublicFormat::Y16;
-            }
-            break;
-        case HAL_PIXEL_FORMAT_BLOB:
-            // Dataspace-dependent
-            switch (ds) {
-                case Dataspace::DEPTH:
-                    return PublicFormat::DEPTH_POINT_CLOUD;
-                case Dataspace::V0_JFIF:
-                    return PublicFormat::JPEG;
-                case Dataspace::HEIF:
-                    return PublicFormat::HEIC;
-                default:
-                    if (dataSpace == static_cast<android_dataspace>(HAL_DATASPACE_DYNAMIC_DEPTH)) {
-                        return PublicFormat::DEPTH_JPEG;
-                    } else {
-                        // Assume otherwise-marked blobs are also JPEG
-                        return PublicFormat::JPEG;
-                    }
-            }
-            break;
-        case HAL_PIXEL_FORMAT_BGRA_8888:
-            // Not defined in public API
-            return PublicFormat::UNKNOWN;
-
-        default:
-            return PublicFormat::UNKNOWN;
-    }
+    return mapHalFormatDataspaceToPublicFormat(format, dataSpace);
 }
 // ----------------------------------------------------------------------------
 
diff --git a/core/jni/android_view_SurfaceControl.cpp b/core/jni/android_view_SurfaceControl.cpp
index 4c25fd4..89d908b 100644
--- a/core/jni/android_view_SurfaceControl.cpp
+++ b/core/jni/android_view_SurfaceControl.cpp
@@ -463,6 +463,13 @@
     transaction->setColorTransform(surfaceControl, matrix, translation);
 }
 
+static void nativeSetColorSpaceAgnostic(JNIEnv* env, jclass clazz, jlong transactionObj,
+        jlong nativeObject, jboolean agnostic) {
+    auto transaction = reinterpret_cast<SurfaceComposerClient::Transaction*>(transactionObj);
+    SurfaceControl* const surfaceControl = reinterpret_cast<SurfaceControl*>(nativeObject);
+    transaction->setColorSpaceAgnostic(surfaceControl, agnostic);
+}
+
 static void nativeSetWindowCrop(JNIEnv* env, jclass clazz, jlong transactionObj,
         jlong nativeObject,
         jint l, jint t, jint r, jint b) {
@@ -717,6 +724,29 @@
     return result == NO_ERROR ? JNI_TRUE : JNI_FALSE;
 }
 
+static jintArray nativeGetAllowedDisplayConfigs(JNIEnv* env, jclass clazz, jobject tokenObj) {
+    sp<IBinder> token(ibinderForJavaObject(env, tokenObj));
+    if (token == nullptr) return JNI_FALSE;
+
+    std::vector<int32_t> allowedConfigs;
+    size_t result = SurfaceComposerClient::getAllowedDisplayConfigs(token, &allowedConfigs);
+    if (result != NO_ERROR) {
+        return nullptr;
+    }
+
+    jintArray allowedConfigsArray = env->NewIntArray(allowedConfigs.size());
+    if (allowedConfigsArray == nullptr) {
+        jniThrowException(env, "java/lang/OutOfMemoryError", NULL);
+        return nullptr;
+    }
+    jint* allowedConfigsArrayValues = env->GetIntArrayElements(allowedConfigsArray, 0);
+    for (size_t i = 0; i < allowedConfigs.size(); i++) {
+        allowedConfigsArrayValues[i] = static_cast<jint>(allowedConfigs[i]);
+    }
+    env->ReleaseIntArrayElements(allowedConfigsArray, allowedConfigsArrayValues, 0);
+    return allowedConfigsArray;
+}
+
 static jint nativeGetActiveConfig(JNIEnv* env, jclass clazz, jobject tokenObj) {
     sp<IBinder> token(ibinderForJavaObject(env, tokenObj));
     if (token == NULL) return -1;
@@ -1183,6 +1213,8 @@
             (void*)nativeSetMatrix },
     {"nativeSetColorTransform", "(JJ[F[F)V",
             (void*)nativeSetColorTransform },
+    {"nativeSetColorSpaceAgnostic", "(JJZ)V",
+            (void*)nativeSetColorSpaceAgnostic },
     {"nativeSetFlags", "(JJII)V",
             (void*)nativeSetFlags },
     {"nativeSetWindowCrop", "(JJIIII)V",
@@ -1215,6 +1247,8 @@
             (void*)nativeSetActiveConfig },
     {"nativeSetAllowedDisplayConfigs", "(Landroid/os/IBinder;[I)Z",
             (void*)nativeSetAllowedDisplayConfigs },
+    {"nativeGetAllowedDisplayConfigs", "(Landroid/os/IBinder;)[I",
+            (void*)nativeGetAllowedDisplayConfigs },
     {"nativeGetDisplayColorModes", "(Landroid/os/IBinder;)[I",
             (void*)nativeGetDisplayColorModes},
     {"nativeGetDisplayNativePrimaries", "(Landroid/os/IBinder;)Landroid/view/SurfaceControl$DisplayPrimaries;",
diff --git a/core/jni/com_android_internal_content_NativeLibraryHelper.cpp b/core/jni/com_android_internal_content_NativeLibraryHelper.cpp
index dc536b2..be82879 100644
--- a/core/jni/com_android_internal_content_NativeLibraryHelper.cpp
+++ b/core/jni/com_android_internal_content_NativeLibraryHelper.cpp
@@ -187,20 +187,20 @@
     off64_t offset;
 
     if (!zipFile->getEntryInfo(zipEntry, &method, &uncompLen, NULL, &offset, &when, &crc)) {
-        ALOGD("Couldn't read zip entry info\n");
+        ALOGE("Couldn't read zip entry info\n");
         return INSTALL_FAILED_INVALID_APK;
     }
 
     if (!extractNativeLibs) {
         // check if library is uncompressed and page-aligned
         if (method != ZipFileRO::kCompressStored) {
-            ALOGD("Library '%s' is compressed - will not be able to open it directly from apk.\n",
+            ALOGE("Library '%s' is compressed - will not be able to open it directly from apk.\n",
                 fileName);
             return INSTALL_FAILED_INVALID_APK;
         }
 
         if (offset % PAGE_SIZE != 0) {
-            ALOGD("Library '%s' is not page-aligned - will not be able to open it directly from"
+            ALOGE("Library '%s' is not page-aligned - will not be able to open it directly from"
                 " apk.\n", fileName);
             return INSTALL_FAILED_INVALID_APK;
         }
@@ -213,7 +213,7 @@
     char localFileName[nativeLibPath.size() + fileNameLen + 2];
 
     if (strlcpy(localFileName, nativeLibPath.c_str(), sizeof(localFileName)) != nativeLibPath.size()) {
-        ALOGD("Couldn't allocate local file name for library");
+        ALOGE("Couldn't allocate local file name for library");
         return INSTALL_FAILED_INTERNAL_ERROR;
     }
 
@@ -221,7 +221,7 @@
 
     if (strlcpy(localFileName + nativeLibPath.size() + 1, fileName, sizeof(localFileName)
                     - nativeLibPath.size() - 1) != fileNameLen) {
-        ALOGD("Couldn't allocate local file name for library");
+        ALOGE("Couldn't allocate local file name for library");
         return INSTALL_FAILED_INTERNAL_ERROR;
     }
 
@@ -237,24 +237,24 @@
     char localTmpFileName[nativeLibPath.size() + TMP_FILE_PATTERN_LEN + 1];
     if (strlcpy(localTmpFileName, nativeLibPath.c_str(), sizeof(localTmpFileName))
             != nativeLibPath.size()) {
-        ALOGD("Couldn't allocate local file name for library");
+        ALOGE("Couldn't allocate local file name for library");
         return INSTALL_FAILED_INTERNAL_ERROR;
     }
 
     if (strlcpy(localTmpFileName + nativeLibPath.size(), TMP_FILE_PATTERN,
                     TMP_FILE_PATTERN_LEN + 1) != TMP_FILE_PATTERN_LEN) {
-        ALOGI("Couldn't allocate temporary file name for library");
+        ALOGE("Couldn't allocate temporary file name for library");
         return INSTALL_FAILED_INTERNAL_ERROR;
     }
 
     int fd = mkstemp(localTmpFileName);
     if (fd < 0) {
-        ALOGI("Couldn't open temporary file name: %s: %s\n", localTmpFileName, strerror(errno));
+        ALOGE("Couldn't open temporary file name: %s: %s\n", localTmpFileName, strerror(errno));
         return INSTALL_FAILED_CONTAINER_ERROR;
     }
 
     if (!zipFile->uncompressEntry(zipEntry, fd)) {
-        ALOGI("Failed uncompressing %s to %s\n", fileName, localTmpFileName);
+        ALOGE("Failed uncompressing %s to %s\n", fileName, localTmpFileName);
         close(fd);
         unlink(localTmpFileName);
         return INSTALL_FAILED_CONTAINER_ERROR;
@@ -268,7 +268,7 @@
     times[1].tv_sec = modTime;
     times[0].tv_usec = times[1].tv_usec = 0;
     if (utimes(localTmpFileName, times) < 0) {
-        ALOGI("Couldn't change modification time on %s: %s\n", localTmpFileName, strerror(errno));
+        ALOGE("Couldn't change modification time on %s: %s\n", localTmpFileName, strerror(errno));
         unlink(localTmpFileName);
         return INSTALL_FAILED_CONTAINER_ERROR;
     }
@@ -276,14 +276,14 @@
     // Set the mode to 755
     static const mode_t mode = S_IRUSR | S_IWUSR | S_IXUSR | S_IRGRP |  S_IXGRP | S_IROTH | S_IXOTH;
     if (chmod(localTmpFileName, mode) < 0) {
-        ALOGI("Couldn't change permissions on %s: %s\n", localTmpFileName, strerror(errno));
+        ALOGE("Couldn't change permissions on %s: %s\n", localTmpFileName, strerror(errno));
         unlink(localTmpFileName);
         return INSTALL_FAILED_CONTAINER_ERROR;
     }
 
     // Finally, rename it to the final name.
     if (rename(localTmpFileName, localFileName) < 0) {
-        ALOGI("Couldn't rename %s to %s: %s\n", localTmpFileName, localFileName, strerror(errno));
+        ALOGE("Couldn't rename %s to %s: %s\n", localTmpFileName, localFileName, strerror(errno));
         unlink(localTmpFileName);
         return INSTALL_FAILED_CONTAINER_ERROR;
     }
diff --git a/core/jni/com_android_internal_os_ClassLoaderFactory.cpp b/core/jni/com_android_internal_os_ClassLoaderFactory.cpp
index 9ce3289..f8d41e4 100644
--- a/core/jni/com_android_internal_os_ClassLoaderFactory.cpp
+++ b/core/jni/com_android_internal_os_ClassLoaderFactory.cpp
@@ -28,16 +28,16 @@
                                               jstring librarySearchPath,
                                               jstring libraryPermittedPath,
                                               jboolean isShared,
-                                              jboolean isForVendor) {
+                                              jstring dexPath) {
     return android::CreateClassLoaderNamespace(env, targetSdkVersion,
                                                classLoader, isShared == JNI_TRUE,
-                                               isForVendor == JNI_TRUE,
+                                               dexPath,
                                                librarySearchPath, libraryPermittedPath);
 }
 
 static const JNINativeMethod g_methods[] = {
     { "createClassloaderNamespace",
-      "(Ljava/lang/ClassLoader;ILjava/lang/String;Ljava/lang/String;ZZ)Ljava/lang/String;",
+      "(Ljava/lang/ClassLoader;ILjava/lang/String;Ljava/lang/String;ZLjava/lang/String;)Ljava/lang/String;",
       reinterpret_cast<void*>(createClassloaderNamespace_native) },
 };
 
diff --git a/core/jni/com_android_internal_os_Zygote.cpp b/core/jni/com_android_internal_os_Zygote.cpp
index 2ccb01a..c6f62ca 100644
--- a/core/jni/com_android_internal_os_Zygote.cpp
+++ b/core/jni/com_android_internal_os_Zygote.cpp
@@ -138,32 +138,32 @@
 static int gZygoteSocketFD = -1;
 
 /**
- * The file descriptor for the Blastula pool socket opened by init.
+ * The file descriptor for the unspecialized app process (USAP) pool socket opened by init.
  */
 
-static int gBlastulaPoolSocketFD = -1;
+static int gUsapPoolSocketFD = -1;
 
 /**
- * The number of Blastulas currently in this Zygote's pool.
+ * The number of USAPs currently in this Zygote's pool.
  */
-static std::atomic_uint32_t gBlastulaPoolCount = 0;
+static std::atomic_uint32_t gUsapPoolCount = 0;
 
 /**
- * Event file descriptor used to communicate reaped blastulas to the
+ * Event file descriptor used to communicate reaped USAPs to the
  * ZygoteServer.
  */
-static int gBlastulaPoolEventFD = -1;
+static int gUsapPoolEventFD = -1;
 
 /**
- * The maximum value that the gBlastulaPoolSizeMax variable may take.  This value
- * is a mirror of ZygoteServer.BLASTULA_POOL_SIZE_MAX_LIMIT
+ * The maximum value that the gUSAPPoolSizeMax variable may take.  This value
+ * is a mirror of ZygoteServer.USAP_POOL_SIZE_MAX_LIMIT
  */
-static constexpr int BLASTULA_POOL_SIZE_MAX_LIMIT = 100;
+static constexpr int USAP_POOL_SIZE_MAX_LIMIT = 100;
 
 /**
- * A helper class containing accounting information for Blastulas.
+ * A helper class containing accounting information for USAPs.
  */
-class BlastulaTableEntry {
+class UsapTableEntry {
  public:
   struct EntryStorage {
     int32_t pid;
@@ -181,7 +181,7 @@
   static_assert(decltype(mStorage)::is_always_lock_free);
 
  public:
-  constexpr BlastulaTableEntry() : mStorage(INVALID_ENTRY_VALUE) {}
+  constexpr UsapTableEntry() : mStorage(INVALID_ENTRY_VALUE) {}
 
   /**
    * If the provided PID matches the one stored in this entry, the entry will
@@ -246,7 +246,7 @@
    * Sets the entry to the given values if it is currently invalid.
    *
    * @param pid  The process ID for the new entry.
-   * @param read_pipe_fd  The read end of the blastula control pipe for this
+   * @param read_pipe_fd  The read end of the USAP control pipe for this
    * process.
    * @return True if the entry was set; false otherwise.
    */
@@ -263,14 +263,14 @@
 };
 
 /**
- * A table containing information about the Blastulas currently in the pool.
+ * A table containing information about the USAPs currently in the pool.
  *
  * Multiple threads may be attempting to modify the table, either from the
  * signal handler or from the ZygoteServer poll loop.  Atomic loads/stores in
- * the BlastulaTableEntry class prevent data races during these concurrent
+ * the USAPTableEntry class prevent data races during these concurrent
  * operations.
  */
-static std::array<BlastulaTableEntry, BLASTULA_POOL_SIZE_MAX_LIMIT> gBlastulaTable;
+static std::array<UsapTableEntry, USAP_POOL_SIZE_MAX_LIMIT> gUsapTable;
 
 /**
  * The list of open zygote file descriptors.
@@ -295,7 +295,7 @@
 };
 
 // Forward declaration so we don't have to move the signal handler.
-static bool RemoveBlastulaTableEntry(pid_t blastula_pid);
+static bool RemoveUsapTableEntry(pid_t usap_pid);
 
 static void RuntimeAbort(JNIEnv* env, int line, const char* msg) {
   std::ostringstream oss;
@@ -307,7 +307,7 @@
 static void SigChldHandler(int /*signal_number*/) {
   pid_t pid;
   int status;
-  int64_t blastulas_removed = 0;
+  int64_t usaps_removed = 0;
 
   // It's necessary to save and restore the errno during this function.
   // Since errno is stored per thread, changing it here modifies the errno
@@ -338,9 +338,9 @@
       kill(getpid(), SIGKILL);
     }
 
-    // Check to see if the PID is in the blastula pool and remove it if it is.
-    if (RemoveBlastulaTableEntry(pid)) {
-      ++blastulas_removed;
+    // Check to see if the PID is in the USAP pool and remove it if it is.
+    if (RemoveUsapTableEntry(pid)) {
+      ++usaps_removed;
     }
   }
 
@@ -351,12 +351,12 @@
                           "Zygote SIGCHLD error in waitpid: %s", strerror(errno));
   }
 
-  if (blastulas_removed > 0) {
-    if (write(gBlastulaPoolEventFD, &blastulas_removed, sizeof(blastulas_removed)) == -1) {
+  if (usaps_removed > 0) {
+    if (write(gUsapPoolEventFD, &usaps_removed, sizeof(usaps_removed)) == -1) {
       // If this write fails something went terribly wrong.  We will now kill
       // the zygote and let the system bring it back up.
       async_safe_format_log(ANDROID_LOG_ERROR, LOG_TAG,
-                            "Zygote failed to write to blastula pool event FD: %s",
+                            "Zygote failed to write to USAP pool event FD: %s",
                             strerror(errno));
       kill(getpid(), SIGKILL);
     }
@@ -1181,12 +1181,12 @@
   }
 }
 
-static void ClearBlastulaTable() {
-  for (BlastulaTableEntry& entry : gBlastulaTable) {
+static void ClearUsapTable() {
+  for (UsapTableEntry& entry : gUsapTable) {
     entry.Clear();
   }
 
-  gBlastulaPoolCount = 0;
+  gUsapPoolCount = 0;
 }
 
 // Utility routine to fork a process from the zygote.
@@ -1231,8 +1231,8 @@
     // Clean up any descriptors which must be closed immediately
     DetachDescriptors(env, fds_to_close, fail_fn);
 
-    // Invalidate the entries in the blastula table.
-    ClearBlastulaTable();
+    // Invalidate the entries in the USAP table.
+    ClearUsapTable();
 
     // Re-open all remaining open file descriptors so that they aren't shared
     // with the zygote across a fork.
@@ -1525,47 +1525,47 @@
 }
 
 /**
- * Adds the given information about a newly created blastula to the Zygote's
- * blastula table.
+ * Adds the given information about a newly created unspecialized app
+ * processes to the Zygote's USAP table.
  *
- * @param blastula_pid  Process ID of the newly created blastula
- * @param read_pipe_fd  File descriptor for the read end of the blastula
- * reporting pipe.  Used in the ZygoteServer poll loop to track blastula
+ * @param usap_pid  Process ID of the newly created USAP
+ * @param read_pipe_fd  File descriptor for the read end of the USAP
+ * reporting pipe.  Used in the ZygoteServer poll loop to track USAP
  * specialization.
  */
-static void AddBlastulaTableEntry(pid_t blastula_pid, int read_pipe_fd) {
-  static int sBlastulaTableInsertIndex = 0;
+static void AddUsapTableEntry(pid_t usap_pid, int read_pipe_fd) {
+  static int sUsapTableInsertIndex = 0;
 
-  int search_index = sBlastulaTableInsertIndex;
+  int search_index = sUsapTableInsertIndex;
 
   do {
-    if (gBlastulaTable[search_index].SetIfInvalid(blastula_pid, read_pipe_fd)) {
+    if (gUsapTable[search_index].SetIfInvalid(usap_pid, read_pipe_fd)) {
       // Start our next search right after where we finished this one.
-      sBlastulaTableInsertIndex = (search_index + 1) % gBlastulaTable.size();
+      sUsapTableInsertIndex = (search_index + 1) % gUsapTable.size();
 
       return;
     }
 
-    search_index = (search_index + 1) % gBlastulaTable.size();
-  } while (search_index != sBlastulaTableInsertIndex);
+    search_index = (search_index + 1) % gUsapTable.size();
+  } while (search_index != sUsapTableInsertIndex);
 
   // Much like money in the banana stand, there should always be an entry
-  // in the blastula table.
+  // in the USAP table.
   __builtin_unreachable();
 }
 
 /**
- * Invalidates the entry in the BlastulaTable corresponding to the provided
- * process ID if it is present.  If an entry was removed the blastula pool
+ * Invalidates the entry in the USAPTable corresponding to the provided
+ * process ID if it is present.  If an entry was removed the USAP pool
  * count is decremented.
  *
- * @param blastula_pid  Process ID of the blastula entry to invalidate
+ * @param usap_pid  Process ID of the USAP entry to invalidate
  * @return True if an entry was invalidated; false otherwise
  */
-static bool RemoveBlastulaTableEntry(pid_t blastula_pid) {
-  for (BlastulaTableEntry& entry : gBlastulaTable) {
-    if (entry.ClearForPID(blastula_pid)) {
-      --gBlastulaPoolCount;
+static bool RemoveUsapTableEntry(pid_t usap_pid) {
+  for (UsapTableEntry& entry : gUsapTable) {
+    if (entry.ClearForPID(usap_pid)) {
+      --gUsapPoolCount;
       return true;
     }
   }
@@ -1574,13 +1574,13 @@
 }
 
 /**
- * @return A vector of the read pipe FDs for each of the active blastulas.
+ * @return A vector of the read pipe FDs for each of the active USAPs.
  */
-std::vector<int> MakeBlastulaPipeReadFDVector() {
+std::vector<int> MakeUsapPipeReadFDVector() {
   std::vector<int> fd_vec;
-  fd_vec.reserve(gBlastulaTable.size());
+  fd_vec.reserve(gUsapTable.size());
 
-  for (BlastulaTableEntry& entry : gBlastulaTable) {
+  for (UsapTableEntry& entry : gUsapTable) {
     auto entry_values = entry.GetValues();
 
     if (entry_values.has_value()) {
@@ -1624,16 +1624,16 @@
         ExtractJIntArray(env, "zygote", nice_name, managed_fds_to_ignore)
             .value_or(std::vector<int>());
 
-    std::vector<int> blastula_pipes = MakeBlastulaPipeReadFDVector();
+    std::vector<int> usap_pipes = MakeUsapPipeReadFDVector();
 
-    fds_to_close.insert(fds_to_close.end(), blastula_pipes.begin(), blastula_pipes.end());
-    fds_to_ignore.insert(fds_to_ignore.end(), blastula_pipes.begin(), blastula_pipes.end());
+    fds_to_close.insert(fds_to_close.end(), usap_pipes.begin(), usap_pipes.end());
+    fds_to_ignore.insert(fds_to_ignore.end(), usap_pipes.begin(), usap_pipes.end());
 
-    fds_to_close.push_back(gBlastulaPoolSocketFD);
+    fds_to_close.push_back(gUsapPoolSocketFD);
 
-    if (gBlastulaPoolEventFD != -1) {
-      fds_to_close.push_back(gBlastulaPoolEventFD);
-      fds_to_ignore.push_back(gBlastulaPoolEventFD);
+    if (gUsapPoolEventFD != -1) {
+      fds_to_close.push_back(gUsapPoolEventFD);
+      fds_to_ignore.push_back(gUsapPoolEventFD);
     }
 
     pid_t pid = ForkCommon(env, false, fds_to_close, fds_to_ignore);
@@ -1652,14 +1652,14 @@
         JNIEnv* env, jclass, uid_t uid, gid_t gid, jintArray gids,
         jint runtime_flags, jobjectArray rlimits, jlong permitted_capabilities,
         jlong effective_capabilities) {
-  std::vector<int> fds_to_close(MakeBlastulaPipeReadFDVector()),
+  std::vector<int> fds_to_close(MakeUsapPipeReadFDVector()),
                    fds_to_ignore(fds_to_close);
 
-  fds_to_close.push_back(gBlastulaPoolSocketFD);
+  fds_to_close.push_back(gUsapPoolSocketFD);
 
-  if (gBlastulaPoolEventFD != -1) {
-    fds_to_close.push_back(gBlastulaPoolEventFD);
-    fds_to_ignore.push_back(gBlastulaPoolEventFD);
+  if (gUsapPoolEventFD != -1) {
+    fds_to_close.push_back(gUsapPoolEventFD);
+    fds_to_ignore.push_back(gUsapPoolEventFD);
   }
 
   pid_t pid = ForkCommon(env, true,
@@ -1696,49 +1696,52 @@
 }
 
 /**
- * A JNI function that forks a blastula from the Zygote while ensuring proper
- * file descriptor hygiene.
+ * A JNI function that forks an unspecialized app process from the Zygote while
+ * ensuring proper file descriptor hygiene.
  *
  * @param env  Managed runtime environment
- * @param read_pipe_fd  The read FD for the blastula reporting pipe.  Manually closed by blastlas
+ * @param read_pipe_fd  The read FD for the USAP reporting pipe.  Manually closed by blastlas
  * in managed code.
- * @param write_pipe_fd  The write FD for the blastula reporting pipe.  Manually closed by the
+ * @param write_pipe_fd  The write FD for the USAP reporting pipe.  Manually closed by the
  * zygote in managed code.
  * @param managed_session_socket_fds  A list of anonymous session sockets that must be ignored by
- * the FD hygiene code and automatically "closed" in the new blastula.
+ * the FD hygiene code and automatically "closed" in the new USAP.
  * @return
  */
-static jint com_android_internal_os_Zygote_nativeForkBlastula(JNIEnv* env, jclass,
-    jint read_pipe_fd, jint write_pipe_fd, jintArray managed_session_socket_fds) {
-  std::vector<int> fds_to_close(MakeBlastulaPipeReadFDVector()),
+static jint com_android_internal_os_Zygote_nativeForkUsap(JNIEnv* env,
+                                                          jclass,
+                                                          jint read_pipe_fd,
+                                                          jint write_pipe_fd,
+                                                          jintArray managed_session_socket_fds) {
+  std::vector<int> fds_to_close(MakeUsapPipeReadFDVector()),
                    fds_to_ignore(fds_to_close);
 
   std::vector<int> session_socket_fds =
-      ExtractJIntArray(env, "blastula", nullptr, managed_session_socket_fds)
+      ExtractJIntArray(env, "USAP", nullptr, managed_session_socket_fds)
           .value_or(std::vector<int>());
 
-  // The Blastula Pool Event FD is created during the initialization of the
-  // blastula pool and should always be valid here.
+  // The USAP Pool Event FD is created during the initialization of the
+  // USAP pool and should always be valid here.
 
   fds_to_close.push_back(gZygoteSocketFD);
-  fds_to_close.push_back(gBlastulaPoolEventFD);
+  fds_to_close.push_back(gUsapPoolEventFD);
   fds_to_close.insert(fds_to_close.end(), session_socket_fds.begin(), session_socket_fds.end());
 
   fds_to_ignore.push_back(gZygoteSocketFD);
-  fds_to_ignore.push_back(gBlastulaPoolSocketFD);
-  fds_to_ignore.push_back(gBlastulaPoolEventFD);
+  fds_to_ignore.push_back(gUsapPoolSocketFD);
+  fds_to_ignore.push_back(gUsapPoolEventFD);
   fds_to_ignore.push_back(read_pipe_fd);
   fds_to_ignore.push_back(write_pipe_fd);
   fds_to_ignore.insert(fds_to_ignore.end(), session_socket_fds.begin(), session_socket_fds.end());
 
-  pid_t blastula_pid = ForkCommon(env, /* is_system_server= */ false, fds_to_close, fds_to_ignore);
+  pid_t usap_pid = ForkCommon(env, /* is_system_server= */ false, fds_to_close, fds_to_ignore);
 
-  if (blastula_pid != 0) {
-    ++gBlastulaPoolCount;
-    AddBlastulaTableEntry(blastula_pid, read_pipe_fd);
+  if (usap_pid != 0) {
+    ++gUsapPoolCount;
+    AddUsapTableEntry(usap_pid, read_pipe_fd);
   }
 
-  return blastula_pid;
+  return usap_pid;
 }
 
 static void com_android_internal_os_Zygote_nativeAllowFileAcrossFork(
@@ -1803,7 +1806,8 @@
 }
 
 /**
- * Called from a blastula to specialize the process for a specific application.
+ * Called from an unspecialized app process to specialize the process for a
+ * given application.
  *
  * @param env  Managed runtime environment
  * @param uid  User ID of the new application
@@ -1818,7 +1822,7 @@
  * @param instruction_set  The instruction set expected/requested by the new application
  * @param app_data_dir  Path to the application's data directory
  */
-static void com_android_internal_os_Zygote_nativeSpecializeBlastula(
+static void com_android_internal_os_Zygote_nativeSpecializeAppProcess(
     JNIEnv* env, jclass, jint uid, jint gid, jintArray gids,
     jint runtime_flags, jobjectArray rlimits,
     jint mount_external, jstring se_info, jstring nice_name,
@@ -1855,77 +1859,77 @@
     ALOGE("Unable to fetch Zygote socket file descriptor");
   }
 
-  env_var_name = android_socket_prefix + (is_primary ? "blastula_pool" : "blastula_pool_secondary");
+  env_var_name = android_socket_prefix + (is_primary ? "usap_pool_primary" : "usap_pool_secondary");
   env_var_val = getenv(env_var_name.c_str());
 
   if (env_var_val != nullptr) {
-    gBlastulaPoolSocketFD = atoi(env_var_val);
-    ALOGV("Zygote:blastulaPoolSocketFD = %d", gBlastulaPoolSocketFD);
+    gUsapPoolSocketFD = atoi(env_var_val);
+    ALOGV("Zygote:usapPoolSocketFD = %d", gUsapPoolSocketFD);
   } else {
-    ALOGE("Unable to fetch Blastula pool socket file descriptor");
+    ALOGE("Unable to fetch USAP pool socket file descriptor");
   }
 }
 
 /**
  * @param env  Managed runtime environment
- * @return  A managed array of raw file descriptors for the read ends of the blastula reporting
+ * @return  A managed array of raw file descriptors for the read ends of the USAP reporting
  * pipes.
  */
-static jintArray com_android_internal_os_Zygote_nativeGetBlastulaPipeFDs(JNIEnv* env, jclass) {
-  std::vector<int> blastula_fds = MakeBlastulaPipeReadFDVector();
+static jintArray com_android_internal_os_Zygote_nativeGetUsapPipeFDs(JNIEnv* env, jclass) {
+  std::vector<int> usap_fds = MakeUsapPipeReadFDVector();
 
-  jintArray managed_blastula_fds = env->NewIntArray(blastula_fds.size());
-  env->SetIntArrayRegion(managed_blastula_fds, 0, blastula_fds.size(), blastula_fds.data());
+  jintArray managed_usap_fds = env->NewIntArray(usap_fds.size());
+  env->SetIntArrayRegion(managed_usap_fds, 0, usap_fds.size(), usap_fds.data());
 
-  return managed_blastula_fds;
+  return managed_usap_fds;
 }
 
 /**
- * A JNI wrapper around RemoveBlastulaTableEntry.
+ * A JNI wrapper around RemoveUsapTableEntry.
  *
  * @param env  Managed runtime environment
- * @param blastula_pid  Process ID of the blastula entry to invalidate
+ * @param usap_pid  Process ID of the USAP entry to invalidate
  * @return  True if an entry was invalidated; false otherwise.
  */
-static jboolean com_android_internal_os_Zygote_nativeRemoveBlastulaTableEntry(JNIEnv* env, jclass,
-                                                                              jint blastula_pid) {
-  return RemoveBlastulaTableEntry(blastula_pid);
+static jboolean com_android_internal_os_Zygote_nativeRemoveUsapTableEntry(JNIEnv* env, jclass,
+                                                                          jint usap_pid) {
+  return RemoveUsapTableEntry(usap_pid);
 }
 
 /**
- * Creates the blastula pool event FD if it doesn't exist and returns it.  This is used by the
- * ZygoteServer poll loop to know when to re-fill the blastula pool.
+ * Creates the USAP pool event FD if it doesn't exist and returns it.  This is used by the
+ * ZygoteServer poll loop to know when to re-fill the USAP pool.
  *
  * @param env  Managed runtime environment
  * @return A raw event file descriptor used to communicate (from the signal handler) when the
- * Zygote receives a SIGCHLD for a blastula
+ * Zygote receives a SIGCHLD for a USAP
  */
-static jint com_android_internal_os_Zygote_nativeGetBlastulaPoolEventFD(JNIEnv* env, jclass) {
-  if (gBlastulaPoolEventFD == -1) {
-    if ((gBlastulaPoolEventFD = eventfd(0, 0)) == -1) {
+static jint com_android_internal_os_Zygote_nativeGetUsapPoolEventFD(JNIEnv* env, jclass) {
+  if (gUsapPoolEventFD == -1) {
+    if ((gUsapPoolEventFD = eventfd(0, 0)) == -1) {
       ZygoteFailure(env, "zygote", nullptr, StringPrintf("Unable to create eventfd: %s", strerror(errno)));
     }
   }
 
-  return gBlastulaPoolEventFD;
+  return gUsapPoolEventFD;
 }
 
 /**
  * @param env  Managed runtime environment
- * @return The number of blastulas currently in the blastula pool
+ * @return The number of USAPs currently in the USAP pool
  */
-static jint com_android_internal_os_Zygote_nativeGetBlastulaPoolCount(JNIEnv* env, jclass) {
-  return gBlastulaPoolCount;
+static jint com_android_internal_os_Zygote_nativeGetUsapPoolCount(JNIEnv* env, jclass) {
+  return gUsapPoolCount;
 }
 
 /**
- * Kills all processes currently in the blastula pool.
+ * Kills all processes currently in the USAP pool and closes their read pipe
+ * FDs.
  *
  * @param env  Managed runtime environment
- * @return The number of blastulas currently in the blastula pool
  */
-static void com_android_internal_os_Zygote_nativeEmptyBlastulaPool(JNIEnv* env, jclass) {
-  for (auto& entry : gBlastulaTable) {
+static void com_android_internal_os_Zygote_nativeEmptyUsapPool(JNIEnv* env, jclass) {
+  for (auto& entry : gUsapTable) {
     auto entry_storage = entry.GetValues();
 
     if (entry_storage.has_value()) {
@@ -1934,7 +1938,7 @@
 
       // Avoid a second atomic load by invalidating instead of clearing.
       entry.Invalidate();
-      --gBlastulaPoolCount;
+      --gUsapPoolCount;
     }
   }
 }
@@ -1955,23 +1959,23 @@
       (void *) com_android_internal_os_Zygote_nativePreApplicationInit },
     { "nativeInstallSeccompUidGidFilter", "(II)V",
       (void *) com_android_internal_os_Zygote_nativeInstallSeccompUidGidFilter },
-    { "nativeForkBlastula", "(II[I)I",
-      (void *) com_android_internal_os_Zygote_nativeForkBlastula },
-    { "nativeSpecializeBlastula",
+    { "nativeForkUsap", "(II[I)I",
+      (void *) com_android_internal_os_Zygote_nativeForkUsap },
+    { "nativeSpecializeAppProcess",
       "(II[II[[IILjava/lang/String;Ljava/lang/String;ZLjava/lang/String;Ljava/lang/String;Ljava/lang/String;[Ljava/lang/String;Ljava/lang/String;)V",
-      (void *) com_android_internal_os_Zygote_nativeSpecializeBlastula },
+      (void *) com_android_internal_os_Zygote_nativeSpecializeAppProcess },
     { "nativeGetSocketFDs", "(Z)V",
       (void *) com_android_internal_os_Zygote_nativeGetSocketFDs },
-    { "nativeGetBlastulaPipeFDs", "()[I",
-      (void *) com_android_internal_os_Zygote_nativeGetBlastulaPipeFDs },
-    { "nativeRemoveBlastulaTableEntry", "(I)Z",
-      (void *) com_android_internal_os_Zygote_nativeRemoveBlastulaTableEntry },
-    { "nativeGetBlastulaPoolEventFD", "()I",
-      (void *) com_android_internal_os_Zygote_nativeGetBlastulaPoolEventFD },
-    { "nativeGetBlastulaPoolCount", "()I",
-      (void *) com_android_internal_os_Zygote_nativeGetBlastulaPoolCount },
-    { "nativeEmptyBlastulaPool", "()V",
-      (void *) com_android_internal_os_Zygote_nativeEmptyBlastulaPool }
+    { "nativeGetUsapPipeFDs", "()[I",
+      (void *) com_android_internal_os_Zygote_nativeGetUsapPipeFDs },
+    { "nativeRemoveUsapTableEntry", "(I)Z",
+      (void *) com_android_internal_os_Zygote_nativeRemoveUsapTableEntry },
+    { "nativeGetUsapPoolEventFD", "()I",
+      (void *) com_android_internal_os_Zygote_nativeGetUsapPoolEventFD },
+    { "nativeGetUsapPoolCount", "()I",
+      (void *) com_android_internal_os_Zygote_nativeGetUsapPoolCount },
+    { "nativeEmptyUsapPool", "()V",
+      (void *) com_android_internal_os_Zygote_nativeEmptyUsapPool }
 };
 
 int register_com_android_internal_os_Zygote(JNIEnv* env) {
diff --git a/core/jni/fd_utils.cpp b/core/jni/fd_utils.cpp
index 4b37f13..d8d4656 100644
--- a/core/jni/fd_utils.cpp
+++ b/core/jni/fd_utils.cpp
@@ -38,8 +38,8 @@
   "/dev/null",
   "/dev/socket/zygote",
   "/dev/socket/zygote_secondary",
-  "/dev/socket/blastula_pool",
-  "/dev/socket/blastula_pool_secondary",
+  "/dev/socket/usap_pool_primary",
+  "/dev/socket/usap_pool_secondary",
   "/dev/socket/webview_zygote",
   "/dev/socket/heapprofd",
   "/sys/kernel/debug/tracing/trace_marker",
@@ -215,7 +215,7 @@
   // S_ISDIR : Not supported. (We could if we wanted to, but it's unused).
   // S_ISLINK : Not supported.
   // S_ISBLK : Not supported.
-  // S_ISFIFO : Not supported. Note that the Zygote and blastulas use pipes to
+  // S_ISFIFO : Not supported. Note that the Zygote and USAPs use pipes to
   // communicate with the child processes across forks but those should have been
   // added to the redirection exemption list.
   if (!S_ISCHR(f_stat.st_mode) && !S_ISREG(f_stat.st_mode)) {
diff --git a/core/jni/include/android_runtime/android_view_Surface.h b/core/jni/include/android_runtime/android_view_Surface.h
index 3f7c00c..04718cd 100644
--- a/core/jni/include/android_runtime/android_view_Surface.h
+++ b/core/jni/include/android_runtime/android_view_Surface.h
@@ -19,6 +19,7 @@
 
 #include <android/native_window.h>
 #include <system/graphics.h>
+#include <ui/PublicFormat.h>
 
 #include "jni.h"
 
@@ -27,41 +28,6 @@
 class Surface;
 class IGraphicBufferProducer;
 
-/**
- * Enum mirroring the public API definitions for image and pixel formats.
- * Some of these are hidden in the public API
- *
- * Keep up to date with android.graphics.ImageFormat and
- * android.graphics.PixelFormat
- */
-enum class PublicFormat {
-    UNKNOWN           = 0x0,
-    RGBA_8888         = 0x1,
-    RGBX_8888         = 0x2,
-    RGB_888           = 0x3,
-    RGB_565           = 0x4,
-    NV16              = 0x10,
-    NV21              = 0x11,
-    YUY2              = 0x14,
-    RGBA_FP16         = 0x16,
-    RAW_SENSOR        = 0x20,
-    PRIVATE           = 0x22,
-    YUV_420_888       = 0x23,
-    RAW_PRIVATE       = 0x24,
-    RAW10             = 0x25,
-    RAW12             = 0x26,
-    RGBA_1010102      = 0x2b,
-    JPEG              = 0x100,
-    DEPTH_POINT_CLOUD = 0x101,
-    RAW_DEPTH         = 0x1002, // @hide
-    YV12              = 0x32315659,
-    Y8                = 0x20203859,
-    Y16               = 0x20363159, // @hide
-    DEPTH16           = 0x44363159,
-    DEPTH_JPEG        = 0x69656963,
-    HEIC              = 0x48454946,
-};
-
 /* Gets the underlying ANativeWindow for a Surface. */
 extern sp<ANativeWindow> android_view_Surface_getNativeWindow(
         JNIEnv* env, jobject surfaceObj);
diff --git a/core/jni/runtime_native_boot-flags-test.sh b/core/jni/runtime_native_boot-flags-test.sh
index 01f37f0..cdfeffc 100755
--- a/core/jni/runtime_native_boot-flags-test.sh
+++ b/core/jni/runtime_native_boot-flags-test.sh
@@ -139,47 +139,73 @@
   adb logcat -d -s "$zygote" | grep -q -e "option\[[0-9]\+\]=$runtime_option"
 }
 
-# check_zygote_gc_runtime_option CONTEXT VALUE
-# --------------------------------------------
-# Check that all zygote processes are passed device configuration flag VALUE as
-# GC runtime option. Use CONTEXT in logging.
-function check_zygote_gc_runtime_option {
+# check_zygote_runtime_option CONTEXT RUNTIME_OPTION
+# --------------------------------------------------
+# Check that all zygote processes are passed RUNTIME_OPTION as runtime option. Use
+# CONTEXT in logging.
+function check_zygote_runtime_option {
   local context=$1
-  local value=$2
+  local runtime_option=$2
 
   say \
-    "[$context] Check that all zygote processes are passed the flag value as a GC runtime option..."
-  local runtime_option="-Xgc:$value"
+    "[$context] Check that all zygote processes are passed \`$runtime_option\` as runtime option..."
   for zygote in $zygotes; do
-    find_zygote_runtime_option "$zygote" "$runtime_option"\
+    find_zygote_runtime_option "$zygote" "$runtime_option" \
       || fail "Found no \`$runtime_option\` among runtime options passed to \`$zygote\`"
   done
 }
 
-# check_no_zygote_gc_runtime_option CONTEXT VALUE
-# -----------------------------------------------
-# Check that no zygote process is passed device configuration flag VALUE as GC
-# runtime option.  Use CONTEXT in logging.
-function check_no_zygote_gc_runtime_option {
+# check_no_zygote_runtime_option CONTEXT RUNTIME_OPTION
+# -----------------------------------------------------
+# Check that no zygote process is passed RUNTIME_OPTION as runtime option.  Use
+# CONTEXT in logging.
+function check_no_zygote_runtime_option {
   local context=$1
-  local value=$2
+  local runtime_option=$2
 
-  say "[$context] Check no zygote process is passed the flag value as a GC runtime option..."
-  local runtime_option="-Xgc:$value"
+  say "[$context] Check that no zygote process is passed \`$runtime_option\` as runtime option..."
   for zygote in $zygotes; do
-    find_zygote_runtime_option "$zygote" "$runtime_option"\
+    find_zygote_runtime_option "$zygote" "$runtime_option" \
       && fail "Found \`$runtime_option\` among runtime options passed to \`$zygote\`"
   done
 }
 
-# test_android_runtime_flag FLAG VALUE GC_RUNTIME_OPTION
-# ------------------------------------------------------
-# Test device configuration FLAG with VALUE. Check that GC_RUNTIME_OPTION is
-# passed as GC Runtime option by the zygote.
+# check_android_runtime_message CONTEXT MESSAGE
+# ---------------------------------------------
+# Return whether AndroidRuntime generated MESSAGE in logcat. Use CONTEXT in
+# logging.
+function check_android_runtime_message {
+  local context=$1
+  local message=$2
+
+  say "[$context] Check that AndroidRuntime generated expected message in logcat..."
+  adb logcat -d -s AndroidRuntime | grep -F -q "$message" \
+    || fail "Found no message \"$message\" generated by AndroidRuntime"
+}
+
+# check_no_android_runtime_message CONTEXT MESSAGE
+# ------------------------------------------------
+# Return whether AndroidRuntime did not generate MESSAGE in logcat. Use CONTEXT
+# in logging.
+function check_no_android_runtime_message {
+  local context=$1
+  local message=$2
+
+  say "[$context] Check that AndroidRuntime did not generate unexpected message in logcat..."
+  adb logcat -d -s AndroidRuntime | grep -F -q -v "$message" \
+    || fail "Found message \"$message\" generated by AndroidRuntime"
+}
+
+# test_android_runtime_flag FLAG VALUE CHECK_EFFECT CHECK_NO_EFFECT
+# -----------------------------------------------------------------
+# Test device configuration FLAG with VALUE. CHECK_EFFECT and CHECK_NO_EFFECT
+# are functions that are passed a context as sole argument and that respectively
+# check the effect or the absence of effect of the flag.
 function test_android_runtime_flag {
   local flag=$1
   local value=$2
-  local gc_runtime_option=$3
+  local check_effect=$3
+  local check_no_effect=$4
 
   # Persistent system property (set after a reboot) associated with the device
   # configuration flag.
@@ -193,26 +219,26 @@
   sleep 3
 
   # Check that both the device configuration flag and the associated system
-  # property are set, but that the zygote hasn't had the flag passed to it as a
-  # GC runtime option (as we haven't rebooted yet).
+  # property are set, but that flag has not produced an effect on the system (as
+  # we haven't rebooted yet).
   local context="Flag set, before reboot"
   check_device_config_flag "$context" "$flag" "$value"
   check_system_property "$context" "$prop" "$value"
-  check_no_zygote_gc_runtime_option "$context" "$gc_runtime_option"
+  $check_no_effect "$context"
 
   # Reboot device for the flag value to take effect.
   reboot_and_wait_for_device
   context="Flag set, after 1st reboot"
   check_device_config_flag "$context" "$flag" "$value"
   check_system_property "$context" "$prop" "$value"
-  check_zygote_gc_runtime_option "$context" "$gc_runtime_option"
+  $check_effect "$context"
 
   # Reboot device a second time and check that the state has persisted.
   reboot_and_wait_for_device
   context="Flag set, after 2nd reboot"
   check_device_config_flag "$context" "$flag" "$value"
   check_system_property "$context" "$prop" "$value"
-  check_zygote_gc_runtime_option "$context" "$gc_runtime_option"
+  $check_effect "$context"
 
   say "Unsetting device configuration flag..."
   adb shell device_config delete "$namespace" "$flag" >/dev/null
@@ -224,9 +250,13 @@
   context="Flag unset, after 3rd reboot"
   check_no_device_config_flag "$context" "$flag"
   check_no_system_property "$context" "$prop"
-  check_no_zygote_gc_runtime_option "$context" "$gc_runtime_option"
+  $check_no_effect "$context"
 }
 
+
+# Pre-test actions.
+# =================
+
 # Enumerate Zygote processes.
 case $(adb shell getprop ro.zygote) in
   (zygote32) zygotes="zygote";;
@@ -235,8 +265,56 @@
 esac
 
 # Test "enable_generational_cc" flag values.
-test_android_runtime_flag enable_generational_cc false nogenerational_cc
-test_android_runtime_flag enable_generational_cc true generational_cc
+# ==========================================
+
+function check_nogenerational_cc {
+  check_zygote_runtime_option "$1" "-Xgc:nogenerational_cc"
+}
+function check_no_nogenerational_cc {
+  check_no_zygote_runtime_option "$1" "-Xgc:nogenerational_cc"
+}
+
+function check_generational_cc {
+  check_zygote_runtime_option "$1" "-Xgc:generational_cc"
+}
+function check_no_generational_cc {
+  check_no_zygote_runtime_option "$1" "-Xgc:generational_cc"
+}
+
+test_android_runtime_flag \
+  enable_generational_cc false check_nogenerational_cc check_no_nogenerational_cc
+test_android_runtime_flag \
+  enable_generational_cc true check_generational_cc check_no_generational_cc
+
+# Test "enable_apex_image" flag values.
+# =====================================
+
+default_boot_image_message="Using default boot image"
+function check_default_boot_image {
+  check_android_runtime_message "$1" "$default_boot_image_message"
+}
+function check_no_default_boot_image {
+  check_no_android_runtime_message "$1" "$default_boot_image_message"
+}
+
+apex_boot_image_option="-Ximage:/system/framework/apex.art"
+apex_boot_image_message="Using Apex boot image: '$apex_boot_image_option'"
+function check_apex_boot_image {
+  check_zygote_runtime_option "$1" "$apex_boot_image_option"
+  check_android_runtime_message "$1" "$apex_boot_image_message"
+}
+function check_no_apex_boot_image {
+  check_no_zygote_runtime_option "$1" "$apex_boot_image_option"
+  check_no_android_runtime_message "$1" "$apex_boot_image_message"
+}
+
+test_android_runtime_flag \
+  enable_apex_image false check_default_boot_image check_no_default_boot_image
+test_android_runtime_flag \
+  enable_apex_image true check_apex_boot_image check_no_apex_boot_image
+
+# Post-test actions.
+# ==================
 
 if [[ "$exit_status" -eq 0 ]]; then
   banner "All tests passed."
diff --git a/core/proto/android/app/settings_enums.proto b/core/proto/android/app/settings_enums.proto
index efbe8ba..927c85f2 100644
--- a/core/proto/android/app/settings_enums.proto
+++ b/core/proto/android/app/settings_enums.proto
@@ -616,7 +616,7 @@
     // OS: Q
     ACTION_PANEL_INTERACTION = 1658;
 
-    // ACTION: Show Contextual homepage, log latency in loading cards
+    // ACTION: Show Contextual homepage. Log total loading latency.
     ACTION_CONTEXTUAL_HOME_SHOW = 1662;
 
     // ACTION: Contextual card displays
@@ -649,6 +649,15 @@
     ACTION_ATCSCUC = 1680;
 
     ACTION_ATCHNUC = 1681;
+
+    // ACTION: Individual contextual card loading time
+    ACTION_CONTEXTUAL_CARD_LOAD = 1684;
+
+    //ACTION: Contextual card loading timeout
+    ACTION_CONTEXTUAL_CARD_LOAD_TIMEOUT = 1685;
+
+    //ACTION: Log result for each card's eligibility check
+    ACTION_CONTEXTUAL_CARD_ELIGIBILITY = 1686;
 }
 
 /**
@@ -2284,4 +2293,13 @@
     PAGE_ATSCP = 1672;
 
     PAGE_ATHNP = 1673;
+
+    // OPEN: Accessibility detail settings (android.settings.ACCESSIBILITY_DETAILS_SETTINGS intent)
+    ACCESSIBILITY_DETAILS_SETTINGS = 1682;
+
+    // Open: Settings will show the conditional when Grayscale mode is on
+    SETTINGS_CONDITION_GRAYSCALE_MODE = 1683;
+
+    // Panel for Wifi
+    PANEL_WIFI = 1687;
 }
diff --git a/core/proto/android/hardware/biometrics/enums.proto b/core/proto/android/hardware/biometrics/enums.proto
index 973e3e6..f2e0638 100644
--- a/core/proto/android/hardware/biometrics/enums.proto
+++ b/core/proto/android/hardware/biometrics/enums.proto
@@ -55,4 +55,6 @@
     // When the HAL has a template that doesn't exist in Android Framework. The framework
     // is expected to notify the HAL to remove this template to stay in sync with the framework.
     ISSUE_UNKNOWN_TEMPLATE_ENROLLED_HAL = 3;
+    // When the HAL has not sent ERROR_CANCELED within the specified timeout.
+    ISSUE_CANCEL_TIMED_OUT = 4;
 }
\ No newline at end of file
diff --git a/core/proto/android/providers/settings/global.proto b/core/proto/android/providers/settings/global.proto
index c1cbd52..62df6e7 100644
--- a/core/proto/android/providers/settings/global.proto
+++ b/core/proto/android/providers/settings/global.proto
@@ -1043,7 +1043,9 @@
 
     optional SettingProto app_ops_constants = 148 [ (android.privacy).dest = DEST_AUTOMATIC ];
 
+    optional SettingProto text_classifier_action_model_params = 145 [ (android.privacy).dest = DEST_AUTOMATIC ];
+
     // Please insert fields in alphabetical order and group them into messages
     // if possible (to avoid reaching the method limit).
-    // Next tag = 145 then 149; // (145 was removed)
+    // Next tag = 149;
 }
diff --git a/core/proto/android/providers/settings/secure.proto b/core/proto/android/providers/settings/secure.proto
index 6360a5f..27a18ee 100644
--- a/core/proto/android/providers/settings/secure.proto
+++ b/core/proto/android/providers/settings/secure.proto
@@ -191,6 +191,21 @@
 
     optional SettingProto emergency_assistance_application = 22 [ (android.privacy).dest = DEST_AUTOMATIC ];
     optional SettingProto enhanced_voice_privacy_enabled = 23 [ (android.privacy).dest = DEST_AUTOMATIC ];
+
+    message Gesture {
+        optional SettingProto aware_enabled = 1 [ (android.privacy).dest = DEST_AUTOMATIC ];
+
+        optional SettingProto silence_alarms_count = 2 [ (android.privacy).dest = DEST_AUTOMATIC ];
+        optional SettingProto silence_calls_count = 3 [ (android.privacy).dest = DEST_AUTOMATIC ];
+        optional SettingProto silence_enabled = 4 [ (android.privacy).dest = DEST_AUTOMATIC ];
+        optional SettingProto silence_notification_count = 5 [ (android.privacy).dest = DEST_AUTOMATIC ];
+        optional SettingProto silence_timer_count = 6 [ (android.privacy).dest = DEST_AUTOMATIC ];
+
+        optional SettingProto skip_count = 7 [ (android.privacy).dest = DEST_AUTOMATIC ];
+        optional SettingProto skip_enabled = 8 [ (android.privacy).dest = DEST_AUTOMATIC ];
+    }
+    optional Gesture gesture = 74;
+
     optional SettingProto immersive_mode_confirmations = 24 [ (android.privacy).dest = DEST_AUTOMATIC ];
 
     message Incall {
@@ -235,6 +250,10 @@
         optional SettingProto mode = 1 [ (android.privacy).dest = DEST_AUTOMATIC ];
         // The App or module that changes the location mode.
         optional SettingProto changer = 2 [ (android.privacy).dest = DEST_AUTOMATIC ];
+
+        // What should happen to the location permissions when upgraded to Android Q.
+        // 0 == revoke permissions. Anything else == do nothing.
+        optional SettingProto permissions_upgrade_to_q_mode = 3 [ (android.privacy).dest = DEST_AUTOMATIC ];
     }
     optional Location location = 31;
 
@@ -439,6 +458,7 @@
     // parent profile.
     optional SettingProto sync_parent_sounds = 55 [ (android.privacy).dest = DEST_AUTOMATIC ];
     optional SettingProto system_navigation_keys_enabled = 56 [ (android.privacy).dest = DEST_AUTOMATIC ];
+    optional SettingProto theme_customization_overlay_packages = 75 [ (android.privacy).dest = DEST_AUTOMATIC ];
     optional SettingProto trust_agents_initialized = 57 [ (android.privacy).dest = DEST_AUTOMATIC ];
 
     message Tts {
@@ -530,13 +550,7 @@
     }
     optional Zen zen = 71;
 
-    optional SettingProto skip_gesture_enabled = 74 [ (android.privacy).dest = DEST_AUTOMATIC ];
-    optional SettingProto silence_gesture_enabled = 75 [ (android.privacy).dest = DEST_AUTOMATIC ];
-    optional SettingProto theme_customization_overlay_packages = 76 [ (android.privacy).dest = DEST_AUTOMATIC ];
-
-    optional SettingProto aware_enabled = 77 [ (android.privacy).dest = DEST_AUTOMATIC ];
-
     // Please insert fields in alphabetical order and group them into messages
     // if possible (to avoid reaching the method limit).
-    // Next tag = 78;
+    // Next tag = 76;
 }
diff --git a/core/proto/android/server/activitymanagerservice.proto b/core/proto/android/server/activitymanagerservice.proto
index 6f9a564..79a5dd7 100644
--- a/core/proto/android/server/activitymanagerservice.proto
+++ b/core/proto/android/server/activitymanagerservice.proto
@@ -132,6 +132,7 @@
 
     optional bool keyguard_showing = 1;
     repeated KeyguardOccludedProto keyguard_occluded_states= 2;
+    optional bool aod_showing = 3;
 }
 
 message KeyguardOccludedProto {
diff --git a/core/proto/android/stats/devicepolicy/device_policy_enums.proto b/core/proto/android/stats/devicepolicy/device_policy_enums.proto
index a8e64c6..49221b4 100644
--- a/core/proto/android/stats/devicepolicy/device_policy_enums.proto
+++ b/core/proto/android/stats/devicepolicy/device_policy_enums.proto
@@ -101,7 +101,7 @@
   PROVISIONING_MANAGED_PROFILE_ON_FULLY_MANAGED_DEVICE = 77;
   PROVISIONING_PERSISTENT_DEVICE_OWNER = 78;
 
-  // existing Tron logs to be migrated to WestWorld
+  // existing Tron logs to be migrated to statsd
   PROVISIONING_ENTRY_POINT_NFC = 79;
   PROVISIONING_ENTRY_POINT_QR_CODE = 80;
   PROVISIONING_ENTRY_POINT_CLOUD_ENROLLMENT = 81;
diff --git a/core/res/AndroidManifest.xml b/core/res/AndroidManifest.xml
index 0149365..d176260 100644
--- a/core/res/AndroidManifest.xml
+++ b/core/res/AndroidManifest.xml
@@ -398,10 +398,8 @@
 
     <protected-broadcast android:name="android.intent.action.SUB_DEFAULT_CHANGED" />
 
-    <protected-broadcast android:name="android.location.GPS_ENABLED_CHANGE" />
     <protected-broadcast android:name="android.location.PROVIDERS_CHANGED" />
     <protected-broadcast android:name="android.location.MODE_CHANGED" />
-    <protected-broadcast android:name="android.location.GPS_FIX_CHANGE" />
     <protected-broadcast android:name="android.net.proxy.PAC_REFRESH" />
 
     <protected-broadcast android:name="android.telecom.action.DEFAULT_DIALER_CHANGED" />
@@ -2002,12 +2000,12 @@
 
     <!-- Must be required by a {@link android.telecom.PhoneAccountSuggestionService},
          to ensure that only the system can bind to it.
-         <p>Protection level: signature|privileged
+         <p>Protection level: signature
          @SystemApi
          @hide
     -->
     <permission android:name="android.permission.BIND_PHONE_ACCOUNT_SUGGESTION_SERVICE"
-        android:protectionLevel="signature|privileged" />
+        android:protectionLevel="signature" />
 
     <!-- Must be required by a {@link android.telecom.CallRedirectionService},
          to ensure that only the system can bind to it.
@@ -2935,6 +2933,13 @@
     <permission android:name="android.permission.TEMPORARY_ENABLE_ACCESSIBILITY"
         android:protectionLevel="signature" />
 
+    <!-- @SystemApi Allows an application to launch detail settings activity of a particular
+         accessibility service.
+         <p>Not for use by third-party applications.
+         @hide -->
+    <permission android:name="android.permission.OPEN_ACCESSIBILITY_DETAILS_SETTINGS"
+        android:protectionLevel="signature|installer" />
+
     <!-- @SystemApi Allows an application to watch and control how activities are
          started globally in the system.  Only for is in debugging
          (usually the monkey command).
@@ -3044,12 +3049,6 @@
     <permission android:name="android.permission.BIND_COMPANION_DEVICE_MANAGER_SERVICE"
         android:protectionLevel="signature" />
 
-    <!-- Must be required by the RoleControllerService to ensure that only the system can bind to
-         it.
-         @hide -->
-    <permission android:name="android.permission.BIND_ROLE_CONTROLLER_SERVICE"
-        android:protectionLevel="signature" />
-
     <!-- @SystemApi Must be required by the RuntimePermissionPresenterService to ensure
          that only the system can bind to it.
          @hide -->
@@ -3132,6 +3131,14 @@
     <permission android:name="android.permission.BIND_CONTENT_CAPTURE_SERVICE"
                 android:protectionLevel="signature" />
 
+    <!-- Must be required by a android.service.contentsuggestions.ContentSuggestionsService,
+         to ensure that only the system can bind to it.
+         @SystemApi @hide This is not a third-party API (intended for OEMs and system apps).
+         <p>Protection level: signature
+    -->
+    <permission android:name="android.permission.BIND_CONTENT_SUGGESTIONS_SERVICE"
+                android:protectionLevel="signature" />
+
     <!-- Must be required by a android.service.autofill.augmented.AugmentedAutofillService,
          to ensure that only the system can bind to it.
          @SystemApi @hide This is not a third-party API (intended for OEMs and system apps).
@@ -3951,6 +3958,13 @@
     <permission android:name="android.permission.UPDATE_LOCK"
         android:protectionLevel="signature|privileged" />
 
+    <!-- @SystemApi Allows an application the opportunity to become a
+         {@link android.service.notification.NotificationAssistantService}.
+         User permission is still required before access is granted.
+         @hide -->
+    <permission android:name="android.permission.REQUEST_NOTIFICATION_ASSISTANT_SERVICE"
+                android:protectionLevel="signature|privileged" />
+
     <!-- @SystemApi @TestApi Allows an application to read the current set of notifications, including
          any metadata and intents attached.
          @hide -->
@@ -4438,14 +4452,27 @@
          @hide -->
     <permission android:name="android.permission.RECEIVE_DEVICE_CUSTOMIZATION_READY"
         android:protectionLevel="signature|preinstalled" />
+
     <!-- @SystemApi Allows wallpaper to be rendered in ambient mode.
          @hide -->
     <permission android:name="android.permission.AMBIENT_WALLPAPER"
                 android:protectionLevel="signature|preinstalled" />
+
     <!-- @SystemApi Allows sensor privacy to be modified.
          @hide -->
     <permission android:name="android.permission.MANAGE_SENSOR_PRIVACY"
                 android:protectionLevel="signature" />
+    <!-- @SystemApi Permission that protects the {@link Intent#ACTION_REVIEW_ACCESSIBILITY_SERVICES}
+         intent.
+         @hide -->
+    <permission android:name="android.permission.REVIEW_ACCESSIBILITY_SERVICES"
+                android:protectionLevel="signature" />
+
+    <!-- @SystemApi Allows an activity to replace the app name and icon displayed in share targets
+         in the sharesheet for the Q-release and later.
+         @hide  <p>Not for use by third-party applications.</p> -->
+    <permission android:name="android.permission.SUBSTITUTE_SHARE_TARGET_APP_NAME_AND_ICON"
+                android:protectionLevel="signature|privileged" />
 
     <application android:process="system"
                  android:persistent="true"
diff --git a/core/res/res/anim-ldrtl/cross_profile_apps_thumbnail_enter.xml b/core/res/res/anim-ldrtl/cross_profile_apps_thumbnail_enter.xml
index 6f3dc8c..5add19b 100644
--- a/core/res/res/anim-ldrtl/cross_profile_apps_thumbnail_enter.xml
+++ b/core/res/res/anim-ldrtl/cross_profile_apps_thumbnail_enter.xml
@@ -18,7 +18,9 @@
 -->
 <!-- This should be kept in sync with task_open_enter.xml -->
 <set xmlns:android="http://schemas.android.com/apk/res/android"
-     android:shareInterpolator="false" android:zAdjustment="top">
+     android:hasRoundedCorners="true"
+     android:shareInterpolator="false"
+     android:zAdjustment="top">
 
     <alpha
         android:fromAlpha="1"
diff --git a/core/res/res/anim-ldrtl/task_close_enter.xml b/core/res/res/anim-ldrtl/task_close_enter.xml
index 7abada3..e00141a 100644
--- a/core/res/res/anim-ldrtl/task_close_enter.xml
+++ b/core/res/res/anim-ldrtl/task_close_enter.xml
@@ -16,6 +16,7 @@
 <set xmlns:android="http://schemas.android.com/apk/res/android"
     android:shareInterpolator="false"
     android:zAdjustment="top"
+    android:hasRoundedCorners="true"
     android:showWallpaper="true">
 
     <alpha
diff --git a/core/res/res/anim-ldrtl/task_close_exit.xml b/core/res/res/anim-ldrtl/task_close_exit.xml
index a017820..71a44ae 100644
--- a/core/res/res/anim-ldrtl/task_close_exit.xml
+++ b/core/res/res/anim-ldrtl/task_close_exit.xml
@@ -16,6 +16,7 @@
 
 <set xmlns:android="http://schemas.android.com/apk/res/android"
     android:shareInterpolator="false"
+    android:hasRoundedCorners="true"
     android:showWallpaper="true">
 
     <alpha
diff --git a/core/res/res/anim-ldrtl/task_open_enter.xml b/core/res/res/anim-ldrtl/task_open_enter.xml
index 0433664..7815f7d 100644
--- a/core/res/res/anim-ldrtl/task_open_enter.xml
+++ b/core/res/res/anim-ldrtl/task_open_enter.xml
@@ -18,6 +18,7 @@
 <set xmlns:android="http://schemas.android.com/apk/res/android"
     android:shareInterpolator="false"
     android:zAdjustment="top"
+    android:hasRoundedCorners="true"
     android:showWallpaper="true">
 
     <alpha
diff --git a/core/res/res/anim-ldrtl/task_open_enter_cross_profile_apps.xml b/core/res/res/anim-ldrtl/task_open_enter_cross_profile_apps.xml
index 45ca80e..5fccd6df 100644
--- a/core/res/res/anim-ldrtl/task_open_enter_cross_profile_apps.xml
+++ b/core/res/res/anim-ldrtl/task_open_enter_cross_profile_apps.xml
@@ -18,6 +18,7 @@
 <set xmlns:android="http://schemas.android.com/apk/res/android"
     android:shareInterpolator="false"
     android:zAdjustment="top"
+    android:hasRoundedCorners="true"
     android:showWallpaper="true">
 
     <alpha
diff --git a/core/res/res/anim-ldrtl/task_open_exit.xml b/core/res/res/anim-ldrtl/task_open_exit.xml
index f50494d..025e1bd 100644
--- a/core/res/res/anim-ldrtl/task_open_exit.xml
+++ b/core/res/res/anim-ldrtl/task_open_exit.xml
@@ -16,6 +16,7 @@
 
 <set xmlns:android="http://schemas.android.com/apk/res/android"
     android:shareInterpolator="false"
+    android:hasRoundedCorners="true"
     android:showWallpaper="true">
 
     <alpha
diff --git a/core/res/res/anim/cross_profile_apps_thumbnail_enter.xml b/core/res/res/anim/cross_profile_apps_thumbnail_enter.xml
index 4c2559f..2cfeecf 100644
--- a/core/res/res/anim/cross_profile_apps_thumbnail_enter.xml
+++ b/core/res/res/anim/cross_profile_apps_thumbnail_enter.xml
@@ -18,7 +18,9 @@
 -->
 <!-- This should be kept in sync with task_open_enter.xml -->
 <set xmlns:android="http://schemas.android.com/apk/res/android"
-     android:shareInterpolator="false" android:zAdjustment="top">
+     android:shareInterpolator="false"
+     android:hasRoundedCorners="true"
+     android:zAdjustment="top">
 
     <alpha
         android:fromAlpha="1"
diff --git a/core/res/res/anim/lock_in.xml b/core/res/res/anim/lock_in.xml
index 992bc92..cd4effd 100755
--- a/core/res/res/anim/lock_in.xml
+++ b/core/res/res/anim/lock_in.xml
@@ -14,111 +14,76 @@
      limitations under the License.
 -->
 <animated-vector xmlns:android="http://schemas.android.com/apk/res/android"
-    xmlns:aapt="http://schemas.android.com/aapt">
+                 xmlns:aapt="http://schemas.android.com/aapt">
     <aapt:attr name="android:drawable">
-        <vector
-            android:width="24dp"
-            android:height="24dp"
-            android:viewportWidth="24"
-            android:viewportHeight="24">
+        <vector android:height="32dp" android:width="32dp" android:viewportHeight="32"
+                android:viewportWidth="32">
             <group android:name="_R_G">
-                <group android:name="_R_G_L_2_G_N_3_T_0_M">
-                    <group
-                        android:name="_R_G_L_2_G_N_3_T_0"
-                        android:pivotX="2.25"
-                        android:pivotY="2.25"
-                        android:scaleX="0"
-                        android:scaleY="0"
-                        android:translateX="9.75"
-                        android:translateY="12.75">
-                        <group
-                            android:name="_R_G_L_2_G_T_1"
-                            android:scaleX="0.12346"
-                            android:scaleY="0.12346"
-                            android:translateX="2.25"
-                            android:translateY="2.373">
-                            <group
-                                android:name="_R_G_L_2_G"
-                                android:translateY="32">
-                                <path
-                                    android:name="_R_G_L_2_G_D_0_P_0"
-                                    android:fillAlpha="0"
-                                    android:fillColor="#ff0000"
-                                    android:fillType="nonZero"
-                                    android:pathData=" M-28.21 -31.92 C-28.21,-31.92 -27.85,-48.38 -27.97,-55.48 C-28,-57.63 -23.5,-79.87 -0.75,-79.82 C22.77,-79.76 27.75,-59.37 27.72,-58.27 C27.55,-52.88 27.97,-31.67 27.97,-31.67 "
-                                    android:trimPathStart="0.14"
-                                    android:trimPathEnd="0.89"
-                                    android:trimPathOffset="0" />
-                                <path
-                                    android:name="_R_G_L_2_G_D_1_P_0"
-                                    android:pathData=" M-28.21 -31.92 C-28.21,-31.92 -27.85,-48.38 -27.97,-55.48 C-28,-57.63 -23.5,-79.87 -0.75,-79.82 C22.77,-79.76 27.75,-59.37 27.72,-58.27 C27.55,-52.88 27.97,-31.67 27.97,-31.67 "
-                                    android:strokeWidth="16"
-                                    android:strokeAlpha="1"
-                                    android:strokeColor="?attr/textColor"
-                                    android:trimPathStart="0.14"
-                                    android:trimPathEnd="0.89"
-                                    android:trimPathOffset="0" />
+                <group android:name="_R_G_L_2_G_N_2_N_1_T_0" android:translateX="16"
+                       android:translateY="16" android:scaleX="1.3" android:scaleY="1.3">
+                    <group android:name="_R_G_L_2_G_N_2_T_0" android:translateX="-2.25"
+                           android:translateY="0.75" android:pivotX="2.25" android:pivotY="2.25"
+                           android:scaleX="0" android:scaleY="0">
+                        <group android:name="_R_G_L_2_G_T_1" android:translateX="2.25"
+                               android:translateY="2.373" android:scaleX="0.12346"
+                               android:scaleY="0.12346">
+                            <group android:name="_R_G_L_2_G" android:translateY="32">
+                                <path android:name="_R_G_L_2_G_D_0_P_0" android:fillColor="#ff0000"
+                                      android:fillAlpha="0" android:fillType="nonZero"
+                                      android:trimPathStart="0.14" android:trimPathEnd="0.89"
+                                      android:trimPathOffset="0"
+                                      android:pathData=" M-28.21 -31.92 C-28.21,-31.92 -27.85,-48.38 -27.97,-55.48 C-28,-57.63 -23.5,-79.87 -0.75,-79.82 C22.77,-79.76 27.75,-59.37 27.72,-58.27 C27.55,-52.88 27.97,-31.67 27.97,-31.67 "/>
+                                <path android:name="_R_G_L_2_G_D_1_P_0"
+                                      android:strokeColor="?attr/textColor" android:strokeLineCap="round"
+                                      android:strokeLineJoin="round" android:strokeWidth="16"
+                                      android:strokeAlpha="1" android:trimPathStart="0.14"
+                                      android:trimPathEnd="0.89" android:trimPathOffset="0"
+                                      android:pathData=" M-28.21 -31.92 C-28.21,-31.92 -27.85,-48.38 -27.97,-55.48 C-28,-57.63 -23.5,-79.87 -0.75,-79.82 C22.77,-79.76 27.75,-59.37 27.72,-58.27 C27.55,-52.88 27.97,-31.67 27.97,-31.67 "/>
                             </group>
                         </group>
                     </group>
                 </group>
-                <group
-                    android:name="_R_G_L_1_G"
-                    android:pivotX="8.25"
-                    android:pivotY="7.25"
-                    android:scaleX="0"
-                    android:scaleY="0"
-                    android:translateX="3.75"
-                    android:translateY="7.75">
-                    <path
-                        android:name="_R_G_L_1_G_D_0_P_0"
-                        android:fillAlpha="1"
-                        android:fillColor="?attr/textColor"
-                        android:fillType="nonZero"
-                        android:pathData=" M14.25 0.25 C14.25,0.25 12.75,0.25 12.75,0.25 C12.75,0.25 10.75,0.25 10.75,0.25 C10.75,0.25 5.75,0.25 5.75,0.25 C5.75,0.25 3.75,0.25 3.75,0.25 C3.75,0.25 2.25,0.25 2.25,0.25 C1.15,0.25 0.25,1.15 0.25,2.25 C0.25,2.25 0.25,12.25 0.25,12.25 C0.25,13.35 1.15,14.25 2.25,14.25 C2.25,14.25 14.25,14.25 14.25,14.25 C15.35,14.25 16.25,13.35 16.25,12.25 C16.25,12.25 16.25,2.25 16.25,2.25 C16.25,1.15 15.35,0.25 14.25,0.25c  M14.25 12.25 C14.25,12.25 2.25,12.25 2.25,12.25 C2.25,12.25 2.25,2.25 2.25,2.25 C2.25,2.25 3.75,2.25 3.75,2.25 C3.75,2.25 12.75,2.25 12.75,2.25 C12.75,2.25 14.25,2.25 14.25,2.25 C14.25,2.25 14.25,12.25 14.25,12.25c " />
+                <group android:name="_R_G_L_1_G_N_1_T_0" android:translateX="16"
+                       android:translateY="16" android:scaleX="1.3" android:scaleY="1.3">
+                    <group android:name="_R_G_L_1_G" android:translateX="-8.25"
+                           android:translateY="-4.25" android:pivotX="8.25" android:pivotY="7.25"
+                           android:scaleX="0" android:scaleY="0">
+                        <path android:name="_R_G_L_1_G_D_0_P_0" android:fillColor="?attr/textColor"
+                              android:fillAlpha="1" android:fillType="nonZero"
+                              android:pathData=" M14.25 0.25 C14.25,0.25 12.75,0.25 12.75,0.25 C12.75,0.25 10.75,0.25 10.75,0.25 C10.75,0.25 5.75,0.25 5.75,0.25 C5.75,0.25 3.75,0.25 3.75,0.25 C3.75,0.25 2.25,0.25 2.25,0.25 C1.15,0.25 0.25,1.15 0.25,2.25 C0.25,2.25 0.25,12.25 0.25,12.25 C0.25,13.35 1.15,14.25 2.25,14.25 C2.25,14.25 14.25,14.25 14.25,14.25 C15.35,14.25 16.25,13.35 16.25,12.25 C16.25,12.25 16.25,2.25 16.25,2.25 C16.25,1.15 15.35,0.25 14.25,0.25c  M14.25 12.25 C14.25,12.25 2.25,12.25 2.25,12.25 C2.25,12.25 2.25,2.25 2.25,2.25 C2.25,2.25 3.75,2.25 3.75,2.25 C3.75,2.25 12.75,2.25 12.75,2.25 C12.75,2.25 14.25,2.25 14.25,2.25 C14.25,2.25 14.25,12.25 14.25,12.25c "/>
+                    </group>
                 </group>
-                <group
-                    android:name="_R_G_L_0_G"
-                    android:pivotX="2.25"
-                    android:pivotY="2.25"
-                    android:scaleX="0"
-                    android:scaleY="0"
-                    android:translateX="9.75"
-                    android:translateY="12.75">
-                    <path
-                        android:name="_R_G_L_0_G_D_0_P_0"
-                        android:fillAlpha="1"
-                        android:fillColor="?attr/textColor"
-                        android:fillType="nonZero"
-                        android:pathData=" M2.25 0.25 C3.35,0.25 4.25,1.15 4.25,2.25 C4.25,3.35 3.35,4.25 2.25,4.25 C1.15,4.25 0.25,3.35 0.25,2.25 C0.25,1.15 1.15,0.25 2.25,0.25c " />
+                <group android:name="_R_G_L_0_G_N_1_T_0" android:translateX="16"
+                       android:translateY="16" android:scaleX="1.3" android:scaleY="1.3">
+                    <group android:name="_R_G_L_0_G" android:translateX="-2.25"
+                           android:translateY="0.75" android:pivotX="2.25" android:pivotY="2.25"
+                           android:scaleX="0" android:scaleY="0">
+                        <path android:name="_R_G_L_0_G_D_0_P_0" android:fillColor="?attr/textColor"
+                              android:fillAlpha="1" android:fillType="nonZero"
+                              android:pathData=" M2.25 0.25 C3.35,0.25 4.25,1.15 4.25,2.25 C4.25,3.35 3.35,4.25 2.25,4.25 C1.15,4.25 0.25,3.35 0.25,2.25 C0.25,1.15 1.15,0.25 2.25,0.25c "/>
+                    </group>
                 </group>
             </group>
-            <group android:name="time_group" />
+            <group android:name="time_group"/>
         </vector>
     </aapt:attr>
     <target android:name="_R_G_L_2_G_D_0_P_0">
         <aapt:attr name="android:animation">
             <set android:ordering="together">
-                <objectAnimator
-                    android:duration="50"
-                    android:propertyName="trimPathStart"
-                    android:startOffset="0"
-                    android:valueFrom="0.14"
-                    android:valueTo="0.14"
-                    android:valueType="floatType">
+                <objectAnimator android:propertyName="trimPathStart" android:duration="50"
+                                android:startOffset="0" android:valueFrom="0.14"
+                                android:valueTo="0.14" android:valueType="floatType">
                     <aapt:attr name="android:interpolator">
-                        <pathInterpolator android:pathData="M 0.0,0.0 c0.167,0.167 0.833,0.833 1.0,1.0" />
+                        <pathInterpolator
+                            android:pathData="M 0.0,0.0 c0.167,0.167 0.833,0.833 1.0,1.0"/>
                     </aapt:attr>
                 </objectAnimator>
-                <objectAnimator
-                    android:duration="67"
-                    android:propertyName="trimPathStart"
-                    android:startOffset="50"
-                    android:valueFrom="0.14"
-                    android:valueTo="0"
-                    android:valueType="floatType">
+                <objectAnimator android:propertyName="trimPathStart" android:duration="67"
+                                android:startOffset="50" android:valueFrom="0.14"
+                                android:valueTo="0" android:valueType="floatType">
                     <aapt:attr name="android:interpolator">
-                        <pathInterpolator android:pathData="M 0.0,0.0 c0.167,0.167 0.833,0.833 1.0,1.0" />
+                        <pathInterpolator
+                            android:pathData="M 0.0,0.0 c0.167,0.167 0.833,0.833 1.0,1.0"/>
                     </aapt:attr>
                 </objectAnimator>
             </set>
@@ -127,26 +92,20 @@
     <target android:name="_R_G_L_2_G_D_0_P_0">
         <aapt:attr name="android:animation">
             <set android:ordering="together">
-                <objectAnimator
-                    android:duration="50"
-                    android:propertyName="trimPathEnd"
-                    android:startOffset="0"
-                    android:valueFrom="0.89"
-                    android:valueTo="0.89"
-                    android:valueType="floatType">
+                <objectAnimator android:propertyName="trimPathEnd" android:duration="50"
+                                android:startOffset="0" android:valueFrom="0.89"
+                                android:valueTo="0.89" android:valueType="floatType">
                     <aapt:attr name="android:interpolator">
-                        <pathInterpolator android:pathData="M 0.0,0.0 c0.167,0.167 0.833,0.833 1.0,1.0" />
+                        <pathInterpolator
+                            android:pathData="M 0.0,0.0 c0.167,0.167 0.833,0.833 1.0,1.0"/>
                     </aapt:attr>
                 </objectAnimator>
-                <objectAnimator
-                    android:duration="67"
-                    android:propertyName="trimPathEnd"
-                    android:startOffset="50"
-                    android:valueFrom="0.89"
-                    android:valueTo="1"
-                    android:valueType="floatType">
+                <objectAnimator android:propertyName="trimPathEnd" android:duration="67"
+                                android:startOffset="50" android:valueFrom="0.89"
+                                android:valueTo="1" android:valueType="floatType">
                     <aapt:attr name="android:interpolator">
-                        <pathInterpolator android:pathData="M 0.0,0.0 c0.167,0.167 0.833,0.833 1.0,1.0" />
+                        <pathInterpolator
+                            android:pathData="M 0.0,0.0 c0.167,0.167 0.833,0.833 1.0,1.0"/>
                     </aapt:attr>
                 </objectAnimator>
             </set>
@@ -155,26 +114,20 @@
     <target android:name="_R_G_L_2_G_D_1_P_0">
         <aapt:attr name="android:animation">
             <set android:ordering="together">
-                <objectAnimator
-                    android:duration="50"
-                    android:propertyName="trimPathStart"
-                    android:startOffset="0"
-                    android:valueFrom="0.14"
-                    android:valueTo="0.14"
-                    android:valueType="floatType">
+                <objectAnimator android:propertyName="trimPathStart" android:duration="50"
+                                android:startOffset="0" android:valueFrom="0.14"
+                                android:valueTo="0.14" android:valueType="floatType">
                     <aapt:attr name="android:interpolator">
-                        <pathInterpolator android:pathData="M 0.0,0.0 c0.167,0.167 0.833,0.833 1.0,1.0" />
+                        <pathInterpolator
+                            android:pathData="M 0.0,0.0 c0.167,0.167 0.833,0.833 1.0,1.0"/>
                     </aapt:attr>
                 </objectAnimator>
-                <objectAnimator
-                    android:duration="67"
-                    android:propertyName="trimPathStart"
-                    android:startOffset="50"
-                    android:valueFrom="0.14"
-                    android:valueTo="0"
-                    android:valueType="floatType">
+                <objectAnimator android:propertyName="trimPathStart" android:duration="67"
+                                android:startOffset="50" android:valueFrom="0.14"
+                                android:valueTo="0" android:valueType="floatType">
                     <aapt:attr name="android:interpolator">
-                        <pathInterpolator android:pathData="M 0.0,0.0 c0.167,0.167 0.833,0.833 1.0,1.0" />
+                        <pathInterpolator
+                            android:pathData="M 0.0,0.0 c0.167,0.167 0.833,0.833 1.0,1.0"/>
                     </aapt:attr>
                 </objectAnimator>
             </set>
@@ -183,26 +136,20 @@
     <target android:name="_R_G_L_2_G_D_1_P_0">
         <aapt:attr name="android:animation">
             <set android:ordering="together">
-                <objectAnimator
-                    android:duration="50"
-                    android:propertyName="trimPathEnd"
-                    android:startOffset="0"
-                    android:valueFrom="0.89"
-                    android:valueTo="0.89"
-                    android:valueType="floatType">
+                <objectAnimator android:propertyName="trimPathEnd" android:duration="50"
+                                android:startOffset="0" android:valueFrom="0.89"
+                                android:valueTo="0.89" android:valueType="floatType">
                     <aapt:attr name="android:interpolator">
-                        <pathInterpolator android:pathData="M 0.0,0.0 c0.167,0.167 0.833,0.833 1.0,1.0" />
+                        <pathInterpolator
+                            android:pathData="M 0.0,0.0 c0.167,0.167 0.833,0.833 1.0,1.0"/>
                     </aapt:attr>
                 </objectAnimator>
-                <objectAnimator
-                    android:duration="67"
-                    android:propertyName="trimPathEnd"
-                    android:startOffset="50"
-                    android:valueFrom="0.89"
-                    android:valueTo="1"
-                    android:valueType="floatType">
+                <objectAnimator android:propertyName="trimPathEnd" android:duration="67"
+                                android:startOffset="50" android:valueFrom="0.89"
+                                android:valueTo="1" android:valueType="floatType">
                     <aapt:attr name="android:interpolator">
-                        <pathInterpolator android:pathData="M 0.0,0.0 c0.167,0.167 0.833,0.833 1.0,1.0" />
+                        <pathInterpolator
+                            android:pathData="M 0.0,0.0 c0.167,0.167 0.833,0.833 1.0,1.0"/>
                     </aapt:attr>
                 </objectAnimator>
             </set>
@@ -211,128 +158,91 @@
     <target android:name="_R_G_L_2_G_T_1">
         <aapt:attr name="android:animation">
             <set android:ordering="together">
-                <objectAnimator
-                    android:duration="150"
-                    android:pathData="M 2.25,2.373C 2.25,1.2001604776382402 2.25,-3.49116047763824 2.25,-4.664"
-                    android:propertyName="translateXY"
-                    android:propertyXName="translateX"
-                    android:propertyYName="translateY"
-                    android:startOffset="0">
+                <objectAnimator android:propertyName="translateXY" android:duration="150"
+                                android:startOffset="0" android:propertyXName="translateX"
+                                android:propertyYName="translateY"
+                                android:pathData="M 2.25,2.373C 2.25,1.2001604776382402 2.25,-3.49116047763824 2.25,-4.664">
                     <aapt:attr name="android:interpolator">
-                        <pathInterpolator android:pathData="M 0.0,0.0 c0.001,0 0.2,1 1.0,1.0" />
+                        <pathInterpolator android:pathData="M 0.0,0.0 c0.001,0 0.2,1 1.0,1.0"/>
                     </aapt:attr>
                 </objectAnimator>
             </set>
         </aapt:attr>
     </target>
-    <target android:name="_R_G_L_2_G_N_3_T_0">
+    <target android:name="_R_G_L_2_G_N_2_T_0">
         <aapt:attr name="android:animation">
             <set android:ordering="together">
-                <objectAnimator
-                    android:duration="233"
-                    android:propertyName="scaleX"
-                    android:startOffset="0"
-                    android:valueFrom="0"
-                    android:valueTo="1.0125"
-                    android:valueType="floatType">
+                <objectAnimator android:propertyName="scaleX" android:duration="233"
+                                android:startOffset="0" android:valueFrom="0"
+                                android:valueTo="1.0125" android:valueType="floatType">
                     <aapt:attr name="android:interpolator">
-                        <pathInterpolator android:pathData="M 0.0,0.0 c0.043,0.556 0.667,1 1.0,1.0" />
+                        <pathInterpolator
+                            android:pathData="M 0.0,0.0 c0.043,0.556 0.667,1 1.0,1.0"/>
                     </aapt:attr>
                 </objectAnimator>
-                <objectAnimator
-                    android:duration="233"
-                    android:propertyName="scaleY"
-                    android:startOffset="0"
-                    android:valueFrom="0"
-                    android:valueTo="1.0125"
-                    android:valueType="floatType">
+                <objectAnimator android:propertyName="scaleY" android:duration="233"
+                                android:startOffset="0" android:valueFrom="0"
+                                android:valueTo="1.0125" android:valueType="floatType">
                     <aapt:attr name="android:interpolator">
-                        <pathInterpolator android:pathData="M 0.0,0.0 c0.043,0.556 0.667,1 1.0,1.0" />
+                        <pathInterpolator
+                            android:pathData="M 0.0,0.0 c0.043,0.556 0.667,1 1.0,1.0"/>
                     </aapt:attr>
                 </objectAnimator>
-                <objectAnimator
-                    android:duration="117"
-                    android:propertyName="scaleX"
-                    android:startOffset="233"
-                    android:valueFrom="1.0125"
-                    android:valueTo="1"
-                    android:valueType="floatType">
+                <objectAnimator android:propertyName="scaleX" android:duration="117"
+                                android:startOffset="233" android:valueFrom="1.0125"
+                                android:valueTo="1" android:valueType="floatType">
                     <aapt:attr name="android:interpolator">
-                        <pathInterpolator android:pathData="M 0.0,0.0 c0.333,0 0.667,1 1.0,1.0" />
+                        <pathInterpolator android:pathData="M 0.0,0.0 c0.333,0 0.667,1 1.0,1.0"/>
                     </aapt:attr>
                 </objectAnimator>
-                <objectAnimator
-                    android:duration="117"
-                    android:propertyName="scaleY"
-                    android:startOffset="233"
-                    android:valueFrom="1.0125"
-                    android:valueTo="1"
-                    android:valueType="floatType">
+                <objectAnimator android:propertyName="scaleY" android:duration="117"
+                                android:startOffset="233" android:valueFrom="1.0125"
+                                android:valueTo="1" android:valueType="floatType">
                     <aapt:attr name="android:interpolator">
-                        <pathInterpolator android:pathData="M 0.0,0.0 c0.333,0 0.667,1 1.0,1.0" />
+                        <pathInterpolator android:pathData="M 0.0,0.0 c0.333,0 0.667,1 1.0,1.0"/>
                     </aapt:attr>
                 </objectAnimator>
             </set>
         </aapt:attr>
     </target>
-    <target android:name="_R_G_L_2_G_N_3_T_0_M">
+    <target android:name="_R_G_L_2_G_N_2_N_1_T_0">
         <aapt:attr name="android:animation">
             <set android:ordering="together">
-                <objectAnimator
-                    android:duration="0"
-                    android:propertyName="scaleX"
-                    android:startOffset="50"
-                    android:valueFrom="0"
-                    android:valueTo="1"
-                    android:valueType="floatType" />
+                <objectAnimator android:propertyName="scaleX" android:duration="0"
+                                android:startOffset="50" android:valueFrom="0" android:valueTo="1.3"
+                                android:valueType="floatType"/>
             </set>
         </aapt:attr>
     </target>
     <target android:name="_R_G_L_1_G">
         <aapt:attr name="android:animation">
             <set android:ordering="together">
-                <objectAnimator
-                    android:duration="233"
-                    android:propertyName="scaleX"
-                    android:startOffset="0"
-                    android:valueFrom="0"
-                    android:valueTo="1.025"
-                    android:valueType="floatType">
+                <objectAnimator android:propertyName="scaleX" android:duration="233"
+                                android:startOffset="0" android:valueFrom="0"
+                                android:valueTo="1.025" android:valueType="floatType">
                     <aapt:attr name="android:interpolator">
-                        <pathInterpolator android:pathData="M 0.0,0.0 c0.001,0 0.2,1 1.0,1.0" />
+                        <pathInterpolator android:pathData="M 0.0,0.0 c0.001,0 0.2,1 1.0,1.0"/>
                     </aapt:attr>
                 </objectAnimator>
-                <objectAnimator
-                    android:duration="233"
-                    android:propertyName="scaleY"
-                    android:startOffset="0"
-                    android:valueFrom="0"
-                    android:valueTo="1.025"
-                    android:valueType="floatType">
+                <objectAnimator android:propertyName="scaleY" android:duration="233"
+                                android:startOffset="0" android:valueFrom="0"
+                                android:valueTo="1.025" android:valueType="floatType">
                     <aapt:attr name="android:interpolator">
-                        <pathInterpolator android:pathData="M 0.0,0.0 c0.001,0 0.2,1 1.0,1.0" />
+                        <pathInterpolator android:pathData="M 0.0,0.0 c0.001,0 0.2,1 1.0,1.0"/>
                     </aapt:attr>
                 </objectAnimator>
-                <objectAnimator
-                    android:duration="117"
-                    android:propertyName="scaleX"
-                    android:startOffset="233"
-                    android:valueFrom="1.025"
-                    android:valueTo="1"
-                    android:valueType="floatType">
+                <objectAnimator android:propertyName="scaleX" android:duration="117"
+                                android:startOffset="233" android:valueFrom="1.025"
+                                android:valueTo="1" android:valueType="floatType">
                     <aapt:attr name="android:interpolator">
-                        <pathInterpolator android:pathData="M 0.0,0.0 c0.4,0 0.2,1 1.0,1.0" />
+                        <pathInterpolator android:pathData="M 0.0,0.0 c0.4,0 0.2,1 1.0,1.0"/>
                     </aapt:attr>
                 </objectAnimator>
-                <objectAnimator
-                    android:duration="117"
-                    android:propertyName="scaleY"
-                    android:startOffset="233"
-                    android:valueFrom="1.025"
-                    android:valueTo="1"
-                    android:valueType="floatType">
+                <objectAnimator android:propertyName="scaleY" android:duration="117"
+                                android:startOffset="233" android:valueFrom="1.025"
+                                android:valueTo="1" android:valueType="floatType">
                     <aapt:attr name="android:interpolator">
-                        <pathInterpolator android:pathData="M 0.0,0.0 c0.4,0 0.2,1 1.0,1.0" />
+                        <pathInterpolator android:pathData="M 0.0,0.0 c0.4,0 0.2,1 1.0,1.0"/>
                     </aapt:attr>
                 </objectAnimator>
             </set>
@@ -341,48 +251,34 @@
     <target android:name="_R_G_L_0_G">
         <aapt:attr name="android:animation">
             <set android:ordering="together">
-                <objectAnimator
-                    android:duration="233"
-                    android:propertyName="scaleX"
-                    android:startOffset="0"
-                    android:valueFrom="0"
-                    android:valueTo="1.0125"
-                    android:valueType="floatType">
+                <objectAnimator android:propertyName="scaleX" android:duration="233"
+                                android:startOffset="0" android:valueFrom="0"
+                                android:valueTo="1.0125" android:valueType="floatType">
                     <aapt:attr name="android:interpolator">
-                        <pathInterpolator android:pathData="M 0.0,0.0 c0.043,0.556 0.667,1 1.0,1.0" />
+                        <pathInterpolator
+                            android:pathData="M 0.0,0.0 c0.043,0.556 0.667,1 1.0,1.0"/>
                     </aapt:attr>
                 </objectAnimator>
-                <objectAnimator
-                    android:duration="233"
-                    android:propertyName="scaleY"
-                    android:startOffset="0"
-                    android:valueFrom="0"
-                    android:valueTo="1.0125"
-                    android:valueType="floatType">
+                <objectAnimator android:propertyName="scaleY" android:duration="233"
+                                android:startOffset="0" android:valueFrom="0"
+                                android:valueTo="1.0125" android:valueType="floatType">
                     <aapt:attr name="android:interpolator">
-                        <pathInterpolator android:pathData="M 0.0,0.0 c0.043,0.556 0.667,1 1.0,1.0" />
+                        <pathInterpolator
+                            android:pathData="M 0.0,0.0 c0.043,0.556 0.667,1 1.0,1.0"/>
                     </aapt:attr>
                 </objectAnimator>
-                <objectAnimator
-                    android:duration="117"
-                    android:propertyName="scaleX"
-                    android:startOffset="233"
-                    android:valueFrom="1.0125"
-                    android:valueTo="1"
-                    android:valueType="floatType">
+                <objectAnimator android:propertyName="scaleX" android:duration="117"
+                                android:startOffset="233" android:valueFrom="1.0125"
+                                android:valueTo="1" android:valueType="floatType">
                     <aapt:attr name="android:interpolator">
-                        <pathInterpolator android:pathData="M 0.0,0.0 c0.333,0 0.667,1 1.0,1.0" />
+                        <pathInterpolator android:pathData="M 0.0,0.0 c0.333,0 0.667,1 1.0,1.0"/>
                     </aapt:attr>
                 </objectAnimator>
-                <objectAnimator
-                    android:duration="117"
-                    android:propertyName="scaleY"
-                    android:startOffset="233"
-                    android:valueFrom="1.0125"
-                    android:valueTo="1"
-                    android:valueType="floatType">
+                <objectAnimator android:propertyName="scaleY" android:duration="117"
+                                android:startOffset="233" android:valueFrom="1.0125"
+                                android:valueTo="1" android:valueType="floatType">
                     <aapt:attr name="android:interpolator">
-                        <pathInterpolator android:pathData="M 0.0,0.0 c0.333,0 0.667,1 1.0,1.0" />
+                        <pathInterpolator android:pathData="M 0.0,0.0 c0.333,0 0.667,1 1.0,1.0"/>
                     </aapt:attr>
                 </objectAnimator>
             </set>
@@ -391,13 +287,9 @@
     <target android:name="time_group">
         <aapt:attr name="android:animation">
             <set android:ordering="together">
-                <objectAnimator
-                    android:duration="717"
-                    android:propertyName="translateX"
-                    android:startOffset="0"
-                    android:valueFrom="0"
-                    android:valueTo="1"
-                    android:valueType="floatType" />
+                <objectAnimator android:propertyName="translateX" android:duration="717"
+                                android:startOffset="0" android:valueFrom="0" android:valueTo="1"
+                                android:valueType="floatType"/>
             </set>
         </aapt:attr>
     </target>
diff --git a/core/res/res/anim/lock_lock.xml b/core/res/res/anim/lock_lock.xml
index 8b7887c..ce9c8e8 100755
--- a/core/res/res/anim/lock_lock.xml
+++ b/core/res/res/anim/lock_lock.xml
@@ -13,4 +13,277 @@
      See the License for the specific language governing permissions and
      limitations under the License.
 -->
-<animated-vector xmlns:android="http://schemas.android.com/apk/res/android" xmlns:aapt="http://schemas.android.com/aapt"><aapt:attr name="android:drawable"><vector android:height="24dp" android:width="24dp" android:viewportHeight="24" android:viewportWidth="24"><group android:name="_R_G"><group android:name="_R_G_L_2_G_T_1" android:translateX="12" android:translateY="15"><group android:name="_R_G_L_2_G" android:translateX="-8.25" android:translateY="-7.25"><path android:name="_R_G_L_2_G_D_0_P_0" android:fillColor="?attr/textColor" android:fillAlpha="1" android:fillType="nonZero" android:pathData=" M14.25 0.25 C14.25,0.25 12.75,0.25 12.75,0.25 C12.75,0.25 10.75,0.25 10.75,0.25 C10.75,0.25 5.75,0.25 5.75,0.25 C5.75,0.25 3.75,0.25 3.75,0.25 C3.75,0.25 2.25,0.25 2.25,0.25 C1.15,0.25 0.25,1.15 0.25,2.25 C0.25,2.25 0.25,12.25 0.25,12.25 C0.25,13.35 1.15,14.25 2.25,14.25 C2.25,14.25 14.25,14.25 14.25,14.25 C15.35,14.25 16.25,13.35 16.25,12.25 C16.25,12.25 16.25,2.25 16.25,2.25 C16.25,1.15 15.35,0.25 14.25,0.25c  M14.25 12.25 C14.25,12.25 2.25,12.25 2.25,12.25 C2.25,12.25 2.25,2.25 2.25,2.25 C2.25,2.25 3.75,2.25 3.75,2.25 C3.75,2.25 12.75,2.25 12.75,2.25 C12.75,2.25 14.25,2.25 14.25,2.25 C14.25,2.25 14.25,12.25 14.25,12.25c "/></group></group><group android:name="_R_G_L_1_G_N_5_T_1" android:translateX="12" android:translateY="15"><group android:name="_R_G_L_1_G_N_5_T_0" android:translateX="-8.25" android:translateY="-7.25"><group android:name="_R_G_L_1_G" android:translateX="6" android:translateY="5" android:pivotX="2.25" android:pivotY="2.25" android:scaleX="1" android:scaleY="1"><path android:name="_R_G_L_1_G_D_0_P_0" android:fillColor="?attr/textColor" android:fillAlpha="1" android:fillType="nonZero" android:pathData=" M2.25 0.25 C3.35,0.25 4.25,1.15 4.25,2.25 C4.25,3.35 3.35,4.25 2.25,4.25 C1.15,4.25 0.25,3.35 0.25,2.25 C0.25,1.15 1.15,0.25 2.25,0.25c "/></group></group></group><group android:name="_R_G_L_0_G_N_5_T_1" android:translateX="12" android:translateY="15"><group android:name="_R_G_L_0_G_N_5_T_0" android:translateX="-8.25" android:translateY="-7.25"><group android:name="_R_G_L_0_G" android:translateX="-16.219" android:translateY="32.25" android:pivotX="27.965" android:pivotY="-32" android:scaleX="0.125" android:scaleY="0.125"><path android:name="_R_G_L_0_G_D_0_P_0" android:fillColor="#ff0000" android:fillAlpha="0" android:fillType="nonZero" android:pathData=" M79.79 -48.55 C79.79,-48.55 79.75,-53.75 79.78,-55.48 C79.83,-57.62 79.08,-78.36 53.07,-78.83 C29.5,-79.25 25.2,-59.38 25.22,-58.27 C25.25,-56.25 24.97,-31.17 24.97,-31.17 "/><path android:name="_R_G_L_0_G_D_1_P_0" android:strokeColor="?attr/textColor" android:strokeLineCap="round" android:strokeLineJoin="round" android:strokeWidth="16" android:strokeAlpha="1" android:pathData=" M79.79 -48.55 C79.79,-48.55 79.75,-53.75 79.78,-55.48 C79.83,-57.62 79.08,-78.36 53.07,-78.83 C29.5,-79.25 25.2,-59.38 25.22,-58.27 C25.25,-56.25 24.97,-31.17 24.97,-31.17 "/></group></group></group></group><group android:name="time_group"/></vector></aapt:attr><target android:name="_R_G_L_2_G_T_1"><aapt:attr name="android:animation"><set android:ordering="together"><objectAnimator android:propertyName="translateXY" android:duration="400" android:startOffset="0" android:propertyXName="translateX" android:propertyYName="translateY" android:pathData="M 12,15C 12,15.09895833581686 12,15 12,15"><aapt:attr name="android:interpolator"><pathInterpolator android:pathData="M 0.0,0.0 c0.333,0 0.667,1 1.0,1.0"/></aapt:attr></objectAnimator><objectAnimator android:propertyName="translateXY" android:duration="67" android:startOffset="400" android:propertyXName="translateX" android:propertyYName="translateY" android:pathData="M 12,15C 12,15.09895833581686 12,15.594 12,15.594"><aapt:attr name="android:interpolator"><pathInterpolator android:pathData="M 0.0,0.0 c0.333,0 0.667,1 1.0,1.0"/></aapt:attr></objectAnimator><objectAnimator android:propertyName="translateXY" android:duration="83" android:startOffset="467" android:propertyXName="translateX" android:propertyYName="translateY" android:pathData="M 12,15.594C 12,15.594 12,15.09895833581686 12,15"><aapt:attr name="android:interpolator"><pathInterpolator android:pathData="M 0.0,0.0 c0.333,0 0.667,1 1.0,1.0"/></aapt:attr></objectAnimator></set></aapt:attr></target><target android:name="_R_G_L_1_G"><aapt:attr name="android:animation"><set android:ordering="together"><objectAnimator android:propertyName="scaleX" android:duration="450" android:startOffset="0" android:valueFrom="1" android:valueTo="1" android:valueType="floatType"><aapt:attr name="android:interpolator"><pathInterpolator android:pathData="M 0.0,0.0 c0.333,0 0.667,1 1.0,1.0"/></aapt:attr></objectAnimator><objectAnimator android:propertyName="scaleY" android:duration="450" android:startOffset="0" android:valueFrom="1" android:valueTo="1" android:valueType="floatType"><aapt:attr name="android:interpolator"><pathInterpolator android:pathData="M 0.0,0.0 c0.333,0 0.667,1 1.0,1.0"/></aapt:attr></objectAnimator><objectAnimator android:propertyName="scaleX" android:duration="67" android:startOffset="450" android:valueFrom="1" android:valueTo="1.1" android:valueType="floatType"><aapt:attr name="android:interpolator"><pathInterpolator android:pathData="M 0.0,0.0 c0.333,0 0.667,1 1.0,1.0"/></aapt:attr></objectAnimator><objectAnimator android:propertyName="scaleY" android:duration="67" android:startOffset="450" android:valueFrom="1" android:valueTo="1.1" android:valueType="floatType"><aapt:attr name="android:interpolator"><pathInterpolator android:pathData="M 0.0,0.0 c0.333,0 0.667,1 1.0,1.0"/></aapt:attr></objectAnimator><objectAnimator android:propertyName="scaleX" android:duration="183" android:startOffset="517" android:valueFrom="1.1" android:valueTo="1" android:valueType="floatType"><aapt:attr name="android:interpolator"><pathInterpolator android:pathData="M 0.0,0.0 c0.333,0 0.667,1 1.0,1.0"/></aapt:attr></objectAnimator><objectAnimator android:propertyName="scaleY" android:duration="183" android:startOffset="517" android:valueFrom="1.1" android:valueTo="1" android:valueType="floatType"><aapt:attr name="android:interpolator"><pathInterpolator android:pathData="M 0.0,0.0 c0.333,0 0.667,1 1.0,1.0"/></aapt:attr></objectAnimator></set></aapt:attr></target><target android:name="_R_G_L_1_G_N_5_T_1"><aapt:attr name="android:animation"><set android:ordering="together"><objectAnimator android:propertyName="translateXY" android:duration="400" android:startOffset="0" android:propertyXName="translateX" android:propertyYName="translateY" android:pathData="M 12,15C 12,15.09895833581686 12,15 12,15"><aapt:attr name="android:interpolator"><pathInterpolator android:pathData="M 0.0,0.0 c0.333,0 0.667,1 1.0,1.0"/></aapt:attr></objectAnimator><objectAnimator android:propertyName="translateXY" android:duration="67" android:startOffset="400" android:propertyXName="translateX" android:propertyYName="translateY" android:pathData="M 12,15C 12,15.09895833581686 12,15.594 12,15.594"><aapt:attr name="android:interpolator"><pathInterpolator android:pathData="M 0.0,0.0 c0.333,0 0.667,1 1.0,1.0"/></aapt:attr></objectAnimator><objectAnimator android:propertyName="translateXY" android:duration="83" android:startOffset="467" android:propertyXName="translateX" android:propertyYName="translateY" android:pathData="M 12,15.594C 12,15.594 12,15.09895833581686 12,15"><aapt:attr name="android:interpolator"><pathInterpolator android:pathData="M 0.0,0.0 c0.333,0 0.667,1 1.0,1.0"/></aapt:attr></objectAnimator></set></aapt:attr></target><target android:name="_R_G_L_0_G_D_0_P_0"><aapt:attr name="android:animation"><set android:ordering="together"><objectAnimator android:propertyName="pathData" android:duration="317" android:startOffset="0" android:valueFrom="M79.79 -48.55 C79.79,-48.55 79.75,-53.75 79.78,-55.48 C79.83,-57.62 79.08,-78.36 53.07,-78.83 C29.5,-79.25 25.2,-59.38 25.22,-58.27 C25.25,-56.25 24.97,-31.17 24.97,-31.17 " android:valueTo="M-27.97 -55.05 C-27.97,-55.05 -28,-60.25 -27.97,-61.98 C-27.92,-64.13 -23.5,-86.37 -0.75,-86.32 C22.77,-86.26 27.75,-65.87 27.72,-64.77 C27.55,-59.38 27.97,-31.67 27.97,-31.67 " android:valueType="pathType"><aapt:attr name="android:interpolator"><pathInterpolator android:pathData="M 0.0,0.0 c0.974,0 0.458,1 1.0,1.0"/></aapt:attr></objectAnimator><objectAnimator android:propertyName="pathData" android:duration="133" android:startOffset="317" android:valueFrom="M-27.97 -55.05 C-27.97,-55.05 -28,-60.25 -27.97,-61.98 C-27.92,-64.13 -23.5,-86.37 -0.75,-86.32 C22.77,-86.26 27.75,-65.87 27.72,-64.77 C27.55,-59.38 27.97,-31.67 27.97,-31.67 " android:valueTo="M-28.21 -28.42 C-28.21,-28.42 -27.85,-44.88 -27.97,-51.98 C-28,-54.13 -23.5,-76.37 -0.75,-76.32 C22.77,-76.26 27.75,-55.87 27.72,-54.77 C27.55,-49.38 27.97,-28.17 27.97,-28.17 " android:valueType="pathType"><aapt:attr name="android:interpolator"><pathInterpolator android:pathData="M 0.0,0.0 c0.4,0 0.2,1 1.0,1.0"/></aapt:attr></objectAnimator><objectAnimator android:propertyName="pathData" android:duration="250" android:startOffset="450" android:valueFrom="M-28.21 -28.42 C-28.21,-28.42 -27.85,-44.88 -27.97,-51.98 C-28,-54.13 -23.5,-76.37 -0.75,-76.32 C22.77,-76.26 27.75,-55.87 27.72,-54.77 C27.55,-49.38 27.97,-28.17 27.97,-28.17 " android:valueTo="M-28.21 -31.92 C-28.21,-31.92 -27.85,-48.38 -27.97,-55.48 C-28,-57.63 -23.5,-79.87 -0.75,-79.82 C22.77,-79.76 27.75,-59.37 27.72,-58.27 C27.55,-52.88 27.97,-31.67 27.97,-31.67 " android:valueType="pathType"><aapt:attr name="android:interpolator"><pathInterpolator android:pathData="M 0.0,0.0 c0.414,0 0.647,1 1.0,1.0"/></aapt:attr></objectAnimator></set></aapt:attr></target><target android:name="_R_G_L_0_G_D_1_P_0"><aapt:attr name="android:animation"><set android:ordering="together"><objectAnimator android:propertyName="pathData" android:duration="317" android:startOffset="0" android:valueFrom="M79.79 -48.55 C79.79,-48.55 79.75,-53.75 79.78,-55.48 C79.83,-57.62 79.08,-78.36 53.07,-78.83 C29.5,-79.25 25.2,-59.38 25.22,-58.27 C25.25,-56.25 24.97,-31.17 24.97,-31.17 " android:valueTo="M-27.97 -55.05 C-27.97,-55.05 -28,-60.25 -27.97,-61.98 C-27.92,-64.13 -23.5,-86.37 -0.75,-86.32 C22.77,-86.26 27.75,-65.87 27.72,-64.77 C27.55,-59.38 27.97,-31.67 27.97,-31.67 " android:valueType="pathType"><aapt:attr name="android:interpolator"><pathInterpolator android:pathData="M 0.0,0.0 c0.974,0 0.458,1 1.0,1.0"/></aapt:attr></objectAnimator><objectAnimator android:propertyName="pathData" android:duration="133" android:startOffset="317" android:valueFrom="M-27.97 -55.05 C-27.97,-55.05 -28,-60.25 -27.97,-61.98 C-27.92,-64.13 -23.5,-86.37 -0.75,-86.32 C22.77,-86.26 27.75,-65.87 27.72,-64.77 C27.55,-59.38 27.97,-31.67 27.97,-31.67 " android:valueTo="M-28.21 -28.42 C-28.21,-28.42 -27.85,-44.88 -27.97,-51.98 C-28,-54.13 -23.5,-76.37 -0.75,-76.32 C22.77,-76.26 27.75,-55.87 27.72,-54.77 C27.55,-49.38 27.97,-28.17 27.97,-28.17 " android:valueType="pathType"><aapt:attr name="android:interpolator"><pathInterpolator android:pathData="M 0.0,0.0 c0.4,0 0.2,1 1.0,1.0"/></aapt:attr></objectAnimator><objectAnimator android:propertyName="pathData" android:duration="250" android:startOffset="450" android:valueFrom="M-28.21 -28.42 C-28.21,-28.42 -27.85,-44.88 -27.97,-51.98 C-28,-54.13 -23.5,-76.37 -0.75,-76.32 C22.77,-76.26 27.75,-55.87 27.72,-54.77 C27.55,-49.38 27.97,-28.17 27.97,-28.17 " android:valueTo="M-28.21 -31.92 C-28.21,-31.92 -27.85,-48.38 -27.97,-55.48 C-28,-57.63 -23.5,-79.87 -0.75,-79.82 C22.77,-79.76 27.75,-59.37 27.72,-58.27 C27.55,-52.88 27.97,-31.67 27.97,-31.67 " android:valueType="pathType"><aapt:attr name="android:interpolator"><pathInterpolator android:pathData="M 0.0,0.0 c0.414,0 0.647,1 1.0,1.0"/></aapt:attr></objectAnimator></set></aapt:attr></target><target android:name="_R_G_L_0_G_N_5_T_1"><aapt:attr name="android:animation"><set android:ordering="together"><objectAnimator android:propertyName="translateXY" android:duration="400" android:startOffset="0" android:propertyXName="translateX" android:propertyYName="translateY" android:pathData="M 12,15C 12,15.09895833581686 12,15 12,15"><aapt:attr name="android:interpolator"><pathInterpolator android:pathData="M 0.0,0.0 c0.333,0 0.667,1 1.0,1.0"/></aapt:attr></objectAnimator><objectAnimator android:propertyName="translateXY" android:duration="67" android:startOffset="400" android:propertyXName="translateX" android:propertyYName="translateY" android:pathData="M 12,15C 12,15.09895833581686 12,15.594 12,15.594"><aapt:attr name="android:interpolator"><pathInterpolator android:pathData="M 0.0,0.0 c0.333,0 0.667,1 1.0,1.0"/></aapt:attr></objectAnimator><objectAnimator android:propertyName="translateXY" android:duration="83" android:startOffset="467" android:propertyXName="translateX" android:propertyYName="translateY" android:pathData="M 12,15.594C 12,15.594 12,15.09895833581686 12,15"><aapt:attr name="android:interpolator"><pathInterpolator android:pathData="M 0.0,0.0 c0.333,0 0.667,1 1.0,1.0"/></aapt:attr></objectAnimator></set></aapt:attr></target><target android:name="time_group"><aapt:attr name="android:animation"><set android:ordering="together"><objectAnimator android:propertyName="translateX" android:duration="717" android:startOffset="0" android:valueFrom="0" android:valueTo="1" android:valueType="floatType"/></set></aapt:attr></target></animated-vector>
\ No newline at end of file
+<animated-vector xmlns:android="http://schemas.android.com/apk/res/android"
+                 xmlns:aapt="http://schemas.android.com/aapt">
+    <aapt:attr name="android:drawable">
+        <vector android:height="32dp" android:width="32dp" android:viewportHeight="32"
+                android:viewportWidth="32">
+            <group android:name="_R_G">
+                <group android:name="_R_G_L_2_G_N_1_T_0" android:translateX="16"
+                       android:translateY="16" android:scaleX="1.3" android:scaleY="1.3">
+                    <group android:name="_R_G_L_2_G_T_1" android:translateX="0"
+                           android:translateY="3">
+                        <group android:name="_R_G_L_2_G" android:translateX="-8.25"
+                               android:translateY="-7.25">
+                            <path android:name="_R_G_L_2_G_D_0_P_0" android:fillColor="?attr/textColor"
+                                  android:fillAlpha="1" android:fillType="nonZero"
+                                  android:pathData=" M14.25 0.25 C14.25,0.25 12.75,0.25 12.75,0.25 C12.75,0.25 10.75,0.25 10.75,0.25 C10.75,0.25 5.75,0.25 5.75,0.25 C5.75,0.25 3.75,0.25 3.75,0.25 C3.75,0.25 2.25,0.25 2.25,0.25 C1.15,0.25 0.25,1.15 0.25,2.25 C0.25,2.25 0.25,12.25 0.25,12.25 C0.25,13.35 1.15,14.25 2.25,14.25 C2.25,14.25 14.25,14.25 14.25,14.25 C15.35,14.25 16.25,13.35 16.25,12.25 C16.25,12.25 16.25,2.25 16.25,2.25 C16.25,1.15 15.35,0.25 14.25,0.25c  M14.25 12.25 C14.25,12.25 2.25,12.25 2.25,12.25 C2.25,12.25 2.25,2.25 2.25,2.25 C2.25,2.25 3.75,2.25 3.75,2.25 C3.75,2.25 12.75,2.25 12.75,2.25 C12.75,2.25 14.25,2.25 14.25,2.25 C14.25,2.25 14.25,12.25 14.25,12.25c "/>
+                        </group>
+                    </group>
+                </group>
+                <group android:name="_R_G_L_1_G_N_4_N_1_T_0" android:translateX="16"
+                       android:translateY="16" android:scaleX="1.3" android:scaleY="1.3">
+                    <group android:name="_R_G_L_1_G_N_4_T_1" android:translateX="0"
+                           android:translateY="3">
+                        <group android:name="_R_G_L_1_G_N_4_T_0" android:translateX="-8.25"
+                               android:translateY="-7.25">
+                            <group android:name="_R_G_L_1_G" android:translateX="6"
+                                   android:translateY="5" android:pivotX="2.25"
+                                   android:pivotY="2.25" android:scaleX="1" android:scaleY="1">
+                                <path android:name="_R_G_L_1_G_D_0_P_0" android:fillColor="?attr/textColor"
+                                      android:fillAlpha="1" android:fillType="nonZero"
+                                      android:pathData=" M2.25 0.25 C3.35,0.25 4.25,1.15 4.25,2.25 C4.25,3.35 3.35,4.25 2.25,4.25 C1.15,4.25 0.25,3.35 0.25,2.25 C0.25,1.15 1.15,0.25 2.25,0.25c "/>
+                            </group>
+                        </group>
+                    </group>
+                </group>
+                <group android:name="_R_G_L_0_G_N_4_N_1_T_0" android:translateX="16"
+                       android:translateY="16" android:scaleX="1.3" android:scaleY="1.3">
+                    <group android:name="_R_G_L_0_G_N_4_T_1" android:translateX="0"
+                           android:translateY="3">
+                        <group android:name="_R_G_L_0_G_N_4_T_0" android:translateX="-8.25"
+                               android:translateY="-7.25">
+                            <group android:name="_R_G_L_0_G" android:translateX="-16.219"
+                                   android:translateY="32.25" android:pivotX="27.965"
+                                   android:pivotY="-32" android:scaleX="0.125"
+                                   android:scaleY="0.125">
+                                <path android:name="_R_G_L_0_G_D_0_P_0" android:fillColor="#ff0000"
+                                      android:fillAlpha="0" android:fillType="nonZero"
+                                      android:pathData=" M79.79 -48.55 C79.79,-48.55 79.75,-53.75 79.78,-55.48 C79.83,-57.62 79.08,-78.36 53.07,-78.83 C29.5,-79.25 25.2,-59.38 25.22,-58.27 C25.25,-56.25 24.97,-31.17 24.97,-31.17 "/>
+                                <path android:name="_R_G_L_0_G_D_1_P_0"
+                                      android:strokeColor="?attr/textColor" android:strokeLineCap="round"
+                                      android:strokeLineJoin="round" android:strokeWidth="16"
+                                      android:strokeAlpha="1"
+                                      android:pathData=" M79.79 -48.55 C79.79,-48.55 79.75,-53.75 79.78,-55.48 C79.83,-57.62 79.08,-78.36 53.07,-78.83 C29.5,-79.25 25.2,-59.38 25.22,-58.27 C25.25,-56.25 24.97,-31.17 24.97,-31.17 "/>
+                            </group>
+                        </group>
+                    </group>
+                </group>
+            </group>
+            <group android:name="time_group"/>
+        </vector>
+    </aapt:attr>
+    <target android:name="_R_G_L_2_G_T_1">
+        <aapt:attr name="android:animation">
+            <set android:ordering="together">
+                <objectAnimator android:propertyName="translateXY" android:duration="400"
+                                android:startOffset="0" android:propertyXName="translateX"
+                                android:propertyYName="translateY"
+                                android:pathData="M 0,3C 0,3.09895833581686 0,3 0,3">
+                    <aapt:attr name="android:interpolator">
+                        <pathInterpolator android:pathData="M 0.0,0.0 c0.333,0 0.667,1 1.0,1.0"/>
+                    </aapt:attr>
+                </objectAnimator>
+                <objectAnimator android:propertyName="translateXY" android:duration="67"
+                                android:startOffset="400" android:propertyXName="translateX"
+                                android:propertyYName="translateY"
+                                android:pathData="M 0,3C 0,3.09895833581686 0,3.594 0,3.594">
+                    <aapt:attr name="android:interpolator">
+                        <pathInterpolator android:pathData="M 0.0,0.0 c0.333,0 0.667,1 1.0,1.0"/>
+                    </aapt:attr>
+                </objectAnimator>
+                <objectAnimator android:propertyName="translateXY" android:duration="83"
+                                android:startOffset="467" android:propertyXName="translateX"
+                                android:propertyYName="translateY"
+                                android:pathData="M 0,3.594C 0,3.594 0,3.09895833581686 0,3">
+                    <aapt:attr name="android:interpolator">
+                        <pathInterpolator android:pathData="M 0.0,0.0 c0.333,0 0.667,1 1.0,1.0"/>
+                    </aapt:attr>
+                </objectAnimator>
+            </set>
+        </aapt:attr>
+    </target>
+    <target android:name="_R_G_L_1_G">
+        <aapt:attr name="android:animation">
+            <set android:ordering="together">
+                <objectAnimator android:propertyName="scaleX" android:duration="450"
+                                android:startOffset="0" android:valueFrom="1" android:valueTo="1"
+                                android:valueType="floatType">
+                    <aapt:attr name="android:interpolator">
+                        <pathInterpolator android:pathData="M 0.0,0.0 c0.333,0 0.667,1 1.0,1.0"/>
+                    </aapt:attr>
+                </objectAnimator>
+                <objectAnimator android:propertyName="scaleY" android:duration="450"
+                                android:startOffset="0" android:valueFrom="1" android:valueTo="1"
+                                android:valueType="floatType">
+                    <aapt:attr name="android:interpolator">
+                        <pathInterpolator android:pathData="M 0.0,0.0 c0.333,0 0.667,1 1.0,1.0"/>
+                    </aapt:attr>
+                </objectAnimator>
+                <objectAnimator android:propertyName="scaleX" android:duration="67"
+                                android:startOffset="450" android:valueFrom="1"
+                                android:valueTo="1.1" android:valueType="floatType">
+                    <aapt:attr name="android:interpolator">
+                        <pathInterpolator android:pathData="M 0.0,0.0 c0.333,0 0.667,1 1.0,1.0"/>
+                    </aapt:attr>
+                </objectAnimator>
+                <objectAnimator android:propertyName="scaleY" android:duration="67"
+                                android:startOffset="450" android:valueFrom="1"
+                                android:valueTo="1.1" android:valueType="floatType">
+                    <aapt:attr name="android:interpolator">
+                        <pathInterpolator android:pathData="M 0.0,0.0 c0.333,0 0.667,1 1.0,1.0"/>
+                    </aapt:attr>
+                </objectAnimator>
+                <objectAnimator android:propertyName="scaleX" android:duration="183"
+                                android:startOffset="517" android:valueFrom="1.1"
+                                android:valueTo="1" android:valueType="floatType">
+                    <aapt:attr name="android:interpolator">
+                        <pathInterpolator android:pathData="M 0.0,0.0 c0.333,0 0.667,1 1.0,1.0"/>
+                    </aapt:attr>
+                </objectAnimator>
+                <objectAnimator android:propertyName="scaleY" android:duration="183"
+                                android:startOffset="517" android:valueFrom="1.1"
+                                android:valueTo="1" android:valueType="floatType">
+                    <aapt:attr name="android:interpolator">
+                        <pathInterpolator android:pathData="M 0.0,0.0 c0.333,0 0.667,1 1.0,1.0"/>
+                    </aapt:attr>
+                </objectAnimator>
+            </set>
+        </aapt:attr>
+    </target>
+    <target android:name="_R_G_L_1_G_N_4_T_1">
+        <aapt:attr name="android:animation">
+            <set android:ordering="together">
+                <objectAnimator android:propertyName="translateXY" android:duration="400"
+                                android:startOffset="0" android:propertyXName="translateX"
+                                android:propertyYName="translateY"
+                                android:pathData="M 0,3C 0,3.09895833581686 0,3 0,3">
+                    <aapt:attr name="android:interpolator">
+                        <pathInterpolator android:pathData="M 0.0,0.0 c0.333,0 0.667,1 1.0,1.0"/>
+                    </aapt:attr>
+                </objectAnimator>
+                <objectAnimator android:propertyName="translateXY" android:duration="67"
+                                android:startOffset="400" android:propertyXName="translateX"
+                                android:propertyYName="translateY"
+                                android:pathData="M 0,3C 0,3.09895833581686 0,3.594 0,3.594">
+                    <aapt:attr name="android:interpolator">
+                        <pathInterpolator android:pathData="M 0.0,0.0 c0.333,0 0.667,1 1.0,1.0"/>
+                    </aapt:attr>
+                </objectAnimator>
+                <objectAnimator android:propertyName="translateXY" android:duration="83"
+                                android:startOffset="467" android:propertyXName="translateX"
+                                android:propertyYName="translateY"
+                                android:pathData="M 0,3.594C 0,3.594 0,3.09895833581686 0,3">
+                    <aapt:attr name="android:interpolator">
+                        <pathInterpolator android:pathData="M 0.0,0.0 c0.333,0 0.667,1 1.0,1.0"/>
+                    </aapt:attr>
+                </objectAnimator>
+            </set>
+        </aapt:attr>
+    </target>
+    <target android:name="_R_G_L_0_G_D_0_P_0">
+        <aapt:attr name="android:animation">
+            <set android:ordering="together">
+                <objectAnimator android:propertyName="pathData" android:duration="317"
+                                android:startOffset="0"
+                                android:valueFrom="M79.79 -48.55 C79.79,-48.55 79.75,-53.75 79.78,-55.48 C79.83,-57.62 79.08,-78.36 53.07,-78.83 C29.5,-79.25 25.2,-59.38 25.22,-58.27 C25.25,-56.25 24.97,-31.17 24.97,-31.17 "
+                                android:valueTo="M-27.97 -55.05 C-27.97,-55.05 -28,-60.25 -27.97,-61.98 C-27.92,-64.13 -23.5,-86.37 -0.75,-86.32 C22.77,-86.26 27.75,-65.87 27.72,-64.77 C27.55,-59.38 27.97,-31.67 27.97,-31.67 "
+                                android:valueType="pathType">
+                    <aapt:attr name="android:interpolator">
+                        <pathInterpolator android:pathData="M 0.0,0.0 c0.974,0 0.458,1 1.0,1.0"/>
+                    </aapt:attr>
+                </objectAnimator>
+                <objectAnimator android:propertyName="pathData" android:duration="133"
+                                android:startOffset="317"
+                                android:valueFrom="M-27.97 -55.05 C-27.97,-55.05 -28,-60.25 -27.97,-61.98 C-27.92,-64.13 -23.5,-86.37 -0.75,-86.32 C22.77,-86.26 27.75,-65.87 27.72,-64.77 C27.55,-59.38 27.97,-31.67 27.97,-31.67 "
+                                android:valueTo="M-28.21 -28.42 C-28.21,-28.42 -27.85,-44.88 -27.97,-51.98 C-28,-54.13 -23.5,-76.37 -0.75,-76.32 C22.77,-76.26 27.75,-55.87 27.72,-54.77 C27.55,-49.38 27.97,-28.17 27.97,-28.17 "
+                                android:valueType="pathType">
+                    <aapt:attr name="android:interpolator">
+                        <pathInterpolator android:pathData="M 0.0,0.0 c0.4,0 0.2,1 1.0,1.0"/>
+                    </aapt:attr>
+                </objectAnimator>
+                <objectAnimator android:propertyName="pathData" android:duration="250"
+                                android:startOffset="450"
+                                android:valueFrom="M-28.21 -28.42 C-28.21,-28.42 -27.85,-44.88 -27.97,-51.98 C-28,-54.13 -23.5,-76.37 -0.75,-76.32 C22.77,-76.26 27.75,-55.87 27.72,-54.77 C27.55,-49.38 27.97,-28.17 27.97,-28.17 "
+                                android:valueTo="M-28.21 -31.92 C-28.21,-31.92 -27.85,-48.38 -27.97,-55.48 C-28,-57.63 -23.5,-79.87 -0.75,-79.82 C22.77,-79.76 27.75,-59.37 27.72,-58.27 C27.55,-52.88 27.97,-31.67 27.97,-31.67 "
+                                android:valueType="pathType">
+                    <aapt:attr name="android:interpolator">
+                        <pathInterpolator android:pathData="M 0.0,0.0 c0.414,0 0.647,1 1.0,1.0"/>
+                    </aapt:attr>
+                </objectAnimator>
+            </set>
+        </aapt:attr>
+    </target>
+    <target android:name="_R_G_L_0_G_D_1_P_0">
+        <aapt:attr name="android:animation">
+            <set android:ordering="together">
+                <objectAnimator android:propertyName="pathData" android:duration="317"
+                                android:startOffset="0"
+                                android:valueFrom="M79.79 -48.55 C79.79,-48.55 79.75,-53.75 79.78,-55.48 C79.83,-57.62 79.08,-78.36 53.07,-78.83 C29.5,-79.25 25.2,-59.38 25.22,-58.27 C25.25,-56.25 24.97,-31.17 24.97,-31.17 "
+                                android:valueTo="M-27.97 -55.05 C-27.97,-55.05 -28,-60.25 -27.97,-61.98 C-27.92,-64.13 -23.5,-86.37 -0.75,-86.32 C22.77,-86.26 27.75,-65.87 27.72,-64.77 C27.55,-59.38 27.97,-31.67 27.97,-31.67 "
+                                android:valueType="pathType">
+                    <aapt:attr name="android:interpolator">
+                        <pathInterpolator android:pathData="M 0.0,0.0 c0.974,0 0.458,1 1.0,1.0"/>
+                    </aapt:attr>
+                </objectAnimator>
+                <objectAnimator android:propertyName="pathData" android:duration="133"
+                                android:startOffset="317"
+                                android:valueFrom="M-27.97 -55.05 C-27.97,-55.05 -28,-60.25 -27.97,-61.98 C-27.92,-64.13 -23.5,-86.37 -0.75,-86.32 C22.77,-86.26 27.75,-65.87 27.72,-64.77 C27.55,-59.38 27.97,-31.67 27.97,-31.67 "
+                                android:valueTo="M-28.21 -28.42 C-28.21,-28.42 -27.85,-44.88 -27.97,-51.98 C-28,-54.13 -23.5,-76.37 -0.75,-76.32 C22.77,-76.26 27.75,-55.87 27.72,-54.77 C27.55,-49.38 27.97,-28.17 27.97,-28.17 "
+                                android:valueType="pathType">
+                    <aapt:attr name="android:interpolator">
+                        <pathInterpolator android:pathData="M 0.0,0.0 c0.4,0 0.2,1 1.0,1.0"/>
+                    </aapt:attr>
+                </objectAnimator>
+                <objectAnimator android:propertyName="pathData" android:duration="250"
+                                android:startOffset="450"
+                                android:valueFrom="M-28.21 -28.42 C-28.21,-28.42 -27.85,-44.88 -27.97,-51.98 C-28,-54.13 -23.5,-76.37 -0.75,-76.32 C22.77,-76.26 27.75,-55.87 27.72,-54.77 C27.55,-49.38 27.97,-28.17 27.97,-28.17 "
+                                android:valueTo="M-28.21 -31.92 C-28.21,-31.92 -27.85,-48.38 -27.97,-55.48 C-28,-57.63 -23.5,-79.87 -0.75,-79.82 C22.77,-79.76 27.75,-59.37 27.72,-58.27 C27.55,-52.88 27.97,-31.67 27.97,-31.67 "
+                                android:valueType="pathType">
+                    <aapt:attr name="android:interpolator">
+                        <pathInterpolator android:pathData="M 0.0,0.0 c0.414,0 0.647,1 1.0,1.0"/>
+                    </aapt:attr>
+                </objectAnimator>
+            </set>
+        </aapt:attr>
+    </target>
+    <target android:name="_R_G_L_0_G_N_4_T_1">
+        <aapt:attr name="android:animation">
+            <set android:ordering="together">
+                <objectAnimator android:propertyName="translateXY" android:duration="400"
+                                android:startOffset="0" android:propertyXName="translateX"
+                                android:propertyYName="translateY"
+                                android:pathData="M 0,3C 0,3.09895833581686 0,3 0,3">
+                    <aapt:attr name="android:interpolator">
+                        <pathInterpolator android:pathData="M 0.0,0.0 c0.333,0 0.667,1 1.0,1.0"/>
+                    </aapt:attr>
+                </objectAnimator>
+                <objectAnimator android:propertyName="translateXY" android:duration="67"
+                                android:startOffset="400" android:propertyXName="translateX"
+                                android:propertyYName="translateY"
+                                android:pathData="M 0,3C 0,3.09895833581686 0,3.594 0,3.594">
+                    <aapt:attr name="android:interpolator">
+                        <pathInterpolator android:pathData="M 0.0,0.0 c0.333,0 0.667,1 1.0,1.0"/>
+                    </aapt:attr>
+                </objectAnimator>
+                <objectAnimator android:propertyName="translateXY" android:duration="83"
+                                android:startOffset="467" android:propertyXName="translateX"
+                                android:propertyYName="translateY"
+                                android:pathData="M 0,3.594C 0,3.594 0,3.09895833581686 0,3">
+                    <aapt:attr name="android:interpolator">
+                        <pathInterpolator android:pathData="M 0.0,0.0 c0.333,0 0.667,1 1.0,1.0"/>
+                    </aapt:attr>
+                </objectAnimator>
+            </set>
+        </aapt:attr>
+    </target>
+    <target android:name="time_group">
+        <aapt:attr name="android:animation">
+            <set android:ordering="together">
+                <objectAnimator android:propertyName="translateX" android:duration="717"
+                                android:startOffset="0" android:valueFrom="0" android:valueTo="1"
+                                android:valueType="floatType"/>
+            </set>
+        </aapt:attr>
+    </target>
+</animated-vector>
\ No newline at end of file
diff --git a/core/res/res/anim/lock_scanning.xml b/core/res/res/anim/lock_scanning.xml
new file mode 100644
index 0000000..998c965
--- /dev/null
+++ b/core/res/res/anim/lock_scanning.xml
@@ -0,0 +1,378 @@
+<!--
+     Copyright (C) 2019 The Android Open Source Project
+
+     Licensed under the Apache License, Version 2.0 (the "License");
+     you may not use this file except in compliance with the License.
+     You may obtain a copy of the License at
+
+          http://www.apache.org/licenses/LICENSE-2.0
+
+     Unless required by applicable law or agreed to in writing, software
+     distributed under the License is distributed on an "AS IS" BASIS,
+     WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+     See the License for the specific language governing permissions and
+     limitations under the License.
+-->
+<animated-vector xmlns:android="http://schemas.android.com/apk/res/android"
+                 xmlns:aapt="http://schemas.android.com/aapt">
+    <aapt:attr name="android:drawable">
+        <vector android:height="42dp" android:width="32dp" android:viewportHeight="42"
+                android:viewportWidth="32">
+            <group android:name="_R_G">
+                <group android:name="_R_G_L_2_G_N_5_N_1_T_0" android:translateY="5"
+                       android:pivotX="16" android:pivotY="16" android:scaleX="2"
+                       android:scaleY="2">
+                    <group android:name="_R_G_L_2_G_N_5_T_0" android:translateX="7.75"
+                           android:translateY="10.670000000000002" android:pivotX="8.25"
+                           android:pivotY="7.25" android:scaleX="0.64" android:scaleY="0.64">
+                        <group android:name="_R_G_L_2_G" android:translateX="6"
+                               android:translateY="5" android:pivotX="2.25" android:pivotY="2.25"
+                               android:scaleX="1" android:scaleY="1">
+                            <path android:name="_R_G_L_2_G_D_0_P_0" android:fillColor="?attr/textColor"
+                                  android:fillAlpha="1" android:fillType="nonZero"
+                                  android:pathData=" M2.25 0.25 C3.35,0.25 4.25,1.15 4.25,2.25 C4.25,3.35 3.35,4.25 2.25,4.25 C1.15,4.25 0.25,3.35 0.25,2.25 C0.25,1.15 1.15,0.25 2.25,0.25c "/>
+                        </group>
+                    </group>
+                </group>
+                <group android:name="_R_G_L_1_G_N_5_N_1_T_0" android:translateY="5"
+                       android:pivotX="16" android:pivotY="16" android:scaleX="2"
+                       android:scaleY="2">
+                    <group android:name="_R_G_L_1_G_N_5_T_0" android:translateX="7.75"
+                           android:translateY="10.670000000000002" android:pivotX="8.25"
+                           android:pivotY="7.25" android:scaleX="0.64" android:scaleY="0.64">
+                        <group android:name="_R_G_L_1_G_T_1" android:translateX="8.25"
+                               android:translateY="1.121" android:scaleX="0.125"
+                               android:scaleY="0.125">
+                            <group android:name="_R_G_L_1_G" android:translateY="25.029">
+                                <path android:name="_R_G_L_1_G_D_0_P_0"
+                                      android:strokeColor="?attr/textColor" android:strokeLineCap="round"
+                                      android:strokeLineJoin="round" android:strokeWidth="16"
+                                      android:strokeAlpha="1"
+                                      android:pathData=" M-28.21 -25.03 C-28.21,-25.03 -27.85,-48.38 -27.97,-55.48 C-28,-57.63 -23.5,-79.87 -0.75,-79.82 C22.77,-79.76 27.75,-59.37 27.72,-58.27 C27.55,-52.88 27.93,-26.15 27.93,-26.15 "/>
+                            </group>
+                        </group>
+                    </group>
+                </group>
+                <group android:name="_R_G_L_0_G_N_5_N_1_T_0" android:translateY="5"
+                       android:pivotX="16" android:pivotY="16" android:scaleX="2"
+                       android:scaleY="2">
+                    <group android:name="_R_G_L_0_G_N_5_T_0" android:translateX="7.75"
+                           android:translateY="10.670000000000002" android:pivotX="8.25"
+                           android:pivotY="7.25" android:scaleX="0.64" android:scaleY="0.64">
+                        <group android:name="_R_G_L_0_G" android:translateY="0.04699999999999971"
+                               android:pivotX="8.25" android:pivotY="7.25" android:scaleX="1.01562"
+                               android:scaleY="1.01563">
+                            <path android:name="_R_G_L_0_G_D_0_P_0" android:fillColor="?attr/textColor"
+                                  android:fillAlpha="1" android:fillType="nonZero"
+                                  android:pathData=" M14.25 0.25 C14.25,0.25 12.75,0.25 12.75,0.25 C12.75,0.25 10.75,0.25 10.75,0.25 C10.75,0.25 5.75,0.25 5.75,0.25 C5.75,0.25 3.75,0.25 3.75,0.25 C3.75,0.25 2.25,0.25 2.25,0.25 C1.15,0.25 0.25,1.15 0.25,2.25 C0.25,2.25 0.25,12.25 0.25,12.25 C0.25,13.35 1.15,14.25 2.25,14.25 C2.25,14.25 14.25,14.25 14.25,14.25 C15.35,14.25 16.25,13.35 16.25,12.25 C16.25,12.25 16.25,2.25 16.25,2.25 C16.25,1.15 15.35,0.25 14.25,0.25c  M14.25 12.25 C14.25,12.25 2.25,12.25 2.25,12.25 C2.25,12.25 2.25,2.25 2.25,2.25 C2.25,2.25 3.75,2.25 3.75,2.25 C3.75,2.25 12.75,2.25 12.75,2.25 C12.75,2.25 14.25,2.25 14.25,2.25 C14.25,2.25 14.25,12.25 14.25,12.25c "/>
+                        </group>
+                    </group>
+                </group>
+            </group>
+            <group android:name="time_group"/>
+        </vector>
+    </aapt:attr>
+    <target android:name="_R_G_L_2_G">
+        <aapt:attr name="android:animation">
+            <set android:ordering="together">
+                <objectAnimator android:propertyName="scaleX" android:duration="150"
+                                android:startOffset="0" android:valueFrom="1" android:valueTo="1"
+                                android:valueType="floatType">
+                    <aapt:attr name="android:interpolator">
+                        <pathInterpolator android:pathData="M 0.0,0.0 c0.333,0 0.667,1 1.0,1.0"/>
+                    </aapt:attr>
+                </objectAnimator>
+                <objectAnimator android:propertyName="scaleY" android:duration="150"
+                                android:startOffset="0" android:valueFrom="1" android:valueTo="1"
+                                android:valueType="floatType">
+                    <aapt:attr name="android:interpolator">
+                        <pathInterpolator android:pathData="M 0.0,0.0 c0.333,0 0.667,1 1.0,1.0"/>
+                    </aapt:attr>
+                </objectAnimator>
+                <objectAnimator android:propertyName="scaleX" android:duration="117"
+                                android:startOffset="150" android:valueFrom="1"
+                                android:valueTo="0.6" android:valueType="floatType">
+                    <aapt:attr name="android:interpolator">
+                        <pathInterpolator android:pathData="M 0.0,0.0 c0.333,0 0.667,1 1.0,1.0"/>
+                    </aapt:attr>
+                </objectAnimator>
+                <objectAnimator android:propertyName="scaleY" android:duration="117"
+                                android:startOffset="150" android:valueFrom="1"
+                                android:valueTo="0.6" android:valueType="floatType">
+                    <aapt:attr name="android:interpolator">
+                        <pathInterpolator android:pathData="M 0.0,0.0 c0.333,0 0.667,1 1.0,1.0"/>
+                    </aapt:attr>
+                </objectAnimator>
+                <objectAnimator android:propertyName="scaleX" android:duration="333"
+                                android:startOffset="267" android:valueFrom="0.6"
+                                android:valueTo="1" android:valueType="floatType">
+                    <aapt:attr name="android:interpolator">
+                        <pathInterpolator android:pathData="M 0.0,0.0 c0.333,0 0.667,1 1.0,1.0"/>
+                    </aapt:attr>
+                </objectAnimator>
+                <objectAnimator android:propertyName="scaleY" android:duration="333"
+                                android:startOffset="267" android:valueFrom="0.6"
+                                android:valueTo="1" android:valueType="floatType">
+                    <aapt:attr name="android:interpolator">
+                        <pathInterpolator android:pathData="M 0.0,0.0 c0.333,0 0.667,1 1.0,1.0"/>
+                    </aapt:attr>
+                </objectAnimator>
+            </set>
+        </aapt:attr>
+    </target>
+    <target android:name="_R_G_L_2_G_N_5_T_0">
+        <aapt:attr name="android:animation">
+            <set android:ordering="together">
+                <objectAnimator android:propertyName="scaleX" android:duration="83"
+                                android:startOffset="0" android:valueFrom="0.64"
+                                android:valueTo="0.64" android:valueType="floatType">
+                    <aapt:attr name="android:interpolator">
+                        <pathInterpolator android:pathData="M 0.0,0.0 c0.333,0 0.667,1 1.0,1.0"/>
+                    </aapt:attr>
+                </objectAnimator>
+                <objectAnimator android:propertyName="scaleY" android:duration="83"
+                                android:startOffset="0" android:valueFrom="0.64"
+                                android:valueTo="0.64" android:valueType="floatType">
+                    <aapt:attr name="android:interpolator">
+                        <pathInterpolator android:pathData="M 0.0,0.0 c0.333,0 0.667,1 1.0,1.0"/>
+                    </aapt:attr>
+                </objectAnimator>
+                <objectAnimator android:propertyName="scaleX" android:duration="83"
+                                android:startOffset="83" android:valueFrom="0.64"
+                                android:valueTo="0.62" android:valueType="floatType">
+                    <aapt:attr name="android:interpolator">
+                        <pathInterpolator android:pathData="M 0.0,0.0 c0.333,0 0.667,1 1.0,1.0"/>
+                    </aapt:attr>
+                </objectAnimator>
+                <objectAnimator android:propertyName="scaleY" android:duration="83"
+                                android:startOffset="83" android:valueFrom="0.64"
+                                android:valueTo="0.62" android:valueType="floatType">
+                    <aapt:attr name="android:interpolator">
+                        <pathInterpolator android:pathData="M 0.0,0.0 c0.333,0 0.667,1 1.0,1.0"/>
+                    </aapt:attr>
+                </objectAnimator>
+                <objectAnimator android:propertyName="scaleX" android:duration="183"
+                                android:startOffset="167" android:valueFrom="0.62"
+                                android:valueTo="0.8" android:valueType="floatType">
+                    <aapt:attr name="android:interpolator">
+                        <pathInterpolator android:pathData="M 0.0,0.0 c0.333,0 0.667,1 1.0,1.0"/>
+                    </aapt:attr>
+                </objectAnimator>
+                <objectAnimator android:propertyName="scaleY" android:duration="183"
+                                android:startOffset="167" android:valueFrom="0.62"
+                                android:valueTo="0.8" android:valueType="floatType">
+                    <aapt:attr name="android:interpolator">
+                        <pathInterpolator android:pathData="M 0.0,0.0 c0.333,0 0.667,1 1.0,1.0"/>
+                    </aapt:attr>
+                </objectAnimator>
+                <objectAnimator android:propertyName="scaleX" android:duration="250"
+                                android:startOffset="350" android:valueFrom="0.8"
+                                android:valueTo="0.64" android:valueType="floatType">
+                    <aapt:attr name="android:interpolator">
+                        <pathInterpolator android:pathData="M 0.0,0.0 c0.333,0 0.667,1 1.0,1.0"/>
+                    </aapt:attr>
+                </objectAnimator>
+                <objectAnimator android:propertyName="scaleY" android:duration="250"
+                                android:startOffset="350" android:valueFrom="0.8"
+                                android:valueTo="0.64" android:valueType="floatType">
+                    <aapt:attr name="android:interpolator">
+                        <pathInterpolator android:pathData="M 0.0,0.0 c0.333,0 0.667,1 1.0,1.0"/>
+                    </aapt:attr>
+                </objectAnimator>
+            </set>
+        </aapt:attr>
+    </target>
+    <target android:name="_R_G_L_1_G_D_0_P_0">
+        <aapt:attr name="android:animation">
+            <set android:ordering="together">
+                <objectAnimator android:propertyName="pathData" android:duration="83"
+                                android:startOffset="0"
+                                android:valueFrom="M-28.21 -25.03 C-28.21,-25.03 -27.85,-48.38 -27.97,-55.48 C-28,-57.63 -23.5,-79.87 -0.75,-79.82 C22.77,-79.76 27.75,-59.37 27.72,-58.27 C27.55,-52.88 27.93,-26.15 27.93,-26.15 "
+                                android:valueTo="M-28.21 -25.03 C-28.21,-25.03 -27.85,-48.38 -27.97,-55.48 C-28,-57.63 -23.5,-79.87 -0.75,-79.82 C22.77,-79.76 27.75,-59.37 27.72,-58.27 C27.55,-52.88 27.93,-26.15 27.93,-26.15 "
+                                android:valueType="pathType">
+                    <aapt:attr name="android:interpolator">
+                        <pathInterpolator android:pathData="M 0.0,0.0 c0.333,0 0.667,1 1.0,1.0"/>
+                    </aapt:attr>
+                </objectAnimator>
+                <objectAnimator android:propertyName="pathData" android:duration="150"
+                                android:startOffset="83"
+                                android:valueFrom="M-28.21 -25.03 C-28.21,-25.03 -27.85,-48.38 -27.97,-55.48 C-28,-57.63 -23.5,-79.87 -0.75,-79.82 C22.77,-79.76 27.75,-59.37 27.72,-58.27 C27.55,-52.88 27.93,-26.15 27.93,-26.15 "
+                                android:valueTo="M-28.02 -43.42 C-28.02,-43.42 -27.85,-48.38 -27.97,-55.48 C-28,-57.63 -23.5,-79.87 -0.75,-79.82 C22.77,-79.76 27.75,-59.37 27.72,-58.27 C27.55,-52.88 27.76,-43.67 27.76,-43.67 "
+                                android:valueType="pathType">
+                    <aapt:attr name="android:interpolator">
+                        <pathInterpolator android:pathData="M 0.0,0.0 c0.333,0 0.667,1 1.0,1.0"/>
+                    </aapt:attr>
+                </objectAnimator>
+                <objectAnimator android:propertyName="pathData" android:duration="117"
+                                android:startOffset="233"
+                                android:valueFrom="M-28.02 -43.42 C-28.02,-43.42 -27.85,-48.38 -27.97,-55.48 C-28,-57.63 -23.5,-79.87 -0.75,-79.82 C22.77,-79.76 27.75,-59.37 27.72,-58.27 C27.55,-52.88 27.76,-43.67 27.76,-43.67 "
+                                android:valueTo="M-28.21 -25.03 C-28.21,-25.03 -27.85,-48.38 -27.97,-55.48 C-28,-57.63 -23.5,-79.87 -0.75,-79.82 C22.77,-79.76 27.75,-59.37 27.72,-58.27 C27.55,-52.88 27.93,-26.15 27.93,-26.15 "
+                                android:valueType="pathType">
+                    <aapt:attr name="android:interpolator">
+                        <pathInterpolator android:pathData="M 0.0,0.0 c0.333,0 0.667,1 1.0,1.0"/>
+                    </aapt:attr>
+                </objectAnimator>
+            </set>
+        </aapt:attr>
+    </target>
+    <target android:name="_R_G_L_1_G_T_1">
+        <aapt:attr name="android:animation">
+            <set android:ordering="together">
+                <objectAnimator android:propertyName="translateY" android:duration="83"
+                                android:startOffset="0" android:valueFrom="1.121"
+                                android:valueTo="1.121" android:valueType="floatType">
+                    <aapt:attr name="android:interpolator">
+                        <pathInterpolator android:pathData="M 0.0,0.0 c0.333,0 0.667,1 1.0,1.0"/>
+                    </aapt:attr>
+                </objectAnimator>
+                <objectAnimator android:propertyName="translateY" android:duration="150"
+                                android:startOffset="83" android:valueFrom="1.121"
+                                android:valueTo="3.749" android:valueType="floatType">
+                    <aapt:attr name="android:interpolator">
+                        <pathInterpolator android:pathData="M 0.0,0.0 c0.333,0 0.667,1 1.0,1.0"/>
+                    </aapt:attr>
+                </objectAnimator>
+                <objectAnimator android:propertyName="translateY" android:duration="117"
+                                android:startOffset="233" android:valueFrom="3.749"
+                                android:valueTo="1.121" android:valueType="floatType">
+                    <aapt:attr name="android:interpolator">
+                        <pathInterpolator android:pathData="M 0.0,0.0 c0.333,0 0.667,1 1.0,1.0"/>
+                    </aapt:attr>
+                </objectAnimator>
+            </set>
+        </aapt:attr>
+    </target>
+    <target android:name="_R_G_L_1_G_N_5_T_0">
+        <aapt:attr name="android:animation">
+            <set android:ordering="together">
+                <objectAnimator android:propertyName="scaleX" android:duration="83"
+                                android:startOffset="0" android:valueFrom="0.64"
+                                android:valueTo="0.64" android:valueType="floatType">
+                    <aapt:attr name="android:interpolator">
+                        <pathInterpolator android:pathData="M 0.0,0.0 c0.333,0 0.667,1 1.0,1.0"/>
+                    </aapt:attr>
+                </objectAnimator>
+                <objectAnimator android:propertyName="scaleY" android:duration="83"
+                                android:startOffset="0" android:valueFrom="0.64"
+                                android:valueTo="0.64" android:valueType="floatType">
+                    <aapt:attr name="android:interpolator">
+                        <pathInterpolator android:pathData="M 0.0,0.0 c0.333,0 0.667,1 1.0,1.0"/>
+                    </aapt:attr>
+                </objectAnimator>
+                <objectAnimator android:propertyName="scaleX" android:duration="83"
+                                android:startOffset="83" android:valueFrom="0.64"
+                                android:valueTo="0.62" android:valueType="floatType">
+                    <aapt:attr name="android:interpolator">
+                        <pathInterpolator android:pathData="M 0.0,0.0 c0.333,0 0.667,1 1.0,1.0"/>
+                    </aapt:attr>
+                </objectAnimator>
+                <objectAnimator android:propertyName="scaleY" android:duration="83"
+                                android:startOffset="83" android:valueFrom="0.64"
+                                android:valueTo="0.62" android:valueType="floatType">
+                    <aapt:attr name="android:interpolator">
+                        <pathInterpolator android:pathData="M 0.0,0.0 c0.333,0 0.667,1 1.0,1.0"/>
+                    </aapt:attr>
+                </objectAnimator>
+                <objectAnimator android:propertyName="scaleX" android:duration="183"
+                                android:startOffset="167" android:valueFrom="0.62"
+                                android:valueTo="0.8" android:valueType="floatType">
+                    <aapt:attr name="android:interpolator">
+                        <pathInterpolator android:pathData="M 0.0,0.0 c0.333,0 0.667,1 1.0,1.0"/>
+                    </aapt:attr>
+                </objectAnimator>
+                <objectAnimator android:propertyName="scaleY" android:duration="183"
+                                android:startOffset="167" android:valueFrom="0.62"
+                                android:valueTo="0.8" android:valueType="floatType">
+                    <aapt:attr name="android:interpolator">
+                        <pathInterpolator android:pathData="M 0.0,0.0 c0.333,0 0.667,1 1.0,1.0"/>
+                    </aapt:attr>
+                </objectAnimator>
+                <objectAnimator android:propertyName="scaleX" android:duration="250"
+                                android:startOffset="350" android:valueFrom="0.8"
+                                android:valueTo="0.64" android:valueType="floatType">
+                    <aapt:attr name="android:interpolator">
+                        <pathInterpolator android:pathData="M 0.0,0.0 c0.333,0 0.667,1 1.0,1.0"/>
+                    </aapt:attr>
+                </objectAnimator>
+                <objectAnimator android:propertyName="scaleY" android:duration="250"
+                                android:startOffset="350" android:valueFrom="0.8"
+                                android:valueTo="0.64" android:valueType="floatType">
+                    <aapt:attr name="android:interpolator">
+                        <pathInterpolator android:pathData="M 0.0,0.0 c0.333,0 0.667,1 1.0,1.0"/>
+                    </aapt:attr>
+                </objectAnimator>
+            </set>
+        </aapt:attr>
+    </target>
+    <target android:name="_R_G_L_0_G_N_5_T_0">
+        <aapt:attr name="android:animation">
+            <set android:ordering="together">
+                <objectAnimator android:propertyName="scaleX" android:duration="83"
+                                android:startOffset="0" android:valueFrom="0.64"
+                                android:valueTo="0.64" android:valueType="floatType">
+                    <aapt:attr name="android:interpolator">
+                        <pathInterpolator android:pathData="M 0.0,0.0 c0.333,0 0.667,1 1.0,1.0"/>
+                    </aapt:attr>
+                </objectAnimator>
+                <objectAnimator android:propertyName="scaleY" android:duration="83"
+                                android:startOffset="0" android:valueFrom="0.64"
+                                android:valueTo="0.64" android:valueType="floatType">
+                    <aapt:attr name="android:interpolator">
+                        <pathInterpolator android:pathData="M 0.0,0.0 c0.333,0 0.667,1 1.0,1.0"/>
+                    </aapt:attr>
+                </objectAnimator>
+                <objectAnimator android:propertyName="scaleX" android:duration="83"
+                                android:startOffset="83" android:valueFrom="0.64"
+                                android:valueTo="0.62" android:valueType="floatType">
+                    <aapt:attr name="android:interpolator">
+                        <pathInterpolator android:pathData="M 0.0,0.0 c0.333,0 0.667,1 1.0,1.0"/>
+                    </aapt:attr>
+                </objectAnimator>
+                <objectAnimator android:propertyName="scaleY" android:duration="83"
+                                android:startOffset="83" android:valueFrom="0.64"
+                                android:valueTo="0.62" android:valueType="floatType">
+                    <aapt:attr name="android:interpolator">
+                        <pathInterpolator android:pathData="M 0.0,0.0 c0.333,0 0.667,1 1.0,1.0"/>
+                    </aapt:attr>
+                </objectAnimator>
+                <objectAnimator android:propertyName="scaleX" android:duration="183"
+                                android:startOffset="167" android:valueFrom="0.62"
+                                android:valueTo="0.8" android:valueType="floatType">
+                    <aapt:attr name="android:interpolator">
+                        <pathInterpolator android:pathData="M 0.0,0.0 c0.333,0 0.667,1 1.0,1.0"/>
+                    </aapt:attr>
+                </objectAnimator>
+                <objectAnimator android:propertyName="scaleY" android:duration="183"
+                                android:startOffset="167" android:valueFrom="0.62"
+                                android:valueTo="0.8" android:valueType="floatType">
+                    <aapt:attr name="android:interpolator">
+                        <pathInterpolator android:pathData="M 0.0,0.0 c0.333,0 0.667,1 1.0,1.0"/>
+                    </aapt:attr>
+                </objectAnimator>
+                <objectAnimator android:propertyName="scaleX" android:duration="250"
+                                android:startOffset="350" android:valueFrom="0.8"
+                                android:valueTo="0.64" android:valueType="floatType">
+                    <aapt:attr name="android:interpolator">
+                        <pathInterpolator android:pathData="M 0.0,0.0 c0.333,0 0.667,1 1.0,1.0"/>
+                    </aapt:attr>
+                </objectAnimator>
+                <objectAnimator android:propertyName="scaleY" android:duration="250"
+                                android:startOffset="350" android:valueFrom="0.8"
+                                android:valueTo="0.64" android:valueType="floatType">
+                    <aapt:attr name="android:interpolator">
+                        <pathInterpolator android:pathData="M 0.0,0.0 c0.333,0 0.667,1 1.0,1.0"/>
+                    </aapt:attr>
+                </objectAnimator>
+            </set>
+        </aapt:attr>
+    </target>
+    <target android:name="time_group">
+        <aapt:attr name="android:animation">
+            <set android:ordering="together">
+                <objectAnimator android:propertyName="translateX" android:duration="1000"
+                                android:startOffset="0" android:valueFrom="0" android:valueTo="1"
+                                android:valueType="floatType"/>
+            </set>
+        </aapt:attr>
+    </target>
+</animated-vector>
\ No newline at end of file
diff --git a/core/res/res/anim/lock_to_error.xml b/core/res/res/anim/lock_to_error.xml
index 29b4964..ddef96b 100755
--- a/core/res/res/anim/lock_to_error.xml
+++ b/core/res/res/anim/lock_to_error.xml
@@ -14,545 +14,166 @@
      limitations under the License.
 -->
 <animated-vector xmlns:android="http://schemas.android.com/apk/res/android"
-    xmlns:aapt="http://schemas.android.com/aapt">
+                 xmlns:aapt="http://schemas.android.com/aapt">
     <aapt:attr name="android:drawable">
-        <vector
-            android:width="24dp"
-            android:height="24dp"
-            android:viewportWidth="24"
-            android:viewportHeight="24">
+        <vector android:height="32dp" android:width="32dp" android:viewportHeight="32"
+                android:viewportWidth="32">
             <group android:name="_R_G">
-                <group
-                    android:name="_R_G_L_3_G"
-                    android:pivotY="-32"
-                    android:scaleX="0.12762"
-                    android:scaleY="0.12762"
-                    android:translateX="12"
-                    android:translateY="39.871">
-                    <path
-                        android:name="_R_G_L_3_G_D_0_P_0"
-                        android:fillAlpha="0"
-                        android:fillColor="#ff0000"
-                        android:fillType="nonZero"
-                        android:pathData=" M-28.21 -31.92 C-28.21,-31.92 -27.85,-48.38 -27.97,-55.48 C-28,-57.63 -23.5,-79.87 -0.75,-79.82 C22.77,-79.76 27.75,-59.37 27.72,-58.27 C27.55,-52.88 27.97,-31.67 27.97,-31.67 "
-                        android:trimPathStart="0"
-                        android:trimPathEnd="1"
-                        android:trimPathOffset="0" />
-                    <path
-                        android:name="_R_G_L_3_G_D_1_P_0"
-                        android:pathData=" M-28.21 -31.92 C-28.21,-31.92 -27.85,-48.38 -27.97,-55.48 C-28,-57.63 -23.5,-79.87 -0.75,-79.82 C22.77,-79.76 27.75,-59.37 27.72,-58.27 C27.55,-52.88 27.97,-31.67 27.97,-31.67 "
-                        android:strokeWidth="16"
-                        android:strokeAlpha="1"
-                        android:strokeColor="?attr/textColor"
-                        android:trimPathStart="0"
-                        android:trimPathEnd="1"
-                        android:trimPathOffset="0" />
-                </group>
-                <group
-                    android:name="_R_G_L_2_G_T_1"
-                    android:rotation="45"
-                    android:scaleX="1"
-                    android:scaleY="1"
-                    android:translateX="12"
-                    android:translateY="15">
-                    <group
-                        android:name="_R_G_L_2_G"
-                        android:translateX="-2.25"
-                        android:translateY="-2.25">
-                        <path
-                            android:name="_R_G_L_2_G_D_0_P_0"
-                            android:fillAlpha="1"
-                            android:fillColor="?attr/textColor"
-                            android:fillType="nonZero"
-                            android:pathData=" M2.25 0.25 C3.35,0.25 4.25,1.15 4.25,2.25 C4.25,3.35 3.35,4.25 2.25,4.25 C1.15,4.25 0.25,3.35 0.25,2.25 C0.25,1.15 1.15,0.25 2.25,0.25c " />
+                <group android:name="_R_G_L_2_G_N_2_T_0" android:translateX="7.75"
+                       android:translateY="12.649999999999999" android:pivotX="8.25"
+                       android:pivotY="7.25" android:rotation="0" android:scaleX="1.3"
+                       android:scaleY="1.3">
+                    <group android:name="_R_G_L_2_G" android:translateX="6"
+                           android:translateY="4.954" android:pivotX="2.25" android:pivotY="2.25"
+                           android:scaleX="0.98462" android:scaleY="0.98462">
+                        <path android:name="_R_G_L_2_G_D_0_P_0" android:fillColor="?attr/textColor"
+                              android:fillAlpha="1" android:fillType="nonZero"
+                              android:pathData=" M2.25 0.25 C3.35,0.25 4.25,1.15 4.25,2.25 C4.25,3.35 3.35,4.25 2.25,4.25 C1.15,4.25 0.25,3.35 0.25,2.25 C0.25,1.15 1.15,0.25 2.25,0.25c "/>
                     </group>
                 </group>
-                <group
-                    android:name="_R_G_L_1_G_T_1"
-                    android:scaleX="0.125"
-                    android:scaleY="0.125"
-                    android:translateX="12.023"
-                    android:translateY="1.281">
-                    <group
-                        android:name="_R_G_L_1_G"
-                        android:translateX="0.317"
-                        android:translateY="45.25">
-                        <path
-                            android:name="_R_G_L_1_G_D_0_P_0"
-                            android:fillAlpha="0"
-                            android:fillColor="#EA4335"
-                            android:fillType="nonZero"
-                            android:pathData=" M4.21 -42.01 C4.21,-42.01 4.21,-32 4.21,-32 C4.21,-32 -5.25,-32 -5.25,-32 C-5.25,-32 -5.25,-42.01 -5.25,-42.01 C-5.25,-42.01 4.21,-42.01 4.21,-42.01c " />
+                <group android:name="_R_G_L_1_G_N_2_T_0" android:translateX="7.75"
+                       android:translateY="12.649999999999999" android:pivotX="8.25"
+                       android:pivotY="7.25" android:rotation="0" android:scaleX="1.3"
+                       android:scaleY="1.3">
+                    <group android:name="_R_G_L_1_G" android:translateX="-16.273"
+                           android:translateY="32.312" android:pivotX="27.965" android:pivotY="-32"
+                           android:scaleX="0.12308" android:scaleY="0.12308">
+                        <path android:name="_R_G_L_1_G_D_0_P_0" android:strokeColor="?attr/textColor"
+                              android:strokeLineCap="round" android:strokeLineJoin="round"
+                              android:strokeWidth="16" android:strokeAlpha="1"
+                              android:pathData=" M-28.21 -25.03 C-28.21,-25.03 -27.85,-48.38 -27.97,-55.48 C-28,-57.63 -23.5,-79.87 -0.75,-79.82 C22.77,-79.76 27.75,-59.37 27.72,-58.27 C27.55,-52.88 27.93,-26.15 27.93,-26.15 "/>
                     </group>
                 </group>
-                <group
-                    android:name="_R_G_L_0_G"
-                    android:pivotY="21"
-                    android:scaleX="0.14286"
-                    android:scaleY="0.14286"
-                    android:translateX="12"
-                    android:translateY="-6">
-                    <path
-                        android:name="_R_G_L_0_G_D_0_P_0"
-                        android:fillAlpha="0"
-                        android:fillColor="#ffffff"
-                        android:fillType="nonZero"
-                        android:pathData=" M49.24 -12.32 C49.24,-12.32 49.24,52.91 49.24,52.91 C49.24,58.95 44.34,63.85 38.3,63.85 C38.3,63.85 -37.8,63.85 -37.8,63.85 C-43.84,63.85 -48.74,58.95 -48.74,52.91 C-48.74,52.91 -48.74,-12.32 -48.74,-12.32 C-48.74,-18.37 -43.84,-23.27 -37.8,-23.27 C-37.8,-23.27 38.3,-23.27 38.3,-23.27 C44.34,-23.27 49.24,-18.37 49.24,-12.32c " />
-                    <path
-                        android:name="_R_G_L_0_G_D_1_P_0"
-                        android:pathData=" M49.24 -12.32 C49.24,-12.32 49.24,52.91 49.24,52.91 C49.24,58.95 44.34,63.85 38.3,63.85 C38.3,63.85 -37.8,63.85 -37.8,63.85 C-43.84,63.85 -48.74,58.95 -48.74,52.91 C-48.74,52.91 -48.74,-12.32 -48.74,-12.32 C-48.74,-18.37 -43.84,-23.27 -37.8,-23.27 C-37.8,-23.27 38.3,-23.27 38.3,-23.27 C44.34,-23.27 49.24,-18.37 49.24,-12.32c "
-                        android:strokeWidth="14"
-                        android:strokeAlpha="1"
-                        android:strokeColor="?attr/textColor"
-                        android:strokeLineCap="round"
-                        android:strokeLineJoin="round" />
+                <group android:name="_R_G_L_0_G" android:translateX="7.75"
+                       android:translateY="12.649999999999999" android:pivotX="8.25"
+                       android:pivotY="7.25" android:rotation="0" android:scaleX="1.3"
+                       android:scaleY="1.3">
+                    <path android:name="_R_G_L_0_G_D_0_P_0" android:fillColor="?attr/textColor"
+                          android:fillAlpha="1" android:fillType="nonZero"
+                          android:pathData=" M14.25 0.25 C14.25,0.25 12.75,0.25 12.75,0.25 C12.75,0.25 10.75,0.25 10.75,0.25 C10.75,0.25 5.75,0.25 5.75,0.25 C5.75,0.25 3.75,0.25 3.75,0.25 C3.75,0.25 2.25,0.25 2.25,0.25 C1.15,0.25 0.25,1.15 0.25,2.25 C0.25,2.25 0.25,12.25 0.25,12.25 C0.25,13.35 1.15,14.25 2.25,14.25 C2.25,14.25 14.25,14.25 14.25,14.25 C15.35,14.25 16.25,13.35 16.25,12.25 C16.25,12.25 16.25,2.25 16.25,2.25 C16.25,1.15 15.35,0.25 14.25,0.25c  M14.25 12.25 C14.25,12.25 2.25,12.25 2.25,12.25 C2.25,12.25 2.25,2.25 2.25,2.25 C2.25,2.25 3.75,2.25 3.75,2.25 C3.75,2.25 12.75,2.25 12.75,2.25 C12.75,2.25 14.25,2.25 14.25,2.25 C14.25,2.25 14.25,12.25 14.25,12.25c "/>
                 </group>
             </group>
-            <group android:name="time_group" />
+            <group android:name="time_group"/>
         </vector>
     </aapt:attr>
-    <target android:name="_R_G_L_3_G_D_0_P_0">
+    <target android:name="_R_G_L_2_G_N_2_T_0">
         <aapt:attr name="android:animation">
             <set android:ordering="together">
-                <objectAnimator
-                    android:duration="250"
-                    android:propertyName="trimPathStart"
-                    android:startOffset="0"
-                    android:valueFrom="0"
-                    android:valueTo="0.5"
-                    android:valueType="floatType">
+                <objectAnimator android:propertyName="rotation" android:duration="133"
+                                android:startOffset="0" android:valueFrom="0" android:valueTo="0"
+                                android:valueType="floatType">
                     <aapt:attr name="android:interpolator">
-                        <pathInterpolator android:pathData="M 0.0,0.0 c0.4,0 0.2,1 1.0,1.0" />
+                        <pathInterpolator android:pathData="M 0.0,0.0 c0.44,0 0.601,1 1.0,1.0"/>
+                    </aapt:attr>
+                </objectAnimator>
+                <objectAnimator android:propertyName="rotation" android:duration="120"
+                                android:startOffset="133" android:valueFrom="0"
+                                android:valueTo="-10" android:valueType="floatType">
+                    <aapt:attr name="android:interpolator">
+                        <pathInterpolator android:pathData="M 0.0,0.0 c0.44,0 0.601,1 1.0,1.0"/>
+                    </aapt:attr>
+                </objectAnimator>
+                <objectAnimator android:propertyName="rotation" android:duration="97"
+                                android:startOffset="253" android:valueFrom="-10"
+                                android:valueTo="10" android:valueType="floatType">
+                    <aapt:attr name="android:interpolator">
+                        <pathInterpolator android:pathData="M 0.0,0.0 c0.531,0 0.389,1 1.0,1.0"/>
+                    </aapt:attr>
+                </objectAnimator>
+                <objectAnimator android:propertyName="rotation" android:duration="100"
+                                android:startOffset="350" android:valueFrom="10"
+                                android:valueTo="-5" android:valueType="floatType">
+                    <aapt:attr name="android:interpolator">
+                        <pathInterpolator android:pathData="M 0.0,0.0 c0.499,0 0.489,1 1.0,1.0"/>
+                    </aapt:attr>
+                </objectAnimator>
+                <objectAnimator android:propertyName="rotation" android:duration="167"
+                                android:startOffset="450" android:valueFrom="-5" android:valueTo="0"
+                                android:valueType="floatType">
+                    <aapt:attr name="android:interpolator">
+                        <pathInterpolator android:pathData="M 0.0,0.0 c0.293,0 0.689,1 1.0,1.0"/>
                     </aapt:attr>
                 </objectAnimator>
             </set>
         </aapt:attr>
     </target>
-    <target android:name="_R_G_L_3_G_D_0_P_0">
+    <target android:name="_R_G_L_1_G_N_2_T_0">
         <aapt:attr name="android:animation">
             <set android:ordering="together">
-                <objectAnimator
-                    android:duration="250"
-                    android:propertyName="trimPathEnd"
-                    android:startOffset="0"
-                    android:valueFrom="1"
-                    android:valueTo="0.5"
-                    android:valueType="floatType">
+                <objectAnimator android:propertyName="rotation" android:duration="133"
+                                android:startOffset="0" android:valueFrom="0" android:valueTo="0"
+                                android:valueType="floatType">
                     <aapt:attr name="android:interpolator">
-                        <pathInterpolator android:pathData="M 0.0,0.0 c0.4,0 0.2,1 1.0,1.0" />
+                        <pathInterpolator android:pathData="M 0.0,0.0 c0.44,0 0.601,1 1.0,1.0"/>
+                    </aapt:attr>
+                </objectAnimator>
+                <objectAnimator android:propertyName="rotation" android:duration="120"
+                                android:startOffset="133" android:valueFrom="0"
+                                android:valueTo="-10" android:valueType="floatType">
+                    <aapt:attr name="android:interpolator">
+                        <pathInterpolator android:pathData="M 0.0,0.0 c0.44,0 0.601,1 1.0,1.0"/>
+                    </aapt:attr>
+                </objectAnimator>
+                <objectAnimator android:propertyName="rotation" android:duration="97"
+                                android:startOffset="253" android:valueFrom="-10"
+                                android:valueTo="10" android:valueType="floatType">
+                    <aapt:attr name="android:interpolator">
+                        <pathInterpolator android:pathData="M 0.0,0.0 c0.531,0 0.389,1 1.0,1.0"/>
+                    </aapt:attr>
+                </objectAnimator>
+                <objectAnimator android:propertyName="rotation" android:duration="100"
+                                android:startOffset="350" android:valueFrom="10"
+                                android:valueTo="-5" android:valueType="floatType">
+                    <aapt:attr name="android:interpolator">
+                        <pathInterpolator android:pathData="M 0.0,0.0 c0.499,0 0.489,1 1.0,1.0"/>
+                    </aapt:attr>
+                </objectAnimator>
+                <objectAnimator android:propertyName="rotation" android:duration="167"
+                                android:startOffset="450" android:valueFrom="-5" android:valueTo="0"
+                                android:valueType="floatType">
+                    <aapt:attr name="android:interpolator">
+                        <pathInterpolator android:pathData="M 0.0,0.0 c0.293,0 0.689,1 1.0,1.0"/>
                     </aapt:attr>
                 </objectAnimator>
             </set>
         </aapt:attr>
     </target>
-    <target android:name="_R_G_L_3_G_D_1_P_0">
+    <target android:name="_R_G_L_0_G">
         <aapt:attr name="android:animation">
             <set android:ordering="together">
-                <objectAnimator
-                    android:duration="117"
-                    android:propertyName="strokeColor"
-                    android:startOffset="0"
-                    android:valueFrom="#fff"
-                    android:valueTo="#fff"
-                    android:valueType="colorType">
+                <objectAnimator android:propertyName="rotation" android:duration="133"
+                                android:startOffset="0" android:valueFrom="0" android:valueTo="0"
+                                android:valueType="floatType">
                     <aapt:attr name="android:interpolator">
-                        <pathInterpolator android:pathData="M 0.0,0.0 c0.167,0.167 0.833,0.833 1.0,1.0" />
+                        <pathInterpolator android:pathData="M 0.0,0.0 c0.44,0 0.601,1 1.0,1.0"/>
                     </aapt:attr>
                 </objectAnimator>
-                <objectAnimator
-                    android:duration="17"
-                    android:propertyName="strokeColor"
-                    android:startOffset="117"
-                    android:valueFrom="#fff"
-                    android:valueTo="#EA4335"
-                    android:valueType="colorType">
+                <objectAnimator android:propertyName="rotation" android:duration="120"
+                                android:startOffset="133" android:valueFrom="0"
+                                android:valueTo="-10" android:valueType="floatType">
                     <aapt:attr name="android:interpolator">
-                        <pathInterpolator android:pathData="M 0.0,0.0 c0.167,0.167 0.833,0.833 1.0,1.0" />
+                        <pathInterpolator android:pathData="M 0.0,0.0 c0.44,0 0.601,1 1.0,1.0"/>
                     </aapt:attr>
                 </objectAnimator>
-            </set>
-        </aapt:attr>
-    </target>
-    <target android:name="_R_G_L_3_G_D_1_P_0">
-        <aapt:attr name="android:animation">
-            <set android:ordering="together">
-                <objectAnimator
-                    android:duration="133"
-                    android:propertyName="strokeWidth"
-                    android:startOffset="0"
-                    android:valueFrom="16"
-                    android:valueTo="8"
-                    android:valueType="floatType">
+                <objectAnimator android:propertyName="rotation" android:duration="97"
+                                android:startOffset="253" android:valueFrom="-10"
+                                android:valueTo="10" android:valueType="floatType">
                     <aapt:attr name="android:interpolator">
-                        <pathInterpolator android:pathData="M 0.0,0.0 c0.4,0 0.2,1 1.0,1.0" />
+                        <pathInterpolator android:pathData="M 0.0,0.0 c0.531,0 0.389,1 1.0,1.0"/>
                     </aapt:attr>
                 </objectAnimator>
-            </set>
-        </aapt:attr>
-    </target>
-    <target android:name="_R_G_L_3_G_D_1_P_0">
-        <aapt:attr name="android:animation">
-            <set android:ordering="together">
-                <objectAnimator
-                    android:duration="250"
-                    android:propertyName="trimPathStart"
-                    android:startOffset="0"
-                    android:valueFrom="0"
-                    android:valueTo="0.5"
-                    android:valueType="floatType">
+                <objectAnimator android:propertyName="rotation" android:duration="100"
+                                android:startOffset="350" android:valueFrom="10"
+                                android:valueTo="-5" android:valueType="floatType">
                     <aapt:attr name="android:interpolator">
-                        <pathInterpolator android:pathData="M 0.0,0.0 c0.4,0 0.2,1 1.0,1.0" />
+                        <pathInterpolator android:pathData="M 0.0,0.0 c0.499,0 0.489,1 1.0,1.0"/>
                     </aapt:attr>
                 </objectAnimator>
-            </set>
-        </aapt:attr>
-    </target>
-    <target android:name="_R_G_L_3_G_D_1_P_0">
-        <aapt:attr name="android:animation">
-            <set android:ordering="together">
-                <objectAnimator
-                    android:duration="250"
-                    android:propertyName="trimPathEnd"
-                    android:startOffset="0"
-                    android:valueFrom="1"
-                    android:valueTo="0.5"
-                    android:valueType="floatType">
+                <objectAnimator android:propertyName="rotation" android:duration="167"
+                                android:startOffset="450" android:valueFrom="-5" android:valueTo="0"
+                                android:valueType="floatType">
                     <aapt:attr name="android:interpolator">
-                        <pathInterpolator android:pathData="M 0.0,0.0 c0.4,0 0.2,1 1.0,1.0" />
-                    </aapt:attr>
-                </objectAnimator>
-            </set>
-        </aapt:attr>
-    </target>
-    <target android:name="_R_G_L_3_G">
-        <aapt:attr name="android:animation">
-            <set android:ordering="together">
-                <objectAnimator
-                    android:duration="0"
-                    android:propertyName="scaleY"
-                    android:startOffset="183"
-                    android:valueFrom="0.12762"
-                    android:valueTo="0"
-                    android:valueType="floatType" />
-            </set>
-        </aapt:attr>
-    </target>
-    <target android:name="_R_G_L_2_G_D_0_P_0">
-        <aapt:attr name="android:animation">
-            <set android:ordering="together">
-                <objectAnimator
-                    android:duration="117"
-                    android:propertyName="fillColor"
-                    android:startOffset="0"
-                    android:valueFrom="#fff"
-                    android:valueTo="#fff"
-                    android:valueType="colorType">
-                    <aapt:attr name="android:interpolator">
-                        <pathInterpolator android:pathData="M 0.0,0.0 c0.167,0.167 0.833,0.833 1.0,1.0" />
-                    </aapt:attr>
-                </objectAnimator>
-                <objectAnimator
-                    android:duration="17"
-                    android:propertyName="fillColor"
-                    android:startOffset="117"
-                    android:valueFrom="#fff"
-                    android:valueTo="#EA4335"
-                    android:valueType="colorType">
-                    <aapt:attr name="android:interpolator">
-                        <pathInterpolator android:pathData="M 0.0,0.0 c0.167,0.167 0.833,0.833 1.0,1.0" />
-                    </aapt:attr>
-                </objectAnimator>
-            </set>
-        </aapt:attr>
-    </target>
-    <target android:name="_R_G_L_2_G_D_0_P_0">
-        <aapt:attr name="android:animation">
-            <set android:ordering="together">
-                <objectAnimator
-                    android:duration="133"
-                    android:propertyName="pathData"
-                    android:startOffset="0"
-                    android:valueFrom="M2.25 0.25 C3.35,0.25 4.25,1.15 4.25,2.25 C4.25,3.35 3.35,4.25 2.25,4.25 C1.15,4.25 0.25,3.35 0.25,2.25 C0.25,1.15 1.15,0.25 2.25,0.25c "
-                    android:valueTo="M2.25 0.25 C3.35,0.25 4.25,1.15 4.25,2.25 C4.25,3.35 3.35,4.25 2.25,4.25 C1.15,4.25 0.25,3.35 0.25,2.25 C0.25,1.15 1.15,0.25 2.25,0.25c "
-                    android:valueType="pathType">
-                    <aapt:attr name="android:interpolator">
-                        <pathInterpolator android:pathData="M 0.0,0.0 c0.167,0 0.833,1 1.0,1.0" />
-                    </aapt:attr>
-                </objectAnimator>
-                <objectAnimator
-                    android:duration="133"
-                    android:propertyName="pathData"
-                    android:startOffset="133"
-                    android:valueFrom="M2.25 0.25 C3.35,0.25 4.25,1.15 4.25,2.25 C4.25,3.35 3.35,4.25 2.25,4.25 C1.15,4.25 0.25,3.35 0.25,2.25 C0.25,1.15 1.15,0.25 2.25,0.25c "
-                    android:valueTo="M2.25 0.25 C2.25,0.25 4.25,2.25 4.25,2.25 C4.25,2.25 2.25,4.25 2.25,4.25 C2.25,4.25 0.25,2.25 0.25,2.25 C0.25,2.25 2.25,0.25 2.25,0.25c "
-                    android:valueType="pathType">
-                    <aapt:attr name="android:interpolator">
-                        <pathInterpolator android:pathData="M 0.0,0.0 c0.4,0 0.2,1 1.0,1.0" />
-                    </aapt:attr>
-                </objectAnimator>
-            </set>
-        </aapt:attr>
-    </target>
-    <target android:name="_R_G_L_2_G_T_1">
-        <aapt:attr name="android:animation">
-            <set android:ordering="together">
-                <objectAnimator
-                    android:duration="17"
-                    android:pathData="M 12,15C 12,15.171875 12,14.828125 12,15"
-                    android:propertyName="translateXY"
-                    android:propertyXName="translateX"
-                    android:propertyYName="translateY"
-                    android:startOffset="0">
-                    <aapt:attr name="android:interpolator">
-                        <pathInterpolator android:pathData="M 0.0,0.0 c0.4,0 0.2,1 1.0,1.0" />
-                    </aapt:attr>
-                </objectAnimator>
-                <objectAnimator
-                    android:duration="333"
-                    android:pathData="M 12,15C 12,15.171875 12,15.859124999999999 12,16.031"
-                    android:propertyName="translateXY"
-                    android:propertyXName="translateX"
-                    android:propertyYName="translateY"
-                    android:startOffset="17">
-                    <aapt:attr name="android:interpolator">
-                        <pathInterpolator android:pathData="M 0.0,0.0 c0.4,0 0.2,1 1.0,1.0" />
-                    </aapt:attr>
-                </objectAnimator>
-            </set>
-        </aapt:attr>
-    </target>
-    <target android:name="_R_G_L_2_G_T_1">
-        <aapt:attr name="android:animation">
-            <set android:ordering="together">
-                <objectAnimator
-                    android:duration="17"
-                    android:propertyName="scaleX"
-                    android:startOffset="0"
-                    android:valueFrom="1"
-                    android:valueTo="1"
-                    android:valueType="floatType">
-                    <aapt:attr name="android:interpolator">
-                        <pathInterpolator android:pathData="M 0.0,0.0 c0.4,0 0.2,1 1.0,1.0" />
-                    </aapt:attr>
-                </objectAnimator>
-                <objectAnimator
-                    android:duration="17"
-                    android:propertyName="scaleY"
-                    android:startOffset="0"
-                    android:valueFrom="1"
-                    android:valueTo="1"
-                    android:valueType="floatType">
-                    <aapt:attr name="android:interpolator">
-                        <pathInterpolator android:pathData="M 0.0,0.0 c0.4,0 0.2,1 1.0,1.0" />
-                    </aapt:attr>
-                </objectAnimator>
-                <objectAnimator
-                    android:duration="333"
-                    android:propertyName="scaleX"
-                    android:startOffset="17"
-                    android:valueFrom="1"
-                    android:valueTo="0.4325"
-                    android:valueType="floatType">
-                    <aapt:attr name="android:interpolator">
-                        <pathInterpolator android:pathData="M 0.0,0.0 c0.4,0 0.2,1 1.0,1.0" />
-                    </aapt:attr>
-                </objectAnimator>
-                <objectAnimator
-                    android:duration="333"
-                    android:propertyName="scaleY"
-                    android:startOffset="17"
-                    android:valueFrom="1"
-                    android:valueTo="0.4325"
-                    android:valueType="floatType">
-                    <aapt:attr name="android:interpolator">
-                        <pathInterpolator android:pathData="M 0.0,0.0 c0.4,0 0.2,1 1.0,1.0" />
-                    </aapt:attr>
-                </objectAnimator>
-            </set>
-        </aapt:attr>
-    </target>
-    <target android:name="_R_G_L_1_G_D_0_P_0">
-        <aapt:attr name="android:animation">
-            <set android:ordering="together">
-                <objectAnimator
-                    android:duration="150"
-                    android:propertyName="fillAlpha"
-                    android:startOffset="0"
-                    android:valueFrom="0"
-                    android:valueTo="0"
-                    android:valueType="floatType">
-                    <aapt:attr name="android:interpolator">
-                        <pathInterpolator android:pathData="M 0.0,0.0 c0.167,0.167 0.833,0.833 1.0,1.0" />
-                    </aapt:attr>
-                </objectAnimator>
-                <objectAnimator
-                    android:duration="17"
-                    android:propertyName="fillAlpha"
-                    android:startOffset="150"
-                    android:valueFrom="0"
-                    android:valueTo="1"
-                    android:valueType="floatType">
-                    <aapt:attr name="android:interpolator">
-                        <pathInterpolator android:pathData="M 0.0,0.0 c0.167,0.167 0.833,0.833 1.0,1.0" />
-                    </aapt:attr>
-                </objectAnimator>
-            </set>
-        </aapt:attr>
-    </target>
-    <target android:name="_R_G_L_1_G_D_0_P_0">
-        <aapt:attr name="android:animation">
-            <set android:ordering="together">
-                <objectAnimator
-                    android:duration="167"
-                    android:propertyName="pathData"
-                    android:startOffset="0"
-                    android:valueFrom="M4.21 -42.01 C4.21,-42.01 4.21,-32 4.21,-32 C4.21,-32 -5.25,-32 -5.25,-32 C-5.25,-32 -5.25,-42.01 -5.25,-42.01 C-5.25,-42.01 4.21,-42.01 4.21,-42.01c "
-                    android:valueTo="M4.21 -42.01 C4.21,-42.01 4.21,-32 4.21,-32 C4.21,-32 -5.25,-32 -5.25,-32 C-5.25,-32 -5.25,-42.01 -5.25,-42.01 C-5.25,-42.01 4.21,-42.01 4.21,-42.01c "
-                    android:valueType="pathType">
-                    <aapt:attr name="android:interpolator">
-                        <pathInterpolator android:pathData="M 0.0,0.0 c0.4,0 0.2,1 1.0,1.0" />
-                    </aapt:attr>
-                </objectAnimator>
-                <objectAnimator
-                    android:duration="183"
-                    android:propertyName="pathData"
-                    android:startOffset="167"
-                    android:valueFrom="M4.21 -42.01 C4.21,-42.01 4.21,-32 4.21,-32 C4.21,-32 -5.25,-32 -5.25,-32 C-5.25,-32 -5.25,-42.01 -5.25,-42.01 C-5.25,-42.01 4.21,-42.01 4.21,-42.01c "
-                    android:valueTo="M4.21 -42.01 C4.21,-42.01 4.16,33 4.16,33 C4.16,33 -5.3,33 -5.3,33 C-5.3,33 -5.25,-42.01 -5.25,-42.01 C-5.25,-42.01 4.21,-42.01 4.21,-42.01c "
-                    android:valueType="pathType">
-                    <aapt:attr name="android:interpolator">
-                        <pathInterpolator android:pathData="M 0.0,0.0 c0.4,0 0.2,1 1.0,1.0" />
-                    </aapt:attr>
-                </objectAnimator>
-                <objectAnimator
-                    android:duration="50"
-                    android:propertyName="pathData"
-                    android:startOffset="350"
-                    android:valueFrom="M4.21 -42.01 C4.21,-42.01 4.16,33 4.16,33 C4.16,33 -5.3,33 -5.3,33 C-5.3,33 -5.25,-42.01 -5.25,-42.01 C-5.25,-42.01 4.21,-42.01 4.21,-42.01c "
-                    android:valueTo="M4.21 -42.01 C4.21,-42.01 4.19,30.81 4.19,30.81 C4.19,30.81 -5.27,30.81 -5.27,30.81 C-5.27,30.81 -5.25,-42.01 -5.25,-42.01 C-5.25,-42.01 4.21,-42.01 4.21,-42.01c "
-                    android:valueType="pathType">
-                    <aapt:attr name="android:interpolator">
-                        <pathInterpolator android:pathData="M 0.0,0.0 c0.4,0 0.2,1 1.0,1.0" />
-                    </aapt:attr>
-                </objectAnimator>
-            </set>
-        </aapt:attr>
-    </target>
-    <target android:name="_R_G_L_1_G_T_1">
-        <aapt:attr name="android:animation">
-            <set android:ordering="together">
-                <objectAnimator
-                    android:duration="167"
-                    android:pathData="M 12.023,1.281C 12.023,1.656 12.023,0.9059999999999999 12.023,1.281"
-                    android:propertyName="translateXY"
-                    android:propertyXName="translateX"
-                    android:propertyYName="translateY"
-                    android:startOffset="0">
-                    <aapt:attr name="android:interpolator">
-                        <pathInterpolator android:pathData="M 0.0,0.0 c0.4,0 0.2,1 1.0,1.0" />
-                    </aapt:attr>
-                </objectAnimator>
-                <objectAnimator
-                    android:duration="183"
-                    android:pathData="M 12.023,1.281C 12.023,1.656 12.023,3.156 12.023,3.531"
-                    android:propertyName="translateXY"
-                    android:propertyXName="translateX"
-                    android:propertyYName="translateY"
-                    android:startOffset="167">
-                    <aapt:attr name="android:interpolator">
-                        <pathInterpolator android:pathData="M 0.0,0.0 c0.4,0 0.2,1 1.0,1.0" />
-                    </aapt:attr>
-                </objectAnimator>
-            </set>
-        </aapt:attr>
-    </target>
-    <target android:name="_R_G_L_1_G_T_1">
-        <aapt:attr name="android:animation">
-            <set android:ordering="together">
-                <objectAnimator
-                    android:duration="0"
-                    android:propertyName="scaleX"
-                    android:startOffset="167"
-                    android:valueFrom="0"
-                    android:valueTo="0.125"
-                    android:valueType="floatType" />
-            </set>
-        </aapt:attr>
-    </target>
-    <target android:name="_R_G_L_0_G_D_0_P_0">
-        <aapt:attr name="android:animation">
-            <set android:ordering="together">
-                <objectAnimator
-                    android:duration="267"
-                    android:propertyName="pathData"
-                    android:startOffset="0"
-                    android:valueFrom="M49.24 -12.32 C49.24,-12.32 49.24,52.91 49.24,52.91 C49.24,58.95 44.34,63.85 38.3,63.85 C38.3,63.85 -37.8,63.85 -37.8,63.85 C-43.84,63.85 -48.74,58.95 -48.74,52.91 C-48.74,52.91 -48.74,-12.32 -48.74,-12.32 C-48.74,-18.37 -43.84,-23.27 -37.8,-23.27 C-37.8,-23.27 38.3,-23.27 38.3,-23.27 C44.34,-23.27 49.24,-18.37 49.24,-12.32c "
-                    android:valueTo="M75.1 -1.1 C75.1,19.57 66.72,38.28 53.18,51.83 C39.63,65.37 20.92,73.75 0.25,73.75 C-20.42,73.75 -39.13,65.37 -52.68,51.83 C-66.22,38.28 -74.6,19.57 -74.6,-1.1 C-74.6,-21.77 -66.22,-40.48 -52.68,-54.02 C-39.13,-67.57 -20.42,-75.95 0.25,-75.95 C20.92,-75.95 39.63,-67.57 53.18,-54.02 C66.72,-40.48 75.1,-21.77 75.1,-1.1c "
-                    android:valueType="pathType">
-                    <aapt:attr name="android:interpolator">
-                        <pathInterpolator android:pathData="M 0.0,0.0 c0.4,0 0.2,1 1.0,1.0" />
-                    </aapt:attr>
-                </objectAnimator>
-            </set>
-        </aapt:attr>
-    </target>
-    <target android:name="_R_G_L_0_G_D_1_P_0">
-        <aapt:attr name="android:animation">
-            <set android:ordering="together">
-                <objectAnimator
-                    android:duration="117"
-                    android:propertyName="strokeColor"
-                    android:startOffset="0"
-                    android:valueFrom="#fff"
-                    android:valueTo="#fff"
-                    android:valueType="colorType">
-                    <aapt:attr name="android:interpolator">
-                        <pathInterpolator android:pathData="M 0.0,0.0 c0.167,0.167 0.833,0.833 1.0,1.0" />
-                    </aapt:attr>
-                </objectAnimator>
-                <objectAnimator
-                    android:duration="17"
-                    android:propertyName="strokeColor"
-                    android:startOffset="117"
-                    android:valueFrom="#fff"
-                    android:valueTo="#EA4335"
-                    android:valueType="colorType">
-                    <aapt:attr name="android:interpolator">
-                        <pathInterpolator android:pathData="M 0.0,0.0 c0.167,0.167 0.833,0.833 1.0,1.0" />
-                    </aapt:attr>
-                </objectAnimator>
-            </set>
-        </aapt:attr>
-    </target>
-    <target android:name="_R_G_L_0_G_D_1_P_0">
-        <aapt:attr name="android:animation">
-            <set android:ordering="together">
-                <objectAnimator
-                    android:duration="267"
-                    android:propertyName="strokeWidth"
-                    android:startOffset="0"
-                    android:valueFrom="14"
-                    android:valueTo="12"
-                    android:valueType="floatType">
-                    <aapt:attr name="android:interpolator">
-                        <pathInterpolator android:pathData="M 0.0,0.0 c0.4,0 0.2,1 1.0,1.0" />
-                    </aapt:attr>
-                </objectAnimator>
-            </set>
-        </aapt:attr>
-    </target>
-    <target android:name="_R_G_L_0_G_D_1_P_0">
-        <aapt:attr name="android:animation">
-            <set android:ordering="together">
-                <objectAnimator
-                    android:duration="267"
-                    android:propertyName="pathData"
-                    android:startOffset="0"
-                    android:valueFrom="M49.24 -12.32 C49.24,-12.32 49.24,52.91 49.24,52.91 C49.24,58.95 44.34,63.85 38.3,63.85 C38.3,63.85 -37.8,63.85 -37.8,63.85 C-43.84,63.85 -48.74,58.95 -48.74,52.91 C-48.74,52.91 -48.74,-12.32 -48.74,-12.32 C-48.74,-18.37 -43.84,-23.27 -37.8,-23.27 C-37.8,-23.27 38.3,-23.27 38.3,-23.27 C44.34,-23.27 49.24,-18.37 49.24,-12.32c "
-                    android:valueTo="M75.1 -1.1 C75.1,19.57 66.72,38.28 53.18,51.83 C39.63,65.37 20.92,73.75 0.25,73.75 C-20.42,73.75 -39.13,65.37 -52.68,51.83 C-66.22,38.28 -74.6,19.57 -74.6,-1.1 C-74.6,-21.77 -66.22,-40.48 -52.68,-54.02 C-39.13,-67.57 -20.42,-75.95 0.25,-75.95 C20.92,-75.95 39.63,-67.57 53.18,-54.02 C66.72,-40.48 75.1,-21.77 75.1,-1.1c "
-                    android:valueType="pathType">
-                    <aapt:attr name="android:interpolator">
-                        <pathInterpolator android:pathData="M 0.0,0.0 c0.4,0 0.2,1 1.0,1.0" />
+                        <pathInterpolator android:pathData="M 0.0,0.0 c0.293,0 0.689,1 1.0,1.0"/>
                     </aapt:attr>
                 </objectAnimator>
             </set>
@@ -561,13 +182,9 @@
     <target android:name="time_group">
         <aapt:attr name="android:animation">
             <set android:ordering="together">
-                <objectAnimator
-                    android:duration="1017"
-                    android:propertyName="translateX"
-                    android:startOffset="0"
-                    android:valueFrom="0"
-                    android:valueTo="1"
-                    android:valueType="floatType" />
+                <objectAnimator android:propertyName="translateX" android:duration="1000"
+                                android:startOffset="0" android:valueFrom="0" android:valueTo="1"
+                                android:valueType="floatType"/>
             </set>
         </aapt:attr>
     </target>
diff --git a/core/res/res/anim/lock_unlock.xml b/core/res/res/anim/lock_unlock.xml
index 9cc31a0..0e85c9d 100755
--- a/core/res/res/anim/lock_unlock.xml
+++ b/core/res/res/anim/lock_unlock.xml
@@ -14,124 +14,85 @@
      limitations under the License.
 -->
 <animated-vector xmlns:android="http://schemas.android.com/apk/res/android"
-    xmlns:aapt="http://schemas.android.com/aapt">
+                 xmlns:aapt="http://schemas.android.com/aapt">
     <aapt:attr name="android:drawable">
-        <vector
-            android:width="24dp"
-            android:height="24dp"
-            android:viewportWidth="24"
-            android:viewportHeight="24">
+        <vector android:height="40dp" android:width="32dp" android:viewportHeight="40"
+                android:viewportWidth="32">
             <group android:name="_R_G">
-                <group
-                    android:name="_R_G_L_2_G_T_1"
-                    android:translateX="12"
-                    android:translateY="15">
-                    <group
-                        android:name="_R_G_L_2_G"
-                        android:translateX="-8.25"
-                        android:translateY="-7.25">
-                        <path
-                            android:name="_R_G_L_2_G_D_0_P_0"
-                            android:fillAlpha="1"
-                            android:fillColor="?attr/textColor"
-                            android:fillType="nonZero"
-                            android:pathData=" M14.25 0.25 C14.25,0.25 12.75,0.25 12.75,0.25 C12.75,0.25 10.75,0.25 10.75,0.25 C10.75,0.25 5.75,0.25 5.75,0.25 C5.75,0.25 3.75,0.25 3.75,0.25 C3.75,0.25 2.25,0.25 2.25,0.25 C1.15,0.25 0.25,1.15 0.25,2.25 C0.25,2.25 0.25,12.25 0.25,12.25 C0.25,13.35 1.15,14.25 2.25,14.25 C2.25,14.25 14.25,14.25 14.25,14.25 C15.35,14.25 16.25,13.35 16.25,12.25 C16.25,12.25 16.25,2.25 16.25,2.25 C16.25,1.15 15.35,0.25 14.25,0.25c  M14.25 12.25 C14.25,12.25 2.25,12.25 2.25,12.25 C2.25,12.25 2.25,2.25 2.25,2.25 C2.25,2.25 3.75,2.25 3.75,2.25 C3.75,2.25 12.75,2.25 12.75,2.25 C12.75,2.25 14.25,2.25 14.25,2.25 C14.25,2.25 14.25,12.25 14.25,12.25c " />
-                    </group>
-                </group>
-                <group
-                    android:name="_R_G_L_1_G_N_5_T_1"
-                    android:translateX="12"
-                    android:translateY="15">
-                    <group
-                        android:name="_R_G_L_1_G_N_5_T_0"
-                        android:translateX="-8.25"
-                        android:translateY="-7.25">
-                        <group
-                            android:name="_R_G_L_1_G"
-                            android:pivotX="2.25"
-                            android:pivotY="2.25"
-                            android:scaleX="1"
-                            android:scaleY="1"
-                            android:translateX="6"
-                            android:translateY="5">
-                            <path
-                                android:name="_R_G_L_1_G_D_0_P_0"
-                                android:fillAlpha="1"
-                                android:fillColor="?attr/textColor"
-                                android:fillType="nonZero"
-                                android:pathData=" M2.25 0.25 C3.35,0.25 4.25,1.15 4.25,2.25 C4.25,3.35 3.35,4.25 2.25,4.25 C1.15,4.25 0.25,3.35 0.25,2.25 C0.25,1.15 1.15,0.25 2.25,0.25c " />
+                <group android:name="_R_G_L_2_G_N_1_T_0" android:translateX="16"
+                       android:translateY="20" android:scaleX="1.3" android:scaleY="1.3">
+                    <group android:name="_R_G_L_2_G_T_1" android:translateY="3">
+                        <group android:name="_R_G_L_2_G" android:translateX="-8.25"
+                               android:translateY="-7.25">
+                            <path android:name="_R_G_L_2_G_D_0_P_0" android:fillColor="?attr/textColor"
+                                  android:fillAlpha="1" android:fillType="nonZero"
+                                  android:pathData=" M14.25 0.25 C14.25,0.25 12.75,0.25 12.75,0.25 C12.75,0.25 10.75,0.25 10.75,0.25 C10.75,0.25 5.75,0.25 5.75,0.25 C5.75,0.25 3.75,0.25 3.75,0.25 C3.75,0.25 2.25,0.25 2.25,0.25 C1.15,0.25 0.25,1.15 0.25,2.25 C0.25,2.25 0.25,12.25 0.25,12.25 C0.25,13.35 1.15,14.25 2.25,14.25 C2.25,14.25 14.25,14.25 14.25,14.25 C15.35,14.25 16.25,13.35 16.25,12.25 C16.25,12.25 16.25,2.25 16.25,2.25 C16.25,1.15 15.35,0.25 14.25,0.25c  M14.25 12.25 C14.25,12.25 2.25,12.25 2.25,12.25 C2.25,12.25 2.25,2.25 2.25,2.25 C2.25,2.25 3.75,2.25 3.75,2.25 C3.75,2.25 12.75,2.25 12.75,2.25 C12.75,2.25 14.25,2.25 14.25,2.25 C14.25,2.25 14.25,12.25 14.25,12.25c "/>
                         </group>
                     </group>
                 </group>
-                <group
-                    android:name="_R_G_L_0_G_N_5_T_1"
-                    android:translateX="12"
-                    android:translateY="15">
-                    <group
-                        android:name="_R_G_L_0_G_N_5_T_0"
-                        android:translateX="-8.25"
-                        android:translateY="-7.25">
-                        <group
-                            android:name="_R_G_L_0_G"
-                            android:pivotX="27.965"
-                            android:pivotY="-32"
-                            android:scaleX="0.125"
-                            android:scaleY="0.125"
-                            android:translateX="-16.219"
-                            android:translateY="32.25">
-                            <path
-                                android:name="_R_G_L_0_G_D_0_P_0"
-                                android:fillAlpha="0"
-                                android:fillColor="#ff0000"
-                                android:fillType="nonZero"
-                                android:pathData=" M-28.21 -31.92 C-28.21,-31.92 -27.85,-48.38 -27.97,-55.48 C-28,-57.63 -23.5,-79.87 -0.75,-79.82 C22.77,-79.76 27.75,-59.37 27.72,-58.27 C27.55,-52.88 27.97,-31.67 27.97,-31.67 " />
-                            <path
-                                android:name="_R_G_L_0_G_D_1_P_0"
-                                android:pathData=" M-28.21 -31.92 C-28.21,-31.92 -27.85,-48.38 -27.97,-55.48 C-28,-57.63 -23.5,-79.87 -0.75,-79.82 C22.77,-79.76 27.75,-59.37 27.72,-58.27 C27.55,-52.88 27.97,-31.67 27.97,-31.67 "
-                                android:strokeWidth="16"
-                                android:strokeAlpha="1"
-                                android:strokeColor="?attr/textColor"/>
+                <group android:name="_R_G_L_1_G_N_4_N_1_T_0" android:translateX="16"
+                       android:translateY="20" android:scaleX="1.3" android:scaleY="1.3">
+                    <group android:name="_R_G_L_1_G_N_4_T_1" android:translateY="3">
+                        <group android:name="_R_G_L_1_G_N_4_T_0" android:translateX="-8.25"
+                               android:translateY="-7.25">
+                            <group android:name="_R_G_L_1_G" android:translateX="6"
+                                   android:translateY="5" android:pivotX="2.25"
+                                   android:pivotY="2.25" android:scaleX="1" android:scaleY="1">
+                                <path android:name="_R_G_L_1_G_D_0_P_0" android:fillColor="?attr/textColor"
+                                      android:fillAlpha="1" android:fillType="nonZero"
+                                      android:pathData=" M2.25 0.25 C3.35,0.25 4.25,1.15 4.25,2.25 C4.25,3.35 3.35,4.25 2.25,4.25 C1.15,4.25 0.25,3.35 0.25,2.25 C0.25,1.15 1.15,0.25 2.25,0.25c "/>
+                            </group>
+                        </group>
+                    </group>
+                </group>
+                <group android:name="_R_G_L_0_G_N_4_N_1_T_0" android:translateX="16"
+                       android:translateY="20" android:scaleX="1.3" android:scaleY="1.3">
+                    <group android:name="_R_G_L_0_G_N_4_T_1" android:translateY="3">
+                        <group android:name="_R_G_L_0_G_N_4_T_0" android:translateX="-8.25"
+                               android:translateY="-7.25">
+                            <group android:name="_R_G_L_0_G" android:translateX="-16.219"
+                                   android:translateY="32.25" android:pivotX="27.965"
+                                   android:pivotY="-32" android:scaleX="0.125"
+                                   android:scaleY="0.125">
+                                <path android:name="_R_G_L_0_G_D_0_P_0" android:fillColor="#ff0000"
+                                      android:fillAlpha="0" android:fillType="nonZero"
+                                      android:pathData=" M-28.21 -31.92 C-28.21,-31.92 -27.85,-48.38 -27.97,-55.48 C-28,-57.63 -23.5,-79.87 -0.75,-79.82 C22.77,-79.76 27.75,-59.37 27.72,-58.27 C27.55,-52.88 27.97,-31.67 27.97,-31.67 "/>
+                                <path android:name="_R_G_L_0_G_D_1_P_0"
+                                      android:strokeColor="?attr/textColor" android:strokeLineCap="round"
+                                      android:strokeLineJoin="round" android:strokeWidth="16"
+                                      android:strokeAlpha="1"
+                                      android:pathData=" M-28.21 -31.92 C-28.21,-31.92 -27.85,-48.38 -27.97,-55.48 C-28,-57.63 -23.5,-79.87 -0.75,-79.82 C22.77,-79.76 27.75,-59.37 27.72,-58.27 C27.55,-52.88 27.97,-31.67 27.97,-31.67 "/>
+                            </group>
                         </group>
                     </group>
                 </group>
             </group>
-            <group android:name="time_group" />
+            <group android:name="time_group"/>
         </vector>
     </aapt:attr>
     <target android:name="_R_G_L_2_G_T_1">
         <aapt:attr name="android:animation">
             <set android:ordering="together">
-                <objectAnimator
-                    android:duration="133"
-                    android:pathData="M 12,15C 12,14.85416667163372 12,14.125 12,14.125"
-                    android:propertyName="translateXY"
-                    android:propertyXName="translateX"
-                    android:propertyYName="translateY"
-                    android:startOffset="0">
+                <objectAnimator android:propertyName="translateY" android:duration="133"
+                                android:startOffset="0" android:valueFrom="3"
+                                android:valueTo="1.625" android:valueType="floatType">
                     <aapt:attr name="android:interpolator">
-                        <pathInterpolator android:pathData="M 0.0,0.0 c0.333,0 0.667,1 1.0,1.0" />
+                        <pathInterpolator
+                            android:pathData="M 0.0,0.0 c0.075,0.167 0.622,1 1.0,1.0"/>
                     </aapt:attr>
                 </objectAnimator>
-                <objectAnimator
-                    android:duration="133"
-                    android:pathData="M 12,14.125C 12,14.125 12,15.05870145463943 12,15.324"
-                    android:propertyName="translateXY"
-                    android:propertyXName="translateX"
-                    android:propertyYName="translateY"
-                    android:startOffset="133">
+                <objectAnimator android:propertyName="translateY" android:duration="133"
+                                android:startOffset="133" android:valueFrom="1.625"
+                                android:valueTo="3.699" android:valueType="floatType">
                     <aapt:attr name="android:interpolator">
-                        <pathInterpolator android:pathData="M 0.0,0.0 c0.333,0 0.667,1 1.0,1.0" />
+                        <pathInterpolator android:pathData="M 0.0,0.0 c0.352,0 0.717,1 1.0,1.0"/>
                     </aapt:attr>
                 </objectAnimator>
-                <objectAnimator
-                    android:duration="100"
-                    android:pathData="M 12,15.324C 12,15.40252217555046 12,14.96669441461563 12,15"
-                    android:propertyName="translateXY"
-                    android:propertyXName="translateX"
-                    android:propertyYName="translateY"
-                    android:startOffset="267">
+                <objectAnimator android:propertyName="translateY" android:duration="100"
+                                android:startOffset="267" android:valueFrom="3.699"
+                                android:valueTo="3" android:valueType="floatType">
                     <aapt:attr name="android:interpolator">
-                        <pathInterpolator android:pathData="M 0.0,0.0 c0.333,0 0.667,1 1.0,1.0" />
+                        <pathInterpolator android:pathData="M 0.0,0.0 c0.356,0 0.527,1 1.0,1.0"/>
                     </aapt:attr>
                 </objectAnimator>
             </set>
@@ -140,87 +101,60 @@
     <target android:name="_R_G_L_1_G">
         <aapt:attr name="android:animation">
             <set android:ordering="together">
-                <objectAnimator
-                    android:duration="100"
-                    android:propertyName="scaleX"
-                    android:startOffset="0"
-                    android:valueFrom="1"
-                    android:valueTo="0.85"
-                    android:valueType="floatType">
+                <objectAnimator android:propertyName="scaleX" android:duration="100"
+                                android:startOffset="0" android:valueFrom="1" android:valueTo="0.85"
+                                android:valueType="floatType">
                     <aapt:attr name="android:interpolator">
-                        <pathInterpolator android:pathData="M 0.0,0.0 c0.4,0 0.2,1 1.0,1.0" />
+                        <pathInterpolator android:pathData="M 0.0,0.0 c0.4,0 0.2,1 1.0,1.0"/>
                     </aapt:attr>
                 </objectAnimator>
-                <objectAnimator
-                    android:duration="100"
-                    android:propertyName="scaleY"
-                    android:startOffset="0"
-                    android:valueFrom="1"
-                    android:valueTo="0.85"
-                    android:valueType="floatType">
+                <objectAnimator android:propertyName="scaleY" android:duration="100"
+                                android:startOffset="0" android:valueFrom="1" android:valueTo="0.85"
+                                android:valueType="floatType">
                     <aapt:attr name="android:interpolator">
-                        <pathInterpolator android:pathData="M 0.0,0.0 c0.4,0 0.2,1 1.0,1.0" />
+                        <pathInterpolator android:pathData="M 0.0,0.0 c0.4,0 0.2,1 1.0,1.0"/>
                     </aapt:attr>
                 </objectAnimator>
-                <objectAnimator
-                    android:duration="283"
-                    android:propertyName="scaleX"
-                    android:startOffset="100"
-                    android:valueFrom="0.85"
-                    android:valueTo="1"
-                    android:valueType="floatType">
+                <objectAnimator android:propertyName="scaleX" android:duration="283"
+                                android:startOffset="100" android:valueFrom="0.85"
+                                android:valueTo="1" android:valueType="floatType">
                     <aapt:attr name="android:interpolator">
-                        <pathInterpolator android:pathData="M 0.0,0.0 c0.4,0 0.2,1 1.0,1.0" />
+                        <pathInterpolator android:pathData="M 0.0,0.0 c0.4,0 0.2,1 1.0,1.0"/>
                     </aapt:attr>
                 </objectAnimator>
-                <objectAnimator
-                    android:duration="283"
-                    android:propertyName="scaleY"
-                    android:startOffset="100"
-                    android:valueFrom="0.85"
-                    android:valueTo="1"
-                    android:valueType="floatType">
+                <objectAnimator android:propertyName="scaleY" android:duration="283"
+                                android:startOffset="100" android:valueFrom="0.85"
+                                android:valueTo="1" android:valueType="floatType">
                     <aapt:attr name="android:interpolator">
-                        <pathInterpolator android:pathData="M 0.0,0.0 c0.4,0 0.2,1 1.0,1.0" />
+                        <pathInterpolator android:pathData="M 0.0,0.0 c0.4,0 0.2,1 1.0,1.0"/>
                     </aapt:attr>
                 </objectAnimator>
             </set>
         </aapt:attr>
     </target>
-    <target android:name="_R_G_L_1_G_N_5_T_1">
+    <target android:name="_R_G_L_1_G_N_4_T_1">
         <aapt:attr name="android:animation">
             <set android:ordering="together">
-                <objectAnimator
-                    android:duration="133"
-                    android:pathData="M 12,15C 12,14.85416667163372 12,14.125 12,14.125"
-                    android:propertyName="translateXY"
-                    android:propertyXName="translateX"
-                    android:propertyYName="translateY"
-                    android:startOffset="0">
+                <objectAnimator android:propertyName="translateY" android:duration="133"
+                                android:startOffset="0" android:valueFrom="3"
+                                android:valueTo="1.625" android:valueType="floatType">
                     <aapt:attr name="android:interpolator">
-                        <pathInterpolator android:pathData="M 0.0,0.0 c0.333,0 0.667,1 1.0,1.0" />
+                        <pathInterpolator
+                            android:pathData="M 0.0,0.0 c0.075,0.167 0.622,1 1.0,1.0"/>
                     </aapt:attr>
                 </objectAnimator>
-                <objectAnimator
-                    android:duration="133"
-                    android:pathData="M 12,14.125C 12,14.125 12,15.05870145463943 12,15.324"
-                    android:propertyName="translateXY"
-                    android:propertyXName="translateX"
-                    android:propertyYName="translateY"
-                    android:startOffset="133">
+                <objectAnimator android:propertyName="translateY" android:duration="133"
+                                android:startOffset="133" android:valueFrom="1.625"
+                                android:valueTo="3.699" android:valueType="floatType">
                     <aapt:attr name="android:interpolator">
-                        <pathInterpolator android:pathData="M 0.0,0.0 c0.333,0 0.667,1 1.0,1.0" />
+                        <pathInterpolator android:pathData="M 0.0,0.0 c0.352,0 0.717,1 1.0,1.0"/>
                     </aapt:attr>
                 </objectAnimator>
-                <objectAnimator
-                    android:duration="100"
-                    android:pathData="M 12,15.324C 12,15.40252217555046 12,14.96669441461563 12,15"
-                    android:propertyName="translateXY"
-                    android:propertyXName="translateX"
-                    android:propertyYName="translateY"
-                    android:startOffset="267">
+                <objectAnimator android:propertyName="translateY" android:duration="100"
+                                android:startOffset="267" android:valueFrom="3.699"
+                                android:valueTo="3" android:valueType="floatType">
                     <aapt:attr name="android:interpolator">
-                        <pathInterpolator android:pathData="M 0.0,0.0 c0.333,0 0.667,1 1.0,1.0" />
+                        <pathInterpolator android:pathData="M 0.0,0.0 c0.356,0 0.527,1 1.0,1.0"/>
                     </aapt:attr>
                 </objectAnimator>
             </set>
@@ -229,26 +163,22 @@
     <target android:name="_R_G_L_0_G_D_0_P_0">
         <aapt:attr name="android:animation">
             <set android:ordering="together">
-                <objectAnimator
-                    android:duration="67"
-                    android:propertyName="pathData"
-                    android:startOffset="0"
-                    android:valueFrom="M-28.21 -31.92 C-28.21,-31.92 -27.85,-48.38 -27.97,-55.48 C-28,-57.63 -23.5,-79.87 -0.75,-79.82 C22.77,-79.76 27.75,-59.37 27.72,-58.27 C27.55,-52.88 27.97,-31.67 27.97,-31.67 "
-                    android:valueTo="M-27.97 -48.55 C-27.97,-48.55 -28,-53.75 -27.97,-55.48 C-27.92,-57.63 -23.5,-79.87 -0.75,-79.82 C22.77,-79.76 27.75,-59.37 27.72,-58.27 C27.55,-52.88 27.97,-31.67 27.97,-31.67 "
-                    android:valueType="pathType">
+                <objectAnimator android:propertyName="pathData" android:duration="67"
+                                android:startOffset="0"
+                                android:valueFrom="M-28.21 -31.92 C-28.21,-31.92 -27.85,-48.38 -27.97,-55.48 C-28,-57.63 -23.5,-79.87 -0.75,-79.82 C22.77,-79.76 27.75,-59.37 27.72,-58.27 C27.55,-52.88 27.97,-31.67 27.97,-31.67 "
+                                android:valueTo="M-27.97 -59.3 C-27.97,-59.3 -28,-64.5 -27.97,-66.23 C-27.92,-68.37 -23.5,-90.63 -0.75,-90.57 C22.77,-90.51 27.75,-70.12 27.72,-69.02 C27.55,-63.63 27.97,-25.67 27.97,-25.67 "
+                                android:valueType="pathType">
                     <aapt:attr name="android:interpolator">
-                        <pathInterpolator android:pathData="M 0.0,0.0 c0.353,0 0.2,1 1.0,1.0" />
+                        <pathInterpolator android:pathData="M 0.0,0.0 c0.353,0 0.2,1 1.0,1.0"/>
                     </aapt:attr>
                 </objectAnimator>
-                <objectAnimator
-                    android:duration="333"
-                    android:propertyName="pathData"
-                    android:startOffset="67"
-                    android:valueFrom="M-27.97 -48.55 C-27.97,-48.55 -28,-53.75 -27.97,-55.48 C-27.92,-57.63 -23.5,-79.87 -0.75,-79.82 C22.77,-79.76 27.75,-59.37 27.72,-58.27 C27.55,-52.88 27.97,-31.67 27.97,-31.67 "
-                    android:valueTo="M79.79 -48.55 C79.79,-48.55 79.75,-53.75 79.78,-55.48 C79.83,-57.62 79.08,-78.36 53.07,-78.83 C29.5,-79.25 25.2,-59.38 25.22,-58.27 C25.25,-56.25 24.97,-31.17 24.97,-31.17 "
-                    android:valueType="pathType">
+                <objectAnimator android:propertyName="pathData" android:duration="333"
+                                android:startOffset="67"
+                                android:valueFrom="M-27.97 -59.3 C-27.97,-59.3 -28,-64.5 -27.97,-66.23 C-27.92,-68.37 -23.5,-90.63 -0.75,-90.57 C22.77,-90.51 27.75,-70.12 27.72,-69.02 C27.55,-63.63 27.97,-25.67 27.97,-25.67 "
+                                android:valueTo="M79.79 -48.55 C79.79,-48.55 79.75,-53.75 79.78,-55.48 C79.83,-57.62 79.08,-78.36 53.07,-78.83 C29.5,-79.25 25.2,-59.38 25.22,-58.27 C25.25,-56.25 24.97,-31.17 24.97,-31.17 "
+                                android:valueType="pathType">
                     <aapt:attr name="android:interpolator">
-                        <pathInterpolator android:pathData="M 0.0,0.0 c0.542,0 0.026,1 1.0,1.0" />
+                        <pathInterpolator android:pathData="M 0.0,0.0 c0.542,0 0.026,1 1.0,1.0"/>
                     </aapt:attr>
                 </objectAnimator>
             </set>
@@ -257,65 +187,50 @@
     <target android:name="_R_G_L_0_G_D_1_P_0">
         <aapt:attr name="android:animation">
             <set android:ordering="together">
-                <objectAnimator
-                    android:duration="67"
-                    android:propertyName="pathData"
-                    android:startOffset="0"
-                    android:valueFrom="M-28.21 -31.92 C-28.21,-31.92 -27.85,-48.38 -27.97,-55.48 C-28,-57.63 -23.5,-79.87 -0.75,-79.82 C22.77,-79.76 27.75,-59.37 27.72,-58.27 C27.55,-52.88 27.97,-31.67 27.97,-31.67 "
-                    android:valueTo="M-27.97 -48.55 C-27.97,-48.55 -28,-53.75 -27.97,-55.48 C-27.92,-57.63 -23.5,-79.87 -0.75,-79.82 C22.77,-79.76 27.75,-59.37 27.72,-58.27 C27.55,-52.88 27.97,-31.67 27.97,-31.67 "
-                    android:valueType="pathType">
+                <objectAnimator android:propertyName="pathData" android:duration="67"
+                                android:startOffset="0"
+                                android:valueFrom="M-28.21 -31.92 C-28.21,-31.92 -27.85,-48.38 -27.97,-55.48 C-28,-57.63 -23.5,-79.87 -0.75,-79.82 C22.77,-79.76 27.75,-59.37 27.72,-58.27 C27.55,-52.88 27.97,-31.67 27.97,-31.67 "
+                                android:valueTo="M-27.97 -59.3 C-27.97,-59.3 -28,-64.5 -27.97,-66.23 C-27.92,-68.37 -23.5,-90.63 -0.75,-90.57 C22.77,-90.51 27.75,-70.12 27.72,-69.02 C27.55,-63.63 27.97,-25.67 27.97,-25.67 "
+                                android:valueType="pathType">
                     <aapt:attr name="android:interpolator">
-                        <pathInterpolator android:pathData="M 0.0,0.0 c0.353,0 0.2,1 1.0,1.0" />
+                        <pathInterpolator android:pathData="M 0.0,0.0 c0.353,0 0.2,1 1.0,1.0"/>
                     </aapt:attr>
                 </objectAnimator>
-                <objectAnimator
-                    android:duration="333"
-                    android:propertyName="pathData"
-                    android:startOffset="67"
-                    android:valueFrom="M-27.97 -48.55 C-27.97,-48.55 -28,-53.75 -27.97,-55.48 C-27.92,-57.63 -23.5,-79.87 -0.75,-79.82 C22.77,-79.76 27.75,-59.37 27.72,-58.27 C27.55,-52.88 27.97,-31.67 27.97,-31.67 "
-                    android:valueTo="M79.79 -48.55 C79.79,-48.55 79.75,-53.75 79.78,-55.48 C79.83,-57.62 79.08,-78.36 53.07,-78.83 C29.5,-79.25 25.2,-59.38 25.22,-58.27 C25.25,-56.25 24.97,-31.17 24.97,-31.17 "
-                    android:valueType="pathType">
+                <objectAnimator android:propertyName="pathData" android:duration="333"
+                                android:startOffset="67"
+                                android:valueFrom="M-27.97 -59.3 C-27.97,-59.3 -28,-64.5 -27.97,-66.23 C-27.92,-68.37 -23.5,-90.63 -0.75,-90.57 C22.77,-90.51 27.75,-70.12 27.72,-69.02 C27.55,-63.63 27.97,-25.67 27.97,-25.67 "
+                                android:valueTo="M79.79 -48.55 C79.79,-48.55 79.75,-53.75 79.78,-55.48 C79.83,-57.62 79.08,-78.36 53.07,-78.83 C29.5,-79.25 25.2,-59.38 25.22,-58.27 C25.25,-56.25 24.97,-31.17 24.97,-31.17 "
+                                android:valueType="pathType">
                     <aapt:attr name="android:interpolator">
-                        <pathInterpolator android:pathData="M 0.0,0.0 c0.542,0 0.026,1 1.0,1.0" />
+                        <pathInterpolator android:pathData="M 0.0,0.0 c0.542,0 0.026,1 1.0,1.0"/>
                     </aapt:attr>
                 </objectAnimator>
             </set>
         </aapt:attr>
     </target>
-    <target android:name="_R_G_L_0_G_N_5_T_1">
+    <target android:name="_R_G_L_0_G_N_4_T_1">
         <aapt:attr name="android:animation">
             <set android:ordering="together">
-                <objectAnimator
-                    android:duration="133"
-                    android:pathData="M 12,15C 12,14.85416667163372 12,14.125 12,14.125"
-                    android:propertyName="translateXY"
-                    android:propertyXName="translateX"
-                    android:propertyYName="translateY"
-                    android:startOffset="0">
+                <objectAnimator android:propertyName="translateY" android:duration="133"
+                                android:startOffset="0" android:valueFrom="3"
+                                android:valueTo="1.625" android:valueType="floatType">
                     <aapt:attr name="android:interpolator">
-                        <pathInterpolator android:pathData="M 0.0,0.0 c0.333,0 0.667,1 1.0,1.0" />
+                        <pathInterpolator
+                            android:pathData="M 0.0,0.0 c0.075,0.167 0.622,1 1.0,1.0"/>
                     </aapt:attr>
                 </objectAnimator>
-                <objectAnimator
-                    android:duration="133"
-                    android:pathData="M 12,14.125C 12,14.125 12,15.05870145463943 12,15.324"
-                    android:propertyName="translateXY"
-                    android:propertyXName="translateX"
-                    android:propertyYName="translateY"
-                    android:startOffset="133">
+                <objectAnimator android:propertyName="translateY" android:duration="133"
+                                android:startOffset="133" android:valueFrom="1.625"
+                                android:valueTo="3.699" android:valueType="floatType">
                     <aapt:attr name="android:interpolator">
-                        <pathInterpolator android:pathData="M 0.0,0.0 c0.333,0 0.667,1 1.0,1.0" />
+                        <pathInterpolator android:pathData="M 0.0,0.0 c0.352,0 0.717,1 1.0,1.0"/>
                     </aapt:attr>
                 </objectAnimator>
-                <objectAnimator
-                    android:duration="100"
-                    android:pathData="M 12,15.324C 12,15.40252217555046 12,14.96669441461563 12,15"
-                    android:propertyName="translateXY"
-                    android:propertyXName="translateX"
-                    android:propertyYName="translateY"
-                    android:startOffset="267">
+                <objectAnimator android:propertyName="translateY" android:duration="100"
+                                android:startOffset="267" android:valueFrom="3.699"
+                                android:valueTo="3" android:valueType="floatType">
                     <aapt:attr name="android:interpolator">
-                        <pathInterpolator android:pathData="M 0.0,0.0 c0.333,0 0.667,1 1.0,1.0" />
+                        <pathInterpolator android:pathData="M 0.0,0.0 c0.356,0 0.527,1 1.0,1.0"/>
                     </aapt:attr>
                 </objectAnimator>
             </set>
@@ -324,13 +239,9 @@
     <target android:name="time_group">
         <aapt:attr name="android:animation">
             <set android:ordering="together">
-                <objectAnimator
-                    android:duration="717"
-                    android:propertyName="translateX"
-                    android:startOffset="0"
-                    android:valueFrom="0"
-                    android:valueTo="1"
-                    android:valueType="floatType" />
+                <objectAnimator android:propertyName="translateX" android:duration="717"
+                                android:startOffset="0" android:valueFrom="0" android:valueTo="1"
+                                android:valueType="floatType"/>
             </set>
         </aapt:attr>
     </target>
diff --git a/core/res/res/anim/task_close_enter.xml b/core/res/res/anim/task_close_enter.xml
index b059aa9..487ff5c 100644
--- a/core/res/res/anim/task_close_enter.xml
+++ b/core/res/res/anim/task_close_enter.xml
@@ -18,6 +18,7 @@
 <set xmlns:android="http://schemas.android.com/apk/res/android"
     android:shareInterpolator="false"
     android:zAdjustment="top"
+    android:hasRoundedCorners="true"
     android:showWallpaper="true">
 
     <alpha
diff --git a/core/res/res/anim/task_close_exit.xml b/core/res/res/anim/task_close_exit.xml
index c9ade22..afc3256c 100644
--- a/core/res/res/anim/task_close_exit.xml
+++ b/core/res/res/anim/task_close_exit.xml
@@ -18,6 +18,7 @@
 
 <set xmlns:android="http://schemas.android.com/apk/res/android"
     android:shareInterpolator="false"
+    android:hasRoundedCorners="true"
     android:showWallpaper="true">
 
     <alpha
diff --git a/core/res/res/anim/task_open_enter.xml b/core/res/res/anim/task_open_enter.xml
index 5c61859..0aafc1c 100644
--- a/core/res/res/anim/task_open_enter.xml
+++ b/core/res/res/anim/task_open_enter.xml
@@ -20,6 +20,7 @@
 <set xmlns:android="http://schemas.android.com/apk/res/android"
     android:shareInterpolator="false"
     android:zAdjustment="top"
+    android:hasRoundedCorners="true"
     android:showWallpaper="true">
 
     <alpha
diff --git a/core/res/res/anim/task_open_enter_cross_profile_apps.xml b/core/res/res/anim/task_open_enter_cross_profile_apps.xml
index 6441047..702f7ba 100644
--- a/core/res/res/anim/task_open_enter_cross_profile_apps.xml
+++ b/core/res/res/anim/task_open_enter_cross_profile_apps.xml
@@ -20,6 +20,7 @@
 <set xmlns:android="http://schemas.android.com/apk/res/android"
     android:shareInterpolator="false"
     android:zAdjustment="top"
+    android:hasRoundedCorners="true"
     android:showWallpaper="true">
 
     <alpha
diff --git a/core/res/res/anim/task_open_exit.xml b/core/res/res/anim/task_open_exit.xml
index 9394c57..691317d 100644
--- a/core/res/res/anim/task_open_exit.xml
+++ b/core/res/res/anim/task_open_exit.xml
@@ -18,6 +18,7 @@
 
 <set xmlns:android="http://schemas.android.com/apk/res/android"
     android:shareInterpolator="false"
+    android:hasRoundedCorners="true"
     android:showWallpaper="true">
 
     <alpha
diff --git a/core/res/res/color-car/car_borderless_button_text_color.xml b/core/res/res/color-car/car_borderless_button_text_color.xml
new file mode 100644
index 0000000..1cdd6cd
--- /dev/null
+++ b/core/res/res/color-car/car_borderless_button_text_color.xml
@@ -0,0 +1,20 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Copyright (C) 2019 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.
+-->
+<!-- Default text colors for car buttons when enabled/disabled. -->
+<selector xmlns:android="http://schemas.android.com/apk/res/android">
+    <item android:color="@*android:color/car_grey_700" android:state_enabled="false"/>
+    <item android:color="?android:attr/colorButtonNormal"/>
+</selector>
diff --git a/core/res/res/color-car/car_button_text_color.xml b/core/res/res/color-car/car_button_text_color.xml
new file mode 100644
index 0000000..eda54d9
--- /dev/null
+++ b/core/res/res/color-car/car_button_text_color.xml
@@ -0,0 +1,20 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Copyright (C) 2019 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.
+-->
+<!-- Default text colors for car buttons when enabled/disabled. -->
+<selector xmlns:android="http://schemas.android.com/apk/res/android">
+    <item android:color="@*android:color/car_grey_700" android:state_enabled="false"/>
+    <item android:color="@*android:color/car_action1"/>
+</selector>
diff --git a/core/res/res/color-car/car_switch.xml b/core/res/res/color-car/car_switch.xml
new file mode 100644
index 0000000..ebf3841
--- /dev/null
+++ b/core/res/res/color-car/car_switch.xml
@@ -0,0 +1,24 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!--
+    Copyright 2019 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.
+-->
+
+<selector xmlns:android="http://schemas.android.com/apk/res/android">
+    <item
+        android:color="?attr/colorControlActivated"
+        android:state_checked="true"/>
+    <item
+        android:color="?attr/colorSwitchThumbNormal"/>
+</selector>
diff --git a/core/res/res/drawable-car/car_button_background.xml b/core/res/res/drawable-car/car_button_background.xml
new file mode 100644
index 0000000..3e2610c
--- /dev/null
+++ b/core/res/res/drawable-car/car_button_background.xml
@@ -0,0 +1,36 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Copyright (C) 2019 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.
+-->
+<!-- Default background styles for car buttons when enabled/disabled. -->
+<ripple
+    xmlns:android="http://schemas.android.com/apk/res/android"
+    android:color="?android:attr/colorControlHighlight">
+    <item>
+        <selector>
+            <item android:state_enabled="false">
+                <shape android:shape="rectangle">
+                    <corners android:radius="@*android:dimen/car_button_radius"/>
+                    <solid android:color="@*android:color/car_grey_300"/>
+                </shape>
+            </item>
+            <item>
+                <shape android:shape="rectangle">
+                    <corners android:radius="@*android:dimen/car_button_radius"/>
+                    <solid android:color="?android:attr/colorButtonNormal"/>
+                </shape>
+            </item>
+        </selector>
+    </item>
+</ripple>
diff --git a/core/res/res/drawable-car/car_checkbox.xml b/core/res/res/drawable-car/car_checkbox.xml
new file mode 100644
index 0000000..651e678
--- /dev/null
+++ b/core/res/res/drawable-car/car_checkbox.xml
@@ -0,0 +1,23 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!--
+    Copyright 2019 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.
+-->
+
+<layer-list xmlns:android="http://schemas.android.com/apk/res/android">
+    <item
+        android:width="@*android:dimen/car_primary_icon_size"
+        android:height="@*android:dimen/car_primary_icon_size"
+        android:drawable="@drawable/btn_check_material_anim"/>
+</layer-list>
diff --git a/core/res/res/drawable-car/car_dialog_button_background.xml b/core/res/res/drawable-car/car_dialog_button_background.xml
new file mode 100644
index 0000000..dc742d5
--- /dev/null
+++ b/core/res/res/drawable-car/car_dialog_button_background.xml
@@ -0,0 +1,22 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!--
+  ~ Copyright (C) 2019 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.
+  -->
+<ripple xmlns:android="http://schemas.android.com/apk/res/android"
+        android:color="@*android:color/car_card_ripple_background">
+    <item android:id="@android:id/mask">
+        <color android:color="@*android:color/car_white_1000" />
+    </item>
+</ripple>
diff --git a/core/res/res/drawable-car/car_seekbar_thumb.xml b/core/res/res/drawable-car/car_seekbar_thumb.xml
new file mode 100644
index 0000000..fe9c773
--- /dev/null
+++ b/core/res/res/drawable-car/car_seekbar_thumb.xml
@@ -0,0 +1,24 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Copyright (C) 2019 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.
+-->
+
+<shape
+    xmlns:android="http://schemas.android.com/apk/res/android"
+    android:shape="oval">
+    <solid android:color="@*android:color/car_accent" />
+    <size
+        android:width="@*android:dimen/car_seekbar_thumb_size"
+        android:height="@*android:dimen/car_seekbar_thumb_size" />
+</shape>
diff --git a/core/res/res/drawable-car/car_seekbar_thumb_dark.xml b/core/res/res/drawable-car/car_seekbar_thumb_dark.xml
new file mode 100644
index 0000000..8ac9975
--- /dev/null
+++ b/core/res/res/drawable-car/car_seekbar_thumb_dark.xml
@@ -0,0 +1,24 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Copyright (C) 2019 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.
+-->
+
+<shape
+    xmlns:android="http://schemas.android.com/apk/res/android"
+    android:shape="oval">
+    <solid android:color="@*android:color/car_accent_dark" />
+    <size
+        android:width="@*android:dimen/car_seekbar_thumb_size"
+        android:height="@*android:dimen/car_seekbar_thumb_size" />
+</shape>
diff --git a/core/res/res/drawable-car/car_seekbar_thumb_light.xml b/core/res/res/drawable-car/car_seekbar_thumb_light.xml
new file mode 100644
index 0000000..b212b76
--- /dev/null
+++ b/core/res/res/drawable-car/car_seekbar_thumb_light.xml
@@ -0,0 +1,24 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Copyright (C) 2019 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.
+-->
+
+<shape
+    xmlns:android="http://schemas.android.com/apk/res/android"
+    android:shape="oval">
+    <solid android:color="@*android:color/car_accent_light" />
+    <size
+        android:width="@*android:dimen/car_seekbar_thumb_size"
+        android:height="@*android:dimen/car_seekbar_thumb_size" />
+</shape>
diff --git a/core/res/res/drawable-car/car_seekbar_track.xml b/core/res/res/drawable-car/car_seekbar_track.xml
new file mode 100644
index 0000000..5ea7b22
--- /dev/null
+++ b/core/res/res/drawable-car/car_seekbar_track.xml
@@ -0,0 +1,43 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Copyright (C) 2019 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.
+-->
+
+<layer-list xmlns:android="http://schemas.android.com/apk/res/android">
+    <item android:id="@android:id/background">
+        <shape android:shape="line">
+            <stroke
+                android:width="@*android:dimen/car_seekbar_height"
+                android:color="@*android:color/car_seekbar_track_background" />
+        </shape>
+    </item>
+    <item android:id="@android:id/secondaryProgress">
+        <clip>
+            <shape android:shape="line">
+                <stroke
+                    android:width="@*android:dimen/car_seekbar_height"
+                    android:color="@*android:color/car_seekbar_track_secondary_progress" />
+            </shape>
+        </clip>
+    </item>
+    <item android:id="@android:id/progress">
+        <clip>
+            <shape android:shape="line">
+                <stroke
+                    android:width="@*android:dimen/car_seekbar_height"
+                    android:color="@*android:color/car_accent" />
+            </shape>
+        </clip>
+    </item>
+</layer-list>
diff --git a/core/res/res/drawable-car/car_seekbar_track_dark.xml b/core/res/res/drawable-car/car_seekbar_track_dark.xml
new file mode 100644
index 0000000..19f6340
--- /dev/null
+++ b/core/res/res/drawable-car/car_seekbar_track_dark.xml
@@ -0,0 +1,44 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Copyright (C) 2019 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.
+-->
+
+<!-- Drawable of seekbar track. Uses dark color for track. -->
+<layer-list xmlns:android="http://schemas.android.com/apk/res/android">
+    <item android:id="@android:id/background">
+        <shape android:shape="line">
+            <stroke
+                android:width="@*android:dimen/car_seekbar_height"
+                android:color="@*android:color/car_seekbar_track_background_dark" />
+        </shape>
+    </item>
+    <item android:id="@android:id/secondaryProgress">
+        <clip>
+            <shape android:shape="line">
+                <stroke
+                    android:width="@*android:dimen/car_seekbar_height"
+                    android:color="@*android:color/car_seekbar_track_secondary_progress" />
+            </shape>
+        </clip>
+    </item>
+    <item android:id="@android:id/progress">
+        <clip>
+            <shape android:shape="line">
+                <stroke
+                    android:width="@*android:dimen/car_seekbar_height"
+                    android:color="@*android:color/car_accent_light" />
+            </shape>
+        </clip>
+    </item>
+</layer-list>
diff --git a/core/res/res/drawable-car/car_seekbar_track_light.xml b/core/res/res/drawable-car/car_seekbar_track_light.xml
new file mode 100644
index 0000000..d23ca33
--- /dev/null
+++ b/core/res/res/drawable-car/car_seekbar_track_light.xml
@@ -0,0 +1,44 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Copyright (C) 2019 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.
+-->
+
+<!-- Drawable of seekbar track. Uses light color for track. -->
+<layer-list xmlns:android="http://schemas.android.com/apk/res/android">
+    <item android:id="@android:id/background">
+        <shape android:shape="line">
+            <stroke
+                android:width="@*android:dimen/car_seekbar_height"
+                android:color="@*android:color/car_seekbar_track_background_light" />
+        </shape>
+    </item>
+    <item android:id="@android:id/secondaryProgress">
+        <clip>
+            <shape android:shape="line">
+                <stroke
+                    android:width="@*android:dimen/car_seekbar_height"
+                    android:color="@*android:color/car_seekbar_track_secondary_progress" />
+            </shape>
+        </clip>
+    </item>
+    <item android:id="@android:id/progress">
+        <clip>
+            <shape android:shape="line">
+                <stroke
+                    android:width="@*android:dimen/car_seekbar_height"
+                    android:color="@*android:color/car_accent_dark" />
+            </shape>
+        </clip>
+    </item>
+</layer-list>
diff --git a/core/res/res/drawable-car/car_switch_thumb.xml b/core/res/res/drawable-car/car_switch_thumb.xml
new file mode 100644
index 0000000..03efc18
--- /dev/null
+++ b/core/res/res/drawable-car/car_switch_thumb.xml
@@ -0,0 +1,25 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!--
+    Copyright 2019 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.
+-->
+
+<shape
+    xmlns:android="http://schemas.android.com/apk/res/android"
+    android:shape="oval">
+    <solid android:color="@color/car_switch"/>
+    <size
+        android:width="@dimen/car_seekbar_thumb_size"
+        android:height="@dimen/car_seekbar_thumb_size"/>
+</shape>
diff --git a/core/res/res/drawable-nodpi/stat_sys_adb.xml b/core/res/res/drawable-nodpi/stat_sys_adb.xml
index 6839e39..08e9fad 100644
--- a/core/res/res/drawable-nodpi/stat_sys_adb.xml
+++ b/core/res/res/drawable-nodpi/stat_sys_adb.xml
@@ -1,11 +1,11 @@
 <!--
 Copyright (C) 2019 The Android Open Source Project
 
-   Licensed under the Apache License, Version 2 (the "License");
+   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
+         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,
@@ -16,19 +16,15 @@
 <vector xmlns:android="http://schemas.android.com/apk/res/android"
         android:width="24dp"
         android:height="24dp"
-        android:viewportWidth="24"
-        android:viewportHeight="24">
+        android:viewportWidth="24.0"
+        android:viewportHeight="24.0">
     <path
-        android:pathData="M12,12m-7,0a7,7,0,1,1,14,0a7,7,0,1,1,-14,0"
-        android:strokeColor="#FF0000"
-        android:strokeWidth="4"/>
+        android:fillColor="#FF000000"
+        android:pathData="M16.28,16.19A6,6 0,1 0,6 12c0,0.1 0,0.19 0,0.29L9.2,9.11Z"/>
     <path
-        android:pathData="M19,19 L12,12"
-        android:strokeLineCap="round"
-        android:strokeColor="#FF0000"
-        android:strokeWidth="4"
-        android:strokeAlpha=".5"/>
+        android:fillColor="#FF000000"
+        android:pathData="M16,19.48a8.57,8.57 0,1 1,2 -1.52l1.77,1.77a11.07,11.07 0,1 0,-2 1.57Z"/>
     <path
-        android:pathData="M12,12m-2,0a2,2,0,1,1,4,0a2,2,0,1,1,-4,0"
-        android:fillColor="#FF0000"/>
+        android:fillColor="#FF000000"
+        android:pathData="M12,18a5.77,5.77 0,0 0,2 -0.34l0.19,-0.07 -0.87,-0.87L9.2,12.64 6.82,15A6,6 0,0 0,12 18Z"/>
 </vector>
diff --git a/core/res/res/drawable/chooser_row_layer_list.xml b/core/res/res/drawable/chooser_row_layer_list.xml
new file mode 100644
index 0000000..0fb26e1
--- /dev/null
+++ b/core/res/res/drawable/chooser_row_layer_list.xml
@@ -0,0 +1,25 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!--
+/*
+** Copyright 2019, 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.
+*/
+-->
+<layer-list xmlns:android="http://schemas.android.com/apk/res/android">
+    <item android:bottom="-2dp" android:left="-2dp" android:right="-2dp">
+        <shape android:shape="rectangle">
+            <stroke android:width="1dp" android:color="@color/chooser_row_divider"/>
+        </shape>
+    </item>
+</layer-list>
diff --git a/core/res/res/drawable/ic_auth_error.xml b/core/res/res/drawable/ic_auth_error.xml
deleted file mode 100644
index ea5f572..0000000
--- a/core/res/res/drawable/ic_auth_error.xml
+++ /dev/null
@@ -1,23 +0,0 @@
-<!--
-     Copyright (C) 2019 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 android:height="24dp" android:viewportHeight="60"
-        android:viewportWidth="60" android:width="24dp" xmlns:android="http://schemas.android.com/apk/res/android">
-    <path android:fillColor="?attr/colorError" android:pathData="M28.8,37.5l2.4,0l0,2.5l-2.4,0z"/>
-    <path android:fillColor="?attr/colorError" android:pathData="M28.8,17.5l2.4,0l0,15l-2.4,0z"/>
-    <path android:fillColor="#00000000"
-          android:pathData="M30,6.2c-13.1,0 -23.7,10.6 -23.7,23.8S16.9,53.8 30,53.8c13.1,0 23.8,-10.6 23.8,-23.8S43.1,6.2 30,6.2z"
-          android:strokeColor="?android:attr/colorError" android:strokeWidth="2.5"/>
-</vector>
diff --git a/core/res/res/drawable/ic_lock.xml b/core/res/res/drawable/ic_lock.xml
new file mode 100644
index 0000000..8d7143b
--- /dev/null
+++ b/core/res/res/drawable/ic_lock.xml
@@ -0,0 +1,27 @@
+<!--
+Copyright (C) 2019 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="32dp"
+        android:height="32dp"
+        android:viewportWidth="32"
+        android:viewportHeight="32">
+    <path
+        android:fillColor="?attr/textColor"
+        android:pathData="M16,20m-2.7,0a2.7,2.7 0,1 1,5.4 0a2.7,2.7 0,1 1,-5.4 0"/>
+    <path
+        android:fillColor="?attr/textColor"
+        android:pathData="M24,10.7h-2V7.3c0,-3.3 -2.7,-6 -6,-6s-6,2.7 -6,6v3.3H8c-1.5,0 -2.7,1.2 -2.7,2.7v13.3c0,1.5 1.2,2.7 2.7,2.7h16c1.5,0 2.7,-1.2 2.7,-2.7V13.3C26.7,11.9 25.5,10.7 24,10.7zM12.7,7.3C12.7,5.5 14.2,4 16,4s3.3,1.5 3.3,3.3v3.3h-6.7V7.3zM24,26.7H8V13.3h2h12h2V26.7z"/>
+</vector>
diff --git a/core/res/res/drawable/ic_lock_24dp.xml b/core/res/res/drawable/ic_lock_24dp.xml
deleted file mode 100644
index d848426..0000000
--- a/core/res/res/drawable/ic_lock_24dp.xml
+++ /dev/null
@@ -1,30 +0,0 @@
-<!--
-Copyright (C) 2014 The Android Open Source Project
-
-   Licensed under the Apache License, Version 2.0 (the "License");
-    you may not use this file except in compliance with the License.
-    You may obtain a copy of the License at
-
-         http://www.apache.org/licenses/LICENSE-2.0
-
-    Unless required by applicable law or agreed to in writing, software
-    distributed under the License is distributed on an "AS IS" BASIS,
-    WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-    See the License for the specific language governing permissions and
-    limitations under the License.
--->
-<vector xmlns:android="http://schemas.android.com/apk/res/android"
-        android:width="24.0dp"
-        android:height="24.0dp"
-        android:viewportWidth="24.0"
-        android:viewportHeight="24.0">
-    <path
-        android:fillColor="?attr/textColor"
-        android:pathData="M12.0,15.0m-2.0,0.0a2.0,2.0 0.0,1.0 1.0,4.0 0.0a2.0,2.0 0.0,1.0 1.0,-4.0 0.0"/>
-    <path
-        android:pathData="M0,0h24v24H0V0z"
-        android:fillColor="#00000000"/>
-    <path
-        android:fillColor="?attr/textColor"
-        android:pathData="M18.0,8.0l-1.5,0.0L16.5,5.5C16.5,3.01 14.49,1.0 12.0,1.0S7.5,3.01 7.5,5.5L7.5,8.0L6.0,8.0c-1.1,0.0 -2.0,0.9 -2.0,2.0l0.0,10.0c0.0,1.1 0.9,2.0 2.0,2.0l12.0,0.0c1.1,0.0 2.0,-0.9 2.0,-2.0L20.0,10.0C20.0,8.9 19.1,8.0 18.0,8.0zM9.5,5.5C9.5,4.12 10.62,3.0 12.0,3.0c1.38,0.0 2.5,1.12 2.5,2.5L14.5,8.0l-5.0,0.0L9.5,5.5zM18.0,20.0L6.0,20.0L6.0,10.0l1.5,0.0l9.0,0.0L18.0,10.0L18.0,20.0z"/>
-</vector>
diff --git a/core/res/res/drawable/ic_lock_open.xml b/core/res/res/drawable/ic_lock_open.xml
new file mode 100644
index 0000000..3a6bf93
--- /dev/null
+++ b/core/res/res/drawable/ic_lock_open.xml
@@ -0,0 +1,27 @@
+<!--
+Copyright (C) 2019 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="32dp"
+        android:height="32dp"
+        android:viewportWidth="32"
+        android:viewportHeight="32">
+    <path
+        android:fillColor="?attr/textColor"
+        android:pathData="M16,20m-2.67,0a2.67,2.67 0,1 1,5.34 0a2.67,2.67 0,1 1,-5.34 0"/>
+    <path
+        android:fillColor="?attr/textColor"
+        android:pathData="M24.67,1.33a6,6 0,0 0,-6 6v3.34L8,10.67a2.67,2.67 0,0 0,-2.67 2.66L5.33,26.67A2.67,2.67 0,0 0,8 29.33L24,29.33a2.67,2.67 0,0 0,2.67 -2.66L26.67,13.33A2.67,2.67 0,0 0,24 10.67L21.33,10.67L21.33,7.33a3.34,3.34 0,0 1,6.67 0L28,8h2.67L30.67,7.33A6,6 0,0 0,24.67 1.33ZM24,13.33L24,26.67L8,26.67L8,13.33Z"/>
+</vector>
\ No newline at end of file
diff --git a/core/res/res/drawable/ic_lock_open_24dp.xml b/core/res/res/drawable/ic_lock_open_24dp.xml
deleted file mode 100644
index 94eecad..0000000
--- a/core/res/res/drawable/ic_lock_open_24dp.xml
+++ /dev/null
@@ -1,30 +0,0 @@
-<!--
-Copyright (C) 2014 The Android Open Source Project
-
-   Licensed under the Apache License, Version 2.0 (the "License");
-    you may not use this file except in compliance with the License.
-    You may obtain a copy of the License at
-
-         http://www.apache.org/licenses/LICENSE-2.0
-
-    Unless required by applicable law or agreed to in writing, software
-    distributed under the License is distributed on an "AS IS" BASIS,
-    WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-    See the License for the specific language governing permissions and
-    limitations under the License.
--->
-<vector xmlns:android="http://schemas.android.com/apk/res/android"
-        android:width="24.0dp"
-        android:height="24.0dp"
-        android:viewportWidth="24.0"
-        android:viewportHeight="24.0">
-    <path
-        android:fillColor="?attr/textColor"
-        android:pathData="M12.0,15.0m-2.0,0.0a2.0,2.0 0.0,1.0 1.0,4.0 0.0a2.0,2.0 0.0,1.0 1.0,-4.0 0.0"/>
-    <path
-        android:fillColor="?attr/textColor"
-        android:pathData="M18.5,1.0C16.01,1.0 14.0,3.01 14.0,5.5L14.0,8.0L6.0,8.0c-1.1,0.0 -2.0,0.9 -2.0,2.0l0.0,10.0c0.0,1.1 0.9,2.0 2.0,2.0l12.0,0.0c1.1,0.0 2.0,-0.9 2.0,-2.0L20.0,10.0c0.0,-1.1 -0.9,-2.0 -2.0,-2.0l-2.0,0.0L16.0,5.5C16.0,4.12 17.12,3.0 18.5,3.0C19.88,3.0 21.0,4.12 21.0,5.5L21.0,6.0l2.0,0.0L23.0,5.5C23.0,3.01 20.99,1.0 18.5,1.0zM18.0,10.0l0.0,10.0L6.0,20.0L6.0,10.0L18.0,10.0z"/>
-    <path
-        android:pathData="M0,0h24v24H0V0z"
-        android:fillColor="#00000000"/>
-</vector>
diff --git a/core/res/res/layout-car/car_preference.xml b/core/res/res/layout-car/car_preference.xml
new file mode 100644
index 0000000..939c3fb
--- /dev/null
+++ b/core/res/res/layout-car/car_preference.xml
@@ -0,0 +1,72 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!--
+    Copyright 2019 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.
+-->
+
+<RelativeLayout
+    xmlns:android="http://schemas.android.com/apk/res/android"
+    android:layout_width="match_parent"
+    android:layout_height="wrap_content"
+    android:background="?android:attr/selectableItemBackground"
+    android:focusable="true"
+    android:minHeight="?android:attr/listPreferredItemHeightSmall"
+    android:paddingEnd="?android:attr/listPreferredItemPaddingEnd"
+    android:paddingStart="?android:attr/listPreferredItemPaddingStart">
+
+    <com.android.internal.widget.PreferenceImageView
+        android:id="@id/icon"
+        android:layout_width="@*android:dimen/car_primary_icon_size"
+        android:layout_height="@*android:dimen/car_primary_icon_size"
+        android:layout_alignParentStart="true"
+        android:layout_centerVertical="true"
+        android:layout_marginBottom="@*android:dimen/car_padding_2"
+        android:layout_marginEnd="?android:attr/listPreferredItemPaddingEnd"
+        android:layout_marginTop="@android:dimen/car_padding_2"/>
+
+    <LinearLayout
+        android:layout_width="match_parent"
+        android:layout_height="wrap_content"
+        android:layout_centerVertical="true"
+        android:layout_marginBottom="@*android:dimen/car_padding_2"
+        android:layout_marginTop="@*android:dimen/car_padding_2"
+        android:layout_toEndOf="@id/icon"
+        android:layout_toStartOf="@id/widget_frame"
+        android:orientation="vertical">
+
+        <TextView
+            android:id="@id/title"
+            android:layout_width="wrap_content"
+            android:layout_height="wrap_content"
+            android:ellipsize="end"
+            android:singleLine="true"
+            android:textAppearance="?android:attr/textAppearanceListItem"/>
+
+        <TextView
+            android:id="@id/summary"
+            android:layout_width="wrap_content"
+            android:layout_height="wrap_content"
+            android:textAppearance="?android:attr/textAppearanceListItemSecondary"/>
+
+    </LinearLayout>
+
+    <!-- Preference should place its actual preference widget here. -->
+    <FrameLayout
+        android:id="@id/widget_frame"
+        android:layout_width="wrap_content"
+        android:layout_height="wrap_content"
+        android:layout_alignParentEnd="true"
+        android:layout_centerVertical="true"/>
+
+</RelativeLayout>
diff --git a/core/res/res/layout-car/car_preference_category.xml b/core/res/res/layout-car/car_preference_category.xml
new file mode 100644
index 0000000..d1f7342
--- /dev/null
+++ b/core/res/res/layout-car/car_preference_category.xml
@@ -0,0 +1,65 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!--
+    Copyright 2019 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.
+-->
+
+<LinearLayout
+    xmlns:android="http://schemas.android.com/apk/res/android"
+    android:layout_width="match_parent"
+    android:layout_height="wrap_content"
+    android:background="?android:attr/selectableItemBackground"
+    android:focusable="true"
+    android:gravity="center_vertical"
+    android:minHeight="@*android:dimen/car_card_header_height"
+    android:orientation="horizontal"
+    android:paddingEnd="?android:attr/listPreferredItemPaddingEnd"
+    android:paddingStart="?android:attr/listPreferredItemPaddingStart">
+
+    <com.android.internal.widget.PreferenceImageView
+        android:id="@id/icon"
+        android:layout_width="@*android:dimen/car_primary_icon_size"
+        android:layout_height="@*android:dimen/car_primary_icon_size"
+        android:layout_gravity="center_vertical"
+        android:layout_marginBottom="@dimen/car_padding_2"
+        android:layout_marginEnd="?android:attr/listPreferredItemPaddingEnd"
+        android:layout_marginTop="@*android:dimen/car_padding_2"/>
+
+    <LinearLayout
+        android:layout_width="match_parent"
+        android:layout_height="wrap_content"
+        android:layout_marginBottom="@*android:dimen/car_padding_2"
+        android:layout_marginTop="@*android:dimen/car_padding_2"
+        android:orientation="vertical">
+
+        <TextView
+            android:id="@id/title"
+            android:layout_width="match_parent"
+            android:layout_height="wrap_content"
+            android:fontFamily="sans-serif-medium"
+            android:textAlignment="viewStart"
+            android:textAppearance="?android:attr/textAppearanceSmall"
+            android:textColor="?android:attr/colorAccent"/>
+
+        <TextView
+            android:id="@id/summary"
+            android:layout_width="wrap_content"
+            android:layout_height="wrap_content"
+            android:ellipsize="end"
+            android:singleLine="true"
+            android:textColor="?android:attr/textColorSecondary"/>
+
+    </LinearLayout>
+
+</LinearLayout>
diff --git a/core/res/res/layout-car/car_resolver_different_item_header.xml b/core/res/res/layout-car/car_resolver_different_item_header.xml
new file mode 100644
index 0000000..222ecc6
--- /dev/null
+++ b/core/res/res/layout-car/car_resolver_different_item_header.xml
@@ -0,0 +1,33 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!--
+/*
+ * Copyright 2019, 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.
+ */
+-->
+<TextView
+    xmlns:android="http://schemas.android.com/apk/res/android"
+    android:layout_width="match_parent"
+    android:layout_height="wrap_content"
+    android:layout_alwaysShow="true"
+    android:text="@*android:string/use_a_different_app"
+    android:minHeight="56dp"
+    android:textAppearance="?android:attr/textAppearanceLarge"
+    android:gravity="start|center_vertical"
+    android:paddingStart="16dp"
+    android:paddingEnd="16dp"
+    android:paddingTop="8dp"
+    android:paddingBottom="8dp"
+    android:elevation="8dp"
+/>
\ No newline at end of file
diff --git a/core/res/res/layout-car/car_resolver_list.xml b/core/res/res/layout-car/car_resolver_list.xml
new file mode 100644
index 0000000..15a8645
--- /dev/null
+++ b/core/res/res/layout-car/car_resolver_list.xml
@@ -0,0 +1,112 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!--
+/*
+* Copyright 2019, 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.
+*/
+-->
+<com.android.internal.widget.ResolverDrawerLayout
+    xmlns:android="http://schemas.android.com/apk/res/android"
+    android:layout_width="match_parent"
+    android:layout_height="match_parent"
+    android:id="@id/contentPanel">
+
+    <LinearLayout
+        android:id="@+id/button_bar"
+        android:visibility="gone"
+        style="?attr/buttonBarStyle"
+        android:layout_width="match_parent"
+        android:layout_height="wrap_content"
+        android:layout_ignoreOffset="true"
+        android:layout_alwaysShow="true"
+        android:layout_hasNestedScrollIndicator="true"
+        android:background="?attr/colorBackgroundFloating"
+        android:orientation="horizontal"
+        android:paddingTop="8dp"
+        android:paddingBottom="8dp"
+        android:paddingStart="12dp"
+        android:weightSum="5"
+        android:paddingEnd="12dp"
+        android:elevation="8dp">
+
+        <TextView
+            android:id="@+id/profile_button"
+            android:layout_width="wrap_content"
+            android:layout_height="wrap_content"
+            android:layout_marginEnd="8dp"
+            android:paddingStart="8dp"
+            android:paddingEnd="8dp"
+            android:textSize="40sp"
+            android:layout_weight="5"
+            android:layout_gravity = "left"
+            android:visibility="gone"
+            android:textColor="?attr/colorAccent"
+            android:singleLine="true"/>
+
+        <TextView
+            android:id="@+id/title"
+            android:layout_width="wrap_content"
+            android:layout_height="wrap_content"
+            android:minHeight="56dp"
+            android:layout_gravity = "left"
+            android:layout_weight="3"
+            android:paddingTop="8dp"
+            android:layout_below="@id/profile_button"
+            android:paddingBottom="8dp"/>
+
+        <Button
+            android:id="@+id/button_once"
+            android:layout_width="wrap_content"
+            android:layout_height="wrap_content"
+            android:enabled="false"
+            android:layout_gravity = "right"
+            android:text="@string/activity_resolver_use_once"
+            android:layout_weight="1"
+            android:onClick="onButtonClick"/>
+
+        <Button
+            android:id="@+id/button_always"
+            android:layout_marginLeft="10dp"
+            android:layout_width="wrap_content"
+            android:layout_height="wrap_content"
+            android:enabled="false"
+            android:layout_gravity = "right"
+            android:text="@string/activity_resolver_use_always"
+            android:layout_weight="1"
+            android:onClick="onButtonClick"/>
+    </LinearLayout>
+
+    <ListView
+        android:layout_width="match_parent"
+        android:layout_height="500dp"
+        android:id="@+id/resolver_list"
+        android:clipToPadding="false"
+        android:scrollbarStyle="outsideOverlay"
+        android:background="?attr/colorBackgroundFloating"
+        android:elevation="8dp"
+        android:nestedScrollingEnabled="true"
+        android:scrollIndicators="top|bottom"/>
+
+    <TextView android:id="@+id/empty"
+              android:layout_width="match_parent"
+              android:layout_height="wrap_content"
+              android:background="?attr/colorBackgroundFloating"
+              android:elevation="8dp"
+              android:layout_alwaysShow="true"
+              android:text="@string/noApplications"
+              android:padding="32dp"
+              android:gravity="center"
+              android:visibility="gone"/>
+
+</com.android.internal.widget.ResolverDrawerLayout>
diff --git a/core/res/res/layout-car/car_resolver_list_with_default.xml b/core/res/res/layout-car/car_resolver_list_with_default.xml
new file mode 100644
index 0000000..2aed00b
--- /dev/null
+++ b/core/res/res/layout-car/car_resolver_list_with_default.xml
@@ -0,0 +1,161 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!--
+/*
+* Copyright 2019, 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.
+*/
+-->
+<com.android.internal.widget.ResolverDrawerLayout
+    xmlns:android="http://schemas.android.com/apk/res/android"
+    android:layout_width="match_parent"
+    android:layout_height="match_parent"
+    android:maxCollapsedHeight="200dp"
+    android:id="@id/contentPanel">
+
+    <LinearLayout
+        android:layout_width="match_parent"
+        android:layout_height="match_parent"
+        android:weightSum="5"
+        android:layout_alwaysShow="true"
+        android:orientation="vertical"
+        android:background="?attr/colorBackgroundFloating"
+        android:elevation="8dp">
+
+        <LinearLayout
+            android:layout_width="match_parent"
+            android:layout_height="wrap_content"
+            android:layout_weight="0.5"
+            android:orientation="horizontal">
+
+            <ImageView
+                android:id="@+id/icon"
+                android:layout_width="24dp"
+                android:layout_height="24dp"
+                android:layout_gravity="start|top"
+                android:layout_marginStart="16dp"
+                android:layout_marginEnd="16dp"
+                android:layout_marginTop="20dp"
+                android:src="@drawable/resolver_icon_placeholder"
+                android:scaleType="fitCenter"/>
+
+            <TextView
+                android:id="@+id/title"
+                android:layout_width="0dp"
+                android:layout_weight="1"
+                android:layout_height="?attr/listPreferredItemHeight"
+                android:layout_marginStart="16dp"
+                android:textAppearance="?attr/textAppearanceMedium"
+                android:gravity="start|center_vertical"
+                android:paddingEnd="16dp"/>
+
+            <LinearLayout
+                android:id="@+id/profile_button"
+                android:layout_width="wrap_content"
+                android:layout_height="48dp"
+                android:layout_marginTop="4dp"
+                android:layout_marginEnd="4dp"
+                android:paddingStart="8dp"
+                android:paddingEnd="8dp"
+                android:paddingTop="4dp"
+                android:paddingBottom="4dp"
+                android:focusable="true"
+                android:visibility="gone"
+                style="?attr/borderlessButtonStyle">
+
+                <ImageView
+                    android:id="@+id/icon"
+                    android:layout_width="24dp"
+                    android:layout_height="24dp"
+                    android:layout_gravity="start|center_vertical"
+                    android:layout_marginEnd="?attr/listPreferredItemPaddingEnd"
+                    android:layout_marginTop="12dp"
+                    android:layout_marginBottom="12dp"
+                    android:scaleType="fitCenter"/>
+
+                <TextView
+                    android:id="@id/text1"
+                    android:layout_width="wrap_content"
+                    android:layout_height="wrap_content"
+                    android:layout_gravity="start|center_vertical"
+                    android:layout_marginEnd="?attr/listPreferredItemPaddingEnd"
+                    android:textAppearance="?attr/textAppearanceButton"
+                    android:textColor="?attr/textColorPrimary"
+                    android:minLines="1"
+                    android:maxLines="1"
+                    android:ellipsize="marquee"/>
+            </LinearLayout>
+        </LinearLayout>
+
+        <LinearLayout
+            android:id="@+id/button_bar"
+            android:visibility="gone"
+            style="?attr/buttonBarStyle"
+            android:layout_width="match_parent"
+            android:layout_height="wrap_content"
+            android:layout_alwaysShow="true"
+            android:gravity="end|center_vertical"
+            android:layout_weight="0.5"
+            android:orientation="horizontal"
+            android:layoutDirection="locale"
+            android:measureWithLargestChild="true"
+            android:paddingTop="8dp"
+            android:paddingBottom="8dp"
+            android:paddingStart="12dp"
+            android:paddingEnd="12dp"
+            android:elevation="8dp">
+
+            <Button
+                android:id="@+id/button_once"
+                android:layout_width="wrap_content"
+                android:layout_gravity="start"
+                android:maxLines="2"
+                style="?attr/buttonBarNegativeButtonStyle"
+                android:minHeight="@dimen/alert_dialog_button_bar_height"
+                android:layout_height="wrap_content"
+                android:enabled="false"
+                android:text="@string/activity_resolver_use_once"
+                android:onClick="onButtonClick"/>
+
+            <Button
+                android:id="@+id/button_always"
+                android:layout_width="wrap_content"
+                android:layout_gravity="end"
+                android:maxLines="2"
+                android:minHeight="@dimen/alert_dialog_button_bar_height"
+                style="?attr/buttonBarPositiveButtonStyle"
+                android:layout_height="wrap_content"
+                android:enabled="false"
+                android:text="@string/activity_resolver_use_always"
+                android:onClick="onButtonClick"/>
+        </LinearLayout>
+
+        <View
+            android:layout_width="match_parent"
+            android:layout_height="1dp"
+            android:background="?attr/dividerVertical"/>
+
+        <ListView
+            android:layout_width="match_parent"
+            android:layout_height="wrap_content"
+            android:id="@+id/resolver_list"
+            android:layout_weight="4"
+            android:clipToPadding="false"
+            android:scrollbarStyle="outsideOverlay"
+            android:background="?attr/colorBackgroundFloating"
+            android:elevation="8dp"
+            android:nestedScrollingEnabled="true"
+            android:divider="@null"/>
+    </LinearLayout>
+
+</com.android.internal.widget.ResolverDrawerLayout>
diff --git a/core/res/res/layout/chooser_row.xml b/core/res/res/layout/chooser_row.xml
index cf81260..d4585eb 100644
--- a/core/res/res/layout/chooser_row.xml
+++ b/core/res/res/layout/chooser_row.xml
@@ -23,6 +23,12 @@
               android:gravity="start|top"
               android:paddingStart="@dimen/chooser_grid_padding"
               android:paddingEnd="@dimen/chooser_grid_padding">
-
+  <TextView
+      android:id="@+id/chooser_row_text_option"
+      android:layout_width="match_parent"
+      android:layout_height="wrap_content"
+      android:gravity="center"
+      android:layout_gravity="center"
+      android:visibility="gone" />
 </LinearLayout>
 
diff --git a/core/res/res/layout/immersive_mode_cling.xml b/core/res/res/layout/immersive_mode_cling.xml
index b08b0f4..9fd615d 100644
--- a/core/res/res/layout/immersive_mode_cling.xml
+++ b/core/res/res/layout/immersive_mode_cling.xml
@@ -59,7 +59,7 @@
             android:paddingStart="48dp"
             android:paddingTop="40dp"
             android:text="@string/immersive_cling_title"
-            android:textColor="@color/primary_text_default_material_light"
+            android:textColor="@android:color/white"
             android:textSize="24sp" />
 
     <TextView
@@ -71,7 +71,7 @@
             android:paddingStart="48dp"
             android:paddingTop="12.6dp"
             android:text="@string/immersive_cling_description"
-            android:textColor="@color/primary_text_default_material_light"
+            android:textColor="@android:color/white"
             android:textSize="16sp" />
 
     <Button
@@ -89,4 +89,4 @@
             android:textColor="@android:color/white"
             android:textSize="14sp" />
 
-</RelativeLayout>
\ No newline at end of file
+</RelativeLayout>
diff --git a/core/res/res/layout/notification_material_media_seekbar.xml b/core/res/res/layout/notification_material_media_seekbar.xml
index c23ca83..4aa8acc 100644
--- a/core/res/res/layout/notification_material_media_seekbar.xml
+++ b/core/res/res/layout/notification_material_media_seekbar.xml
@@ -50,7 +50,7 @@
             android:layout_height="wrap_content"
             android:layout_alignParentLeft="true"
             android:layout_marginStart="@dimen/notification_content_margin_start"
-            android:gravity="left"
+            android:gravity="start"
         />
 
         <TextView android:id="@+id/notification_media_total_time"
@@ -59,7 +59,7 @@
             android:layout_height="wrap_content"
             android:layout_alignParentRight="true"
             android:layout_marginEnd="@dimen/notification_content_margin_end"
-            android:gravity="right"
+            android:gravity="end"
         />
     </FrameLayout>
 </LinearLayout>
\ No newline at end of file
diff --git a/core/res/res/values-af/strings.xml b/core/res/res/values-af/strings.xml
index f4e35a7..78c0b80 100644
--- a/core/res/res/values-af/strings.xml
+++ b/core/res/res/values-af/strings.xml
@@ -308,15 +308,15 @@
     <string name="permgrouplab_phone" msgid="5229115638567440675">"Foon"</string>
     <string name="permgroupdesc_phone" msgid="6234224354060641055">"foonoproepe te maak en te bestuur"</string>
     <string name="permgrouprequest_phone" msgid="9166979577750581037">"Laat &lt;b&gt;<xliff:g id="APP_NAME">%1$s</xliff:g>&lt;/b&gt; toe om foonoproepe te maak en te bestuur?"</string>
-    <string name="permgrouplab_sensors" msgid="416037179223226722">"Liggaamsensors"</string>
+    <string name="permgrouplab_sensors" msgid="4838614103153567532">"Liggaamsensors"</string>
     <string name="permgroupdesc_sensors" msgid="7147968539346634043">"toegang te verkry tot sensordata oor jou lewenstekens"</string>
     <string name="permgrouprequest_sensors" msgid="6349806962814556786">"Gee &lt;b&gt;<xliff:g id="APP_NAME">%1$s</xliff:g>&lt;/b&gt; toegang tot sensordata oor jou lewenstekens?"</string>
     <string name="permgrouplab_aural" msgid="965607064083134896">"Musiek"</string>
     <string name="permgroupdesc_aural" msgid="4870189506255958055">"toegang tot jou musiek"</string>
     <string name="permgrouprequest_aural" msgid="6787926123071735620">"Gee &lt;b&gt;<xliff:g id="APP_NAME">%1$s</xliff:g>&lt;/b&gt; toegang tot jou musiek?"</string>
-    <string name="permgrouplab_visual" msgid="8030190588123857921">"Foto\'s en video\'s"</string>
+    <string name="permgrouplab_visual" msgid="6477382108771145134">"Foto\'s en video\'s"</string>
     <string name="permgroupdesc_visual" msgid="3415827902566663546">"toegang tot jou foto\'s en video\'s"</string>
-    <string name="permgrouprequest_visual" msgid="6907523945030290376">"Gee &lt;b&gt;<xliff:g id="APP_NAME">%1$s</xliff:g>&lt;/b&gt; toegang tot jou foto\'s en video\'s?"</string>
+    <string name="permgrouprequest_visual" msgid="3043752127595243314">"Laat &lt;b&gt;<xliff:g id="APP_NAME">%1$s</xliff:g>&lt;/b&gt; toe om by jou foto\'s en video\'s in te gaan, insluitend gemerkte liggings?"</string>
     <string name="capability_title_canRetrieveWindowContent" msgid="3901717936930170320">"Venster-inhoud ophaal"</string>
     <string name="capability_desc_canRetrieveWindowContent" msgid="3772225008605310672">"Die inhoud ondersoek van \'n venster waarmee jy interaksie het."</string>
     <string name="capability_title_canRequestTouchExploration" msgid="3108723364676667320">"Verken deur raak aanskakel"</string>
@@ -1396,8 +1396,7 @@
     <string name="ext_media_init_action" msgid="7952885510091978278">"Stel op"</string>
     <string name="ext_media_unmount_action" msgid="1121883233103278199">"Haal uit"</string>
     <string name="ext_media_browse_action" msgid="8322172381028546087">"Verken"</string>
-    <!-- no translation found for ext_media_seamless_action (6575980560886881233) -->
-    <skip />
+    <string name="ext_media_seamless_action" msgid="6575980560886881233">"Wissel uitvoer"</string>
     <string name="ext_media_missing_title" msgid="620980315821543904">"<xliff:g id="NAME">%s</xliff:g> ontbreek"</string>
     <string name="ext_media_missing_message" msgid="4012389235250987930">"Sit toestel weer in"</string>
     <string name="ext_media_move_specific_title" msgid="1471100343872375842">"Skuif tans <xliff:g id="NAME">%s</xliff:g>"</string>
@@ -1611,6 +1610,8 @@
     <string name="display_manager_overlay_display_name" msgid="5142365982271620716">"Oorlegger #<xliff:g id="ID">%1$d</xliff:g>"</string>
     <string name="display_manager_overlay_display_title" msgid="652124517672257172">"<xliff:g id="NAME">%1$s</xliff:g>: <xliff:g id="WIDTH">%2$d</xliff:g>x<xliff:g id="HEIGHT">%3$d</xliff:g>, <xliff:g id="DPI">%4$d</xliff:g> dpi"</string>
     <string name="display_manager_overlay_display_secure_suffix" msgid="6022119702628572080">", veilig"</string>
+    <string name="activity_starter_block_bg_activity_starts_permissive" msgid="5692097903712956720">"Hierdie begin van agtergrondaktiwiteit vanaf <xliff:g id="PACKAGENAME">%1$s</xliff:g> sal in toekomstige Q-weergawes geblokkeer word. Sien go/q-bg-block."</string>
+    <string name="activity_starter_block_bg_activity_starts_enforcing" msgid="8299522481076404353">"Begin van agtergrondaktiwiteit vanaf <xliff:g id="PACKAGENAME">%1$s</xliff:g> word geblokkeer. Sien go/q-bg-block."</string>
     <string name="kg_forgot_pattern_button_text" msgid="8852021467868220608">"Het jy die patroon vergeet?"</string>
     <string name="kg_wrong_pattern" msgid="1850806070801358830">"Verkeerde patroon"</string>
     <string name="kg_wrong_password" msgid="2333281762128113157">"Verkeerde wagwoord"</string>
@@ -1996,9 +1997,29 @@
     <string name="dynamic_mode_notification_channel_name" msgid="2348803891571320452">"Roetinemodus-inligtingkennisgewing"</string>
     <string name="dynamic_mode_notification_title" msgid="508815255807182035">"Battery kan afloop voordat dit normaalweg gelaai word"</string>
     <string name="dynamic_mode_notification_summary" msgid="2541166298550402690">"Batterybespaarder is geaktiveer om batterylewe te verleng"</string>
+    <string name="mime_type_folder" msgid="7111951698626315204">"Vouer"</string>
+    <string name="mime_type_apk" msgid="5518003630972506900">"Android-program"</string>
+    <string name="mime_type_generic" msgid="6833871596845900027">"Lêer"</string>
+    <string name="mime_type_generic_ext" msgid="8450275970061657174">"<xliff:g id="EXTENSION">%1$s</xliff:g>-lêer"</string>
+    <string name="mime_type_audio" msgid="6289777657172050926">"Oudio"</string>
+    <string name="mime_type_audio_ext" msgid="3270880987725816210">"<xliff:g id="EXTENSION">%1$s</xliff:g>-oudio"</string>
+    <string name="mime_type_video" msgid="4093025777317307426">"Video"</string>
+    <string name="mime_type_video_ext" msgid="5643771615714173159">"<xliff:g id="EXTENSION">%1$s</xliff:g>-video"</string>
+    <string name="mime_type_image" msgid="3144284451605236371">"Prent"</string>
+    <string name="mime_type_image_ext" msgid="1514613218742736590">"<xliff:g id="EXTENSION">%1$s</xliff:g>-prent"</string>
+    <string name="mime_type_compressed" msgid="1645486037074943257">"Argief"</string>
+    <string name="mime_type_compressed_ext" msgid="4232293058067801528">"<xliff:g id="EXTENSION">%1$s</xliff:g>-argief"</string>
+    <string name="mime_type_document" msgid="1596838147256375966">"Dokument"</string>
+    <string name="mime_type_document_ext" msgid="6327266601345501281">"<xliff:g id="EXTENSION">%1$s</xliff:g>-dokument"</string>
+    <string name="mime_type_spreadsheet" msgid="2639138255207123557">"Sigblad"</string>
+    <string name="mime_type_spreadsheet_ext" msgid="5508653032786106725">"<xliff:g id="EXTENSION">%1$s</xliff:g>-sigblad"</string>
+    <string name="mime_type_presentation" msgid="6145604688774787357">"Aanbieding"</string>
+    <string name="mime_type_presentation_ext" msgid="2982650207774823437">"<xliff:g id="EXTENSION">%1$s</xliff:g>-aanbieding"</string>
     <string name="car_loading_profile" msgid="3545132581795684027">"Laai tans"</string>
     <plurals name="file_count" formatted="false" msgid="1628600959752419449">
       <item quantity="other"><xliff:g id="FILE_NAME_2">%s</xliff:g> + <xliff:g id="COUNT_3">%d</xliff:g> lêers</item>
       <item quantity="one"><xliff:g id="FILE_NAME_0">%s</xliff:g> + <xliff:g id="COUNT_1">%d</xliff:g> lêer</item>
     </plurals>
+    <!-- no translation found for chooser_no_direct_share_targets (997970693708458895) -->
+    <skip />
 </resources>
diff --git a/core/res/res/values-am/strings.xml b/core/res/res/values-am/strings.xml
index 6282a8d..cabca7f 100644
--- a/core/res/res/values-am/strings.xml
+++ b/core/res/res/values-am/strings.xml
@@ -308,15 +308,15 @@
     <string name="permgrouplab_phone" msgid="5229115638567440675">"ስልክ"</string>
     <string name="permgroupdesc_phone" msgid="6234224354060641055">"የስልክ ጥሪዎች ያድርጉ እና ያስተዳድሩ"</string>
     <string name="permgrouprequest_phone" msgid="9166979577750581037">"&lt;b&gt;<xliff:g id="APP_NAME">%1$s</xliff:g>&lt;/b&gt; የስልክ ጥሪዎችን እንዲያደርግ እና እንዲያቀናብር ይፈቀድለት?"</string>
-    <string name="permgrouplab_sensors" msgid="416037179223226722">"የሰውነት ዳሳሾች"</string>
+    <string name="permgrouplab_sensors" msgid="4838614103153567532">"የሰውነት ዳሳሾች"</string>
     <string name="permgroupdesc_sensors" msgid="7147968539346634043">"ስለአስፈላጊ ምልክቶችዎ ያሉ የዳሳሽ ውሂብ ይድረሱ"</string>
     <string name="permgrouprequest_sensors" msgid="6349806962814556786">"&lt;b&gt;<xliff:g id="APP_NAME">%1$s</xliff:g>&lt;/b&gt; የሰውነትዎ መሠረታዊ ምልክቶች የዳሳሽ ውሂብ እንዲደርስ ይፈቀድለት?"</string>
     <string name="permgrouplab_aural" msgid="965607064083134896">"ሙዚቃ"</string>
     <string name="permgroupdesc_aural" msgid="4870189506255958055">"ሙዚቃዎን መድረስ"</string>
     <string name="permgrouprequest_aural" msgid="6787926123071735620">"&lt;b&gt;<xliff:g id="APP_NAME">%1$s</xliff:g>&lt;/b&gt; ቀን ሙዚቃዎን እንዲደርስ ይፈቀድለት?"</string>
-    <string name="permgrouplab_visual" msgid="8030190588123857921">"ፎቶዎች እና ቪዲዮዎች"</string>
+    <string name="permgrouplab_visual" msgid="6477382108771145134">"ፎቶዎች እና ቪዲዮዎች"</string>
     <string name="permgroupdesc_visual" msgid="3415827902566663546">"የእርስዎን ፎቶዎች እና ቪዲዮዎች መድረስ"</string>
-    <string name="permgrouprequest_visual" msgid="6907523945030290376">"&lt;b&gt;<xliff:g id="APP_NAME">%1$s</xliff:g>&lt;/b&gt; የእርስዎን ፎቶዎች እና ቪዲዮዎች እንዲደርስ ይፈቀድለት?"</string>
+    <string name="permgrouprequest_visual" msgid="3043752127595243314">"የእርስዎን ፎቶዎች እና ቪዲዮዎች መለያ ስያሜ የተደረገባቸውን መገኛ አካባቢዎች ጨምሮ &lt;b&gt;<xliff:g id="APP_NAME">%1$s</xliff:g>&lt;/b&gt; እንዲደርስ ይፈቀድለት?"</string>
     <string name="capability_title_canRetrieveWindowContent" msgid="3901717936930170320">"የመስኮት ይዘት ሰርስረው ያውጡ"</string>
     <string name="capability_desc_canRetrieveWindowContent" msgid="3772225008605310672">"መስተጋበር የሚፈጥሩት የመስኮት ይዘት ይመርምሩ።"</string>
     <string name="capability_title_canRequestTouchExploration" msgid="3108723364676667320">"በመንካት ያስሱን ያብሩ"</string>
@@ -1396,8 +1396,7 @@
     <string name="ext_media_init_action" msgid="7952885510091978278">"አዋቅር"</string>
     <string name="ext_media_unmount_action" msgid="1121883233103278199">"አስወጣ"</string>
     <string name="ext_media_browse_action" msgid="8322172381028546087">"ያስሱ"</string>
-    <!-- no translation found for ext_media_seamless_action (6575980560886881233) -->
-    <skip />
+    <string name="ext_media_seamless_action" msgid="6575980560886881233">"ውጽዓትን ቀይር"</string>
     <string name="ext_media_missing_title" msgid="620980315821543904">"<xliff:g id="NAME">%s</xliff:g> ይጎድላል"</string>
     <string name="ext_media_missing_message" msgid="4012389235250987930">"መሣሪያን እንደገና ያስገቡ"</string>
     <string name="ext_media_move_specific_title" msgid="1471100343872375842">"<xliff:g id="NAME">%s</xliff:g>ን በመውሰድ ላይ"</string>
@@ -1611,6 +1610,8 @@
     <string name="display_manager_overlay_display_name" msgid="5142365982271620716">"ተደራቢ #<xliff:g id="ID">%1$d</xliff:g>"</string>
     <string name="display_manager_overlay_display_title" msgid="652124517672257172">"<xliff:g id="NAME">%1$s</xliff:g>፦ <xliff:g id="WIDTH">%2$d</xliff:g>x<xliff:g id="HEIGHT">%3$d</xliff:g>፣ <xliff:g id="DPI">%4$d</xliff:g> dpi"</string>
     <string name="display_manager_overlay_display_secure_suffix" msgid="6022119702628572080">"፣ የተጠበቀ"</string>
+    <string name="activity_starter_block_bg_activity_starts_permissive" msgid="5692097903712956720">"ይህ የ<xliff:g id="PACKAGENAME">%1$s</xliff:g> የበስተጀርባ እንቅስቃሴ ጅምር በወደፊት የQ ግንቦች ላይ ይታገዳል። go/q-bg-block ይመልከቱ።"</string>
+    <string name="activity_starter_block_bg_activity_starts_enforcing" msgid="8299522481076404353">"የ<xliff:g id="PACKAGENAME">%1$s</xliff:g> የበስተጀርባ እንቅስቃሴ ጅምር ታግዷል። go/q-bg-block ይመልከቱ።"</string>
     <string name="kg_forgot_pattern_button_text" msgid="8852021467868220608">"ስርዓተ ጥለቱን እርሳ"</string>
     <string name="kg_wrong_pattern" msgid="1850806070801358830">"የተሳሳተ ስርዓተ ጥለት"</string>
     <string name="kg_wrong_password" msgid="2333281762128113157">"የተሳሳተ ይለፍ ቃል"</string>
@@ -1996,9 +1997,29 @@
     <string name="dynamic_mode_notification_channel_name" msgid="2348803891571320452">"የዕለት ተዕለት ሁነታ መረጃ ማሳወቂያዎች"</string>
     <string name="dynamic_mode_notification_title" msgid="508815255807182035">"ባትሪ ከተለመደው ኃይል መሙላት በፊት ሊያልቅ ይችላል"</string>
     <string name="dynamic_mode_notification_summary" msgid="2541166298550402690">"የባትሪ ቆጣቢ የባትሪ ዕድሜን ለማራዘም ገብሯል።"</string>
+    <string name="mime_type_folder" msgid="7111951698626315204">"አቃፊ"</string>
+    <string name="mime_type_apk" msgid="5518003630972506900">"የAndroid መተግበሪያ"</string>
+    <string name="mime_type_generic" msgid="6833871596845900027">"ፋይል"</string>
+    <string name="mime_type_generic_ext" msgid="8450275970061657174">"የ<xliff:g id="EXTENSION">%1$s</xliff:g> ፋይል"</string>
+    <string name="mime_type_audio" msgid="6289777657172050926">"ኦዲዮ"</string>
+    <string name="mime_type_audio_ext" msgid="3270880987725816210">"የ<xliff:g id="EXTENSION">%1$s</xliff:g> ኦዲዮ"</string>
+    <string name="mime_type_video" msgid="4093025777317307426">"ቪዲዮ"</string>
+    <string name="mime_type_video_ext" msgid="5643771615714173159">"የ<xliff:g id="EXTENSION">%1$s</xliff:g> ቪድዮ"</string>
+    <string name="mime_type_image" msgid="3144284451605236371">"ምስል"</string>
+    <string name="mime_type_image_ext" msgid="1514613218742736590">"የ<xliff:g id="EXTENSION">%1$s</xliff:g> ምስል"</string>
+    <string name="mime_type_compressed" msgid="1645486037074943257">"ማህደር"</string>
+    <string name="mime_type_compressed_ext" msgid="4232293058067801528">"የ<xliff:g id="EXTENSION">%1$s</xliff:g> ማህደር"</string>
+    <string name="mime_type_document" msgid="1596838147256375966">"ሰነድ"</string>
+    <string name="mime_type_document_ext" msgid="6327266601345501281">"የ<xliff:g id="EXTENSION">%1$s</xliff:g> ሰነድ"</string>
+    <string name="mime_type_spreadsheet" msgid="2639138255207123557">"ተመን ሉህ"</string>
+    <string name="mime_type_spreadsheet_ext" msgid="5508653032786106725">"የ<xliff:g id="EXTENSION">%1$s</xliff:g> ተመን ሉህ"</string>
+    <string name="mime_type_presentation" msgid="6145604688774787357">"የዝግጅት አቀራረብ"</string>
+    <string name="mime_type_presentation_ext" msgid="2982650207774823437">"የ<xliff:g id="EXTENSION">%1$s</xliff:g> ዝግጅት አቀራረብ"</string>
     <string name="car_loading_profile" msgid="3545132581795684027">"በመጫን ላይ"</string>
     <plurals name="file_count" formatted="false" msgid="1628600959752419449">
       <item quantity="one"><xliff:g id="FILE_NAME_2">%s</xliff:g> + <xliff:g id="COUNT_3">%d</xliff:g> ፋይሎች</item>
       <item quantity="other"><xliff:g id="FILE_NAME_2">%s</xliff:g> + <xliff:g id="COUNT_3">%d</xliff:g> ፋይሎች</item>
     </plurals>
+    <!-- no translation found for chooser_no_direct_share_targets (997970693708458895) -->
+    <skip />
 </resources>
diff --git a/core/res/res/values-ar/strings.xml b/core/res/res/values-ar/strings.xml
index b522148..52f6698 100644
--- a/core/res/res/values-ar/strings.xml
+++ b/core/res/res/values-ar/strings.xml
@@ -320,15 +320,15 @@
     <string name="permgrouplab_phone" msgid="5229115638567440675">"الهاتف"</string>
     <string name="permgroupdesc_phone" msgid="6234224354060641055">"إجراء مكالمات هاتفية وإدارتها"</string>
     <string name="permgrouprequest_phone" msgid="9166979577750581037">"‏هل تريد السماح لتطبيق &lt;b&gt;<xliff:g id="APP_NAME">%1$s</xliff:g>&lt;/b&gt; بإجراء المكالمات الهاتفية وإدارتها؟"</string>
-    <string name="permgrouplab_sensors" msgid="416037179223226722">"أجهزة استشعار الجسم"</string>
+    <string name="permgrouplab_sensors" msgid="4838614103153567532">"أجهزة استشعار الجسم"</string>
     <string name="permgroupdesc_sensors" msgid="7147968539346634043">"الوصول إلى بيانات المستشعر حول علاماتك الحيوية"</string>
     <string name="permgrouprequest_sensors" msgid="6349806962814556786">"‏هل تريد السماح لتطبيق &lt;b&gt;<xliff:g id="APP_NAME">%1$s</xliff:g>&lt;/b&gt; بالدخول إلى بيانات المستشعر حول علاماتك الحيوية؟"</string>
     <string name="permgrouplab_aural" msgid="965607064083134896">"الموسيقى"</string>
     <string name="permgroupdesc_aural" msgid="4870189506255958055">"الوصول إلى الموسيقى"</string>
     <string name="permgrouprequest_aural" msgid="6787926123071735620">"‏هل تريد السماح لتطبيق &lt;b&gt;<xliff:g id="APP_NAME">%1$s</xliff:g>&lt;/b&gt; بالوصول إلى الموسيقى؟"</string>
-    <string name="permgrouplab_visual" msgid="8030190588123857921">"الصور والفيديوهات"</string>
+    <string name="permgrouplab_visual" msgid="6477382108771145134">"الصور والفيديوهات"</string>
     <string name="permgroupdesc_visual" msgid="3415827902566663546">"الوصول إلى صورك وفيديوهاتك"</string>
-    <string name="permgrouprequest_visual" msgid="6907523945030290376">"‏هل تريد السماح لتطبيق &lt;b&gt;<xliff:g id="APP_NAME">%1$s</xliff:g>&lt;/b&gt; بالوصول إلى صورك وفيديوهاتك؟"</string>
+    <string name="permgrouprequest_visual" msgid="3043752127595243314">"‏هل تريد السماح للتطبيق &lt;b&gt;<xliff:g id="APP_NAME">%1$s</xliff:g>&lt;/b&gt; بالوصول إلى صورك وفيديوهاتك، بما في ذلك المواقع الجغرافية ذات العلامات؟"</string>
     <string name="capability_title_canRetrieveWindowContent" msgid="3901717936930170320">"استرداد محتوى النافذة"</string>
     <string name="capability_desc_canRetrieveWindowContent" msgid="3772225008605310672">"فحص محتوى نافذة يتم التفاعل معها"</string>
     <string name="capability_title_canRequestTouchExploration" msgid="3108723364676667320">"تشغيل الاستكشاف باللمس"</string>
@@ -1484,8 +1484,7 @@
     <string name="ext_media_init_action" msgid="7952885510091978278">"إعداد"</string>
     <string name="ext_media_unmount_action" msgid="1121883233103278199">"إلغاء"</string>
     <string name="ext_media_browse_action" msgid="8322172381028546087">"استكشاف"</string>
-    <!-- no translation found for ext_media_seamless_action (6575980560886881233) -->
-    <skip />
+    <string name="ext_media_seamless_action" msgid="6575980560886881233">"تبديل جهاز إخراج الصوت"</string>
     <string name="ext_media_missing_title" msgid="620980315821543904">"<xliff:g id="NAME">%s</xliff:g> مفقود"</string>
     <string name="ext_media_missing_message" msgid="4012389235250987930">"إدخال الجهاز مرة أخرى"</string>
     <string name="ext_media_move_specific_title" msgid="1471100343872375842">"جارٍ نقل <xliff:g id="NAME">%s</xliff:g>"</string>
@@ -1703,6 +1702,8 @@
     <string name="display_manager_overlay_display_name" msgid="5142365982271620716">"المركب #<xliff:g id="ID">%1$d</xliff:g>"</string>
     <string name="display_manager_overlay_display_title" msgid="652124517672257172">"‏<xliff:g id="NAME">%1$s</xliff:g>: <xliff:g id="WIDTH">%2$d</xliff:g>x<xliff:g id="HEIGHT">%3$d</xliff:g>، <xliff:g id="DPI">%4$d</xliff:g> نقطة لكل بوصة"</string>
     <string name="display_manager_overlay_display_secure_suffix" msgid="6022119702628572080">"آمن"</string>
+    <string name="activity_starter_block_bg_activity_starts_permissive" msgid="5692097903712956720">"‏سيتم حظر بدء نشاط الخلفية هذا من <xliff:g id="PACKAGENAME">%1$s</xliff:g> في إصدارات Q القادمة. اطَّلِع على go/q-bg-block."</string>
+    <string name="activity_starter_block_bg_activity_starts_enforcing" msgid="8299522481076404353">"‏تم حظر بدء نشاط الخلفية من <xliff:g id="PACKAGENAME">%1$s</xliff:g>. اطَّلِع على go/q-bg-block."</string>
     <string name="kg_forgot_pattern_button_text" msgid="8852021467868220608">"نسيت النقش"</string>
     <string name="kg_wrong_pattern" msgid="1850806070801358830">"نقش خاطئ"</string>
     <string name="kg_wrong_password" msgid="2333281762128113157">"كلمة مرور خاطئة"</string>
@@ -2136,6 +2137,24 @@
     <string name="dynamic_mode_notification_channel_name" msgid="2348803891571320452">"إشعار معلومات \"وضع سلسلة الإجراءات\""</string>
     <string name="dynamic_mode_notification_title" msgid="508815255807182035">"قد تنفد طاقة البطارية قبل الشحن المعتاد"</string>
     <string name="dynamic_mode_notification_summary" msgid="2541166298550402690">"تم تفعيل \"توفير شحن البطارية\" لإطالة عمرها."</string>
+    <string name="mime_type_folder" msgid="7111951698626315204">"مجلّد"</string>
+    <string name="mime_type_apk" msgid="5518003630972506900">"‏تطبيق Android"</string>
+    <string name="mime_type_generic" msgid="6833871596845900027">"ملف"</string>
+    <string name="mime_type_generic_ext" msgid="8450275970061657174">"ملف: <xliff:g id="EXTENSION">%1$s</xliff:g>"</string>
+    <string name="mime_type_audio" msgid="6289777657172050926">"صوت"</string>
+    <string name="mime_type_audio_ext" msgid="3270880987725816210">"صوت: <xliff:g id="EXTENSION">%1$s</xliff:g>"</string>
+    <string name="mime_type_video" msgid="4093025777317307426">"فيديو"</string>
+    <string name="mime_type_video_ext" msgid="5643771615714173159">"فيديو: <xliff:g id="EXTENSION">%1$s</xliff:g>"</string>
+    <string name="mime_type_image" msgid="3144284451605236371">"صورة"</string>
+    <string name="mime_type_image_ext" msgid="1514613218742736590">"صورة: <xliff:g id="EXTENSION">%1$s</xliff:g>"</string>
+    <string name="mime_type_compressed" msgid="1645486037074943257">"أرشيف"</string>
+    <string name="mime_type_compressed_ext" msgid="4232293058067801528">"أرشيف: <xliff:g id="EXTENSION">%1$s</xliff:g>"</string>
+    <string name="mime_type_document" msgid="1596838147256375966">"مستند"</string>
+    <string name="mime_type_document_ext" msgid="6327266601345501281">"مستند: <xliff:g id="EXTENSION">%1$s</xliff:g>"</string>
+    <string name="mime_type_spreadsheet" msgid="2639138255207123557">"جدول بيانات"</string>
+    <string name="mime_type_spreadsheet_ext" msgid="5508653032786106725">"جدول بيانات: <xliff:g id="EXTENSION">%1$s</xliff:g>"</string>
+    <string name="mime_type_presentation" msgid="6145604688774787357">"عرض تقديمي"</string>
+    <string name="mime_type_presentation_ext" msgid="2982650207774823437">"عرض تقديمي: <xliff:g id="EXTENSION">%1$s</xliff:g>"</string>
     <string name="car_loading_profile" msgid="3545132581795684027">"جارٍ التحميل"</string>
     <plurals name="file_count" formatted="false" msgid="1628600959752419449">
       <item quantity="zero"><xliff:g id="FILE_NAME_2">%s</xliff:g> و<xliff:g id="COUNT_3">%d</xliff:g> ملف</item>
@@ -2145,4 +2164,6 @@
       <item quantity="other"><xliff:g id="FILE_NAME_2">%s</xliff:g> و<xliff:g id="COUNT_3">%d</xliff:g> ملف</item>
       <item quantity="one"><xliff:g id="FILE_NAME_0">%s</xliff:g> وملف (<xliff:g id="COUNT_1">%d</xliff:g>)</item>
     </plurals>
+    <!-- no translation found for chooser_no_direct_share_targets (997970693708458895) -->
+    <skip />
 </resources>
diff --git a/core/res/res/values-as/strings.xml b/core/res/res/values-as/strings.xml
index 2f69ace..e7dad2f 100644
--- a/core/res/res/values-as/strings.xml
+++ b/core/res/res/values-as/strings.xml
@@ -308,15 +308,15 @@
     <string name="permgrouplab_phone" msgid="5229115638567440675">"ফ’ন"</string>
     <string name="permgroupdesc_phone" msgid="6234224354060641055">"ফ\'ন কল কৰিব আৰু পৰিচলনা কৰিব পাৰে"</string>
     <string name="permgrouprequest_phone" msgid="9166979577750581037">"&lt;b&gt;<xliff:g id="APP_NAME">%1$s</xliff:g>&lt;/b&gt;ক ফ\'ন কল কৰিবলৈ আৰু পৰিচালনা কৰিবলৈ অনুমতি দিবনে?"</string>
-    <string name="permgrouplab_sensors" msgid="416037179223226722">"শৰীৰৰ ছেন্সৰসমূহ"</string>
+    <string name="permgrouplab_sensors" msgid="4838614103153567532">"শৰীৰৰ ছেন্সৰ"</string>
     <string name="permgroupdesc_sensors" msgid="7147968539346634043">"আপোনাৰ দেহৰ গুৰুত্বপূৰ্ণ অংগসমূহৰ অৱস্থাৰ বিষয়ে ছেন্সৰৰ ডেটা লাভ কৰিব পাৰে"</string>
     <string name="permgrouprequest_sensors" msgid="6349806962814556786">"&lt;b&gt;<xliff:g id="APP_NAME">%1$s</xliff:g>&lt;/b&gt;ক আপোনাৰ দেহৰ গুৰুত্বপূৰ্ণ অংগসমূহৰ অৱস্থাৰ বিষয়ে ছেন্সৰৰ ডেটা লাভ কৰিবলৈ অনুমতি দিবনে?"</string>
     <string name="permgrouplab_aural" msgid="965607064083134896">"সংগীত"</string>
     <string name="permgroupdesc_aural" msgid="4870189506255958055">"আপোনাৰ সংগীত এক্সেছ কৰিবলৈ"</string>
     <string name="permgrouprequest_aural" msgid="6787926123071735620">"&lt;b&gt;<xliff:g id="APP_NAME">%1$s</xliff:g>&lt;/b&gt;ক আপোনাৰ সংগীত এক্সেছ কৰিবলৈ দিবনে?"</string>
-    <string name="permgrouplab_visual" msgid="8030190588123857921">"ফট’ আৰু ভিডিঅ’"</string>
+    <string name="permgrouplab_visual" msgid="6477382108771145134">"ফট’ আৰু ভিডিঅ’"</string>
     <string name="permgroupdesc_visual" msgid="3415827902566663546">"আপোনাৰ ফট’ আৰু ভিডিঅ’সমূহ এক্সেছ কৰিবলৈ"</string>
-    <string name="permgrouprequest_visual" msgid="6907523945030290376">"&lt;b&gt;<xliff:g id="APP_NAME">%1$s</xliff:g>&lt;/b&gt;ক আপোনাৰ ফট’ আৰু ভিডিঅ’সমূহ এক্সেছ কৰিবলৈ দিবনে?"</string>
+    <string name="permgrouprequest_visual" msgid="3043752127595243314">"টেগ কৰা অৱস্থানসহ আপোনাৰ ফট’ আৰু ভিডিঅ’ &lt;b&gt;<xliff:g id="APP_NAME">%1$s</xliff:g>&lt;/b&gt;ক এক্সেছ কৰিবলৈ দিবনে?"</string>
     <string name="capability_title_canRetrieveWindowContent" msgid="3901717936930170320">"ৱিণ্ড’ সমল বিচাৰি উলিওৱাৰ"</string>
     <string name="capability_desc_canRetrieveWindowContent" msgid="3772225008605310672">"আপুনি চাই থকা ৱিণ্ড’খনৰ সমল পৰীক্ষা কৰাৰ।"</string>
     <string name="capability_title_canRequestTouchExploration" msgid="3108723364676667320">"স্পৰ্শৰ দ্বাৰা অন্বেষণ কৰাৰ সুবিধা অন কৰাৰ"</string>
@@ -536,8 +536,7 @@
     <string name="biometric_error_user_canceled" msgid="2260175018114348727">"বিশ্বাসযোগ্যতাৰ প্ৰমাণীকৰণ বাতিল কৰা হৈছে"</string>
     <string name="biometric_not_recognized" msgid="5770511773560736082">"চিনাক্ত কৰিব পৰা নাই"</string>
     <string name="biometric_error_canceled" msgid="349665227864885880">"বিশ্বাসযোগ্যতাৰ প্ৰমাণীকৰণ বাতিল কৰা হৈছে"</string>
-    <!-- no translation found for biometric_error_device_not_secured (6583143098363528349) -->
-    <skip />
+    <string name="biometric_error_device_not_secured" msgid="6583143098363528349">"কোনো পিন, আৰ্হি বা পাছৱৰ্ড ছেট কৰা নাই"</string>
     <string name="fingerprint_acquired_partial" msgid="735082772341716043">"ফিংগাৰপ্ৰিণ্ট আংশিকভাৱে চিনাক্ত কৰা হৈছে। অনুগ্ৰহ কৰি আকৌ চেষ্টা কৰক৷"</string>
     <string name="fingerprint_acquired_insufficient" msgid="4596546021310923214">"ফিগাৰপ্ৰিণ্টৰ প্ৰক্ৰিয়া সম্পাদন কৰিবপৰা নগ\'ল। অনুগ্ৰহ কৰি আকৌ চেষ্টা কৰক৷"</string>
     <string name="fingerprint_acquired_imager_dirty" msgid="1087209702421076105">"ফিংগাৰপ্ৰিণ্ট ছেন্সৰটো লেতেৰা হৈ আছে। অনুগ্ৰহ কৰি পৰিষ্কাৰ কৰি আকৌ চেষ্টা কৰক।"</string>
@@ -557,8 +556,7 @@
     <string name="fingerprint_error_lockout_permanent" msgid="5033251797919508137">"অত্যধিক প্ৰয়াস। ফিংগাৰপ্ৰিণ্ট ছেন্সৰ অক্ষম কৰা হ’ল।"</string>
     <string name="fingerprint_error_unable_to_process" msgid="6107816084103552441">"আকৌ চেষ্টা কৰক।"</string>
     <string name="fingerprint_error_no_fingerprints" msgid="7654382120628334248">"কোনো ফিংগাৰপ্ৰিণ্ট যোগ কৰা নহ\'ল।"</string>
-    <!-- no translation found for fingerprint_error_hw_not_present (409523969613176352) -->
-    <skip />
+    <string name="fingerprint_error_hw_not_present" msgid="409523969613176352">"এই ডিভাইচটোত ফিংগাৰপ্ৰিণ্ট ছেন্সৰ নাই।"</string>
     <string name="fingerprint_name_template" msgid="5870957565512716938">"<xliff:g id="FINGERID">%d</xliff:g> আঙুলি"</string>
   <string-array name="fingerprint_error_vendor">
   </string-array>
@@ -578,22 +576,14 @@
     <string name="face_acquired_too_left" msgid="2712489669456176505">"অনুগ্ৰহ কৰি ছেন্সৰটো বাওঁফাললৈ নিয়ক।"</string>
     <string name="face_acquired_poor_gaze" msgid="8344973502980415859">"অনুগ্ৰহ কৰি ছেন্সৰটোলৈ চাওক।"</string>
     <string name="face_acquired_not_detected" msgid="5707782294589511391">"কোনো মুখমণ্ডল চিনাক্ত কৰিব পৰা নগ’ল।"</string>
-    <!-- no translation found for face_acquired_too_much_motion (470381210701463822) -->
-    <skip />
-    <!-- no translation found for face_acquired_recalibrate (8077949502893707539) -->
-    <skip />
-    <!-- no translation found for face_acquired_too_different (5553210341111255124) -->
-    <skip />
-    <!-- no translation found for face_acquired_too_similar (1508776858407646460) -->
-    <skip />
-    <!-- no translation found for face_acquired_pan_too_extreme (8203001424525231680) -->
-    <skip />
-    <!-- no translation found for face_acquired_tilt_too_extreme (7641326344460439970) -->
-    <skip />
-    <!-- no translation found for face_acquired_roll_too_extreme (1444829237745898619) -->
-    <skip />
-    <!-- no translation found for face_acquired_obscured (3055077697850272097) -->
-    <skip />
+    <string name="face_acquired_too_much_motion" msgid="470381210701463822">"বেছি লৰচৰ কৰি আছে।"</string>
+    <string name="face_acquired_recalibrate" msgid="8077949502893707539">"আপোনাৰ মুখমণ্ডল পুনৰ পঞ্জীয়ন কৰক।"</string>
+    <string name="face_acquired_too_different" msgid="5553210341111255124">"অন্য মুখমণ্ডল চিনাক্ত কৰা হৈছে।"</string>
+    <string name="face_acquired_too_similar" msgid="1508776858407646460">"একে ধৰণৰ হৈছে, অনুগ্ৰহ কৰি আপোনাৰ প’জটো সলনি কৰক।"</string>
+    <string name="face_acquired_pan_too_extreme" msgid="8203001424525231680">"অনুগ্ৰহ কৰি পোনে পোনে কেমেৰালৈ চাওক।"</string>
+    <string name="face_acquired_tilt_too_extreme" msgid="7641326344460439970">"অনুগ্ৰহ কৰি পোনে পোনে কেমেৰালৈ চাওক।"</string>
+    <string name="face_acquired_roll_too_extreme" msgid="1444829237745898619">"অনুগ্ৰহ কৰি আপোনাৰ মূৰটো উলম্বভাৱে চিধা কৰক।"</string>
+    <string name="face_acquired_obscured" msgid="3055077697850272097">"আপোনাৰ মুখমণ্ডলৰপৰা আৱৰণ আঁতৰাওক।"</string>
   <string-array name="face_acquired_vendor">
   </string-array>
     <string name="face_error_hw_not_available" msgid="6255891785768984615">"মুখমণ্ডলৰ হাৰ্ডৱেৰ উপলব্ধ নহয়।"</string>
@@ -605,8 +595,7 @@
     <string name="face_error_lockout_permanent" msgid="8198354656746088890">"অত্যধিক প্ৰয়াস। মুখমণ্ডলৰ জৰিয়তে সত্যাপন অক্ষম কৰা হ’ল।"</string>
     <string name="face_error_unable_to_process" msgid="238761109287767270">"আকৌ চেষ্টা কৰক।"</string>
     <string name="face_error_not_enrolled" msgid="9166792142679691323">"কোনো মুখমণ্ডল যোগ কৰা নহ’ল।"</string>
-    <!-- no translation found for face_error_hw_not_present (916085883581450331) -->
-    <skip />
+    <string name="face_error_hw_not_present" msgid="916085883581450331">"এই ডিভাইচটোত মুখমণ্ডল সত্যাপন ছেন্সৰ নাই।"</string>
     <string name="face_name_template" msgid="7004562145809595384">"মুখমণ্ডল <xliff:g id="FACEID">%d</xliff:g>"</string>
   <string-array name="face_error_vendor">
   </string-array>
@@ -1408,8 +1397,7 @@
     <string name="ext_media_init_action" msgid="7952885510091978278">"ছেট আপ কৰক"</string>
     <string name="ext_media_unmount_action" msgid="1121883233103278199">"বাহিৰ কৰক"</string>
     <string name="ext_media_browse_action" msgid="8322172381028546087">"অন্বেষণ কৰক"</string>
-    <!-- no translation found for ext_media_seamless_action (6575980560886881233) -->
-    <skip />
+    <string name="ext_media_seamless_action" msgid="6575980560886881233">"আউটপুট সলনি কৰক"</string>
     <string name="ext_media_missing_title" msgid="620980315821543904">"<xliff:g id="NAME">%s</xliff:g> উপলব্ধ নহয়"</string>
     <string name="ext_media_missing_message" msgid="4012389235250987930">"ডিভাইচ আকৌ ভৰাওক"</string>
     <string name="ext_media_move_specific_title" msgid="1471100343872375842">"<xliff:g id="NAME">%s</xliff:g>ক স্থানান্তৰ কৰি থকা হৈছে"</string>
@@ -1623,6 +1611,8 @@
     <string name="display_manager_overlay_display_name" msgid="5142365982271620716">"অ\'ভাৰলে\' #<xliff:g id="ID">%1$d</xliff:g>"</string>
     <string name="display_manager_overlay_display_title" msgid="652124517672257172">"<xliff:g id="NAME">%1$s</xliff:g>: <xliff:g id="WIDTH">%2$d</xliff:g>x<xliff:g id="HEIGHT">%3$d</xliff:g>, <xliff:g id="DPI">%4$d</xliff:g> dpi"</string>
     <string name="display_manager_overlay_display_secure_suffix" msgid="6022119702628572080">", সুৰক্ষিত"</string>
+    <string name="activity_starter_block_bg_activity_starts_permissive" msgid="5692097903712956720">"<xliff:g id="PACKAGENAME">%1$s</xliff:g>ৰ পৰা নেপথ্যত আৰম্ভ হোৱা এই কাৰ্যকলাপটো ভবিষ্যতে কিউ বিল্ডত অৱৰোধ কৰা হ’ব। go/q-bg-block চাওক"</string>
+    <string name="activity_starter_block_bg_activity_starts_enforcing" msgid="8299522481076404353">"<xliff:g id="PACKAGENAME">%1$s</xliff:g>ৰ পৰা নেপথ্যত আৰম্ভ হোৱা কাৰ্যকলাপ অৱৰোধ কৰা হৈছে। go/q-bg-block চাওক"</string>
     <string name="kg_forgot_pattern_button_text" msgid="8852021467868220608">"আৰ্হি পাহৰিলেনে"</string>
     <string name="kg_wrong_pattern" msgid="1850806070801358830">"ভুল আৰ্হি"</string>
     <string name="kg_wrong_password" msgid="2333281762128113157">"ভুল পাছৱৰ্ড"</string>
@@ -2008,9 +1998,29 @@
     <string name="dynamic_mode_notification_channel_name" msgid="2348803891571320452">"ৰুটিন ম’ডৰ তথ্য জাননী"</string>
     <string name="dynamic_mode_notification_title" msgid="508815255807182035">"চ্চাৰ্জ কৰাৰ সচৰাচৰ সময়ৰ আগতেই বেটাৰি শেষ হ’ব পাৰে"</string>
     <string name="dynamic_mode_notification_summary" msgid="2541166298550402690">"বেটাৰিৰ খৰচ কমাবলৈ বেটাৰি সঞ্চয়কাৰী অন কৰা হৈছে"</string>
+    <string name="mime_type_folder" msgid="7111951698626315204">"ফ’ল্ডাৰ"</string>
+    <string name="mime_type_apk" msgid="5518003630972506900">"Android এপ্লিকেশ্বন"</string>
+    <string name="mime_type_generic" msgid="6833871596845900027">"ফাইল"</string>
+    <string name="mime_type_generic_ext" msgid="8450275970061657174">"<xliff:g id="EXTENSION">%1$s</xliff:g> ফাইল"</string>
+    <string name="mime_type_audio" msgid="6289777657172050926">"অডিঅ’"</string>
+    <string name="mime_type_audio_ext" msgid="3270880987725816210">"<xliff:g id="EXTENSION">%1$s</xliff:g> অডিঅ’"</string>
+    <string name="mime_type_video" msgid="4093025777317307426">"ভিডিঅ’"</string>
+    <string name="mime_type_video_ext" msgid="5643771615714173159">"<xliff:g id="EXTENSION">%1$s</xliff:g> ভিডিঅ’"</string>
+    <string name="mime_type_image" msgid="3144284451605236371">"ছবি"</string>
+    <string name="mime_type_image_ext" msgid="1514613218742736590">"<xliff:g id="EXTENSION">%1$s</xliff:g> ছবি"</string>
+    <string name="mime_type_compressed" msgid="1645486037074943257">"আৰ্কাইভ"</string>
+    <string name="mime_type_compressed_ext" msgid="4232293058067801528">"<xliff:g id="EXTENSION">%1$s</xliff:g> আৰ্কাইভ"</string>
+    <string name="mime_type_document" msgid="1596838147256375966">"নথি"</string>
+    <string name="mime_type_document_ext" msgid="6327266601345501281">"<xliff:g id="EXTENSION">%1$s</xliff:g> নথি"</string>
+    <string name="mime_type_spreadsheet" msgid="2639138255207123557">"স্প্ৰেডশ্বীট"</string>
+    <string name="mime_type_spreadsheet_ext" msgid="5508653032786106725">"<xliff:g id="EXTENSION">%1$s</xliff:g> স্প্ৰেডশ্বীট"</string>
+    <string name="mime_type_presentation" msgid="6145604688774787357">"উপস্থাপন"</string>
+    <string name="mime_type_presentation_ext" msgid="2982650207774823437">"<xliff:g id="EXTENSION">%1$s</xliff:g> উপস্থাপন"</string>
     <string name="car_loading_profile" msgid="3545132581795684027">"ল’ড হৈ আছে"</string>
     <plurals name="file_count" formatted="false" msgid="1628600959752419449">
       <item quantity="one"><xliff:g id="FILE_NAME_2">%s</xliff:g> + <xliff:g id="COUNT_3">%d</xliff:g>টা ফাইল</item>
       <item quantity="other"><xliff:g id="FILE_NAME_2">%s</xliff:g> + <xliff:g id="COUNT_3">%d</xliff:g>টা ফাইল</item>
     </plurals>
+    <!-- no translation found for chooser_no_direct_share_targets (997970693708458895) -->
+    <skip />
 </resources>
diff --git a/core/res/res/values-az/strings.xml b/core/res/res/values-az/strings.xml
index bc78e19..7186da9 100644
--- a/core/res/res/values-az/strings.xml
+++ b/core/res/res/values-az/strings.xml
@@ -308,15 +308,15 @@
     <string name="permgrouplab_phone" msgid="5229115638567440675">"Telefon"</string>
     <string name="permgroupdesc_phone" msgid="6234224354060641055">"telefon zəngləri edin və onları idarə edin"</string>
     <string name="permgrouprequest_phone" msgid="9166979577750581037">"&lt;b&gt;<xliff:g id="APP_NAME">%1$s</xliff:g>&lt;/b&gt; tətbiqinə telefon zəngləri etmək və onları idarə etmək icazəsi verilsin?"</string>
-    <string name="permgrouplab_sensors" msgid="416037179223226722">"Bədən Sensorları"</string>
+    <string name="permgrouplab_sensors" msgid="4838614103153567532">"Bədən sensorları"</string>
     <string name="permgroupdesc_sensors" msgid="7147968539346634043">"Həyati əlamətlər haqqında sensor dataya daxil olun"</string>
     <string name="permgrouprequest_sensors" msgid="6349806962814556786">"&lt;b&gt;<xliff:g id="APP_NAME">%1$s</xliff:g>&lt;/b&gt; tətbiqinə həyati əlamətlər haqqında sensor dataya daxil olmaq icazəsi verilsin?"</string>
     <string name="permgrouplab_aural" msgid="965607064083134896">"Musiqi"</string>
     <string name="permgroupdesc_aural" msgid="4870189506255958055">"musiqiyə daxil olun"</string>
     <string name="permgrouprequest_aural" msgid="6787926123071735620">"&lt;b&gt;<xliff:g id="APP_NAME">%1$s</xliff:g>&lt;/b&gt; tətbiqinin musiqiyə daxil olmağına icazə verilsin?"</string>
-    <string name="permgrouplab_visual" msgid="8030190588123857921">"Foto və Videolar"</string>
+    <string name="permgrouplab_visual" msgid="6477382108771145134">"Foto və videolar"</string>
     <string name="permgroupdesc_visual" msgid="3415827902566663546">"foto və videolara daxil olun"</string>
-    <string name="permgrouprequest_visual" msgid="6907523945030290376">"&lt;b&gt;<xliff:g id="APP_NAME">%1$s</xliff:g>&lt;/b&gt; tətbiqinin foto və videolarınıza daxil olmağına icazə verilsin?"</string>
+    <string name="permgrouprequest_visual" msgid="3043752127595243314">"&lt;b&gt;<xliff:g id="APP_NAME">%1$s</xliff:g>&lt;/b&gt; tətbiqinə işarələnmiş məkanlar daxil olmaqla, foto və videolara girişinə icazə verilsin?"</string>
     <string name="capability_title_canRetrieveWindowContent" msgid="3901717936930170320">"Pəncərənin məzmununu əldə edin"</string>
     <string name="capability_desc_canRetrieveWindowContent" msgid="3772225008605310672">"Əlaqədə olduğunuz pəncərənin məzmununu nəzərdən keçirin."</string>
     <string name="capability_title_canRequestTouchExploration" msgid="3108723364676667320">"Toxunaraq Kəşf et funksiyasını yandırın"</string>
@@ -1396,8 +1396,7 @@
     <string name="ext_media_init_action" msgid="7952885510091978278">"Quraşdırın"</string>
     <string name="ext_media_unmount_action" msgid="1121883233103278199">"Çıxarın"</string>
     <string name="ext_media_browse_action" msgid="8322172381028546087">"Araşdır"</string>
-    <!-- no translation found for ext_media_seamless_action (6575980560886881233) -->
-    <skip />
+    <string name="ext_media_seamless_action" msgid="6575980560886881233">"Çıxışı dəyişin"</string>
     <string name="ext_media_missing_title" msgid="620980315821543904">"<xliff:g id="NAME">%s</xliff:g> yoxdur"</string>
     <string name="ext_media_missing_message" msgid="4012389235250987930">"Cihazı yenidən daxil edin"</string>
     <string name="ext_media_move_specific_title" msgid="1471100343872375842">"<xliff:g id="NAME">%s</xliff:g> daşınır"</string>
@@ -1611,6 +1610,8 @@
     <string name="display_manager_overlay_display_name" msgid="5142365982271620716">"Örtük #<xliff:g id="ID">%1$d</xliff:g>"</string>
     <string name="display_manager_overlay_display_title" msgid="652124517672257172">"<xliff:g id="NAME">%1$s</xliff:g>: <xliff:g id="WIDTH">%2$d</xliff:g>x<xliff:g id="HEIGHT">%3$d</xliff:g>, <xliff:g id="DPI">%4$d</xliff:g> dpi"</string>
     <string name="display_manager_overlay_display_secure_suffix" msgid="6022119702628572080">", təhlükəsiz"</string>
+    <string name="activity_starter_block_bg_activity_starts_permissive" msgid="5692097903712956720">"<xliff:g id="PACKAGENAME">%1$s</xliff:g> ünvanından olan bu arxa fon fəaliyyəti növbəti Q versiyalarında blok ediləcək. go/q-bg-block ünvanına baxın."</string>
+    <string name="activity_starter_block_bg_activity_starts_enforcing" msgid="8299522481076404353">"<xliff:g id="PACKAGENAME">%1$s</xliff:g> ünvanından olan arxa fon fəaliyyəti blok edildi. go/q-bg-block ünvanına baxın."</string>
     <string name="kg_forgot_pattern_button_text" msgid="8852021467868220608">"Şablonu unutmuşam"</string>
     <string name="kg_wrong_pattern" msgid="1850806070801358830">"Yanlış Model"</string>
     <string name="kg_wrong_password" msgid="2333281762128113157">"Yanlış Şifrə"</string>
@@ -1996,9 +1997,29 @@
     <string name="dynamic_mode_notification_channel_name" msgid="2348803891571320452">"Rejim üçün məlumat bildirişi"</string>
     <string name="dynamic_mode_notification_title" msgid="508815255807182035">"Batareya həmişəki vaxtdan əvvəl bitə bilər"</string>
     <string name="dynamic_mode_notification_summary" msgid="2541166298550402690">"Enerjiyə Qənaət rejimi batareya istifadəsinin müddətini artırmaq üçün aktiv edilir"</string>
+    <string name="mime_type_folder" msgid="7111951698626315204">"Qovluq"</string>
+    <string name="mime_type_apk" msgid="5518003630972506900">"Android tətbiqi"</string>
+    <string name="mime_type_generic" msgid="6833871596845900027">"Fayl"</string>
+    <string name="mime_type_generic_ext" msgid="8450275970061657174">"<xliff:g id="EXTENSION">%1$s</xliff:g> fayl"</string>
+    <string name="mime_type_audio" msgid="6289777657172050926">"Audio"</string>
+    <string name="mime_type_audio_ext" msgid="3270880987725816210">"<xliff:g id="EXTENSION">%1$s</xliff:g> audio"</string>
+    <string name="mime_type_video" msgid="4093025777317307426">"Video"</string>
+    <string name="mime_type_video_ext" msgid="5643771615714173159">"<xliff:g id="EXTENSION">%1$s</xliff:g> video"</string>
+    <string name="mime_type_image" msgid="3144284451605236371">"Şəkil"</string>
+    <string name="mime_type_image_ext" msgid="1514613218742736590">"<xliff:g id="EXTENSION">%1$s</xliff:g> şəkil"</string>
+    <string name="mime_type_compressed" msgid="1645486037074943257">"Arxiv"</string>
+    <string name="mime_type_compressed_ext" msgid="4232293058067801528">"<xliff:g id="EXTENSION">%1$s</xliff:g> arxiv faylı"</string>
+    <string name="mime_type_document" msgid="1596838147256375966">"Sənəd"</string>
+    <string name="mime_type_document_ext" msgid="6327266601345501281">"<xliff:g id="EXTENSION">%1$s</xliff:g> sənəd"</string>
+    <string name="mime_type_spreadsheet" msgid="2639138255207123557">"Cədvəl"</string>
+    <string name="mime_type_spreadsheet_ext" msgid="5508653032786106725">"<xliff:g id="EXTENSION">%1$s</xliff:g> cədvəl"</string>
+    <string name="mime_type_presentation" msgid="6145604688774787357">"Təqdimat"</string>
+    <string name="mime_type_presentation_ext" msgid="2982650207774823437">"<xliff:g id="EXTENSION">%1$s</xliff:g> təqdimat"</string>
     <string name="car_loading_profile" msgid="3545132581795684027">"Yüklənir"</string>
     <plurals name="file_count" formatted="false" msgid="1628600959752419449">
       <item quantity="other"><xliff:g id="FILE_NAME_2">%s</xliff:g> + <xliff:g id="COUNT_3">%d</xliff:g> fayl</item>
       <item quantity="one"><xliff:g id="FILE_NAME_0">%s</xliff:g> + <xliff:g id="COUNT_1">%d</xliff:g> fayl</item>
     </plurals>
+    <!-- no translation found for chooser_no_direct_share_targets (997970693708458895) -->
+    <skip />
 </resources>
diff --git a/core/res/res/values-b+sr+Latn/strings.xml b/core/res/res/values-b+sr+Latn/strings.xml
index 55ab20c..788b5d6 100644
--- a/core/res/res/values-b+sr+Latn/strings.xml
+++ b/core/res/res/values-b+sr+Latn/strings.xml
@@ -311,15 +311,15 @@
     <string name="permgrouplab_phone" msgid="5229115638567440675">"Telefon"</string>
     <string name="permgroupdesc_phone" msgid="6234224354060641055">"upućuje telefonske pozive i upravlja njima"</string>
     <string name="permgrouprequest_phone" msgid="9166979577750581037">"Želite li da omogućite da &lt;b&gt;<xliff:g id="APP_NAME">%1$s</xliff:g>&lt;/b&gt; upućuje pozive i upravlja njima?"</string>
-    <string name="permgrouplab_sensors" msgid="416037179223226722">"Senzori za telo"</string>
+    <string name="permgrouplab_sensors" msgid="4838614103153567532">"Senzori za telo"</string>
     <string name="permgroupdesc_sensors" msgid="7147968539346634043">"pristupa podacima senzora o vitalnim funkcijama"</string>
     <string name="permgrouprequest_sensors" msgid="6349806962814556786">"Želite li da omogućite da &lt;b&gt;<xliff:g id="APP_NAME">%1$s</xliff:g>&lt;/b&gt;pristupa podacima senzora o vitalnim funkcijama?"</string>
     <string name="permgrouplab_aural" msgid="965607064083134896">"Muzika"</string>
     <string name="permgroupdesc_aural" msgid="4870189506255958055">"pristup muzici"</string>
     <string name="permgrouprequest_aural" msgid="6787926123071735620">"Želite li da omogućite da &lt;b&gt;<xliff:g id="APP_NAME">%1$s</xliff:g>&lt;/b&gt; pristupa muzici?"</string>
-    <string name="permgrouplab_visual" msgid="8030190588123857921">"Slike i video snimci"</string>
+    <string name="permgrouplab_visual" msgid="6477382108771145134">"Slike i video snimci"</string>
     <string name="permgroupdesc_visual" msgid="3415827902566663546">"pristup slikama i video snimcima"</string>
-    <string name="permgrouprequest_visual" msgid="6907523945030290376">"Želite li da omogućite da &lt;b&gt;<xliff:g id="APP_NAME">%1$s</xliff:g>&lt;/b&gt; pristupa slikama i video snimcima?"</string>
+    <string name="permgrouprequest_visual" msgid="3043752127595243314">"Želite li da dozvolite da „<xliff:g id="APP_NAME">%1$s</xliff:g>“ pristupa slikama i video snimcima, uključujući označene lokacije?"</string>
     <string name="capability_title_canRetrieveWindowContent" msgid="3901717936930170320">"da preuzima sadržaj prozora"</string>
     <string name="capability_desc_canRetrieveWindowContent" msgid="3772225008605310672">"Proverava sadržaj prozora sa kojim ostvarujete interakciju."</string>
     <string name="capability_title_canRequestTouchExploration" msgid="3108723364676667320">"da uključi Istraživanja dodirom"</string>
@@ -1418,8 +1418,7 @@
     <string name="ext_media_init_action" msgid="7952885510091978278">"Aktiviraj"</string>
     <string name="ext_media_unmount_action" msgid="1121883233103278199">"Izbaci"</string>
     <string name="ext_media_browse_action" msgid="8322172381028546087">"Istraži"</string>
-    <!-- no translation found for ext_media_seamless_action (6575980560886881233) -->
-    <skip />
+    <string name="ext_media_seamless_action" msgid="6575980560886881233">"Promenite izlaz"</string>
     <string name="ext_media_missing_title" msgid="620980315821543904">"<xliff:g id="NAME">%s</xliff:g> nedostaje"</string>
     <string name="ext_media_missing_message" msgid="4012389235250987930">"Ponovo umetnite uređaj"</string>
     <string name="ext_media_move_specific_title" msgid="1471100343872375842">"Prenosi se <xliff:g id="NAME">%s</xliff:g>"</string>
@@ -1634,6 +1633,8 @@
     <string name="display_manager_overlay_display_name" msgid="5142365982271620716">"Postavljeni element br. <xliff:g id="ID">%1$d</xliff:g>"</string>
     <string name="display_manager_overlay_display_title" msgid="652124517672257172">"<xliff:g id="NAME">%1$s</xliff:g>: <xliff:g id="WIDTH">%2$d</xliff:g>×<xliff:g id="HEIGHT">%3$d</xliff:g>, <xliff:g id="DPI">%4$d</xliff:g> dpi"</string>
     <string name="display_manager_overlay_display_secure_suffix" msgid="6022119702628572080">", bezbedno"</string>
+    <string name="activity_starter_block_bg_activity_starts_permissive" msgid="5692097903712956720">"Ovo pokretanje aktivnosti u pozadini sa <xliff:g id="PACKAGENAME">%1$s</xliff:g> biće blokirano u budućim Q verzijama. Pogledajte go/q-bg-block."</string>
+    <string name="activity_starter_block_bg_activity_starts_enforcing" msgid="8299522481076404353">"Pokretanje aktivnosti u pozadini sa <xliff:g id="PACKAGENAME">%1$s</xliff:g> je blokirano. Pogledajte go/q-bg-block."</string>
     <string name="kg_forgot_pattern_button_text" msgid="8852021467868220608">"Zaboravljeni šablon"</string>
     <string name="kg_wrong_pattern" msgid="1850806070801358830">"Pogrešan šablon"</string>
     <string name="kg_wrong_password" msgid="2333281762128113157">"Pogrešna lozinka"</string>
@@ -2031,10 +2032,30 @@
     <string name="dynamic_mode_notification_channel_name" msgid="2348803891571320452">"Obaveštenje o informacijama Rutinskog režima"</string>
     <string name="dynamic_mode_notification_title" msgid="508815255807182035">"Baterija će se možda isprazniti pre uobičajenog punjenja"</string>
     <string name="dynamic_mode_notification_summary" msgid="2541166298550402690">"Ušteda baterije je aktivirana da bi se produžilo trajanje baterije"</string>
+    <string name="mime_type_folder" msgid="7111951698626315204">"Direktorijum"</string>
+    <string name="mime_type_apk" msgid="5518003630972506900">"Android aplikacija"</string>
+    <string name="mime_type_generic" msgid="6833871596845900027">"Datoteka"</string>
+    <string name="mime_type_generic_ext" msgid="8450275970061657174">"<xliff:g id="EXTENSION">%1$s</xliff:g> datoteka"</string>
+    <string name="mime_type_audio" msgid="6289777657172050926">"Audio datoteka"</string>
+    <string name="mime_type_audio_ext" msgid="3270880987725816210">"<xliff:g id="EXTENSION">%1$s</xliff:g> audio datoteka"</string>
+    <string name="mime_type_video" msgid="4093025777317307426">"Video"</string>
+    <string name="mime_type_video_ext" msgid="5643771615714173159">"<xliff:g id="EXTENSION">%1$s</xliff:g> video"</string>
+    <string name="mime_type_image" msgid="3144284451605236371">"Slika"</string>
+    <string name="mime_type_image_ext" msgid="1514613218742736590">"<xliff:g id="EXTENSION">%1$s</xliff:g> slika"</string>
+    <string name="mime_type_compressed" msgid="1645486037074943257">"Arhiva"</string>
+    <string name="mime_type_compressed_ext" msgid="4232293058067801528">"<xliff:g id="EXTENSION">%1$s</xliff:g> arhiva"</string>
+    <string name="mime_type_document" msgid="1596838147256375966">"Dokument"</string>
+    <string name="mime_type_document_ext" msgid="6327266601345501281">"<xliff:g id="EXTENSION">%1$s</xliff:g> dokument"</string>
+    <string name="mime_type_spreadsheet" msgid="2639138255207123557">"Tabela"</string>
+    <string name="mime_type_spreadsheet_ext" msgid="5508653032786106725">"<xliff:g id="EXTENSION">%1$s</xliff:g> tabela"</string>
+    <string name="mime_type_presentation" msgid="6145604688774787357">"Prezentacija"</string>
+    <string name="mime_type_presentation_ext" msgid="2982650207774823437">"<xliff:g id="EXTENSION">%1$s</xliff:g> prezentacija"</string>
     <string name="car_loading_profile" msgid="3545132581795684027">"Učitava se"</string>
     <plurals name="file_count" formatted="false" msgid="1628600959752419449">
       <item quantity="one"><xliff:g id="FILE_NAME_2">%s</xliff:g> i još <xliff:g id="COUNT_3">%d</xliff:g> datoteka</item>
       <item quantity="few"><xliff:g id="FILE_NAME_2">%s</xliff:g> i još <xliff:g id="COUNT_3">%d</xliff:g> datoteke</item>
       <item quantity="other"><xliff:g id="FILE_NAME_2">%s</xliff:g> i još <xliff:g id="COUNT_3">%d</xliff:g> datoteka</item>
     </plurals>
+    <!-- no translation found for chooser_no_direct_share_targets (997970693708458895) -->
+    <skip />
 </resources>
diff --git a/core/res/res/values-be/strings.xml b/core/res/res/values-be/strings.xml
index 7964be5..83b268a 100644
--- a/core/res/res/values-be/strings.xml
+++ b/core/res/res/values-be/strings.xml
@@ -314,15 +314,15 @@
     <string name="permgrouplab_phone" msgid="5229115638567440675">"Тэлефон"</string>
     <string name="permgroupdesc_phone" msgid="6234224354060641055">"рабіць тэлефонныя выклікі і кіраваць імі"</string>
     <string name="permgrouprequest_phone" msgid="9166979577750581037">"Дазволіць праграме &lt;b&gt;<xliff:g id="APP_NAME">%1$s</xliff:g>&lt;/b&gt; рабіць тэлефонныя выклікі і кіраваць імі?"</string>
-    <string name="permgrouplab_sensors" msgid="416037179223226722">"Датчыкі цела"</string>
+    <string name="permgrouplab_sensors" msgid="4838614103153567532">"Датчыкі цела"</string>
     <string name="permgroupdesc_sensors" msgid="7147968539346634043">"атрымліваць з датчыка даныя асноўных фізіялагічных паказчыкаў"</string>
     <string name="permgrouprequest_sensors" msgid="6349806962814556786">"Дазволіць праграме &lt;b&gt;<xliff:g id="APP_NAME">%1$s</xliff:g>&lt;/b&gt; доступ да даных з датчыкаў пра вашы асноўныя фізіялагічныя паказчыкі?"</string>
     <string name="permgrouplab_aural" msgid="965607064083134896">"Музыка"</string>
     <string name="permgroupdesc_aural" msgid="4870189506255958055">"доступ да музыкі"</string>
     <string name="permgrouprequest_aural" msgid="6787926123071735620">"Дазволіць праграме &lt;b&gt;<xliff:g id="APP_NAME">%1$s</xliff:g>&lt;/b&gt; доступ да музыкі?"</string>
-    <string name="permgrouplab_visual" msgid="8030190588123857921">"Фота і відэа"</string>
+    <string name="permgrouplab_visual" msgid="6477382108771145134">"Фота і відэа"</string>
     <string name="permgroupdesc_visual" msgid="3415827902566663546">"доступ да фота і відэа"</string>
-    <string name="permgrouprequest_visual" msgid="6907523945030290376">"Дазволіць праграме &lt;b&gt;<xliff:g id="APP_NAME">%1$s</xliff:g>&lt;/b&gt; доступ да фота і відэа?"</string>
+    <string name="permgrouprequest_visual" msgid="3043752127595243314">"Дазволіць &lt;b&gt;<xliff:g id="APP_NAME">%1$s</xliff:g>&lt;/b&gt; доступ да фота і відэа, у тым ліку з пазначаным месцам?"</string>
     <string name="capability_title_canRetrieveWindowContent" msgid="3901717936930170320">"Атрымліваць змесціва вакна"</string>
     <string name="capability_desc_canRetrieveWindowContent" msgid="3772225008605310672">"Аналізаваць змесціва актыўнага вакна."</string>
     <string name="capability_title_canRequestTouchExploration" msgid="3108723364676667320">"Уключаць Азнаямленне дотыкам"</string>
@@ -1440,8 +1440,7 @@
     <string name="ext_media_init_action" msgid="7952885510091978278">"Наладзіць"</string>
     <string name="ext_media_unmount_action" msgid="1121883233103278199">"Выняць"</string>
     <string name="ext_media_browse_action" msgid="8322172381028546087">"Праглядзець"</string>
-    <!-- no translation found for ext_media_seamless_action (6575980560886881233) -->
-    <skip />
+    <string name="ext_media_seamless_action" msgid="6575980560886881233">"Пераключыце вывад"</string>
     <string name="ext_media_missing_title" msgid="620980315821543904">"<xliff:g id="NAME">%s</xliff:g> адсутнічае"</string>
     <string name="ext_media_missing_message" msgid="4012389235250987930">"Устаўце прыладу яшчэ раз"</string>
     <string name="ext_media_move_specific_title" msgid="1471100343872375842">"Перамяшчэнне <xliff:g id="NAME">%s</xliff:g>"</string>
@@ -1657,6 +1656,8 @@
     <string name="display_manager_overlay_display_name" msgid="5142365982271620716">"Оверлей # <xliff:g id="ID">%1$d</xliff:g>"</string>
     <string name="display_manager_overlay_display_title" msgid="652124517672257172">"<xliff:g id="NAME">%1$s</xliff:g>: <xliff:g id="WIDTH">%2$d</xliff:g>x<xliff:g id="HEIGHT">%3$d</xliff:g>, <xliff:g id="DPI">%4$d</xliff:g> кр. на цалю"</string>
     <string name="display_manager_overlay_display_secure_suffix" msgid="6022119702628572080">", бяспечны"</string>
+    <string name="activity_starter_block_bg_activity_starts_permissive" msgid="5692097903712956720">"Запуск дзеянняў у фонавым рэжыме з пакета \"<xliff:g id="PACKAGENAME">%1$s</xliff:g>\" будзе заблакіраваны ў будучых Q-зборках. Глядзіце go/q-bg-block."</string>
+    <string name="activity_starter_block_bg_activity_starts_enforcing" msgid="8299522481076404353">"Запуск дзеянняў у фонавым рэжыме з пакета \"<xliff:g id="PACKAGENAME">%1$s</xliff:g>\" заблакіраваны. Глядзіце go/q-bg-block."</string>
     <string name="kg_forgot_pattern_button_text" msgid="8852021467868220608">"Забылі ключ"</string>
     <string name="kg_wrong_pattern" msgid="1850806070801358830">"Няправільны ўзор"</string>
     <string name="kg_wrong_password" msgid="2333281762128113157">"Няправiльны пароль"</string>
@@ -2066,6 +2067,24 @@
     <string name="dynamic_mode_notification_channel_name" msgid="2348803891571320452">"Апавяшчэнне з інфармацыяй пра ўсталяваны рэжым"</string>
     <string name="dynamic_mode_notification_title" msgid="508815255807182035">"Акумулятар можа разрадзіцца хутчэй, чым прыйдзе час звычайнай зарадкі"</string>
     <string name="dynamic_mode_notification_summary" msgid="2541166298550402690">"Каб павялічыць тэрмін работы акумулятара, уключаны рэжым эканоміі зараду"</string>
+    <string name="mime_type_folder" msgid="7111951698626315204">"Папка"</string>
+    <string name="mime_type_apk" msgid="5518003630972506900">"Праграма Android"</string>
+    <string name="mime_type_generic" msgid="6833871596845900027">"Файл"</string>
+    <string name="mime_type_generic_ext" msgid="8450275970061657174">"Файл <xliff:g id="EXTENSION">%1$s</xliff:g>"</string>
+    <string name="mime_type_audio" msgid="6289777657172050926">"Аўдыяфайл"</string>
+    <string name="mime_type_audio_ext" msgid="3270880987725816210">"Аўдыя <xliff:g id="EXTENSION">%1$s</xliff:g>"</string>
+    <string name="mime_type_video" msgid="4093025777317307426">"Відэа"</string>
+    <string name="mime_type_video_ext" msgid="5643771615714173159">"Відэа <xliff:g id="EXTENSION">%1$s</xliff:g>"</string>
+    <string name="mime_type_image" msgid="3144284451605236371">"Відарыс"</string>
+    <string name="mime_type_image_ext" msgid="1514613218742736590">"Відарыс <xliff:g id="EXTENSION">%1$s</xliff:g>"</string>
+    <string name="mime_type_compressed" msgid="1645486037074943257">"Архіў"</string>
+    <string name="mime_type_compressed_ext" msgid="4232293058067801528">"Архіў <xliff:g id="EXTENSION">%1$s</xliff:g>"</string>
+    <string name="mime_type_document" msgid="1596838147256375966">"Дакумент"</string>
+    <string name="mime_type_document_ext" msgid="6327266601345501281">"Дакумент <xliff:g id="EXTENSION">%1$s</xliff:g>"</string>
+    <string name="mime_type_spreadsheet" msgid="2639138255207123557">"Табліца"</string>
+    <string name="mime_type_spreadsheet_ext" msgid="5508653032786106725">"Табліца <xliff:g id="EXTENSION">%1$s</xliff:g>"</string>
+    <string name="mime_type_presentation" msgid="6145604688774787357">"Прэзентацыя"</string>
+    <string name="mime_type_presentation_ext" msgid="2982650207774823437">"Прэзентацыя <xliff:g id="EXTENSION">%1$s</xliff:g>"</string>
     <string name="car_loading_profile" msgid="3545132581795684027">"Загрузка"</string>
     <plurals name="file_count" formatted="false" msgid="1628600959752419449">
       <item quantity="one"><xliff:g id="FILE_NAME_2">%s</xliff:g> + <xliff:g id="COUNT_3">%d</xliff:g> файл</item>
@@ -2073,4 +2092,6 @@
       <item quantity="many"><xliff:g id="FILE_NAME_2">%s</xliff:g> + <xliff:g id="COUNT_3">%d</xliff:g> файлаў</item>
       <item quantity="other"><xliff:g id="FILE_NAME_2">%s</xliff:g> + <xliff:g id="COUNT_3">%d</xliff:g> файла</item>
     </plurals>
+    <!-- no translation found for chooser_no_direct_share_targets (997970693708458895) -->
+    <skip />
 </resources>
diff --git a/core/res/res/values-bg/strings.xml b/core/res/res/values-bg/strings.xml
index 8af0c5f..da29c0e 100644
--- a/core/res/res/values-bg/strings.xml
+++ b/core/res/res/values-bg/strings.xml
@@ -308,15 +308,15 @@
     <string name="permgrouplab_phone" msgid="5229115638567440675">"Телефон"</string>
     <string name="permgroupdesc_phone" msgid="6234224354060641055">"да извършва телефонни обаждания и да ги управлява"</string>
     <string name="permgrouprequest_phone" msgid="9166979577750581037">"Да се разреши ли на &lt;b&gt;<xliff:g id="APP_NAME">%1$s</xliff:g>&lt;/b&gt; да извършва и управлява телефонни обаждания?"</string>
-    <string name="permgrouplab_sensors" msgid="416037179223226722">"Телесни сензори"</string>
+    <string name="permgrouplab_sensors" msgid="4838614103153567532">"Сензори за тяло"</string>
     <string name="permgroupdesc_sensors" msgid="7147968539346634043">"достъп до сензорните данни за жизнените ви показатели"</string>
     <string name="permgrouprequest_sensors" msgid="6349806962814556786">"Да се разреши ли на &lt;b&gt;<xliff:g id="APP_NAME">%1$s</xliff:g>&lt;/b&gt; да осъществява достъп до данните от сензорите за жизнените ви показатели?"</string>
     <string name="permgrouplab_aural" msgid="965607064083134896">"Музика"</string>
     <string name="permgroupdesc_aural" msgid="4870189506255958055">"достъп до музиката ви"</string>
     <string name="permgrouprequest_aural" msgid="6787926123071735620">"Да се разреши ли на &lt;b&gt;<xliff:g id="APP_NAME">%1$s</xliff:g>&lt;/b&gt; да осъществява достъп до музиката ви?"</string>
-    <string name="permgrouplab_visual" msgid="8030190588123857921">"Снимки и видеоклипове"</string>
+    <string name="permgrouplab_visual" msgid="6477382108771145134">"Снимки и видеоклипове"</string>
     <string name="permgroupdesc_visual" msgid="3415827902566663546">"достъп до снимките и видеоклиповете ви"</string>
-    <string name="permgrouprequest_visual" msgid="6907523945030290376">"Да се разреши ли на &lt;b&gt;<xliff:g id="APP_NAME">%1$s</xliff:g>&lt;/b&gt; да осъществява достъп до снимките и видеоклиповете ви?"</string>
+    <string name="permgrouprequest_visual" msgid="3043752127595243314">"Да се разреши ли на &lt;b&gt;<xliff:g id="APP_NAME">%1$s</xliff:g>&lt;/b&gt; достъп до снимките и видеоклиповете ви, включително маркерите за местоположение?"</string>
     <string name="capability_title_canRetrieveWindowContent" msgid="3901717936930170320">"Извличане на съдържанието от прозореца"</string>
     <string name="capability_desc_canRetrieveWindowContent" msgid="3772225008605310672">"Инспектиране на съдържанието на прозорец, с който взаимодействате."</string>
     <string name="capability_title_canRequestTouchExploration" msgid="3108723364676667320">"Включване на изследването чрез докосване"</string>
@@ -1396,8 +1396,7 @@
     <string name="ext_media_init_action" msgid="7952885510091978278">"Настройване"</string>
     <string name="ext_media_unmount_action" msgid="1121883233103278199">"Изваждане"</string>
     <string name="ext_media_browse_action" msgid="8322172381028546087">"Изследване"</string>
-    <!-- no translation found for ext_media_seamless_action (6575980560886881233) -->
-    <skip />
+    <string name="ext_media_seamless_action" msgid="6575980560886881233">"Превключване на изхода"</string>
     <string name="ext_media_missing_title" msgid="620980315821543904">"Липсва <xliff:g id="NAME">%s</xliff:g>"</string>
     <string name="ext_media_missing_message" msgid="4012389235250987930">"Поставете отново устройството"</string>
     <string name="ext_media_move_specific_title" msgid="1471100343872375842">"<xliff:g id="NAME">%s</xliff:g> се премества"</string>
@@ -1611,6 +1610,8 @@
     <string name="display_manager_overlay_display_name" msgid="5142365982271620716">"Наслагване №<xliff:g id="ID">%1$d</xliff:g>"</string>
     <string name="display_manager_overlay_display_title" msgid="652124517672257172">"„<xliff:g id="NAME">%1$s</xliff:g>“: <xliff:g id="WIDTH">%2$d</xliff:g> x <xliff:g id="HEIGHT">%3$d</xliff:g>, <xliff:g id="DPI">%4$d</xliff:g> dpi"</string>
     <string name="display_manager_overlay_display_secure_suffix" msgid="6022119702628572080">", защитено"</string>
+    <string name="activity_starter_block_bg_activity_starts_permissive" msgid="5692097903712956720">"Стартирането на активност на заден план от <xliff:g id="PACKAGENAME">%1$s</xliff:g> ще бъде блокирано в бъдещите компилации под Q. Вижте go/q-bg-block."</string>
+    <string name="activity_starter_block_bg_activity_starts_enforcing" msgid="8299522481076404353">"Стартирането на активност на заден план от <xliff:g id="PACKAGENAME">%1$s</xliff:g> е блокирано. Вижте go/q-bg-block."</string>
     <string name="kg_forgot_pattern_button_text" msgid="8852021467868220608">"Забравена фигура"</string>
     <string name="kg_wrong_pattern" msgid="1850806070801358830">"Грешна фигура"</string>
     <string name="kg_wrong_password" msgid="2333281762128113157">"Грешна парола"</string>
@@ -1996,9 +1997,29 @@
     <string name="dynamic_mode_notification_channel_name" msgid="2348803891571320452">"Известие с информация за режима на поредица"</string>
     <string name="dynamic_mode_notification_title" msgid="508815255807182035">"Батерията може да се изтощи преди обичайното зареждане"</string>
     <string name="dynamic_mode_notification_summary" msgid="2541166298550402690">"Режимът за запазване на батерията е активиран с цел удължаване на живота на батерията"</string>
+    <string name="mime_type_folder" msgid="7111951698626315204">"Папка"</string>
+    <string name="mime_type_apk" msgid="5518003630972506900">"Приложение за Android"</string>
+    <string name="mime_type_generic" msgid="6833871596845900027">"Файл"</string>
+    <string name="mime_type_generic_ext" msgid="8450275970061657174">"Файл във формат <xliff:g id="EXTENSION">%1$s</xliff:g>"</string>
+    <string name="mime_type_audio" msgid="6289777657172050926">"Аудиофайл"</string>
+    <string name="mime_type_audio_ext" msgid="3270880987725816210">"Аудиофайл във формат <xliff:g id="EXTENSION">%1$s</xliff:g>"</string>
+    <string name="mime_type_video" msgid="4093025777317307426">"Видеоклип"</string>
+    <string name="mime_type_video_ext" msgid="5643771615714173159">"Видеоклип във формат <xliff:g id="EXTENSION">%1$s</xliff:g>"</string>
+    <string name="mime_type_image" msgid="3144284451605236371">"Изображение"</string>
+    <string name="mime_type_image_ext" msgid="1514613218742736590">"Изображение във формат <xliff:g id="EXTENSION">%1$s</xliff:g>"</string>
+    <string name="mime_type_compressed" msgid="1645486037074943257">"Архив"</string>
+    <string name="mime_type_compressed_ext" msgid="4232293058067801528">"Архив във формат <xliff:g id="EXTENSION">%1$s</xliff:g>"</string>
+    <string name="mime_type_document" msgid="1596838147256375966">"Документ"</string>
+    <string name="mime_type_document_ext" msgid="6327266601345501281">"Документ във формат <xliff:g id="EXTENSION">%1$s</xliff:g>"</string>
+    <string name="mime_type_spreadsheet" msgid="2639138255207123557">"Електронна таблица"</string>
+    <string name="mime_type_spreadsheet_ext" msgid="5508653032786106725">"Електронна таблица във формат <xliff:g id="EXTENSION">%1$s</xliff:g>"</string>
+    <string name="mime_type_presentation" msgid="6145604688774787357">"Презентация"</string>
+    <string name="mime_type_presentation_ext" msgid="2982650207774823437">"Презентация във формат <xliff:g id="EXTENSION">%1$s</xliff:g>"</string>
     <string name="car_loading_profile" msgid="3545132581795684027">"Зарежда се"</string>
     <plurals name="file_count" formatted="false" msgid="1628600959752419449">
       <item quantity="other"><xliff:g id="FILE_NAME_2">%s</xliff:g> + <xliff:g id="COUNT_3">%d</xliff:g> файла</item>
       <item quantity="one"><xliff:g id="FILE_NAME_0">%s</xliff:g> + <xliff:g id="COUNT_1">%d</xliff:g> файл</item>
     </plurals>
+    <!-- no translation found for chooser_no_direct_share_targets (997970693708458895) -->
+    <skip />
 </resources>
diff --git a/core/res/res/values-bn/strings.xml b/core/res/res/values-bn/strings.xml
index 100dd57..e0f866d 100644
--- a/core/res/res/values-bn/strings.xml
+++ b/core/res/res/values-bn/strings.xml
@@ -308,15 +308,15 @@
     <string name="permgrouplab_phone" msgid="5229115638567440675">"ফোন"</string>
     <string name="permgroupdesc_phone" msgid="6234224354060641055">"ফোন কলগুলি এবং পরিচালনা"</string>
     <string name="permgrouprequest_phone" msgid="9166979577750581037">"&lt;b&gt;<xliff:g id="APP_NAME">%1$s</xliff:g>&lt;/b&gt;-কে কল করতে এবং কল পরিচালনা করতে দেবেন?"</string>
-    <string name="permgrouplab_sensors" msgid="416037179223226722">"বডি সেন্সরগুলি"</string>
+    <string name="permgrouplab_sensors" msgid="4838614103153567532">"বডি সেন্সর"</string>
     <string name="permgroupdesc_sensors" msgid="7147968539346634043">"আপনার অত্যাবশ্যক লক্ষণগুলির সম্পর্কে সেন্সর ডেটা অ্যাক্সেস করে"</string>
     <string name="permgrouprequest_sensors" msgid="6349806962814556786">"&lt;b&gt;<xliff:g id="APP_NAME">%1$s</xliff:g>&lt;/b&gt;-কে সেন্সর থেকে আপনার ভাইটাল সাইনের ডেটা অ্যাক্সেস করতে দেবেন?"</string>
     <string name="permgrouplab_aural" msgid="965607064083134896">"মিউজিক"</string>
     <string name="permgroupdesc_aural" msgid="4870189506255958055">"আপনার মিউজিকে অ্যাক্সেস করুন"</string>
     <string name="permgrouprequest_aural" msgid="6787926123071735620">"&lt;b&gt;<xliff:g id="APP_NAME">%1$s</xliff:g>&lt;/b&gt;-কে আপনার মিউজিকে অ্যাক্সেস দেবেন?"</string>
-    <string name="permgrouplab_visual" msgid="8030190588123857921">"ফটো ও ভিডিও"</string>
+    <string name="permgrouplab_visual" msgid="6477382108771145134">"ফটো ও ভিডিও"</string>
     <string name="permgroupdesc_visual" msgid="3415827902566663546">"আপনার ফটো ও ভিডিও অ্যাক্সেস করুন"</string>
-    <string name="permgrouprequest_visual" msgid="6907523945030290376">"আপনার ফটো ও ভিডিওতে &lt;b&gt;<xliff:g id="APP_NAME">%1$s</xliff:g>&lt;/b&gt;-কে অ্যাক্সেস দেবেন?"</string>
+    <string name="permgrouprequest_visual" msgid="3043752127595243314">"&lt;b&gt;<xliff:g id="APP_NAME">%1$s</xliff:g>&lt;/b&gt;-কে ট্যাগ করা লোকেশন সহ ফটো এবং ভিডিও অ্যাক্সেস করার অনুমতি দেবেন?"</string>
     <string name="capability_title_canRetrieveWindowContent" msgid="3901717936930170320">"উইন্ডোর কন্টেন্ট পুনরুদ্ধার করে"</string>
     <string name="capability_desc_canRetrieveWindowContent" msgid="3772225008605310672">"ব্যবহার করছেন এমন একটি উইন্ডোর কন্টেন্ট নিরীক্ষণ করে৷"</string>
     <string name="capability_title_canRequestTouchExploration" msgid="3108723364676667320">"স্পর্শের মাধ্যমে অন্বেষণ করা চালু করুন"</string>
@@ -1612,6 +1612,8 @@
     <string name="display_manager_overlay_display_name" msgid="5142365982271620716">"আচ্ছাদন #<xliff:g id="ID">%1$d</xliff:g>"</string>
     <string name="display_manager_overlay_display_title" msgid="652124517672257172">"<xliff:g id="NAME">%1$s</xliff:g>: <xliff:g id="WIDTH">%2$d</xliff:g>x<xliff:g id="HEIGHT">%3$d</xliff:g>, <xliff:g id="DPI">%4$d</xliff:g> dpi"</string>
     <string name="display_manager_overlay_display_secure_suffix" msgid="6022119702628572080">", নিরাপদ"</string>
+    <string name="activity_starter_block_bg_activity_starts_permissive" msgid="5692097903712956720">"<xliff:g id="PACKAGENAME">%1$s</xliff:g> থেকে শুরু হওয়া ব্যাকগ্রাউন্ড অ্যাক্টিভিটি ভবিষ্যত কিউ বিল্ডে ব্লক করা হবে। go/q-bg-block দেখুন।"</string>
+    <string name="activity_starter_block_bg_activity_starts_enforcing" msgid="8299522481076404353">"<xliff:g id="PACKAGENAME">%1$s</xliff:g> থেকে শুরু হওয়া ব্যাকগ্রাউন্ড অ্যাক্টিভিটি ব্লক করা হয়েছে। go/q-bg-block দেখুন।"</string>
     <string name="kg_forgot_pattern_button_text" msgid="8852021467868220608">"প্যাটার্ন ভুলে গেছেন"</string>
     <string name="kg_wrong_pattern" msgid="1850806070801358830">"ভুল প্যাটার্ন"</string>
     <string name="kg_wrong_password" msgid="2333281762128113157">"ভুল পাসওয়ার্ড"</string>
@@ -1997,9 +1999,29 @@
     <string name="dynamic_mode_notification_channel_name" msgid="2348803891571320452">"রুটিন মোডের তথ্য সংক্রান্ত বিজ্ঞপ্তি"</string>
     <string name="dynamic_mode_notification_title" msgid="508815255807182035">"সাধারণত যখন চার্জ দেন, তার আগে চার্জ শেষ হয়ে যেতে পারে"</string>
     <string name="dynamic_mode_notification_summary" msgid="2541166298550402690">"ডিভাইস বেশিক্ষণ চালু রাখতে ব্যাটারি সেভার চালু করা হয়েছে"</string>
+    <string name="mime_type_folder" msgid="7111951698626315204">"ফোল্ডার"</string>
+    <string name="mime_type_apk" msgid="5518003630972506900">"Android অ্যাপ্লিকেশন"</string>
+    <string name="mime_type_generic" msgid="6833871596845900027">"ফাইল"</string>
+    <string name="mime_type_generic_ext" msgid="8450275970061657174">"<xliff:g id="EXTENSION">%1$s</xliff:g> ফাইল"</string>
+    <string name="mime_type_audio" msgid="6289777657172050926">"অডিও"</string>
+    <string name="mime_type_audio_ext" msgid="3270880987725816210">"<xliff:g id="EXTENSION">%1$s</xliff:g> অডিও"</string>
+    <string name="mime_type_video" msgid="4093025777317307426">"ভিডিও"</string>
+    <string name="mime_type_video_ext" msgid="5643771615714173159">"<xliff:g id="EXTENSION">%1$s</xliff:g> ভিডিও"</string>
+    <string name="mime_type_image" msgid="3144284451605236371">"ছবি"</string>
+    <string name="mime_type_image_ext" msgid="1514613218742736590">"<xliff:g id="EXTENSION">%1$s</xliff:g> ছবি"</string>
+    <string name="mime_type_compressed" msgid="1645486037074943257">"আর্কাইভ"</string>
+    <string name="mime_type_compressed_ext" msgid="4232293058067801528">"<xliff:g id="EXTENSION">%1$s</xliff:g> আর্কাইভ"</string>
+    <string name="mime_type_document" msgid="1596838147256375966">"ডকুমেন্ট"</string>
+    <string name="mime_type_document_ext" msgid="6327266601345501281">"<xliff:g id="EXTENSION">%1$s</xliff:g> ডকুমেন্ট"</string>
+    <string name="mime_type_spreadsheet" msgid="2639138255207123557">"স্প্রেডশীট"</string>
+    <string name="mime_type_spreadsheet_ext" msgid="5508653032786106725">"<xliff:g id="EXTENSION">%1$s</xliff:g> স্প্রেডশীট"</string>
+    <string name="mime_type_presentation" msgid="6145604688774787357">"উপস্থাপনা"</string>
+    <string name="mime_type_presentation_ext" msgid="2982650207774823437">"<xliff:g id="EXTENSION">%1$s</xliff:g> উপস্থাপনা"</string>
     <string name="car_loading_profile" msgid="3545132581795684027">"লোড হচ্ছে"</string>
     <plurals name="file_count" formatted="false" msgid="1628600959752419449">
       <item quantity="one"><xliff:g id="FILE_NAME_2">%s</xliff:g> এবং আরও <xliff:g id="COUNT_3">%d</xliff:g>টি ফাইল</item>
       <item quantity="other"><xliff:g id="FILE_NAME_2">%s</xliff:g> এবং আরও <xliff:g id="COUNT_3">%d</xliff:g>টি ফাইল</item>
     </plurals>
+    <!-- no translation found for chooser_no_direct_share_targets (997970693708458895) -->
+    <skip />
 </resources>
diff --git a/core/res/res/values-bs/strings.xml b/core/res/res/values-bs/strings.xml
index c33ebc3..a78796f 100644
--- a/core/res/res/values-bs/strings.xml
+++ b/core/res/res/values-bs/strings.xml
@@ -311,15 +311,15 @@
     <string name="permgrouplab_phone" msgid="5229115638567440675">"Telefon"</string>
     <string name="permgroupdesc_phone" msgid="6234224354060641055">"poziva i upravlja pozivima"</string>
     <string name="permgrouprequest_phone" msgid="9166979577750581037">"Dozvoliti aplikaciji &lt;b&gt;<xliff:g id="APP_NAME">%1$s</xliff:g>&lt;/b&gt; uspostavljanje poziva i njihovo upravljanje?"</string>
-    <string name="permgrouplab_sensors" msgid="416037179223226722">"Tjelesni senzori"</string>
+    <string name="permgrouplab_sensors" msgid="4838614103153567532">"Tjelesni senzori"</string>
     <string name="permgroupdesc_sensors" msgid="7147968539346634043">"pristupa podacima senzora o vašim vitalnim funkcijama"</string>
     <string name="permgrouprequest_sensors" msgid="6349806962814556786">"Dozvoliti aplikaciji &lt;b&gt;<xliff:g id="APP_NAME">%1$s</xliff:g>&lt;/b&gt; pristup senzornim podacima o vašim vitalnim znacima?"</string>
     <string name="permgrouplab_aural" msgid="965607064083134896">"Muzika"</string>
     <string name="permgroupdesc_aural" msgid="4870189506255958055">"pristup muzici"</string>
     <string name="permgrouprequest_aural" msgid="6787926123071735620">"Dozvoliti aplikaciji &lt;b&gt;<xliff:g id="APP_NAME">%1$s</xliff:g>&lt;/b&gt;da pristupi vašoj muzici?"</string>
-    <string name="permgrouplab_visual" msgid="8030190588123857921">"Fotografije i videozapisi"</string>
+    <string name="permgrouplab_visual" msgid="6477382108771145134">"Fotografije i videozapisi"</string>
     <string name="permgroupdesc_visual" msgid="3415827902566663546">"pristup fotografijama i videozapisima"</string>
-    <string name="permgrouprequest_visual" msgid="6907523945030290376">"Dozvoliti aplikaciji &lt;b&gt;<xliff:g id="APP_NAME">%1$s</xliff:g>&lt;/b&gt; da pristupi vašim fotografijama i videozapisima?"</string>
+    <string name="permgrouprequest_visual" msgid="3043752127595243314">"Dozvoliti da &lt;b&gt;<xliff:g id="APP_NAME">%1$s</xliff:g>&lt;/b&gt; pristupa fotografijama i videozapisima, uključujući označene lokacije?"</string>
     <string name="capability_title_canRetrieveWindowContent" msgid="3901717936930170320">"Preuzima sadržaj prozora"</string>
     <string name="capability_desc_canRetrieveWindowContent" msgid="3772225008605310672">"Pregleda sadržaj prozora koji trenutno koristite."</string>
     <string name="capability_title_canRequestTouchExploration" msgid="3108723364676667320">"Uključi opciju Istraživanje dodirom"</string>
@@ -1420,8 +1420,7 @@
     <string name="ext_media_init_action" msgid="7952885510091978278">"Postavi"</string>
     <string name="ext_media_unmount_action" msgid="1121883233103278199">"Izbaci"</string>
     <string name="ext_media_browse_action" msgid="8322172381028546087">"Istraži"</string>
-    <!-- no translation found for ext_media_seamless_action (6575980560886881233) -->
-    <skip />
+    <string name="ext_media_seamless_action" msgid="6575980560886881233">"Prebacite izlaz"</string>
     <string name="ext_media_missing_title" msgid="620980315821543904">"<xliff:g id="NAME">%s</xliff:g> nedostaje"</string>
     <string name="ext_media_missing_message" msgid="4012389235250987930">"Ponovo ubacite uređaj"</string>
     <string name="ext_media_move_specific_title" msgid="1471100343872375842">"Premješta se <xliff:g id="NAME">%s</xliff:g>"</string>
@@ -1636,6 +1635,8 @@
     <string name="display_manager_overlay_display_name" msgid="5142365982271620716">"Nadsloj #<xliff:g id="ID">%1$d</xliff:g>"</string>
     <string name="display_manager_overlay_display_title" msgid="652124517672257172">"<xliff:g id="NAME">%1$s</xliff:g>: <xliff:g id="WIDTH">%2$d</xliff:g>x<xliff:g id="HEIGHT">%3$d</xliff:g>, <xliff:g id="DPI">%4$d</xliff:g> dpi"</string>
     <string name="display_manager_overlay_display_secure_suffix" msgid="6022119702628572080">", osigurano"</string>
+    <string name="activity_starter_block_bg_activity_starts_permissive" msgid="5692097903712956720">"Pokretanje aktivnosti u pozadini na web lokaciji <xliff:g id="PACKAGENAME">%1$s</xliff:g> blokirat će se u budućim Q verzijama. Pogledajte go/q-bg-block."</string>
+    <string name="activity_starter_block_bg_activity_starts_enforcing" msgid="8299522481076404353">"Blokirano je pokretanje aktivnosti u pozadini na web lokaciji <xliff:g id="PACKAGENAME">%1$s</xliff:g>. Pogledajte go/q-bg-block."</string>
     <string name="kg_forgot_pattern_button_text" msgid="8852021467868220608">"Zaboravili ste uzorak?"</string>
     <string name="kg_wrong_pattern" msgid="1850806070801358830">"Pogrešan uzorak"</string>
     <string name="kg_wrong_password" msgid="2333281762128113157">"Pogrešna lozinka"</string>
@@ -1877,7 +1878,7 @@
     <string name="zen_mode_rule_name_combination" msgid="191109939968076477">"<xliff:g id="FIRST">%1$s</xliff:g>/<xliff:g id="REST">%2$s</xliff:g>"</string>
     <string name="toolbar_collapse_description" msgid="2821479483960330739">"Suzi"</string>
     <string name="zen_mode_feature_name" msgid="5254089399895895004">"Ne ometaj"</string>
-    <string name="zen_mode_downtime_feature_name" msgid="2626974636779860146">"Prestanak rada"</string>
+    <string name="zen_mode_downtime_feature_name" msgid="2626974636779860146">"Neaktivnost"</string>
     <string name="zen_mode_default_weeknights_name" msgid="3081318299464998143">"Radni dan uvečer"</string>
     <string name="zen_mode_default_weekends_name" msgid="2786495801019345244">"Vikend"</string>
     <string name="zen_mode_default_events_name" msgid="8158334939013085363">"Događaj"</string>
@@ -2033,10 +2034,30 @@
     <string name="dynamic_mode_notification_channel_name" msgid="2348803891571320452">"Obavještenje za informacije Rutinskog načina"</string>
     <string name="dynamic_mode_notification_title" msgid="508815255807182035">"Moguće je da će se baterija isprazniti prije uobičajenog punjenja"</string>
     <string name="dynamic_mode_notification_summary" msgid="2541166298550402690">"Ušteda baterije je aktivirana da bi se produžio vijek trajanja baterije"</string>
+    <string name="mime_type_folder" msgid="7111951698626315204">"Folder"</string>
+    <string name="mime_type_apk" msgid="5518003630972506900">"Android aplikacija"</string>
+    <string name="mime_type_generic" msgid="6833871596845900027">"Fajl"</string>
+    <string name="mime_type_generic_ext" msgid="8450275970061657174">"<xliff:g id="EXTENSION">%1$s</xliff:g> fajl"</string>
+    <string name="mime_type_audio" msgid="6289777657172050926">"Zvučni zapis"</string>
+    <string name="mime_type_audio_ext" msgid="3270880987725816210">"<xliff:g id="EXTENSION">%1$s</xliff:g> zvučni zapis"</string>
+    <string name="mime_type_video" msgid="4093025777317307426">"Videozapis"</string>
+    <string name="mime_type_video_ext" msgid="5643771615714173159">"<xliff:g id="EXTENSION">%1$s</xliff:g> videozapis"</string>
+    <string name="mime_type_image" msgid="3144284451605236371">"Slika"</string>
+    <string name="mime_type_image_ext" msgid="1514613218742736590">"<xliff:g id="EXTENSION">%1$s</xliff:g> slika"</string>
+    <string name="mime_type_compressed" msgid="1645486037074943257">"Arhiva"</string>
+    <string name="mime_type_compressed_ext" msgid="4232293058067801528">"<xliff:g id="EXTENSION">%1$s</xliff:g> arhiva"</string>
+    <string name="mime_type_document" msgid="1596838147256375966">"Dokument"</string>
+    <string name="mime_type_document_ext" msgid="6327266601345501281">"<xliff:g id="EXTENSION">%1$s</xliff:g> dokument"</string>
+    <string name="mime_type_spreadsheet" msgid="2639138255207123557">"Tabela"</string>
+    <string name="mime_type_spreadsheet_ext" msgid="5508653032786106725">"<xliff:g id="EXTENSION">%1$s</xliff:g> tabela"</string>
+    <string name="mime_type_presentation" msgid="6145604688774787357">"Prezentacija"</string>
+    <string name="mime_type_presentation_ext" msgid="2982650207774823437">"<xliff:g id="EXTENSION">%1$s</xliff:g> prezentacija"</string>
     <string name="car_loading_profile" msgid="3545132581795684027">"Učitavanje"</string>
     <plurals name="file_count" formatted="false" msgid="1628600959752419449">
       <item quantity="one"><xliff:g id="FILE_NAME_2">%s</xliff:g> + <xliff:g id="COUNT_3">%d</xliff:g> fajl</item>
       <item quantity="few"><xliff:g id="FILE_NAME_2">%s</xliff:g> + <xliff:g id="COUNT_3">%d</xliff:g> fajla</item>
       <item quantity="other"><xliff:g id="FILE_NAME_2">%s</xliff:g> + <xliff:g id="COUNT_3">%d</xliff:g> fajlova</item>
     </plurals>
+    <!-- no translation found for chooser_no_direct_share_targets (997970693708458895) -->
+    <skip />
 </resources>
diff --git a/core/res/res/values-ca/strings.xml b/core/res/res/values-ca/strings.xml
index 12d02e1..3e784b9 100644
--- a/core/res/res/values-ca/strings.xml
+++ b/core/res/res/values-ca/strings.xml
@@ -263,7 +263,7 @@
     <string name="notification_channel_vpn" msgid="8330103431055860618">"Estat de la VPN"</string>
     <string name="notification_channel_device_admin" msgid="1568154104368069249">"Administració del dispositiu"</string>
     <string name="notification_channel_alerts" msgid="4496839309318519037">"Alertes"</string>
-    <string name="notification_channel_retail_mode" msgid="6088920674914038779">"Demostració comercial"</string>
+    <string name="notification_channel_retail_mode" msgid="6088920674914038779">"Demostració per a botigues"</string>
     <string name="notification_channel_usb" msgid="9006850475328924681">"Connexió USB"</string>
     <string name="notification_channel_heavy_weight_app" msgid="6218742927792852607">"S\'està executant una aplicació"</string>
     <string name="notification_channel_foreground_service" msgid="3931987440602669158">"Aplicacions que consumeixen bateria"</string>
@@ -308,15 +308,15 @@
     <string name="permgrouplab_phone" msgid="5229115638567440675">"Telèfon"</string>
     <string name="permgroupdesc_phone" msgid="6234224354060641055">"fer i gestionar trucades"</string>
     <string name="permgrouprequest_phone" msgid="9166979577750581037">"Vols permetre que &lt;b&gt;<xliff:g id="APP_NAME">%1$s</xliff:g>&lt;/b&gt; faci trucades i les gestioni?"</string>
-    <string name="permgrouplab_sensors" msgid="416037179223226722">"Sensors corporals"</string>
+    <string name="permgrouplab_sensors" msgid="4838614103153567532">"Sensors corporals"</string>
     <string name="permgroupdesc_sensors" msgid="7147968539346634043">"accedir a les dades del sensor sobre els signes vitals"</string>
     <string name="permgrouprequest_sensors" msgid="6349806962814556786">"Vols permetre que &lt;b&gt;<xliff:g id="APP_NAME">%1$s</xliff:g>&lt;/b&gt; accedeixi a les dades del sensor de constants vitals?"</string>
     <string name="permgrouplab_aural" msgid="965607064083134896">"Música"</string>
     <string name="permgroupdesc_aural" msgid="4870189506255958055">"accedir a la teva música"</string>
     <string name="permgrouprequest_aural" msgid="6787926123071735620">"Vols permetre que &lt;b&gt;<xliff:g id="APP_NAME">%1$s</xliff:g>&lt;/b&gt; accedeixi a la teva música?"</string>
-    <string name="permgrouplab_visual" msgid="8030190588123857921">"Fotos i vídeos"</string>
+    <string name="permgrouplab_visual" msgid="6477382108771145134">"Fotos i vídeos"</string>
     <string name="permgroupdesc_visual" msgid="3415827902566663546">"accedir a les teves fotos i als teus vídeos"</string>
-    <string name="permgrouprequest_visual" msgid="6907523945030290376">"Vols permetre que &lt;b&gt;<xliff:g id="APP_NAME">%1$s</xliff:g>&lt;/b&gt; accedeixi a les teves fotos i als teus vídeos?"</string>
+    <string name="permgrouprequest_visual" msgid="3043752127595243314">"Vols permetre que &lt;b&gt;<xliff:g id="APP_NAME">%1$s</xliff:g>&lt;/b&gt; accedeixi a les fotos i als vídeos, incloses les ubicacions etiquetades?"</string>
     <string name="capability_title_canRetrieveWindowContent" msgid="3901717936930170320">"Recuperar el contingut de la finestra"</string>
     <string name="capability_desc_canRetrieveWindowContent" msgid="3772225008605310672">"Inspecciona el contingut d\'una finestra amb què estàs interaccionant."</string>
     <string name="capability_title_canRequestTouchExploration" msgid="3108723364676667320">"Activar Exploració tàctil"</string>
@@ -1396,8 +1396,7 @@
     <string name="ext_media_init_action" msgid="7952885510091978278">"Configura"</string>
     <string name="ext_media_unmount_action" msgid="1121883233103278199">"Expulsa"</string>
     <string name="ext_media_browse_action" msgid="8322172381028546087">"Explora"</string>
-    <!-- no translation found for ext_media_seamless_action (6575980560886881233) -->
-    <skip />
+    <string name="ext_media_seamless_action" msgid="6575980560886881233">"Canvia la sortida"</string>
     <string name="ext_media_missing_title" msgid="620980315821543904">"No es detecta <xliff:g id="NAME">%s</xliff:g>"</string>
     <string name="ext_media_missing_message" msgid="4012389235250987930">"Torna a inserir el dispositiu"</string>
     <string name="ext_media_move_specific_title" msgid="1471100343872375842">"S\'està desplaçant l\'aplicació <xliff:g id="NAME">%s</xliff:g>"</string>
@@ -1611,6 +1610,8 @@
     <string name="display_manager_overlay_display_name" msgid="5142365982271620716">"Superposa #<xliff:g id="ID">%1$d</xliff:g>"</string>
     <string name="display_manager_overlay_display_title" msgid="652124517672257172">"<xliff:g id="NAME">%1$s</xliff:g>: <xliff:g id="WIDTH">%2$d</xliff:g> x <xliff:g id="HEIGHT">%3$d</xliff:g>, <xliff:g id="DPI">%4$d</xliff:g> dpi"</string>
     <string name="display_manager_overlay_display_secure_suffix" msgid="6022119702628572080">", segur"</string>
+    <string name="activity_starter_block_bg_activity_starts_permissive" msgid="5692097903712956720">"A les futures compilacions de Q, es bloquejarà aquest inici d\'activitat en segon pla del paquet <xliff:g id="PACKAGENAME">%1$s</xliff:g>. Ves a go/q-bg-block."</string>
+    <string name="activity_starter_block_bg_activity_starts_enforcing" msgid="8299522481076404353">"S\'ha bloquejat l\'inici d\'activitat en segon pla del paquet <xliff:g id="PACKAGENAME">%1$s</xliff:g>. Ves a go/q-bg-block."</string>
     <string name="kg_forgot_pattern_button_text" msgid="8852021467868220608">"He oblidat el patró"</string>
     <string name="kg_wrong_pattern" msgid="1850806070801358830">"Patró incorrecte"</string>
     <string name="kg_wrong_password" msgid="2333281762128113157">"Contrasenya incorrecta"</string>
@@ -1996,9 +1997,29 @@
     <string name="dynamic_mode_notification_channel_name" msgid="2348803891571320452">"Notificació d\'informació del mode de rutina"</string>
     <string name="dynamic_mode_notification_title" msgid="508815255807182035">"És possible que la bateria s\'esgoti abans de la càrrega habitual"</string>
     <string name="dynamic_mode_notification_summary" msgid="2541166298550402690">"S\'ha activat l\'estalvi de bateria per allargar-ne la durada"</string>
+    <string name="mime_type_folder" msgid="7111951698626315204">"Carpeta"</string>
+    <string name="mime_type_apk" msgid="5518003630972506900">"Aplicació per a Android"</string>
+    <string name="mime_type_generic" msgid="6833871596845900027">"Fitxer"</string>
+    <string name="mime_type_generic_ext" msgid="8450275970061657174">"Fitxer <xliff:g id="EXTENSION">%1$s</xliff:g>"</string>
+    <string name="mime_type_audio" msgid="6289777657172050926">"Àudio"</string>
+    <string name="mime_type_audio_ext" msgid="3270880987725816210">"Àudio <xliff:g id="EXTENSION">%1$s</xliff:g>"</string>
+    <string name="mime_type_video" msgid="4093025777317307426">"Vídeo"</string>
+    <string name="mime_type_video_ext" msgid="5643771615714173159">"Vídeo <xliff:g id="EXTENSION">%1$s</xliff:g>"</string>
+    <string name="mime_type_image" msgid="3144284451605236371">"Imatge"</string>
+    <string name="mime_type_image_ext" msgid="1514613218742736590">"Imatge <xliff:g id="EXTENSION">%1$s</xliff:g>"</string>
+    <string name="mime_type_compressed" msgid="1645486037074943257">"Arxiu"</string>
+    <string name="mime_type_compressed_ext" msgid="4232293058067801528">"Arxiu <xliff:g id="EXTENSION">%1$s</xliff:g>"</string>
+    <string name="mime_type_document" msgid="1596838147256375966">"Document"</string>
+    <string name="mime_type_document_ext" msgid="6327266601345501281">"Document <xliff:g id="EXTENSION">%1$s</xliff:g>"</string>
+    <string name="mime_type_spreadsheet" msgid="2639138255207123557">"Full de càlcul"</string>
+    <string name="mime_type_spreadsheet_ext" msgid="5508653032786106725">"Full de càlcul <xliff:g id="EXTENSION">%1$s</xliff:g>"</string>
+    <string name="mime_type_presentation" msgid="6145604688774787357">"Presentació"</string>
+    <string name="mime_type_presentation_ext" msgid="2982650207774823437">"Presentació <xliff:g id="EXTENSION">%1$s</xliff:g>"</string>
     <string name="car_loading_profile" msgid="3545132581795684027">"S\'està carregant"</string>
     <plurals name="file_count" formatted="false" msgid="1628600959752419449">
       <item quantity="other"><xliff:g id="FILE_NAME_2">%s</xliff:g> i <xliff:g id="COUNT_3">%d</xliff:g> fitxers més</item>
       <item quantity="one"><xliff:g id="FILE_NAME_0">%s</xliff:g> i <xliff:g id="COUNT_1">%d</xliff:g> fitxer més</item>
     </plurals>
+    <!-- no translation found for chooser_no_direct_share_targets (997970693708458895) -->
+    <skip />
 </resources>
diff --git a/core/res/res/values-cs/strings.xml b/core/res/res/values-cs/strings.xml
index 9e735fc..be2c0de 100644
--- a/core/res/res/values-cs/strings.xml
+++ b/core/res/res/values-cs/strings.xml
@@ -314,15 +314,15 @@
     <string name="permgrouplab_phone" msgid="5229115638567440675">"Telefon"</string>
     <string name="permgroupdesc_phone" msgid="6234224354060641055">"uskutečňování a spravování telefonních hovorů"</string>
     <string name="permgrouprequest_phone" msgid="9166979577750581037">"Povolit aplikaci &lt;b&gt;<xliff:g id="APP_NAME">%1$s</xliff:g>&lt;/b&gt; uskutečňovat a spravovat telefonní hovory?"</string>
-    <string name="permgrouplab_sensors" msgid="416037179223226722">"Tělesné senzory"</string>
+    <string name="permgrouplab_sensors" msgid="4838614103153567532">"Tělesné senzory"</string>
     <string name="permgroupdesc_sensors" msgid="7147968539346634043">"přístup k datům ze snímačů vašich životních funkcí"</string>
     <string name="permgrouprequest_sensors" msgid="6349806962814556786">"Povolit aplikaci &lt;b&gt;<xliff:g id="APP_NAME">%1$s</xliff:g>&lt;/b&gt; přístup k údajům ze snímačů vašich životních funkcí?"</string>
     <string name="permgrouplab_aural" msgid="965607064083134896">"Hudba"</string>
     <string name="permgroupdesc_aural" msgid="4870189506255958055">"přístup k hudbě"</string>
     <string name="permgrouprequest_aural" msgid="6787926123071735620">"Povolit aplikaci &lt;b&gt;<xliff:g id="APP_NAME">%1$s</xliff:g>&lt;/b&gt; přístup k hudbě?"</string>
-    <string name="permgrouplab_visual" msgid="8030190588123857921">"Fotky a videa"</string>
+    <string name="permgrouplab_visual" msgid="6477382108771145134">"Fotky a videa"</string>
     <string name="permgroupdesc_visual" msgid="3415827902566663546">"přístup k fotkám a videím"</string>
-    <string name="permgrouprequest_visual" msgid="6907523945030290376">"Povolit aplikaci &lt;b&gt;<xliff:g id="APP_NAME">%1$s</xliff:g>&lt;/b&gt; přístup k fotkám a videím?"</string>
+    <string name="permgrouprequest_visual" msgid="3043752127595243314">"Povolit aplikaci &lt;b&gt;<xliff:g id="APP_NAME">%1$s</xliff:g>&lt;/b&gt; přístup k fotkám a videím včetně označených míst?"</string>
     <string name="capability_title_canRetrieveWindowContent" msgid="3901717936930170320">"Načítat obsah oken"</string>
     <string name="capability_desc_canRetrieveWindowContent" msgid="3772225008605310672">"Může prozkoumávat obsah oken, se kterými pracujete."</string>
     <string name="capability_title_canRequestTouchExploration" msgid="3108723364676667320">"Zapnout funkci Prozkoumání dotykem"</string>
@@ -1440,8 +1440,7 @@
     <string name="ext_media_init_action" msgid="7952885510091978278">"Nastavit"</string>
     <string name="ext_media_unmount_action" msgid="1121883233103278199">"Odpojit"</string>
     <string name="ext_media_browse_action" msgid="8322172381028546087">"Otevřít"</string>
-    <!-- no translation found for ext_media_seamless_action (6575980560886881233) -->
-    <skip />
+    <string name="ext_media_seamless_action" msgid="6575980560886881233">"Přepnout výstup"</string>
     <string name="ext_media_missing_title" msgid="620980315821543904">"<xliff:g id="NAME">%s</xliff:g> chybí"</string>
     <string name="ext_media_missing_message" msgid="4012389235250987930">"Znovu vložte zařízení"</string>
     <string name="ext_media_move_specific_title" msgid="1471100343872375842">"Přesouvání aplikace <xliff:g id="NAME">%s</xliff:g>"</string>
@@ -1657,6 +1656,8 @@
     <string name="display_manager_overlay_display_name" msgid="5142365982271620716">"Překryvná vrstva č. <xliff:g id="ID">%1$d</xliff:g>"</string>
     <string name="display_manager_overlay_display_title" msgid="652124517672257172">"<xliff:g id="NAME">%1$s</xliff:g>: <xliff:g id="WIDTH">%2$d</xliff:g>x<xliff:g id="HEIGHT">%3$d</xliff:g>, <xliff:g id="DPI">%4$d</xliff:g> dpi"</string>
     <string name="display_manager_overlay_display_secure_suffix" msgid="6022119702628572080">", zabezpečené"</string>
+    <string name="activity_starter_block_bg_activity_starts_permissive" msgid="5692097903712956720">"Zahájení této aktivity na pozadí ze zdroje <xliff:g id="PACKAGENAME">%1$s</xliff:g> bude v budoucích sestaveních Q zablokováno. Viz go/q-bg-block."</string>
+    <string name="activity_starter_block_bg_activity_starts_enforcing" msgid="8299522481076404353">"Zahájení aktivity na pozadí ze zdroje <xliff:g id="PACKAGENAME">%1$s</xliff:g> bylo zablokováno. Viz go/q-bg-block."</string>
     <string name="kg_forgot_pattern_button_text" msgid="8852021467868220608">"Zapomenuté gesto"</string>
     <string name="kg_wrong_pattern" msgid="1850806070801358830">"Nesprávné gesto"</string>
     <string name="kg_wrong_password" msgid="2333281762128113157">"Nesprávné heslo"</string>
@@ -2066,6 +2067,24 @@
     <string name="dynamic_mode_notification_channel_name" msgid="2348803891571320452">"Informační oznámení režimu sledu činností"</string>
     <string name="dynamic_mode_notification_title" msgid="508815255807182035">"Baterie se možná vybije před obvyklým časem nabití"</string>
     <string name="dynamic_mode_notification_summary" msgid="2541166298550402690">"Byl aktivován spořič baterie za účelem prodloužení výdrže"</string>
+    <string name="mime_type_folder" msgid="7111951698626315204">"Složka"</string>
+    <string name="mime_type_apk" msgid="5518003630972506900">"Aplikace pro Android"</string>
+    <string name="mime_type_generic" msgid="6833871596845900027">"Soubor"</string>
+    <string name="mime_type_generic_ext" msgid="8450275970061657174">"Soubor <xliff:g id="EXTENSION">%1$s</xliff:g>"</string>
+    <string name="mime_type_audio" msgid="6289777657172050926">"Zvuk"</string>
+    <string name="mime_type_audio_ext" msgid="3270880987725816210">"Zvuk <xliff:g id="EXTENSION">%1$s</xliff:g>"</string>
+    <string name="mime_type_video" msgid="4093025777317307426">"Video"</string>
+    <string name="mime_type_video_ext" msgid="5643771615714173159">"Video <xliff:g id="EXTENSION">%1$s</xliff:g>"</string>
+    <string name="mime_type_image" msgid="3144284451605236371">"Obrázek"</string>
+    <string name="mime_type_image_ext" msgid="1514613218742736590">"Obrázek <xliff:g id="EXTENSION">%1$s</xliff:g>"</string>
+    <string name="mime_type_compressed" msgid="1645486037074943257">"Archiv"</string>
+    <string name="mime_type_compressed_ext" msgid="4232293058067801528">"Archiv <xliff:g id="EXTENSION">%1$s</xliff:g>"</string>
+    <string name="mime_type_document" msgid="1596838147256375966">"Dokument"</string>
+    <string name="mime_type_document_ext" msgid="6327266601345501281">"Dokument <xliff:g id="EXTENSION">%1$s</xliff:g>"</string>
+    <string name="mime_type_spreadsheet" msgid="2639138255207123557">"Tabulka"</string>
+    <string name="mime_type_spreadsheet_ext" msgid="5508653032786106725">"Tabulka <xliff:g id="EXTENSION">%1$s</xliff:g>"</string>
+    <string name="mime_type_presentation" msgid="6145604688774787357">"Prezentace"</string>
+    <string name="mime_type_presentation_ext" msgid="2982650207774823437">"Prezentace <xliff:g id="EXTENSION">%1$s</xliff:g>"</string>
     <string name="car_loading_profile" msgid="3545132581795684027">"Načítání"</string>
     <plurals name="file_count" formatted="false" msgid="1628600959752419449">
       <item quantity="few"><xliff:g id="FILE_NAME_2">%s</xliff:g> + <xliff:g id="COUNT_3">%d</xliff:g> soubory</item>
@@ -2073,4 +2092,6 @@
       <item quantity="other"><xliff:g id="FILE_NAME_2">%s</xliff:g> + <xliff:g id="COUNT_3">%d</xliff:g> souborů</item>
       <item quantity="one"><xliff:g id="FILE_NAME_0">%s</xliff:g> + <xliff:g id="COUNT_1">%d</xliff:g> soubor</item>
     </plurals>
+    <!-- no translation found for chooser_no_direct_share_targets (997970693708458895) -->
+    <skip />
 </resources>
diff --git a/core/res/res/values-da/strings.xml b/core/res/res/values-da/strings.xml
index b1c4ef7..4a30a4d 100644
--- a/core/res/res/values-da/strings.xml
+++ b/core/res/res/values-da/strings.xml
@@ -308,15 +308,15 @@
     <string name="permgrouplab_phone" msgid="5229115638567440675">"Telefon"</string>
     <string name="permgroupdesc_phone" msgid="6234224354060641055">"foretage og administrere telefonopkald"</string>
     <string name="permgrouprequest_phone" msgid="9166979577750581037">"Vil du give &lt;b&gt;<xliff:g id="APP_NAME">%1$s</xliff:g>&lt;/b&gt; tilladelse til at foretage og administrere telefonopkald?"</string>
-    <string name="permgrouplab_sensors" msgid="416037179223226722">"Kropssensorer"</string>
+    <string name="permgrouplab_sensors" msgid="4838614103153567532">"Kropssensorer"</string>
     <string name="permgroupdesc_sensors" msgid="7147968539346634043">"få adgang til sensordata om dine livstegn"</string>
     <string name="permgrouprequest_sensors" msgid="6349806962814556786">"Vil du give &lt;b&gt;<xliff:g id="APP_NAME">%1$s</xliff:g>&lt;/b&gt; adgang til sensordata om dine livstegn?"</string>
     <string name="permgrouplab_aural" msgid="965607064083134896">"Musik"</string>
     <string name="permgroupdesc_aural" msgid="4870189506255958055">"adgang til din musik"</string>
     <string name="permgrouprequest_aural" msgid="6787926123071735620">"Vil du give &lt;b&gt;<xliff:g id="APP_NAME">%1$s</xliff:g>&lt;/b&gt; adgang til din musik?"</string>
-    <string name="permgrouplab_visual" msgid="8030190588123857921">"Billeder og videoer"</string>
+    <string name="permgrouplab_visual" msgid="6477382108771145134">"Billeder og videoer"</string>
     <string name="permgroupdesc_visual" msgid="3415827902566663546">"adgang til dine billeder og videoer"</string>
-    <string name="permgrouprequest_visual" msgid="6907523945030290376">"Vil du give &lt;b&gt;<xliff:g id="APP_NAME">%1$s</xliff:g>&lt;/b&gt; adgang til dine billeder og videoer?"</string>
+    <string name="permgrouprequest_visual" msgid="3043752127595243314">"Vil du give &lt;b&gt;<xliff:g id="APP_NAME">%1$s</xliff:g>&lt;/b&gt; adgang til dine billeder og videoer, herunder taggede placeringer?"</string>
     <string name="capability_title_canRetrieveWindowContent" msgid="3901717936930170320">"Hente indholdet i vinduet"</string>
     <string name="capability_desc_canRetrieveWindowContent" msgid="3772225008605310672">"Undersøge indholdet i et vindue, du interagerer med."</string>
     <string name="capability_title_canRequestTouchExploration" msgid="3108723364676667320">"Aktivere Udforsk ved berøring"</string>
@@ -1396,8 +1396,7 @@
     <string name="ext_media_init_action" msgid="7952885510091978278">"Konfigurer"</string>
     <string name="ext_media_unmount_action" msgid="1121883233103278199">"Skub ud"</string>
     <string name="ext_media_browse_action" msgid="8322172381028546087">"Udforsk"</string>
-    <!-- no translation found for ext_media_seamless_action (6575980560886881233) -->
-    <skip />
+    <string name="ext_media_seamless_action" msgid="6575980560886881233">"Skift udgang"</string>
     <string name="ext_media_missing_title" msgid="620980315821543904">"<xliff:g id="NAME">%s</xliff:g> er ikke til stede"</string>
     <string name="ext_media_missing_message" msgid="4012389235250987930">"Indsæt enheden igen"</string>
     <string name="ext_media_move_specific_title" msgid="1471100343872375842">"Flytter <xliff:g id="NAME">%s</xliff:g>"</string>
@@ -1611,6 +1610,8 @@
     <string name="display_manager_overlay_display_name" msgid="5142365982271620716">"Overlejring nr. <xliff:g id="ID">%1$d</xliff:g>"</string>
     <string name="display_manager_overlay_display_title" msgid="652124517672257172">"<xliff:g id="NAME">%1$s</xliff:g>: <xliff:g id="WIDTH">%2$d</xliff:g> x <xliff:g id="HEIGHT">%3$d</xliff:g>, <xliff:g id="DPI">%4$d</xliff:g> dpi"</string>
     <string name="display_manager_overlay_display_secure_suffix" msgid="6022119702628572080">", sikker"</string>
+    <string name="activity_starter_block_bg_activity_starts_permissive" msgid="5692097903712956720">"Denne opstart af aktivitet i baggrunden fra <xliff:g id="PACKAGENAME">%1$s</xliff:g> blokeres i fremtidige Q-builds. Gå til go/q-bg-block."</string>
+    <string name="activity_starter_block_bg_activity_starts_enforcing" msgid="8299522481076404353">"Opstart af aktivitet i baggrunden fra <xliff:g id="PACKAGENAME">%1$s</xliff:g> blokeres. Gå til go/q-bg-block."</string>
     <string name="kg_forgot_pattern_button_text" msgid="8852021467868220608">"Glemt mønster"</string>
     <string name="kg_wrong_pattern" msgid="1850806070801358830">"Forkert mønster"</string>
     <string name="kg_wrong_password" msgid="2333281762128113157">"Forkert adgangskode"</string>
@@ -1996,9 +1997,29 @@
     <string name="dynamic_mode_notification_channel_name" msgid="2348803891571320452">"Notifikation med oplysninger om rutinetilstand"</string>
     <string name="dynamic_mode_notification_title" msgid="508815255807182035">"Enheden løber muligvis tør for batteri, inden du normalt oplader den"</string>
     <string name="dynamic_mode_notification_summary" msgid="2541166298550402690">"Batterisparefunktion er aktiveret for at forlænge batteritiden"</string>
+    <string name="mime_type_folder" msgid="7111951698626315204">"Mappe"</string>
+    <string name="mime_type_apk" msgid="5518003630972506900">"Android-app"</string>
+    <string name="mime_type_generic" msgid="6833871596845900027">"Fil"</string>
+    <string name="mime_type_generic_ext" msgid="8450275970061657174">"<xliff:g id="EXTENSION">%1$s</xliff:g>-fil"</string>
+    <string name="mime_type_audio" msgid="6289777657172050926">"Lyd"</string>
+    <string name="mime_type_audio_ext" msgid="3270880987725816210">"<xliff:g id="EXTENSION">%1$s</xliff:g>-lyd"</string>
+    <string name="mime_type_video" msgid="4093025777317307426">"Video"</string>
+    <string name="mime_type_video_ext" msgid="5643771615714173159">"<xliff:g id="EXTENSION">%1$s</xliff:g>-video"</string>
+    <string name="mime_type_image" msgid="3144284451605236371">"Billede"</string>
+    <string name="mime_type_image_ext" msgid="1514613218742736590">"<xliff:g id="EXTENSION">%1$s</xliff:g>-billede"</string>
+    <string name="mime_type_compressed" msgid="1645486037074943257">"Arkiv"</string>
+    <string name="mime_type_compressed_ext" msgid="4232293058067801528">"<xliff:g id="EXTENSION">%1$s</xliff:g>-arkiv"</string>
+    <string name="mime_type_document" msgid="1596838147256375966">"Dokument"</string>
+    <string name="mime_type_document_ext" msgid="6327266601345501281">"<xliff:g id="EXTENSION">%1$s</xliff:g>-dokument"</string>
+    <string name="mime_type_spreadsheet" msgid="2639138255207123557">"Regneark"</string>
+    <string name="mime_type_spreadsheet_ext" msgid="5508653032786106725">"<xliff:g id="EXTENSION">%1$s</xliff:g>-regneark"</string>
+    <string name="mime_type_presentation" msgid="6145604688774787357">"Præsentation"</string>
+    <string name="mime_type_presentation_ext" msgid="2982650207774823437">"<xliff:g id="EXTENSION">%1$s</xliff:g>-præsentation"</string>
     <string name="car_loading_profile" msgid="3545132581795684027">"Indlæser"</string>
     <plurals name="file_count" formatted="false" msgid="1628600959752419449">
       <item quantity="one"><xliff:g id="FILE_NAME_2">%s</xliff:g> + <xliff:g id="COUNT_3">%d</xliff:g> fil</item>
       <item quantity="other"><xliff:g id="FILE_NAME_2">%s</xliff:g> + <xliff:g id="COUNT_3">%d</xliff:g> filer</item>
     </plurals>
+    <!-- no translation found for chooser_no_direct_share_targets (997970693708458895) -->
+    <skip />
 </resources>
diff --git a/core/res/res/values-de/strings.xml b/core/res/res/values-de/strings.xml
index d162354..a790b50 100644
--- a/core/res/res/values-de/strings.xml
+++ b/core/res/res/values-de/strings.xml
@@ -308,15 +308,15 @@
     <string name="permgrouplab_phone" msgid="5229115638567440675">"Telefon"</string>
     <string name="permgroupdesc_phone" msgid="6234224354060641055">"Telefonanrufe tätigen und verwalten"</string>
     <string name="permgrouprequest_phone" msgid="9166979577750581037">"&lt;b&gt;<xliff:g id="APP_NAME">%1$s</xliff:g>&lt;/b&gt; erlauben, Anrufe zu tätigen und zu verwalten?"</string>
-    <string name="permgrouplab_sensors" msgid="416037179223226722">"Körpersensoren"</string>
+    <string name="permgrouplab_sensors" msgid="4838614103153567532">"Körpersensoren"</string>
     <string name="permgroupdesc_sensors" msgid="7147968539346634043">"auf Sensordaten zu deinen Vitaldaten zugreifen"</string>
     <string name="permgrouprequest_sensors" msgid="6349806962814556786">"&lt;b&gt;<xliff:g id="APP_NAME">%1$s</xliff:g>&lt;/b&gt; erlauben, auf Sensordaten zu deinen Vitalfunktionen zuzugreifen?"</string>
     <string name="permgrouplab_aural" msgid="965607064083134896">"Musik"</string>
     <string name="permgroupdesc_aural" msgid="4870189506255958055">"auf Musik zugreifen"</string>
     <string name="permgrouprequest_aural" msgid="6787926123071735620">"&lt;b&gt;<xliff:g id="APP_NAME">%1$s</xliff:g>&lt;/b&gt; Zugriff auf deine Musik gewähren?"</string>
-    <string name="permgrouplab_visual" msgid="8030190588123857921">"Fotos und Videos"</string>
+    <string name="permgrouplab_visual" msgid="6477382108771145134">"Fotos &amp; Videos"</string>
     <string name="permgroupdesc_visual" msgid="3415827902566663546">"auf meine Fotos und Videos zugreifen"</string>
-    <string name="permgrouprequest_visual" msgid="6907523945030290376">"&lt;b&gt;<xliff:g id="APP_NAME">%1$s</xliff:g>&lt;/b&gt; Zugriff auf deine Fotos und Videos gewähren?"</string>
+    <string name="permgrouprequest_visual" msgid="3043752127595243314">"&lt;b&gt;<xliff:g id="APP_NAME">%1$s</xliff:g>&lt;/b&gt; Zugriff auf deine Fotos und Videos gewähren, einschließlich gekennzeichneter Standorte?"</string>
     <string name="capability_title_canRetrieveWindowContent" msgid="3901717936930170320">"Fensterinhalte abrufen"</string>
     <string name="capability_desc_canRetrieveWindowContent" msgid="3772225008605310672">"Die Inhalte eines Fensters, mit dem du interagierst, werden abgerufen."</string>
     <string name="capability_title_canRequestTouchExploration" msgid="3108723364676667320">"\"Tippen &amp; Entdecken\" aktivieren"</string>
@@ -510,7 +510,7 @@
     <string name="permlab_disableKeyguard" msgid="3598496301486439258">"Displaysperre deaktivieren"</string>
     <string name="permdesc_disableKeyguard" msgid="6034203065077122992">"Ermöglicht der App, die Tastensperre sowie den damit verbundenen Passwortschutz zu deaktivieren. Das Telefon deaktiviert die Tastensperre beispielsweise, wenn ein Anruf eingeht, und aktiviert sie wieder, nachdem das Gespräch beendet wurde."</string>
     <string name="permlab_requestScreenLockComplexity" msgid="7028982116060987169">"Komplexitätsstufe der Displaysperre anfragen"</string>
-    <string name="permdesc_requestScreenLockComplexity" msgid="2806396846128185677">"Ermöglicht es der App, die Komplexitätsstufe der Displaysperre (hoch, mittel, niedrig oder keine) zu erfahren, was auf die mögliche Dauer und Art der Displaysperre hinweist. Die App kann Nutzern auch vorschlagen, die Displaysperre auf eine bestimmte Stufe zu aktualisieren, Nutzer können diesen Vorschlag jedoch auch einfach ignorieren und fortfahren. Beachten Sie, dass die Displaysperre nicht im Klartext gespeichert ist, sodass die App nicht das genaue Passwort kennt."</string>
+    <string name="permdesc_requestScreenLockComplexity" msgid="2806396846128185677">"Ermöglicht es der App, die Komplexitätsstufe der Displaysperre (hoch, mittel, niedrig oder keine) zu erfahren, was auf die mögliche Dauer und Art der Displaysperre hinweist. Die App kann Nutzern auch vorschlagen, dass sie die Displaysperre auf eine bestimmte Stufe aktualisieren, Nutzer können diesen Vorschlag jedoch einfach ignorieren und fortfahren. Beachten Sie, dass die Displaysperre nicht im Klartext gespeichert ist, sodass die App nicht das genaue Passwort kennt."</string>
     <string name="permlab_useBiometric" msgid="8837753668509919318">"Biometrische Hardware verwenden"</string>
     <string name="permdesc_useBiometric" msgid="8389855232721612926">"Erlaubt der App, biometrische Hardware zur Authentifizierung zu verwenden"</string>
     <string name="permlab_manageFingerprint" msgid="5640858826254575638">"Fingerabdruckhardware verwalten"</string>
@@ -1356,7 +1356,7 @@
     <string name="adb_active_notification_message" product="tv" msgid="8470296818270110396">"USB-Debugging deaktivieren: auswählen"</string>
     <string name="usb_contaminant_detected_title" msgid="7136400633704058349">"Flüssigkeiten oder Fremdkörper im USB-Port"</string>
     <string name="usb_contaminant_detected_message" msgid="832337061059487250">"Der USB-Port wird automatisch deaktiviert. Für weitere Informationen tippen."</string>
-    <string name="usb_contaminant_not_detected_title" msgid="4202417484434906086">"USB-Ports kann wieder sicher verwendet werden"</string>
+    <string name="usb_contaminant_not_detected_title" msgid="4202417484434906086">"USB-Port kann wieder sicher verwendet werden"</string>
     <string name="usb_contaminant_not_detected_message" msgid="2415791798244545292">"Das Smartphone erkennt keine Flüssigkeiten oder Fremdkörper mehr."</string>
     <string name="taking_remote_bugreport_notification_title" msgid="6742483073875060934">"Fehlerbericht wird abgerufen…"</string>
     <string name="share_remote_bugreport_notification_title" msgid="4987095013583691873">"Fehlerbericht teilen?"</string>
@@ -1396,8 +1396,7 @@
     <string name="ext_media_init_action" msgid="7952885510091978278">"Einrichten"</string>
     <string name="ext_media_unmount_action" msgid="1121883233103278199">"Auswerfen"</string>
     <string name="ext_media_browse_action" msgid="8322172381028546087">"Ansehen"</string>
-    <!-- no translation found for ext_media_seamless_action (6575980560886881233) -->
-    <skip />
+    <string name="ext_media_seamless_action" msgid="6575980560886881233">"Ausgabe wechseln"</string>
     <string name="ext_media_missing_title" msgid="620980315821543904">"<xliff:g id="NAME">%s</xliff:g> fehlt"</string>
     <string name="ext_media_missing_message" msgid="4012389235250987930">"Gerät wieder einlegen"</string>
     <string name="ext_media_move_specific_title" msgid="1471100343872375842">"<xliff:g id="NAME">%s</xliff:g> wird verschoben"</string>
@@ -1611,6 +1610,8 @@
     <string name="display_manager_overlay_display_name" msgid="5142365982271620716">"Overlay-Nr. <xliff:g id="ID">%1$d</xliff:g>"</string>
     <string name="display_manager_overlay_display_title" msgid="652124517672257172">"<xliff:g id="NAME">%1$s</xliff:g>: <xliff:g id="WIDTH">%2$d</xliff:g> x <xliff:g id="HEIGHT">%3$d</xliff:g>, <xliff:g id="DPI">%4$d</xliff:g> dpi"</string>
     <string name="display_manager_overlay_display_secure_suffix" msgid="6022119702628572080">", sicher"</string>
+    <string name="activity_starter_block_bg_activity_starts_permissive" msgid="5692097903712956720">"Der Start dieser Hintergrundaktivität aus <xliff:g id="PACKAGENAME">%1$s</xliff:g> wird in künftigen Q-Builds blockiert. Siehe go/q-bg-block."</string>
+    <string name="activity_starter_block_bg_activity_starts_enforcing" msgid="8299522481076404353">"Der Start der Hintergrundaktivität aus <xliff:g id="PACKAGENAME">%1$s</xliff:g> wurde blockiert. Siehe go/q-bg-block."</string>
     <string name="kg_forgot_pattern_button_text" msgid="8852021467868220608">"Muster vergessen"</string>
     <string name="kg_wrong_pattern" msgid="1850806070801358830">"Falsches Muster"</string>
     <string name="kg_wrong_password" msgid="2333281762128113157">"Falsches Passwort"</string>
@@ -1996,9 +1997,29 @@
     <string name="dynamic_mode_notification_channel_name" msgid="2348803891571320452">"Infomitteilung zum Ablaufmodus"</string>
     <string name="dynamic_mode_notification_title" msgid="508815255807182035">"Dein Akku könnte vor der gewöhnlichen Ladezeit leer sein"</string>
     <string name="dynamic_mode_notification_summary" msgid="2541166298550402690">"Energiesparmodus aktiviert, um die Akkulaufzeit zu verlängern"</string>
+    <string name="mime_type_folder" msgid="7111951698626315204">"Ordner"</string>
+    <string name="mime_type_apk" msgid="5518003630972506900">"Android-App"</string>
+    <string name="mime_type_generic" msgid="6833871596845900027">"Datei"</string>
+    <string name="mime_type_generic_ext" msgid="8450275970061657174">"Datei (<xliff:g id="EXTENSION">%1$s</xliff:g>)"</string>
+    <string name="mime_type_audio" msgid="6289777657172050926">"Audiodatei"</string>
+    <string name="mime_type_audio_ext" msgid="3270880987725816210">"Audiodatei (<xliff:g id="EXTENSION">%1$s</xliff:g>)"</string>
+    <string name="mime_type_video" msgid="4093025777317307426">"Video"</string>
+    <string name="mime_type_video_ext" msgid="5643771615714173159">"Video (<xliff:g id="EXTENSION">%1$s</xliff:g>)"</string>
+    <string name="mime_type_image" msgid="3144284451605236371">"Bild"</string>
+    <string name="mime_type_image_ext" msgid="1514613218742736590">"Bild (<xliff:g id="EXTENSION">%1$s</xliff:g>)"</string>
+    <string name="mime_type_compressed" msgid="1645486037074943257">"Archiv"</string>
+    <string name="mime_type_compressed_ext" msgid="4232293058067801528">"Archiv (<xliff:g id="EXTENSION">%1$s</xliff:g>)"</string>
+    <string name="mime_type_document" msgid="1596838147256375966">"Dokument"</string>
+    <string name="mime_type_document_ext" msgid="6327266601345501281">"Dokument (<xliff:g id="EXTENSION">%1$s</xliff:g>)"</string>
+    <string name="mime_type_spreadsheet" msgid="2639138255207123557">"Tabelle"</string>
+    <string name="mime_type_spreadsheet_ext" msgid="5508653032786106725">"Tabelle (<xliff:g id="EXTENSION">%1$s</xliff:g>)"</string>
+    <string name="mime_type_presentation" msgid="6145604688774787357">"Präsentation"</string>
+    <string name="mime_type_presentation_ext" msgid="2982650207774823437">"Präsentation (<xliff:g id="EXTENSION">%1$s</xliff:g>)"</string>
     <string name="car_loading_profile" msgid="3545132581795684027">"Wird geladen"</string>
     <plurals name="file_count" formatted="false" msgid="1628600959752419449">
       <item quantity="other"><xliff:g id="FILE_NAME_2">%s</xliff:g> und <xliff:g id="COUNT_3">%d</xliff:g> Dateien</item>
       <item quantity="one"><xliff:g id="FILE_NAME_0">%s</xliff:g> und <xliff:g id="COUNT_1">%d</xliff:g> Datei</item>
     </plurals>
+    <!-- no translation found for chooser_no_direct_share_targets (997970693708458895) -->
+    <skip />
 </resources>
diff --git a/core/res/res/values-el/strings.xml b/core/res/res/values-el/strings.xml
index 195995c..f4f7918 100644
--- a/core/res/res/values-el/strings.xml
+++ b/core/res/res/values-el/strings.xml
@@ -308,15 +308,15 @@
     <string name="permgrouplab_phone" msgid="5229115638567440675">"Τηλέφωνο"</string>
     <string name="permgroupdesc_phone" msgid="6234224354060641055">"πραγματοποιεί και να διαχειρίζεται τηλ/κές κλήσεις"</string>
     <string name="permgrouprequest_phone" msgid="9166979577750581037">"Να επιτρέπεται στην εφαρμογή &lt;b&gt;<xliff:g id="APP_NAME">%1$s</xliff:g>&lt;/b&gt; η πραγματοποίηση και η διαχείριση τηλεφωνικών κλήσεων;"</string>
-    <string name="permgrouplab_sensors" msgid="416037179223226722">"Αισθητήρες σώματος"</string>
+    <string name="permgrouplab_sensors" msgid="4838614103153567532">"Αισθητήρες σώματος"</string>
     <string name="permgroupdesc_sensors" msgid="7147968539346634043">"πρόσβαση στα δεδομένα αισθητήρα σχετικά με τις ζωτικές ενδείξεις σας"</string>
     <string name="permgrouprequest_sensors" msgid="6349806962814556786">"Να επιτρέπεται στην εφαρμογή &lt;b&gt;<xliff:g id="APP_NAME">%1$s</xliff:g>&lt;/b&gt; να έχει πρόσβαση στα δεδομένα αισθητήρα σχετικά με τις ζωτικές ενδείξεις σας;"</string>
     <string name="permgrouplab_aural" msgid="965607064083134896">"Μουσική"</string>
     <string name="permgroupdesc_aural" msgid="4870189506255958055">"πρόσβαση στη μουσική σας"</string>
     <string name="permgrouprequest_aural" msgid="6787926123071735620">"Να επιτρέπεται στην εφαρμογή &lt;b&gt;<xliff:g id="APP_NAME">%1$s</xliff:g>&lt;/b&gt; να έχει πρόσβαση στη μουσική σας;"</string>
-    <string name="permgrouplab_visual" msgid="8030190588123857921">"Φωτογραφίες και βίντεο"</string>
+    <string name="permgrouplab_visual" msgid="6477382108771145134">"Φωτογραφίες και βίντεο"</string>
     <string name="permgroupdesc_visual" msgid="3415827902566663546">"πρόσβαση στις φωτογραφίες και στα βίντεό σας"</string>
-    <string name="permgrouprequest_visual" msgid="6907523945030290376">"Να επιτρέπεται στην εφαρμογή &lt;b&gt;<xliff:g id="APP_NAME">%1$s</xliff:g>&lt;/b&gt; να έχει πρόσβαση στις φωτογραφίες και στα βίντεό σας;"</string>
+    <string name="permgrouprequest_visual" msgid="3043752127595243314">"Να επιτρέπεται η πρόσβαση του &lt;b&gt;<xliff:g id="APP_NAME">%1$s</xliff:g>&lt;/b&gt; σε φωτογραφίες και βίντεο, μεταξύ άλλων σε επισημασμένες τοποθεσίες;"</string>
     <string name="capability_title_canRetrieveWindowContent" msgid="3901717936930170320">"Ανάκτηση του περιεχομένου του παραθύρου"</string>
     <string name="capability_desc_canRetrieveWindowContent" msgid="3772225008605310672">"Έλεγχος του περιεχομένου ενός παραθύρου με το οποίο αλληλεπιδράτε."</string>
     <string name="capability_title_canRequestTouchExploration" msgid="3108723364676667320">"Ενεργοποίηση της \"Εξερεύνησης με άγγιγμα\""</string>
@@ -1396,8 +1396,7 @@
     <string name="ext_media_init_action" msgid="7952885510091978278">"Ρύθμιση"</string>
     <string name="ext_media_unmount_action" msgid="1121883233103278199">"Εξαγωγή"</string>
     <string name="ext_media_browse_action" msgid="8322172381028546087">"Εξερεύνηση"</string>
-    <!-- no translation found for ext_media_seamless_action (6575980560886881233) -->
-    <skip />
+    <string name="ext_media_seamless_action" msgid="6575980560886881233">"Εναλλαγή εξόδου"</string>
     <string name="ext_media_missing_title" msgid="620980315821543904">"Λείπει το μέσο <xliff:g id="NAME">%s</xliff:g>"</string>
     <string name="ext_media_missing_message" msgid="4012389235250987930">"Τοποθετήστε ξανά τη συσκευή"</string>
     <string name="ext_media_move_specific_title" msgid="1471100343872375842">"Μετακίνηση <xliff:g id="NAME">%s</xliff:g>"</string>
@@ -1611,6 +1610,8 @@
     <string name="display_manager_overlay_display_name" msgid="5142365982271620716">"Επικάλυψη #<xliff:g id="ID">%1$d</xliff:g>"</string>
     <string name="display_manager_overlay_display_title" msgid="652124517672257172">"<xliff:g id="NAME">%1$s</xliff:g>: <xliff:g id="WIDTH">%2$d</xliff:g>x<xliff:g id="HEIGHT">%3$d</xliff:g>, <xliff:g id="DPI">%4$d</xliff:g> dpi"</string>
     <string name="display_manager_overlay_display_secure_suffix" msgid="6022119702628572080">", ασφαλές"</string>
+    <string name="activity_starter_block_bg_activity_starts_permissive" msgid="5692097903712956720">"Αυτή η έναρξη δραστηριότητας παρασκηνίου από το <xliff:g id="PACKAGENAME">%1$s</xliff:g> θα αποκλειστεί σε μελλοντικές εκδόσεις του Q. Ανατρέξτε στο go/q-bg-block."</string>
+    <string name="activity_starter_block_bg_activity_starts_enforcing" msgid="8299522481076404353">"Η έναρξη δραστηριότητας παρασκηνίου από το <xliff:g id="PACKAGENAME">%1$s</xliff:g> αποκλείστηκε. Ανατρέξτε στο go/q-bg-block."</string>
     <string name="kg_forgot_pattern_button_text" msgid="8852021467868220608">"Ξεχάσατε το μοτίβο"</string>
     <string name="kg_wrong_pattern" msgid="1850806070801358830">"Λάθος μοτίβο"</string>
     <string name="kg_wrong_password" msgid="2333281762128113157">"Λανθασμένος κωδικός πρόσβασης"</string>
@@ -1996,9 +1997,29 @@
     <string name="dynamic_mode_notification_channel_name" msgid="2348803891571320452">"Ειδοποίηση πληροφοριών λειτουργίας Ρουτίνας"</string>
     <string name="dynamic_mode_notification_title" msgid="508815255807182035">"Η μπαταρία μπορεί να εξαντληθεί πριν από τη συνηθισμένη φόρτιση"</string>
     <string name="dynamic_mode_notification_summary" msgid="2541166298550402690">"Η Εξοικονόμηση μπαταρίας ενεργοποιήθηκε για την επέκταση της διάρκειας ζωής της μπαταρίας"</string>
+    <string name="mime_type_folder" msgid="7111951698626315204">"Φάκελος"</string>
+    <string name="mime_type_apk" msgid="5518003630972506900">"Εφαρμογή Android"</string>
+    <string name="mime_type_generic" msgid="6833871596845900027">"Αρχείο"</string>
+    <string name="mime_type_generic_ext" msgid="8450275970061657174">"Αρχείο <xliff:g id="EXTENSION">%1$s</xliff:g>"</string>
+    <string name="mime_type_audio" msgid="6289777657172050926">"Ήχος"</string>
+    <string name="mime_type_audio_ext" msgid="3270880987725816210">"Αρχείο ήχου <xliff:g id="EXTENSION">%1$s</xliff:g>"</string>
+    <string name="mime_type_video" msgid="4093025777317307426">"Βίντεο"</string>
+    <string name="mime_type_video_ext" msgid="5643771615714173159">"Βίντεο <xliff:g id="EXTENSION">%1$s</xliff:g>"</string>
+    <string name="mime_type_image" msgid="3144284451605236371">"Εικόνα"</string>
+    <string name="mime_type_image_ext" msgid="1514613218742736590">"Εικόνα <xliff:g id="EXTENSION">%1$s</xliff:g>"</string>
+    <string name="mime_type_compressed" msgid="1645486037074943257">"Αρχείο"</string>
+    <string name="mime_type_compressed_ext" msgid="4232293058067801528">"Αρχείο <xliff:g id="EXTENSION">%1$s</xliff:g>"</string>
+    <string name="mime_type_document" msgid="1596838147256375966">"Έγγραφο"</string>
+    <string name="mime_type_document_ext" msgid="6327266601345501281">"Έγγραφο <xliff:g id="EXTENSION">%1$s</xliff:g>"</string>
+    <string name="mime_type_spreadsheet" msgid="2639138255207123557">"Υπολογιστικό φύλλο"</string>
+    <string name="mime_type_spreadsheet_ext" msgid="5508653032786106725">"Υπολογιστικό φύλλο <xliff:g id="EXTENSION">%1$s</xliff:g>"</string>
+    <string name="mime_type_presentation" msgid="6145604688774787357">"Παρουσίαση"</string>
+    <string name="mime_type_presentation_ext" msgid="2982650207774823437">"Παρουσίαση <xliff:g id="EXTENSION">%1$s</xliff:g>"</string>
     <string name="car_loading_profile" msgid="3545132581795684027">"Φόρτωση"</string>
     <plurals name="file_count" formatted="false" msgid="1628600959752419449">
       <item quantity="other"><xliff:g id="FILE_NAME_2">%s</xliff:g> + <xliff:g id="COUNT_3">%d</xliff:g> αρχεία</item>
       <item quantity="one"><xliff:g id="FILE_NAME_0">%s</xliff:g> + <xliff:g id="COUNT_1">%d</xliff:g> αρχείο</item>
     </plurals>
+    <!-- no translation found for chooser_no_direct_share_targets (997970693708458895) -->
+    <skip />
 </resources>
diff --git a/core/res/res/values-en-rAU/strings.xml b/core/res/res/values-en-rAU/strings.xml
index 4c5d6c0..8ed7bd8 100644
--- a/core/res/res/values-en-rAU/strings.xml
+++ b/core/res/res/values-en-rAU/strings.xml
@@ -308,15 +308,15 @@
     <string name="permgrouplab_phone" msgid="5229115638567440675">"Telephone"</string>
     <string name="permgroupdesc_phone" msgid="6234224354060641055">"make and manage phone calls"</string>
     <string name="permgrouprequest_phone" msgid="9166979577750581037">"Allow &lt;b&gt;<xliff:g id="APP_NAME">%1$s</xliff:g>&lt;/b&gt; to make and manage phone calls?"</string>
-    <string name="permgrouplab_sensors" msgid="416037179223226722">"Body sensors"</string>
+    <string name="permgrouplab_sensors" msgid="4838614103153567532">"Body sensors"</string>
     <string name="permgroupdesc_sensors" msgid="7147968539346634043">"access sensor data about your vital signs"</string>
     <string name="permgrouprequest_sensors" msgid="6349806962814556786">"Allow &lt;b&gt;<xliff:g id="APP_NAME">%1$s</xliff:g>&lt;/b&gt; to access sensor data about your vital signs?"</string>
     <string name="permgrouplab_aural" msgid="965607064083134896">"Music"</string>
     <string name="permgroupdesc_aural" msgid="4870189506255958055">"access your music"</string>
     <string name="permgrouprequest_aural" msgid="6787926123071735620">"Allow &lt;b&gt;<xliff:g id="APP_NAME">%1$s</xliff:g>&lt;/b&gt; to access your music?"</string>
-    <string name="permgrouplab_visual" msgid="8030190588123857921">"Photos &amp; Videos"</string>
+    <string name="permgrouplab_visual" msgid="6477382108771145134">"Photos &amp; videos"</string>
     <string name="permgroupdesc_visual" msgid="3415827902566663546">"access your photos &amp; videos"</string>
-    <string name="permgrouprequest_visual" msgid="6907523945030290376">"Allow &lt;b&gt;<xliff:g id="APP_NAME">%1$s</xliff:g>&lt;/b&gt; to access your photos &amp; videos?"</string>
+    <string name="permgrouprequest_visual" msgid="3043752127595243314">"Allow &lt;b&gt;<xliff:g id="APP_NAME">%1$s</xliff:g>&lt;/b&gt; to access your photos and videos, including tagged locations?"</string>
     <string name="capability_title_canRetrieveWindowContent" msgid="3901717936930170320">"Retrieve window content"</string>
     <string name="capability_desc_canRetrieveWindowContent" msgid="3772225008605310672">"Inspect the content of a window that you\'re interacting with."</string>
     <string name="capability_title_canRequestTouchExploration" msgid="3108723364676667320">"Turn on Explore by Touch"</string>
@@ -1396,8 +1396,7 @@
     <string name="ext_media_init_action" msgid="7952885510091978278">"Set-up"</string>
     <string name="ext_media_unmount_action" msgid="1121883233103278199">"Eject"</string>
     <string name="ext_media_browse_action" msgid="8322172381028546087">"Explore"</string>
-    <!-- no translation found for ext_media_seamless_action (6575980560886881233) -->
-    <skip />
+    <string name="ext_media_seamless_action" msgid="6575980560886881233">"Switch output"</string>
     <string name="ext_media_missing_title" msgid="620980315821543904">"<xliff:g id="NAME">%s</xliff:g> missing"</string>
     <string name="ext_media_missing_message" msgid="4012389235250987930">"Insert device again"</string>
     <string name="ext_media_move_specific_title" msgid="1471100343872375842">"Moving <xliff:g id="NAME">%s</xliff:g>"</string>
@@ -1611,6 +1610,8 @@
     <string name="display_manager_overlay_display_name" msgid="5142365982271620716">"Overlay #<xliff:g id="ID">%1$d</xliff:g>"</string>
     <string name="display_manager_overlay_display_title" msgid="652124517672257172">"<xliff:g id="NAME">%1$s</xliff:g>: <xliff:g id="WIDTH">%2$d</xliff:g>x<xliff:g id="HEIGHT">%3$d</xliff:g>, <xliff:g id="DPI">%4$d</xliff:g> dpi"</string>
     <string name="display_manager_overlay_display_secure_suffix" msgid="6022119702628572080">", secure"</string>
+    <string name="activity_starter_block_bg_activity_starts_permissive" msgid="5692097903712956720">"This background activity start from <xliff:g id="PACKAGENAME">%1$s</xliff:g> will be blocked in future Q builds. See go/q-bg-block."</string>
+    <string name="activity_starter_block_bg_activity_starts_enforcing" msgid="8299522481076404353">"Background activity start from <xliff:g id="PACKAGENAME">%1$s</xliff:g> blocked. See go/q-bg-block."</string>
     <string name="kg_forgot_pattern_button_text" msgid="8852021467868220608">"Forgot Pattern"</string>
     <string name="kg_wrong_pattern" msgid="1850806070801358830">"Wrong Pattern"</string>
     <string name="kg_wrong_password" msgid="2333281762128113157">"Wrong Password"</string>
@@ -1996,9 +1997,29 @@
     <string name="dynamic_mode_notification_channel_name" msgid="2348803891571320452">"Routine Mode info notification"</string>
     <string name="dynamic_mode_notification_title" msgid="508815255807182035">"Battery may run out before usual charge"</string>
     <string name="dynamic_mode_notification_summary" msgid="2541166298550402690">"Battery Saver activated to extend battery life"</string>
+    <string name="mime_type_folder" msgid="7111951698626315204">"Folder"</string>
+    <string name="mime_type_apk" msgid="5518003630972506900">"Android application"</string>
+    <string name="mime_type_generic" msgid="6833871596845900027">"File"</string>
+    <string name="mime_type_generic_ext" msgid="8450275970061657174">"<xliff:g id="EXTENSION">%1$s</xliff:g> file"</string>
+    <string name="mime_type_audio" msgid="6289777657172050926">"Audio"</string>
+    <string name="mime_type_audio_ext" msgid="3270880987725816210">"<xliff:g id="EXTENSION">%1$s</xliff:g> audio"</string>
+    <string name="mime_type_video" msgid="4093025777317307426">"Video"</string>
+    <string name="mime_type_video_ext" msgid="5643771615714173159">"<xliff:g id="EXTENSION">%1$s</xliff:g> video"</string>
+    <string name="mime_type_image" msgid="3144284451605236371">"Image"</string>
+    <string name="mime_type_image_ext" msgid="1514613218742736590">"<xliff:g id="EXTENSION">%1$s</xliff:g> image"</string>
+    <string name="mime_type_compressed" msgid="1645486037074943257">"Archive"</string>
+    <string name="mime_type_compressed_ext" msgid="4232293058067801528">"<xliff:g id="EXTENSION">%1$s</xliff:g> archive"</string>
+    <string name="mime_type_document" msgid="1596838147256375966">"Document"</string>
+    <string name="mime_type_document_ext" msgid="6327266601345501281">"<xliff:g id="EXTENSION">%1$s</xliff:g> document"</string>
+    <string name="mime_type_spreadsheet" msgid="2639138255207123557">"Spreadsheet"</string>
+    <string name="mime_type_spreadsheet_ext" msgid="5508653032786106725">"<xliff:g id="EXTENSION">%1$s</xliff:g> spreadsheet"</string>
+    <string name="mime_type_presentation" msgid="6145604688774787357">"Presentation"</string>
+    <string name="mime_type_presentation_ext" msgid="2982650207774823437">"<xliff:g id="EXTENSION">%1$s</xliff:g> presentation"</string>
     <string name="car_loading_profile" msgid="3545132581795684027">"Loading"</string>
     <plurals name="file_count" formatted="false" msgid="1628600959752419449">
       <item quantity="other"><xliff:g id="FILE_NAME_2">%s</xliff:g> + <xliff:g id="COUNT_3">%d</xliff:g> files</item>
       <item quantity="one"><xliff:g id="FILE_NAME_0">%s</xliff:g> + <xliff:g id="COUNT_1">%d</xliff:g> file</item>
     </plurals>
+    <!-- no translation found for chooser_no_direct_share_targets (997970693708458895) -->
+    <skip />
 </resources>
diff --git a/core/res/res/values-en-rCA/strings.xml b/core/res/res/values-en-rCA/strings.xml
index 3c1d004..722d132 100644
--- a/core/res/res/values-en-rCA/strings.xml
+++ b/core/res/res/values-en-rCA/strings.xml
@@ -308,15 +308,15 @@
     <string name="permgrouplab_phone" msgid="5229115638567440675">"Telephone"</string>
     <string name="permgroupdesc_phone" msgid="6234224354060641055">"make and manage phone calls"</string>
     <string name="permgrouprequest_phone" msgid="9166979577750581037">"Allow &lt;b&gt;<xliff:g id="APP_NAME">%1$s</xliff:g>&lt;/b&gt; to make and manage phone calls?"</string>
-    <string name="permgrouplab_sensors" msgid="416037179223226722">"Body sensors"</string>
+    <string name="permgrouplab_sensors" msgid="4838614103153567532">"Body sensors"</string>
     <string name="permgroupdesc_sensors" msgid="7147968539346634043">"access sensor data about your vital signs"</string>
     <string name="permgrouprequest_sensors" msgid="6349806962814556786">"Allow &lt;b&gt;<xliff:g id="APP_NAME">%1$s</xliff:g>&lt;/b&gt; to access sensor data about your vital signs?"</string>
     <string name="permgrouplab_aural" msgid="965607064083134896">"Music"</string>
     <string name="permgroupdesc_aural" msgid="4870189506255958055">"access your music"</string>
     <string name="permgrouprequest_aural" msgid="6787926123071735620">"Allow &lt;b&gt;<xliff:g id="APP_NAME">%1$s</xliff:g>&lt;/b&gt; to access your music?"</string>
-    <string name="permgrouplab_visual" msgid="8030190588123857921">"Photos &amp; Videos"</string>
+    <string name="permgrouplab_visual" msgid="6477382108771145134">"Photos &amp; videos"</string>
     <string name="permgroupdesc_visual" msgid="3415827902566663546">"access your photos &amp; videos"</string>
-    <string name="permgrouprequest_visual" msgid="6907523945030290376">"Allow &lt;b&gt;<xliff:g id="APP_NAME">%1$s</xliff:g>&lt;/b&gt; to access your photos &amp; videos?"</string>
+    <string name="permgrouprequest_visual" msgid="3043752127595243314">"Allow &lt;b&gt;<xliff:g id="APP_NAME">%1$s</xliff:g>&lt;/b&gt; to access your photos and videos, including tagged locations?"</string>
     <string name="capability_title_canRetrieveWindowContent" msgid="3901717936930170320">"Retrieve window content"</string>
     <string name="capability_desc_canRetrieveWindowContent" msgid="3772225008605310672">"Inspect the content of a window that you\'re interacting with."</string>
     <string name="capability_title_canRequestTouchExploration" msgid="3108723364676667320">"Turn on Explore by Touch"</string>
@@ -1396,8 +1396,7 @@
     <string name="ext_media_init_action" msgid="7952885510091978278">"Set-up"</string>
     <string name="ext_media_unmount_action" msgid="1121883233103278199">"Eject"</string>
     <string name="ext_media_browse_action" msgid="8322172381028546087">"Explore"</string>
-    <!-- no translation found for ext_media_seamless_action (6575980560886881233) -->
-    <skip />
+    <string name="ext_media_seamless_action" msgid="6575980560886881233">"Switch output"</string>
     <string name="ext_media_missing_title" msgid="620980315821543904">"<xliff:g id="NAME">%s</xliff:g> missing"</string>
     <string name="ext_media_missing_message" msgid="4012389235250987930">"Insert device again"</string>
     <string name="ext_media_move_specific_title" msgid="1471100343872375842">"Moving <xliff:g id="NAME">%s</xliff:g>"</string>
@@ -1611,6 +1610,8 @@
     <string name="display_manager_overlay_display_name" msgid="5142365982271620716">"Overlay #<xliff:g id="ID">%1$d</xliff:g>"</string>
     <string name="display_manager_overlay_display_title" msgid="652124517672257172">"<xliff:g id="NAME">%1$s</xliff:g>: <xliff:g id="WIDTH">%2$d</xliff:g>x<xliff:g id="HEIGHT">%3$d</xliff:g>, <xliff:g id="DPI">%4$d</xliff:g> dpi"</string>
     <string name="display_manager_overlay_display_secure_suffix" msgid="6022119702628572080">", secure"</string>
+    <string name="activity_starter_block_bg_activity_starts_permissive" msgid="5692097903712956720">"This background activity start from <xliff:g id="PACKAGENAME">%1$s</xliff:g> will be blocked in future Q builds. See go/q-bg-block."</string>
+    <string name="activity_starter_block_bg_activity_starts_enforcing" msgid="8299522481076404353">"Background activity start from <xliff:g id="PACKAGENAME">%1$s</xliff:g> blocked. See go/q-bg-block."</string>
     <string name="kg_forgot_pattern_button_text" msgid="8852021467868220608">"Forgot Pattern"</string>
     <string name="kg_wrong_pattern" msgid="1850806070801358830">"Wrong Pattern"</string>
     <string name="kg_wrong_password" msgid="2333281762128113157">"Wrong Password"</string>
@@ -1996,9 +1997,29 @@
     <string name="dynamic_mode_notification_channel_name" msgid="2348803891571320452">"Routine Mode info notification"</string>
     <string name="dynamic_mode_notification_title" msgid="508815255807182035">"Battery may run out before usual charge"</string>
     <string name="dynamic_mode_notification_summary" msgid="2541166298550402690">"Battery Saver activated to extend battery life"</string>
+    <string name="mime_type_folder" msgid="7111951698626315204">"Folder"</string>
+    <string name="mime_type_apk" msgid="5518003630972506900">"Android application"</string>
+    <string name="mime_type_generic" msgid="6833871596845900027">"File"</string>
+    <string name="mime_type_generic_ext" msgid="8450275970061657174">"<xliff:g id="EXTENSION">%1$s</xliff:g> file"</string>
+    <string name="mime_type_audio" msgid="6289777657172050926">"Audio"</string>
+    <string name="mime_type_audio_ext" msgid="3270880987725816210">"<xliff:g id="EXTENSION">%1$s</xliff:g> audio"</string>
+    <string name="mime_type_video" msgid="4093025777317307426">"Video"</string>
+    <string name="mime_type_video_ext" msgid="5643771615714173159">"<xliff:g id="EXTENSION">%1$s</xliff:g> video"</string>
+    <string name="mime_type_image" msgid="3144284451605236371">"Image"</string>
+    <string name="mime_type_image_ext" msgid="1514613218742736590">"<xliff:g id="EXTENSION">%1$s</xliff:g> image"</string>
+    <string name="mime_type_compressed" msgid="1645486037074943257">"Archive"</string>
+    <string name="mime_type_compressed_ext" msgid="4232293058067801528">"<xliff:g id="EXTENSION">%1$s</xliff:g> archive"</string>
+    <string name="mime_type_document" msgid="1596838147256375966">"Document"</string>
+    <string name="mime_type_document_ext" msgid="6327266601345501281">"<xliff:g id="EXTENSION">%1$s</xliff:g> document"</string>
+    <string name="mime_type_spreadsheet" msgid="2639138255207123557">"Spreadsheet"</string>
+    <string name="mime_type_spreadsheet_ext" msgid="5508653032786106725">"<xliff:g id="EXTENSION">%1$s</xliff:g> spreadsheet"</string>
+    <string name="mime_type_presentation" msgid="6145604688774787357">"Presentation"</string>
+    <string name="mime_type_presentation_ext" msgid="2982650207774823437">"<xliff:g id="EXTENSION">%1$s</xliff:g> presentation"</string>
     <string name="car_loading_profile" msgid="3545132581795684027">"Loading"</string>
     <plurals name="file_count" formatted="false" msgid="1628600959752419449">
       <item quantity="other"><xliff:g id="FILE_NAME_2">%s</xliff:g> + <xliff:g id="COUNT_3">%d</xliff:g> files</item>
       <item quantity="one"><xliff:g id="FILE_NAME_0">%s</xliff:g> + <xliff:g id="COUNT_1">%d</xliff:g> file</item>
     </plurals>
+    <!-- no translation found for chooser_no_direct_share_targets (997970693708458895) -->
+    <skip />
 </resources>
diff --git a/core/res/res/values-en-rGB/strings.xml b/core/res/res/values-en-rGB/strings.xml
index 4c5d6c0..8ed7bd8 100644
--- a/core/res/res/values-en-rGB/strings.xml
+++ b/core/res/res/values-en-rGB/strings.xml
@@ -308,15 +308,15 @@
     <string name="permgrouplab_phone" msgid="5229115638567440675">"Telephone"</string>
     <string name="permgroupdesc_phone" msgid="6234224354060641055">"make and manage phone calls"</string>
     <string name="permgrouprequest_phone" msgid="9166979577750581037">"Allow &lt;b&gt;<xliff:g id="APP_NAME">%1$s</xliff:g>&lt;/b&gt; to make and manage phone calls?"</string>
-    <string name="permgrouplab_sensors" msgid="416037179223226722">"Body sensors"</string>
+    <string name="permgrouplab_sensors" msgid="4838614103153567532">"Body sensors"</string>
     <string name="permgroupdesc_sensors" msgid="7147968539346634043">"access sensor data about your vital signs"</string>
     <string name="permgrouprequest_sensors" msgid="6349806962814556786">"Allow &lt;b&gt;<xliff:g id="APP_NAME">%1$s</xliff:g>&lt;/b&gt; to access sensor data about your vital signs?"</string>
     <string name="permgrouplab_aural" msgid="965607064083134896">"Music"</string>
     <string name="permgroupdesc_aural" msgid="4870189506255958055">"access your music"</string>
     <string name="permgrouprequest_aural" msgid="6787926123071735620">"Allow &lt;b&gt;<xliff:g id="APP_NAME">%1$s</xliff:g>&lt;/b&gt; to access your music?"</string>
-    <string name="permgrouplab_visual" msgid="8030190588123857921">"Photos &amp; Videos"</string>
+    <string name="permgrouplab_visual" msgid="6477382108771145134">"Photos &amp; videos"</string>
     <string name="permgroupdesc_visual" msgid="3415827902566663546">"access your photos &amp; videos"</string>
-    <string name="permgrouprequest_visual" msgid="6907523945030290376">"Allow &lt;b&gt;<xliff:g id="APP_NAME">%1$s</xliff:g>&lt;/b&gt; to access your photos &amp; videos?"</string>
+    <string name="permgrouprequest_visual" msgid="3043752127595243314">"Allow &lt;b&gt;<xliff:g id="APP_NAME">%1$s</xliff:g>&lt;/b&gt; to access your photos and videos, including tagged locations?"</string>
     <string name="capability_title_canRetrieveWindowContent" msgid="3901717936930170320">"Retrieve window content"</string>
     <string name="capability_desc_canRetrieveWindowContent" msgid="3772225008605310672">"Inspect the content of a window that you\'re interacting with."</string>
     <string name="capability_title_canRequestTouchExploration" msgid="3108723364676667320">"Turn on Explore by Touch"</string>
@@ -1396,8 +1396,7 @@
     <string name="ext_media_init_action" msgid="7952885510091978278">"Set-up"</string>
     <string name="ext_media_unmount_action" msgid="1121883233103278199">"Eject"</string>
     <string name="ext_media_browse_action" msgid="8322172381028546087">"Explore"</string>
-    <!-- no translation found for ext_media_seamless_action (6575980560886881233) -->
-    <skip />
+    <string name="ext_media_seamless_action" msgid="6575980560886881233">"Switch output"</string>
     <string name="ext_media_missing_title" msgid="620980315821543904">"<xliff:g id="NAME">%s</xliff:g> missing"</string>
     <string name="ext_media_missing_message" msgid="4012389235250987930">"Insert device again"</string>
     <string name="ext_media_move_specific_title" msgid="1471100343872375842">"Moving <xliff:g id="NAME">%s</xliff:g>"</string>
@@ -1611,6 +1610,8 @@
     <string name="display_manager_overlay_display_name" msgid="5142365982271620716">"Overlay #<xliff:g id="ID">%1$d</xliff:g>"</string>
     <string name="display_manager_overlay_display_title" msgid="652124517672257172">"<xliff:g id="NAME">%1$s</xliff:g>: <xliff:g id="WIDTH">%2$d</xliff:g>x<xliff:g id="HEIGHT">%3$d</xliff:g>, <xliff:g id="DPI">%4$d</xliff:g> dpi"</string>
     <string name="display_manager_overlay_display_secure_suffix" msgid="6022119702628572080">", secure"</string>
+    <string name="activity_starter_block_bg_activity_starts_permissive" msgid="5692097903712956720">"This background activity start from <xliff:g id="PACKAGENAME">%1$s</xliff:g> will be blocked in future Q builds. See go/q-bg-block."</string>
+    <string name="activity_starter_block_bg_activity_starts_enforcing" msgid="8299522481076404353">"Background activity start from <xliff:g id="PACKAGENAME">%1$s</xliff:g> blocked. See go/q-bg-block."</string>
     <string name="kg_forgot_pattern_button_text" msgid="8852021467868220608">"Forgot Pattern"</string>
     <string name="kg_wrong_pattern" msgid="1850806070801358830">"Wrong Pattern"</string>
     <string name="kg_wrong_password" msgid="2333281762128113157">"Wrong Password"</string>
@@ -1996,9 +1997,29 @@
     <string name="dynamic_mode_notification_channel_name" msgid="2348803891571320452">"Routine Mode info notification"</string>
     <string name="dynamic_mode_notification_title" msgid="508815255807182035">"Battery may run out before usual charge"</string>
     <string name="dynamic_mode_notification_summary" msgid="2541166298550402690">"Battery Saver activated to extend battery life"</string>
+    <string name="mime_type_folder" msgid="7111951698626315204">"Folder"</string>
+    <string name="mime_type_apk" msgid="5518003630972506900">"Android application"</string>
+    <string name="mime_type_generic" msgid="6833871596845900027">"File"</string>
+    <string name="mime_type_generic_ext" msgid="8450275970061657174">"<xliff:g id="EXTENSION">%1$s</xliff:g> file"</string>
+    <string name="mime_type_audio" msgid="6289777657172050926">"Audio"</string>
+    <string name="mime_type_audio_ext" msgid="3270880987725816210">"<xliff:g id="EXTENSION">%1$s</xliff:g> audio"</string>
+    <string name="mime_type_video" msgid="4093025777317307426">"Video"</string>
+    <string name="mime_type_video_ext" msgid="5643771615714173159">"<xliff:g id="EXTENSION">%1$s</xliff:g> video"</string>
+    <string name="mime_type_image" msgid="3144284451605236371">"Image"</string>
+    <string name="mime_type_image_ext" msgid="1514613218742736590">"<xliff:g id="EXTENSION">%1$s</xliff:g> image"</string>
+    <string name="mime_type_compressed" msgid="1645486037074943257">"Archive"</string>
+    <string name="mime_type_compressed_ext" msgid="4232293058067801528">"<xliff:g id="EXTENSION">%1$s</xliff:g> archive"</string>
+    <string name="mime_type_document" msgid="1596838147256375966">"Document"</string>
+    <string name="mime_type_document_ext" msgid="6327266601345501281">"<xliff:g id="EXTENSION">%1$s</xliff:g> document"</string>
+    <string name="mime_type_spreadsheet" msgid="2639138255207123557">"Spreadsheet"</string>
+    <string name="mime_type_spreadsheet_ext" msgid="5508653032786106725">"<xliff:g id="EXTENSION">%1$s</xliff:g> spreadsheet"</string>
+    <string name="mime_type_presentation" msgid="6145604688774787357">"Presentation"</string>
+    <string name="mime_type_presentation_ext" msgid="2982650207774823437">"<xliff:g id="EXTENSION">%1$s</xliff:g> presentation"</string>
     <string name="car_loading_profile" msgid="3545132581795684027">"Loading"</string>
     <plurals name="file_count" formatted="false" msgid="1628600959752419449">
       <item quantity="other"><xliff:g id="FILE_NAME_2">%s</xliff:g> + <xliff:g id="COUNT_3">%d</xliff:g> files</item>
       <item quantity="one"><xliff:g id="FILE_NAME_0">%s</xliff:g> + <xliff:g id="COUNT_1">%d</xliff:g> file</item>
     </plurals>
+    <!-- no translation found for chooser_no_direct_share_targets (997970693708458895) -->
+    <skip />
 </resources>
diff --git a/core/res/res/values-en-rIN/strings.xml b/core/res/res/values-en-rIN/strings.xml
index 4c5d6c0..8ed7bd8 100644
--- a/core/res/res/values-en-rIN/strings.xml
+++ b/core/res/res/values-en-rIN/strings.xml
@@ -308,15 +308,15 @@
     <string name="permgrouplab_phone" msgid="5229115638567440675">"Telephone"</string>
     <string name="permgroupdesc_phone" msgid="6234224354060641055">"make and manage phone calls"</string>
     <string name="permgrouprequest_phone" msgid="9166979577750581037">"Allow &lt;b&gt;<xliff:g id="APP_NAME">%1$s</xliff:g>&lt;/b&gt; to make and manage phone calls?"</string>
-    <string name="permgrouplab_sensors" msgid="416037179223226722">"Body sensors"</string>
+    <string name="permgrouplab_sensors" msgid="4838614103153567532">"Body sensors"</string>
     <string name="permgroupdesc_sensors" msgid="7147968539346634043">"access sensor data about your vital signs"</string>
     <string name="permgrouprequest_sensors" msgid="6349806962814556786">"Allow &lt;b&gt;<xliff:g id="APP_NAME">%1$s</xliff:g>&lt;/b&gt; to access sensor data about your vital signs?"</string>
     <string name="permgrouplab_aural" msgid="965607064083134896">"Music"</string>
     <string name="permgroupdesc_aural" msgid="4870189506255958055">"access your music"</string>
     <string name="permgrouprequest_aural" msgid="6787926123071735620">"Allow &lt;b&gt;<xliff:g id="APP_NAME">%1$s</xliff:g>&lt;/b&gt; to access your music?"</string>
-    <string name="permgrouplab_visual" msgid="8030190588123857921">"Photos &amp; Videos"</string>
+    <string name="permgrouplab_visual" msgid="6477382108771145134">"Photos &amp; videos"</string>
     <string name="permgroupdesc_visual" msgid="3415827902566663546">"access your photos &amp; videos"</string>
-    <string name="permgrouprequest_visual" msgid="6907523945030290376">"Allow &lt;b&gt;<xliff:g id="APP_NAME">%1$s</xliff:g>&lt;/b&gt; to access your photos &amp; videos?"</string>
+    <string name="permgrouprequest_visual" msgid="3043752127595243314">"Allow &lt;b&gt;<xliff:g id="APP_NAME">%1$s</xliff:g>&lt;/b&gt; to access your photos and videos, including tagged locations?"</string>
     <string name="capability_title_canRetrieveWindowContent" msgid="3901717936930170320">"Retrieve window content"</string>
     <string name="capability_desc_canRetrieveWindowContent" msgid="3772225008605310672">"Inspect the content of a window that you\'re interacting with."</string>
     <string name="capability_title_canRequestTouchExploration" msgid="3108723364676667320">"Turn on Explore by Touch"</string>
@@ -1396,8 +1396,7 @@
     <string name="ext_media_init_action" msgid="7952885510091978278">"Set-up"</string>
     <string name="ext_media_unmount_action" msgid="1121883233103278199">"Eject"</string>
     <string name="ext_media_browse_action" msgid="8322172381028546087">"Explore"</string>
-    <!-- no translation found for ext_media_seamless_action (6575980560886881233) -->
-    <skip />
+    <string name="ext_media_seamless_action" msgid="6575980560886881233">"Switch output"</string>
     <string name="ext_media_missing_title" msgid="620980315821543904">"<xliff:g id="NAME">%s</xliff:g> missing"</string>
     <string name="ext_media_missing_message" msgid="4012389235250987930">"Insert device again"</string>
     <string name="ext_media_move_specific_title" msgid="1471100343872375842">"Moving <xliff:g id="NAME">%s</xliff:g>"</string>
@@ -1611,6 +1610,8 @@
     <string name="display_manager_overlay_display_name" msgid="5142365982271620716">"Overlay #<xliff:g id="ID">%1$d</xliff:g>"</string>
     <string name="display_manager_overlay_display_title" msgid="652124517672257172">"<xliff:g id="NAME">%1$s</xliff:g>: <xliff:g id="WIDTH">%2$d</xliff:g>x<xliff:g id="HEIGHT">%3$d</xliff:g>, <xliff:g id="DPI">%4$d</xliff:g> dpi"</string>
     <string name="display_manager_overlay_display_secure_suffix" msgid="6022119702628572080">", secure"</string>
+    <string name="activity_starter_block_bg_activity_starts_permissive" msgid="5692097903712956720">"This background activity start from <xliff:g id="PACKAGENAME">%1$s</xliff:g> will be blocked in future Q builds. See go/q-bg-block."</string>
+    <string name="activity_starter_block_bg_activity_starts_enforcing" msgid="8299522481076404353">"Background activity start from <xliff:g id="PACKAGENAME">%1$s</xliff:g> blocked. See go/q-bg-block."</string>
     <string name="kg_forgot_pattern_button_text" msgid="8852021467868220608">"Forgot Pattern"</string>
     <string name="kg_wrong_pattern" msgid="1850806070801358830">"Wrong Pattern"</string>
     <string name="kg_wrong_password" msgid="2333281762128113157">"Wrong Password"</string>
@@ -1996,9 +1997,29 @@
     <string name="dynamic_mode_notification_channel_name" msgid="2348803891571320452">"Routine Mode info notification"</string>
     <string name="dynamic_mode_notification_title" msgid="508815255807182035">"Battery may run out before usual charge"</string>
     <string name="dynamic_mode_notification_summary" msgid="2541166298550402690">"Battery Saver activated to extend battery life"</string>
+    <string name="mime_type_folder" msgid="7111951698626315204">"Folder"</string>
+    <string name="mime_type_apk" msgid="5518003630972506900">"Android application"</string>
+    <string name="mime_type_generic" msgid="6833871596845900027">"File"</string>
+    <string name="mime_type_generic_ext" msgid="8450275970061657174">"<xliff:g id="EXTENSION">%1$s</xliff:g> file"</string>
+    <string name="mime_type_audio" msgid="6289777657172050926">"Audio"</string>
+    <string name="mime_type_audio_ext" msgid="3270880987725816210">"<xliff:g id="EXTENSION">%1$s</xliff:g> audio"</string>
+    <string name="mime_type_video" msgid="4093025777317307426">"Video"</string>
+    <string name="mime_type_video_ext" msgid="5643771615714173159">"<xliff:g id="EXTENSION">%1$s</xliff:g> video"</string>
+    <string name="mime_type_image" msgid="3144284451605236371">"Image"</string>
+    <string name="mime_type_image_ext" msgid="1514613218742736590">"<xliff:g id="EXTENSION">%1$s</xliff:g> image"</string>
+    <string name="mime_type_compressed" msgid="1645486037074943257">"Archive"</string>
+    <string name="mime_type_compressed_ext" msgid="4232293058067801528">"<xliff:g id="EXTENSION">%1$s</xliff:g> archive"</string>
+    <string name="mime_type_document" msgid="1596838147256375966">"Document"</string>
+    <string name="mime_type_document_ext" msgid="6327266601345501281">"<xliff:g id="EXTENSION">%1$s</xliff:g> document"</string>
+    <string name="mime_type_spreadsheet" msgid="2639138255207123557">"Spreadsheet"</string>
+    <string name="mime_type_spreadsheet_ext" msgid="5508653032786106725">"<xliff:g id="EXTENSION">%1$s</xliff:g> spreadsheet"</string>
+    <string name="mime_type_presentation" msgid="6145604688774787357">"Presentation"</string>
+    <string name="mime_type_presentation_ext" msgid="2982650207774823437">"<xliff:g id="EXTENSION">%1$s</xliff:g> presentation"</string>
     <string name="car_loading_profile" msgid="3545132581795684027">"Loading"</string>
     <plurals name="file_count" formatted="false" msgid="1628600959752419449">
       <item quantity="other"><xliff:g id="FILE_NAME_2">%s</xliff:g> + <xliff:g id="COUNT_3">%d</xliff:g> files</item>
       <item quantity="one"><xliff:g id="FILE_NAME_0">%s</xliff:g> + <xliff:g id="COUNT_1">%d</xliff:g> file</item>
     </plurals>
+    <!-- no translation found for chooser_no_direct_share_targets (997970693708458895) -->
+    <skip />
 </resources>
diff --git a/core/res/res/values-en-rXC/strings.xml b/core/res/res/values-en-rXC/strings.xml
index dc9ddf9..a8173dd 100644
--- a/core/res/res/values-en-rXC/strings.xml
+++ b/core/res/res/values-en-rXC/strings.xml
@@ -308,15 +308,15 @@
     <string name="permgrouplab_phone" msgid="5229115638567440675">"‎‏‎‎‎‎‎‏‎‏‏‏‎‎‎‎‎‎‏‎‎‏‎‎‎‎‏‏‏‏‏‏‏‏‎‎‏‎‎‎‏‎‎‏‎‎‎‏‏‎‎‎‏‏‎‎‏‏‏‏‎‏‏‏‏‏‎‏‏‏‏‎‎‏‎‎‎‎‎‎‏‎‎‏‎‎‎‏‎‎‏‎‎‎‏‏‎Phone‎‏‎‎‏‎"</string>
     <string name="permgroupdesc_phone" msgid="6234224354060641055">"‎‏‎‎‎‎‎‏‎‏‏‏‎‎‎‎‎‎‏‎‎‏‎‎‎‎‏‏‏‏‏‏‏‏‎‏‎‏‏‎‏‎‎‎‎‏‎‎‎‏‏‎‏‎‏‎‎‎‎‎‎‏‎‏‎‎‎‎‏‎‎‏‏‏‎‏‏‏‏‏‏‎‏‎‎‎‏‏‎‎‎‏‏‏‏‏‎make and manage phone calls‎‏‎‎‏‎"</string>
     <string name="permgrouprequest_phone" msgid="9166979577750581037">"‎‏‎‎‎‎‎‏‎‏‏‏‎‎‎‎‎‎‏‎‎‏‎‎‎‎‏‏‏‏‏‏‏‏‏‏‏‏‏‏‎‎‏‏‎‏‏‏‏‎‏‎‎‏‏‏‎‏‎‏‏‎‏‏‎‏‏‏‎‎‏‏‎‎‎‏‎‏‎‏‎‏‏‎‏‏‏‏‎‎‏‎‏‏‎‏‎Allow &lt;b&gt;‎‏‎‎‏‏‎<xliff:g id="APP_NAME">%1$s</xliff:g>‎‏‎‎‏‏‏‎&lt;/b&gt; to make and manage phone calls?‎‏‎‎‏‎"</string>
-    <string name="permgrouplab_sensors" msgid="416037179223226722">"‎‏‎‎‎‎‎‏‎‏‏‏‎‎‎‎‎‎‏‎‎‏‎‎‎‎‏‏‏‏‎‏‏‏‎‏‏‏‎‎‎‏‏‎‎‎‎‎‏‏‏‏‏‎‎‏‏‏‎‎‎‎‏‏‏‎‎‎‏‏‏‏‎‏‎‎‏‎‏‏‏‎‎‏‎‏‏‎‎‎‏‎‎Body Sensors‎‏‎‎‏‎"</string>
+    <string name="permgrouplab_sensors" msgid="4838614103153567532">"‎‏‎‎‎‎‎‏‎‏‏‏‎‎‎‎‎‎‏‎‎‏‎‎‎‎‏‏‏‏‏‏‏‏‎‎‎‎‏‏‎‎‏‎‎‏‏‎‎‎‏‏‎‏‎‏‏‏‏‎‎‏‎‎‎‎‎‎‎‏‏‏‏‎‏‎‏‎‎‏‏‏‏‎‎‏‏‏‎‎‏‎‏‏‎‎‎Body sensors‎‏‎‎‏‎"</string>
     <string name="permgroupdesc_sensors" msgid="7147968539346634043">"‎‏‎‎‎‎‎‏‎‏‏‏‎‎‎‎‎‎‏‎‎‏‎‎‎‎‏‏‏‏‏‏‏‏‏‎‎‎‏‏‎‎‏‏‎‎‏‎‏‎‏‎‏‏‏‏‏‎‎‎‎‎‏‏‏‏‎‏‎‏‎‏‎‏‏‎‏‏‎‎‏‎‎‎‎‏‎‏‎‎‏‏‏‎‏‏‎access sensor data about your vital signs‎‏‎‎‏‎"</string>
     <string name="permgrouprequest_sensors" msgid="6349806962814556786">"‎‏‎‎‎‎‎‏‎‏‏‏‎‎‎‎‎‎‏‎‎‏‎‎‎‎‏‏‏‏‏‏‏‏‎‏‏‎‎‎‎‎‎‏‏‏‏‏‎‎‎‎‏‎‏‏‏‏‎‎‏‎‏‎‎‎‏‏‏‎‏‎‏‏‎‏‏‏‎‏‎‎‎‏‏‎‏‎‎‏‏‏‎‎‏‎‎Allow &lt;b&gt;‎‏‎‎‏‏‎<xliff:g id="APP_NAME">%1$s</xliff:g>‎‏‎‎‏‏‏‎&lt;/b&gt; to access sensor data about your vital signs?‎‏‎‎‏‎"</string>
     <string name="permgrouplab_aural" msgid="965607064083134896">"‎‏‎‎‎‎‎‏‎‏‏‏‎‎‎‎‎‎‏‎‎‏‎‎‎‎‏‏‏‏‏‎‎‏‏‎‏‎‏‏‎‎‏‏‎‏‎‎‎‎‏‏‎‏‎‎‎‎‎‏‎‎‎‏‏‏‏‏‏‎‏‎‎‏‎‎‎‎‏‏‏‏‎‎‏‏‎‏‏‎‎‎‎‎Music‎‏‎‎‏‎"</string>
     <string name="permgroupdesc_aural" msgid="4870189506255958055">"‎‏‎‎‎‎‎‏‎‏‏‏‎‎‎‎‎‎‏‎‎‏‎‎‎‎‏‏‏‏‏‏‏‏‎‎‎‎‏‏‏‎‎‏‎‏‏‎‎‏‏‎‎‎‏‏‏‎‎‎‏‏‎‏‎‏‏‏‎‏‎‏‎‎‏‏‏‎‎‎‏‎‏‏‎‎‎‎‎‎‏‎‎‏‏‏‎access your music‎‏‎‎‏‎"</string>
     <string name="permgrouprequest_aural" msgid="6787926123071735620">"‎‏‎‎‎‎‎‏‎‏‏‏‎‎‎‎‎‎‏‎‎‏‎‎‎‎‏‏‏‏‏‏‏‏‎‏‏‏‏‎‎‎‏‏‎‎‏‏‏‎‎‎‏‏‏‎‏‏‎‏‏‎‎‎‎‏‎‎‏‏‏‏‎‏‎‎‏‎‎‏‎‎‎‎‎‏‏‏‎‏‎‎‎‏‎‎‎Allow &lt;b&gt;‎‏‎‎‏‏‎<xliff:g id="APP_NAME">%1$s</xliff:g>‎‏‎‎‏‏‏‎&lt;/b&gt; to access your music?‎‏‎‎‏‎"</string>
-    <string name="permgrouplab_visual" msgid="8030190588123857921">"‎‏‎‎‎‎‎‏‎‏‏‏‎‎‎‎‎‎‏‎‎‏‎‎‎‎‏‏‏‏‏‏‏‏‏‎‏‏‏‏‎‏‏‏‎‎‎‎‏‏‏‏‎‏‏‏‏‏‎‎‏‎‏‏‎‏‎‎‏‎‏‏‏‏‎‎‏‏‏‎‏‏‎‎‎‏‎‎‎‎‎‎‎‎‎‏‎Photos &amp; Videos‎‏‎‎‏‎"</string>
+    <string name="permgrouplab_visual" msgid="6477382108771145134">"‎‏‎‎‎‎‎‏‎‏‏‏‎‎‎‎‎‎‏‎‎‏‎‎‎‎‏‏‏‏‏‏‏‏‎‏‏‎‎‏‏‏‏‎‎‏‎‎‎‏‎‎‏‎‎‎‏‎‏‏‎‏‎‏‏‎‎‏‎‎‏‏‏‏‎‎‎‏‏‎‎‏‎‏‎‏‎‏‏‎‏‎‏‏‏‎‎Photos &amp; videos‎‏‎‎‏‎"</string>
     <string name="permgroupdesc_visual" msgid="3415827902566663546">"‎‏‎‎‎‎‎‏‎‏‏‏‎‎‎‎‎‎‏‎‎‏‎‎‎‎‏‏‏‏‏‏‎‏‎‏‏‏‏‎‏‏‎‎‏‏‏‎‏‏‏‎‏‎‏‎‏‏‎‎‎‎‏‎‎‏‎‏‎‏‎‎‏‎‏‏‎‏‎‏‎‎‎‎‏‎‏‎‏‏‏‏‎‏‎‎access your photos &amp; videos‎‏‎‎‏‎"</string>
-    <string name="permgrouprequest_visual" msgid="6907523945030290376">"‎‏‎‎‎‎‎‏‎‏‏‏‎‎‎‎‎‎‏‎‎‏‎‎‎‎‏‏‏‏‏‏‏‏‎‏‏‏‏‏‏‏‎‏‏‏‎‎‎‏‏‏‎‏‎‎‎‏‏‎‏‏‏‎‎‎‏‎‏‏‎‏‎‎‎‎‏‎‎‏‎‎‎‎‏‎‏‏‏‏‎‎‏‎‎‎‎Allow &lt;b&gt;‎‏‎‎‏‏‎<xliff:g id="APP_NAME">%1$s</xliff:g>‎‏‎‎‏‏‏‎&lt;/b&gt; to access your photos &amp; videos?‎‏‎‎‏‎"</string>
+    <string name="permgrouprequest_visual" msgid="3043752127595243314">"‎‏‎‎‎‎‎‏‎‏‏‏‎‎‎‎‎‎‏‎‎‏‎‎‎‎‏‏‏‏‏‏‎‏‎‏‎‏‎‎‎‏‏‏‏‎‏‏‎‎‏‎‏‎‎‎‏‏‎‏‏‏‎‏‏‏‏‏‏‎‏‏‎‏‎‎‏‏‏‎‏‏‎‎‏‏‏‎‎‏‏‎‎‏‎‎Allow &lt;b&gt;‎‏‎‎‏‏‎<xliff:g id="APP_NAME">%1$s</xliff:g>‎‏‎‎‏‏‏‎&lt;/b&gt; to access your photos and videos, including tagged locations?‎‏‎‎‏‎"</string>
     <string name="capability_title_canRetrieveWindowContent" msgid="3901717936930170320">"‎‏‎‎‎‎‎‏‎‏‏‏‎‎‎‎‎‎‏‎‎‏‎‎‎‎‏‏‏‏‏‏‎‏‏‎‏‏‎‎‎‏‎‎‏‎‏‏‎‏‎‏‏‏‏‏‏‎‎‏‎‏‎‏‎‎‏‏‏‎‎‎‏‏‏‏‏‏‎‎‎‏‎‎‏‎‏‏‏‎‏‎‎‎‎‎Retrieve window content‎‏‎‎‏‎"</string>
     <string name="capability_desc_canRetrieveWindowContent" msgid="3772225008605310672">"‎‏‎‎‎‎‎‏‎‏‏‏‎‎‎‎‎‎‏‎‎‏‎‎‎‎‏‏‏‏‏‏‎‏‏‎‏‎‎‎‏‎‏‏‎‎‏‏‎‏‎‎‎‏‎‏‎‏‎‏‎‎‎‏‏‎‎‎‎‏‎‏‏‎‎‎‎‏‏‏‎‏‎‏‏‏‎‏‏‎‏‎‎‎‎‎Inspect the content of a window you\'re interacting with.‎‏‎‎‏‎"</string>
     <string name="capability_title_canRequestTouchExploration" msgid="3108723364676667320">"‎‏‎‎‎‎‎‏‎‏‏‏‎‎‎‎‎‎‏‎‎‏‎‎‎‎‏‏‏‏‏‏‎‏‎‏‎‏‏‎‎‏‎‎‏‎‎‎‏‏‎‎‏‏‏‎‏‏‎‏‏‎‏‏‏‏‏‎‎‎‎‏‎‎‎‎‎‏‎‏‎‎‎‎‏‏‏‏‎‏‏‏‎‎‎‎Turn on Explore by Touch‎‏‎‎‏‎"</string>
@@ -1396,8 +1396,7 @@
     <string name="ext_media_init_action" msgid="7952885510091978278">"‎‏‎‎‎‎‎‏‎‏‏‏‎‎‎‎‎‎‏‎‎‏‎‎‎‎‏‏‏‏‏‏‏‏‏‎‏‏‏‎‎‏‎‏‏‏‏‎‎‏‎‏‎‎‏‏‎‎‏‏‏‏‎‎‎‎‏‏‏‎‎‎‎‏‏‎‎‎‏‎‎‎‏‏‎‏‏‎‎‎‏‎‎‏‏‎‎Set up‎‏‎‎‏‎"</string>
     <string name="ext_media_unmount_action" msgid="1121883233103278199">"‎‏‎‎‎‎‎‏‎‏‏‏‎‎‎‎‎‎‏‎‎‏‎‎‎‎‏‏‏‏‏‎‎‏‏‏‏‏‎‎‏‎‎‎‏‏‎‏‏‏‎‏‎‏‏‎‏‏‎‏‏‎‏‎‎‎‏‎‎‏‎‎‏‎‏‏‎‎‏‏‏‎‎‎‎‎‏‏‏‎‏‏‏‎Eject‎‏‎‎‏‎"</string>
     <string name="ext_media_browse_action" msgid="8322172381028546087">"‎‏‎‎‎‎‎‏‎‏‏‏‎‎‎‎‎‎‏‎‎‏‎‎‎‎‏‏‏‏‏‏‏‏‏‏‎‎‏‏‎‏‏‏‏‏‏‎‎‏‎‎‏‎‏‏‏‎‏‏‎‎‎‎‎‎‎‏‎‎‏‎‏‏‎‎‎‏‎‏‏‏‏‏‎‏‏‎‎‎‏‎‎‏‏‏‎Explore‎‏‎‎‏‎"</string>
-    <!-- no translation found for ext_media_seamless_action (6575980560886881233) -->
-    <skip />
+    <string name="ext_media_seamless_action" msgid="6575980560886881233">"‎‏‎‎‎‎‎‏‎‏‏‏‎‎‎‎‎‎‏‎‎‏‎‎‎‎‏‏‏‏‏‏‏‏‎‏‏‎‏‏‎‏‎‎‎‎‏‎‏‎‎‏‎‎‏‏‎‏‏‏‏‎‏‎‏‎‏‎‎‏‎‏‏‎‎‎‏‎‎‏‎‏‎‏‏‎‏‏‏‏‎‏‎‎‎‏‎Switch output‎‏‎‎‏‎"</string>
     <string name="ext_media_missing_title" msgid="620980315821543904">"‎‏‎‎‎‎‎‏‎‏‏‏‎‎‎‎‎‎‏‎‎‏‎‎‎‎‏‏‏‏‏‎‎‏‎‎‎‏‎‎‏‏‏‏‎‎‎‏‎‏‎‏‎‎‏‎‎‏‏‏‎‏‎‏‎‎‎‎‏‎‎‎‎‏‏‎‏‏‎‎‏‎‎‎‏‏‏‏‎‎‎‎‎‎‎‏‎‎‏‏‎<xliff:g id="NAME">%s</xliff:g>‎‏‎‎‏‏‏‎ missing‎‏‎‎‏‎"</string>
     <string name="ext_media_missing_message" msgid="4012389235250987930">"‎‏‎‎‎‎‎‏‎‏‏‏‎‎‎‎‎‎‏‎‎‏‎‎‎‎‏‏‏‏‏‏‎‏‏‎‏‏‏‏‎‏‎‏‏‏‎‏‏‎‏‏‏‏‎‏‏‎‎‎‎‎‎‎‎‏‏‏‎‏‏‏‎‏‏‏‏‎‎‏‎‎‎‎‎‏‏‏‎‎‏‏‎‏‎‎Insert device again‎‏‎‎‏‎"</string>
     <string name="ext_media_move_specific_title" msgid="1471100343872375842">"‎‏‎‎‎‎‎‏‎‏‏‏‎‎‎‎‎‎‏‎‎‏‎‎‎‎‏‏‏‏‏‎‏‏‎‏‎‎‎‏‏‎‏‎‏‎‎‏‏‎‎‏‎‏‏‏‏‏‎‏‏‏‏‏‏‏‎‎‎‏‎‏‏‏‎‏‏‏‏‏‎‎‏‏‎‎‎‎‏‎‎‎‏‎‎Moving ‎‏‎‎‏‏‎<xliff:g id="NAME">%s</xliff:g>‎‏‎‎‏‏‏‎‎‏‎‎‏‎"</string>
@@ -1611,6 +1610,8 @@
     <string name="display_manager_overlay_display_name" msgid="5142365982271620716">"‎‏‎‎‎‎‎‏‎‏‏‏‎‎‎‎‎‎‏‎‎‏‎‎‎‎‏‏‏‏‏‏‏‏‎‎‎‏‏‏‎‏‎‏‏‏‎‏‎‏‎‏‏‎‏‎‏‎‎‏‏‏‎‏‏‎‎‎‏‏‏‎‎‏‎‏‏‎‏‎‎‏‎‎‎‏‏‎‎‏‏‎‏‏‎‎‎Overlay #‎‏‎‎‏‏‎<xliff:g id="ID">%1$d</xliff:g>‎‏‎‎‏‏‏‎‎‏‎‎‏‎"</string>
     <string name="display_manager_overlay_display_title" msgid="652124517672257172">"‎‏‎‎‎‎‎‏‎‏‏‏‎‎‎‎‎‎‏‎‎‏‎‎‎‎‏‏‏‏‏‎‎‏‎‎‏‎‎‎‎‏‏‎‎‏‏‎‎‏‏‏‏‏‏‎‎‏‎‏‏‎‎‏‏‎‎‎‏‎‎‏‎‏‏‎‏‏‎‎‎‎‏‏‎‏‎‎‏‎‏‎‎‎‎‏‎‎‏‏‎<xliff:g id="NAME">%1$s</xliff:g>‎‏‎‎‏‏‏‎: ‎‏‎‎‏‏‎<xliff:g id="WIDTH">%2$d</xliff:g>‎‏‎‎‏‏‏‎x‎‏‎‎‏‏‎<xliff:g id="HEIGHT">%3$d</xliff:g>‎‏‎‎‏‏‏‎, ‎‏‎‎‏‏‎<xliff:g id="DPI">%4$d</xliff:g>‎‏‎‎‏‏‏‎ dpi‎‏‎‎‏‎"</string>
     <string name="display_manager_overlay_display_secure_suffix" msgid="6022119702628572080">"‎‏‎‎‎‎‎‏‎‏‏‏‎‎‎‎‎‎‏‎‎‏‎‎‎‎‏‏‏‏‏‏‏‏‎‏‎‎‏‏‏‎‎‏‎‎‏‎‏‏‎‏‏‏‎‏‏‏‏‏‎‏‏‎‏‎‎‎‎‏‏‎‎‎‎‎‏‏‏‎‏‎‎‏‏‎‏‏‏‎‏‏‎‎‎‎‎, secure‎‏‎‎‏‎"</string>
+    <string name="activity_starter_block_bg_activity_starts_permissive" msgid="5692097903712956720">"‎‏‎‎‎‎‎‏‎‏‏‏‎‎‎‎‎‎‏‎‎‏‎‎‎‎‏‏‏‏‏‏‏‏‎‎‏‏‏‎‏‏‏‏‏‏‏‎‎‏‏‎‎‏‎‎‏‏‏‎‎‎‏‎‏‎‏‎‏‎‎‏‏‎‎‎‏‏‏‎‎‏‏‏‎‎‎‏‎‎‏‏‎‎‎‎‎This background activity start from ‎‏‎‎‏‏‎<xliff:g id="PACKAGENAME">%1$s</xliff:g>‎‏‎‎‏‏‏‎ will be blocked in future Q builds. See go/q-bg-block.‎‏‎‎‏‎"</string>
+    <string name="activity_starter_block_bg_activity_starts_enforcing" msgid="8299522481076404353">"‎‏‎‎‎‎‎‏‎‏‏‏‎‎‎‎‎‎‏‎‎‏‎‎‎‎‏‏‏‏‏‏‏‏‏‏‎‎‏‏‎‎‏‎‏‏‎‏‏‏‎‏‎‎‏‏‏‎‏‏‏‎‎‏‎‏‎‎‏‎‎‏‏‏‏‎‏‏‎‏‏‎‎‎‎‎‎‎‏‎‎‎‎‎‎‏‎Background activity start from ‎‏‎‎‏‏‎<xliff:g id="PACKAGENAME">%1$s</xliff:g>‎‏‎‎‏‏‏‎ blocked. See go/q-bg-block.‎‏‎‎‏‎"</string>
     <string name="kg_forgot_pattern_button_text" msgid="8852021467868220608">"‎‏‎‎‎‎‎‏‎‏‏‏‎‎‎‎‎‎‏‎‎‏‎‎‎‎‏‏‏‏‏‏‏‏‏‏‏‎‏‎‏‏‎‏‏‎‎‎‏‎‏‏‎‎‏‎‏‎‏‎‎‎‎‎‎‎‎‎‎‎‎‎‎‏‏‎‏‎‏‎‏‏‎‎‏‏‎‎‏‏‎‎‎‎‎‎‎Forgot Pattern‎‏‎‎‏‎"</string>
     <string name="kg_wrong_pattern" msgid="1850806070801358830">"‎‏‎‎‎‎‎‏‎‏‏‏‎‎‎‎‎‎‏‎‎‏‎‎‎‎‏‏‏‏‏‎‏‏‏‎‎‏‏‎‏‎‏‏‏‏‎‏‏‎‎‎‏‎‎‏‎‏‎‎‎‎‏‎‏‏‏‏‏‎‎‏‎‎‎‎‎‎‎‏‎‏‏‏‏‏‏‏‏‎‏‏‏‎‎Wrong Pattern‎‏‎‎‏‎"</string>
     <string name="kg_wrong_password" msgid="2333281762128113157">"‎‏‎‎‎‎‎‏‎‏‏‏‎‎‎‎‎‎‏‎‎‏‎‎‎‎‏‏‏‏‏‏‎‏‎‎‎‎‎‎‏‏‎‎‎‎‏‎‏‏‏‏‎‏‏‎‏‏‎‎‏‏‎‏‎‎‎‎‎‎‎‏‎‎‎‏‎‏‏‎‎‏‎‏‏‏‎‎‎‎‎‎‏‎‏‎Wrong Password‎‏‎‎‏‎"</string>
@@ -1996,9 +1997,29 @@
     <string name="dynamic_mode_notification_channel_name" msgid="2348803891571320452">"‎‏‎‎‎‎‎‏‎‏‏‏‎‎‎‎‎‎‏‎‎‏‎‎‎‎‏‏‏‏‏‏‎‏‎‎‎‎‎‏‎‎‏‏‎‎‎‏‎‏‎‎‎‎‎‏‎‏‏‎‎‎‏‏‏‏‎‎‏‎‎‎‎‏‎‏‎‎‏‏‏‏‎‎‏‏‎‏‎‎‎‎‏‎‎‎Routine Mode info notification‎‏‎‎‏‎"</string>
     <string name="dynamic_mode_notification_title" msgid="508815255807182035">"‎‏‎‎‎‎‎‏‎‏‏‏‎‎‎‎‎‎‏‎‎‏‎‎‎‎‏‏‏‏‎‏‏‏‏‏‎‎‎‎‏‏‏‏‏‎‏‎‏‏‎‎‏‏‎‎‎‏‏‏‏‎‎‎‎‎‏‎‏‎‏‎‏‏‏‏‏‏‎‎‎‏‎‎‏‏‎‏‎‎‏‏‎Battery may run out before usual charge‎‏‎‎‏‎"</string>
     <string name="dynamic_mode_notification_summary" msgid="2541166298550402690">"‎‏‎‎‎‎‎‏‎‏‏‏‎‎‎‎‎‎‏‎‎‏‎‎‎‎‏‏‏‏‏‏‎‏‎‎‎‏‏‎‏‎‎‎‏‎‎‎‎‎‎‏‎‎‏‎‏‎‎‏‎‎‎‏‏‏‎‏‏‎‎‎‏‎‎‏‎‏‎‎‏‏‏‏‏‏‎‏‎‎‎‎‎‏‎‎Battery Saver activated to extend battery life‎‏‎‎‏‎"</string>
+    <string name="mime_type_folder" msgid="7111951698626315204">"‎‏‎‎‎‎‎‏‎‏‏‏‎‎‎‎‎‎‏‎‎‏‎‎‎‎‏‏‏‏‏‏‏‏‏‎‎‎‏‎‏‎‏‏‎‎‏‎‏‎‏‏‏‎‏‎‎‏‏‎‎‎‏‏‏‎‏‎‎‎‎‎‎‏‎‏‏‎‏‏‏‎‎‎‎‎‏‏‏‏‎‎‎‏‎‎‎Folder‎‏‎‎‏‎"</string>
+    <string name="mime_type_apk" msgid="5518003630972506900">"‎‏‎‎‎‎‎‏‎‏‏‏‎‎‎‎‎‎‏‎‎‏‎‎‎‎‏‏‏‏‏‏‏‏‎‎‏‏‎‎‏‎‎‏‎‎‏‏‏‏‏‎‎‎‏‏‎‎‎‏‎‎‎‏‎‎‎‏‎‏‎‏‎‏‏‎‏‏‏‎‏‎‎‏‎‎‏‏‎‎‎‏‎‏‎‎‎Android application‎‏‎‎‏‎"</string>
+    <string name="mime_type_generic" msgid="6833871596845900027">"‎‏‎‎‎‎‎‏‎‏‏‏‎‎‎‎‎‎‏‎‎‏‎‎‎‎‏‏‏‏‏‏‏‏‎‏‏‏‏‎‏‏‎‏‎‏‏‎‏‏‎‎‏‎‏‎‎‎‎‎‎‎‏‎‏‎‎‎‏‎‏‎‏‎‏‎‎‎‎‏‏‎‏‎‎‎‎‎‏‏‏‏‏‎‏‏‎File‎‏‎‎‏‎"</string>
+    <string name="mime_type_generic_ext" msgid="8450275970061657174">"‎‏‎‎‎‎‎‏‎‏‏‏‎‎‎‎‎‎‏‎‎‏‎‎‎‎‏‏‏‏‏‏‏‏‏‏‎‏‎‏‎‏‎‎‎‏‎‏‎‏‏‎‏‎‎‏‎‎‏‏‏‎‎‏‎‎‏‎‏‎‎‏‏‎‎‎‏‎‏‏‎‏‏‎‎‏‎‎‎‏‎‏‎‏‏‎‎‎‏‎‎‏‏‎<xliff:g id="EXTENSION">%1$s</xliff:g>‎‏‎‎‏‏‏‎ file‎‏‎‎‏‎"</string>
+    <string name="mime_type_audio" msgid="6289777657172050926">"‎‏‎‎‎‎‎‏‎‏‏‏‎‎‎‎‎‎‏‎‎‏‎‎‎‎‏‏‏‏‏‏‏‏‎‏‎‏‏‏‎‏‎‎‏‎‎‏‏‏‎‎‎‏‏‏‎‏‏‏‎‏‎‎‎‏‎‏‏‎‏‏‏‏‏‎‏‏‎‏‏‏‎‎‎‎‏‏‏‏‏‎‏‏‏‎‎Audio‎‏‎‎‏‎"</string>
+    <string name="mime_type_audio_ext" msgid="3270880987725816210">"‎‏‎‎‎‎‎‏‎‏‏‏‎‎‎‎‎‎‏‎‎‏‎‎‎‎‏‏‏‏‏‏‎‏‎‏‏‎‏‎‏‏‎‎‏‎‎‏‎‎‎‎‎‎‎‏‏‏‎‏‏‎‏‏‎‏‎‏‏‏‏‏‏‏‏‏‎‎‏‏‏‏‎‎‎‎‏‏‎‎‏‎‎‏‎‎‎‏‎‎‏‏‎<xliff:g id="EXTENSION">%1$s</xliff:g>‎‏‎‎‏‏‏‎ audio‎‏‎‎‏‎"</string>
+    <string name="mime_type_video" msgid="4093025777317307426">"‎‏‎‎‎‎‎‏‎‏‏‏‎‎‎‎‎‎‏‎‎‏‎‎‎‎‏‏‏‏‏‏‎‏‏‏‎‎‎‏‏‎‎‏‏‎‏‎‏‎‏‏‎‎‏‎‏‎‎‎‎‏‎‎‎‏‏‏‎‎‏‏‎‎‎‎‎‏‏‏‏‏‎‎‏‎‎‎‎‏‎‎‎‏‎‎Video‎‏‎‎‏‎"</string>
+    <string name="mime_type_video_ext" msgid="5643771615714173159">"‎‏‎‎‎‎‎‏‎‏‏‏‎‎‎‎‎‎‏‎‎‏‎‎‎‎‏‏‏‏‏‏‏‏‎‎‏‏‏‎‎‏‎‏‎‎‏‎‏‎‏‏‎‏‎‎‎‏‏‎‎‎‎‏‏‏‏‎‏‏‎‎‎‎‎‏‎‎‏‏‎‏‏‎‎‎‎‎‏‏‏‎‎‏‏‏‎‎‏‎‎‏‏‎<xliff:g id="EXTENSION">%1$s</xliff:g>‎‏‎‎‏‏‏‎ video‎‏‎‎‏‎"</string>
+    <string name="mime_type_image" msgid="3144284451605236371">"‎‏‎‎‎‎‎‏‎‏‏‏‎‎‎‎‎‎‏‎‎‏‎‎‎‎‏‏‏‏‏‏‎‏‎‏‎‏‏‏‎‏‎‎‎‏‎‏‎‏‏‏‏‏‎‎‎‎‎‏‏‎‎‏‎‏‏‎‎‏‎‏‎‏‏‎‏‏‎‏‏‎‎‏‎‏‎‏‎‎‏‎‎‏‏‎Image‎‏‎‎‏‎"</string>
+    <string name="mime_type_image_ext" msgid="1514613218742736590">"‎‏‎‎‎‎‎‏‎‏‏‏‎‎‎‎‎‎‏‎‎‏‎‎‎‎‏‏‏‏‏‎‏‏‎‏‎‏‎‎‎‎‎‏‎‎‏‏‏‏‏‏‎‎‏‎‏‏‎‎‏‎‏‎‎‏‏‎‏‏‎‏‎‎‎‏‎‏‏‎‎‏‎‏‏‎‏‏‎‎‏‏‏‎‎‎‏‎‎‏‏‎<xliff:g id="EXTENSION">%1$s</xliff:g>‎‏‎‎‏‏‏‎ image‎‏‎‎‏‎"</string>
+    <string name="mime_type_compressed" msgid="1645486037074943257">"‎‏‎‎‎‎‎‏‎‏‏‏‎‎‎‎‎‎‏‎‎‏‎‎‎‎‏‏‏‏‏‎‏‏‎‏‏‎‏‏‎‏‎‏‎‏‏‏‏‏‎‎‎‎‏‏‎‏‎‏‎‏‎‎‏‎‎‎‏‎‏‎‏‏‎‏‏‏‏‎‎‏‏‏‎‏‎‎‎‏‏‎‎‏‎Archive‎‏‎‎‏‎"</string>
+    <string name="mime_type_compressed_ext" msgid="4232293058067801528">"‎‏‎‎‎‎‎‏‎‏‏‏‎‎‎‎‎‎‏‎‎‏‎‎‎‎‏‏‏‏‏‏‎‏‏‏‎‏‎‏‎‏‏‏‏‎‎‎‎‏‎‎‎‎‎‎‎‎‏‏‏‎‎‏‏‎‏‎‏‏‏‎‏‏‏‏‎‏‏‏‎‏‎‎‏‎‏‏‎‏‏‏‎‎‎‎‎‏‎‎‏‏‎<xliff:g id="EXTENSION">%1$s</xliff:g>‎‏‎‎‏‏‏‎ archive‎‏‎‎‏‎"</string>
+    <string name="mime_type_document" msgid="1596838147256375966">"‎‏‎‎‎‎‎‏‎‏‏‏‎‎‎‎‎‎‏‎‎‏‎‎‎‎‏‏‏‏‏‎‏‏‎‏‏‎‎‎‏‎‏‎‎‏‎‎‎‏‏‎‏‏‏‏‎‏‎‏‎‏‏‎‏‎‎‎‏‏‎‎‎‎‎‎‏‎‎‏‎‏‏‎‏‎‏‎‎‏‏‏‏‎‎Document‎‏‎‎‏‎"</string>
+    <string name="mime_type_document_ext" msgid="6327266601345501281">"‎‏‎‎‎‎‎‏‎‏‏‏‎‎‎‎‎‎‏‎‎‏‎‎‎‎‏‏‏‏‏‏‏‏‎‏‎‏‏‏‏‏‎‎‏‏‏‎‏‏‏‏‎‏‏‏‎‏‏‏‎‎‏‏‎‏‎‏‏‏‎‎‎‏‏‎‎‏‎‎‎‏‎‎‏‎‎‎‎‏‏‎‎‎‎‏‎‎‏‎‎‏‏‎<xliff:g id="EXTENSION">%1$s</xliff:g>‎‏‎‎‏‏‏‎ document‎‏‎‎‏‎"</string>
+    <string name="mime_type_spreadsheet" msgid="2639138255207123557">"‎‏‎‎‎‎‎‏‎‏‏‏‎‎‎‎‎‎‏‎‎‏‎‎‎‎‏‏‏‏‏‏‎‏‎‎‏‎‎‏‎‏‎‎‎‎‎‎‎‎‏‏‎‏‎‎‏‎‎‎‎‏‎‏‎‏‎‎‏‏‎‏‏‎‎‎‎‏‏‏‏‎‎‏‎‏‎‎‏‏‎‎‏‎‏‎Spreadsheet‎‏‎‎‏‎"</string>
+    <string name="mime_type_spreadsheet_ext" msgid="5508653032786106725">"‎‏‎‎‎‎‎‏‎‏‏‏‎‎‎‎‎‎‏‎‎‏‎‎‎‎‏‏‏‏‏‏‏‏‎‎‏‏‎‎‎‏‏‏‎‎‏‎‏‎‏‎‏‎‏‎‏‎‏‏‏‏‏‏‎‏‎‎‏‎‏‎‎‎‎‏‏‎‎‎‎‎‎‏‏‎‎‏‎‏‏‎‎‏‎‏‎‎‏‎‎‏‏‎<xliff:g id="EXTENSION">%1$s</xliff:g>‎‏‎‎‏‏‏‎ spreadsheet‎‏‎‎‏‎"</string>
+    <string name="mime_type_presentation" msgid="6145604688774787357">"‎‏‎‎‎‎‎‏‎‏‏‏‎‎‎‎‎‎‏‎‎‏‎‎‎‎‏‏‏‏‏‏‏‏‎‏‎‏‎‏‎‏‎‎‏‎‎‏‏‎‎‏‎‎‏‎‏‏‏‎‎‏‏‏‎‏‎‏‎‏‎‎‎‏‏‎‎‏‎‏‎‏‏‏‎‎‎‏‎‎‎‏‏‏‎‏‎Presentation‎‏‎‎‏‎"</string>
+    <string name="mime_type_presentation_ext" msgid="2982650207774823437">"‎‏‎‎‎‎‎‏‎‏‏‏‎‎‎‎‎‎‏‎‎‏‎‎‎‎‏‏‏‏‏‏‎‏‎‏‎‎‏‎‏‏‎‎‏‎‎‏‎‎‎‎‎‎‎‏‎‎‎‏‏‏‏‏‎‏‎‏‎‏‏‏‎‏‎‏‎‎‏‏‏‎‏‎‏‎‎‎‎‎‎‏‏‎‏‎‎‏‎‎‏‏‎<xliff:g id="EXTENSION">%1$s</xliff:g>‎‏‎‎‏‏‏‎ presentation‎‏‎‎‏‎"</string>
     <string name="car_loading_profile" msgid="3545132581795684027">"‎‏‎‎‎‎‎‏‎‏‏‏‎‎‎‎‎‎‏‎‎‏‎‎‎‎‏‏‏‏‏‏‎‏‏‎‎‎‏‎‎‏‏‎‎‏‎‏‏‎‏‎‏‏‏‎‏‎‎‏‏‎‎‏‏‎‏‏‎‏‏‏‎‎‏‏‎‎‎‎‏‎‏‏‏‏‎‏‎‏‏‏‎‏‏‎Loading‎‏‎‎‏‎"</string>
     <plurals name="file_count" formatted="false" msgid="1628600959752419449">
       <item quantity="other">‎‏‎‎‎‎‎‏‎‏‏‏‎‎‎‎‎‎‏‎‎‏‎‎‎‎‏‏‏‏‏‎‏‏‎‏‏‎‏‎‎‏‏‎‎‏‏‏‏‏‎‎‏‏‏‏‏‏‎‎‎‏‏‎‏‏‎‏‏‎‏‏‏‎‎‏‏‏‎‎‏‏‏‎‎‎‎‏‏‏‏‎‎‏‎‎‏‎‎‏‏‎<xliff:g id="FILE_NAME_2">%s</xliff:g>‎‏‎‎‏‏‏‎ + ‎‏‎‎‏‏‎<xliff:g id="COUNT_3">%d</xliff:g>‎‏‎‎‏‏‏‎ files‎‏‎‎‏‎</item>
       <item quantity="one">‎‏‎‎‎‎‎‏‎‏‏‏‎‎‎‎‎‎‏‎‎‏‎‎‎‎‏‏‏‏‏‎‏‏‎‏‏‎‏‎‎‏‏‎‎‏‏‏‏‏‎‎‏‏‏‏‏‏‎‎‎‏‏‎‏‏‎‏‏‎‏‏‏‎‎‏‏‏‎‎‏‏‏‎‎‎‎‏‏‏‏‎‎‏‎‎‏‎‎‏‏‎<xliff:g id="FILE_NAME_0">%s</xliff:g>‎‏‎‎‏‏‏‎ + ‎‏‎‎‏‏‎<xliff:g id="COUNT_1">%d</xliff:g>‎‏‎‎‏‏‏‎ file‎‏‎‎‏‎</item>
     </plurals>
+    <!-- no translation found for chooser_no_direct_share_targets (997970693708458895) -->
+    <skip />
 </resources>
diff --git a/core/res/res/values-es-rUS/strings.xml b/core/res/res/values-es-rUS/strings.xml
index 505a184..387eea3 100644
--- a/core/res/res/values-es-rUS/strings.xml
+++ b/core/res/res/values-es-rUS/strings.xml
@@ -308,15 +308,15 @@
     <string name="permgrouplab_phone" msgid="5229115638567440675">"Teléfono"</string>
     <string name="permgroupdesc_phone" msgid="6234224354060641055">"hacer y administrar llamadas telefónicas"</string>
     <string name="permgrouprequest_phone" msgid="9166979577750581037">"¿Permitir que &lt;b&gt;<xliff:g id="APP_NAME">%1$s</xliff:g>&lt;/b&gt; haga y administre las llamadas telefónicas?"</string>
-    <string name="permgrouplab_sensors" msgid="416037179223226722">"Sensores corporales"</string>
+    <string name="permgrouplab_sensors" msgid="4838614103153567532">"Sensores corporales"</string>
     <string name="permgroupdesc_sensors" msgid="7147968539346634043">"acceder a los datos del sensor acerca de tus signos vitales"</string>
     <string name="permgrouprequest_sensors" msgid="6349806962814556786">"¿Permitir que &lt;b&gt;<xliff:g id="APP_NAME">%1$s</xliff:g>&lt;/b&gt; acceda a los datos del sensor de tus signos vitales?"</string>
     <string name="permgrouplab_aural" msgid="965607064083134896">"Música"</string>
     <string name="permgroupdesc_aural" msgid="4870189506255958055">"acceder a tu música"</string>
     <string name="permgrouprequest_aural" msgid="6787926123071735620">"¿Quieres permitir que &lt;b&gt;<xliff:g id="APP_NAME">%1$s</xliff:g>&lt;/b&gt; acceda a tu música?"</string>
-    <string name="permgrouplab_visual" msgid="8030190588123857921">"Fotos y videos"</string>
+    <string name="permgrouplab_visual" msgid="6477382108771145134">"Fotos y videos"</string>
     <string name="permgroupdesc_visual" msgid="3415827902566663546">"acceder a tus fotos y videos"</string>
-    <string name="permgrouprequest_visual" msgid="6907523945030290376">"¿Quieres permitir que &lt;b&gt;<xliff:g id="APP_NAME">%1$s</xliff:g>&lt;/b&gt; acceda a tus fotos y videos?"</string>
+    <string name="permgrouprequest_visual" msgid="3043752127595243314">"¿Permitir que &lt;b&gt;<xliff:g id="APP_NAME">%1$s</xliff:g>&lt;/b&gt; acceda a tus fotos y videos, incluidas las ubicaciones etiquetadas?"</string>
     <string name="capability_title_canRetrieveWindowContent" msgid="3901717936930170320">"Recuperar el contenido de las ventanas"</string>
     <string name="capability_desc_canRetrieveWindowContent" msgid="3772225008605310672">"Inspecciona el contenido de la ventana con la que estés interactuando."</string>
     <string name="capability_title_canRequestTouchExploration" msgid="3108723364676667320">"Activar la Exploración táctil"</string>
@@ -1396,8 +1396,7 @@
     <string name="ext_media_init_action" msgid="7952885510091978278">"Configurar"</string>
     <string name="ext_media_unmount_action" msgid="1121883233103278199">"Expulsar"</string>
     <string name="ext_media_browse_action" msgid="8322172381028546087">"Explorar"</string>
-    <!-- no translation found for ext_media_seamless_action (6575980560886881233) -->
-    <skip />
+    <string name="ext_media_seamless_action" msgid="6575980560886881233">"Cambiar salida"</string>
     <string name="ext_media_missing_title" msgid="620980315821543904">"No se encuentra dispositivo <xliff:g id="NAME">%s</xliff:g>."</string>
     <string name="ext_media_missing_message" msgid="4012389235250987930">"Vuelve a insertar dispositivo"</string>
     <string name="ext_media_move_specific_title" msgid="1471100343872375842">"Transfiriendo la aplicación <xliff:g id="NAME">%s</xliff:g>"</string>
@@ -1611,6 +1610,8 @@
     <string name="display_manager_overlay_display_name" msgid="5142365982271620716">"Superposición #<xliff:g id="ID">%1$d</xliff:g>"</string>
     <string name="display_manager_overlay_display_title" msgid="652124517672257172">"<xliff:g id="NAME">%1$s</xliff:g>: <xliff:g id="WIDTH">%2$d</xliff:g> x <xliff:g id="HEIGHT">%3$d</xliff:g>, <xliff:g id="DPI">%4$d</xliff:g> ppp"</string>
     <string name="display_manager_overlay_display_secure_suffix" msgid="6022119702628572080">", segura"</string>
+    <string name="activity_starter_block_bg_activity_starts_permissive" msgid="5692097903712956720">"En las próximas compilaciones de Q, se bloqueará el inicio de la actividad en segundo plano de <xliff:g id="PACKAGENAME">%1$s</xliff:g>. Consulta go/q-bg-block."</string>
+    <string name="activity_starter_block_bg_activity_starts_enforcing" msgid="8299522481076404353">"Se bloqueó el inicio de la actividad en segundo plano de <xliff:g id="PACKAGENAME">%1$s</xliff:g>. Consulta go/q-bg-block."</string>
     <string name="kg_forgot_pattern_button_text" msgid="8852021467868220608">"¿Olvidaste el patrón?"</string>
     <string name="kg_wrong_pattern" msgid="1850806070801358830">"Patrón incorrecto"</string>
     <string name="kg_wrong_password" msgid="2333281762128113157">"Contraseña incorrecta"</string>
@@ -1996,9 +1997,29 @@
     <string name="dynamic_mode_notification_channel_name" msgid="2348803891571320452">"Notificación de información del modo de Rutinas"</string>
     <string name="dynamic_mode_notification_title" msgid="508815255807182035">"Es posible que la batería se agote antes de la carga habitual"</string>
     <string name="dynamic_mode_notification_summary" msgid="2541166298550402690">"Se activó el Ahorro de batería para extender la duración de la batería"</string>
+    <string name="mime_type_folder" msgid="7111951698626315204">"Carpeta"</string>
+    <string name="mime_type_apk" msgid="5518003630972506900">"Aplicación de Android"</string>
+    <string name="mime_type_generic" msgid="6833871596845900027">"Archivo"</string>
+    <string name="mime_type_generic_ext" msgid="8450275970061657174">"Archivo <xliff:g id="EXTENSION">%1$s</xliff:g>"</string>
+    <string name="mime_type_audio" msgid="6289777657172050926">"Audio"</string>
+    <string name="mime_type_audio_ext" msgid="3270880987725816210">"Audio <xliff:g id="EXTENSION">%1$s</xliff:g>"</string>
+    <string name="mime_type_video" msgid="4093025777317307426">"Video"</string>
+    <string name="mime_type_video_ext" msgid="5643771615714173159">"Video <xliff:g id="EXTENSION">%1$s</xliff:g>"</string>
+    <string name="mime_type_image" msgid="3144284451605236371">"Imagen"</string>
+    <string name="mime_type_image_ext" msgid="1514613218742736590">"Imagen <xliff:g id="EXTENSION">%1$s</xliff:g>"</string>
+    <string name="mime_type_compressed" msgid="1645486037074943257">"Archivo"</string>
+    <string name="mime_type_compressed_ext" msgid="4232293058067801528">"Archivo <xliff:g id="EXTENSION">%1$s</xliff:g>"</string>
+    <string name="mime_type_document" msgid="1596838147256375966">"Documento"</string>
+    <string name="mime_type_document_ext" msgid="6327266601345501281">"Documento <xliff:g id="EXTENSION">%1$s</xliff:g>"</string>
+    <string name="mime_type_spreadsheet" msgid="2639138255207123557">"Hoja de cálculo"</string>
+    <string name="mime_type_spreadsheet_ext" msgid="5508653032786106725">"Hoja de cálculo <xliff:g id="EXTENSION">%1$s</xliff:g>"</string>
+    <string name="mime_type_presentation" msgid="6145604688774787357">"Presentación"</string>
+    <string name="mime_type_presentation_ext" msgid="2982650207774823437">"Presentación <xliff:g id="EXTENSION">%1$s</xliff:g>"</string>
     <string name="car_loading_profile" msgid="3545132581795684027">"Cargando"</string>
     <plurals name="file_count" formatted="false" msgid="1628600959752419449">
-      <item quantity="other"><xliff:g id="FILE_NAME_2">%s</xliff:g> y <xliff:g id="COUNT_3">%d</xliff:g> archivos</item>
-      <item quantity="one"><xliff:g id="FILE_NAME_0">%s</xliff:g> y <xliff:g id="COUNT_1">%d</xliff:g> archivo</item>
+      <item quantity="other"><xliff:g id="FILE_NAME_2">%s</xliff:g> y <xliff:g id="COUNT_3">%d</xliff:g> archivos más</item>
+      <item quantity="one"><xliff:g id="FILE_NAME_0">%s</xliff:g> y <xliff:g id="COUNT_1">%d</xliff:g> archivo más</item>
     </plurals>
+    <!-- no translation found for chooser_no_direct_share_targets (997970693708458895) -->
+    <skip />
 </resources>
diff --git a/core/res/res/values-es/strings.xml b/core/res/res/values-es/strings.xml
index db6b710..017f31b 100644
--- a/core/res/res/values-es/strings.xml
+++ b/core/res/res/values-es/strings.xml
@@ -308,15 +308,15 @@
     <string name="permgrouplab_phone" msgid="5229115638567440675">"Teléfono"</string>
     <string name="permgroupdesc_phone" msgid="6234224354060641055">"hacer y administrar llamadas telefónicas"</string>
     <string name="permgrouprequest_phone" msgid="9166979577750581037">"¿Quieres permitir que &lt;b&gt;<xliff:g id="APP_NAME">%1$s</xliff:g>&lt;/b&gt; haga y gestione llamadas?"</string>
-    <string name="permgrouplab_sensors" msgid="416037179223226722">"Sensores corporales"</string>
+    <string name="permgrouplab_sensors" msgid="4838614103153567532">"Sensores corporales"</string>
     <string name="permgroupdesc_sensors" msgid="7147968539346634043">"acceder a datos de sensores de tus constantes vitales"</string>
     <string name="permgrouprequest_sensors" msgid="6349806962814556786">"¿Quieres permitir que &lt;b&gt;<xliff:g id="APP_NAME">%1$s</xliff:g>&lt;/b&gt; acceda a los datos del sensor sobre tus constantes vitales?"</string>
     <string name="permgrouplab_aural" msgid="965607064083134896">"Música"</string>
     <string name="permgroupdesc_aural" msgid="4870189506255958055">"acceder a tu música"</string>
     <string name="permgrouprequest_aural" msgid="6787926123071735620">"¿Quieres permitir que &lt;b&gt;<xliff:g id="APP_NAME">%1$s</xliff:g>&lt;/b&gt; acceda a tu música?"</string>
-    <string name="permgrouplab_visual" msgid="8030190588123857921">"Fotos y vídeos"</string>
+    <string name="permgrouplab_visual" msgid="6477382108771145134">"Fotos y vídeos"</string>
     <string name="permgroupdesc_visual" msgid="3415827902566663546">"acceder a tus fotos y vídeos"</string>
-    <string name="permgrouprequest_visual" msgid="6907523945030290376">"¿Quieres permitir que &lt;b&gt;<xliff:g id="APP_NAME">%1$s</xliff:g>&lt;/b&gt; acceda a tus fotos y vídeos?"</string>
+    <string name="permgrouprequest_visual" msgid="3043752127595243314">"¿Quieres permitir que &lt;b&gt;<xliff:g id="APP_NAME">%1$s</xliff:g>&lt;/b&gt; acceda a tus fotos y vídeos, así como a las ubicaciones etiquetadas?"</string>
     <string name="capability_title_canRetrieveWindowContent" msgid="3901717936930170320">"Comprobar el contenido de la ventana"</string>
     <string name="capability_desc_canRetrieveWindowContent" msgid="3772225008605310672">"Inspecciona el contenido de una ventana con la que estés interactuando."</string>
     <string name="capability_title_canRequestTouchExploration" msgid="3108723364676667320">"Activar la exploración táctil"</string>
@@ -1396,8 +1396,7 @@
     <string name="ext_media_init_action" msgid="7952885510091978278">"Configurar"</string>
     <string name="ext_media_unmount_action" msgid="1121883233103278199">"Expulsar"</string>
     <string name="ext_media_browse_action" msgid="8322172381028546087">"Explorar"</string>
-    <!-- no translation found for ext_media_seamless_action (6575980560886881233) -->
-    <skip />
+    <string name="ext_media_seamless_action" msgid="6575980560886881233">"Cambiar salida"</string>
     <string name="ext_media_missing_title" msgid="620980315821543904">"Falta <xliff:g id="NAME">%s</xliff:g>"</string>
     <string name="ext_media_missing_message" msgid="4012389235250987930">"Introduce el dispositivo"</string>
     <string name="ext_media_move_specific_title" msgid="1471100343872375842">"Moviendo <xliff:g id="NAME">%s</xliff:g>"</string>
@@ -1611,6 +1610,8 @@
     <string name="display_manager_overlay_display_name" msgid="5142365982271620716">"Superposición #<xliff:g id="ID">%1$d</xliff:g>"</string>
     <string name="display_manager_overlay_display_title" msgid="652124517672257172">"<xliff:g id="NAME">%1$s</xliff:g>: <xliff:g id="WIDTH">%2$d</xliff:g> x <xliff:g id="HEIGHT">%3$d</xliff:g>, <xliff:g id="DPI">%4$d</xliff:g> dpi"</string>
     <string name="display_manager_overlay_display_secure_suffix" msgid="6022119702628572080">", seguro"</string>
+    <string name="activity_starter_block_bg_activity_starts_permissive" msgid="5692097903712956720">"El inicio de la actividad en segundo plano de <xliff:g id="PACKAGENAME">%1$s</xliff:g> se bloqueará en las próximas compilaciones de Q. Consulta la página go/q-bg-block."</string>
+    <string name="activity_starter_block_bg_activity_starts_enforcing" msgid="8299522481076404353">"Se ha bloqueado el inicio de la actividad en segundo plano de <xliff:g id="PACKAGENAME">%1$s</xliff:g>. Consulta la página go/q-bg-block."</string>
     <string name="kg_forgot_pattern_button_text" msgid="8852021467868220608">"¿Has olvidado el patrón?"</string>
     <string name="kg_wrong_pattern" msgid="1850806070801358830">"El patrón es incorrecto"</string>
     <string name="kg_wrong_password" msgid="2333281762128113157">"Contraseña incorrecta"</string>
@@ -1996,9 +1997,29 @@
     <string name="dynamic_mode_notification_channel_name" msgid="2348803891571320452">"Notificación sobre el modo rutina"</string>
     <string name="dynamic_mode_notification_title" msgid="508815255807182035">"Es posible que te quedes sin batería antes de lo habitual"</string>
     <string name="dynamic_mode_notification_summary" msgid="2541166298550402690">"Se ha activado el ahorro de batería para aumentar la duración de la batería"</string>
+    <string name="mime_type_folder" msgid="7111951698626315204">"Carpeta"</string>
+    <string name="mime_type_apk" msgid="5518003630972506900">"Aplicación de Android"</string>
+    <string name="mime_type_generic" msgid="6833871596845900027">"Archivo"</string>
+    <string name="mime_type_generic_ext" msgid="8450275970061657174">"Archivo <xliff:g id="EXTENSION">%1$s</xliff:g>"</string>
+    <string name="mime_type_audio" msgid="6289777657172050926">"Audio"</string>
+    <string name="mime_type_audio_ext" msgid="3270880987725816210">"Audio: <xliff:g id="EXTENSION">%1$s</xliff:g>"</string>
+    <string name="mime_type_video" msgid="4093025777317307426">"Vídeo"</string>
+    <string name="mime_type_video_ext" msgid="5643771615714173159">"Vídeo <xliff:g id="EXTENSION">%1$s</xliff:g>"</string>
+    <string name="mime_type_image" msgid="3144284451605236371">"Imagen"</string>
+    <string name="mime_type_image_ext" msgid="1514613218742736590">"Imagen <xliff:g id="EXTENSION">%1$s</xliff:g>"</string>
+    <string name="mime_type_compressed" msgid="1645486037074943257">"Archivo"</string>
+    <string name="mime_type_compressed_ext" msgid="4232293058067801528">"Archivo <xliff:g id="EXTENSION">%1$s</xliff:g>"</string>
+    <string name="mime_type_document" msgid="1596838147256375966">"Documento"</string>
+    <string name="mime_type_document_ext" msgid="6327266601345501281">"Documento <xliff:g id="EXTENSION">%1$s</xliff:g>"</string>
+    <string name="mime_type_spreadsheet" msgid="2639138255207123557">"Hoja de cálculo"</string>
+    <string name="mime_type_spreadsheet_ext" msgid="5508653032786106725">"Hoja de cálculo <xliff:g id="EXTENSION">%1$s</xliff:g>"</string>
+    <string name="mime_type_presentation" msgid="6145604688774787357">"Presentación"</string>
+    <string name="mime_type_presentation_ext" msgid="2982650207774823437">"Presentación <xliff:g id="EXTENSION">%1$s</xliff:g>"</string>
     <string name="car_loading_profile" msgid="3545132581795684027">"Cargando"</string>
     <plurals name="file_count" formatted="false" msgid="1628600959752419449">
       <item quantity="other"><xliff:g id="FILE_NAME_2">%s</xliff:g> y <xliff:g id="COUNT_3">%d</xliff:g> archivos</item>
       <item quantity="one"><xliff:g id="FILE_NAME_0">%s</xliff:g> y <xliff:g id="COUNT_1">%d</xliff:g> archivo</item>
     </plurals>
+    <!-- no translation found for chooser_no_direct_share_targets (997970693708458895) -->
+    <skip />
 </resources>
diff --git a/core/res/res/values-et/strings.xml b/core/res/res/values-et/strings.xml
index e16cb6a..f87743a 100644
--- a/core/res/res/values-et/strings.xml
+++ b/core/res/res/values-et/strings.xml
@@ -308,15 +308,15 @@
     <string name="permgrouplab_phone" msgid="5229115638567440675">"Telefon"</string>
     <string name="permgroupdesc_phone" msgid="6234224354060641055">"helistamine ja telefonikõnede haldamine"</string>
     <string name="permgrouprequest_phone" msgid="9166979577750581037">"Kas lubada rakendusel &lt;b&gt;<xliff:g id="APP_NAME">%1$s</xliff:g>&lt;/b&gt; teha ja hallata telefonikõnesid?"</string>
-    <string name="permgrouplab_sensors" msgid="416037179223226722">"Kehaandurid"</string>
+    <string name="permgrouplab_sensors" msgid="4838614103153567532">"Kehaandurid"</string>
     <string name="permgroupdesc_sensors" msgid="7147968539346634043">"juurdepääs anduri andmetele teie eluliste näitajate kohta"</string>
     <string name="permgrouprequest_sensors" msgid="6349806962814556786">"Kas lubada rakendusele &lt;b&gt;<xliff:g id="APP_NAME">%1$s</xliff:g>&lt;/b&gt; juurdepääs anduri andmetele teie eluliste näitajate kohta?"</string>
     <string name="permgrouplab_aural" msgid="965607064083134896">"Muusika"</string>
     <string name="permgroupdesc_aural" msgid="4870189506255958055">"Pääseda juurde teie muusikale"</string>
     <string name="permgrouprequest_aural" msgid="6787926123071735620">"Kas lubada rakendusele &lt;b&gt;<xliff:g id="APP_NAME">%1$s</xliff:g>&lt;/b&gt; juurdepääs teie muusikale?"</string>
-    <string name="permgrouplab_visual" msgid="8030190588123857921">"Fotod ja videod"</string>
+    <string name="permgrouplab_visual" msgid="6477382108771145134">"Fotod ja videod"</string>
     <string name="permgroupdesc_visual" msgid="3415827902566663546">"Pääseda juurde teie fotodele ja videotele"</string>
-    <string name="permgrouprequest_visual" msgid="6907523945030290376">"Kas lubada rakendusele &lt;b&gt;<xliff:g id="APP_NAME">%1$s</xliff:g>&lt;/b&gt; juurdepääs teie fotodele ja videotele?"</string>
+    <string name="permgrouprequest_visual" msgid="3043752127595243314">"Kas lubada rakendusel &lt;b&gt;<xliff:g id="APP_NAME">%1$s</xliff:g>&lt;/b&gt; teie fotodele ja videotele, sh märgistatud asukohtadele, juurde pääseda?"</string>
     <string name="capability_title_canRetrieveWindowContent" msgid="3901717936930170320">"Akna sisu toomine"</string>
     <string name="capability_desc_canRetrieveWindowContent" msgid="3772225008605310672">"Kasutatava akna sisu kontrollimine."</string>
     <string name="capability_title_canRequestTouchExploration" msgid="3108723364676667320">"Puudutusega sirvimise sisselülitamine"</string>
@@ -1396,8 +1396,7 @@
     <string name="ext_media_init_action" msgid="7952885510091978278">"Seadistus"</string>
     <string name="ext_media_unmount_action" msgid="1121883233103278199">"Eemaldamine"</string>
     <string name="ext_media_browse_action" msgid="8322172381028546087">"Avastamine"</string>
-    <!-- no translation found for ext_media_seamless_action (6575980560886881233) -->
-    <skip />
+    <string name="ext_media_seamless_action" msgid="6575980560886881233">"Vahetage väljundit"</string>
     <string name="ext_media_missing_title" msgid="620980315821543904">"Üksust <xliff:g id="NAME">%s</xliff:g> pole"</string>
     <string name="ext_media_missing_message" msgid="4012389235250987930">"Sisestage seade uuesti"</string>
     <string name="ext_media_move_specific_title" msgid="1471100343872375842">"Seadme <xliff:g id="NAME">%s</xliff:g> teisaldamine"</string>
@@ -1611,6 +1610,8 @@
     <string name="display_manager_overlay_display_name" msgid="5142365982271620716">"Ülekate nr .<xliff:g id="ID">%1$d</xliff:g>"</string>
     <string name="display_manager_overlay_display_title" msgid="652124517672257172">"<xliff:g id="NAME">%1$s</xliff:g>: <xliff:g id="WIDTH">%2$d</xliff:g> x <xliff:g id="HEIGHT">%3$d</xliff:g>, <xliff:g id="DPI">%4$d</xliff:g> dpi"</string>
     <string name="display_manager_overlay_display_secure_suffix" msgid="6022119702628572080">", turvaline"</string>
+    <string name="activity_starter_block_bg_activity_starts_permissive" msgid="5692097903712956720">"See taustategevuse käivitamine paketist <xliff:g id="PACKAGENAME">%1$s</xliff:g> blokeeritakse tulevaste Q järkude puhul. Vt go/q-bg-block."</string>
+    <string name="activity_starter_block_bg_activity_starts_enforcing" msgid="8299522481076404353">"Taustategevuse käivitamine paketist <xliff:g id="PACKAGENAME">%1$s</xliff:g> blokeeriti. Vt go/q-bg-block."</string>
     <string name="kg_forgot_pattern_button_text" msgid="8852021467868220608">"Unustasin mustri"</string>
     <string name="kg_wrong_pattern" msgid="1850806070801358830">"Vale muster"</string>
     <string name="kg_wrong_password" msgid="2333281762128113157">"Vale parool"</string>
@@ -1996,9 +1997,29 @@
     <string name="dynamic_mode_notification_channel_name" msgid="2348803891571320452">"Rutiinirežiimi teabe märguanne"</string>
     <string name="dynamic_mode_notification_title" msgid="508815255807182035">"Aku võib enne tavapärast laadimist tühjaks saada"</string>
     <string name="dynamic_mode_notification_summary" msgid="2541166298550402690">"Akusäästja aktiveeriti aku tööea pikendamiseks"</string>
+    <string name="mime_type_folder" msgid="7111951698626315204">"Kaust"</string>
+    <string name="mime_type_apk" msgid="5518003630972506900">"Androidi rakendus"</string>
+    <string name="mime_type_generic" msgid="6833871596845900027">"Fail"</string>
+    <string name="mime_type_generic_ext" msgid="8450275970061657174">"<xliff:g id="EXTENSION">%1$s</xliff:g>-fail"</string>
+    <string name="mime_type_audio" msgid="6289777657172050926">"Heli"</string>
+    <string name="mime_type_audio_ext" msgid="3270880987725816210">"<xliff:g id="EXTENSION">%1$s</xliff:g>-helifail"</string>
+    <string name="mime_type_video" msgid="4093025777317307426">"Video"</string>
+    <string name="mime_type_video_ext" msgid="5643771615714173159">"<xliff:g id="EXTENSION">%1$s</xliff:g>-videofail"</string>
+    <string name="mime_type_image" msgid="3144284451605236371">"Kujutis"</string>
+    <string name="mime_type_image_ext" msgid="1514613218742736590">"<xliff:g id="EXTENSION">%1$s</xliff:g>-kujutisefail"</string>
+    <string name="mime_type_compressed" msgid="1645486037074943257">"Arhiiv"</string>
+    <string name="mime_type_compressed_ext" msgid="4232293058067801528">"<xliff:g id="EXTENSION">%1$s</xliff:g>-arhiivifail"</string>
+    <string name="mime_type_document" msgid="1596838147256375966">"Dokument"</string>
+    <string name="mime_type_document_ext" msgid="6327266601345501281">"<xliff:g id="EXTENSION">%1$s</xliff:g>-dokument"</string>
+    <string name="mime_type_spreadsheet" msgid="2639138255207123557">"Arvutustabel"</string>
+    <string name="mime_type_spreadsheet_ext" msgid="5508653032786106725">"<xliff:g id="EXTENSION">%1$s</xliff:g>-arvutustabelifail"</string>
+    <string name="mime_type_presentation" msgid="6145604688774787357">"Esitlus"</string>
+    <string name="mime_type_presentation_ext" msgid="2982650207774823437">"<xliff:g id="EXTENSION">%1$s</xliff:g>-esitlusefail"</string>
     <string name="car_loading_profile" msgid="3545132581795684027">"Laadimine"</string>
     <plurals name="file_count" formatted="false" msgid="1628600959752419449">
       <item quantity="other"><xliff:g id="FILE_NAME_2">%s</xliff:g> + <xliff:g id="COUNT_3">%d</xliff:g> faili</item>
       <item quantity="one"><xliff:g id="FILE_NAME_0">%s</xliff:g> + <xliff:g id="COUNT_1">%d</xliff:g> fail</item>
     </plurals>
+    <!-- no translation found for chooser_no_direct_share_targets (997970693708458895) -->
+    <skip />
 </resources>
diff --git a/core/res/res/values-eu/strings.xml b/core/res/res/values-eu/strings.xml
index ab1dbd0..adc4dc4 100644
--- a/core/res/res/values-eu/strings.xml
+++ b/core/res/res/values-eu/strings.xml
@@ -282,7 +282,7 @@
     <string name="permgroupdesc_location" msgid="1346617465127855033">"atzitu gailuaren kokapena"</string>
     <string name="permgrouprequest_location" msgid="3788275734953323491">"&lt;b&gt;<xliff:g id="APP_NAME">%1$s</xliff:g>&lt;/b&gt; aplikazioari gailuaren kokapena atzitzea baimendu nahi diozu?"</string>
     <string name="permgrouprequestdetail_location" msgid="1113400215566814664">"Aplikazioa erabiltzen ari zarenean soilik atzituko du aplikazioak kokapena."</string>
-    <string name="permgroupbackgroundrequest_location" msgid="8461841153030844390">"&lt;b&gt;<xliff:g id="APP_NAME">%1$s</xliff:g>&lt;/b&gt; aplikazioari gailuaren kokapena beti atzitzea baimendu?"</string>
+    <string name="permgroupbackgroundrequest_location" msgid="8461841153030844390">"Gailuaren kokapena beti atzitzeko baimena eman nahi diozu &lt;b&gt;<xliff:g id="APP_NAME">%1$s</xliff:g>&lt;/b&gt; aplikazioari?"</string>
     <string name="permgroupbackgroundrequestdetail_location" msgid="1715668276378108654">"Aplikazioak beti atzituko du kokapena, baita aplikazioa erabiltzen ari ez bazara ere."</string>
     <string name="permgrouplab_calendar" msgid="5863508437783683902">"Egutegia"</string>
     <string name="permgroupdesc_calendar" msgid="3889615280211184106">"atzitu egutegia"</string>
@@ -308,15 +308,15 @@
     <string name="permgrouplab_phone" msgid="5229115638567440675">"Telefonoa"</string>
     <string name="permgroupdesc_phone" msgid="6234224354060641055">"egin eta kudeatu telefono-deiak"</string>
     <string name="permgrouprequest_phone" msgid="9166979577750581037">"&lt;b&gt;<xliff:g id="APP_NAME">%1$s</xliff:g>&lt;/b&gt; aplikazioari telefono-deiak egitea eta kudeatzea baimendu nahi diozu?"</string>
-    <string name="permgrouplab_sensors" msgid="416037179223226722">"Gorputz-sentsoreak"</string>
+    <string name="permgrouplab_sensors" msgid="4838614103153567532">"Gorputz-sentsoreak"</string>
     <string name="permgroupdesc_sensors" msgid="7147968539346634043">"atzitu bizi-konstanteei buruzko sentsorearen datuak"</string>
     <string name="permgrouprequest_sensors" msgid="6349806962814556786">"Bizi-konstanteei buruzko sentsorearen datuak atzitzea baimendu nahi diozu &lt;b&gt;<xliff:g id="APP_NAME">%1$s</xliff:g>&lt;/b&gt; aplikazioari?"</string>
     <string name="permgrouplab_aural" msgid="965607064083134896">"Musika"</string>
     <string name="permgroupdesc_aural" msgid="4870189506255958055">"musika atzitu"</string>
     <string name="permgrouprequest_aural" msgid="6787926123071735620">"&lt;b&gt;<xliff:g id="APP_NAME">%1$s</xliff:g>&lt;/b&gt; aplikazioari musika atzitzea baimendu nahi diozu?"</string>
-    <string name="permgrouplab_visual" msgid="8030190588123857921">"Argazkiak eta bideoak"</string>
+    <string name="permgrouplab_visual" msgid="6477382108771145134">"Argazkiak eta bideoak"</string>
     <string name="permgroupdesc_visual" msgid="3415827902566663546">"argazkiak eta bideoak atzitu"</string>
-    <string name="permgrouprequest_visual" msgid="6907523945030290376">"&lt;b&gt;<xliff:g id="APP_NAME">%1$s</xliff:g>&lt;/b&gt; aplikazioari argazkiak eta bideoak atzitzea baimendu nahi diozu?"</string>
+    <string name="permgrouprequest_visual" msgid="3043752127595243314">"&lt;b&gt;<xliff:g id="APP_NAME">%1$s</xliff:g>&lt;/b&gt; aplikazioari zure argazkiak eta bideoak (etiketatutako kokapenak barne) atzitzeko baimena eman?"</string>
     <string name="capability_title_canRetrieveWindowContent" msgid="3901717936930170320">"Eskuratu leihoko edukia"</string>
     <string name="capability_desc_canRetrieveWindowContent" msgid="3772225008605310672">"Arakatu irekita daukazun leihoko edukia."</string>
     <string name="capability_title_canRequestTouchExploration" msgid="3108723364676667320">"Aktibatu \"Arakatu ukituta\""</string>
@@ -510,7 +510,7 @@
     <string name="permlab_disableKeyguard" msgid="3598496301486439258">"desgaitu pantailaren blokeoa"</string>
     <string name="permdesc_disableKeyguard" msgid="6034203065077122992">"Teklen blokeoa eta erlazionatutako pasahitz-segurtasuna desgaitzeko baimena ematen die aplikazioei. Adibidez, telefonoak teklen blokeoa desgaitzen du telefono-deiak jasotzen dituenean, eta berriro gaitzen du deiak amaitzean."</string>
     <string name="permlab_requestScreenLockComplexity" msgid="7028982116060987169">"eskatu pantailaren blokeoaren konplexutasuna"</string>
-    <string name="permdesc_requestScreenLockComplexity" msgid="2806396846128185677">"Pantailaren blokeoaren konplexutasun-maila (handia, ertaina, txikia edo bat ere ez) ezagutzeko aukera ematen dio aplikazioari; haren bidez, pantailaren blokeoaren luzeraren barruti edo mota posiblea adierazten da. Halaber, erabiltzaileei pantailaren blokeoa maila jakin batera igotzeko iradoki diezaieke aplikazioak, baina erabiltzaileek horri ez ikusi egiteko eta aplikazioa erabiltzen jarraitzeko aukera dute. Kontuan izan pantailaren blokeoa ez dela gordetzen testu arrunt gisa; beraz, aplikazioak ez du jakingo pasahitza zehazki zein den."</string>
+    <string name="permdesc_requestScreenLockComplexity" msgid="2806396846128185677">"Pantailaren blokeoaren konplexutasun-maila (handia, ertaina, txikia edo bat ere ez) ezagutzeko aukera ematen dio aplikazioari; haren bidez, pantailaren blokeoaren luzeraren barruti edo mota posiblea adierazten da. Halaber, erabiltzaileei pantailaren blokeoa maila jakin batera igotzeko iradoki diezaieke aplikazioak, baina erabiltzaileek horri ez ikusi egiteko eta aplikazioa erabiltzen jarraitzeko aukera dute. Kontuan izan pantailaren blokeoa ez dela gordetzen testu arrunt gisa; beraz, aplikazioak ez du jakingo zein den pasahitz zehatza."</string>
     <string name="permlab_useBiometric" msgid="8837753668509919318">"Erabili hardware biometrikoa"</string>
     <string name="permdesc_useBiometric" msgid="8389855232721612926">"Autentifikatzeko hardware biometrikoa erabiltzea baimentzen die aplikazioei."</string>
     <string name="permlab_manageFingerprint" msgid="5640858826254575638">"kudeatu erreferentzia-gako digitalen hardwarea"</string>
@@ -1318,7 +1318,7 @@
     <string name="sms_short_code_confirm_deny" msgid="2927389840209170706">"Utzi"</string>
     <string name="sms_short_code_remember_choice" msgid="5289538592272218136">"Gogoratu aukera"</string>
     <string name="sms_short_code_remember_undo_instruction" msgid="4960944133052287484">"Hori geroago alda dezakezu Ezarpenak &gt; Aplikazioak atalean"</string>
-    <string name="sms_short_code_confirm_always_allow" msgid="3241181154869493368">"Onartu beti"</string>
+    <string name="sms_short_code_confirm_always_allow" msgid="3241181154869493368">"Eman baimena beti"</string>
     <string name="sms_short_code_confirm_never_allow" msgid="446992765774269673">"Ez onartu inoiz"</string>
     <string name="sim_removed_title" msgid="6227712319223226185">"SIM txartela kendu da"</string>
     <string name="sim_removed_message" msgid="2333164559970958645">"Sare mugikorra ez da erabilgarri egongo baliozko SIM txartel bat sartuta berrabiarazten ez duzun arte."</string>
@@ -1397,8 +1397,7 @@
     <string name="ext_media_init_action" msgid="7952885510091978278">"Konfiguratu"</string>
     <string name="ext_media_unmount_action" msgid="1121883233103278199">"Atera"</string>
     <string name="ext_media_browse_action" msgid="8322172381028546087">"Arakatu"</string>
-    <!-- no translation found for ext_media_seamless_action (6575980560886881233) -->
-    <skip />
+    <string name="ext_media_seamless_action" msgid="6575980560886881233">"Aldatu irteera"</string>
     <string name="ext_media_missing_title" msgid="620980315821543904">"Ez dago <xliff:g id="NAME">%s</xliff:g>"</string>
     <string name="ext_media_missing_message" msgid="4012389235250987930">"Sartu gailua berriro"</string>
     <string name="ext_media_move_specific_title" msgid="1471100343872375842">"<xliff:g id="NAME">%s</xliff:g> mugitzen"</string>
@@ -1612,6 +1611,8 @@
     <string name="display_manager_overlay_display_name" msgid="5142365982271620716">"<xliff:g id="ID">%1$d</xliff:g>. gainjartzea"</string>
     <string name="display_manager_overlay_display_title" msgid="652124517672257172">"<xliff:g id="NAME">%1$s</xliff:g>: <xliff:g id="WIDTH">%2$d</xliff:g> x <xliff:g id="HEIGHT">%3$d</xliff:g>, <xliff:g id="DPI">%4$d</xliff:g> dpi"</string>
     <string name="display_manager_overlay_display_secure_suffix" msgid="6022119702628572080">", segurua"</string>
+    <string name="activity_starter_block_bg_activity_starts_permissive" msgid="5692097903712956720">"<xliff:g id="PACKAGENAME">%1$s</xliff:g> paketearen atzeko planoko jardueraren abio hau blokeatu egingo da Q bertsioaren etorkizuneko konpilazioetan. Joan go/q-bg-block helbidera."</string>
+    <string name="activity_starter_block_bg_activity_starts_enforcing" msgid="8299522481076404353">"Blokeatu da <xliff:g id="PACKAGENAME">%1$s</xliff:g> paketearen atzeko planoko jardueraren abioa. Joan go/q-bg-block helbidera."</string>
     <string name="kg_forgot_pattern_button_text" msgid="8852021467868220608">"Eredua ahaztu zaizu"</string>
     <string name="kg_wrong_pattern" msgid="1850806070801358830">"Eredu okerra"</string>
     <string name="kg_wrong_password" msgid="2333281762128113157">"Pasahitz okerra"</string>
@@ -1997,9 +1998,29 @@
     <string name="dynamic_mode_notification_channel_name" msgid="2348803891571320452">"Ohitura moduaren informazio-jakinarazpena"</string>
     <string name="dynamic_mode_notification_title" msgid="508815255807182035">"Baliteke bateria ohi baino lehenago agortzea"</string>
     <string name="dynamic_mode_notification_summary" msgid="2541166298550402690">"Bateria-aurrezlea aktibatuta dago bateriaren iraupena luzatzeko"</string>
+    <string name="mime_type_folder" msgid="7111951698626315204">"Karpeta"</string>
+    <string name="mime_type_apk" msgid="5518003630972506900">"Android aplikazioa"</string>
+    <string name="mime_type_generic" msgid="6833871596845900027">"Fitxategia"</string>
+    <string name="mime_type_generic_ext" msgid="8450275970061657174">"<xliff:g id="EXTENSION">%1$s</xliff:g> fitxategia"</string>
+    <string name="mime_type_audio" msgid="6289777657172050926">"Audioa"</string>
+    <string name="mime_type_audio_ext" msgid="3270880987725816210">"<xliff:g id="EXTENSION">%1$s</xliff:g> audioa"</string>
+    <string name="mime_type_video" msgid="4093025777317307426">"Bideoa"</string>
+    <string name="mime_type_video_ext" msgid="5643771615714173159">"<xliff:g id="EXTENSION">%1$s</xliff:g> bideoa"</string>
+    <string name="mime_type_image" msgid="3144284451605236371">"Irudia"</string>
+    <string name="mime_type_image_ext" msgid="1514613218742736590">"<xliff:g id="EXTENSION">%1$s</xliff:g> irudia"</string>
+    <string name="mime_type_compressed" msgid="1645486037074943257">"Artxiboa"</string>
+    <string name="mime_type_compressed_ext" msgid="4232293058067801528">"<xliff:g id="EXTENSION">%1$s</xliff:g> artxiboa"</string>
+    <string name="mime_type_document" msgid="1596838147256375966">"Dokumentua"</string>
+    <string name="mime_type_document_ext" msgid="6327266601345501281">"<xliff:g id="EXTENSION">%1$s</xliff:g> dokumentua"</string>
+    <string name="mime_type_spreadsheet" msgid="2639138255207123557">"Kalkulu-orria"</string>
+    <string name="mime_type_spreadsheet_ext" msgid="5508653032786106725">"<xliff:g id="EXTENSION">%1$s</xliff:g> kalkulu-orria"</string>
+    <string name="mime_type_presentation" msgid="6145604688774787357">"Aurkezpena"</string>
+    <string name="mime_type_presentation_ext" msgid="2982650207774823437">"<xliff:g id="EXTENSION">%1$s</xliff:g> aurkezpena"</string>
     <string name="car_loading_profile" msgid="3545132581795684027">"Kargatzen"</string>
     <plurals name="file_count" formatted="false" msgid="1628600959752419449">
       <item quantity="other"><xliff:g id="FILE_NAME_2">%s</xliff:g> + <xliff:g id="COUNT_3">%d</xliff:g> fitxategi</item>
       <item quantity="one"><xliff:g id="FILE_NAME_0">%s</xliff:g> + <xliff:g id="COUNT_1">%d</xliff:g> fitxategi</item>
     </plurals>
+    <!-- no translation found for chooser_no_direct_share_targets (997970693708458895) -->
+    <skip />
 </resources>
diff --git a/core/res/res/values-fa/strings.xml b/core/res/res/values-fa/strings.xml
index 712f06c..7835cfe 100644
--- a/core/res/res/values-fa/strings.xml
+++ b/core/res/res/values-fa/strings.xml
@@ -308,15 +308,15 @@
     <string name="permgrouplab_phone" msgid="5229115638567440675">"تلفن"</string>
     <string name="permgroupdesc_phone" msgid="6234224354060641055">"برقراری و مدیریت تماس‌های تلفنی"</string>
     <string name="permgrouprequest_phone" msgid="9166979577750581037">"‏به &lt;b&gt;<xliff:g id="APP_NAME">%1$s</xliff:g>&lt;b&gt; اجازه داده شود تماس‌های تلفنی برقرار کند و آن‌ها را مدیریت کند؟"</string>
-    <string name="permgrouplab_sensors" msgid="416037179223226722">"حسگرهای بدن"</string>
+    <string name="permgrouplab_sensors" msgid="4838614103153567532">"حسگرهای بدن"</string>
     <string name="permgroupdesc_sensors" msgid="7147968539346634043">"دسترسی به داده‌های حسگر در رابطه با علائم حیاتی شما"</string>
     <string name="permgrouprequest_sensors" msgid="6349806962814556786">"‏به &lt;b&gt;<xliff:g id="APP_NAME">%1$s</xliff:g>&lt;b&gt; اجازه داده شود به داده‌های حسگر مربوط به علائم حیاتی شما دسترسی پیدا کند؟"</string>
     <string name="permgrouplab_aural" msgid="965607064083134896">"موسیقی"</string>
     <string name="permgroupdesc_aural" msgid="4870189506255958055">"دسترسی به موسیقی شما"</string>
     <string name="permgrouprequest_aural" msgid="6787926123071735620">"‏به &lt;b&gt;<xliff:g id="APP_NAME">%1$s</xliff:g>&lt;/b&gt; اجازه داده شود به موسیقی شما دسترسی پیدا کند؟"</string>
-    <string name="permgrouplab_visual" msgid="8030190588123857921">"عکس و ویدیو"</string>
+    <string name="permgrouplab_visual" msgid="6477382108771145134">"عکس و ویدیو"</string>
     <string name="permgroupdesc_visual" msgid="3415827902566663546">"دسترسی به عکس‌ها و ویدیوهایتان"</string>
-    <string name="permgrouprequest_visual" msgid="6907523945030290376">"‏به &lt;b&gt;<xliff:g id="APP_NAME">%1$s</xliff:g>&lt;/b&gt; اجازه داده شود به عکس‌ها و ویدیوهای شما دسترسی پیدا کند؟"</string>
+    <string name="permgrouprequest_visual" msgid="3043752127595243314">"‏به &lt;b&gt;<xliff:g id="APP_NAME">%1$s</xliff:g>&lt;/b&gt; اجازه می‌دهید به عکس‌ها و ویدیوهاتان، ازجمله مکان‌های برچسب‌گذاری‌شده، دسترسی داشته باشد؟"</string>
     <string name="capability_title_canRetrieveWindowContent" msgid="3901717936930170320">"محتوای پنجره را بازیابی کند"</string>
     <string name="capability_desc_canRetrieveWindowContent" msgid="3772225008605310672">"محتوای پنجره‌ای را که درحال تعامل با آن هستید بررسی می‌کند."</string>
     <string name="capability_title_canRequestTouchExploration" msgid="3108723364676667320">"فعال‌سازی کاوش لمسی"</string>
@@ -1396,8 +1396,7 @@
     <string name="ext_media_init_action" msgid="7952885510091978278">"راه‌اندازی"</string>
     <string name="ext_media_unmount_action" msgid="1121883233103278199">"بیرون راندن"</string>
     <string name="ext_media_browse_action" msgid="8322172381028546087">"کاوش"</string>
-    <!-- no translation found for ext_media_seamless_action (6575980560886881233) -->
-    <skip />
+    <string name="ext_media_seamless_action" msgid="6575980560886881233">"تغییر خروجی"</string>
     <string name="ext_media_missing_title" msgid="620980315821543904">"<xliff:g id="NAME">%s</xliff:g> وجود ندارد"</string>
     <string name="ext_media_missing_message" msgid="4012389235250987930">"دستگاه را دوباره وارد کنید"</string>
     <string name="ext_media_move_specific_title" msgid="1471100343872375842">"در حال انتقال <xliff:g id="NAME">%s</xliff:g>"</string>
@@ -1611,6 +1610,8 @@
     <string name="display_manager_overlay_display_name" msgid="5142365982271620716">"هم‌پوشانی #<xliff:g id="ID">%1$d</xliff:g>"</string>
     <string name="display_manager_overlay_display_title" msgid="652124517672257172">"<xliff:g id="NAME">%1$s</xliff:g>: <xliff:g id="WIDTH">%2$d</xliff:g>x<xliff:g id="HEIGHT">%3$d</xliff:g>, <xliff:g id="DPI">%4$d</xliff:g> dpi"</string>
     <string name="display_manager_overlay_display_secure_suffix" msgid="6022119702628572080">"، امن"</string>
+    <string name="activity_starter_block_bg_activity_starts_permissive" msgid="5692097903712956720">"‏شروع فعالیت پس‌زمینه<xliff:g id="PACKAGENAME">%1$s</xliff:g> در نسخه‌های Q آینده مسدود خواهد شد. به go/q-bg-block مراجعه کنید."</string>
+    <string name="activity_starter_block_bg_activity_starts_enforcing" msgid="8299522481076404353">"‏شروع فعالیت پس‌زمینه <xliff:g id="PACKAGENAME">%1$s</xliff:g> مسدود شده است. به go/q-bg-block مراجعه کنید."</string>
     <string name="kg_forgot_pattern_button_text" msgid="8852021467868220608">"الگو را فراموش کرده‌اید"</string>
     <string name="kg_wrong_pattern" msgid="1850806070801358830">"الگوی اشتباه"</string>
     <string name="kg_wrong_password" msgid="2333281762128113157">"گذرواژه اشتباه"</string>
@@ -1996,9 +1997,29 @@
     <string name="dynamic_mode_notification_channel_name" msgid="2348803891571320452">"اعلان اطلاعات حالت روال معمول"</string>
     <string name="dynamic_mode_notification_title" msgid="508815255807182035">"ممکن است شارژ باتری قبل از شارژ معمول تمام شود"</string>
     <string name="dynamic_mode_notification_summary" msgid="2541166298550402690">"جهت افزایش عمر باتری، بهینه‌سازی باتری فعال شد"</string>
+    <string name="mime_type_folder" msgid="7111951698626315204">"پوشه"</string>
+    <string name="mime_type_apk" msgid="5518003630972506900">"‏برنامه Android"</string>
+    <string name="mime_type_generic" msgid="6833871596845900027">"فایل"</string>
+    <string name="mime_type_generic_ext" msgid="8450275970061657174">"<xliff:g id="EXTENSION">%1$s</xliff:g> فایل"</string>
+    <string name="mime_type_audio" msgid="6289777657172050926">"صدا"</string>
+    <string name="mime_type_audio_ext" msgid="3270880987725816210">"<xliff:g id="EXTENSION">%1$s</xliff:g> صوتی"</string>
+    <string name="mime_type_video" msgid="4093025777317307426">"ویدیو"</string>
+    <string name="mime_type_video_ext" msgid="5643771615714173159">"<xliff:g id="EXTENSION">%1$s</xliff:g> ویدیو"</string>
+    <string name="mime_type_image" msgid="3144284451605236371">"تصویر"</string>
+    <string name="mime_type_image_ext" msgid="1514613218742736590">"<xliff:g id="EXTENSION">%1$s</xliff:g> تصویر"</string>
+    <string name="mime_type_compressed" msgid="1645486037074943257">"بایگانی"</string>
+    <string name="mime_type_compressed_ext" msgid="4232293058067801528">"<xliff:g id="EXTENSION">%1$s</xliff:g> بایگانی"</string>
+    <string name="mime_type_document" msgid="1596838147256375966">"سند"</string>
+    <string name="mime_type_document_ext" msgid="6327266601345501281">"<xliff:g id="EXTENSION">%1$s</xliff:g> سند"</string>
+    <string name="mime_type_spreadsheet" msgid="2639138255207123557">"صفحه‌گسترده"</string>
+    <string name="mime_type_spreadsheet_ext" msgid="5508653032786106725">"<xliff:g id="EXTENSION">%1$s</xliff:g> صفحه‌گسترده"</string>
+    <string name="mime_type_presentation" msgid="6145604688774787357">"ارائه"</string>
+    <string name="mime_type_presentation_ext" msgid="2982650207774823437">"<xliff:g id="EXTENSION">%1$s</xliff:g> ارائه"</string>
     <string name="car_loading_profile" msgid="3545132581795684027">"درحال بارگیری"</string>
     <plurals name="file_count" formatted="false" msgid="1628600959752419449">
       <item quantity="one"><xliff:g id="FILE_NAME_2">%s</xliff:g> + <xliff:g id="COUNT_3">%d</xliff:g> فایل</item>
       <item quantity="other"><xliff:g id="FILE_NAME_2">%s</xliff:g> + <xliff:g id="COUNT_3">%d</xliff:g> فایل</item>
     </plurals>
+    <!-- no translation found for chooser_no_direct_share_targets (997970693708458895) -->
+    <skip />
 </resources>
diff --git a/core/res/res/values-fi/strings.xml b/core/res/res/values-fi/strings.xml
index d8e336c..6efc8be 100644
--- a/core/res/res/values-fi/strings.xml
+++ b/core/res/res/values-fi/strings.xml
@@ -308,15 +308,15 @@
     <string name="permgrouplab_phone" msgid="5229115638567440675">"Puhelin"</string>
     <string name="permgroupdesc_phone" msgid="6234224354060641055">"soittaa ja hallinnoida puheluita"</string>
     <string name="permgrouprequest_phone" msgid="9166979577750581037">"Saako &lt;b&gt;<xliff:g id="APP_NAME">%1$s</xliff:g>&lt;/b&gt; soittaa ja hallinnoida puheluita?"</string>
-    <string name="permgrouplab_sensors" msgid="416037179223226722">"Kehon anturit"</string>
+    <string name="permgrouplab_sensors" msgid="4838614103153567532">"Kehon anturit"</string>
     <string name="permgroupdesc_sensors" msgid="7147968539346634043">"käyttää anturitietoja elintoiminnoistasi"</string>
     <string name="permgrouprequest_sensors" msgid="6349806962814556786">"Saako &lt;b&gt;<xliff:g id="APP_NAME">%1$s</xliff:g>&lt;/b&gt; käyttää anturitietoja elintoiminnoistasi?"</string>
     <string name="permgrouplab_aural" msgid="965607064083134896">"Musiikki"</string>
     <string name="permgroupdesc_aural" msgid="4870189506255958055">"käyttää musiikkiasi"</string>
     <string name="permgrouprequest_aural" msgid="6787926123071735620">"Saako &lt;b&gt;<xliff:g id="APP_NAME">%1$s</xliff:g>&lt;/b&gt; käyttää musiikkiasi?"</string>
-    <string name="permgrouplab_visual" msgid="8030190588123857921">"Kuvat ja videot"</string>
+    <string name="permgrouplab_visual" msgid="6477382108771145134">"Kuvat ja videot"</string>
     <string name="permgroupdesc_visual" msgid="3415827902566663546">"käyttää kuvia ja videoita"</string>
-    <string name="permgrouprequest_visual" msgid="6907523945030290376">"Saako &lt;b&gt;<xliff:g id="APP_NAME">%1$s</xliff:g>&lt;/b&gt; käyttää kuviasi ja videoitasi?"</string>
+    <string name="permgrouprequest_visual" msgid="3043752127595243314">"Saako &lt;b&gt;<xliff:g id="APP_NAME">%1$s</xliff:g>&lt;/b&gt; pääsyn kuviin ja videoihin, mukaan lukien tagattuihin sijainteihin?"</string>
     <string name="capability_title_canRetrieveWindowContent" msgid="3901717936930170320">"Noutaa ikkunan sisältöä"</string>
     <string name="capability_desc_canRetrieveWindowContent" msgid="3772225008605310672">"Tarkistaa käyttämäsi ikkunan sisältö."</string>
     <string name="capability_title_canRequestTouchExploration" msgid="3108723364676667320">"Ottaa kosketuksella tutkimisen käyttöön"</string>
@@ -1396,8 +1396,7 @@
     <string name="ext_media_init_action" msgid="7952885510091978278">"Määritä asetukset"</string>
     <string name="ext_media_unmount_action" msgid="1121883233103278199">"Poista"</string>
     <string name="ext_media_browse_action" msgid="8322172381028546087">"Tutustu"</string>
-    <!-- no translation found for ext_media_seamless_action (6575980560886881233) -->
-    <skip />
+    <string name="ext_media_seamless_action" msgid="6575980560886881233">"Vaihda syötettä"</string>
     <string name="ext_media_missing_title" msgid="620980315821543904">"<xliff:g id="NAME">%s</xliff:g> puuttuu."</string>
     <string name="ext_media_missing_message" msgid="4012389235250987930">"Liitä laite uudelleen"</string>
     <string name="ext_media_move_specific_title" msgid="1471100343872375842">"Siirretään <xliff:g id="NAME">%s</xliff:g>."</string>
@@ -1611,6 +1610,8 @@
     <string name="display_manager_overlay_display_name" msgid="5142365982271620716">"Peittokuva # <xliff:g id="ID">%1$d</xliff:g>"</string>
     <string name="display_manager_overlay_display_title" msgid="652124517672257172">"<xliff:g id="NAME">%1$s</xliff:g>: <xliff:g id="WIDTH">%2$d</xliff:g> x <xliff:g id="HEIGHT">%3$d</xliff:g>, <xliff:g id="DPI">%4$d</xliff:g> dpi"</string>
     <string name="display_manager_overlay_display_secure_suffix" msgid="6022119702628572080">", suojattu"</string>
+    <string name="activity_starter_block_bg_activity_starts_permissive" msgid="5692097903712956720">"Tämä taustatoiminnan käynnistys kohteesta <xliff:g id="PACKAGENAME">%1$s</xliff:g> estetään tulevissa Q-versioissa. Lue lisää: go/q-bg-block."</string>
+    <string name="activity_starter_block_bg_activity_starts_enforcing" msgid="8299522481076404353">"Taustatoiminnan käynnistys kohteesta <xliff:g id="PACKAGENAME">%1$s</xliff:g> estettiin. Lue lisää: go/q-bg-block."</string>
     <string name="kg_forgot_pattern_button_text" msgid="8852021467868220608">"Unohtunut kuvio"</string>
     <string name="kg_wrong_pattern" msgid="1850806070801358830">"Väärä kuvio"</string>
     <string name="kg_wrong_password" msgid="2333281762128113157">"Väärä salasana"</string>
@@ -1996,9 +1997,29 @@
     <string name="dynamic_mode_notification_channel_name" msgid="2348803891571320452">"Ohjelmatilan tietoilmoitus"</string>
     <string name="dynamic_mode_notification_title" msgid="508815255807182035">"Akku saattaa loppua ennen normaalia latausaikaa"</string>
     <string name="dynamic_mode_notification_summary" msgid="2541166298550402690">"Virransäästö otettu käyttöön akunkeston pidentämiseksi"</string>
+    <string name="mime_type_folder" msgid="7111951698626315204">"Kansio"</string>
+    <string name="mime_type_apk" msgid="5518003630972506900">"Android-sovellus"</string>
+    <string name="mime_type_generic" msgid="6833871596845900027">"Tiedosto"</string>
+    <string name="mime_type_generic_ext" msgid="8450275970061657174">"<xliff:g id="EXTENSION">%1$s</xliff:g>-tiedosto"</string>
+    <string name="mime_type_audio" msgid="6289777657172050926">"Ääni"</string>
+    <string name="mime_type_audio_ext" msgid="3270880987725816210">"<xliff:g id="EXTENSION">%1$s</xliff:g>-ääni"</string>
+    <string name="mime_type_video" msgid="4093025777317307426">"Video"</string>
+    <string name="mime_type_video_ext" msgid="5643771615714173159">"<xliff:g id="EXTENSION">%1$s</xliff:g>-video"</string>
+    <string name="mime_type_image" msgid="3144284451605236371">"Kuva"</string>
+    <string name="mime_type_image_ext" msgid="1514613218742736590">"<xliff:g id="EXTENSION">%1$s</xliff:g>-kuva"</string>
+    <string name="mime_type_compressed" msgid="1645486037074943257">"Arkisto"</string>
+    <string name="mime_type_compressed_ext" msgid="4232293058067801528">"<xliff:g id="EXTENSION">%1$s</xliff:g>-arkisto"</string>
+    <string name="mime_type_document" msgid="1596838147256375966">"Dokumentti"</string>
+    <string name="mime_type_document_ext" msgid="6327266601345501281">"<xliff:g id="EXTENSION">%1$s</xliff:g>-dokumentti"</string>
+    <string name="mime_type_spreadsheet" msgid="2639138255207123557">"Laskentataulukko"</string>
+    <string name="mime_type_spreadsheet_ext" msgid="5508653032786106725">"<xliff:g id="EXTENSION">%1$s</xliff:g>-laskentataulukko"</string>
+    <string name="mime_type_presentation" msgid="6145604688774787357">"Esitys"</string>
+    <string name="mime_type_presentation_ext" msgid="2982650207774823437">"<xliff:g id="EXTENSION">%1$s</xliff:g>-esitys"</string>
     <string name="car_loading_profile" msgid="3545132581795684027">"Ladataan"</string>
     <plurals name="file_count" formatted="false" msgid="1628600959752419449">
       <item quantity="other"><xliff:g id="FILE_NAME_2">%s</xliff:g> + <xliff:g id="COUNT_3">%d</xliff:g> tiedostoa</item>
       <item quantity="one"><xliff:g id="FILE_NAME_0">%s</xliff:g> + <xliff:g id="COUNT_1">%d</xliff:g> tiedosto</item>
     </plurals>
+    <!-- no translation found for chooser_no_direct_share_targets (997970693708458895) -->
+    <skip />
 </resources>
diff --git a/core/res/res/values-fr-rCA/strings.xml b/core/res/res/values-fr-rCA/strings.xml
index 0c3757b..9e8b92c 100644
--- a/core/res/res/values-fr-rCA/strings.xml
+++ b/core/res/res/values-fr-rCA/strings.xml
@@ -308,15 +308,15 @@
     <string name="permgrouplab_phone" msgid="5229115638567440675">"Téléphone"</string>
     <string name="permgroupdesc_phone" msgid="6234224354060641055">"faire et gérer des appels téléphoniques"</string>
     <string name="permgrouprequest_phone" msgid="9166979577750581037">"Autoriser &lt;b&gt;<xliff:g id="APP_NAME">%1$s</xliff:g>&lt;/b&gt; à faire et à gérer les appels téléphoniques?"</string>
-    <string name="permgrouplab_sensors" msgid="416037179223226722">"Capteurs corporels"</string>
+    <string name="permgrouplab_sensors" msgid="4838614103153567532">"Capteurs corporels"</string>
     <string name="permgroupdesc_sensors" msgid="7147968539346634043">"accéder aux données des capteurs sur vos signes vitaux"</string>
     <string name="permgrouprequest_sensors" msgid="6349806962814556786">"Autoriser « <xliff:g id="APP_NAME">%1$s</xliff:g> » à accéder aux données des capteurs pour vos signes vitaux?"</string>
     <string name="permgrouplab_aural" msgid="965607064083134896">"Musique"</string>
     <string name="permgroupdesc_aural" msgid="4870189506255958055">"accéder à votre musique"</string>
     <string name="permgrouprequest_aural" msgid="6787926123071735620">"Autoriser &lt;b&gt;<xliff:g id="APP_NAME">%1$s</xliff:g>&lt;/b&gt; à accéder à votre musique?"</string>
-    <string name="permgrouplab_visual" msgid="8030190588123857921">"Photos et vidéos"</string>
+    <string name="permgrouplab_visual" msgid="6477382108771145134">"Photos et vidéos"</string>
     <string name="permgroupdesc_visual" msgid="3415827902566663546">"accéder à vos photos et à vos vidéos"</string>
-    <string name="permgrouprequest_visual" msgid="6907523945030290376">"Autoriser &lt;b&gt;<xliff:g id="APP_NAME">%1$s</xliff:g>&lt;/b&gt; à accéder à vos photos et à vos videos?"</string>
+    <string name="permgrouprequest_visual" msgid="3043752127595243314">"Autoriser « <xliff:g id="APP_NAME">%1$s</xliff:g> » à accéder à vos photos et vos videos, y compris les lieux balisés?"</string>
     <string name="capability_title_canRetrieveWindowContent" msgid="3901717936930170320">"Récupérer le contenu d\'une fenêtre"</string>
     <string name="capability_desc_canRetrieveWindowContent" msgid="3772225008605310672">"Inspecter le contenu d\'une fenêtre avec laquelle vous interagissez."</string>
     <string name="capability_title_canRequestTouchExploration" msgid="3108723364676667320">"Activer la fonctionnalité Explorer au toucher"</string>
@@ -1396,8 +1396,7 @@
     <string name="ext_media_init_action" msgid="7952885510091978278">"Configurer"</string>
     <string name="ext_media_unmount_action" msgid="1121883233103278199">"Éjecter"</string>
     <string name="ext_media_browse_action" msgid="8322172381028546087">"Découvrir"</string>
-    <!-- no translation found for ext_media_seamless_action (6575980560886881233) -->
-    <skip />
+    <string name="ext_media_seamless_action" msgid="6575980560886881233">"Changer de sortie"</string>
     <string name="ext_media_missing_title" msgid="620980315821543904">"Mémoire de stockage <xliff:g id="NAME">%s</xliff:g> manquante"</string>
     <string name="ext_media_missing_message" msgid="4012389235250987930">"Insérez l\'appareil de nouveau"</string>
     <string name="ext_media_move_specific_title" msgid="1471100343872375842">"Déplacement de <xliff:g id="NAME">%s</xliff:g> en cours..."</string>
@@ -1611,6 +1610,8 @@
     <string name="display_manager_overlay_display_name" msgid="5142365982271620716">"Superposition n° <xliff:g id="ID">%1$d</xliff:g>"</string>
     <string name="display_manager_overlay_display_title" msgid="652124517672257172">"<xliff:g id="NAME">%1$s</xliff:g> : <xliff:g id="WIDTH">%2$d</xliff:g> x <xliff:g id="HEIGHT">%3$d</xliff:g>, <xliff:g id="DPI">%4$d</xliff:g> ppp"</string>
     <string name="display_manager_overlay_display_secure_suffix" msgid="6022119702628572080">", sécurisé"</string>
+    <string name="activity_starter_block_bg_activity_starts_permissive" msgid="5692097903712956720">"Ce lancement d\'activité en arrière-plan par <xliff:g id="PACKAGENAME">%1$s</xliff:g> sera bloqué dans les versions futures de Q. Visitez la page go/q-bg-block."</string>
+    <string name="activity_starter_block_bg_activity_starts_enforcing" msgid="8299522481076404353">"Le lancement d\'une activité en arrière-plan par <xliff:g id="PACKAGENAME">%1$s</xliff:g> a été bloqué. Visitez la page go/q-bg-block."</string>
     <string name="kg_forgot_pattern_button_text" msgid="8852021467868220608">"J\'ai oublié le schéma"</string>
     <string name="kg_wrong_pattern" msgid="1850806070801358830">"Schéma incorrect."</string>
     <string name="kg_wrong_password" msgid="2333281762128113157">"Mot de passe incorrect."</string>
@@ -1996,9 +1997,29 @@
     <string name="dynamic_mode_notification_channel_name" msgid="2348803891571320452">"Notification d\'information du mode Routine"</string>
     <string name="dynamic_mode_notification_title" msgid="508815255807182035">"La pile pourrait s\'épuiser avant la charge habituelle"</string>
     <string name="dynamic_mode_notification_summary" msgid="2541166298550402690">"Le mode Économiseur de pile est activé afin de prolonger l\'autonomie"</string>
+    <string name="mime_type_folder" msgid="7111951698626315204">"Dossier"</string>
+    <string name="mime_type_apk" msgid="5518003630972506900">"Application Android"</string>
+    <string name="mime_type_generic" msgid="6833871596845900027">"Fichier"</string>
+    <string name="mime_type_generic_ext" msgid="8450275970061657174">"Fichier <xliff:g id="EXTENSION">%1$s</xliff:g>"</string>
+    <string name="mime_type_audio" msgid="6289777657172050926">"Son"</string>
+    <string name="mime_type_audio_ext" msgid="3270880987725816210">"Audio en <xliff:g id="EXTENSION">%1$s</xliff:g>"</string>
+    <string name="mime_type_video" msgid="4093025777317307426">"Vidéo"</string>
+    <string name="mime_type_video_ext" msgid="5643771615714173159">"Vidéo <xliff:g id="EXTENSION">%1$s</xliff:g>"</string>
+    <string name="mime_type_image" msgid="3144284451605236371">"Image"</string>
+    <string name="mime_type_image_ext" msgid="1514613218742736590">"Image <xliff:g id="EXTENSION">%1$s</xliff:g>"</string>
+    <string name="mime_type_compressed" msgid="1645486037074943257">"Archive"</string>
+    <string name="mime_type_compressed_ext" msgid="4232293058067801528">"Archive <xliff:g id="EXTENSION">%1$s</xliff:g>"</string>
+    <string name="mime_type_document" msgid="1596838147256375966">"Document"</string>
+    <string name="mime_type_document_ext" msgid="6327266601345501281">"Document <xliff:g id="EXTENSION">%1$s</xliff:g>"</string>
+    <string name="mime_type_spreadsheet" msgid="2639138255207123557">"Feuille de calcul"</string>
+    <string name="mime_type_spreadsheet_ext" msgid="5508653032786106725">"Feuille de calcul <xliff:g id="EXTENSION">%1$s</xliff:g>"</string>
+    <string name="mime_type_presentation" msgid="6145604688774787357">"Présentation"</string>
+    <string name="mime_type_presentation_ext" msgid="2982650207774823437">"Présentation <xliff:g id="EXTENSION">%1$s</xliff:g>"</string>
     <string name="car_loading_profile" msgid="3545132581795684027">"Chargement en cours…"</string>
     <plurals name="file_count" formatted="false" msgid="1628600959752419449">
       <item quantity="one"><xliff:g id="FILE_NAME_2">%s</xliff:g> + <xliff:g id="COUNT_3">%d</xliff:g> fichier</item>
       <item quantity="other"><xliff:g id="FILE_NAME_2">%s</xliff:g> + <xliff:g id="COUNT_3">%d</xliff:g> fichiers</item>
     </plurals>
+    <!-- no translation found for chooser_no_direct_share_targets (997970693708458895) -->
+    <skip />
 </resources>
diff --git a/core/res/res/values-fr/strings.xml b/core/res/res/values-fr/strings.xml
index 14b05e7..1723039 100644
--- a/core/res/res/values-fr/strings.xml
+++ b/core/res/res/values-fr/strings.xml
@@ -274,7 +274,7 @@
     <string name="safeMode" msgid="2788228061547930246">"Mode sécurisé"</string>
     <string name="android_system_label" msgid="6577375335728551336">"Système Android"</string>
     <string name="user_owner_label" msgid="8836124313744349203">"Passer au profil personnel"</string>
-    <string name="managed_profile_label" msgid="8947929265267690522">"Passer au profil professionnel"</string>
+    <string name="managed_profile_label" msgid="8947929265267690522">"Passer au profil pro"</string>
     <string name="permgrouplab_contacts" msgid="3657758145679177612">"Contacts"</string>
     <string name="permgroupdesc_contacts" msgid="6951499528303668046">"accéder à vos contacts"</string>
     <string name="permgrouprequest_contacts" msgid="6032805601881764300">"Permettre à &lt;b&gt;<xliff:g id="APP_NAME">%1$s</xliff:g>&lt;/b&gt; d\'accéder à vos contacts ?"</string>
@@ -308,15 +308,15 @@
     <string name="permgrouplab_phone" msgid="5229115638567440675">"Téléphone"</string>
     <string name="permgroupdesc_phone" msgid="6234224354060641055">"effectuer et gérer des appels téléphoniques"</string>
     <string name="permgrouprequest_phone" msgid="9166979577750581037">"Permettre à &lt;b&gt;<xliff:g id="APP_NAME">%1$s</xliff:g>&lt;/b&gt; de passer et gérer des appels téléphoniques ?"</string>
-    <string name="permgrouplab_sensors" msgid="416037179223226722">"Capteurs corporels"</string>
+    <string name="permgrouplab_sensors" msgid="4838614103153567532">"Capteurs corporels"</string>
     <string name="permgroupdesc_sensors" msgid="7147968539346634043">"accéder aux données des capteurs relatives à vos signes vitaux"</string>
     <string name="permgrouprequest_sensors" msgid="6349806962814556786">"Permettre à &lt;b&gt;<xliff:g id="APP_NAME">%1$s</xliff:g>&lt;/b&gt; d\'accéder aux données des capteurs relatives à vos signes vitaux ?"</string>
     <string name="permgrouplab_aural" msgid="965607064083134896">"Musique"</string>
     <string name="permgroupdesc_aural" msgid="4870189506255958055">"accéder à votre musique"</string>
     <string name="permgrouprequest_aural" msgid="6787926123071735620">"Autoriser &lt;b&gt;<xliff:g id="APP_NAME">%1$s</xliff:g>&lt;/b&gt; à accéder à votre musique ?"</string>
-    <string name="permgrouplab_visual" msgid="8030190588123857921">"Photos et vidéos"</string>
+    <string name="permgrouplab_visual" msgid="6477382108771145134">"Photos et vidéos"</string>
     <string name="permgroupdesc_visual" msgid="3415827902566663546">"accéder à vos photos et vos vidéos"</string>
-    <string name="permgrouprequest_visual" msgid="6907523945030290376">"Autoriser &lt;b&gt;<xliff:g id="APP_NAME">%1$s</xliff:g>&lt;/b&gt; à accéder à vos photos et vidéos ?"</string>
+    <string name="permgrouprequest_visual" msgid="3043752127595243314">"Autoriser &lt;b&gt;<xliff:g id="APP_NAME">%1$s</xliff:g>&lt;/b&gt; à accéder à vos photos et vidéos, y compris aux tags de lieu ?"</string>
     <string name="capability_title_canRetrieveWindowContent" msgid="3901717936930170320">"Récupérer le contenu d\'une fenêtre"</string>
     <string name="capability_desc_canRetrieveWindowContent" msgid="3772225008605310672">"Inspecte le contenu d\'une fenêtre avec laquelle vous interagissez."</string>
     <string name="capability_title_canRequestTouchExploration" msgid="3108723364676667320">"Activer la fonctionnalité Explorer au toucher"</string>
@@ -1396,8 +1396,7 @@
     <string name="ext_media_init_action" msgid="7952885510091978278">"Configurer"</string>
     <string name="ext_media_unmount_action" msgid="1121883233103278199">"Éjecter"</string>
     <string name="ext_media_browse_action" msgid="8322172381028546087">"Parcourir"</string>
-    <!-- no translation found for ext_media_seamless_action (6575980560886881233) -->
-    <skip />
+    <string name="ext_media_seamless_action" msgid="6575980560886881233">"Changer de sortie"</string>
     <string name="ext_media_missing_title" msgid="620980315821543904">"Mémoire de stockage \"<xliff:g id="NAME">%s</xliff:g>\" manquante"</string>
     <string name="ext_media_missing_message" msgid="4012389235250987930">"Insérez le périphérique"</string>
     <string name="ext_media_move_specific_title" msgid="1471100343872375842">"Transfert de l\'application <xliff:g id="NAME">%s</xliff:g>"</string>
@@ -1611,6 +1610,8 @@
     <string name="display_manager_overlay_display_name" msgid="5142365982271620716">"Superposition n° <xliff:g id="ID">%1$d</xliff:g>"</string>
     <string name="display_manager_overlay_display_title" msgid="652124517672257172">"<xliff:g id="NAME">%1$s</xliff:g> : <xliff:g id="WIDTH">%2$d</xliff:g> x <xliff:g id="HEIGHT">%3$d</xliff:g>, <xliff:g id="DPI">%4$d</xliff:g> dpi"</string>
     <string name="display_manager_overlay_display_secure_suffix" msgid="6022119702628572080">", sécurisé"</string>
+    <string name="activity_starter_block_bg_activity_starts_permissive" msgid="5692097903712956720">"Le démarrage de cette activité en arrière-plan de <xliff:g id="PACKAGENAME">%1$s</xliff:g> sera bloqué dans les prochaines builds Q. Voir go/q-bg-block."</string>
+    <string name="activity_starter_block_bg_activity_starts_enforcing" msgid="8299522481076404353">"Le démarrage de l\'activité en arrière-plan de <xliff:g id="PACKAGENAME">%1$s</xliff:g> a été bloqué. Voir go/q-bg-block."</string>
     <string name="kg_forgot_pattern_button_text" msgid="8852021467868220608">"J\'ai oublié le schéma"</string>
     <string name="kg_wrong_pattern" msgid="1850806070801358830">"Schéma incorrect."</string>
     <string name="kg_wrong_password" msgid="2333281762128113157">"Mot de passe incorrect."</string>
@@ -1996,9 +1997,29 @@
     <string name="dynamic_mode_notification_channel_name" msgid="2348803891571320452">"Notification d\'information du mode Routine"</string>
     <string name="dynamic_mode_notification_title" msgid="508815255807182035">"Vous risquez d\'être à court de batterie plus tôt que prévu"</string>
     <string name="dynamic_mode_notification_summary" msgid="2541166298550402690">"Économiseur de batterie activé pour prolonger l\'autonomie"</string>
+    <string name="mime_type_folder" msgid="7111951698626315204">"Dossier"</string>
+    <string name="mime_type_apk" msgid="5518003630972506900">"Application Android"</string>
+    <string name="mime_type_generic" msgid="6833871596845900027">"Fichier"</string>
+    <string name="mime_type_generic_ext" msgid="8450275970061657174">"Fichier <xliff:g id="EXTENSION">%1$s</xliff:g>"</string>
+    <string name="mime_type_audio" msgid="6289777657172050926">"Audio"</string>
+    <string name="mime_type_audio_ext" msgid="3270880987725816210">"Audio <xliff:g id="EXTENSION">%1$s</xliff:g>"</string>
+    <string name="mime_type_video" msgid="4093025777317307426">"Vidéo"</string>
+    <string name="mime_type_video_ext" msgid="5643771615714173159">"Vidéo <xliff:g id="EXTENSION">%1$s</xliff:g>"</string>
+    <string name="mime_type_image" msgid="3144284451605236371">"Image"</string>
+    <string name="mime_type_image_ext" msgid="1514613218742736590">"Image <xliff:g id="EXTENSION">%1$s</xliff:g>"</string>
+    <string name="mime_type_compressed" msgid="1645486037074943257">"Archive"</string>
+    <string name="mime_type_compressed_ext" msgid="4232293058067801528">"Archive <xliff:g id="EXTENSION">%1$s</xliff:g>"</string>
+    <string name="mime_type_document" msgid="1596838147256375966">"Document"</string>
+    <string name="mime_type_document_ext" msgid="6327266601345501281">"Document <xliff:g id="EXTENSION">%1$s</xliff:g>"</string>
+    <string name="mime_type_spreadsheet" msgid="2639138255207123557">"Feuille de calcul"</string>
+    <string name="mime_type_spreadsheet_ext" msgid="5508653032786106725">"Feuille de calcul <xliff:g id="EXTENSION">%1$s</xliff:g>"</string>
+    <string name="mime_type_presentation" msgid="6145604688774787357">"Présentation"</string>
+    <string name="mime_type_presentation_ext" msgid="2982650207774823437">"Présentation <xliff:g id="EXTENSION">%1$s</xliff:g>"</string>
     <string name="car_loading_profile" msgid="3545132581795684027">"Chargement…"</string>
     <plurals name="file_count" formatted="false" msgid="1628600959752419449">
       <item quantity="one"><xliff:g id="FILE_NAME_2">%s</xliff:g> + <xliff:g id="COUNT_3">%d</xliff:g> fichier</item>
       <item quantity="other"><xliff:g id="FILE_NAME_2">%s</xliff:g> + <xliff:g id="COUNT_3">%d</xliff:g> fichiers</item>
     </plurals>
+    <!-- no translation found for chooser_no_direct_share_targets (997970693708458895) -->
+    <skip />
 </resources>
diff --git a/core/res/res/values-gl/strings.xml b/core/res/res/values-gl/strings.xml
index 4e6f045..78f6ecc 100644
--- a/core/res/res/values-gl/strings.xml
+++ b/core/res/res/values-gl/strings.xml
@@ -308,15 +308,15 @@
     <string name="permgrouplab_phone" msgid="5229115638567440675">"Teléfono"</string>
     <string name="permgroupdesc_phone" msgid="6234224354060641055">"facer e xestionar chamadas telefónicas"</string>
     <string name="permgrouprequest_phone" msgid="9166979577750581037">"Queres permitir que a aplicación &lt;b&gt;<xliff:g id="APP_NAME">%1$s</xliff:g>&lt;/b&gt; realice e xestione chamadas telefónicas?"</string>
-    <string name="permgrouplab_sensors" msgid="416037179223226722">"Sensores corporais"</string>
+    <string name="permgrouplab_sensors" msgid="4838614103153567532">"Sensores corporais"</string>
     <string name="permgroupdesc_sensors" msgid="7147968539346634043">"acceder aos datos dos sensores sobre as túas constantes vitais"</string>
     <string name="permgrouprequest_sensors" msgid="6349806962814556786">"Queres permitir que a aplicación &lt;b&gt;<xliff:g id="APP_NAME">%1$s</xliff:g>&lt;/b&gt; acceda aos datos dos sensores sobre as túas constantes vitais?"</string>
     <string name="permgrouplab_aural" msgid="965607064083134896">"Música"</string>
     <string name="permgroupdesc_aural" msgid="4870189506255958055">"acceder á música"</string>
     <string name="permgrouprequest_aural" msgid="6787926123071735620">"Queres permitir que a aplicación &lt;b&gt;<xliff:g id="APP_NAME">%1$s</xliff:g>&lt;/b&gt; acceda á túa música?"</string>
-    <string name="permgrouplab_visual" msgid="8030190588123857921">"Fotos e vídeos"</string>
+    <string name="permgrouplab_visual" msgid="6477382108771145134">"Fotos e vídeos"</string>
     <string name="permgroupdesc_visual" msgid="3415827902566663546">"acceder ás fotos e aos vídeos"</string>
-    <string name="permgrouprequest_visual" msgid="6907523945030290376">"Queres permitir que a aplicación &lt;b&gt;<xliff:g id="APP_NAME">%1$s</xliff:g>&lt;/b&gt; acceda ás túas fotos e vídeos?"</string>
+    <string name="permgrouprequest_visual" msgid="3043752127595243314">"Queres permitir que &lt;b&gt;<xliff:g id="APP_NAME">%1$s</xliff:g>&lt;/b&gt; acceda ás túas fotos e vídeos, incluídas as localizacións etiquetadas?"</string>
     <string name="capability_title_canRetrieveWindowContent" msgid="3901717936930170320">"Recuperar contido da ventá"</string>
     <string name="capability_desc_canRetrieveWindowContent" msgid="3772225008605310672">"Inspecciona o contido dunha ventá coa que estás interactuando."</string>
     <string name="capability_title_canRequestTouchExploration" msgid="3108723364676667320">"Activar a exploración táctil"</string>
@@ -1397,8 +1397,7 @@
     <string name="ext_media_init_action" msgid="7952885510091978278">"Configurar"</string>
     <string name="ext_media_unmount_action" msgid="1121883233103278199">"Expulsar"</string>
     <string name="ext_media_browse_action" msgid="8322172381028546087">"Explorar"</string>
-    <!-- no translation found for ext_media_seamless_action (6575980560886881233) -->
-    <skip />
+    <string name="ext_media_seamless_action" msgid="6575980560886881233">"Cambiar de saída"</string>
     <string name="ext_media_missing_title" msgid="620980315821543904">"Falta <xliff:g id="NAME">%s</xliff:g>"</string>
     <string name="ext_media_missing_message" msgid="4012389235250987930">"Volve inserir o dispositivo"</string>
     <string name="ext_media_move_specific_title" msgid="1471100343872375842">"Migrando <xliff:g id="NAME">%s</xliff:g>"</string>
@@ -1612,6 +1611,8 @@
     <string name="display_manager_overlay_display_name" msgid="5142365982271620716">"Superposición n.º <xliff:g id="ID">%1$d</xliff:g>"</string>
     <string name="display_manager_overlay_display_title" msgid="652124517672257172">"<xliff:g id="NAME">%1$s</xliff:g>: <xliff:g id="WIDTH">%2$d</xliff:g> x <xliff:g id="HEIGHT">%3$d</xliff:g>, <xliff:g id="DPI">%4$d</xliff:g> ppp"</string>
     <string name="display_manager_overlay_display_secure_suffix" msgid="6022119702628572080">", segura"</string>
+    <string name="activity_starter_block_bg_activity_starts_permissive" msgid="5692097903712956720">"O inicio desta actividade en segundo plano desde <xliff:g id="PACKAGENAME">%1$s</xliff:g> bloquearase en futuras compilacións de Q. Consulta a páxina go/q-bg-block."</string>
+    <string name="activity_starter_block_bg_activity_starts_enforcing" msgid="8299522481076404353">"Bloqueouse o inicio da actividade en segundo plano desde <xliff:g id="PACKAGENAME">%1$s</xliff:g>. Consulta a páxina go/q-bg-block."</string>
     <string name="kg_forgot_pattern_button_text" msgid="8852021467868220608">"Esqueciches o padrón"</string>
     <string name="kg_wrong_pattern" msgid="1850806070801358830">"Padrón incorrecto"</string>
     <string name="kg_wrong_password" msgid="2333281762128113157">"Contrasinal incorrecto"</string>
@@ -1997,9 +1998,29 @@
     <string name="dynamic_mode_notification_channel_name" msgid="2348803891571320452">"Notificación da información do modo de rutina"</string>
     <string name="dynamic_mode_notification_title" msgid="508815255807182035">"A batería pode esgotarse antes do habitual"</string>
     <string name="dynamic_mode_notification_summary" msgid="2541166298550402690">"Para ampliar a duración da batería activouse a función Aforro de batería"</string>
+    <string name="mime_type_folder" msgid="7111951698626315204">"Cartafol"</string>
+    <string name="mime_type_apk" msgid="5518003630972506900">"Aplicación Android"</string>
+    <string name="mime_type_generic" msgid="6833871596845900027">"Ficheiro"</string>
+    <string name="mime_type_generic_ext" msgid="8450275970061657174">"Ficheiro <xliff:g id="EXTENSION">%1$s</xliff:g>"</string>
+    <string name="mime_type_audio" msgid="6289777657172050926">"Audio"</string>
+    <string name="mime_type_audio_ext" msgid="3270880987725816210">"Audio <xliff:g id="EXTENSION">%1$s</xliff:g>"</string>
+    <string name="mime_type_video" msgid="4093025777317307426">"Vídeo"</string>
+    <string name="mime_type_video_ext" msgid="5643771615714173159">"Vídeo <xliff:g id="EXTENSION">%1$s</xliff:g>"</string>
+    <string name="mime_type_image" msgid="3144284451605236371">"Imaxe"</string>
+    <string name="mime_type_image_ext" msgid="1514613218742736590">"Imaxe <xliff:g id="EXTENSION">%1$s</xliff:g>"</string>
+    <string name="mime_type_compressed" msgid="1645486037074943257">"Arquivo"</string>
+    <string name="mime_type_compressed_ext" msgid="4232293058067801528">"Arquivo <xliff:g id="EXTENSION">%1$s</xliff:g>"</string>
+    <string name="mime_type_document" msgid="1596838147256375966">"Documento"</string>
+    <string name="mime_type_document_ext" msgid="6327266601345501281">"Documento <xliff:g id="EXTENSION">%1$s</xliff:g>"</string>
+    <string name="mime_type_spreadsheet" msgid="2639138255207123557">"Folla de cálculo"</string>
+    <string name="mime_type_spreadsheet_ext" msgid="5508653032786106725">"Folla de cálculo <xliff:g id="EXTENSION">%1$s</xliff:g>"</string>
+    <string name="mime_type_presentation" msgid="6145604688774787357">"Presentación"</string>
+    <string name="mime_type_presentation_ext" msgid="2982650207774823437">"Presentación <xliff:g id="EXTENSION">%1$s</xliff:g>"</string>
     <string name="car_loading_profile" msgid="3545132581795684027">"Cargando"</string>
     <plurals name="file_count" formatted="false" msgid="1628600959752419449">
       <item quantity="other"><xliff:g id="FILE_NAME_2">%s</xliff:g> + <xliff:g id="COUNT_3">%d</xliff:g> ficheiros</item>
       <item quantity="one"><xliff:g id="FILE_NAME_0">%s</xliff:g> + <xliff:g id="COUNT_1">%d</xliff:g> ficheiro</item>
     </plurals>
+    <!-- no translation found for chooser_no_direct_share_targets (997970693708458895) -->
+    <skip />
 </resources>
diff --git a/core/res/res/values-gu/strings.xml b/core/res/res/values-gu/strings.xml
index 51feace..8131c0d 100644
--- a/core/res/res/values-gu/strings.xml
+++ b/core/res/res/values-gu/strings.xml
@@ -308,15 +308,15 @@
     <string name="permgrouplab_phone" msgid="5229115638567440675">"ફોન"</string>
     <string name="permgroupdesc_phone" msgid="6234224354060641055">"ફોન કૉલ કરો અને સંચાલિત કરો"</string>
     <string name="permgrouprequest_phone" msgid="9166979577750581037">"&lt;b&gt;<xliff:g id="APP_NAME">%1$s</xliff:g>&lt;/b&gt;ને ફોન કૉલ કરવાની અને તેને મેનેજ કરવાની મંજૂરી આપીએ?"</string>
-    <string name="permgrouplab_sensors" msgid="416037179223226722">"બોડી સેન્સર્સ"</string>
+    <string name="permgrouplab_sensors" msgid="4838614103153567532">"બૉડી સેન્સર"</string>
     <string name="permgroupdesc_sensors" msgid="7147968539346634043">"તમારા મહત્વપૂર્ણ ચિહ્નો વિશે સેન્સર ડેટા ઍક્સેસ કરો"</string>
     <string name="permgrouprequest_sensors" msgid="6349806962814556786">"&lt;b&gt;<xliff:g id="APP_NAME">%1$s</xliff:g>&lt;/b&gt;ને તમારી મહત્વપૂર્ણ સહી વિશેના સેન્સર ડેટાને ઍક્સેસ કરવાની મંજૂરી આપીએ?"</string>
     <string name="permgrouplab_aural" msgid="965607064083134896">"સંગીત"</string>
     <string name="permgroupdesc_aural" msgid="4870189506255958055">"તમારા સંગીતને ઍક્સેસ કરો"</string>
     <string name="permgrouprequest_aural" msgid="6787926123071735620">"&lt;b&gt;<xliff:g id="APP_NAME">%1$s</xliff:g>&lt;/b&gt;ને તમારા સંગીતમાં ઍક્સેસ કરવાની મંજૂરી આપવી છે?"</string>
-    <string name="permgrouplab_visual" msgid="8030190588123857921">"ફોટો અને વિડિઓ"</string>
+    <string name="permgrouplab_visual" msgid="6477382108771145134">"ફોટા અને વીડિયો"</string>
     <string name="permgroupdesc_visual" msgid="3415827902566663546">"તમારા ફોટો &amp; વિડિઓ ઍક્સેસ કરો"</string>
-    <string name="permgrouprequest_visual" msgid="6907523945030290376">"&lt;b&gt;<xliff:g id="APP_NAME">%1$s</xliff:g>&lt;/b&gt; ને તમારા ફોટો &amp; વિડિઓમાં ઍક્સેસ કરવાની મંજૂરી આપવી છે?"</string>
+    <string name="permgrouprequest_visual" msgid="3043752127595243314">"&lt;b&gt;<xliff:g id="APP_NAME">%1$s</xliff:g>&lt;/b&gt;ને તમારા ટૅગ કરેલાં સ્થાનો સહિત ફોટા અને વીડિયો ઍક્સેસ કરવાની મંજૂરી આપવી છે?"</string>
     <string name="capability_title_canRetrieveWindowContent" msgid="3901717936930170320">"વિંડો કન્ટેન્ટ પુનઃપ્રાપ્ત કરો"</string>
     <string name="capability_desc_canRetrieveWindowContent" msgid="3772225008605310672">"તમે જેની સાથે ક્રિયા-પ્રતિક્રિયા કરી રહ્યાં છો તે વિંડોનું કન્ટેન્ટ તપાસો."</string>
     <string name="capability_title_canRequestTouchExploration" msgid="3108723364676667320">"સ્પર્શ કરીને શોધખોળ કરવું ચાલુ કરો"</string>
@@ -1397,8 +1397,7 @@
     <string name="ext_media_init_action" msgid="7952885510091978278">"સેટ કરો"</string>
     <string name="ext_media_unmount_action" msgid="1121883233103278199">"બહાર કાઢો"</string>
     <string name="ext_media_browse_action" msgid="8322172381028546087">"અન્વેષણ કરો"</string>
-    <!-- no translation found for ext_media_seamless_action (6575980560886881233) -->
-    <skip />
+    <string name="ext_media_seamless_action" msgid="6575980560886881233">"આઉટપુટ સ્વિચ કરો"</string>
     <string name="ext_media_missing_title" msgid="620980315821543904">"<xliff:g id="NAME">%s</xliff:g> ખૂટે છે"</string>
     <string name="ext_media_missing_message" msgid="4012389235250987930">"ફરીથી ઉપકરણ દાખલ કરો"</string>
     <string name="ext_media_move_specific_title" msgid="1471100343872375842">"<xliff:g id="NAME">%s</xliff:g> ખસેડી રહ્યાં છીએ"</string>
@@ -1612,6 +1611,8 @@
     <string name="display_manager_overlay_display_name" msgid="5142365982271620716">"#<xliff:g id="ID">%1$d</xliff:g> ઓવરલે કરો"</string>
     <string name="display_manager_overlay_display_title" msgid="652124517672257172">"<xliff:g id="NAME">%1$s</xliff:g>: <xliff:g id="WIDTH">%2$d</xliff:g>x<xliff:g id="HEIGHT">%3$d</xliff:g>, <xliff:g id="DPI">%4$d</xliff:g> dpi"</string>
     <string name="display_manager_overlay_display_secure_suffix" msgid="6022119702628572080">", સુરક્ષિત"</string>
+    <string name="activity_starter_block_bg_activity_starts_permissive" msgid="5692097903712956720">"<xliff:g id="PACKAGENAME">%1$s</xliff:g>માંથી શરૂ થયેલી આ બૅકગ્રાઉન્ડ પ્રવૃત્તિને ભાવિ Q બિલ્ડમાં બ્લૉક કરવામાં આવશે. go/q-bg-block જુઓ."</string>
+    <string name="activity_starter_block_bg_activity_starts_enforcing" msgid="8299522481076404353">"<xliff:g id="PACKAGENAME">%1$s</xliff:g>માંથી શરૂ થયેલી બૅકગ્રાઉન્ડ પ્રવૃત્તિ બ્લૉક કરી છે. go/q-bg-block જુઓ."</string>
     <string name="kg_forgot_pattern_button_text" msgid="8852021467868220608">"પૅટર્ન ભૂલી ગયાં"</string>
     <string name="kg_wrong_pattern" msgid="1850806070801358830">"ખોટી પૅટર્ન"</string>
     <string name="kg_wrong_password" msgid="2333281762128113157">"ખોટો પાસવર્ડ"</string>
@@ -1997,9 +1998,29 @@
     <string name="dynamic_mode_notification_channel_name" msgid="2348803891571320452">"રૂટિન મોડની માહિતીનું નોટિફિકેશન"</string>
     <string name="dynamic_mode_notification_title" msgid="508815255807182035">"સામાન્ય રીતે ચાર્જ કરવાના સમય પહેલાં બૅટરી સમાપ્ત થઈ શકે છે"</string>
     <string name="dynamic_mode_notification_summary" msgid="2541166298550402690">"બૅટરી આવરદા વધારવા માટે બૅટરી સેવર ચાલુ કર્યું"</string>
+    <string name="mime_type_folder" msgid="7111951698626315204">"ફોલ્ડર"</string>
+    <string name="mime_type_apk" msgid="5518003630972506900">"Android ઍપ"</string>
+    <string name="mime_type_generic" msgid="6833871596845900027">"ફાઇલ"</string>
+    <string name="mime_type_generic_ext" msgid="8450275970061657174">"<xliff:g id="EXTENSION">%1$s</xliff:g> ફાઇલ"</string>
+    <string name="mime_type_audio" msgid="6289777657172050926">"ઑડિયો"</string>
+    <string name="mime_type_audio_ext" msgid="3270880987725816210">"<xliff:g id="EXTENSION">%1$s</xliff:g> ઑડિયો"</string>
+    <string name="mime_type_video" msgid="4093025777317307426">"વીડિયો"</string>
+    <string name="mime_type_video_ext" msgid="5643771615714173159">"<xliff:g id="EXTENSION">%1$s</xliff:g> વીડિઓ"</string>
+    <string name="mime_type_image" msgid="3144284451605236371">"છબી"</string>
+    <string name="mime_type_image_ext" msgid="1514613218742736590">"<xliff:g id="EXTENSION">%1$s</xliff:g> છબી"</string>
+    <string name="mime_type_compressed" msgid="1645486037074943257">"આર્કાઇવ"</string>
+    <string name="mime_type_compressed_ext" msgid="4232293058067801528">"<xliff:g id="EXTENSION">%1$s</xliff:g> આર્કાઇવ"</string>
+    <string name="mime_type_document" msgid="1596838147256375966">"દસ્તાવેજ"</string>
+    <string name="mime_type_document_ext" msgid="6327266601345501281">"<xliff:g id="EXTENSION">%1$s</xliff:g> દસ્તાવેજ"</string>
+    <string name="mime_type_spreadsheet" msgid="2639138255207123557">"સ્પ્રેડશીટ"</string>
+    <string name="mime_type_spreadsheet_ext" msgid="5508653032786106725">"<xliff:g id="EXTENSION">%1$s</xliff:g> સ્પ્રેડશીટ"</string>
+    <string name="mime_type_presentation" msgid="6145604688774787357">"પ્રસ્તુતિ"</string>
+    <string name="mime_type_presentation_ext" msgid="2982650207774823437">"<xliff:g id="EXTENSION">%1$s</xliff:g> પ્રસ્તુતિ"</string>
     <string name="car_loading_profile" msgid="3545132581795684027">"લોડિંગ"</string>
     <plurals name="file_count" formatted="false" msgid="1628600959752419449">
       <item quantity="one"><xliff:g id="FILE_NAME_2">%s</xliff:g> + <xliff:g id="COUNT_3">%d</xliff:g> ફાઇલ</item>
       <item quantity="other"><xliff:g id="FILE_NAME_2">%s</xliff:g> + <xliff:g id="COUNT_3">%d</xliff:g> ફાઇલ</item>
     </plurals>
+    <!-- no translation found for chooser_no_direct_share_targets (997970693708458895) -->
+    <skip />
 </resources>
diff --git a/core/res/res/values-hi/strings.xml b/core/res/res/values-hi/strings.xml
index c3885bf..2fd884e 100644
--- a/core/res/res/values-hi/strings.xml
+++ b/core/res/res/values-hi/strings.xml
@@ -308,15 +308,18 @@
     <string name="permgrouplab_phone" msgid="5229115638567440675">"फ़ोन"</string>
     <string name="permgroupdesc_phone" msgid="6234224354060641055">"फ़ोन कॉल करने और उन्हें प्रबंधित करने की अनुमति दें"</string>
     <string name="permgrouprequest_phone" msgid="9166979577750581037">"&lt;b&gt;<xliff:g id="APP_NAME">%1$s</xliff:g>&lt;/b&gt; को फ़ोन कॉल करने और उन्हें प्रबंधित करने की अनुमति दें?"</string>
-    <string name="permgrouplab_sensors" msgid="416037179223226722">"शरीर संवेदक"</string>
+    <!-- no translation found for permgrouplab_sensors (4838614103153567532) -->
+    <skip />
     <string name="permgroupdesc_sensors" msgid="7147968539346634043">"अपने महत्वपूर्ण संकेतों के बारे में सेंसर डेटा को ऐक्सेस करें"</string>
     <string name="permgrouprequest_sensors" msgid="6349806962814556786">"&lt;b&gt;<xliff:g id="APP_NAME">%1$s</xliff:g>&lt;/b&gt; को अपने स्वास्थ्य से जुड़ी ज़रूरी जानकारी इस्तेमाल करने की अनुमति देना चाहते हैं?"</string>
     <string name="permgrouplab_aural" msgid="965607064083134896">"संगीत"</string>
     <string name="permgroupdesc_aural" msgid="4870189506255958055">"अपना संगीत संग्रह एक्सेस करने दें"</string>
     <string name="permgrouprequest_aural" msgid="6787926123071735620">"&lt;b&gt;<xliff:g id="APP_NAME">%1$s</xliff:g>&lt;/b&gt; को अपना संगीत एक्सेस करने दें?"</string>
-    <string name="permgrouplab_visual" msgid="8030190588123857921">"फ़ोटो और वीडियो"</string>
+    <!-- no translation found for permgrouplab_visual (6477382108771145134) -->
+    <skip />
     <string name="permgroupdesc_visual" msgid="3415827902566663546">"अपने फ़ोटो और वीडियो एक्सेस करने दें"</string>
-    <string name="permgrouprequest_visual" msgid="6907523945030290376">"&lt;b&gt;<xliff:g id="APP_NAME">%1$s</xliff:g>&lt;/b&gt; को अपने फ़ोटो और वीडियो एक्सेस करने दें?"</string>
+    <!-- no translation found for permgrouprequest_visual (3043752127595243314) -->
+    <skip />
     <string name="capability_title_canRetrieveWindowContent" msgid="3901717936930170320">"विंडो की सामग्री वापस पाएं"</string>
     <string name="capability_desc_canRetrieveWindowContent" msgid="3772225008605310672">"उस विंडो की सामग्री की जाँच करें, जिसका आप इस्तेमाल कर रहे हैं."</string>
     <string name="capability_title_canRequestTouchExploration" msgid="3108723364676667320">"छूकर, किसी चीज़ से जुड़ी जानकारी सुनने की सुविधा चालू करें"</string>
@@ -510,7 +513,7 @@
     <string name="permlab_disableKeyguard" msgid="3598496301486439258">"अपना स्‍क्रीन लॉक अक्षम करें"</string>
     <string name="permdesc_disableKeyguard" msgid="6034203065077122992">"ऐप्स को कीलॉक और कोई भी संबद्ध पासवर्ड सुरक्षा अक्षम करने देता है. उदाहरण के लिए, इनकमिंग फ़ोन कॉल प्राप्त करते समय फ़ोन, कीलॉक को अक्षम कर देता है, फिर कॉल समाप्त होने पर कीलॉक को पुन: सक्षम कर देता है."</string>
     <string name="permlab_requestScreenLockComplexity" msgid="7028982116060987169">"जानें कि स्क्रीन लॉक कितना मुश्किल है"</string>
-    <string name="permdesc_requestScreenLockComplexity" msgid="2806396846128185677">"यह मंज़ूरी मिलने के बाद ऐप्लिकेशन जान पाता है कि स्क्रीन लॉक कितना मुश्किल (बहुत ज़्यादा, मध्यम, कम या बिल्कुल नहीं) है. इस स्तर से यह पता चलता है कि स्क्रीन लॉक कितना लंबा या किस तरह का है. ऐप्लिकेशन उपयोगकर्ताओं को यह सुझाव भी दे सकता है कि वे स्क्रीन लॉक को एक तय स्तर तक अपडेट करें. मगर उपयोगकर्ता बेझिझक इसे अनदेखा करके आगे बढ़ सकते हैं. ध्यान दें कि स्क्रीन लॉक को सादे टेक्स्ट में सेव नहीं किया जाता है इसलिए ऐप्लिकेशन को बिल्कुल सही पासवर्ड पता नहीं होता."</string>
+    <string name="permdesc_requestScreenLockComplexity" msgid="2806396846128185677">"यह मंज़ूरी मिलने के बाद ऐप्लिकेशन जान पाता है कि स्क्रीन लॉक कितना मुश्किल (बहुत ज़्यादा, मध्यम, कम या बिल्कुल नहीं) है. इस स्तर से यह पता चलता है कि स्क्रीन लॉक कितना लंबा या किस तरह का है. ऐप्लिकेशन उपयोगकर्ताओं को यह सुझाव भी दे सकता है कि वे स्क्रीन लॉक को एक तय स्तर तक अपडेट करें. हालांकि, उपयोगकर्ता बेझिझक इसे अनदेखा करके आगे बढ़ सकते हैं. ध्यान दें कि स्क्रीन लॉक को सादे टेक्स्ट में सेव नहीं किया जाता है इसलिए ऐप्लिकेशन को बिल्कुल सही पासवर्ड पता नहीं होता."</string>
     <string name="permlab_useBiometric" msgid="8837753668509919318">"बायोमीट्रिक हार्डवेयर इस्तेमाल करने दें"</string>
     <string name="permdesc_useBiometric" msgid="8389855232721612926">"पुष्टि के लिए, ऐप्लिकेशन को बायोमीट्रिक हार्डवेयर इस्तेमाल करने की मंज़ूरी दें"</string>
     <string name="permlab_manageFingerprint" msgid="5640858826254575638">"उंगली की छाप के लिए हार्डवेयर को प्रबंधित करें"</string>
@@ -536,8 +539,7 @@
     <string name="biometric_error_user_canceled" msgid="2260175018114348727">"प्रमाणीकरण रद्द किया गया"</string>
     <string name="biometric_not_recognized" msgid="5770511773560736082">"पहचान नहीं हो पाई"</string>
     <string name="biometric_error_canceled" msgid="349665227864885880">"प्रमाणीकरण रद्द किया गया"</string>
-    <!-- no translation found for biometric_error_device_not_secured (6583143098363528349) -->
-    <skip />
+    <string name="biometric_error_device_not_secured" msgid="6583143098363528349">"पिन, पैटर्न या पासवर्ड सेट नहीं है"</string>
     <string name="fingerprint_acquired_partial" msgid="735082772341716043">"आंशिक फ़िंगरप्रिंट की पहचान की गई. कृपया पुनः प्रयास करें."</string>
     <string name="fingerprint_acquired_insufficient" msgid="4596546021310923214">"फ़िंगरप्रिंट संसाधित नहीं हो सका. कृपया पुन: प्रयास करें."</string>
     <string name="fingerprint_acquired_imager_dirty" msgid="1087209702421076105">"फ़िंगरप्रिंट सेंसर गंदा है. कृपया साफ़ करें और फिर कोशिश करें."</string>
@@ -557,8 +559,7 @@
     <string name="fingerprint_error_lockout_permanent" msgid="5033251797919508137">"बहुत अधिक कोशिशें. फ़िंगरप्रिंट सेंसर अक्षम है."</string>
     <string name="fingerprint_error_unable_to_process" msgid="6107816084103552441">"पुन: प्रयास करें."</string>
     <string name="fingerprint_error_no_fingerprints" msgid="7654382120628334248">"कोई फ़िंगरप्रिंट रजिस्टर नहीं किया गया है."</string>
-    <!-- no translation found for fingerprint_error_hw_not_present (409523969613176352) -->
-    <skip />
+    <string name="fingerprint_error_hw_not_present" msgid="409523969613176352">"इस डिवाइस में फ़िंगरप्रिंट सेंसर नहीं है."</string>
     <string name="fingerprint_name_template" msgid="5870957565512716938">"फ़िंगरप्रिंट <xliff:g id="FINGERID">%d</xliff:g>"</string>
   <string-array name="fingerprint_error_vendor">
   </string-array>
@@ -578,22 +579,14 @@
     <string name="face_acquired_too_left" msgid="2712489669456176505">"कृपया डिवाइस को चेहरे के बाईं ओर ले जाएं."</string>
     <string name="face_acquired_poor_gaze" msgid="8344973502980415859">"कृपया सेंसर की ओर देखें."</string>
     <string name="face_acquired_not_detected" msgid="5707782294589511391">"चेहरे की पहचान नहीं हो पाई."</string>
-    <!-- no translation found for face_acquired_too_much_motion (470381210701463822) -->
-    <skip />
-    <!-- no translation found for face_acquired_recalibrate (8077949502893707539) -->
-    <skip />
-    <!-- no translation found for face_acquired_too_different (5553210341111255124) -->
-    <skip />
-    <!-- no translation found for face_acquired_too_similar (1508776858407646460) -->
-    <skip />
-    <!-- no translation found for face_acquired_pan_too_extreme (8203001424525231680) -->
-    <skip />
-    <!-- no translation found for face_acquired_tilt_too_extreme (7641326344460439970) -->
-    <skip />
-    <!-- no translation found for face_acquired_roll_too_extreme (1444829237745898619) -->
-    <skip />
-    <!-- no translation found for face_acquired_obscured (3055077697850272097) -->
-    <skip />
+    <string name="face_acquired_too_much_motion" msgid="470381210701463822">"डिवाइस बहुत ज़्यादा हिल रहा है."</string>
+    <string name="face_acquired_recalibrate" msgid="8077949502893707539">"कृपया फिर से अपने चेहरे की पहचान कराएं."</string>
+    <string name="face_acquired_too_different" msgid="5553210341111255124">"यह चेहरा किसी और का है."</string>
+    <string name="face_acquired_too_similar" msgid="1508776858407646460">"चेहरा काफ़ी मिलता-जुलता है, कृपया अपना पोज़ बदलें."</string>
+    <string name="face_acquired_pan_too_extreme" msgid="8203001424525231680">"कृपया कैमरे की तरफ़ सीधा देखें."</string>
+    <string name="face_acquired_tilt_too_extreme" msgid="7641326344460439970">"कृपया कैमरे की तरफ़ सीधा देखें."</string>
+    <string name="face_acquired_roll_too_extreme" msgid="1444829237745898619">"कृपया अपना सिर सीधा करें, दाएं-बाएं न झुकाएं"</string>
+    <string name="face_acquired_obscured" msgid="3055077697850272097">"चेहरा साफ़ नहीं दिख रहा. कृपया रोशनी बढ़ाएं."</string>
   <string-array name="face_acquired_vendor">
   </string-array>
     <string name="face_error_hw_not_available" msgid="6255891785768984615">"चेहरे की पहचान करने वाला हार्डवेयर मौजूद नहीं है."</string>
@@ -605,8 +598,7 @@
     <string name="face_error_lockout_permanent" msgid="8198354656746088890">"कई बार कोशिश की. चेहरा पहचानने की सुविधा बंद हुई."</string>
     <string name="face_error_unable_to_process" msgid="238761109287767270">"फिर से कोशिश करें."</string>
     <string name="face_error_not_enrolled" msgid="9166792142679691323">"कोई चेहरा रजिस्टर नहीं किया गया है."</string>
-    <!-- no translation found for face_error_hw_not_present (916085883581450331) -->
-    <skip />
+    <string name="face_error_hw_not_present" msgid="916085883581450331">"इस डिवाइस में चेहरे की पहचान करने वाला सेंसर नहीं है."</string>
     <string name="face_name_template" msgid="7004562145809595384">"चेहरा <xliff:g id="FACEID">%d</xliff:g>"</string>
   <string-array name="face_error_vendor">
   </string-array>
@@ -1407,8 +1399,7 @@
     <string name="ext_media_init_action" msgid="7952885510091978278">"सेट करें"</string>
     <string name="ext_media_unmount_action" msgid="1121883233103278199">"निकालें"</string>
     <string name="ext_media_browse_action" msgid="8322172381028546087">"एक्सप्लोर करें"</string>
-    <!-- no translation found for ext_media_seamless_action (6575980560886881233) -->
-    <skip />
+    <string name="ext_media_seamless_action" msgid="6575980560886881233">"आउटपुट बदलें"</string>
     <string name="ext_media_missing_title" msgid="620980315821543904">"<xliff:g id="NAME">%s</xliff:g> गुम है"</string>
     <string name="ext_media_missing_message" msgid="4012389235250987930">"डिवाइस को दोबारा लगाएं"</string>
     <string name="ext_media_move_specific_title" msgid="1471100343872375842">"<xliff:g id="NAME">%s</xliff:g> को ले जाया जा रहा है"</string>
@@ -1622,6 +1613,8 @@
     <string name="display_manager_overlay_display_name" msgid="5142365982271620716">"ओवरले #<xliff:g id="ID">%1$d</xliff:g>"</string>
     <string name="display_manager_overlay_display_title" msgid="652124517672257172">"<xliff:g id="NAME">%1$s</xliff:g>: <xliff:g id="WIDTH">%2$d</xliff:g>x<xliff:g id="HEIGHT">%3$d</xliff:g>, <xliff:g id="DPI">%4$d</xliff:g> dpi"</string>
     <string name="display_manager_overlay_display_secure_suffix" msgid="6022119702628572080">", सुरक्षित"</string>
+    <string name="activity_starter_block_bg_activity_starts_permissive" msgid="5692097903712956720">"आने वाले Q बिल्ड में <xliff:g id="PACKAGENAME">%1$s</xliff:g> के बैकग्राउंड में गतिविधि शुरू करने पर रोक लगा दी जाएगी. go/q-bg-block देखें."</string>
+    <string name="activity_starter_block_bg_activity_starts_enforcing" msgid="8299522481076404353">"<xliff:g id="PACKAGENAME">%1$s</xliff:g> के बैकग्राउंड में गतिविधि शुरू करने पर रोक लगा दी गई है. go/q-bg-block देखें."</string>
     <string name="kg_forgot_pattern_button_text" msgid="8852021467868220608">"आकार भूल गए"</string>
     <string name="kg_wrong_pattern" msgid="1850806070801358830">"गलत पैटर्न डाला गया है"</string>
     <string name="kg_wrong_password" msgid="2333281762128113157">"गलत पासवर्ड"</string>
@@ -2007,9 +2000,29 @@
     <string name="dynamic_mode_notification_channel_name" msgid="2348803891571320452">"रूटीन मोड जानकारी की सूचना"</string>
     <string name="dynamic_mode_notification_title" msgid="508815255807182035">"बैटरी आम तौर पर जितने समय चलती है, उससे पहले खत्म हो सकती है"</string>
     <string name="dynamic_mode_notification_summary" msgid="2541166298550402690">"बैटरी लाइफ़ बढ़ाने के लिए \'बैटरी सेवर\' चालू हो गया है"</string>
+    <string name="mime_type_folder" msgid="7111951698626315204">"फ़ोल्डर"</string>
+    <string name="mime_type_apk" msgid="5518003630972506900">"Android ऐप्लिकेशन"</string>
+    <string name="mime_type_generic" msgid="6833871596845900027">"फ़ाइल"</string>
+    <string name="mime_type_generic_ext" msgid="8450275970061657174">"<xliff:g id="EXTENSION">%1$s</xliff:g> फ़ाइल"</string>
+    <string name="mime_type_audio" msgid="6289777657172050926">"ऑडियो"</string>
+    <string name="mime_type_audio_ext" msgid="3270880987725816210">"<xliff:g id="EXTENSION">%1$s</xliff:g> ऑडियो"</string>
+    <string name="mime_type_video" msgid="4093025777317307426">"वीडियो"</string>
+    <string name="mime_type_video_ext" msgid="5643771615714173159">"<xliff:g id="EXTENSION">%1$s</xliff:g> वीडियो"</string>
+    <string name="mime_type_image" msgid="3144284451605236371">"इमेज"</string>
+    <string name="mime_type_image_ext" msgid="1514613218742736590">"<xliff:g id="EXTENSION">%1$s</xliff:g> इमेज"</string>
+    <string name="mime_type_compressed" msgid="1645486037074943257">"संग्रह"</string>
+    <string name="mime_type_compressed_ext" msgid="4232293058067801528">"<xliff:g id="EXTENSION">%1$s</xliff:g> संग्रह"</string>
+    <string name="mime_type_document" msgid="1596838147256375966">"दस्तावेज़"</string>
+    <string name="mime_type_document_ext" msgid="6327266601345501281">"<xliff:g id="EXTENSION">%1$s</xliff:g> दस्तावेज़"</string>
+    <string name="mime_type_spreadsheet" msgid="2639138255207123557">"स्प्रेडशीट"</string>
+    <string name="mime_type_spreadsheet_ext" msgid="5508653032786106725">"<xliff:g id="EXTENSION">%1$s</xliff:g> स्प्रेडशीट"</string>
+    <string name="mime_type_presentation" msgid="6145604688774787357">"प्रज़ेंटेशन"</string>
+    <string name="mime_type_presentation_ext" msgid="2982650207774823437">"<xliff:g id="EXTENSION">%1$s</xliff:g> प्रज़ेंटेशन"</string>
     <string name="car_loading_profile" msgid="3545132581795684027">"प्राेफ़ाइल लोड हो रही है"</string>
     <plurals name="file_count" formatted="false" msgid="1628600959752419449">
       <item quantity="one"><xliff:g id="FILE_NAME_2">%s</xliff:g> + <xliff:g id="COUNT_3">%d</xliff:g> फ़ाइलें</item>
       <item quantity="other"><xliff:g id="FILE_NAME_2">%s</xliff:g> + <xliff:g id="COUNT_3">%d</xliff:g> फ़ाइलें</item>
     </plurals>
+    <!-- no translation found for chooser_no_direct_share_targets (997970693708458895) -->
+    <skip />
 </resources>
diff --git a/core/res/res/values-hr/strings.xml b/core/res/res/values-hr/strings.xml
index e36837e..d50fda6 100644
--- a/core/res/res/values-hr/strings.xml
+++ b/core/res/res/values-hr/strings.xml
@@ -311,15 +311,15 @@
     <string name="permgrouplab_phone" msgid="5229115638567440675">"Telefon"</string>
     <string name="permgroupdesc_phone" msgid="6234224354060641055">"uspostavljati telefonske pozive i upravljati njima"</string>
     <string name="permgrouprequest_phone" msgid="9166979577750581037">"Želite li dopustiti aplikaciji &lt;b&gt;<xliff:g id="APP_NAME">%1$s</xliff:g>&lt;/b&gt; da upućuje telefonske pozive i upravlja njima?"</string>
-    <string name="permgrouplab_sensors" msgid="416037179223226722">"Biometrijski senzori"</string>
+    <string name="permgrouplab_sensors" msgid="4838614103153567532">"Biometrijski senzori"</string>
     <string name="permgroupdesc_sensors" msgid="7147968539346634043">"pristupiti podacima senzora o vašim vitalnim znakovima"</string>
     <string name="permgrouprequest_sensors" msgid="6349806962814556786">"Želite li dopustiti aplikaciji &lt;b&gt;<xliff:g id="APP_NAME">%1$s</xliff:g>&lt;/b&gt; da pristupa podacima senzora o vašim vitalnim znakovima?"</string>
     <string name="permgrouplab_aural" msgid="965607064083134896">"Glazba"</string>
     <string name="permgroupdesc_aural" msgid="4870189506255958055">"pristup glazbi"</string>
     <string name="permgrouprequest_aural" msgid="6787926123071735620">"Želite li dopustiti aplikaciji &lt;b&gt;<xliff:g id="APP_NAME">%1$s</xliff:g>&lt;/b&gt; da pristupa vašoj glazbi?"</string>
-    <string name="permgrouplab_visual" msgid="8030190588123857921">"Fotografije i videozapisi"</string>
+    <string name="permgrouplab_visual" msgid="6477382108771145134">"Fotografije i videozapisi"</string>
     <string name="permgroupdesc_visual" msgid="3415827902566663546">"pristup fotografijama i &amp; videozapisima"</string>
-    <string name="permgrouprequest_visual" msgid="6907523945030290376">"Želite li dopustiti aplikaciji &lt;b&gt;<xliff:g id="APP_NAME">%1$s</xliff:g>&lt;/b&gt; da pristupa vašim fotografijama i videozapisima?"</string>
+    <string name="permgrouprequest_visual" msgid="3043752127595243314">"Želite li dopustiti da &lt;b&gt;<xliff:g id="APP_NAME">%1$s</xliff:g>&lt;/b&gt; pristupa vašim fotografijama i videozapisima, uključujući označene lokacije?"</string>
     <string name="capability_title_canRetrieveWindowContent" msgid="3901717936930170320">"Dohvaćati sadržaj prozora"</string>
     <string name="capability_desc_canRetrieveWindowContent" msgid="3772225008605310672">"Pregledat će sadržaj prozora koji upotrebljavate."</string>
     <string name="capability_title_canRequestTouchExploration" msgid="3108723364676667320">"Uključiti značajku Istraži dodirom"</string>
@@ -1418,8 +1418,7 @@
     <string name="ext_media_init_action" msgid="7952885510091978278">"Postavljanje"</string>
     <string name="ext_media_unmount_action" msgid="1121883233103278199">"Izbaci"</string>
     <string name="ext_media_browse_action" msgid="8322172381028546087">"Istraži"</string>
-    <!-- no translation found for ext_media_seamless_action (6575980560886881233) -->
-    <skip />
+    <string name="ext_media_seamless_action" msgid="6575980560886881233">"Promjena izlaza"</string>
     <string name="ext_media_missing_title" msgid="620980315821543904">"<xliff:g id="NAME">%s</xliff:g> nedostaje"</string>
     <string name="ext_media_missing_message" msgid="4012389235250987930">"Ponovo umetnite uređaj"</string>
     <string name="ext_media_move_specific_title" msgid="1471100343872375842">"Premještanje aplikacije <xliff:g id="NAME">%s</xliff:g>"</string>
@@ -1634,6 +1633,8 @@
     <string name="display_manager_overlay_display_name" msgid="5142365982271620716">"Preklapanje br. <xliff:g id="ID">%1$d</xliff:g>"</string>
     <string name="display_manager_overlay_display_title" msgid="652124517672257172">"<xliff:g id="NAME">%1$s</xliff:g>: <xliff:g id="WIDTH">%2$d</xliff:g> x <xliff:g id="HEIGHT">%3$d</xliff:g>, <xliff:g id="DPI">%4$d</xliff:g> dpi"</string>
     <string name="display_manager_overlay_display_secure_suffix" msgid="6022119702628572080">", sigurno"</string>
+    <string name="activity_starter_block_bg_activity_starts_permissive" msgid="5692097903712956720">"Pokretanje aktivnosti u pozadini na web-lokaciji <xliff:g id="PACKAGENAME">%1$s</xliff:g> blokirat će se u budućim međuverzijama Q. Pogledajte go/q-bg-block."</string>
+    <string name="activity_starter_block_bg_activity_starts_enforcing" msgid="8299522481076404353">"Blokirano je pokretanje aktivnosti u pozadini na web-lokaciji <xliff:g id="PACKAGENAME">%1$s</xliff:g>. Pogledajte go/q-bg-block."</string>
     <string name="kg_forgot_pattern_button_text" msgid="8852021467868220608">"Zaboravili ste obrazac"</string>
     <string name="kg_wrong_pattern" msgid="1850806070801358830">"Pogrešan obrazac"</string>
     <string name="kg_wrong_password" msgid="2333281762128113157">"Pogrešna zaporka"</string>
@@ -2031,10 +2032,30 @@
     <string name="dynamic_mode_notification_channel_name" msgid="2348803891571320452">"Obavještavanje o informacijama u Rutinskom načinu rada"</string>
     <string name="dynamic_mode_notification_title" msgid="508815255807182035">"Baterija se može isprazniti prije uobičajenog vremena punjenja"</string>
     <string name="dynamic_mode_notification_summary" msgid="2541166298550402690">"Štednja baterije aktivirana je kako bi se produljilo trajanje baterije"</string>
+    <string name="mime_type_folder" msgid="7111951698626315204">"Mapa"</string>
+    <string name="mime_type_apk" msgid="5518003630972506900">"Android aplikacija"</string>
+    <string name="mime_type_generic" msgid="6833871596845900027">"Datoteka"</string>
+    <string name="mime_type_generic_ext" msgid="8450275970061657174">"<xliff:g id="EXTENSION">%1$s</xliff:g> datoteka"</string>
+    <string name="mime_type_audio" msgid="6289777657172050926">"Zvuk"</string>
+    <string name="mime_type_audio_ext" msgid="3270880987725816210">"<xliff:g id="EXTENSION">%1$s</xliff:g> audiozapis"</string>
+    <string name="mime_type_video" msgid="4093025777317307426">"Videozapis"</string>
+    <string name="mime_type_video_ext" msgid="5643771615714173159">"<xliff:g id="EXTENSION">%1$s</xliff:g> videozapis"</string>
+    <string name="mime_type_image" msgid="3144284451605236371">"Slika"</string>
+    <string name="mime_type_image_ext" msgid="1514613218742736590">"<xliff:g id="EXTENSION">%1$s</xliff:g> slika"</string>
+    <string name="mime_type_compressed" msgid="1645486037074943257">"Arhiva"</string>
+    <string name="mime_type_compressed_ext" msgid="4232293058067801528">"<xliff:g id="EXTENSION">%1$s</xliff:g> arhiva"</string>
+    <string name="mime_type_document" msgid="1596838147256375966">"Dokument"</string>
+    <string name="mime_type_document_ext" msgid="6327266601345501281">"<xliff:g id="EXTENSION">%1$s</xliff:g> dokument"</string>
+    <string name="mime_type_spreadsheet" msgid="2639138255207123557">"Proračunska tablica"</string>
+    <string name="mime_type_spreadsheet_ext" msgid="5508653032786106725">"<xliff:g id="EXTENSION">%1$s</xliff:g> proračunska tablica"</string>
+    <string name="mime_type_presentation" msgid="6145604688774787357">"Prezentacija"</string>
+    <string name="mime_type_presentation_ext" msgid="2982650207774823437">"<xliff:g id="EXTENSION">%1$s</xliff:g> prezentacija"</string>
     <string name="car_loading_profile" msgid="3545132581795684027">"Učitavanje"</string>
     <plurals name="file_count" formatted="false" msgid="1628600959752419449">
       <item quantity="one"><xliff:g id="FILE_NAME_2">%s</xliff:g> i još <xliff:g id="COUNT_3">%d</xliff:g> datoteka</item>
       <item quantity="few"><xliff:g id="FILE_NAME_2">%s</xliff:g> i još <xliff:g id="COUNT_3">%d</xliff:g> datoteke</item>
       <item quantity="other"><xliff:g id="FILE_NAME_2">%s</xliff:g> i još <xliff:g id="COUNT_3">%d</xliff:g> datoteka</item>
     </plurals>
+    <!-- no translation found for chooser_no_direct_share_targets (997970693708458895) -->
+    <skip />
 </resources>
diff --git a/core/res/res/values-hu/strings.xml b/core/res/res/values-hu/strings.xml
index 20d06c3..5d0086b 100644
--- a/core/res/res/values-hu/strings.xml
+++ b/core/res/res/values-hu/strings.xml
@@ -308,15 +308,15 @@
     <string name="permgrouplab_phone" msgid="5229115638567440675">"Telefon"</string>
     <string name="permgroupdesc_phone" msgid="6234224354060641055">"telefonhívások kezdeményezése és kezelése"</string>
     <string name="permgrouprequest_phone" msgid="9166979577750581037">"Engedélyezi a(z) &lt;b&gt;<xliff:g id="APP_NAME">%1$s</xliff:g>&lt;/b&gt; számára, hogy hívásokat indíthasson és kezelhessen?"</string>
-    <string name="permgrouplab_sensors" msgid="416037179223226722">"Testérzékelők"</string>
+    <string name="permgrouplab_sensors" msgid="4838614103153567532">"Testérzékelők"</string>
     <string name="permgroupdesc_sensors" msgid="7147968539346634043">"az érzékelők által mért, életjelekkel kapcsolatos adatok elérése"</string>
     <string name="permgrouprequest_sensors" msgid="6349806962814556786">"Engedélyezi a(z) &lt;b&gt;<xliff:g id="APP_NAME">%1$s</xliff:g>&lt;/b&gt; számára, hogy hozzáférjen az életjelekkel kapcsolatos szenzoradatokhoz?"</string>
     <string name="permgrouplab_aural" msgid="965607064083134896">"Zene"</string>
     <string name="permgroupdesc_aural" msgid="4870189506255958055">"hozzáférés a zenékhez"</string>
     <string name="permgrouprequest_aural" msgid="6787926123071735620">"Engedélyezi a(z) &lt;b&gt;<xliff:g id="APP_NAME">%1$s</xliff:g>&lt;/b&amp;gt számára, hogy hozzáférjen az Ön zenéihez?"</string>
-    <string name="permgrouplab_visual" msgid="8030190588123857921">"Fényképek és videók"</string>
+    <string name="permgrouplab_visual" msgid="6477382108771145134">"Fotók és videók"</string>
     <string name="permgroupdesc_visual" msgid="3415827902566663546">"hozzáférés a fényképekhez és videókhoz"</string>
-    <string name="permgrouprequest_visual" msgid="6907523945030290376">"Engedélyezi a(z) &lt;b&gt;<xliff:g id="APP_NAME">%1$s</xliff:g>&lt;/b&amp;gt számára, hogy hozzáférjen a fotókhoz és videókhoz?"</string>
+    <string name="permgrouprequest_visual" msgid="3043752127595243314">"Engedélyezi a(z) &lt;b&gt;<xliff:g id="APP_NAME">%1$s</xliff:g>&lt;/b&gt; számára a fotókhoz és videókhoz (köztük a címkézett helyekhez) való hozzáférést?"</string>
     <string name="capability_title_canRetrieveWindowContent" msgid="3901717936930170320">"Ablaktartalom lekérdezése"</string>
     <string name="capability_desc_canRetrieveWindowContent" msgid="3772225008605310672">"A használt ablak tartalmának vizsgálata."</string>
     <string name="capability_title_canRequestTouchExploration" msgid="3108723364676667320">"Felfedezés érintéssel bekapcsolása"</string>
@@ -1396,8 +1396,7 @@
     <string name="ext_media_init_action" msgid="7952885510091978278">"Beállítás"</string>
     <string name="ext_media_unmount_action" msgid="1121883233103278199">"Kiadás"</string>
     <string name="ext_media_browse_action" msgid="8322172381028546087">"Tallózás"</string>
-    <!-- no translation found for ext_media_seamless_action (6575980560886881233) -->
-    <skip />
+    <string name="ext_media_seamless_action" msgid="6575980560886881233">"Kimenet átváltása"</string>
     <string name="ext_media_missing_title" msgid="620980315821543904">"A(z) <xliff:g id="NAME">%s</xliff:g> nem található"</string>
     <string name="ext_media_missing_message" msgid="4012389235250987930">"Csatlakoztassa újra az eszközt"</string>
     <string name="ext_media_move_specific_title" msgid="1471100343872375842">"<xliff:g id="NAME">%s</xliff:g> áthelyezése"</string>
@@ -1611,6 +1610,8 @@
     <string name="display_manager_overlay_display_name" msgid="5142365982271620716">"<xliff:g id="ID">%1$d</xliff:g>. fedvény"</string>
     <string name="display_manager_overlay_display_title" msgid="652124517672257172">"<xliff:g id="NAME">%1$s</xliff:g>: <xliff:g id="WIDTH">%2$d</xliff:g> x <xliff:g id="HEIGHT">%3$d</xliff:g>, <xliff:g id="DPI">%4$d</xliff:g> képpont"</string>
     <string name="display_manager_overlay_display_secure_suffix" msgid="6022119702628572080">", biztonságos"</string>
+    <string name="activity_starter_block_bg_activity_starts_permissive" msgid="5692097903712956720">"Ez a háttértevékenység-indítás le lesz tiltva a(z) <xliff:g id="PACKAGENAME">%1$s</xliff:g> számára a jövőbeni Q-buildeknél. Lásd: go/q-bg-block."</string>
+    <string name="activity_starter_block_bg_activity_starts_enforcing" msgid="8299522481076404353">"A(z) <xliff:g id="PACKAGENAME">%1$s</xliff:g> számára le van tiltva a háttértevékenységek indítása. Lásd: go/q-bg-block."</string>
     <string name="kg_forgot_pattern_button_text" msgid="8852021467868220608">"Elfelejtett minta"</string>
     <string name="kg_wrong_pattern" msgid="1850806070801358830">"Helytelen minta"</string>
     <string name="kg_wrong_password" msgid="2333281762128113157">"Helytelen jelszó"</string>
@@ -1996,9 +1997,29 @@
     <string name="dynamic_mode_notification_channel_name" msgid="2348803891571320452">"Információs értesítés a rutinmódról"</string>
     <string name="dynamic_mode_notification_title" msgid="508815255807182035">"Előfordulhat, hogy az akkumulátor lemerül a szokásos töltési időszak előtt"</string>
     <string name="dynamic_mode_notification_summary" msgid="2541166298550402690">"Akkumulátorkímélő mód aktiválva az akkumulátor üzemidejének növelése érdekében"</string>
+    <string name="mime_type_folder" msgid="7111951698626315204">"Mappa"</string>
+    <string name="mime_type_apk" msgid="5518003630972506900">"Android-alkalmazás"</string>
+    <string name="mime_type_generic" msgid="6833871596845900027">"Fájl"</string>
+    <string name="mime_type_generic_ext" msgid="8450275970061657174">"<xliff:g id="EXTENSION">%1$s</xliff:g>-fájl"</string>
+    <string name="mime_type_audio" msgid="6289777657172050926">"Hang"</string>
+    <string name="mime_type_audio_ext" msgid="3270880987725816210">"<xliff:g id="EXTENSION">%1$s</xliff:g>-hangfájl"</string>
+    <string name="mime_type_video" msgid="4093025777317307426">"Videó"</string>
+    <string name="mime_type_video_ext" msgid="5643771615714173159">"<xliff:g id="EXTENSION">%1$s</xliff:g>-videó"</string>
+    <string name="mime_type_image" msgid="3144284451605236371">"Kép"</string>
+    <string name="mime_type_image_ext" msgid="1514613218742736590">"<xliff:g id="EXTENSION">%1$s</xliff:g>-kép"</string>
+    <string name="mime_type_compressed" msgid="1645486037074943257">"Archívum"</string>
+    <string name="mime_type_compressed_ext" msgid="4232293058067801528">"<xliff:g id="EXTENSION">%1$s</xliff:g>-archívum"</string>
+    <string name="mime_type_document" msgid="1596838147256375966">"Dokumentum"</string>
+    <string name="mime_type_document_ext" msgid="6327266601345501281">"<xliff:g id="EXTENSION">%1$s</xliff:g>-dokumentum"</string>
+    <string name="mime_type_spreadsheet" msgid="2639138255207123557">"Táblázat"</string>
+    <string name="mime_type_spreadsheet_ext" msgid="5508653032786106725">"<xliff:g id="EXTENSION">%1$s</xliff:g>-táblázat"</string>
+    <string name="mime_type_presentation" msgid="6145604688774787357">"Prezentáció"</string>
+    <string name="mime_type_presentation_ext" msgid="2982650207774823437">"<xliff:g id="EXTENSION">%1$s</xliff:g>-prezentáció"</string>
     <string name="car_loading_profile" msgid="3545132581795684027">"Betöltés"</string>
     <plurals name="file_count" formatted="false" msgid="1628600959752419449">
       <item quantity="other"><xliff:g id="FILE_NAME_2">%s</xliff:g> + <xliff:g id="COUNT_3">%d</xliff:g> fájl</item>
       <item quantity="one"><xliff:g id="FILE_NAME_0">%s</xliff:g> + <xliff:g id="COUNT_1">%d</xliff:g> fájl</item>
     </plurals>
+    <!-- no translation found for chooser_no_direct_share_targets (997970693708458895) -->
+    <skip />
 </resources>
diff --git a/core/res/res/values-hy/strings.xml b/core/res/res/values-hy/strings.xml
index 1c05168..7d9f8ac 100644
--- a/core/res/res/values-hy/strings.xml
+++ b/core/res/res/values-hy/strings.xml
@@ -308,15 +308,15 @@
     <string name="permgrouplab_phone" msgid="5229115638567440675">"Հեռախոս"</string>
     <string name="permgroupdesc_phone" msgid="6234224354060641055">"կատարել զանգեր և կառավարել զանգերը"</string>
     <string name="permgrouprequest_phone" msgid="9166979577750581037">"Թույլ տա՞լ &lt;b&gt;<xliff:g id="APP_NAME">%1$s</xliff:g>&lt;/b&gt; հավելվածին կատարել հեռախոսազանգեր և կառավարել դրանք:"</string>
-    <string name="permgrouplab_sensors" msgid="416037179223226722">"Մարմնի սենսորներ"</string>
+    <string name="permgrouplab_sensors" msgid="4838614103153567532">"Մարմնի տվիչներ"</string>
     <string name="permgroupdesc_sensors" msgid="7147968539346634043">"օգտագործել սենսորների տվյալները ձեր օրգանիզմի վիճակի մասին"</string>
     <string name="permgrouprequest_sensors" msgid="6349806962814556786">"Թույլ տա՞լ &lt;b&gt;<xliff:g id="APP_NAME">%1$s</xliff:g>&lt;/b&gt; հավելվածին սենսորից ստանալ ձեր կենսագործունեության հիմնական տվյալները:"</string>
     <string name="permgrouplab_aural" msgid="965607064083134896">"Երաժշտություն"</string>
     <string name="permgroupdesc_aural" msgid="4870189506255958055">"երաժշտության հասանելիություն"</string>
     <string name="permgrouprequest_aural" msgid="6787926123071735620">"Հասանելի դարձնե՞լ &lt;b&gt;<xliff:g id="APP_NAME">%1$s</xliff:g>&lt;/b&gt; հավելվածին ձեր երաժշտությունը:"</string>
-    <string name="permgrouplab_visual" msgid="8030190588123857921">"Լուսանկարներ և տեսանյութեր"</string>
+    <string name="permgrouplab_visual" msgid="6477382108771145134">"Լուսանկարներ և տեսանյութեր"</string>
     <string name="permgroupdesc_visual" msgid="3415827902566663546">"լուսանկարների և տեսանյութերի հասանելիություն"</string>
-    <string name="permgrouprequest_visual" msgid="6907523945030290376">"Հասանելի դարձնե՞լ &lt;b&gt;<xliff:g id="APP_NAME">%1$s</xliff:g>&lt;/b&gt; հավելվածին ձեր լուսանկարներն ու տեսանյութերը։"</string>
+    <string name="permgrouprequest_visual" msgid="3043752127595243314">"Հասանելի դարձնե՞լ &lt;b&gt;<xliff:g id="APP_NAME">%1$s</xliff:g>&lt;/b&gt; հավելվածին ձեր լուսանկարները, տեսանյութերը և տեղանշված վայրերը:"</string>
     <string name="capability_title_canRetrieveWindowContent" msgid="3901717936930170320">"Առբերել պատուհանի բովանդակությունը"</string>
     <string name="capability_desc_canRetrieveWindowContent" msgid="3772225008605310672">"Վերլուծել գործող պատուհանի բովանդակությունը"</string>
     <string name="capability_title_canRequestTouchExploration" msgid="3108723364676667320">"Միացնել Հպման միջոցով հետազոտումը"</string>
@@ -1611,6 +1611,8 @@
     <string name="display_manager_overlay_display_name" msgid="5142365982271620716">"Վերածածկ #<xliff:g id="ID">%1$d</xliff:g>"</string>
     <string name="display_manager_overlay_display_title" msgid="652124517672257172">"<xliff:g id="NAME">%1$s</xliff:g>. <xliff:g id="WIDTH">%2$d</xliff:g>x<xliff:g id="HEIGHT">%3$d</xliff:g>, <xliff:g id="DPI">%4$d</xliff:g> կմվ"</string>
     <string name="display_manager_overlay_display_secure_suffix" msgid="6022119702628572080">", անվտանգ"</string>
+    <string name="activity_starter_block_bg_activity_starts_permissive" msgid="5692097903712956720">"Ֆոնային ռեժիմում <xliff:g id="PACKAGENAME">%1$s</xliff:g>-ի աշխատանքի գործարկումը կարգելափակվի հաջորդ Q կառուցումներում։ Տես այստեղ՝ go/q-bg-block։"</string>
+    <string name="activity_starter_block_bg_activity_starts_enforcing" msgid="8299522481076404353">"Ֆոնային ռեժիմում <xliff:g id="PACKAGENAME">%1$s</xliff:g>-ի աշխատանքի գործարկումն արգելափակվեց։ Տես այստեղ՝ go/q-bg-block։"</string>
     <string name="kg_forgot_pattern_button_text" msgid="8852021467868220608">"Մոռացել եմ սխեման"</string>
     <string name="kg_wrong_pattern" msgid="1850806070801358830">"Սխալ սխեմա"</string>
     <string name="kg_wrong_password" msgid="2333281762128113157">"Սխալ գաղտնաբառ"</string>
@@ -1996,9 +1998,29 @@
     <string name="dynamic_mode_notification_channel_name" msgid="2348803891571320452">"Ծանուցում լիցքավորման մասին"</string>
     <string name="dynamic_mode_notification_title" msgid="508815255807182035">"Մարտկոցի լիցքը կարող է սովորականից շուտ սպառվել"</string>
     <string name="dynamic_mode_notification_summary" msgid="2541166298550402690">"Մարտկոցի կյանքը երկարացնելու համար ակտիվացվել է մարտկոցի տնտեսման ռեժիմը"</string>
+    <string name="mime_type_folder" msgid="7111951698626315204">"Պանակ"</string>
+    <string name="mime_type_apk" msgid="5518003630972506900">"Android հավելված"</string>
+    <string name="mime_type_generic" msgid="6833871596845900027">"Ֆայլ"</string>
+    <string name="mime_type_generic_ext" msgid="8450275970061657174">"<xliff:g id="EXTENSION">%1$s</xliff:g> ֆայլ"</string>
+    <string name="mime_type_audio" msgid="6289777657172050926">"Աուդիո ֆայլ"</string>
+    <string name="mime_type_audio_ext" msgid="3270880987725816210">"<xliff:g id="EXTENSION">%1$s</xliff:g> աուդիո ֆայլ"</string>
+    <string name="mime_type_video" msgid="4093025777317307426">"Տեսանյութ"</string>
+    <string name="mime_type_video_ext" msgid="5643771615714173159">"<xliff:g id="EXTENSION">%1$s</xliff:g> տեսանյութ"</string>
+    <string name="mime_type_image" msgid="3144284451605236371">"Պատկեր"</string>
+    <string name="mime_type_image_ext" msgid="1514613218742736590">"<xliff:g id="EXTENSION">%1$s</xliff:g> պատկեր"</string>
+    <string name="mime_type_compressed" msgid="1645486037074943257">"Արխիվ"</string>
+    <string name="mime_type_compressed_ext" msgid="4232293058067801528">"<xliff:g id="EXTENSION">%1$s</xliff:g> արխիվ"</string>
+    <string name="mime_type_document" msgid="1596838147256375966">"Փաստաթուղթ"</string>
+    <string name="mime_type_document_ext" msgid="6327266601345501281">"<xliff:g id="EXTENSION">%1$s</xliff:g> փաստաթուղթ"</string>
+    <string name="mime_type_spreadsheet" msgid="2639138255207123557">"Աղյուսակ"</string>
+    <string name="mime_type_spreadsheet_ext" msgid="5508653032786106725">"<xliff:g id="EXTENSION">%1$s</xliff:g> աղյուսակ"</string>
+    <string name="mime_type_presentation" msgid="6145604688774787357">"Ներկայացում"</string>
+    <string name="mime_type_presentation_ext" msgid="2982650207774823437">"<xliff:g id="EXTENSION">%1$s</xliff:g> ներկայացում"</string>
     <string name="car_loading_profile" msgid="3545132581795684027">"Բեռնում"</string>
     <plurals name="file_count" formatted="false" msgid="1628600959752419449">
       <item quantity="one"><xliff:g id="FILE_NAME_2">%s</xliff:g> + <xliff:g id="COUNT_3">%d</xliff:g> ֆայլ</item>
       <item quantity="other"><xliff:g id="FILE_NAME_2">%s</xliff:g> + <xliff:g id="COUNT_3">%d</xliff:g> ֆայլ</item>
     </plurals>
+    <!-- no translation found for chooser_no_direct_share_targets (997970693708458895) -->
+    <skip />
 </resources>
diff --git a/core/res/res/values-in/strings.xml b/core/res/res/values-in/strings.xml
index a27a672..6432e37 100644
--- a/core/res/res/values-in/strings.xml
+++ b/core/res/res/values-in/strings.xml
@@ -308,15 +308,15 @@
     <string name="permgrouplab_phone" msgid="5229115638567440675">"Telepon"</string>
     <string name="permgroupdesc_phone" msgid="6234224354060641055">"melakukan dan mengelola panggilan telepon"</string>
     <string name="permgrouprequest_phone" msgid="9166979577750581037">"Izinkan &lt;b&gt;<xliff:g id="APP_NAME">%1$s</xliff:g>&lt;/b&gt; melakukan dan mengelola panggilan telepon?"</string>
-    <string name="permgrouplab_sensors" msgid="416037179223226722">"Sensor Tubuh"</string>
+    <string name="permgrouplab_sensors" msgid="4838614103153567532">"Sensor tubuh"</string>
     <string name="permgroupdesc_sensors" msgid="7147968539346634043">"mengakses data sensor tentang tanda-tanda vital"</string>
     <string name="permgrouprequest_sensors" msgid="6349806962814556786">"Izinkan &lt;b&gt;<xliff:g id="APP_NAME">%1$s</xliff:g>&lt;/b&gt; mengakses data sensor tentang tanda-tanda vital Anda?"</string>
     <string name="permgrouplab_aural" msgid="965607064083134896">"Musik"</string>
     <string name="permgroupdesc_aural" msgid="4870189506255958055">"mengakses musik Anda"</string>
     <string name="permgrouprequest_aural" msgid="6787926123071735620">"Izinkan &lt;b&gt;<xliff:g id="APP_NAME">%1$s</xliff:g>&lt;/b&gt; untuk mengakses musik?"</string>
-    <string name="permgrouplab_visual" msgid="8030190588123857921">"Foto &amp; Video"</string>
+    <string name="permgrouplab_visual" msgid="6477382108771145134">"Foto &amp; video"</string>
     <string name="permgroupdesc_visual" msgid="3415827902566663546">"mengakses foto &amp; video Anda"</string>
-    <string name="permgrouprequest_visual" msgid="6907523945030290376">"Izinkan &lt;b&gt;<xliff:g id="APP_NAME">%1$s</xliff:g>&lt;/b&gt; untuk mengakses foto &amp; video?"</string>
+    <string name="permgrouprequest_visual" msgid="3043752127595243314">"Izinkan &lt;b&gt;<xliff:g id="APP_NAME">%1$s</xliff:g>&lt;/b&gt; mengakses foto dan video Anda, termasuk lokasi yang diberi tag?"</string>
     <string name="capability_title_canRetrieveWindowContent" msgid="3901717936930170320">"Mengambil konten jendela"</string>
     <string name="capability_desc_canRetrieveWindowContent" msgid="3772225008605310672">"Memeriksa konten jendela tempat Anda berinteraksi."</string>
     <string name="capability_title_canRequestTouchExploration" msgid="3108723364676667320">"Mengaktifkan Jelajahi dengan Sentuhan"</string>
@@ -1396,8 +1396,7 @@
     <string name="ext_media_init_action" msgid="7952885510091978278">"Siapkan"</string>
     <string name="ext_media_unmount_action" msgid="1121883233103278199">"Keluarkan"</string>
     <string name="ext_media_browse_action" msgid="8322172381028546087">"Jelajahi"</string>
-    <!-- no translation found for ext_media_seamless_action (6575980560886881233) -->
-    <skip />
+    <string name="ext_media_seamless_action" msgid="6575980560886881233">"Ganti keluaran"</string>
     <string name="ext_media_missing_title" msgid="620980315821543904">"Tidak ada <xliff:g id="NAME">%s</xliff:g>"</string>
     <string name="ext_media_missing_message" msgid="4012389235250987930">"Masukkan perangkat lagi"</string>
     <string name="ext_media_move_specific_title" msgid="1471100343872375842">"Memindahkan <xliff:g id="NAME">%s</xliff:g>"</string>
@@ -1611,6 +1610,8 @@
     <string name="display_manager_overlay_display_name" msgid="5142365982271620716">"Hamparan #<xliff:g id="ID">%1$d</xliff:g>"</string>
     <string name="display_manager_overlay_display_title" msgid="652124517672257172">"<xliff:g id="NAME">%1$s</xliff:g>: <xliff:g id="WIDTH">%2$d</xliff:g>x<xliff:g id="HEIGHT">%3$d</xliff:g>, <xliff:g id="DPI">%4$d</xliff:g> dpi"</string>
     <string name="display_manager_overlay_display_secure_suffix" msgid="6022119702628572080">", aman"</string>
+    <string name="activity_starter_block_bg_activity_starts_permissive" msgid="5692097903712956720">"Aktivitas latar belakang yang dimulai dari <xliff:g id="PACKAGENAME">%1$s</xliff:g> akan diblokir di build Q di masa mendatang. Lihat go/q-bg-block."</string>
+    <string name="activity_starter_block_bg_activity_starts_enforcing" msgid="8299522481076404353">"Aktivitas latar belakang yang dimulai dari <xliff:g id="PACKAGENAME">%1$s</xliff:g> diblokir. Lihat go/q-bg-block."</string>
     <string name="kg_forgot_pattern_button_text" msgid="8852021467868220608">"Lupa Pola?"</string>
     <string name="kg_wrong_pattern" msgid="1850806070801358830">"Pola Salah"</string>
     <string name="kg_wrong_password" msgid="2333281762128113157">"Sandi Salah"</string>
@@ -1996,9 +1997,29 @@
     <string name="dynamic_mode_notification_channel_name" msgid="2348803891571320452">"Notifikasi info Mode Rutinitas"</string>
     <string name="dynamic_mode_notification_title" msgid="508815255807182035">"Baterai mungkin habis sebelum pengisian daya biasanya"</string>
     <string name="dynamic_mode_notification_summary" msgid="2541166298550402690">"Penghemat Baterai diaktifkan untuk memperpanjang masa pakai baterai"</string>
+    <string name="mime_type_folder" msgid="7111951698626315204">"Folder"</string>
+    <string name="mime_type_apk" msgid="5518003630972506900">"Aplikasi Android"</string>
+    <string name="mime_type_generic" msgid="6833871596845900027">"File"</string>
+    <string name="mime_type_generic_ext" msgid="8450275970061657174">"File <xliff:g id="EXTENSION">%1$s</xliff:g>"</string>
+    <string name="mime_type_audio" msgid="6289777657172050926">"Audio"</string>
+    <string name="mime_type_audio_ext" msgid="3270880987725816210">"Audio <xliff:g id="EXTENSION">%1$s</xliff:g>"</string>
+    <string name="mime_type_video" msgid="4093025777317307426">"Video"</string>
+    <string name="mime_type_video_ext" msgid="5643771615714173159">"Video <xliff:g id="EXTENSION">%1$s</xliff:g>"</string>
+    <string name="mime_type_image" msgid="3144284451605236371">"Gambar"</string>
+    <string name="mime_type_image_ext" msgid="1514613218742736590">"Gambar <xliff:g id="EXTENSION">%1$s</xliff:g>"</string>
+    <string name="mime_type_compressed" msgid="1645486037074943257">"Arsip"</string>
+    <string name="mime_type_compressed_ext" msgid="4232293058067801528">"Arsip <xliff:g id="EXTENSION">%1$s</xliff:g>"</string>
+    <string name="mime_type_document" msgid="1596838147256375966">"Dokumen"</string>
+    <string name="mime_type_document_ext" msgid="6327266601345501281">"Dokumen <xliff:g id="EXTENSION">%1$s</xliff:g>"</string>
+    <string name="mime_type_spreadsheet" msgid="2639138255207123557">"Spreadsheet"</string>
+    <string name="mime_type_spreadsheet_ext" msgid="5508653032786106725">"Spreadsheet <xliff:g id="EXTENSION">%1$s</xliff:g>"</string>
+    <string name="mime_type_presentation" msgid="6145604688774787357">"Presentasi"</string>
+    <string name="mime_type_presentation_ext" msgid="2982650207774823437">"Presentasi <xliff:g id="EXTENSION">%1$s</xliff:g>"</string>
     <string name="car_loading_profile" msgid="3545132581795684027">"Memuat"</string>
     <plurals name="file_count" formatted="false" msgid="1628600959752419449">
       <item quantity="other"><xliff:g id="FILE_NAME_2">%s</xliff:g> + <xliff:g id="COUNT_3">%d</xliff:g> file</item>
       <item quantity="one"><xliff:g id="FILE_NAME_0">%s</xliff:g> + <xliff:g id="COUNT_1">%d</xliff:g> file</item>
     </plurals>
+    <!-- no translation found for chooser_no_direct_share_targets (997970693708458895) -->
+    <skip />
 </resources>
diff --git a/core/res/res/values-is/strings.xml b/core/res/res/values-is/strings.xml
index d03e2a2..d27d8b5 100644
--- a/core/res/res/values-is/strings.xml
+++ b/core/res/res/values-is/strings.xml
@@ -308,15 +308,15 @@
     <string name="permgrouplab_phone" msgid="5229115638567440675">"Sími"</string>
     <string name="permgroupdesc_phone" msgid="6234224354060641055">"hringja og stjórna símtölum"</string>
     <string name="permgrouprequest_phone" msgid="9166979577750581037">"Viltu leyfa &lt;b&gt;<xliff:g id="APP_NAME">%1$s</xliff:g>&lt;/b&gt; að hringja og stjórna símtölum?"</string>
-    <string name="permgrouplab_sensors" msgid="416037179223226722">"Líkamsskynjarar"</string>
+    <string name="permgrouplab_sensors" msgid="4838614103153567532">"Líkamsskynjarar"</string>
     <string name="permgroupdesc_sensors" msgid="7147968539346634043">"aðgangur að skynjaragögnum yfir lífsmörk þín"</string>
     <string name="permgrouprequest_sensors" msgid="6349806962814556786">"Viltu veita &lt;b&gt;<xliff:g id="APP_NAME">%1$s</xliff:g>&lt;/b&gt; aðgang að skynjaragögnum yfir lífsmörk þín?"</string>
     <string name="permgrouplab_aural" msgid="965607064083134896">"Tónlist"</string>
     <string name="permgroupdesc_aural" msgid="4870189506255958055">"fá aðgang að tónlistinni þinni"</string>
     <string name="permgrouprequest_aural" msgid="6787926123071735620">"Viltu veita &lt;b&gt;<xliff:g id="APP_NAME">%1$s</xliff:g>&lt;/b&gt; aðgang að tónlistinni þinni?"</string>
-    <string name="permgrouplab_visual" msgid="8030190588123857921">"Myndir og myndskeið"</string>
+    <string name="permgrouplab_visual" msgid="6477382108771145134">"Myndir og myndskeið"</string>
     <string name="permgroupdesc_visual" msgid="3415827902566663546">"fá aðgang að myndunum og myndskeiðunum þínum"</string>
-    <string name="permgrouprequest_visual" msgid="6907523945030290376">"Viltu veita &lt;b&gt;<xliff:g id="APP_NAME">%1$s</xliff:g>&lt;/b&gt; aðgang að myndunum og myndskeiðunum þínum?"</string>
+    <string name="permgrouprequest_visual" msgid="3043752127595243314">"Viltu veita &lt;b&gt;<xliff:g id="APP_NAME">%1$s</xliff:g>&lt;/b&gt; aðgang að myndunum þínum og myndskeiðum, þ.m.t. merktum staðsetningum?"</string>
     <string name="capability_title_canRetrieveWindowContent" msgid="3901717936930170320">"Sækja innihald glugga"</string>
     <string name="capability_desc_canRetrieveWindowContent" msgid="3772225008605310672">"Kanna innihald glugga sem þú ert að nota."</string>
     <string name="capability_title_canRequestTouchExploration" msgid="3108723364676667320">"Kveikja á snertikönnun"</string>
@@ -1397,8 +1397,7 @@
     <string name="ext_media_init_action" msgid="7952885510091978278">"Setja upp"</string>
     <string name="ext_media_unmount_action" msgid="1121883233103278199">"Fjarlægja"</string>
     <string name="ext_media_browse_action" msgid="8322172381028546087">"Kanna"</string>
-    <!-- no translation found for ext_media_seamless_action (6575980560886881233) -->
-    <skip />
+    <string name="ext_media_seamless_action" msgid="6575980560886881233">"Skipta um úttak"</string>
     <string name="ext_media_missing_title" msgid="620980315821543904">"<xliff:g id="NAME">%s</xliff:g> vantar"</string>
     <string name="ext_media_missing_message" msgid="4012389235250987930">"Tengdu tækið aftur"</string>
     <string name="ext_media_move_specific_title" msgid="1471100343872375842">"Flytur <xliff:g id="NAME">%s</xliff:g>"</string>
@@ -1612,6 +1611,8 @@
     <string name="display_manager_overlay_display_name" msgid="5142365982271620716">"Yfirlögn #<xliff:g id="ID">%1$d</xliff:g>"</string>
     <string name="display_manager_overlay_display_title" msgid="652124517672257172">"<xliff:g id="NAME">%1$s</xliff:g>: <xliff:g id="WIDTH">%2$d</xliff:g>x<xliff:g id="HEIGHT">%3$d</xliff:g>, <xliff:g id="DPI">%4$d</xliff:g> dpi"</string>
     <string name="display_manager_overlay_display_secure_suffix" msgid="6022119702628572080">", öruggur"</string>
+    <string name="activity_starter_block_bg_activity_starts_permissive" msgid="5692097903712956720">"Framvegis verður lokað á þessa bakgrunnsvirkni frá <xliff:g id="PACKAGENAME">%1$s</xliff:g> í Q-smíði. Sjá go/q-bg-block."</string>
+    <string name="activity_starter_block_bg_activity_starts_enforcing" msgid="8299522481076404353">"Lokað á bakgrunnsvirkni frá <xliff:g id="PACKAGENAME">%1$s</xliff:g>. Sjá go/q-bg-block."</string>
     <string name="kg_forgot_pattern_button_text" msgid="8852021467868220608">"Man ekki mynstrið"</string>
     <string name="kg_wrong_pattern" msgid="1850806070801358830">"Rangt mynstur"</string>
     <string name="kg_wrong_password" msgid="2333281762128113157">"Rangt aðgangsorð"</string>
@@ -1997,9 +1998,29 @@
     <string name="dynamic_mode_notification_channel_name" msgid="2348803891571320452">"Upplýsingatilkynning aðgerðastillingar"</string>
     <string name="dynamic_mode_notification_title" msgid="508815255807182035">"Rafhlaðan kann að tæmast áður en hún kemst í hleðslu"</string>
     <string name="dynamic_mode_notification_summary" msgid="2541166298550402690">"Kveikt á rafhlöðusparnaði til að lengja endingu rafhlöðunnar"</string>
+    <string name="mime_type_folder" msgid="7111951698626315204">"Mappa"</string>
+    <string name="mime_type_apk" msgid="5518003630972506900">"Android forrit"</string>
+    <string name="mime_type_generic" msgid="6833871596845900027">"Skrá"</string>
+    <string name="mime_type_generic_ext" msgid="8450275970061657174">"<xliff:g id="EXTENSION">%1$s</xliff:g>-skrá"</string>
+    <string name="mime_type_audio" msgid="6289777657172050926">"Hljóð"</string>
+    <string name="mime_type_audio_ext" msgid="3270880987725816210">"<xliff:g id="EXTENSION">%1$s</xliff:g>-hljóðskrá"</string>
+    <string name="mime_type_video" msgid="4093025777317307426">"Myndskeið"</string>
+    <string name="mime_type_video_ext" msgid="5643771615714173159">"<xliff:g id="EXTENSION">%1$s</xliff:g>-myndskeið"</string>
+    <string name="mime_type_image" msgid="3144284451605236371">"Mynd"</string>
+    <string name="mime_type_image_ext" msgid="1514613218742736590">"<xliff:g id="EXTENSION">%1$s</xliff:g>-mynd"</string>
+    <string name="mime_type_compressed" msgid="1645486037074943257">"Safnskrá"</string>
+    <string name="mime_type_compressed_ext" msgid="4232293058067801528">"<xliff:g id="EXTENSION">%1$s</xliff:g>-safnskrá"</string>
+    <string name="mime_type_document" msgid="1596838147256375966">"Skjal"</string>
+    <string name="mime_type_document_ext" msgid="6327266601345501281">"<xliff:g id="EXTENSION">%1$s</xliff:g>-skjal"</string>
+    <string name="mime_type_spreadsheet" msgid="2639138255207123557">"Töflureiknir"</string>
+    <string name="mime_type_spreadsheet_ext" msgid="5508653032786106725">"<xliff:g id="EXTENSION">%1$s</xliff:g>-töflureiknir"</string>
+    <string name="mime_type_presentation" msgid="6145604688774787357">"Kynning"</string>
+    <string name="mime_type_presentation_ext" msgid="2982650207774823437">"<xliff:g id="EXTENSION">%1$s</xliff:g>-kynning"</string>
     <string name="car_loading_profile" msgid="3545132581795684027">"Hleður"</string>
     <plurals name="file_count" formatted="false" msgid="1628600959752419449">
       <item quantity="one"><xliff:g id="FILE_NAME_2">%s</xliff:g> + <xliff:g id="COUNT_3">%d</xliff:g> skrá</item>
       <item quantity="other"><xliff:g id="FILE_NAME_2">%s</xliff:g> + <xliff:g id="COUNT_3">%d</xliff:g> skrá</item>
     </plurals>
+    <!-- no translation found for chooser_no_direct_share_targets (997970693708458895) -->
+    <skip />
 </resources>
diff --git a/core/res/res/values-it/strings.xml b/core/res/res/values-it/strings.xml
index 52d674f..c5592b6 100644
--- a/core/res/res/values-it/strings.xml
+++ b/core/res/res/values-it/strings.xml
@@ -308,15 +308,15 @@
     <string name="permgrouplab_phone" msgid="5229115638567440675">"Telefono"</string>
     <string name="permgroupdesc_phone" msgid="6234224354060641055">"eseguire e gestire le telefonate"</string>
     <string name="permgrouprequest_phone" msgid="9166979577750581037">"Consentire all\'app &lt;b&gt;<xliff:g id="APP_NAME">%1$s</xliff:g>&lt;/b&gt; di effettuare e gestire telefonate?"</string>
-    <string name="permgrouplab_sensors" msgid="416037179223226722">"Sensori per il corpo"</string>
+    <string name="permgrouplab_sensors" msgid="4838614103153567532">"Sensori del corpo"</string>
     <string name="permgroupdesc_sensors" msgid="7147968539346634043">"accedere ai dati dei sensori relativi ai tuoi parametri vitali"</string>
     <string name="permgrouprequest_sensors" msgid="6349806962814556786">"Consentire a &lt;b&gt;<xliff:g id="APP_NAME">%1$s</xliff:g>&lt;/b&gt; di accedere ai dati dei sensori relativi ai parametri vitali?"</string>
     <string name="permgrouplab_aural" msgid="965607064083134896">"Musica"</string>
     <string name="permgroupdesc_aural" msgid="4870189506255958055">"Accesso alla tua musica"</string>
     <string name="permgrouprequest_aural" msgid="6787926123071735620">"Vuoi consentire all\'app &lt;b&gt;<xliff:g id="APP_NAME">%1$s</xliff:g>&lt;/b&gt; di accedere alla tua musica?"</string>
-    <string name="permgrouplab_visual" msgid="8030190588123857921">"Foto e video"</string>
+    <string name="permgrouplab_visual" msgid="6477382108771145134">"Foto e video"</string>
     <string name="permgroupdesc_visual" msgid="3415827902566663546">"Accesso alle tue foto e ai tuoi video"</string>
-    <string name="permgrouprequest_visual" msgid="6907523945030290376">"Vuoi consentire all\'app &lt;b&gt;<xliff:g id="APP_NAME">%1$s</xliff:g>&lt;/b&gt; di accedere alle tue foto e ai tuoi video?"</string>
+    <string name="permgrouprequest_visual" msgid="3043752127595243314">"Vuoi consentire a &lt;b&gt;<xliff:g id="APP_NAME">%1$s</xliff:g>&lt;/b&gt; di accedere alle tue foto e ai tuoi video, incluse le località taggate?"</string>
     <string name="capability_title_canRetrieveWindowContent" msgid="3901717936930170320">"Recuperare contenuti della finestra"</string>
     <string name="capability_desc_canRetrieveWindowContent" msgid="3772225008605310672">"Esaminare i contenuti di una finestra con cui interagisci."</string>
     <string name="capability_title_canRequestTouchExploration" msgid="3108723364676667320">"Attivare Esplora al tocco"</string>
@@ -1396,8 +1396,7 @@
     <string name="ext_media_init_action" msgid="7952885510091978278">"Configura"</string>
     <string name="ext_media_unmount_action" msgid="1121883233103278199">"Espelli"</string>
     <string name="ext_media_browse_action" msgid="8322172381028546087">"Apri"</string>
-    <!-- no translation found for ext_media_seamless_action (6575980560886881233) -->
-    <skip />
+    <string name="ext_media_seamless_action" msgid="6575980560886881233">"Cambia uscita"</string>
     <string name="ext_media_missing_title" msgid="620980315821543904">"<xliff:g id="NAME">%s</xliff:g> mancante"</string>
     <string name="ext_media_missing_message" msgid="4012389235250987930">"Reinserisci il dispositivo"</string>
     <string name="ext_media_move_specific_title" msgid="1471100343872375842">"Spostamento di <xliff:g id="NAME">%s</xliff:g> in corso"</string>
@@ -1611,6 +1610,8 @@
     <string name="display_manager_overlay_display_name" msgid="5142365982271620716">"Overlay n. <xliff:g id="ID">%1$d</xliff:g>"</string>
     <string name="display_manager_overlay_display_title" msgid="652124517672257172">"<xliff:g id="NAME">%1$s</xliff:g>: <xliff:g id="WIDTH">%2$d</xliff:g> x <xliff:g id="HEIGHT">%3$d</xliff:g>, <xliff:g id="DPI">%4$d</xliff:g> dpi"</string>
     <string name="display_manager_overlay_display_secure_suffix" msgid="6022119702628572080">", opzione sicura"</string>
+    <string name="activity_starter_block_bg_activity_starts_permissive" msgid="5692097903712956720">"L\'avvio di questa attività in background da <xliff:g id="PACKAGENAME">%1$s</xliff:g> verrà bloccato nelle future build Q. Visita la pagina go/q-bg-block."</string>
+    <string name="activity_starter_block_bg_activity_starts_enforcing" msgid="8299522481076404353">"Avvio delle attività in background da <xliff:g id="PACKAGENAME">%1$s</xliff:g> bloccato. Visita la pagina go/q-bg-block."</string>
     <string name="kg_forgot_pattern_button_text" msgid="8852021467868220608">"Sequenza dimenticata"</string>
     <string name="kg_wrong_pattern" msgid="1850806070801358830">"Sequenza sbagliata"</string>
     <string name="kg_wrong_password" msgid="2333281762128113157">"Password sbagliata"</string>
@@ -1996,9 +1997,29 @@
     <string name="dynamic_mode_notification_channel_name" msgid="2348803891571320452">"Notifica di informazioni sulla modalità Routine"</string>
     <string name="dynamic_mode_notification_title" msgid="508815255807182035">"La batteria potrebbe esaurirsi prima della ricarica abituale"</string>
     <string name="dynamic_mode_notification_summary" msgid="2541166298550402690">"Risparmio energetico attivo per far durare di più la batteria"</string>
+    <string name="mime_type_folder" msgid="7111951698626315204">"Cartella"</string>
+    <string name="mime_type_apk" msgid="5518003630972506900">"Applicazione Android"</string>
+    <string name="mime_type_generic" msgid="6833871596845900027">"File"</string>
+    <string name="mime_type_generic_ext" msgid="8450275970061657174">"File <xliff:g id="EXTENSION">%1$s</xliff:g>"</string>
+    <string name="mime_type_audio" msgid="6289777657172050926">"Audio"</string>
+    <string name="mime_type_audio_ext" msgid="3270880987725816210">"Audio <xliff:g id="EXTENSION">%1$s</xliff:g>"</string>
+    <string name="mime_type_video" msgid="4093025777317307426">"Video"</string>
+    <string name="mime_type_video_ext" msgid="5643771615714173159">"Video <xliff:g id="EXTENSION">%1$s</xliff:g>"</string>
+    <string name="mime_type_image" msgid="3144284451605236371">"Immagine"</string>
+    <string name="mime_type_image_ext" msgid="1514613218742736590">"Immagine <xliff:g id="EXTENSION">%1$s</xliff:g>"</string>
+    <string name="mime_type_compressed" msgid="1645486037074943257">"Archivio"</string>
+    <string name="mime_type_compressed_ext" msgid="4232293058067801528">"Archivio <xliff:g id="EXTENSION">%1$s</xliff:g>"</string>
+    <string name="mime_type_document" msgid="1596838147256375966">"Documento"</string>
+    <string name="mime_type_document_ext" msgid="6327266601345501281">"Documento <xliff:g id="EXTENSION">%1$s</xliff:g>"</string>
+    <string name="mime_type_spreadsheet" msgid="2639138255207123557">"Foglio di lavoro"</string>
+    <string name="mime_type_spreadsheet_ext" msgid="5508653032786106725">"Foglio di lavoro <xliff:g id="EXTENSION">%1$s</xliff:g>"</string>
+    <string name="mime_type_presentation" msgid="6145604688774787357">"Presentazione"</string>
+    <string name="mime_type_presentation_ext" msgid="2982650207774823437">"Presentazione <xliff:g id="EXTENSION">%1$s</xliff:g>"</string>
     <string name="car_loading_profile" msgid="3545132581795684027">"Caricamento"</string>
     <plurals name="file_count" formatted="false" msgid="1628600959752419449">
       <item quantity="other"><xliff:g id="FILE_NAME_2">%s</xliff:g> + <xliff:g id="COUNT_3">%d</xliff:g> file</item>
       <item quantity="one"><xliff:g id="FILE_NAME_0">%s</xliff:g> + <xliff:g id="COUNT_1">%d</xliff:g> file</item>
     </plurals>
+    <!-- no translation found for chooser_no_direct_share_targets (997970693708458895) -->
+    <skip />
 </resources>
diff --git a/core/res/res/values-iw/strings.xml b/core/res/res/values-iw/strings.xml
index 093638bd..89813a7 100644
--- a/core/res/res/values-iw/strings.xml
+++ b/core/res/res/values-iw/strings.xml
@@ -314,15 +314,15 @@
     <string name="permgrouplab_phone" msgid="5229115638567440675">"טלפון"</string>
     <string name="permgroupdesc_phone" msgid="6234224354060641055">"התקשרות וניהול של שיחות טלפון"</string>
     <string name="permgrouprequest_phone" msgid="9166979577750581037">"‏לתת לאפליקציה &lt;b&gt;<xliff:g id="APP_NAME">%1$s</xliff:g>&lt;/b&gt; הרשאה להתקשרות ולניהול של שיחות טלפון?"</string>
-    <string name="permgrouplab_sensors" msgid="416037179223226722">"חיישני גוף"</string>
+    <string name="permgrouplab_sensors" msgid="4838614103153567532">"חיישנים לבישים"</string>
     <string name="permgroupdesc_sensors" msgid="7147968539346634043">"גישה אל נתוני חיישנים של הסימנים החיוניים שלך"</string>
     <string name="permgrouprequest_sensors" msgid="6349806962814556786">"‏לתת לאפליקציה &lt;b&gt;<xliff:g id="APP_NAME">%1$s</xliff:g>&lt;/b&gt; הרשאת גישה לנתוני חיישנים העוקבים אחר הסימנים החיוניים שלך?"</string>
     <string name="permgrouplab_aural" msgid="965607064083134896">"מוזיקה"</string>
     <string name="permgroupdesc_aural" msgid="4870189506255958055">"גישה למוזיקה שלך"</string>
     <string name="permgrouprequest_aural" msgid="6787926123071735620">"‏האם לתת לאפליקציה &lt;b&gt;<xliff:g id="APP_NAME">%1$s</xliff:g>&lt;/b&gt; הרשאת גישה למוזיקה שלך?"</string>
-    <string name="permgrouplab_visual" msgid="8030190588123857921">"תמונות וסרטונים"</string>
+    <string name="permgrouplab_visual" msgid="6477382108771145134">"תמונות וסרטונים"</string>
     <string name="permgroupdesc_visual" msgid="3415827902566663546">"גישה לתמונות ולסרטונים שלך"</string>
-    <string name="permgrouprequest_visual" msgid="6907523945030290376">"‏האם לתת לאפליקציה &lt;b&gt;<xliff:g id="APP_NAME">%1$s</xliff:g>&lt;/b&gt; הרשאת גישה לתמונות ולסרטונים שלך?"</string>
+    <string name="permgrouprequest_visual" msgid="3043752127595243314">"‏האם לאפשר ל-&lt;b&gt;<xliff:g id="APP_NAME">%1$s</xliff:g>&lt;/b&gt; לקבל גישה לתמונות ולסרטונים שלך, כולל מיקומים מתויגים?"</string>
     <string name="capability_title_canRetrieveWindowContent" msgid="3901717936930170320">"אחזור תוכן של חלון"</string>
     <string name="capability_desc_canRetrieveWindowContent" msgid="3772225008605310672">"בדוק את התוכן של חלון שאיתו אתה מבצע אינטראקציה."</string>
     <string name="capability_title_canRequestTouchExploration" msgid="3108723364676667320">"הפעלה של \'גילוי באמצעות מגע\'"</string>
@@ -1440,8 +1440,7 @@
     <string name="ext_media_init_action" msgid="7952885510091978278">"הגדר"</string>
     <string name="ext_media_unmount_action" msgid="1121883233103278199">"הוצא"</string>
     <string name="ext_media_browse_action" msgid="8322172381028546087">"גלה"</string>
-    <!-- no translation found for ext_media_seamless_action (6575980560886881233) -->
-    <skip />
+    <string name="ext_media_seamless_action" msgid="6575980560886881233">"החלפת פלט"</string>
     <string name="ext_media_missing_title" msgid="620980315821543904">"<xliff:g id="NAME">%s</xliff:g> חסר"</string>
     <string name="ext_media_missing_message" msgid="4012389235250987930">"יש להכניס שוב את ההתקן"</string>
     <string name="ext_media_move_specific_title" msgid="1471100343872375842">"מעביר את <xliff:g id="NAME">%s</xliff:g>"</string>
@@ -1657,6 +1656,8 @@
     <string name="display_manager_overlay_display_name" msgid="5142365982271620716">"שכבת-על #<xliff:g id="ID">%1$d</xliff:g>"</string>
     <string name="display_manager_overlay_display_title" msgid="652124517672257172">"‏<xliff:g id="NAME">%1$s</xliff:g>: ‎<xliff:g id="WIDTH">%2$d</xliff:g>x<xliff:g id="HEIGHT">%3$d</xliff:g>‎, ‏<xliff:g id="DPI">%4$d</xliff:g> dpi"</string>
     <string name="display_manager_overlay_display_secure_suffix" msgid="6022119702628572080">", מאובטח"</string>
+    <string name="activity_starter_block_bg_activity_starts_permissive" msgid="5692097903712956720">"‏התחלה זו של פעילות ברקע מ-<xliff:g id="PACKAGENAME">%1$s</xliff:g> תיחסם בגרסאות build עתידיות של Q. ניתן לעיין בכתובת go/q-bg-block."</string>
+    <string name="activity_starter_block_bg_activity_starts_enforcing" msgid="8299522481076404353">"‏נחסמה התחלה של פעילות ברקע מ-<xliff:g id="PACKAGENAME">%1$s</xliff:g>. ניתן לעיין בכתובת go/q-bg-block."</string>
     <string name="kg_forgot_pattern_button_text" msgid="8852021467868220608">"שכחת את קו ביטול הנעילה?"</string>
     <string name="kg_wrong_pattern" msgid="1850806070801358830">"קו ביטול נעילה שגוי"</string>
     <string name="kg_wrong_password" msgid="2333281762128113157">"סיסמה שגויה"</string>
@@ -2066,6 +2067,24 @@
     <string name="dynamic_mode_notification_channel_name" msgid="2348803891571320452">"התראת מידע לגבי מצב שגרתי"</string>
     <string name="dynamic_mode_notification_title" msgid="508815255807182035">"הסוללה עלולה להתרוקן לפני המועד הרגיל של הטעינה"</string>
     <string name="dynamic_mode_notification_summary" msgid="2541166298550402690">"תכונת החיסכון בסוללה הופעלה כדי להאריך את חיי הסוללה"</string>
+    <string name="mime_type_folder" msgid="7111951698626315204">"תיקייה"</string>
+    <string name="mime_type_apk" msgid="5518003630972506900">"‏אפליקציית Android"</string>
+    <string name="mime_type_generic" msgid="6833871596845900027">"קובץ"</string>
+    <string name="mime_type_generic_ext" msgid="8450275970061657174">"קובץ <xliff:g id="EXTENSION">%1$s</xliff:g>"</string>
+    <string name="mime_type_audio" msgid="6289777657172050926">"אודיו"</string>
+    <string name="mime_type_audio_ext" msgid="3270880987725816210">"אודיו בפורמט <xliff:g id="EXTENSION">%1$s</xliff:g>"</string>
+    <string name="mime_type_video" msgid="4093025777317307426">"סרטון"</string>
+    <string name="mime_type_video_ext" msgid="5643771615714173159">"סרטון <xliff:g id="EXTENSION">%1$s</xliff:g>"</string>
+    <string name="mime_type_image" msgid="3144284451605236371">"תמונה"</string>
+    <string name="mime_type_image_ext" msgid="1514613218742736590">"תמונה בפורמט <xliff:g id="EXTENSION">%1$s</xliff:g>"</string>
+    <string name="mime_type_compressed" msgid="1645486037074943257">"ארכיון"</string>
+    <string name="mime_type_compressed_ext" msgid="4232293058067801528">"קובץ ארכיון <xliff:g id="EXTENSION">%1$s</xliff:g>"</string>
+    <string name="mime_type_document" msgid="1596838147256375966">"מסמך"</string>
+    <string name="mime_type_document_ext" msgid="6327266601345501281">"מסמך <xliff:g id="EXTENSION">%1$s</xliff:g>"</string>
+    <string name="mime_type_spreadsheet" msgid="2639138255207123557">"גיליון אלקטרוני"</string>
+    <string name="mime_type_spreadsheet_ext" msgid="5508653032786106725">"גיליון אלקטרוני <xliff:g id="EXTENSION">%1$s</xliff:g>"</string>
+    <string name="mime_type_presentation" msgid="6145604688774787357">"מצגת"</string>
+    <string name="mime_type_presentation_ext" msgid="2982650207774823437">"מצגת <xliff:g id="EXTENSION">%1$s</xliff:g>"</string>
     <string name="car_loading_profile" msgid="3545132581795684027">"בטעינה"</string>
     <plurals name="file_count" formatted="false" msgid="1628600959752419449">
       <item quantity="two"><xliff:g id="FILE_NAME_2">%s</xliff:g> + <xliff:g id="COUNT_3">%d</xliff:g> קבצים</item>
@@ -2073,4 +2092,6 @@
       <item quantity="other"><xliff:g id="FILE_NAME_2">%s</xliff:g> + <xliff:g id="COUNT_3">%d</xliff:g> קבצים</item>
       <item quantity="one"><xliff:g id="FILE_NAME_0">%s</xliff:g> + קובץ  אחד (<xliff:g id="COUNT_1">%d</xliff:g>)</item>
     </plurals>
+    <!-- no translation found for chooser_no_direct_share_targets (997970693708458895) -->
+    <skip />
 </resources>
diff --git a/core/res/res/values-ja/strings.xml b/core/res/res/values-ja/strings.xml
index 8ff3c28..79e2f09 100644
--- a/core/res/res/values-ja/strings.xml
+++ b/core/res/res/values-ja/strings.xml
@@ -308,15 +308,15 @@
     <string name="permgrouplab_phone" msgid="5229115638567440675">"電話"</string>
     <string name="permgroupdesc_phone" msgid="6234224354060641055">"電話の発信と管理"</string>
     <string name="permgrouprequest_phone" msgid="9166979577750581037">"電話の発信と管理を &lt;b&gt;<xliff:g id="APP_NAME">%1$s</xliff:g>&lt;/b&gt; に許可しますか?"</string>
-    <string name="permgrouplab_sensors" msgid="416037179223226722">"ボディーセンサー"</string>
+    <string name="permgrouplab_sensors" msgid="4838614103153567532">"ボディセンサー"</string>
     <string name="permgroupdesc_sensors" msgid="7147968539346634043">"バイタルサインに関するセンサーデータへのアクセス"</string>
     <string name="permgrouprequest_sensors" msgid="6349806962814556786">"バイタルサインに関するセンサーデータへのアクセスを &lt;b&gt;<xliff:g id="APP_NAME">%1$s</xliff:g>&lt;/b&gt; に許可しますか?"</string>
     <string name="permgrouplab_aural" msgid="965607064083134896">"音楽"</string>
     <string name="permgroupdesc_aural" msgid="4870189506255958055">"音楽へのアクセス"</string>
     <string name="permgrouprequest_aural" msgid="6787926123071735620">"音楽へのアクセスを &lt;b&gt;<xliff:g id="APP_NAME">%1$s</xliff:g>&lt;/b&gt; に許可しますか?"</string>
-    <string name="permgrouplab_visual" msgid="8030190588123857921">"写真と動画"</string>
+    <string name="permgrouplab_visual" msgid="6477382108771145134">"写真と動画"</string>
     <string name="permgroupdesc_visual" msgid="3415827902566663546">"写真と動画へのアクセス"</string>
-    <string name="permgrouprequest_visual" msgid="6907523945030290376">"写真と動画へのアクセスを &lt;b&gt;<xliff:g id="APP_NAME">%1$s</xliff:g>&lt;/b&gt; に許可しますか?"</string>
+    <string name="permgrouprequest_visual" msgid="3043752127595243314">"タグ付けされた場所を含め、写真と動画へのアクセスを &lt;b&gt;<xliff:g id="APP_NAME">%1$s</xliff:g>&lt;/b&gt; に許可しますか?"</string>
     <string name="capability_title_canRetrieveWindowContent" msgid="3901717936930170320">"ウィンドウコンテンツの取得"</string>
     <string name="capability_desc_canRetrieveWindowContent" msgid="3772225008605310672">"ユーザーがアクセスしているウィンドウのコンテンツを検査します。"</string>
     <string name="capability_title_canRequestTouchExploration" msgid="3108723364676667320">"タッチガイドの有効化"</string>
@@ -1396,8 +1396,7 @@
     <string name="ext_media_init_action" msgid="7952885510091978278">"セットアップ"</string>
     <string name="ext_media_unmount_action" msgid="1121883233103278199">"取り外し"</string>
     <string name="ext_media_browse_action" msgid="8322172381028546087">"外部メディア"</string>
-    <!-- no translation found for ext_media_seamless_action (6575980560886881233) -->
-    <skip />
+    <string name="ext_media_seamless_action" msgid="6575980560886881233">"出力を切り替えます"</string>
     <string name="ext_media_missing_title" msgid="620980315821543904">"<xliff:g id="NAME">%s</xliff:g>が見つかりません"</string>
     <string name="ext_media_missing_message" msgid="4012389235250987930">"デバイスを挿入し直してください"</string>
     <string name="ext_media_move_specific_title" msgid="1471100343872375842">"<xliff:g id="NAME">%s</xliff:g>を移動しています"</string>
@@ -1611,6 +1610,8 @@
     <string name="display_manager_overlay_display_name" msgid="5142365982271620716">"オーバーレイ第<xliff:g id="ID">%1$d</xliff:g>"</string>
     <string name="display_manager_overlay_display_title" msgid="652124517672257172">"<xliff:g id="NAME">%1$s</xliff:g>: <xliff:g id="WIDTH">%2$d</xliff:g>x<xliff:g id="HEIGHT">%3$d</xliff:g>、<xliff:g id="DPI">%4$d</xliff:g> dpi"</string>
     <string name="display_manager_overlay_display_secure_suffix" msgid="6022119702628572080">"、セキュア"</string>
+    <string name="activity_starter_block_bg_activity_starts_permissive" msgid="5692097903712956720">"<xliff:g id="PACKAGENAME">%1$s</xliff:g> からのこのバックグラウンド アクティビティの開始は今後の Q ビルドではブロックされます。go/q-bg-block をご覧ください。"</string>
+    <string name="activity_starter_block_bg_activity_starts_enforcing" msgid="8299522481076404353">"<xliff:g id="PACKAGENAME">%1$s</xliff:g> からのバックグラウンド アクティビティの開始がブロックされました。go/q-bg-block をご覧ください。"</string>
     <string name="kg_forgot_pattern_button_text" msgid="8852021467868220608">"パターンを忘れた場合"</string>
     <string name="kg_wrong_pattern" msgid="1850806070801358830">"パターンが正しくありません"</string>
     <string name="kg_wrong_password" msgid="2333281762128113157">"パスワードが正しくありません"</string>
@@ -1996,9 +1997,29 @@
     <string name="dynamic_mode_notification_channel_name" msgid="2348803891571320452">"ルーティン モード情報の通知"</string>
     <string name="dynamic_mode_notification_title" msgid="508815255807182035">"通常の充電を行う前に電池が切れる可能性があります"</string>
     <string name="dynamic_mode_notification_summary" msgid="2541166298550402690">"電池を長持ちさせるため、バッテリー セーバーが有効になりました"</string>
+    <string name="mime_type_folder" msgid="7111951698626315204">"フォルダ"</string>
+    <string name="mime_type_apk" msgid="5518003630972506900">"Android アプリ"</string>
+    <string name="mime_type_generic" msgid="6833871596845900027">"ファイル"</string>
+    <string name="mime_type_generic_ext" msgid="8450275970061657174">"<xliff:g id="EXTENSION">%1$s</xliff:g> ファイル"</string>
+    <string name="mime_type_audio" msgid="6289777657172050926">"音声"</string>
+    <string name="mime_type_audio_ext" msgid="3270880987725816210">"<xliff:g id="EXTENSION">%1$s</xliff:g> 音声"</string>
+    <string name="mime_type_video" msgid="4093025777317307426">"動画"</string>
+    <string name="mime_type_video_ext" msgid="5643771615714173159">"<xliff:g id="EXTENSION">%1$s</xliff:g> 動画"</string>
+    <string name="mime_type_image" msgid="3144284451605236371">"画像"</string>
+    <string name="mime_type_image_ext" msgid="1514613218742736590">"<xliff:g id="EXTENSION">%1$s</xliff:g> 画像"</string>
+    <string name="mime_type_compressed" msgid="1645486037074943257">"アーカイブ"</string>
+    <string name="mime_type_compressed_ext" msgid="4232293058067801528">"<xliff:g id="EXTENSION">%1$s</xliff:g> アーカイブ"</string>
+    <string name="mime_type_document" msgid="1596838147256375966">"ドキュメント"</string>
+    <string name="mime_type_document_ext" msgid="6327266601345501281">"<xliff:g id="EXTENSION">%1$s</xliff:g> ドキュメント"</string>
+    <string name="mime_type_spreadsheet" msgid="2639138255207123557">"スプレッドシート"</string>
+    <string name="mime_type_spreadsheet_ext" msgid="5508653032786106725">"<xliff:g id="EXTENSION">%1$s</xliff:g> スプレッドシート"</string>
+    <string name="mime_type_presentation" msgid="6145604688774787357">"プレゼンテーション"</string>
+    <string name="mime_type_presentation_ext" msgid="2982650207774823437">"<xliff:g id="EXTENSION">%1$s</xliff:g> プレゼンテーション"</string>
     <string name="car_loading_profile" msgid="3545132581795684027">"読み込んでいます"</string>
     <plurals name="file_count" formatted="false" msgid="1628600959752419449">
       <item quantity="other"><xliff:g id="FILE_NAME_2">%s</xliff:g>、他 <xliff:g id="COUNT_3">%d</xliff:g> ファイル</item>
       <item quantity="one"><xliff:g id="FILE_NAME_0">%s</xliff:g>、他 <xliff:g id="COUNT_1">%d</xliff:g> ファイル</item>
     </plurals>
+    <!-- no translation found for chooser_no_direct_share_targets (997970693708458895) -->
+    <skip />
 </resources>
diff --git a/core/res/res/values-ka/strings.xml b/core/res/res/values-ka/strings.xml
index cf41d5d5..4a3cb8b 100644
--- a/core/res/res/values-ka/strings.xml
+++ b/core/res/res/values-ka/strings.xml
@@ -308,15 +308,15 @@
     <string name="permgrouplab_phone" msgid="5229115638567440675">"ტელეფონი"</string>
     <string name="permgroupdesc_phone" msgid="6234224354060641055">"სატელეფონო ზარების განხორციელება და მართვა"</string>
     <string name="permgrouprequest_phone" msgid="9166979577750581037">"გსურთ, მიანიჭოთ &lt;b&gt;<xliff:g id="APP_NAME">%1$s</xliff:g>-ს&lt;/b&gt; სატელეფონო ზარების განხორციელების და მართვის ნებართვა?"</string>
-    <string name="permgrouplab_sensors" msgid="416037179223226722">"სხეულის სენსორები"</string>
+    <string name="permgrouplab_sensors" msgid="4838614103153567532">"სხეულის სენსორები"</string>
     <string name="permgroupdesc_sensors" msgid="7147968539346634043">"თქვენი სასიცოცხლო ფუნქციების შესახებ სენსორის მონაცემებზე წვდომა"</string>
     <string name="permgrouprequest_sensors" msgid="6349806962814556786">"გსურთ, მიანიჭოთ &lt;b&gt;<xliff:g id="APP_NAME">%1$s</xliff:g>-ს&lt;/b&gt; თქვენი სასიცოცხლო ფუნქციების შესახებ სენსორის მონაცემებზე წვდომის ნებართვა?"</string>
     <string name="permgrouplab_aural" msgid="965607064083134896">"მუსიკა"</string>
     <string name="permgroupdesc_aural" msgid="4870189506255958055">"თქვენს მუსიკაზე წვდომა"</string>
     <string name="permgrouprequest_aural" msgid="6787926123071735620">"გსურთ, მიანიჭოთ &lt;b&gt;<xliff:g id="APP_NAME">%1$s</xliff:g>&lt;/b&gt;-ს თქვენს მუსიკაზე წვდომა?"</string>
-    <string name="permgrouplab_visual" msgid="8030190588123857921">"ფოტოები და ვიდეოები"</string>
+    <string name="permgrouplab_visual" msgid="6477382108771145134">"ფოტოები და ვიდეოები"</string>
     <string name="permgroupdesc_visual" msgid="3415827902566663546">"თქვენს ფოტოებსა და ვიდეოებზე წვდომა"</string>
-    <string name="permgrouprequest_visual" msgid="6907523945030290376">"გსურთ, მიანიჭოთ &lt;b&gt;<xliff:g id="APP_NAME">%1$s</xliff:g>&lt;/b&gt;-ს თქვენს ფოტოებსა და ვიდეოებზე წვდომა?"</string>
+    <string name="permgrouprequest_visual" msgid="3043752127595243314">"გსურთ, მიანიჭოთ &lt;b&gt;<xliff:g id="APP_NAME">%1$s</xliff:g>&lt;/b&gt;-ს წვდომა თქვენს ფოტოებსა და ვიდეოებზე, მათ შორის, თეგებით მონიშნულ მდებარეობებზე?"</string>
     <string name="capability_title_canRetrieveWindowContent" msgid="3901717936930170320">"ფანჯრის კონტენტის მოძიება"</string>
     <string name="capability_desc_canRetrieveWindowContent" msgid="3772225008605310672">"იმ ფანჯრის კონტენტის შემოწმება, რომელშიც მუშაობთ."</string>
     <string name="capability_title_canRequestTouchExploration" msgid="3108723364676667320">"„შეხებით აღმოჩენის“ ჩართვა"</string>
@@ -1611,6 +1611,8 @@
     <string name="display_manager_overlay_display_name" msgid="5142365982271620716">"გადაფარვა #<xliff:g id="ID">%1$d</xliff:g>"</string>
     <string name="display_manager_overlay_display_title" msgid="652124517672257172">"<xliff:g id="NAME">%1$s</xliff:g>: <xliff:g id="WIDTH">%2$d</xliff:g>x<xliff:g id="HEIGHT">%3$d</xliff:g>, <xliff:g id="DPI">%4$d</xliff:g> dpi"</string>
     <string name="display_manager_overlay_display_secure_suffix" msgid="6022119702628572080">", დაცული"</string>
+    <string name="activity_starter_block_bg_activity_starts_permissive" msgid="5692097903712956720">"<xliff:g id="PACKAGENAME">%1$s</xliff:g>-დან ამ ფონური აქტივობის გაშვება დაიბლოკება Q-ის მომდევნო ანაწყობებში. იხილეთ go/q-bg-block."</string>
+    <string name="activity_starter_block_bg_activity_starts_enforcing" msgid="8299522481076404353">"<xliff:g id="PACKAGENAME">%1$s</xliff:g>-დან ფონური აქტივობის გაშვება დაიბლოკა. იხილეთ go/q-bg-block."</string>
     <string name="kg_forgot_pattern_button_text" msgid="8852021467868220608">"დაგავიწყდათ ნიმუში"</string>
     <string name="kg_wrong_pattern" msgid="1850806070801358830">"არასწორი ნიმუში"</string>
     <string name="kg_wrong_password" msgid="2333281762128113157">"არასწორი პაროლი"</string>
@@ -1996,9 +1998,29 @@
     <string name="dynamic_mode_notification_channel_name" msgid="2348803891571320452">"რუტინის რეჟიმის საინფორმაციო შეტყობინება"</string>
     <string name="dynamic_mode_notification_title" msgid="508815255807182035">"ბატარეა შეიძლება დაჯდეს დატენის ჩვეულ დრომდე"</string>
     <string name="dynamic_mode_notification_summary" msgid="2541166298550402690">"ბატარეის დამზოგი გააქტიურდა ბატარეის მუშაობის გასახანგრძლივლებლად"</string>
+    <string name="mime_type_folder" msgid="7111951698626315204">"საქაღალდე"</string>
+    <string name="mime_type_apk" msgid="5518003630972506900">"Android-ის აპლიკაცია"</string>
+    <string name="mime_type_generic" msgid="6833871596845900027">"ფაილი"</string>
+    <string name="mime_type_generic_ext" msgid="8450275970061657174">"<xliff:g id="EXTENSION">%1$s</xliff:g> ფაილი"</string>
+    <string name="mime_type_audio" msgid="6289777657172050926">"აუდიო"</string>
+    <string name="mime_type_audio_ext" msgid="3270880987725816210">"<xliff:g id="EXTENSION">%1$s</xliff:g> აუდიო"</string>
+    <string name="mime_type_video" msgid="4093025777317307426">"ვიდეო"</string>
+    <string name="mime_type_video_ext" msgid="5643771615714173159">"<xliff:g id="EXTENSION">%1$s</xliff:g> ვიდეო"</string>
+    <string name="mime_type_image" msgid="3144284451605236371">"სურათი"</string>
+    <string name="mime_type_image_ext" msgid="1514613218742736590">"<xliff:g id="EXTENSION">%1$s</xliff:g> სურათი"</string>
+    <string name="mime_type_compressed" msgid="1645486037074943257">"არქივი"</string>
+    <string name="mime_type_compressed_ext" msgid="4232293058067801528">"<xliff:g id="EXTENSION">%1$s</xliff:g> არქივი"</string>
+    <string name="mime_type_document" msgid="1596838147256375966">"დოკუმენტი"</string>
+    <string name="mime_type_document_ext" msgid="6327266601345501281">"<xliff:g id="EXTENSION">%1$s</xliff:g> დოკუმენტი"</string>
+    <string name="mime_type_spreadsheet" msgid="2639138255207123557">"ელცხრილი"</string>
+    <string name="mime_type_spreadsheet_ext" msgid="5508653032786106725">"<xliff:g id="EXTENSION">%1$s</xliff:g> ელცხრილი"</string>
+    <string name="mime_type_presentation" msgid="6145604688774787357">"პრეზენტაცია"</string>
+    <string name="mime_type_presentation_ext" msgid="2982650207774823437">"<xliff:g id="EXTENSION">%1$s</xliff:g> პრეზენტაცია"</string>
     <string name="car_loading_profile" msgid="3545132581795684027">"იტვირთება"</string>
     <plurals name="file_count" formatted="false" msgid="1628600959752419449">
       <item quantity="other"><xliff:g id="FILE_NAME_2">%s</xliff:g> + <xliff:g id="COUNT_3">%d</xliff:g> ფაილი</item>
       <item quantity="one"><xliff:g id="FILE_NAME_0">%s</xliff:g> + <xliff:g id="COUNT_1">%d</xliff:g> ფაილი</item>
     </plurals>
+    <!-- no translation found for chooser_no_direct_share_targets (997970693708458895) -->
+    <skip />
 </resources>
diff --git a/core/res/res/values-kk/strings.xml b/core/res/res/values-kk/strings.xml
index b17f7fd..951c4e2 100644
--- a/core/res/res/values-kk/strings.xml
+++ b/core/res/res/values-kk/strings.xml
@@ -308,15 +308,15 @@
     <string name="permgrouplab_phone" msgid="5229115638567440675">"Телефон"</string>
     <string name="permgroupdesc_phone" msgid="6234224354060641055">"қоңырау шалу және телефон қоңырауларын басқару"</string>
     <string name="permgrouprequest_phone" msgid="9166979577750581037">"&lt;b&gt;<xliff:g id="APP_NAME">%1$s</xliff:g>&lt;/b&gt; қолданбасына қоңыраулар шалуға және басқаруға рұқсат берілсін бе?"</string>
-    <string name="permgrouplab_sensors" msgid="416037179223226722">"Дене датчиктері"</string>
+    <string name="permgrouplab_sensors" msgid="4838614103153567532">"Дене датчиктері"</string>
     <string name="permgroupdesc_sensors" msgid="7147968539346634043">"ағза күйінің көрсеткіштері туралы сенсор деректеріне қатынасу"</string>
     <string name="permgrouprequest_sensors" msgid="6349806962814556786">"&lt;b&gt;<xliff:g id="APP_NAME">%1$s</xliff:g>&lt;/b&gt; қолданбасына негізгі физиологиялық көрсеткіштерді көрсететін сенсорлық деректерді пайдалануға рұқсат берілсін бе?"</string>
     <string name="permgrouplab_aural" msgid="965607064083134896">"Музыка"</string>
     <string name="permgroupdesc_aural" msgid="4870189506255958055">"музыка мазмұнына кіру"</string>
     <string name="permgrouprequest_aural" msgid="6787926123071735620">"&lt;b&gt;<xliff:g id="APP_NAME">%1$s</xliff:g>&lt;/b&gt; қолданбасына музыка мазмұнына кіруге рұқсат етілсін бе?"</string>
-    <string name="permgrouplab_visual" msgid="8030190588123857921">"Суреттер және бейнелер"</string>
+    <string name="permgrouplab_visual" msgid="6477382108771145134">"Суреттер және бейнелер"</string>
     <string name="permgroupdesc_visual" msgid="3415827902566663546">"суреттер мен бейнелерге кіру"</string>
-    <string name="permgrouprequest_visual" msgid="6907523945030290376">"&lt;b&gt;<xliff:g id="APP_NAME">%1$s</xliff:g>&lt;/b&gt; қолданбасына суреттер мен бейнелерге кіруге рұқсат етілсін бе?"</string>
+    <string name="permgrouprequest_visual" msgid="3043752127595243314">"&lt;b&gt;<xliff:g id="APP_NAME">%1$s</xliff:g>&lt;/b&gt; қолданбасына суреттер мен бейнелерді, тэг енгізілген орындарды пайдалануға рұқсат етілсін бе?"</string>
     <string name="capability_title_canRetrieveWindowContent" msgid="3901717936930170320">"Терезе мазмұнын оқып отыру"</string>
     <string name="capability_desc_canRetrieveWindowContent" msgid="3772225008605310672">"Ашық тұрған терезе мазмұнын тексеру."</string>
     <string name="capability_title_canRequestTouchExploration" msgid="3108723364676667320">"Explore by Touch функциясын қосу"</string>
@@ -510,7 +510,7 @@
     <string name="permlab_disableKeyguard" msgid="3598496301486439258">"экран бекітпесін істен шығару"</string>
     <string name="permdesc_disableKeyguard" msgid="6034203065077122992">"Қолданбаларға кілтперне және басқа кілтсөзге қатысты қауіпсіздік шараларын өшіру мүмкіндігін береді. Мысалы, телефон кіріс қоңырауларын алғанда кілтпернені өшіреді және қоңырау аяқталғанда қайта қосады."</string>
     <string name="permlab_requestScreenLockComplexity" msgid="7028982116060987169">"экранды құлыптау күрделілігін сұрау"</string>
-    <string name="permdesc_requestScreenLockComplexity" msgid="2806396846128185677">"Қолданбаға экранды құлыптаудың күрделілік деңгейін (жоғары, орташа, төмен немесе жоқ), соның ішінде ұзақтығы мен түрін анықтауға мүмкіндік береді. Сонымен қатар қолданба пайдаланушыларға экранды құлыптауды белгілі бір деңгейге жаңартуды ұсынады. Бірақ бұл ұсыныстарды елемеуге болады. Экранды құлыптау қарапайым мәтін түрінде сақталмайтынын және қолданбаға белгісіз болатынын ескеріңіз."</string>
+    <string name="permdesc_requestScreenLockComplexity" msgid="2806396846128185677">"Қолданбаға экранды құлыптаудың күрделілік деңгейін (жоғары, орташа, төмен немесе жоқ), соның ішінде ұзақтығы мен түрін анықтауға мүмкіндік береді. Сонымен қатар қолданба пайдаланушыларға құлыпты белгілі бір деңгейге жаңартуды ұсынады. Бірақ бұл ұсыныстарды елемеуге болады. Экран құлпы қарапайым мәтін түрінде сақталмайтынын және құпия сөз қолданбаға белгісіз болатынын ескеріңіз."</string>
     <string name="permlab_useBiometric" msgid="8837753668509919318">"биометрикалық жабдықты пайдалану"</string>
     <string name="permdesc_useBiometric" msgid="8389855232721612926">"Аутентификациялау үшін қолданбаға биометрикалық жабдықты пайдалануға рұқсат береді"</string>
     <string name="permlab_manageFingerprint" msgid="5640858826254575638">"саусақ ізі жабдығын басқару"</string>
@@ -1397,8 +1397,7 @@
     <string name="ext_media_init_action" msgid="7952885510091978278">"Реттеу"</string>
     <string name="ext_media_unmount_action" msgid="1121883233103278199">"Шығару"</string>
     <string name="ext_media_browse_action" msgid="8322172381028546087">"Зерттеу"</string>
-    <!-- no translation found for ext_media_seamless_action (6575980560886881233) -->
-    <skip />
+    <string name="ext_media_seamless_action" msgid="6575980560886881233">"Шығысты ауыстыру"</string>
     <string name="ext_media_missing_title" msgid="620980315821543904">"<xliff:g id="NAME">%s</xliff:g> жоқ"</string>
     <string name="ext_media_missing_message" msgid="4012389235250987930">"Құрылғыны қайта салыңыз"</string>
     <string name="ext_media_move_specific_title" msgid="1471100343872375842">"<xliff:g id="NAME">%s</xliff:g> тасымалдануда"</string>
@@ -1612,6 +1611,8 @@
     <string name="display_manager_overlay_display_name" msgid="5142365982271620716">"№<xliff:g id="ID">%1$d</xliff:g> қабаттама"</string>
     <string name="display_manager_overlay_display_title" msgid="652124517672257172">"<xliff:g id="NAME">%1$s</xliff:g>: <xliff:g id="WIDTH">%2$d</xliff:g>x<xliff:g id="HEIGHT">%3$d</xliff:g>, <xliff:g id="DPI">%4$d</xliff:g> dpi"</string>
     <string name="display_manager_overlay_display_secure_suffix" msgid="6022119702628572080">", қауіпсіз"</string>
+    <string name="activity_starter_block_bg_activity_starts_permissive" msgid="5692097903712956720">"<xliff:g id="PACKAGENAME">%1$s</xliff:g> сайтындағы фондық әрекеттерге болашақ Q құрамаларында тыйым салынады. go/q-bg-block бетін қараңыз."</string>
+    <string name="activity_starter_block_bg_activity_starts_enforcing" msgid="8299522481076404353">"<xliff:g id="PACKAGENAME">%1$s</xliff:g> сайтындағы фондық әрекеттерге тыйым салынған. go/q-bg-block бетін қараңыз."</string>
     <string name="kg_forgot_pattern_button_text" msgid="8852021467868220608">"Кескінді ұмытып қалу"</string>
     <string name="kg_wrong_pattern" msgid="1850806070801358830">"Қате өрнек"</string>
     <string name="kg_wrong_password" msgid="2333281762128113157">"Қате кілтсөз"</string>
@@ -1997,9 +1998,29 @@
     <string name="dynamic_mode_notification_channel_name" msgid="2348803891571320452">"Режим туралы хабарландыру"</string>
     <string name="dynamic_mode_notification_title" msgid="508815255807182035">"Батарея заряды азаюы мүмкін"</string>
     <string name="dynamic_mode_notification_summary" msgid="2541166298550402690">"Батарея ұзаққа жетуі үшін, Battery Saver іске қосылды"</string>
+    <string name="mime_type_folder" msgid="7111951698626315204">"Қалта"</string>
+    <string name="mime_type_apk" msgid="5518003630972506900">"Android қолданбасы"</string>
+    <string name="mime_type_generic" msgid="6833871596845900027">"Файл"</string>
+    <string name="mime_type_generic_ext" msgid="8450275970061657174">"<xliff:g id="EXTENSION">%1$s</xliff:g> файлы"</string>
+    <string name="mime_type_audio" msgid="6289777657172050926">"Аудио"</string>
+    <string name="mime_type_audio_ext" msgid="3270880987725816210">"<xliff:g id="EXTENSION">%1$s</xliff:g> аудиофайлы"</string>
+    <string name="mime_type_video" msgid="4093025777317307426">"Бейне"</string>
+    <string name="mime_type_video_ext" msgid="5643771615714173159">"<xliff:g id="EXTENSION">%1$s</xliff:g> бейнесі"</string>
+    <string name="mime_type_image" msgid="3144284451605236371">"Сурет"</string>
+    <string name="mime_type_image_ext" msgid="1514613218742736590">"<xliff:g id="EXTENSION">%1$s</xliff:g> суреті"</string>
+    <string name="mime_type_compressed" msgid="1645486037074943257">"Мұрағат"</string>
+    <string name="mime_type_compressed_ext" msgid="4232293058067801528">"<xliff:g id="EXTENSION">%1$s</xliff:g> мұрағаты"</string>
+    <string name="mime_type_document" msgid="1596838147256375966">"Құжат"</string>
+    <string name="mime_type_document_ext" msgid="6327266601345501281">"<xliff:g id="EXTENSION">%1$s</xliff:g> құжаты"</string>
+    <string name="mime_type_spreadsheet" msgid="2639138255207123557">"Электрондық кесте"</string>
+    <string name="mime_type_spreadsheet_ext" msgid="5508653032786106725">"<xliff:g id="EXTENSION">%1$s</xliff:g> электрондық кестесі"</string>
+    <string name="mime_type_presentation" msgid="6145604688774787357">"Презентация"</string>
+    <string name="mime_type_presentation_ext" msgid="2982650207774823437">"<xliff:g id="EXTENSION">%1$s</xliff:g> презентациясы"</string>
     <string name="car_loading_profile" msgid="3545132581795684027">"Жүктелуде"</string>
     <plurals name="file_count" formatted="false" msgid="1628600959752419449">
       <item quantity="other"><xliff:g id="FILE_NAME_2">%s</xliff:g> + <xliff:g id="COUNT_3">%d</xliff:g> файл</item>
       <item quantity="one"><xliff:g id="FILE_NAME_0">%s</xliff:g> + <xliff:g id="COUNT_1">%d</xliff:g> файл</item>
     </plurals>
+    <!-- no translation found for chooser_no_direct_share_targets (997970693708458895) -->
+    <skip />
 </resources>
diff --git a/core/res/res/values-km/strings.xml b/core/res/res/values-km/strings.xml
index d5690b8..cb38ea1 100644
--- a/core/res/res/values-km/strings.xml
+++ b/core/res/res/values-km/strings.xml
@@ -308,15 +308,15 @@
     <string name="permgrouplab_phone" msgid="5229115638567440675">"ទូរសព្ទ"</string>
     <string name="permgroupdesc_phone" msgid="6234224354060641055">"ហៅទូរស័ព្ទ និងគ្រប់គ្រងការហៅទូរស័ព្ទ"</string>
     <string name="permgrouprequest_phone" msgid="9166979577750581037">"អនុញ្ញាតឱ្យ &lt;b&gt;<xliff:g id="APP_NAME">%1$s</xliff:g>&lt;/b&gt; គ្រប់គ្រង និង​ធ្វើការហៅទូរសព្ទ?"</string>
-    <string name="permgrouplab_sensors" msgid="416037179223226722">"ឧបករណ៍ចាប់សញ្ញារាងកាយ"</string>
+    <string name="permgrouplab_sensors" msgid="4838614103153567532">"ឧបករណ៍​ចាប់សញ្ញា​រាងកាយ"</string>
     <string name="permgroupdesc_sensors" msgid="7147968539346634043">"ចូលដំណើរការទិន្នន័យឧបករណ៍ចាប់សញ្ញាអំពីស្ថានភាពសុខភាពរបស់អ្នក"</string>
     <string name="permgrouprequest_sensors" msgid="6349806962814556786">"អនុញ្ញាតឱ្យ &lt;b&gt;<xliff:g id="APP_NAME">%1$s</xliff:g>&lt;/b&gt; ចូលប្រើ​ទិន្នន័យឧបករណ៍ចាប់សញ្ញាអំពីស្ថានភាពសុខភាពរបស់អ្នក?"</string>
     <string name="permgrouplab_aural" msgid="965607064083134896">"តន្ត្រី"</string>
     <string name="permgroupdesc_aural" msgid="4870189506255958055">"ចូលប្រើ​តន្ត្រី​របស់អ្នក"</string>
     <string name="permgrouprequest_aural" msgid="6787926123071735620">"អនុញ្ញាត​ឱ្យ &lt;b&gt;<xliff:g id="APP_NAME">%1$s</xliff:g>&lt;/b&gt; ចូលប្រើ​តន្រ្តី​របស់​អ្នក?"</string>
-    <string name="permgrouplab_visual" msgid="8030190588123857921">"រូបថត និង​វីដេអូ"</string>
+    <string name="permgrouplab_visual" msgid="6477382108771145134">"​រូបថត និង​វីដេអូ"</string>
     <string name="permgroupdesc_visual" msgid="3415827902566663546">"ចូលប្រើ​រូបថត និង​វីដេអូ​របស់អ្នក"</string>
-    <string name="permgrouprequest_visual" msgid="6907523945030290376">"អនុញ្ញាត​ឱ្យ &lt;b&gt;<xliff:g id="APP_NAME">%1$s</xliff:g>&lt;/b&gt; ចូលប្រើ​រូបថត និង​វីដេអូ​របស់​អ្នក?"</string>
+    <string name="permgrouprequest_visual" msgid="3043752127595243314">"អនុញ្ញាត​ឱ្យ &lt;b&gt;<xliff:g id="APP_NAME">%1$s</xliff:g>&lt;/b&gt; ចូលប្រើ​រូបថត និង​វីដេអូ​របស់អ្នក រួមទាំង​ទីតាំង​ដែលបានដាក់ស្លាក?"</string>
     <string name="capability_title_canRetrieveWindowContent" msgid="3901717936930170320">"ទាញយក​ខ្លឹមសារ​វិនដូ"</string>
     <string name="capability_desc_canRetrieveWindowContent" msgid="3772225008605310672">"ពិនិត្យ​ខ្លឹមសារវិនដូ​ដែល​អ្នក​កំពុង​ទាក់ទង​ជា​មួយ។"</string>
     <string name="capability_title_canRequestTouchExploration" msgid="3108723364676667320">"បើក​ការ​រក​មើល​​ដោយ​ប៉ះ"</string>
@@ -510,7 +510,7 @@
     <string name="permlab_disableKeyguard" msgid="3598496301486439258">"បិទ​ការ​ចាក់​សោ​អេក្រង់​របស់​អ្នក"</string>
     <string name="permdesc_disableKeyguard" msgid="6034203065077122992">"ឲ្យ​កម្មវិធី​បិទ​ការ​ចាក់សោ​សុវត្ថិភាព​ពាក្យ​សម្ងាត់​ដែល​បាន​ភ្ជាប់​ណា​មួយ។ ​ឧទាហរណ៍​ត្រឹមត្រូវ​​​នៃ​ការ​បិទ​ទូរស័ព្ទ​ពេល​ទទួលការ​ហៅ​ចូល បន្ទាប់​ម​បើក​សោ​ពេល​ការ​ហៅ​បាន​បញ្ចប់។"</string>
     <string name="permlab_requestScreenLockComplexity" msgid="7028982116060987169">"ស្នើ​សុំកម្រិត​​ស្មុគស្មាញ​នៃការចាក់សោអេក្រង់"</string>
-    <string name="permdesc_requestScreenLockComplexity" msgid="2806396846128185677">"អនុញ្ញាតឱ្យ​កម្មវិធី​រៀនអំពី​កម្រិតស្មុគស្មាញ​ការនៃការចាក់សោអេក្រង់ (ខ្ពស់ មធ្យម​ ទាប ឬគ្មាន) ដែល​បញ្ជាក់អំពី​​ប្រវែង និងប្រភេទ​នៃការចាក់សោអេក្រង់។ កម្មវិធី​នេះ​ក៏​អាច​ណែនាំឱ្យ​អ្នកប្រើប្រាស់​ធ្វើបច្ចុប្បន្នភាព​ការចាក់សោ​អេក្រង់​ទៅកម្រិតជាក់លាក់​ផងដែរ ប៉ុន្តែ​អ្នកប្រើប្រាស់​អាច​មិនអើពើនឹង​ការណែនាំនេះ​ដោយសេរី។ សូម​ចំណាំថា ការចាក់សោអេក្រង់​មិន​ត្រូវបាន​រក្សាទុក​ជាអត្ថបទ​ធម្មតាទេ ដូច្នេះ​កម្មវិធីនេះ​មិន​ស្គាល់​ពាក្យសម្ងាត់​ពិតប្រាកដ​ឡើយ។"</string>
+    <string name="permdesc_requestScreenLockComplexity" msgid="2806396846128185677">"អនុញ្ញាតឱ្យ​កម្មវិធី​រៀនអំពី​កម្រិតស្មុគស្មាញ​នៃការចាក់សោអេក្រង់ (ខ្ពស់ មធ្យម​ ទាប ឬគ្មាន) ដែល​បញ្ជាក់អំពី​​ចន្លោះប្រវែងដែលអាចមាន និងប្រភេទ​នៃការចាក់សោអេក្រង់។ កម្មវិធី​នេះ​ក៏​អាច​ណែនាំឱ្យ​អ្នកប្រើប្រាស់​ធ្វើបច្ចុប្បន្នភាព​ការចាក់សោ​អេក្រង់​ទៅកម្រិតជាក់លាក់​ផងដែរ ប៉ុន្តែ​អ្នកប្រើប្រាស់​អាច​មិនអើពើនឹង​ការណែនាំនេះ​ដោយសេរី។ សូម​ចំណាំថា ការចាក់សោអេក្រង់​មិន​ត្រូវបាន​រក្សាទុក​ជាអត្ថបទ​ធម្មតាទេ ដូច្នេះ​កម្មវិធីនេះ​មិន​ស្គាល់​ពាក្យសម្ងាត់​ពិតប្រាកដ​ឡើយ។"</string>
     <string name="permlab_useBiometric" msgid="8837753668509919318">"ប្រើ​ឧបករណ៍​ស្កេន​ស្នាមម្រាមដៃ"</string>
     <string name="permdesc_useBiometric" msgid="8389855232721612926">"អនុញ្ញាត​ឱ្យ​កម្មវិធី​ប្រើ​ឧបករណ៍​ស្កេន​ស្នាមម្រាមដៃ​សម្រាប់​ការផ្ទៀងផ្ទាត់"</string>
     <string name="permlab_manageFingerprint" msgid="5640858826254575638">"គ្រប់គ្រងផ្នែករឹងស្នាមម្រាមដៃ"</string>
@@ -1398,8 +1398,7 @@
     <string name="ext_media_init_action" msgid="7952885510091978278">"ដំឡើង"</string>
     <string name="ext_media_unmount_action" msgid="1121883233103278199">"ដកចេញ"</string>
     <string name="ext_media_browse_action" msgid="8322172381028546087">"រុករក"</string>
-    <!-- no translation found for ext_media_seamless_action (6575980560886881233) -->
-    <skip />
+    <string name="ext_media_seamless_action" msgid="6575980560886881233">"លទ្ធផល Switch"</string>
     <string name="ext_media_missing_title" msgid="620980315821543904">"បាត់ <xliff:g id="NAME">%s</xliff:g>"</string>
     <string name="ext_media_missing_message" msgid="4012389235250987930">"បញ្ចូល​ឧបករណ៍​ម្តងទៀត"</string>
     <string name="ext_media_move_specific_title" msgid="1471100343872375842">"កំពុងផ្លាស់ទី <xliff:g id="NAME">%s</xliff:g>"</string>
@@ -1613,6 +1612,8 @@
     <string name="display_manager_overlay_display_name" msgid="5142365982271620716">"#<xliff:g id="ID">%1$d</xliff:g> ត្រួត​គ្នា"</string>
     <string name="display_manager_overlay_display_title" msgid="652124517672257172">"<xliff:g id="NAME">%1$s</xliff:g>: <xliff:g id="WIDTH">%2$d</xliff:g>x<xliff:g id="HEIGHT">%3$d</xliff:g>, <xliff:g id="DPI">%4$d</xliff:g> dpi"</string>
     <string name="display_manager_overlay_display_secure_suffix" msgid="6022119702628572080">", សុវត្ថិភាព"</string>
+    <string name="activity_starter_block_bg_activity_starts_permissive" msgid="5692097903712956720">"មុខងារចាប់ផ្ដើម​សកម្មភាព​នៅផ្ទៃខាងក្រោយ​ពី <xliff:g id="PACKAGENAME">%1$s</xliff:g> នេះ​នឹងត្រូវ​ទប់ស្កាត់​នៅក្នុង​កំណែបង្កើត Q នាពេលអនាគត។ សូមមើល go/q-bg-block ។"</string>
+    <string name="activity_starter_block_bg_activity_starts_enforcing" msgid="8299522481076404353">"បានទប់ស្កាត់​មុខងារចាប់ផ្ដើម​សកម្មភាព​នៅផ្ទៃខាងក្រោយ​ពី <xliff:g id="PACKAGENAME">%1$s</xliff:g> ។ សូមមើល go/q-bg-block ។"</string>
     <string name="kg_forgot_pattern_button_text" msgid="8852021467868220608">"ភ្លេច​​លំនាំ"</string>
     <string name="kg_wrong_pattern" msgid="1850806070801358830">"លំនាំ​មិន​ត្រឹមត្រូវ"</string>
     <string name="kg_wrong_password" msgid="2333281762128113157">"ពាក្យ​សម្ងាត់​មិន​ត្រឹមត្រូវ"</string>
@@ -1998,9 +1999,29 @@
     <string name="dynamic_mode_notification_channel_name" msgid="2348803891571320452">"ការ​ជូនដំណឹង​ព័ត៌មាន​របស់​មុខងារ​ទម្លាប់"</string>
     <string name="dynamic_mode_notification_title" msgid="508815255807182035">"ថ្ម​អាច​នឹង​អស់ មុនពេល​សាកថ្មធម្មតា"</string>
     <string name="dynamic_mode_notification_summary" msgid="2541166298550402690">"បាន​បើក​ដំណើរការកម្មវិធី​សន្សំ​ថ្ម ដើម្បីបង្កើនកម្រិត​ថាមពល​​ថ្ម"</string>
+    <string name="mime_type_folder" msgid="7111951698626315204">"ថត"</string>
+    <string name="mime_type_apk" msgid="5518003630972506900">"​កម្មវិធី Android"</string>
+    <string name="mime_type_generic" msgid="6833871596845900027">"ឯកសារ"</string>
+    <string name="mime_type_generic_ext" msgid="8450275970061657174">"​ឯកសារ <xliff:g id="EXTENSION">%1$s</xliff:g>"</string>
+    <string name="mime_type_audio" msgid="6289777657172050926">"សំឡេង"</string>
+    <string name="mime_type_audio_ext" msgid="3270880987725816210">"សំឡេង ​<xliff:g id="EXTENSION">%1$s</xliff:g>"</string>
+    <string name="mime_type_video" msgid="4093025777317307426">"វីដេអូ​"</string>
+    <string name="mime_type_video_ext" msgid="5643771615714173159">"វីដេអូ <xliff:g id="EXTENSION">%1$s</xliff:g>"</string>
+    <string name="mime_type_image" msgid="3144284451605236371">"រូបភាព"</string>
+    <string name="mime_type_image_ext" msgid="1514613218742736590">"រូបភាព <xliff:g id="EXTENSION">%1$s</xliff:g>"</string>
+    <string name="mime_type_compressed" msgid="1645486037074943257">"បណ្ណសារ​"</string>
+    <string name="mime_type_compressed_ext" msgid="4232293058067801528">"បណ្ណសារ​ <xliff:g id="EXTENSION">%1$s</xliff:g>"</string>
+    <string name="mime_type_document" msgid="1596838147256375966">"ឯកសារ​"</string>
+    <string name="mime_type_document_ext" msgid="6327266601345501281">"ឯកសារ <xliff:g id="EXTENSION">%1$s</xliff:g>"</string>
+    <string name="mime_type_spreadsheet" msgid="2639138255207123557">"បញ្ជី​"</string>
+    <string name="mime_type_spreadsheet_ext" msgid="5508653032786106725">"បញ្ជី​ <xliff:g id="EXTENSION">%1$s</xliff:g>"</string>
+    <string name="mime_type_presentation" msgid="6145604688774787357">"បទ​បង្ហាញ"</string>
+    <string name="mime_type_presentation_ext" msgid="2982650207774823437">"បទបង្ហាញ​ <xliff:g id="EXTENSION">%1$s</xliff:g>"</string>
     <string name="car_loading_profile" msgid="3545132581795684027">"កំពុងផ្ទុក"</string>
     <plurals name="file_count" formatted="false" msgid="1628600959752419449">
       <item quantity="other">ឯកសារ <xliff:g id="FILE_NAME_2">%s</xliff:g> + <xliff:g id="COUNT_3">%d</xliff:g></item>
       <item quantity="one">ឯកសារ​ <xliff:g id="FILE_NAME_0">%s</xliff:g> + <xliff:g id="COUNT_1">%d</xliff:g></item>
     </plurals>
+    <!-- no translation found for chooser_no_direct_share_targets (997970693708458895) -->
+    <skip />
 </resources>
diff --git a/core/res/res/values-kn/strings.xml b/core/res/res/values-kn/strings.xml
index 4dce499..c8d4396 100644
--- a/core/res/res/values-kn/strings.xml
+++ b/core/res/res/values-kn/strings.xml
@@ -308,15 +308,15 @@
     <string name="permgrouplab_phone" msgid="5229115638567440675">"ಫೋನ್"</string>
     <string name="permgroupdesc_phone" msgid="6234224354060641055">"ಫೋನ್ ಕರೆ ಮಾಡಲು ಹಾಗೂ ನಿರ್ವಹಿಸಲು"</string>
     <string name="permgrouprequest_phone" msgid="9166979577750581037">"ಫೋನ್ ಕರೆಗಳನ್ನು ಮಾಡಲು ಮತ್ತು ನಿರ್ವಹಿಸಲು &lt;b&gt;<xliff:g id="APP_NAME">%1$s</xliff:g>&lt;/b&gt; ಗೆ ಅನುಮತಿಸಬೇಕೇ?"</string>
-    <string name="permgrouplab_sensors" msgid="416037179223226722">"ದೇಹ ಸೆನ್ಸರ್‌ಗಳು"</string>
+    <string name="permgrouplab_sensors" msgid="4838614103153567532">"ದೇಹದ ಸೆನ್ಸರ್‌ಗಳು"</string>
     <string name="permgroupdesc_sensors" msgid="7147968539346634043">"ನಿಮ್ಮ ಮುಖ್ಯ ಲಕ್ಷಣಗಳ ಕುರಿತು ಸೆನ್ಸಾರ್ ಡೇಟಾವನ್ನು ಪ್ರವೇಶಿಸಿ"</string>
     <string name="permgrouprequest_sensors" msgid="6349806962814556786">"ನಿಮ್ಮ ಮುಖ್ಯ ಲಕ್ಷಣಗಳ ಕುರಿತು ಸೆನ್ಸರ್ ಡೇಟಾವನ್ನು &lt;b&gt;<xliff:g id="APP_NAME">%1$s</xliff:g>&lt;/b&gt; ಗೆ ಅನುಮತಿಸಬೇಕೇ?"</string>
     <string name="permgrouplab_aural" msgid="965607064083134896">"ಸಂಗೀತ"</string>
     <string name="permgroupdesc_aural" msgid="4870189506255958055">"ನಿಮ್ಮ ಸಂಗೀತವನ್ನು ಪ್ರವೇಶಿಸಿ"</string>
     <string name="permgrouprequest_aural" msgid="6787926123071735620">"ನಿಮ್ಮ ಸಂಗೀತವನ್ನು ಪ್ರವೇಶಿಸಲು &lt;b&gt;<xliff:g id="APP_NAME">%1$s</xliff:g>&lt;/b&gt; ಗೆ ಅನುಮತಿಸಬೇಕೇ?"</string>
-    <string name="permgrouplab_visual" msgid="8030190588123857921">"ಫೋಟೋಗಳು &amp; ವೀಡಿಯೊಗಳು"</string>
+    <string name="permgrouplab_visual" msgid="6477382108771145134">"ಫೋಟೋಗಳು ಮತ್ತು ವೀಡಿಯೊಗಳು"</string>
     <string name="permgroupdesc_visual" msgid="3415827902566663546">"ನಿಮ್ಮ ಫೋಟೋಗಳು &amp; ವೀಡಿಯೊಗಳನ್ನು ಪ್ರವೇಶಿಸಿ"</string>
-    <string name="permgrouprequest_visual" msgid="6907523945030290376">"ನಿಮ್ಮ ಫೋಟೋಗಳು &amp; ವೀಡಿಯೊಗಳನ್ನು ಪ್ರವೇಶಿಸಲು &lt;b&gt;<xliff:g id="APP_NAME">%1$s</xliff:g>&lt;/b&gt; ಗೆ ಅನುಮತಿಸಬೇಕೇ?"</string>
+    <string name="permgrouprequest_visual" msgid="3043752127595243314">"ಟ್ಯಾಗ್ ಮಾಡಿದ ಸ್ಥಳಗಳೂ ಸೇರಿದಂತೆ ನಿಮ್ಮ ಫೋಟೋಗಳು ಹಾಗೂ ವೀಡಿಯೊಗಳಿಗೆ ಪ್ರವೇಶ ಪಡೆಯಲು &lt;b&gt;<xliff:g id="APP_NAME">%1$s</xliff:g>&lt;/b&gt; ಗೆ ಅನುಮತಿ ನೀಡಬೇಕೇ?"</string>
     <string name="capability_title_canRetrieveWindowContent" msgid="3901717936930170320">"ವಿಂಡೋ ವಿಷಯವನ್ನು ಹಿಂಪಡೆಯುತ್ತದೆ"</string>
     <string name="capability_desc_canRetrieveWindowContent" msgid="3772225008605310672">"ನೀವು ಬಳಸುತ್ತಿರುವ ವಿಂಡೋದ ವಿಷಯ ಪರೀಕ್ಷಿಸುತ್ತದೆ."</string>
     <string name="capability_title_canRequestTouchExploration" msgid="3108723364676667320">"ಸ್ಪರ್ಶ-ಎಕ್ಸ್‌ಪ್ಲೋರ್ ಆನ್ ಮಾಡುತ್ತದೆ"</string>
@@ -1612,6 +1612,8 @@
     <string name="display_manager_overlay_display_name" msgid="5142365982271620716">"ಓವರ್‌ಲೇ #<xliff:g id="ID">%1$d</xliff:g>"</string>
     <string name="display_manager_overlay_display_title" msgid="652124517672257172">"<xliff:g id="NAME">%1$s</xliff:g>: <xliff:g id="WIDTH">%2$d</xliff:g>x<xliff:g id="HEIGHT">%3$d</xliff:g>, <xliff:g id="DPI">%4$d</xliff:g> dpi"</string>
     <string name="display_manager_overlay_display_secure_suffix" msgid="6022119702628572080">", ಸುರಕ್ಷಿತ"</string>
+    <string name="activity_starter_block_bg_activity_starts_permissive" msgid="5692097903712956720">"ಈ ಹಿನ್ನೆಲೆ ಚಟುವಟಿಕೆಯು <xliff:g id="PACKAGENAME">%1$s</xliff:g> ನಿಂದ ಆರಂಭವಾಗುತ್ತದೆ. ಭವಿಷ್ಯದ ಕ್ಯು ರಚನೆಗಳಲ್ಲಿ ನಿರ್ಬಂಧವಾಗುತ್ತದೆ. go/q-bg-block ನೋಡಿ."</string>
+    <string name="activity_starter_block_bg_activity_starts_enforcing" msgid="8299522481076404353">"ಹಿನ್ನೆಲೆ ಚಟುವಟಿಕೆ <xliff:g id="PACKAGENAME">%1$s</xliff:g> ನಿಂದ ಆರಂಭವಾಗುತ್ತದೆ ನಿರ್ಬಂಧಿಸಲಾಗಿದೆ. go/q-bg-block ನೋಡಿ."</string>
     <string name="kg_forgot_pattern_button_text" msgid="8852021467868220608">"ಪ್ಯಾಟರ್ನ್ ಅನ್ನು ಮರೆತಿರುವಿರಿ"</string>
     <string name="kg_wrong_pattern" msgid="1850806070801358830">"ತಪ್ಪು ಪ್ಯಾಟರ್ನ್"</string>
     <string name="kg_wrong_password" msgid="2333281762128113157">"ತಪ್ಪು ಪಾಸ್‌ವರ್ಡ್"</string>
@@ -1997,9 +1999,29 @@
     <string name="dynamic_mode_notification_channel_name" msgid="2348803891571320452">"ದೈನಂದಿನ ಸ್ಥಿತಿಯ ಮಾಹಿತಿಯ ಅಧಿಸೂಚನೆ"</string>
     <string name="dynamic_mode_notification_title" msgid="508815255807182035">"ಚಾರ್ಜ್‌ಗೆ ಮೊದಲೆ ಬ್ಯಾಟರಿ ಮುಗಿದು ಬಿಡಬಹುದು"</string>
     <string name="dynamic_mode_notification_summary" msgid="2541166298550402690">"ಬ್ಯಾಟರಿ ಅವಧಿ ಹೆಚ್ಚಿಸಲು ಬ್ಯಾಟರಿ ಸೇವರ್ ಸಕ್ರಿಯಗೊಳಿಸಲಾಗಿದೆ"</string>
+    <string name="mime_type_folder" msgid="7111951698626315204">"ಫೋಲ್ಡರ್"</string>
+    <string name="mime_type_apk" msgid="5518003630972506900">"Android ಆ್ಯಪ್‌"</string>
+    <string name="mime_type_generic" msgid="6833871596845900027">"ಫೈಲ್"</string>
+    <string name="mime_type_generic_ext" msgid="8450275970061657174">"<xliff:g id="EXTENSION">%1$s</xliff:g> ಫೈಲ್"</string>
+    <string name="mime_type_audio" msgid="6289777657172050926">"ಆಡಿಯೋ"</string>
+    <string name="mime_type_audio_ext" msgid="3270880987725816210">"<xliff:g id="EXTENSION">%1$s</xliff:g> ಆಡಿಯೋ"</string>
+    <string name="mime_type_video" msgid="4093025777317307426">"ವೀಡಿಯೊ"</string>
+    <string name="mime_type_video_ext" msgid="5643771615714173159">"<xliff:g id="EXTENSION">%1$s</xliff:g> ವೀಡಿಯೊ"</string>
+    <string name="mime_type_image" msgid="3144284451605236371">"ಚಿತ್ರ"</string>
+    <string name="mime_type_image_ext" msgid="1514613218742736590">"<xliff:g id="EXTENSION">%1$s</xliff:g> ಚಿತ್ರ"</string>
+    <string name="mime_type_compressed" msgid="1645486037074943257">"ಆರ್ಕೈವ್"</string>
+    <string name="mime_type_compressed_ext" msgid="4232293058067801528">"<xliff:g id="EXTENSION">%1$s</xliff:g> ಆರ್ಕೈವ್"</string>
+    <string name="mime_type_document" msgid="1596838147256375966">"ಡಾಕ್ಯುಮೆಂಟ್"</string>
+    <string name="mime_type_document_ext" msgid="6327266601345501281">"<xliff:g id="EXTENSION">%1$s</xliff:g> ಡಾಕ್ಯುಮೆಂಟ್"</string>
+    <string name="mime_type_spreadsheet" msgid="2639138255207123557">"ಸ್ಪ್ರೆಡ್‌ಶೀಟ್"</string>
+    <string name="mime_type_spreadsheet_ext" msgid="5508653032786106725">"<xliff:g id="EXTENSION">%1$s</xliff:g> ಸ್ಪ್ರೆಡ್‌ಶೀಟ್"</string>
+    <string name="mime_type_presentation" msgid="6145604688774787357">"ಪ್ರಸ್ತುತಿ"</string>
+    <string name="mime_type_presentation_ext" msgid="2982650207774823437">"<xliff:g id="EXTENSION">%1$s</xliff:g> ಪ್ರಸ್ತುತಿ"</string>
     <string name="car_loading_profile" msgid="3545132581795684027">"ಲೋಡ್ ಆಗುತ್ತಿದೆ"</string>
     <plurals name="file_count" formatted="false" msgid="1628600959752419449">
       <item quantity="one"><xliff:g id="FILE_NAME_2">%s</xliff:g> + <xliff:g id="COUNT_3">%d</xliff:g> ಫೈಲ್‌ಗಳು</item>
       <item quantity="other"><xliff:g id="FILE_NAME_2">%s</xliff:g> + <xliff:g id="COUNT_3">%d</xliff:g> ಫೈಲ್‌ಗಳು</item>
     </plurals>
+    <!-- no translation found for chooser_no_direct_share_targets (997970693708458895) -->
+    <skip />
 </resources>
diff --git a/core/res/res/values-ko/strings.xml b/core/res/res/values-ko/strings.xml
index 8b1ee4a..69963ef05 100644
--- a/core/res/res/values-ko/strings.xml
+++ b/core/res/res/values-ko/strings.xml
@@ -308,15 +308,15 @@
     <string name="permgrouplab_phone" msgid="5229115638567440675">"전화"</string>
     <string name="permgroupdesc_phone" msgid="6234224354060641055">"전화 걸기 및 관리"</string>
     <string name="permgrouprequest_phone" msgid="9166979577750581037">"&lt;b&gt;<xliff:g id="APP_NAME">%1$s</xliff:g>&lt;/b&gt;에서 전화를 걸고 관리하도록 허용하시겠습니까?"</string>
-    <string name="permgrouplab_sensors" msgid="416037179223226722">"인체 감지 센서"</string>
+    <string name="permgrouplab_sensors" msgid="4838614103153567532">"신체 센서"</string>
     <string name="permgroupdesc_sensors" msgid="7147968539346634043">"생체 신호에 관한 센서 데이터에 액세스"</string>
     <string name="permgrouprequest_sensors" msgid="6349806962814556786">"&lt;b&gt;<xliff:g id="APP_NAME">%1$s</xliff:g>&lt;/b&gt;에서 생체 신호에 관한 센서 데이터에 액세스하도록 허용하시겠습니까?"</string>
     <string name="permgrouplab_aural" msgid="965607064083134896">"음악"</string>
     <string name="permgroupdesc_aural" msgid="4870189506255958055">"음악에 액세스"</string>
     <string name="permgrouprequest_aural" msgid="6787926123071735620">"&lt;b&gt;<xliff:g id="APP_NAME">%1$s</xliff:g>&lt;/b&gt;에서 내 음악에 액세스하도록 허용하시겠습니까?"</string>
-    <string name="permgrouplab_visual" msgid="8030190588123857921">"사진 및 동영상"</string>
+    <string name="permgrouplab_visual" msgid="6477382108771145134">"사진 및 동영상"</string>
     <string name="permgroupdesc_visual" msgid="3415827902566663546">"사진 및 동영상에 액세스"</string>
-    <string name="permgrouprequest_visual" msgid="6907523945030290376">"&lt;b&gt;<xliff:g id="APP_NAME">%1$s</xliff:g>&lt;/b&gt;에서 내 사진 및 동영상에 액세스하도록 허용하시겠습니까?"</string>
+    <string name="permgrouprequest_visual" msgid="3043752127595243314">"&lt;b&gt;<xliff:g id="APP_NAME">%1$s</xliff:g>&lt;/b&gt;에서 태그가 지정된 위치를 포함한 내 사진과 동영상에 액세스하도록 허용하시겠습니까?"</string>
     <string name="capability_title_canRetrieveWindowContent" msgid="3901717936930170320">"창 콘텐츠 가져오기"</string>
     <string name="capability_desc_canRetrieveWindowContent" msgid="3772225008605310672">"상호작용 중인 창의 콘텐츠를 검사합니다."</string>
     <string name="capability_title_canRequestTouchExploration" msgid="3108723364676667320">"터치하여 탐색 사용"</string>
@@ -1611,6 +1611,8 @@
     <string name="display_manager_overlay_display_name" msgid="5142365982271620716">"<xliff:g id="ID">%1$d</xliff:g>번째 오버레이"</string>
     <string name="display_manager_overlay_display_title" msgid="652124517672257172">"<xliff:g id="NAME">%1$s</xliff:g>: <xliff:g id="WIDTH">%2$d</xliff:g>x<xliff:g id="HEIGHT">%3$d</xliff:g>, <xliff:g id="DPI">%4$d</xliff:g> dpi"</string>
     <string name="display_manager_overlay_display_secure_suffix" msgid="6022119702628572080">", 보안"</string>
+    <string name="activity_starter_block_bg_activity_starts_permissive" msgid="5692097903712956720">"<xliff:g id="PACKAGENAME">%1$s</xliff:g>의 백그라운드 활동 시작은 향후 Q 빌드에서 차단됩니다. go/q-bg-block을 참조하세요."</string>
+    <string name="activity_starter_block_bg_activity_starts_enforcing" msgid="8299522481076404353">"<xliff:g id="PACKAGENAME">%1$s</xliff:g>의 백그라운드 활동 시작이 차단되었습니다. go/q-bg-block을 참조하세요."</string>
     <string name="kg_forgot_pattern_button_text" msgid="8852021467868220608">"패턴을 잊음"</string>
     <string name="kg_wrong_pattern" msgid="1850806070801358830">"잘못된 패턴"</string>
     <string name="kg_wrong_password" msgid="2333281762128113157">"잘못된 비밀번호"</string>
@@ -1996,9 +1998,29 @@
     <string name="dynamic_mode_notification_channel_name" msgid="2348803891571320452">"루틴 모드 정보 알림"</string>
     <string name="dynamic_mode_notification_title" msgid="508815255807182035">"평소에 충전하는 시간 전에 배터리가 소진될 수 있습니다."</string>
     <string name="dynamic_mode_notification_summary" msgid="2541166298550402690">"배터리 수명을 연장하기 위해 배터리 세이버가 활성화되었습니다."</string>
+    <string name="mime_type_folder" msgid="7111951698626315204">"폴더"</string>
+    <string name="mime_type_apk" msgid="5518003630972506900">"Android 애플리케이션"</string>
+    <string name="mime_type_generic" msgid="6833871596845900027">"파일"</string>
+    <string name="mime_type_generic_ext" msgid="8450275970061657174">"<xliff:g id="EXTENSION">%1$s</xliff:g> 파일"</string>
+    <string name="mime_type_audio" msgid="6289777657172050926">"오디오"</string>
+    <string name="mime_type_audio_ext" msgid="3270880987725816210">"<xliff:g id="EXTENSION">%1$s</xliff:g> 오디오"</string>
+    <string name="mime_type_video" msgid="4093025777317307426">"동영상"</string>
+    <string name="mime_type_video_ext" msgid="5643771615714173159">"<xliff:g id="EXTENSION">%1$s</xliff:g> 동영상"</string>
+    <string name="mime_type_image" msgid="3144284451605236371">"이미지"</string>
+    <string name="mime_type_image_ext" msgid="1514613218742736590">"<xliff:g id="EXTENSION">%1$s</xliff:g> 이미지"</string>
+    <string name="mime_type_compressed" msgid="1645486037074943257">"보관 파일"</string>
+    <string name="mime_type_compressed_ext" msgid="4232293058067801528">"<xliff:g id="EXTENSION">%1$s</xliff:g> 보관 파일"</string>
+    <string name="mime_type_document" msgid="1596838147256375966">"문서"</string>
+    <string name="mime_type_document_ext" msgid="6327266601345501281">"<xliff:g id="EXTENSION">%1$s</xliff:g> 문서"</string>
+    <string name="mime_type_spreadsheet" msgid="2639138255207123557">"스프레드시트"</string>
+    <string name="mime_type_spreadsheet_ext" msgid="5508653032786106725">"<xliff:g id="EXTENSION">%1$s</xliff:g> 스프레드시트"</string>
+    <string name="mime_type_presentation" msgid="6145604688774787357">"프레젠테이션"</string>
+    <string name="mime_type_presentation_ext" msgid="2982650207774823437">"<xliff:g id="EXTENSION">%1$s</xliff:g> 프레젠테이션"</string>
     <string name="car_loading_profile" msgid="3545132581795684027">"로드 중"</string>
     <plurals name="file_count" formatted="false" msgid="1628600959752419449">
       <item quantity="other"><xliff:g id="FILE_NAME_2">%s</xliff:g> 및 파일 <xliff:g id="COUNT_3">%d</xliff:g>개</item>
       <item quantity="one"><xliff:g id="FILE_NAME_0">%s</xliff:g> 및 파일 <xliff:g id="COUNT_1">%d</xliff:g>개</item>
     </plurals>
+    <!-- no translation found for chooser_no_direct_share_targets (997970693708458895) -->
+    <skip />
 </resources>
diff --git a/core/res/res/values-ky/strings.xml b/core/res/res/values-ky/strings.xml
index 59a8b18..95e85c6 100644
--- a/core/res/res/values-ky/strings.xml
+++ b/core/res/res/values-ky/strings.xml
@@ -308,15 +308,15 @@
     <string name="permgrouplab_phone" msgid="5229115638567440675">"Телефон"</string>
     <string name="permgroupdesc_phone" msgid="6234224354060641055">"телефон чалуу жана аларды башкаруу"</string>
     <string name="permgrouprequest_phone" msgid="9166979577750581037">"&lt;b&gt;<xliff:g id="APP_NAME">%1$s</xliff:g>&lt;/b&gt; колдонмосуна телефон чалууга жана чалууларды башкарууга уруксат берилсинби?"</string>
-    <string name="permgrouplab_sensors" msgid="416037179223226722">"Дене сенсорлору"</string>
+    <string name="permgrouplab_sensors" msgid="4838614103153567532">"Дене сенсорлору"</string>
     <string name="permgroupdesc_sensors" msgid="7147968539346634043">"организмдин абалына көз салган сенсордун дайындарына мүмкүнчүлүк алуу"</string>
     <string name="permgrouprequest_sensors" msgid="6349806962814556786">"&lt;b&gt;<xliff:g id="APP_NAME">%1$s</xliff:g>&lt;/b&gt; колдонмосуна организмдин абалына көз салган сенсордун дайындарын пайдаланууга уруксат берилсинби?"</string>
     <string name="permgrouplab_aural" msgid="965607064083134896">"Музыка"</string>
     <string name="permgroupdesc_aural" msgid="4870189506255958055">"музыкага кирүү мүмкүнчүлүгү"</string>
     <string name="permgrouprequest_aural" msgid="6787926123071735620">"&lt;b&gt;<xliff:g id="APP_NAME">%1$s</xliff:g>&lt;/b&gt; колдонмосуна музыканы пайдаланууга уруксат берилсинби?"</string>
-    <string name="permgrouplab_visual" msgid="8030190588123857921">"Сүрөттөр жана видеолор"</string>
+    <string name="permgrouplab_visual" msgid="6477382108771145134">"Сүрөттөр жана видеолор"</string>
     <string name="permgroupdesc_visual" msgid="3415827902566663546">"сүрөттөр менен видеолорго кирүү мүмкүнчүлүгү"</string>
-    <string name="permgrouprequest_visual" msgid="6907523945030290376">"&lt;b&gt;<xliff:g id="APP_NAME">%1$s</xliff:g>&lt;/b&gt; колдонмосуна сүрөттөр менен видеолорду пайдаланууга уруксат берилсинби?"</string>
+    <string name="permgrouprequest_visual" msgid="3043752127595243314">"&lt;b&gt;<xliff:g id="APP_NAME">%1$s</xliff:g>&lt;/b&gt; колдонмосуна сүрөттөрүңүздү, видеолоруңузду, анын ичинде тегделген жайгашкан жерлериңизди көрүүгө уруксат бересизби?"</string>
     <string name="capability_title_canRetrieveWindowContent" msgid="3901717936930170320">"Терезедеги мазмунду алып турат"</string>
     <string name="capability_desc_canRetrieveWindowContent" msgid="3772225008605310672">"Учурда ачылып турган терезедеги маалыматты талдайт."</string>
     <string name="capability_title_canRequestTouchExploration" msgid="3108723364676667320">"\"Сыйпалап изилдөө\" мүмкүнчүлүгүн иштетет"</string>
@@ -1398,8 +1398,7 @@
     <string name="ext_media_init_action" msgid="7952885510091978278">"Орнотуу"</string>
     <string name="ext_media_unmount_action" msgid="1121883233103278199">"Чыгаруу"</string>
     <string name="ext_media_browse_action" msgid="8322172381028546087">"Изилдөө"</string>
-    <!-- no translation found for ext_media_seamless_action (6575980560886881233) -->
-    <skip />
+    <string name="ext_media_seamless_action" msgid="6575980560886881233">"Аудио түзмөктү которуштуруу"</string>
     <string name="ext_media_missing_title" msgid="620980315821543904">"<xliff:g id="NAME">%s</xliff:g> табылбай жатат"</string>
     <string name="ext_media_missing_message" msgid="4012389235250987930">"Түзмөктү кайра салыңыз"</string>
     <string name="ext_media_move_specific_title" msgid="1471100343872375842">"<xliff:g id="NAME">%s</xliff:g> сактагычына ооштурулууда"</string>
@@ -1613,6 +1612,8 @@
     <string name="display_manager_overlay_display_name" msgid="5142365982271620716">"Катмар №<xliff:g id="ID">%1$d</xliff:g>"</string>
     <string name="display_manager_overlay_display_title" msgid="652124517672257172">"<xliff:g id="NAME">%1$s</xliff:g>: <xliff:g id="WIDTH">%2$d</xliff:g>x<xliff:g id="HEIGHT">%3$d</xliff:g>, <xliff:g id="DPI">%4$d</xliff:g> dpi"</string>
     <string name="display_manager_overlay_display_secure_suffix" msgid="6022119702628572080">", корголгон"</string>
+    <string name="activity_starter_block_bg_activity_starts_permissive" msgid="5692097903712956720">"<xliff:g id="PACKAGENAME">%1$s</xliff:g> сайтынын фондук режимде иштеши Q курамдарында бөгөттөлүп турат. Төмөнкүгө өтүңүз: go/q-bg-block."</string>
+    <string name="activity_starter_block_bg_activity_starts_enforcing" msgid="8299522481076404353">"<xliff:g id="PACKAGENAME">%1$s</xliff:g> сайтынын фондук режимде иштеши бөгөттөлдү. Төмөнкүгө өтүңүз: go/q-bg-block."</string>
     <string name="kg_forgot_pattern_button_text" msgid="8852021467868220608">"Үлгү унутулду"</string>
     <string name="kg_wrong_pattern" msgid="1850806070801358830">"Графикалык ачкыч туура эмес"</string>
     <string name="kg_wrong_password" msgid="2333281762128113157">"Сырсөз туура эмес"</string>
@@ -1998,9 +1999,29 @@
     <string name="dynamic_mode_notification_channel_name" msgid="2348803891571320452">"Режимдин адаттагы билдирмеси"</string>
     <string name="dynamic_mode_notification_title" msgid="508815255807182035">"Батарея кубаттоого чейин отуруп калышы мүмкүн"</string>
     <string name="dynamic_mode_notification_summary" msgid="2541166298550402690">"Батареянын отуруп калбашы үчүн Батареяны үнөмдөгүч режими иштетилди"</string>
+    <string name="mime_type_folder" msgid="7111951698626315204">"Папка"</string>
+    <string name="mime_type_apk" msgid="5518003630972506900">"Android колдонмосу"</string>
+    <string name="mime_type_generic" msgid="6833871596845900027">"Файл"</string>
+    <string name="mime_type_generic_ext" msgid="8450275970061657174">"<xliff:g id="EXTENSION">%1$s</xliff:g> форматындагы файл"</string>
+    <string name="mime_type_audio" msgid="6289777657172050926">"Аудио"</string>
+    <string name="mime_type_audio_ext" msgid="3270880987725816210">"<xliff:g id="EXTENSION">%1$s</xliff:g> форматындагы аудио файл"</string>
+    <string name="mime_type_video" msgid="4093025777317307426">"Видео"</string>
+    <string name="mime_type_video_ext" msgid="5643771615714173159">"<xliff:g id="EXTENSION">%1$s</xliff:g> форматындагы видео файл"</string>
+    <string name="mime_type_image" msgid="3144284451605236371">"Сүрөт"</string>
+    <string name="mime_type_image_ext" msgid="1514613218742736590">"<xliff:g id="EXTENSION">%1$s</xliff:g> форматындагы сүрөт"</string>
+    <string name="mime_type_compressed" msgid="1645486037074943257">"Архив"</string>
+    <string name="mime_type_compressed_ext" msgid="4232293058067801528">"<xliff:g id="EXTENSION">%1$s</xliff:g> форматындагы архив"</string>
+    <string name="mime_type_document" msgid="1596838147256375966">"Документ"</string>
+    <string name="mime_type_document_ext" msgid="6327266601345501281">"<xliff:g id="EXTENSION">%1$s</xliff:g> форматындагы документ"</string>
+    <string name="mime_type_spreadsheet" msgid="2639138255207123557">"Электрондук жадыбал"</string>
+    <string name="mime_type_spreadsheet_ext" msgid="5508653032786106725">"<xliff:g id="EXTENSION">%1$s</xliff:g> форматындагы электр. жадыбал"</string>
+    <string name="mime_type_presentation" msgid="6145604688774787357">"Презентация"</string>
+    <string name="mime_type_presentation_ext" msgid="2982650207774823437">"<xliff:g id="EXTENSION">%1$s</xliff:g> форматындагы презентация"</string>
     <string name="car_loading_profile" msgid="3545132581795684027">"Жүктөлүүдө"</string>
     <plurals name="file_count" formatted="false" msgid="1628600959752419449">
       <item quantity="other"><xliff:g id="FILE_NAME_2">%s</xliff:g> + <xliff:g id="COUNT_3">%d</xliff:g> файл</item>
       <item quantity="one"><xliff:g id="FILE_NAME_0">%s</xliff:g> + <xliff:g id="COUNT_1">%d</xliff:g> файл</item>
     </plurals>
+    <!-- no translation found for chooser_no_direct_share_targets (997970693708458895) -->
+    <skip />
 </resources>
diff --git a/core/res/res/values-lo/strings.xml b/core/res/res/values-lo/strings.xml
index 3f1a6ef..1e76147 100644
--- a/core/res/res/values-lo/strings.xml
+++ b/core/res/res/values-lo/strings.xml
@@ -308,15 +308,15 @@
     <string name="permgrouplab_phone" msgid="5229115638567440675">"ໂທລະສັບ"</string>
     <string name="permgroupdesc_phone" msgid="6234224354060641055">"ໂທ ແລະ​ຈັດ​ການ​ການ​ໂທ​ລະ​ສັບ"</string>
     <string name="permgrouprequest_phone" msgid="9166979577750581037">"ອະນຸຍາດ &lt;b&gt;<xliff:g id="APP_NAME">%1$s</xliff:g>&lt;/b&gt; ໃຫ້ໂທ ແລະ ຈັດການການໂທບໍ?"</string>
-    <string name="permgrouplab_sensors" msgid="416037179223226722">"ເຊັນ​ເຊີ​ຮ່າງ​ກາຍ"</string>
+    <string name="permgrouplab_sensors" msgid="4838614103153567532">"ເຊັນເຊີຮ່າງກາຍ"</string>
     <string name="permgroupdesc_sensors" msgid="7147968539346634043">"ເຂົ້າ​ຫາ​ຂໍ້​ມູນ​ເຊັນ​ເຊີ​ກ່ຽວ​ກັບ​ສັນ​ຍານ​ຊີບ​ຂອງ​ທ່ານ"</string>
     <string name="permgrouprequest_sensors" msgid="6349806962814556786">"ອະນຸຍາດ &lt;b&gt;<xliff:g id="APP_NAME">%1$s</xliff:g>&lt;/b&gt; ໃຫ້ເຂົ້າເຖິງຂໍ້ມູນເຊັນເຊີກ່ຽວກັບສັນຍານຊີບຂອງທ່ານບໍ?"</string>
     <string name="permgrouplab_aural" msgid="965607064083134896">"ເພງ"</string>
     <string name="permgroupdesc_aural" msgid="4870189506255958055">"ເຂົ້າເຖິງເພງຂອງທ່ານ"</string>
     <string name="permgrouprequest_aural" msgid="6787926123071735620">"ອະນຸຍາດ &lt;b&gt;<xliff:g id="APP_NAME">%1$s</xliff:g>&lt;/b&gt; ໃຫ້ເຂົ້າເຖິງເພງຂອງທ່ານບໍ?"</string>
-    <string name="permgrouplab_visual" msgid="8030190588123857921">"ຮູບພາບ ແລະ ວິດີໂອ"</string>
+    <string name="permgrouplab_visual" msgid="6477382108771145134">"ຮູບພາບ ແລະ ວິດີໂອ"</string>
     <string name="permgroupdesc_visual" msgid="3415827902566663546">"ເຂົ້າເຖິງຮູບພາບ ແລະ ວິດີໂອຂອງທ່ານ"</string>
-    <string name="permgrouprequest_visual" msgid="6907523945030290376">"ອະນຸຍາດ &lt;b&gt;<xliff:g id="APP_NAME">%1$s</xliff:g>&lt;/b&gt; ໃຫ້ເຂົ້າເຖິງຮູບພາບ ແລະ ວິດີໂອຂອງທ່ານບໍ?"</string>
+    <string name="permgrouprequest_visual" msgid="3043752127595243314">"ອະນຸຍາດໃຫ້ &lt;b&gt;<xliff:g id="APP_NAME">%1$s</xliff:g>&lt;/b&gt; ເຂົ້າເຖິງຮູບພາບ ແລະ ວິດີໂອຂອງທ່ານ, ຮວມທັງສະຖານທີ່ທີ່ຖືກແທັກນຳບໍ?"</string>
     <string name="capability_title_canRetrieveWindowContent" msgid="3901717936930170320">"ດຶງຂໍ້ມູນເນື້ອຫາໃນໜ້າຈໍ"</string>
     <string name="capability_desc_canRetrieveWindowContent" msgid="3772225008605310672">"ກວດກາເນື້ອຫາຂອງໜ້າຈໍທີ່ທ່ານກຳລັງມີປະຕິສຳພັນນຳ."</string>
     <string name="capability_title_canRequestTouchExploration" msgid="3108723364676667320">"ເປີດໃຊ້ \"ການສຳຫຼວດໂດຍສຳຜັດ\""</string>
@@ -1396,8 +1396,7 @@
     <string name="ext_media_init_action" msgid="7952885510091978278">"ຕິດ​ຕັ້ງ"</string>
     <string name="ext_media_unmount_action" msgid="1121883233103278199">"ເອົາອອກ"</string>
     <string name="ext_media_browse_action" msgid="8322172381028546087">"ຄົ້ນຫາ"</string>
-    <!-- no translation found for ext_media_seamless_action (6575980560886881233) -->
-    <skip />
+    <string name="ext_media_seamless_action" msgid="6575980560886881233">"ສະຫຼັບການສົ່ງຂໍ້ມູນອອກ"</string>
     <string name="ext_media_missing_title" msgid="620980315821543904">"<xliff:g id="NAME">%s</xliff:g> ຂາດ​ໄປ"</string>
     <string name="ext_media_missing_message" msgid="4012389235250987930">"ໃສ່ອຸປະກອນອີກຄັ້ງ"</string>
     <string name="ext_media_move_specific_title" msgid="1471100343872375842">"ກຳ​ລັງ​ຍ້າຍ <xliff:g id="NAME">%s</xliff:g>"</string>
@@ -1611,6 +1610,8 @@
     <string name="display_manager_overlay_display_name" msgid="5142365982271620716">"ການວາງຊ້ອນ #<xliff:g id="ID">%1$d</xliff:g>"</string>
     <string name="display_manager_overlay_display_title" msgid="652124517672257172">"<xliff:g id="NAME">%1$s</xliff:g>: <xliff:g id="WIDTH">%2$d</xliff:g>x<xliff:g id="HEIGHT">%3$d</xliff:g>, <xliff:g id="DPI">%4$d</xliff:g> dpi"</string>
     <string name="display_manager_overlay_display_secure_suffix" msgid="6022119702628572080">", ປອດໄພ"</string>
+    <string name="activity_starter_block_bg_activity_starts_permissive" msgid="5692097903712956720">"ການເລີ່ມການເຄື່ອນໄຫວໃນພື້ນຫຼັງນີ້ຈາກ <xliff:g id="PACKAGENAME">%1$s</xliff:g> ຈະຖືກບລັອກໄວ້ໃນ Q ເວີຊັນອະນາຄົດ. ກະລຸນາເບິ່ງ go/q-bg-block."</string>
+    <string name="activity_starter_block_bg_activity_starts_enforcing" msgid="8299522481076404353">"ການເຄື່ອນໄຫວພື້ນຫຼັງເລີ່ມຈາກ <xliff:g id="PACKAGENAME">%1$s</xliff:g> ຖືກບລັອກໄວ້ແລ້ວ. ກະລຸນາເບິ່ງ go/q-bg-block."</string>
     <string name="kg_forgot_pattern_button_text" msgid="8852021467868220608">"ລືມຮູບແບບປົດລັອກ?"</string>
     <string name="kg_wrong_pattern" msgid="1850806070801358830">"ຮູບແບບຜິດ"</string>
     <string name="kg_wrong_password" msgid="2333281762128113157">"ລະຫັດຜ່ານບໍ່ຖືກຕ້ອງ"</string>
@@ -1996,9 +1997,29 @@
     <string name="dynamic_mode_notification_channel_name" msgid="2348803891571320452">"ການແຈ້ງເຕືອນຂໍ້ມູນໂໝດກິດຈະວັດປະຈຳວັນ"</string>
     <string name="dynamic_mode_notification_title" msgid="508815255807182035">"ແບັດເຕີຣີອາດໝົດກ່ອນການສາກຕາມປົກກະຕິ"</string>
     <string name="dynamic_mode_notification_summary" msgid="2541166298550402690">"ເປີດຕົວປະຢັດແບັດເຕີຣີເພື່ອຂະຫຍາຍອາຍຸແບັດເຕີຣີ"</string>
+    <string name="mime_type_folder" msgid="7111951698626315204">"ໂຟນເດີ"</string>
+    <string name="mime_type_apk" msgid="5518003630972506900">"ແອັບພລິເຄຊັນ Android"</string>
+    <string name="mime_type_generic" msgid="6833871596845900027">"ໄຟລ໌"</string>
+    <string name="mime_type_generic_ext" msgid="8450275970061657174">"ໄຟລ໌ <xliff:g id="EXTENSION">%1$s</xliff:g>"</string>
+    <string name="mime_type_audio" msgid="6289777657172050926">"ສຽງ"</string>
+    <string name="mime_type_audio_ext" msgid="3270880987725816210">"ສຽງ <xliff:g id="EXTENSION">%1$s</xliff:g>"</string>
+    <string name="mime_type_video" msgid="4093025777317307426">"ວິດີໂອ"</string>
+    <string name="mime_type_video_ext" msgid="5643771615714173159">"ວິດີໂອ <xliff:g id="EXTENSION">%1$s</xliff:g>"</string>
+    <string name="mime_type_image" msgid="3144284451605236371">"ຮູບພາບ"</string>
+    <string name="mime_type_image_ext" msgid="1514613218742736590">"ຮູບພາບ <xliff:g id="EXTENSION">%1$s</xliff:g>"</string>
+    <string name="mime_type_compressed" msgid="1645486037074943257">"ແຟ້ມຈັດເກັບ"</string>
+    <string name="mime_type_compressed_ext" msgid="4232293058067801528">"ແຟມຈັດເກັບ <xliff:g id="EXTENSION">%1$s</xliff:g>"</string>
+    <string name="mime_type_document" msgid="1596838147256375966">"ເອກະສານ"</string>
+    <string name="mime_type_document_ext" msgid="6327266601345501281">"ເອກະສານ <xliff:g id="EXTENSION">%1$s</xliff:g>"</string>
+    <string name="mime_type_spreadsheet" msgid="2639138255207123557">"ສະເປຣດຊີດ"</string>
+    <string name="mime_type_spreadsheet_ext" msgid="5508653032786106725">"ສະເປຣດຊີດ <xliff:g id="EXTENSION">%1$s</xliff:g>"</string>
+    <string name="mime_type_presentation" msgid="6145604688774787357">"ພຣີເຊັນເທເຊິນ"</string>
+    <string name="mime_type_presentation_ext" msgid="2982650207774823437">"ພຣີເຊັນເທເຊິນ <xliff:g id="EXTENSION">%1$s</xliff:g>"</string>
     <string name="car_loading_profile" msgid="3545132581795684027">"ກຳລັງໂຫລດ"</string>
     <plurals name="file_count" formatted="false" msgid="1628600959752419449">
       <item quantity="other"><xliff:g id="FILE_NAME_2">%s</xliff:g> + <xliff:g id="COUNT_3">%d</xliff:g> ໄຟລ໌</item>
       <item quantity="one"><xliff:g id="FILE_NAME_0">%s</xliff:g> + <xliff:g id="COUNT_1">%d</xliff:g> ໄຟລ໌</item>
     </plurals>
+    <!-- no translation found for chooser_no_direct_share_targets (997970693708458895) -->
+    <skip />
 </resources>
diff --git a/core/res/res/values-lt/strings.xml b/core/res/res/values-lt/strings.xml
index 43995a9..94ab46c 100644
--- a/core/res/res/values-lt/strings.xml
+++ b/core/res/res/values-lt/strings.xml
@@ -314,15 +314,15 @@
     <string name="permgrouplab_phone" msgid="5229115638567440675">"Telefonas"</string>
     <string name="permgroupdesc_phone" msgid="6234224354060641055">"skambinti ir tvarkyti telefonų skambučius"</string>
     <string name="permgrouprequest_phone" msgid="9166979577750581037">"Leisti &lt;b&gt;<xliff:g id="APP_NAME">%1$s</xliff:g>&lt;/b&gt; skambinti ir tvarkyti telefono skambučius?"</string>
-    <string name="permgrouplab_sensors" msgid="416037179223226722">"Kūno jutikliai"</string>
+    <string name="permgrouplab_sensors" msgid="4838614103153567532">"Kūno jutikliai"</string>
     <string name="permgroupdesc_sensors" msgid="7147968539346634043">"pasiekti jutiklių duomenis apie gyvybinius ženklus"</string>
     <string name="permgrouprequest_sensors" msgid="6349806962814556786">"Suteikti &lt;b&gt;<xliff:g id="APP_NAME">%1$s</xliff:g>&lt;/b&gt; galimybę pasiekti jutiklių duomenis apie gyvybinius ženklus?"</string>
     <string name="permgrouplab_aural" msgid="965607064083134896">"Muzika"</string>
     <string name="permgroupdesc_aural" msgid="4870189506255958055">"pasiekti muziką"</string>
     <string name="permgrouprequest_aural" msgid="6787926123071735620">"Suteikti programai &lt;b&gt;<xliff:g id="APP_NAME">%1$s</xliff:g>&lt;/b&gt; prieigą prie muzikos?"</string>
-    <string name="permgrouplab_visual" msgid="8030190588123857921">"Nuotraukos ir vaizdo įrašai"</string>
+    <string name="permgrouplab_visual" msgid="6477382108771145134">"Nuotraukos ir vaizdo įrašai"</string>
     <string name="permgroupdesc_visual" msgid="3415827902566663546">"pasiekti nuotraukas ir vaizdo įrašus"</string>
-    <string name="permgrouprequest_visual" msgid="6907523945030290376">"Suteikti programai &lt;b&gt;<xliff:g id="APP_NAME">%1$s</xliff:g>&lt;/b&gt; prieigą prie nuotraukų ir vaizdo įrašų?"</string>
+    <string name="permgrouprequest_visual" msgid="3043752127595243314">"Leisti programai &lt;b&gt;<xliff:g id="APP_NAME">%1$s</xliff:g>&lt;/b&gt; pasiekti nuotraukas ir vaizdo įrašus, įskaitant pažymėtas vietoves?"</string>
     <string name="capability_title_canRetrieveWindowContent" msgid="3901717936930170320">"Gauti lango turinį"</string>
     <string name="capability_desc_canRetrieveWindowContent" msgid="3772225008605310672">"Tikrinti lango, su kuriuo sąveikaujate, turinį."</string>
     <string name="capability_title_canRequestTouchExploration" msgid="3108723364676667320">"Įjungti „Naršyti paliečiant“"</string>
@@ -1440,8 +1440,7 @@
     <string name="ext_media_init_action" msgid="7952885510091978278">"Nustatyti"</string>
     <string name="ext_media_unmount_action" msgid="1121883233103278199">"Pašalinti"</string>
     <string name="ext_media_browse_action" msgid="8322172381028546087">"Naršyti"</string>
-    <!-- no translation found for ext_media_seamless_action (6575980560886881233) -->
-    <skip />
+    <string name="ext_media_seamless_action" msgid="6575980560886881233">"Išvesties perjungimas"</string>
     <string name="ext_media_missing_title" msgid="620980315821543904">"Trūksta <xliff:g id="NAME">%s</xliff:g>"</string>
     <string name="ext_media_missing_message" msgid="4012389235250987930">"Įdėkite įrenginį dar kartą"</string>
     <string name="ext_media_move_specific_title" msgid="1471100343872375842">"Perkeliama programa „<xliff:g id="NAME">%s</xliff:g>“"</string>
@@ -1657,6 +1656,8 @@
     <string name="display_manager_overlay_display_name" msgid="5142365982271620716">"Perdanga nr. <xliff:g id="ID">%1$d</xliff:g>"</string>
     <string name="display_manager_overlay_display_title" msgid="652124517672257172">"„<xliff:g id="NAME">%1$s</xliff:g>“: <xliff:g id="WIDTH">%2$d</xliff:g> x <xliff:g id="HEIGHT">%3$d</xliff:g>, <xliff:g id="DPI">%4$d</xliff:g> tašk. colyje"</string>
     <string name="display_manager_overlay_display_secure_suffix" msgid="6022119702628572080">", saugu"</string>
+    <string name="activity_starter_block_bg_activity_starts_permissive" msgid="5692097903712956720">"Šios fono veiklos paleidimas iš „<xliff:g id="PACKAGENAME">%1$s</xliff:g>“ bus užblokuotas būsimose Q versijose. Žr. go/q-bg-block."</string>
+    <string name="activity_starter_block_bg_activity_starts_enforcing" msgid="8299522481076404353">"Fono veiklos paleidimas iš „<xliff:g id="PACKAGENAME">%1$s</xliff:g>“ užblokuotas. Žr. go/q-bg-block."</string>
     <string name="kg_forgot_pattern_button_text" msgid="8852021467868220608">"Pamiršau atrakinimo piešinį"</string>
     <string name="kg_wrong_pattern" msgid="1850806070801358830">"Netinkamas atrakinimo piešinys"</string>
     <string name="kg_wrong_password" msgid="2333281762128113157">"Netinkamas slaptažodis"</string>
@@ -2066,6 +2067,24 @@
     <string name="dynamic_mode_notification_channel_name" msgid="2348803891571320452">"Veiksmų sekos režimo informacijos pranešimas"</string>
     <string name="dynamic_mode_notification_title" msgid="508815255807182035">"Akumuliatoriaus energija gali išsekti prieš įprastą įkrovimą"</string>
     <string name="dynamic_mode_notification_summary" msgid="2541166298550402690">"Akumuliatoriaus tausojimo priemonė suaktyvinta, kad akumuliatorius veiktų ilgiau"</string>
+    <string name="mime_type_folder" msgid="7111951698626315204">"Aplankas"</string>
+    <string name="mime_type_apk" msgid="5518003630972506900">"„Android“ programa"</string>
+    <string name="mime_type_generic" msgid="6833871596845900027">"Failas"</string>
+    <string name="mime_type_generic_ext" msgid="8450275970061657174">"<xliff:g id="EXTENSION">%1$s</xliff:g> failas"</string>
+    <string name="mime_type_audio" msgid="6289777657172050926">"Garso įrašas"</string>
+    <string name="mime_type_audio_ext" msgid="3270880987725816210">"<xliff:g id="EXTENSION">%1$s</xliff:g> garso įrašas"</string>
+    <string name="mime_type_video" msgid="4093025777317307426">"Vaizdo įrašas"</string>
+    <string name="mime_type_video_ext" msgid="5643771615714173159">"<xliff:g id="EXTENSION">%1$s</xliff:g> vaizdo įrašas"</string>
+    <string name="mime_type_image" msgid="3144284451605236371">"Vaizdas"</string>
+    <string name="mime_type_image_ext" msgid="1514613218742736590">"<xliff:g id="EXTENSION">%1$s</xliff:g> vaizdas"</string>
+    <string name="mime_type_compressed" msgid="1645486037074943257">"Archyvas"</string>
+    <string name="mime_type_compressed_ext" msgid="4232293058067801528">"<xliff:g id="EXTENSION">%1$s</xliff:g> archyvas"</string>
+    <string name="mime_type_document" msgid="1596838147256375966">"Dokumentas"</string>
+    <string name="mime_type_document_ext" msgid="6327266601345501281">"<xliff:g id="EXTENSION">%1$s</xliff:g> dokumentas"</string>
+    <string name="mime_type_spreadsheet" msgid="2639138255207123557">"Skaičiuoklė"</string>
+    <string name="mime_type_spreadsheet_ext" msgid="5508653032786106725">"<xliff:g id="EXTENSION">%1$s</xliff:g> skaičiuoklė"</string>
+    <string name="mime_type_presentation" msgid="6145604688774787357">"Pristatymas"</string>
+    <string name="mime_type_presentation_ext" msgid="2982650207774823437">"<xliff:g id="EXTENSION">%1$s</xliff:g> pristatymas"</string>
     <string name="car_loading_profile" msgid="3545132581795684027">"Įkeliama"</string>
     <plurals name="file_count" formatted="false" msgid="1628600959752419449">
       <item quantity="one">„<xliff:g id="FILE_NAME_2">%s</xliff:g>“ ir <xliff:g id="COUNT_3">%d</xliff:g> failas</item>
@@ -2073,4 +2092,6 @@
       <item quantity="many">„<xliff:g id="FILE_NAME_2">%s</xliff:g>“ ir <xliff:g id="COUNT_3">%d</xliff:g> failo</item>
       <item quantity="other">„<xliff:g id="FILE_NAME_2">%s</xliff:g>“ ir <xliff:g id="COUNT_3">%d</xliff:g> failų</item>
     </plurals>
+    <!-- no translation found for chooser_no_direct_share_targets (997970693708458895) -->
+    <skip />
 </resources>
diff --git a/core/res/res/values-lv/strings.xml b/core/res/res/values-lv/strings.xml
index 669a448..53ab075 100644
--- a/core/res/res/values-lv/strings.xml
+++ b/core/res/res/values-lv/strings.xml
@@ -311,15 +311,15 @@
     <string name="permgrouplab_phone" msgid="5229115638567440675">"Tālrunis"</string>
     <string name="permgroupdesc_phone" msgid="6234224354060641055">"veikt un pārvaldīt tālruņa zvanus"</string>
     <string name="permgrouprequest_phone" msgid="9166979577750581037">"Vai atļaut lietotnei &lt;b&gt;<xliff:g id="APP_NAME">%1$s</xliff:g>&lt;/b&gt; veikt un pārvaldīt tālruņa zvanus?"</string>
-    <string name="permgrouplab_sensors" msgid="416037179223226722">"Ķermeņa sensori"</string>
+    <string name="permgrouplab_sensors" msgid="4838614103153567532">"Ķermeņa sensori"</string>
     <string name="permgroupdesc_sensors" msgid="7147968539346634043">"piekļūt sensoru datiem par jūsu veselības rādījumiem"</string>
     <string name="permgrouprequest_sensors" msgid="6349806962814556786">"Vai atļaut lietotnei &lt;b&gt;<xliff:g id="APP_NAME">%1$s</xliff:g>&lt;/b&gt; piekļūt sensoru uztvertajiem veselības rādījumiem?"</string>
     <string name="permgrouplab_aural" msgid="965607064083134896">"Mūzika"</string>
     <string name="permgroupdesc_aural" msgid="4870189506255958055">"Piekļūt jūsu mūzikai"</string>
     <string name="permgrouprequest_aural" msgid="6787926123071735620">"Vai atļaut lietotnei &lt;b&gt;<xliff:g id="APP_NAME">%1$s</xliff:g>&lt;/b&gt; piekļūt jūsu mūzikai?"</string>
-    <string name="permgrouplab_visual" msgid="8030190588123857921">"Fotoattēli un videoklipi"</string>
+    <string name="permgrouplab_visual" msgid="6477382108771145134">"Fotoattēli un videoklipi"</string>
     <string name="permgroupdesc_visual" msgid="3415827902566663546">"Piekļūt jūsu fotoattēliem un videoklipiem"</string>
-    <string name="permgrouprequest_visual" msgid="6907523945030290376">"Vai atļaut lietotnei &lt;b&gt;<xliff:g id="APP_NAME">%1$s</xliff:g>&lt;/b&gt; piekļūt jūsu fotoattēliem videoklipiem?"</string>
+    <string name="permgrouprequest_visual" msgid="3043752127595243314">"Vai atļaut lietotnei &lt;b&gt;<xliff:g id="APP_NAME">%1$s</xliff:g>&lt;/b&gt; piekļūt jūsu fotoattēliem, videoklipiem, tostarp atzīmētajām atrašanās vietām?"</string>
     <string name="capability_title_canRetrieveWindowContent" msgid="3901717936930170320">"Izgūt loga saturu."</string>
     <string name="capability_desc_canRetrieveWindowContent" msgid="3772225008605310672">"Skatīt tā loga saturu, ar kuru mijiedarbojaties."</string>
     <string name="capability_title_canRequestTouchExploration" msgid="3108723364676667320">"Aktivizēt funkciju “Pārlūkot pieskaroties”."</string>
@@ -1418,8 +1418,7 @@
     <string name="ext_media_init_action" msgid="7952885510091978278">"Iestatīt"</string>
     <string name="ext_media_unmount_action" msgid="1121883233103278199">"Izstumt"</string>
     <string name="ext_media_browse_action" msgid="8322172381028546087">"Izpētīt"</string>
-    <!-- no translation found for ext_media_seamless_action (6575980560886881233) -->
-    <skip />
+    <string name="ext_media_seamless_action" msgid="6575980560886881233">"Slēdža izeja"</string>
     <string name="ext_media_missing_title" msgid="620980315821543904">"Nav ierīces <xliff:g id="NAME">%s</xliff:g>"</string>
     <string name="ext_media_missing_message" msgid="4012389235250987930">"Vēlreiz pievienojiet ierīci."</string>
     <string name="ext_media_move_specific_title" msgid="1471100343872375842">"Notiek lietotnes <xliff:g id="NAME">%s</xliff:g> pārvietošana"</string>
@@ -1634,6 +1633,8 @@
     <string name="display_manager_overlay_display_name" msgid="5142365982271620716">"Pārklājums Nr. <xliff:g id="ID">%1$d</xliff:g>"</string>
     <string name="display_manager_overlay_display_title" msgid="652124517672257172">"<xliff:g id="NAME">%1$s</xliff:g>: <xliff:g id="WIDTH">%2$d</xliff:g> x <xliff:g id="HEIGHT">%3$d</xliff:g>, <xliff:g id="DPI">%4$d</xliff:g> dpi"</string>
     <string name="display_manager_overlay_display_secure_suffix" msgid="6022119702628572080">", drošs"</string>
+    <string name="activity_starter_block_bg_activity_starts_permissive" msgid="5692097903712956720">"Šīs fona darbības sākšana no pakotnes <xliff:g id="PACKAGENAME">%1$s</xliff:g> tiks bloķēta turpmākajās Q versijās. Skatiet: go/q-bg-block."</string>
+    <string name="activity_starter_block_bg_activity_starts_enforcing" msgid="8299522481076404353">"Fona darbības sākšana no pakotnes <xliff:g id="PACKAGENAME">%1$s</xliff:g> bloķēta. Skatiet: go/q-bg-block."</string>
     <string name="kg_forgot_pattern_button_text" msgid="8852021467868220608">"Aizmirsu kombināciju"</string>
     <string name="kg_wrong_pattern" msgid="1850806070801358830">"Nepareiza kombinācija"</string>
     <string name="kg_wrong_password" msgid="2333281762128113157">"Nepareiza parole"</string>
@@ -2031,10 +2032,30 @@
     <string name="dynamic_mode_notification_channel_name" msgid="2348803891571320452">"Informatīvs paziņojums par akumulatoru"</string>
     <string name="dynamic_mode_notification_title" msgid="508815255807182035">"Akumulators var izlādēties pirms parastā uzlādes laika"</string>
     <string name="dynamic_mode_notification_summary" msgid="2541166298550402690">"Aktivizēts akumulatora jaudas taupīšanas režīms, lai palielinātu akumulatora darbības ilgumu"</string>
+    <string name="mime_type_folder" msgid="7111951698626315204">"Mape"</string>
+    <string name="mime_type_apk" msgid="5518003630972506900">"Android lietojumprogramma"</string>
+    <string name="mime_type_generic" msgid="6833871596845900027">"Fails"</string>
+    <string name="mime_type_generic_ext" msgid="8450275970061657174">"<xliff:g id="EXTENSION">%1$s</xliff:g> fails"</string>
+    <string name="mime_type_audio" msgid="6289777657172050926">"Audio"</string>
+    <string name="mime_type_audio_ext" msgid="3270880987725816210">"<xliff:g id="EXTENSION">%1$s</xliff:g> audio"</string>
+    <string name="mime_type_video" msgid="4093025777317307426">"Video"</string>
+    <string name="mime_type_video_ext" msgid="5643771615714173159">"<xliff:g id="EXTENSION">%1$s</xliff:g> video"</string>
+    <string name="mime_type_image" msgid="3144284451605236371">"Attēls"</string>
+    <string name="mime_type_image_ext" msgid="1514613218742736590">"<xliff:g id="EXTENSION">%1$s</xliff:g> attēls"</string>
+    <string name="mime_type_compressed" msgid="1645486037074943257">"Arhīvs"</string>
+    <string name="mime_type_compressed_ext" msgid="4232293058067801528">"<xliff:g id="EXTENSION">%1$s</xliff:g> arhīvs"</string>
+    <string name="mime_type_document" msgid="1596838147256375966">"Dokuments"</string>
+    <string name="mime_type_document_ext" msgid="6327266601345501281">"<xliff:g id="EXTENSION">%1$s</xliff:g> dokuments"</string>
+    <string name="mime_type_spreadsheet" msgid="2639138255207123557">"Izklājlapa"</string>
+    <string name="mime_type_spreadsheet_ext" msgid="5508653032786106725">"<xliff:g id="EXTENSION">%1$s</xliff:g> izklājlapa"</string>
+    <string name="mime_type_presentation" msgid="6145604688774787357">"Prezentācija"</string>
+    <string name="mime_type_presentation_ext" msgid="2982650207774823437">"<xliff:g id="EXTENSION">%1$s</xliff:g> prezentācija"</string>
     <string name="car_loading_profile" msgid="3545132581795684027">"Ielāde"</string>
     <plurals name="file_count" formatted="false" msgid="1628600959752419449">
       <item quantity="zero"><xliff:g id="FILE_NAME_2">%s</xliff:g> un <xliff:g id="COUNT_3">%d</xliff:g> failu</item>
       <item quantity="one"><xliff:g id="FILE_NAME_2">%s</xliff:g> un <xliff:g id="COUNT_3">%d</xliff:g> fails</item>
       <item quantity="other"><xliff:g id="FILE_NAME_2">%s</xliff:g> un <xliff:g id="COUNT_3">%d</xliff:g> faili</item>
     </plurals>
+    <!-- no translation found for chooser_no_direct_share_targets (997970693708458895) -->
+    <skip />
 </resources>
diff --git a/core/res/res/values-mcc311-mnc480/config.xml b/core/res/res/values-mcc311-mnc480/config.xml
index cc7daa8..db2f8d0 100755
--- a/core/res/res/values-mcc311-mnc480/config.xml
+++ b/core/res/res/values-mcc311-mnc480/config.xml
@@ -19,21 +19,6 @@
 
 <resources xmlns:xliff="urn:oasis:names:tc:xliff:document:1.2">
 
-    <!-- CDMA home system id for Verizon -->
-    <string-array translatable="false" name="config_cdma_home_system">
-        <item>64</item>
-        <item>65</item>
-        <item>66</item>
-        <item>76</item>
-        <item>77</item>
-        <item>78</item>
-        <item>79</item>
-        <item>80</item>
-        <item>81</item>
-        <item>82</item>
-        <item>83</item>
-    </string-array>
-
     <!-- Flag indicating whether the IMS service can be turned off. If false then
         the service will not be turned-off completely (the ImsManager.turnOffIms() will
         be disabled) but individual Features can be disabled using ImsConfig.setFeatureValue() -->
diff --git a/core/res/res/values-mk/strings.xml b/core/res/res/values-mk/strings.xml
index 2487153..4e0b47a 100644
--- a/core/res/res/values-mk/strings.xml
+++ b/core/res/res/values-mk/strings.xml
@@ -308,15 +308,15 @@
     <string name="permgrouplab_phone" msgid="5229115638567440675">"Телефон"</string>
     <string name="permgroupdesc_phone" msgid="6234224354060641055">"упатува и управува со телефонски повици"</string>
     <string name="permgrouprequest_phone" msgid="9166979577750581037">"Дали да се дозволи &lt;b&gt;<xliff:g id="APP_NAME">%1$s</xliff:g>&lt;/b&gt; да повикува и да управува со телефонските повици?"</string>
-    <string name="permgrouplab_sensors" msgid="416037179223226722">"Телесни сензори"</string>
+    <string name="permgrouplab_sensors" msgid="4838614103153567532">"Телесни сензори"</string>
     <string name="permgroupdesc_sensors" msgid="7147968539346634043">"пристапува до податоците од сензорите за виталните знаци"</string>
     <string name="permgrouprequest_sensors" msgid="6349806962814556786">"Дали да се дозволи &lt;b&gt;<xliff:g id="APP_NAME">%1$s</xliff:g>&lt;/b&gt; да пристапува до податоците на сензорот за витални знаци?"</string>
     <string name="permgrouplab_aural" msgid="965607064083134896">"Музика"</string>
     <string name="permgroupdesc_aural" msgid="4870189506255958055">"пристапува до музиката"</string>
     <string name="permgrouprequest_aural" msgid="6787926123071735620">"Дали да се дозволи &lt;b&gt;<xliff:g id="APP_NAME">%1$s</xliff:g>&lt;/b&gt; да пристапува до музиката?"</string>
-    <string name="permgrouplab_visual" msgid="8030190588123857921">"Фотографии и видеа"</string>
+    <string name="permgrouplab_visual" msgid="6477382108771145134">"Фотографии и видеа"</string>
     <string name="permgroupdesc_visual" msgid="3415827902566663546">"пристапува до фотографиите и видеата"</string>
-    <string name="permgrouprequest_visual" msgid="6907523945030290376">"Дали да се дозволи &lt;b&gt;<xliff:g id="APP_NAME">%1$s</xliff:g>&lt;/b&gt; да пристапува до фотографиите и видеата?"</string>
+    <string name="permgrouprequest_visual" msgid="3043752127595243314">"Дали да се дозволи &lt;b&gt;<xliff:g id="APP_NAME">%1$s</xliff:g>&lt;/b&gt; да пристапува до фотографиите и видеата, вклучувајќи означени локации?"</string>
     <string name="capability_title_canRetrieveWindowContent" msgid="3901717936930170320">"Преземе содржина на прозорец"</string>
     <string name="capability_desc_canRetrieveWindowContent" msgid="3772225008605310672">"Ја следи содржината на прозорецот со кој се комуницира."</string>
     <string name="capability_title_canRequestTouchExploration" msgid="3108723364676667320">"Вклучи „Истражувај со допир“"</string>
@@ -1397,8 +1397,7 @@
     <string name="ext_media_init_action" msgid="7952885510091978278">"Постави"</string>
     <string name="ext_media_unmount_action" msgid="1121883233103278199">"Извади"</string>
     <string name="ext_media_browse_action" msgid="8322172381028546087">"Истражувај"</string>
-    <!-- no translation found for ext_media_seamless_action (6575980560886881233) -->
-    <skip />
+    <string name="ext_media_seamless_action" msgid="6575980560886881233">"Сменете го излезот"</string>
     <string name="ext_media_missing_title" msgid="620980315821543904">"<xliff:g id="NAME">%s</xliff:g> недостасува"</string>
     <string name="ext_media_missing_message" msgid="4012389235250987930">"Вметнете го уредот повторно"</string>
     <string name="ext_media_move_specific_title" msgid="1471100343872375842">"Се преместува <xliff:g id="NAME">%s</xliff:g>"</string>
@@ -1614,6 +1613,8 @@
     <string name="display_manager_overlay_display_name" msgid="5142365982271620716">"Прекривка #<xliff:g id="ID">%1$d</xliff:g>"</string>
     <string name="display_manager_overlay_display_title" msgid="652124517672257172">"<xliff:g id="NAME">%1$s</xliff:g> : <xliff:g id="WIDTH">%2$d</xliff:g>х<xliff:g id="HEIGHT">%3$d</xliff:g>, <xliff:g id="DPI">%4$d</xliff:g> dpi"</string>
     <string name="display_manager_overlay_display_secure_suffix" msgid="6022119702628572080">", безбедно"</string>
+    <string name="activity_starter_block_bg_activity_starts_permissive" msgid="5692097903712956720">"Ова стартување активност во заднина од <xliff:g id="PACKAGENAME">%1$s</xliff:g> ќе се блокира во идните верзии на Q. Погледнете на go/q-bg-block."</string>
+    <string name="activity_starter_block_bg_activity_starts_enforcing" msgid="8299522481076404353">"Блокирано е стартување активност во заднина од <xliff:g id="PACKAGENAME">%1$s</xliff:g>. Погледнете на go/q-bg-block."</string>
     <string name="kg_forgot_pattern_button_text" msgid="8852021467868220608">"Заборавив шема"</string>
     <string name="kg_wrong_pattern" msgid="1850806070801358830">"Погрешна шема"</string>
     <string name="kg_wrong_password" msgid="2333281762128113157">"Погрешна лозинка"</string>
@@ -1999,9 +2000,29 @@
     <string name="dynamic_mode_notification_channel_name" msgid="2348803891571320452">"Известување за информации за режимот за рутини"</string>
     <string name="dynamic_mode_notification_title" msgid="508815255807182035">"Батеријата може да се потроши пред вообичаеното време за полнење"</string>
     <string name="dynamic_mode_notification_summary" msgid="2541166298550402690">"Активиран е „Штедачот на батерија“ за да се продолжи траењето на батеријата"</string>
+    <string name="mime_type_folder" msgid="7111951698626315204">"Папка"</string>
+    <string name="mime_type_apk" msgid="5518003630972506900">"Апликација за Android"</string>
+    <string name="mime_type_generic" msgid="6833871596845900027">"Датотека"</string>
+    <string name="mime_type_generic_ext" msgid="8450275970061657174">"<xliff:g id="EXTENSION">%1$s</xliff:g>-датотека"</string>
+    <string name="mime_type_audio" msgid="6289777657172050926">"Аудио"</string>
+    <string name="mime_type_audio_ext" msgid="3270880987725816210">"<xliff:g id="EXTENSION">%1$s</xliff:g>-аудио"</string>
+    <string name="mime_type_video" msgid="4093025777317307426">"Видео"</string>
+    <string name="mime_type_video_ext" msgid="5643771615714173159">"<xliff:g id="EXTENSION">%1$s</xliff:g>-видео"</string>
+    <string name="mime_type_image" msgid="3144284451605236371">"Слика"</string>
+    <string name="mime_type_image_ext" msgid="1514613218742736590">"<xliff:g id="EXTENSION">%1$s</xliff:g>-слика"</string>
+    <string name="mime_type_compressed" msgid="1645486037074943257">"Архива"</string>
+    <string name="mime_type_compressed_ext" msgid="4232293058067801528">"<xliff:g id="EXTENSION">%1$s</xliff:g>-архива"</string>
+    <string name="mime_type_document" msgid="1596838147256375966">"Документ"</string>
+    <string name="mime_type_document_ext" msgid="6327266601345501281">"<xliff:g id="EXTENSION">%1$s</xliff:g>-документ"</string>
+    <string name="mime_type_spreadsheet" msgid="2639138255207123557">"Табела"</string>
+    <string name="mime_type_spreadsheet_ext" msgid="5508653032786106725">"<xliff:g id="EXTENSION">%1$s</xliff:g>-табела"</string>
+    <string name="mime_type_presentation" msgid="6145604688774787357">"Презентација"</string>
+    <string name="mime_type_presentation_ext" msgid="2982650207774823437">"<xliff:g id="EXTENSION">%1$s</xliff:g>-презентација"</string>
     <string name="car_loading_profile" msgid="3545132581795684027">"Се вчитува"</string>
     <plurals name="file_count" formatted="false" msgid="1628600959752419449">
       <item quantity="one"><xliff:g id="FILE_NAME_2">%s</xliff:g> + <xliff:g id="COUNT_3">%d</xliff:g> датотека</item>
       <item quantity="other"><xliff:g id="FILE_NAME_2">%s</xliff:g> + <xliff:g id="COUNT_3">%d</xliff:g> датотеки</item>
     </plurals>
+    <!-- no translation found for chooser_no_direct_share_targets (997970693708458895) -->
+    <skip />
 </resources>
diff --git a/core/res/res/values-ml/strings.xml b/core/res/res/values-ml/strings.xml
index 3f4c441..13ca198 100644
--- a/core/res/res/values-ml/strings.xml
+++ b/core/res/res/values-ml/strings.xml
@@ -308,15 +308,15 @@
     <string name="permgrouplab_phone" msgid="5229115638567440675">"ഫോണ്‍"</string>
     <string name="permgroupdesc_phone" msgid="6234224354060641055">"ഫോൺ വിളിക്കുകയും നിയന്ത്രിക്കുകയും ചെയ്യുക"</string>
     <string name="permgrouprequest_phone" msgid="9166979577750581037">"ഫോൺ കോളുകൾ ചെയ്യാനും അവ നിയന്ത്രിക്കാനും &lt;b&gt;<xliff:g id="APP_NAME">%1$s</xliff:g>&lt;/b&gt; ആപ്പിനെ അനുവദിക്കണോ?"</string>
-    <string name="permgrouplab_sensors" msgid="416037179223226722">"ബോഡി സെൻസറുകൾ"</string>
+    <string name="permgrouplab_sensors" msgid="4838614103153567532">"ബോഡി സെൻസറുകൾ"</string>
     <string name="permgroupdesc_sensors" msgid="7147968539346634043">"നിങ്ങളുടെ ജീവാധാര ലക്ഷണങ്ങളെ കുറിച്ചുള്ള സെൻസർ വിവരങ്ങൾ ആക്സസ് ചെയ്യുക"</string>
     <string name="permgrouprequest_sensors" msgid="6349806962814556786">"നിങ്ങളുടെ ജീവധാരണ ലക്ഷണങ്ങളെ കുറിച്ചുള്ള സെൻസർ ഡാറ്റ ആക്‌സസ് ചെയ്യാൻ &lt;b&gt;<xliff:g id="APP_NAME">%1$s</xliff:g>&lt;/b&gt; ആപ്പിനെ അനുവദിക്കണോ?"</string>
     <string name="permgrouplab_aural" msgid="965607064083134896">"സംഗീതം"</string>
     <string name="permgroupdesc_aural" msgid="4870189506255958055">"നിങ്ങളുടെ സംഗീതം ആക്‌സസ് ചെയ്യുക"</string>
     <string name="permgrouprequest_aural" msgid="6787926123071735620">"&lt;b&gt;<xliff:g id="APP_NAME">%1$s</xliff:g>&lt;/b&gt; എന്നതിനെ നിങ്ങളുടെ സംഗീതം ആക്‌സസ് ചെയ്യാൻ അനുവദിക്കണോ?"</string>
-    <string name="permgrouplab_visual" msgid="8030190588123857921">"ഫോട്ടോകളും &amp; വീഡിയോകളും"</string>
+    <string name="permgrouplab_visual" msgid="6477382108771145134">"ഫോട്ടോകളും വീഡിയോകളും"</string>
     <string name="permgroupdesc_visual" msgid="3415827902566663546">"നിങ്ങളുടെ ഫോട്ടോകളും &amp; വീഡിയോകളും"</string>
-    <string name="permgrouprequest_visual" msgid="6907523945030290376">"&lt;b&gt;<xliff:g id="APP_NAME">%1$s</xliff:g>&lt;/b&gt; എന്നതിനെ നിങ്ങളുടെ ഫോട്ടോകൾ &amp; വീഡിയോകൾ എന്നിവ ആക്‌സസ് ചെയ്യാൻ അനുവദിക്കണോ?"</string>
+    <string name="permgrouprequest_visual" msgid="3043752127595243314">"ടാഗ് ചെയ്‌ത ലൊക്കേഷനുകൾ ഉൾപ്പെടെ നിങ്ങളുടെ ഫോട്ടോകളും വീഡിയോകളും ആക്‌സസ് ചെയ്യാൻ &lt;b&gt;<xliff:g id="APP_NAME">%1$s</xliff:g>&lt;/b&gt;-നെ അനുവദിക്കണോ?"</string>
     <string name="capability_title_canRetrieveWindowContent" msgid="3901717936930170320">"വിൻഡോ ഉള്ളടക്കം വീണ്ടെടുക്കുക"</string>
     <string name="capability_desc_canRetrieveWindowContent" msgid="3772225008605310672">"നിങ്ങൾ സംവദിക്കുന്ന ഒരു വിൻഡോയുടെ ഉള്ളടക്കം പരിശോധിക്കുക."</string>
     <string name="capability_title_canRequestTouchExploration" msgid="3108723364676667320">"സ്‌പർശനം വഴി പര്യവേക്ഷണം ചെയ്യുക, ഓണാക്കുക"</string>
@@ -1397,8 +1397,7 @@
     <string name="ext_media_init_action" msgid="7952885510091978278">"സജ്ജമാക്കുക"</string>
     <string name="ext_media_unmount_action" msgid="1121883233103278199">"നിരസിക്കുക"</string>
     <string name="ext_media_browse_action" msgid="8322172381028546087">"അടുത്തറിയുക"</string>
-    <!-- no translation found for ext_media_seamless_action (6575980560886881233) -->
-    <skip />
+    <string name="ext_media_seamless_action" msgid="6575980560886881233">"ഔട്ട്പുട്ട് മാറുക"</string>
     <string name="ext_media_missing_title" msgid="620980315821543904">"<xliff:g id="NAME">%s</xliff:g> കാണുന്നില്ല"</string>
     <string name="ext_media_missing_message" msgid="4012389235250987930">"ഉപകരണത്തിലേക്ക് വീണ്ടും ഇടുക"</string>
     <string name="ext_media_move_specific_title" msgid="1471100343872375842">"<xliff:g id="NAME">%s</xliff:g> നീക്കുന്നു"</string>
@@ -1612,6 +1611,8 @@
     <string name="display_manager_overlay_display_name" msgid="5142365982271620716">"ഓവർലേ #<xliff:g id="ID">%1$d</xliff:g>"</string>
     <string name="display_manager_overlay_display_title" msgid="652124517672257172">"<xliff:g id="NAME">%1$s</xliff:g>: <xliff:g id="WIDTH">%2$d</xliff:g>x<xliff:g id="HEIGHT">%3$d</xliff:g>, <xliff:g id="DPI">%4$d</xliff:g> dpi"</string>
     <string name="display_manager_overlay_display_secure_suffix" msgid="6022119702628572080">", സുരക്ഷിതമാക്കുക"</string>
+    <string name="activity_starter_block_bg_activity_starts_permissive" msgid="5692097903712956720">"<xliff:g id="PACKAGENAME">%1$s</xliff:g>-ൽ നിന്ന് ഈ പശ്ചാത്തല പ്രവർത്തനം ആരംഭിക്കുന്നത് ഭാവി Q നിർമ്മാണങ്ങളിൽ ബ്ലോക്ക് ചെയ്യപെടും. go/q-bg-block കാണുക."</string>
+    <string name="activity_starter_block_bg_activity_starts_enforcing" msgid="8299522481076404353">"<xliff:g id="PACKAGENAME">%1$s</xliff:g>-ൽ നിന്ന് പശ്ചാത്തല പ്രവർത്തനം ആരംഭിക്കുന്നത് ബ്ലോക്ക് ചെയ്‌തു. go/q-bg-block കാണുക."</string>
     <string name="kg_forgot_pattern_button_text" msgid="8852021467868220608">"പാറ്റേൺ മറന്നു"</string>
     <string name="kg_wrong_pattern" msgid="1850806070801358830">"പാറ്റേൺ തെറ്റാണ്"</string>
     <string name="kg_wrong_password" msgid="2333281762128113157">"പാസ്‌വേഡ് തെറ്റാണ്"</string>
@@ -1997,9 +1998,29 @@
     <string name="dynamic_mode_notification_channel_name" msgid="2348803891571320452">"ദിനചര്യ മോഡ് വിവരത്തെ കുറിച്ചുള്ള അറിയിപ്പ്"</string>
     <string name="dynamic_mode_notification_title" msgid="508815255807182035">"സാധാരണയുള്ളതിലും നേരത്തെ ബാറ്ററിയുടെ ചാർജ് തീർന്നേക്കാം"</string>
     <string name="dynamic_mode_notification_summary" msgid="2541166298550402690">"ബാറ്ററി ലൈഫ് വര്‍ദ്ധിപ്പിക്കാൻ, ബാറ്ററി ലാഭിക്കൽ സജീവമാക്കി"</string>
+    <string name="mime_type_folder" msgid="7111951698626315204">"ഫോള്‍ഡര്‍"</string>
+    <string name="mime_type_apk" msgid="5518003630972506900">"Android ആപ്പ്"</string>
+    <string name="mime_type_generic" msgid="6833871596845900027">"ഫയൽ"</string>
+    <string name="mime_type_generic_ext" msgid="8450275970061657174">"<xliff:g id="EXTENSION">%1$s</xliff:g> ഫയൽ"</string>
+    <string name="mime_type_audio" msgid="6289777657172050926">"ഓഡിയോ"</string>
+    <string name="mime_type_audio_ext" msgid="3270880987725816210">"<xliff:g id="EXTENSION">%1$s</xliff:g> ഓഡിയോ"</string>
+    <string name="mime_type_video" msgid="4093025777317307426">"വീഡിയോ"</string>
+    <string name="mime_type_video_ext" msgid="5643771615714173159">"<xliff:g id="EXTENSION">%1$s</xliff:g> വീഡിയോ"</string>
+    <string name="mime_type_image" msgid="3144284451605236371">"ഇമേജ്"</string>
+    <string name="mime_type_image_ext" msgid="1514613218742736590">"<xliff:g id="EXTENSION">%1$s</xliff:g> ചിത്രം"</string>
+    <string name="mime_type_compressed" msgid="1645486037074943257">"ആർക്കൈവ്"</string>
+    <string name="mime_type_compressed_ext" msgid="4232293058067801528">"<xliff:g id="EXTENSION">%1$s</xliff:g> ആർക്കൈവ്"</string>
+    <string name="mime_type_document" msgid="1596838147256375966">"പ്രമാണം"</string>
+    <string name="mime_type_document_ext" msgid="6327266601345501281">"<xliff:g id="EXTENSION">%1$s</xliff:g> പ്രമാണം"</string>
+    <string name="mime_type_spreadsheet" msgid="2639138255207123557">"സ്പ്രെഡ്ഷീറ്റ്"</string>
+    <string name="mime_type_spreadsheet_ext" msgid="5508653032786106725">"<xliff:g id="EXTENSION">%1$s</xliff:g> സ്പ്രെഡ്ഷീറ്റ്"</string>
+    <string name="mime_type_presentation" msgid="6145604688774787357">"അവതരണം"</string>
+    <string name="mime_type_presentation_ext" msgid="2982650207774823437">"<xliff:g id="EXTENSION">%1$s</xliff:g> അവതരണം"</string>
     <string name="car_loading_profile" msgid="3545132581795684027">"ലോഡ് ചെയ്യുന്നു"</string>
     <plurals name="file_count" formatted="false" msgid="1628600959752419449">
       <item quantity="other"><xliff:g id="FILE_NAME_2">%s</xliff:g> + <xliff:g id="COUNT_3">%d</xliff:g> ഫയലുകൾ</item>
       <item quantity="one"><xliff:g id="FILE_NAME_0">%s</xliff:g> + <xliff:g id="COUNT_1">%d</xliff:g> ഫയൽ</item>
     </plurals>
+    <!-- no translation found for chooser_no_direct_share_targets (997970693708458895) -->
+    <skip />
 </resources>
diff --git a/core/res/res/values-mn/strings.xml b/core/res/res/values-mn/strings.xml
index bf668e7..101ef35 100644
--- a/core/res/res/values-mn/strings.xml
+++ b/core/res/res/values-mn/strings.xml
@@ -308,15 +308,15 @@
     <string name="permgrouplab_phone" msgid="5229115638567440675">"Утас"</string>
     <string name="permgroupdesc_phone" msgid="6234224354060641055">"утасны дуудлага хийх, дуудлага удирдах"</string>
     <string name="permgrouprequest_phone" msgid="9166979577750581037">"&lt;b&gt;<xliff:g id="APP_NAME">%1$s</xliff:g>&lt;/b&gt;-д утасны дуудлага хийх, дуудлагад хариулахыг зөвшөөрөх үү?"</string>
-    <string name="permgrouplab_sensors" msgid="416037179223226722">"Биеийн мэдрэгч"</string>
+    <string name="permgrouplab_sensors" msgid="4838614103153567532">"Биеийн мэдрэгч"</string>
     <string name="permgroupdesc_sensors" msgid="7147968539346634043">"таны биеийн байдлын талаарх мэдрэгч бүхий өгөгдөлд нэвтрэх"</string>
     <string name="permgrouprequest_sensors" msgid="6349806962814556786">"&lt;b&gt;<xliff:g id="APP_NAME">%1$s</xliff:g>&lt;/b&gt;-д таны биеийн ерөнхий байдлын үзүүлэлтүүдийн мэдрэгчийн өгөгдөлд хандахыг зөвшөөрөх үү?"</string>
     <string name="permgrouplab_aural" msgid="965607064083134896">"Хөгжим"</string>
     <string name="permgroupdesc_aural" msgid="4870189506255958055">"хөгжимдөө хандах"</string>
     <string name="permgrouprequest_aural" msgid="6787926123071735620">"&lt;b&gt;<xliff:g id="APP_NAME">%1$s</xliff:g>&lt;/b&gt;-д таны хөгжимд хандахыг зөвшөөрөх үү?"</string>
-    <string name="permgrouplab_visual" msgid="8030190588123857921">"Зураг &amp; видео"</string>
+    <string name="permgrouplab_visual" msgid="6477382108771145134">"Зураг &amp; видео"</string>
     <string name="permgroupdesc_visual" msgid="3415827902566663546">"зураг &amp; видеондоо хандах"</string>
-    <string name="permgrouprequest_visual" msgid="6907523945030290376">"&lt;b&gt;<xliff:g id="APP_NAME">%1$s</xliff:g>&lt;/b&gt;-д таны зураг &amp; видеонд хандахыг зөвшөөрөх үү?"</string>
+    <string name="permgrouprequest_visual" msgid="3043752127595243314">"&lt;b&gt;<xliff:g id="APP_NAME">%1$s</xliff:g>&lt;/b&gt;-д таны зураг, видео болон шошголсон байршилд хандахыг зөвшөөрөх үү?"</string>
     <string name="capability_title_canRetrieveWindowContent" msgid="3901717936930170320">"Цонхны агуулгыг авах"</string>
     <string name="capability_desc_canRetrieveWindowContent" msgid="3772225008605310672">"Таны харилцан үйлчлэх цонхны контентоос шалгах."</string>
     <string name="capability_title_canRequestTouchExploration" msgid="3108723364676667320">"Хүрч танихыг асаах"</string>
@@ -1396,8 +1396,7 @@
     <string name="ext_media_init_action" msgid="7952885510091978278">"Тохируулах"</string>
     <string name="ext_media_unmount_action" msgid="1121883233103278199">"Салгах"</string>
     <string name="ext_media_browse_action" msgid="8322172381028546087">"Судлах"</string>
-    <!-- no translation found for ext_media_seamless_action (6575980560886881233) -->
-    <skip />
+    <string name="ext_media_seamless_action" msgid="6575980560886881233">"Гаралтыг сэлгэх"</string>
     <string name="ext_media_missing_title" msgid="620980315821543904">"<xliff:g id="NAME">%s</xliff:g> байхгүй байна"</string>
     <string name="ext_media_missing_message" msgid="4012389235250987930">"Tөхөөрөмжийг дахин оруулна уу"</string>
     <string name="ext_media_move_specific_title" msgid="1471100343872375842">"<xliff:g id="NAME">%s</xliff:g>-ыг зөөж байна"</string>
@@ -1611,6 +1610,8 @@
     <string name="display_manager_overlay_display_name" msgid="5142365982271620716">"Давхарга #<xliff:g id="ID">%1$d</xliff:g>"</string>
     <string name="display_manager_overlay_display_title" msgid="652124517672257172">"<xliff:g id="NAME">%1$s</xliff:g>: <xliff:g id="WIDTH">%2$d</xliff:g>x<xliff:g id="HEIGHT">%3$d</xliff:g>, <xliff:g id="DPI">%4$d</xliff:g> dpi"</string>
     <string name="display_manager_overlay_display_secure_suffix" msgid="6022119702628572080">", найдвартай"</string>
+    <string name="activity_starter_block_bg_activity_starts_permissive" msgid="5692097903712956720">"<xliff:g id="PACKAGENAME">%1$s</xliff:g>-с эхлэх арын үйл ажиллагааг цаашдын Q боловсруулагдсан программд хориглоно Go/q-bg-block-г харна уу."</string>
+    <string name="activity_starter_block_bg_activity_starts_enforcing" msgid="8299522481076404353">"<xliff:g id="PACKAGENAME">%1$s</xliff:g>-с эхлэх арын үйл ажиллагааг хориглосон. Go/q-bg-block-г харна уу."</string>
     <string name="kg_forgot_pattern_button_text" msgid="8852021467868220608">"Хээг мартсан"</string>
     <string name="kg_wrong_pattern" msgid="1850806070801358830">"Буруу хээ"</string>
     <string name="kg_wrong_password" msgid="2333281762128113157">"Нууц үг буруу"</string>
@@ -1996,9 +1997,29 @@
     <string name="dynamic_mode_notification_channel_name" msgid="2348803891571320452">"Хэвшлийн горимын мэдээллийн мэдэгдэл"</string>
     <string name="dynamic_mode_notification_title" msgid="508815255807182035">"Батарей ихэвчлэн цэнэглэдэг хугацаанаас өмнө дуусаж болзошгүй"</string>
     <string name="dynamic_mode_notification_summary" msgid="2541166298550402690">"Батарейны ажиллах хугацааг уртасгахын тулд Батарей хэмнэгчийг идэвхжүүллээ"</string>
+    <string name="mime_type_folder" msgid="7111951698626315204">"Фолдер"</string>
+    <string name="mime_type_apk" msgid="5518003630972506900">"Андройд апп"</string>
+    <string name="mime_type_generic" msgid="6833871596845900027">"Файл"</string>
+    <string name="mime_type_generic_ext" msgid="8450275970061657174">"<xliff:g id="EXTENSION">%1$s</xliff:g>-н файл"</string>
+    <string name="mime_type_audio" msgid="6289777657172050926">"Аудио"</string>
+    <string name="mime_type_audio_ext" msgid="3270880987725816210">"<xliff:g id="EXTENSION">%1$s</xliff:g>-н аудио"</string>
+    <string name="mime_type_video" msgid="4093025777317307426">"Видео"</string>
+    <string name="mime_type_video_ext" msgid="5643771615714173159">"<xliff:g id="EXTENSION">%1$s</xliff:g>-н видео"</string>
+    <string name="mime_type_image" msgid="3144284451605236371">"Зураг"</string>
+    <string name="mime_type_image_ext" msgid="1514613218742736590">"<xliff:g id="EXTENSION">%1$s</xliff:g>-н зураг"</string>
+    <string name="mime_type_compressed" msgid="1645486037074943257">"Архив"</string>
+    <string name="mime_type_compressed_ext" msgid="4232293058067801528">"<xliff:g id="EXTENSION">%1$s</xliff:g>-н архив"</string>
+    <string name="mime_type_document" msgid="1596838147256375966">"Документ"</string>
+    <string name="mime_type_document_ext" msgid="6327266601345501281">"<xliff:g id="EXTENSION">%1$s</xliff:g>-н документ"</string>
+    <string name="mime_type_spreadsheet" msgid="2639138255207123557">"Хүснэгт"</string>
+    <string name="mime_type_spreadsheet_ext" msgid="5508653032786106725">"<xliff:g id="EXTENSION">%1$s</xliff:g>-н хүснэгт"</string>
+    <string name="mime_type_presentation" msgid="6145604688774787357">"Үзүүлэн"</string>
+    <string name="mime_type_presentation_ext" msgid="2982650207774823437">"<xliff:g id="EXTENSION">%1$s</xliff:g>-н үзүүлэн"</string>
     <string name="car_loading_profile" msgid="3545132581795684027">"Ачаалж байна"</string>
     <plurals name="file_count" formatted="false" msgid="1628600959752419449">
       <item quantity="other"><xliff:g id="FILE_NAME_2">%s</xliff:g> + <xliff:g id="COUNT_3">%d</xliff:g> файл</item>
       <item quantity="one"><xliff:g id="FILE_NAME_0">%s</xliff:g> + <xliff:g id="COUNT_1">%d</xliff:g> файл</item>
     </plurals>
+    <!-- no translation found for chooser_no_direct_share_targets (997970693708458895) -->
+    <skip />
 </resources>
diff --git a/core/res/res/values-mr/strings.xml b/core/res/res/values-mr/strings.xml
index 1ee3a35..938c539 100644
--- a/core/res/res/values-mr/strings.xml
+++ b/core/res/res/values-mr/strings.xml
@@ -308,15 +308,15 @@
     <string name="permgrouplab_phone" msgid="5229115638567440675">"फोन"</string>
     <string name="permgroupdesc_phone" msgid="6234224354060641055">"फोन कॉल आणि व्यवस्थापित"</string>
     <string name="permgrouprequest_phone" msgid="9166979577750581037">"&lt;b&gt;<xliff:g id="APP_NAME">%1$s</xliff:g>&lt;/b&gt; ला फोन कॉल करू आणि ते व्यवस्थापित करू द्यायचे?"</string>
-    <string name="permgrouplab_sensors" msgid="416037179223226722">"शरीर सेन्सर"</string>
+    <string name="permgrouplab_sensors" msgid="4838614103153567532">"शरीर सेंसर"</string>
     <string name="permgroupdesc_sensors" msgid="7147968539346634043">"आपल्‍या महत्त्वाच्या मापनांविषयी सेंसर डेटा अॅक्सेस करा"</string>
     <string name="permgrouprequest_sensors" msgid="6349806962814556786">"&lt;b&gt;<xliff:g id="APP_NAME">%1$s</xliff:g>&lt;/b&gt; ला तुमच्या महत्त्वाच्या लक्षणांविषयीचा सेन्सर डेटा अॅक्सेस करू द्यायचे?"</string>
     <string name="permgrouplab_aural" msgid="965607064083134896">"संगीत"</string>
     <string name="permgroupdesc_aural" msgid="4870189506255958055">"तुमचे संगीत अॅक्सेस करा"</string>
     <string name="permgrouprequest_aural" msgid="6787926123071735620">"&lt;b&gt;<xliff:g id="APP_NAME">%1$s</xliff:g>&lt;/b&gt; ला तुमचे संगीत अॅक्सेस करू द्यायचे का?"</string>
-    <string name="permgrouplab_visual" msgid="8030190588123857921">"फोटो आणि व्हिडिओ"</string>
+    <string name="permgrouplab_visual" msgid="6477382108771145134">"फोटो आणि व्हिडिओ"</string>
     <string name="permgroupdesc_visual" msgid="3415827902566663546">"तुमचे फोटो आणि व्हिडिओ अॅक्सेस करा"</string>
-    <string name="permgrouprequest_visual" msgid="6907523945030290376">"&lt;b&gt;<xliff:g id="APP_NAME">%1$s</xliff:g>&lt;/b&gt; ला तुमचे फोटो आणि व्हिडिओ अॅक्सेस करू द्यायचे का?"</string>
+    <string name="permgrouprequest_visual" msgid="3043752127595243314">"&lt;b&gt;<xliff:g id="APP_NAME">%1$s</xliff:g>&lt;/b&gt; ला टॅग केलेल्या स्थानांसह तुमचे फोटो आणि व्हिडिओ अॅक्सेस करण्याची अनुमती द्यायची का?"</string>
     <string name="capability_title_canRetrieveWindowContent" msgid="3901717936930170320">"विंडोमधील आशय पुन्हा मिळवा"</string>
     <string name="capability_desc_canRetrieveWindowContent" msgid="3772225008605310672">"तुम्ही वापरत असलेल्‍या विंडोमधील आशय तपासा."</string>
     <string name="capability_title_canRequestTouchExploration" msgid="3108723364676667320">"स्पर्श करून अन्वेषण चालू करा"</string>
@@ -1397,8 +1397,7 @@
     <string name="ext_media_init_action" msgid="7952885510091978278">"सेट करा"</string>
     <string name="ext_media_unmount_action" msgid="1121883233103278199">"बाहेर काढा"</string>
     <string name="ext_media_browse_action" msgid="8322172381028546087">"एक्सप्लोर करा"</string>
-    <!-- no translation found for ext_media_seamless_action (6575980560886881233) -->
-    <skip />
+    <string name="ext_media_seamless_action" msgid="6575980560886881233">"आउटपुट स्विच करा"</string>
     <string name="ext_media_missing_title" msgid="620980315821543904">"<xliff:g id="NAME">%s</xliff:g> गहाळ आहे"</string>
     <string name="ext_media_missing_message" msgid="4012389235250987930">"डिव्हाइस पुन्हा घाला"</string>
     <string name="ext_media_move_specific_title" msgid="1471100343872375842">"<xliff:g id="NAME">%s</xliff:g> हलवित आहे"</string>
@@ -1612,6 +1611,8 @@
     <string name="display_manager_overlay_display_name" msgid="5142365982271620716">"ओव्हरले #<xliff:g id="ID">%1$d</xliff:g>"</string>
     <string name="display_manager_overlay_display_title" msgid="652124517672257172">"<xliff:g id="NAME">%1$s</xliff:g>: <xliff:g id="WIDTH">%2$d</xliff:g>x<xliff:g id="HEIGHT">%3$d</xliff:g>, <xliff:g id="DPI">%4$d</xliff:g> dpi"</string>
     <string name="display_manager_overlay_display_secure_suffix" msgid="6022119702628572080">", सुरक्षित"</string>
+    <string name="activity_starter_block_bg_activity_starts_permissive" msgid="5692097903712956720">"<xliff:g id="PACKAGENAME">%1$s</xliff:g> पासून सुरुवात होणारी ही बॅकग्राउंड अॅक्टिव्हिटी भविष्यातील Q बिल्डमध्ये ब्लॉक केली जाईल. go/q-bg-block पाहा."</string>
+    <string name="activity_starter_block_bg_activity_starts_enforcing" msgid="8299522481076404353">"<xliff:g id="PACKAGENAME">%1$s</xliff:g> वरून सुरुवात होणारी बॅकग्राउंड अॅक्टिव्हिटी ब्लॉक करण्यात आली. go/q-bg-block पाहा."</string>
     <string name="kg_forgot_pattern_button_text" msgid="8852021467868220608">"पॅटर्न विसरलात"</string>
     <string name="kg_wrong_pattern" msgid="1850806070801358830">"चुकीचा पॅटर्न"</string>
     <string name="kg_wrong_password" msgid="2333281762128113157">"चुकीचा पासवर्ड"</string>
@@ -1997,9 +1998,29 @@
     <string name="dynamic_mode_notification_channel_name" msgid="2348803891571320452">"दिनक्रम मोडची माहिती सूचना"</string>
     <string name="dynamic_mode_notification_title" msgid="508815255807182035">"चार्जिंगची सामान्य पातळी गाठेपर्यंत कदाचित बॅटरी संपू शकते"</string>
     <string name="dynamic_mode_notification_summary" msgid="2541166298550402690">"बॅटरी लाइफ वाढवण्यासाठी बॅटरी सेव्हर सुरू केला आहे"</string>
+    <string name="mime_type_folder" msgid="7111951698626315204">"फोल्डर"</string>
+    <string name="mime_type_apk" msgid="5518003630972506900">"Android अ‍ॅप्लिकेशन"</string>
+    <string name="mime_type_generic" msgid="6833871596845900027">"फाइल"</string>
+    <string name="mime_type_generic_ext" msgid="8450275970061657174">"<xliff:g id="EXTENSION">%1$s</xliff:g> फाइल"</string>
+    <string name="mime_type_audio" msgid="6289777657172050926">"ऑडिओ"</string>
+    <string name="mime_type_audio_ext" msgid="3270880987725816210">"<xliff:g id="EXTENSION">%1$s</xliff:g> ऑडिओ"</string>
+    <string name="mime_type_video" msgid="4093025777317307426">"व्हिडिओ"</string>
+    <string name="mime_type_video_ext" msgid="5643771615714173159">"<xliff:g id="EXTENSION">%1$s</xliff:g> व्हिडिओ"</string>
+    <string name="mime_type_image" msgid="3144284451605236371">"इमेज"</string>
+    <string name="mime_type_image_ext" msgid="1514613218742736590">"<xliff:g id="EXTENSION">%1$s</xliff:g> इमेज"</string>
+    <string name="mime_type_compressed" msgid="1645486037074943257">"संग्रहित करा"</string>
+    <string name="mime_type_compressed_ext" msgid="4232293058067801528">"<xliff:g id="EXTENSION">%1$s</xliff:g> संग्रहण"</string>
+    <string name="mime_type_document" msgid="1596838147256375966">"दस्तऐवज"</string>
+    <string name="mime_type_document_ext" msgid="6327266601345501281">"<xliff:g id="EXTENSION">%1$s</xliff:g> दस्तऐवज"</string>
+    <string name="mime_type_spreadsheet" msgid="2639138255207123557">"स्प्रेडशीट"</string>
+    <string name="mime_type_spreadsheet_ext" msgid="5508653032786106725">"<xliff:g id="EXTENSION">%1$s</xliff:g> स्प्रेडशीट"</string>
+    <string name="mime_type_presentation" msgid="6145604688774787357">"सादरीकरण"</string>
+    <string name="mime_type_presentation_ext" msgid="2982650207774823437">"<xliff:g id="EXTENSION">%1$s</xliff:g> सादरीकरण"</string>
     <string name="car_loading_profile" msgid="3545132581795684027">"लोड होत आहे"</string>
     <plurals name="file_count" formatted="false" msgid="1628600959752419449">
       <item quantity="one"><xliff:g id="FILE_NAME_2">%s</xliff:g> + <xliff:g id="COUNT_3">%d</xliff:g> फाइल</item>
       <item quantity="other"><xliff:g id="FILE_NAME_2">%s</xliff:g> + <xliff:g id="COUNT_3">%d</xliff:g> फायली</item>
     </plurals>
+    <!-- no translation found for chooser_no_direct_share_targets (997970693708458895) -->
+    <skip />
 </resources>
diff --git a/core/res/res/values-ms/strings.xml b/core/res/res/values-ms/strings.xml
index ad84062..98b64e9 100644
--- a/core/res/res/values-ms/strings.xml
+++ b/core/res/res/values-ms/strings.xml
@@ -308,15 +308,15 @@
     <string name="permgrouplab_phone" msgid="5229115638567440675">"Telefon"</string>
     <string name="permgroupdesc_phone" msgid="6234224354060641055">"membuat dan mengurus panggilan telefon"</string>
     <string name="permgrouprequest_phone" msgid="9166979577750581037">"Benarkan &lt;b&gt;<xliff:g id="APP_NAME">%1$s</xliff:g>&lt;/b&gt; membuat dan mengurus panggilan telefon?"</string>
-    <string name="permgrouplab_sensors" msgid="416037179223226722">"Penderia Badan"</string>
+    <string name="permgrouplab_sensors" msgid="4838614103153567532">"Penderia tubuh"</string>
     <string name="permgroupdesc_sensors" msgid="7147968539346634043">"akses data penderia tentang tanda vital anda"</string>
     <string name="permgrouprequest_sensors" msgid="6349806962814556786">"Benarkan &lt;b&gt;<xliff:g id="APP_NAME">%1$s</xliff:g>&lt;/b&gt; mengakses data penderia tentang tanda vital anda?"</string>
     <string name="permgrouplab_aural" msgid="965607064083134896">"Muzik"</string>
     <string name="permgroupdesc_aural" msgid="4870189506255958055">"akses muzik anda"</string>
     <string name="permgrouprequest_aural" msgid="6787926123071735620">"Benarkan &lt;b&gt;<xliff:g id="APP_NAME">%1$s</xliff:g>&lt;/b&gt; mengakses muzik anda?"</string>
-    <string name="permgrouplab_visual" msgid="8030190588123857921">"Foto &amp; Video"</string>
+    <string name="permgrouplab_visual" msgid="6477382108771145134">"Foto &amp; video"</string>
     <string name="permgroupdesc_visual" msgid="3415827902566663546">"akses foto &amp; video anda"</string>
-    <string name="permgrouprequest_visual" msgid="6907523945030290376">"Benarkan &lt;b&gt;<xliff:g id="APP_NAME">%1$s</xliff:g>&lt;/b&gt; mengakses foto &amp; video anda?"</string>
+    <string name="permgrouprequest_visual" msgid="3043752127595243314">"Benarkan &lt;b&gt;<xliff:g id="APP_NAME">%1$s</xliff:g>&lt;/b&gt; mengakses foto dan video anda, termasuk lokasi yang ditandai?"</string>
     <string name="capability_title_canRetrieveWindowContent" msgid="3901717936930170320">"Dapatkan kembali kandungan tetingkap"</string>
     <string name="capability_desc_canRetrieveWindowContent" msgid="3772225008605310672">"Periksa kandungan tetingkap yang berinteraksi dengan anda."</string>
     <string name="capability_title_canRequestTouchExploration" msgid="3108723364676667320">"Hidupkan Jelajah melalui Sentuhan"</string>
@@ -1611,6 +1611,8 @@
     <string name="display_manager_overlay_display_name" msgid="5142365982271620716">"Tindih #<xliff:g id="ID">%1$d</xliff:g>"</string>
     <string name="display_manager_overlay_display_title" msgid="652124517672257172">"<xliff:g id="NAME">%1$s</xliff:g>: <xliff:g id="WIDTH">%2$d</xliff:g>x<xliff:g id="HEIGHT">%3$d</xliff:g>, <xliff:g id="DPI">%4$d</xliff:g> dpi"</string>
     <string name="display_manager_overlay_display_secure_suffix" msgid="6022119702628572080">", selamat"</string>
+    <string name="activity_starter_block_bg_activity_starts_permissive" msgid="5692097903712956720">"Permulaan aktiviti latar belakang daripada <xliff:g id="PACKAGENAME">%1$s</xliff:g> ini akan disekat dalam binaan Q pada masa hadapan. Lihat go/q-bg-block."</string>
+    <string name="activity_starter_block_bg_activity_starts_enforcing" msgid="8299522481076404353">"Permulaan aktiviti latar belakang daripada <xliff:g id="PACKAGENAME">%1$s</xliff:g> disekat. Lihat go/q-bg-block."</string>
     <string name="kg_forgot_pattern_button_text" msgid="8852021467868220608">"Lupa Corak"</string>
     <string name="kg_wrong_pattern" msgid="1850806070801358830">"Corak Salah"</string>
     <string name="kg_wrong_password" msgid="2333281762128113157">"Kata Laluan Salah"</string>
@@ -1996,9 +1998,29 @@
     <string name="dynamic_mode_notification_channel_name" msgid="2348803891571320452">"Pemberitahuan maklumat Mod Rutin"</string>
     <string name="dynamic_mode_notification_title" msgid="508815255807182035">"Bateri mungkin habis sebelum pengecasan biasa"</string>
     <string name="dynamic_mode_notification_summary" msgid="2541166298550402690">"Penjimat Bateri diaktifkan untuk memanjangkan hayat bateri"</string>
+    <string name="mime_type_folder" msgid="7111951698626315204">"Folder"</string>
+    <string name="mime_type_apk" msgid="5518003630972506900">"Aplikasi Android"</string>
+    <string name="mime_type_generic" msgid="6833871596845900027">"Fail"</string>
+    <string name="mime_type_generic_ext" msgid="8450275970061657174">"Fail <xliff:g id="EXTENSION">%1$s</xliff:g>"</string>
+    <string name="mime_type_audio" msgid="6289777657172050926">"Audio"</string>
+    <string name="mime_type_audio_ext" msgid="3270880987725816210">"Audio <xliff:g id="EXTENSION">%1$s</xliff:g>"</string>
+    <string name="mime_type_video" msgid="4093025777317307426">"Video"</string>
+    <string name="mime_type_video_ext" msgid="5643771615714173159">"Video <xliff:g id="EXTENSION">%1$s</xliff:g>"</string>
+    <string name="mime_type_image" msgid="3144284451605236371">"Imej"</string>
+    <string name="mime_type_image_ext" msgid="1514613218742736590">"Imej <xliff:g id="EXTENSION">%1$s</xliff:g>"</string>
+    <string name="mime_type_compressed" msgid="1645486037074943257">"Arkib"</string>
+    <string name="mime_type_compressed_ext" msgid="4232293058067801528">"Arkib <xliff:g id="EXTENSION">%1$s</xliff:g>"</string>
+    <string name="mime_type_document" msgid="1596838147256375966">"Dokumen"</string>
+    <string name="mime_type_document_ext" msgid="6327266601345501281">"Dokumen <xliff:g id="EXTENSION">%1$s</xliff:g>"</string>
+    <string name="mime_type_spreadsheet" msgid="2639138255207123557">"Hamparan"</string>
+    <string name="mime_type_spreadsheet_ext" msgid="5508653032786106725">"Hamparan <xliff:g id="EXTENSION">%1$s</xliff:g>"</string>
+    <string name="mime_type_presentation" msgid="6145604688774787357">"Pembentangan"</string>
+    <string name="mime_type_presentation_ext" msgid="2982650207774823437">"Pembentangan <xliff:g id="EXTENSION">%1$s</xliff:g>"</string>
     <string name="car_loading_profile" msgid="3545132581795684027">"Memuatkan"</string>
     <plurals name="file_count" formatted="false" msgid="1628600959752419449">
       <item quantity="other"><xliff:g id="FILE_NAME_2">%s</xliff:g> + <xliff:g id="COUNT_3">%d</xliff:g> fail</item>
       <item quantity="one"><xliff:g id="FILE_NAME_0">%s</xliff:g> + <xliff:g id="COUNT_1">%d</xliff:g> fail</item>
     </plurals>
+    <!-- no translation found for chooser_no_direct_share_targets (997970693708458895) -->
+    <skip />
 </resources>
diff --git a/core/res/res/values-my/strings.xml b/core/res/res/values-my/strings.xml
index 1c0daaf..09e963f 100644
--- a/core/res/res/values-my/strings.xml
+++ b/core/res/res/values-my/strings.xml
@@ -308,15 +308,15 @@
     <string name="permgrouplab_phone" msgid="5229115638567440675">"ဖုန်း"</string>
     <string name="permgroupdesc_phone" msgid="6234224354060641055">"ဖုန်းခေါ်ဆိုမှုများ ပြုလုပ်ရန်နှင့် စီမံရန်"</string>
     <string name="permgrouprequest_phone" msgid="9166979577750581037">"&lt;b&gt;<xliff:g id="APP_NAME">%1$s</xliff:g>&lt;/b&gt; အား ဖုန်းခေါ်ဆိုမှုများ ပြုလုပ်ခွင့်နှင့် စီမံခွင့်ပေးလိုပါသလား။"</string>
-    <string name="permgrouplab_sensors" msgid="416037179223226722">"ခန္ဓာကိုယ် အာရုံခံကိရိယာများ"</string>
+    <string name="permgrouplab_sensors" msgid="4838614103153567532">"စက်၏ အာရုံခံစနစ်များ"</string>
     <string name="permgroupdesc_sensors" msgid="7147968539346634043">"သင်၏ အဓိကကျသော လက္ခဏာများအကြောင်း အာရုံခံကိရိယာဒေတာကို ရယူသုံးစွဲရန်"</string>
     <string name="permgrouprequest_sensors" msgid="6349806962814556786">"&lt;b&gt;<xliff:g id="APP_NAME">%1$s</xliff:g>&lt;/b&gt; အား သင်၏ အရေးကြီးသောလက္ခဏာ အာရုံခံကိရိယာ ဒေတာများကို သုံးခွင့်ပေးလိုပါသလား။"</string>
     <string name="permgrouplab_aural" msgid="965607064083134896">"တေးဂီတ"</string>
     <string name="permgroupdesc_aural" msgid="4870189506255958055">"သင့်တေးဂီတသို့ ဝင်သည်"</string>
     <string name="permgrouprequest_aural" msgid="6787926123071735620">"&lt;b&gt;<xliff:g id="APP_NAME">%1$s</xliff:g>&lt;/b&gt; အား သင့်တေးဂီတကို ဝင်ခွင့်ပေးလိုပါသလား။"</string>
-    <string name="permgrouplab_visual" msgid="8030190588123857921">"ဓာတ်ပုံနှင့် ဗီဒီယိုများ"</string>
+    <string name="permgrouplab_visual" msgid="6477382108771145134">"ဓာတ်ပုံများနှင့် ဗီဒီယိုများ"</string>
     <string name="permgroupdesc_visual" msgid="3415827902566663546">"သင့်ဓာတ်ပုံနှင့် ဗီဒီယိုများသို့ ဝင်သည်"</string>
-    <string name="permgrouprequest_visual" msgid="6907523945030290376">"&lt;b&gt;<xliff:g id="APP_NAME">%1$s</xliff:g>&lt;/b&gt; အား သင့်ဓာတ်ပုံနှင့် ဗီဒီယိုများကို ဝင်ခွင့်ပေးလိုပါသလား။"</string>
+    <string name="permgrouprequest_visual" msgid="3043752127595243314">"တဂ်လုပ်ထားသည့် တည်နေရာများအပါအဝင် သင့်ဓာတ်ပုံနှင့် ဗီဒီယိုများကို &lt;b&gt;<xliff:g id="APP_NAME">%1$s</xliff:g>&lt;/b&gt; အား ဝင်ကြည့်ခွင့်ပေးလိုပါသလား။"</string>
     <string name="capability_title_canRetrieveWindowContent" msgid="3901717936930170320">"ဝင်းဒိုးတွင် ပါရှိသည်များကို ပြန်လည်ရယူရန်"</string>
     <string name="capability_desc_canRetrieveWindowContent" msgid="3772225008605310672">"သင်အသုံးပြုနေသော ဝင်းဒိုးတွင် ပါရှိသည်များကို ကြည့်ရှုစစ်ဆေးသည်။"</string>
     <string name="capability_title_canRequestTouchExploration" msgid="3108723364676667320">"တို့ထိခြင်းဖြင့် ရှာဖွေမှုကို ဖွင့်ရန်"</string>
@@ -1397,8 +1397,7 @@
     <string name="ext_media_init_action" msgid="7952885510091978278">"စဖွင့်သတ်မှတ်"</string>
     <string name="ext_media_unmount_action" msgid="1121883233103278199">"ထုတ်မည်"</string>
     <string name="ext_media_browse_action" msgid="8322172381028546087">"စူးစမ်းရန်"</string>
-    <!-- no translation found for ext_media_seamless_action (6575980560886881233) -->
-    <skip />
+    <string name="ext_media_seamless_action" msgid="6575980560886881233">"မီဒီယာအထွက် ပြောင်းရန်"</string>
     <string name="ext_media_missing_title" msgid="620980315821543904">"<xliff:g id="NAME">%s</xliff:g> ပျောက်နေသည်"</string>
     <string name="ext_media_missing_message" msgid="4012389235250987930">"စက်ပစ္စည်းကို ထပ်မံထည့်သွင်းပါ"</string>
     <string name="ext_media_move_specific_title" msgid="1471100343872375842">"<xliff:g id="NAME">%s</xliff:g> ရွှေ့နေစဉ်"</string>
@@ -1612,6 +1611,8 @@
     <string name="display_manager_overlay_display_name" msgid="5142365982271620716">"အပေါ်မှ ထပ်သောအရာ #<xliff:g id="ID">%1$d</xliff:g>"</string>
     <string name="display_manager_overlay_display_title" msgid="652124517672257172">"<xliff:g id="NAME">%1$s</xliff:g>: <xliff:g id="WIDTH">%2$d</xliff:g>x<xliff:g id="HEIGHT">%3$d</xliff:g>, <xliff:g id="DPI">%4$d</xliff:g>  dpi"</string>
     <string name="display_manager_overlay_display_secure_suffix" msgid="6022119702628572080">", လုံခြုံသော"</string>
+    <string name="activity_starter_block_bg_activity_starts_permissive" msgid="5692097903712956720">"<xliff:g id="PACKAGENAME">%1$s</xliff:g> မှစတင်သော ဤနောက်ခံလုပ်ဆောင်ချက်ကို အနာဂတ် Q တည်ဆောက်ပုံများတွင် ပိတ်ထားပါမည်။ go/q-bg-block ကိုကြည့်ပါ။"</string>
+    <string name="activity_starter_block_bg_activity_starts_enforcing" msgid="8299522481076404353">"<xliff:g id="PACKAGENAME">%1$s</xliff:g> မှစတင်သော နောက်ခံလုပ်ဆောင်ချက်ကို ပိတ်ထားသည်။ go/q-bg-block ကိုကြည့်ပါ။"</string>
     <string name="kg_forgot_pattern_button_text" msgid="8852021467868220608">"ပုံဖော်မှုအား မေ့လျော့ခြင်း"</string>
     <string name="kg_wrong_pattern" msgid="1850806070801358830">"ပုံဆွဲအမှား"</string>
     <string name="kg_wrong_password" msgid="2333281762128113157">"စကားဝှက်အမှား"</string>
@@ -1997,9 +1998,29 @@
     <string name="dynamic_mode_notification_channel_name" msgid="2348803891571320452">"ပုံမှန်မုဒ်အတွက် အချက်အလက်ပြသည့် အကြောင်းကြားချက်"</string>
     <string name="dynamic_mode_notification_title" msgid="508815255807182035">"ပုံမှန်အားသွင်းမှုမပြုလုပ်မီ ဘက်ထရီကုန်သွားနိုင်သည်"</string>
     <string name="dynamic_mode_notification_summary" msgid="2541166298550402690">"ဘက်ထရီသက်တမ်းကို တိုးမြှင့်ရန် \'ဘက်ထရီအားထိန်း\' စတင်ပြီးပါပြီ"</string>
+    <string name="mime_type_folder" msgid="7111951698626315204">"ဖိုင်တွဲ"</string>
+    <string name="mime_type_apk" msgid="5518003630972506900">"Android အပလီကေးရှင်း"</string>
+    <string name="mime_type_generic" msgid="6833871596845900027">"ဖိုင်"</string>
+    <string name="mime_type_generic_ext" msgid="8450275970061657174">"<xliff:g id="EXTENSION">%1$s</xliff:g> ဖိုင်"</string>
+    <string name="mime_type_audio" msgid="6289777657172050926">"အသံ"</string>
+    <string name="mime_type_audio_ext" msgid="3270880987725816210">"<xliff:g id="EXTENSION">%1$s</xliff:g> အသံ"</string>
+    <string name="mime_type_video" msgid="4093025777317307426">"ဗီဒီယို"</string>
+    <string name="mime_type_video_ext" msgid="5643771615714173159">"<xliff:g id="EXTENSION">%1$s</xliff:g> ဗီဒီယို"</string>
+    <string name="mime_type_image" msgid="3144284451605236371">"ပုံ"</string>
+    <string name="mime_type_image_ext" msgid="1514613218742736590">"<xliff:g id="EXTENSION">%1$s</xliff:g> ပုံ"</string>
+    <string name="mime_type_compressed" msgid="1645486037074943257">"မှတ်တမ်း"</string>
+    <string name="mime_type_compressed_ext" msgid="4232293058067801528">"<xliff:g id="EXTENSION">%1$s</xliff:g> မှတ်တမ်း"</string>
+    <string name="mime_type_document" msgid="1596838147256375966">"စာရွက်စာတမ်း"</string>
+    <string name="mime_type_document_ext" msgid="6327266601345501281">"<xliff:g id="EXTENSION">%1$s</xliff:g> စာရွက်စာတမ်း"</string>
+    <string name="mime_type_spreadsheet" msgid="2639138255207123557">"Spreadsheet"</string>
+    <string name="mime_type_spreadsheet_ext" msgid="5508653032786106725">"<xliff:g id="EXTENSION">%1$s</xliff:g> spreadsheet"</string>
+    <string name="mime_type_presentation" msgid="6145604688774787357">"တင်ပြမှု"</string>
+    <string name="mime_type_presentation_ext" msgid="2982650207774823437">"<xliff:g id="EXTENSION">%1$s</xliff:g> တင်ပြမှု"</string>
     <string name="car_loading_profile" msgid="3545132581795684027">"တင်နေသည်"</string>
     <plurals name="file_count" formatted="false" msgid="1628600959752419449">
       <item quantity="other"><xliff:g id="FILE_NAME_2">%s</xliff:g> + <xliff:g id="COUNT_3">%d</xliff:g> ဖိုင်</item>
       <item quantity="one"><xliff:g id="FILE_NAME_0">%s</xliff:g> + <xliff:g id="COUNT_1">%d</xliff:g> ဖိုင်</item>
     </plurals>
+    <!-- no translation found for chooser_no_direct_share_targets (997970693708458895) -->
+    <skip />
 </resources>
diff --git a/core/res/res/values-nb/strings.xml b/core/res/res/values-nb/strings.xml
index 3a2aed7..1aced28 100644
--- a/core/res/res/values-nb/strings.xml
+++ b/core/res/res/values-nb/strings.xml
@@ -308,15 +308,15 @@
     <string name="permgrouplab_phone" msgid="5229115638567440675">"Telefon"</string>
     <string name="permgroupdesc_phone" msgid="6234224354060641055">"ring og administrer anrop"</string>
     <string name="permgrouprequest_phone" msgid="9166979577750581037">"Vil du la &lt;b&gt;<xliff:g id="APP_NAME">%1$s</xliff:g>&lt;/b&gt; ringe og administrere telefonsamtaler?"</string>
-    <string name="permgrouplab_sensors" msgid="416037179223226722">"Kroppssensorer"</string>
+    <string name="permgrouplab_sensors" msgid="4838614103153567532">"Kroppssensorer"</string>
     <string name="permgroupdesc_sensors" msgid="7147968539346634043">"få tilgang til sensordata om de vitale tegnene dine"</string>
     <string name="permgrouprequest_sensors" msgid="6349806962814556786">"Vil du gi &lt;b&gt;<xliff:g id="APP_NAME">%1$s</xliff:g>&lt;/b&gt; tilgang til sensordata om de vitale tegnene dine?"</string>
     <string name="permgrouplab_aural" msgid="965607064083134896">"Musikk"</string>
     <string name="permgroupdesc_aural" msgid="4870189506255958055">"få tilgang til musikken din"</string>
     <string name="permgrouprequest_aural" msgid="6787926123071735620">"Vil du gi &lt;b&gt;<xliff:g id="APP_NAME">%1$s</xliff:g>&lt;/b&gt; tilgang til musikken din?"</string>
-    <string name="permgrouplab_visual" msgid="8030190588123857921">"Bilder og videoer"</string>
+    <string name="permgrouplab_visual" msgid="6477382108771145134">"Bilder og videoer"</string>
     <string name="permgroupdesc_visual" msgid="3415827902566663546">"få tilgang til bildene og videoene dine"</string>
-    <string name="permgrouprequest_visual" msgid="6907523945030290376">"Vil du gi &lt;b&gt;<xliff:g id="APP_NAME">%1$s</xliff:g>&lt;/b&gt; tilgang til bildene og videoene dine?"</string>
+    <string name="permgrouprequest_visual" msgid="3043752127595243314">"Vil du gi &lt;b&gt;<xliff:g id="APP_NAME">%1$s</xliff:g>&lt;/b&gt; tilgang til bildene og videoene dine, inkludert merkede steder?"</string>
     <string name="capability_title_canRetrieveWindowContent" msgid="3901717936930170320">"hente innhold i vinduer"</string>
     <string name="capability_desc_canRetrieveWindowContent" msgid="3772225008605310672">"Appen analyserer innholdet i vinduer du samhandler med."</string>
     <string name="capability_title_canRequestTouchExploration" msgid="3108723364676667320">"slå på berøringsutforsking"</string>
@@ -1396,8 +1396,7 @@
     <string name="ext_media_init_action" msgid="7952885510091978278">"Konfigurer"</string>
     <string name="ext_media_unmount_action" msgid="1121883233103278199">"Løs ut"</string>
     <string name="ext_media_browse_action" msgid="8322172381028546087">"Utforsk"</string>
-    <!-- no translation found for ext_media_seamless_action (6575980560886881233) -->
-    <skip />
+    <string name="ext_media_seamless_action" msgid="6575980560886881233">"Bytt utenhet"</string>
     <string name="ext_media_missing_title" msgid="620980315821543904">"<xliff:g id="NAME">%s</xliff:g> mangler"</string>
     <string name="ext_media_missing_message" msgid="4012389235250987930">"Sett inn enheten på nytt"</string>
     <string name="ext_media_move_specific_title" msgid="1471100343872375842">"Flytter <xliff:g id="NAME">%s</xliff:g>"</string>
@@ -1611,6 +1610,8 @@
     <string name="display_manager_overlay_display_name" msgid="5142365982271620716">"Overlegg #<xliff:g id="ID">%1$d</xliff:g>"</string>
     <string name="display_manager_overlay_display_title" msgid="652124517672257172">"<xliff:g id="NAME">%1$s</xliff:g>: <xliff:g id="WIDTH">%2$d</xliff:g> x <xliff:g id="HEIGHT">%3$d</xliff:g>, <xliff:g id="DPI">%4$d</xliff:g> dpi"</string>
     <string name="display_manager_overlay_display_secure_suffix" msgid="6022119702628572080">", sikker"</string>
+    <string name="activity_starter_block_bg_activity_starts_permissive" msgid="5692097903712956720">"Denne bakgrunnsaktiviteten som starter fra <xliff:g id="PACKAGENAME">%1$s</xliff:g>, blir blokkert i fremtidige Q-delversjoner. Se go/q-bg-block."</string>
+    <string name="activity_starter_block_bg_activity_starts_enforcing" msgid="8299522481076404353">"Bakgrunnsaktivitet som starter fra <xliff:g id="PACKAGENAME">%1$s</xliff:g>, er blokkert. Se go/q-bg-block."</string>
     <string name="kg_forgot_pattern_button_text" msgid="8852021467868220608">"Har du glemt mønsteret?"</string>
     <string name="kg_wrong_pattern" msgid="1850806070801358830">"Feil mønster"</string>
     <string name="kg_wrong_password" msgid="2333281762128113157">"Feil passord"</string>
@@ -1996,9 +1997,29 @@
     <string name="dynamic_mode_notification_channel_name" msgid="2348803891571320452">"Varsel med informasjon om rutinemodus"</string>
     <string name="dynamic_mode_notification_title" msgid="508815255807182035">"Batteriet kan gå tomt før den vanlige ladingen"</string>
     <string name="dynamic_mode_notification_summary" msgid="2541166298550402690">"Batterisparing er aktivert for å forlenge batterilevetiden"</string>
+    <string name="mime_type_folder" msgid="7111951698626315204">"Mappe"</string>
+    <string name="mime_type_apk" msgid="5518003630972506900">"Android-app"</string>
+    <string name="mime_type_generic" msgid="6833871596845900027">"Fil"</string>
+    <string name="mime_type_generic_ext" msgid="8450275970061657174">"<xliff:g id="EXTENSION">%1$s</xliff:g>-fil"</string>
+    <string name="mime_type_audio" msgid="6289777657172050926">"Lyd"</string>
+    <string name="mime_type_audio_ext" msgid="3270880987725816210">"<xliff:g id="EXTENSION">%1$s</xliff:g>-lyd"</string>
+    <string name="mime_type_video" msgid="4093025777317307426">"Video"</string>
+    <string name="mime_type_video_ext" msgid="5643771615714173159">"<xliff:g id="EXTENSION">%1$s</xliff:g>-video"</string>
+    <string name="mime_type_image" msgid="3144284451605236371">"Bilde"</string>
+    <string name="mime_type_image_ext" msgid="1514613218742736590">"<xliff:g id="EXTENSION">%1$s</xliff:g>-bilde"</string>
+    <string name="mime_type_compressed" msgid="1645486037074943257">"Arkiv"</string>
+    <string name="mime_type_compressed_ext" msgid="4232293058067801528">"<xliff:g id="EXTENSION">%1$s</xliff:g>-arkiv"</string>
+    <string name="mime_type_document" msgid="1596838147256375966">"Dokument"</string>
+    <string name="mime_type_document_ext" msgid="6327266601345501281">"<xliff:g id="EXTENSION">%1$s</xliff:g>-dokument"</string>
+    <string name="mime_type_spreadsheet" msgid="2639138255207123557">"Regneark"</string>
+    <string name="mime_type_spreadsheet_ext" msgid="5508653032786106725">"<xliff:g id="EXTENSION">%1$s</xliff:g>-regneark"</string>
+    <string name="mime_type_presentation" msgid="6145604688774787357">"Presentasjon"</string>
+    <string name="mime_type_presentation_ext" msgid="2982650207774823437">"<xliff:g id="EXTENSION">%1$s</xliff:g>-presentasjon"</string>
     <string name="car_loading_profile" msgid="3545132581795684027">"Laster inn"</string>
     <plurals name="file_count" formatted="false" msgid="1628600959752419449">
       <item quantity="other"><xliff:g id="FILE_NAME_2">%s</xliff:g> + <xliff:g id="COUNT_3">%d</xliff:g> filer</item>
       <item quantity="one"><xliff:g id="FILE_NAME_0">%s</xliff:g> + <xliff:g id="COUNT_1">%d</xliff:g> fil</item>
     </plurals>
+    <!-- no translation found for chooser_no_direct_share_targets (997970693708458895) -->
+    <skip />
 </resources>
diff --git a/core/res/res/values-ne/strings.xml b/core/res/res/values-ne/strings.xml
index 40a0c12..806e520 100644
--- a/core/res/res/values-ne/strings.xml
+++ b/core/res/res/values-ne/strings.xml
@@ -308,15 +308,15 @@
     <string name="permgrouplab_phone" msgid="5229115638567440675">"फोन"</string>
     <string name="permgroupdesc_phone" msgid="6234224354060641055">"फोन कलहरू गर्नुहोस् र व्यवस्थापन गर्नुहोस्"</string>
     <string name="permgrouprequest_phone" msgid="9166979577750581037">"&lt;b&gt;<xliff:g id="APP_NAME">%1$s</xliff:g>&lt;/b&gt; लाई फोन कलहरू गर्न र तिनीहरूको व्यवस्थापन गर्न दिने हो?"</string>
-    <string name="permgrouplab_sensors" msgid="416037179223226722">"शारीरिक सेन्सर"</string>
+    <string name="permgrouplab_sensors" msgid="4838614103153567532">"शारीरिक सेन्सरहरू"</string>
     <string name="permgroupdesc_sensors" msgid="7147968539346634043">"तपाईंको महत्त्वपूर्ण संकेत बारे सेन्सर डेटा पहुँच गर्नुहोस्"</string>
     <string name="permgrouprequest_sensors" msgid="6349806962814556786">"&lt;b&gt;<xliff:g id="APP_NAME">%1$s</xliff:g>&lt;/b&gt; लाई आफ्ना महत्त्वपूर्ण लक्षणहरूसम्बन्धी सेन्सर डेटामाथि पहुँच राख्न दिने हो?"</string>
     <string name="permgrouplab_aural" msgid="965607064083134896">"सङ्गीत"</string>
     <string name="permgroupdesc_aural" msgid="4870189506255958055">"आफ्नो सङ्गीतमाथि पहुँच राख्नुहोस्‌"</string>
     <string name="permgrouprequest_aural" msgid="6787926123071735620">"&lt;b&gt;<xliff:g id="APP_NAME">%1$s</xliff:g>&lt;/b&gt; लाई तपाईंको सङ्गीतमाथि पहुँच राख्न दिने हो?"</string>
-    <string name="permgrouplab_visual" msgid="8030190588123857921">"तस्बिर तथा भिडियोहरू"</string>
+    <string name="permgrouplab_visual" msgid="6477382108771145134">"तस्बिर तथा भिडियोहरू"</string>
     <string name="permgroupdesc_visual" msgid="3415827902566663546">"आफ्नो तस्बिर &amp; भिडियोहरूमाथि पहुँच राख्नुहोस्‌"</string>
-    <string name="permgrouprequest_visual" msgid="6907523945030290376">"&lt;b&gt;<xliff:g id="APP_NAME">%1$s</xliff:g>&lt;/b&gt; लाई आफ्नो तस्बिर तथा भिडियोहरूमाथि पहुँच राख्न दिने हो?"</string>
+    <string name="permgrouprequest_visual" msgid="3043752127595243314">"&lt;b&gt;<xliff:g id="APP_NAME">%1$s</xliff:g>&lt;/b&gt; लाई ट्याग गरिएका स्थानहरूलगायत तपाईंका तस्बिर तथा भिडियोहरूमाथि पहुँच गर्न दिने हो?"</string>
     <string name="capability_title_canRetrieveWindowContent" msgid="3901717936930170320">"विन्डो सामग्रीको पुनःबहाली गर्नुहोस्।"</string>
     <string name="capability_desc_canRetrieveWindowContent" msgid="3772225008605310672">"तपाईँको अन्तरक्रिया भइरहेको विन्डोको सामग्रीको निरीक्षण गर्नुहोस्।"</string>
     <string name="capability_title_canRequestTouchExploration" msgid="3108723364676667320">"छोएर गरिने खोजलाई सुचारु गर्नुहोस्"</string>
@@ -1402,8 +1402,7 @@
     <string name="ext_media_init_action" msgid="7952885510091978278">"सेटअप गर्नुहोस्"</string>
     <string name="ext_media_unmount_action" msgid="1121883233103278199">"निकाल्नुहोस्"</string>
     <string name="ext_media_browse_action" msgid="8322172381028546087">"अन्वेषण गर्नुहोस्"</string>
-    <!-- no translation found for ext_media_seamless_action (6575980560886881233) -->
-    <skip />
+    <string name="ext_media_seamless_action" msgid="6575980560886881233">"आउटपुट बदल्नुहोस्"</string>
     <string name="ext_media_missing_title" msgid="620980315821543904">"<xliff:g id="NAME">%s</xliff:g> हराइरहेको"</string>
     <string name="ext_media_missing_message" msgid="4012389235250987930">"यन्त्र फेरि घुसाउनुहोस्"</string>
     <string name="ext_media_move_specific_title" msgid="1471100343872375842">"<xliff:g id="NAME">%s</xliff:g> सार्दै"</string>
@@ -1617,6 +1616,8 @@
     <string name="display_manager_overlay_display_name" msgid="5142365982271620716">"आवरण #<xliff:g id="ID">%1$d</xliff:g>"</string>
     <string name="display_manager_overlay_display_title" msgid="652124517672257172">"<xliff:g id="NAME">%1$s</xliff:g>: <xliff:g id="WIDTH">%2$d</xliff:g>x<xliff:g id="HEIGHT">%3$d</xliff:g>, <xliff:g id="DPI">%4$d</xliff:g> dpi"</string>
     <string name="display_manager_overlay_display_secure_suffix" msgid="6022119702628572080">", सुरक्षित"</string>
+    <string name="activity_starter_block_bg_activity_starts_permissive" msgid="5692097903712956720">"यो पृष्ठभूमिमा चल्ने क्रियाकलापलाई <xliff:g id="PACKAGENAME">%1$s</xliff:g> बाट भविष्यका Q build हरूमा रोक लगाइने छ। go/q-bg-block हेर्नुहोस्।"</string>
+    <string name="activity_starter_block_bg_activity_starts_enforcing" msgid="8299522481076404353">"यो पृष्ठभूमिमा चल्ने क्रियाकलापलाई<xliff:g id="PACKAGENAME">%1$s</xliff:g> माथि रोक लगाएपछि सुरु गरिन्छ। go/q-bg-block हेर्नुहोस्।"</string>
     <string name="kg_forgot_pattern_button_text" msgid="8852021467868220608">"ढाँचा बिर्सनु भयो"</string>
     <string name="kg_wrong_pattern" msgid="1850806070801358830">"गलत ढाँचा"</string>
     <string name="kg_wrong_password" msgid="2333281762128113157">"गलत पासवर्ड"</string>
@@ -2002,9 +2003,29 @@
     <string name="dynamic_mode_notification_channel_name" msgid="2348803891571320452">"दिनचर्या मोडको जानकारीमूलक सूचना"</string>
     <string name="dynamic_mode_notification_title" msgid="508815255807182035">"प्रायः चार्ज गर्ने समय हुनुभन्दा पहिले नै ब्याट्री सकिन सक्छ"</string>
     <string name="dynamic_mode_notification_summary" msgid="2541166298550402690">"ब्याट्रीको आयु बढाउन ब्याट्री सेभर सक्रिय गरियो"</string>
+    <string name="mime_type_folder" msgid="7111951698626315204">"फोल्डर"</string>
+    <string name="mime_type_apk" msgid="5518003630972506900">"Android अनुप्रयोग"</string>
+    <string name="mime_type_generic" msgid="6833871596845900027">"फाइल"</string>
+    <string name="mime_type_generic_ext" msgid="8450275970061657174">"<xliff:g id="EXTENSION">%1$s</xliff:g> फाइल"</string>
+    <string name="mime_type_audio" msgid="6289777657172050926">"अडियो"</string>
+    <string name="mime_type_audio_ext" msgid="3270880987725816210">"<xliff:g id="EXTENSION">%1$s</xliff:g> अडियो"</string>
+    <string name="mime_type_video" msgid="4093025777317307426">"भिडियो"</string>
+    <string name="mime_type_video_ext" msgid="5643771615714173159">"<xliff:g id="EXTENSION">%1$s</xliff:g> भिडियो"</string>
+    <string name="mime_type_image" msgid="3144284451605236371">"छवि"</string>
+    <string name="mime_type_image_ext" msgid="1514613218742736590">"<xliff:g id="EXTENSION">%1$s</xliff:g> छवि"</string>
+    <string name="mime_type_compressed" msgid="1645486037074943257">"अभिलेख"</string>
+    <string name="mime_type_compressed_ext" msgid="4232293058067801528">"<xliff:g id="EXTENSION">%1$s</xliff:g> अभिलेख"</string>
+    <string name="mime_type_document" msgid="1596838147256375966">"कागजात"</string>
+    <string name="mime_type_document_ext" msgid="6327266601345501281">"<xliff:g id="EXTENSION">%1$s</xliff:g> कागजात"</string>
+    <string name="mime_type_spreadsheet" msgid="2639138255207123557">"स्प्रेडसिट"</string>
+    <string name="mime_type_spreadsheet_ext" msgid="5508653032786106725">"<xliff:g id="EXTENSION">%1$s</xliff:g> स्प्रेडसिट"</string>
+    <string name="mime_type_presentation" msgid="6145604688774787357">"प्रस्तुति"</string>
+    <string name="mime_type_presentation_ext" msgid="2982650207774823437">"<xliff:g id="EXTENSION">%1$s</xliff:g> प्रस्तुति"</string>
     <string name="car_loading_profile" msgid="3545132581795684027">"लोड गर्दै"</string>
     <plurals name="file_count" formatted="false" msgid="1628600959752419449">
       <item quantity="other"><xliff:g id="FILE_NAME_2">%s</xliff:g> + <xliff:g id="COUNT_3">%d</xliff:g> फाइलहरू</item>
       <item quantity="one"><xliff:g id="FILE_NAME_0">%s</xliff:g> + <xliff:g id="COUNT_1">%d</xliff:g> फाइल</item>
     </plurals>
+    <!-- no translation found for chooser_no_direct_share_targets (997970693708458895) -->
+    <skip />
 </resources>
diff --git a/core/res/res/values-night/values.xml b/core/res/res/values-night/values.xml
index a2ad3b9..4e6b712 100644
--- a/core/res/res/values-night/values.xml
+++ b/core/res/res/values-night/values.xml
@@ -24,6 +24,7 @@
         <item name="colorError">@color/error_color_device_default_dark</item>
         <item name="colorControlNormal">?attr/textColorPrimary</item>
         <item name="alertDialogTheme">@style/Theme.DeviceDefault.Dialog.Alert</item>
+        <item name="forceDarkAllowed">false</item>
 
         <!-- QS panel background -->
         <item name="colorBackgroundFloating">@color/black</item>
diff --git a/core/res/res/values-nl/strings.xml b/core/res/res/values-nl/strings.xml
index ddc3781..f7482bc 100644
--- a/core/res/res/values-nl/strings.xml
+++ b/core/res/res/values-nl/strings.xml
@@ -308,15 +308,15 @@
     <string name="permgrouplab_phone" msgid="5229115638567440675">"Telefoon"</string>
     <string name="permgroupdesc_phone" msgid="6234224354060641055">"telefoneren en gesprekken beheren"</string>
     <string name="permgrouprequest_phone" msgid="9166979577750581037">"&lt;b&gt;<xliff:g id="APP_NAME">%1$s</xliff:g>&lt;/b&gt; toestaan om telefoongesprekken te starten en te beheren?"</string>
-    <string name="permgrouplab_sensors" msgid="416037179223226722">"Lichaamssensoren"</string>
+    <string name="permgrouplab_sensors" msgid="4838614103153567532">"Lichaamssensoren"</string>
     <string name="permgroupdesc_sensors" msgid="7147968539346634043">"toegang krijgen tot sensorgegevens over je vitale functies"</string>
     <string name="permgrouprequest_sensors" msgid="6349806962814556786">"&lt;b&gt;<xliff:g id="APP_NAME">%1$s</xliff:g>&lt;/b&gt; toegang geven tot sensorgegevens over je vitale functies?"</string>
     <string name="permgrouplab_aural" msgid="965607064083134896">"Muziek"</string>
     <string name="permgroupdesc_aural" msgid="4870189506255958055">"toegang tot je muziek"</string>
     <string name="permgrouprequest_aural" msgid="6787926123071735620">"&lt;b&gt;<xliff:g id="APP_NAME">%1$s</xliff:g>&lt;/b&gt; toegang geven tot je muziek?"</string>
-    <string name="permgrouplab_visual" msgid="8030190588123857921">"Foto\'s en video\'s"</string>
+    <string name="permgrouplab_visual" msgid="6477382108771145134">"Foto\'s en video\'s"</string>
     <string name="permgroupdesc_visual" msgid="3415827902566663546">"toegang tot je foto\'s en video\'s"</string>
-    <string name="permgrouprequest_visual" msgid="6907523945030290376">"Wil je &lt;b&gt;<xliff:g id="APP_NAME">%1$s</xliff:g>&lt;/b&gt; toegang geven tot je foto\'s en video\'s?"</string>
+    <string name="permgrouprequest_visual" msgid="3043752127595243314">"&lt;b&gt;<xliff:g id="APP_NAME">%1$s</xliff:g>&lt;/b&gt; toegang geven tot je foto\'s en video\'s, waaronder getagde locaties?"</string>
     <string name="capability_title_canRetrieveWindowContent" msgid="3901717936930170320">"Content van vensters ophalen"</string>
     <string name="capability_desc_canRetrieveWindowContent" msgid="3772225008605310672">"De content inspecteren van een venster waarmee je interactie hebt."</string>
     <string name="capability_title_canRequestTouchExploration" msgid="3108723364676667320">"\'Verkennen via aanraking\' inschakelen"</string>
@@ -1396,8 +1396,7 @@
     <string name="ext_media_init_action" msgid="7952885510091978278">"Configureren"</string>
     <string name="ext_media_unmount_action" msgid="1121883233103278199">"Uitwerpen"</string>
     <string name="ext_media_browse_action" msgid="8322172381028546087">"Verkennen"</string>
-    <!-- no translation found for ext_media_seamless_action (6575980560886881233) -->
-    <skip />
+    <string name="ext_media_seamless_action" msgid="6575980560886881233">"Uitvoer wijzigen"</string>
     <string name="ext_media_missing_title" msgid="620980315821543904">"<xliff:g id="NAME">%s</xliff:g> ontbreekt"</string>
     <string name="ext_media_missing_message" msgid="4012389235250987930">"Voer apparaat opnieuw in"</string>
     <string name="ext_media_move_specific_title" msgid="1471100343872375842">"<xliff:g id="NAME">%s</xliff:g> verplaatsen"</string>
@@ -1611,6 +1610,8 @@
     <string name="display_manager_overlay_display_name" msgid="5142365982271620716">"Overlay <xliff:g id="ID">%1$d</xliff:g>"</string>
     <string name="display_manager_overlay_display_title" msgid="652124517672257172">"<xliff:g id="NAME">%1$s</xliff:g>: <xliff:g id="WIDTH">%2$d</xliff:g>x<xliff:g id="HEIGHT">%3$d</xliff:g>, <xliff:g id="DPI">%4$d</xliff:g> dpi"</string>
     <string name="display_manager_overlay_display_secure_suffix" msgid="6022119702628572080">", beveiligd"</string>
+    <string name="activity_starter_block_bg_activity_starts_permissive" msgid="5692097903712956720">"Het starten van deze achtergrondactiviteit voor <xliff:g id="PACKAGENAME">%1$s</xliff:g> wordt geblokkeerd in toekomstige Q-builds. Zie go/q-bg-block."</string>
+    <string name="activity_starter_block_bg_activity_starts_enforcing" msgid="8299522481076404353">"Starten van achtergrondactiviteit voor <xliff:g id="PACKAGENAME">%1$s</xliff:g> is geblokkeerd. Zie go/q-bg-block."</string>
     <string name="kg_forgot_pattern_button_text" msgid="8852021467868220608">"Patroon vergeten"</string>
     <string name="kg_wrong_pattern" msgid="1850806070801358830">"Onjuist patroon"</string>
     <string name="kg_wrong_password" msgid="2333281762128113157">"Onjuist wachtwoord"</string>
@@ -1996,9 +1997,29 @@
     <string name="dynamic_mode_notification_channel_name" msgid="2348803891571320452">"Informatiemelding voor routinemodus"</string>
     <string name="dynamic_mode_notification_title" msgid="508815255807182035">"De batterij raakt mogelijk leeg voordat deze normaal gesproken wordt opgeladen"</string>
     <string name="dynamic_mode_notification_summary" msgid="2541166298550402690">"Batterijbesparing is geactiveerd om de batterijduur te verlengen"</string>
+    <string name="mime_type_folder" msgid="7111951698626315204">"Map"</string>
+    <string name="mime_type_apk" msgid="5518003630972506900">"Android-app"</string>
+    <string name="mime_type_generic" msgid="6833871596845900027">"Bestand"</string>
+    <string name="mime_type_generic_ext" msgid="8450275970061657174">"<xliff:g id="EXTENSION">%1$s</xliff:g>-bestand"</string>
+    <string name="mime_type_audio" msgid="6289777657172050926">"Audio"</string>
+    <string name="mime_type_audio_ext" msgid="3270880987725816210">"<xliff:g id="EXTENSION">%1$s</xliff:g>-audio"</string>
+    <string name="mime_type_video" msgid="4093025777317307426">"Video"</string>
+    <string name="mime_type_video_ext" msgid="5643771615714173159">"<xliff:g id="EXTENSION">%1$s</xliff:g>-video"</string>
+    <string name="mime_type_image" msgid="3144284451605236371">"Afbeelding"</string>
+    <string name="mime_type_image_ext" msgid="1514613218742736590">"<xliff:g id="EXTENSION">%1$s</xliff:g>-afbeelding"</string>
+    <string name="mime_type_compressed" msgid="1645486037074943257">"Archief"</string>
+    <string name="mime_type_compressed_ext" msgid="4232293058067801528">"<xliff:g id="EXTENSION">%1$s</xliff:g>-archief"</string>
+    <string name="mime_type_document" msgid="1596838147256375966">"Document"</string>
+    <string name="mime_type_document_ext" msgid="6327266601345501281">"<xliff:g id="EXTENSION">%1$s</xliff:g>-document"</string>
+    <string name="mime_type_spreadsheet" msgid="2639138255207123557">"Spreadsheet"</string>
+    <string name="mime_type_spreadsheet_ext" msgid="5508653032786106725">"<xliff:g id="EXTENSION">%1$s</xliff:g>-spreadsheet"</string>
+    <string name="mime_type_presentation" msgid="6145604688774787357">"Presentatie"</string>
+    <string name="mime_type_presentation_ext" msgid="2982650207774823437">"<xliff:g id="EXTENSION">%1$s</xliff:g>-presentatie"</string>
     <string name="car_loading_profile" msgid="3545132581795684027">"Laden"</string>
     <plurals name="file_count" formatted="false" msgid="1628600959752419449">
       <item quantity="other"><xliff:g id="FILE_NAME_2">%s</xliff:g> + <xliff:g id="COUNT_3">%d</xliff:g> bestanden</item>
       <item quantity="one"><xliff:g id="FILE_NAME_0">%s</xliff:g> + <xliff:g id="COUNT_1">%d</xliff:g> bestand</item>
     </plurals>
+    <!-- no translation found for chooser_no_direct_share_targets (997970693708458895) -->
+    <skip />
 </resources>
diff --git a/core/res/res/values-or/strings.xml b/core/res/res/values-or/strings.xml
index 1724aea..1607b40 100644
--- a/core/res/res/values-or/strings.xml
+++ b/core/res/res/values-or/strings.xml
@@ -308,15 +308,15 @@
     <string name="permgrouplab_phone" msgid="5229115638567440675">"ଫୋନ୍‍"</string>
     <string name="permgroupdesc_phone" msgid="6234224354060641055">"ଫୋନ୍‍ କଲ୍‍ କରେ ଏବଂ ପରିଚାଳନା କରେ"</string>
     <string name="permgrouprequest_phone" msgid="9166979577750581037">"&lt;b&gt;<xliff:g id="APP_NAME">%1$s</xliff:g>&lt;/b&gt;କୁ ଫୋନ୍‍ କଲ୍‍ କରିବାକୁ ତଥା ପରିଚାଳନା କରିବାକୁ ଅନୁମତି ଦେବେ କି?"</string>
-    <string name="permgrouplab_sensors" msgid="416037179223226722">"ବଡୀ ସେନ୍ସର୍"</string>
+    <string name="permgrouplab_sensors" msgid="4838614103153567532">"ବଡି ସେନ୍ସର୍"</string>
     <string name="permgroupdesc_sensors" msgid="7147968539346634043">"ଆପଣଙ୍କ ଗୁରୁତପୂର୍ଣ୍ଣ ସଂକେତଗୁଡ଼ିକ ବିଷୟରେ ସେନ୍ସର୍‍ ଡାଟା ଆକ୍ସେସ୍‍ କରେ"</string>
     <string name="permgrouprequest_sensors" msgid="6349806962814556786">"&lt;b&gt;<xliff:g id="APP_NAME">%1$s</xliff:g>&lt;/b&gt;କୁ ଆପଣଙ୍କ ଗୁରୁତ୍ୱପୂର୍ଣ୍ଣ ଲକ୍ଷଣଗୁଡ଼ିକ ବିଷୟରେ ସେନ୍ସର୍‍ ଡାଟା ଆକ୍ସେସ୍‍ କରିବା ପାଇଁ ଅନୁମତି ଦେବେ କି?"</string>
     <string name="permgrouplab_aural" msgid="965607064083134896">"ସଙ୍ଗୀତ"</string>
     <string name="permgroupdesc_aural" msgid="4870189506255958055">"ଆପଣଙ୍କ ସଙ୍ଗୀତ ଆକ୍ସେସ୍‍ କରନ୍ତୁ"</string>
     <string name="permgrouprequest_aural" msgid="6787926123071735620">"ଆପଣଙ୍କ ସଙ୍ଗୀତକୁ ଆକ୍ସେସ୍‍ କରିବାକୁ &lt;b&gt;<xliff:g id="APP_NAME">%1$s</xliff:g>&lt;/b&gt;କୁ ଅନୁମତି ଦେବେ କି?"</string>
-    <string name="permgrouplab_visual" msgid="8030190588123857921">"ଫଟୋ ଏବଂ ଭିଡିଓ"</string>
+    <string name="permgrouplab_visual" msgid="6477382108771145134">"ଫଟୋ ଓ ଭିଡିଓ"</string>
     <string name="permgroupdesc_visual" msgid="3415827902566663546">"ଆପଣଙ୍କ ଫଟୋ ଏବଂ ଭିଡିଓ ଆକ୍ସେସ୍‍ କରନ୍ତୁ"</string>
-    <string name="permgrouprequest_visual" msgid="6907523945030290376">"ଆପଣଙ୍କ ଫଟୋ ଏବଂ ଭିଡିଓକୁ Allow &lt;b&gt;<xliff:g id="APP_NAME">%1$s</xliff:g>&lt;/b&gt;ଆକ୍ସେସ୍‍ କରିବାକୁ ଅନୁମତି ଦେବେ କି?"</string>
+    <string name="permgrouprequest_visual" msgid="3043752127595243314">"ଟ୍ୟାଗ୍ କରାଯାଇଥିବା ଲୋକେସନ୍ ସହିତ ଆପଣଙ୍କ ଫଟୋ ଏବଂ ଭିଡିଓ ଆକ୍ସେସ୍ କରିବାକୁ &lt;b&gt;<xliff:g id="APP_NAME">%1$s</xliff:g>&lt;/b&gt; କୁ ଅନୁମତି ଦେବେ କି?"</string>
     <string name="capability_title_canRetrieveWindowContent" msgid="3901717936930170320">"ୱିଣ୍ଡୋ କଣ୍ଟେଣ୍ଟ ହାସଲ କରନ୍ତୁ"</string>
     <string name="capability_desc_canRetrieveWindowContent" msgid="3772225008605310672">"ଆପଣ କାମ କରୁଥିବା ୱିଣ୍ଡୋର କଣ୍ଟେଣ୍ଟକୁ ଯାଞ୍ଚ କରନ୍ତୁ।"</string>
     <string name="capability_title_canRequestTouchExploration" msgid="3108723364676667320">"ସ୍ପର୍ଶ ଦ୍ୱାରା ଏକ୍ସପ୍ଲୋର୍‍ ଅନ୍‍ କରନ୍ତୁ"</string>
@@ -1397,8 +1397,7 @@
     <string name="ext_media_init_action" msgid="7952885510091978278">"ସେଟ୍ ଅପ୍ କରନ୍ତୁ"</string>
     <string name="ext_media_unmount_action" msgid="1121883233103278199">"ବାହାର କରନ୍ତୁ"</string>
     <string name="ext_media_browse_action" msgid="8322172381028546087">"ଖୋଜନ୍ତୁ"</string>
-    <!-- no translation found for ext_media_seamless_action (6575980560886881233) -->
-    <skip />
+    <string name="ext_media_seamless_action" msgid="6575980560886881233">"ଆଉଟ୍‌ପୁଟ୍ ସ୍ୱିଚ୍‌ କରନ୍ତୁ"</string>
     <string name="ext_media_missing_title" msgid="620980315821543904">"<xliff:g id="NAME">%s</xliff:g> ନାହିଁ"</string>
     <string name="ext_media_missing_message" msgid="4012389235250987930">"ଡିଭାଇସ୍‌କୁ ପୁଣି ଭର୍ତ୍ତି କରନ୍ତୁ"</string>
     <string name="ext_media_move_specific_title" msgid="1471100343872375842">"<xliff:g id="NAME">%s</xliff:g> ନିଆଯାଉଛି"</string>
@@ -1612,6 +1611,8 @@
     <string name="display_manager_overlay_display_name" msgid="5142365982271620716">"ପ୍ରାୟତଃ #<xliff:g id="ID">%1$d</xliff:g>"</string>
     <string name="display_manager_overlay_display_title" msgid="652124517672257172">"<xliff:g id="NAME">%1$s</xliff:g>: <xliff:g id="WIDTH">%2$d</xliff:g>x<xliff:g id="HEIGHT">%3$d</xliff:g>, <xliff:g id="DPI">%4$d</xliff:g> dpi"</string>
     <string name="display_manager_overlay_display_secure_suffix" msgid="6022119702628572080">", ସୁରକ୍ଷିତ"</string>
+    <string name="activity_starter_block_bg_activity_starts_permissive" msgid="5692097903712956720">"<xliff:g id="PACKAGENAME">%1$s</xliff:g> ଠାରୁ ଆରମ୍ଭ ହୋଇଥିବା ପୃଷ୍ଠଭୂମି କାର୍ଯ୍ୟକଳାପ ଆଗାମୀ Q ବିଲ୍ଡରେ ବ୍ଲକ୍ କରାଯାଇଛି। go/q-bg-block ଦେଖନ୍ତୁ।"</string>
+    <string name="activity_starter_block_bg_activity_starts_enforcing" msgid="8299522481076404353">"<xliff:g id="PACKAGENAME">%1$s</xliff:g> ଠାରୁ ଆରମ୍ଭ ହୋଇଥିବା ପୃଷ୍ଠଭୂମି କାର୍ଯ୍ୟକଳାପ ବ୍ଲକ୍ କରାଯାଇଛି। go/q-bg-block ଦେଖନ୍ତୁ।"</string>
     <string name="kg_forgot_pattern_button_text" msgid="8852021467868220608">"ପାଟର୍ନ ଭୁଲି ଯାଇଛନ୍ତି"</string>
     <string name="kg_wrong_pattern" msgid="1850806070801358830">"ଭୁଲ ପାଟର୍ନ"</string>
     <string name="kg_wrong_password" msgid="2333281762128113157">"ଭୁଲ ପାସ୍‌ୱର୍ଡ"</string>
@@ -1997,9 +1998,29 @@
     <string name="dynamic_mode_notification_channel_name" msgid="2348803891571320452">"ନିୟମିତ ମୋଡ୍‍ ସୂଚନା ବିଜ୍ଞପ୍ତି"</string>
     <string name="dynamic_mode_notification_title" msgid="508815255807182035">"ସାଧାରଣ ଭାବରେ ଚାର୍ଜ୍ କରିବା ପୂର୍ବରୁ ବ୍ୟାଟେରୀ ସରିଯାଇପାରେ"</string>
     <string name="dynamic_mode_notification_summary" msgid="2541166298550402690">"ବ୍ୟାଟେରୀର ସମୟକୁ ବଢ଼ାଇବା ପାଇଁ ବ୍ୟଟେରୀ ସେଭର୍‍କୁ କାର୍ଯ୍ୟକାରୀ କରାଯାଇଛି"</string>
+    <string name="mime_type_folder" msgid="7111951698626315204">"ଫୋଲ୍ଡର୍"</string>
+    <string name="mime_type_apk" msgid="5518003630972506900">"Android ଆପ୍ଲିକେସନ୍"</string>
+    <string name="mime_type_generic" msgid="6833871596845900027">"ଫାଇଲ୍"</string>
+    <string name="mime_type_generic_ext" msgid="8450275970061657174">"<xliff:g id="EXTENSION">%1$s</xliff:g> ଫାଇଲ୍"</string>
+    <string name="mime_type_audio" msgid="6289777657172050926">"ଅଡିଓ"</string>
+    <string name="mime_type_audio_ext" msgid="3270880987725816210">"<xliff:g id="EXTENSION">%1$s</xliff:g> ଅଡିଓ"</string>
+    <string name="mime_type_video" msgid="4093025777317307426">"ଭିଡିଓ"</string>
+    <string name="mime_type_video_ext" msgid="5643771615714173159">"<xliff:g id="EXTENSION">%1$s</xliff:g> ଭିଡିଓ"</string>
+    <string name="mime_type_image" msgid="3144284451605236371">"ଛବି"</string>
+    <string name="mime_type_image_ext" msgid="1514613218742736590">"<xliff:g id="EXTENSION">%1$s</xliff:g> ଛବି"</string>
+    <string name="mime_type_compressed" msgid="1645486037074943257">"ଆର୍କାଇଭ୍ କରନ୍ତୁ"</string>
+    <string name="mime_type_compressed_ext" msgid="4232293058067801528">"<xliff:g id="EXTENSION">%1$s</xliff:g> ଆର୍କାଇଭ୍"</string>
+    <string name="mime_type_document" msgid="1596838147256375966">"ଡକ୍ୟୁମେଣ୍ଟ"</string>
+    <string name="mime_type_document_ext" msgid="6327266601345501281">"<xliff:g id="EXTENSION">%1$s</xliff:g> ଡକ୍ୟୁମେଣ୍ଟ"</string>
+    <string name="mime_type_spreadsheet" msgid="2639138255207123557">"ସ୍ପ୍ରେଡ୍‍ସିଟ୍"</string>
+    <string name="mime_type_spreadsheet_ext" msgid="5508653032786106725">"<xliff:g id="EXTENSION">%1$s</xliff:g> ସ୍ପ୍ରେଡ୍‌ସିଟ୍"</string>
+    <string name="mime_type_presentation" msgid="6145604688774787357">"ଉପସ୍ଥାପନା"</string>
+    <string name="mime_type_presentation_ext" msgid="2982650207774823437">"<xliff:g id="EXTENSION">%1$s</xliff:g> ଉପସ୍ଥାପନା"</string>
     <string name="car_loading_profile" msgid="3545132581795684027">"ଲୋଡ୍ ହେଉଛି"</string>
     <plurals name="file_count" formatted="false" msgid="1628600959752419449">
       <item quantity="other"><xliff:g id="FILE_NAME_2">%s</xliff:g> + <xliff:g id="COUNT_3">%d</xliff:g>ଟି ଫାଇଲ୍</item>
       <item quantity="one"><xliff:g id="FILE_NAME_0">%s</xliff:g> + <xliff:g id="COUNT_1">%d</xliff:g>ଟି ଫାଇଲ୍</item>
     </plurals>
+    <!-- no translation found for chooser_no_direct_share_targets (997970693708458895) -->
+    <skip />
 </resources>
diff --git a/core/res/res/values-pa/strings.xml b/core/res/res/values-pa/strings.xml
index decb624..421d52f 100644
--- a/core/res/res/values-pa/strings.xml
+++ b/core/res/res/values-pa/strings.xml
@@ -308,15 +308,15 @@
     <string name="permgrouplab_phone" msgid="5229115638567440675">"ਫ਼ੋਨ ਕਰੋ"</string>
     <string name="permgroupdesc_phone" msgid="6234224354060641055">"ਫ਼ੋਨ ਕਾਲਾਂ ਕਰਨ ਅਤੇ ਉਹਨਾਂ ਦਾ ਪ੍ਰਬੰਧਨ ਕਰਨ"</string>
     <string name="permgrouprequest_phone" msgid="9166979577750581037">"ਕੀ &lt;b&gt;<xliff:g id="APP_NAME">%1$s</xliff:g>&lt;/b&gt; ਨੂੰ ਫ਼ੋਨ ਕਾਲਾਂ ਕਰਨ ਅਤੇ ਉਹਨਾਂ ਦਾ ਪ੍ਰਬੰਧਨ ਕਰਨ ਦੇਣਾ ਹੈ?"</string>
-    <string name="permgrouplab_sensors" msgid="416037179223226722">"ਸਰੀਰ ਸੰਵੇਦਕ"</string>
+    <string name="permgrouplab_sensors" msgid="4838614103153567532">"ਸਰੀਰ ਸੰਬੰਧੀ ਸੈਂਸਰ"</string>
     <string name="permgroupdesc_sensors" msgid="7147968539346634043">"ਆਪਣੇ ਸਰੀਰ ਦੇ ਅਹਿਮ ਚਿੰਨ੍ਹਾਂ ਬਾਰੇ ਸੰਵੇਦਕ ਡਾਟਾ ਤੱਕ ਪਹੁੰਚ ਕਰਨ"</string>
     <string name="permgrouprequest_sensors" msgid="6349806962814556786">"ਕੀ &lt;b&gt;<xliff:g id="APP_NAME">%1$s</xliff:g>&lt;/b&gt; ਨੂੰ ਤੁਹਾਡੇ ਸਰੀਰ ਦੇ ਅਹਿਮ ਲੱਛਣਾਂ ਸੰਬੰਧੀ ਸੈਂਸਰ ਡਾਟੇ ਤੱਕ ਪਹੁੰਚ ਕਰਨ ਦੇਣੀ ਹੈ?"</string>
     <string name="permgrouplab_aural" msgid="965607064083134896">"ਸੰਗੀਤ"</string>
     <string name="permgroupdesc_aural" msgid="4870189506255958055">"ਤੁਹਾਡੇ ਸੰਗੀਤ ਤੱਕ ਪਹੁੰਚ"</string>
     <string name="permgrouprequest_aural" msgid="6787926123071735620">"ਕੀ &lt;b&gt;<xliff:g id="APP_NAME">%1$s</xliff:g>&lt;/b&gt; ਨੂੰ ਤੁਹਾਡੇ ਸੰਗੀਤ ਤੱਕ ਪਹੁੰਚ ਕਰਨ ਦੇਣੀ ਹੈ?"</string>
-    <string name="permgrouplab_visual" msgid="8030190588123857921">"ਫ਼ੋਟੋਆਂ ਅਤੇ ਵੀਡੀਓ"</string>
+    <string name="permgrouplab_visual" msgid="6477382108771145134">"ਫ਼ੋਟੋਆਂ ਅਤੇ ਵੀਡੀਓ"</string>
     <string name="permgroupdesc_visual" msgid="3415827902566663546">"ਤੁਹਾਡੀਆਂ ਫ਼ੋਟੋਆਂ ਅਤੇ ਵੀਡੀਓ ਤੱਕ ਪਹੁੰਚ"</string>
-    <string name="permgrouprequest_visual" msgid="6907523945030290376">"ਕੀ &lt;b&gt;<xliff:g id="APP_NAME">%1$s</xliff:g>&lt;/b&gt; ਤੁਹਾਡੀਆਂ ਫ਼ੋਟੋਆਂ ਅਤੇ ਵੀਡੀਓ ਤੱਕ ਪਹੁੰਚ ਕਰਨ ਦੇਣੀ ਹੈ?"</string>
+    <string name="permgrouprequest_visual" msgid="3043752127595243314">"ਕੀ &lt;b&gt;<xliff:g id="APP_NAME">%1$s</xliff:g>&lt;/b&gt; ਨੂੰ ਟੈਗ ਕੀਤੇ ਟਿਕਾਣਿਆਂ ਸਮੇਤ ਤੁਹਾਡੀਆਂ ਫ਼ੋਟੋਆਂ ਅਤੇ ਵੀਡੀਓ ਤੱਕ ਪਹੁੰਚ ਕਰਨ ਦੇਣੀ ਹੈ?"</string>
     <string name="capability_title_canRetrieveWindowContent" msgid="3901717936930170320">"ਵਿੰਡੋ ਸਮੱਗਰੀ ਮੁੜ ਪ੍ਰਾਪਤ ਕਰਨਾ"</string>
     <string name="capability_desc_canRetrieveWindowContent" msgid="3772225008605310672">"ਉਸ ਵਿੰਡੋ ਸਮੱਗਰੀ ਦੀ ਜਾਂਚ ਕਰੋ, ਜਿਸ ਨਾਲ ਤੁਸੀਂ ਅੰਤਰਕਿਰਿਆ ਕਰ ਰਹੇ ਹੋ"</string>
     <string name="capability_title_canRequestTouchExploration" msgid="3108723364676667320">"\'ਸਪੱਰਸ਼ ਰਾਹੀਂ ਪੜਚੋਲ ਕਰੋ\' ਚਾਲੂ ਕਰਨਾ"</string>
@@ -1397,8 +1397,7 @@
     <string name="ext_media_init_action" msgid="7952885510091978278">"ਸਥਾਪਤ ਕਰੋ"</string>
     <string name="ext_media_unmount_action" msgid="1121883233103278199">"ਬਾਹਰ ਕੱਢੋ"</string>
     <string name="ext_media_browse_action" msgid="8322172381028546087">"ਐਕਸਪਲੋਰ ਕਰੋ"</string>
-    <!-- no translation found for ext_media_seamless_action (6575980560886881233) -->
-    <skip />
+    <string name="ext_media_seamless_action" msgid="6575980560886881233">"ਆਊਟਪੁੱਟ ਬਦਲੋ"</string>
     <string name="ext_media_missing_title" msgid="620980315821543904">"<xliff:g id="NAME">%s</xliff:g> ਲਾਪਤਾ"</string>
     <string name="ext_media_missing_message" msgid="4012389235250987930">"ਦੁਬਾਰਾ ਡੀਵਾਈਸ ਸ਼ਾਮਲ ਕਰੋ"</string>
     <string name="ext_media_move_specific_title" msgid="1471100343872375842">"<xliff:g id="NAME">%s</xliff:g> ਮੂਵ ਕਰ ਰਿਹਾ ਹੈ"</string>
@@ -1612,6 +1611,8 @@
     <string name="display_manager_overlay_display_name" msgid="5142365982271620716">"ਓਵਰਲੇ #<xliff:g id="ID">%1$d</xliff:g>"</string>
     <string name="display_manager_overlay_display_title" msgid="652124517672257172">"<xliff:g id="NAME">%1$s</xliff:g>: <xliff:g id="WIDTH">%2$d</xliff:g>x<xliff:g id="HEIGHT">%3$d</xliff:g>, <xliff:g id="DPI">%4$d</xliff:g> dpi"</string>
     <string name="display_manager_overlay_display_secure_suffix" msgid="6022119702628572080">", ਸੁਰੱਖਿਅਤ"</string>
+    <string name="activity_starter_block_bg_activity_starts_permissive" msgid="5692097903712956720">"ਇਹ ਬੈਕਗ੍ਰਾਊਂਡ ਸਰਗਰਮੀ <xliff:g id="PACKAGENAME">%1$s</xliff:g> ਤੋਂ ਸ਼ੁਰੂ ਹੋ ਕੇ ਭਵਿੱਖ ਦੇ Q ਬਿਲਡ ਵਿੱਚ ਬਲਾਕ ਕੀਤੀ ਜਾਵੇਗੀ। go/q-bg-block ਦੇਖੋ।"</string>
+    <string name="activity_starter_block_bg_activity_starts_enforcing" msgid="8299522481076404353">"<xliff:g id="PACKAGENAME">%1$s</xliff:g> ਬਲਾਕ ਕਰਕੇ ਬੈਕਗ੍ਰਾਊਂਡ ਸਰਗਰਮੀ ਸ਼ੁਰੂ ਕੀਤੀ ਗਈ। go/q-bg-block ਦੇਖੋ।"</string>
     <string name="kg_forgot_pattern_button_text" msgid="8852021467868220608">"ਪੈਟਰਨ ਭੁੱਲ ਗਏ"</string>
     <string name="kg_wrong_pattern" msgid="1850806070801358830">"ਗ਼ਲਤ ਪੈਟਰਨ"</string>
     <string name="kg_wrong_password" msgid="2333281762128113157">"ਗਲਤ ਪਾਸਵਰਡ"</string>
@@ -1997,9 +1998,29 @@
     <string name="dynamic_mode_notification_channel_name" msgid="2348803891571320452">"ਨਿਯਮਬੱਧ ਮੋਡ ਦੀ ਜਾਣਕਾਰੀ ਵਾਲੀ ਸੂਚਨਾ"</string>
     <string name="dynamic_mode_notification_title" msgid="508815255807182035">"ਬੈਟਰੀ ਚਾਰਜ ਕਰਨ ਦੇ ਮਿੱਥੇ ਸਮੇਂ ਤੋਂ ਪਹਿਲਾਂ ਸ਼ਾਇਦ ਬੈਟਰੀ ਖਤਮ ਹੋ ਜਾਵੇ"</string>
     <string name="dynamic_mode_notification_summary" msgid="2541166298550402690">"ਬੈਟਰੀ ਲਾਈਫ਼ ਵਧਾਉਣ ਲਈ ਬੈਟਰੀ ਸੇਵਰ ਚਾਲੂ ਕੀਤਾ ਗਿਆ"</string>
+    <string name="mime_type_folder" msgid="7111951698626315204">"ਫੋਲਡਰ"</string>
+    <string name="mime_type_apk" msgid="5518003630972506900">"Android ਐਪਲੀਕੇਸ਼ਨ"</string>
+    <string name="mime_type_generic" msgid="6833871596845900027">"ਫ਼ਾਈਲ"</string>
+    <string name="mime_type_generic_ext" msgid="8450275970061657174">"<xliff:g id="EXTENSION">%1$s</xliff:g> ਫ਼ਾਈਲ"</string>
+    <string name="mime_type_audio" msgid="6289777657172050926">"ਆਡੀਓ"</string>
+    <string name="mime_type_audio_ext" msgid="3270880987725816210">"<xliff:g id="EXTENSION">%1$s</xliff:g> ਆਡੀਓ"</string>
+    <string name="mime_type_video" msgid="4093025777317307426">"ਵੀਡੀਓ"</string>
+    <string name="mime_type_video_ext" msgid="5643771615714173159">"<xliff:g id="EXTENSION">%1$s</xliff:g> ਵੀਡੀਓ"</string>
+    <string name="mime_type_image" msgid="3144284451605236371">"ਚਿੱਤਰ"</string>
+    <string name="mime_type_image_ext" msgid="1514613218742736590">"<xliff:g id="EXTENSION">%1$s</xliff:g> ਚਿੱਤਰ"</string>
+    <string name="mime_type_compressed" msgid="1645486037074943257">"ਪੁਰਾਲੇਖਬੱਧ ਕਰੋ"</string>
+    <string name="mime_type_compressed_ext" msgid="4232293058067801528">"<xliff:g id="EXTENSION">%1$s</xliff:g> ਪੁਰਾਲੇਖਬੱਧ ਕਰੋ"</string>
+    <string name="mime_type_document" msgid="1596838147256375966">"ਦਸਤਾਵੇਜ਼"</string>
+    <string name="mime_type_document_ext" msgid="6327266601345501281">"<xliff:g id="EXTENSION">%1$s</xliff:g> ਦਸਤਾਵੇਜ਼"</string>
+    <string name="mime_type_spreadsheet" msgid="2639138255207123557">"ਸਪਰੈੱਡਸ਼ੀਟ"</string>
+    <string name="mime_type_spreadsheet_ext" msgid="5508653032786106725">"<xliff:g id="EXTENSION">%1$s</xliff:g> ਸਪਰੈੱਡਸ਼ੀਟ"</string>
+    <string name="mime_type_presentation" msgid="6145604688774787357">"ਪੇਸ਼ਕਾਰੀ"</string>
+    <string name="mime_type_presentation_ext" msgid="2982650207774823437">"<xliff:g id="EXTENSION">%1$s</xliff:g> ਪੇਸ਼ਕਾਰੀ"</string>
     <string name="car_loading_profile" msgid="3545132581795684027">"ਲੋਡ ਕੀਤਾ ਜਾ ਰਿਹਾ ਹੈ"</string>
     <plurals name="file_count" formatted="false" msgid="1628600959752419449">
       <item quantity="one"><xliff:g id="FILE_NAME_2">%s</xliff:g> + <xliff:g id="COUNT_3">%d</xliff:g> ਫ਼ਾਈਲ</item>
       <item quantity="other"><xliff:g id="FILE_NAME_2">%s</xliff:g> + <xliff:g id="COUNT_3">%d</xliff:g> ਫ਼ਾਈਲਾਂ</item>
     </plurals>
+    <!-- no translation found for chooser_no_direct_share_targets (997970693708458895) -->
+    <skip />
 </resources>
diff --git a/core/res/res/values-pl/strings.xml b/core/res/res/values-pl/strings.xml
index 3e3ee3c..674ccb0 100644
--- a/core/res/res/values-pl/strings.xml
+++ b/core/res/res/values-pl/strings.xml
@@ -314,15 +314,15 @@
     <string name="permgrouplab_phone" msgid="5229115638567440675">"Telefon"</string>
     <string name="permgroupdesc_phone" msgid="6234224354060641055">"nawiązywanie połączeń telefonicznych i zarządzanie nimi"</string>
     <string name="permgrouprequest_phone" msgid="9166979577750581037">"Zezwolić aplikacji &lt;b&gt;<xliff:g id="APP_NAME">%1$s</xliff:g>&lt;/b&gt; na wykonywanie połączeń telefonicznych i zarządzanie nimi?"</string>
-    <string name="permgrouplab_sensors" msgid="416037179223226722">"Czujniki na ciele"</string>
+    <string name="permgrouplab_sensors" msgid="4838614103153567532">"Czujniki na ciele"</string>
     <string name="permgroupdesc_sensors" msgid="7147968539346634043">"dostęp do danych czujnika podstawowych funkcji życiowych"</string>
     <string name="permgrouprequest_sensors" msgid="6349806962814556786">"Zezwolić aplikacji &lt;b&gt;<xliff:g id="APP_NAME">%1$s</xliff:g>&lt;/b&gt; na dostęp do danych z czujnika podstawowych funkcji życiowych?"</string>
     <string name="permgrouplab_aural" msgid="965607064083134896">"Muzyka"</string>
     <string name="permgroupdesc_aural" msgid="4870189506255958055">"dostęp do muzyki"</string>
     <string name="permgrouprequest_aural" msgid="6787926123071735620">"Zezwolić aplikacji &lt;b&gt;<xliff:g id="APP_NAME">%1$s</xliff:g>&lt;/b&gt; na dostęp do muzyki?"</string>
-    <string name="permgrouplab_visual" msgid="8030190588123857921">"Zdjęcia i filmy"</string>
+    <string name="permgrouplab_visual" msgid="6477382108771145134">"Zdjęcia i filmy"</string>
     <string name="permgroupdesc_visual" msgid="3415827902566663546">"dostęp do zdjęć i filmów"</string>
-    <string name="permgrouprequest_visual" msgid="6907523945030290376">"Zezwolić aplikacji &lt;b&gt;<xliff:g id="APP_NAME">%1$s</xliff:g>&lt;/b&gt; na dostęp do zdjęć i filmów?"</string>
+    <string name="permgrouprequest_visual" msgid="3043752127595243314">"Zezwolić aplikacji „<xliff:g id="APP_NAME">%1$s</xliff:g>” na dostęp do Twoich zdjęć i filmów, w tym do otagowanych lokalizacji?"</string>
     <string name="capability_title_canRetrieveWindowContent" msgid="3901717936930170320">"Pobieranie zawartości okna"</string>
     <string name="capability_desc_canRetrieveWindowContent" msgid="3772225008605310672">"Sprawdzanie zawartości okna, z którego korzystasz."</string>
     <string name="capability_title_canRequestTouchExploration" msgid="3108723364676667320">"Włączenie czytania dotykiem"</string>
@@ -1440,8 +1440,7 @@
     <string name="ext_media_init_action" msgid="7952885510091978278">"Skonfiguruj"</string>
     <string name="ext_media_unmount_action" msgid="1121883233103278199">"Odłącz"</string>
     <string name="ext_media_browse_action" msgid="8322172381028546087">"Przeglądaj"</string>
-    <!-- no translation found for ext_media_seamless_action (6575980560886881233) -->
-    <skip />
+    <string name="ext_media_seamless_action" msgid="6575980560886881233">"Przełącz urządzenie wyjściowe"</string>
     <string name="ext_media_missing_title" msgid="620980315821543904">"Brak: <xliff:g id="NAME">%s</xliff:g>"</string>
     <string name="ext_media_missing_message" msgid="4012389235250987930">"Włóż nośnik ponownie"</string>
     <string name="ext_media_move_specific_title" msgid="1471100343872375842">"Przenoszę <xliff:g id="NAME">%s</xliff:g>"</string>
@@ -1657,6 +1656,8 @@
     <string name="display_manager_overlay_display_name" msgid="5142365982271620716">"Nakładka nr <xliff:g id="ID">%1$d</xliff:g>"</string>
     <string name="display_manager_overlay_display_title" msgid="652124517672257172">"<xliff:g id="NAME">%1$s</xliff:g>: <xliff:g id="WIDTH">%2$d</xliff:g> x <xliff:g id="HEIGHT">%3$d</xliff:g>, <xliff:g id="DPI">%4$d</xliff:g> dpi"</string>
     <string name="display_manager_overlay_display_secure_suffix" msgid="6022119702628572080">", bezpieczny"</string>
+    <string name="activity_starter_block_bg_activity_starts_permissive" msgid="5692097903712956720">"Rozpoczęcie tej aktywności w tle przez pakiet <xliff:g id="PACKAGENAME">%1$s</xliff:g> zostanie zablokowane w przyszłych kompilacjach Q. Więcej informacji: go/q-bg-block."</string>
+    <string name="activity_starter_block_bg_activity_starts_enforcing" msgid="8299522481076404353">"Rozpoczęcie aktywności w tle przez pakiet <xliff:g id="PACKAGENAME">%1$s</xliff:g> zostało zablokowane. Więcej informacji: go/q-bg-block."</string>
     <string name="kg_forgot_pattern_button_text" msgid="8852021467868220608">"Nie pamiętam wzoru"</string>
     <string name="kg_wrong_pattern" msgid="1850806070801358830">"Nieprawidłowy wzór"</string>
     <string name="kg_wrong_password" msgid="2333281762128113157">"Nieprawidłowe hasło"</string>
@@ -2066,6 +2067,24 @@
     <string name="dynamic_mode_notification_channel_name" msgid="2348803891571320452">"Powiadomienie z informacją o trybie rutynowym"</string>
     <string name="dynamic_mode_notification_title" msgid="508815255807182035">"Bateria może się wyczerpać przed zwykłą porą ładowania"</string>
     <string name="dynamic_mode_notification_summary" msgid="2541166298550402690">"Włączono Oszczędzanie baterii, by wydłużyć czas pracy na baterii"</string>
+    <string name="mime_type_folder" msgid="7111951698626315204">"Folder"</string>
+    <string name="mime_type_apk" msgid="5518003630972506900">"Aplikacja na Androida"</string>
+    <string name="mime_type_generic" msgid="6833871596845900027">"Plik"</string>
+    <string name="mime_type_generic_ext" msgid="8450275970061657174">"Plik <xliff:g id="EXTENSION">%1$s</xliff:g>"</string>
+    <string name="mime_type_audio" msgid="6289777657172050926">"Plik audio"</string>
+    <string name="mime_type_audio_ext" msgid="3270880987725816210">"Plik audio <xliff:g id="EXTENSION">%1$s</xliff:g>"</string>
+    <string name="mime_type_video" msgid="4093025777317307426">"Plik wideo"</string>
+    <string name="mime_type_video_ext" msgid="5643771615714173159">"Plik wideo <xliff:g id="EXTENSION">%1$s</xliff:g>"</string>
+    <string name="mime_type_image" msgid="3144284451605236371">"Obraz"</string>
+    <string name="mime_type_image_ext" msgid="1514613218742736590">"Grafika <xliff:g id="EXTENSION">%1$s</xliff:g>"</string>
+    <string name="mime_type_compressed" msgid="1645486037074943257">"Archiwum"</string>
+    <string name="mime_type_compressed_ext" msgid="4232293058067801528">"Archiwum <xliff:g id="EXTENSION">%1$s</xliff:g>"</string>
+    <string name="mime_type_document" msgid="1596838147256375966">"Dokument"</string>
+    <string name="mime_type_document_ext" msgid="6327266601345501281">"Dokument <xliff:g id="EXTENSION">%1$s</xliff:g>"</string>
+    <string name="mime_type_spreadsheet" msgid="2639138255207123557">"Arkusz kalkulacyjny"</string>
+    <string name="mime_type_spreadsheet_ext" msgid="5508653032786106725">"Arkusz kalkulacyjny <xliff:g id="EXTENSION">%1$s</xliff:g>"</string>
+    <string name="mime_type_presentation" msgid="6145604688774787357">"Prezentacja"</string>
+    <string name="mime_type_presentation_ext" msgid="2982650207774823437">"Prezentacja <xliff:g id="EXTENSION">%1$s</xliff:g>"</string>
     <string name="car_loading_profile" msgid="3545132581795684027">"Ładuję"</string>
     <plurals name="file_count" formatted="false" msgid="1628600959752419449">
       <item quantity="few"><xliff:g id="FILE_NAME_2">%s</xliff:g> + <xliff:g id="COUNT_3">%d</xliff:g> pliki</item>
@@ -2073,4 +2092,6 @@
       <item quantity="other"><xliff:g id="FILE_NAME_2">%s</xliff:g> + <xliff:g id="COUNT_3">%d</xliff:g> pliku</item>
       <item quantity="one"><xliff:g id="FILE_NAME_0">%s</xliff:g> + <xliff:g id="COUNT_1">%d</xliff:g> plik</item>
     </plurals>
+    <!-- no translation found for chooser_no_direct_share_targets (997970693708458895) -->
+    <skip />
 </resources>
diff --git a/core/res/res/values-pt-rBR/strings.xml b/core/res/res/values-pt-rBR/strings.xml
index c51a06e..9a078f8 100644
--- a/core/res/res/values-pt-rBR/strings.xml
+++ b/core/res/res/values-pt-rBR/strings.xml
@@ -308,15 +308,15 @@
     <string name="permgrouplab_phone" msgid="5229115638567440675">"Telefone"</string>
     <string name="permgroupdesc_phone" msgid="6234224354060641055">"faça e gerencie chamadas telefônicas"</string>
     <string name="permgrouprequest_phone" msgid="9166979577750581037">"Permitir que &lt;b&gt;<xliff:g id="APP_NAME">%1$s</xliff:g>&lt;/b&gt; gerencie e faça chamadas telefônicas?"</string>
-    <string name="permgrouplab_sensors" msgid="416037179223226722">"Sensores corporais"</string>
+    <string name="permgrouplab_sensors" msgid="4838614103153567532">"Sensores corporais"</string>
     <string name="permgroupdesc_sensors" msgid="7147968539346634043">"acesse dados do sensor sobre seus sinais vitais"</string>
     <string name="permgrouprequest_sensors" msgid="6349806962814556786">"Permitir que &lt;b&gt;<xliff:g id="APP_NAME">%1$s</xliff:g>&lt;/b&gt; acesse os dados do sensor sobre seus sinais vitais?"</string>
     <string name="permgrouplab_aural" msgid="965607064083134896">"Músicas"</string>
     <string name="permgroupdesc_aural" msgid="4870189506255958055">"acessar suas músicas"</string>
     <string name="permgrouprequest_aural" msgid="6787926123071735620">"Permitir que o app &lt;b&gt;<xliff:g id="APP_NAME">%1$s</xliff:g>&lt;/b&gt; acesse suas músicas?"</string>
-    <string name="permgrouplab_visual" msgid="8030190588123857921">"Fotos e vídeos"</string>
+    <string name="permgrouplab_visual" msgid="6477382108771145134">"Fotos e vídeos"</string>
     <string name="permgroupdesc_visual" msgid="3415827902566663546">"acessar suas fotos e seus vídeos"</string>
-    <string name="permgrouprequest_visual" msgid="6907523945030290376">"Permitir que o app &lt;b&gt;<xliff:g id="APP_NAME">%1$s</xliff:g>&lt;/b&gt; acesse suas fotos e seus vídeos?"</string>
+    <string name="permgrouprequest_visual" msgid="3043752127595243314">"Permitir que o app &lt;b&gt;<xliff:g id="APP_NAME">%1$s</xliff:g>&lt;/b&gt; acesse seus vídeos e fotos, incluindo os locais marcados?"</string>
     <string name="capability_title_canRetrieveWindowContent" msgid="3901717936930170320">"Acessar conteúdo de uma janela"</string>
     <string name="capability_desc_canRetrieveWindowContent" msgid="3772225008605310672">"Inspeciona o conteúdo de uma janela com a qual você está interagindo."</string>
     <string name="capability_title_canRequestTouchExploration" msgid="3108723364676667320">"Ativar Explorar por toque"</string>
@@ -1396,8 +1396,7 @@
     <string name="ext_media_init_action" msgid="7952885510091978278">"Configurar"</string>
     <string name="ext_media_unmount_action" msgid="1121883233103278199">"Ejetar"</string>
     <string name="ext_media_browse_action" msgid="8322172381028546087">"Explorar"</string>
-    <!-- no translation found for ext_media_seamless_action (6575980560886881233) -->
-    <skip />
+    <string name="ext_media_seamless_action" msgid="6575980560886881233">"Alterar saída"</string>
     <string name="ext_media_missing_title" msgid="620980315821543904">"<xliff:g id="NAME">%s</xliff:g> ausente"</string>
     <string name="ext_media_missing_message" msgid="4012389235250987930">"Insira o dispositivo novamente"</string>
     <string name="ext_media_move_specific_title" msgid="1471100343872375842">"Movendo <xliff:g id="NAME">%s</xliff:g>"</string>
@@ -1611,6 +1610,8 @@
     <string name="display_manager_overlay_display_name" msgid="5142365982271620716">"Sobreposição nº <xliff:g id="ID">%1$d</xliff:g>"</string>
     <string name="display_manager_overlay_display_title" msgid="652124517672257172">"<xliff:g id="NAME">%1$s</xliff:g>: <xliff:g id="WIDTH">%2$d</xliff:g>x<xliff:g id="HEIGHT">%3$d</xliff:g>, <xliff:g id="DPI">%4$d</xliff:g> dpi"</string>
     <string name="display_manager_overlay_display_secure_suffix" msgid="6022119702628572080">", seguro"</string>
+    <string name="activity_starter_block_bg_activity_starts_permissive" msgid="5692097903712956720">"Esse início de atividade em segundo plano de <xliff:g id="PACKAGENAME">%1$s</xliff:g> será bloqueado nas versões futuras do Android Q. Consulte go/q-bg-block."</string>
+    <string name="activity_starter_block_bg_activity_starts_enforcing" msgid="8299522481076404353">"O início da atividade em segundo plano de <xliff:g id="PACKAGENAME">%1$s</xliff:g> foi bloqueado. Consulte go/q-bg-block."</string>
     <string name="kg_forgot_pattern_button_text" msgid="8852021467868220608">"Esqueci o padrão"</string>
     <string name="kg_wrong_pattern" msgid="1850806070801358830">"Padrão incorreto"</string>
     <string name="kg_wrong_password" msgid="2333281762128113157">"Senha incorreta"</string>
@@ -1996,9 +1997,29 @@
     <string name="dynamic_mode_notification_channel_name" msgid="2348803891571320452">"Notificação de informação do modo rotina"</string>
     <string name="dynamic_mode_notification_title" msgid="508815255807182035">"A bateria pode acabar antes da recarga normal"</string>
     <string name="dynamic_mode_notification_summary" msgid="2541166298550402690">"A \"Economia de bateria\" foi ativada para aumentar a duração da carga"</string>
+    <string name="mime_type_folder" msgid="7111951698626315204">"Pasta"</string>
+    <string name="mime_type_apk" msgid="5518003630972506900">"Aplicativo Android"</string>
+    <string name="mime_type_generic" msgid="6833871596845900027">"Arquivo"</string>
+    <string name="mime_type_generic_ext" msgid="8450275970061657174">"Arquivo em <xliff:g id="EXTENSION">%1$s</xliff:g>"</string>
+    <string name="mime_type_audio" msgid="6289777657172050926">"Áudio"</string>
+    <string name="mime_type_audio_ext" msgid="3270880987725816210">"Áudio em <xliff:g id="EXTENSION">%1$s</xliff:g>"</string>
+    <string name="mime_type_video" msgid="4093025777317307426">"Vídeo"</string>
+    <string name="mime_type_video_ext" msgid="5643771615714173159">"Vídeo em <xliff:g id="EXTENSION">%1$s</xliff:g>"</string>
+    <string name="mime_type_image" msgid="3144284451605236371">"Imagem"</string>
+    <string name="mime_type_image_ext" msgid="1514613218742736590">"Imagem <xliff:g id="EXTENSION">%1$s</xliff:g>"</string>
+    <string name="mime_type_compressed" msgid="1645486037074943257">"Arquivo"</string>
+    <string name="mime_type_compressed_ext" msgid="4232293058067801528">"Arquivo <xliff:g id="EXTENSION">%1$s</xliff:g>"</string>
+    <string name="mime_type_document" msgid="1596838147256375966">"Documento"</string>
+    <string name="mime_type_document_ext" msgid="6327266601345501281">"Documento em <xliff:g id="EXTENSION">%1$s</xliff:g>"</string>
+    <string name="mime_type_spreadsheet" msgid="2639138255207123557">"Planilha"</string>
+    <string name="mime_type_spreadsheet_ext" msgid="5508653032786106725">"Planilha em <xliff:g id="EXTENSION">%1$s</xliff:g>"</string>
+    <string name="mime_type_presentation" msgid="6145604688774787357">"Apresentação"</string>
+    <string name="mime_type_presentation_ext" msgid="2982650207774823437">"Apresentação em <xliff:g id="EXTENSION">%1$s</xliff:g>"</string>
     <string name="car_loading_profile" msgid="3545132581795684027">"Carregando"</string>
     <plurals name="file_count" formatted="false" msgid="1628600959752419449">
       <item quantity="one"><xliff:g id="FILE_NAME_2">%s</xliff:g> + <xliff:g id="COUNT_3">%d</xliff:g> arquivo</item>
       <item quantity="other"><xliff:g id="FILE_NAME_2">%s</xliff:g> + <xliff:g id="COUNT_3">%d</xliff:g> arquivos</item>
     </plurals>
+    <!-- no translation found for chooser_no_direct_share_targets (997970693708458895) -->
+    <skip />
 </resources>
diff --git a/core/res/res/values-pt-rPT/strings.xml b/core/res/res/values-pt-rPT/strings.xml
index a68b865..ecaff4d 100644
--- a/core/res/res/values-pt-rPT/strings.xml
+++ b/core/res/res/values-pt-rPT/strings.xml
@@ -308,15 +308,15 @@
     <string name="permgrouplab_phone" msgid="5229115638567440675">"Telemóvel"</string>
     <string name="permgroupdesc_phone" msgid="6234224354060641055">"fazer e gerir chamadas"</string>
     <string name="permgrouprequest_phone" msgid="9166979577750581037">"Pretende permitir que a aplicação &lt;b&gt;<xliff:g id="APP_NAME">%1$s</xliff:g>&lt;/b&gt; faça e gira chamadas telefónicas?"</string>
-    <string name="permgrouplab_sensors" msgid="416037179223226722">"Sensores de corpo"</string>
+    <string name="permgrouplab_sensors" msgid="4838614103153567532">"Sensores de corpo"</string>
     <string name="permgroupdesc_sensors" msgid="7147968539346634043">"aceder a dados do sensor acerca dos seus sinais vitais"</string>
     <string name="permgrouprequest_sensors" msgid="6349806962814556786">"Pretende permitir que a aplicação &lt;b&gt;<xliff:g id="APP_NAME">%1$s</xliff:g>&lt;/b&gt; aceda aos dados do sensor acerca dos seus sinais vitais?"</string>
     <string name="permgrouplab_aural" msgid="965607064083134896">"Música"</string>
     <string name="permgroupdesc_aural" msgid="4870189506255958055">"aceder à sua música"</string>
     <string name="permgrouprequest_aural" msgid="6787926123071735620">"Pretende permitir que a aplicação &lt;b&gt;<xliff:g id="APP_NAME">%1$s</xliff:g>&lt;/b&gt; aceda à sua música?"</string>
-    <string name="permgrouplab_visual" msgid="8030190588123857921">"Fotos e vídeos"</string>
+    <string name="permgrouplab_visual" msgid="6477382108771145134">"Fotos e vídeos"</string>
     <string name="permgroupdesc_visual" msgid="3415827902566663546">"aceder aos seus vídeos e fotos"</string>
-    <string name="permgrouprequest_visual" msgid="6907523945030290376">"Pretende permitir que a aplicação &lt;b&gt;<xliff:g id="APP_NAME">%1$s</xliff:g>&lt;/b&gt; aceda às suas fotos e vídeos?"</string>
+    <string name="permgrouprequest_visual" msgid="3043752127595243314">"Pretende permitir que a aplicação &lt;b&gt;<xliff:g id="APP_NAME">%1$s</xliff:g>&lt;/b&gt; aceda aos seus vídeos e fotos, incluindo localizações etiquetadas?"</string>
     <string name="capability_title_canRetrieveWindowContent" msgid="3901717936930170320">"Obter conteúdo da janela"</string>
     <string name="capability_desc_canRetrieveWindowContent" msgid="3772225008605310672">"Inspecionar o conteúdo de uma janela com a qual está a interagir."</string>
     <string name="capability_title_canRequestTouchExploration" msgid="3108723364676667320">"Ativar Explorar Através do Toque"</string>
@@ -1396,8 +1396,7 @@
     <string name="ext_media_init_action" msgid="7952885510091978278">"Configurar"</string>
     <string name="ext_media_unmount_action" msgid="1121883233103278199">"Ejetar"</string>
     <string name="ext_media_browse_action" msgid="8322172381028546087">"Explorar"</string>
-    <!-- no translation found for ext_media_seamless_action (6575980560886881233) -->
-    <skip />
+    <string name="ext_media_seamless_action" msgid="6575980560886881233">"Saída do interruptor"</string>
     <string name="ext_media_missing_title" msgid="620980315821543904">"<xliff:g id="NAME">%s</xliff:g> em falta"</string>
     <string name="ext_media_missing_message" msgid="4012389235250987930">"Volte a inserir o dispositivo."</string>
     <string name="ext_media_move_specific_title" msgid="1471100343872375842">"A mover <xliff:g id="NAME">%s</xliff:g>"</string>
@@ -1611,6 +1610,8 @@
     <string name="display_manager_overlay_display_name" msgid="5142365982271620716">"Sobreposição #<xliff:g id="ID">%1$d</xliff:g>"</string>
     <string name="display_manager_overlay_display_title" msgid="652124517672257172">"<xliff:g id="NAME">%1$s</xliff:g>: <xliff:g id="WIDTH">%2$d</xliff:g>x<xliff:g id="HEIGHT">%3$d</xliff:g>, <xliff:g id="DPI">%4$d</xliff:g> ppp"</string>
     <string name="display_manager_overlay_display_secure_suffix" msgid="6022119702628572080">", protegido"</string>
+    <string name="activity_starter_block_bg_activity_starts_permissive" msgid="5692097903712956720">"Este início da atividade em segundo plano do pacote <xliff:g id="PACKAGENAME">%1$s</xliff:g> será bloqueado em compilações Q futuras. Aceda a go/q-bg-block."</string>
+    <string name="activity_starter_block_bg_activity_starts_enforcing" msgid="8299522481076404353">"Início da atividade em segundo plano do pacote <xliff:g id="PACKAGENAME">%1$s</xliff:g> bloqueado. Aceda a go/q-bg-block."</string>
     <string name="kg_forgot_pattern_button_text" msgid="8852021467868220608">"Esqueceu-se da Sequência"</string>
     <string name="kg_wrong_pattern" msgid="1850806070801358830">"Sequência Incorreta"</string>
     <string name="kg_wrong_password" msgid="2333281762128113157">"Palavra-passe Incorreta"</string>
@@ -1996,9 +1997,29 @@
     <string name="dynamic_mode_notification_channel_name" msgid="2348803891571320452">"Notificação de informações do Modo rotina"</string>
     <string name="dynamic_mode_notification_title" msgid="508815255807182035">"Pode ficar sem bateria antes do carregamento habitual"</string>
     <string name="dynamic_mode_notification_summary" msgid="2541166298550402690">"Poupança de bateria ativada para prolongar a duração da bateria"</string>
+    <string name="mime_type_folder" msgid="7111951698626315204">"Pasta"</string>
+    <string name="mime_type_apk" msgid="5518003630972506900">"Aplicação para Android"</string>
+    <string name="mime_type_generic" msgid="6833871596845900027">"Ficheiro"</string>
+    <string name="mime_type_generic_ext" msgid="8450275970061657174">"Ficheiro <xliff:g id="EXTENSION">%1$s</xliff:g>"</string>
+    <string name="mime_type_audio" msgid="6289777657172050926">"Áudio"</string>
+    <string name="mime_type_audio_ext" msgid="3270880987725816210">"Áudio <xliff:g id="EXTENSION">%1$s</xliff:g>"</string>
+    <string name="mime_type_video" msgid="4093025777317307426">"Vídeo"</string>
+    <string name="mime_type_video_ext" msgid="5643771615714173159">"Vídeo <xliff:g id="EXTENSION">%1$s</xliff:g>"</string>
+    <string name="mime_type_image" msgid="3144284451605236371">"Imagem"</string>
+    <string name="mime_type_image_ext" msgid="1514613218742736590">"Imagem <xliff:g id="EXTENSION">%1$s</xliff:g>"</string>
+    <string name="mime_type_compressed" msgid="1645486037074943257">"Arquivo"</string>
+    <string name="mime_type_compressed_ext" msgid="4232293058067801528">"Arquivo <xliff:g id="EXTENSION">%1$s</xliff:g>"</string>
+    <string name="mime_type_document" msgid="1596838147256375966">"Documento"</string>
+    <string name="mime_type_document_ext" msgid="6327266601345501281">"Documento <xliff:g id="EXTENSION">%1$s</xliff:g>"</string>
+    <string name="mime_type_spreadsheet" msgid="2639138255207123557">"Folha de cálculo"</string>
+    <string name="mime_type_spreadsheet_ext" msgid="5508653032786106725">"Folha de cálculo <xliff:g id="EXTENSION">%1$s</xliff:g>"</string>
+    <string name="mime_type_presentation" msgid="6145604688774787357">"Apresentação"</string>
+    <string name="mime_type_presentation_ext" msgid="2982650207774823437">"Apresentação <xliff:g id="EXTENSION">%1$s</xliff:g>"</string>
     <string name="car_loading_profile" msgid="3545132581795684027">"A carregar…"</string>
     <plurals name="file_count" formatted="false" msgid="1628600959752419449">
       <item quantity="other"><xliff:g id="FILE_NAME_2">%s</xliff:g> + <xliff:g id="COUNT_3">%d</xliff:g> ficheiros</item>
       <item quantity="one"><xliff:g id="FILE_NAME_0">%s</xliff:g> + <xliff:g id="COUNT_1">%d</xliff:g> ficheiro</item>
     </plurals>
+    <!-- no translation found for chooser_no_direct_share_targets (997970693708458895) -->
+    <skip />
 </resources>
diff --git a/core/res/res/values-pt/strings.xml b/core/res/res/values-pt/strings.xml
index c51a06e..9a078f8 100644
--- a/core/res/res/values-pt/strings.xml
+++ b/core/res/res/values-pt/strings.xml
@@ -308,15 +308,15 @@
     <string name="permgrouplab_phone" msgid="5229115638567440675">"Telefone"</string>
     <string name="permgroupdesc_phone" msgid="6234224354060641055">"faça e gerencie chamadas telefônicas"</string>
     <string name="permgrouprequest_phone" msgid="9166979577750581037">"Permitir que &lt;b&gt;<xliff:g id="APP_NAME">%1$s</xliff:g>&lt;/b&gt; gerencie e faça chamadas telefônicas?"</string>
-    <string name="permgrouplab_sensors" msgid="416037179223226722">"Sensores corporais"</string>
+    <string name="permgrouplab_sensors" msgid="4838614103153567532">"Sensores corporais"</string>
     <string name="permgroupdesc_sensors" msgid="7147968539346634043">"acesse dados do sensor sobre seus sinais vitais"</string>
     <string name="permgrouprequest_sensors" msgid="6349806962814556786">"Permitir que &lt;b&gt;<xliff:g id="APP_NAME">%1$s</xliff:g>&lt;/b&gt; acesse os dados do sensor sobre seus sinais vitais?"</string>
     <string name="permgrouplab_aural" msgid="965607064083134896">"Músicas"</string>
     <string name="permgroupdesc_aural" msgid="4870189506255958055">"acessar suas músicas"</string>
     <string name="permgrouprequest_aural" msgid="6787926123071735620">"Permitir que o app &lt;b&gt;<xliff:g id="APP_NAME">%1$s</xliff:g>&lt;/b&gt; acesse suas músicas?"</string>
-    <string name="permgrouplab_visual" msgid="8030190588123857921">"Fotos e vídeos"</string>
+    <string name="permgrouplab_visual" msgid="6477382108771145134">"Fotos e vídeos"</string>
     <string name="permgroupdesc_visual" msgid="3415827902566663546">"acessar suas fotos e seus vídeos"</string>
-    <string name="permgrouprequest_visual" msgid="6907523945030290376">"Permitir que o app &lt;b&gt;<xliff:g id="APP_NAME">%1$s</xliff:g>&lt;/b&gt; acesse suas fotos e seus vídeos?"</string>
+    <string name="permgrouprequest_visual" msgid="3043752127595243314">"Permitir que o app &lt;b&gt;<xliff:g id="APP_NAME">%1$s</xliff:g>&lt;/b&gt; acesse seus vídeos e fotos, incluindo os locais marcados?"</string>
     <string name="capability_title_canRetrieveWindowContent" msgid="3901717936930170320">"Acessar conteúdo de uma janela"</string>
     <string name="capability_desc_canRetrieveWindowContent" msgid="3772225008605310672">"Inspeciona o conteúdo de uma janela com a qual você está interagindo."</string>
     <string name="capability_title_canRequestTouchExploration" msgid="3108723364676667320">"Ativar Explorar por toque"</string>
@@ -1396,8 +1396,7 @@
     <string name="ext_media_init_action" msgid="7952885510091978278">"Configurar"</string>
     <string name="ext_media_unmount_action" msgid="1121883233103278199">"Ejetar"</string>
     <string name="ext_media_browse_action" msgid="8322172381028546087">"Explorar"</string>
-    <!-- no translation found for ext_media_seamless_action (6575980560886881233) -->
-    <skip />
+    <string name="ext_media_seamless_action" msgid="6575980560886881233">"Alterar saída"</string>
     <string name="ext_media_missing_title" msgid="620980315821543904">"<xliff:g id="NAME">%s</xliff:g> ausente"</string>
     <string name="ext_media_missing_message" msgid="4012389235250987930">"Insira o dispositivo novamente"</string>
     <string name="ext_media_move_specific_title" msgid="1471100343872375842">"Movendo <xliff:g id="NAME">%s</xliff:g>"</string>
@@ -1611,6 +1610,8 @@
     <string name="display_manager_overlay_display_name" msgid="5142365982271620716">"Sobreposição nº <xliff:g id="ID">%1$d</xliff:g>"</string>
     <string name="display_manager_overlay_display_title" msgid="652124517672257172">"<xliff:g id="NAME">%1$s</xliff:g>: <xliff:g id="WIDTH">%2$d</xliff:g>x<xliff:g id="HEIGHT">%3$d</xliff:g>, <xliff:g id="DPI">%4$d</xliff:g> dpi"</string>
     <string name="display_manager_overlay_display_secure_suffix" msgid="6022119702628572080">", seguro"</string>
+    <string name="activity_starter_block_bg_activity_starts_permissive" msgid="5692097903712956720">"Esse início de atividade em segundo plano de <xliff:g id="PACKAGENAME">%1$s</xliff:g> será bloqueado nas versões futuras do Android Q. Consulte go/q-bg-block."</string>
+    <string name="activity_starter_block_bg_activity_starts_enforcing" msgid="8299522481076404353">"O início da atividade em segundo plano de <xliff:g id="PACKAGENAME">%1$s</xliff:g> foi bloqueado. Consulte go/q-bg-block."</string>
     <string name="kg_forgot_pattern_button_text" msgid="8852021467868220608">"Esqueci o padrão"</string>
     <string name="kg_wrong_pattern" msgid="1850806070801358830">"Padrão incorreto"</string>
     <string name="kg_wrong_password" msgid="2333281762128113157">"Senha incorreta"</string>
@@ -1996,9 +1997,29 @@
     <string name="dynamic_mode_notification_channel_name" msgid="2348803891571320452">"Notificação de informação do modo rotina"</string>
     <string name="dynamic_mode_notification_title" msgid="508815255807182035">"A bateria pode acabar antes da recarga normal"</string>
     <string name="dynamic_mode_notification_summary" msgid="2541166298550402690">"A \"Economia de bateria\" foi ativada para aumentar a duração da carga"</string>
+    <string name="mime_type_folder" msgid="7111951698626315204">"Pasta"</string>
+    <string name="mime_type_apk" msgid="5518003630972506900">"Aplicativo Android"</string>
+    <string name="mime_type_generic" msgid="6833871596845900027">"Arquivo"</string>
+    <string name="mime_type_generic_ext" msgid="8450275970061657174">"Arquivo em <xliff:g id="EXTENSION">%1$s</xliff:g>"</string>
+    <string name="mime_type_audio" msgid="6289777657172050926">"Áudio"</string>
+    <string name="mime_type_audio_ext" msgid="3270880987725816210">"Áudio em <xliff:g id="EXTENSION">%1$s</xliff:g>"</string>
+    <string name="mime_type_video" msgid="4093025777317307426">"Vídeo"</string>
+    <string name="mime_type_video_ext" msgid="5643771615714173159">"Vídeo em <xliff:g id="EXTENSION">%1$s</xliff:g>"</string>
+    <string name="mime_type_image" msgid="3144284451605236371">"Imagem"</string>
+    <string name="mime_type_image_ext" msgid="1514613218742736590">"Imagem <xliff:g id="EXTENSION">%1$s</xliff:g>"</string>
+    <string name="mime_type_compressed" msgid="1645486037074943257">"Arquivo"</string>
+    <string name="mime_type_compressed_ext" msgid="4232293058067801528">"Arquivo <xliff:g id="EXTENSION">%1$s</xliff:g>"</string>
+    <string name="mime_type_document" msgid="1596838147256375966">"Documento"</string>
+    <string name="mime_type_document_ext" msgid="6327266601345501281">"Documento em <xliff:g id="EXTENSION">%1$s</xliff:g>"</string>
+    <string name="mime_type_spreadsheet" msgid="2639138255207123557">"Planilha"</string>
+    <string name="mime_type_spreadsheet_ext" msgid="5508653032786106725">"Planilha em <xliff:g id="EXTENSION">%1$s</xliff:g>"</string>
+    <string name="mime_type_presentation" msgid="6145604688774787357">"Apresentação"</string>
+    <string name="mime_type_presentation_ext" msgid="2982650207774823437">"Apresentação em <xliff:g id="EXTENSION">%1$s</xliff:g>"</string>
     <string name="car_loading_profile" msgid="3545132581795684027">"Carregando"</string>
     <plurals name="file_count" formatted="false" msgid="1628600959752419449">
       <item quantity="one"><xliff:g id="FILE_NAME_2">%s</xliff:g> + <xliff:g id="COUNT_3">%d</xliff:g> arquivo</item>
       <item quantity="other"><xliff:g id="FILE_NAME_2">%s</xliff:g> + <xliff:g id="COUNT_3">%d</xliff:g> arquivos</item>
     </plurals>
+    <!-- no translation found for chooser_no_direct_share_targets (997970693708458895) -->
+    <skip />
 </resources>
diff --git a/core/res/res/values-ro/strings.xml b/core/res/res/values-ro/strings.xml
index 61bc9b8..63b3411 100644
--- a/core/res/res/values-ro/strings.xml
+++ b/core/res/res/values-ro/strings.xml
@@ -311,15 +311,15 @@
     <string name="permgrouplab_phone" msgid="5229115638567440675">"Telefon"</string>
     <string name="permgroupdesc_phone" msgid="6234224354060641055">"inițieze și să gestioneze apeluri telefonice"</string>
     <string name="permgrouprequest_phone" msgid="9166979577750581037">"Permiteți &lt;b&gt;<xliff:g id="APP_NAME">%1$s</xliff:g>&lt;/b&gt; să inițieze și să gestioneze apeluri telefonice?"</string>
-    <string name="permgrouplab_sensors" msgid="416037179223226722">"Senzori corporali"</string>
+    <string name="permgrouplab_sensors" msgid="4838614103153567532">"Senzori corporali"</string>
     <string name="permgroupdesc_sensors" msgid="7147968539346634043">"acceseze datele de la senzori despre semnele vitale"</string>
     <string name="permgrouprequest_sensors" msgid="6349806962814556786">"Permiteți &lt;b&gt;<xliff:g id="APP_NAME">%1$s</xliff:g>&lt;/b&gt; să acceseze datele de la senzori despre semnele dvs. vitale?"</string>
     <string name="permgrouplab_aural" msgid="965607064083134896">"Muzică"</string>
     <string name="permgroupdesc_aural" msgid="4870189506255958055">"accesați muzica"</string>
     <string name="permgrouprequest_aural" msgid="6787926123071735620">"Permiteți &lt;b&gt;<xliff:g id="APP_NAME">%1$s</xliff:g>&lt;/b&gt; să vă acceseze muzica?"</string>
-    <string name="permgrouplab_visual" msgid="8030190588123857921">"Fotografii și videoclipuri"</string>
+    <string name="permgrouplab_visual" msgid="6477382108771145134">"Fotografii și videoclipuri"</string>
     <string name="permgroupdesc_visual" msgid="3415827902566663546">"accesați fotografiile și videoclipurile"</string>
-    <string name="permgrouprequest_visual" msgid="6907523945030290376">"Permiteți &lt;b&gt;<xliff:g id="APP_NAME">%1$s</xliff:g>&lt;/b&gt; să vă acceseze fotografiile și videoclipurile?"</string>
+    <string name="permgrouprequest_visual" msgid="3043752127595243314">"Permiteți aplicației &lt;b&gt;<xliff:g id="APP_NAME">%1$s</xliff:g>&lt;/b&gt; să acceseze fotografiile și videoclipurile, inclusiv locațiile etichetate?"</string>
     <string name="capability_title_canRetrieveWindowContent" msgid="3901717936930170320">"Analizează conținutul ferestrei"</string>
     <string name="capability_desc_canRetrieveWindowContent" msgid="3772225008605310672">"Inspectează conținutul unei ferestre cu care interacționați."</string>
     <string name="capability_title_canRequestTouchExploration" msgid="3108723364676667320">"Activează funcția Explorați prin atingere"</string>
@@ -1418,8 +1418,7 @@
     <string name="ext_media_init_action" msgid="7952885510091978278">"Configurați"</string>
     <string name="ext_media_unmount_action" msgid="1121883233103278199">"Scoateți"</string>
     <string name="ext_media_browse_action" msgid="8322172381028546087">"Explorați"</string>
-    <!-- no translation found for ext_media_seamless_action (6575980560886881233) -->
-    <skip />
+    <string name="ext_media_seamless_action" msgid="6575980560886881233">"Schimbați ieșirea"</string>
     <string name="ext_media_missing_title" msgid="620980315821543904">"<xliff:g id="NAME">%s</xliff:g> lipsește"</string>
     <string name="ext_media_missing_message" msgid="4012389235250987930">"Reintroduceți dispozitivul"</string>
     <string name="ext_media_move_specific_title" msgid="1471100343872375842">"Se mută <xliff:g id="NAME">%s</xliff:g>"</string>
@@ -1634,6 +1633,8 @@
     <string name="display_manager_overlay_display_name" msgid="5142365982271620716">"Suprapunerea <xliff:g id="ID">%1$d</xliff:g>"</string>
     <string name="display_manager_overlay_display_title" msgid="652124517672257172">"<xliff:g id="NAME">%1$s</xliff:g>: <xliff:g id="WIDTH">%2$d</xliff:g>x<xliff:g id="HEIGHT">%3$d</xliff:g>, <xliff:g id="DPI">%4$d</xliff:g> dpi"</string>
     <string name="display_manager_overlay_display_secure_suffix" msgid="6022119702628572080">", securizat"</string>
+    <string name="activity_starter_block_bg_activity_starts_permissive" msgid="5692097903712956720">"Începerea activității în fundal de la <xliff:g id="PACKAGENAME">%1$s</xliff:g> va fi blocată în versiunile Q viitoare. Consultați go/q-bg-block."</string>
+    <string name="activity_starter_block_bg_activity_starts_enforcing" msgid="8299522481076404353">"Începerea activității din fundal de la <xliff:g id="PACKAGENAME">%1$s</xliff:g> este blocată. Consultați go/q-bg-block."</string>
     <string name="kg_forgot_pattern_button_text" msgid="8852021467868220608">"Model uitat"</string>
     <string name="kg_wrong_pattern" msgid="1850806070801358830">"Model greșit"</string>
     <string name="kg_wrong_password" msgid="2333281762128113157">"Parolă greșită"</string>
@@ -2031,10 +2032,30 @@
     <string name="dynamic_mode_notification_channel_name" msgid="2348803891571320452">"Notificare pentru informații despre modul Rutină"</string>
     <string name="dynamic_mode_notification_title" msgid="508815255807182035">"Bateria se poate descărca înainte de încărcarea obișnuită"</string>
     <string name="dynamic_mode_notification_summary" msgid="2541166298550402690">"Economisirea bateriei este activată pentru a prelungi durata de funcționare a bateriei"</string>
+    <string name="mime_type_folder" msgid="7111951698626315204">"Dosar"</string>
+    <string name="mime_type_apk" msgid="5518003630972506900">"Aplicație Android"</string>
+    <string name="mime_type_generic" msgid="6833871596845900027">"Fișier"</string>
+    <string name="mime_type_generic_ext" msgid="8450275970061657174">"Fișier <xliff:g id="EXTENSION">%1$s</xliff:g>"</string>
+    <string name="mime_type_audio" msgid="6289777657172050926">"Audio"</string>
+    <string name="mime_type_audio_ext" msgid="3270880987725816210">"Audio <xliff:g id="EXTENSION">%1$s</xliff:g>"</string>
+    <string name="mime_type_video" msgid="4093025777317307426">"Videoclip"</string>
+    <string name="mime_type_video_ext" msgid="5643771615714173159">"Videoclip <xliff:g id="EXTENSION">%1$s</xliff:g>"</string>
+    <string name="mime_type_image" msgid="3144284451605236371">"Imagine"</string>
+    <string name="mime_type_image_ext" msgid="1514613218742736590">"Imagine <xliff:g id="EXTENSION">%1$s</xliff:g>"</string>
+    <string name="mime_type_compressed" msgid="1645486037074943257">"Arhivă"</string>
+    <string name="mime_type_compressed_ext" msgid="4232293058067801528">"Arhivă <xliff:g id="EXTENSION">%1$s</xliff:g>"</string>
+    <string name="mime_type_document" msgid="1596838147256375966">"Document"</string>
+    <string name="mime_type_document_ext" msgid="6327266601345501281">"Document <xliff:g id="EXTENSION">%1$s</xliff:g>"</string>
+    <string name="mime_type_spreadsheet" msgid="2639138255207123557">"Foaie de calcul"</string>
+    <string name="mime_type_spreadsheet_ext" msgid="5508653032786106725">"Foaie de calcul <xliff:g id="EXTENSION">%1$s</xliff:g>"</string>
+    <string name="mime_type_presentation" msgid="6145604688774787357">"Prezentare"</string>
+    <string name="mime_type_presentation_ext" msgid="2982650207774823437">"Prezentare <xliff:g id="EXTENSION">%1$s</xliff:g>"</string>
     <string name="car_loading_profile" msgid="3545132581795684027">"Se încarcă"</string>
     <plurals name="file_count" formatted="false" msgid="1628600959752419449">
       <item quantity="few"><xliff:g id="FILE_NAME_2">%s</xliff:g> + <xliff:g id="COUNT_3">%d</xliff:g> fișiere</item>
       <item quantity="other"><xliff:g id="FILE_NAME_2">%s</xliff:g> + <xliff:g id="COUNT_3">%d</xliff:g> de fișiere</item>
       <item quantity="one"><xliff:g id="FILE_NAME_0">%s</xliff:g> + <xliff:g id="COUNT_1">%d</xliff:g> fișier</item>
     </plurals>
+    <!-- no translation found for chooser_no_direct_share_targets (997970693708458895) -->
+    <skip />
 </resources>
diff --git a/core/res/res/values-ru/strings.xml b/core/res/res/values-ru/strings.xml
index 6931e26..0aed6bc 100644
--- a/core/res/res/values-ru/strings.xml
+++ b/core/res/res/values-ru/strings.xml
@@ -314,15 +314,15 @@
     <string name="permgrouplab_phone" msgid="5229115638567440675">"Телефон"</string>
     <string name="permgroupdesc_phone" msgid="6234224354060641055">"осуществлять вызовы и управлять ими"</string>
     <string name="permgrouprequest_phone" msgid="9166979577750581037">"Разрешить приложению &lt;b&gt;<xliff:g id="APP_NAME">%1$s</xliff:g>&lt;/b&gt; совершать звонки и управлять ими?"</string>
-    <string name="permgrouplab_sensors" msgid="416037179223226722">"Нательные датчики"</string>
+    <string name="permgrouplab_sensors" msgid="4838614103153567532">"Датчики на теле"</string>
     <string name="permgroupdesc_sensors" msgid="7147968539346634043">"доступ к данным датчиков о состоянии организма"</string>
     <string name="permgrouprequest_sensors" msgid="6349806962814556786">"Разрешить приложению &lt;b&gt;<xliff:g id="APP_NAME">%1$s</xliff:g>&lt;/b&gt; доступ к данным датчиков о состоянии организма?"</string>
     <string name="permgrouplab_aural" msgid="965607064083134896">"Музыка"</string>
     <string name="permgroupdesc_aural" msgid="4870189506255958055">"доступ к музыке"</string>
     <string name="permgrouprequest_aural" msgid="6787926123071735620">"Разрешить приложению &lt;b&gt;<xliff:g id="APP_NAME">%1$s</xliff:g>&lt;/b&gt; доступ к музыке?"</string>
-    <string name="permgrouplab_visual" msgid="8030190588123857921">"Фото и видео"</string>
+    <string name="permgrouplab_visual" msgid="6477382108771145134">"Фото и видео"</string>
     <string name="permgroupdesc_visual" msgid="3415827902566663546">"доступ к фото и видео"</string>
-    <string name="permgrouprequest_visual" msgid="6907523945030290376">"Разрешить приложению &lt;b&gt;<xliff:g id="APP_NAME">%1$s</xliff:g>&lt;/b&gt; доступ к фото и видео?"</string>
+    <string name="permgrouprequest_visual" msgid="3043752127595243314">"Открыть приложению &lt;b&gt;<xliff:g id="APP_NAME">%1$s</xliff:g>&lt;/b&gt; доступ к вашим фото и видео, а также к данным о местах съемки?"</string>
     <string name="capability_title_canRetrieveWindowContent" msgid="3901717936930170320">"Получать содержимое окна"</string>
     <string name="capability_desc_canRetrieveWindowContent" msgid="3772225008605310672">"Анализировать содержимое активного окна."</string>
     <string name="capability_title_canRequestTouchExploration" msgid="3108723364676667320">"Включать Изучение касанием"</string>
@@ -1657,6 +1657,8 @@
     <string name="display_manager_overlay_display_name" msgid="5142365982271620716">"Наложение № <xliff:g id="ID">%1$d</xliff:g>"</string>
     <string name="display_manager_overlay_display_title" msgid="652124517672257172">"<xliff:g id="NAME">%1$s</xliff:g>: <xliff:g id="WIDTH">%2$d</xliff:g> х <xliff:g id="HEIGHT">%3$d</xliff:g>, <xliff:g id="DPI">%4$d</xliff:g> тчк/дюйм"</string>
     <string name="display_manager_overlay_display_secure_suffix" msgid="6022119702628572080">", безопасный"</string>
+    <string name="activity_starter_block_bg_activity_starts_permissive" msgid="5692097903712956720">"Действия приложения \"<xliff:g id="PACKAGENAME">%1$s</xliff:g>\" в фоновом режиме будут блокироваться в последующих сборках Android Q. Подробнее: go/q-bg-block."</string>
+    <string name="activity_starter_block_bg_activity_starts_enforcing" msgid="8299522481076404353">"Действие приложения \"<xliff:g id="PACKAGENAME">%1$s</xliff:g>\" в фоновом режиме заблокировано. Подробнее: go/q-bg-block."</string>
     <string name="kg_forgot_pattern_button_text" msgid="8852021467868220608">"Забыли графический ключ?"</string>
     <string name="kg_wrong_pattern" msgid="1850806070801358830">"Неправильный графический ключ"</string>
     <string name="kg_wrong_password" msgid="2333281762128113157">"Неправильный пароль"</string>
@@ -2066,6 +2068,24 @@
     <string name="dynamic_mode_notification_channel_name" msgid="2348803891571320452">"Уведомление о батарее"</string>
     <string name="dynamic_mode_notification_title" msgid="508815255807182035">"Батарея может разрядиться"</string>
     <string name="dynamic_mode_notification_summary" msgid="2541166298550402690">"Чтобы увеличить время работы от батареи, был включен режим энергосбережения."</string>
+    <string name="mime_type_folder" msgid="7111951698626315204">"Папка"</string>
+    <string name="mime_type_apk" msgid="5518003630972506900">"Приложение Android"</string>
+    <string name="mime_type_generic" msgid="6833871596845900027">"Файл"</string>
+    <string name="mime_type_generic_ext" msgid="8450275970061657174">"Файл <xliff:g id="EXTENSION">%1$s</xliff:g>"</string>
+    <string name="mime_type_audio" msgid="6289777657172050926">"Аудио"</string>
+    <string name="mime_type_audio_ext" msgid="3270880987725816210">"Аудиофайл <xliff:g id="EXTENSION">%1$s</xliff:g>"</string>
+    <string name="mime_type_video" msgid="4093025777317307426">"Видео"</string>
+    <string name="mime_type_video_ext" msgid="5643771615714173159">"Видео <xliff:g id="EXTENSION">%1$s</xliff:g>"</string>
+    <string name="mime_type_image" msgid="3144284451605236371">"Изображение"</string>
+    <string name="mime_type_image_ext" msgid="1514613218742736590">"Изображение <xliff:g id="EXTENSION">%1$s</xliff:g>"</string>
+    <string name="mime_type_compressed" msgid="1645486037074943257">"Архив"</string>
+    <string name="mime_type_compressed_ext" msgid="4232293058067801528">"Архив <xliff:g id="EXTENSION">%1$s</xliff:g>"</string>
+    <string name="mime_type_document" msgid="1596838147256375966">"Документ"</string>
+    <string name="mime_type_document_ext" msgid="6327266601345501281">"Документ <xliff:g id="EXTENSION">%1$s</xliff:g>"</string>
+    <string name="mime_type_spreadsheet" msgid="2639138255207123557">"Таблица"</string>
+    <string name="mime_type_spreadsheet_ext" msgid="5508653032786106725">"Таблица <xliff:g id="EXTENSION">%1$s</xliff:g>"</string>
+    <string name="mime_type_presentation" msgid="6145604688774787357">"Презентация"</string>
+    <string name="mime_type_presentation_ext" msgid="2982650207774823437">"Презентация <xliff:g id="EXTENSION">%1$s</xliff:g>"</string>
     <string name="car_loading_profile" msgid="3545132581795684027">"Загрузка"</string>
     <plurals name="file_count" formatted="false" msgid="1628600959752419449">
       <item quantity="one">\"<xliff:g id="FILE_NAME_2">%s</xliff:g>\" и ещё <xliff:g id="COUNT_3">%d</xliff:g> файл</item>
@@ -2073,4 +2093,6 @@
       <item quantity="many">\"<xliff:g id="FILE_NAME_2">%s</xliff:g>\" и ещё <xliff:g id="COUNT_3">%d</xliff:g> файлов</item>
       <item quantity="other">\"<xliff:g id="FILE_NAME_2">%s</xliff:g>\" и ещё <xliff:g id="COUNT_3">%d</xliff:g> файла</item>
     </plurals>
+    <!-- no translation found for chooser_no_direct_share_targets (997970693708458895) -->
+    <skip />
 </resources>
diff --git a/core/res/res/values-si/strings.xml b/core/res/res/values-si/strings.xml
index f98ec7d..cc6087a 100644
--- a/core/res/res/values-si/strings.xml
+++ b/core/res/res/values-si/strings.xml
@@ -308,15 +308,15 @@
     <string name="permgrouplab_phone" msgid="5229115638567440675">"දුරකථනය"</string>
     <string name="permgroupdesc_phone" msgid="6234224354060641055">"දුරකථන ඇමතුම් සිදු කිරීම සහ කළමනාකරණය කිරීම"</string>
     <string name="permgrouprequest_phone" msgid="9166979577750581037">"&lt;b&gt;<xliff:g id="APP_NAME">%1$s</xliff:g>&lt;b&gt; වෙත දුරකථන ඇමතුම් ලබා ගැනීමට සහ කළමනාකරණය කිරීමට ඉඩ දෙන්නද?"</string>
-    <string name="permgrouplab_sensors" msgid="416037179223226722">"ශරීර සංවේදක"</string>
+    <string name="permgrouplab_sensors" msgid="4838614103153567532">"ශරීර සංවේදක"</string>
     <string name="permgroupdesc_sensors" msgid="7147968539346634043">"ඔබේ ජෛව ලක්ෂණ පිළිබඳ සංවේදක දත්ත වෙත පිවිසෙන්න"</string>
     <string name="permgrouprequest_sensors" msgid="6349806962814556786">"&lt;b&gt;<xliff:g id="APP_NAME">%1$s</xliff:g>&lt;b&gt; වෙත ඔබගේ ජෛව ලක්ෂණ පිළිබඳ සංවේදක දත්ත වෙත ප්‍රවේශ වීමට ඉඩ දෙන්නද?"</string>
     <string name="permgrouplab_aural" msgid="965607064083134896">"සංගීතය"</string>
     <string name="permgroupdesc_aural" msgid="4870189506255958055">"ඔබේ සංගීතයට පිවිසෙන්න"</string>
     <string name="permgrouprequest_aural" msgid="6787926123071735620">"&lt;b&gt;<xliff:g id="APP_NAME">%1$s</xliff:g>&lt;b&gt; හට ඔබගේ දින දර්ශනය වෙත පිවිසීමට ඉඩ දෙන්නද?"</string>
-    <string name="permgrouplab_visual" msgid="8030190588123857921">"ඡායාරූප සහ වීඩියෝ"</string>
+    <string name="permgrouplab_visual" msgid="6477382108771145134">"ඡායාරූප සහ වීඩියෝ"</string>
     <string name="permgroupdesc_visual" msgid="3415827902566663546">"ඔබගේ ඡායාරූප සහ වීඩියෝ වෙත පිවිසෙන්න"</string>
-    <string name="permgrouprequest_visual" msgid="6907523945030290376">"&lt;b&gt;<xliff:g id="APP_NAME">%1$s</xliff:g>&lt;b&gt; හට ඔබගේ ඡායාරූප වෙත පිවිසීමට ඉඩ දෙන්නද?"</string>
+    <string name="permgrouprequest_visual" msgid="3043752127595243314">"&lt;b&gt;<xliff:g id="APP_NAME">%1$s</xliff:g>&lt;/b&gt; හට ටැග් කළ ස්ථාන ඇතුළුව, ඔබේ ඡායාරූප සහ වීඩියෝවලට ප්‍රවේශයට ඉඩ දෙන්න ද?"</string>
     <string name="capability_title_canRetrieveWindowContent" msgid="3901717936930170320">"කවුළු අන්න්තර්ගතය ලබාගන්න"</string>
     <string name="capability_desc_canRetrieveWindowContent" msgid="3772225008605310672">"ඔබ අන්තර්ක්‍රියාකාරී වන කවුළුවේ අන්තර්ගතය පරීක්ෂා කරන්න."</string>
     <string name="capability_title_canRequestTouchExploration" msgid="3108723364676667320">"ස්පර්ශයෙන් ගවේෂණය සක්‍රිය කරන්න"</string>
@@ -1398,8 +1398,7 @@
     <string name="ext_media_init_action" msgid="7952885510091978278">"පිහිටුවන්න"</string>
     <string name="ext_media_unmount_action" msgid="1121883233103278199">"ගැලවීම"</string>
     <string name="ext_media_browse_action" msgid="8322172381028546087">"ගවේෂණය කරන්න"</string>
-    <!-- no translation found for ext_media_seamless_action (6575980560886881233) -->
-    <skip />
+    <string name="ext_media_seamless_action" msgid="6575980560886881233">"ප්‍රතිදාන මාරු කරන්න"</string>
     <string name="ext_media_missing_title" msgid="620980315821543904">"<xliff:g id="NAME">%s</xliff:g> අස්ථානගතයි"</string>
     <string name="ext_media_missing_message" msgid="4012389235250987930">"නැවත උපාංගය ඇතුළු කරන්න"</string>
     <string name="ext_media_move_specific_title" msgid="1471100343872375842">"<xliff:g id="NAME">%s</xliff:g> ගෙන යමින්"</string>
@@ -1613,6 +1612,8 @@
     <string name="display_manager_overlay_display_name" msgid="5142365982271620716">"උඩැතිරිය #<xliff:g id="ID">%1$d</xliff:g>"</string>
     <string name="display_manager_overlay_display_title" msgid="652124517672257172">"<xliff:g id="NAME">%1$s</xliff:g>: <xliff:g id="WIDTH">%2$d</xliff:g>x<xliff:g id="HEIGHT">%3$d</xliff:g>, <xliff:g id="DPI">%4$d</xliff:g> dpi"</string>
     <string name="display_manager_overlay_display_secure_suffix" msgid="6022119702628572080">", ආරක්‍ෂිත"</string>
+    <string name="activity_starter_block_bg_activity_starts_permissive" msgid="5692097903712956720">"<xliff:g id="PACKAGENAME">%1$s</xliff:g> සිට පසුබිම් ක්‍රියාකාරකම අනාගත Q නිමැවුම්වල අවහිර කෙරේ. go/q-bg-block බලන්න."</string>
+    <string name="activity_starter_block_bg_activity_starts_enforcing" msgid="8299522481076404353">"<xliff:g id="PACKAGENAME">%1$s</xliff:g> සිට පසුබිම් ක්‍රියාකාරකම අවහිර කර ඇත. go/q-bg-block බලන්න."</string>
     <string name="kg_forgot_pattern_button_text" msgid="8852021467868220608">"රටාව අමතකයි"</string>
     <string name="kg_wrong_pattern" msgid="1850806070801358830">"වැරදි රටාවකි"</string>
     <string name="kg_wrong_password" msgid="2333281762128113157">"වැරදි මුරපදය"</string>
@@ -1998,9 +1999,29 @@
     <string name="dynamic_mode_notification_channel_name" msgid="2348803891571320452">"දිනචරියා ප්‍රකාර තතු දැනුම්දීම"</string>
     <string name="dynamic_mode_notification_title" msgid="508815255807182035">"බැටරිය සුපුරුදු ආරෝපණයට පෙර ඉවර විය හැක"</string>
     <string name="dynamic_mode_notification_summary" msgid="2541166298550402690">"බැටරි සුරැකුම බැටරි ආයු කාලය දීර්ඝ කිරීමට සක්‍රිය කෙරිණි"</string>
+    <string name="mime_type_folder" msgid="7111951698626315204">"ෆෝල්ඩරය"</string>
+    <string name="mime_type_apk" msgid="5518003630972506900">"Android යෙදුම"</string>
+    <string name="mime_type_generic" msgid="6833871596845900027">"ගොනුව"</string>
+    <string name="mime_type_generic_ext" msgid="8450275970061657174">"<xliff:g id="EXTENSION">%1$s</xliff:g> ගොනුව"</string>
+    <string name="mime_type_audio" msgid="6289777657172050926">"ශ්‍රව්‍ය"</string>
+    <string name="mime_type_audio_ext" msgid="3270880987725816210">"ශ්‍රව්‍ය <xliff:g id="EXTENSION">%1$s</xliff:g>"</string>
+    <string name="mime_type_video" msgid="4093025777317307426">"වීඩියෝව"</string>
+    <string name="mime_type_video_ext" msgid="5643771615714173159">"<xliff:g id="EXTENSION">%1$s</xliff:g> වීඩියෝව"</string>
+    <string name="mime_type_image" msgid="3144284451605236371">"රූපය"</string>
+    <string name="mime_type_image_ext" msgid="1514613218742736590">"<xliff:g id="EXTENSION">%1$s</xliff:g> රූපය"</string>
+    <string name="mime_type_compressed" msgid="1645486037074943257">"සංරක්‍ෂණය"</string>
+    <string name="mime_type_compressed_ext" msgid="4232293058067801528">"<xliff:g id="EXTENSION">%1$s</xliff:g> සංරක්‍ෂණ කරන්න"</string>
+    <string name="mime_type_document" msgid="1596838147256375966">"ලේඛනය"</string>
+    <string name="mime_type_document_ext" msgid="6327266601345501281">"<xliff:g id="EXTENSION">%1$s</xliff:g> ලේඛනය"</string>
+    <string name="mime_type_spreadsheet" msgid="2639138255207123557">"පැතුරුම්පත"</string>
+    <string name="mime_type_spreadsheet_ext" msgid="5508653032786106725">"<xliff:g id="EXTENSION">%1$s</xliff:g> පැතුරුම්පත"</string>
+    <string name="mime_type_presentation" msgid="6145604688774787357">"ඉදිරිපත් කිරීම"</string>
+    <string name="mime_type_presentation_ext" msgid="2982650207774823437">"<xliff:g id="EXTENSION">%1$s</xliff:g> ඉදිරිපත් කිරීම"</string>
     <string name="car_loading_profile" msgid="3545132581795684027">"පූරණය කරමින්"</string>
     <plurals name="file_count" formatted="false" msgid="1628600959752419449">
       <item quantity="one">ගොනු<xliff:g id="FILE_NAME_2">%s</xliff:g> + <xliff:g id="COUNT_3">%d</xliff:g></item>
       <item quantity="other">ගොනු<xliff:g id="FILE_NAME_2">%s</xliff:g> + <xliff:g id="COUNT_3">%d</xliff:g></item>
     </plurals>
+    <!-- no translation found for chooser_no_direct_share_targets (997970693708458895) -->
+    <skip />
 </resources>
diff --git a/core/res/res/values-sk/strings.xml b/core/res/res/values-sk/strings.xml
index 9a392cb3..31fa127 100644
--- a/core/res/res/values-sk/strings.xml
+++ b/core/res/res/values-sk/strings.xml
@@ -314,15 +314,15 @@
     <string name="permgrouplab_phone" msgid="5229115638567440675">"Telefón"</string>
     <string name="permgroupdesc_phone" msgid="6234224354060641055">"telefonovanie a správu hovorov"</string>
     <string name="permgrouprequest_phone" msgid="9166979577750581037">"Povoliť aplikácii &lt;b&gt;<xliff:g id="APP_NAME">%1$s</xliff:g>&lt;/b&gt; uskutočňovať a spravovať telefonické hovory?"</string>
-    <string name="permgrouplab_sensors" msgid="416037179223226722">"Telesné senzory"</string>
+    <string name="permgrouplab_sensors" msgid="4838614103153567532">"Telové senzory"</string>
     <string name="permgroupdesc_sensors" msgid="7147968539346634043">"prístup k dátam senzorov vašich životných funkcií"</string>
     <string name="permgrouprequest_sensors" msgid="6349806962814556786">"Povoliť aplikácii &lt;b&gt;<xliff:g id="APP_NAME">%1$s</xliff:g>&lt;/b&gt; používať údaje senzorov o vašich životných funkciách?"</string>
     <string name="permgrouplab_aural" msgid="965607064083134896">"Hudba"</string>
     <string name="permgroupdesc_aural" msgid="4870189506255958055">"prístup k hudbe"</string>
     <string name="permgrouprequest_aural" msgid="6787926123071735620">"Chcete povoliť aplikácii &lt;b&gt;<xliff:g id="APP_NAME">%1$s</xliff:g>&lt;/b&gt; prístup k hudbe?"</string>
-    <string name="permgrouplab_visual" msgid="8030190588123857921">"Fotky a videá"</string>
+    <string name="permgrouplab_visual" msgid="6477382108771145134">"Fotky a videá"</string>
     <string name="permgroupdesc_visual" msgid="3415827902566663546">"prístup k fotkám a videám"</string>
-    <string name="permgrouprequest_visual" msgid="6907523945030290376">"Chcete povoliť aplikácii &lt;b&gt;<xliff:g id="APP_NAME">%1$s</xliff:g>&lt;/b&gt; prístup k fotkám a videám?"</string>
+    <string name="permgrouprequest_visual" msgid="3043752127595243314">"Chcete povoliť aplikácii &lt;b&gt;<xliff:g id="APP_NAME">%1$s</xliff:g>&lt;/b&gt; prístup k vašim fotkám a videám vrátane označených miest?"</string>
     <string name="capability_title_canRetrieveWindowContent" msgid="3901717936930170320">"Načítať obsah okna"</string>
     <string name="capability_desc_canRetrieveWindowContent" msgid="3772225008605310672">"Môžete preskúmať obsah okna, s ktorým pracujete."</string>
     <string name="capability_title_canRequestTouchExploration" msgid="3108723364676667320">"Zapnúť funkciu Preskúmanie dotykom"</string>
@@ -1440,8 +1440,7 @@
     <string name="ext_media_init_action" msgid="7952885510091978278">"Nastaviť"</string>
     <string name="ext_media_unmount_action" msgid="1121883233103278199">"Odpojiť"</string>
     <string name="ext_media_browse_action" msgid="8322172381028546087">"Preskúmať"</string>
-    <!-- no translation found for ext_media_seamless_action (6575980560886881233) -->
-    <skip />
+    <string name="ext_media_seamless_action" msgid="6575980560886881233">"Prepnúť výstup"</string>
     <string name="ext_media_missing_title" msgid="620980315821543904">"Chýba: <xliff:g id="NAME">%s</xliff:g>"</string>
     <string name="ext_media_missing_message" msgid="4012389235250987930">"Zariadenie vložte znova"</string>
     <string name="ext_media_move_specific_title" msgid="1471100343872375842">"Presúva sa aplikácia <xliff:g id="NAME">%s</xliff:g>"</string>
@@ -1657,6 +1656,8 @@
     <string name="display_manager_overlay_display_name" msgid="5142365982271620716">"Prekrytie č. <xliff:g id="ID">%1$d</xliff:g>"</string>
     <string name="display_manager_overlay_display_title" msgid="652124517672257172">"<xliff:g id="NAME">%1$s</xliff:g>: <xliff:g id="WIDTH">%2$d</xliff:g> x <xliff:g id="HEIGHT">%3$d</xliff:g>, <xliff:g id="DPI">%4$d</xliff:g> dpi"</string>
     <string name="display_manager_overlay_display_secure_suffix" msgid="6022119702628572080">", zabezpečené"</string>
+    <string name="activity_starter_block_bg_activity_starts_permissive" msgid="5692097903712956720">"Toto spustenie aktivity na pozadí v režime <xliff:g id="PACKAGENAME">%1$s</xliff:g> bude blokované v budúcich zostavách Q. Prejdite na go/q-bg-block."</string>
+    <string name="activity_starter_block_bg_activity_starts_enforcing" msgid="8299522481076404353">"Spustenie aktivity na pozadí v režime <xliff:g id="PACKAGENAME">%1$s</xliff:g> je blokované. Prejdite na go/q-bg-block."</string>
     <string name="kg_forgot_pattern_button_text" msgid="8852021467868220608">"Nepamätám si vzor"</string>
     <string name="kg_wrong_pattern" msgid="1850806070801358830">"Nesprávny vzor"</string>
     <string name="kg_wrong_password" msgid="2333281762128113157">"Nesprávne heslo"</string>
@@ -2066,6 +2067,24 @@
     <string name="dynamic_mode_notification_channel_name" msgid="2348803891571320452">"Upozornenie s informáciami o rutinnom režime"</string>
     <string name="dynamic_mode_notification_title" msgid="508815255807182035">"Batéria sa môže vybiť pred obvyklým nabitím"</string>
     <string name="dynamic_mode_notification_summary" msgid="2541166298550402690">"Bol aktivovaný šetrič batérie na predĺženie výdrže batérie"</string>
+    <string name="mime_type_folder" msgid="7111951698626315204">"Priečinok"</string>
+    <string name="mime_type_apk" msgid="5518003630972506900">"Aplikácia pre Android"</string>
+    <string name="mime_type_generic" msgid="6833871596845900027">"Súbor"</string>
+    <string name="mime_type_generic_ext" msgid="8450275970061657174">"Súbor <xliff:g id="EXTENSION">%1$s</xliff:g>"</string>
+    <string name="mime_type_audio" msgid="6289777657172050926">"Zvuk"</string>
+    <string name="mime_type_audio_ext" msgid="3270880987725816210">"Zvuk <xliff:g id="EXTENSION">%1$s</xliff:g>"</string>
+    <string name="mime_type_video" msgid="4093025777317307426">"Video"</string>
+    <string name="mime_type_video_ext" msgid="5643771615714173159">"Video <xliff:g id="EXTENSION">%1$s</xliff:g>"</string>
+    <string name="mime_type_image" msgid="3144284451605236371">"Obrázok"</string>
+    <string name="mime_type_image_ext" msgid="1514613218742736590">"Obrázok <xliff:g id="EXTENSION">%1$s</xliff:g>"</string>
+    <string name="mime_type_compressed" msgid="1645486037074943257">"Archív"</string>
+    <string name="mime_type_compressed_ext" msgid="4232293058067801528">"Archív <xliff:g id="EXTENSION">%1$s</xliff:g>"</string>
+    <string name="mime_type_document" msgid="1596838147256375966">"Dokument"</string>
+    <string name="mime_type_document_ext" msgid="6327266601345501281">"Dokument <xliff:g id="EXTENSION">%1$s</xliff:g>"</string>
+    <string name="mime_type_spreadsheet" msgid="2639138255207123557">"Tabuľka"</string>
+    <string name="mime_type_spreadsheet_ext" msgid="5508653032786106725">"Tabuľka <xliff:g id="EXTENSION">%1$s</xliff:g>"</string>
+    <string name="mime_type_presentation" msgid="6145604688774787357">"Prezentácia"</string>
+    <string name="mime_type_presentation_ext" msgid="2982650207774823437">"Prezentácia <xliff:g id="EXTENSION">%1$s</xliff:g>"</string>
     <string name="car_loading_profile" msgid="3545132581795684027">"Načítava sa"</string>
     <plurals name="file_count" formatted="false" msgid="1628600959752419449">
       <item quantity="few"><xliff:g id="FILE_NAME_2">%s</xliff:g> + <xliff:g id="COUNT_3">%d</xliff:g> súbory</item>
@@ -2073,4 +2092,6 @@
       <item quantity="other"><xliff:g id="FILE_NAME_2">%s</xliff:g> + <xliff:g id="COUNT_3">%d</xliff:g> súborov</item>
       <item quantity="one"><xliff:g id="FILE_NAME_0">%s</xliff:g> + <xliff:g id="COUNT_1">%d</xliff:g> súbor</item>
     </plurals>
+    <!-- no translation found for chooser_no_direct_share_targets (997970693708458895) -->
+    <skip />
 </resources>
diff --git a/core/res/res/values-sl/strings.xml b/core/res/res/values-sl/strings.xml
index cdd9ed8..067165b 100644
--- a/core/res/res/values-sl/strings.xml
+++ b/core/res/res/values-sl/strings.xml
@@ -314,15 +314,15 @@
     <string name="permgrouplab_phone" msgid="5229115638567440675">"Telefon"</string>
     <string name="permgroupdesc_phone" msgid="6234224354060641055">"opravljanje in upravljanje telefonskih klicev"</string>
     <string name="permgrouprequest_phone" msgid="9166979577750581037">"Želite aplikaciji &lt;b&gt;<xliff:g id="APP_NAME">%1$s</xliff:g>&lt;/b&gt; omogočiti opravljanje in upravljanje telefonskih klicev?"</string>
-    <string name="permgrouplab_sensors" msgid="416037179223226722">"Tipala telesnih funkcij"</string>
+    <string name="permgrouplab_sensors" msgid="4838614103153567532">"Tipala telesnih funkcij"</string>
     <string name="permgroupdesc_sensors" msgid="7147968539346634043">"dostop do podatkov tipala o vaših vitalnih znakih"</string>
     <string name="permgrouprequest_sensors" msgid="6349806962814556786">"Želite aplikaciji &lt;b&gt;<xliff:g id="APP_NAME">%1$s</xliff:g>&lt;/b&gt; omogočiti dostop do podatkov tipala o vitalnih znakih?"</string>
     <string name="permgrouplab_aural" msgid="965607064083134896">"Glasba"</string>
     <string name="permgroupdesc_aural" msgid="4870189506255958055">"dostop do glasbe"</string>
     <string name="permgrouprequest_aural" msgid="6787926123071735620">"Želite aplikaciji &lt;b&gt;<xliff:g id="APP_NAME">%1$s</xliff:g>&lt;/b&gt; omogočiti dostop do glasbe?"</string>
-    <string name="permgrouplab_visual" msgid="8030190588123857921">"Fotografije in videoposnetki"</string>
+    <string name="permgrouplab_visual" msgid="6477382108771145134">"Fotografije in videoposnetki"</string>
     <string name="permgroupdesc_visual" msgid="3415827902566663546">"dostop do fotografij in videoposnetkov"</string>
-    <string name="permgrouprequest_visual" msgid="6907523945030290376">"Želite aplikaciji &lt;b&gt;<xliff:g id="APP_NAME">%1$s</xliff:g>&lt;/b&gt; omogočiti dostop do fotografij in videoposnetkov?"</string>
+    <string name="permgrouprequest_visual" msgid="3043752127595243314">"Želite aplikaciji &lt;b&gt;<xliff:g id="APP_NAME">%1$s</xliff:g>&lt;/b&gt; omogočiti dostop do fotografij, videoposnetkov in v njih označenih lokacij?"</string>
     <string name="capability_title_canRetrieveWindowContent" msgid="3901717936930170320">"Pridobiti vsebino okna"</string>
     <string name="capability_desc_canRetrieveWindowContent" msgid="3772225008605310672">"Preverjanje vsebine okna, ki ga uporabljate."</string>
     <string name="capability_title_canRequestTouchExploration" msgid="3108723364676667320">"Vklopiti raziskovanje z dotikom"</string>
@@ -1440,8 +1440,7 @@
     <string name="ext_media_init_action" msgid="7952885510091978278">"Nastavi"</string>
     <string name="ext_media_unmount_action" msgid="1121883233103278199">"Izvrzite"</string>
     <string name="ext_media_browse_action" msgid="8322172381028546087">"Raziščite"</string>
-    <!-- no translation found for ext_media_seamless_action (6575980560886881233) -->
-    <skip />
+    <string name="ext_media_seamless_action" msgid="6575980560886881233">"Preklopite izhod"</string>
     <string name="ext_media_missing_title" msgid="620980315821543904">"Ni shrambe <xliff:g id="NAME">%s</xliff:g>"</string>
     <string name="ext_media_missing_message" msgid="4012389235250987930">"Znova vstavite napravo"</string>
     <string name="ext_media_move_specific_title" msgid="1471100343872375842">"Premikanje aplikacije <xliff:g id="NAME">%s</xliff:g>"</string>
@@ -1657,6 +1656,8 @@
     <string name="display_manager_overlay_display_name" msgid="5142365982271620716">"Prekrivanje #<xliff:g id="ID">%1$d</xliff:g>"</string>
     <string name="display_manager_overlay_display_title" msgid="652124517672257172">"<xliff:g id="NAME">%1$s</xliff:g>: <xliff:g id="WIDTH">%2$d</xliff:g> x <xliff:g id="HEIGHT">%3$d</xliff:g>, <xliff:g id="DPI">%4$d</xliff:g> pik na palec"</string>
     <string name="display_manager_overlay_display_secure_suffix" msgid="6022119702628572080">", varen"</string>
+    <string name="activity_starter_block_bg_activity_starts_permissive" msgid="5692097903712956720">"Ta zagon dejavnosti v ozadju za paket <xliff:g id="PACKAGENAME">%1$s</xliff:g> bo blokiran v prihodnjih različicah Androida Q. Obiščite go/q-bg-block."</string>
+    <string name="activity_starter_block_bg_activity_starts_enforcing" msgid="8299522481076404353">"Zagon dejavnosti v ozadju za paket <xliff:g id="PACKAGENAME">%1$s</xliff:g> je bil blokiran. Obiščite go/q-bg-block."</string>
     <string name="kg_forgot_pattern_button_text" msgid="8852021467868220608">"Pozabljen vzorec"</string>
     <string name="kg_wrong_pattern" msgid="1850806070801358830">"Napačen vzorec"</string>
     <string name="kg_wrong_password" msgid="2333281762128113157">"Napačno geslo"</string>
@@ -2066,6 +2067,24 @@
     <string name="dynamic_mode_notification_channel_name" msgid="2348803891571320452">"Rutinsko informativno obvestilo o načinu delovanja"</string>
     <string name="dynamic_mode_notification_title" msgid="508815255807182035">"Akumulator se bo morda izpraznil, preden ga običajno priključite na polnjenje"</string>
     <string name="dynamic_mode_notification_summary" msgid="2541166298550402690">"Vklopilo se je varčevanje z energijo akumulatorja za podaljšanje časa delovanja akumulatorja"</string>
+    <string name="mime_type_folder" msgid="7111951698626315204">"Mapa"</string>
+    <string name="mime_type_apk" msgid="5518003630972506900">"Aplikacija za Android"</string>
+    <string name="mime_type_generic" msgid="6833871596845900027">"Datoteka"</string>
+    <string name="mime_type_generic_ext" msgid="8450275970061657174">"Datoteka <xliff:g id="EXTENSION">%1$s</xliff:g>"</string>
+    <string name="mime_type_audio" msgid="6289777657172050926">"Zvočna datoteka"</string>
+    <string name="mime_type_audio_ext" msgid="3270880987725816210">"Zvočna datoteka <xliff:g id="EXTENSION">%1$s</xliff:g>"</string>
+    <string name="mime_type_video" msgid="4093025777317307426">"Videoposnetek"</string>
+    <string name="mime_type_video_ext" msgid="5643771615714173159">"Videoposnetek <xliff:g id="EXTENSION">%1$s</xliff:g>"</string>
+    <string name="mime_type_image" msgid="3144284451605236371">"Slika"</string>
+    <string name="mime_type_image_ext" msgid="1514613218742736590">"Slika <xliff:g id="EXTENSION">%1$s</xliff:g>"</string>
+    <string name="mime_type_compressed" msgid="1645486037074943257">"Arhiv"</string>
+    <string name="mime_type_compressed_ext" msgid="4232293058067801528">"Arhivska datoteka <xliff:g id="EXTENSION">%1$s</xliff:g>"</string>
+    <string name="mime_type_document" msgid="1596838147256375966">"Dokument"</string>
+    <string name="mime_type_document_ext" msgid="6327266601345501281">"Dokument <xliff:g id="EXTENSION">%1$s</xliff:g>"</string>
+    <string name="mime_type_spreadsheet" msgid="2639138255207123557">"Preglednica"</string>
+    <string name="mime_type_spreadsheet_ext" msgid="5508653032786106725">"Preglednica <xliff:g id="EXTENSION">%1$s</xliff:g>"</string>
+    <string name="mime_type_presentation" msgid="6145604688774787357">"Predstavitev"</string>
+    <string name="mime_type_presentation_ext" msgid="2982650207774823437">"Predstavitev <xliff:g id="EXTENSION">%1$s</xliff:g>"</string>
     <string name="car_loading_profile" msgid="3545132581795684027">"Nalaganje"</string>
     <plurals name="file_count" formatted="false" msgid="1628600959752419449">
       <item quantity="one"><xliff:g id="FILE_NAME_2">%s</xliff:g> in še <xliff:g id="COUNT_3">%d</xliff:g> datoteka</item>
@@ -2073,4 +2092,6 @@
       <item quantity="few"><xliff:g id="FILE_NAME_2">%s</xliff:g> in še <xliff:g id="COUNT_3">%d</xliff:g> datoteke</item>
       <item quantity="other"><xliff:g id="FILE_NAME_2">%s</xliff:g> in še <xliff:g id="COUNT_3">%d</xliff:g> datotek</item>
     </plurals>
+    <!-- no translation found for chooser_no_direct_share_targets (997970693708458895) -->
+    <skip />
 </resources>
diff --git a/core/res/res/values-sq/strings.xml b/core/res/res/values-sq/strings.xml
index 1474dfc..61703f3 100644
--- a/core/res/res/values-sq/strings.xml
+++ b/core/res/res/values-sq/strings.xml
@@ -308,15 +308,15 @@
     <string name="permgrouplab_phone" msgid="5229115638567440675">"Telefoni"</string>
     <string name="permgroupdesc_phone" msgid="6234224354060641055">"kryej dhe menaxho telefonata"</string>
     <string name="permgrouprequest_phone" msgid="9166979577750581037">"Të lejohet që &lt;b&gt;<xliff:g id="APP_NAME">%1$s</xliff:g>&lt;/b&gt; të kryejë dhe të menaxhojë telefonata?"</string>
-    <string name="permgrouplab_sensors" msgid="416037179223226722">"Sensorët e trupit"</string>
+    <string name="permgrouplab_sensors" msgid="4838614103153567532">"Sensorët e trupit"</string>
     <string name="permgroupdesc_sensors" msgid="7147968539346634043">"qasu tek të dhënat e sensorëve rreth shenjave të tua jetësore"</string>
     <string name="permgrouprequest_sensors" msgid="6349806962814556786">"Të lejohet që &lt;b&gt;<xliff:g id="APP_NAME">%1$s</xliff:g>&lt;/b&gt; të ketë qasje te të dhënat e sensorëve rreth shenjave të tua jetësore?"</string>
     <string name="permgrouplab_aural" msgid="965607064083134896">"Muzika"</string>
     <string name="permgroupdesc_aural" msgid="4870189506255958055">"qasu te muzika jote"</string>
     <string name="permgrouprequest_aural" msgid="6787926123071735620">"Të lejohet që &lt;b&gt;<xliff:g id="APP_NAME">%1$s</xliff:g>&lt;/b&gt; të ketë qasje te muzika jote?"</string>
-    <string name="permgrouplab_visual" msgid="8030190588123857921">"Fotografitë dhe videot"</string>
+    <string name="permgrouplab_visual" msgid="6477382108771145134">"Fotografitë dhe videot"</string>
     <string name="permgroupdesc_visual" msgid="3415827902566663546">"qasu te fotografitë dhe videot e tua"</string>
-    <string name="permgrouprequest_visual" msgid="6907523945030290376">"Të lejohet që &lt;b&gt;<xliff:g id="APP_NAME">%1$s</xliff:g>&lt;/b&gt; të ketë qasje te fotografitë dhe videot e tua?"</string>
+    <string name="permgrouprequest_visual" msgid="3043752127595243314">"Të lejohet që &lt;b&gt;<xliff:g id="APP_NAME">%1$s</xliff:g>&lt;/b&gt; të qaset te fotografitë dhe videot e tua, duke përfshirë vendndodhjet e etiketuara?"</string>
     <string name="capability_title_canRetrieveWindowContent" msgid="3901717936930170320">"Nxjerrë përmbajtjen e dritares"</string>
     <string name="capability_desc_canRetrieveWindowContent" msgid="3772225008605310672">"Inspekton përmbajtjen e dritares me të cilën po ndërvepron."</string>
     <string name="capability_title_canRequestTouchExploration" msgid="3108723364676667320">"Aktivizojë funksionin \"Eksploro me prekje\""</string>
@@ -1397,8 +1397,7 @@
     <string name="ext_media_init_action" msgid="7952885510091978278">"Konfiguro"</string>
     <string name="ext_media_unmount_action" msgid="1121883233103278199">"Nxirr"</string>
     <string name="ext_media_browse_action" msgid="8322172381028546087">"Eksploro"</string>
-    <!-- no translation found for ext_media_seamless_action (6575980560886881233) -->
-    <skip />
+    <string name="ext_media_seamless_action" msgid="6575980560886881233">"Ndrysho daljen"</string>
     <string name="ext_media_missing_title" msgid="620980315821543904">"<xliff:g id="NAME">%s</xliff:g> mungon"</string>
     <string name="ext_media_missing_message" msgid="4012389235250987930">"Fut përsëri pajisjen"</string>
     <string name="ext_media_move_specific_title" msgid="1471100343872375842">"Po zhvendos <xliff:g id="NAME">%s</xliff:g>"</string>
@@ -1612,6 +1611,8 @@
     <string name="display_manager_overlay_display_name" msgid="5142365982271620716">"Mbivendosja #<xliff:g id="ID">%1$d</xliff:g>"</string>
     <string name="display_manager_overlay_display_title" msgid="652124517672257172">"<xliff:g id="NAME">%1$s</xliff:g>: <xliff:g id="WIDTH">%2$d</xliff:g>x<xliff:g id="HEIGHT">%3$d</xliff:g>, <xliff:g id="DPI">%4$d</xliff:g> ppi"</string>
     <string name="display_manager_overlay_display_secure_suffix" msgid="6022119702628572080">", i sigurt"</string>
+    <string name="activity_starter_block_bg_activity_starts_permissive" msgid="5692097903712956720">"Kjo nisje e aktivitetit në sfond nga <xliff:g id="PACKAGENAME">%1$s</xliff:g> do të bllokohet në ndërtimet e ardhshme të Q. Shiko në go/q-bg-block."</string>
+    <string name="activity_starter_block_bg_activity_starts_enforcing" msgid="8299522481076404353">"Nisja e aktivitetit në sfond nga <xliff:g id="PACKAGENAME">%1$s</xliff:g> u bllokua. Shiko në go/q-bg-block."</string>
     <string name="kg_forgot_pattern_button_text" msgid="8852021467868220608">"Harrova motivin"</string>
     <string name="kg_wrong_pattern" msgid="1850806070801358830">"Motivi është i gabuar"</string>
     <string name="kg_wrong_password" msgid="2333281762128113157">"Fjalëkalim i gabuar"</string>
@@ -1997,9 +1998,29 @@
     <string name="dynamic_mode_notification_channel_name" msgid="2348803891571320452">"Njoftimi i informacionit të \"Modalitetit rutinë\""</string>
     <string name="dynamic_mode_notification_title" msgid="508815255807182035">"Bateria mund të mbarojë përpara ngarkimit të zakonshëm"</string>
     <string name="dynamic_mode_notification_summary" msgid="2541166298550402690">"\"Kursyesi i baterisë\" u aktivizua për të zgjatur jetëgjatësinë e baterisë"</string>
+    <string name="mime_type_folder" msgid="7111951698626315204">"Dosje"</string>
+    <string name="mime_type_apk" msgid="5518003630972506900">"Aplikacion i Android"</string>
+    <string name="mime_type_generic" msgid="6833871596845900027">"Skedar"</string>
+    <string name="mime_type_generic_ext" msgid="8450275970061657174">"Skedar <xliff:g id="EXTENSION">%1$s</xliff:g>"</string>
+    <string name="mime_type_audio" msgid="6289777657172050926">"Audio"</string>
+    <string name="mime_type_audio_ext" msgid="3270880987725816210">"Audio <xliff:g id="EXTENSION">%1$s</xliff:g>"</string>
+    <string name="mime_type_video" msgid="4093025777317307426">"Video"</string>
+    <string name="mime_type_video_ext" msgid="5643771615714173159">"Video <xliff:g id="EXTENSION">%1$s</xliff:g>"</string>
+    <string name="mime_type_image" msgid="3144284451605236371">"Imazh"</string>
+    <string name="mime_type_image_ext" msgid="1514613218742736590">"Imazh <xliff:g id="EXTENSION">%1$s</xliff:g>"</string>
+    <string name="mime_type_compressed" msgid="1645486037074943257">"Arkiv"</string>
+    <string name="mime_type_compressed_ext" msgid="4232293058067801528">"Arkiv <xliff:g id="EXTENSION">%1$s</xliff:g>"</string>
+    <string name="mime_type_document" msgid="1596838147256375966">"Dokument"</string>
+    <string name="mime_type_document_ext" msgid="6327266601345501281">"Dokument <xliff:g id="EXTENSION">%1$s</xliff:g>"</string>
+    <string name="mime_type_spreadsheet" msgid="2639138255207123557">"Fletëllogaritëse"</string>
+    <string name="mime_type_spreadsheet_ext" msgid="5508653032786106725">"Fletëllogaritëse <xliff:g id="EXTENSION">%1$s</xliff:g>"</string>
+    <string name="mime_type_presentation" msgid="6145604688774787357">"Prezantim"</string>
+    <string name="mime_type_presentation_ext" msgid="2982650207774823437">"Prezantim <xliff:g id="EXTENSION">%1$s</xliff:g>"</string>
     <string name="car_loading_profile" msgid="3545132581795684027">"Po ngarkohet"</string>
     <plurals name="file_count" formatted="false" msgid="1628600959752419449">
       <item quantity="other"><xliff:g id="FILE_NAME_2">%s</xliff:g> + <xliff:g id="COUNT_3">%d</xliff:g> skedarë</item>
       <item quantity="one"><xliff:g id="FILE_NAME_0">%s</xliff:g> + <xliff:g id="COUNT_1">%d</xliff:g> skedar</item>
     </plurals>
+    <!-- no translation found for chooser_no_direct_share_targets (997970693708458895) -->
+    <skip />
 </resources>
diff --git a/core/res/res/values-sr/strings.xml b/core/res/res/values-sr/strings.xml
index ef28488..68c272c 100644
--- a/core/res/res/values-sr/strings.xml
+++ b/core/res/res/values-sr/strings.xml
@@ -311,15 +311,15 @@
     <string name="permgrouplab_phone" msgid="5229115638567440675">"Телефон"</string>
     <string name="permgroupdesc_phone" msgid="6234224354060641055">"упућује телефонске позиве и управља њима"</string>
     <string name="permgrouprequest_phone" msgid="9166979577750581037">"Желите ли да омогућите да &lt;b&gt;<xliff:g id="APP_NAME">%1$s</xliff:g>&lt;/b&gt; упућује позиве и управља њима?"</string>
-    <string name="permgrouplab_sensors" msgid="416037179223226722">"Сензори за тело"</string>
+    <string name="permgrouplab_sensors" msgid="4838614103153567532">"Сензори за тело"</string>
     <string name="permgroupdesc_sensors" msgid="7147968539346634043">"приступа подацима сензора о виталним функцијама"</string>
     <string name="permgrouprequest_sensors" msgid="6349806962814556786">"Желите ли да омогућите да &lt;b&gt;<xliff:g id="APP_NAME">%1$s</xliff:g>&lt;/b&gt;приступа подацима сензора о виталним функцијама?"</string>
     <string name="permgrouplab_aural" msgid="965607064083134896">"Музика"</string>
     <string name="permgroupdesc_aural" msgid="4870189506255958055">"приступ музици"</string>
     <string name="permgrouprequest_aural" msgid="6787926123071735620">"Желите ли да омогућите да &lt;b&gt;<xliff:g id="APP_NAME">%1$s</xliff:g>&lt;/b&gt; приступа музици?"</string>
-    <string name="permgrouplab_visual" msgid="8030190588123857921">"Слике и видео снимци"</string>
+    <string name="permgrouplab_visual" msgid="6477382108771145134">"Слике и видео снимци"</string>
     <string name="permgroupdesc_visual" msgid="3415827902566663546">"приступ сликама и видео снимцима"</string>
-    <string name="permgrouprequest_visual" msgid="6907523945030290376">"Желите ли да омогућите да &lt;b&gt;<xliff:g id="APP_NAME">%1$s</xliff:g>&lt;/b&gt; приступа сликама и видео снимцима?"</string>
+    <string name="permgrouprequest_visual" msgid="3043752127595243314">"Желите ли да дозволите да „<xliff:g id="APP_NAME">%1$s</xliff:g>“ приступа сликама и видео снимцима, укључујући означене локације?"</string>
     <string name="capability_title_canRetrieveWindowContent" msgid="3901717936930170320">"да преузима садржај прозора"</string>
     <string name="capability_desc_canRetrieveWindowContent" msgid="3772225008605310672">"Проверава садржај прозора са којим остварујете интеракцију."</string>
     <string name="capability_title_canRequestTouchExploration" msgid="3108723364676667320">"да укључи Истраживања додиром"</string>
@@ -1418,8 +1418,7 @@
     <string name="ext_media_init_action" msgid="7952885510091978278">"Активирај"</string>
     <string name="ext_media_unmount_action" msgid="1121883233103278199">"Избаци"</string>
     <string name="ext_media_browse_action" msgid="8322172381028546087">"Истражи"</string>
-    <!-- no translation found for ext_media_seamless_action (6575980560886881233) -->
-    <skip />
+    <string name="ext_media_seamless_action" msgid="6575980560886881233">"Промените излаз"</string>
     <string name="ext_media_missing_title" msgid="620980315821543904">"<xliff:g id="NAME">%s</xliff:g> недостаје"</string>
     <string name="ext_media_missing_message" msgid="4012389235250987930">"Поново уметните уређај"</string>
     <string name="ext_media_move_specific_title" msgid="1471100343872375842">"Преноси се <xliff:g id="NAME">%s</xliff:g>"</string>
@@ -1634,6 +1633,8 @@
     <string name="display_manager_overlay_display_name" msgid="5142365982271620716">"Постављени елемент бр. <xliff:g id="ID">%1$d</xliff:g>"</string>
     <string name="display_manager_overlay_display_title" msgid="652124517672257172">"<xliff:g id="NAME">%1$s</xliff:g>: <xliff:g id="WIDTH">%2$d</xliff:g>×<xliff:g id="HEIGHT">%3$d</xliff:g>, <xliff:g id="DPI">%4$d</xliff:g> dpi"</string>
     <string name="display_manager_overlay_display_secure_suffix" msgid="6022119702628572080">", безбедно"</string>
+    <string name="activity_starter_block_bg_activity_starts_permissive" msgid="5692097903712956720">"Ово покретање активности у позадини са <xliff:g id="PACKAGENAME">%1$s</xliff:g> биће блокирано у будућим Q верзијама. Погледајте go/q-bg-block."</string>
+    <string name="activity_starter_block_bg_activity_starts_enforcing" msgid="8299522481076404353">"Покретање активности у позадини са <xliff:g id="PACKAGENAME">%1$s</xliff:g> је блокирано. Погледајте go/q-bg-block."</string>
     <string name="kg_forgot_pattern_button_text" msgid="8852021467868220608">"Заборављени шаблон"</string>
     <string name="kg_wrong_pattern" msgid="1850806070801358830">"Погрешан шаблон"</string>
     <string name="kg_wrong_password" msgid="2333281762128113157">"Погрешна лозинка"</string>
@@ -2031,10 +2032,30 @@
     <string name="dynamic_mode_notification_channel_name" msgid="2348803891571320452">"Обавештење о информацијама Рутинског режима"</string>
     <string name="dynamic_mode_notification_title" msgid="508815255807182035">"Батерија ће се можда испразнити пре уобичајеног пуњења"</string>
     <string name="dynamic_mode_notification_summary" msgid="2541166298550402690">"Уштеда батерије је активирана да би се продужило трајање батерије"</string>
+    <string name="mime_type_folder" msgid="7111951698626315204">"Директоријум"</string>
+    <string name="mime_type_apk" msgid="5518003630972506900">"Android апликација"</string>
+    <string name="mime_type_generic" msgid="6833871596845900027">"Датотека"</string>
+    <string name="mime_type_generic_ext" msgid="8450275970061657174">"<xliff:g id="EXTENSION">%1$s</xliff:g> датотека"</string>
+    <string name="mime_type_audio" msgid="6289777657172050926">"Аудио датотека"</string>
+    <string name="mime_type_audio_ext" msgid="3270880987725816210">"<xliff:g id="EXTENSION">%1$s</xliff:g> аудио датотека"</string>
+    <string name="mime_type_video" msgid="4093025777317307426">"Видео"</string>
+    <string name="mime_type_video_ext" msgid="5643771615714173159">"<xliff:g id="EXTENSION">%1$s</xliff:g> видео"</string>
+    <string name="mime_type_image" msgid="3144284451605236371">"Слика"</string>
+    <string name="mime_type_image_ext" msgid="1514613218742736590">"<xliff:g id="EXTENSION">%1$s</xliff:g> слика"</string>
+    <string name="mime_type_compressed" msgid="1645486037074943257">"Архива"</string>
+    <string name="mime_type_compressed_ext" msgid="4232293058067801528">"<xliff:g id="EXTENSION">%1$s</xliff:g> архива"</string>
+    <string name="mime_type_document" msgid="1596838147256375966">"Документ"</string>
+    <string name="mime_type_document_ext" msgid="6327266601345501281">"<xliff:g id="EXTENSION">%1$s</xliff:g> документ"</string>
+    <string name="mime_type_spreadsheet" msgid="2639138255207123557">"Табела"</string>
+    <string name="mime_type_spreadsheet_ext" msgid="5508653032786106725">"<xliff:g id="EXTENSION">%1$s</xliff:g> табела"</string>
+    <string name="mime_type_presentation" msgid="6145604688774787357">"Презентација"</string>
+    <string name="mime_type_presentation_ext" msgid="2982650207774823437">"<xliff:g id="EXTENSION">%1$s</xliff:g> презентација"</string>
     <string name="car_loading_profile" msgid="3545132581795684027">"Учитава се"</string>
     <plurals name="file_count" formatted="false" msgid="1628600959752419449">
       <item quantity="one"><xliff:g id="FILE_NAME_2">%s</xliff:g> и још <xliff:g id="COUNT_3">%d</xliff:g> датотека</item>
       <item quantity="few"><xliff:g id="FILE_NAME_2">%s</xliff:g> и још <xliff:g id="COUNT_3">%d</xliff:g> датотеке</item>
       <item quantity="other"><xliff:g id="FILE_NAME_2">%s</xliff:g> и још <xliff:g id="COUNT_3">%d</xliff:g> датотека</item>
     </plurals>
+    <!-- no translation found for chooser_no_direct_share_targets (997970693708458895) -->
+    <skip />
 </resources>
diff --git a/core/res/res/values-sv/strings.xml b/core/res/res/values-sv/strings.xml
index df9a5c6..aaf33bb 100644
--- a/core/res/res/values-sv/strings.xml
+++ b/core/res/res/values-sv/strings.xml
@@ -308,15 +308,15 @@
     <string name="permgrouplab_phone" msgid="5229115638567440675">"Telefon"</string>
     <string name="permgroupdesc_phone" msgid="6234224354060641055">"ringa och hantera telefonsamtal"</string>
     <string name="permgrouprequest_phone" msgid="9166979577750581037">"Vill du ge &lt;b&gt;<xliff:g id="APP_NAME">%1$s</xliff:g>&lt;/b&gt; behörighet att ringa och hantera telefonsamtal?"</string>
-    <string name="permgrouplab_sensors" msgid="416037179223226722">"Kroppssensorer"</string>
+    <string name="permgrouplab_sensors" msgid="4838614103153567532">"Kroppssensorer"</string>
     <string name="permgroupdesc_sensors" msgid="7147968539346634043">"få åtkomst till sensordata om dina vitalparametrar"</string>
     <string name="permgrouprequest_sensors" msgid="6349806962814556786">"Vill du ge &lt;b&gt;<xliff:g id="APP_NAME">%1$s</xliff:g>&lt;/b&gt; åtkomst till sensordata om vitalparametrar?"</string>
     <string name="permgrouplab_aural" msgid="965607064083134896">"Musik"</string>
     <string name="permgroupdesc_aural" msgid="4870189506255958055">"åtkomstbehörighet till din musik"</string>
     <string name="permgrouprequest_aural" msgid="6787926123071735620">"Vill du ge &lt;b&gt;<xliff:g id="APP_NAME">%1$s</xliff:g>&lt;/b&gt; åtkomstbehörighet till din musik?"</string>
-    <string name="permgrouplab_visual" msgid="8030190588123857921">"Foton och videor"</string>
+    <string name="permgrouplab_visual" msgid="6477382108771145134">"Foton och videor"</string>
     <string name="permgroupdesc_visual" msgid="3415827902566663546">"åtkomstbehörighet till dina foton &amp; videor"</string>
-    <string name="permgrouprequest_visual" msgid="6907523945030290376">"Vill du ge &lt;b&gt;<xliff:g id="APP_NAME">%1$s</xliff:g>&lt;/b&gt; åtkomstbehörighet till dina foton och videor?"</string>
+    <string name="permgrouprequest_visual" msgid="3043752127595243314">"Vill du tillåta att &lt;b&gt;<xliff:g id="APP_NAME">%1$s</xliff:g>&lt;/b&gt; får åtkomst till dina foton och videor, inklusive taggade platser?"</string>
     <string name="capability_title_canRetrieveWindowContent" msgid="3901717936930170320">"Hämta fönsterinnehåll"</string>
     <string name="capability_desc_canRetrieveWindowContent" msgid="3772225008605310672">"Granska innehållet i ett fönster som du interagerar med."</string>
     <string name="capability_title_canRequestTouchExploration" msgid="3108723364676667320">"Aktivera Explore by touch"</string>
@@ -1396,8 +1396,7 @@
     <string name="ext_media_init_action" msgid="7952885510091978278">"Konfigurera"</string>
     <string name="ext_media_unmount_action" msgid="1121883233103278199">"Mata ut"</string>
     <string name="ext_media_browse_action" msgid="8322172381028546087">"Utforska"</string>
-    <!-- no translation found for ext_media_seamless_action (6575980560886881233) -->
-    <skip />
+    <string name="ext_media_seamless_action" msgid="6575980560886881233">"Utdata som styrs med reglaget"</string>
     <string name="ext_media_missing_title" msgid="620980315821543904">"<xliff:g id="NAME">%s</xliff:g> saknas"</string>
     <string name="ext_media_missing_message" msgid="4012389235250987930">"Sätt i enheten igen"</string>
     <string name="ext_media_move_specific_title" msgid="1471100343872375842">"Flyttar <xliff:g id="NAME">%s</xliff:g>"</string>
@@ -1611,6 +1610,8 @@
     <string name="display_manager_overlay_display_name" msgid="5142365982271620716">"Överlagring #<xliff:g id="ID">%1$d</xliff:g>"</string>
     <string name="display_manager_overlay_display_title" msgid="652124517672257172">"<xliff:g id="NAME">%1$s</xliff:g>: <xliff:g id="WIDTH">%2$d</xliff:g> x <xliff:g id="HEIGHT">%3$d</xliff:g>, <xliff:g id="DPI">%4$d</xliff:g> dpi"</string>
     <string name="display_manager_overlay_display_secure_suffix" msgid="6022119702628572080">", säker"</string>
+    <string name="activity_starter_block_bg_activity_starts_permissive" msgid="5692097903712956720">"Denna start bakgrundsaktivitet från <xliff:g id="PACKAGENAME">%1$s</xliff:g> blockeras i framtida Q-versioner. Besök go/q-bg-block."</string>
+    <string name="activity_starter_block_bg_activity_starts_enforcing" msgid="8299522481076404353">"Start av bakgrundsaktivitet från <xliff:g id="PACKAGENAME">%1$s</xliff:g> blockerades. Besök go/q-bg-block."</string>
     <string name="kg_forgot_pattern_button_text" msgid="8852021467868220608">"Har du glömt ditt grafiska lösenord?"</string>
     <string name="kg_wrong_pattern" msgid="1850806070801358830">"Fel grafiskt lösenord"</string>
     <string name="kg_wrong_password" msgid="2333281762128113157">"Fel lösenord"</string>
@@ -1996,9 +1997,29 @@
     <string name="dynamic_mode_notification_channel_name" msgid="2348803891571320452">"Avisering om rutinläge"</string>
     <string name="dynamic_mode_notification_title" msgid="508815255807182035">"Batteriet kan ta slut innan du brukar ladda det"</string>
     <string name="dynamic_mode_notification_summary" msgid="2541166298550402690">"Batterisparläget har aktiverats för att utöka batteritiden"</string>
+    <string name="mime_type_folder" msgid="7111951698626315204">"Mapp"</string>
+    <string name="mime_type_apk" msgid="5518003630972506900">"Android-app"</string>
+    <string name="mime_type_generic" msgid="6833871596845900027">"Fil"</string>
+    <string name="mime_type_generic_ext" msgid="8450275970061657174">"<xliff:g id="EXTENSION">%1$s</xliff:g>-fil"</string>
+    <string name="mime_type_audio" msgid="6289777657172050926">"Ljud"</string>
+    <string name="mime_type_audio_ext" msgid="3270880987725816210">"<xliff:g id="EXTENSION">%1$s</xliff:g>-ljud"</string>
+    <string name="mime_type_video" msgid="4093025777317307426">"Video"</string>
+    <string name="mime_type_video_ext" msgid="5643771615714173159">"<xliff:g id="EXTENSION">%1$s</xliff:g>-video"</string>
+    <string name="mime_type_image" msgid="3144284451605236371">"Bild"</string>
+    <string name="mime_type_image_ext" msgid="1514613218742736590">"<xliff:g id="EXTENSION">%1$s</xliff:g>-bild"</string>
+    <string name="mime_type_compressed" msgid="1645486037074943257">"Arkiv"</string>
+    <string name="mime_type_compressed_ext" msgid="4232293058067801528">"<xliff:g id="EXTENSION">%1$s</xliff:g>-arkiv"</string>
+    <string name="mime_type_document" msgid="1596838147256375966">"Dokument"</string>
+    <string name="mime_type_document_ext" msgid="6327266601345501281">"<xliff:g id="EXTENSION">%1$s</xliff:g>-dokument"</string>
+    <string name="mime_type_spreadsheet" msgid="2639138255207123557">"Kalkylark"</string>
+    <string name="mime_type_spreadsheet_ext" msgid="5508653032786106725">"<xliff:g id="EXTENSION">%1$s</xliff:g>-kalkylark"</string>
+    <string name="mime_type_presentation" msgid="6145604688774787357">"Presentation"</string>
+    <string name="mime_type_presentation_ext" msgid="2982650207774823437">"<xliff:g id="EXTENSION">%1$s</xliff:g>-presentation"</string>
     <string name="car_loading_profile" msgid="3545132581795684027">"Läser in"</string>
     <plurals name="file_count" formatted="false" msgid="1628600959752419449">
       <item quantity="other"><xliff:g id="FILE_NAME_2">%s</xliff:g> + <xliff:g id="COUNT_3">%d</xliff:g> filer</item>
       <item quantity="one"><xliff:g id="FILE_NAME_0">%s</xliff:g> + <xliff:g id="COUNT_1">%d</xliff:g> fil</item>
     </plurals>
+    <!-- no translation found for chooser_no_direct_share_targets (997970693708458895) -->
+    <skip />
 </resources>
diff --git a/core/res/res/values-sw/strings.xml b/core/res/res/values-sw/strings.xml
index ae0acd5..ae7531b0 100644
--- a/core/res/res/values-sw/strings.xml
+++ b/core/res/res/values-sw/strings.xml
@@ -308,15 +308,15 @@
     <string name="permgrouplab_phone" msgid="5229115638567440675">"Simu"</string>
     <string name="permgroupdesc_phone" msgid="6234224354060641055">"piga na udhibiti simu"</string>
     <string name="permgrouprequest_phone" msgid="9166979577750581037">"Ungependa kuiruhusu &lt;b&gt;<xliff:g id="APP_NAME">%1$s</xliff:g>&lt;/b&gt; ipige na kudhibiti simu?"</string>
-    <string name="permgrouplab_sensors" msgid="416037179223226722">"Vihisi vya Mwili"</string>
+    <string name="permgrouplab_sensors" msgid="4838614103153567532">"Vihisi vya mwili"</string>
     <string name="permgroupdesc_sensors" msgid="7147968539346634043">"fikia data ya kitambuzi kuhusu alama zako muhimu"</string>
     <string name="permgrouprequest_sensors" msgid="6349806962814556786">"Ungependa kuiruhusu &lt;b&gt;<xliff:g id="APP_NAME">%1$s</xliff:g>&lt;/b&gt; ifikie data ya vitambuzi kuhusu viashiria muhimu vya mwili wako?"</string>
     <string name="permgrouplab_aural" msgid="965607064083134896">"Muziki"</string>
     <string name="permgroupdesc_aural" msgid="4870189506255958055">"kufikia muziki wako"</string>
     <string name="permgrouprequest_aural" msgid="6787926123071735620">"Ungependa kuiruhusu &lt;b&gt;<xliff:g id="APP_NAME">%1$s</xliff:g>&lt;/b&gt; ifikie muziki wako?"</string>
-    <string name="permgrouplab_visual" msgid="8030190588123857921">"Picha na Video"</string>
+    <string name="permgrouplab_visual" msgid="6477382108771145134">"Picha na video"</string>
     <string name="permgroupdesc_visual" msgid="3415827902566663546">"kufikia picha na video zako"</string>
-    <string name="permgrouprequest_visual" msgid="6907523945030290376">"Ungependa kuruhusu &lt;b&gt;<xliff:g id="APP_NAME">%1$s</xliff:g>&lt;/b&gt; ifikie picha na video zako?"</string>
+    <string name="permgrouprequest_visual" msgid="3043752127595243314">"Ungependa kuruhusu &lt;b&gt;<xliff:g id="APP_NAME">%1$s</xliff:g>&lt;/b&gt; ufikie picha na video zako, yakiwemo maeneo uliyotambulisha?"</string>
     <string name="capability_title_canRetrieveWindowContent" msgid="3901717936930170320">"Kufikia maudhui ya dirisha"</string>
     <string name="capability_desc_canRetrieveWindowContent" msgid="3772225008605310672">"Kuchunguza maudhui ya dirisha unalotumia."</string>
     <string name="capability_title_canRequestTouchExploration" msgid="3108723364676667320">"Kuwasha \'Chunguza kwa Kugusa\'"</string>
@@ -1396,8 +1396,7 @@
     <string name="ext_media_init_action" msgid="7952885510091978278">"Weka mipangilio"</string>
     <string name="ext_media_unmount_action" msgid="1121883233103278199">"Ondoa"</string>
     <string name="ext_media_browse_action" msgid="8322172381028546087">"Chunguza"</string>
-    <!-- no translation found for ext_media_seamless_action (6575980560886881233) -->
-    <skip />
+    <string name="ext_media_seamless_action" msgid="6575980560886881233">"Badilisha kifaa cha kutoa maudhui"</string>
     <string name="ext_media_missing_title" msgid="620980315821543904">"<xliff:g id="NAME">%s</xliff:g> haipo"</string>
     <string name="ext_media_missing_message" msgid="4012389235250987930">"Weka kifaa tena"</string>
     <string name="ext_media_move_specific_title" msgid="1471100343872375842">"Inahamisha <xliff:g id="NAME">%s</xliff:g>"</string>
@@ -1611,6 +1610,8 @@
     <string name="display_manager_overlay_display_name" msgid="5142365982271620716">"Uwekeleaji #<xliff:g id="ID">%1$d</xliff:g>"</string>
     <string name="display_manager_overlay_display_title" msgid="652124517672257172">"<xliff:g id="NAME">%1$s</xliff:g>: <xliff:g id="WIDTH">%2$d</xliff:g>x<xliff:g id="HEIGHT">%3$d</xliff:g>, <xliff:g id="DPI">%4$d</xliff:g> dpi"</string>
     <string name="display_manager_overlay_display_secure_suffix" msgid="6022119702628572080">", salama"</string>
+    <string name="activity_starter_block_bg_activity_starts_permissive" msgid="5692097903712956720">"Itazuia shughuli hii ya chinichini inayoanzia <xliff:g id="PACKAGENAME">%1$s</xliff:g> katika miundo ya baadaye ya Q. Angalia go/q-bg-block."</string>
+    <string name="activity_starter_block_bg_activity_starts_enforcing" msgid="8299522481076404353">"Imezuia shughuli za chinichini zinazoanzia <xliff:g id="PACKAGENAME">%1$s</xliff:g>. Angalia go/q-bg-block."</string>
     <string name="kg_forgot_pattern_button_text" msgid="8852021467868220608">"Umesahau Ruwaza"</string>
     <string name="kg_wrong_pattern" msgid="1850806070801358830">"Mchoro huo si sahihi"</string>
     <string name="kg_wrong_password" msgid="2333281762128113157">"Nenosiri Lisilo sahihi"</string>
@@ -1996,9 +1997,29 @@
     <string name="dynamic_mode_notification_channel_name" msgid="2348803891571320452">"Arifa ya maelezo ya Hali ya Kawaida"</string>
     <string name="dynamic_mode_notification_title" msgid="508815255807182035">"Huenda betri itakwisha chaji mapema"</string>
     <string name="dynamic_mode_notification_summary" msgid="2541166298550402690">"Imewasha Kiokoa Betri ili kurefusha muda wa matumizi ya betri"</string>
+    <string name="mime_type_folder" msgid="7111951698626315204">"Folda"</string>
+    <string name="mime_type_apk" msgid="5518003630972506900">"Programu ya Android"</string>
+    <string name="mime_type_generic" msgid="6833871596845900027">"Faili"</string>
+    <string name="mime_type_generic_ext" msgid="8450275970061657174">"Faili ya <xliff:g id="EXTENSION">%1$s</xliff:g>"</string>
+    <string name="mime_type_audio" msgid="6289777657172050926">"Faili ya sauti"</string>
+    <string name="mime_type_audio_ext" msgid="3270880987725816210">"Faili ya sauti ya <xliff:g id="EXTENSION">%1$s</xliff:g>"</string>
+    <string name="mime_type_video" msgid="4093025777317307426">"Video"</string>
+    <string name="mime_type_video_ext" msgid="5643771615714173159">"Video ya <xliff:g id="EXTENSION">%1$s</xliff:g>"</string>
+    <string name="mime_type_image" msgid="3144284451605236371">"Picha"</string>
+    <string name="mime_type_image_ext" msgid="1514613218742736590">"Picha ya <xliff:g id="EXTENSION">%1$s</xliff:g>"</string>
+    <string name="mime_type_compressed" msgid="1645486037074943257">"Kumbukumbu"</string>
+    <string name="mime_type_compressed_ext" msgid="4232293058067801528">"Faili ya kumbukumbu ya <xliff:g id="EXTENSION">%1$s</xliff:g>"</string>
+    <string name="mime_type_document" msgid="1596838147256375966">"Hati"</string>
+    <string name="mime_type_document_ext" msgid="6327266601345501281">"Hati ya <xliff:g id="EXTENSION">%1$s</xliff:g>"</string>
+    <string name="mime_type_spreadsheet" msgid="2639138255207123557">"Lahajedwali"</string>
+    <string name="mime_type_spreadsheet_ext" msgid="5508653032786106725">"Lahajedwali la <xliff:g id="EXTENSION">%1$s</xliff:g>"</string>
+    <string name="mime_type_presentation" msgid="6145604688774787357">"Wasilisho"</string>
+    <string name="mime_type_presentation_ext" msgid="2982650207774823437">"Wasilisho la <xliff:g id="EXTENSION">%1$s</xliff:g>"</string>
     <string name="car_loading_profile" msgid="3545132581795684027">"Inapakia"</string>
     <plurals name="file_count" formatted="false" msgid="1628600959752419449">
       <item quantity="other">Faili <xliff:g id="FILE_NAME_2">%s</xliff:g> + <xliff:g id="COUNT_3">%d</xliff:g></item>
       <item quantity="one">Faili <xliff:g id="FILE_NAME_0">%s</xliff:g> + <xliff:g id="COUNT_1">%d</xliff:g></item>
     </plurals>
+    <!-- no translation found for chooser_no_direct_share_targets (997970693708458895) -->
+    <skip />
 </resources>
diff --git a/core/res/res/values-ta/strings.xml b/core/res/res/values-ta/strings.xml
index 5d0ab34..16ea0b7 100644
--- a/core/res/res/values-ta/strings.xml
+++ b/core/res/res/values-ta/strings.xml
@@ -308,15 +308,18 @@
     <string name="permgrouplab_phone" msgid="5229115638567440675">"ஃபோன்"</string>
     <string name="permgroupdesc_phone" msgid="6234224354060641055">"யாரையும் தொலைபேசியில் அழைக்கலாம்"</string>
     <string name="permgrouprequest_phone" msgid="9166979577750581037">"மொபைல் அழைப்புகள் செய்யவும், அவற்றை நிர்வகிக்கவும், &lt;b&gt;<xliff:g id="APP_NAME">%1$s</xliff:g>&lt;/b&gt; ஆப்ஸை அனுமதிக்கவா?"</string>
-    <string name="permgrouplab_sensors" msgid="416037179223226722">"உடல் சென்சார்கள்"</string>
+    <!-- no translation found for permgrouplab_sensors (4838614103153567532) -->
+    <skip />
     <string name="permgroupdesc_sensors" msgid="7147968539346634043">"உங்கள் உடல் இயக்கம் பற்றி உணர்விகள் கூறும் தகவலைப் பார்க்கலாம்"</string>
     <string name="permgrouprequest_sensors" msgid="6349806962814556786">"உங்கள் உடலியக்கக் குறிகள் பற்றிய சென்சார் தரவை அணுகுவதற்கு &lt;b&gt;<xliff:g id="APP_NAME">%1$s</xliff:g>&lt;/b&gt; பயன்பாட்டை அனுமதிக்கவா?"</string>
     <string name="permgrouplab_aural" msgid="965607064083134896">"இசை"</string>
     <string name="permgroupdesc_aural" msgid="4870189506255958055">"இசையைக் கேட்கலாம்"</string>
     <string name="permgrouprequest_aural" msgid="6787926123071735620">"இசையை அணுக &lt;b&gt;<xliff:g id="APP_NAME">%1$s</xliff:g>&lt;/b&gt; ஆப்ஸை அனுமதிக்கவா?"</string>
-    <string name="permgrouplab_visual" msgid="8030190588123857921">"படங்கள் &amp; வீடியோக்கள்"</string>
+    <!-- no translation found for permgrouplab_visual (6477382108771145134) -->
+    <skip />
     <string name="permgroupdesc_visual" msgid="3415827902566663546">"படங்கள் &amp; வீடியோக்களைப் பார்க்கலாம்"</string>
-    <string name="permgrouprequest_visual" msgid="6907523945030290376">"படங்கள் &amp; வீடியோக்களை அணுக &lt;b&gt;<xliff:g id="APP_NAME">%1$s</xliff:g>&lt;/b&gt; ஆப்ஸை அனுமதிக்கவா?"</string>
+    <!-- no translation found for permgrouprequest_visual (3043752127595243314) -->
+    <skip />
     <string name="capability_title_canRetrieveWindowContent" msgid="3901717936930170320">"சாளர உள்ளடக்கத்தைப் பெறும்"</string>
     <string name="capability_desc_canRetrieveWindowContent" msgid="3772225008605310672">"நீங்கள் பணியாற்றிக் கொண்டிருக்கும் சாளரத்தின் உள்ளடக்கத்தைப் பார்க்கலாம்."</string>
     <string name="capability_title_canRequestTouchExploration" msgid="3108723364676667320">"தொடுவதன் மூலம் அறிவதை இயக்கும்"</string>
@@ -1397,8 +1400,7 @@
     <string name="ext_media_init_action" msgid="7952885510091978278">"அமை"</string>
     <string name="ext_media_unmount_action" msgid="1121883233103278199">"வெளியேற்று"</string>
     <string name="ext_media_browse_action" msgid="8322172381028546087">"உலாவுக"</string>
-    <!-- no translation found for ext_media_seamless_action (6575980560886881233) -->
-    <skip />
+    <string name="ext_media_seamless_action" msgid="6575980560886881233">"வெளியீட்டை மாற்று"</string>
     <string name="ext_media_missing_title" msgid="620980315821543904">"<xliff:g id="NAME">%s</xliff:g> இல்லை"</string>
     <string name="ext_media_missing_message" msgid="4012389235250987930">"மீண்டும் சாதனத்தைச் செருகவும்"</string>
     <string name="ext_media_move_specific_title" msgid="1471100343872375842">"<xliff:g id="NAME">%s</xliff:g>ஐ நகர்த்துகிறது"</string>
@@ -1612,6 +1614,8 @@
     <string name="display_manager_overlay_display_name" msgid="5142365982271620716">"மேலோட்ட #<xliff:g id="ID">%1$d</xliff:g>"</string>
     <string name="display_manager_overlay_display_title" msgid="652124517672257172">"<xliff:g id="NAME">%1$s</xliff:g>: <xliff:g id="WIDTH">%2$d</xliff:g>x<xliff:g id="HEIGHT">%3$d</xliff:g>, <xliff:g id="DPI">%4$d</xliff:g> dpi"</string>
     <string name="display_manager_overlay_display_secure_suffix" msgid="6022119702628572080">", பாதுகாப்பானது"</string>
+    <string name="activity_starter_block_bg_activity_starts_permissive" msgid="5692097903712956720">"<xliff:g id="PACKAGENAME">%1$s</xliff:g> என்பதன் பின்னணிச் செயல்பாடு இனிவரும் Q பதிப்புகளில் தடுக்கப்படும். go/q-bg-block என்பதைப் பார்க்கவும்."</string>
+    <string name="activity_starter_block_bg_activity_starts_enforcing" msgid="8299522481076404353">"<xliff:g id="PACKAGENAME">%1$s</xliff:g> என்பதன் பின்னணிச் செயல்பாடு தடுக்கப்பட்டுள்ளது. go/q-bg-block என்பதைப் பார்க்கவும்."</string>
     <string name="kg_forgot_pattern_button_text" msgid="8852021467868220608">"வடிவத்தை மறந்துவிட்டீர்களா"</string>
     <string name="kg_wrong_pattern" msgid="1850806070801358830">"தவறான வடிவம்"</string>
     <string name="kg_wrong_password" msgid="2333281762128113157">"தவறான கடவுச்சொல்"</string>
@@ -1997,9 +2001,29 @@
     <string name="dynamic_mode_notification_channel_name" msgid="2348803891571320452">"வழக்கமான பேட்டரி சேமிப்பானுக்கான விவர அறிவிப்பு"</string>
     <string name="dynamic_mode_notification_title" msgid="508815255807182035">"வழக்கமாகச் சார்ஜ் செய்வதற்கு முன்பே பேட்டரி தீர்ந்துபோகக்கூடும்"</string>
     <string name="dynamic_mode_notification_summary" msgid="2541166298550402690">"பேட்டரி நிலையை நீட்டிக்க பேட்டரி சேமிப்பான் இயக்கப்பட்டுள்ளது"</string>
+    <string name="mime_type_folder" msgid="7111951698626315204">"கோப்புறை"</string>
+    <string name="mime_type_apk" msgid="5518003630972506900">"Android ஆப்ஸ்"</string>
+    <string name="mime_type_generic" msgid="6833871596845900027">"ஃபைல்"</string>
+    <string name="mime_type_generic_ext" msgid="8450275970061657174">"<xliff:g id="EXTENSION">%1$s</xliff:g> ஃபைல்"</string>
+    <string name="mime_type_audio" msgid="6289777657172050926">"ஆடியோ"</string>
+    <string name="mime_type_audio_ext" msgid="3270880987725816210">"<xliff:g id="EXTENSION">%1$s</xliff:g> ஆடியோ"</string>
+    <string name="mime_type_video" msgid="4093025777317307426">"வீடியோ"</string>
+    <string name="mime_type_video_ext" msgid="5643771615714173159">"<xliff:g id="EXTENSION">%1$s</xliff:g> வீடியோ"</string>
+    <string name="mime_type_image" msgid="3144284451605236371">"படம்"</string>
+    <string name="mime_type_image_ext" msgid="1514613218742736590">"<xliff:g id="EXTENSION">%1$s</xliff:g> படம்"</string>
+    <string name="mime_type_compressed" msgid="1645486037074943257">"காப்பக ஃபைல்"</string>
+    <string name="mime_type_compressed_ext" msgid="4232293058067801528">"<xliff:g id="EXTENSION">%1$s</xliff:g> காப்பக ஃபைல்"</string>
+    <string name="mime_type_document" msgid="1596838147256375966">"ஆவணம்"</string>
+    <string name="mime_type_document_ext" msgid="6327266601345501281">"<xliff:g id="EXTENSION">%1$s</xliff:g> ஆவணம்"</string>
+    <string name="mime_type_spreadsheet" msgid="2639138255207123557">"விரிதாள்"</string>
+    <string name="mime_type_spreadsheet_ext" msgid="5508653032786106725">"<xliff:g id="EXTENSION">%1$s</xliff:g> விரிதாள்"</string>
+    <string name="mime_type_presentation" msgid="6145604688774787357">"விளக்கக்காட்சி"</string>
+    <string name="mime_type_presentation_ext" msgid="2982650207774823437">"<xliff:g id="EXTENSION">%1$s</xliff:g> விளக்கக்காட்சி"</string>
     <string name="car_loading_profile" msgid="3545132581795684027">"ஏற்றுகிறது"</string>
     <plurals name="file_count" formatted="false" msgid="1628600959752419449">
       <item quantity="other"><xliff:g id="FILE_NAME_2">%s</xliff:g> + <xliff:g id="COUNT_3">%d</xliff:g> ஃபைல்கள்</item>
       <item quantity="one"><xliff:g id="FILE_NAME_0">%s</xliff:g> + <xliff:g id="COUNT_1">%d</xliff:g> ஃபைல்</item>
     </plurals>
+    <!-- no translation found for chooser_no_direct_share_targets (997970693708458895) -->
+    <skip />
 </resources>
diff --git a/core/res/res/values-te/strings.xml b/core/res/res/values-te/strings.xml
index 7406b5a..ded03cc 100644
--- a/core/res/res/values-te/strings.xml
+++ b/core/res/res/values-te/strings.xml
@@ -308,15 +308,15 @@
     <string name="permgrouplab_phone" msgid="5229115638567440675">"ఫోన్"</string>
     <string name="permgroupdesc_phone" msgid="6234224354060641055">"ఫోన్ కాల్‌లు చేయడం మరియు నిర్వహించడం"</string>
     <string name="permgrouprequest_phone" msgid="9166979577750581037">"ఫోన్ కాల్‌లు చేయడానికి మరియు నిర్వహించడానికి &lt;b&gt;<xliff:g id="APP_NAME">%1$s</xliff:g>&lt;/b&gt;ని అనుమతించాలా?"</string>
-    <string name="permgrouplab_sensors" msgid="416037179223226722">"శరీర సెన్సార్‌లు"</string>
+    <string name="permgrouplab_sensors" msgid="4838614103153567532">"శరీర సెన్సార్‌లు"</string>
     <string name="permgroupdesc_sensors" msgid="7147968539346634043">"మీ అత్యంత కీలకమైన గుర్తుల గురించి సెన్సార్ డేటాని యాక్సెస్ చేస్తుంది"</string>
     <string name="permgrouprequest_sensors" msgid="6349806962814556786">"మీ అత్యంత కీలకమైన గుర్తుల గురించి సెన్సార్ డేటాని యాక్సెస్ చేయడానికి &lt;b&gt;<xliff:g id="APP_NAME">%1$s</xliff:g>&lt;/b&gt;ని అనుమతించాలా?"</string>
     <string name="permgrouplab_aural" msgid="965607064083134896">"సంగీతం"</string>
     <string name="permgroupdesc_aural" msgid="4870189506255958055">"మీ సంగీతాన్ని యాక్సెస్ చేయండి"</string>
     <string name="permgrouprequest_aural" msgid="6787926123071735620">"మీ సంగీతాన్ని యాక్సెస్ చేయడానికి &lt;b&gt;<xliff:g id="APP_NAME">%1$s</xliff:g>&lt;/b&gt;ని అనుమతించాలా?"</string>
-    <string name="permgrouplab_visual" msgid="8030190588123857921">"ఫోటోలు &amp; వీడియోలు"</string>
+    <string name="permgrouplab_visual" msgid="6477382108771145134">"ఫోటోలు &amp; వీడియోలు"</string>
     <string name="permgroupdesc_visual" msgid="3415827902566663546">"మీ ఫోటోలను &amp; వీడియోలను యాక్సెస్ చేయండి"</string>
-    <string name="permgrouprequest_visual" msgid="6907523945030290376">"మీ ఫోటోలు &amp; వీడియోలు యాక్సెస్ చేయడానికి &lt;b&gt;<xliff:g id="APP_NAME">%1$s</xliff:g>&lt;/b&gt;ని అనుమతించాలా?"</string>
+    <string name="permgrouprequest_visual" msgid="3043752127595243314">"ట్యాగ్ చేసిన స్థానాలతో సహా, మీ ఫోటోలు, వీడియోలను యాక్సెస్ చేయడానికి &lt;b&gt;<xliff:g id="APP_NAME">%1$s</xliff:g>&lt;/b&gt;ను అనుమతించాలా?"</string>
     <string name="capability_title_canRetrieveWindowContent" msgid="3901717936930170320">"విండో కంటెంట్‍ను తిరిగి పొందుతుంది"</string>
     <string name="capability_desc_canRetrieveWindowContent" msgid="3772225008605310672">"మీరు పరస్పర చర్య చేస్తున్న విండో కంటెంట్‌‍ను పరిశీలిస్తుంది."</string>
     <string name="capability_title_canRequestTouchExploration" msgid="3108723364676667320">"తాకడం ద్వారా విశ్లేషణను ప్రారంభిస్తుంది"</string>
@@ -1397,8 +1397,7 @@
     <string name="ext_media_init_action" msgid="7952885510091978278">"సెటప్ చేయండి"</string>
     <string name="ext_media_unmount_action" msgid="1121883233103278199">"తొలగించు"</string>
     <string name="ext_media_browse_action" msgid="8322172381028546087">"విశ్లేషించు"</string>
-    <!-- no translation found for ext_media_seamless_action (6575980560886881233) -->
-    <skip />
+    <string name="ext_media_seamless_action" msgid="6575980560886881233">"అవుట్‌పుట్ మార్చండి"</string>
     <string name="ext_media_missing_title" msgid="620980315821543904">"<xliff:g id="NAME">%s</xliff:g> కనుగొనబడటం లేదు"</string>
     <string name="ext_media_missing_message" msgid="4012389235250987930">"పరికరాన్ని మళ్లీ చొప్పించండి"</string>
     <string name="ext_media_move_specific_title" msgid="1471100343872375842">"<xliff:g id="NAME">%s</xliff:g>ని తరలిస్తోంది"</string>
@@ -1612,6 +1611,8 @@
     <string name="display_manager_overlay_display_name" msgid="5142365982271620716">"అతివ్యాప్తి #<xliff:g id="ID">%1$d</xliff:g>"</string>
     <string name="display_manager_overlay_display_title" msgid="652124517672257172">"<xliff:g id="NAME">%1$s</xliff:g>: <xliff:g id="WIDTH">%2$d</xliff:g>x<xliff:g id="HEIGHT">%3$d</xliff:g>, <xliff:g id="DPI">%4$d</xliff:g> dpi"</string>
     <string name="display_manager_overlay_display_secure_suffix" msgid="6022119702628572080">", సురక్షితం"</string>
+    <string name="activity_starter_block_bg_activity_starts_permissive" msgid="5692097903712956720">"<xliff:g id="PACKAGENAME">%1$s</xliff:g> నుండి ప్రారంభం అయ్యే నేపథ్య కార్యకలాపం భవిష్యత్తు Q బిల్డ్‌లలో బ్లాక్ చేయబడుతుంది. go/q-bg-block చూడండి."</string>
+    <string name="activity_starter_block_bg_activity_starts_enforcing" msgid="8299522481076404353">"<xliff:g id="PACKAGENAME">%1$s</xliff:g> నుండి ప్రారంభం అయ్యే నేపథ్య కార్యకలాపం బ్లాక్ చేయబడింది. go/q-bg-block చూడండి."</string>
     <string name="kg_forgot_pattern_button_text" msgid="8852021467868220608">"నమూనాను మర్చిపోయాను"</string>
     <string name="kg_wrong_pattern" msgid="1850806070801358830">"ఆకృతి తప్పు"</string>
     <string name="kg_wrong_password" msgid="2333281762128113157">"పాస్‌వర్డ్ తప్పు"</string>
@@ -1997,9 +1998,29 @@
     <string name="dynamic_mode_notification_channel_name" msgid="2348803891571320452">"రొటీన్ మోడ్ సమాచార నోటిఫికేషన్"</string>
     <string name="dynamic_mode_notification_title" msgid="508815255807182035">"మామూలుగా ఛార్జ్ చేసేలోపు బ్యాటరీ ఖాళీ కావచ్చు"</string>
     <string name="dynamic_mode_notification_summary" msgid="2541166298550402690">"బ్యాటరీ జీవితకాలాన్ని పెంచడానికి బ్యాటరీ సేవర్ యాక్టివేట్ చేయబడింది"</string>
+    <string name="mime_type_folder" msgid="7111951698626315204">"ఫోల్డర్"</string>
+    <string name="mime_type_apk" msgid="5518003630972506900">"Android అప్లికేషన్"</string>
+    <string name="mime_type_generic" msgid="6833871596845900027">"ఫైల్"</string>
+    <string name="mime_type_generic_ext" msgid="8450275970061657174">"<xliff:g id="EXTENSION">%1$s</xliff:g> ఫైల్"</string>
+    <string name="mime_type_audio" msgid="6289777657172050926">"ఆడియో"</string>
+    <string name="mime_type_audio_ext" msgid="3270880987725816210">"<xliff:g id="EXTENSION">%1$s</xliff:g> ఆడియో"</string>
+    <string name="mime_type_video" msgid="4093025777317307426">"వీడియో"</string>
+    <string name="mime_type_video_ext" msgid="5643771615714173159">"<xliff:g id="EXTENSION">%1$s</xliff:g> వీడియో"</string>
+    <string name="mime_type_image" msgid="3144284451605236371">"చిత్రం"</string>
+    <string name="mime_type_image_ext" msgid="1514613218742736590">"<xliff:g id="EXTENSION">%1$s</xliff:g> చిత్రం"</string>
+    <string name="mime_type_compressed" msgid="1645486037074943257">"ఆర్కైవ్"</string>
+    <string name="mime_type_compressed_ext" msgid="4232293058067801528">"<xliff:g id="EXTENSION">%1$s</xliff:g> ఆర్కైవ్"</string>
+    <string name="mime_type_document" msgid="1596838147256375966">"పత్రం"</string>
+    <string name="mime_type_document_ext" msgid="6327266601345501281">"<xliff:g id="EXTENSION">%1$s</xliff:g> పత్రం"</string>
+    <string name="mime_type_spreadsheet" msgid="2639138255207123557">"స్ప్రెడ్‌షీట్"</string>
+    <string name="mime_type_spreadsheet_ext" msgid="5508653032786106725">"<xliff:g id="EXTENSION">%1$s</xliff:g> స్ప్రెడ్‌షీట్"</string>
+    <string name="mime_type_presentation" msgid="6145604688774787357">"ప్రదర్శన"</string>
+    <string name="mime_type_presentation_ext" msgid="2982650207774823437">"<xliff:g id="EXTENSION">%1$s</xliff:g> ప్రదర్శన"</string>
     <string name="car_loading_profile" msgid="3545132581795684027">"లోడవుతోంది"</string>
     <plurals name="file_count" formatted="false" msgid="1628600959752419449">
       <item quantity="other"><xliff:g id="FILE_NAME_2">%s</xliff:g> + <xliff:g id="COUNT_3">%d</xliff:g> ఫైల్‌లు</item>
       <item quantity="one"><xliff:g id="FILE_NAME_0">%s</xliff:g> + <xliff:g id="COUNT_1">%d</xliff:g> ఫైల్</item>
     </plurals>
+    <!-- no translation found for chooser_no_direct_share_targets (997970693708458895) -->
+    <skip />
 </resources>
diff --git a/core/res/res/values-th/strings.xml b/core/res/res/values-th/strings.xml
index 271949d..5b2541f 100644
--- a/core/res/res/values-th/strings.xml
+++ b/core/res/res/values-th/strings.xml
@@ -308,15 +308,15 @@
     <string name="permgrouplab_phone" msgid="5229115638567440675">"โทรศัพท์"</string>
     <string name="permgroupdesc_phone" msgid="6234224354060641055">"โทรและจัดการการโทร"</string>
     <string name="permgrouprequest_phone" msgid="9166979577750581037">"อนุญาตให้ &lt;b&gt;<xliff:g id="APP_NAME">%1$s</xliff:g>&lt;/b&gt; โทรและจัดการการโทรไหม"</string>
-    <string name="permgrouplab_sensors" msgid="416037179223226722">"เซ็นเซอร์ร่างกาย"</string>
+    <string name="permgrouplab_sensors" msgid="4838614103153567532">"เซ็นเซอร์ร่างกาย"</string>
     <string name="permgroupdesc_sensors" msgid="7147968539346634043">"เข้าถึงข้อมูลเซ็นเซอร์เกี่ยวกับสัญญาณชีพของคุณ"</string>
     <string name="permgrouprequest_sensors" msgid="6349806962814556786">"อนุญาตให้ &lt;b&gt;<xliff:g id="APP_NAME">%1$s</xliff:g>&lt;/b&gt; เข้าถึงข้อมูลเซ็นเซอร์เกี่ยวกับสัญญาณชีพไหม"</string>
     <string name="permgrouplab_aural" msgid="965607064083134896">"เพลง"</string>
     <string name="permgroupdesc_aural" msgid="4870189506255958055">"เข้าถึงเพลง"</string>
     <string name="permgrouprequest_aural" msgid="6787926123071735620">"อนุญาตให้ &lt;b&gt;<xliff:g id="APP_NAME">%1$s</xliff:g>&lt;/b&gt; เข้าถึงเพลงไหม"</string>
-    <string name="permgrouplab_visual" msgid="8030190588123857921">"รูปภาพและวิดีโอ"</string>
+    <string name="permgrouplab_visual" msgid="6477382108771145134">"รูปภาพและวิดีโอ"</string>
     <string name="permgroupdesc_visual" msgid="3415827902566663546">"เข้าถึงรูปภาพและวิดีโอ"</string>
-    <string name="permgrouprequest_visual" msgid="6907523945030290376">"อนุญาตให้ &lt;b&gt;<xliff:g id="APP_NAME">%1$s</xliff:g>&lt;/b&gt; เข้าถึงรูปภาพและวิดีโอไหม"</string>
+    <string name="permgrouprequest_visual" msgid="3043752127595243314">"อนุญาตให้ &lt;b&gt;<xliff:g id="APP_NAME">%1$s</xliff:g>&lt;/b&gt; เข้าถึงรูปภาพและวิดีโอของคุณ รวมถึงตำแหน่งที่ติดแท็กไหม"</string>
     <string name="capability_title_canRetrieveWindowContent" msgid="3901717936930170320">"เรียกข้อมูลเนื้อหาของหน้าต่าง"</string>
     <string name="capability_desc_canRetrieveWindowContent" msgid="3772225008605310672">"ตรวจสอบเนื้อหาของหน้าต่างที่คุณกำลังโต้ตอบอยู่"</string>
     <string name="capability_title_canRequestTouchExploration" msgid="3108723364676667320">"เปิด \"แตะเพื่อสำรวจ\""</string>
@@ -1396,8 +1396,7 @@
     <string name="ext_media_init_action" msgid="7952885510091978278">"ตั้งค่า"</string>
     <string name="ext_media_unmount_action" msgid="1121883233103278199">"นำอุปกรณ์ออก"</string>
     <string name="ext_media_browse_action" msgid="8322172381028546087">"สำรวจ"</string>
-    <!-- no translation found for ext_media_seamless_action (6575980560886881233) -->
-    <skip />
+    <string name="ext_media_seamless_action" msgid="6575980560886881233">"เปลี่ยนเอาต์พุต"</string>
     <string name="ext_media_missing_title" msgid="620980315821543904">"ไม่มี <xliff:g id="NAME">%s</xliff:g>"</string>
     <string name="ext_media_missing_message" msgid="4012389235250987930">"ใส่อุปกรณ์อีกครั้ง"</string>
     <string name="ext_media_move_specific_title" msgid="1471100343872375842">"กำลังย้าย <xliff:g id="NAME">%s</xliff:g>"</string>
@@ -1611,6 +1610,8 @@
     <string name="display_manager_overlay_display_name" msgid="5142365982271620716">"การวางซ้อน #<xliff:g id="ID">%1$d</xliff:g>"</string>
     <string name="display_manager_overlay_display_title" msgid="652124517672257172">"<xliff:g id="NAME">%1$s</xliff:g>: <xliff:g id="WIDTH">%2$d</xliff:g>x<xliff:g id="HEIGHT">%3$d</xliff:g>, <xliff:g id="DPI">%4$d</xliff:g> dpi"</string>
     <string name="display_manager_overlay_display_secure_suffix" msgid="6022119702628572080">", ปลอดภัย"</string>
+    <string name="activity_starter_block_bg_activity_starts_permissive" msgid="5692097903712956720">"การเริ่มกิจกรรมในเบื้องหลังจาก <xliff:g id="PACKAGENAME">%1$s</xliff:g> นี้จะถูกบล็อกในบิวด์ Q ในอนาคต ดู go/q-bg-block"</string>
+    <string name="activity_starter_block_bg_activity_starts_enforcing" msgid="8299522481076404353">"บล็อกการเริ่มกิจกรรมในเบื้องหลังจาก <xliff:g id="PACKAGENAME">%1$s</xliff:g> แล้ว ดู go/q-bg-block"</string>
     <string name="kg_forgot_pattern_button_text" msgid="8852021467868220608">"ลืมรูปแบบใช่หรือไม่"</string>
     <string name="kg_wrong_pattern" msgid="1850806070801358830">"รูปแบบไม่ถูกต้อง"</string>
     <string name="kg_wrong_password" msgid="2333281762128113157">"รหัสผ่านไม่ถูกต้อง"</string>
@@ -1996,9 +1997,29 @@
     <string name="dynamic_mode_notification_channel_name" msgid="2348803891571320452">"การแจ้งเตือนข้อมูลโหมดกิจวัตร"</string>
     <string name="dynamic_mode_notification_title" msgid="508815255807182035">"แบตเตอรี่อาจหมดก่อนการชาร์จปกติ"</string>
     <string name="dynamic_mode_notification_summary" msgid="2541166298550402690">"เปิดใช้งานโหมดประหยัดแบตเตอรี่แล้วเพื่อยืดอายุการใช้งานแบตเตอรี่"</string>
+    <string name="mime_type_folder" msgid="7111951698626315204">"โฟลเดอร์"</string>
+    <string name="mime_type_apk" msgid="5518003630972506900">"ไฟล์แอปพลิเคชัน Android"</string>
+    <string name="mime_type_generic" msgid="6833871596845900027">"ไฟล์"</string>
+    <string name="mime_type_generic_ext" msgid="8450275970061657174">"ไฟล์ <xliff:g id="EXTENSION">%1$s</xliff:g>"</string>
+    <string name="mime_type_audio" msgid="6289777657172050926">"ไฟล์เสียง"</string>
+    <string name="mime_type_audio_ext" msgid="3270880987725816210">"ไฟล์เสียง <xliff:g id="EXTENSION">%1$s</xliff:g>"</string>
+    <string name="mime_type_video" msgid="4093025777317307426">"ไฟล์วิดีโอ"</string>
+    <string name="mime_type_video_ext" msgid="5643771615714173159">"ไฟล์วิดีโอ <xliff:g id="EXTENSION">%1$s</xliff:g>"</string>
+    <string name="mime_type_image" msgid="3144284451605236371">"ไฟล์รูปภาพ"</string>
+    <string name="mime_type_image_ext" msgid="1514613218742736590">"ไฟล์รูปภาพ <xliff:g id="EXTENSION">%1$s</xliff:g>"</string>
+    <string name="mime_type_compressed" msgid="1645486037074943257">"ไฟล์ที่เก็บถาวร"</string>
+    <string name="mime_type_compressed_ext" msgid="4232293058067801528">"ไฟล์ที่เก็บถาวร <xliff:g id="EXTENSION">%1$s</xliff:g>"</string>
+    <string name="mime_type_document" msgid="1596838147256375966">"ไฟล์เอกสาร"</string>
+    <string name="mime_type_document_ext" msgid="6327266601345501281">"ไฟล์เอกสาร <xliff:g id="EXTENSION">%1$s</xliff:g>"</string>
+    <string name="mime_type_spreadsheet" msgid="2639138255207123557">"สเปรดชีต"</string>
+    <string name="mime_type_spreadsheet_ext" msgid="5508653032786106725">"ไฟล์สเปรดชีต <xliff:g id="EXTENSION">%1$s</xliff:g>"</string>
+    <string name="mime_type_presentation" msgid="6145604688774787357">"ไฟล์งานนำเสนอ"</string>
+    <string name="mime_type_presentation_ext" msgid="2982650207774823437">"ไฟล์งานนำเสนอ <xliff:g id="EXTENSION">%1$s</xliff:g>"</string>
     <string name="car_loading_profile" msgid="3545132581795684027">"กำลังโหลด"</string>
     <plurals name="file_count" formatted="false" msgid="1628600959752419449">
       <item quantity="other"><xliff:g id="FILE_NAME_2">%s</xliff:g> และอีก <xliff:g id="COUNT_3">%d</xliff:g> ไฟล์</item>
       <item quantity="one"><xliff:g id="FILE_NAME_0">%s</xliff:g> และอีก <xliff:g id="COUNT_1">%d</xliff:g> ไฟล์</item>
     </plurals>
+    <!-- no translation found for chooser_no_direct_share_targets (997970693708458895) -->
+    <skip />
 </resources>
diff --git a/core/res/res/values-tl/strings.xml b/core/res/res/values-tl/strings.xml
index 287234f..4d7e7a2 100644
--- a/core/res/res/values-tl/strings.xml
+++ b/core/res/res/values-tl/strings.xml
@@ -308,15 +308,15 @@
     <string name="permgrouplab_phone" msgid="5229115638567440675">"Telepono"</string>
     <string name="permgroupdesc_phone" msgid="6234224354060641055">"tumawag at mamahala ng mga tawag sa telepono"</string>
     <string name="permgrouprequest_phone" msgid="9166979577750581037">"Payagan ang &lt;b&gt;<xliff:g id="APP_NAME">%1$s</xliff:g>&lt;/b&gt; na tumawag at mamahala ng mga tawag sa telepono?"</string>
-    <string name="permgrouplab_sensors" msgid="416037179223226722">"Mga Sensor ng Katawan"</string>
+    <string name="permgrouplab_sensors" msgid="4838614103153567532">"Mga sensor ng katawan"</string>
     <string name="permgroupdesc_sensors" msgid="7147968539346634043">"i-access ang data ng sensor tungkol sa iyong vital signs"</string>
     <string name="permgrouprequest_sensors" msgid="6349806962814556786">"Payagan ang &lt;b&gt;<xliff:g id="APP_NAME">%1$s</xliff:g>&lt;/b&gt; na i-access ang data ng sensor tungkol sa iyong mga vital sign?"</string>
     <string name="permgrouplab_aural" msgid="965607064083134896">"Musika"</string>
     <string name="permgroupdesc_aural" msgid="4870189506255958055">"i-access ang iyong musika"</string>
     <string name="permgrouprequest_aural" msgid="6787926123071735620">"Payagan ang &lt;b&gt;<xliff:g id="APP_NAME">%1$s</xliff:g>&lt;/b&gt; na i-access ang iyong musika?"</string>
-    <string name="permgrouplab_visual" msgid="8030190588123857921">"Mga Larawan at Video"</string>
+    <string name="permgrouplab_visual" msgid="6477382108771145134">"Mga larawan at video"</string>
     <string name="permgroupdesc_visual" msgid="3415827902566663546">"i-access ang iyong mga larawan at video"</string>
-    <string name="permgrouprequest_visual" msgid="6907523945030290376">"Payagan ang &lt;b&gt;<xliff:g id="APP_NAME">%1$s</xliff:g>&lt;/b&gt; na i-access ang iyong mga larawan at video?"</string>
+    <string name="permgrouprequest_visual" msgid="3043752127595243314">"Payagan ang &lt;b&gt;<xliff:g id="APP_NAME">%1$s</xliff:g>&lt;/b&gt; na i-access ang iyong mga larawan at video, kasama ang mga naka-tag na lokasyon?"</string>
     <string name="capability_title_canRetrieveWindowContent" msgid="3901717936930170320">"Kunin ang content ng window"</string>
     <string name="capability_desc_canRetrieveWindowContent" msgid="3772225008605310672">"Siyasatin ang nilalaman ng isang window kung saan ka nakikipag-ugnayan."</string>
     <string name="capability_title_canRequestTouchExploration" msgid="3108723364676667320">"I-on ang Explore by Touch"</string>
@@ -1396,8 +1396,7 @@
     <string name="ext_media_init_action" msgid="7952885510091978278">"I-set up"</string>
     <string name="ext_media_unmount_action" msgid="1121883233103278199">"I-eject"</string>
     <string name="ext_media_browse_action" msgid="8322172381028546087">"I-explore"</string>
-    <!-- no translation found for ext_media_seamless_action (6575980560886881233) -->
-    <skip />
+    <string name="ext_media_seamless_action" msgid="6575980560886881233">"Ilipat ang output"</string>
     <string name="ext_media_missing_title" msgid="620980315821543904">"Nawawala ang <xliff:g id="NAME">%s</xliff:g>"</string>
     <string name="ext_media_missing_message" msgid="4012389235250987930">"Ikabit muli ang device"</string>
     <string name="ext_media_move_specific_title" msgid="1471100343872375842">"Inililipat ang <xliff:g id="NAME">%s</xliff:g>"</string>
@@ -1611,6 +1610,8 @@
     <string name="display_manager_overlay_display_name" msgid="5142365982271620716">"Overlay #<xliff:g id="ID">%1$d</xliff:g>"</string>
     <string name="display_manager_overlay_display_title" msgid="652124517672257172">"<xliff:g id="NAME">%1$s</xliff:g>: <xliff:g id="WIDTH">%2$d</xliff:g>x<xliff:g id="HEIGHT">%3$d</xliff:g>, <xliff:g id="DPI">%4$d</xliff:g> dpi"</string>
     <string name="display_manager_overlay_display_secure_suffix" msgid="6022119702628572080">", secure"</string>
+    <string name="activity_starter_block_bg_activity_starts_permissive" msgid="5692097903712956720">"Iba-block ang pagsisimula ng aktibidad sa background na ito mula sa <xliff:g id="PACKAGENAME">%1$s</xliff:g> sa mga Q build sa hinaharap. Tingnan ang go/q-bg-block."</string>
+    <string name="activity_starter_block_bg_activity_starts_enforcing" msgid="8299522481076404353">"Na-block ang pagsisimula ng aktibidad sa background mula sa <xliff:g id="PACKAGENAME">%1$s</xliff:g>. Tingnan ang go/q-bg-block."</string>
     <string name="kg_forgot_pattern_button_text" msgid="8852021467868220608">"Nakalimutan ang Pattern"</string>
     <string name="kg_wrong_pattern" msgid="1850806070801358830">"Maling Pattern"</string>
     <string name="kg_wrong_password" msgid="2333281762128113157">"Maling Password"</string>
@@ -1996,9 +1997,29 @@
     <string name="dynamic_mode_notification_channel_name" msgid="2348803891571320452">"Notification ng impormasyon ng Routine Mode"</string>
     <string name="dynamic_mode_notification_title" msgid="508815255807182035">"Maaaring maubos ang baterya bago ang karaniwang pag-charge"</string>
     <string name="dynamic_mode_notification_summary" msgid="2541166298550402690">"Na-activate ang Pangtipid sa Baterya para patagalin ang buhay ng baterya"</string>
+    <string name="mime_type_folder" msgid="7111951698626315204">"Folder"</string>
+    <string name="mime_type_apk" msgid="5518003630972506900">"Android application"</string>
+    <string name="mime_type_generic" msgid="6833871596845900027">"File"</string>
+    <string name="mime_type_generic_ext" msgid="8450275970061657174">"<xliff:g id="EXTENSION">%1$s</xliff:g> file"</string>
+    <string name="mime_type_audio" msgid="6289777657172050926">"Audio"</string>
+    <string name="mime_type_audio_ext" msgid="3270880987725816210">"<xliff:g id="EXTENSION">%1$s</xliff:g> na audio"</string>
+    <string name="mime_type_video" msgid="4093025777317307426">"Video"</string>
+    <string name="mime_type_video_ext" msgid="5643771615714173159">"<xliff:g id="EXTENSION">%1$s</xliff:g> na video"</string>
+    <string name="mime_type_image" msgid="3144284451605236371">"Larawan"</string>
+    <string name="mime_type_image_ext" msgid="1514613218742736590">"<xliff:g id="EXTENSION">%1$s</xliff:g> na larawan"</string>
+    <string name="mime_type_compressed" msgid="1645486037074943257">"Archive"</string>
+    <string name="mime_type_compressed_ext" msgid="4232293058067801528">"<xliff:g id="EXTENSION">%1$s</xliff:g> na archive"</string>
+    <string name="mime_type_document" msgid="1596838147256375966">"Dokumento"</string>
+    <string name="mime_type_document_ext" msgid="6327266601345501281">"<xliff:g id="EXTENSION">%1$s</xliff:g> na dokumento"</string>
+    <string name="mime_type_spreadsheet" msgid="2639138255207123557">"Spreadsheet"</string>
+    <string name="mime_type_spreadsheet_ext" msgid="5508653032786106725">"<xliff:g id="EXTENSION">%1$s</xliff:g> na spreadsheet"</string>
+    <string name="mime_type_presentation" msgid="6145604688774787357">"Presentation"</string>
+    <string name="mime_type_presentation_ext" msgid="2982650207774823437">"<xliff:g id="EXTENSION">%1$s</xliff:g> na presentation"</string>
     <string name="car_loading_profile" msgid="3545132581795684027">"Naglo-load"</string>
     <plurals name="file_count" formatted="false" msgid="1628600959752419449">
       <item quantity="one"><xliff:g id="FILE_NAME_2">%s</xliff:g> + <xliff:g id="COUNT_3">%d</xliff:g> file</item>
       <item quantity="other"><xliff:g id="FILE_NAME_2">%s</xliff:g> + <xliff:g id="COUNT_3">%d</xliff:g> na file</item>
     </plurals>
+    <!-- no translation found for chooser_no_direct_share_targets (997970693708458895) -->
+    <skip />
 </resources>
diff --git a/core/res/res/values-tr/strings.xml b/core/res/res/values-tr/strings.xml
index 783c7a6..3e1bfb8 100644
--- a/core/res/res/values-tr/strings.xml
+++ b/core/res/res/values-tr/strings.xml
@@ -308,15 +308,15 @@
     <string name="permgrouplab_phone" msgid="5229115638567440675">"Telefon"</string>
     <string name="permgroupdesc_phone" msgid="6234224354060641055">"telefon çağrıları yapma ve yönetme"</string>
     <string name="permgrouprequest_phone" msgid="9166979577750581037">"&lt;b&gt;<xliff:g id="APP_NAME">%1$s</xliff:g>&lt;/b&gt; uygulamasının telefon etmesine ve çağrıları yönetmesine izin verilsin mi?"</string>
-    <string name="permgrouplab_sensors" msgid="416037179223226722">"Vücut Sensörleri"</string>
+    <string name="permgrouplab_sensors" msgid="4838614103153567532">"Vücut sensörleri"</string>
     <string name="permgroupdesc_sensors" msgid="7147968539346634043">"hayati belirtilerinizle ilgili sensör verilerine erişme"</string>
     <string name="permgrouprequest_sensors" msgid="6349806962814556786">"&lt;b&gt;<xliff:g id="APP_NAME">%1$s</xliff:g>&lt;/b&gt; uygulamasının hayati belirtilerinizle ilgili sensör verilerine erişmesine izin verilsin mi?"</string>
     <string name="permgrouplab_aural" msgid="965607064083134896">"Müzik"</string>
     <string name="permgroupdesc_aural" msgid="4870189506255958055">"müziğinize erişme"</string>
     <string name="permgrouprequest_aural" msgid="6787926123071735620">"&lt;b&gt;<xliff:g id="APP_NAME">%1$s</xliff:g>&lt;/b&gt; uygulamasının müziğinize erişmesine izin veriyor musunuz?"</string>
-    <string name="permgrouplab_visual" msgid="8030190588123857921">"Fotoğraflar ve Videolar"</string>
+    <string name="permgrouplab_visual" msgid="6477382108771145134">"Fotoğraflar ve videolar"</string>
     <string name="permgroupdesc_visual" msgid="3415827902566663546">"fotoğraflarınıza ve videolarınıza erişme"</string>
-    <string name="permgrouprequest_visual" msgid="6907523945030290376">"&lt;b&gt;<xliff:g id="APP_NAME">%1$s</xliff:g>&lt;/b&gt; uygulamasının fotoğraflarınıza ve videolarınıza erişmesine izin veriyor musunuz?"</string>
+    <string name="permgrouprequest_visual" msgid="3043752127595243314">"&lt;b&gt;<xliff:g id="APP_NAME">%1$s</xliff:g>&lt;/b&gt; uygulamasına, etiketlenmiş yerler de dahil fotoğraf ve videolarınıza erişim izni verilsin mi?"</string>
     <string name="capability_title_canRetrieveWindowContent" msgid="3901717936930170320">"Pencere içeriğini alma"</string>
     <string name="capability_desc_canRetrieveWindowContent" msgid="3772225008605310672">"Etkileşim kurduğunuz pencerenin içeriğini inceler."</string>
     <string name="capability_title_canRequestTouchExploration" msgid="3108723364676667320">"Dokunarak Keşfet\'i açma"</string>
@@ -1396,8 +1396,7 @@
     <string name="ext_media_init_action" msgid="7952885510091978278">"Kur"</string>
     <string name="ext_media_unmount_action" msgid="1121883233103278199">"Çıkar"</string>
     <string name="ext_media_browse_action" msgid="8322172381028546087">"Keşfet"</string>
-    <!-- no translation found for ext_media_seamless_action (6575980560886881233) -->
-    <skip />
+    <string name="ext_media_seamless_action" msgid="6575980560886881233">"Çıkışı değiştir"</string>
     <string name="ext_media_missing_title" msgid="620980315821543904">"<xliff:g id="NAME">%s</xliff:g> bulunamıyor"</string>
     <string name="ext_media_missing_message" msgid="4012389235250987930">"Cihazı tekrar takın"</string>
     <string name="ext_media_move_specific_title" msgid="1471100343872375842">"<xliff:g id="NAME">%s</xliff:g> taşınıyor"</string>
@@ -1611,6 +1610,8 @@
     <string name="display_manager_overlay_display_name" msgid="5142365982271620716">"Yer Paylaşımı No. <xliff:g id="ID">%1$d</xliff:g>"</string>
     <string name="display_manager_overlay_display_title" msgid="652124517672257172">"<xliff:g id="NAME">%1$s</xliff:g>: <xliff:g id="WIDTH">%2$d</xliff:g>x<xliff:g id="HEIGHT">%3$d</xliff:g>, <xliff:g id="DPI">%4$d</xliff:g> dpi"</string>
     <string name="display_manager_overlay_display_secure_suffix" msgid="6022119702628572080">", güvenli"</string>
+    <string name="activity_starter_block_bg_activity_starts_permissive" msgid="5692097903712956720">"<xliff:g id="PACKAGENAME">%1$s</xliff:g> paketinden bu arka plan etkinliği başlangıcı, ilerideki Q derlemelerinde engellenecek. go/q-bg-block adresine bakın."</string>
+    <string name="activity_starter_block_bg_activity_starts_enforcing" msgid="8299522481076404353">"<xliff:g id="PACKAGENAME">%1$s</xliff:g> paketinden arka plan etkinliği başlangıcı engellendi. go/q-bg-block adresine bakın."</string>
     <string name="kg_forgot_pattern_button_text" msgid="8852021467868220608">"Deseni Unuttunuz mu?"</string>
     <string name="kg_wrong_pattern" msgid="1850806070801358830">"Yanlış Desen"</string>
     <string name="kg_wrong_password" msgid="2333281762128113157">"Yanlış Şifre"</string>
@@ -1996,9 +1997,29 @@
     <string name="dynamic_mode_notification_channel_name" msgid="2348803891571320452">"Rutin Modu bilgi bildirimi"</string>
     <string name="dynamic_mode_notification_title" msgid="508815255807182035">"Pil normal şarjdan önce bitebilir"</string>
     <string name="dynamic_mode_notification_summary" msgid="2541166298550402690">"Pilin ömrünü uzatmak için Pil Tasarrufu etkinleştirildi"</string>
+    <string name="mime_type_folder" msgid="7111951698626315204">"Klasör"</string>
+    <string name="mime_type_apk" msgid="5518003630972506900">"Android uygulaması"</string>
+    <string name="mime_type_generic" msgid="6833871596845900027">"Dosya"</string>
+    <string name="mime_type_generic_ext" msgid="8450275970061657174">"<xliff:g id="EXTENSION">%1$s</xliff:g> dosyası"</string>
+    <string name="mime_type_audio" msgid="6289777657172050926">"Ses"</string>
+    <string name="mime_type_audio_ext" msgid="3270880987725816210">"<xliff:g id="EXTENSION">%1$s</xliff:g> ses dosyası"</string>
+    <string name="mime_type_video" msgid="4093025777317307426">"Video"</string>
+    <string name="mime_type_video_ext" msgid="5643771615714173159">"<xliff:g id="EXTENSION">%1$s</xliff:g> video dosyası"</string>
+    <string name="mime_type_image" msgid="3144284451605236371">"Resim"</string>
+    <string name="mime_type_image_ext" msgid="1514613218742736590">"<xliff:g id="EXTENSION">%1$s</xliff:g> resim dosyası"</string>
+    <string name="mime_type_compressed" msgid="1645486037074943257">"Arşiv"</string>
+    <string name="mime_type_compressed_ext" msgid="4232293058067801528">"<xliff:g id="EXTENSION">%1$s</xliff:g> arşiv dosyası"</string>
+    <string name="mime_type_document" msgid="1596838147256375966">"Doküman"</string>
+    <string name="mime_type_document_ext" msgid="6327266601345501281">"<xliff:g id="EXTENSION">%1$s</xliff:g> doküman dosyası"</string>
+    <string name="mime_type_spreadsheet" msgid="2639138255207123557">"E-tablo"</string>
+    <string name="mime_type_spreadsheet_ext" msgid="5508653032786106725">"<xliff:g id="EXTENSION">%1$s</xliff:g> e-tablo dosyası"</string>
+    <string name="mime_type_presentation" msgid="6145604688774787357">"Sunu"</string>
+    <string name="mime_type_presentation_ext" msgid="2982650207774823437">"<xliff:g id="EXTENSION">%1$s</xliff:g> sunu dosyası"</string>
     <string name="car_loading_profile" msgid="3545132581795684027">"Yükleniyor"</string>
     <plurals name="file_count" formatted="false" msgid="1628600959752419449">
       <item quantity="other"><xliff:g id="FILE_NAME_2">%s</xliff:g> + <xliff:g id="COUNT_3">%d</xliff:g> dosya</item>
       <item quantity="one"><xliff:g id="FILE_NAME_0">%s</xliff:g> + <xliff:g id="COUNT_1">%d</xliff:g> dosya</item>
     </plurals>
+    <!-- no translation found for chooser_no_direct_share_targets (997970693708458895) -->
+    <skip />
 </resources>
diff --git a/core/res/res/values-uk/strings.xml b/core/res/res/values-uk/strings.xml
index c49c94f..9ca44d9 100644
--- a/core/res/res/values-uk/strings.xml
+++ b/core/res/res/values-uk/strings.xml
@@ -314,15 +314,15 @@
     <string name="permgrouplab_phone" msgid="5229115638567440675">"Телефон"</string>
     <string name="permgroupdesc_phone" msgid="6234224354060641055">"телефонувати та керувати дзвінками"</string>
     <string name="permgrouprequest_phone" msgid="9166979577750581037">"Дозволити додатку &lt;b&gt;<xliff:g id="APP_NAME">%1$s</xliff:g>&lt;/b&gt; здійснювати телефонні дзвінки та керувати ними?"</string>
-    <string name="permgrouplab_sensors" msgid="416037179223226722">"Датчики на тілі"</string>
+    <string name="permgrouplab_sensors" msgid="4838614103153567532">"Датчики на тілі"</string>
     <string name="permgroupdesc_sensors" msgid="7147968539346634043">"отримувати доступ до інформації датчиків про ваші життєві показники"</string>
     <string name="permgrouprequest_sensors" msgid="6349806962814556786">"Надати додатку &lt;b&gt;<xliff:g id="APP_NAME">%1$s</xliff:g>&lt;/b&gt; доступ до життєвих показників із датчиків?"</string>
     <string name="permgrouplab_aural" msgid="965607064083134896">"Музика"</string>
     <string name="permgroupdesc_aural" msgid="4870189506255958055">"доступ до музики"</string>
     <string name="permgrouprequest_aural" msgid="6787926123071735620">"Надати додатку &lt;b&gt;<xliff:g id="APP_NAME">%1$s</xliff:g>&lt;/b&gt; доступ до музики?"</string>
-    <string name="permgrouplab_visual" msgid="8030190588123857921">"Фото й відео"</string>
+    <string name="permgrouplab_visual" msgid="6477382108771145134">"Фотографії та відео"</string>
     <string name="permgroupdesc_visual" msgid="3415827902566663546">"доступ до фото й відео"</string>
-    <string name="permgrouprequest_visual" msgid="6907523945030290376">"Надати додатку &lt;b&gt;<xliff:g id="APP_NAME">%1$s</xliff:g>&lt;/b&gt; доступ до фото й відео?"</string>
+    <string name="permgrouprequest_visual" msgid="3043752127595243314">"Дозволити додатку &lt;b&gt;<xliff:g id="APP_NAME">%1$s</xliff:g>&lt;/b&gt; отримувати доступ до ваших фотографій і відео, зокрема до позначок місцеположення?"</string>
     <string name="capability_title_canRetrieveWindowContent" msgid="3901717936930170320">"Отримувати вміст вікна"</string>
     <string name="capability_desc_canRetrieveWindowContent" msgid="3772225008605310672">"Перевіряти вміст вікна, з яким ви взаємодієте."</string>
     <string name="capability_title_canRequestTouchExploration" msgid="3108723364676667320">"Увімкнути функцію дослідження дотиком"</string>
@@ -515,8 +515,8 @@
     <string name="permdesc_nfc" msgid="7120611819401789907">"Дозволяє програмі обмінюватися даними з тегами, картками та читачами екрана Near Field Communication (NFC)."</string>
     <string name="permlab_disableKeyguard" msgid="3598496301486439258">"вимикати блокування екрана"</string>
     <string name="permdesc_disableKeyguard" msgid="6034203065077122992">"Дозволяє програмі вимикати блокування клавіатури та будь-який пов’язаний паролем захист. Наприклад: телефон вимикає блокування клавіатури під час отримання вхідного дзвінка, після закінчення якого блокування клавіатури відновлюється."</string>
-    <string name="permlab_requestScreenLockComplexity" msgid="7028982116060987169">"запит складності пароля для блокування екрана"</string>
-    <string name="permdesc_requestScreenLockComplexity" msgid="2806396846128185677">"Дає додатку змогу визначати рівень складності пароля для блокування екрана (високий, середній, низький або нульовий). Враховуються кількість символів і тип блокування. Додаток також може пропонувати користувачам підвищити рівень складності пароля для блокування екрана, але цю пропозицію можна ігнорувати. Примітка: оскільки пароль зашифрований, додаток його не знає."</string>
+    <string name="permlab_requestScreenLockComplexity" msgid="7028982116060987169">"запит складності способу блокування екрана"</string>
+    <string name="permdesc_requestScreenLockComplexity" msgid="2806396846128185677">"Дозволяє додатку визначати рівень складності способу блокування екрана (високий, середній, низький або нульовий). Враховуються кількість символів і тип блокування. Додаток також може пропонувати користувачам вибрати складніший тип блокування екрана, але це не обов’язково робити. Примітка: оскільки пароль зашифрований, додаток його не знає."</string>
     <string name="permlab_useBiometric" msgid="8837753668509919318">"використовувати біометричне апаратне забезпечення"</string>
     <string name="permdesc_useBiometric" msgid="8389855232721612926">"Додаток може використовувати біометричне апаратне забезпечення для автентифікації"</string>
     <string name="permlab_manageFingerprint" msgid="5640858826254575638">"керувати апаратним забезпеченням для цифрових відбитків"</string>
@@ -1657,6 +1657,8 @@
     <string name="display_manager_overlay_display_name" msgid="5142365982271620716">"Накладання №<xliff:g id="ID">%1$d</xliff:g>"</string>
     <string name="display_manager_overlay_display_title" msgid="652124517672257172">"<xliff:g id="NAME">%1$s</xliff:g>: <xliff:g id="WIDTH">%2$d</xliff:g>х<xliff:g id="HEIGHT">%3$d</xliff:g>, <xliff:g id="DPI">%4$d</xliff:g> dpi"</string>
     <string name="display_manager_overlay_display_secure_suffix" msgid="6022119702628572080">", безпечний"</string>
+    <string name="activity_starter_block_bg_activity_starts_permissive" msgid="5692097903712956720">"Активність пакета <xliff:g id="PACKAGENAME">%1$s</xliff:g> у фоновому режимі буде заблоковано в майбутніх складаннях Q. Докладнішу інформацію наведено на сторінці go/q-bg-block."</string>
+    <string name="activity_starter_block_bg_activity_starts_enforcing" msgid="8299522481076404353">"Активність додатка <xliff:g id="PACKAGENAME">%1$s</xliff:g> у фоновому режимі заблоковано. Докладнішу інформацію наведено на сторінці go/q-bg-block."</string>
     <string name="kg_forgot_pattern_button_text" msgid="8852021467868220608">"Не пам’ятаю ключ"</string>
     <string name="kg_wrong_pattern" msgid="1850806070801358830">"Неправильний ключ"</string>
     <string name="kg_wrong_password" msgid="2333281762128113157">"Неправильний пароль"</string>
@@ -2066,6 +2068,24 @@
     <string name="dynamic_mode_notification_channel_name" msgid="2348803891571320452">"Сповіщення про послідовнсть дій"</string>
     <string name="dynamic_mode_notification_title" msgid="508815255807182035">"Акумулятор може розрядитися раніше ніж зазвичай"</string>
     <string name="dynamic_mode_notification_summary" msgid="2541166298550402690">"Режим економії заряду акумулятора активовано для збільшення часу його роботи"</string>
+    <string name="mime_type_folder" msgid="7111951698626315204">"Папка"</string>
+    <string name="mime_type_apk" msgid="5518003630972506900">"Додаток Android"</string>
+    <string name="mime_type_generic" msgid="6833871596845900027">"Файл"</string>
+    <string name="mime_type_generic_ext" msgid="8450275970061657174">"Файл у форматі <xliff:g id="EXTENSION">%1$s</xliff:g>"</string>
+    <string name="mime_type_audio" msgid="6289777657172050926">"Аудіо"</string>
+    <string name="mime_type_audio_ext" msgid="3270880987725816210">"Аудіо у форматі <xliff:g id="EXTENSION">%1$s</xliff:g>"</string>
+    <string name="mime_type_video" msgid="4093025777317307426">"Відео"</string>
+    <string name="mime_type_video_ext" msgid="5643771615714173159">"Відео у форматі <xliff:g id="EXTENSION">%1$s</xliff:g>"</string>
+    <string name="mime_type_image" msgid="3144284451605236371">"Зображення"</string>
+    <string name="mime_type_image_ext" msgid="1514613218742736590">"Зображення у форматі <xliff:g id="EXTENSION">%1$s</xliff:g>"</string>
+    <string name="mime_type_compressed" msgid="1645486037074943257">"Архів"</string>
+    <string name="mime_type_compressed_ext" msgid="4232293058067801528">"Архів у форматі <xliff:g id="EXTENSION">%1$s</xliff:g>"</string>
+    <string name="mime_type_document" msgid="1596838147256375966">"Документ"</string>
+    <string name="mime_type_document_ext" msgid="6327266601345501281">"Документ у форматі <xliff:g id="EXTENSION">%1$s</xliff:g>"</string>
+    <string name="mime_type_spreadsheet" msgid="2639138255207123557">"Таблиця"</string>
+    <string name="mime_type_spreadsheet_ext" msgid="5508653032786106725">"Таблиця у форматі <xliff:g id="EXTENSION">%1$s</xliff:g>"</string>
+    <string name="mime_type_presentation" msgid="6145604688774787357">"Презентація"</string>
+    <string name="mime_type_presentation_ext" msgid="2982650207774823437">"Презентація у форматі <xliff:g id="EXTENSION">%1$s</xliff:g>"</string>
     <string name="car_loading_profile" msgid="3545132581795684027">"Завантаження"</string>
     <plurals name="file_count" formatted="false" msgid="1628600959752419449">
       <item quantity="one"><xliff:g id="FILE_NAME_2">%s</xliff:g> і ще <xliff:g id="COUNT_3">%d</xliff:g> файл</item>
@@ -2073,4 +2093,6 @@
       <item quantity="many"><xliff:g id="FILE_NAME_2">%s</xliff:g> і ще <xliff:g id="COUNT_3">%d</xliff:g> файлів</item>
       <item quantity="other"><xliff:g id="FILE_NAME_2">%s</xliff:g> і ще <xliff:g id="COUNT_3">%d</xliff:g> файлу</item>
     </plurals>
+    <!-- no translation found for chooser_no_direct_share_targets (997970693708458895) -->
+    <skip />
 </resources>
diff --git a/core/res/res/values-ur/strings.xml b/core/res/res/values-ur/strings.xml
index 1d661e8..22fbd56 100644
--- a/core/res/res/values-ur/strings.xml
+++ b/core/res/res/values-ur/strings.xml
@@ -308,15 +308,15 @@
     <string name="permgrouplab_phone" msgid="5229115638567440675">"فون"</string>
     <string name="permgroupdesc_phone" msgid="6234224354060641055">"فون کالز کریں اور ان کا نظم کریں"</string>
     <string name="permgrouprequest_phone" msgid="9166979577750581037">"‏&lt;/b&gt;<xliff:g id="APP_NAME">%1$s</xliff:g>&lt;/b&gt; کو فون کالز کرنے اور ان کا نظم کرنے کی اجازت دیں؟"</string>
-    <string name="permgrouplab_sensors" msgid="416037179223226722">"باڈی سینسرز"</string>
+    <string name="permgrouplab_sensors" msgid="4838614103153567532">"باڈی سینسرز"</string>
     <string name="permgroupdesc_sensors" msgid="7147968539346634043">"اپنی علامات حیات کے متعلق سنسر ڈیٹا تک رسائی حاصل کریں"</string>
     <string name="permgrouprequest_sensors" msgid="6349806962814556786">"‏&lt;b&gt;<xliff:g id="APP_NAME">%1$s</xliff:g>&lt;/b&gt; کو آپ کے اہم اشاروں کے متعلق سینسر ڈیٹا تک رسائی کی اجازت دیں؟"</string>
     <string name="permgrouplab_aural" msgid="965607064083134896">"موسیقی"</string>
     <string name="permgroupdesc_aural" msgid="4870189506255958055">"اپنی موسیقی تک رسائی حاصل کریں"</string>
     <string name="permgrouprequest_aural" msgid="6787926123071735620">"‏&lt;b&gt;<xliff:g id="APP_NAME">%1$s</xliff:g>&lt;/b&gt; کو آپ کی موسیقی تک رسائی کی اجازت دیں؟"</string>
-    <string name="permgrouplab_visual" msgid="8030190588123857921">"تصاویر اور ویڈیوز"</string>
+    <string name="permgrouplab_visual" msgid="6477382108771145134">"تصاویر اور ویڈیوز"</string>
     <string name="permgroupdesc_visual" msgid="3415827902566663546">"اپنی تصاویر اور ویڈیوز تک رسائی حاصل کریں"</string>
-    <string name="permgrouprequest_visual" msgid="6907523945030290376">"‏&lt;b&gt;<xliff:g id="APP_NAME">%1$s</xliff:g>&lt;/b&gt; کو آپ کی تصاویر اور ویڈیوز تک رسائی کی اجازت دیں؟"</string>
+    <string name="permgrouprequest_visual" msgid="3043752127595243314">"‏&lt;b&gt;<xliff:g id="APP_NAME">%1$s</xliff:g>&lt;/b&gt; کو ٹیگ کردہ مقامات سمیت آپ کی تصاویر اور ویڈیوز تک رسائی کی اجازت دیں؟"</string>
     <string name="capability_title_canRetrieveWindowContent" msgid="3901717936930170320">"ونڈو مواد بازیافت کرنے کی"</string>
     <string name="capability_desc_canRetrieveWindowContent" msgid="3772225008605310672">"کسی ایسی ونڈو کے مواد کا معائنہ کریں جس کے ساتھ آپ تعامل کر رہے ہیں۔"</string>
     <string name="capability_title_canRequestTouchExploration" msgid="3108723364676667320">"ٹچ کے ذریعے دریافت کریں کو آن کرنے کی"</string>
@@ -1397,8 +1397,7 @@
     <string name="ext_media_init_action" msgid="7952885510091978278">"سیٹ اپ کریں"</string>
     <string name="ext_media_unmount_action" msgid="1121883233103278199">"خارج کریں"</string>
     <string name="ext_media_browse_action" msgid="8322172381028546087">"دریافت کریں"</string>
-    <!-- no translation found for ext_media_seamless_action (6575980560886881233) -->
-    <skip />
+    <string name="ext_media_seamless_action" msgid="6575980560886881233">"آؤٹ پٹ سوئچ کریں"</string>
     <string name="ext_media_missing_title" msgid="620980315821543904">"<xliff:g id="NAME">%s</xliff:g> غائب ہے"</string>
     <string name="ext_media_missing_message" msgid="4012389235250987930">"آلہ دوبارہ داخل کریں"</string>
     <string name="ext_media_move_specific_title" msgid="1471100343872375842">"<xliff:g id="NAME">%s</xliff:g> کو منتقل کیا جا رہا ہے"</string>
@@ -1612,6 +1611,8 @@
     <string name="display_manager_overlay_display_name" msgid="5142365982271620716">"‏اوور لے ‎#<xliff:g id="ID">%1$d</xliff:g>"</string>
     <string name="display_manager_overlay_display_title" msgid="652124517672257172">"<xliff:g id="NAME">%1$s</xliff:g>: <xliff:g id="WIDTH">%2$d</xliff:g>x<xliff:g id="HEIGHT">%3$d</xliff:g>, <xliff:g id="DPI">%4$d</xliff:g> dpi"</string>
     <string name="display_manager_overlay_display_secure_suffix" msgid="6022119702628572080">"، محفوظ"</string>
+    <string name="activity_starter_block_bg_activity_starts_permissive" msgid="5692097903712956720">"‏<xliff:g id="PACKAGENAME">%1$s</xliff:g> سے شروع ہونے والی پس منظر کی اس سرگرمی کو مستقبل کے Q بلڈز میں مسدود کر دیا جائے گا۔ go/q-bg-block دیکھیں۔"</string>
+    <string name="activity_starter_block_bg_activity_starts_enforcing" msgid="8299522481076404353">"‏<xliff:g id="PACKAGENAME">%1$s</xliff:g> سے شروع ہونے والی پس منظر کی سرگرمی کو مسدود کر دیا گیا ہے۔ go/q-bg-block دیکھیں۔"</string>
     <string name="kg_forgot_pattern_button_text" msgid="8852021467868220608">"پیٹرن بھول گئے"</string>
     <string name="kg_wrong_pattern" msgid="1850806070801358830">"غلط پیٹرن"</string>
     <string name="kg_wrong_password" msgid="2333281762128113157">"غلط پاس ورڈ"</string>
@@ -1997,9 +1998,29 @@
     <string name="dynamic_mode_notification_channel_name" msgid="2348803891571320452">"روٹین موڈ معلومات کی اطلاع"</string>
     <string name="dynamic_mode_notification_title" msgid="508815255807182035">"معمول چارج سے پہلے بیٹری ختم ہو سکتی ہے"</string>
     <string name="dynamic_mode_notification_summary" msgid="2541166298550402690">"بیٹری لائف کو بڑھانے کے لیے بیٹری سیور کو فعال کر دیا گیا ہے"</string>
+    <string name="mime_type_folder" msgid="7111951698626315204">"فولڈر"</string>
+    <string name="mime_type_apk" msgid="5518003630972506900">"‏Android ایپلیکیشن"</string>
+    <string name="mime_type_generic" msgid="6833871596845900027">"فائل"</string>
+    <string name="mime_type_generic_ext" msgid="8450275970061657174">"<xliff:g id="EXTENSION">%1$s</xliff:g> فائل"</string>
+    <string name="mime_type_audio" msgid="6289777657172050926">"آڈیو"</string>
+    <string name="mime_type_audio_ext" msgid="3270880987725816210">"<xliff:g id="EXTENSION">%1$s</xliff:g> آڈیو"</string>
+    <string name="mime_type_video" msgid="4093025777317307426">"ویڈیو"</string>
+    <string name="mime_type_video_ext" msgid="5643771615714173159">"<xliff:g id="EXTENSION">%1$s</xliff:g> ویڈیو"</string>
+    <string name="mime_type_image" msgid="3144284451605236371">"تصویر"</string>
+    <string name="mime_type_image_ext" msgid="1514613218742736590">"<xliff:g id="EXTENSION">%1$s</xliff:g> تصویر"</string>
+    <string name="mime_type_compressed" msgid="1645486037074943257">"آرکائیو"</string>
+    <string name="mime_type_compressed_ext" msgid="4232293058067801528">"<xliff:g id="EXTENSION">%1$s</xliff:g> آرکائيو"</string>
+    <string name="mime_type_document" msgid="1596838147256375966">"دستاویز"</string>
+    <string name="mime_type_document_ext" msgid="6327266601345501281">"<xliff:g id="EXTENSION">%1$s</xliff:g> دستاویز"</string>
+    <string name="mime_type_spreadsheet" msgid="2639138255207123557">"اسپریڈشیٹ"</string>
+    <string name="mime_type_spreadsheet_ext" msgid="5508653032786106725">"<xliff:g id="EXTENSION">%1$s</xliff:g> اسپریڈشیٹ"</string>
+    <string name="mime_type_presentation" msgid="6145604688774787357">"پیشکش"</string>
+    <string name="mime_type_presentation_ext" msgid="2982650207774823437">"<xliff:g id="EXTENSION">%1$s</xliff:g> پیشکش"</string>
     <string name="car_loading_profile" msgid="3545132581795684027">"لوڈ ہو رہا ہے"</string>
     <plurals name="file_count" formatted="false" msgid="1628600959752419449">
       <item quantity="other"><xliff:g id="FILE_NAME_2">%s</xliff:g> + <xliff:g id="COUNT_3">%d</xliff:g> فائلز</item>
       <item quantity="one"><xliff:g id="FILE_NAME_0">%s</xliff:g> + <xliff:g id="COUNT_1">%d</xliff:g> فائل</item>
     </plurals>
+    <!-- no translation found for chooser_no_direct_share_targets (997970693708458895) -->
+    <skip />
 </resources>
diff --git a/core/res/res/values-uz/strings.xml b/core/res/res/values-uz/strings.xml
index 5597a8b..eaf81d7 100644
--- a/core/res/res/values-uz/strings.xml
+++ b/core/res/res/values-uz/strings.xml
@@ -308,15 +308,15 @@
     <string name="permgrouplab_phone" msgid="5229115638567440675">"Telefon"</string>
     <string name="permgroupdesc_phone" msgid="6234224354060641055">"telefon qo‘ng‘iroqlarini amalga oshirish va boshqarish"</string>
     <string name="permgrouprequest_phone" msgid="9166979577750581037">"&lt;b&gt;<xliff:g id="APP_NAME">%1$s</xliff:g>&lt;/b&gt; uchun telefon chaqiruvlarini amalga oshirish va boshqarishga ruxsat berilsinmi?"</string>
-    <string name="permgrouplab_sensors" msgid="416037179223226722">"Tana sezgichlari"</string>
+    <string name="permgrouplab_sensors" msgid="4838614103153567532">"Tana sezgichlari"</string>
     <string name="permgroupdesc_sensors" msgid="7147968539346634043">"organizm holati haqidagi sezgich ma’lumotlariga kirish"</string>
     <string name="permgrouprequest_sensors" msgid="6349806962814556786">"&lt;b&gt;<xliff:g id="APP_NAME">%1$s</xliff:g>&lt;/b&gt; uchun organizm holati haqidagi sezgichlar axborotlariga ruxsat berilsinmi?"</string>
     <string name="permgrouplab_aural" msgid="965607064083134896">"Musiqa"</string>
     <string name="permgroupdesc_aural" msgid="4870189506255958055">"musiqaga kirish"</string>
     <string name="permgrouprequest_aural" msgid="6787926123071735620">"&lt;b&gt;<xliff:g id="APP_NAME">%1$s</xliff:g>&lt;/b&gt; uchun musiqangizga kirishga ruxsat berilsinmi?"</string>
-    <string name="permgrouplab_visual" msgid="8030190588123857921">"Surat va videolar"</string>
+    <string name="permgrouplab_visual" msgid="6477382108771145134">"Surat va videolar"</string>
     <string name="permgroupdesc_visual" msgid="3415827902566663546">"surat va videolarga kirish"</string>
-    <string name="permgrouprequest_visual" msgid="6907523945030290376">"&lt;b&gt;<xliff:g id="APP_NAME">%1$s</xliff:g>&lt;/b&gt; uchun surat va videolaringizga kirishga ruxsat berilsinmi?"</string>
+    <string name="permgrouprequest_visual" msgid="3043752127595243314">"&lt;b&gt;<xliff:g id="APP_NAME">%1$s</xliff:g>&lt;/b&gt; ilovasi uchun surat va videolaringizga, jumladan, teglangan joylarga ham ruxsat berilsinmi?"</string>
     <string name="capability_title_canRetrieveWindowContent" msgid="3901717936930170320">"Oynadagi kontentni o‘qiydi"</string>
     <string name="capability_desc_canRetrieveWindowContent" msgid="3772225008605310672">"Joriy oynadagi kontent mazmunini aniqlaydi."</string>
     <string name="capability_title_canRequestTouchExploration" msgid="3108723364676667320">"Teginib o‘rganish xizmatini yoqadi"</string>
@@ -1397,8 +1397,7 @@
     <string name="ext_media_init_action" msgid="7952885510091978278">"Sozlash"</string>
     <string name="ext_media_unmount_action" msgid="1121883233103278199">"Chiqarish"</string>
     <string name="ext_media_browse_action" msgid="8322172381028546087">"O‘rganish"</string>
-    <!-- no translation found for ext_media_seamless_action (6575980560886881233) -->
-    <skip />
+    <string name="ext_media_seamless_action" msgid="6575980560886881233">"Audio chiqishni almashtirish"</string>
     <string name="ext_media_missing_title" msgid="620980315821543904">"<xliff:g id="NAME">%s</xliff:g> topilmadi"</string>
     <string name="ext_media_missing_message" msgid="4012389235250987930">"Qurilmani yana ulang"</string>
     <string name="ext_media_move_specific_title" msgid="1471100343872375842">"<xliff:g id="NAME">%s</xliff:g> ko‘chirib o‘tkazilmoqda"</string>
@@ -1612,6 +1611,8 @@
     <string name="display_manager_overlay_display_name" msgid="5142365982271620716">"Tasvir uzatish #<xliff:g id="ID">%1$d</xliff:g>"</string>
     <string name="display_manager_overlay_display_title" msgid="652124517672257172">"<xliff:g id="NAME">%1$s</xliff:g>: <xliff:g id="WIDTH">%2$d</xliff:g>x<xliff:g id="HEIGHT">%3$d</xliff:g>, <xliff:g id="DPI">%4$d</xliff:g> dpi"</string>
     <string name="display_manager_overlay_display_secure_suffix" msgid="6022119702628572080">", xavfsiz"</string>
+    <string name="activity_starter_block_bg_activity_starts_permissive" msgid="5692097903712956720">"Keyingi Android Q nashrlarida fondagi ushbu <xliff:g id="PACKAGENAME">%1$s</xliff:g> jarayoni bloklanadi. Batafsil: go/q-bg-block."</string>
+    <string name="activity_starter_block_bg_activity_starts_enforcing" msgid="8299522481076404353">"Fondagi <xliff:g id="PACKAGENAME">%1$s</xliff:g> jarayoni bloklandi. Batafsil: go/q-bg-block."</string>
     <string name="kg_forgot_pattern_button_text" msgid="8852021467868220608">"Grafik kalit esimdan chiqdi"</string>
     <string name="kg_wrong_pattern" msgid="1850806070801358830">"Grafik kalit xato"</string>
     <string name="kg_wrong_password" msgid="2333281762128113157">"Parol noto‘g‘ri"</string>
@@ -1997,9 +1998,29 @@
     <string name="dynamic_mode_notification_channel_name" msgid="2348803891571320452">"Kun tartibi rejimi haqidagi bildirishnoma"</string>
     <string name="dynamic_mode_notification_title" msgid="508815255807182035">"Batareya quvvati odatdagidan ertaroq tugashi mumkin"</string>
     <string name="dynamic_mode_notification_summary" msgid="2541166298550402690">"Batareya quvvati uzoqroq ishlashi uchun Tejamkor rejim yoqildi"</string>
+    <string name="mime_type_folder" msgid="7111951698626315204">"Jild"</string>
+    <string name="mime_type_apk" msgid="5518003630972506900">"Android ilova"</string>
+    <string name="mime_type_generic" msgid="6833871596845900027">"Fayl"</string>
+    <string name="mime_type_generic_ext" msgid="8450275970061657174">"<xliff:g id="EXTENSION">%1$s</xliff:g> fayl"</string>
+    <string name="mime_type_audio" msgid="6289777657172050926">"Audio"</string>
+    <string name="mime_type_audio_ext" msgid="3270880987725816210">"<xliff:g id="EXTENSION">%1$s</xliff:g> audio"</string>
+    <string name="mime_type_video" msgid="4093025777317307426">"Video"</string>
+    <string name="mime_type_video_ext" msgid="5643771615714173159">"<xliff:g id="EXTENSION">%1$s</xliff:g> video"</string>
+    <string name="mime_type_image" msgid="3144284451605236371">"Rasm"</string>
+    <string name="mime_type_image_ext" msgid="1514613218742736590">"<xliff:g id="EXTENSION">%1$s</xliff:g> rasm"</string>
+    <string name="mime_type_compressed" msgid="1645486037074943257">"Arxiv"</string>
+    <string name="mime_type_compressed_ext" msgid="4232293058067801528">"<xliff:g id="EXTENSION">%1$s</xliff:g> arxiv"</string>
+    <string name="mime_type_document" msgid="1596838147256375966">"Hujjat"</string>
+    <string name="mime_type_document_ext" msgid="6327266601345501281">"<xliff:g id="EXTENSION">%1$s</xliff:g> hujjat"</string>
+    <string name="mime_type_spreadsheet" msgid="2639138255207123557">"Jadval"</string>
+    <string name="mime_type_spreadsheet_ext" msgid="5508653032786106725">"<xliff:g id="EXTENSION">%1$s</xliff:g> jadval"</string>
+    <string name="mime_type_presentation" msgid="6145604688774787357">"Taqdimot"</string>
+    <string name="mime_type_presentation_ext" msgid="2982650207774823437">"<xliff:g id="EXTENSION">%1$s</xliff:g> taqdimot"</string>
     <string name="car_loading_profile" msgid="3545132581795684027">"Yuklanmoqda"</string>
     <plurals name="file_count" formatted="false" msgid="1628600959752419449">
       <item quantity="other"><xliff:g id="FILE_NAME_2">%s</xliff:g> + <xliff:g id="COUNT_3">%d</xliff:g> ta fayl</item>
       <item quantity="one"><xliff:g id="FILE_NAME_0">%s</xliff:g> + <xliff:g id="COUNT_1">%d</xliff:g> ta fayl</item>
     </plurals>
+    <!-- no translation found for chooser_no_direct_share_targets (997970693708458895) -->
+    <skip />
 </resources>
diff --git a/core/res/res/values-vi/strings.xml b/core/res/res/values-vi/strings.xml
index ca4e967..5f237a7 100644
--- a/core/res/res/values-vi/strings.xml
+++ b/core/res/res/values-vi/strings.xml
@@ -308,15 +308,15 @@
     <string name="permgrouplab_phone" msgid="5229115638567440675">"Điện thoại"</string>
     <string name="permgroupdesc_phone" msgid="6234224354060641055">"thực hiện và quản lý cuộc gọi điện thoại"</string>
     <string name="permgrouprequest_phone" msgid="9166979577750581037">"Cho phép &lt;b&gt;<xliff:g id="APP_NAME">%1$s</xliff:g>&lt;/b&gt; thực hiện và quản lý cuộc gọi điện thoại?"</string>
-    <string name="permgrouplab_sensors" msgid="416037179223226722">"Cảm biến cơ thể"</string>
+    <string name="permgrouplab_sensors" msgid="4838614103153567532">"Cảm biến cơ thể"</string>
     <string name="permgroupdesc_sensors" msgid="7147968539346634043">"truy cập dữ liệu cảm biến về dấu hiệu sinh tồn của bạn"</string>
     <string name="permgrouprequest_sensors" msgid="6349806962814556786">"Cho phép &lt;b&gt;<xliff:g id="APP_NAME">%1$s</xliff:g>&lt;/b&gt; truy cập vào dữ liệu cảm biến về các dấu hiệu sinh tồn của bạn?"</string>
     <string name="permgrouplab_aural" msgid="965607064083134896">"Nhạc"</string>
     <string name="permgroupdesc_aural" msgid="4870189506255958055">"sử dụng nhạc"</string>
     <string name="permgrouprequest_aural" msgid="6787926123071735620">"Bạn có muốn cho phép &lt;b&gt;<xliff:g id="APP_NAME">%1$s</xliff:g>&lt;/b&gt; sử dụng nhạc không?"</string>
-    <string name="permgrouplab_visual" msgid="8030190588123857921">"Ảnh và video"</string>
+    <string name="permgrouplab_visual" msgid="6477382108771145134">"Ảnh và video"</string>
     <string name="permgroupdesc_visual" msgid="3415827902566663546">"sử dụng ảnh và video"</string>
-    <string name="permgrouprequest_visual" msgid="6907523945030290376">"Bạn có muốn cho phép &lt;b&gt;<xliff:g id="APP_NAME">%1$s</xliff:g>&lt;/b&gt; sử dụng ảnh và video không?"</string>
+    <string name="permgrouprequest_visual" msgid="3043752127595243314">"Cho phép &lt;b&gt;<xliff:g id="APP_NAME">%1$s</xliff:g>&lt;/b&gt; truy cập vào ảnh và video của bạn, bao gồm cả vị trí được gắn thẻ?"</string>
     <string name="capability_title_canRetrieveWindowContent" msgid="3901717936930170320">"Truy xuất nội dung cửa sổ"</string>
     <string name="capability_desc_canRetrieveWindowContent" msgid="3772225008605310672">"Kiểm tra nội dung của cửa sổ bạn đang tương tác."</string>
     <string name="capability_title_canRequestTouchExploration" msgid="3108723364676667320">"Bật Khám phá bằng cách chạm"</string>
@@ -1611,6 +1611,8 @@
     <string name="display_manager_overlay_display_name" msgid="5142365982271620716">"Lớp phủ #<xliff:g id="ID">%1$d</xliff:g>"</string>
     <string name="display_manager_overlay_display_title" msgid="652124517672257172">"<xliff:g id="NAME">%1$s</xliff:g>: <xliff:g id="WIDTH">%2$d</xliff:g>x<xliff:g id="HEIGHT">%3$d</xliff:g>, <xliff:g id="DPI">%4$d</xliff:g> dpi"</string>
     <string name="display_manager_overlay_display_secure_suffix" msgid="6022119702628572080">", an toàn"</string>
+    <string name="activity_starter_block_bg_activity_starts_permissive" msgid="5692097903712956720">"Tính năng bắt đầu hoạt động trong nền từ <xliff:g id="PACKAGENAME">%1$s</xliff:g> này sẽ bị chặn ở các bản dựng Q trong tương lai. Bạn có thể xem thông tin tại: go/q-bg-block."</string>
+    <string name="activity_starter_block_bg_activity_starts_enforcing" msgid="8299522481076404353">"Tính năng bắt đầu hoạt động trong nền từ <xliff:g id="PACKAGENAME">%1$s</xliff:g> đã bị chặn. Bạn có thể xem thông tin tại: go/q-bg-block."</string>
     <string name="kg_forgot_pattern_button_text" msgid="8852021467868220608">"Đã quên hình"</string>
     <string name="kg_wrong_pattern" msgid="1850806070801358830">"Hình sai"</string>
     <string name="kg_wrong_password" msgid="2333281762128113157">"Mật khẩu sai"</string>
@@ -1996,9 +1998,29 @@
     <string name="dynamic_mode_notification_channel_name" msgid="2348803891571320452">"Thông báo cung cấp thông tin về chế độ sạc thông thường"</string>
     <string name="dynamic_mode_notification_title" msgid="508815255807182035">"Pin có thể hết trước khi sạc bình thường"</string>
     <string name="dynamic_mode_notification_summary" msgid="2541166298550402690">"Trình tiết kiệm pin được kích hoạt để kéo dài thời lượng pin"</string>
+    <string name="mime_type_folder" msgid="7111951698626315204">"Thư mục"</string>
+    <string name="mime_type_apk" msgid="5518003630972506900">"Ứng dụng Android"</string>
+    <string name="mime_type_generic" msgid="6833871596845900027">"Tệp"</string>
+    <string name="mime_type_generic_ext" msgid="8450275970061657174">"Tệp <xliff:g id="EXTENSION">%1$s</xliff:g>"</string>
+    <string name="mime_type_audio" msgid="6289777657172050926">"Âm thanh"</string>
+    <string name="mime_type_audio_ext" msgid="3270880987725816210">"Âm thanh <xliff:g id="EXTENSION">%1$s</xliff:g>"</string>
+    <string name="mime_type_video" msgid="4093025777317307426">"Video"</string>
+    <string name="mime_type_video_ext" msgid="5643771615714173159">"Video <xliff:g id="EXTENSION">%1$s</xliff:g>"</string>
+    <string name="mime_type_image" msgid="3144284451605236371">"Hình ảnh"</string>
+    <string name="mime_type_image_ext" msgid="1514613218742736590">"Hình ảnh <xliff:g id="EXTENSION">%1$s</xliff:g>"</string>
+    <string name="mime_type_compressed" msgid="1645486037074943257">"Lưu trữ"</string>
+    <string name="mime_type_compressed_ext" msgid="4232293058067801528">"Lưu trữ <xliff:g id="EXTENSION">%1$s</xliff:g>"</string>
+    <string name="mime_type_document" msgid="1596838147256375966">"Tài liệu"</string>
+    <string name="mime_type_document_ext" msgid="6327266601345501281">"Tài liệu <xliff:g id="EXTENSION">%1$s</xliff:g>"</string>
+    <string name="mime_type_spreadsheet" msgid="2639138255207123557">"Bảng tính"</string>
+    <string name="mime_type_spreadsheet_ext" msgid="5508653032786106725">"Bảng tính <xliff:g id="EXTENSION">%1$s</xliff:g>"</string>
+    <string name="mime_type_presentation" msgid="6145604688774787357">"Bản trình bày"</string>
+    <string name="mime_type_presentation_ext" msgid="2982650207774823437">"Bản trình bày <xliff:g id="EXTENSION">%1$s</xliff:g>"</string>
     <string name="car_loading_profile" msgid="3545132581795684027">"Đang tải"</string>
     <plurals name="file_count" formatted="false" msgid="1628600959752419449">
       <item quantity="other"><xliff:g id="FILE_NAME_2">%s</xliff:g> + <xliff:g id="COUNT_3">%d</xliff:g> tệp</item>
       <item quantity="one"><xliff:g id="FILE_NAME_0">%s</xliff:g> + <xliff:g id="COUNT_1">%d</xliff:g> tệp</item>
     </plurals>
+    <!-- no translation found for chooser_no_direct_share_targets (997970693708458895) -->
+    <skip />
 </resources>
diff --git a/core/res/res/values-zh-rCN/strings.xml b/core/res/res/values-zh-rCN/strings.xml
index ba27f5a..d7effc0 100644
--- a/core/res/res/values-zh-rCN/strings.xml
+++ b/core/res/res/values-zh-rCN/strings.xml
@@ -308,15 +308,15 @@
     <string name="permgrouplab_phone" msgid="5229115638567440675">"电话"</string>
     <string name="permgroupdesc_phone" msgid="6234224354060641055">"拨打电话和管理通话"</string>
     <string name="permgrouprequest_phone" msgid="9166979577750581037">"允许“&lt;b&gt;<xliff:g id="APP_NAME">%1$s</xliff:g>&lt;/b&gt;”拨打电话和管理通话吗?"</string>
-    <string name="permgrouplab_sensors" msgid="416037179223226722">"身体传感器"</string>
+    <string name="permgrouplab_sensors" msgid="4838614103153567532">"身体传感器"</string>
     <string name="permgroupdesc_sensors" msgid="7147968539346634043">"访问与您的生命体征相关的传感器数据"</string>
     <string name="permgrouprequest_sensors" msgid="6349806962814556786">"允许&lt;b&gt;<xliff:g id="APP_NAME">%1$s</xliff:g>&lt;/b&gt;访问与您的生命体征相关的传感器数据吗?"</string>
     <string name="permgrouplab_aural" msgid="965607064083134896">"音乐"</string>
     <string name="permgroupdesc_aural" msgid="4870189506255958055">"访问您的音乐"</string>
     <string name="permgrouprequest_aural" msgid="6787926123071735620">"允许&lt;b&gt;<xliff:g id="APP_NAME">%1$s</xliff:g>&lt;/b&gt;访问您的音乐吗?"</string>
-    <string name="permgrouplab_visual" msgid="8030190588123857921">"照片和视频"</string>
+    <string name="permgrouplab_visual" msgid="6477382108771145134">"照片和视频"</string>
     <string name="permgroupdesc_visual" msgid="3415827902566663546">"访问您的照片和视频"</string>
-    <string name="permgrouprequest_visual" msgid="6907523945030290376">"允许&lt;b&gt;<xliff:g id="APP_NAME">%1$s</xliff:g>&lt;/b&gt;访问您的照片和视频吗?"</string>
+    <string name="permgrouprequest_visual" msgid="3043752127595243314">"允许&lt;b&gt;<xliff:g id="APP_NAME">%1$s</xliff:g>&lt;/b&gt;访问您的照片和视频(包括标记的位置)吗?"</string>
     <string name="capability_title_canRetrieveWindowContent" msgid="3901717936930170320">"检索窗口内容"</string>
     <string name="capability_desc_canRetrieveWindowContent" msgid="3772225008605310672">"检测您正访问的窗口的内容。"</string>
     <string name="capability_title_canRequestTouchExploration" msgid="3108723364676667320">"启用触摸浏览"</string>
@@ -1396,8 +1396,7 @@
     <string name="ext_media_init_action" msgid="7952885510091978278">"设置"</string>
     <string name="ext_media_unmount_action" msgid="1121883233103278199">"弹出"</string>
     <string name="ext_media_browse_action" msgid="8322172381028546087">"浏览"</string>
-    <!-- no translation found for ext_media_seamless_action (6575980560886881233) -->
-    <skip />
+    <string name="ext_media_seamless_action" msgid="6575980560886881233">"切换输出"</string>
     <string name="ext_media_missing_title" msgid="620980315821543904">"缺少<xliff:g id="NAME">%s</xliff:g>"</string>
     <string name="ext_media_missing_message" msgid="4012389235250987930">"请再次插入设备"</string>
     <string name="ext_media_move_specific_title" msgid="1471100343872375842">"正在移动<xliff:g id="NAME">%s</xliff:g>"</string>
@@ -1611,6 +1610,8 @@
     <string name="display_manager_overlay_display_name" msgid="5142365982271620716">"叠加视图 #<xliff:g id="ID">%1$d</xliff:g>"</string>
     <string name="display_manager_overlay_display_title" msgid="652124517672257172">"<xliff:g id="NAME">%1$s</xliff:g>:<xliff:g id="WIDTH">%2$d</xliff:g>x<xliff:g id="HEIGHT">%3$d</xliff:g>,<xliff:g id="DPI">%4$d</xliff:g> dpi"</string>
     <string name="display_manager_overlay_display_secure_suffix" msgid="6022119702628572080">",安全"</string>
+    <string name="activity_starter_block_bg_activity_starts_permissive" msgid="5692097903712956720">"<xliff:g id="PACKAGENAME">%1$s</xliff:g> 的这类后台活动启动程序会在日后的 Android Q 版本中遭到屏蔽。请查看 go/q-bg-block。"</string>
+    <string name="activity_starter_block_bg_activity_starts_enforcing" msgid="8299522481076404353">"已屏蔽 <xliff:g id="PACKAGENAME">%1$s</xliff:g> 的后台活动启动程序。请查看 go/q-bg-block。"</string>
     <string name="kg_forgot_pattern_button_text" msgid="8852021467868220608">"忘记了图案"</string>
     <string name="kg_wrong_pattern" msgid="1850806070801358830">"图案错误"</string>
     <string name="kg_wrong_password" msgid="2333281762128113157">"密码错误"</string>
@@ -1996,9 +1997,29 @@
     <string name="dynamic_mode_notification_channel_name" msgid="2348803891571320452">"日常安排模式信息通知"</string>
     <string name="dynamic_mode_notification_title" msgid="508815255807182035">"电池电量可能会在您平时的充电时间之前耗尽"</string>
     <string name="dynamic_mode_notification_summary" msgid="2541166298550402690">"已启用省电模式以延长电池续航时间"</string>
+    <string name="mime_type_folder" msgid="7111951698626315204">"文件夹"</string>
+    <string name="mime_type_apk" msgid="5518003630972506900">"Android 应用"</string>
+    <string name="mime_type_generic" msgid="6833871596845900027">"文件"</string>
+    <string name="mime_type_generic_ext" msgid="8450275970061657174">"<xliff:g id="EXTENSION">%1$s</xliff:g> 文件"</string>
+    <string name="mime_type_audio" msgid="6289777657172050926">"音频"</string>
+    <string name="mime_type_audio_ext" msgid="3270880987725816210">"<xliff:g id="EXTENSION">%1$s</xliff:g> 音频"</string>
+    <string name="mime_type_video" msgid="4093025777317307426">"视频"</string>
+    <string name="mime_type_video_ext" msgid="5643771615714173159">"<xliff:g id="EXTENSION">%1$s</xliff:g> 视频"</string>
+    <string name="mime_type_image" msgid="3144284451605236371">"图片"</string>
+    <string name="mime_type_image_ext" msgid="1514613218742736590">"<xliff:g id="EXTENSION">%1$s</xliff:g> 图片"</string>
+    <string name="mime_type_compressed" msgid="1645486037074943257">"归档文件"</string>
+    <string name="mime_type_compressed_ext" msgid="4232293058067801528">"<xliff:g id="EXTENSION">%1$s</xliff:g> 归档文件"</string>
+    <string name="mime_type_document" msgid="1596838147256375966">"文档"</string>
+    <string name="mime_type_document_ext" msgid="6327266601345501281">"<xliff:g id="EXTENSION">%1$s</xliff:g> 文档"</string>
+    <string name="mime_type_spreadsheet" msgid="2639138255207123557">"电子表格"</string>
+    <string name="mime_type_spreadsheet_ext" msgid="5508653032786106725">"<xliff:g id="EXTENSION">%1$s</xliff:g> 电子表格"</string>
+    <string name="mime_type_presentation" msgid="6145604688774787357">"演示文稿"</string>
+    <string name="mime_type_presentation_ext" msgid="2982650207774823437">"<xliff:g id="EXTENSION">%1$s</xliff:g> 演示文稿"</string>
     <string name="car_loading_profile" msgid="3545132581795684027">"正在加载"</string>
     <plurals name="file_count" formatted="false" msgid="1628600959752419449">
       <item quantity="other"><xliff:g id="FILE_NAME_2">%s</xliff:g> + <xliff:g id="COUNT_3">%d</xliff:g> 个文件</item>
       <item quantity="one"><xliff:g id="FILE_NAME_0">%s</xliff:g> + <xliff:g id="COUNT_1">%d</xliff:g> 个文件</item>
     </plurals>
+    <!-- no translation found for chooser_no_direct_share_targets (997970693708458895) -->
+    <skip />
 </resources>
diff --git a/core/res/res/values-zh-rHK/strings.xml b/core/res/res/values-zh-rHK/strings.xml
index 443cd91..20231fc 100644
--- a/core/res/res/values-zh-rHK/strings.xml
+++ b/core/res/res/values-zh-rHK/strings.xml
@@ -308,15 +308,15 @@
     <string name="permgrouplab_phone" msgid="5229115638567440675">"電話"</string>
     <string name="permgroupdesc_phone" msgid="6234224354060641055">"撥打電話及管理通話"</string>
     <string name="permgrouprequest_phone" msgid="9166979577750581037">"允許「<xliff:g id="APP_NAME">%1$s</xliff:g>」&lt;b&gt;&lt;/b&gt;撥打電話和管理通話嗎?"</string>
-    <string name="permgrouplab_sensors" msgid="416037179223226722">"人體感應器"</string>
+    <string name="permgrouplab_sensors" msgid="4838614103153567532">"人體感應器"</string>
     <string name="permgroupdesc_sensors" msgid="7147968539346634043">"存取與您生命體徵相關的感應器資料"</string>
     <string name="permgrouprequest_sensors" msgid="6349806962814556786">"允許「<xliff:g id="APP_NAME">%1$s</xliff:g>」&lt;b&gt;&lt;/b&gt;存取與您身體機能相關的感應器資料嗎?"</string>
     <string name="permgrouplab_aural" msgid="965607064083134896">"音樂"</string>
     <string name="permgroupdesc_aural" msgid="4870189506255958055">"存取您的音樂"</string>
     <string name="permgrouprequest_aural" msgid="6787926123071735620">"要允許「&lt;b&gt;<xliff:g id="APP_NAME">%1$s</xliff:g>&lt;/b&gt;」存取您的音樂嗎?"</string>
-    <string name="permgrouplab_visual" msgid="8030190588123857921">"相片和影片"</string>
+    <string name="permgrouplab_visual" msgid="6477382108771145134">"相片和影片"</string>
     <string name="permgroupdesc_visual" msgid="3415827902566663546">"存取您的相片和影片"</string>
-    <string name="permgrouprequest_visual" msgid="6907523945030290376">"要允許「&lt;b&gt;<xliff:g id="APP_NAME">%1$s</xliff:g>&lt;/b&gt;」存取您的相片和影片嗎?"</string>
+    <string name="permgrouprequest_visual" msgid="3043752127595243314">"要允許「<xliff:g id="APP_NAME">%1$s</xliff:g>」&lt;b&gt;&lt;/b&gt;存取您的相片和影片 (包括標記的位置資訊) 嗎?"</string>
     <string name="capability_title_canRetrieveWindowContent" msgid="3901717936930170320">"擷取視窗內容"</string>
     <string name="capability_desc_canRetrieveWindowContent" msgid="3772225008605310672">"檢查您使用中的視窗內容。"</string>
     <string name="capability_title_canRequestTouchExploration" msgid="3108723364676667320">"開啟「輕觸探索」功能"</string>
@@ -1396,8 +1396,7 @@
     <string name="ext_media_init_action" msgid="7952885510091978278">"設定"</string>
     <string name="ext_media_unmount_action" msgid="1121883233103278199">"移除"</string>
     <string name="ext_media_browse_action" msgid="8322172381028546087">"探索"</string>
-    <!-- no translation found for ext_media_seamless_action (6575980560886881233) -->
-    <skip />
+    <string name="ext_media_seamless_action" msgid="6575980560886881233">"切換輸出"</string>
     <string name="ext_media_missing_title" msgid="620980315821543904">"找不到<xliff:g id="NAME">%s</xliff:g>"</string>
     <string name="ext_media_missing_message" msgid="4012389235250987930">"請再插入裝置"</string>
     <string name="ext_media_move_specific_title" msgid="1471100343872375842">"正在轉移<xliff:g id="NAME">%s</xliff:g>"</string>
@@ -1611,6 +1610,8 @@
     <string name="display_manager_overlay_display_name" msgid="5142365982271620716">"重疊效果 #<xliff:g id="ID">%1$d</xliff:g>"</string>
     <string name="display_manager_overlay_display_title" msgid="652124517672257172">"<xliff:g id="NAME">%1$s</xliff:g>:<xliff:g id="WIDTH">%2$d</xliff:g>x<xliff:g id="HEIGHT">%3$d</xliff:g>,<xliff:g id="DPI">%4$d</xliff:g> dpi"</string>
     <string name="display_manager_overlay_display_secure_suffix" msgid="6022119702628572080">"(安全)"</string>
+    <string name="activity_starter_block_bg_activity_starts_permissive" msgid="5692097903712956720">"在日後的 Q 版本中,系統將會封鎖這個由 <xliff:g id="PACKAGENAME">%1$s</xliff:g> 啟動的背景活動。請參閱 go/q-bg-block。"</string>
+    <string name="activity_starter_block_bg_activity_starts_enforcing" msgid="8299522481076404353">"已封鎖 <xliff:g id="PACKAGENAME">%1$s</xliff:g> 啟動的背景活動。請參閱 go/q-bg-block。"</string>
     <string name="kg_forgot_pattern_button_text" msgid="8852021467868220608">"忘記圖案"</string>
     <string name="kg_wrong_pattern" msgid="1850806070801358830">"圖形不對"</string>
     <string name="kg_wrong_password" msgid="2333281762128113157">"密碼錯誤"</string>
@@ -1996,9 +1997,29 @@
     <string name="dynamic_mode_notification_channel_name" msgid="2348803891571320452">"「日常安排模式」資料通知"</string>
     <string name="dynamic_mode_notification_title" msgid="508815255807182035">"電量可能會在日常充電前耗盡"</string>
     <string name="dynamic_mode_notification_summary" msgid="2541166298550402690">"「省電模式」已啟用,以便延長電池壽命"</string>
+    <string name="mime_type_folder" msgid="7111951698626315204">"資料夾"</string>
+    <string name="mime_type_apk" msgid="5518003630972506900">"Android 應用程式"</string>
+    <string name="mime_type_generic" msgid="6833871596845900027">"檔案"</string>
+    <string name="mime_type_generic_ext" msgid="8450275970061657174">"<xliff:g id="EXTENSION">%1$s</xliff:g> 檔案"</string>
+    <string name="mime_type_audio" msgid="6289777657172050926">"音訊"</string>
+    <string name="mime_type_audio_ext" msgid="3270880987725816210">"<xliff:g id="EXTENSION">%1$s</xliff:g> 音訊"</string>
+    <string name="mime_type_video" msgid="4093025777317307426">"影片"</string>
+    <string name="mime_type_video_ext" msgid="5643771615714173159">"<xliff:g id="EXTENSION">%1$s</xliff:g> 影片"</string>
+    <string name="mime_type_image" msgid="3144284451605236371">"圖片"</string>
+    <string name="mime_type_image_ext" msgid="1514613218742736590">"<xliff:g id="EXTENSION">%1$s</xliff:g> 圖片"</string>
+    <string name="mime_type_compressed" msgid="1645486037074943257">"封存"</string>
+    <string name="mime_type_compressed_ext" msgid="4232293058067801528">"<xliff:g id="EXTENSION">%1$s</xliff:g> 封存檔案"</string>
+    <string name="mime_type_document" msgid="1596838147256375966">"文件"</string>
+    <string name="mime_type_document_ext" msgid="6327266601345501281">"<xliff:g id="EXTENSION">%1$s</xliff:g> 文件"</string>
+    <string name="mime_type_spreadsheet" msgid="2639138255207123557">"試算表"</string>
+    <string name="mime_type_spreadsheet_ext" msgid="5508653032786106725">"<xliff:g id="EXTENSION">%1$s</xliff:g> 試算表"</string>
+    <string name="mime_type_presentation" msgid="6145604688774787357">"簡報"</string>
+    <string name="mime_type_presentation_ext" msgid="2982650207774823437">"<xliff:g id="EXTENSION">%1$s</xliff:g> 簡報"</string>
     <string name="car_loading_profile" msgid="3545132581795684027">"正在載入"</string>
     <plurals name="file_count" formatted="false" msgid="1628600959752419449">
       <item quantity="other"><xliff:g id="FILE_NAME_2">%s</xliff:g> + <xliff:g id="COUNT_3">%d</xliff:g> 個檔案</item>
       <item quantity="one"><xliff:g id="FILE_NAME_0">%s</xliff:g> + <xliff:g id="COUNT_1">%d</xliff:g> 個檔案</item>
     </plurals>
+    <!-- no translation found for chooser_no_direct_share_targets (997970693708458895) -->
+    <skip />
 </resources>
diff --git a/core/res/res/values-zh-rTW/strings.xml b/core/res/res/values-zh-rTW/strings.xml
index db5cbf4..8fa7681 100644
--- a/core/res/res/values-zh-rTW/strings.xml
+++ b/core/res/res/values-zh-rTW/strings.xml
@@ -308,15 +308,15 @@
     <string name="permgrouplab_phone" msgid="5229115638567440675">"電話"</string>
     <string name="permgroupdesc_phone" msgid="6234224354060641055">"撥打電話及管理通話"</string>
     <string name="permgrouprequest_phone" msgid="9166979577750581037">"要允許「<xliff:g id="APP_NAME">%1$s</xliff:g>」撥打電話及管理通話嗎?"</string>
-    <string name="permgrouplab_sensors" msgid="416037179223226722">"人體感應器"</string>
+    <string name="permgrouplab_sensors" msgid="4838614103153567532">"人體感測器"</string>
     <string name="permgroupdesc_sensors" msgid="7147968539346634043">"存取與你生命徵象相關的感應器資料"</string>
     <string name="permgrouprequest_sensors" msgid="6349806962814556786">"要允許「<xliff:g id="APP_NAME">%1$s</xliff:g>」存取與你生命徵象相關的感應器資料嗎?"</string>
     <string name="permgrouplab_aural" msgid="965607064083134896">"音樂"</string>
     <string name="permgroupdesc_aural" msgid="4870189506255958055">"存取你的音樂"</string>
     <string name="permgrouprequest_aural" msgid="6787926123071735620">"要允許「<xliff:g id="APP_NAME">%1$s</xliff:g>」&lt;b&gt;&lt;/b&gt;存取你的音樂嗎?"</string>
-    <string name="permgrouplab_visual" msgid="8030190588123857921">"相片和影片"</string>
+    <string name="permgrouplab_visual" msgid="6477382108771145134">"相片和影片"</string>
     <string name="permgroupdesc_visual" msgid="3415827902566663546">"存取你的相片和影片"</string>
-    <string name="permgrouprequest_visual" msgid="6907523945030290376">"要允許「<xliff:g id="APP_NAME">%1$s</xliff:g>」&lt;b&gt;&lt;/b&gt;存取你的相片和影片嗎?"</string>
+    <string name="permgrouprequest_visual" msgid="3043752127595243314">"要允許「<xliff:g id="APP_NAME">%1$s</xliff:g>」&lt;b&gt;&lt;/b&gt;存取你的相片和影片 (包括加上標記的地點) 嗎?"</string>
     <string name="capability_title_canRetrieveWindowContent" msgid="3901717936930170320">"擷取視窗內容"</string>
     <string name="capability_desc_canRetrieveWindowContent" msgid="3772225008605310672">"檢查你存取的視窗內容。"</string>
     <string name="capability_title_canRequestTouchExploration" msgid="3108723364676667320">"啟用輕觸探索功能"</string>
@@ -1611,6 +1611,8 @@
     <string name="display_manager_overlay_display_name" msgid="5142365982271620716">"第 <xliff:g id="ID">%1$d</xliff:g> 個重疊效果"</string>
     <string name="display_manager_overlay_display_title" msgid="652124517672257172">"<xliff:g id="NAME">%1$s</xliff:g>:<xliff:g id="WIDTH">%2$d</xliff:g>x<xliff:g id="HEIGHT">%3$d</xliff:g>,<xliff:g id="DPI">%4$d</xliff:g> dpi"</string>
     <string name="display_manager_overlay_display_secure_suffix" msgid="6022119702628572080">"(安全)"</string>
+    <string name="activity_starter_block_bg_activity_starts_permissive" msgid="5692097903712956720">"<xliff:g id="PACKAGENAME">%1$s</xliff:g> 的這類背景活動啟動程序會在日後的 Android Q 版本遭到封鎖。請前往 go/q-bg-block 查看。"</string>
+    <string name="activity_starter_block_bg_activity_starts_enforcing" msgid="8299522481076404353">"已封鎖 <xliff:g id="PACKAGENAME">%1$s</xliff:g> 的背景活動啟動程序。請前往 go/q-bg-block 查看。"</string>
     <string name="kg_forgot_pattern_button_text" msgid="8852021467868220608">"忘記圖案"</string>
     <string name="kg_wrong_pattern" msgid="1850806070801358830">"圖案錯誤"</string>
     <string name="kg_wrong_password" msgid="2333281762128113157">"密碼錯誤"</string>
@@ -1996,9 +1998,29 @@
     <string name="dynamic_mode_notification_channel_name" msgid="2348803891571320452">"日常安排模式資訊通知"</string>
     <string name="dynamic_mode_notification_title" msgid="508815255807182035">"電池電力可能會在你平常的充電時間前耗盡"</string>
     <string name="dynamic_mode_notification_summary" msgid="2541166298550402690">"已啟用節約耗電量模式以延長電池續航力"</string>
+    <string name="mime_type_folder" msgid="7111951698626315204">"資料夾"</string>
+    <string name="mime_type_apk" msgid="5518003630972506900">"Android 應用程式"</string>
+    <string name="mime_type_generic" msgid="6833871596845900027">"檔案"</string>
+    <string name="mime_type_generic_ext" msgid="8450275970061657174">"<xliff:g id="EXTENSION">%1$s</xliff:g> 檔案"</string>
+    <string name="mime_type_audio" msgid="6289777657172050926">"音訊"</string>
+    <string name="mime_type_audio_ext" msgid="3270880987725816210">"<xliff:g id="EXTENSION">%1$s</xliff:g> 音訊"</string>
+    <string name="mime_type_video" msgid="4093025777317307426">"影片"</string>
+    <string name="mime_type_video_ext" msgid="5643771615714173159">"<xliff:g id="EXTENSION">%1$s</xliff:g> 影片"</string>
+    <string name="mime_type_image" msgid="3144284451605236371">"圖片"</string>
+    <string name="mime_type_image_ext" msgid="1514613218742736590">"<xliff:g id="EXTENSION">%1$s</xliff:g> 圖片"</string>
+    <string name="mime_type_compressed" msgid="1645486037074943257">"封存檔"</string>
+    <string name="mime_type_compressed_ext" msgid="4232293058067801528">"<xliff:g id="EXTENSION">%1$s</xliff:g> 封存檔"</string>
+    <string name="mime_type_document" msgid="1596838147256375966">"文件"</string>
+    <string name="mime_type_document_ext" msgid="6327266601345501281">"<xliff:g id="EXTENSION">%1$s</xliff:g> 文件"</string>
+    <string name="mime_type_spreadsheet" msgid="2639138255207123557">"試算表"</string>
+    <string name="mime_type_spreadsheet_ext" msgid="5508653032786106725">"<xliff:g id="EXTENSION">%1$s</xliff:g> 試算表"</string>
+    <string name="mime_type_presentation" msgid="6145604688774787357">"簡報"</string>
+    <string name="mime_type_presentation_ext" msgid="2982650207774823437">"<xliff:g id="EXTENSION">%1$s</xliff:g> 簡報"</string>
     <string name="car_loading_profile" msgid="3545132581795684027">"載入中"</string>
     <plurals name="file_count" formatted="false" msgid="1628600959752419449">
       <item quantity="other">「<xliff:g id="FILE_NAME_2">%s</xliff:g>」及另外 <xliff:g id="COUNT_3">%d</xliff:g> 個檔案</item>
       <item quantity="one">「<xliff:g id="FILE_NAME_0">%s</xliff:g>」及另外 <xliff:g id="COUNT_1">%d</xliff:g> 個檔案</item>
     </plurals>
+    <!-- no translation found for chooser_no_direct_share_targets (997970693708458895) -->
+    <skip />
 </resources>
diff --git a/core/res/res/values-zu/strings.xml b/core/res/res/values-zu/strings.xml
index 2b96039..93280cb 100644
--- a/core/res/res/values-zu/strings.xml
+++ b/core/res/res/values-zu/strings.xml
@@ -308,15 +308,15 @@
     <string name="permgrouplab_phone" msgid="5229115638567440675">"Ifoni"</string>
     <string name="permgroupdesc_phone" msgid="6234224354060641055">"yenza uphinde uphathe amakholi wefoni"</string>
     <string name="permgrouprequest_phone" msgid="9166979577750581037">"Vumela i-&lt;b&gt;<xliff:g id="APP_NAME">%1$s</xliff:g>&lt;/b&gt; ukuthi yenze iphinde iphathe amakholi efoni?"</string>
-    <string name="permgrouplab_sensors" msgid="416037179223226722">"Izinzwa zomzimba"</string>
+    <string name="permgrouplab_sensors" msgid="4838614103153567532">"Izinzwa zomzimba"</string>
     <string name="permgroupdesc_sensors" msgid="7147968539346634043">"finyelela idatha yesizweli mayelana nezimpawu zakho ezibalulekile"</string>
     <string name="permgrouprequest_sensors" msgid="6349806962814556786">"Vumela i-&lt;b&gt;<xliff:g id="APP_NAME">%1$s</xliff:g>&lt;/b&gt; ukuthi ifinyelele kudatha yenzwa emayelana nezimpawu zakho ezibalulekile?"</string>
     <string name="permgrouplab_aural" msgid="965607064083134896">"Umculo"</string>
     <string name="permgroupdesc_aural" msgid="4870189506255958055">"finyelela umculo wakho"</string>
     <string name="permgrouprequest_aural" msgid="6787926123071735620">"Vumela i-&lt;b&gt;<xliff:g id="APP_NAME">%1$s</xliff:g>&lt;/b&gt; ukuthi ifinyelele umculo wakho?"</string>
-    <string name="permgrouplab_visual" msgid="8030190588123857921">"Izithombe namavidiyo"</string>
+    <string name="permgrouplab_visual" msgid="6477382108771145134">"Izithombe Namavidiyo"</string>
     <string name="permgroupdesc_visual" msgid="3415827902566663546">"finyelela izithombe zakho namavidiyo"</string>
-    <string name="permgrouprequest_visual" msgid="6907523945030290376">"Vumela i-&lt;b&gt;<xliff:g id="APP_NAME">%1$s</xliff:g>&lt;/b&gt; ukuthi ifinyelele kuzithombe zakho namavidiyo?"</string>
+    <string name="permgrouprequest_visual" msgid="3043752127595243314">"Vumela &lt;b&gt;<xliff:g id="APP_NAME">%1$s</xliff:g>&lt;/b&gt; ukufinyelela izithombe zakho namavidiyo, kufaka phakathi izindawo ezimakiwe?"</string>
     <string name="capability_title_canRetrieveWindowContent" msgid="3901717936930170320">"Thola okuqukethwe kwewindi"</string>
     <string name="capability_desc_canRetrieveWindowContent" msgid="3772225008605310672">"Hlola okuqukethwe kwewindi ohlanganyela nalo."</string>
     <string name="capability_title_canRequestTouchExploration" msgid="3108723364676667320">"Vula ukuhlola ngokuthinta"</string>
@@ -1396,8 +1396,7 @@
     <string name="ext_media_init_action" msgid="7952885510091978278">"Setha"</string>
     <string name="ext_media_unmount_action" msgid="1121883233103278199">"Khipha"</string>
     <string name="ext_media_browse_action" msgid="8322172381028546087">"Hlola"</string>
-    <!-- no translation found for ext_media_seamless_action (6575980560886881233) -->
-    <skip />
+    <string name="ext_media_seamless_action" msgid="6575980560886881233">"Shintsha okukhiphayo"</string>
     <string name="ext_media_missing_title" msgid="620980315821543904">"<xliff:g id="NAME">%s</xliff:g> okulahlekile"</string>
     <string name="ext_media_missing_message" msgid="4012389235250987930">"Faka idivayisi futhi"</string>
     <string name="ext_media_move_specific_title" msgid="1471100343872375842">"Ihambisa i-<xliff:g id="NAME">%s</xliff:g>"</string>
@@ -1611,6 +1610,8 @@
     <string name="display_manager_overlay_display_name" msgid="5142365982271620716">"Isendlalelo #<xliff:g id="ID">%1$d</xliff:g>"</string>
     <string name="display_manager_overlay_display_title" msgid="652124517672257172">"<xliff:g id="NAME">%1$s</xliff:g>: <xliff:g id="WIDTH">%2$d</xliff:g>x<xliff:g id="HEIGHT">%3$d</xliff:g>, <xliff:g id="DPI">%4$d</xliff:g> dpi"</string>
     <string name="display_manager_overlay_display_secure_suffix" msgid="6022119702628572080">", kuphephile"</string>
+    <string name="activity_starter_block_bg_activity_starts_permissive" msgid="5692097903712956720">"Lesi siqalo somsebenzi ongemuva kusukela ku-<xliff:g id="PACKAGENAME">%1$s</xliff:g> sizovinjelwa ekwakhiweni okuzayo kwe-Q. Bona i-go/q-bg-block."</string>
+    <string name="activity_starter_block_bg_activity_starts_enforcing" msgid="8299522481076404353">"Umsebenzi ongemuva oqala kusukela ku-<xliff:g id="PACKAGENAME">%1$s</xliff:g> uvinjelwe. Bona i-go/q-bg-block."</string>
     <string name="kg_forgot_pattern_button_text" msgid="8852021467868220608">"Ukhohlwe iphethini?"</string>
     <string name="kg_wrong_pattern" msgid="1850806070801358830">"Iphatheni engalungile"</string>
     <string name="kg_wrong_password" msgid="2333281762128113157">"Iphasiwedi engalungile"</string>
@@ -1996,9 +1997,29 @@
     <string name="dynamic_mode_notification_channel_name" msgid="2348803891571320452">"Isaziso solwazi lwe-Routine Mode"</string>
     <string name="dynamic_mode_notification_title" msgid="508815255807182035">"Ibhethri lingaphela ngaphambi kokushaja okuvamile"</string>
     <string name="dynamic_mode_notification_summary" msgid="2541166298550402690">"Isilondolozi sebhethri siyasebenza ngaphandle kwempilo yebhethri"</string>
+    <string name="mime_type_folder" msgid="7111951698626315204">"Ifolda"</string>
+    <string name="mime_type_apk" msgid="5518003630972506900">"Uhlelo lokusebenza lwe-Android"</string>
+    <string name="mime_type_generic" msgid="6833871596845900027">"Ifayela"</string>
+    <string name="mime_type_generic_ext" msgid="8450275970061657174">"<xliff:g id="EXTENSION">%1$s</xliff:g> ifayela"</string>
+    <string name="mime_type_audio" msgid="6289777657172050926">"Umsindo"</string>
+    <string name="mime_type_audio_ext" msgid="3270880987725816210">"<xliff:g id="EXTENSION">%1$s</xliff:g> umsindo"</string>
+    <string name="mime_type_video" msgid="4093025777317307426">"Ividiyo"</string>
+    <string name="mime_type_video_ext" msgid="5643771615714173159">"<xliff:g id="EXTENSION">%1$s</xliff:g> ividiyo"</string>
+    <string name="mime_type_image" msgid="3144284451605236371">"Isithombe"</string>
+    <string name="mime_type_image_ext" msgid="1514613218742736590">"<xliff:g id="EXTENSION">%1$s</xliff:g> isithombe"</string>
+    <string name="mime_type_compressed" msgid="1645486037074943257">"Ingobo yomlando"</string>
+    <string name="mime_type_compressed_ext" msgid="4232293058067801528">"<xliff:g id="EXTENSION">%1$s</xliff:g> ingobo yomlando"</string>
+    <string name="mime_type_document" msgid="1596838147256375966">"Idokhumenti"</string>
+    <string name="mime_type_document_ext" msgid="6327266601345501281">"<xliff:g id="EXTENSION">%1$s</xliff:g> idokhumenti"</string>
+    <string name="mime_type_spreadsheet" msgid="2639138255207123557">"Isipredishithi"</string>
+    <string name="mime_type_spreadsheet_ext" msgid="5508653032786106725">"<xliff:g id="EXTENSION">%1$s</xliff:g> isipredishithi"</string>
+    <string name="mime_type_presentation" msgid="6145604688774787357">"Iphrezentheshini"</string>
+    <string name="mime_type_presentation_ext" msgid="2982650207774823437">"<xliff:g id="EXTENSION">%1$s</xliff:g> iphrezentheshini"</string>
     <string name="car_loading_profile" msgid="3545132581795684027">"Iyalayisha"</string>
     <plurals name="file_count" formatted="false" msgid="1628600959752419449">
       <item quantity="one"><xliff:g id="FILE_NAME_2">%s</xliff:g> + <xliff:g id="COUNT_3">%d</xliff:g> amafayela</item>
       <item quantity="other"><xliff:g id="FILE_NAME_2">%s</xliff:g> + <xliff:g id="COUNT_3">%d</xliff:g> amafayela</item>
     </plurals>
+    <!-- no translation found for chooser_no_direct_share_targets (997970693708458895) -->
+    <skip />
 </resources>
diff --git a/core/res/res/values/attrs.xml b/core/res/res/values/attrs.xml
index 088669d..743496f 100644
--- a/core/res/res/values/attrs.xml
+++ b/core/res/res/values/attrs.xml
@@ -6488,6 +6488,9 @@
         <!-- Special option for window animations: show the wallpaper behind when running this
              animation. -->
         <attr name="showWallpaper" format="boolean" />
+        <!-- Special option for window animations: whether window should have rounded corners.
+             @see ScreenDecorationsUtils#getWindowCornerRadius(Resources) -->
+        <attr name="hasRoundedCorners" format="boolean" />
     </declare-styleable>
 
     <declare-styleable name="AnimationSet">
diff --git a/core/res/res/values/attrs_manifest.xml b/core/res/res/values/attrs_manifest.xml
index 1053184..fc7b4cf 100644
--- a/core/res/res/values/attrs_manifest.xml
+++ b/core/res/res/values/attrs_manifest.xml
@@ -965,7 +965,7 @@
          <p>The default value of this attribute is <code>false</code>. -->
     <attr name="allowEmbedded" format="boolean" />
 
-    <!-- @hide @SystemApi Specifies whether this {@link android.app.Activity} should be shown on
+    <!-- Specifies whether this {@link android.app.Activity} should be shown on
          top of the lock screen whenever the lockscreen is up and this activity has another
          activity behind it with the {@link android.R.attr#showWhenLocked} attribute set. That
          is, this activity is only visible on the lock screen if there is another activity with
@@ -1667,6 +1667,9 @@
              This flag is turned on by default. <em>This attribute is usable only by system apps.
              </em> -->
         <attr name="allowClearUserDataOnFailedRestore"/>
+        <!-- If {@code true} the app's non sensitive audio can be capture by other apps.
+             The default value is true. -->
+        <attr name="allowAudioPlaybackCapture" format="boolean" />
     </declare-styleable>
     <!-- The <code>permission</code> tag declares a security permission that can be
          used to control access from other packages to specific components or
diff --git a/core/res/res/values/colors.xml b/core/res/res/values/colors.xml
index 02fae4a..e9b1bd3 100644
--- a/core/res/res/values/colors.xml
+++ b/core/res/res/values/colors.xml
@@ -215,4 +215,6 @@
     <!-- Magnifier -->
     <color name="default_magnifier_color_overlay">#00FFFFFF</color>
 
+    <color name="chooser_row_divider">#1f000000</color>
+
 </resources>
diff --git a/core/res/res/values/colors_device_defaults.xml b/core/res/res/values/colors_device_defaults.xml
index 824b4b5..7209103 100644
--- a/core/res/res/values/colors_device_defaults.xml
+++ b/core/res/res/values/colors_device_defaults.xml
@@ -26,6 +26,8 @@
     <color name="primary_dark_device_default_settings">@color/primary_dark_material_settings</color>
     <color name="primary_dark_device_default_settings_light">@color/primary_dark_material_settings_light</color>
 
+    <color name="navigation_bar_divider_device_default_settings">#1f000000</color>
+
     <color name="secondary_device_default_settings">@color/secondary_material_settings</color>
     <color name="secondary_device_default_settings_light">@color/secondary_material_settings_light</color>
     <color name="tertiary_device_default_settings">@color/tertiary_material_settings</color>
diff --git a/core/res/res/values/config.xml b/core/res/res/values/config.xml
index 910af4c..bfb6d24 100644
--- a/core/res/res/values/config.xml
+++ b/core/res/res/values/config.xml
@@ -127,7 +127,7 @@
     <bool name="config_sendAudioBecomingNoisy">true</bool>
 
     <!-- Whether Hearing Aid profile is supported -->
-    <bool name="config_hearing_aid_profile_supported">true</bool>
+    <bool name="config_hearing_aid_profile_supported">false</bool>
 
     <!-- Flag to disable all transition animations -->
     <bool name="config_disableTransitionAnimation">false</bool>
@@ -486,22 +486,16 @@
              - the return value of TelephonyManager.getTetherApnRequired()
                determines how the array is further modified:
 
-                   * DUN_REQUIRED
-                     TYPE_MOBILE is removed (if present)
-                     TYPE_MOBILE_HIPRI is removed (if present)
-                     TYPE_MOBILE_DUN is appended (if not already present)
+                   * TRUE (DUN REQUIRED).
+                     TYPE_MOBILE is removed (if present).
+                     TYPE_MOBILE_HIPRI is removed (if present).
+                     TYPE_MOBILE_DUN is appended (if not already present).
 
-                   * DUN_NOT_REQUIRED
-                     TYPE_MOBILE_DUN is removed (if present)
-                     TYPE_MOBILE is appended (if not already present)
-                     TYPE_MOBILE_HIPRI is appended (if not already present)
-
-                   * DUN_UNSPECIFIED
-                     if any of TYPE_MOBILE{,_DUN,_HIPRI} are present:
-                         change nothing
-                     else:
-                         TYPE_MOBILE is appended
-                         TYPE_MOBILE_HIPRI is appended
+                   * FALSE (DUN NOT REQUIRED).
+                     TYPE_MOBILE_DUN is removed (if present).
+                     If both of TYPE_MOBILE{,_HIPRI} are not present:
+                        TYPE_MOBILE is appended.
+                        TYPE_MOBILE_HIPRI is appended.
 
          For other changes applied to this list, now and in the future, see
          com.android.server.connectivity.tethering.TetheringConfiguration.
@@ -660,7 +654,7 @@
     <bool translatable="false" name="config_wifi_framework_enable_associated_network_selection">true</bool>
 
     <!-- Boolean indicating whether single radio chain scan results are to be used for network selection -->
-    <bool translatable="false" name="config_wifi_framework_use_single_radio_chain_scan_results_network_selection">false</bool>
+    <bool translatable="false" name="config_wifi_framework_use_single_radio_chain_scan_results_network_selection">true</bool>
 
     <!-- Boolean indicating that wifi only link configuratios that have exact same credentials (i.e PSK) -->
     <bool translatable="false" name="config_wifi_only_link_same_credential_configurations">true</bool>
@@ -712,6 +706,9 @@
     <!-- Indicates that connected MAC randomization is supported on this device -->
     <bool translatable="false" name="config_wifi_connected_mac_randomization_supported">false</bool>
 
+    <!-- Indicates that p2p MAC randomization is supported on this device -->
+    <bool translatable="false" name="config_wifi_p2p_mac_randomization_supported">false</bool>
+
     <!-- Indicates that wifi link probing is supported on this device -->
     <bool translatable="false" name="config_wifi_link_probing_supported">false</bool>
 
@@ -1953,7 +1950,7 @@
     <!-- The name of the package that will hold the browser role by default. -->
     <string name="config_defaultBrowser" translatable="false">@string/default_browser</string>
     <!-- The name of the package that will hold the dialer role by default. -->
-    <string name="config_defaultDialer" translatable="false">com.android.phone</string>
+    <string name="config_defaultDialer" translatable="false">com.android.dialer</string>
     <!-- The name of the package that will hold the SMS role by default. -->
     <string name="config_defaultSms" translatable="false">@string/default_sms_application</string>
     <!-- Whether the default emergency settings should be shown. -->
@@ -2267,7 +2264,7 @@
 
     <!-- If the sensor that wakes up the lock screen is available or not. -->
     <bool name="config_dozeWakeLockScreenSensorAvailable">false</bool>
-    <integer name="config_dozeWakeLockScreenDebounce">3000</integer>
+    <integer name="config_dozeWakeLockScreenDebounce">1500</integer>
 
     <!-- Control whether the always on display mode is available. This should only be enabled on
          devices where the display has been tuned to be power efficient in DOZE and/or DOZE_SUSPEND
@@ -2923,14 +2920,6 @@
 
     <bool name="config_networkSamplingWakesDevice">true</bool>
 
-    <!-- Home (non-roaming) values for CDMA roaming indicator.
-         Carriers can override this table by resource overlay. If not,
-         the default values come from 3GPP2 C.R1001 table
-         8.1-1. Enhanced Roaming Indicator Number Assignments -->
-    <string-array translatable="false" name="config_cdma_home_system">
-        <item>1</item>
-    </string-array>
-
     <!--From SmsMessage-->
     <!--Support decoding the user data payload as pack GSM 8-bit (a GSM alphabet
         string that's stored in 8-bit unpacked format) characters.-->
@@ -3712,8 +3701,8 @@
 
     <string translatable="false" name="config_batterySaverDeviceSpecificConfig"></string>
 
-    <!-- Package name that should be granted Notification Assistant access -->
-    <string name="config_defaultAssistantAccessPackage" translatable="false">android.ext.services</string>
+    <!-- Component name that should be granted Notification Assistant access -->
+    <string name="config_defaultAssistantAccessComponent" translatable="false">android.ext.services/android.ext.services.notification.Assistant</string>
 
     <bool name="config_supportBluetoothPersistedState">true</bool>
 
@@ -3944,11 +3933,18 @@
         M5,17.5 V12 H3 L7,4.5 V10 h2 L5,17.5 z
     </string>
     <string name="config_batterymeterPowersavePath" translatable="false">
-		M9,10l-2,0l0,-2l-2,0l0,2l-2,0l0,2l2,0l0,2l2,0l0,-2l2,0z
+		M9.75,10l-2.5,0l0,-2.5l-2.5,0l0,2.5l-2.5,0l0,2.5l2.5,0l0,2.5l2.5,0l0,-2.5l2.5,0z
     </string>
 
     <!-- A dual tone battery meter draws the perimeter path twice - once to define the shape
      and a second time clipped to the fill level to indicate charge -->
     <bool name="config_batterymeterDualTone">false</bool>
 
+    <!-- The default peak refresh rate for a given device. Change this value if you want to allow
+         for higher refresh rates to be automatically used out of the box -->
+    <integer name="config_defaultPeakRefreshRate">60</integer>
+
+    <!-- The type of the light sensor to be used by the display framework for things like
+         auto-brightness. If unset, then it just gets the default sensor of type TYPE_LIGHT. -->
+    <string name="config_displayLightSensorType" translatable="false" />
 </resources>
diff --git a/core/res/res/values/dimens.xml b/core/res/res/values/dimens.xml
index 39cbd26..fafd8fe 100644
--- a/core/res/res/values/dimens.xml
+++ b/core/res/res/values/dimens.xml
@@ -717,6 +717,7 @@
 
     <!-- chooser (sharesheet) spacing -->
     <dimen name="chooser_corner_radius">8dp</dimen>
+    <dimen name="chooser_row_text_option_translate">25dp</dimen>
     <dimen name="chooser_view_spacing">18dp</dimen>
     <dimen name="chooser_edge_margin_thin">16dp</dimen>
     <dimen name="chooser_edge_margin_normal">24dp</dimen>
diff --git a/core/res/res/values/public.xml b/core/res/res/values/public.xml
index 5a3c536..840cd63 100644
--- a/core/res/res/values/public.xml
+++ b/core/res/res/values/public.xml
@@ -2934,13 +2934,14 @@
         <public name="foregroundServiceType" />
         <public name="hasFragileUserData" />
         <public name="minAspectRatio" />
-        <!-- @hide @SystemApi -->
         <public name="inheritShowWhenLocked" />
         <public name="zygotePreloadName" />
         <public name="useEmbeddedDex" />
         <public name="forceUriPermissions" />
         <!-- @hide @SystemApi -->
         <public name="allowClearUserDataOnFailedRestore"/>
+        <public name="allowAudioPlaybackCapture"/>
+        <public name="secureElementName" />
     </public-group>
 
     <public-group type="drawable" first-id="0x010800b4">
diff --git a/core/res/res/values/strings.xml b/core/res/res/values/strings.xml
index 4e47b1f..6671ff8 100644
--- a/core/res/res/values/strings.xml
+++ b/core/res/res/values/strings.xml
@@ -707,12 +707,12 @@
     <string name="permgrouprequest_location">Allow
         &lt;b><xliff:g id="app_name" example="Gmail">%1$s</xliff:g>&lt;/b> to access this device\'s location?</string>
     <!-- Subtitle of the message shown to the user when the apps requests permission to use the location only while app is in foreground [CHAR LIMIT=150]-->
-    <string name="permgrouprequestdetail_location">The app will only have access to the location while you\u2019re using the app.</string>
+    <string name="permgrouprequestdetail_location">The app will only have access to the location while you\u2019re using the app</string>
     <!-- Message shown to the user when the apps requests permission to use the location while app is in foreground and background. If ever possible this should stay below 80 characters (assuming the parameters takes 20 characters). Don't abbreviate until the message reaches 120 characters though. [CHAR LIMIT=120] -->
-    <string name="permgroupbackgroundrequest_location">Always allow
-        &lt;b><xliff:g id="app_name" example="Gmail">%1$s</xliff:g>&lt;/b> to access this device\u2019s location?</string>
+    <string name="permgroupbackgroundrequest_location">Allow
+        &lt;b><xliff:g id="app_name" example="Gmail">%1$s</xliff:g>&lt;/b> to access this device\u2019s location &lt;b>all the time&lt;/b>?</string>
     <!-- Subtitle of the message shown to the user when the apps requests permission to use the location while app is in foreground and background [CHAR LIMIT=150] -->
-    <string name="permgroupbackgroundrequestdetail_location">The app will always have access to the location, even when you\u2019re not using the app.</string>
+    <string name="permgroupbackgroundrequestdetail_location">App currently can access location only while you\u2019re using the app</string>
 
     <!-- Title of a category of application permissions, listed so the user can choose whether they want to allow the application to do this. -->
     <string name="permgrouplab_calendar">Calendar</string>
@@ -5340,4 +5340,8 @@
         <item quantity="one"><xliff:g id="file_name">%s</xliff:g> + <xliff:g id="count">%d</xliff:g> file</item>
         <item quantity="other"><xliff:g id="file_name">%s</xliff:g> + <xliff:g id="count">%d</xliff:g> files</item>
     </plurals>
+
+    <!-- ChooserActivity - No direct share targets are available. [CHAR LIMIT=NONE] -->
+    <string name="chooser_no_direct_share_targets">Direct share not available</string>
+
 </resources>
diff --git a/core/res/res/values/symbols.xml b/core/res/res/values/symbols.xml
index 426d813..c7e19c5 100644
--- a/core/res/res/values/symbols.xml
+++ b/core/res/res/values/symbols.xml
@@ -1378,9 +1378,8 @@
   <java-symbol type="drawable" name="ic_text_dot" />
   <java-symbol type="drawable" name="ic_print" />
   <java-symbol type="drawable" name="ic_print_error" />
-  <java-symbol type="drawable" name="ic_lock_24dp" />
-  <java-symbol type="drawable" name="ic_lock_open_24dp" />
-  <java-symbol type="drawable" name="ic_auth_error" />
+  <java-symbol type="drawable" name="ic_lock" />
+  <java-symbol type="drawable" name="ic_lock_open" />
   <java-symbol type="drawable" name="jog_dial_arrow_long_left_green" />
   <java-symbol type="drawable" name="jog_dial_arrow_long_right_red" />
   <java-symbol type="drawable" name="jog_dial_arrow_short_left_and_right" />
@@ -1939,6 +1938,7 @@
   <java-symbol type="bool" name="config_wifi_convert_apband_5ghz_to_any" />
   <java-symbol type="bool" name="config_wifi_local_only_hotspot_5ghz" />
   <java-symbol type="bool" name="config_wifi_connected_mac_randomization_supported" />
+  <java-symbol type="bool" name="config_wifi_p2p_mac_randomization_supported" />
   <java-symbol type="bool" name="config_wifi_link_probing_supported" />
   <java-symbol type="bool" name="config_wifi_fast_bss_transition_enabled" />
   <java-symbol type="bool" name="config_wimaxEnabled" />
@@ -2247,6 +2247,7 @@
   <java-symbol type="anim" name="lock_lock" />
   <java-symbol type="anim" name="lock_unlock" />
   <java-symbol type="anim" name="lock_in" />
+  <java-symbol type="anim" name="lock_scanning" />
 
   <java-symbol type="bool" name="config_alwaysUseCdmaRssi" />
   <java-symbol type="dimen" name="status_bar_icon_size" />
@@ -2606,7 +2607,6 @@
   <java-symbol type="attr" name="lightRadius" />
   <java-symbol type="attr" name="ambientShadowAlpha" />
   <java-symbol type="attr" name="spotShadowAlpha" />
-  <java-symbol type="array" name="config_cdma_home_system" />
   <java-symbol type="bool" name="config_sms_decode_gsm_8bit_data" />
   <java-symbol type="dimen" name="text_size_small_material" />
   <java-symbol type="attr" name="checkMarkGravity" />
@@ -2752,12 +2752,16 @@
   <java-symbol type="id" name="month_view" />
   <java-symbol type="integer" name="config_zen_repeat_callers_threshold" />
   <java-symbol type="dimen" name="chooser_corner_radius" />
+  <java-symbol type="string" name="chooser_no_direct_share_targets" />
+  <java-symbol type="drawable" name="chooser_row_layer_list" />
   <java-symbol type="dimen" name="chooser_view_spacing" />
   <java-symbol type="dimen" name="chooser_edge_margin_thin" />
   <java-symbol type="dimen" name="chooser_edge_margin_normal" />
   <java-symbol type="dimen" name="chooser_preview_image_font_size"/>
   <java-symbol type="dimen" name="chooser_preview_width" />
   <java-symbol type="layout" name="chooser_grid" />
+  <java-symbol type="id" name="chooser_row_text_option" />
+  <java-symbol type="dimen" name="chooser_row_text_option_translate" />
   <java-symbol type="layout" name="resolve_grid_item" />
   <java-symbol type="id" name="day_picker_view_pager" />
   <java-symbol type="layout" name="day_picker_content_material" />
@@ -3533,7 +3537,7 @@
   <java-symbol type="string" name="harmful_app_warning_title" />
   <java-symbol type="layout" name="harmful_app_warning_dialog" />
 
-  <java-symbol type="string" name="config_defaultAssistantAccessPackage" />
+  <java-symbol type="string" name="config_defaultAssistantAccessComponent" />
 
   <java-symbol type="bool" name="config_supportBluetoothPersistedState" />
 
@@ -3688,4 +3692,10 @@
   <java-symbol type="string" name="mime_type_spreadsheet_ext" />
   <java-symbol type="string" name="mime_type_presentation" />
   <java-symbol type="string" name="mime_type_presentation_ext" />
+
+  <!-- For high refresh rate displays -->
+  <java-symbol type="integer" name="config_defaultPeakRefreshRate" />
+
+  <!-- For Auto-Brightness -->
+  <java-symbol type="string" name="config_displayLightSensorType" />
 </resources>
diff --git a/core/res/res/values/themes_device_defaults.xml b/core/res/res/values/themes_device_defaults.xml
index 194c86c..9a95ecc 100644
--- a/core/res/res/values/themes_device_defaults.xml
+++ b/core/res/res/values/themes_device_defaults.xml
@@ -1468,7 +1468,7 @@
         <item name="colorEdgeEffect">@android:color/black</item>
 
         <!-- Add white nav bar with divider that matches material -->
-        <item name="navigationBarDividerColor">#1f000000</item>
+        <item name="navigationBarDividerColor">@color/navigation_bar_divider_device_default_settings</item>
         <item name="navigationBarColor">@android:color/white</item>
         <item name="windowLightNavigationBar">true</item>
 
diff --git a/core/res/res/xml/color_extraction.xml b/core/res/res/xml/color_extraction.xml
index 93ab0ff..c3ebe4e 100644
--- a/core/res/res/xml/color_extraction.xml
+++ b/core/res/res/xml/color_extraction.xml
@@ -246,109 +246,4 @@
                 0.6549019607843137,0.7549019607843137,0.8509803921568627,
                 0.9411764705882353"/>
     </palettes>
-    <blacklist>
-        <!-- Red -->
-        <range h="0, 20"
-               s="0.7, 1"
-               l="0.21, 0.79"/>
-        <range h="0, 20"
-               s="0.3, 0.7"
-               l="0.355, 0.653"/>
-        <!-- Red Orange -->
-        <range h="20, 40"
-               s="0.7, 1"
-               l="0.2, 0.643"/>
-        <range h="20, 40"
-               s="0.3, 0.7"
-               l="0.414, 0.561"/>
-        <range h="20, 40"
-               s="0, 0.3"
-               l="0.343, 0.584"/>
-        <!-- Orange -->
-        <range h="40, 60"
-               s="0.7, 1"
-               l="0.173, 0.38"/>
-        <range h="40, 60"
-               s="0.3, 0.7"
-               l="0.233, 0.427"/>
-        <range h="40, 60"
-               s="0, 0.3"
-               l="0.231, 0.48"/>
-        <!-- Yellow 60 -->
-        <range h="60, 80"
-               s="0.7, 1"
-               l="0.15, 0.40"/>
-        <range h="60, 80"
-               s="0.3, 0.7"
-               l="0.15, 0.42"/>
-        <range h="60, 80"
-               s="0, 0.3"
-               l="0.35, 0.57"/>
-        <!-- Yellow Green 80 -->
-        <range h="80, 100"
-               s="0.7, 1"
-               l="0.36, 0.65"/>
-        <range h="80, 100"
-               s="0.3, 0.7"
-               l="0.48, 0.57"/>
-        <!-- Yellow green 100 -->
-        <range h="100, 120"
-               s="0.7, 1"
-               l="0.388, 0.67"/>
-        <range h="100, 120"
-               s="0.3, 0.7"
-               l="0.424, 0.58"/>
-        <!-- Green -->
-        <range h="120, 140"
-               s="0.7, 1"
-               l="0.37, 0.65"/>
-        <range h="120, 140"
-               s="0.3, 0.7"
-               l="0.435, 0.58"/>
-        <!-- Green Blue 140 -->
-        <range h="140, 160"
-               s="0.7, 1"
-               l="0.43, 0.641"/>
-        <!-- Seaoam -->
-        <range h="160, 180"
-               s="0.7, 1"
-               l="0.496, 0.567"/>
-        <!-- Cyan -->
-        <range h="180, 200"
-               s="0.7, 1"
-               l="0.52, 0.729"/>
-        <!-- Blue -->
-        <range h="220, 240"
-               s="0.7, 1"
-               l="0.396, 0.571"/>
-        <range h="220, 240"
-               s="0.3, 0.7"
-               l="0.425, 0.551"/>
-        <!-- Blue Purple 240 -->
-        <range h="240, 260"
-               s="0.7, 1"
-               l="0.418, 0.639"/>
-        <range h="220, 240"
-               s="0.3, 0.7"
-               l="0.441, 0.576"/>
-        <!-- Blue Purple 260 -->
-        <range h="260, 280"
-               s="0.3, 1"
-               l="0.461, 0.553"/>
-        <!-- Fuchsia -->
-        <range h="300, 320"
-               s="0.7, 1"
-               l="0.484, 0.588"/>
-        <range h="300, 320"
-               s="0.3, 0.7"
-               l="0.48, 0.592"/>
-        <!-- Pink -->
-        <range h="320, 340"
-               s="0.7, 1"
-               l="0.466, 0.629"/>
-        <!-- Soft red -->
-        <range h="340, 360"
-               s="0.7, 1"
-               l="0.437, 0.596"/>
-    </blacklist>
-</colorextraction>
\ No newline at end of file
+</colorextraction>
diff --git a/core/tests/BroadcastRadioTests/Android.mk b/core/tests/BroadcastRadioTests/Android.mk
index 6b0484e..faffc4b 100644
--- a/core/tests/BroadcastRadioTests/Android.mk
+++ b/core/tests/BroadcastRadioTests/Android.mk
@@ -25,7 +25,7 @@
 # LOCAL_SDK_VERSION := current
 LOCAL_PRIVATE_PLATFORM_APIS := true
 
-LOCAL_STATIC_JAVA_LIBRARIES := compatibility-device-util androidx.test.rules testng
+LOCAL_STATIC_JAVA_LIBRARIES := compatibility-device-util-axt androidx.test.rules testng
 
 LOCAL_JAVA_LIBRARIES := android.test.base
 
diff --git a/core/tests/coretests/AndroidManifest.xml b/core/tests/coretests/AndroidManifest.xml
index 1764249..3791305 100644
--- a/core/tests/coretests/AndroidManifest.xml
+++ b/core/tests/coretests/AndroidManifest.xml
@@ -123,6 +123,9 @@
     <uses-permission android:name="android.permission.CAPTURE_VIDEO_OUTPUT" />
     <uses-permission android:name="android.permission.CAPTURE_SECURE_VIDEO_OUTPUT" />
 
+    <!-- color extraction test permissions -->
+    <uses-permission android:name="android.permission.READ_FRAME_BUFFER" />
+
     <!-- accessibility test permissions -->
     <uses-permission android:name="android.permission.RETRIEVE_WINDOW_CONTENT" />
 
diff --git a/core/tests/coretests/src/android/app/NotificationTest.java b/core/tests/coretests/src/android/app/NotificationTest.java
index c17aa92..109cff9 100644
--- a/core/tests/coretests/src/android/app/NotificationTest.java
+++ b/core/tests/coretests/src/android/app/NotificationTest.java
@@ -21,12 +21,14 @@
 import static org.junit.Assert.assertEquals;
 import static org.junit.Assert.assertFalse;
 import static org.junit.Assert.assertNotSame;
+import static org.junit.Assert.assertNull;
 import static org.junit.Assert.assertSame;
 import static org.junit.Assert.assertTrue;
 
 import android.annotation.Nullable;
 import android.content.Context;
 import android.content.Intent;
+import android.content.LocusId;
 import android.graphics.BitmapFactory;
 import android.graphics.drawable.Icon;
 import android.media.session.MediaSession;
@@ -320,6 +322,27 @@
                 action.clone().getSemanticAction());
     }
 
+    @Test
+    public void testBuilder_setLocusId() {
+        LocusId locusId = new LocusId("4815162342");
+        Notification notification = new Notification.Builder(mContext, "whatever")
+                .setLocusId(locusId).build();
+        assertEquals(locusId, notification.getLocusId());
+
+        Notification clone = writeAndReadParcelable(notification);
+        assertEquals(locusId, clone.getLocusId());
+    }
+
+    @Test
+    public void testBuilder_setLocusId_null() {
+        Notification notification = new Notification.Builder(mContext, "whatever")
+                .setLocusId(null).build();
+        assertNull(notification.getLocusId());
+
+        Notification clone = writeAndReadParcelable(notification);
+        assertNull(clone.getLocusId());
+    }
+
     private Notification.Builder getMediaNotification() {
         MediaSession session = new MediaSession(mContext, "test");
         return new Notification.Builder(mContext, "color")
diff --git a/core/tests/coretests/src/android/os/PowerManagerTest.java b/core/tests/coretests/src/android/os/PowerManagerTest.java
index 1b587dd..576ac73 100644
--- a/core/tests/coretests/src/android/os/PowerManagerTest.java
+++ b/core/tests/coretests/src/android/os/PowerManagerTest.java
@@ -41,7 +41,9 @@
     private UiDevice mUiDevice;
     private Executor mExec = Executors.newSingleThreadExecutor();
     @Mock
-    private PowerManager.ThermalStatusCallback mCallback;
+    private PowerManager.OnThermalStatusChangedListener mListener1;
+    @Mock
+    private PowerManager.OnThermalStatusChangedListener mListener2;
     private static final long CALLBACK_TIMEOUT_MILLI_SEC = 5000;
 
     /**
@@ -169,6 +171,11 @@
         // TODO: Threaded test (needs handler) to make sure timed wakelocks work too
     }
 
+    /**
+     * Confirm that we can get thermal status.
+     *
+     * @throws Exception
+     */
     @Test
     public void testGetThermalStatus() throws Exception {
         int status = 0;
@@ -179,24 +186,57 @@
         assertEquals(status, mPm.getCurrentThermalStatus());
     }
 
+    /**
+     * Confirm that we can add/remove thermal status listener.
+     *
+     * @throws Exception
+     */
     @Test
     public void testThermalStatusCallback() throws Exception {
-        mPm.registerThermalStatusCallback(mCallback, mExec);
-        verify(mCallback, timeout(CALLBACK_TIMEOUT_MILLI_SEC)
-                .times(1)).onStatusChange(0);
-        reset(mCallback);
-        int status = 3;
+        // Initial override status is THERMAL_STATUS_NONE
+        int status = PowerManager.THERMAL_STATUS_NONE;
+        // Add listener1
+        mPm.addThermalStatusListener(mExec, mListener1);
+        verify(mListener1, timeout(CALLBACK_TIMEOUT_MILLI_SEC)
+                .times(1)).onThermalStatusChanged(status);
+        reset(mListener1);
+        status = PowerManager.THERMAL_STATUS_SEVERE;
         mUiDevice.executeShellCommand("cmd thermalservice override-status "
                 + Integer.toString(status));
-        verify(mCallback, timeout(CALLBACK_TIMEOUT_MILLI_SEC)
-                .times(1)).onStatusChange(status);
-        reset(mCallback);
-        mPm.unregisterThermalStatusCallback(mCallback);
-        status = 2;
+        verify(mListener1, timeout(CALLBACK_TIMEOUT_MILLI_SEC)
+                .times(1)).onThermalStatusChanged(status);
+        reset(mListener1);
+        // Add listener1 again
+        try {
+            mPm.addThermalStatusListener(mListener1);
+            fail("Expected exception not thrown");
+        } catch (IllegalArgumentException expectedException) {
+        }
+        // Add listener2 on main thread.
+        mPm.addThermalStatusListener(mListener2);
+        status = PowerManager.THERMAL_STATUS_MODERATE;
         mUiDevice.executeShellCommand("cmd thermalservice override-status "
                 + Integer.toString(status));
-        verify(mCallback, timeout(CALLBACK_TIMEOUT_MILLI_SEC)
-                .times(0)).onStatusChange(status);
-
+        verify(mListener1, timeout(CALLBACK_TIMEOUT_MILLI_SEC)
+                .times(1)).onThermalStatusChanged(status);
+        verify(mListener2, timeout(CALLBACK_TIMEOUT_MILLI_SEC)
+                .times(1)).onThermalStatusChanged(status);
+        reset(mListener1);
+        reset(mListener2);
+        // Remove listener1
+        mPm.removeThermalStatusListener(mListener1);
+        // Remove listener1 again
+        try {
+            mPm.removeThermalStatusListener(mListener1);
+            fail("Expected exception not thrown");
+        } catch (IllegalArgumentException expectedException) {
+        }
+        status = PowerManager.THERMAL_STATUS_LIGHT;
+        mUiDevice.executeShellCommand("cmd thermalservice override-status "
+                + Integer.toString(status));
+        verify(mListener1, timeout(CALLBACK_TIMEOUT_MILLI_SEC)
+                .times(0)).onThermalStatusChanged(status);
+        verify(mListener2, timeout(CALLBACK_TIMEOUT_MILLI_SEC)
+                .times(1)).onThermalStatusChanged(status);
     }
 }
diff --git a/core/tests/coretests/src/android/provider/DeviceConfigTest.java b/core/tests/coretests/src/android/provider/DeviceConfigTest.java
index 5d5754b..04fa524 100644
--- a/core/tests/coretests/src/android/provider/DeviceConfigTest.java
+++ b/core/tests/coretests/src/android/provider/DeviceConfigTest.java
@@ -16,6 +16,7 @@
 
 package android.provider;
 
+import static android.provider.DeviceConfig.OnPropertiesChangedListener;
 import static android.provider.DeviceConfig.OnPropertyChangedListener;
 
 import static com.google.common.truth.Truth.assertThat;
@@ -30,6 +31,7 @@
 import androidx.test.runner.AndroidJUnit4;
 
 import org.junit.After;
+import org.junit.Assert;
 import org.junit.Test;
 import org.junit.runner.RunWith;
 
@@ -59,6 +61,131 @@
     }
 
     @Test
+    public void getString_empty() {
+        final String default_value = "default_value";
+        final String result = DeviceConfig.getString(sNamespace, sKey, default_value);
+        assertThat(result).isEqualTo(default_value);
+    }
+
+    @Test
+    public void getString_nonEmpty() {
+        final String value = "new_value";
+        final String default_value = "default";
+        DeviceConfig.setProperty(sNamespace, sKey, value, false);
+
+        final String result = DeviceConfig.getString(sNamespace, sKey, default_value);
+        assertThat(result).isEqualTo(value);
+    }
+
+    @Test
+    public void getBoolean_empty() {
+        final boolean default_value = true;
+        final boolean result = DeviceConfig.getBoolean(sNamespace, sKey, default_value);
+        assertThat(result).isEqualTo(default_value);
+    }
+
+    @Test
+    public void getBoolean_valid() {
+        final boolean value = true;
+        final boolean default_value = false;
+        DeviceConfig.setProperty(sNamespace, sKey, String.valueOf(value), false);
+
+        final boolean result = DeviceConfig.getBoolean(sNamespace, sKey, default_value);
+        assertThat(result).isEqualTo(value);
+    }
+
+    @Test
+    public void getBoolean_invalid() {
+        final boolean default_value = true;
+        DeviceConfig.setProperty(sNamespace, sKey, "not_a_boolean", false);
+
+        final boolean result = DeviceConfig.getBoolean(sNamespace, sKey, default_value);
+        // Anything non-null other than case insensitive "true" parses to false.
+        assertThat(result).isFalse();
+    }
+
+    @Test
+    public void getInt_empty() {
+        final int default_value = 999;
+        final int result = DeviceConfig.getInt(sNamespace, sKey, default_value);
+        assertThat(result).isEqualTo(default_value);
+    }
+
+    @Test
+    public void getInt_valid() {
+        final int value = 123;
+        final int default_value = 999;
+        DeviceConfig.setProperty(sNamespace, sKey, String.valueOf(value), false);
+
+        final int result = DeviceConfig.getInt(sNamespace, sKey, default_value);
+        assertThat(result).isEqualTo(value);
+    }
+
+    @Test
+    public void getInt_invalid() {
+        final int default_value = 999;
+        DeviceConfig.setProperty(sNamespace, sKey, "not_an_int", false);
+
+        final int result = DeviceConfig.getInt(sNamespace, sKey, default_value);
+        // Failure to parse results in using the default value
+        assertThat(result).isEqualTo(default_value);
+    }
+
+    @Test
+    public void getLong_empty() {
+        final long default_value = 123456;
+        final long result = DeviceConfig.getLong(sNamespace, sKey, default_value);
+        assertThat(result).isEqualTo(default_value);
+    }
+
+    @Test
+    public void getLong_valid() {
+        final long value = 456789;
+        final long default_value = 123456;
+        DeviceConfig.setProperty(sNamespace, sKey, String.valueOf(value), false);
+
+        final long result = DeviceConfig.getLong(sNamespace, sKey, default_value);
+        assertThat(result).isEqualTo(value);
+    }
+
+    @Test
+    public void getLong_invalid() {
+        final long default_value = 123456;
+        DeviceConfig.setProperty(sNamespace, sKey, "not_a_long", false);
+
+        final long result = DeviceConfig.getLong(sNamespace, sKey, default_value);
+        // Failure to parse results in using the default value
+        assertThat(result).isEqualTo(default_value);
+    }
+
+    @Test
+    public void getFloat_empty() {
+        final float default_value = 123.456f;
+        final float result = DeviceConfig.getFloat(sNamespace, sKey, default_value);
+        assertThat(result).isEqualTo(default_value);
+    }
+
+    @Test
+    public void getFloat_valid() {
+        final float value = 456.789f;
+        final float default_value = 123.456f;
+        DeviceConfig.setProperty(sNamespace, sKey, String.valueOf(value), false);
+
+        final float result = DeviceConfig.getFloat(sNamespace, sKey, default_value);
+        assertThat(result).isEqualTo(value);
+    }
+
+    @Test
+    public void getFloat_invalid() {
+        final float default_value = 123.456f;
+        DeviceConfig.setProperty(sNamespace, sKey, "not_a_float", false);
+
+        final float result = DeviceConfig.getFloat(sNamespace, sKey, default_value);
+        // Failure to parse results in using the default value
+        assertThat(result).isEqualTo(default_value);
+    }
+
+    @Test
     public void setAndGetProperty_sameNamespace() {
         DeviceConfig.setProperty(sNamespace, sKey, sValue, false);
         String result = DeviceConfig.getProperty(sNamespace, sKey);
@@ -98,7 +225,31 @@
     }
 
     @Test
-    public void testListener() throws InterruptedException {
+    public void testOnPropertiesChangedListener() throws InterruptedException {
+        final CountDownLatch countDownLatch = new CountDownLatch(1);
+
+        OnPropertiesChangedListener changeListener = (properties) -> {
+            assertThat(properties.getNamespace()).isEqualTo(sNamespace);
+            assertThat(properties.getKeyset()).contains(sKey);
+            assertThat(properties.getString(sKey, "default_value")).isEqualTo(sValue);
+            countDownLatch.countDown();
+        };
+
+        try {
+            DeviceConfig.addOnPropertiesChangedListener(sNamespace,
+                    ActivityThread.currentApplication().getMainExecutor(), changeListener);
+            DeviceConfig.setProperty(sNamespace, sKey, sValue, false);
+            assertThat(countDownLatch.await(
+                    WAIT_FOR_PROPERTY_CHANGE_TIMEOUT_MILLIS, TimeUnit.MILLISECONDS)).isTrue();
+        } catch (InterruptedException e) {
+            Assert.fail(e.getMessage());
+        } finally {
+            DeviceConfig.removeOnPropertiesChangedListener(changeListener);
+        }
+    }
+
+    @Test
+    public void testOnPropertyChangedListener() throws InterruptedException {
         CountDownLatch countDownLatch = new CountDownLatch(1);
 
         OnPropertyChangedListener changeListener = (namespace, name, value) -> {
@@ -114,6 +265,8 @@
             DeviceConfig.setProperty(sNamespace, sKey, sValue, false);
             assertThat(countDownLatch.await(
                     WAIT_FOR_PROPERTY_CHANGE_TIMEOUT_MILLIS, TimeUnit.MILLISECONDS)).isTrue();
+        } catch (InterruptedException e) {
+            Assert.fail(e.getMessage());
         } finally {
             DeviceConfig.removeOnPropertyChangedListener(changeListener);
         }
diff --git a/core/tests/coretests/src/android/provider/SettingsBackupTest.java b/core/tests/coretests/src/android/provider/SettingsBackupTest.java
index 23cd963..43f8db1 100644
--- a/core/tests/coretests/src/android/provider/SettingsBackupTest.java
+++ b/core/tests/coretests/src/android/provider/SettingsBackupTest.java
@@ -92,7 +92,8 @@
                     Settings.System.VOLUME_SYSTEM, // deprecated since API 2?
                     Settings.System.VOLUME_VOICE, // deprecated since API 2?
                     Settings.System.WHEN_TO_MAKE_WIFI_CALLS, // bug?
-                    Settings.System.WINDOW_ORIENTATION_LISTENER_LOG // used for debugging only
+                    Settings.System.WINDOW_ORIENTATION_LISTENER_LOG, // used for debugging only
+                    Settings.System.PEAK_REFRESH_RATE // depends on hardware capabilities
                     );
 
     private static final Set<String> BACKUP_BLACKLISTED_GLOBAL_SETTINGS =
@@ -116,7 +117,6 @@
                     Settings.Global.ANOMALY_CONFIG_VERSION,
                     Settings.Global.APN_DB_UPDATE_CONTENT_URL,
                     Settings.Global.APN_DB_UPDATE_METADATA_URL,
-                    Settings.Global.APPLY_RAMPING_RINGER,
                     Settings.Global.APP_BINDING_CONSTANTS,
                     Settings.Global.APP_IDLE_CONSTANTS,
                     Settings.Global.APP_OPS_CONSTANTS,
@@ -131,6 +131,7 @@
                     Settings.Global.AUTOFILL_MAX_VISIBLE_DATASETS,
                     Settings.Global.AUTOMATIC_POWER_SAVER_MODE,
                     Settings.Global.BACKGROUND_ACTIVITY_STARTS_ENABLED,
+                    Settings.Global.BACKGROUND_ACTIVITY_STARTS_PACKAGE_NAMES_WHITELIST,
                     Settings.Global.BATTERY_CHARGING_STATE_UPDATE_DELAY,
                     Settings.Global.BROADCAST_BG_CONSTANTS,
                     Settings.Global.BROADCAST_FG_CONSTANTS,
@@ -287,6 +288,7 @@
                     Settings.Global.HDMI_SYSTEM_AUDIO_CONTROL_ENABLED,
                     Settings.Global.HEADS_UP_NOTIFICATIONS_ENABLED,
                     Settings.Global.HIDDEN_API_ACCESS_LOG_SAMPLING_RATE,
+                    Settings.Global.HIDDEN_API_ACCESS_STATSLOG_SAMPLING_RATE,
                     Settings.Global.HIDDEN_API_POLICY,
                     Settings.Global.HIDE_ERROR_DIALOGS,
                     Settings.Global.HTTP_PROXY,
@@ -465,6 +467,7 @@
                     Settings.Global.TETHER_SUPPORTED,
                     Settings.Global.TETHER_ENABLE_LEGACY_DHCP_SERVER,
                     Settings.Global.TEXT_CLASSIFIER_CONSTANTS,
+                    Settings.Global.TEXT_CLASSIFIER_ACTION_MODEL_PARAMS,
                     Settings.Global.THEATER_MODE_ON,
                     Settings.Global.TIME_ONLY_MODE_CONSTANTS,
                     Settings.Global.TRANSITION_ANIMATION_SCALE,
@@ -640,6 +643,7 @@
                  Settings.Secure.LAST_SETUP_SHOWN,
                  Settings.Secure.LOCATION_CHANGER,
                  Settings.Secure.LOCATION_MODE,
+                 Settings.Secure.LOCATION_PERMISSIONS_UPGRADE_TO_Q_MODE,
                  Settings.Secure.LOCK_SCREEN_ALLOW_REMOTE_INPUT, // Candidate?
                  Settings.Secure.LOCK_SCREEN_LOCK_AFTER_TIMEOUT,
                  Settings.Secure.LOCK_TO_APP_EXIT_LOCKED,
diff --git a/core/tests/coretests/src/android/service/notification/StatusBarNotificationTest.java b/core/tests/coretests/src/android/service/notification/StatusBarNotificationTest.java
index c99777b..0f32a82 100644
--- a/core/tests/coretests/src/android/service/notification/StatusBarNotificationTest.java
+++ b/core/tests/coretests/src/android/service/notification/StatusBarNotificationTest.java
@@ -89,6 +89,17 @@
         assertNull(logMaker.getTaggedData(MetricsEvent.FIELD_NOTIFICATION_CATEGORY));
     }
 
+    /** Verify that modifying the returned logMaker won't leave stale data behind for
+     * the next caller.*/
+    @Test
+    public void testLogMakerNoStaleData() {
+        StatusBarNotification sbn = getNotification(PKG, GROUP_ID_1, CHANNEL_ID);
+        final LogMaker logMaker = sbn.getLogMaker();
+        int extraTag = MetricsEvent.FIELD_NOTIFICATION_CHANNEL_GROUP_ID;  // An arbitrary new tag
+        logMaker.addTaggedData(extraTag, 1);
+        assertNull(sbn.getLogMaker().getTaggedData(extraTag));
+    }
+
     @Test
     public void testLogMakerWithCategory() {
         Notification.Builder builder = getNotificationBuilder(GROUP_ID_1, CHANNEL_ID)
diff --git a/core/tests/coretests/src/android/view/accessibility/AccessibilityCacheTest.java b/core/tests/coretests/src/android/view/accessibility/AccessibilityCacheTest.java
index e3852e1..1cb71f9 100644
--- a/core/tests/coretests/src/android/view/accessibility/AccessibilityCacheTest.java
+++ b/core/tests/coretests/src/android/view/accessibility/AccessibilityCacheTest.java
@@ -20,6 +20,7 @@
 import static junit.framework.Assert.assertNotNull;
 import static junit.framework.Assert.assertNull;
 
+import static org.junit.Assert.fail;
 import static org.mockito.Matchers.anyBoolean;
 import static org.mockito.Matchers.anyObject;
 import static org.mockito.Mockito.doAnswer;
@@ -33,6 +34,8 @@
 import androidx.test.filters.LargeTest;
 import androidx.test.runner.AndroidJUnit4;
 
+import com.google.common.base.Throwables;
+
 import org.junit.After;
 import org.junit.Before;
 import org.junit.Test;
@@ -301,6 +304,26 @@
     }
 
     @Test
+    public void subTreeChangeEventFromUncachedNode_clearsNodeInCache() {
+        AccessibilityNodeInfo nodeInfo = getNodeWithA11yAndWindowId(CHILD_VIEW_ID, WINDOW_ID_1);
+        long id = nodeInfo.getSourceNodeId();
+        mAccessibilityCache.add(nodeInfo);
+        nodeInfo.recycle();
+
+        AccessibilityEvent event = AccessibilityEvent
+                .obtain(AccessibilityEvent.TYPE_WINDOW_CONTENT_CHANGED);
+        event.setContentChangeTypes(AccessibilityEvent.CONTENT_CHANGE_TYPE_SUBTREE);
+        event.setSource(getMockViewWithA11yAndWindowIds(PARENT_VIEW_ID, WINDOW_ID_1));
+
+        mAccessibilityCache.onAccessibilityEvent(event);
+        AccessibilityNodeInfo shouldBeNull = mAccessibilityCache.getNode(WINDOW_ID_1, id);
+        if (shouldBeNull != null) {
+            shouldBeNull.recycle();
+        }
+        assertNull(shouldBeNull);
+    }
+
+    @Test
     public void scrollEvent_clearsNodeAndChild() {
         AccessibilityEvent event = AccessibilityEvent
                 .obtain(AccessibilityEvent.TYPE_VIEW_SCROLLED);
@@ -568,6 +591,29 @@
         }
     }
 
+    @Test
+    public void addSameParentNodeWithDifferentChildNode_whenOriginalChildHasChild_doesntCrash() {
+        AccessibilityNodeInfo parentNodeInfo = getParentNode();
+        AccessibilityNodeInfo childNodeInfo = getChildNode();
+        childNodeInfo.addChild(getMockViewWithA11yAndWindowIds(CHILD_VIEW_ID + 1, WINDOW_ID_1));
+
+        AccessibilityNodeInfo replacementParentNodeInfo =
+                getNodeWithA11yAndWindowId(PARENT_VIEW_ID, WINDOW_ID_1);
+        replacementParentNodeInfo.addChild(
+                getMockViewWithA11yAndWindowIds(OTHER_CHILD_VIEW_ID, WINDOW_ID_1));
+        try {
+            mAccessibilityCache.add(parentNodeInfo);
+            mAccessibilityCache.add(childNodeInfo);
+            mAccessibilityCache.add(replacementParentNodeInfo);
+        } catch (IllegalStateException e) {
+            fail("recycle A11yNodeInfo twice" + Throwables.getStackTraceAsString(e));
+        } finally {
+            parentNodeInfo.recycle();
+            childNodeInfo.recycle();
+            replacementParentNodeInfo.recycle();
+        }
+    }
+
     private void assertNodeIsRefreshedWithEventType(int eventType, int contentChangeTypes) {
         AccessibilityNodeInfo nodeInfo = getNodeWithA11yAndWindowId(SINGLE_VIEW_ID, WINDOW_ID_1);
         mAccessibilityCache.add(nodeInfo);
diff --git a/core/tests/coretests/src/android/view/contentcapture/ContentCaptureEventTest.java b/core/tests/coretests/src/android/view/contentcapture/ContentCaptureEventTest.java
index a5ac270..de2edc3 100644
--- a/core/tests/coretests/src/android/view/contentcapture/ContentCaptureEventTest.java
+++ b/core/tests/coretests/src/android/view/contentcapture/ContentCaptureEventTest.java
@@ -25,7 +25,6 @@
 import static org.testng.Assert.assertThrows;
 
 import android.content.LocusId;
-import android.net.Uri;
 import android.os.Parcel;
 import android.os.SystemClock;
 import android.view.autofill.AutofillId;
@@ -47,7 +46,7 @@
 
     private static final long MY_EPOCH = SystemClock.uptimeMillis();
 
-    private static final LocusId ID = new LocusId(Uri.parse("WHATEVER"));
+    private static final LocusId ID = new LocusId("WHATEVER");
 
     // Not using @Mock because it's final - no need to be fancy here....
     private final ContentCaptureContext mClientContext =
diff --git a/core/tests/coretests/src/android/view/textclassifier/ConfigParserTest.java b/core/tests/coretests/src/android/view/textclassifier/ConfigParserTest.java
new file mode 100644
index 0000000..1b3c724
--- /dev/null
+++ b/core/tests/coretests/src/android/view/textclassifier/ConfigParserTest.java
@@ -0,0 +1,136 @@
+/*
+ * Copyright (C) 2019 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package android.view.textclassifier;
+
+import static com.google.common.truth.Truth.assertThat;
+
+import android.provider.DeviceConfig;
+import android.support.test.uiautomator.UiDevice;
+
+import androidx.test.InstrumentationRegistry;
+import androidx.test.filters.SmallTest;
+import androidx.test.runner.AndroidJUnit4;
+
+import org.junit.After;
+import org.junit.Before;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+
+import java.io.IOException;
+
+@SmallTest
+@RunWith(AndroidJUnit4.class)
+public class ConfigParserTest {
+    private static final String SETTINGS = "int=42,float=12.3,boolean=true,string=abc";
+    private static final String CLEAR_DEVICE_CONFIG_KEY_CMD =
+            "device_config delete " + DeviceConfig.NAMESPACE_TEXTCLASSIFIER;
+    private static final String[] DEVICE_CONFIG_KEYS = new String[]{
+            "boolean",
+            "string",
+            "int",
+            "float"
+    };
+
+    private ConfigParser mConfigParser;
+
+    @Before
+    public void setup() throws IOException {
+        mConfigParser = new ConfigParser(SETTINGS);
+        clearDeviceConfig();
+    }
+
+    @After
+    public void tearDown() throws IOException {
+        clearDeviceConfig();
+    }
+
+    @Test
+    public void getBoolean_deviceConfig() {
+        DeviceConfig.setProperty(
+                DeviceConfig.NAMESPACE_TEXTCLASSIFIER,
+                "boolean",
+                "false",
+                false);
+        boolean value = mConfigParser.getBoolean("boolean", true);
+        assertThat(value).isFalse();
+    }
+
+    @Test
+    public void getBoolean_settings() {
+        boolean value = mConfigParser.getBoolean(
+                "boolean",
+                false);
+        assertThat(value).isTrue();
+    }
+
+    @Test
+    public void getInt_deviceConfig() {
+        DeviceConfig.setProperty(
+                DeviceConfig.NAMESPACE_TEXTCLASSIFIER,
+                "int",
+                "1",
+                false);
+        int value = mConfigParser.getInt("int", 0);
+        assertThat(value).isEqualTo(1);
+    }
+
+    @Test
+    public void getInt_settings() {
+        int value = mConfigParser.getInt("int", 0);
+        assertThat(value).isEqualTo(42);
+    }
+
+    @Test
+    public void getFloat_deviceConfig() {
+        DeviceConfig.setProperty(
+                DeviceConfig.NAMESPACE_TEXTCLASSIFIER,
+                "float",
+                "3.14",
+                false);
+        float value = mConfigParser.getFloat("float", 0);
+        assertThat(value).isWithin(0.0001f).of(3.14f);
+    }
+
+    @Test
+    public void getFloat_settings() {
+        float value = mConfigParser.getFloat("float", 0);
+        assertThat(value).isWithin(0.0001f).of(12.3f);
+    }
+
+    @Test
+    public void getString_deviceConfig() {
+        DeviceConfig.setProperty(
+                DeviceConfig.NAMESPACE_TEXTCLASSIFIER,
+                "string",
+                "hello",
+                false);
+        String value = mConfigParser.getString("string", "");
+        assertThat(value).isEqualTo("hello");
+    }
+
+    @Test
+    public void getString_settings() {
+        String value = mConfigParser.getString("string", "");
+        assertThat(value).isEqualTo("abc");
+    }
+
+    private static void clearDeviceConfig() throws IOException {
+        UiDevice uiDevice = UiDevice.getInstance(InstrumentationRegistry.getInstrumentation());
+        for (String key : DEVICE_CONFIG_KEYS) {
+            uiDevice.executeShellCommand(CLEAR_DEVICE_CONFIG_KEY_CMD + " " + key);
+        }
+    }
+}
diff --git a/core/tests/coretests/src/com/android/internal/app/ChooserActivityTest.java b/core/tests/coretests/src/com/android/internal/app/ChooserActivityTest.java
index 9fbc166..3578bc0 100644
--- a/core/tests/coretests/src/com/android/internal/app/ChooserActivityTest.java
+++ b/core/tests/coretests/src/com/android/internal/app/ChooserActivityTest.java
@@ -740,6 +740,7 @@
         Intent sendIntent = new Intent();
         sendIntent.setAction(Intent.ACTION_SEND);
         sendIntent.putExtra(Intent.EXTRA_TEXT, "testing intent sending");
+        sendIntent.setType("text/plain");
         return sendIntent;
     }
 
diff --git a/core/tests/coretests/src/com/android/internal/infra/WhitelistHelperTest.java b/core/tests/coretests/src/com/android/internal/infra/WhitelistHelperTest.java
new file mode 100644
index 0000000..ab6830b
--- /dev/null
+++ b/core/tests/coretests/src/com/android/internal/infra/WhitelistHelperTest.java
@@ -0,0 +1,138 @@
+/*
+ * Copyright (C) 2019 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 com.android.internal.infra;
+
+import static com.google.common.truth.Truth.assertThat;
+
+import static org.testng.Assert.assertThrows;
+
+import android.content.ComponentName;
+import android.util.ArraySet;
+
+import org.junit.Test;
+import org.junit.runner.RunWith;
+import org.mockito.junit.MockitoJUnitRunner;
+
+/**
+ * Unit test for {@link WhitelistHelper}.
+ *
+ * <p>To run it:
+ * {@code atest FrameworksCoreTests:com.android.internal.infra.WhitelistHelperTest}
+ */
+
+@RunWith(MockitoJUnitRunner.class)
+public class WhitelistHelperTest {
+    private WhitelistHelper mWhitelistHelper = new WhitelistHelper();
+
+    private String mPackage1 = "com.example";
+    private String mPackage2 = "com.example2";
+
+    private ComponentName mComponent1 = new ComponentName(mPackage1, "class1");
+    private ComponentName mComponent2 = new ComponentName(mPackage1, "class2");
+    private ComponentName mComponentDifferentPkg = new ComponentName(mPackage2, "class3");
+
+    @Test
+    public void testSetWhitelist_emptyArguments() {
+        assertThrows(IllegalArgumentException.class,
+                () -> mWhitelistHelper.setWhitelist(new ArraySet<>(), null));
+        assertThrows(IllegalArgumentException.class,
+                () -> mWhitelistHelper.setWhitelist(null, new ArraySet<>()));
+        assertThrows(IllegalArgumentException.class,
+                () -> mWhitelistHelper.setWhitelist(new ArraySet<>(), new ArraySet<>()));
+    }
+
+    @Test
+    public void testWhitelistHelper_nullArguments() {
+        assertThrows(NullPointerException.class,
+                () -> mWhitelistHelper.isWhitelisted((String) null));
+        assertThrows(NullPointerException.class,
+                () -> mWhitelistHelper.isWhitelisted((ComponentName) null));
+        assertThrows(NullPointerException.class,
+                () -> mWhitelistHelper.getWhitelistedComponents(null));
+    }
+
+    @Test
+    public void testSetWhitelist_nullPackage() {
+        final ArraySet<String> packages = new ArraySet<>();
+        packages.add(null);
+        mWhitelistHelper.setWhitelist(packages, null);
+
+        assertThat(mWhitelistHelper.isWhitelisted(mPackage1)).isFalse();
+        assertThat(mWhitelistHelper.isWhitelisted(mPackage2)).isFalse();
+
+        assertThat(mWhitelistHelper.isWhitelisted(mComponent1)).isFalse();
+        assertThat(mWhitelistHelper.isWhitelisted(mComponent2)).isFalse();
+        assertThat(mWhitelistHelper.isWhitelisted(mComponentDifferentPkg)).isFalse();
+    }
+
+    @Test
+    public void testSetWhitelist_nullActivity() {
+        final ArraySet<ComponentName> components = new ArraySet<>();
+        components.add(null);
+        mWhitelistHelper.setWhitelist(null, components);
+
+        assertThat(mWhitelistHelper.isWhitelisted(mPackage1)).isFalse();
+        assertThat(mWhitelistHelper.isWhitelisted(mPackage2)).isFalse();
+
+        assertThat(mWhitelistHelper.isWhitelisted(mComponent1)).isFalse();
+        assertThat(mWhitelistHelper.isWhitelisted(mComponent2)).isFalse();
+        assertThat(mWhitelistHelper.isWhitelisted(mComponentDifferentPkg)).isFalse();
+    }
+
+    @Test
+    public void testSetWhitelist_replaceWhitelist() {
+        final ArraySet<ComponentName> components = new ArraySet<>();
+        components.add(mComponent1);
+        mWhitelistHelper.setWhitelist(null, components);
+        assertThat(mWhitelistHelper.isWhitelisted(mComponent1)).isTrue();
+        assertThat(mWhitelistHelper.isWhitelisted(mComponent2)).isFalse();
+
+        final ArraySet<ComponentName> components2 = new ArraySet<>();
+        components2.add(mComponent2);
+        mWhitelistHelper.setWhitelist(null, components2);
+        assertThat(mWhitelistHelper.isWhitelisted(mComponent1)).isFalse();
+        assertThat(mWhitelistHelper.isWhitelisted(mComponent2)).isTrue();
+    }
+
+    @Test
+    public void testIsWhitelisted_packageWhitelisted() {
+        final ArraySet<String> packages = new ArraySet<>();
+        packages.add(mPackage1);
+        mWhitelistHelper.setWhitelist(packages, null);
+
+        assertThat(mWhitelistHelper.isWhitelisted(mPackage1)).isTrue();
+        assertThat(mWhitelistHelper.isWhitelisted(mPackage2)).isFalse();
+
+        assertThat(mWhitelistHelper.isWhitelisted(mComponent1)).isTrue();
+        assertThat(mWhitelistHelper.isWhitelisted(mComponent2)).isTrue();
+        assertThat(mWhitelistHelper.isWhitelisted(mComponentDifferentPkg)).isFalse();
+    }
+
+    @Test
+    public void testIsWhitelisted_activityWhitelisted() {
+        final ArraySet<ComponentName> components = new ArraySet<>();
+        components.add(mComponent1);
+        mWhitelistHelper.setWhitelist(null, components);
+
+        assertThat(mWhitelistHelper.isWhitelisted(mPackage1)).isFalse();
+        assertThat(mWhitelistHelper.isWhitelisted(mPackage2)).isFalse();
+
+        assertThat(mWhitelistHelper.isWhitelisted(mComponent1)).isTrue();
+        assertThat(mWhitelistHelper.isWhitelisted(mComponent2)).isFalse();
+        assertThat(mWhitelistHelper.isWhitelisted(mComponentDifferentPkg)).isFalse();
+    }
+}
diff --git a/core/tests/coretests/src/com/android/internal/os/BinderCallsStatsTest.java b/core/tests/coretests/src/com/android/internal/os/BinderCallsStatsTest.java
index e375af3..eb9c7b6 100644
--- a/core/tests/coretests/src/com/android/internal/os/BinderCallsStatsTest.java
+++ b/core/tests/coretests/src/com/android/internal/os/BinderCallsStatsTest.java
@@ -642,8 +642,9 @@
         long startTime = SystemClock.elapsedRealtime();
         TestBinderCallsStats bcs = new TestBinderCallsStats();
         bcs.setAddDebugEntries(true);
+        bcs.setSamplingInterval(10);
         ArrayList<BinderCallsStats.ExportedCallStat> callStats = bcs.getExportedCallStats();
-        assertEquals(3, callStats.size());
+        assertEquals(4, callStats.size());
         BinderCallsStats.ExportedCallStat debugEntry1 = callStats.get(0);
         assertEquals("", debugEntry1.className);
         assertEquals("__DEBUG_start_time_millis", debugEntry1.methodName);
@@ -656,6 +657,9 @@
         assertEquals("", debugEntry3.className);
         assertEquals("__DEBUG_battery_time_millis", debugEntry3.methodName);
         assertTrue(debugEntry3.latencyMicros >= 0);
+        BinderCallsStats.ExportedCallStat debugEntry4 = callStats.get(3);
+        assertEquals("__DEBUG_sampling_interval", debugEntry4.methodName);
+        assertEquals(10, debugEntry4.latencyMicros);
     }
 
     @Test
@@ -718,6 +722,36 @@
         assertEquals(2, callStats.recordedCallCount);
     }
 
+    @Test
+    public void testTrackScreenInteractiveDisabled_sampling() {
+        TestBinderCallsStats bcs = new TestBinderCallsStats();
+        bcs.setSamplingInterval(2);
+        bcs.setTrackScreenInteractive(false);
+        Binder binder = new Binder();
+
+        mDeviceState.setScreenInteractive(false);
+        CallSession callSession = bcs.callStarted(binder, 1, WORKSOURCE_UID);
+        bcs.time += 10;
+        bcs.callEnded(callSession, REQUEST_SIZE, REPLY_SIZE, WORKSOURCE_UID);
+
+        mDeviceState.setScreenInteractive(true);
+        callSession = bcs.callStarted(binder, 1, WORKSOURCE_UID);
+        bcs.time += 1000;  // shoud be ignored.
+        bcs.callEnded(callSession, REQUEST_SIZE, REPLY_SIZE, WORKSOURCE_UID);
+
+        SparseArray<BinderCallsStats.UidEntry> uidEntries = bcs.getUidEntries();
+        assertEquals(1, uidEntries.size());
+        BinderCallsStats.UidEntry uidEntry = uidEntries.get(WORKSOURCE_UID);
+        Assert.assertNotNull(uidEntry);
+        assertEquals(2, uidEntry.callCount);
+
+        List<BinderCallsStats.CallStat> callStatsList = new ArrayList(uidEntry.getCallStatsList());
+        assertEquals(1, callStatsList.size());
+        BinderCallsStats.CallStat callStats = callStatsList.get(0);
+        assertEquals(false, callStats.screenInteractive);
+        assertEquals(2, callStats.callCount);
+        assertEquals(1, callStats.recordedCallCount);
+    }
 
     class TestBinderCallsStats extends BinderCallsStats {
         public int callingUid = CALLING_UID;
diff --git a/core/tests/coretests/src/com/android/internal/os/KernelCpuThreadReaderTest.java b/core/tests/coretests/src/com/android/internal/os/KernelCpuThreadReaderTest.java
index 442ece5..e6e7a85 100644
--- a/core/tests/coretests/src/com/android/internal/os/KernelCpuThreadReaderTest.java
+++ b/core/tests/coretests/src/com/android/internal/os/KernelCpuThreadReaderTest.java
@@ -218,6 +218,51 @@
 
     }
 
+    @Test
+    public void testReader_otherThreads() throws IOException {
+        final Path processPath = mProcDirectory.toPath().resolve("self");
+        setupDirectory(
+                processPath,
+                new int[]{1, 2, 3},
+                "process",
+                new String[]{"thread1", "thread2", "thread3"},
+                new int[]{1000, 2000},
+                new int[][]{{0, 100}, {10, 0}, {0, 300}});
+        final KernelCpuThreadReader kernelCpuThreadReader = new KernelCpuThreadReader(
+                8,
+                i -> true,
+                2000,
+                mProcDirectory.toPath(),
+                processPath.resolve("task/1/time_in_state"),
+                new KernelCpuThreadReader.Injector() {
+                    @Override
+                    public int myPid() {
+                        return 1000;
+                    }
+
+                    @Override
+                    public int myUid() {
+                        return 0;
+                    }
+
+                    @Override
+                    public int getUidForPid(int pid) {
+                        return 0;
+                    }
+                });
+        checkResults(
+                kernelCpuThreadReader.getCurrentProcessCpuUsage(),
+                kernelCpuThreadReader.getCpuFrequenciesKhz(),
+                0,
+                1000,
+                new int[]{-1, 3},
+                "process",
+                new String[]{"__OTHER_THREADS", "thread3"},
+                new int[]{1000, 2000},
+                new int[][]{{100, 1000}, {0, 3000}}
+        );
+    }
+
     private void setupDirectory(Path processPath, int[] threadIds, String processName,
             String[] threadNames, int[] cpuFrequencies, int[][] cpuTimes) throws IOException {
         // Make /proc/$PID
@@ -259,6 +304,7 @@
         assertEquals(processId, processCpuUsage.processId);
         assertEquals(uid, processCpuUsage.uid);
         assertEquals(processName, processCpuUsage.processName);
+        assertEquals(threadIds.length, processCpuUsage.threadCpuUsages.size());
 
         // Sort the thread CPU usages to compare with test case
         final ArrayList<KernelCpuThreadReader.ThreadCpuUsage> threadCpuUsages =
@@ -472,6 +518,17 @@
     }
 
     @Test
+    public void testUidPredicate_zero() {
+        KernelCpuThreadReaderSettingsObserver.UidPredicate uidPredicate =
+                KernelCpuThreadReaderSettingsObserver.UidPredicate.fromString("0-0");
+        assertTrue(uidPredicate.test(0));
+        assertFalse(uidPredicate.test(1));
+        assertFalse(uidPredicate.test(2000));
+        assertFalse(uidPredicate.test(10000));
+        assertFalse(uidPredicate.test(-100));
+    }
+
+    @Test
     public void testUidPredicate_emptyRangeString() {
         assertThrows(
                 NumberFormatException.class,
diff --git a/core/tests/coretests/src/com/android/internal/os/LooperStatsTest.java b/core/tests/coretests/src/com/android/internal/os/LooperStatsTest.java
index 3edf5f8..7917a06 100644
--- a/core/tests/coretests/src/com/android/internal/os/LooperStatsTest.java
+++ b/core/tests/coretests/src/com/android/internal/os/LooperStatsTest.java
@@ -452,6 +452,7 @@
     public void testAddsDebugEntries() {
         TestableLooperStats looperStats = new TestableLooperStats(1, 100);
         looperStats.setAddDebugEntries(true);
+        looperStats.setSamplingInterval(10);
 
         Message message = mHandlerFirst.obtainMessage(1000);
         message.when = looperStats.getSystemUptimeMillis();
@@ -459,7 +460,7 @@
         looperStats.messageDispatched(token, message);
 
         List<LooperStats.ExportedEntry> entries = looperStats.getEntries();
-        assertThat(entries).hasSize(4);
+        assertThat(entries).hasSize(5);
         LooperStats.ExportedEntry debugEntry1 = entries.get(1);
         assertThat(debugEntry1.handlerClassName).isEqualTo("");
         assertThat(debugEntry1.messageName).isEqualTo("__DEBUG_start_time_millis");
@@ -474,6 +475,9 @@
         assertThat(debugEntry3.handlerClassName).isEqualTo("");
         assertThat(debugEntry3.messageName).isEqualTo("__DEBUG_battery_time_millis");
         assertThat(debugEntry3.totalLatencyMicros).isAtLeast(0L);
+        LooperStats.ExportedEntry debugEntry4 = entries.get(4);
+        assertThat(debugEntry4.messageName).isEqualTo("__DEBUG_sampling_interval");
+        assertThat(debugEntry4.totalLatencyMicros).isEqualTo(10L);
     }
 
     @Test
diff --git a/core/xsd/Android.bp b/core/xsd/Android.bp
new file mode 100644
index 0000000..81669eb
--- /dev/null
+++ b/core/xsd/Android.bp
@@ -0,0 +1,6 @@
+xsd_config {
+    name: "permission",
+    srcs: ["permission.xsd"],
+    api_dir: "schema",
+    package_name: "com.android.xml.permission",
+}
diff --git a/core/xsd/permission.xsd b/core/xsd/permission.xsd
new file mode 100644
index 0000000..d90863b
--- /dev/null
+++ b/core/xsd/permission.xsd
@@ -0,0 +1,166 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!-- Copyright (C) 2019 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.
+-->
+<!-- TODO: define a targetNamespace. Note that it will break retrocompatibility -->
+<xs:schema version="2.0"
+           elementFormDefault="qualified"
+           attributeFormDefault="unqualified"
+           xmlns:xs="http://www.w3.org/2001/XMLSchema">
+    <xs:element name="permissions">
+        <xs:complexType>
+            <xs:sequence>
+                <xs:element name="group" type="group" maxOccurs="unbounded"/>
+                <xs:element name="permission" type="permission" maxOccurs="unbounded"/>
+                <xs:element name="assign-permission" type="assign-permission" maxOccurs="unbounded"/>
+                <xs:element name="split-permission" type="split-permission" maxOccurs="unbounded"/>
+                <xs:element name="library" type="library" maxOccurs="unbounded"/>
+                <xs:element name="feature" type="feature" maxOccurs="unbounded"/>
+                <xs:element name="unavailable-feature" type="unavailable-feature" maxOccurs="unbounded"/>
+                <xs:element name="allow-in-power-save-except-idle" type="allow-in-power-save-except-idle" maxOccurs="unbounded"/>
+                <xs:element name="allow-in-power-save" type="allow-in-power-save" maxOccurs="unbounded"/>
+                <xs:element name="allow-in-data-usage-save" type="allow-in-data-usage-save" maxOccurs="unbounded"/>
+                <xs:element name="allow-unthrottled-location" type="allow-unthrottled-location" maxOccurs="unbounded"/>
+                <xs:element name="allow-ignore-location-settings" type="allow-ignore-location-settings" maxOccurs="unbounded"/>
+                <xs:element name="allow-implicit-broadcast" type="allow-implicit-broadcast" maxOccurs="unbounded"/>
+                <xs:element name="app-link" type="app-link" maxOccurs="unbounded"/>
+                <xs:element name="system-user-whitelisted-app" type="system-user-whitelisted-app" maxOccurs="unbounded"/>
+                <xs:element name="system-user-blacklisted-app" type="system-user-blacklisted-app" maxOccurs="unbounded"/>
+                <xs:element name="default-enabled-vr-app" type="default-enabled-vr-app" maxOccurs="unbounded"/>
+                <xs:element name="backup-transport-whitelisted-service" type="backup-transport-whitelisted-service" maxOccurs="unbounded"/>
+                <xs:element name="disabled-until-used-preinstalled-carrier-associated-app" type="disabled-until-used-preinstalled-carrier-associated-app" maxOccurs="unbounded"/>
+                <xs:element name="disabled-until-used-preinstalled-carrier-app" type="disabled-until-used-preinstalled-carrier-app" maxOccurs="unbounded"/>
+                <xs:element name="privapp-permissions" type="privapp-permissions" maxOccurs="unbounded"/>
+                <xs:element name="oem-permissions" type="oem-permissions" maxOccurs="unbounded"/>
+                <xs:element name="hidden-api-whitelisted-app" type="hidden-api-whitelisted-app" maxOccurs="unbounded"/>
+                <xs:element name="allow-association" type="allow-association" maxOccurs="unbounded"/>
+                <xs:element name="bugreport-whitelisted" type="bugreport-whitelisted" maxOccurs="unbounded"/>
+            </xs:sequence>
+        </xs:complexType>
+    </xs:element>
+    <xs:complexType name="group">
+        <xs:attribute name="gid" type="xs:int"/>
+    </xs:complexType>
+    <xs:complexType name="permission">
+        <xs:attribute name="name" type="xs:string"/>
+    </xs:complexType>
+    <xs:complexType name="assign-permission">
+        <xs:attribute name="name" type="xs:string"/>
+        <xs:attribute name="uid" type="xs:int"/>
+    </xs:complexType>
+    <xs:complexType name="split-permission">
+        <xs:attribute name="name" type="xs:string"/>
+        <xs:attribute name="targetSdk" type="xs:int"/>
+        <xs:sequence>
+            <xs:element name="library" maxOccurs="unbounded">
+                <xs:complexType>
+                    <xs:attribute name="name" type="xs:string"/>
+                </xs:complexType>
+            </xs:element>
+        </xs:sequence>
+    </xs:complexType>
+    <xs:complexType name="library">
+        <xs:attribute name="name" type="xs:string"/>
+        <xs:attribute name="file" type="xs:string"/>
+        <xs:attribute name="dependency" type="xs:string"/>
+    </xs:complexType>
+    <xs:complexType name="feature">
+        <xs:attribute name="name" type="xs:string"/>
+        <xs:attribute name="notLowRam" type="xs:string"/>
+    </xs:complexType>
+    <xs:complexType name="unavailable-feature">
+        <xs:attribute name="name" type="xs:string"/>
+    </xs:complexType>
+    <xs:complexType name="allow-in-power-save-except-idle">
+        <xs:attribute name="package" type="xs:string"/>
+    </xs:complexType>
+    <xs:complexType name="allow-in-power-save">
+        <xs:attribute name="package" type="xs:string"/>
+    </xs:complexType>
+    <xs:complexType name="allow-in-data-usage-save">
+        <xs:attribute name="package" type="xs:string"/>
+    </xs:complexType>
+    <xs:complexType name="allow-unthrottled-location">
+        <xs:attribute name="package" type="xs:string"/>
+    </xs:complexType>
+    <xs:complexType name="allow-ignore-location-settings">
+        <xs:attribute name="package" type="xs:string"/>
+    </xs:complexType>
+    <xs:complexType name="allow-implicit-broadcast">
+        <xs:attribute name="action" type="xs:string"/>
+    </xs:complexType>
+    <xs:complexType name="app-link">
+        <xs:attribute name="package" type="xs:string"/>
+    </xs:complexType>
+    <xs:complexType name="system-user-whitelisted-app">
+        <xs:attribute name="package" type="xs:string"/>
+    </xs:complexType>
+    <xs:complexType name="system-user-blacklisted-app">
+        <xs:attribute name="package" type="xs:string"/>
+    </xs:complexType>
+    <xs:complexType name="default-enabled-vr-app">
+        <xs:attribute name="package" type="xs:string"/>
+        <xs:attribute name="class" type="xs:string"/>
+    </xs:complexType>
+    <xs:complexType name="backup-transport-whitelisted-service">
+        <xs:attribute name="service" type="xs:string"/>
+    </xs:complexType>
+    <xs:complexType name="disabled-until-used-preinstalled-carrier-associated-app">
+        <xs:attribute name="package" type="xs:string"/>
+        <xs:attribute name="carrierAppPackage" type="xs:string"/>
+    </xs:complexType>
+    <xs:complexType name="disabled-until-used-preinstalled-carrier-app">
+        <xs:attribute name="package" type="xs:string"/>
+    </xs:complexType>
+    <xs:complexType name="privapp-permissions">
+        <xs:attribute name="package" type="xs:string"/>
+        <xs:sequence>
+            <xs:element name="permission" maxOccurs="unbounded">
+                <xs:complexType>
+                    <xs:attribute name="name" type="xs:string"/>
+                </xs:complexType>
+            </xs:element>
+            <xs:element name="deny-permission" maxOccurs="unbounded">
+                <xs:complexType>
+                    <xs:attribute name="name" type="xs:string"/>
+                </xs:complexType>
+            </xs:element>
+        </xs:sequence>
+    </xs:complexType>
+    <xs:complexType name="oem-permissions">
+        <xs:attribute name="package" type="xs:string"/>
+        <xs:sequence>
+            <xs:element name="permission" maxOccurs="unbounded">
+                <xs:complexType>
+                    <xs:attribute name="name" type="xs:string"/>
+                </xs:complexType>
+            </xs:element>
+            <xs:element name="deny-permission" maxOccurs="unbounded">
+                <xs:complexType>
+                    <xs:attribute name="name" type="xs:string"/>
+                </xs:complexType>
+            </xs:element>
+        </xs:sequence>
+    </xs:complexType>
+    <xs:complexType name="hidden-api-whitelisted-app">
+        <xs:attribute name="package" type="xs:string"/>
+    </xs:complexType>
+    <xs:complexType name="allow-association">
+        <xs:attribute name="target" type="xs:string"/>
+        <xs:attribute name="allowed" type="xs:string"/>
+    </xs:complexType>
+    <xs:complexType name="bugreport-whitelisted">
+        <xs:attribute name="package" type="xs:string"/>
+    </xs:complexType>
+</xs:schema>
diff --git a/core/xsd/schema/README.md b/core/xsd/schema/README.md
new file mode 100644
index 0000000..f52d93d
--- /dev/null
+++ b/core/xsd/schema/README.md
@@ -0,0 +1 @@
+Please see the [README](https://android.googlesource.com/platform/system/tools/xsdc/+/refs/heads/master/README.md) for details regarding the Configfile as API.
diff --git a/core/xsd/schema/current.txt b/core/xsd/schema/current.txt
new file mode 100644
index 0000000..82bb0fea
--- /dev/null
+++ b/core/xsd/schema/current.txt
@@ -0,0 +1,242 @@
+// Signature format: 2.0
+package com.android.xml.permission {
+
+  public class AllowAssociation {
+    ctor public AllowAssociation();
+    method public String getAllowed();
+    method public String getTarget();
+    method public void setAllowed(String);
+    method public void setTarget(String);
+  }
+
+  public class AllowIgnoreLocationSettings {
+    ctor public AllowIgnoreLocationSettings();
+    method public String get_package();
+    method public void set_package(String);
+  }
+
+  public class AllowImplicitBroadcast {
+    ctor public AllowImplicitBroadcast();
+    method public String getAction();
+    method public void setAction(String);
+  }
+
+  public class AllowInDataUsageSave {
+    ctor public AllowInDataUsageSave();
+    method public String get_package();
+    method public void set_package(String);
+  }
+
+  public class AllowInPowerSave {
+    ctor public AllowInPowerSave();
+    method public String get_package();
+    method public void set_package(String);
+  }
+
+  public class AllowInPowerSaveExceptIdle {
+    ctor public AllowInPowerSaveExceptIdle();
+    method public String get_package();
+    method public void set_package(String);
+  }
+
+  public class AllowUnthrottledLocation {
+    ctor public AllowUnthrottledLocation();
+    method public String get_package();
+    method public void set_package(String);
+  }
+
+  public class AppLink {
+    ctor public AppLink();
+    method public String get_package();
+    method public void set_package(String);
+  }
+
+  public class AssignPermission {
+    ctor public AssignPermission();
+    method public String getName();
+    method public int getUid();
+    method public void setName(String);
+    method public void setUid(int);
+  }
+
+  public class BackupTransportWhitelistedService {
+    ctor public BackupTransportWhitelistedService();
+    method public String getService();
+    method public void setService(String);
+  }
+
+  public class BugreportWhitelisted {
+    ctor public BugreportWhitelisted();
+    method public String get_package();
+    method public void set_package(String);
+  }
+
+  public class DefaultEnabledVrApp {
+    ctor public DefaultEnabledVrApp();
+    method public String get_class();
+    method public String get_package();
+    method public void set_class(String);
+    method public void set_package(String);
+  }
+
+  public class DisabledUntilUsedPreinstalledCarrierApp {
+    ctor public DisabledUntilUsedPreinstalledCarrierApp();
+    method public String get_package();
+    method public void set_package(String);
+  }
+
+  public class DisabledUntilUsedPreinstalledCarrierAssociatedApp {
+    ctor public DisabledUntilUsedPreinstalledCarrierAssociatedApp();
+    method public String getCarrierAppPackage();
+    method public String get_package();
+    method public void setCarrierAppPackage(String);
+    method public void set_package(String);
+  }
+
+  public class Feature {
+    ctor public Feature();
+    method public String getName();
+    method public String getNotLowRam();
+    method public void setName(String);
+    method public void setNotLowRam(String);
+  }
+
+  public class Group {
+    ctor public Group();
+    method public int getGid();
+    method public void setGid(int);
+  }
+
+  public class HiddenApiWhitelistedApp {
+    ctor public HiddenApiWhitelistedApp();
+    method public String get_package();
+    method public void set_package(String);
+  }
+
+  public class Library {
+    ctor public Library();
+    method public String getDependency();
+    method public String getFile();
+    method public String getName();
+    method public void setDependency(String);
+    method public void setFile(String);
+    method public void setName(String);
+  }
+
+  public class OemPermissions {
+    ctor public OemPermissions();
+    method public java.util.List<com.android.xml.permission.OemPermissions.DenyPermission> getDenyPermission();
+    method public java.util.List<com.android.xml.permission.OemPermissions.Permission> getPermission();
+    method public String get_package();
+    method public void set_package(String);
+  }
+
+  public static class OemPermissions.DenyPermission {
+    ctor public OemPermissions.DenyPermission();
+    method public String getName();
+    method public void setName(String);
+  }
+
+  public static class OemPermissions.Permission {
+    ctor public OemPermissions.Permission();
+    method public String getName();
+    method public void setName(String);
+  }
+
+  public class Permission {
+    ctor public Permission();
+    method public String getName();
+    method public void setName(String);
+  }
+
+  public class Permissions {
+    ctor public Permissions();
+    method public java.util.List<com.android.xml.permission.AllowAssociation> getAllowAssociation();
+    method public java.util.List<com.android.xml.permission.AllowIgnoreLocationSettings> getAllowIgnoreLocationSettings();
+    method public java.util.List<com.android.xml.permission.AllowImplicitBroadcast> getAllowImplicitBroadcast();
+    method public java.util.List<com.android.xml.permission.AllowInDataUsageSave> getAllowInDataUsageSave();
+    method public java.util.List<com.android.xml.permission.AllowInPowerSave> getAllowInPowerSave();
+    method public java.util.List<com.android.xml.permission.AllowInPowerSaveExceptIdle> getAllowInPowerSaveExceptIdle();
+    method public java.util.List<com.android.xml.permission.AllowUnthrottledLocation> getAllowUnthrottledLocation();
+    method public java.util.List<com.android.xml.permission.AppLink> getAppLink();
+    method public java.util.List<com.android.xml.permission.AssignPermission> getAssignPermission();
+    method public java.util.List<com.android.xml.permission.BackupTransportWhitelistedService> getBackupTransportWhitelistedService();
+    method public java.util.List<com.android.xml.permission.BugreportWhitelisted> getBugreportWhitelisted();
+    method public java.util.List<com.android.xml.permission.DefaultEnabledVrApp> getDefaultEnabledVrApp();
+    method public java.util.List<com.android.xml.permission.DisabledUntilUsedPreinstalledCarrierApp> getDisabledUntilUsedPreinstalledCarrierApp();
+    method public java.util.List<com.android.xml.permission.DisabledUntilUsedPreinstalledCarrierAssociatedApp> getDisabledUntilUsedPreinstalledCarrierAssociatedApp();
+    method public java.util.List<com.android.xml.permission.Feature> getFeature();
+    method public java.util.List<com.android.xml.permission.Group> getGroup();
+    method public java.util.List<com.android.xml.permission.HiddenApiWhitelistedApp> getHiddenApiWhitelistedApp();
+    method public java.util.List<com.android.xml.permission.Library> getLibrary();
+    method public java.util.List<com.android.xml.permission.OemPermissions> getOemPermissions();
+    method public java.util.List<com.android.xml.permission.Permission> getPermission();
+    method public java.util.List<com.android.xml.permission.PrivappPermissions> getPrivappPermissions();
+    method public java.util.List<com.android.xml.permission.SplitPermission> getSplitPermission();
+    method public java.util.List<com.android.xml.permission.SystemUserBlacklistedApp> getSystemUserBlacklistedApp();
+    method public java.util.List<com.android.xml.permission.SystemUserWhitelistedApp> getSystemUserWhitelistedApp();
+    method public java.util.List<com.android.xml.permission.UnavailableFeature> getUnavailableFeature();
+  }
+
+  public class PrivappPermissions {
+    ctor public PrivappPermissions();
+    method public java.util.List<com.android.xml.permission.PrivappPermissions.DenyPermission> getDenyPermission();
+    method public java.util.List<com.android.xml.permission.PrivappPermissions.Permission> getPermission();
+    method public String get_package();
+    method public void set_package(String);
+  }
+
+  public static class PrivappPermissions.DenyPermission {
+    ctor public PrivappPermissions.DenyPermission();
+    method public String getName();
+    method public void setName(String);
+  }
+
+  public static class PrivappPermissions.Permission {
+    ctor public PrivappPermissions.Permission();
+    method public String getName();
+    method public void setName(String);
+  }
+
+  public class SplitPermission {
+    ctor public SplitPermission();
+    method public java.util.List<com.android.xml.permission.SplitPermission.Library> getLibrary();
+    method public String getName();
+    method public int getTargetSdk();
+    method public void setName(String);
+    method public void setTargetSdk(int);
+  }
+
+  public static class SplitPermission.Library {
+    ctor public SplitPermission.Library();
+    method public String getName();
+    method public void setName(String);
+  }
+
+  public class SystemUserBlacklistedApp {
+    ctor public SystemUserBlacklistedApp();
+    method public String get_package();
+    method public void set_package(String);
+  }
+
+  public class SystemUserWhitelistedApp {
+    ctor public SystemUserWhitelistedApp();
+    method public String get_package();
+    method public void set_package(String);
+  }
+
+  public class UnavailableFeature {
+    ctor public UnavailableFeature();
+    method public String getName();
+    method public void setName(String);
+  }
+
+  public class XmlParser {
+    ctor public XmlParser();
+    method public static com.android.xml.permission.Permissions read(java.io.InputStream) throws javax.xml.datatype.DatatypeConfigurationException, java.io.IOException, org.xmlpull.v1.XmlPullParserException;
+    method public static String readText(org.xmlpull.v1.XmlPullParser) throws java.io.IOException, org.xmlpull.v1.XmlPullParserException;
+    method public static void skip(org.xmlpull.v1.XmlPullParser) throws java.io.IOException, org.xmlpull.v1.XmlPullParserException;
+  }
+
+}
+
diff --git a/core/xsd/schema/last_current.txt b/core/xsd/schema/last_current.txt
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/core/xsd/schema/last_current.txt
diff --git a/core/xsd/schema/last_removed.txt b/core/xsd/schema/last_removed.txt
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/core/xsd/schema/last_removed.txt
diff --git a/core/xsd/schema/removed.txt b/core/xsd/schema/removed.txt
new file mode 100644
index 0000000..d802177
--- /dev/null
+++ b/core/xsd/schema/removed.txt
@@ -0,0 +1 @@
+// Signature format: 2.0
diff --git a/data/etc/com.android.settings.xml b/data/etc/com.android.settings.xml
index 2110a8f..3e53a38 100644
--- a/data/etc/com.android.settings.xml
+++ b/data/etc/com.android.settings.xml
@@ -33,6 +33,7 @@
         <permission name="android.permission.MANAGE_USERS"/>
         <permission name="android.permission.MANAGE_USER_OEM_UNLOCK_STATE" />
         <permission name="android.permission.MASTER_CLEAR"/>
+        <permission name="android.permission.MEDIA_CONTENT_CONTROL"/>
         <permission name="android.permission.MODIFY_PHONE_STATE"/>
         <permission name="android.permission.MOUNT_UNMOUNT_FILESYSTEMS"/>
         <permission name="android.permission.MOVE_PACKAGE"/>
diff --git a/data/etc/privapp-permissions-platform.xml b/data/etc/privapp-permissions-platform.xml
index f19e44c..fcd5d56 100644
--- a/data/etc/privapp-permissions-platform.xml
+++ b/data/etc/privapp-permissions-platform.xml
@@ -23,6 +23,7 @@
     <privapp-permissions package="android.ext.services">
         <permission name="android.permission.PROVIDE_RESOLVER_RANKER_SERVICE" />
         <permission name="android.permission.MONITOR_DEFAULT_SMS_PACKAGE" />
+        <permission name="android.permission.REQUEST_NOTIFICATION_ASSISTANT_SERVICE" />
     </privapp-permissions>
 
     <privapp-permissions package="com.android.apps.tag">
diff --git a/graphics/TEST_MAPPING b/graphics/TEST_MAPPING
new file mode 100644
index 0000000..10bd0ee
--- /dev/null
+++ b/graphics/TEST_MAPPING
@@ -0,0 +1,7 @@
+{
+  "presubmit": [
+    {
+      "name": "CtsGraphicsTestCases"
+    }
+  ]
+}
diff --git a/graphics/java/android/graphics/BaseCanvas.java b/graphics/java/android/graphics/BaseCanvas.java
index 83c8b01..fd37735 100644
--- a/graphics/java/android/graphics/BaseCanvas.java
+++ b/graphics/java/android/graphics/BaseCanvas.java
@@ -425,8 +425,8 @@
      * Make lint happy.
      * See {@link Canvas#drawDoubleRoundRect(RectF, float[], RectF, float[], Paint)}
      */
-    public void drawDoubleRoundRect(@NonNull RectF outer, float[] outerRadii,
-            @NonNull RectF inner, float[] innerRadii, @NonNull Paint paint) {
+    public void drawDoubleRoundRect(@NonNull RectF outer, @NonNull float[] outerRadii,
+            @NonNull RectF inner, @NonNull float[] innerRadii, @NonNull Paint paint) {
         throwIfHasHwBitmapInSwMode(paint);
         if (innerRadii == null || outerRadii == null
                 || innerRadii.length != 8 || outerRadii.length != 8) {
diff --git a/graphics/java/android/graphics/Bitmap.java b/graphics/java/android/graphics/Bitmap.java
index 920fb4c..2e56e09 100644
--- a/graphics/java/android/graphics/Bitmap.java
+++ b/graphics/java/android/graphics/Bitmap.java
@@ -1718,6 +1718,11 @@
      * <p>Modifies the bitmap to have the specified {@link ColorSpace}, without
      * affecting the underlying allocation backing the bitmap.</p>
      *
+     * <p>This affects how the framework will interpret the color at each pixel. A bitmap
+     * with {@link Config#ALPHA_8} never has a color space, since a color space does not
+     * affect the alpha channel. Other {@code Config}s must always have a non-null
+     * {@code ColorSpace}.</p>
+     *
      * @throws IllegalArgumentException If the specified color space is {@code null}, not
      *         {@link ColorSpace.Model#RGB RGB}, has a transfer function that is not an
      *         {@link ColorSpace.Rgb.TransferParameters ICC parametric curve}, or whose
@@ -1845,6 +1850,7 @@
      * @throws IllegalStateException if the bitmap's config is {@link Config#HARDWARE}
      *
      */
+    @NonNull
     public Color getColor(int x, int y) {
         checkRecycled("Can't call getColor() on a recycled bitmap");
         checkHardware("unable to getColor(), "
@@ -2024,7 +2030,7 @@
                         x, y, width, height);
     }
 
-    public static final Parcelable.Creator<Bitmap> CREATOR
+    public static final @android.annotation.NonNull Parcelable.Creator<Bitmap> CREATOR
             = new Parcelable.Creator<Bitmap>() {
         /**
          * Rebuilds a bitmap previously stored with writeToParcel().
diff --git a/graphics/java/android/graphics/Canvas.java b/graphics/java/android/graphics/Canvas.java
index 034dff0..8f46e1a 100644
--- a/graphics/java/android/graphics/Canvas.java
+++ b/graphics/java/android/graphics/Canvas.java
@@ -2018,8 +2018,8 @@
      * @param paint The paint used to draw the double roundRect
      */
     @Override
-    public void drawDoubleRoundRect(@NonNull RectF outer, float[] outerRadii,
-            @NonNull RectF inner, float[] innerRadii, @NonNull Paint paint) {
+    public void drawDoubleRoundRect(@NonNull RectF outer, @NonNull float[] outerRadii,
+            @NonNull RectF inner, @NonNull float[] innerRadii, @NonNull Paint paint) {
         super.drawDoubleRoundRect(outer, outerRadii, inner, innerRadii, paint);
     }
 
diff --git a/graphics/java/android/graphics/GraphicBuffer.java b/graphics/java/android/graphics/GraphicBuffer.java
index 7408683..3b1fc70 100644
--- a/graphics/java/android/graphics/GraphicBuffer.java
+++ b/graphics/java/android/graphics/GraphicBuffer.java
@@ -279,7 +279,7 @@
     }
 
     @UnsupportedAppUsage
-    public static final Parcelable.Creator<GraphicBuffer> CREATOR =
+    public static final @android.annotation.NonNull Parcelable.Creator<GraphicBuffer> CREATOR =
             new Parcelable.Creator<GraphicBuffer>() {
         public GraphicBuffer createFromParcel(Parcel in) {
             int width = in.readInt();
diff --git a/graphics/java/android/graphics/HardwareRenderer.java b/graphics/java/android/graphics/HardwareRenderer.java
index e623354..bc744cc 100644
--- a/graphics/java/android/graphics/HardwareRenderer.java
+++ b/graphics/java/android/graphics/HardwareRenderer.java
@@ -170,13 +170,14 @@
 
     /**
      * Destroys the rendering context of this HardwareRenderer. This destroys the resources
-     * associated with this renderer and releases the currently set {@link Surface}.
+     * associated with this renderer and releases the currently set {@link Surface}. This must
+     * be called when this HardwareRenderer is no longer needed.
      *
      * <p>The renderer may be restored from this state by setting a new {@link Surface}, setting
      * new rendering content with {@link #setContentRoot(RenderNode)}, and resuming
      * rendering by issuing a new {@link FrameRenderRequest}.
      *
-     * <p>It is suggested to call this in response to callbacks such as
+     * <p>It is recommended to call this in response to callbacks such as
      * {@link android.view.SurfaceHolder.Callback#surfaceDestroyed(SurfaceHolder)}.
      *
      * <p>Note that if there are any outstanding frame commit callbacks they may never being
@@ -193,7 +194,7 @@
      *
      * @param name The debug name to use for this HardwareRenderer instance
      */
-    public void setName(String name) {
+    public void setName(@NonNull String name) {
         nSetName(mNativeProxy, name);
     }
 
@@ -330,7 +331,7 @@
          *
          * @return this instance
          */
-        public FrameRenderRequest setVsyncTime(long vsyncTime) {
+        public @NonNull FrameRenderRequest setVsyncTime(long vsyncTime) {
             mFrameInfo.setVsync(vsyncTime, vsyncTime);
             mFrameInfo.addFlags(FrameInfo.FLAG_SURFACE_CANVAS);
             return this;
@@ -351,7 +352,7 @@
          *
          * @return this instance
          */
-        public FrameRenderRequest setFrameCommitCallback(@NonNull Executor executor,
+        public @NonNull FrameRenderRequest setFrameCommitCallback(@NonNull Executor executor,
                 @NonNull Runnable frameCommitCallback) {
             setFrameCompleteCallback(frameNr -> executor.execute(frameCommitCallback));
             return this;
@@ -372,7 +373,7 @@
          *                   completion.
          * @return this instance
          */
-        public FrameRenderRequest setWaitForPresent(boolean shouldWait) {
+        public @NonNull FrameRenderRequest setWaitForPresent(boolean shouldWait) {
             mWaitForPresent = shouldWait;
             return this;
         }
@@ -383,7 +384,7 @@
          * The system internally may reuse instances of {@link FrameRenderRequest} to reduce
          * allocation churn.
          *
-         * @return The result of the sync operation. See {@link SyncAndDrawResult}.
+         * @return The result of the sync operation.
          */
         @SyncAndDrawResult
         public int syncAndDraw() {
@@ -406,7 +407,7 @@
      * @return An instance of {@link FrameRenderRequest}. The instance may be reused for every
      * frame, so the caller should not hold onto it for longer than a single render request.
      */
-    public FrameRenderRequest createRenderRequest() {
+    public @NonNull FrameRenderRequest createRenderRequest() {
         mRenderRequest.reset();
         return mRenderRequest;
     }
@@ -456,12 +457,37 @@
      * and {@link Activity#onStart()}.
      *
      * @param stopped true to stop all rendering, false to resume
+     * @hide
      */
     public void setStopped(boolean stopped) {
         nSetStopped(mNativeProxy, stopped);
     }
 
     /**
+     * Hard stops rendering into the surface. If the renderer is stopped it will
+     * block any attempt to render. Calls to {@link FrameRenderRequest#syncAndDraw()} will
+     * still sync over the latest rendering content, however they will not render and instead
+     * {@link #SYNC_CONTEXT_IS_STOPPED} will be returned.
+     *
+     * <p>This is useful in combination with lifecycle events such as {@link Activity#onStop()}.
+     * See {@link #start()} for resuming rendering.
+     */
+    public void stop() {
+        nSetStopped(mNativeProxy, true);
+    }
+
+    /**
+     * Resumes rendering into the surface. Any pending rendering requests
+     * will produce a new frame at the next vsync signal.
+     *
+     * <p>This is useful in combination with lifecycle events such as {@link Activity#onStart()}.
+     * See {@link #stop()} for stopping rendering.
+     */
+    public void start() {
+        nSetStopped(mNativeProxy, false);
+    }
+
+    /**
      * Destroys all the display lists associated with the current rendering content.
      * This includes releasing a reference to the current content root RenderNode. It will
      * therefore be necessary to call {@link #setContentRoot(RenderNode)} in order to resume
@@ -473,7 +499,7 @@
      * {@link android.content.ComponentCallbacks2#onTrimMemory(int)} signals such as
      * {@link android.content.ComponentCallbacks2#TRIM_MEMORY_UI_HIDDEN}
      *
-     * See also {@link #setStopped(boolean)}
+     * See also {@link #stop()}.
      */
     public void clearContent() {
         nDestroyHardwareResources(mNativeProxy);
diff --git a/graphics/java/android/graphics/ImageDecoder.java b/graphics/java/android/graphics/ImageDecoder.java
index 7016cc7..2d5babc 100644
--- a/graphics/java/android/graphics/ImageDecoder.java
+++ b/graphics/java/android/graphics/ImageDecoder.java
@@ -59,6 +59,8 @@
 import java.io.InputStream;
 import java.lang.annotation.Retention;
 import java.nio.ByteBuffer;
+import java.util.Locale;
+import java.util.Objects;
 import java.util.concurrent.Callable;
 import java.util.concurrent.atomic.AtomicBoolean;
 
@@ -838,6 +840,40 @@
     }
 
     /**
+     * Return if the given MIME type is a supported file format that can be
+     * decoded by this class. This can be useful to determine if a file can be
+     * decoded directly, or if it needs to be converted into a more general
+     * format using an API like {@link ContentResolver#openTypedAssetFile}.
+     */
+    public static boolean isMimeTypeSupported(@NonNull String mimeType) {
+        Objects.requireNonNull(mimeType);
+        switch (mimeType.toLowerCase(Locale.US)) {
+            case "image/png":
+            case "image/jpeg":
+            case "image/webp":
+            case "image/gif":
+            case "image/heif":
+            case "image/heic":
+            case "image/bmp":
+            case "image/x-ico":
+            case "image/vnd.wap.wbmp":
+            case "image/x-sony-arw":
+            case "image/x-canon-cr2":
+            case "image/x-adobe-dng":
+            case "image/x-nikon-nef":
+            case "image/x-nikon-nrw":
+            case "image/x-olympus-orf":
+            case "image/x-fuji-raf":
+            case "image/x-panasonic-rw2":
+            case "image/x-pentax-pef":
+            case "image/x-samsung-srw":
+                return true;
+            default:
+                return false;
+        }
+    }
+
+    /**
      * Create a new {@link Source Source} from a resource.
      *
      * @param res the {@link Resources} object containing the image data.
@@ -1606,14 +1642,16 @@
         mTempStorage = null;
     }
 
-    private void checkState() {
+    private void checkState(boolean animated) {
         if (mNativePtr == 0) {
             throw new IllegalStateException("Cannot use closed ImageDecoder!");
         }
 
         checkSubset(mDesiredWidth, mDesiredHeight, mCropRect);
 
-        if (mAllocator == ALLOCATOR_HARDWARE) {
+        // animated ignores the allocator, so no need to check for incompatible
+        // fields.
+        if (!animated && mAllocator == ALLOCATOR_HARDWARE) {
             if (mMutable) {
                 throw new IllegalStateException("Cannot make mutable HARDWARE Bitmap!");
             }
@@ -1637,21 +1675,30 @@
         }
     }
 
+    private boolean checkForExtended() {
+        if (mDesiredColorSpace == null) {
+            return false;
+        }
+        return mDesiredColorSpace == ColorSpace.get(ColorSpace.Named.EXTENDED_SRGB)
+                || mDesiredColorSpace == ColorSpace.get(ColorSpace.Named.LINEAR_EXTENDED_SRGB);
+    }
+
+    private long getColorSpacePtr() {
+        if (mDesiredColorSpace == null) {
+            return 0;
+        }
+        return mDesiredColorSpace.getNativeInstance();
+    }
+
     @WorkerThread
     @NonNull
     private Bitmap decodeBitmapInternal() throws IOException {
-        checkState();
-        long colorSpacePtr = 0;
-        boolean extended = false;
-        if (mDesiredColorSpace != null) {
-            colorSpacePtr = mDesiredColorSpace.getNativeInstance();
-            extended = mDesiredColorSpace == ColorSpace.get(ColorSpace.Named.EXTENDED_SRGB)
-                || mDesiredColorSpace == ColorSpace.get(ColorSpace.Named.LINEAR_EXTENDED_SRGB);
-        }
+        checkState(false);
         return nDecodeBitmap(mNativePtr, this, mPostProcessor != null,
                 mDesiredWidth, mDesiredHeight, mCropRect,
                 mMutable, mAllocator, mUnpremultipliedRequired,
-                mConserveMemory, mDecodeAsAlphaMask, colorSpacePtr, extended);
+                mConserveMemory, mDecodeAsAlphaMask, getColorSpacePtr(),
+                checkForExtended());
     }
 
     private void callHeaderDecoded(@Nullable OnHeaderDecodedListener listener,
@@ -1717,9 +1764,11 @@
                 // mPostProcessor exists.
                 ImageDecoder postProcessPtr = decoder.mPostProcessor == null ?
                         null : decoder;
+                decoder.checkState(true);
                 Drawable d = new AnimatedImageDrawable(decoder.mNativePtr,
                         postProcessPtr, decoder.mDesiredWidth,
-                        decoder.mDesiredHeight, srcDensity,
+                        decoder.mDesiredHeight, decoder.getColorSpacePtr(),
+                        decoder.checkForExtended(), srcDensity,
                         src.computeDstDensity(), decoder.mCropRect,
                         decoder.mInputStream, decoder.mAssetFd);
                 // d has taken ownership of these objects.
diff --git a/graphics/java/android/graphics/Insets.java b/graphics/java/android/graphics/Insets.java
index c64c789..1e03c53 100644
--- a/graphics/java/android/graphics/Insets.java
+++ b/graphics/java/android/graphics/Insets.java
@@ -30,7 +30,7 @@
  *
  */
 public final class Insets implements Parcelable {
-    public static final Insets NONE = new Insets(0, 0, 0, 0);
+    public static final @NonNull Insets NONE = new Insets(0, 0, 0, 0);
 
     public final int left;
     public final int top;
@@ -184,7 +184,7 @@
         out.writeInt(bottom);
     }
 
-    public static final Parcelable.Creator<Insets> CREATOR = new Parcelable.Creator<Insets>() {
+    public static final @android.annotation.NonNull Parcelable.Creator<Insets> CREATOR = new Parcelable.Creator<Insets>() {
         @Override
         public Insets createFromParcel(Parcel in) {
             return new Insets(in.readInt(), in.readInt(), in.readInt(), in.readInt());
diff --git a/graphics/java/android/graphics/Paint.java b/graphics/java/android/graphics/Paint.java
index e617c42..9eeb43b 100644
--- a/graphics/java/android/graphics/Paint.java
+++ b/graphics/java/android/graphics/Paint.java
@@ -1733,7 +1733,7 @@
      * @return the paint's extra word-spacing for drawing text in pixels.
      * @see #setWordSpacing(float)
      */
-    public float getWordSpacing() {
+    public @Px float getWordSpacing() {
         return nGetWordSpacing(mNativePaint);
     }
 
@@ -1746,7 +1746,7 @@
      * @param wordSpacing set the paint's extra word-spacing for drawing text in pixels.
      * @see #getWordSpacing()
      */
-    public void setWordSpacing(float wordSpacing) {
+    public void setWordSpacing(@Px float wordSpacing) {
         nSetWordSpacing(mNativePaint, wordSpacing);
     }
 
@@ -2706,6 +2706,8 @@
     }
 
     /**
+     * Retrieve the text boundary box and store to bounds.
+     *
      * Return in bounds (allocated by the caller) the smallest rectangle that
      * encloses all of the characters, with an implied origin at (0,0).
      *
@@ -2725,6 +2727,8 @@
     }
 
     /**
+     * Retrieve the text boundary box and store to bounds.
+     *
      * Return in bounds (allocated by the caller) the smallest rectangle that
      * encloses all of the characters, with an implied origin at (0,0).
      *
@@ -2736,7 +2740,8 @@
      * @param end 1 past the last char in the text to measure
      * @param bounds returns the unioned bounds of all the text. Must be allocated by the caller
      */
-    public void getTextBounds(CharSequence text, int start, int end, Rect bounds) {
+    public void getTextBounds(@NonNull CharSequence text, int start, int end,
+            @NonNull Rect bounds) {
         if ((start | end | (end - start) | (text.length() - end)) < 0) {
             throw new IndexOutOfBoundsException();
         }
diff --git a/graphics/java/android/graphics/Point.java b/graphics/java/android/graphics/Point.java
index ea93501..3614f3b 100644
--- a/graphics/java/android/graphics/Point.java
+++ b/graphics/java/android/graphics/Point.java
@@ -139,7 +139,7 @@
         protoOutputStream.end(token);
     }
 
-    public static final Parcelable.Creator<Point> CREATOR = new Parcelable.Creator<Point>() {
+    public static final @android.annotation.NonNull Parcelable.Creator<Point> CREATOR = new Parcelable.Creator<Point>() {
         /**
          * Return a new point from the data in the specified parcel.
          */
diff --git a/graphics/java/android/graphics/PointF.java b/graphics/java/android/graphics/PointF.java
index a3b4194..f1f48ad 100644
--- a/graphics/java/android/graphics/PointF.java
+++ b/graphics/java/android/graphics/PointF.java
@@ -130,7 +130,7 @@
         out.writeFloat(y);
     }
 
-    public static final Parcelable.Creator<PointF> CREATOR = new Parcelable.Creator<PointF>() {
+    public static final @android.annotation.NonNull Parcelable.Creator<PointF> CREATOR = new Parcelable.Creator<PointF>() {
         /**
          * Return a new point from the data in the specified parcel.
          */
diff --git a/graphics/java/android/graphics/RecordingCanvas.java b/graphics/java/android/graphics/RecordingCanvas.java
index 30466e1..c0e0a24 100644
--- a/graphics/java/android/graphics/RecordingCanvas.java
+++ b/graphics/java/android/graphics/RecordingCanvas.java
@@ -166,7 +166,9 @@
      * @param drawGLFunction A native function pointer
      *
      * @hide
+     * @deprecated Use {@link #drawWebViewFunctor(int)}
      */
+    @Deprecated
     public void callDrawGLFunction2(long drawGLFunction) {
         nCallDrawGLFunction(mNativeCanvasWrapper, drawGLFunction, null);
     }
@@ -184,7 +186,9 @@
      * canvas's display list has been released.
      *
      * @hide
+     * @deprecated Use {@link #drawWebViewFunctor(int)}
      */
+    @Deprecated
     public void drawGLFunctor2(long drawGLFunctor, @Nullable Runnable releasedCallback) {
         nCallDrawGLFunction(mNativeCanvasWrapper, drawGLFunctor, releasedCallback);
     }
diff --git a/graphics/java/android/graphics/Rect.java b/graphics/java/android/graphics/Rect.java
index 40a32f3..d47f682 100644
--- a/graphics/java/android/graphics/Rect.java
+++ b/graphics/java/android/graphics/Rect.java
@@ -722,7 +722,7 @@
         out.writeInt(bottom);
     }
 
-    public static final Parcelable.Creator<Rect> CREATOR = new Parcelable.Creator<Rect>() {
+    public static final @android.annotation.NonNull Parcelable.Creator<Rect> CREATOR = new Parcelable.Creator<Rect>() {
         /**
          * Return a new rectangle from the data in the specified parcel.
          */
diff --git a/graphics/java/android/graphics/RectF.java b/graphics/java/android/graphics/RectF.java
index d6447ac..3361fa2 100644
--- a/graphics/java/android/graphics/RectF.java
+++ b/graphics/java/android/graphics/RectF.java
@@ -561,7 +561,7 @@
         out.writeFloat(bottom);
     }
     
-    public static final Parcelable.Creator<RectF> CREATOR = new Parcelable.Creator<RectF>() {
+    public static final @android.annotation.NonNull Parcelable.Creator<RectF> CREATOR = new Parcelable.Creator<RectF>() {
         /**
          * Return a new rectangle from the data in the specified parcel.
          */
diff --git a/graphics/java/android/graphics/Region.java b/graphics/java/android/graphics/Region.java
index 29d9367..ec7f7a0 100644
--- a/graphics/java/android/graphics/Region.java
+++ b/graphics/java/android/graphics/Region.java
@@ -345,7 +345,7 @@
 
     //////////////////////////////////////////////////////////////////////////
     
-    public static final Parcelable.Creator<Region> CREATOR
+    public static final @android.annotation.NonNull Parcelable.Creator<Region> CREATOR
         = new Parcelable.Creator<Region>() {
             /**
             * Rebuild a Region previously stored with writeToParcel().
diff --git a/graphics/java/android/graphics/RenderNode.java b/graphics/java/android/graphics/RenderNode.java
index e98879d..5e48ea1 100644
--- a/graphics/java/android/graphics/RenderNode.java
+++ b/graphics/java/android/graphics/RenderNode.java
@@ -27,6 +27,8 @@
 import android.view.Surface;
 import android.view.View;
 
+import com.android.internal.util.ArrayUtils;
+
 import dalvik.annotation.optimization.CriticalNative;
 import dalvik.annotation.optimization.FastNative;
 
@@ -60,7 +62,7 @@
  *
  * <h3>Creating a RenderNode</h3>
  * <pre class="prettyprint">
- *     RenderNode renderNode = RenderNode.create("myRenderNode");
+ *     RenderNode renderNode = new RenderNode("myRenderNode");
  *     renderNode.setLeftTopRightBottom(0, 0, 50, 50); // Set the size to 50x50
  *     RecordingCanvas canvas = renderNode.beginRecording();
  *     try {
@@ -104,7 +106,7 @@
  *
  * <pre class="prettyprint">
  *     private void createDisplayList() {
- *         mRenderNode = RenderNode.create("MyRenderNode");
+ *         mRenderNode = new RenderNode("MyRenderNode");
  *         mRenderNode.setLeftTopRightBottom(0, 0, width, height);
  *         RecordingCanvas canvas = mRenderNode.beginRecording();
  *         try {
@@ -133,6 +135,36 @@
  *     }
  * </pre>
  *
+ * <p>A few of the properties may at first appear redundant, such as {@link #setElevation(float)}
+ * and {@link #setTranslationZ(float)}. The reason for these duplicates are to allow for a
+ * separation between static & transient usages. For example consider a button that raises from 2dp
+ * to 8dp when pressed. To achieve that an application may decide to setElevation(2dip), and then
+ * on press to animate setTranslationZ to 6dip. Combined this achieves the final desired 8dip
+ * value, but the animation need only concern itself with animating the lift from press without
+ * needing to know the initial starting value. {@link #setTranslationX(float)} and
+ * {@link #setTranslationY(float)} are similarly provided for animation uses despite the functional
+ * overlap with {@link #setPosition(Rect)}.
+ *
+ * <p>The RenderNode's transform matrix is computed at render time as follows:
+ * First a setTranslate(getTranslationX(), getTranslationY()) is applied to a {@link Matrix}.
+ * Second a preRotate(getRotationZ(), getPivotX(), getPivotY()) is applied to the matrix. And
+ * finally a preScale(getScaleX(), getScaleY(), getPivotX(), getPivotY()) is applied. The current
+ * canvas transform matrix, which is translated to the RenderNode's position,
+ * is then multiplied by the RenderNode's transform matrix. Therefore there is no implicit
+ * ordering in setting various RenderNode properties. That is to say that:
+ *
+ * <pre class="prettyprint">
+ *     renderNode.setTranslationX(100);
+ *     renderNode.setScaleX(100);
+ * </pre>
+ *
+ * is equivalent to
+ *
+ * <pre class="prettyprint">
+ *     renderNode.setScaleX(100);
+ *     renderNode.setTranslationX(100);
+ * </pre>
+ *
  * <h3>Threading</h3>
  * <p>RenderNode may be created and used on any thread but they are not thread-safe. Only
  * a single thread may interact with a RenderNode at any given time. It is critical
@@ -179,6 +211,10 @@
     private final AnimationHost mAnimationHost;
     private RecordingCanvas mCurrentRecordingCanvas;
 
+    // Will be null if not currently registered
+    @Nullable
+    private CompositePositionUpdateListener mCompositePositionUpdateListener;
+
     /**
      * Creates a new RenderNode that can be used to record batches of
      * drawing operations, and store / apply render properties when drawn.
@@ -248,15 +284,70 @@
 
     }
 
+    private static final class CompositePositionUpdateListener implements PositionUpdateListener {
+        private final PositionUpdateListener[] mListeners;
+
+        CompositePositionUpdateListener(PositionUpdateListener... listeners) {
+            mListeners = listeners;
+        }
+
+        public CompositePositionUpdateListener with(PositionUpdateListener listener) {
+            return new CompositePositionUpdateListener(
+                    ArrayUtils.appendElement(PositionUpdateListener.class, mListeners, listener));
+        }
+
+        public CompositePositionUpdateListener without(PositionUpdateListener listener) {
+            return new CompositePositionUpdateListener(
+                    ArrayUtils.removeElement(PositionUpdateListener.class, mListeners, listener));
+        }
+
+        @Override
+        public void positionChanged(long frameNumber, int left, int top, int right, int bottom) {
+            for (PositionUpdateListener pul : mListeners) {
+                pul.positionChanged(frameNumber, left, top, right, bottom);
+            }
+        }
+
+        @Override
+        public void positionLost(long frameNumber) {
+            for (PositionUpdateListener pul : mListeners) {
+                pul.positionLost(frameNumber);
+            }
+        }
+    }
+
     /**
-     * Enable callbacks for position changes.
+     * Enable callbacks for position changes. Call only from the UI thread or with
+     * external synchronization.
      *
      * @hide
      */
-    public void requestPositionUpdates(PositionUpdateListener listener) {
-        nRequestPositionUpdates(mNativeRenderNode, listener);
+    public void addPositionUpdateListener(@NonNull PositionUpdateListener listener) {
+        CompositePositionUpdateListener comp = mCompositePositionUpdateListener;
+        if (comp == null) {
+            comp = new CompositePositionUpdateListener(listener);
+        } else {
+            comp = comp.with(listener);
+        }
+        mCompositePositionUpdateListener = comp;
+        nRequestPositionUpdates(mNativeRenderNode, comp);
     }
 
+    /**
+     * Disable a callback for position changes. Call only from the UI thread or with
+     * external synchronization.
+     *
+     * @param listener Callback to remove
+     * @hide
+     */
+    public void removePositionUpdateListener(@NonNull PositionUpdateListener listener) {
+        CompositePositionUpdateListener comp = mCompositePositionUpdateListener;
+        if (comp != null) {
+            comp = comp.without(listener);
+            mCompositePositionUpdateListener = comp;
+            nRequestPositionUpdates(mNativeRenderNode, comp);
+        }
+    }
 
     /**
      * Starts recording a display list for the render node. All
@@ -277,7 +368,7 @@
      * @see #endRecording()
      * @see #hasDisplayList()
      */
-    public RecordingCanvas beginRecording(int width, int height) {
+    public @NonNull RecordingCanvas beginRecording(int width, int height) {
         if (mCurrentRecordingCanvas != null) {
             throw new IllegalStateException(
                     "Recording currently in progress - missing #endRecording() call?");
@@ -297,7 +388,7 @@
      * @see #endRecording()
      * @see #hasDisplayList()
      */
-    public RecordingCanvas beginRecording() {
+    public @NonNull RecordingCanvas beginRecording() {
         return beginRecording(nGetWidth(mNativeRenderNode), nGetHeight(mNativeRenderNode));
     }
 
@@ -1224,7 +1315,7 @@
      * @param position The position rectangle in pixels
      * @return True if the value changed, false if the new value was the same as the previous value.
      */
-    public boolean setPosition(Rect position) {
+    public boolean setPosition(@NonNull Rect position) {
         return nSetLeftTopRightBottom(mNativeRenderNode,
                 position.left, position.top, position.right, position.bottom);
     }
diff --git a/graphics/java/android/graphics/Typeface.java b/graphics/java/android/graphics/Typeface.java
index e93e757..9518714 100644
--- a/graphics/java/android/graphics/Typeface.java
+++ b/graphics/java/android/graphics/Typeface.java
@@ -34,6 +34,7 @@
 import android.graphics.fonts.SystemFonts;
 import android.os.Build;
 import android.os.Build.VERSION_CODES;
+import android.os.ParcelFileDescriptor;
 import android.provider.FontRequest;
 import android.provider.FontsContract;
 import android.text.FontConfig;
@@ -368,7 +369,7 @@
         private final AssetManager mAssetManager;
         private final String mPath;
 
-        private final Font.Builder mFontBuilder;
+        private final @Nullable Font.Builder mFontBuilder;
 
         private String mFallbackFamilyName;
 
@@ -395,7 +396,16 @@
          * @param fd The file descriptor. The passed fd must be mmap-able.
          */
         public Builder(@NonNull FileDescriptor fd) {
-            mFontBuilder = new Font.Builder(fd);
+            Font.Builder builder;
+            try {
+                builder = new Font.Builder(ParcelFileDescriptor.dup(fd));
+            } catch (IOException e) {
+                // We cannot tell the error to developer at this moment since we cannot change the
+                // public API signature. Instead, silently fallbacks to system fallback in the build
+                // method as the same as other error cases.
+                builder = null;
+            }
+            mFontBuilder = builder;
             mAssetManager = null;
             mPath = null;
         }
@@ -585,6 +595,9 @@
          * @return Newly created Typeface. May return null if some parameters are invalid.
          */
         public Typeface build() {
+            if (mFontBuilder == null) {
+                return resolveFallbackTypeface();
+            }
             try {
                 final Font font = mFontBuilder.build();
                 final String key = mAssetManager == null ? null : createAssetUid(
@@ -687,7 +700,7 @@
      * </pre>
      * </p>
      */
-    public static class CustomFallbackBuilder {
+    public static final class CustomFallbackBuilder {
         private static final int MAX_CUSTOM_FALLBACK = 64;
         private final ArrayList<FontFamily> mFamilies = new ArrayList<>();
         private String mFallbackName = null;
@@ -728,7 +741,7 @@
          * @param familyName a family name to be used for fallback if the provided fonts can not be
          *                   used
          */
-        public CustomFallbackBuilder setSystemFallback(@NonNull String familyName) {
+        public @NonNull CustomFallbackBuilder setSystemFallback(@NonNull String familyName) {
             Preconditions.checkNotNull(familyName);
             mFallbackName = familyName;
             return this;
@@ -743,7 +756,7 @@
          *
          * @param style a font style
          */
-        public CustomFallbackBuilder setStyle(@NonNull FontStyle style) {
+        public @NonNull CustomFallbackBuilder setStyle(@NonNull FontStyle style) {
             mStyle = style;
             return this;
         }
@@ -758,7 +771,7 @@
          * @param family a fallback family
          * @throws IllegalArgumentException if you give more than 64 custom fallback families
          */
-        public CustomFallbackBuilder addCustomFallback(@NonNull FontFamily family) {
+        public @NonNull CustomFallbackBuilder addCustomFallback(@NonNull FontFamily family) {
             Preconditions.checkNotNull(family);
             Preconditions.checkArgument(mFamilies.size() < getMaxCustomFallbackCount(),
                     "Custom fallback limit exceeded(" + getMaxCustomFallbackCount() + ")");
@@ -771,7 +784,7 @@
          *
          * @return the Typeface object
          */
-        public Typeface build() {
+        public @NonNull Typeface build() {
             final int userFallbackSize = mFamilies.size();
             final FontFamily[] fallback = SystemFonts.getSystemFallback(mFallbackName);
             final long[] ptrArray = new long[fallback.length + userFallbackSize];
diff --git a/graphics/java/android/graphics/drawable/AnimatedImageDrawable.java b/graphics/java/android/graphics/drawable/AnimatedImageDrawable.java
index 3aaec31..bb6bf24 100644
--- a/graphics/java/android/graphics/drawable/AnimatedImageDrawable.java
+++ b/graphics/java/android/graphics/drawable/AnimatedImageDrawable.java
@@ -291,8 +291,8 @@
      */
     public AnimatedImageDrawable(long nativeImageDecoder,
             @Nullable ImageDecoder decoder, int width, int height,
-            int srcDensity, int dstDensity, Rect cropRect,
-            InputStream inputStream, AssetFileDescriptor afd)
+            long colorSpaceHandle, boolean extended, int srcDensity, int dstDensity,
+            Rect cropRect, InputStream inputStream, AssetFileDescriptor afd)
             throws IOException {
         width = Bitmap.scaleFromDensity(width, srcDensity, dstDensity);
         height = Bitmap.scaleFromDensity(height, srcDensity, dstDensity);
@@ -309,8 +309,8 @@
             mIntrinsicHeight = cropRect.height();
         }
 
-        mState = new State(nCreate(nativeImageDecoder, decoder, width, height, cropRect),
-                inputStream, afd);
+        mState = new State(nCreate(nativeImageDecoder, decoder, width, height, colorSpaceHandle,
+                    extended, cropRect), inputStream, afd);
 
         final long nativeSize = nNativeByteSize(mState.mNativePtr);
         NativeAllocationRegistry registry = new NativeAllocationRegistry(
@@ -574,8 +574,8 @@
 
 
     private static native long nCreate(long nativeImageDecoder,
-            @Nullable ImageDecoder decoder, int width, int height, Rect cropRect)
-        throws IOException;
+            @Nullable ImageDecoder decoder, int width, int height, long colorSpaceHandle,
+            boolean extended, Rect cropRect) throws IOException;
     @FastNative
     private static native long nGetNativeFinalizer();
     private static native long nDraw(long nativePtr, long canvasNativePtr);
diff --git a/graphics/java/android/graphics/drawable/ColorStateListDrawable.java b/graphics/java/android/graphics/drawable/ColorStateListDrawable.java
index 5181d89..ee4d1e7 100644
--- a/graphics/java/android/graphics/drawable/ColorStateListDrawable.java
+++ b/graphics/java/android/graphics/drawable/ColorStateListDrawable.java
@@ -17,6 +17,7 @@
 
 import android.annotation.IntRange;
 import android.annotation.NonNull;
+import android.annotation.Nullable;
 import android.content.pm.ActivityInfo;
 import android.content.res.ColorStateList;
 import android.content.res.Resources;
@@ -40,14 +41,14 @@
         initializeColorDrawable();
     }
 
-    public ColorStateListDrawable(ColorStateList colorStateList) {
+    public ColorStateListDrawable(@NonNull ColorStateList colorStateList) {
         mState = new ColorStateListDrawableState();
         initializeColorDrawable();
         setColorStateList(colorStateList);
     }
 
     @Override
-    public void draw(Canvas canvas) {
+    public void draw(@NonNull Canvas canvas) {
         mColorDrawable.draw(canvas);
     }
 
@@ -73,7 +74,7 @@
     }
 
     @Override
-    public void applyTheme(Resources.Theme t) {
+    public void applyTheme(@NonNull Resources.Theme t) {
         super.applyTheme(t);
 
         if (mState.mColor != null) {
@@ -106,26 +107,26 @@
     }
 
     @Override
-    public void setTintList(ColorStateList tint) {
+    public void setTintList(@Nullable ColorStateList tint) {
         mState.mTint = tint;
         mColorDrawable.setTintList(tint);
         onStateChange(getState());
     }
 
     @Override
-    public void setTintMode(PorterDuff.Mode tintMode) {
+    public void setTintMode(@NonNull PorterDuff.Mode tintMode) {
         mState.mTintMode = tintMode;
         mColorDrawable.setTintMode(tintMode);
         onStateChange(getState());
     }
 
     @Override
-    public ColorFilter getColorFilter() {
+    public @Nullable ColorFilter getColorFilter() {
         return mColorDrawable.getColorFilter();
     }
 
     @Override
-    public void setColorFilter(ColorFilter colorFilter) {
+    public void setColorFilter(@Nullable ColorFilter colorFilter) {
         mColorDrawable.setColorFilter(colorFilter);
     }
 
@@ -156,28 +157,28 @@
     }
 
     @Override
-    public void invalidateDrawable(Drawable who) {
+    public void invalidateDrawable(@NonNull Drawable who) {
         if (who == mColorDrawable && getCallback() != null) {
             getCallback().invalidateDrawable(this);
         }
     }
 
     @Override
-    public void scheduleDrawable(Drawable who, Runnable what, long when) {
+    public void scheduleDrawable(@NonNull Drawable who, @NonNull Runnable what, long when) {
         if (who == mColorDrawable && getCallback() != null) {
             getCallback().scheduleDrawable(this, what, when);
         }
     }
 
     @Override
-    public void unscheduleDrawable(Drawable who, Runnable what) {
+    public void unscheduleDrawable(@NonNull Drawable who, @NonNull Runnable what) {
         if (who == mColorDrawable && getCallback() != null) {
             getCallback().unscheduleDrawable(this, what);
         }
     }
 
     @Override
-    public ConstantState getConstantState() {
+    public @NonNull ConstantState getConstantState() {
         mState.mChangingConfigurations = mState.mChangingConfigurations
                 | (getChangingConfigurations() & ~mState.getChangingConfigurations());
         return mState;
@@ -203,7 +204,7 @@
     }
 
     @Override
-    public Drawable mutate() {
+    public @NonNull Drawable mutate() {
         if (!mMutated && super.mutate() == this) {
             mState = new ColorStateListDrawableState(mState);
             mMutated = true;
@@ -226,7 +227,7 @@
      *
      * @param colorStateList A color state list to attach.
      */
-    public void setColorStateList(ColorStateList colorStateList) {
+    public void setColorStateList(@NonNull ColorStateList colorStateList) {
         mState.mColor = colorStateList;
         onStateChange(getState());
     }
@@ -278,7 +279,7 @@
         }
     }
 
-    private ColorStateListDrawable(ColorStateListDrawableState state) {
+    private ColorStateListDrawable(@NonNull ColorStateListDrawableState state) {
         mState = state;
         initializeColorDrawable();
     }
diff --git a/graphics/java/android/graphics/drawable/GradientDrawable.java b/graphics/java/android/graphics/drawable/GradientDrawable.java
index 6ecb621..e58e802 100644
--- a/graphics/java/android/graphics/drawable/GradientDrawable.java
+++ b/graphics/java/android/graphics/drawable/GradientDrawable.java
@@ -17,9 +17,11 @@
 package android.graphics.drawable;
 
 import android.annotation.ColorInt;
+import android.annotation.FloatRange;
 import android.annotation.IntDef;
 import android.annotation.NonNull;
 import android.annotation.Nullable;
+import android.annotation.Px;
 import android.annotation.UnsupportedAppUsage;
 import android.content.pm.ActivityInfo.Config;
 import android.content.res.ColorStateList;
@@ -581,9 +583,9 @@
      * The default value for this property is {@code false}.
      * <p>
      * <strong>Note</strong>: This property corresponds to the
-     * {@code android:useLevel} attribute on the inner {@code &lt;gradient&gt;}
+     * {@code android:useLevel} attribute on the inner {@code <gradient>}
      * tag, NOT the {@code android:useLevel} attribute on the outer
-     * {@code &lt;shape&gt;} tag. For example,
+     * {@code <shape>} tag. For example,
      * <pre>{@code
      * <shape ...>
      *     <gradient
@@ -670,7 +672,7 @@
      * @see #mutate()
      * @see #setColor(int)
      */
-    public void setColors(@ColorInt int[] colors) {
+    public void setColors(@Nullable @ColorInt int[] colors) {
         setColors(colors, null);
     }
 
@@ -690,7 +692,7 @@
      * @see #mutate()
      * @see #setColors(int[])
      */
-    public void setColors(@ColorInt int[] colors, @Nullable float[] offsets) {
+    public void setColors(@Nullable @ColorInt int[] colors, @Nullable float[] offsets) {
         mGradientState.setGradientColors(colors);
         mGradientState.mPositions = offsets;
         mGradientIsDirty = true;
@@ -877,7 +879,11 @@
      * @see #getInnerRadiusRatio()
      * @attr ref android.R.styleable#GradientDrawable_innerRadiusRatio
      */
-    public void setInnerRadiusRatio(float innerRadiusRatio) {
+    public void setInnerRadiusRatio(
+            @FloatRange(from = 0.0f, fromInclusive = false) float innerRadiusRatio) {
+        if (innerRadiusRatio <= 0) {
+            throw new IllegalArgumentException("Ratio must be greater than zero");
+        }
         mGradientState.mInnerRadiusRatio = innerRadiusRatio;
         mPathIsDirty = true;
         invalidateSelf();
@@ -899,7 +905,7 @@
      * @see #getInnerRadius()
      * @attr ref android.R.styleable#GradientDrawable_innerRadius
      */
-    public void setInnerRadius(int innerRadius) {
+    public void setInnerRadius(@Px int innerRadius) {
         mGradientState.mInnerRadius = innerRadius;
         mPathIsDirty = true;
         invalidateSelf();
@@ -911,7 +917,7 @@
      * @see #setInnerRadius(int)
      * @attr ref android.R.styleable#GradientDrawable_innerRadius
      */
-    public int getInnerRadius() {
+    public @Px int getInnerRadius() {
         return mGradientState.mInnerRadius;
     }
 
@@ -921,7 +927,11 @@
      * @see #getThicknessRatio()
      * @attr ref android.R.styleable#GradientDrawable_thicknessRatio
      */
-    public void setThicknessRatio(float thicknessRatio) {
+    public void setThicknessRatio(
+            @FloatRange(from = 0.0f, fromInclusive = false) float thicknessRatio) {
+        if (thicknessRatio <= 0) {
+            throw new IllegalArgumentException("Ratio must be greater than zero");
+        }
         mGradientState.mThicknessRatio = thicknessRatio;
         mPathIsDirty = true;
         invalidateSelf();
@@ -942,7 +952,7 @@
      *
      * @attr ref android.R.styleable#GradientDrawable_thickness
      */
-    public void setThickness(int thickness) {
+    public void setThickness(@Px int thickness) {
         mGradientState.mThickness = thickness;
         mPathIsDirty = true;
         invalidateSelf();
@@ -954,7 +964,7 @@
      * @see #setThickness(int)
      * @attr ref android.R.styleable#GradientDrawable_thickness
      */
-    public int getThickness() {
+    public @Px int getThickness() {
         return mGradientState.mThickness;
     }
 
@@ -970,7 +980,7 @@
      * @attr ref android.R.styleable#GradientDrawablePadding_right
      * @attr ref android.R.styleable#GradientDrawablePadding_bottom
      */
-    public void setPadding(int left, int top, int right, int bottom) {
+    public void setPadding(@Px int left, @Px int top, @Px int right, @Px int bottom) {
         if (mGradientState.mPadding == null) {
             mGradientState.mPadding = new Rect();
         }
diff --git a/graphics/java/android/graphics/drawable/Icon.java b/graphics/java/android/graphics/drawable/Icon.java
index f41cc7e..71dd7a2 100644
--- a/graphics/java/android/graphics/drawable/Icon.java
+++ b/graphics/java/android/graphics/drawable/Icon.java
@@ -840,7 +840,7 @@
         dest.writeInt(PorterDuff.modeToInt(mTintMode));
     }
 
-    public static final Parcelable.Creator<Icon> CREATOR
+    public static final @android.annotation.NonNull Parcelable.Creator<Icon> CREATOR
             = new Parcelable.Creator<Icon>() {
         public Icon createFromParcel(Parcel in) {
             return new Icon(in);
diff --git a/graphics/java/android/graphics/drawable/StateListDrawable.java b/graphics/java/android/graphics/drawable/StateListDrawable.java
index 2855227..f67188c 100644
--- a/graphics/java/android/graphics/drawable/StateListDrawable.java
+++ b/graphics/java/android/graphics/drawable/StateListDrawable.java
@@ -256,7 +256,7 @@
      * @see #getStateCount()
      * @see #getStateDrawable(int)
      */
-    public int[] getStateSet(int index) {
+    public @NonNull int[] getStateSet(int index) {
         return mStateListState.mStateSets[index];
     }
 
@@ -268,7 +268,7 @@
      * @see #getStateCount()
      * @see #getStateSet(int)
      */
-    public Drawable getStateDrawable(int index) {
+    public @Nullable Drawable getStateDrawable(int index) {
         return mStateListState.getChild(index);
     }
 
@@ -280,7 +280,7 @@
      * @see #getStateDrawable(int)
      * @see #getStateSet(int)
      */
-    public int findStateDrawableIndex(int[] stateSet) {
+    public int findStateDrawableIndex(@NonNull int[] stateSet) {
         return mStateListState.indexOfStateSet(stateSet);
     }
 
diff --git a/graphics/java/android/graphics/fonts/Font.java b/graphics/java/android/graphics/fonts/Font.java
index 7f165bf..f715f43 100644
--- a/graphics/java/android/graphics/fonts/Font.java
+++ b/graphics/java/android/graphics/fonts/Font.java
@@ -22,6 +22,7 @@
 import android.content.res.AssetManager;
 import android.content.res.Resources;
 import android.os.LocaleList;
+import android.os.ParcelFileDescriptor;
 import android.util.TypedValue;
 
 import com.android.internal.util.Preconditions;
@@ -31,7 +32,6 @@
 import libcore.util.NativeAllocationRegistry;
 
 import java.io.File;
-import java.io.FileDescriptor;
 import java.io.FileInputStream;
 import java.io.FileNotFoundException;
 import java.io.IOException;
@@ -53,7 +53,7 @@
     /**
      * A builder class for creating new Font.
      */
-    public static class Builder {
+    public static final class Builder {
         private static final NativeAllocationRegistry sAssetByteBufferRegistroy =
                 new NativeAllocationRegistry(ByteBuffer.class.getClassLoader(),
                     nGetReleaseNativeAssetFunc(), 64);
@@ -122,7 +122,7 @@
          *
          * @param fd a file descriptor
          */
-        public Builder(@NonNull FileDescriptor fd) {
+        public Builder(@NonNull ParcelFileDescriptor fd) {
             this(fd, 0, -1);
         }
 
@@ -133,9 +133,9 @@
          * @param offset an offset to of the font data in the file
          * @param size a size of the font data. If -1 is passed, use until end of the file.
          */
-        public Builder(@NonNull FileDescriptor fd, @IntRange(from = 0) long offset,
+        public Builder(@NonNull ParcelFileDescriptor fd, @IntRange(from = 0) long offset,
                 @IntRange(from = -1) long size) {
-            try (FileInputStream fis = new FileInputStream(fd)) {
+            try (FileInputStream fis = new FileInputStream(fd.getFileDescriptor())) {
                 final FileChannel fc = fis.getChannel();
                 size = (size == -1) ? fc.size() - offset : size;
                 mBuffer = fc.map(FileChannel.MapMode.READ_ONLY, offset, size);
@@ -467,7 +467,7 @@
      * @see Builder#setSlant(int)
      * @return a font style
      */
-    public FontStyle getStyle() {
+    public @NonNull FontStyle getStyle() {
         return mFontStyle;
     }
 
diff --git a/graphics/java/android/graphics/fonts/FontFamily.java b/graphics/java/android/graphics/fonts/FontFamily.java
index c0f1b16..4772c1c 100644
--- a/graphics/java/android/graphics/fonts/FontFamily.java
+++ b/graphics/java/android/graphics/fonts/FontFamily.java
@@ -61,7 +61,7 @@
     /**
      * A builder class for creating new FontFamily.
      */
-    public static class Builder {
+    public static final class Builder {
         private static final NativeAllocationRegistry sFamilyRegistory =
                 new NativeAllocationRegistry(FontFamily.class.getClassLoader(),
                     nGetReleaseNativeFamily(), 64);
@@ -152,7 +152,7 @@
      * @param index an index of the font
      * @return a registered font
      */
-    public Font getFont(@IntRange(from = 0) int index) {
+    public @NonNull Font getFont(@IntRange(from = 0) int index) {
         return mFonts.get(index);
     }
 
@@ -161,7 +161,7 @@
      *
      * @return the number of fonts registered in this family.
      */
-    public int getSize() {
+    public @IntRange(from = 1) int getSize() {
         return mFonts.size();
     }
 
diff --git a/graphics/java/android/graphics/text/LineBreaker.java b/graphics/java/android/graphics/text/LineBreaker.java
index 1647909..046bbcf 100644
--- a/graphics/java/android/graphics/text/LineBreaker.java
+++ b/graphics/java/android/graphics/text/LineBreaker.java
@@ -177,10 +177,10 @@
     /**
      * Helper class for creating a {@link LineBreaker}.
      */
-    public static class Builder {
+    public static final class Builder {
         private @BreakStrategy int mBreakStrategy = BREAK_STRATEGY_SIMPLE;
         private @HyphenationFrequency int mHyphenationFrequency = HYPHENATION_FREQUENCY_NONE;
-        private @JustificationMode int mJustified = JUSTIFICATION_MODE_NONE;
+        private @JustificationMode int mJustificationMode = JUSTIFICATION_MODE_NONE;
         private @Nullable int[] mIndents = null;
 
         /**
@@ -189,7 +189,7 @@
          * You can change the line breaking behavior by setting break strategy. The default value is
          * {@link #BREAK_STRATEGY_SIMPLE}.
          */
-        public Builder setBreakStrategy(@BreakStrategy int breakStrategy) {
+        public @NonNull Builder setBreakStrategy(@BreakStrategy int breakStrategy) {
             mBreakStrategy = breakStrategy;
             return this;
         }
@@ -200,7 +200,8 @@
          * You can change the amount of automatic hyphenation used. The default value is
          * {@link #HYPHENATION_FREQUENCY_NONE}.
          */
-        public Builder setHyphenationFrequency(@HyphenationFrequency int hyphenationFrequency) {
+        public @NonNull Builder setHyphenationFrequency(
+                @HyphenationFrequency int hyphenationFrequency) {
             mHyphenationFrequency = hyphenationFrequency;
             return this;
         }
@@ -212,8 +213,8 @@
          * internal parameters for justification.
          * The default value is {@link #JUSTIFICATION_MODE_NONE}
          */
-        public Builder setJustified(@JustificationMode int justified) {
-            mJustified = justified;
+        public @NonNull Builder setJustificationMode(@JustificationMode int justificationMode) {
+            mJustificationMode = justificationMode;
             return this;
         }
 
@@ -224,7 +225,7 @@
          * amount is the sum of both left and right indentations. For lines past the last element in
          * the array, the indentation amount of the last element is used.
          */
-        public Builder setIndents(@Nullable int[] indents) {
+        public @NonNull Builder setIndents(@Nullable int[] indents) {
             mIndents = indents;
             return this;
         }
@@ -234,8 +235,9 @@
          *
          * You can reuse the Builder instance even after calling this method.
          */
-        public LineBreaker build() {
-            return new LineBreaker(mBreakStrategy, mHyphenationFrequency, mJustified, mIndents);
+        public @NonNull LineBreaker build() {
+            return new LineBreaker(mBreakStrategy, mHyphenationFrequency, mJustificationMode,
+                    mIndents);
         }
     }
 
@@ -412,7 +414,7 @@
         }
 
         /**
-         * Returns a packed packed hyphen edit for the line.
+         * Returns a packed hyphen edit for the line.
          *
          * @param lineIndex an index of the line.
          * @return a packed hyphen edit for the line.
@@ -451,7 +453,7 @@
      * @param constraints for a single paragraph
      * @param lineNumber a line number of this paragraph
      */
-    public Result computeLineBreaks(
+    public @NonNull Result computeLineBreaks(
             @NonNull MeasuredText measuredPara,
             @NonNull ParagraphConstraints constraints,
             @IntRange(from = 0) int lineNumber) {
diff --git a/graphics/java/android/graphics/text/MeasuredText.java b/graphics/java/android/graphics/text/MeasuredText.java
index 2536619..480aff2 100644
--- a/graphics/java/android/graphics/text/MeasuredText.java
+++ b/graphics/java/android/graphics/text/MeasuredText.java
@@ -168,7 +168,7 @@
      *
      * Note: The appendStyle and appendReplacementRun should be called to cover the text length.
      */
-    public static class Builder {
+    public static final class Builder {
         private static final NativeAllocationRegistry sRegistry = new NativeAllocationRegistry(
                 MeasuredText.class.getClassLoader(), nGetReleaseFunc(), 1024);
 
@@ -227,7 +227,7 @@
          *               text
          * @param isRtl true if the text is in RTL context, otherwise false.
          */
-        public Builder appendStyleRun(@NonNull Paint paint, @IntRange(from = 0) int length,
+        public @NonNull Builder appendStyleRun(@NonNull Paint paint, @IntRange(from = 0) int length,
                 boolean isRtl) {
             Preconditions.checkNotNull(paint);
             Preconditions.checkArgument(length > 0, "length can not be negative");
@@ -253,8 +253,8 @@
          *               text
          * @param width a replacement width of the range
          */
-        public Builder appendReplacementRun(@NonNull Paint paint,
-                @IntRange(from = 0) int length, @FloatRange(from = 0) float width) {
+        public @NonNull Builder appendReplacementRun(@NonNull Paint paint,
+                @IntRange(from = 0) int length, @Px @FloatRange(from = 0) float width) {
             Preconditions.checkArgument(length > 0, "length can not be negative");
             final int end = mCurrentOffset + length;
             Preconditions.checkArgument(end <= mText.length, "Replacement exceeds the text length");
@@ -275,7 +275,7 @@
          *
          * @param computeHyphenation true if you want to use automatic hyphenations.
          */
-        public Builder setComputeHyphenation(boolean computeHyphenation) {
+        public @NonNull Builder setComputeHyphenation(boolean computeHyphenation) {
             mComputeHyphenation = computeHyphenation;
             return this;
         }
@@ -292,7 +292,7 @@
          *
          * @param computeLayout true if you want to retrieve full layout info, e.g. bbox.
          */
-        public Builder setComputeLayout(boolean computeLayout) {
+        public @NonNull Builder setComputeLayout(boolean computeLayout) {
             mComputeLayout = computeLayout;
             return this;
         }
@@ -305,7 +305,7 @@
          * @throws IllegalStateException if the whole text is not covered by one or more runs (style
          *                               or replacement)
          */
-        public MeasuredText build() {
+        public @NonNull MeasuredText build() {
             ensureNativePtrNoReuse();
             if (mCurrentOffset != mText.length) {
                 throw new IllegalStateException("Style info has not been provided for all text.");
diff --git a/keystore/java/android/security/Credentials.java b/keystore/java/android/security/Credentials.java
index 2ae28f5..08f4176 100644
--- a/keystore/java/android/security/Credentials.java
+++ b/keystore/java/android/security/Credentials.java
@@ -20,6 +20,7 @@
 import com.android.org.bouncycastle.util.io.pem.PemReader;
 import com.android.org.bouncycastle.util.io.pem.PemWriter;
 
+import android.annotation.UnsupportedAppUsage;
 import java.io.ByteArrayInputStream;
 import java.io.ByteArrayOutputStream;
 import java.io.IOException;
@@ -122,6 +123,7 @@
      * Convert objects to a PEM format which is used for
      * CA_CERTIFICATE and USER_CERTIFICATE entries.
      */
+    @UnsupportedAppUsage
     public static byte[] convertToPem(Certificate... objects)
             throws IOException, CertificateEncodingException {
         ByteArrayOutputStream bao = new ByteArrayOutputStream();
diff --git a/keystore/java/android/security/IKeyChainService.aidl b/keystore/java/android/security/IKeyChainService.aidl
index 0d32075..b3cdff7 100644
--- a/keystore/java/android/security/IKeyChainService.aidl
+++ b/keystore/java/android/security/IKeyChainService.aidl
@@ -27,6 +27,7 @@
  */
 interface IKeyChainService {
     // APIs used by KeyChain
+    @UnsupportedAppUsage
     String requestPrivateKey(String alias);
     byte[] getCertificate(String alias);
     byte[] getCaCertificates(String alias);
diff --git a/keystore/java/android/security/keystore/DeviceIdAttestationException.java b/keystore/java/android/security/keystore/DeviceIdAttestationException.java
index 13f50b1..8ba0317 100644
--- a/keystore/java/android/security/keystore/DeviceIdAttestationException.java
+++ b/keystore/java/android/security/keystore/DeviceIdAttestationException.java
@@ -16,6 +16,7 @@
 
 package android.security.keystore;
 
+import android.annotation.Nullable;
 import android.annotation.SystemApi;
 import android.annotation.TestApi;
 
@@ -33,7 +34,7 @@
      *
      * @param detailMessage the detail message for this exception.
      */
-    public DeviceIdAttestationException(String detailMessage) {
+    public DeviceIdAttestationException(@Nullable String detailMessage) {
         super(detailMessage);
     }
 
@@ -44,7 +45,7 @@
      * @param message the detail message for this exception.
      * @param cause the cause of this exception, may be {@code null}.
      */
-    public DeviceIdAttestationException(String message, Throwable cause) {
+    public DeviceIdAttestationException(@Nullable String message, @Nullable Throwable cause) {
         super(message, cause);
     }
 }
diff --git a/keystore/java/android/security/keystore/KeystoreResponse.java b/keystore/java/android/security/keystore/KeystoreResponse.java
index 3a229cb..529351e 100644
--- a/keystore/java/android/security/keystore/KeystoreResponse.java
+++ b/keystore/java/android/security/keystore/KeystoreResponse.java
@@ -30,7 +30,7 @@
     public final int error_code_;
     public final String error_msg_;
 
-    public static final Parcelable.Creator<KeystoreResponse> CREATOR = new
+    public static final @android.annotation.NonNull Parcelable.Creator<KeystoreResponse> CREATOR = new
             Parcelable.Creator<KeystoreResponse>() {
                 @Override
                 public KeystoreResponse createFromParcel(Parcel in) {
diff --git a/keystore/java/android/security/keystore/ParcelableKeyGenParameterSpec.java b/keystore/java/android/security/keystore/ParcelableKeyGenParameterSpec.java
index 8231dc9..d8030fb 100644
--- a/keystore/java/android/security/keystore/ParcelableKeyGenParameterSpec.java
+++ b/keystore/java/android/security/keystore/ParcelableKeyGenParameterSpec.java
@@ -193,7 +193,7 @@
                 unlockedDeviceRequired);
     }
 
-    public static final Creator<ParcelableKeyGenParameterSpec> CREATOR = new Creator<ParcelableKeyGenParameterSpec>() {
+    public static final @android.annotation.NonNull Creator<ParcelableKeyGenParameterSpec> CREATOR = new Creator<ParcelableKeyGenParameterSpec>() {
         @Override
         public ParcelableKeyGenParameterSpec createFromParcel(Parcel in) {
             return new ParcelableKeyGenParameterSpec(in);
diff --git a/keystore/tests/Android.mk b/keystore/tests/Android.mk
index 596e5f5..99d3197 100644
--- a/keystore/tests/Android.mk
+++ b/keystore/tests/Android.mk
@@ -21,7 +21,7 @@
 LOCAL_SRC_FILES := $(call all-java-files-under, src)
 
 LOCAL_STATIC_JAVA_LIBRARIES := \
-    android-support-test
+    androidx.test.rules hamcrest-library
 
 LOCAL_PACKAGE_NAME := KeystoreTests
 LOCAL_PRIVATE_PLATFORM_APIS := true
diff --git a/keystore/tests/AndroidManifest.xml b/keystore/tests/AndroidManifest.xml
index 9bf2d0c..6833cd1 100644
--- a/keystore/tests/AndroidManifest.xml
+++ b/keystore/tests/AndroidManifest.xml
@@ -20,7 +20,7 @@
         <uses-library android:name="android.test.runner" />
     </application>
 
-    <instrumentation android:name="android.support.test.runner.AndroidJUnitRunner"
+    <instrumentation android:name="androidx.test.runner.AndroidJUnitRunner"
         android:targetPackage="android.security.tests"
         android:label="Tests for Keystore">
     </instrumentation>
diff --git a/keystore/tests/src/android/security/ParcelableKeyGenParameterSpecTest.java b/keystore/tests/src/android/security/ParcelableKeyGenParameterSpecTest.java
index 32f8ec4..fca2775 100644
--- a/keystore/tests/src/android/security/ParcelableKeyGenParameterSpecTest.java
+++ b/keystore/tests/src/android/security/ParcelableKeyGenParameterSpecTest.java
@@ -22,16 +22,20 @@
 
 import android.os.Parcel;
 import android.security.keystore.KeyGenParameterSpec;
-import android.security.keystore.ParcelableKeyGenParameterSpec;
 import android.security.keystore.KeyProperties;
-import android.support.test.runner.AndroidJUnit4;
+import android.security.keystore.ParcelableKeyGenParameterSpec;
+
+import androidx.test.runner.AndroidJUnit4;
+
+import org.junit.Test;
+import org.junit.runner.RunWith;
+
 import java.math.BigInteger;
 import java.security.spec.ECGenParameterSpec;
 import java.security.spec.RSAKeyGenParameterSpec;
 import java.util.Date;
+
 import javax.security.auth.x500.X500Principal;
-import org.junit.Test;
-import org.junit.runner.RunWith;
 
 /** Unit tests for {@link ParcelableKeyGenParameterSpec}. */
 @RunWith(AndroidJUnit4.class)
diff --git a/keystore/tests/src/android/security/keystore/KeyGenParameterSpecTest.java b/keystore/tests/src/android/security/keystore/KeyGenParameterSpecTest.java
index 865cad4..b2edfd0 100644
--- a/keystore/tests/src/android/security/keystore/KeyGenParameterSpecTest.java
+++ b/keystore/tests/src/android/security/keystore/KeyGenParameterSpecTest.java
@@ -20,10 +20,12 @@
 import static org.junit.Assert.assertEquals;
 import static org.junit.Assert.assertThat;
 
+import android.security.ParcelableKeyGenParameterSpecTest;
 import android.security.keystore.KeyGenParameterSpec;
 import android.security.keystore.KeyProperties;
-import android.security.ParcelableKeyGenParameterSpecTest;
-import android.support.test.runner.AndroidJUnit4;
+
+import androidx.test.runner.AndroidJUnit4;
+
 import org.junit.Test;
 import org.junit.runner.RunWith;
 
diff --git a/libs/androidfw/AssetManager2.cpp b/libs/androidfw/AssetManager2.cpp
index d7b84ff..d74f27c 100644
--- a/libs/androidfw/AssetManager2.cpp
+++ b/libs/androidfw/AssetManager2.cpp
@@ -35,6 +35,12 @@
 #endif
 #endif
 
+#ifdef __ANDROID__
+#define ANDROID_LOG(x) LOG(x)
+#else
+#define ANDROID_LOG(x) std::stringstream()
+#endif
+
 #include "androidfw/ResourceUtils.h"
 
 namespace android {
@@ -380,7 +386,8 @@
 
   const uint8_t package_idx = package_ids_[package_id];
   if (package_idx == 0xff) {
-    LOG(ERROR) << base::StringPrintf("No package ID %02x found for ID 0x%08x.", package_id, resid);
+    ANDROID_LOG(ERROR) << base::StringPrintf("No package ID %02x found for ID 0x%08x.",
+                                             package_id, resid);
     return kInvalidCookie;
   }
 
@@ -1045,6 +1052,8 @@
 }
 
 void AssetManager2::InvalidateCaches(uint32_t diff) {
+  cached_bag_resid_stacks_.clear();
+
   if (diff == 0xffffffffu) {
     // Everything must go.
     cached_bags_.clear();
diff --git a/libs/androidfw/AttributeResolution.cpp b/libs/androidfw/AttributeResolution.cpp
index cc177af..e62fb61 100644
--- a/libs/androidfw/AttributeResolution.cpp
+++ b/libs/androidfw/AttributeResolution.cpp
@@ -388,7 +388,7 @@
     out_values[STYLE_RESOURCE_ID] = resid;
     out_values[STYLE_CHANGING_CONFIGURATIONS] = type_set_flags;
     out_values[STYLE_DENSITY] = config.density;
-    out_values[SYTLE_SOURCE_RESOURCE_ID] = value_source_resid;
+    out_values[STYLE_SOURCE_RESOURCE_ID] = value_source_resid;
 
     if (value.dataType != Res_value::TYPE_NULL || value.data == Res_value::DATA_NULL_EMPTY) {
       indices_idx++;
diff --git a/libs/androidfw/include/androidfw/AttributeResolution.h b/libs/androidfw/include/androidfw/AttributeResolution.h
index 0cc1d3c..d71aad2 100644
--- a/libs/androidfw/include/androidfw/AttributeResolution.h
+++ b/libs/androidfw/include/androidfw/AttributeResolution.h
@@ -33,7 +33,7 @@
   STYLE_RESOURCE_ID = 3,
   STYLE_CHANGING_CONFIGURATIONS = 4,
   STYLE_DENSITY = 5,
-  SYTLE_SOURCE_RESOURCE_ID = 6
+  STYLE_SOURCE_RESOURCE_ID = 6
 };
 
 // These are all variations of the same method. They each perform the exact same operation,
diff --git a/libs/hwui/Android.bp b/libs/hwui/Android.bp
index 793dd8d..4f1b2a4 100644
--- a/libs/hwui/Android.bp
+++ b/libs/hwui/Android.bp
@@ -69,6 +69,7 @@
         "libminikin",
         "libandroidfw",
         "libcrypto",
+        "libsync",
     ],
     static_libs: [
         "libEGL_blobCache",
@@ -180,6 +181,7 @@
         "renderthread/EglManager.cpp",
         "renderthread/ReliableSurface.cpp",
         "renderthread/VulkanManager.cpp",
+        "renderthread/VulkanSurface.cpp",
         "renderthread/RenderProxy.cpp",
         "renderthread/RenderTask.cpp",
         "renderthread/RenderThread.cpp",
diff --git a/libs/hwui/Layer.cpp b/libs/hwui/Layer.cpp
index a15ff22..c174c24 100644
--- a/libs/hwui/Layer.cpp
+++ b/libs/hwui/Layer.cpp
@@ -19,8 +19,6 @@
 #include "renderstate/RenderState.h"
 #include "utils/Color.h"
 
-#include <SkToSRGBColorFilter.h>
-
 namespace android {
 namespace uirenderer {
 
diff --git a/libs/hwui/Readback.cpp b/libs/hwui/Readback.cpp
index 2ffda83..fe633e9 100644
--- a/libs/hwui/Readback.cpp
+++ b/libs/hwui/Readback.cpp
@@ -20,7 +20,6 @@
 #include "renderthread/EglManager.h"
 #include "renderthread/VulkanManager.h"
 
-#include <SkToSRGBColorFilter.h>
 #include <gui/Surface.h>
 #include <ui/Fence.h>
 #include <ui/GraphicBuffer.h>
diff --git a/libs/hwui/RenderNode.cpp b/libs/hwui/RenderNode.cpp
index 1ff7ffe..e0ed3e4 100644
--- a/libs/hwui/RenderNode.cpp
+++ b/libs/hwui/RenderNode.cpp
@@ -134,6 +134,7 @@
 
 void RenderNode::damageSelf(TreeInfo& info) {
     if (isRenderable()) {
+        mDamageGenerationId = info.damageGenerationId;
         if (properties().getClipDamageToBounds()) {
             info.damageAccumulator->dirty(0, 0, properties().getWidth(), properties().getHeight());
         } else {
@@ -199,6 +200,12 @@
  * stencil buffer may be needed. Views that use a functor to draw will be forced onto a layer.
  */
 void RenderNode::prepareTreeImpl(TreeObserver& observer, TreeInfo& info, bool functorsNeedLayer) {
+    if (mDamageGenerationId == info.damageGenerationId) {
+        // We hit the same node a second time in the same tree. We don't know the minimal
+        // damage rect anymore, so just push the biggest we can onto our parent's transform
+        // We push directly onto parent in case we are clipped to bounds but have moved position.
+        info.damageAccumulator->dirty(DIRTY_MIN, DIRTY_MIN, DIRTY_MAX, DIRTY_MAX);
+    }
     info.damageAccumulator->pushTransform(this);
 
     if (info.mode == TreeInfo::MODE_FULL) {
diff --git a/libs/hwui/RenderNode.h b/libs/hwui/RenderNode.h
index 6060123..23e7a0e 100644
--- a/libs/hwui/RenderNode.h
+++ b/libs/hwui/RenderNode.h
@@ -255,6 +255,8 @@
     DisplayList* mDisplayList;
     DisplayList* mStagingDisplayList;
 
+    int64_t mDamageGenerationId;
+
     friend class AnimatorManager;
     AnimatorManager mAnimatorManager;
 
diff --git a/libs/hwui/TEST_MAPPING b/libs/hwui/TEST_MAPPING
new file mode 100644
index 0000000..d9f2acb
--- /dev/null
+++ b/libs/hwui/TEST_MAPPING
@@ -0,0 +1,13 @@
+{
+  "presubmit": [
+    {
+      "name": "CtsUiRenderingTestCases"
+    },
+    {
+      "name": "CtsGraphicsTestCases"
+    },
+    {
+      "name": "CtsAccelerationTestCases"
+    }
+  ]
+}
\ No newline at end of file
diff --git a/libs/hwui/TreeInfo.cpp b/libs/hwui/TreeInfo.cpp
index 808a12a..cdad20e 100644
--- a/libs/hwui/TreeInfo.cpp
+++ b/libs/hwui/TreeInfo.cpp
@@ -24,6 +24,7 @@
         : mode(mode)
         , prepareTextures(mode == MODE_FULL)
         , canvasContext(canvasContext)
+        , damageGenerationId(canvasContext.getFrameNumber())
         , disableForceDark(canvasContext.useForceDark() ? 0 : 1) {}
 
 }  // namespace android::uirenderer
diff --git a/libs/hwui/TreeInfo.h b/libs/hwui/TreeInfo.h
index a0d9605..04eabac 100644
--- a/libs/hwui/TreeInfo.h
+++ b/libs/hwui/TreeInfo.h
@@ -87,6 +87,7 @@
 
     // Must not be null during actual usage
     DamageAccumulator* damageAccumulator = nullptr;
+    int64_t damageGenerationId = 0;
 
     LayerUpdateQueue* layerUpdateQueue = nullptr;
     ErrorHandler* errorHandler = nullptr;
diff --git a/libs/hwui/pipeline/skia/SkiaVulkanPipeline.cpp b/libs/hwui/pipeline/skia/SkiaVulkanPipeline.cpp
index 87cffb5..edde6d3 100644
--- a/libs/hwui/pipeline/skia/SkiaVulkanPipeline.cpp
+++ b/libs/hwui/pipeline/skia/SkiaVulkanPipeline.cpp
@@ -55,20 +55,8 @@
 }
 
 Frame SkiaVulkanPipeline::getFrame() {
-    LOG_ALWAYS_FATAL_IF(mVkSurface == nullptr,
-                        "drawRenderNode called on a context with no surface!");
-
-    SkSurface* backBuffer = mVkManager.getBackbufferSurface(&mVkSurface);
-    LOG_ALWAYS_FATAL_IF(mVkSurface == nullptr,
-                        "drawRenderNode called on a context with an invalid surface");
-    if (backBuffer == nullptr) {
-        SkDebugf("failed to get backbuffer");
-        return Frame(-1, -1, 0);
-    }
-
-    Frame frame(mVkSurface->windowWidth(), mVkSurface->windowHeight(),
-                mVkManager.getAge(mVkSurface));
-    return frame;
+    LOG_ALWAYS_FATAL_IF(mVkSurface == nullptr, "getFrame() called on a context with no surface!");
+    return mVkManager.dequeueNextBuffer(mVkSurface);
 }
 
 bool SkiaVulkanPipeline::draw(const Frame& frame, const SkRect& screenDirty, const SkRect& dirty,
@@ -77,13 +65,13 @@
                               bool opaque, const LightInfo& lightInfo,
                               const std::vector<sp<RenderNode>>& renderNodes,
                               FrameInfoVisualizer* profiler) {
-    sk_sp<SkSurface> backBuffer = mVkSurface->getBackBufferSurface();
+    sk_sp<SkSurface> backBuffer = mVkSurface->getCurrentSkSurface();
     if (backBuffer.get() == nullptr) {
         return false;
     }
     SkiaPipeline::updateLighting(lightGeometry, lightInfo);
     renderFrame(*layerUpdateQueue, dirty, renderNodes, opaque, contentDrawBounds,
-            backBuffer, mVkSurface->preTransform());
+            backBuffer, mVkSurface->getCurrentPreTransform());
     ShaderCache::get().onVkFrameFlushed(mRenderThread.getGrContext());
     layerUpdateQueue->clear();
 
@@ -113,7 +101,7 @@
     currentFrameInfo->markSwapBuffers();
 
     if (*requireSwap) {
-        mVkManager.swapBuffers(mVkSurface);
+        mVkManager.swapBuffers(mVkSurface, screenDirty);
     }
 
     return *requireSwap;
diff --git a/libs/hwui/pipeline/skia/SkiaVulkanPipeline.h b/libs/hwui/pipeline/skia/SkiaVulkanPipeline.h
index 2c24edd..77a7ab1 100644
--- a/libs/hwui/pipeline/skia/SkiaVulkanPipeline.h
+++ b/libs/hwui/pipeline/skia/SkiaVulkanPipeline.h
@@ -18,6 +18,7 @@
 
 #include "SkiaPipeline.h"
 #include "renderthread/VulkanManager.h"
+#include "renderthread/VulkanSurface.h"
 
 #include "renderstate/RenderState.h"
 
diff --git a/libs/hwui/renderthread/CacheManager.cpp b/libs/hwui/renderthread/CacheManager.cpp
index 6da8062..6c04232 100644
--- a/libs/hwui/renderthread/CacheManager.cpp
+++ b/libs/hwui/renderthread/CacheManager.cpp
@@ -117,6 +117,7 @@
     auto& cache = skiapipeline::ShaderCache::get();
     cache.initShaderDiskCache(identity, size);
     contextOptions->fPersistentCache = &cache;
+    contextOptions->fGpuPathRenderers &= ~GpuPathRenderers::kCoverageCounting;
 }
 
 void CacheManager::trimMemory(TrimMemoryMode mode) {
diff --git a/libs/hwui/renderthread/CanvasContext.cpp b/libs/hwui/renderthread/CanvasContext.cpp
index 8e57a3a..091775dbe7 100644
--- a/libs/hwui/renderthread/CanvasContext.cpp
+++ b/libs/hwui/renderthread/CanvasContext.cpp
@@ -401,11 +401,11 @@
     SkRect dirty;
     mDamageAccumulator.finish(&dirty);
 
-    // TODO: Re-enable after figuring out cause of b/22592975
-    //    if (dirty.isEmpty() && Properties::skipEmptyFrames) {
-    //        mCurrentFrameInfo->addFlag(FrameInfoFlags::SkippedFrame);
-    //        return;
-    //    }
+    if (dirty.isEmpty() && Properties::skipEmptyFrames
+            && !surfaceRequiresRedraw()) {
+        mCurrentFrameInfo->addFlag(FrameInfoFlags::SkippedFrame);
+        return;
+    }
 
     mCurrentFrameInfo->markIssueDrawCommandsStart();
 
@@ -638,6 +638,19 @@
     return mFrameNumber;
 }
 
+bool CanvasContext::surfaceRequiresRedraw() {
+    if (!mNativeSurface) return false;
+    if (mHaveNewSurface) return true;
+
+    int width = -1;
+    int height = -1;
+    ReliableSurface* surface = mNativeSurface.get();
+    surface->query(NATIVE_WINDOW_WIDTH, &width);
+    surface->query(NATIVE_WINDOW_HEIGHT, &height);
+
+    return width == mLastFrameWidth && height == mLastFrameHeight;
+}
+
 SkRect CanvasContext::computeDirtyRect(const Frame& frame, SkRect* dirty) {
     if (frame.width() != mLastFrameWidth || frame.height() != mLastFrameHeight) {
         // can't rely on prior content of window if viewport size changes
diff --git a/libs/hwui/renderthread/CanvasContext.h b/libs/hwui/renderthread/CanvasContext.h
index db97763..4da0eac 100644
--- a/libs/hwui/renderthread/CanvasContext.h
+++ b/libs/hwui/renderthread/CanvasContext.h
@@ -217,6 +217,7 @@
     void freePrefetchedLayers();
 
     bool isSwapChainStuffed();
+    bool surfaceRequiresRedraw();
 
     SkRect computeDirtyRect(const Frame& frame, SkRect* dirty);
 
diff --git a/libs/hwui/renderthread/VulkanManager.cpp b/libs/hwui/renderthread/VulkanManager.cpp
index 3b43f12..d4c6eae 100644
--- a/libs/hwui/renderthread/VulkanManager.cpp
+++ b/libs/hwui/renderthread/VulkanManager.cpp
@@ -16,6 +16,7 @@
 
 #include "VulkanManager.h"
 
+#include <android/sync.h>
 #include <gui/Surface.h>
 
 #include "Properties.h"
@@ -23,6 +24,7 @@
 #include "renderstate/RenderState.h"
 #include "utils/FatVector.h"
 
+#include <GrBackendSemaphore.h>
 #include <GrBackendSurface.h>
 #include <GrContext.h>
 #include <GrTypes.h>
@@ -142,6 +144,7 @@
     GET_INST_PROC(GetPhysicalDeviceProperties);
     GET_INST_PROC(GetPhysicalDeviceQueueFamilyProperties);
     GET_INST_PROC(GetPhysicalDeviceFeatures2);
+    GET_INST_PROC(GetPhysicalDeviceImageFormatProperties2);
     GET_INST_PROC(CreateDevice);
     GET_INST_PROC(EnumerateDeviceExtensionProperties);
     GET_INST_PROC(CreateAndroidSurfaceKHR);
@@ -254,10 +257,36 @@
 
     float queuePriorities[1] = { 0.0 };
 
+    void* queueNextPtr = nullptr;
+
+    VkDeviceQueueGlobalPriorityCreateInfoEXT queuePriorityCreateInfo;
+
+    if (Properties::contextPriority != 0
+            && grExtensions.hasExtension(VK_EXT_GLOBAL_PRIORITY_EXTENSION_NAME, 2)) {
+        memset(&queuePriorityCreateInfo, 0, sizeof(VkDeviceQueueGlobalPriorityCreateInfoEXT));
+        queuePriorityCreateInfo.sType =
+            VK_STRUCTURE_TYPE_DEVICE_QUEUE_GLOBAL_PRIORITY_CREATE_INFO_EXT;
+        queuePriorityCreateInfo.pNext = nullptr;
+        switch (Properties::contextPriority) {
+            case EGL_CONTEXT_PRIORITY_LOW_IMG:
+                queuePriorityCreateInfo.globalPriority = VK_QUEUE_GLOBAL_PRIORITY_LOW_EXT;
+                break;
+            case EGL_CONTEXT_PRIORITY_MEDIUM_IMG:
+                queuePriorityCreateInfo.globalPriority = VK_QUEUE_GLOBAL_PRIORITY_MEDIUM_EXT;
+                break;
+            case EGL_CONTEXT_PRIORITY_HIGH_IMG:
+                queuePriorityCreateInfo.globalPriority = VK_QUEUE_GLOBAL_PRIORITY_HIGH_EXT;
+                break;
+            default:
+                LOG_ALWAYS_FATAL("Unsupported context priority");
+         }
+         queueNextPtr = &queuePriorityCreateInfo;
+    }
+
     const VkDeviceQueueCreateInfo queueInfo[2] = {
         {
             VK_STRUCTURE_TYPE_DEVICE_QUEUE_CREATE_INFO, // sType
-            nullptr,                                    // pNext
+            queueNextPtr,                               // pNext
             0,                                          // VkDeviceQueueCreateFlags
             mGraphicsQueueIndex,                        // queueFamilyIndex
             1,                                          // queueCount
@@ -265,7 +294,7 @@
         },
         {
             VK_STRUCTURE_TYPE_DEVICE_QUEUE_CREATE_INFO, // sType
-            nullptr,                                    // pNext
+            queueNextPtr,                               // pNext
             0,                                          // VkDeviceQueueCreateFlags
             mPresentQueueIndex,                         // queueFamilyIndex
             1,                                          // queueCount
@@ -292,11 +321,6 @@
     GET_DEV_PROC(GetDeviceQueue);
     GET_DEV_PROC(DeviceWaitIdle);
     GET_DEV_PROC(DestroyDevice);
-    GET_DEV_PROC(CreateSwapchainKHR);
-    GET_DEV_PROC(DestroySwapchainKHR);
-    GET_DEV_PROC(GetSwapchainImagesKHR);
-    GET_DEV_PROC(AcquireNextImageKHR);
-    GET_DEV_PROC(QueuePresentKHR);
     GET_DEV_PROC(CreateCommandPool);
     GET_DEV_PROC(DestroyCommandPool);
     GET_DEV_PROC(AllocateCommandBuffers);
@@ -400,201 +424,102 @@
     };
 }
 
-// Returns the next BackbufferInfo to use for the next draw. The function will make sure all
-// previous uses have finished before returning.
-VulkanSurface::BackbufferInfo* VulkanManager::getAvailableBackbuffer(VulkanSurface* surface) {
-    SkASSERT(surface->mBackbuffers);
+Frame VulkanManager::dequeueNextBuffer(VulkanSurface* surface) {
 
-    ++surface->mCurrentBackbufferIndex;
-    if (surface->mCurrentBackbufferIndex > surface->mImageCount) {
-        surface->mCurrentBackbufferIndex = 0;
+    VulkanSurface::NativeBufferInfo* bufferInfo = surface->dequeueNativeBuffer();
+
+    if (bufferInfo == nullptr) {
+        ALOGE("VulkanSurface::dequeueNativeBuffer called with an invalid surface!");
+        return Frame(-1, -1, 0);
     }
 
-    VulkanSurface::BackbufferInfo* backbuffer =
-            surface->mBackbuffers + surface->mCurrentBackbufferIndex;
+    LOG_ALWAYS_FATAL_IF(!bufferInfo->dequeued);
 
-    // Before we reuse a backbuffer, make sure its fences have all signaled so that we can safely
-    // reuse its commands buffers.
-    VkResult res = mWaitForFences(mDevice, 2, backbuffer->mUsageFences, true, UINT64_MAX);
-    if (res != VK_SUCCESS) {
-        return nullptr;
+    if (bufferInfo->dequeue_fence != -1) {
+        int fence_clone = dup(bufferInfo->dequeue_fence);
+        if (fence_clone == -1) {
+            ALOGE("dup(fence) failed, stalling until signalled: %s (%d)", strerror(errno), errno);
+            sync_wait(bufferInfo->dequeue_fence, -1 /* forever */);
+        } else {
+            VkSemaphoreCreateInfo semaphoreInfo;
+            semaphoreInfo.sType = VK_STRUCTURE_TYPE_SEMAPHORE_CREATE_INFO;
+            semaphoreInfo.pNext = nullptr;
+            semaphoreInfo.flags = 0;
+            VkSemaphore semaphore;
+            VkResult err = mCreateSemaphore(mDevice, &semaphoreInfo, nullptr, &semaphore);
+            LOG_ALWAYS_FATAL_IF(VK_SUCCESS != err, "Failed to create import semaphore, err: %d",
+                                err);
+
+            VkImportSemaphoreFdInfoKHR importInfo;
+            importInfo.sType = VK_STRUCTURE_TYPE_IMPORT_SEMAPHORE_FD_INFO_KHR;
+            importInfo.pNext = nullptr;
+            importInfo.semaphore = semaphore;
+            importInfo.flags = VK_SEMAPHORE_IMPORT_TEMPORARY_BIT;
+            importInfo.handleType = VK_EXTERNAL_SEMAPHORE_HANDLE_TYPE_SYNC_FD_BIT;
+            importInfo.fd = fence_clone;
+
+            err = mImportSemaphoreFdKHR(mDevice, &importInfo);
+            LOG_ALWAYS_FATAL_IF(VK_SUCCESS != err, "Failed to import semaphore, err: %d", err);
+
+            GrBackendSemaphore backendSemaphore;
+            backendSemaphore.initVulkan(semaphore);
+            bufferInfo->skSurface->wait(1, &backendSemaphore);
+        }
     }
 
-    return backbuffer;
+    int bufferAge = (mSwapBehavior == SwapBehavior::Discard) ? 0 : surface->getCurrentBuffersAge();
+    return Frame(surface->logicalWidth(), surface->logicalHeight(), bufferAge);
 }
 
-static SkMatrix getPreTransformMatrix(int width, int height,
-                                      VkSurfaceTransformFlagBitsKHR transform) {
-    switch (transform) {
-        case VK_SURFACE_TRANSFORM_IDENTITY_BIT_KHR:
-            return SkMatrix::I();
-        case VK_SURFACE_TRANSFORM_ROTATE_90_BIT_KHR:
-            return SkMatrix::MakeAll(0, -1, height, 1, 0, 0, 0, 0, 1);
-        case VK_SURFACE_TRANSFORM_ROTATE_180_BIT_KHR:
-            return SkMatrix::MakeAll(-1, 0, width, 0, -1, height, 0, 0, 1);
-        case VK_SURFACE_TRANSFORM_ROTATE_270_BIT_KHR:
-            return SkMatrix::MakeAll(0, 1, 0, -1, 0, width, 0, 0, 1);
-        case VK_SURFACE_TRANSFORM_HORIZONTAL_MIRROR_BIT_KHR:
-            return SkMatrix::MakeAll(-1, 0, width, 0, 1, 0, 0, 0, 1);
-        case VK_SURFACE_TRANSFORM_HORIZONTAL_MIRROR_ROTATE_90_BIT_KHR:
-            return SkMatrix::MakeAll(0, -1, height, -1, 0, width, 0, 0, 1);
-        case VK_SURFACE_TRANSFORM_HORIZONTAL_MIRROR_ROTATE_180_BIT_KHR:
-            return SkMatrix::MakeAll(1, 0, 0, 0, -1, height, 0, 0, 1);
-        case VK_SURFACE_TRANSFORM_HORIZONTAL_MIRROR_ROTATE_270_BIT_KHR:
-            return SkMatrix::MakeAll(0, 1, 0, 1, 0, 0, 0, 0, 1);
-        default:
-            LOG_ALWAYS_FATAL("Unsupported pre transform of swapchain.");
-    }
-    return SkMatrix::I();
-}
-
-
-SkSurface* VulkanManager::getBackbufferSurface(VulkanSurface** surfaceOut) {
-    // Recreate VulkanSurface, if ANativeWindow has been resized.
-    VulkanSurface* surface = *surfaceOut;
-    int windowWidth = 0, windowHeight = 0;
-    ANativeWindow* window = surface->mNativeWindow;
-    window->query(window, NATIVE_WINDOW_WIDTH, &windowWidth);
-    window->query(window, NATIVE_WINDOW_HEIGHT, &windowHeight);
-    if (windowWidth != surface->mWindowWidth || windowHeight != surface->mWindowHeight) {
-        ColorMode colorMode = surface->mColorMode;
-        sk_sp<SkColorSpace> colorSpace = surface->mColorSpace;
-        SkColorType colorType = surface->mColorType;
-        GrContext* grContext = surface->mGrContext;
-        destroySurface(surface);
-        *surfaceOut = createSurface(window, colorMode, colorSpace, colorType, grContext);
-        surface = *surfaceOut;
-        if (!surface) {
-            return nullptr;
-        }
+void VulkanManager::swapBuffers(VulkanSurface* surface, const SkRect& dirtyRect) {
+    if (CC_UNLIKELY(Properties::waitForGpuCompletion)) {
+        ATRACE_NAME("Finishing GPU work");
+        mDeviceWaitIdle(mDevice);
     }
 
-    VulkanSurface::BackbufferInfo* backbuffer = getAvailableBackbuffer(surface);
-    SkASSERT(backbuffer);
+    VkExportSemaphoreCreateInfo exportInfo;
+    exportInfo.sType = VK_STRUCTURE_TYPE_EXPORT_SEMAPHORE_CREATE_INFO;
+    exportInfo.pNext = nullptr;
+    exportInfo.handleTypes = VK_EXTERNAL_SEMAPHORE_HANDLE_TYPE_SYNC_FD_BIT;
 
-    VkResult res;
+    VkSemaphoreCreateInfo semaphoreInfo;
+    semaphoreInfo.sType = VK_STRUCTURE_TYPE_SEMAPHORE_CREATE_INFO;
+    semaphoreInfo.pNext = &exportInfo;
+    semaphoreInfo.flags = 0;
+    VkSemaphore semaphore;
+    VkResult err = mCreateSemaphore(mDevice, &semaphoreInfo, nullptr, &semaphore);
+    ALOGE_IF(VK_SUCCESS != err, "VulkanManager::swapBuffers(): Failed to create semaphore");
 
-    res = mResetFences(mDevice, 2, backbuffer->mUsageFences);
-    SkASSERT(VK_SUCCESS == res);
+    GrBackendSemaphore backendSemaphore;
+    backendSemaphore.initVulkan(semaphore);
 
-    // The acquire will signal the attached mAcquireSemaphore. We use this to know the image has
-    // finished presenting and that it is safe to begin sending new commands to the returned image.
-    res = mAcquireNextImageKHR(mDevice, surface->mSwapchain, UINT64_MAX,
-                               backbuffer->mAcquireSemaphore, VK_NULL_HANDLE,
-                               &backbuffer->mImageIndex);
+    VulkanSurface::NativeBufferInfo* bufferInfo = surface->getCurrentBufferInfo();
 
-    if (VK_ERROR_SURFACE_LOST_KHR == res) {
-        // need to figure out how to create a new vkSurface without the platformData*
-        // maybe use attach somehow? but need a Window
-        return nullptr;
-    }
-    if (VK_ERROR_OUT_OF_DATE_KHR == res || VK_SUBOPTIMAL_KHR == res) {
-        // tear swapchain down and try again
-        if (!createSwapchain(surface)) {
-            return nullptr;
-        }
-        backbuffer = getAvailableBackbuffer(surface);
-        res = mResetFences(mDevice, 2, backbuffer->mUsageFences);
-        SkASSERT(VK_SUCCESS == res);
+    int fenceFd = -1;
+    GrSemaphoresSubmitted submitted =
+            bufferInfo->skSurface->flush(SkSurface::BackendSurfaceAccess::kPresent,
+                                         SkSurface::kNone_FlushFlags, 1, &backendSemaphore);
+    if (submitted == GrSemaphoresSubmitted::kYes) {
+        VkSemaphoreGetFdInfoKHR getFdInfo;
+        getFdInfo.sType = VK_STRUCTURE_TYPE_SEMAPHORE_GET_FD_INFO_KHR;
+        getFdInfo.pNext = nullptr;
+        getFdInfo.semaphore = semaphore;
+        getFdInfo.handleType = VK_EXTERNAL_SEMAPHORE_HANDLE_TYPE_SYNC_FD_BIT;
 
-        // acquire the image
-        res = mAcquireNextImageKHR(mDevice, surface->mSwapchain, UINT64_MAX,
-                                   backbuffer->mAcquireSemaphore, VK_NULL_HANDLE,
-                                   &backbuffer->mImageIndex);
-
-        if (VK_SUCCESS != res) {
-            return nullptr;
-        }
+        err = mGetSemaphoreFdKHR(mDevice, &getFdInfo, &fenceFd);
+        ALOGE_IF(VK_SUCCESS != err, "VulkanManager::swapBuffers(): Failed to get semaphore Fd");
+    } else {
+        ALOGE("VulkanManager::swapBuffers(): Semaphore submission failed");
+        mQueueWaitIdle(mGraphicsQueue);
     }
 
-    // set up layout transfer from initial to color attachment
-    VkImageLayout layout = surface->mImageInfos[backbuffer->mImageIndex].mImageLayout;
-    SkASSERT(VK_IMAGE_LAYOUT_UNDEFINED == layout || VK_IMAGE_LAYOUT_PRESENT_SRC_KHR == layout);
-    VkPipelineStageFlags srcStageMask = VK_PIPELINE_STAGE_COLOR_ATTACHMENT_OUTPUT_BIT;
-    VkPipelineStageFlags dstStageMask = VK_PIPELINE_STAGE_COLOR_ATTACHMENT_OUTPUT_BIT;
-    VkAccessFlags srcAccessMask = 0;
-    VkAccessFlags dstAccessMask = VK_ACCESS_COLOR_ATTACHMENT_READ_BIT |
-                                  VK_ACCESS_COLOR_ATTACHMENT_WRITE_BIT;
+    surface->presentCurrentBuffer(dirtyRect, fenceFd);
 
-    VkImageMemoryBarrier imageMemoryBarrier = {
-            VK_STRUCTURE_TYPE_IMAGE_MEMORY_BARRIER,     // sType
-            NULL,                                       // pNext
-            srcAccessMask,                              // outputMask
-            dstAccessMask,                              // inputMask
-            layout,                                     // oldLayout
-            VK_IMAGE_LAYOUT_COLOR_ATTACHMENT_OPTIMAL,   // newLayout
-            mPresentQueueIndex,                         // srcQueueFamilyIndex
-            mGraphicsQueueIndex,       // dstQueueFamilyIndex
-            surface->mImages[backbuffer->mImageIndex],  // image
-            {VK_IMAGE_ASPECT_COLOR_BIT, 0, 1, 0, 1}     // subresourceRange
-    };
-    mResetCommandBuffer(backbuffer->mTransitionCmdBuffers[0], 0);
-
-    VkCommandBufferBeginInfo info;
-    memset(&info, 0, sizeof(VkCommandBufferBeginInfo));
-    info.sType = VK_STRUCTURE_TYPE_COMMAND_BUFFER_BEGIN_INFO;
-    info.flags = 0;
-    mBeginCommandBuffer(backbuffer->mTransitionCmdBuffers[0], &info);
-
-    mCmdPipelineBarrier(backbuffer->mTransitionCmdBuffers[0], srcStageMask, dstStageMask, 0, 0,
-                        nullptr, 0, nullptr, 1, &imageMemoryBarrier);
-
-    mEndCommandBuffer(backbuffer->mTransitionCmdBuffers[0]);
-
-    VkPipelineStageFlags waitDstStageFlags = VK_PIPELINE_STAGE_COLOR_ATTACHMENT_OUTPUT_BIT;
-    // insert the layout transfer into the queue and wait on the acquire
-    VkSubmitInfo submitInfo;
-    memset(&submitInfo, 0, sizeof(VkSubmitInfo));
-    submitInfo.sType = VK_STRUCTURE_TYPE_SUBMIT_INFO;
-    submitInfo.waitSemaphoreCount = 1;
-    // Wait to make sure aquire semaphore set above has signaled.
-    submitInfo.pWaitSemaphores = &backbuffer->mAcquireSemaphore;
-    submitInfo.pWaitDstStageMask = &waitDstStageFlags;
-    submitInfo.commandBufferCount = 1;
-    submitInfo.pCommandBuffers = &backbuffer->mTransitionCmdBuffers[0];
-    submitInfo.signalSemaphoreCount = 0;
-
-    // Attach first fence to submission here so we can track when the command buffer finishes.
-    mQueueSubmit(mGraphicsQueue, 1, &submitInfo, backbuffer->mUsageFences[0]);
-
-    // We need to notify Skia that we changed the layout of the wrapped VkImage
-    sk_sp<SkSurface> skSurface = surface->mImageInfos[backbuffer->mImageIndex].mSurface;
-    GrBackendRenderTarget backendRT = skSurface->getBackendRenderTarget(
-            SkSurface::kFlushRead_BackendHandleAccess);
-    if (!backendRT.isValid()) {
-        SkASSERT(backendRT.isValid());
-        return nullptr;
-    }
-    backendRT.setVkImageLayout(VK_IMAGE_LAYOUT_COLOR_ATTACHMENT_OPTIMAL);
-
-    surface->mPreTransform = getPreTransformMatrix(surface->windowWidth(),
-                                                   surface->windowHeight(),
-                                                   surface->mTransform);
-
-    surface->mBackbuffer = std::move(skSurface);
-    return surface->mBackbuffer.get();
-}
-
-void VulkanManager::destroyBuffers(VulkanSurface* surface) {
-    if (surface->mBackbuffers) {
-        for (uint32_t i = 0; i < surface->mImageCount + 1; ++i) {
-            mWaitForFences(mDevice, 2, surface->mBackbuffers[i].mUsageFences, true, UINT64_MAX);
-            surface->mBackbuffers[i].mImageIndex = -1;
-            mDestroySemaphore(mDevice, surface->mBackbuffers[i].mAcquireSemaphore, nullptr);
-            mDestroySemaphore(mDevice, surface->mBackbuffers[i].mRenderSemaphore, nullptr);
-            mFreeCommandBuffers(mDevice, mCommandPool, 2,
-                    surface->mBackbuffers[i].mTransitionCmdBuffers);
-            mDestroyFence(mDevice, surface->mBackbuffers[i].mUsageFences[0], 0);
-            mDestroyFence(mDevice, surface->mBackbuffers[i].mUsageFences[1], 0);
-        }
-    }
-
-    delete[] surface->mBackbuffers;
-    surface->mBackbuffers = nullptr;
-    delete[] surface->mImageInfos;
-    surface->mImageInfos = nullptr;
-    delete[] surface->mImages;
-    surface->mImages = nullptr;
+    // Exporting a semaphore with copy transference via vkGetSemaphoreFdKHR, has the same effect of
+    // destroying the semaphore and creating a new one with the same handle, and the payloads
+    // ownership is move to the Fd we created. Thus the semaphore is in a state that we can delete
+    // it and we don't need to wait on the command buffer we submitted to finish.
+    mDestroySemaphore(mDevice, semaphore, nullptr);
 }
 
 void VulkanManager::destroySurface(VulkanSurface* surface) {
@@ -604,271 +529,9 @@
     }
     mDeviceWaitIdle(mDevice);
 
-    destroyBuffers(surface);
-
-    if (VK_NULL_HANDLE != surface->mSwapchain) {
-        mDestroySwapchainKHR(mDevice, surface->mSwapchain, nullptr);
-        surface->mSwapchain = VK_NULL_HANDLE;
-    }
-
-    if (VK_NULL_HANDLE != surface->mVkSurface) {
-        mDestroySurfaceKHR(mInstance, surface->mVkSurface, nullptr);
-        surface->mVkSurface = VK_NULL_HANDLE;
-    }
     delete surface;
 }
 
-void VulkanManager::createBuffers(VulkanSurface* surface, VkFormat format, VkExtent2D extent) {
-    mGetSwapchainImagesKHR(mDevice, surface->mSwapchain, &surface->mImageCount, nullptr);
-    SkASSERT(surface->mImageCount);
-    surface->mImages = new VkImage[surface->mImageCount];
-    mGetSwapchainImagesKHR(mDevice, surface->mSwapchain, &surface->mImageCount, surface->mImages);
-
-    SkSurfaceProps props(0, kUnknown_SkPixelGeometry);
-
-    // set up initial image layouts and create surfaces
-    surface->mImageInfos = new VulkanSurface::ImageInfo[surface->mImageCount];
-    for (uint32_t i = 0; i < surface->mImageCount; ++i) {
-        GrVkImageInfo info;
-        info.fImage = surface->mImages[i];
-        info.fAlloc = GrVkAlloc();
-        info.fImageLayout = VK_IMAGE_LAYOUT_UNDEFINED;
-        info.fImageTiling = VK_IMAGE_TILING_OPTIMAL;
-        info.fFormat = format;
-        info.fLevelCount = 1;
-
-        GrBackendRenderTarget backendRT(extent.width, extent.height, 0, 0, info);
-
-        VulkanSurface::ImageInfo& imageInfo = surface->mImageInfos[i];
-        imageInfo.mSurface = SkSurface::MakeFromBackendRenderTarget(
-                surface->mGrContext, backendRT, kTopLeft_GrSurfaceOrigin,
-                surface->mColorType, surface->mColorSpace, &props);
-    }
-
-    SkASSERT(mCommandPool != VK_NULL_HANDLE);
-
-    // set up the backbuffers
-    VkSemaphoreCreateInfo semaphoreInfo;
-    memset(&semaphoreInfo, 0, sizeof(VkSemaphoreCreateInfo));
-    semaphoreInfo.sType = VK_STRUCTURE_TYPE_SEMAPHORE_CREATE_INFO;
-    semaphoreInfo.pNext = nullptr;
-    semaphoreInfo.flags = 0;
-    VkCommandBufferAllocateInfo commandBuffersInfo;
-    memset(&commandBuffersInfo, 0, sizeof(VkCommandBufferAllocateInfo));
-    commandBuffersInfo.sType = VK_STRUCTURE_TYPE_COMMAND_BUFFER_ALLOCATE_INFO;
-    commandBuffersInfo.pNext = nullptr;
-    commandBuffersInfo.commandPool = mCommandPool;
-    commandBuffersInfo.level = VK_COMMAND_BUFFER_LEVEL_PRIMARY;
-    commandBuffersInfo.commandBufferCount = 2;
-    VkFenceCreateInfo fenceInfo;
-    memset(&fenceInfo, 0, sizeof(VkFenceCreateInfo));
-    fenceInfo.sType = VK_STRUCTURE_TYPE_FENCE_CREATE_INFO;
-    fenceInfo.pNext = nullptr;
-    fenceInfo.flags = VK_FENCE_CREATE_SIGNALED_BIT;
-
-    // we create one additional backbuffer structure here, because we want to
-    // give the command buffers they contain a chance to finish before we cycle back
-    surface->mBackbuffers = new VulkanSurface::BackbufferInfo[surface->mImageCount + 1];
-    for (uint32_t i = 0; i < surface->mImageCount + 1; ++i) {
-        SkDEBUGCODE(VkResult res);
-        surface->mBackbuffers[i].mImageIndex = -1;
-        SkDEBUGCODE(res =) mCreateSemaphore(mDevice, &semaphoreInfo, nullptr,
-                                            &surface->mBackbuffers[i].mAcquireSemaphore);
-        SkDEBUGCODE(res =) mCreateSemaphore(mDevice, &semaphoreInfo, nullptr,
-                                            &surface->mBackbuffers[i].mRenderSemaphore);
-        SkDEBUGCODE(res =) mAllocateCommandBuffers(mDevice, &commandBuffersInfo,
-                                                   surface->mBackbuffers[i].mTransitionCmdBuffers);
-        SkDEBUGCODE(res =) mCreateFence(mDevice, &fenceInfo, nullptr,
-                                        &surface->mBackbuffers[i].mUsageFences[0]);
-        SkDEBUGCODE(res =) mCreateFence(mDevice, &fenceInfo, nullptr,
-                                        &surface->mBackbuffers[i].mUsageFences[1]);
-        SkASSERT(VK_SUCCESS == res);
-    }
-    surface->mCurrentBackbufferIndex = surface->mImageCount;
-}
-
-bool VulkanManager::createSwapchain(VulkanSurface* surface) {
-    // check for capabilities
-    VkSurfaceCapabilitiesKHR caps;
-    VkResult res = mGetPhysicalDeviceSurfaceCapabilitiesKHR(mPhysicalDevice,
-                                                            surface->mVkSurface, &caps);
-    if (VK_SUCCESS != res) {
-        return false;
-    }
-
-    uint32_t surfaceFormatCount;
-    res = mGetPhysicalDeviceSurfaceFormatsKHR(mPhysicalDevice, surface->mVkSurface,
-                                              &surfaceFormatCount, nullptr);
-    if (VK_SUCCESS != res) {
-        return false;
-    }
-
-    FatVector<VkSurfaceFormatKHR, 4> surfaceFormats(surfaceFormatCount);
-    res = mGetPhysicalDeviceSurfaceFormatsKHR(mPhysicalDevice, surface->mVkSurface,
-                                              &surfaceFormatCount, surfaceFormats.data());
-    if (VK_SUCCESS != res) {
-        return false;
-    }
-
-    uint32_t presentModeCount;
-    res = mGetPhysicalDeviceSurfacePresentModesKHR(mPhysicalDevice,
-                                                   surface->mVkSurface, &presentModeCount, nullptr);
-    if (VK_SUCCESS != res) {
-        return false;
-    }
-
-    FatVector<VkPresentModeKHR, VK_PRESENT_MODE_RANGE_SIZE_KHR> presentModes(presentModeCount);
-    res = mGetPhysicalDeviceSurfacePresentModesKHR(mPhysicalDevice,
-                                                   surface->mVkSurface, &presentModeCount,
-                                                   presentModes.data());
-    if (VK_SUCCESS != res) {
-        return false;
-    }
-
-    if (!SkToBool(caps.supportedTransforms & VK_SURFACE_TRANSFORM_IDENTITY_BIT_KHR)) {
-        return false;
-    }
-    VkSurfaceTransformFlagBitsKHR transform;
-    if (SkToBool(caps.supportedTransforms & caps.currentTransform) &&
-        !SkToBool(caps.currentTransform & VK_SURFACE_TRANSFORM_INHERIT_BIT_KHR)) {
-        transform = caps.currentTransform;
-    } else {
-        transform = VK_SURFACE_TRANSFORM_IDENTITY_BIT_KHR;
-    }
-
-    VkExtent2D extent = caps.currentExtent;
-    // clamp width; to handle currentExtent of -1 and  protect us from broken hints
-    if (extent.width < caps.minImageExtent.width) {
-        extent.width = caps.minImageExtent.width;
-    }
-    SkASSERT(extent.width <= caps.maxImageExtent.width);
-    // clamp height
-    if (extent.height < caps.minImageExtent.height) {
-        extent.height = caps.minImageExtent.height;
-    }
-    SkASSERT(extent.height <= caps.maxImageExtent.height);
-
-    VkExtent2D swapExtent = extent;
-    if (transform == VK_SURFACE_TRANSFORM_ROTATE_90_BIT_KHR ||
-        transform == VK_SURFACE_TRANSFORM_ROTATE_270_BIT_KHR ||
-        transform == VK_SURFACE_TRANSFORM_HORIZONTAL_MIRROR_ROTATE_90_BIT_KHR ||
-        transform == VK_SURFACE_TRANSFORM_HORIZONTAL_MIRROR_ROTATE_270_BIT_KHR) {
-        swapExtent.width = extent.height;
-        swapExtent.height = extent.width;
-    }
-
-    surface->mWindowWidth = extent.width;
-    surface->mWindowHeight = extent.height;
-
-    uint32_t imageCount = std::max<uint32_t>(3, caps.minImageCount);
-    if (caps.maxImageCount > 0 && imageCount > caps.maxImageCount) {
-        // Application must settle for fewer images than desired:
-        imageCount = caps.maxImageCount;
-    }
-
-    // Currently Skia requires the images to be color attchments and support all transfer
-    // operations.
-    VkImageUsageFlags usageFlags = VK_IMAGE_USAGE_COLOR_ATTACHMENT_BIT |
-                                   VK_IMAGE_USAGE_TRANSFER_SRC_BIT |
-                                   VK_IMAGE_USAGE_TRANSFER_DST_BIT;
-    SkASSERT((caps.supportedUsageFlags & usageFlags) == usageFlags);
-
-    SkASSERT(caps.supportedCompositeAlpha &
-             (VK_COMPOSITE_ALPHA_OPAQUE_BIT_KHR | VK_COMPOSITE_ALPHA_INHERIT_BIT_KHR));
-    VkCompositeAlphaFlagBitsKHR composite_alpha =
-            (caps.supportedCompositeAlpha & VK_COMPOSITE_ALPHA_INHERIT_BIT_KHR)
-                    ? VK_COMPOSITE_ALPHA_INHERIT_BIT_KHR
-                    : VK_COMPOSITE_ALPHA_OPAQUE_BIT_KHR;
-
-    VkFormat surfaceFormat = VK_FORMAT_R8G8B8A8_UNORM;
-    VkColorSpaceKHR colorSpace = VK_COLORSPACE_SRGB_NONLINEAR_KHR;
-    if (surface->mColorType == SkColorType::kRGBA_F16_SkColorType) {
-        surfaceFormat = VK_FORMAT_R16G16B16A16_SFLOAT;
-    }
-
-    if (surface->mColorMode == ColorMode::WideColorGamut) {
-        skcms_Matrix3x3 surfaceGamut;
-        LOG_ALWAYS_FATAL_IF(!surface->mColorSpace->toXYZD50(&surfaceGamut),
-                            "Could not get gamut matrix from color space");
-        if (memcmp(&surfaceGamut, &SkNamedGamut::kSRGB, sizeof(surfaceGamut)) == 0) {
-            colorSpace = VK_COLOR_SPACE_EXTENDED_SRGB_NONLINEAR_EXT;
-        } else if (memcmp(&surfaceGamut, &SkNamedGamut::kDCIP3, sizeof(surfaceGamut)) == 0) {
-            colorSpace = VK_COLOR_SPACE_DISPLAY_P3_NONLINEAR_EXT;
-        } else {
-            LOG_ALWAYS_FATAL("Unreachable: unsupported wide color space.");
-        }
-    }
-
-    bool foundSurfaceFormat = false;
-    for (uint32_t i = 0; i < surfaceFormatCount; ++i) {
-        if (surfaceFormat == surfaceFormats[i].format
-                && colorSpace == surfaceFormats[i].colorSpace) {
-            foundSurfaceFormat = true;
-            break;
-        }
-    }
-
-    if (!foundSurfaceFormat) {
-        return false;
-    }
-
-    // FIFO is always available and will match what we do on GL so just pick that here.
-    VkPresentModeKHR mode = VK_PRESENT_MODE_FIFO_KHR;
-
-    VkSwapchainCreateInfoKHR swapchainCreateInfo;
-    memset(&swapchainCreateInfo, 0, sizeof(VkSwapchainCreateInfoKHR));
-    swapchainCreateInfo.sType = VK_STRUCTURE_TYPE_SWAPCHAIN_CREATE_INFO_KHR;
-    swapchainCreateInfo.surface = surface->mVkSurface;
-    swapchainCreateInfo.minImageCount = imageCount;
-    swapchainCreateInfo.imageFormat = surfaceFormat;
-    swapchainCreateInfo.imageColorSpace = colorSpace;
-    swapchainCreateInfo.imageExtent = swapExtent;
-    swapchainCreateInfo.imageArrayLayers = 1;
-    swapchainCreateInfo.imageUsage = usageFlags;
-
-    uint32_t queueFamilies[] = {mGraphicsQueueIndex, mPresentQueueIndex};
-    if (mGraphicsQueueIndex != mPresentQueueIndex) {
-        swapchainCreateInfo.imageSharingMode = VK_SHARING_MODE_CONCURRENT;
-        swapchainCreateInfo.queueFamilyIndexCount = 2;
-        swapchainCreateInfo.pQueueFamilyIndices = queueFamilies;
-    } else {
-        swapchainCreateInfo.imageSharingMode = VK_SHARING_MODE_EXCLUSIVE;
-        swapchainCreateInfo.queueFamilyIndexCount = 0;
-        swapchainCreateInfo.pQueueFamilyIndices = nullptr;
-    }
-
-    swapchainCreateInfo.preTransform = transform;
-    swapchainCreateInfo.compositeAlpha = composite_alpha;
-    swapchainCreateInfo.presentMode = mode;
-    swapchainCreateInfo.clipped = true;
-    swapchainCreateInfo.oldSwapchain = surface->mSwapchain;
-
-    res = mCreateSwapchainKHR(mDevice, &swapchainCreateInfo, nullptr, &surface->mSwapchain);
-    if (VK_SUCCESS != res) {
-        return false;
-    }
-
-    surface->mTransform = transform;
-
-    // destroy the old swapchain
-    if (swapchainCreateInfo.oldSwapchain != VK_NULL_HANDLE) {
-        mDeviceWaitIdle(mDevice);
-
-        destroyBuffers(surface);
-
-        mDestroySwapchainKHR(mDevice, swapchainCreateInfo.oldSwapchain, nullptr);
-    }
-
-    createBuffers(surface, surfaceFormat, swapExtent);
-
-    // The window content is not updated (frozen) until a buffer of the window size is received.
-    // This prevents temporary stretching of the window after it is resized, but before the first
-    // buffer with new size is enqueued.
-    native_window_set_scaling_mode(surface->mNativeWindow, NATIVE_WINDOW_SCALING_MODE_FREEZE);
-
-    return true;
-}
-
 VulkanSurface* VulkanManager::createSurface(ANativeWindow* window, ColorMode colorMode,
                                             sk_sp<SkColorSpace> surfaceColorSpace,
                                             SkColorType surfaceColorType,
@@ -878,185 +541,8 @@
         return nullptr;
     }
 
-    VulkanSurface* surface = new VulkanSurface(colorMode, window, surfaceColorSpace,
-                                               surfaceColorType, grContext);
-
-    VkAndroidSurfaceCreateInfoKHR surfaceCreateInfo;
-    memset(&surfaceCreateInfo, 0, sizeof(VkAndroidSurfaceCreateInfoKHR));
-    surfaceCreateInfo.sType = VK_STRUCTURE_TYPE_ANDROID_SURFACE_CREATE_INFO_KHR;
-    surfaceCreateInfo.pNext = nullptr;
-    surfaceCreateInfo.flags = 0;
-    surfaceCreateInfo.window = window;
-
-    VkResult res = mCreateAndroidSurfaceKHR(mInstance, &surfaceCreateInfo, nullptr,
-            &surface->mVkSurface);
-    if (VK_SUCCESS != res) {
-        delete surface;
-        return nullptr;
-    }
-
-    SkDEBUGCODE(VkBool32 supported; res = mGetPhysicalDeviceSurfaceSupportKHR(
-            mPhysicalDevice, mPresentQueueIndex, surface->mVkSurface, &supported);
-    // All physical devices and queue families on Android must be capable of
-    // presentation with any native window.
-    SkASSERT(VK_SUCCESS == res && supported););
-
-    if (!createSwapchain(surface)) {
-        destroySurface(surface);
-        return nullptr;
-    }
-
-    return surface;
-}
-
-// Helper to know which src stage flags we need to set when transitioning to the present layout
-static VkPipelineStageFlags layoutToPipelineSrcStageFlags(const VkImageLayout layout) {
-    if (VK_IMAGE_LAYOUT_GENERAL == layout) {
-        return VK_PIPELINE_STAGE_ALL_COMMANDS_BIT;
-    } else if (VK_IMAGE_LAYOUT_TRANSFER_SRC_OPTIMAL == layout ||
-               VK_IMAGE_LAYOUT_TRANSFER_DST_OPTIMAL == layout) {
-        return VK_PIPELINE_STAGE_TRANSFER_BIT;
-    } else if (VK_IMAGE_LAYOUT_COLOR_ATTACHMENT_OPTIMAL == layout) {
-        return VK_PIPELINE_STAGE_COLOR_ATTACHMENT_OUTPUT_BIT;
-    } else if (VK_IMAGE_LAYOUT_DEPTH_STENCIL_ATTACHMENT_OPTIMAL == layout ||
-               VK_IMAGE_LAYOUT_DEPTH_STENCIL_READ_ONLY_OPTIMAL == layout) {
-        return VK_PIPELINE_STAGE_LATE_FRAGMENT_TESTS_BIT;
-    } else if (VK_IMAGE_LAYOUT_SHADER_READ_ONLY_OPTIMAL == layout) {
-        return VK_PIPELINE_STAGE_FRAGMENT_SHADER_BIT;
-    } else if (VK_IMAGE_LAYOUT_PREINITIALIZED == layout) {
-        return VK_PIPELINE_STAGE_HOST_BIT;
-    }
-
-    SkASSERT(VK_IMAGE_LAYOUT_UNDEFINED == layout);
-    return VK_PIPELINE_STAGE_TOP_OF_PIPE_BIT;
-}
-
-// Helper to know which src access mask we need to set when transitioning to the present layout
-static VkAccessFlags layoutToSrcAccessMask(const VkImageLayout layout) {
-    VkAccessFlags flags = 0;
-    if (VK_IMAGE_LAYOUT_GENERAL == layout) {
-        flags = VK_ACCESS_COLOR_ATTACHMENT_WRITE_BIT |
-                VK_ACCESS_DEPTH_STENCIL_ATTACHMENT_WRITE_BIT | VK_ACCESS_TRANSFER_WRITE_BIT |
-                VK_ACCESS_TRANSFER_READ_BIT | VK_ACCESS_SHADER_READ_BIT | VK_ACCESS_HOST_WRITE_BIT |
-                VK_ACCESS_HOST_READ_BIT;
-    } else if (VK_IMAGE_LAYOUT_PREINITIALIZED == layout) {
-        flags = VK_ACCESS_HOST_WRITE_BIT;
-    } else if (VK_IMAGE_LAYOUT_COLOR_ATTACHMENT_OPTIMAL == layout) {
-        flags = VK_ACCESS_COLOR_ATTACHMENT_WRITE_BIT;
-    } else if (VK_IMAGE_LAYOUT_DEPTH_STENCIL_ATTACHMENT_OPTIMAL == layout) {
-        flags = VK_ACCESS_DEPTH_STENCIL_ATTACHMENT_WRITE_BIT;
-    } else if (VK_IMAGE_LAYOUT_TRANSFER_DST_OPTIMAL == layout) {
-        flags = VK_ACCESS_TRANSFER_WRITE_BIT;
-    } else if (VK_IMAGE_LAYOUT_TRANSFER_SRC_OPTIMAL == layout) {
-        flags = VK_ACCESS_TRANSFER_READ_BIT;
-    } else if (VK_IMAGE_LAYOUT_SHADER_READ_ONLY_OPTIMAL == layout) {
-        flags = VK_ACCESS_SHADER_READ_BIT;
-    }
-    return flags;
-}
-
-void VulkanManager::swapBuffers(VulkanSurface* surface) {
-    if (CC_UNLIKELY(Properties::waitForGpuCompletion)) {
-        ATRACE_NAME("Finishing GPU work");
-        mDeviceWaitIdle(mDevice);
-    }
-
-    SkASSERT(surface->mBackbuffers);
-    VulkanSurface::BackbufferInfo* backbuffer =
-            surface->mBackbuffers + surface->mCurrentBackbufferIndex;
-
-    SkSurface* skSurface = surface->mImageInfos[backbuffer->mImageIndex].mSurface.get();
-    GrBackendRenderTarget backendRT = skSurface->getBackendRenderTarget(
-            SkSurface::kFlushRead_BackendHandleAccess);
-    SkASSERT(backendRT.isValid());
-
-    GrVkImageInfo imageInfo;
-    SkAssertResult(backendRT.getVkImageInfo(&imageInfo));
-
-    // Check to make sure we never change the actually wrapped image
-    SkASSERT(imageInfo.fImage == surface->mImages[backbuffer->mImageIndex]);
-
-    // We need to transition the image to VK_IMAGE_LAYOUT_PRESENT_SRC_KHR and make sure that all
-    // previous work is complete for before presenting. So we first add the necessary barrier here.
-    VkImageLayout layout = imageInfo.fImageLayout;
-    VkPipelineStageFlags srcStageMask = layoutToPipelineSrcStageFlags(layout);
-    VkPipelineStageFlags dstStageMask = VK_PIPELINE_STAGE_BOTTOM_OF_PIPE_BIT;
-    VkAccessFlags srcAccessMask = layoutToSrcAccessMask(layout);
-    VkAccessFlags dstAccessMask = 0;
-
-    VkImageMemoryBarrier imageMemoryBarrier = {
-            VK_STRUCTURE_TYPE_IMAGE_MEMORY_BARRIER,     // sType
-            NULL,                                       // pNext
-            srcAccessMask,                              // outputMask
-            dstAccessMask,                              // inputMask
-            layout,                                     // oldLayout
-            VK_IMAGE_LAYOUT_PRESENT_SRC_KHR,            // newLayout
-            mGraphicsQueueIndex,                        // srcQueueFamilyIndex
-            mPresentQueueIndex,                         // dstQueueFamilyIndex
-            surface->mImages[backbuffer->mImageIndex],  // image
-            {VK_IMAGE_ASPECT_COLOR_BIT, 0, 1, 0, 1}     // subresourceRange
-    };
-
-    mResetCommandBuffer(backbuffer->mTransitionCmdBuffers[1], 0);
-    VkCommandBufferBeginInfo info;
-    memset(&info, 0, sizeof(VkCommandBufferBeginInfo));
-    info.sType = VK_STRUCTURE_TYPE_COMMAND_BUFFER_BEGIN_INFO;
-    info.flags = 0;
-    mBeginCommandBuffer(backbuffer->mTransitionCmdBuffers[1], &info);
-    mCmdPipelineBarrier(backbuffer->mTransitionCmdBuffers[1], srcStageMask, dstStageMask, 0, 0,
-                        nullptr, 0, nullptr, 1, &imageMemoryBarrier);
-    mEndCommandBuffer(backbuffer->mTransitionCmdBuffers[1]);
-
-    surface->mImageInfos[backbuffer->mImageIndex].mImageLayout = VK_IMAGE_LAYOUT_PRESENT_SRC_KHR;
-
-    // insert the layout transfer into the queue and wait on the acquire
-    VkSubmitInfo submitInfo;
-    memset(&submitInfo, 0, sizeof(VkSubmitInfo));
-    submitInfo.sType = VK_STRUCTURE_TYPE_SUBMIT_INFO;
-    submitInfo.waitSemaphoreCount = 0;
-    submitInfo.pWaitDstStageMask = 0;
-    submitInfo.commandBufferCount = 1;
-    submitInfo.pCommandBuffers = &backbuffer->mTransitionCmdBuffers[1];
-    submitInfo.signalSemaphoreCount = 1;
-    // When this command buffer finishes we will signal this semaphore so that we know it is now
-    // safe to present the image to the screen.
-    submitInfo.pSignalSemaphores = &backbuffer->mRenderSemaphore;
-
-    // Attach second fence to submission here so we can track when the command buffer finishes.
-    mQueueSubmit(mGraphicsQueue, 1, &submitInfo, backbuffer->mUsageFences[1]);
-
-    // Submit present operation to present queue. We use a semaphore here to make sure all rendering
-    // to the image is complete and that the layout has been change to present on the graphics
-    // queue.
-    const VkPresentInfoKHR presentInfo = {
-            VK_STRUCTURE_TYPE_PRESENT_INFO_KHR,  // sType
-            NULL,                                // pNext
-            1,                                   // waitSemaphoreCount
-            &backbuffer->mRenderSemaphore,       // pWaitSemaphores
-            1,                                   // swapchainCount
-            &surface->mSwapchain,                // pSwapchains
-            &backbuffer->mImageIndex,            // pImageIndices
-            NULL                                 // pResults
-    };
-
-    mQueuePresentKHR(mPresentQueue, &presentInfo);
-
-    surface->mBackbuffer.reset();
-    surface->mImageInfos[backbuffer->mImageIndex].mLastUsed = surface->mCurrentTime;
-    surface->mImageInfos[backbuffer->mImageIndex].mInvalid = false;
-    surface->mCurrentTime++;
-}
-
-int VulkanManager::getAge(VulkanSurface* surface) {
-    SkASSERT(surface->mBackbuffers);
-    VulkanSurface::BackbufferInfo* backbuffer =
-            surface->mBackbuffers + surface->mCurrentBackbufferIndex;
-    if (mSwapBehavior == SwapBehavior::Discard ||
-        surface->mImageInfos[backbuffer->mImageIndex].mInvalid) {
-        return 0;
-    }
-    uint16_t lastUsed = surface->mImageInfos[backbuffer->mImageIndex].mLastUsed;
-    return surface->mCurrentTime - lastUsed;
+    return VulkanSurface::Create(window, colorMode, surfaceColorType, surfaceColorSpace, grContext,
+                                  *this);
 }
 
 bool VulkanManager::setupDummyCommandBuffer() {
diff --git a/libs/hwui/renderthread/VulkanManager.h b/libs/hwui/renderthread/VulkanManager.h
index 95c9630..c3d2891 100644
--- a/libs/hwui/renderthread/VulkanManager.h
+++ b/libs/hwui/renderthread/VulkanManager.h
@@ -28,7 +28,9 @@
 #include <ui/Fence.h>
 #include <utils/StrongPointer.h>
 #include <vk/GrVkBackendContext.h>
+#include "Frame.h"
 #include "IRenderPipeline.h"
+#include "VulkanSurface.h"
 
 class GrVkExtensions;
 
@@ -38,66 +40,6 @@
 
 class RenderThread;
 
-class VulkanSurface {
-public:
-    VulkanSurface(ColorMode colorMode, ANativeWindow* window, sk_sp<SkColorSpace> colorSpace,
-                  SkColorType colorType, GrContext* grContext)
-            : mColorMode(colorMode), mNativeWindow(window), mColorSpace(colorSpace),
-              mColorType(colorType), mGrContext(grContext) {}
-
-    sk_sp<SkSurface> getBackBufferSurface() { return mBackbuffer; }
-
-    // The width and height are are the logical width and height for when submitting draws to the
-    // surface. In reality if the window is rotated the underlying VkImage may have the width and
-    // height swapped.
-    int windowWidth() const { return mWindowWidth; }
-    int windowHeight() const { return mWindowHeight; }
-
-    SkMatrix& preTransform() { return mPreTransform; }
-
-private:
-    friend class VulkanManager;
-    struct BackbufferInfo {
-        uint32_t mImageIndex;           // image this is associated with
-        VkSemaphore mAcquireSemaphore;  // we signal on this for acquisition of image
-        VkSemaphore mRenderSemaphore;   // we wait on this for rendering to be done
-        VkCommandBuffer
-                mTransitionCmdBuffers[2];  // to transition layout between present and render
-        // We use these fences to make sure the above Command buffers have finished their work
-        // before attempting to reuse them or destroy them.
-        VkFence mUsageFences[2];
-    };
-
-    struct ImageInfo {
-        VkImageLayout mImageLayout = VK_IMAGE_LAYOUT_UNDEFINED;
-        sk_sp<SkSurface> mSurface;
-        uint16_t mLastUsed = 0;
-        bool mInvalid = true;
-    };
-
-    sk_sp<SkSurface> mBackbuffer;
-
-    VkSurfaceKHR mVkSurface = VK_NULL_HANDLE;
-    VkSwapchainKHR mSwapchain = VK_NULL_HANDLE;
-
-    BackbufferInfo* mBackbuffers = nullptr;
-    uint32_t mCurrentBackbufferIndex;
-
-    uint32_t mImageCount;
-    VkImage* mImages = nullptr;
-    ImageInfo* mImageInfos;
-    uint16_t mCurrentTime = 0;
-    ColorMode mColorMode;
-    ANativeWindow* mNativeWindow;
-    int mWindowWidth = 0;
-    int mWindowHeight = 0;
-    sk_sp<SkColorSpace> mColorSpace;
-    SkColorType mColorType;
-    VkSurfaceTransformFlagBitsKHR mTransform = VK_SURFACE_TRANSFORM_IDENTITY_BIT_KHR;
-    SkMatrix mPreTransform;
-    GrContext* mGrContext;
-};
-
 // This class contains the shared global Vulkan objects, such as VkInstance, VkDevice and VkQueue,
 // which are re-used by CanvasContext. This class is created once and should be used by all vulkan
 // windowing contexts. The VulkanManager must be initialized before use.
@@ -114,33 +56,19 @@
     // Quick check to see if the VulkanManager has been initialized.
     bool hasVkContext() { return mDevice != VK_NULL_HANDLE; }
 
-    // Given a window this creates a new VkSurfaceKHR and VkSwapchain and stores them inside a new
-    // VulkanSurface object which is returned.
+    // Create and destroy functions for wrapping an ANativeWindow in a VulkanSurface
     VulkanSurface* createSurface(ANativeWindow* window, ColorMode colorMode,
                                  sk_sp<SkColorSpace> surfaceColorSpace,
                                  SkColorType surfaceColorType,
                                  GrContext* grContext);
-
-    // Destroy the VulkanSurface and all associated vulkan objects.
     void destroySurface(VulkanSurface* surface);
 
+    Frame dequeueNextBuffer(VulkanSurface* surface);
+    void swapBuffers(VulkanSurface* surface, const SkRect& dirtyRect);
+
     // Cleans up all the global state in the VulkanManger.
     void destroy();
 
-    // No work is needed to make a VulkanSurface current, and all functions require that a
-    // VulkanSurface is passed into them so we just return true here.
-    bool isCurrent(VulkanSurface* surface) { return true; }
-
-    int getAge(VulkanSurface* surface);
-
-    // Returns an SkSurface which wraps the next image returned from vkAcquireNextImageKHR. It also
-    // will transition the VkImage from a present layout to color attachment so that it can be used
-    // by the client for drawing.
-    SkSurface* getBackbufferSurface(VulkanSurface** surface);
-
-    // Presents the current VkImage.
-    void swapBuffers(VulkanSurface* surface);
-
     // Inserts a wait on fence command into the Vulkan command buffer.
     status_t fenceWait(sp<Fence>& fence);
 
@@ -153,17 +81,10 @@
     sk_sp<GrContext> createContext(const GrContextOptions& options);
 
 private:
+    friend class VulkanSurface;
     // Sets up the VkInstance and VkDevice objects. Also fills out the passed in
     // VkPhysicalDeviceFeatures struct.
     void setupDevice(GrVkExtensions&, VkPhysicalDeviceFeatures2&);
-
-    void destroyBuffers(VulkanSurface* surface);
-
-    bool createSwapchain(VulkanSurface* surface);
-    void createBuffers(VulkanSurface* surface, VkFormat format, VkExtent2D extent);
-
-    VulkanSurface::BackbufferInfo* getAvailableBackbuffer(VulkanSurface* surface);
-
     bool setupDummyCommandBuffer();
 
     // simple wrapper class that exists only to initialize a pointer to NULL
@@ -190,13 +111,6 @@
     VkPtr<PFN_vkGetPhysicalDeviceSurfaceFormatsKHR> mGetPhysicalDeviceSurfaceFormatsKHR;
     VkPtr<PFN_vkGetPhysicalDeviceSurfacePresentModesKHR> mGetPhysicalDeviceSurfacePresentModesKHR;
 
-    VkPtr<PFN_vkCreateSwapchainKHR> mCreateSwapchainKHR;
-    VkPtr<PFN_vkDestroySwapchainKHR> mDestroySwapchainKHR;
-    VkPtr<PFN_vkGetSwapchainImagesKHR> mGetSwapchainImagesKHR;
-    VkPtr<PFN_vkAcquireNextImageKHR> mAcquireNextImageKHR;
-    VkPtr<PFN_vkQueuePresentKHR> mQueuePresentKHR;
-    VkPtr<PFN_vkCreateSharedSwapchainsKHR> mCreateSharedSwapchainsKHR;
-
     // Instance Functions
     VkPtr<PFN_vkEnumerateInstanceVersion> mEnumerateInstanceVersion;
     VkPtr<PFN_vkEnumerateInstanceExtensionProperties> mEnumerateInstanceExtensionProperties;
@@ -207,6 +121,7 @@
     VkPtr<PFN_vkGetPhysicalDeviceProperties> mGetPhysicalDeviceProperties;
     VkPtr<PFN_vkGetPhysicalDeviceQueueFamilyProperties> mGetPhysicalDeviceQueueFamilyProperties;
     VkPtr<PFN_vkGetPhysicalDeviceFeatures2> mGetPhysicalDeviceFeatures2;
+    VkPtr<PFN_vkGetPhysicalDeviceImageFormatProperties2> mGetPhysicalDeviceImageFormatProperties2;
     VkPtr<PFN_vkCreateDevice> mCreateDevice;
     VkPtr<PFN_vkEnumerateDeviceExtensionProperties> mEnumerateDeviceExtensionProperties;
 
diff --git a/libs/hwui/renderthread/VulkanSurface.cpp b/libs/hwui/renderthread/VulkanSurface.cpp
new file mode 100644
index 0000000..c03c3a8
--- /dev/null
+++ b/libs/hwui/renderthread/VulkanSurface.cpp
@@ -0,0 +1,536 @@
+/*
+ * Copyright (C) 2019 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.
+ */
+
+#include "VulkanSurface.h"
+
+#include <algorithm>
+#include <SkSurface.h>
+
+#include "VulkanManager.h"
+#include "utils/TraceUtils.h"
+#include "utils/Color.h"
+
+namespace android {
+namespace uirenderer {
+namespace renderthread {
+
+static bool IsTransformSupported(int transform) {
+    // For now, only support pure rotations, not flip or flip-and-rotate, until we have
+    // more time to test them and build sample code. As far as I know we never actually
+    // use anything besides pure rotations anyway.
+    return transform == 0
+        || transform == NATIVE_WINDOW_TRANSFORM_ROT_90
+        || transform == NATIVE_WINDOW_TRANSFORM_ROT_180
+        || transform == NATIVE_WINDOW_TRANSFORM_ROT_270;
+}
+
+static int InvertTransform(int transform) {
+    switch (transform) {
+        case NATIVE_WINDOW_TRANSFORM_ROT_90:
+            return NATIVE_WINDOW_TRANSFORM_ROT_270;
+        case NATIVE_WINDOW_TRANSFORM_ROT_180:
+            return NATIVE_WINDOW_TRANSFORM_ROT_180;
+        case NATIVE_WINDOW_TRANSFORM_ROT_270:
+            return NATIVE_WINDOW_TRANSFORM_ROT_90;
+        default:
+            return 0;
+    }
+}
+
+static int ConvertVkTransformToNative(VkSurfaceTransformFlagsKHR transform) {
+    switch (transform) {
+        case VK_SURFACE_TRANSFORM_ROTATE_90_BIT_KHR:
+            return NATIVE_WINDOW_TRANSFORM_ROT_270;
+        case VK_SURFACE_TRANSFORM_ROTATE_180_BIT_KHR:
+            return NATIVE_WINDOW_TRANSFORM_ROT_180;
+        case VK_SURFACE_TRANSFORM_ROTATE_270_BIT_KHR:
+            return NATIVE_WINDOW_TRANSFORM_ROT_90;
+        case VK_SURFACE_TRANSFORM_IDENTITY_BIT_KHR:
+        case VK_SURFACE_TRANSFORM_INHERIT_BIT_KHR:
+        default:
+            return 0;
+    }
+}
+
+static SkMatrix GetPreTransformMatrix(SkISize windowSize, int transform) {
+    const int width = windowSize.width();
+    const int height = windowSize.height();
+
+    switch (transform) {
+        case 0:
+            return SkMatrix::I();
+        case NATIVE_WINDOW_TRANSFORM_ROT_90:
+            return SkMatrix::MakeAll(0, -1, height, 1, 0, 0, 0, 0, 1);
+        case NATIVE_WINDOW_TRANSFORM_ROT_180:
+            return SkMatrix::MakeAll(-1, 0, width, 0, -1, height, 0, 0, 1);
+        case NATIVE_WINDOW_TRANSFORM_ROT_270:
+            return SkMatrix::MakeAll(0, 1, 0, -1, 0, width, 0, 0, 1);
+        default:
+            LOG_ALWAYS_FATAL("Unsupported Window Transform (%d)", transform);
+    }
+    return SkMatrix::I();
+}
+
+void VulkanSurface::ComputeWindowSizeAndTransform(WindowInfo* windowInfo, const SkISize& minSize,
+                                                   const SkISize& maxSize) {
+    SkISize& windowSize = windowInfo->size;
+
+    // clamp width & height to handle currentExtent of -1 and  protect us from broken hints
+    if (windowSize.width() < minSize.width() || windowSize.width() > maxSize.width()
+        || windowSize.height() < minSize.height() || windowSize.height() > maxSize.height()) {
+        int width = std::min(maxSize.width(), std::max(minSize.width(), windowSize.width()));
+        int height = std::min(maxSize.height(), std::max(minSize.height(), windowSize.height()));
+        ALOGE("Invalid Window Dimensions [%d, %d]; clamping to [%d, %d]",
+              windowSize.width(), windowSize.height(), width, height);
+        windowSize.set(width, height);
+    }
+
+    windowInfo->actualSize = windowSize;
+    if (windowInfo->transform & HAL_TRANSFORM_ROT_90) {
+        windowInfo->actualSize.set(windowSize.height(), windowSize.width());
+    }
+
+    windowInfo->preTransform = GetPreTransformMatrix(windowInfo->size, windowInfo->transform);
+}
+
+static bool ResetNativeWindow(ANativeWindow* window) {
+    // -- Reset the native window --
+    // The native window might have been used previously, and had its properties
+    // changed from defaults. That will affect the answer we get for queries
+    // like MIN_UNDEQUEUED_BUFFERS. Reset to a known/default state before we
+    // attempt such queries.
+
+    int err = native_window_api_connect(window, NATIVE_WINDOW_API_EGL);
+    if (err != 0) {
+        ALOGW("native_window_api_connect failed: %s (%d)", strerror(-err), err);
+        return false;
+    }
+
+    // this will match what we do on GL so pick that here.
+    err = window->setSwapInterval(window, 1);
+    if (err != 0) {
+        ALOGW("native_window->setSwapInterval(1) failed: %s (%d)", strerror(-err), err);
+        return false;
+    }
+
+    err = native_window_set_shared_buffer_mode(window, false);
+    if (err != 0) {
+        ALOGW("native_window_set_shared_buffer_mode(false) failed: %s (%d)", strerror(-err), err);
+        return false;
+    }
+
+    err = native_window_set_auto_refresh(window, false);
+    if (err != 0) {
+        ALOGW("native_window_set_auto_refresh(false) failed: %s (%d)", strerror(-err), err);
+        return false;
+    }
+
+    return true;
+}
+
+class VkSurfaceAutoDeleter {
+public:
+    VkSurfaceAutoDeleter(VkInstance instance, VkSurfaceKHR surface,
+                         PFN_vkDestroySurfaceKHR destroySurfaceKHR)
+            : mInstance(instance)
+            , mSurface(surface)
+            , mDestroySurfaceKHR(destroySurfaceKHR) {}
+    ~VkSurfaceAutoDeleter() {
+        destroy();
+    }
+
+    void destroy() {
+        if (mSurface != VK_NULL_HANDLE) {
+            mDestroySurfaceKHR(mInstance, mSurface, nullptr);
+            mSurface = VK_NULL_HANDLE;
+        }
+    }
+
+private:
+    VkInstance mInstance;
+    VkSurfaceKHR mSurface;
+    PFN_vkDestroySurfaceKHR mDestroySurfaceKHR;
+};
+
+VulkanSurface* VulkanSurface::Create(ANativeWindow* window, ColorMode colorMode,
+                                       SkColorType colorType, sk_sp<SkColorSpace> colorSpace,
+                                       GrContext* grContext, const VulkanManager& vkManager) {
+
+    VkAndroidSurfaceCreateInfoKHR surfaceCreateInfo;
+    memset(&surfaceCreateInfo, 0, sizeof(VkAndroidSurfaceCreateInfoKHR));
+    surfaceCreateInfo.sType = VK_STRUCTURE_TYPE_ANDROID_SURFACE_CREATE_INFO_KHR;
+    surfaceCreateInfo.pNext = nullptr;
+    surfaceCreateInfo.flags = 0;
+    surfaceCreateInfo.window = window;
+
+    VkSurfaceKHR vkSurface = VK_NULL_HANDLE;
+    VkResult res = vkManager.mCreateAndroidSurfaceKHR(vkManager.mInstance, &surfaceCreateInfo,
+                                                      nullptr, &vkSurface);
+    if (VK_SUCCESS != res) {
+        ALOGE("VulkanSurface::Create() vkCreateAndroidSurfaceKHR failed (%d)", res);
+        return nullptr;
+    }
+
+    VkSurfaceAutoDeleter vkSurfaceDeleter(vkManager.mInstance, vkSurface,
+                                          vkManager.mDestroySurfaceKHR);
+
+    SkDEBUGCODE(VkBool32 supported; res = vkManager.mGetPhysicalDeviceSurfaceSupportKHR(
+            vkManager.mPhysicalDevice, vkManager.mPresentQueueIndex, vkSurface, &supported);
+    // All physical devices and queue families on Android must be capable of
+    // presentation with any native window.
+    SkASSERT(VK_SUCCESS == res && supported););
+
+    // check for capabilities
+    VkSurfaceCapabilitiesKHR caps;
+    res = vkManager.mGetPhysicalDeviceSurfaceCapabilitiesKHR(vkManager.mPhysicalDevice, vkSurface,
+                                                             &caps);
+    if (VK_SUCCESS != res) {
+        ALOGE("VulkanSurface::Create() vkGetPhysicalDeviceSurfaceCapabilitiesKHR failed (%d)", res);
+        return nullptr;
+    }
+
+    LOG_ALWAYS_FATAL_IF(0 == (caps.supportedTransforms & VK_SURFACE_TRANSFORM_IDENTITY_BIT_KHR));
+
+    /*
+     * We must destroy the VK Surface before attempting to update the window as doing so after
+     * will cause the native window to be modified in unexpected ways.
+     */
+    vkSurfaceDeleter.destroy();
+
+    /*
+     * Populate Window Info struct
+     */
+    WindowInfo windowInfo;
+
+    windowInfo.transform = ConvertVkTransformToNative(caps.supportedTransforms);
+    windowInfo.size = SkISize::Make(caps.currentExtent.width, caps.currentExtent.height);
+
+    const SkISize minSize = SkISize::Make(caps.minImageExtent.width, caps.minImageExtent.height);
+    const SkISize maxSize = SkISize::Make(caps.maxImageExtent.width, caps.maxImageExtent.height);
+    ComputeWindowSizeAndTransform(&windowInfo, minSize, maxSize);
+
+    windowInfo.bufferCount = std::max<uint32_t>(VulkanSurface::sMaxBufferCount, caps.minImageCount);
+    if (caps.maxImageCount > 0 && windowInfo.bufferCount > caps.maxImageCount) {
+        // Application must settle for fewer images than desired:
+        windowInfo.bufferCount = caps.maxImageCount;
+    }
+
+    // Currently Skia requires the images to be color attachments and support all transfer
+    // operations.
+    VkImageUsageFlags usageFlags = VK_IMAGE_USAGE_COLOR_ATTACHMENT_BIT |
+                                   VK_IMAGE_USAGE_SAMPLED_BIT |
+                                   VK_IMAGE_USAGE_TRANSFER_SRC_BIT |
+                                   VK_IMAGE_USAGE_TRANSFER_DST_BIT;
+    LOG_ALWAYS_FATAL_IF((caps.supportedUsageFlags & usageFlags) != usageFlags);
+
+    windowInfo.dataspace = HAL_DATASPACE_V0_SRGB;
+    if (colorMode == ColorMode::WideColorGamut) {
+        skcms_Matrix3x3 surfaceGamut;
+        LOG_ALWAYS_FATAL_IF(!colorSpace->toXYZD50(&surfaceGamut),
+                            "Could not get gamut matrix from color space");
+        if (memcmp(&surfaceGamut, &SkNamedGamut::kSRGB, sizeof(surfaceGamut)) == 0) {
+            windowInfo.dataspace = HAL_DATASPACE_V0_SCRGB;
+        } else if (memcmp(&surfaceGamut, &SkNamedGamut::kDCIP3, sizeof(surfaceGamut)) == 0) {
+            windowInfo.dataspace = HAL_DATASPACE_DISPLAY_P3;
+        } else {
+            LOG_ALWAYS_FATAL("Unreachable: unsupported wide color space.");
+        }
+    }
+
+    windowInfo.pixelFormat = ColorTypeToPixelFormat(colorType);
+    VkFormat vkPixelFormat = VK_FORMAT_R8G8B8A8_UNORM;
+    if (windowInfo.pixelFormat == PIXEL_FORMAT_RGBA_FP16) {
+        vkPixelFormat = VK_FORMAT_R16G16B16A16_SFLOAT;
+    }
+
+    uint64_t producerUsage =
+            AHARDWAREBUFFER_USAGE_GPU_FRAMEBUFFER | AHARDWAREBUFFER_USAGE_GPU_SAMPLED_IMAGE;
+    uint64_t consumerUsage;
+    native_window_get_consumer_usage(window, &consumerUsage);
+    windowInfo.windowUsageFlags = consumerUsage | producerUsage;
+
+    /*
+     * Now we attempt to modify the window!
+     */
+    if (!UpdateWindow(window, windowInfo)) {
+        return nullptr;
+    }
+
+    return new VulkanSurface(window, windowInfo, minSize, maxSize, grContext);
+}
+
+bool VulkanSurface::UpdateWindow(ANativeWindow* window, const WindowInfo& windowInfo) {
+    ATRACE_CALL();
+
+    if (!ResetNativeWindow(window)) {
+        return false;
+    }
+
+    // -- Configure the native window --
+    int err = native_window_set_buffers_format(window, windowInfo.pixelFormat);
+    if (err != 0) {
+        ALOGE("VulkanSurface::UpdateWindow() native_window_set_buffers_format(%d) failed: %s (%d)",
+              windowInfo.pixelFormat, strerror(-err), err);
+        return false;
+    }
+
+    err = native_window_set_buffers_data_space(window, windowInfo.dataspace);
+    if (err != 0) {
+        ALOGE("VulkanSurface::UpdateWindow() native_window_set_buffers_data_space(%d) "
+              "failed: %s (%d)", windowInfo.dataspace, strerror(-err), err);
+        return false;
+    }
+
+    const SkISize& size = windowInfo.actualSize;
+    err = native_window_set_buffers_dimensions(window, size.width(), size.height());
+    if (err != 0) {
+        ALOGE("VulkanSurface::UpdateWindow() native_window_set_buffers_dimensions(%d,%d) "
+              "failed: %s (%d)", size.width(), size.height(), strerror(-err), err);
+        return false;
+    }
+
+    // native_window_set_buffers_transform() expects the transform the app is requesting that
+    // the compositor perform during composition. With native windows, pre-transform works by
+    // rendering with the same transform the compositor is applying (as in Vulkan), but
+    // then requesting the inverse transform, so that when the compositor does
+    // it's job the two transforms cancel each other out and the compositor ends
+    // up applying an identity transform to the app's buffer.
+    err = native_window_set_buffers_transform(window, InvertTransform(windowInfo.transform));
+    if (err != 0) {
+        ALOGE("VulkanSurface::UpdateWindow() native_window_set_buffers_transform(%d) "
+              "failed: %s (%d)", windowInfo.transform, strerror(-err), err);
+        return false;
+    }
+
+    // Vulkan defaults to NATIVE_WINDOW_SCALING_MODE_SCALE_TO_WINDOW, but this is different than
+    // HWUI's expectation
+    err = native_window_set_scaling_mode(window, NATIVE_WINDOW_SCALING_MODE_FREEZE);
+    if (err != 0) {
+        ALOGE("VulkanSurface::UpdateWindow() native_window_set_scaling_mode(SCALE_TO_WINDOW) "
+              "failed: %s (%d)", strerror(-err), err);
+        return false;
+    }
+
+    // Lower layer insists that we have at least two buffers.
+    err = native_window_set_buffer_count(window, std::max(2, windowInfo.bufferCount));
+    if (err != 0) {
+        ALOGE("VulkanSurface::UpdateWindow() native_window_set_buffer_count(%d) failed: %s (%d)",
+              windowInfo.bufferCount, strerror(-err), err);
+        return false;
+    }
+
+    err = native_window_set_usage(window, windowInfo.windowUsageFlags);
+    if (err != 0) {
+        ALOGE("VulkanSurface::UpdateWindow() native_window_set_usage failed: %s (%d)",
+              strerror(-err), err);
+        return false;
+    }
+
+    return err == 0;
+}
+
+VulkanSurface::VulkanSurface(ANativeWindow* window, const WindowInfo& windowInfo,
+                               SkISize minWindowSize, SkISize maxWindowSize, GrContext* grContext)
+        : mNativeWindow(window)
+        , mWindowInfo(windowInfo)
+        , mGrContext(grContext)
+        , mMinWindowSize(minWindowSize)
+        , mMaxWindowSize(maxWindowSize) { }
+
+VulkanSurface::~VulkanSurface() {
+    releaseBuffers();
+
+    // release the native window to be available for use by other clients
+    int err = native_window_api_disconnect(mNativeWindow.get(), NATIVE_WINDOW_API_EGL);
+    ALOGW_IF(err != 0, "native_window_api_disconnect failed: %s (%d)", strerror(-err), err);
+}
+
+void VulkanSurface::releaseBuffers() {
+    for (uint32_t i = 0; i < VulkanSurface::sMaxBufferCount; i++) {
+        VulkanSurface::NativeBufferInfo& bufferInfo = mNativeBuffers[i];
+
+        if (bufferInfo.buffer.get() != nullptr && bufferInfo.dequeued) {
+            int err = mNativeWindow->cancelBuffer(mNativeWindow.get(), bufferInfo.buffer.get(),
+                                                  bufferInfo.dequeue_fence);
+            if (err != 0) {
+                ALOGE("cancelBuffer[%u] failed during destroy: %s (%d)", i, strerror(-err), err);
+            }
+            bufferInfo.dequeued = false;
+
+            if (bufferInfo.dequeue_fence >= 0) {
+                close(bufferInfo.dequeue_fence);
+                bufferInfo.dequeue_fence = -1;
+            }
+        }
+
+        LOG_ALWAYS_FATAL_IF(bufferInfo.dequeued);
+        LOG_ALWAYS_FATAL_IF(bufferInfo.dequeue_fence != -1);
+
+        bufferInfo.skSurface.reset();
+        bufferInfo.buffer.clear();
+        bufferInfo.hasValidContents = false;
+        bufferInfo.lastPresentedCount = 0;
+    }
+}
+
+VulkanSurface::NativeBufferInfo* VulkanSurface::dequeueNativeBuffer() {
+    // Set the dequeue index to invalid in case of error and only reset it to the correct
+    // value at the end of the function if everything dequeued correctly.
+    mDequeuedIndex = -1;
+
+    //check if the native window has been resized or rotated and update accordingly
+    SkISize newSize = SkISize::MakeEmpty();
+    int transformHint = 0;
+    mNativeWindow->query(mNativeWindow.get(), NATIVE_WINDOW_WIDTH, &newSize.fWidth);
+    mNativeWindow->query(mNativeWindow.get(), NATIVE_WINDOW_HEIGHT, &newSize.fHeight);
+    mNativeWindow->query(mNativeWindow.get(), NATIVE_WINDOW_TRANSFORM_HINT, &transformHint);
+    if (newSize != mWindowInfo.actualSize || transformHint != mWindowInfo.transform) {
+        WindowInfo newWindowInfo = mWindowInfo;
+        newWindowInfo.size = newSize;
+        newWindowInfo.transform = IsTransformSupported(transformHint) ? transformHint : 0;
+        ComputeWindowSizeAndTransform(&newWindowInfo, mMinWindowSize, mMaxWindowSize);
+
+        int err = 0;
+        if (newWindowInfo.actualSize != mWindowInfo.actualSize) {
+            // reset the native buffers and update the window
+            err = native_window_set_buffers_dimensions(mNativeWindow.get(),
+                                                       newWindowInfo.actualSize.width(),
+                                                       newWindowInfo.actualSize.height());
+            if (err != 0) {
+                ALOGE("native_window_set_buffers_dimensions(%d,%d) failed: %s (%d)",
+                      newWindowInfo.actualSize.width(),
+                      newWindowInfo.actualSize.height(), strerror(-err), err);
+                return nullptr;
+            }
+            // reset the NativeBufferInfo (including SkSurface) associated with the old buffers. The
+            // new NativeBufferInfo storage will be populated lazily as we dequeue each new buffer.
+            releaseBuffers();
+            // TODO should we ask the nativewindow to allocate buffers?
+        }
+
+        if (newWindowInfo.transform != mWindowInfo.transform) {
+            err = native_window_set_buffers_transform(mNativeWindow.get(),
+                    InvertTransform(newWindowInfo.transform));
+            if (err != 0) {
+                ALOGE("native_window_set_buffers_transform(%d) failed: %s (%d)",
+                      newWindowInfo.transform, strerror(-err), err);
+                newWindowInfo.transform = mWindowInfo.transform;
+                ComputeWindowSizeAndTransform(&newWindowInfo, mMinWindowSize, mMaxWindowSize);
+            }
+        }
+
+        mWindowInfo = newWindowInfo;
+    }
+
+    ANativeWindowBuffer* buffer;
+    int fence_fd;
+    int err = mNativeWindow->dequeueBuffer(mNativeWindow.get(), &buffer, &fence_fd);
+    if (err != 0) {
+        ALOGE("dequeueBuffer failed: %s (%d)", strerror(-err), err);
+        return nullptr;
+    }
+
+    uint32_t idx;
+    for (idx = 0; idx < mWindowInfo.bufferCount; idx++) {
+        if (mNativeBuffers[idx].buffer.get() == buffer) {
+            mNativeBuffers[idx].dequeued = true;
+            mNativeBuffers[idx].dequeue_fence = fence_fd;
+            break;
+        } else if (mNativeBuffers[idx].buffer.get() == nullptr) {
+            // increasing the number of buffers we have allocated
+            mNativeBuffers[idx].buffer = buffer;
+            mNativeBuffers[idx].dequeued = true;
+            mNativeBuffers[idx].dequeue_fence = fence_fd;
+            break;
+        }
+    }
+    if (idx == mWindowInfo.bufferCount) {
+        ALOGE("dequeueBuffer returned unrecognized buffer");
+        mNativeWindow->cancelBuffer(mNativeWindow.get(), buffer, fence_fd);
+        return nullptr;
+    }
+
+    VulkanSurface::NativeBufferInfo* bufferInfo = &mNativeBuffers[idx];
+
+    if (bufferInfo->skSurface.get() == nullptr) {
+        bufferInfo->skSurface =
+                SkSurface::MakeFromAHardwareBuffer(mGrContext,
+                        ANativeWindowBuffer_getHardwareBuffer(bufferInfo->buffer.get()),
+                        kTopLeft_GrSurfaceOrigin, DataSpaceToColorSpace(mWindowInfo.dataspace),
+                        nullptr);
+        if (bufferInfo->skSurface.get() == nullptr) {
+            ALOGE("SkSurface::MakeFromAHardwareBuffer failed");
+            mNativeWindow->cancelBuffer(mNativeWindow.get(), buffer, fence_fd);
+            return nullptr;
+        }
+    }
+
+    mDequeuedIndex = idx;
+    return bufferInfo;
+}
+
+bool VulkanSurface::presentCurrentBuffer(const SkRect& dirtyRect, int semaphoreFd) {
+    if (!dirtyRect.isEmpty()) {
+        SkRect transformedRect;
+        mWindowInfo.preTransform.mapRect(&transformedRect, dirtyRect);
+
+        SkIRect transformedIRect;
+        transformedRect.roundOut(&transformedIRect);
+        transformedIRect.intersect(0, 0, mWindowInfo.size.fWidth, mWindowInfo.size.fHeight);
+
+        // map to bottom-left coordinate system
+        android_native_rect_t aRect;
+        aRect.left = transformedIRect.x();
+        aRect.top = mWindowInfo.size.fHeight - (transformedIRect.y() + transformedIRect.height());
+        aRect.right = aRect.left + transformedIRect.width();
+        aRect.bottom = aRect.top - transformedIRect.height();
+
+        int err = native_window_set_surface_damage(mNativeWindow.get(), &aRect, 1);
+        ALOGE_IF(err != 0, "native_window_set_surface_damage failed: %s (%d)", strerror(-err), err);
+    }
+
+    VulkanSurface::NativeBufferInfo& currentBuffer = mNativeBuffers[mDequeuedIndex];
+    int queuedFd = (semaphoreFd != -1) ? semaphoreFd : currentBuffer.dequeue_fence;
+    int err = mNativeWindow->queueBuffer(mNativeWindow.get(), currentBuffer.buffer.get(), queuedFd);
+
+    currentBuffer.dequeued = false;
+    // queueBuffer always closes fence, even on error
+    if (err != 0) {
+        ALOGE("queueBuffer failed: %s (%d)", strerror(-err), err);
+        mNativeWindow->cancelBuffer(mNativeWindow.get(), currentBuffer.buffer.get(),
+                                    currentBuffer.dequeue_fence);
+    } else {
+        currentBuffer.hasValidContents = true;
+        currentBuffer.lastPresentedCount = mPresentCount;
+        mPresentCount++;
+    }
+
+    if (currentBuffer.dequeue_fence >= 0) {
+        close(currentBuffer.dequeue_fence);
+        currentBuffer.dequeue_fence = -1;
+    }
+
+    return err == 0;
+}
+
+int VulkanSurface::getCurrentBuffersAge() {
+    VulkanSurface::NativeBufferInfo& currentBuffer = mNativeBuffers[mDequeuedIndex];
+    return currentBuffer.hasValidContents ? (mPresentCount - currentBuffer.lastPresentedCount) : 0;
+}
+
+} /* namespace renderthread */
+} /* namespace uirenderer */
+} /* namespace android */
diff --git a/libs/hwui/renderthread/VulkanSurface.h b/libs/hwui/renderthread/VulkanSurface.h
new file mode 100644
index 0000000..4fd9cd2
--- /dev/null
+++ b/libs/hwui/renderthread/VulkanSurface.h
@@ -0,0 +1,127 @@
+/*
+ * Copyright (C) 2019 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.
+ */
+#pragma once
+
+#include <system/graphics.h>
+#include <system/window.h>
+#include <vulkan/vulkan.h>
+
+#include <SkSize.h>
+#include <SkRefCnt.h>
+
+#include "IRenderPipeline.h"
+
+class SkSurface;
+
+namespace android {
+namespace uirenderer {
+namespace renderthread {
+
+class VulkanManager;
+
+class VulkanSurface {
+public:
+    static VulkanSurface* Create(ANativeWindow* window,
+                                  ColorMode colorMode,
+                                  SkColorType colorType,
+                                  sk_sp<SkColorSpace> colorSpace,
+                                  GrContext* grContext,
+                                  const VulkanManager& vkManager);
+    ~VulkanSurface();
+
+    sk_sp<SkSurface> getCurrentSkSurface() { return mNativeBuffers[mDequeuedIndex].skSurface; }
+    const SkMatrix& getCurrentPreTransform() { return mWindowInfo.preTransform; }
+
+private:
+    /*
+     * All structs/methods in this private section are specifically for use by the VulkanManager
+     *
+     */
+    friend VulkanManager;
+    struct NativeBufferInfo {
+        sk_sp<SkSurface> skSurface;
+        sp<ANativeWindowBuffer> buffer;
+        // The fence is only valid when the buffer is dequeued, and should be
+        // -1 any other time. When valid, we own the fd, and must ensure it is
+        // closed: either by closing it explicitly when queueing the buffer,
+        // or by passing ownership e.g. to ANativeWindow::cancelBuffer().
+        int dequeue_fence = -1;
+        bool dequeued = false;
+        uint32_t lastPresentedCount = 0;
+        bool hasValidContents = false;
+    };
+
+    NativeBufferInfo* dequeueNativeBuffer();
+    NativeBufferInfo* getCurrentBufferInfo() { return &mNativeBuffers[mDequeuedIndex]; }
+    bool presentCurrentBuffer(const SkRect& dirtyRect, int semaphoreFd);
+
+    // The width and height are are the logical width and height for when submitting draws to the
+    // surface. In reality if the window is rotated the underlying window may have the width and
+    // height swapped.
+    int logicalWidth() const { return mWindowInfo.size.width(); }
+    int logicalHeight() const { return mWindowInfo.size.height(); }
+    int getCurrentBuffersAge();
+
+private:
+    /*
+     * All code below this line while logically available to VulkanManager should not be treated
+     * as private to this class.
+     *
+     */
+    static constexpr int sMaxBufferCount = 3;
+
+    struct WindowInfo {
+        SkISize size;
+        PixelFormat pixelFormat;
+        android_dataspace dataspace;
+        int transform;
+        int bufferCount;
+        uint64_t windowUsageFlags;
+
+        // size of the ANativeWindow if the inverse of transform requires us to swap width/height
+        SkISize actualSize;
+        // transform to be applied to the SkSurface to map the coordinates to the provided transform
+        SkMatrix preTransform;
+    };
+
+    VulkanSurface(ANativeWindow* window,
+                  const WindowInfo& windowInfo,
+                  SkISize minWindowSize,
+                  SkISize maxWindowSize,
+                  GrContext* grContext);
+    static bool UpdateWindow(ANativeWindow* window,
+                             const WindowInfo& windowInfo);
+    static void ComputeWindowSizeAndTransform(WindowInfo* windowInfo,
+                                              const SkISize& minSize,
+                                              const SkISize& maxSize);
+    void releaseBuffers();
+
+    NativeBufferInfo mNativeBuffers[VulkanSurface::sMaxBufferCount];
+
+    sp<ANativeWindow> mNativeWindow;
+    WindowInfo mWindowInfo;
+    GrContext* mGrContext;
+
+    int mDequeuedIndex = -1;
+    uint32_t mPresentCount = 0;
+
+    const SkISize mMinWindowSize;
+    const SkISize mMaxWindowSize;
+};
+
+} /* namespace renderthread */
+} /* namespace uirenderer */
+} /* namespace android */
\ No newline at end of file
diff --git a/libs/incident/include/android/os/IncidentReportArgs.h b/libs/incident/include/android/os/IncidentReportArgs.h
index 5e8eac1..f056d3b 100644
--- a/libs/incident/include/android/os/IncidentReportArgs.h
+++ b/libs/incident/include/android/os/IncidentReportArgs.h
@@ -47,12 +47,16 @@
     void setAll(bool all);
     void setDest(int dest);
     void addSection(int section);
+    void setReceiverPkg(const string& pkg);
+    void setReceiverCls(const string& cls);
     void addHeader(const vector<uint8_t>& headerProto);
 
     inline bool all() const { return mAll; }
     bool containsSection(int section) const;
     inline int dest() const { return mDest; }
     inline const set<int>& sections() const { return mSections; }
+    inline const String16& receiverPkg() const { return mReceiverPkg; }
+    inline const String16& receiverCls() const { return mReceiverCls; }
     inline const vector<vector<uint8_t>>& headers() const { return mHeaders; }
 
     void merge(const IncidentReportArgs& that);
@@ -62,6 +66,8 @@
     vector<vector<uint8_t>> mHeaders;
     bool mAll;
     int mDest;
+    String16 mReceiverPkg;
+    String16 mReceiverCls;
 };
 
 }
diff --git a/libs/incident/src/IncidentReportArgs.cpp b/libs/incident/src/IncidentReportArgs.cpp
index 06b7a5b..46c8dcf9 100644
--- a/libs/incident/src/IncidentReportArgs.cpp
+++ b/libs/incident/src/IncidentReportArgs.cpp
@@ -81,6 +81,16 @@
         return err;
     }
 
+    err = out->writeString16(mReceiverPkg);
+    if (err != NO_ERROR) {
+        return err;
+    }
+
+    err = out->writeString16(mReceiverCls);
+    if (err != NO_ERROR) {
+        return err;
+    }
+
     return NO_ERROR;
 }
 
@@ -134,6 +144,9 @@
     }
     mDest = dest;
 
+    mReceiverPkg = in->readString16();
+    mReceiverCls = in->readString16();
+
     return OK;
 }
 
@@ -161,6 +174,18 @@
 }
 
 void
+IncidentReportArgs::setReceiverPkg(const string& pkg)
+{
+    mReceiverPkg = String16(pkg.c_str());
+}
+
+void
+IncidentReportArgs::setReceiverCls(const string& cls)
+{
+    mReceiverCls = String16(cls.c_str());
+}
+
+void
 IncidentReportArgs::addHeader(const vector<uint8_t>& headerProto)
 {
     mHeaders.push_back(headerProto);
diff --git a/location/java/android/location/Address.java b/location/java/android/location/Address.java
index 83f05c2..bb97c78 100644
--- a/location/java/android/location/Address.java
+++ b/location/java/android/location/Address.java
@@ -472,7 +472,7 @@
         return sb.toString();
     }
 
-    public static final Parcelable.Creator<Address> CREATOR =
+    public static final @android.annotation.NonNull Parcelable.Creator<Address> CREATOR =
         new Parcelable.Creator<Address>() {
         public Address createFromParcel(Parcel in) {
             String language = in.readString();
diff --git a/location/java/android/location/Country.java b/location/java/android/location/Country.java
index 6f82b78..f3c2a16 100644
--- a/location/java/android/location/Country.java
+++ b/location/java/android/location/Country.java
@@ -137,7 +137,7 @@
         return mTimestamp;
     }
 
-    public static final Parcelable.Creator<Country> CREATOR = new Parcelable.Creator<Country>() {
+    public static final @android.annotation.NonNull Parcelable.Creator<Country> CREATOR = new Parcelable.Creator<Country>() {
         public Country createFromParcel(Parcel in) {
             return new Country(in.readString(), in.readInt(), in.readLong());
         }
diff --git a/location/java/android/location/Criteria.java b/location/java/android/location/Criteria.java
index 74eb445..1370b10 100644
--- a/location/java/android/location/Criteria.java
+++ b/location/java/android/location/Criteria.java
@@ -324,7 +324,7 @@
         return mBearingRequired;
     }
 
-    public static final Parcelable.Creator<Criteria> CREATOR =
+    public static final @android.annotation.NonNull Parcelable.Creator<Criteria> CREATOR =
         new Parcelable.Creator<Criteria>() {
         @Override
         public Criteria createFromParcel(Parcel in) {
diff --git a/location/java/android/location/FusedBatchOptions.java b/location/java/android/location/FusedBatchOptions.java
index aa4a860..4a022c3 100644
--- a/location/java/android/location/FusedBatchOptions.java
+++ b/location/java/android/location/FusedBatchOptions.java
@@ -113,7 +113,7 @@
     /*
      * Method definitions to support Parcelable operations.
      */
-    public static final Parcelable.Creator<FusedBatchOptions> CREATOR =
+    public static final @android.annotation.NonNull Parcelable.Creator<FusedBatchOptions> CREATOR =
             new Parcelable.Creator<FusedBatchOptions>() {
         @Override
         public FusedBatchOptions createFromParcel(Parcel parcel) {
diff --git a/location/java/android/location/GeocoderParams.java b/location/java/android/location/GeocoderParams.java
index d90e4b5..45d92ee 100644
--- a/location/java/android/location/GeocoderParams.java
+++ b/location/java/android/location/GeocoderParams.java
@@ -67,7 +67,7 @@
         return mPackageName;
     }
 
-    public static final Parcelable.Creator<GeocoderParams> CREATOR =
+    public static final @android.annotation.NonNull Parcelable.Creator<GeocoderParams> CREATOR =
         new Parcelable.Creator<GeocoderParams>() {
         public GeocoderParams createFromParcel(Parcel in) {
             GeocoderParams gp = new GeocoderParams();
diff --git a/location/java/android/location/Geofence.java b/location/java/android/location/Geofence.java
index ed2aa64..9570b26 100644
--- a/location/java/android/location/Geofence.java
+++ b/location/java/android/location/Geofence.java
@@ -100,7 +100,7 @@
     }
 
     @UnsupportedAppUsage
-    public static final Parcelable.Creator<Geofence> CREATOR = new Parcelable.Creator<Geofence>() {
+    public static final @android.annotation.NonNull Parcelable.Creator<Geofence> CREATOR = new Parcelable.Creator<Geofence>() {
         @Override
         public Geofence createFromParcel(Parcel in) {
             int type = in.readInt();
diff --git a/location/java/android/location/GnssClock.java b/location/java/android/location/GnssClock.java
index 671c57c..8507c83 100644
--- a/location/java/android/location/GnssClock.java
+++ b/location/java/android/location/GnssClock.java
@@ -431,7 +431,7 @@
         mHardwareClockDiscontinuityCount = value;
     }
 
-    public static final Creator<GnssClock> CREATOR = new Creator<GnssClock>() {
+    public static final @android.annotation.NonNull Creator<GnssClock> CREATOR = new Creator<GnssClock>() {
         @Override
         public GnssClock createFromParcel(Parcel parcel) {
             GnssClock gpsClock = new GnssClock();
diff --git a/location/java/android/location/GnssMeasurement.java b/location/java/android/location/GnssMeasurement.java
index a545f2e..446ea85 100644
--- a/location/java/android/location/GnssMeasurement.java
+++ b/location/java/android/location/GnssMeasurement.java
@@ -1509,7 +1509,7 @@
         }
     }
 
-    public static final Creator<GnssMeasurement> CREATOR = new Creator<GnssMeasurement>() {
+    public static final @android.annotation.NonNull Creator<GnssMeasurement> CREATOR = new Creator<GnssMeasurement>() {
         @Override
         public GnssMeasurement createFromParcel(Parcel parcel) {
             GnssMeasurement gnssMeasurement = new GnssMeasurement();
diff --git a/location/java/android/location/GnssMeasurementCorrections.java b/location/java/android/location/GnssMeasurementCorrections.java
index 9d3211d..3e32c21 100644
--- a/location/java/android/location/GnssMeasurementCorrections.java
+++ b/location/java/android/location/GnssMeasurementCorrections.java
@@ -16,11 +16,16 @@
 
 package android.location;
 
+import android.annotation.FloatRange;
+import android.annotation.IntRange;
+import android.annotation.NonNull;
 import android.annotation.Nullable;
 import android.annotation.SystemApi;
 import android.os.Parcel;
 import android.os.Parcelable;
 
+import com.android.internal.util.Preconditions;
+
 import java.util.ArrayList;
 import java.util.Collections;
 import java.util.List;
@@ -35,37 +40,44 @@
 public final class GnssMeasurementCorrections implements Parcelable {
 
     /** Represents latitude in degrees at which the corrections are computed. */
-    private double mLatitudeDegrees;
+    @FloatRange(from = -90.0f, to = 90.0f)
+    private final double mLatitudeDegrees;
     /** Represents longitude in degrees at which the corrections are computed. */
-    private double mLongitudeDegrees;
+    @FloatRange(from = -180.0f, to = 180.0f)
+    private final double mLongitudeDegrees;
     /**
      * Represents altitude in meters above the WGS 84 reference ellipsoid at which the corrections
      * are computed.
      */
-    private double mAltitudeMeters;
+    @FloatRange(from = -1000.0, to = 10000.0f)
+    private final double mAltitudeMeters;
     /**
      * Represents the horizontal uncertainty (68% confidence) in meters on the device position at
      * which the corrections are provided.
      *
      * <p> This value is useful for example to judge how accurate the provided corrections are.
      */
-    private double mHorizontalPositionUncertaintyMeters;
+    @FloatRange(from = 0.0f)
+    private final double mHorizontalPositionUncertaintyMeters;
     /**
      * Represents the vertical uncertainty (68% confidence) in meters on the device position at
      * which the corrections are provided.
      *
      * <p> This value is useful for example to judge how accurate the provided corrections are.
      */
-    private double mVerticalPositionUncertaintyMeters;
+    @FloatRange(from = 0.0f)
+    private final double mVerticalPositionUncertaintyMeters;
 
     /** Time Of Applicability, GPS time of week in nanoseconds. */
-    private long mToaGpsNanosecondsOfWeek;
+    @IntRange(from = 0)
+    private final long mToaGpsNanosecondsOfWeek;
 
     /**
      * A set of {@link GnssSingleSatCorrection} each containing measurement corrections for a
      * satellite in view.
      */
-    private @Nullable List<GnssSingleSatCorrection> mSingleSatCorrectionList;
+    @NonNull
+    private final List<GnssSingleSatCorrection> mSingleSatCorrectionList;
 
     private GnssMeasurementCorrections(Builder builder) {
         mLatitudeDegrees = builder.mLatitudeDegrees;
@@ -74,19 +86,19 @@
         mHorizontalPositionUncertaintyMeters = builder.mHorizontalPositionUncertaintyMeters;
         mVerticalPositionUncertaintyMeters = builder.mVerticalPositionUncertaintyMeters;
         mToaGpsNanosecondsOfWeek = builder.mToaGpsNanosecondsOfWeek;
-        mSingleSatCorrectionList =
-                builder.mSingleSatCorrectionList == null
-                        ? null
-                        : Collections.unmodifiableList(
-                                new ArrayList<>(builder.mSingleSatCorrectionList));
+        final List<GnssSingleSatCorrection> singleSatCorrList =  builder.mSingleSatCorrectionList;
+        Preconditions.checkArgument(singleSatCorrList != null && !singleSatCorrList.isEmpty());
+        mSingleSatCorrectionList = Collections.unmodifiableList(new ArrayList<>(singleSatCorrList));
     }
 
     /** Gets the latitude in degrees at which the corrections are computed. */
+    @FloatRange(from = -90.0f, to = 90.0f)
     public double getLatitudeDegrees() {
         return mLatitudeDegrees;
     }
 
     /** Gets the longitude in degrees at which the corrections are computed. */
+    @FloatRange(from = -180.0f, to = 180.0f)
     public double getLongitudeDegrees() {
         return mLongitudeDegrees;
     }
@@ -95,6 +107,7 @@
      * Gets the altitude in meters above the WGS 84 reference ellipsoid at which the corrections are
      * computed.
      */
+    @FloatRange(from = -1000.0f, to = 10000.0f)
     public double getAltitudeMeters() {
         return mAltitudeMeters;
     }
@@ -103,6 +116,7 @@
      * Gets the horizontal uncertainty (68% confidence) in meters on the device position at
      * which the corrections are provided.
      */
+    @FloatRange(from = 0.0f)
     public double getHorizontalPositionUncertaintyMeters() {
         return mHorizontalPositionUncertaintyMeters;
     }
@@ -111,11 +125,13 @@
      * Gets the vertical uncertainty (68% confidence) in meters on the device position at
      * which the corrections are provided.
      */
+    @FloatRange(from = 0.0f)
     public double getVerticalPositionUncertaintyMeters() {
         return mVerticalPositionUncertaintyMeters;
     }
 
     /** Gets the time of applicability, GPS time of week in nanoseconds. */
+    @IntRange(from = 0)
     public long getToaGpsNanosecondsOfWeek() {
         return mToaGpsNanosecondsOfWeek;
     }
@@ -124,7 +140,8 @@
      * Gets a set of {@link GnssSingleSatCorrection} each containing measurement corrections for a
      * satellite in view
      */
-    public @Nullable List<GnssSingleSatCorrection> getSingleSatelliteCorrectionList() {
+    @NonNull
+    public List<GnssSingleSatCorrection> getSingleSatelliteCorrectionList() {
         return mSingleSatCorrectionList;
     }
 
@@ -136,7 +153,8 @@
     public static final Creator<GnssMeasurementCorrections> CREATOR =
             new Creator<GnssMeasurementCorrections>() {
                 @Override
-                public GnssMeasurementCorrections createFromParcel(Parcel parcel) {
+                @NonNull
+                public GnssMeasurementCorrections createFromParcel(@NonNull Parcel parcel) {
                     final GnssMeasurementCorrections.Builder gnssMeasurementCorrectons =
                             new Builder()
                                     .setLatitudeDegrees(parcel.readDouble())
@@ -148,7 +166,7 @@
                     List<GnssSingleSatCorrection> singleSatCorrectionList = new ArrayList<>();
                     parcel.readTypedList(singleSatCorrectionList, GnssSingleSatCorrection.CREATOR);
                     gnssMeasurementCorrectons.setSingleSatelliteCorrectionList(
-                            singleSatCorrectionList.isEmpty() ? null : singleSatCorrectionList);
+                            singleSatCorrectionList);
                     return gnssMeasurementCorrectons.build();
                 }
 
@@ -177,7 +195,7 @@
     }
 
     @Override
-    public void writeToParcel(Parcel parcel, int flags) {
+    public void writeToParcel(@NonNull Parcel parcel, int flags) {
         parcel.writeDouble(mLatitudeDegrees);
         parcel.writeDouble(mLongitudeDegrees);
         parcel.writeDouble(mAltitudeMeters);
@@ -199,16 +217,18 @@
         private double mHorizontalPositionUncertaintyMeters;
         private double mVerticalPositionUncertaintyMeters;
         private long mToaGpsNanosecondsOfWeek;
-        private List<GnssSingleSatCorrection> mSingleSatCorrectionList;
+        @Nullable private List<GnssSingleSatCorrection> mSingleSatCorrectionList;
 
         /** Sets the latitude in degrees at which the corrections are computed. */
-        public Builder setLatitudeDegrees(double latitudeDegrees) {
+        @NonNull public Builder setLatitudeDegrees(
+                @FloatRange(from = -90.0f, to = 90.0f) double latitudeDegrees) {
             mLatitudeDegrees = latitudeDegrees;
             return this;
         }
 
         /** Sets the longitude in degrees at which the corrections are computed. */
-        public Builder setLongitudeDegrees(double longitudeDegrees) {
+        @NonNull public Builder setLongitudeDegrees(
+                @FloatRange(from = -180.0f, to = 180.0f) double longitudeDegrees) {
             mLongitudeDegrees = longitudeDegrees;
             return this;
         }
@@ -217,7 +237,8 @@
          * Sets the altitude in meters above the WGS 84 reference ellipsoid at which the corrections
          * are computed.
          */
-        public Builder setAltitudeMeters(double altitudeMeters) {
+        @NonNull public Builder setAltitudeMeters(
+                @FloatRange(from = -1000.0f, to = 10000.0f) double altitudeMeters) {
             mAltitudeMeters = altitudeMeters;
             return this;
         }
@@ -227,8 +248,8 @@
          * Sets the horizontal uncertainty (68% confidence) in meters on the device position at
          * which the corrections are provided.
          */
-        public Builder setHorizontalPositionUncertaintyMeters(
-                double horizontalPositionUncertaintyMeters) {
+        @NonNull public Builder setHorizontalPositionUncertaintyMeters(
+                @FloatRange(from = 0.0f) double horizontalPositionUncertaintyMeters) {
             mHorizontalPositionUncertaintyMeters = horizontalPositionUncertaintyMeters;
             return this;
         }
@@ -237,14 +258,15 @@
          * Sets the vertical uncertainty (68% confidence) in meters on the device position at which
          * the corrections are provided.
          */
-        public Builder setVerticalPositionUncertaintyMeters(
-                double verticalPositionUncertaintyMeters) {
+        @NonNull public Builder setVerticalPositionUncertaintyMeters(
+                @FloatRange(from = 0.0f) double verticalPositionUncertaintyMeters) {
             mVerticalPositionUncertaintyMeters = verticalPositionUncertaintyMeters;
             return this;
         }
 
         /** Sets the time of applicability, GPS time of week in nanoseconds. */
-        public Builder setToaGpsNanosecondsOfWeek(long toaGpsNanosecondsOfWeek) {
+        @NonNull public Builder setToaGpsNanosecondsOfWeek(
+                @IntRange(from = 0) long toaGpsNanosecondsOfWeek) {
             mToaGpsNanosecondsOfWeek = toaGpsNanosecondsOfWeek;
             return this;
         }
@@ -253,19 +275,14 @@
          * Sets a the list of {@link GnssSingleSatCorrection} containing measurement corrections for
          * a satellite in view
          */
-        public Builder setSingleSatelliteCorrectionList(
-                @Nullable List<GnssSingleSatCorrection> singleSatCorrectionList) {
-            if (singleSatCorrectionList == null) {
-                mSingleSatCorrectionList = null;
-            } else {
-                mSingleSatCorrectionList =
-                        Collections.unmodifiableList(new ArrayList<>(singleSatCorrectionList));
-            }
+        @NonNull public Builder setSingleSatelliteCorrectionList(
+                @NonNull List<GnssSingleSatCorrection> singleSatCorrectionList) {
+            mSingleSatCorrectionList = singleSatCorrectionList;
             return this;
         }
 
         /** Builds a {@link GnssMeasurementCorrections} instance as specified by this builder. */
-        public GnssMeasurementCorrections build() {
+        @NonNull public GnssMeasurementCorrections build() {
             return new GnssMeasurementCorrections(this);
         }
     }
diff --git a/location/java/android/location/GnssMeasurementsEvent.java b/location/java/android/location/GnssMeasurementsEvent.java
index 34c7354..98ef2d4 100644
--- a/location/java/android/location/GnssMeasurementsEvent.java
+++ b/location/java/android/location/GnssMeasurementsEvent.java
@@ -130,7 +130,7 @@
         return mReadOnlyMeasurements;
     }
 
-    public static final Creator<GnssMeasurementsEvent> CREATOR =
+    public static final @android.annotation.NonNull Creator<GnssMeasurementsEvent> CREATOR =
             new Creator<GnssMeasurementsEvent>() {
         @Override
         public GnssMeasurementsEvent createFromParcel(Parcel in) {
diff --git a/location/java/android/location/GnssNavigationMessage.java b/location/java/android/location/GnssNavigationMessage.java
index c7188aa..a83db3f 100644
--- a/location/java/android/location/GnssNavigationMessage.java
+++ b/location/java/android/location/GnssNavigationMessage.java
@@ -365,7 +365,7 @@
         }
     }
 
-    public static final Creator<GnssNavigationMessage> CREATOR =
+    public static final @android.annotation.NonNull Creator<GnssNavigationMessage> CREATOR =
             new Creator<GnssNavigationMessage>() {
         @Override
         public GnssNavigationMessage createFromParcel(Parcel parcel) {
diff --git a/location/java/android/location/GnssReflectingPlane.java b/location/java/android/location/GnssReflectingPlane.java
index 9a106a7..9d05287 100644
--- a/location/java/android/location/GnssReflectingPlane.java
+++ b/location/java/android/location/GnssReflectingPlane.java
@@ -16,6 +16,8 @@
 
 package android.location;
 
+import android.annotation.FloatRange;
+import android.annotation.NonNull;
 import android.annotation.SystemApi;
 import android.os.Parcel;
 import android.os.Parcelable;
@@ -29,17 +31,21 @@
 public final class GnssReflectingPlane implements Parcelable {
 
     /** Represents latitude in degrees of the reflecting plane */
-    private double mLatitudeDegrees;
+    @FloatRange(from = -90.0f, to = 90.0f)
+    private final double mLatitudeDegrees;
     /** Represents longitude in degrees of the reflecting plane. */
-    private double mLongitudeDegrees;
+    @FloatRange(from = -180.0f, to = 180.0f)
+    private final double mLongitudeDegrees;
     /**
      * Represents altitude in meters above the WGS 84 reference ellipsoid of the reflection point in
      * the plane
      */
-    private double mAltitudeMeters;
+    @FloatRange(from = -1000.0f, to = 10000.0f)
+    private final double mAltitudeMeters;
 
     /** Represents azimuth clockwise from north of the reflecting plane in degrees. */
-    private double mAzimuthDegrees;
+    @FloatRange(from = 0.0f, to = 360.0f)
+    private final double mAzimuthDegrees;
 
     private GnssReflectingPlane(Builder builder) {
         mLatitudeDegrees = builder.mLatitudeDegrees;
@@ -49,11 +55,13 @@
     }
 
     /** Gets the latitude in degrees of the reflecting plane. */
+    @FloatRange(from = -90.0f, to = 90.0f)
     public double getLatitudeDegrees() {
         return mLatitudeDegrees;
     }
 
     /** Gets the longitude in degrees of the reflecting plane. */
+    @FloatRange(from = -180.0f, to = 180.0f)
     public double getLongitudeDegrees() {
         return mLongitudeDegrees;
     }
@@ -62,11 +70,13 @@
      * Gets the altitude in meters above the WGS 84 reference ellipsoid of the reflecting point
      * within the plane
      */
+    @FloatRange(from = -1000.0f, to = 10000.0f)
     public double getAltitudeMeters() {
         return mAltitudeMeters;
     }
 
     /** Gets the azimuth clockwise from north of the reflecting plane in degrees. */
+    @FloatRange(from = 0.0f, to = 360.0f)
     public double getAzimuthDegrees() {
         return mAzimuthDegrees;
     }
@@ -79,7 +89,8 @@
     public static final Creator<GnssReflectingPlane> CREATOR =
             new Creator<GnssReflectingPlane>() {
                 @Override
-                public GnssReflectingPlane createFromParcel(Parcel parcel) {
+                @NonNull
+                public GnssReflectingPlane createFromParcel(@NonNull Parcel parcel) {
                     GnssReflectingPlane reflectingPlane =
                             new Builder()
                                     .setLatitudeDegrees(parcel.readDouble())
@@ -108,7 +119,7 @@
     }
 
     @Override
-    public void writeToParcel(Parcel parcel, int flags) {
+    public void writeToParcel(@NonNull Parcel parcel, int flags) {
         parcel.writeDouble(mLatitudeDegrees);
         parcel.writeDouble(mLongitudeDegrees);
         parcel.writeDouble(mAltitudeMeters);
@@ -119,19 +130,20 @@
     public static final class Builder {
         /** For documentation, see corresponding fields in {@link GnssReflectingPlane}. */
         private double mLatitudeDegrees;
-
         private double mLongitudeDegrees;
         private double mAltitudeMeters;
         private double mAzimuthDegrees;
 
         /** Sets the latitude in degrees of the reflecting plane. */
-        public Builder setLatitudeDegrees(double latitudeDegrees) {
+        @NonNull public Builder setLatitudeDegrees(
+                @FloatRange(from = -90.0f, to = 90.0f) double latitudeDegrees) {
             mLatitudeDegrees = latitudeDegrees;
             return this;
         }
 
         /** Sets the longitude in degrees of the reflecting plane. */
-        public Builder setLongitudeDegrees(double longitudeDegrees) {
+        @NonNull public Builder setLongitudeDegrees(
+                @FloatRange(from = -180.0f, to = 180.0f) double longitudeDegrees) {
             mLongitudeDegrees = longitudeDegrees;
             return this;
         }
@@ -140,19 +152,21 @@
          * Sets the altitude in meters above the WGS 84 reference ellipsoid of the reflecting point
          * within the plane
          */
-        public Builder setAltitudeMeters(double altitudeMeters) {
+        @NonNull public Builder setAltitudeMeters(
+                @FloatRange(from = -1000.0f, to = 10000.0f) double altitudeMeters) {
             mAltitudeMeters = altitudeMeters;
             return this;
         }
 
         /** Sets the azimuth clockwise from north of the reflecting plane in degrees. */
-        public Builder setAzimuthDegrees(double azimuthDegrees) {
+        @NonNull public Builder setAzimuthDegrees(
+                @FloatRange(from = 0.0f, to = 360.0f) double azimuthDegrees) {
             mAzimuthDegrees = azimuthDegrees;
             return this;
         }
 
         /** Builds a {@link GnssReflectingPlane} object as specified by this builder. */
-        public GnssReflectingPlane build() {
+        @NonNull public GnssReflectingPlane build() {
             return new GnssReflectingPlane(this);
         }
     }
diff --git a/location/java/android/location/GnssSingleSatCorrection.java b/location/java/android/location/GnssSingleSatCorrection.java
index f719e1a..e901909 100644
--- a/location/java/android/location/GnssSingleSatCorrection.java
+++ b/location/java/android/location/GnssSingleSatCorrection.java
@@ -17,6 +17,8 @@
 package android.location;
 
 import android.annotation.FloatRange;
+import android.annotation.IntRange;
+import android.annotation.NonNull;
 import android.annotation.Nullable;
 import android.annotation.SystemApi;
 import android.os.Parcel;
@@ -35,40 +37,49 @@
     /**
      * Bit mask for {@link #mSingleSatCorrectionFlags} indicating the presence of {@link
      * #mProbSatIsLos}.
+     *
+     * @hide
      */
     public static final int HAS_PROB_SAT_IS_LOS_MASK = 1 << 0;
 
     /**
      * Bit mask for {@link #mSingleSatCorrectionFlags} indicating the presence of {@link
      * #mExcessPathLengthMeters}.
+     *
+     * @hide
      */
     public static final int HAS_EXCESS_PATH_LENGTH_MASK = 1 << 1;
 
     /**
      * Bit mask for {@link #mSingleSatCorrectionFlags} indicating the presence of {@link
      * #mExcessPathLengthUncertaintyMeters}.
+     *
+     * @hide
      */
     public static final int HAS_EXCESS_PATH_LENGTH_UNC_MASK = 1 << 2;
 
     /**
      * Bit mask for {@link #mSingleSatCorrectionFlags} indicating the presence of {@link
      * #mReflectingPlane}.
+     *
+     * @hide
      */
     public static final int HAS_REFLECTING_PLANE_MASK = 1 << 3;
 
     /** A bitmask of fields present in this object (see HAS_* constants defined above) */
-    private int mSingleSatCorrectionFlags;
+    private final int mSingleSatCorrectionFlags;
 
     /** Defines the constellation of the given satellite as defined in {@link GnssStatus}. */
     @GnssStatus.ConstellationType
-    private int mConstellationType;
+    private final int mConstellationType;
 
     /**
      * Satellite vehicle ID number
      *
      * <p>Interpretation depends on {@link GnssStatus#getSvid(int)}.
      */
-    private int mSatId;
+    @IntRange(from = 0)
+    private final int mSatId;
 
     /**
      * Carrier frequency of the signal to be corrected, for example it can be the GPS center
@@ -79,22 +90,25 @@
      * values related to L1 will be filled, and in the other all of the values related to L5 will be
      * filled.
      */
-    private float mCarrierFrequencyHz;
+    @FloatRange(from = 0.0f,  fromInclusive = false)
+    private final float mCarrierFrequencyHz;
 
     /**
      * The probability that the satellite is estimated to be in Line-of-Sight condition at the given
      * location.
      */
-    @FloatRange(from = 0f, to = 1f)
-    private float mProbSatIsLos;
+    @FloatRange(from = 0.0f, to = 1.0f)
+    private final float mProbSatIsLos;
 
     /**
      * Excess path length to be subtracted from pseudorange before using it in calculating location.
      */
-    private float mExcessPathLengthMeters;
+    @FloatRange(from = 0.0f)
+    private final float mExcessPathLengthMeters;
 
     /** Error estimate (1-sigma) for the Excess path length estimate */
-    private float mExcessPathLengthUncertaintyMeters;
+    @FloatRange(from = 0.0f)
+    private final float mExcessPathLengthUncertaintyMeters;
 
     /**
      * Defines the reflecting plane location and azimuth information
@@ -102,7 +116,8 @@
      * <p>The flag HAS_REFLECTING_PLANE will be used to set this value to invalid if the satellite
      * signal goes through multiple reflections or if reflection plane serving is not supported.
      */
-    private @Nullable GnssReflectingPlane mReflectingPlane;
+    @Nullable
+    private final GnssReflectingPlane mReflectingPlane;
 
     private GnssSingleSatCorrection(Builder builder) {
         mSingleSatCorrectionFlags = builder.mSingleSatCorrectionFlags;
@@ -115,7 +130,11 @@
         mReflectingPlane = builder.mReflectingPlane;
     }
 
-    /** Gets a bitmask of fields present in this object */
+    /**
+     * Gets a bitmask of fields present in this object
+     *
+     * @hide
+     */
     public int getSingleSatelliteCorrectionFlags() {
         return mSingleSatCorrectionFlags;
     }
@@ -137,6 +156,7 @@
      * <p>Interpretation depends on {@link #getConstellationType()}. See {@link
      * GnssStatus#getSvid(int)}.
      */
+    @IntRange(from = 0)
     public int getSatelliteId() {
         return mSatId;
     }
@@ -154,6 +174,7 @@
      *
      * @return the carrier frequency of the signal tracked in Hz.
      */
+    @FloatRange(from = 0.0f,  fromInclusive = false)
     public float getCarrierFrequencyHz() {
         return mCarrierFrequencyHz;
     }
@@ -162,7 +183,7 @@
      * Returns the probability that the satellite is in line-of-sight condition at the given
      * location.
      */
-    @FloatRange(from = 0f, to = 1f)
+    @FloatRange(from = 0.0f, to = 1.0f)
     public float getProbabilityLineOfSight() {
         return mProbSatIsLos;
     }
@@ -171,11 +192,13 @@
      * Returns the Excess path length to be subtracted from pseudorange before using it in
      * calculating location.
      */
+    @FloatRange(from = 0.0f)
     public float getExcessPathLengthMeters() {
         return mExcessPathLengthMeters;
     }
 
     /** Returns the error estimate (1-sigma) for the Excess path length estimate */
+    @FloatRange(from = 0.0f)
     public float getExcessPathLengthUncertaintyMeters() {
         return mExcessPathLengthUncertaintyMeters;
     }
@@ -186,7 +209,8 @@
      * <p>The flag HAS_REFLECTING_PLANE will be used to set this value to invalid if the satellite
      * signal goes through multiple reflections or if reflection plane serving is not supported
      */
-    public @Nullable GnssReflectingPlane getReflectingPlane() {
+    @Nullable
+    public GnssReflectingPlane getReflectingPlane() {
         return mReflectingPlane;
     }
 
@@ -218,20 +242,24 @@
     public static final Creator<GnssSingleSatCorrection> CREATOR =
             new Creator<GnssSingleSatCorrection>() {
                 @Override
-                public GnssSingleSatCorrection createFromParcel(Parcel parcel) {
-                    GnssSingleSatCorrection singleSatCorrection =
+                @NonNull
+                public GnssSingleSatCorrection createFromParcel(@NonNull Parcel parcel) {
+                    int mSingleSatCorrectionFlags = parcel.readInt();
+                    boolean hasReflectingPlane =
+                            (mSingleSatCorrectionFlags & HAS_REFLECTING_PLANE_MASK) != 0;
+                    final GnssSingleSatCorrection.Builder singleSatCorrectionBuilder =
                             new Builder()
-                                    .setSingleSatelliteCorrectionFlags(parcel.readInt())
                                     .setConstellationType(parcel.readInt())
                                     .setSatelliteId(parcel.readInt())
                                     .setCarrierFrequencyHz(parcel.readFloat())
                                     .setProbabilityLineOfSight(parcel.readFloat())
                                     .setExcessPathLengthMeters(parcel.readFloat())
-                                    .setExcessPathLengthUncertaintyMeters(parcel.readFloat())
-                                    .setReflectingPlane(
-                                            GnssReflectingPlane.CREATOR.createFromParcel(parcel))
-                                    .build();
-                    return singleSatCorrection;
+                                    .setExcessPathLengthUncertaintyMeters(parcel.readFloat());
+                    if (hasReflectingPlane) {
+                        singleSatCorrectionBuilder.setReflectingPlane(
+                                GnssReflectingPlane.CREATOR.createFromParcel(parcel));
+                    }
+                    return singleSatCorrectionBuilder.build();
                 }
 
                 @Override
@@ -256,12 +284,14 @@
                         format,
                         "ExcessPathLengthUncertaintyMeters = ",
                         mExcessPathLengthUncertaintyMeters));
-        builder.append(String.format(format, "ReflectingPlane = ", mReflectingPlane));
+        if (hasReflectingPlane()) {
+            builder.append(String.format(format, "ReflectingPlane = ", mReflectingPlane));
+        }
         return builder.toString();
     }
 
     @Override
-    public void writeToParcel(Parcel parcel, int flags) {
+    public void writeToParcel(@NonNull Parcel parcel, int flags) {
         parcel.writeInt(mSingleSatCorrectionFlags);
         parcel.writeInt(mConstellationType);
         parcel.writeInt(mSatId);
@@ -269,7 +299,9 @@
         parcel.writeFloat(mProbSatIsLos);
         parcel.writeFloat(mExcessPathLengthMeters);
         parcel.writeFloat(mExcessPathLengthUncertaintyMeters);
-        mReflectingPlane.writeToParcel(parcel, flags);
+        if (hasReflectingPlane()) {
+            mReflectingPlane.writeToParcel(parcel, flags);
+        }
     }
 
     /** Builder for {@link GnssSingleSatCorrection} */
@@ -287,28 +319,25 @@
         private float mProbSatIsLos;
         private float mExcessPathLengthMeters;
         private float mExcessPathLengthUncertaintyMeters;
+        @Nullable
         private GnssReflectingPlane mReflectingPlane;
 
-        /** Sets a bitmask of fields present in this object */
-        public Builder setSingleSatelliteCorrectionFlags(int singleSatCorrectionFlags) {
-            mSingleSatCorrectionFlags = singleSatCorrectionFlags;
-            return this;
-        }
-
         /** Sets the constellation type. */
-        public Builder setConstellationType(@GnssStatus.ConstellationType int constellationType) {
+        @NonNull public Builder setConstellationType(
+                @GnssStatus.ConstellationType int constellationType) {
             mConstellationType = constellationType;
             return this;
         }
 
         /** Sets the Satellite ID defined in the ICD of the given constellation. */
-        public Builder setSatelliteId(int satId) {
+        @NonNull public Builder setSatelliteId(@IntRange(from = 0) int satId) {
             mSatId = satId;
             return this;
         }
 
         /** Sets the Carrier frequency in Hz. */
-        public Builder setCarrierFrequencyHz(float carrierFrequencyHz) {
+        @NonNull public Builder setCarrierFrequencyHz(
+                @FloatRange(from = 0.0f,  fromInclusive = false) float carrierFrequencyHz) {
             mCarrierFrequencyHz = carrierFrequencyHz;
             return this;
         }
@@ -317,8 +346,8 @@
          * Sets the line-of-sight probability of the satellite at the given location in the range
          * between 0 and 1.
          */
-        public Builder setProbabilityLineOfSight(
-                @FloatRange(from = 0f, to = 1f) float probSatIsLos) {
+        @NonNull public Builder setProbabilityLineOfSight(
+                @FloatRange(from = 0.0f, to = 1.0f) float probSatIsLos) {
             Preconditions.checkArgumentInRange(
                     probSatIsLos, 0, 1, "probSatIsLos should be between 0 and 1.");
             mProbSatIsLos = probSatIsLos;
@@ -331,7 +360,8 @@
          * Sets the Excess path length to be subtracted from pseudorange before using it in
          * calculating location.
          */
-        public Builder setExcessPathLengthMeters(float excessPathLengthMeters) {
+        @NonNull public Builder setExcessPathLengthMeters(
+                @FloatRange(from = 0.0f) float excessPathLengthMeters) {
             mExcessPathLengthMeters = excessPathLengthMeters;
             mSingleSatCorrectionFlags =
                     (byte) (mSingleSatCorrectionFlags | HAS_EXCESS_PATH_LENGTH_MASK);
@@ -339,8 +369,8 @@
         }
 
         /** Sets the error estimate (1-sigma) for the Excess path length estimate */
-        public Builder setExcessPathLengthUncertaintyMeters(
-                float excessPathLengthUncertaintyMeters) {
+        @NonNull public Builder setExcessPathLengthUncertaintyMeters(
+                @FloatRange(from = 0.0f) float excessPathLengthUncertaintyMeters) {
             mExcessPathLengthUncertaintyMeters = excessPathLengthUncertaintyMeters;
             mSingleSatCorrectionFlags =
                     (byte) (mSingleSatCorrectionFlags | HAS_EXCESS_PATH_LENGTH_UNC_MASK);
@@ -348,15 +378,20 @@
         }
 
         /** Sets the reflecting plane information */
-        public Builder setReflectingPlane(GnssReflectingPlane reflectingPlane) {
+        @NonNull public Builder setReflectingPlane(@Nullable GnssReflectingPlane reflectingPlane) {
             mReflectingPlane = reflectingPlane;
-            mSingleSatCorrectionFlags =
-                    (byte) (mSingleSatCorrectionFlags | HAS_REFLECTING_PLANE_MASK);
+            if (reflectingPlane != null) {
+                mSingleSatCorrectionFlags =
+                        (byte) (mSingleSatCorrectionFlags | HAS_REFLECTING_PLANE_MASK);
+            } else {
+                mSingleSatCorrectionFlags =
+                        (byte) (mSingleSatCorrectionFlags & ~HAS_REFLECTING_PLANE_MASK);
+            }
             return this;
         }
 
         /** Builds a {@link GnssSingleSatCorrection} instance as specified by this builder. */
-        public GnssSingleSatCorrection build() {
+        @NonNull public GnssSingleSatCorrection build() {
             return new GnssSingleSatCorrection(this);
         }
     }
diff --git a/location/java/android/location/GpsClock.java b/location/java/android/location/GpsClock.java
index 4135a1c..52ba60e 100644
--- a/location/java/android/location/GpsClock.java
+++ b/location/java/android/location/GpsClock.java
@@ -394,7 +394,7 @@
         mDriftUncertaintyInNsPerSec = Double.NaN;
     }
 
-    public static final Creator<GpsClock> CREATOR = new Creator<GpsClock>() {
+    public static final @android.annotation.NonNull Creator<GpsClock> CREATOR = new Creator<GpsClock>() {
         @Override
         public GpsClock createFromParcel(Parcel parcel) {
             GpsClock gpsClock = new GpsClock();
diff --git a/location/java/android/location/GpsMeasurement.java b/location/java/android/location/GpsMeasurement.java
index f13a440..51718b8 100644
--- a/location/java/android/location/GpsMeasurement.java
+++ b/location/java/android/location/GpsMeasurement.java
@@ -1157,7 +1157,7 @@
         mUsedInFix = value;
     }
 
-    public static final Creator<GpsMeasurement> CREATOR = new Creator<GpsMeasurement>() {
+    public static final @android.annotation.NonNull Creator<GpsMeasurement> CREATOR = new Creator<GpsMeasurement>() {
         @Override
         public GpsMeasurement createFromParcel(Parcel parcel) {
             GpsMeasurement gpsMeasurement = new GpsMeasurement();
diff --git a/location/java/android/location/GpsMeasurementsEvent.java b/location/java/android/location/GpsMeasurementsEvent.java
index 1366873..1cd1fb4 100644
--- a/location/java/android/location/GpsMeasurementsEvent.java
+++ b/location/java/android/location/GpsMeasurementsEvent.java
@@ -103,7 +103,7 @@
         return mReadOnlyMeasurements;
     }
 
-    public static final Creator<GpsMeasurementsEvent> CREATOR =
+    public static final @android.annotation.NonNull Creator<GpsMeasurementsEvent> CREATOR =
             new Creator<GpsMeasurementsEvent>() {
         @Override
         public GpsMeasurementsEvent createFromParcel(Parcel in) {
diff --git a/location/java/android/location/GpsNavigationMessage.java b/location/java/android/location/GpsNavigationMessage.java
index 5c3c710..77f0113 100644
--- a/location/java/android/location/GpsNavigationMessage.java
+++ b/location/java/android/location/GpsNavigationMessage.java
@@ -243,7 +243,7 @@
         }
     }
 
-    public static final Creator<GpsNavigationMessage> CREATOR =
+    public static final @android.annotation.NonNull Creator<GpsNavigationMessage> CREATOR =
             new Creator<GpsNavigationMessage>() {
         @Override
         public GpsNavigationMessage createFromParcel(Parcel parcel) {
diff --git a/location/java/android/location/GpsNavigationMessageEvent.java b/location/java/android/location/GpsNavigationMessageEvent.java
index bd6921c..2aa685c 100644
--- a/location/java/android/location/GpsNavigationMessageEvent.java
+++ b/location/java/android/location/GpsNavigationMessageEvent.java
@@ -84,7 +84,7 @@
         return mNavigationMessage;
     }
 
-    public static final Creator<GpsNavigationMessageEvent> CREATOR =
+    public static final @android.annotation.NonNull Creator<GpsNavigationMessageEvent> CREATOR =
             new Creator<GpsNavigationMessageEvent>() {
                 @Override
                 public GpsNavigationMessageEvent createFromParcel(Parcel in) {
diff --git a/location/java/android/location/GpsStatus.java b/location/java/android/location/GpsStatus.java
index 609a15e..4e37654 100644
--- a/location/java/android/location/GpsStatus.java
+++ b/location/java/android/location/GpsStatus.java
@@ -30,6 +30,7 @@
  * <p>This class is used in conjunction with the {@link Listener} interface.
  *
  * @deprecated use {@link GnssStatus} and {@link GnssStatus.Callback}.
+ * @removed
  */
 @Deprecated
 public final class GpsStatus {
@@ -112,6 +113,7 @@
     /**
      * Used for receiving notifications when GPS status has changed.
      * @deprecated use {@link GnssStatus.Callback} instead.
+     * @removed
      */
     @Deprecated
     public interface Listener {
@@ -142,6 +144,7 @@
      * You can implement this interface and call {@link LocationManager#addNmeaListener}
      * to receive NMEA data from the GPS engine.
      * @deprecated use {@link OnNmeaMessageListener} instead.
+     * @removed
      */
     @Deprecated
     public interface NmeaListener {
diff --git a/location/java/android/location/IGeocodeProvider.aidl b/location/java/android/location/IGeocodeProvider.aidl
index aaa70c7..7eaf7b8 100644
--- a/location/java/android/location/IGeocodeProvider.aidl
+++ b/location/java/android/location/IGeocodeProvider.aidl
@@ -26,9 +26,11 @@
  */
 interface IGeocodeProvider {
 
+    @UnsupportedAppUsage
     String getFromLocation(double latitude, double longitude, int maxResults,
         in GeocoderParams params, out List<Address> addrs);
 
+    @UnsupportedAppUsage
     String getFromLocationName(String locationName,
         double lowerLeftLatitude, double lowerLeftLongitude,
         double upperRightLatitude, double upperRightLongitude, int maxResults,
diff --git a/location/java/android/location/IGeofenceProvider.aidl b/location/java/android/location/IGeofenceProvider.aidl
index d4ff0dd..426ebef 100644
--- a/location/java/android/location/IGeofenceProvider.aidl
+++ b/location/java/android/location/IGeofenceProvider.aidl
@@ -24,5 +24,6 @@
  * {@hide}
  */
 oneway interface IGeofenceProvider {
+    @UnsupportedAppUsage
     void setGeofenceHardware(in IGeofenceHardware proxy);
 }
diff --git a/location/java/android/location/ILocationListener.aidl b/location/java/android/location/ILocationListener.aidl
index 180183e..ec11345 100644
--- a/location/java/android/location/ILocationListener.aidl
+++ b/location/java/android/location/ILocationListener.aidl
@@ -25,10 +25,14 @@
  */
 oneway interface ILocationListener
 {
+    @UnsupportedAppUsage
     void onLocationChanged(in Location location);
+    @UnsupportedAppUsage
     void onProviderEnabled(String provider);
+    @UnsupportedAppUsage
     void onProviderDisabled(String provider);
 
     // --- deprecated ---
+    @UnsupportedAppUsage
     void onStatusChanged(String provider, int status, in Bundle extras);
 }
diff --git a/location/java/android/location/ILocationManager.aidl b/location/java/android/location/ILocationManager.aidl
index 57a0a72..c371c5f 100644
--- a/location/java/android/location/ILocationManager.aidl
+++ b/location/java/android/location/ILocationManager.aidl
@@ -85,6 +85,7 @@
     boolean stopGnssBatch();
     boolean injectLocation(in Location location);
 
+    @UnsupportedAppUsage
     List<String> getAllProviders();
     List<String> getProviders(in Criteria criteria, boolean enabledOnly);
     String getBestProvider(in Criteria criteria, boolean enabledOnly);
@@ -102,6 +103,7 @@
     void removeTestProvider(String provider, String opPackageName);
     void setTestProviderLocation(String provider, in Location loc, String opPackageName);
     void setTestProviderEnabled(String provider, boolean enabled, String opPackageName);
+    List<LocationRequest> getTestProviderCurrentRequests(String provider, String opPackageName);
 
     // --- deprecated ---
     void setTestProviderStatus(String provider, int status, in Bundle extras, long updateTime,
diff --git a/location/java/android/location/INetInitiatedListener.aidl b/location/java/android/location/INetInitiatedListener.aidl
index fc64dd6..a9e9136 100644
--- a/location/java/android/location/INetInitiatedListener.aidl
+++ b/location/java/android/location/INetInitiatedListener.aidl
@@ -22,5 +22,6 @@
  */
 interface INetInitiatedListener
 {
+    @UnsupportedAppUsage
     boolean sendNiResponse(int notifId, int userResponse);
 }
diff --git a/location/java/android/location/Location.java b/location/java/android/location/Location.java
index fbebbb1..ed74333 100644
--- a/location/java/android/location/Location.java
+++ b/location/java/android/location/Location.java
@@ -113,6 +113,10 @@
      * Bit mask for mFieldsMask indicating the presence of mBearingAccuracy.
      */
     private static final int HAS_BEARING_ACCURACY_MASK = 128;
+    /**
+     * Bit mask for mFieldsMask indicating the presence of mElapsedRealtimeUncertaintyNanos.
+     */
+    private static final int HAS_ELAPSED_REALTIME_UNCERTAINTY_MASK = 256;
 
     // Cached data to make bearing/distance computations more efficient for the case
     // where distanceTo and bearingTo are called in sequence.  Assume this typically happens
@@ -130,6 +134,9 @@
     private long mTime = 0;
     @UnsupportedAppUsage
     private long mElapsedRealtimeNanos = 0;
+    // Estimate of the relative precision of the alignment of this SystemClock
+    // timestamp, with the reported measurements in nanoseconds (68% confidence).
+    private long mElapsedRealtimeUncertaintyNanos = 0;
     private double mLatitude = 0.0;
     private double mLongitude = 0.0;
     private double mAltitude = 0.0f;
@@ -171,6 +178,7 @@
         mProvider = l.mProvider;
         mTime = l.mTime;
         mElapsedRealtimeNanos = l.mElapsedRealtimeNanos;
+        mElapsedRealtimeUncertaintyNanos = l.mElapsedRealtimeUncertaintyNanos;
         mFieldsMask = l.mFieldsMask;
         mLatitude = l.mLatitude;
         mLongitude = l.mLongitude;
@@ -191,6 +199,7 @@
         mProvider = null;
         mTime = 0;
         mElapsedRealtimeNanos = 0;
+        mElapsedRealtimeUncertaintyNanos = 0;
         mFieldsMask = 0;
         mLatitude = 0;
         mLongitude = 0;
@@ -586,6 +595,37 @@
     }
 
     /**
+     * Get estimate of the relative precision of the alignment of the
+     * ElapsedRealtimeNanos timestamp, with the reported measurements in
+     * nanoseconds (68% confidence).
+     *
+     * @return uncertainty of elapsed real-time of fix, in nanoseconds.
+     */
+    public long getElapsedRealtimeUncertaintyNanos() {
+        return mElapsedRealtimeUncertaintyNanos;
+    }
+
+    /**
+     * Set estimate of the relative precision of the alignment of the
+     * ElapsedRealtimeNanos timestamp, with the reported measurements in
+     * nanoseconds (68% confidence).
+     *
+     * @param time uncertainty of the elapsed real-time of fix, in nanoseconds.
+     */
+    public void setElapsedRealtimeUncertaintyNanos(long time) {
+        mElapsedRealtimeUncertaintyNanos = time;
+        mFieldsMask |= HAS_ELAPSED_REALTIME_UNCERTAINTY_MASK;
+    }
+
+    /**
+     * True if this location has a elapsed realtime accuracy.
+     */
+    public boolean hasElapsedRealtimeUncertaintyNanos() {
+        return (mFieldsMask & HAS_ELAPSED_REALTIME_UNCERTAINTY_MASK) != 0;
+    }
+
+
+    /**
      * Get the latitude, in degrees.
      *
      * <p>All locations generated by the {@link LocationManager}
@@ -1062,6 +1102,10 @@
             s.append(" et=");
             TimeUtils.formatDuration(mElapsedRealtimeNanos / 1000000L, s);
         }
+        if (hasElapsedRealtimeUncertaintyNanos()) {
+            s.append(" etAcc=");
+            TimeUtils.formatDuration(mElapsedRealtimeUncertaintyNanos / 1000000L, s);
+        }
         if (hasAltitude()) s.append(" alt=").append(mAltitude);
         if (hasSpeed()) s.append(" vel=").append(mSpeed);
         if (hasBearing()) s.append(" bear=").append(mBearing);
@@ -1084,7 +1128,7 @@
         pw.println(prefix + toString());
     }
 
-    public static final Parcelable.Creator<Location> CREATOR =
+    public static final @android.annotation.NonNull Parcelable.Creator<Location> CREATOR =
         new Parcelable.Creator<Location>() {
         @Override
         public Location createFromParcel(Parcel in) {
@@ -1092,6 +1136,7 @@
             Location l = new Location(provider);
             l.mTime = in.readLong();
             l.mElapsedRealtimeNanos = in.readLong();
+            l.mElapsedRealtimeUncertaintyNanos = in.readLong();
             l.mFieldsMask = in.readByte();
             l.mLatitude = in.readDouble();
             l.mLongitude = in.readDouble();
@@ -1122,6 +1167,7 @@
         parcel.writeString(mProvider);
         parcel.writeLong(mTime);
         parcel.writeLong(mElapsedRealtimeNanos);
+        parcel.writeLong(mElapsedRealtimeUncertaintyNanos);
         parcel.writeByte(mFieldsMask);
         parcel.writeDouble(mLatitude);
         parcel.writeDouble(mLongitude);
diff --git a/location/java/android/location/LocationManager.java b/location/java/android/location/LocationManager.java
index 586ee2a..db6a4d0 100644
--- a/location/java/android/location/LocationManager.java
+++ b/location/java/android/location/LocationManager.java
@@ -44,12 +44,12 @@
 import android.os.RemoteException;
 import android.os.UserHandle;
 import android.provider.Settings;
+import android.util.ArrayMap;
 import android.util.Log;
 
 import com.android.internal.location.ProviderProperties;
 
 import java.util.ArrayList;
-import java.util.HashMap;
 import java.util.List;
 
 /**
@@ -78,14 +78,10 @@
     private final GnssMeasurementCallbackTransport mGnssMeasurementCallbackTransport;
     private final GnssNavigationMessageCallbackTransport mGnssNavigationMessageCallbackTransport;
     private final BatchedLocationCallbackTransport mBatchedLocationCallbackTransport;
-    private final HashMap<GpsStatus.Listener, GnssStatusListenerTransport> mGpsStatusListeners =
-            new HashMap<>();
-    private final HashMap<GpsStatus.NmeaListener, GnssStatusListenerTransport> mGpsNmeaListeners =
-            new HashMap<>();
-    private final HashMap<GnssStatus.Callback, GnssStatusListenerTransport> mGnssStatusListeners =
-            new HashMap<>();
-    private final HashMap<OnNmeaMessageListener, GnssStatusListenerTransport> mGnssNmeaListeners =
-            new HashMap<>();
+    private final ArrayMap<GnssStatus.Callback, GnssStatusListenerTransport> mGnssStatusListeners =
+            new ArrayMap<>();
+    private final ArrayMap<OnNmeaMessageListener, GnssStatusListenerTransport> mGnssNmeaListeners =
+            new ArrayMap<>();
     // volatile + GnssStatus final-fields pattern to avoid a partially published object
     private volatile GnssStatus mGnssStatus;
     private int mTimeToFirstFix;
@@ -170,17 +166,6 @@
     public static final String KEY_LOCATION_CHANGED = "location";
 
     /**
-     * Broadcast intent action indicating that the GPS has either been
-     * enabled or disabled. An intent extra provides this state as a boolean,
-     * where {@code true} means enabled.
-     * @see #EXTRA_GPS_ENABLED
-     *
-     * @hide
-     */
-    public static final String GPS_ENABLED_CHANGE_ACTION =
-        "android.location.GPS_ENABLED_CHANGE";
-
-    /**
      * Broadcast intent action when the set of enabled location providers changes. To check the
      * status of a provider, use {@link #isProviderEnabled(String)}.
      */
@@ -206,26 +191,6 @@
     public static final String MODE_CHANGING_ACTION = "com.android.settings.location.MODE_CHANGING";
 
     /**
-     * Broadcast intent action indicating that the GPS has either started or
-     * stopped receiving GPS fixes. An intent extra provides this state as a
-     * boolean, where {@code true} means that the GPS is actively receiving fixes.
-     * @see #EXTRA_GPS_ENABLED
-     *
-     * @hide
-     */
-    public static final String GPS_FIX_CHANGE_ACTION =
-        "android.location.GPS_FIX_CHANGE";
-
-    /**
-     * The lookup key for a boolean that indicates whether GPS is enabled or
-     * disabled. {@code true} means GPS is enabled. Retrieve it with
-     * {@link android.content.Intent#getBooleanExtra(String,boolean)}.
-     *
-     * @hide
-     */
-    public static final String EXTRA_GPS_ENABLED = "enabled";
-
-    /**
      * Broadcast intent action indicating that a high power location requests
      * has either started or stopped being active.  The current state of
      * active location requests should be read from AppOpsManager using
@@ -293,8 +258,7 @@
             "com.android.settings.location.FOOTER_STRING";
 
     // Map from LocationListeners to their associated ListenerTransport objects
-    private final HashMap<LocationListener, ListenerTransport> mListeners =
-        new HashMap<LocationListener,ListenerTransport>();
+    private final ArrayMap<LocationListener, ListenerTransport> mListeners = new ArrayMap<>();
 
     private class ListenerTransport extends ILocationListener.Stub {
         private static final int TYPE_LOCATION_CHANGED = 1;
@@ -405,7 +369,7 @@
      * @hide
      */
     @TestApi
-    public String[] getBackgroundThrottlingWhitelist() {
+    public @NonNull String[] getBackgroundThrottlingWhitelist() {
         try {
             return mService.getBackgroundThrottlingWhitelist();
         } catch (RemoteException e) {
@@ -417,7 +381,7 @@
      * @hide
      */
     @TestApi
-    public String[] getIgnoreSettingsWhitelist() {
+    public @NonNull String[] getIgnoreSettingsWhitelist() {
         try {
             return mService.getIgnoreSettingsWhitelist();
         } catch (RemoteException e) {
@@ -431,7 +395,7 @@
      * right way to create an instance of this class is using the
      * factory Context.getSystemService.
      */
-    public LocationManager(Context context, ILocationManager service) {
+    public LocationManager(@NonNull Context context, @NonNull ILocationManager service) {
         mService = service;
         mContext = context;
         mGnssMeasurementCallbackTransport =
@@ -454,7 +418,7 @@
      *
      * @return list of Strings containing names of the provider
      */
-    public List<String> getAllProviders() {
+    public @NonNull List<String> getAllProviders() {
         try {
             return mService.getAllProviders();
         } catch (RemoteException e) {
@@ -469,7 +433,7 @@
      * enabled are returned.
      * @return list of Strings containing names of the providers
      */
-    public List<String> getProviders(boolean enabledOnly) {
+    public @NonNull List<String> getProviders(boolean enabledOnly) {
         try {
             return mService.getProviders(null, enabledOnly);
         } catch (RemoteException e) {
@@ -488,7 +452,7 @@
      * @throws SecurityException if the caller is not permitted to access the
      * given provider.
      */
-    public LocationProvider getProvider(String name) {
+    public @Nullable LocationProvider getProvider(@NonNull String name) {
         checkProvider(name);
         try {
             ProviderProperties properties = mService.getProviderProperties(name);
@@ -511,7 +475,7 @@
      * enabled are returned.
      * @return list of Strings containing names of the providers
      */
-    public List<String> getProviders(Criteria criteria, boolean enabledOnly) {
+    public @NonNull List<String> getProviders(@NonNull Criteria criteria, boolean enabledOnly) {
         checkCriteria(criteria);
         try {
             return mService.getProviders(criteria, enabledOnly);
@@ -542,7 +506,7 @@
      * @param enabledOnly if true then only a provider that is currently enabled is returned
      * @return name of the provider that best matches the requirements
      */
-    public String getBestProvider(Criteria criteria, boolean enabledOnly) {
+    public @Nullable String getBestProvider(@NonNull Criteria criteria, boolean enabledOnly) {
         checkCriteria(criteria);
         try {
             return mService.getBestProvider(criteria, enabledOnly);
@@ -572,8 +536,8 @@
      * @throws SecurityException if no suitable permission is present
      */
     @RequiresPermission(anyOf = {ACCESS_COARSE_LOCATION, ACCESS_FINE_LOCATION})
-    public void requestLocationUpdates(String provider, long minTime, float minDistance,
-            LocationListener listener) {
+    public void requestLocationUpdates(@NonNull String provider, long minTime, float minDistance,
+            @NonNull LocationListener listener) {
         checkProvider(provider);
         checkListener(listener);
 
@@ -604,8 +568,8 @@
      * @throws SecurityException if no suitable permission is present
      */
     @RequiresPermission(anyOf = {ACCESS_COARSE_LOCATION, ACCESS_FINE_LOCATION})
-    public void requestLocationUpdates(String provider, long minTime, float minDistance,
-            LocationListener listener, Looper looper) {
+    public void requestLocationUpdates(@NonNull String provider, long minTime, float minDistance,
+            @NonNull LocationListener listener, @Nullable Looper looper) {
         checkProvider(provider);
         checkListener(listener);
 
@@ -637,8 +601,8 @@
      * @throws SecurityException if no suitable permission is present
      */
     @RequiresPermission(anyOf = {ACCESS_COARSE_LOCATION, ACCESS_FINE_LOCATION})
-    public void requestLocationUpdates(long minTime, float minDistance, Criteria criteria,
-            LocationListener listener, Looper looper) {
+    public void requestLocationUpdates(long minTime, float minDistance, @NonNull Criteria criteria,
+            @NonNull LocationListener listener, @Nullable Looper looper) {
         checkCriteria(criteria);
         checkListener(listener);
 
@@ -665,8 +629,8 @@
      * @throws SecurityException if no suitable permission is present
      */
     @RequiresPermission(anyOf = {ACCESS_COARSE_LOCATION, ACCESS_FINE_LOCATION})
-    public void requestLocationUpdates(String provider, long minTime, float minDistance,
-            PendingIntent intent) {
+    public void requestLocationUpdates(@NonNull String provider, long minTime, float minDistance,
+            @NonNull PendingIntent intent) {
         checkProvider(provider);
         checkPendingIntent(intent);
 
@@ -772,8 +736,8 @@
      * @throws SecurityException if no suitable permission is present
      */
     @RequiresPermission(anyOf = {ACCESS_COARSE_LOCATION, ACCESS_FINE_LOCATION})
-    public void requestLocationUpdates(long minTime, float minDistance, Criteria criteria,
-            PendingIntent intent) {
+    public void requestLocationUpdates(long minTime, float minDistance, @NonNull Criteria criteria,
+            @NonNull PendingIntent intent) {
         checkCriteria(criteria);
         checkPendingIntent(intent);
 
@@ -802,7 +766,8 @@
      * @throws SecurityException if no suitable permission is present
      */
     @RequiresPermission(anyOf = {ACCESS_COARSE_LOCATION, ACCESS_FINE_LOCATION})
-    public void requestSingleUpdate(String provider, LocationListener listener, Looper looper) {
+    public void requestSingleUpdate(
+            @NonNull String provider, @NonNull LocationListener listener, @Nullable Looper looper) {
         checkProvider(provider);
         checkListener(listener);
 
@@ -832,7 +797,10 @@
      * @throws SecurityException if no suitable permission is present
      */
     @RequiresPermission(anyOf = {ACCESS_COARSE_LOCATION, ACCESS_FINE_LOCATION})
-    public void requestSingleUpdate(Criteria criteria, LocationListener listener, Looper looper) {
+    public void requestSingleUpdate(
+            @NonNull Criteria criteria,
+            @NonNull LocationListener listener,
+            @Nullable Looper looper) {
         checkCriteria(criteria);
         checkListener(listener);
 
@@ -855,7 +823,7 @@
      * @throws SecurityException if no suitable permission is present
      */
     @RequiresPermission(anyOf = {ACCESS_COARSE_LOCATION, ACCESS_FINE_LOCATION})
-    public void requestSingleUpdate(String provider, PendingIntent intent) {
+    public void requestSingleUpdate(@NonNull String provider, @NonNull PendingIntent intent) {
         checkProvider(provider);
         checkPendingIntent(intent);
 
@@ -879,7 +847,7 @@
      * @throws SecurityException if no suitable permission is present
      */
     @RequiresPermission(anyOf = {ACCESS_COARSE_LOCATION, ACCESS_FINE_LOCATION})
-    public void requestSingleUpdate(Criteria criteria, PendingIntent intent) {
+    public void requestSingleUpdate(@NonNull Criteria criteria, @NonNull PendingIntent intent) {
         checkCriteria(criteria);
         checkPendingIntent(intent);
 
@@ -948,8 +916,10 @@
     @SystemApi
     @TestApi
     @RequiresPermission(anyOf = {ACCESS_COARSE_LOCATION, ACCESS_FINE_LOCATION})
-    public void requestLocationUpdates(LocationRequest request, LocationListener listener,
-            Looper looper) {
+    public void requestLocationUpdates(
+            @NonNull LocationRequest request,
+            @NonNull LocationListener listener,
+            @Nullable Looper looper) {
         checkListener(listener);
         requestLocationUpdates(request, listener, looper, null);
     }
@@ -978,7 +948,8 @@
     @SystemApi
     @TestApi
     @RequiresPermission(anyOf = {ACCESS_COARSE_LOCATION, ACCESS_FINE_LOCATION})
-    public void requestLocationUpdates(LocationRequest request, PendingIntent intent) {
+    public void requestLocationUpdates(
+            @NonNull LocationRequest request, @NonNull PendingIntent intent) {
         checkPendingIntent(intent);
         requestLocationUpdates(request, null, null, intent);
     }
@@ -1003,7 +974,7 @@
      * @hide
      */
     @RequiresPermission(allOf = {LOCATION_HARDWARE, ACCESS_FINE_LOCATION})
-    public boolean injectLocation(Location newLocation) {
+    public boolean injectLocation(@NonNull Location newLocation) {
         try {
             return mService.injectLocation(newLocation);
         } catch (RemoteException e) {
@@ -1048,7 +1019,7 @@
      * @param listener listener object that no longer needs location updates
      * @throws IllegalArgumentException if listener is null
      */
-    public void removeUpdates(LocationListener listener) {
+    public void removeUpdates(@NonNull LocationListener listener) {
         checkListener(listener);
         String packageName = mContext.getPackageName();
 
@@ -1073,7 +1044,7 @@
      * @param intent pending intent object that no longer needs location updates
      * @throws IllegalArgumentException if intent is null
      */
-    public void removeUpdates(PendingIntent intent) {
+    public void removeUpdates(@NonNull PendingIntent intent) {
         checkPendingIntent(intent);
         String packageName = mContext.getPackageName();
 
@@ -1133,7 +1104,7 @@
      */
     @RequiresPermission(anyOf = {ACCESS_COARSE_LOCATION, ACCESS_FINE_LOCATION})
     public void addProximityAlert(double latitude, double longitude, float radius, long expiration,
-            PendingIntent intent) {
+            @NonNull PendingIntent intent) {
         checkPendingIntent(intent);
         if (expiration < 0) expiration = Long.MAX_VALUE;
 
@@ -1183,7 +1154,10 @@
      * @hide
      */
     @RequiresPermission(anyOf = {ACCESS_COARSE_LOCATION, ACCESS_FINE_LOCATION})
-    public void addGeofence(LocationRequest request, Geofence fence, PendingIntent intent) {
+    public void addGeofence(
+            @NonNull LocationRequest request,
+            @NonNull Geofence fence,
+            @NonNull PendingIntent intent) {
         checkPendingIntent(intent);
         checkGeofence(fence);
 
@@ -1210,7 +1184,7 @@
      * @throws SecurityException if {@link android.Manifest.permission#ACCESS_FINE_LOCATION}
      * permission is not present
      */
-    public void removeProximityAlert(PendingIntent intent) {
+    public void removeProximityAlert(@NonNull PendingIntent intent) {
         checkPendingIntent(intent);
         String packageName = mContext.getPackageName();
 
@@ -1237,7 +1211,7 @@
      *
      * @hide
      */
-    public void removeGeofence(Geofence fence, PendingIntent intent) {
+    public void removeGeofence(@NonNull Geofence fence, @NonNull PendingIntent intent) {
         checkPendingIntent(intent);
         checkGeofence(fence);
         String packageName = mContext.getPackageName();
@@ -1260,7 +1234,7 @@
      *
      * @hide
      */
-    public void removeAllGeofences(PendingIntent intent) {
+    public void removeAllGeofences(@NonNull PendingIntent intent) {
         checkPendingIntent(intent);
         String packageName = mContext.getPackageName();
 
@@ -1290,7 +1264,7 @@
      * @hide
      */
     @SystemApi
-    public boolean isLocationEnabledForUser(UserHandle userHandle) {
+    public boolean isLocationEnabledForUser(@NonNull UserHandle userHandle) {
         try {
             return mService.isLocationEnabledForUser(userHandle.getIdentifier());
         } catch (RemoteException e) {
@@ -1309,7 +1283,7 @@
     @SystemApi
     @TestApi
     @RequiresPermission(WRITE_SECURE_SETTINGS)
-    public void setLocationEnabledForUser(boolean enabled, UserHandle userHandle) {
+    public void setLocationEnabledForUser(boolean enabled, @NonNull UserHandle userHandle) {
         Settings.Secure.putIntForUser(
                 mContext.getContentResolver(),
                 Settings.Secure.LOCATION_MODE,
@@ -1332,7 +1306,7 @@
      *
      * @throws IllegalArgumentException if provider is null
      */
-    public boolean isProviderEnabled(String provider) {
+    public boolean isProviderEnabled(@NonNull String provider) {
         return isProviderEnabledForUser(provider, Process.myUserHandle());
     }
 
@@ -1353,7 +1327,8 @@
      * @hide
      */
     @SystemApi
-    public boolean isProviderEnabledForUser(String provider, UserHandle userHandle) {
+    public boolean isProviderEnabledForUser(
+            @NonNull String provider, @NonNull UserHandle userHandle) {
         checkProvider(provider);
 
         try {
@@ -1382,7 +1357,7 @@
     @SystemApi
     @RequiresPermission(WRITE_SECURE_SETTINGS)
     public boolean setProviderEnabledForUser(
-            String provider, boolean enabled, UserHandle userHandle) {
+            @NonNull String provider, boolean enabled, @NonNull UserHandle userHandle) {
         checkProvider(provider);
 
         return Settings.Secure.setLocationProviderEnabledForUser(
@@ -1406,6 +1381,7 @@
      *
      * @hide
      */
+    @Nullable
     public Location getLastLocation() {
         String packageName = mContext.getPackageName();
 
@@ -1434,7 +1410,8 @@
      * @throws IllegalArgumentException if provider is null or doesn't exist
      */
     @RequiresPermission(anyOf = {ACCESS_COARSE_LOCATION, ACCESS_FINE_LOCATION})
-    public Location getLastKnownLocation(String provider) {
+    @Nullable
+    public Location getLastKnownLocation(@NonNull String provider) {
         checkProvider(provider);
         String packageName = mContext.getPackageName();
         LocationRequest request = LocationRequest.createFromDeprecatedProvider(
@@ -1447,10 +1424,6 @@
         }
     }
 
-    // --- Mock provider support ---
-    // TODO: It would be fantastic to deprecate mock providers entirely, and replace
-    // with something closer to LocationProviderBase.java
-
     /**
      * Creates a mock location provider and adds it to the set of active providers.
      *
@@ -1461,7 +1434,8 @@
      * allowed} for your app.
      * @throws IllegalArgumentException if a provider with the given name already exists
      */
-    public void addTestProvider(String name, boolean requiresNetwork, boolean requiresSatellite,
+    public void addTestProvider(
+            @NonNull String name, boolean requiresNetwork, boolean requiresSatellite,
             boolean requiresCell, boolean hasMonetaryCost, boolean supportsAltitude,
             boolean supportsSpeed, boolean supportsBearing, int powerRequirement, int accuracy) {
         ProviderProperties properties = new ProviderProperties(requiresNetwork,
@@ -1488,7 +1462,7 @@
      * allowed} for your app.
      * @throws IllegalArgumentException if no provider with the given name exists
      */
-    public void removeTestProvider(String provider) {
+    public void removeTestProvider(@NonNull String provider) {
         try {
             mService.removeTestProvider(provider, mContext.getOpPackageName());
         } catch (RemoteException e) {
@@ -1512,7 +1486,7 @@
      * @throws IllegalArgumentException if no provider with the given name exists
      * @throws IllegalArgumentException if the location is incomplete
      */
-    public void setTestProviderLocation(String provider, Location loc) {
+    public void setTestProviderLocation(@NonNull String provider, @NonNull Location loc) {
         if (!loc.isComplete()) {
             IllegalArgumentException e = new IllegalArgumentException(
                     "Incomplete location object, missing timestamp or accuracy? " + loc);
@@ -1546,7 +1520,7 @@
      * @deprecated This function has always been a no-op, and may be removed in the future.
      */
     @Deprecated
-    public void clearTestProviderLocation(String provider) {}
+    public void clearTestProviderLocation(@NonNull String provider) {}
 
     /**
      * Sets a mock enabled value for the given provider.  This value will be used in place
@@ -1560,7 +1534,7 @@
      * allowed} for your app.
      * @throws IllegalArgumentException if no provider with the given name exists
      */
-    public void setTestProviderEnabled(String provider, boolean enabled) {
+    public void setTestProviderEnabled(@NonNull String provider, boolean enabled) {
         try {
             mService.setTestProviderEnabled(provider, enabled, mContext.getOpPackageName());
         } catch (RemoteException e) {
@@ -1581,7 +1555,7 @@
      * @deprecated Use {@link #setTestProviderEnabled(String, boolean)} instead.
      */
     @Deprecated
-    public void clearTestProviderEnabled(String provider) {
+    public void clearTestProviderEnabled(@NonNull String provider) {
         setTestProviderEnabled(provider, false);
     }
 
@@ -1601,7 +1575,8 @@
      * @deprecated This method has no effect.
      */
     @Deprecated
-    public void setTestProviderStatus(String provider, int status, Bundle extras, long updateTime) {
+    public void setTestProviderStatus(
+            @NonNull String provider, int status, @Nullable Bundle extras, long updateTime) {
         try {
             mService.setTestProviderStatus(provider, status, extras, updateTime,
                     mContext.getOpPackageName());
@@ -1622,22 +1597,37 @@
      * @deprecated This method has no effect.
      */
     @Deprecated
-    public void clearTestProviderStatus(String provider) {
+    public void clearTestProviderStatus(@NonNull String provider) {
         setTestProviderStatus(provider, LocationProvider.AVAILABLE, null, 0L);
     }
 
+    /**
+     * Get the last list of {@link LocationRequest}s sent to the provider.
+     *
+     * @hide
+     */
+    @TestApi
+    @NonNull
+    public List<LocationRequest> getTestProviderCurrentRequests(String providerName) {
+        checkProvider(providerName);
+        try {
+            return mService.getTestProviderCurrentRequests(providerName,
+                    mContext.getOpPackageName());
+        } catch (RemoteException e) {
+            throw e.rethrowFromSystemServer();
+        }
+    }
+
     // --- GPS-specific support ---
 
     // This class is used to send Gnss status events to the client's specific thread.
     private class GnssStatusListenerTransport extends IGnssStatusListener.Stub {
 
-        private final GpsStatus.Listener mGpsListener;
-        private final GpsStatus.NmeaListener mGpsNmeaListener;
         private final GnssStatus.Callback mGnssCallback;
         private final OnNmeaMessageListener mGnssNmeaListener;
 
         private class GnssHandler extends Handler {
-            public GnssHandler(Handler handler) {
+            GnssHandler(Handler handler) {
                 super(handler != null ? handler.getLooper() : Looper.myLooper());
             }
 
@@ -1646,24 +1636,22 @@
                 switch (msg.what) {
                     case NMEA_RECEIVED:
                         synchronized (mNmeaBuffer) {
-                            int length = mNmeaBuffer.size();
-                            for (int i = 0; i < length; i++) {
-                                Nmea nmea = mNmeaBuffer.get(i);
+                            for (Nmea nmea : mNmeaBuffer) {
                                 mGnssNmeaListener.onNmeaMessage(nmea.mNmea, nmea.mTimestamp);
                             }
                             mNmeaBuffer.clear();
                         }
                         break;
-                    case GpsStatus.GPS_EVENT_STARTED:
+                    case GNSS_EVENT_STARTED:
                         mGnssCallback.onStarted();
                         break;
-                    case GpsStatus.GPS_EVENT_STOPPED:
+                    case GNSS_EVENT_STOPPED:
                         mGnssCallback.onStopped();
                         break;
-                    case GpsStatus.GPS_EVENT_FIRST_FIX:
+                    case GNSS_EVENT_FIRST_FIX:
                         mGnssCallback.onFirstFix(mTimeToFirstFix);
                         break;
-                    case GpsStatus.GPS_EVENT_SATELLITE_STATUS:
+                    case GNSS_EVENT_SATELLITE_STATUS:
                         mGnssCallback.onSatelliteStatusChanged(mGnssStatus);
                         break;
                     default:
@@ -1674,8 +1662,11 @@
 
         private final Handler mGnssHandler;
 
-        // This must not equal any of the GpsStatus event IDs
-        private static final int NMEA_RECEIVED = 1000;
+        private static final int NMEA_RECEIVED = 1;
+        private static final int GNSS_EVENT_STARTED = 2;
+        private static final int GNSS_EVENT_STOPPED = 3;
+        private static final int GNSS_EVENT_FIRST_FIX = 4;
+        private static final int GNSS_EVENT_SATELLITE_STATUS = 5;
 
         private class Nmea {
             long mTimestamp;
@@ -1688,98 +1679,31 @@
         }
         private final ArrayList<Nmea> mNmeaBuffer;
 
-        GnssStatusListenerTransport(GpsStatus.Listener listener) {
-            this(listener, null);
-        }
-
-        GnssStatusListenerTransport(GpsStatus.Listener listener, Handler handler) {
-            mGpsListener = listener;
-            mGnssHandler = new GnssHandler(handler);
-            mGpsNmeaListener = null;
-            mNmeaBuffer = null;
-            mGnssCallback = mGpsListener != null ? new GnssStatus.Callback() {
-                @Override
-                public void onStarted() {
-                    mGpsListener.onGpsStatusChanged(GpsStatus.GPS_EVENT_STARTED);
-                }
-
-                @Override
-                public void onStopped() {
-                    mGpsListener.onGpsStatusChanged(GpsStatus.GPS_EVENT_STOPPED);
-                }
-
-                @Override
-                public void onFirstFix(int ttff) {
-                    mGpsListener.onGpsStatusChanged(GpsStatus.GPS_EVENT_FIRST_FIX);
-                }
-
-                @Override
-                public void onSatelliteStatusChanged(GnssStatus status) {
-                    mGpsListener.onGpsStatusChanged(GpsStatus.GPS_EVENT_SATELLITE_STATUS);
-                }
-            } : null;
-            mGnssNmeaListener = null;
-        }
-
-        GnssStatusListenerTransport(GpsStatus.NmeaListener listener) {
-            this(listener, null);
-        }
-
-        GnssStatusListenerTransport(GpsStatus.NmeaListener listener, Handler handler) {
-            mGpsListener = null;
-            mGnssHandler = new GnssHandler(handler);
-            mGpsNmeaListener = listener;
-            mNmeaBuffer = new ArrayList<Nmea>();
-            mGnssCallback = null;
-            mGnssNmeaListener = mGpsNmeaListener != null ? new OnNmeaMessageListener() {
-                @Override
-                public void onNmeaMessage(String nmea, long timestamp) {
-                    mGpsNmeaListener.onNmeaReceived(timestamp, nmea);
-                }
-            } : null;
-        }
-
-        GnssStatusListenerTransport(GnssStatus.Callback callback) {
-            this(callback, null);
-        }
-
         GnssStatusListenerTransport(GnssStatus.Callback callback, Handler handler) {
             mGnssCallback = callback;
             mGnssHandler = new GnssHandler(handler);
             mGnssNmeaListener = null;
             mNmeaBuffer = null;
-            mGpsListener = null;
-            mGpsNmeaListener = null;
-        }
-
-        GnssStatusListenerTransport(OnNmeaMessageListener listener) {
-            this(listener, null);
         }
 
         GnssStatusListenerTransport(OnNmeaMessageListener listener, Handler handler) {
             mGnssCallback = null;
             mGnssHandler = new GnssHandler(handler);
             mGnssNmeaListener = listener;
-            mGpsListener = null;
-            mGpsNmeaListener = null;
-            mNmeaBuffer = new ArrayList<Nmea>();
+            mNmeaBuffer = new ArrayList<>();
         }
 
         @Override
         public void onGnssStarted() {
             if (mGnssCallback != null) {
-                Message msg = Message.obtain();
-                msg.what = GpsStatus.GPS_EVENT_STARTED;
-                mGnssHandler.sendMessage(msg);
+                mGnssHandler.obtainMessage(GNSS_EVENT_STARTED).sendToTarget();
             }
         }
 
         @Override
         public void onGnssStopped() {
             if (mGnssCallback != null) {
-                Message msg = Message.obtain();
-                msg.what = GpsStatus.GPS_EVENT_STOPPED;
-                mGnssHandler.sendMessage(msg);
+                mGnssHandler.obtainMessage(GNSS_EVENT_STOPPED).sendToTarget();
             }
         }
 
@@ -1787,9 +1711,7 @@
         public void onFirstFix(int ttff) {
             if (mGnssCallback != null) {
                 mTimeToFirstFix = ttff;
-                Message msg = Message.obtain();
-                msg.what = GpsStatus.GPS_EVENT_FIRST_FIX;
-                mGnssHandler.sendMessage(msg);
+                mGnssHandler.obtainMessage(GNSS_EVENT_FIRST_FIX).sendToTarget();
             }
         }
 
@@ -1800,11 +1722,8 @@
                 mGnssStatus = new GnssStatus(svCount, prnWithFlags, cn0s, elevations, azimuths,
                         carrierFreqs);
 
-                Message msg = Message.obtain();
-                msg.what = GpsStatus.GPS_EVENT_SATELLITE_STATUS;
-                // remove any SV status messages already in the queue
-                mGnssHandler.removeMessages(GpsStatus.GPS_EVENT_SATELLITE_STATUS);
-                mGnssHandler.sendMessage(msg);
+                mGnssHandler.removeMessages(GNSS_EVENT_SATELLITE_STATUS);
+                mGnssHandler.obtainMessage(GNSS_EVENT_SATELLITE_STATUS).sendToTarget();
             }
         }
 
@@ -1814,11 +1733,9 @@
                 synchronized (mNmeaBuffer) {
                     mNmeaBuffer.add(new Nmea(timestamp, nmea));
                 }
-                Message msg = Message.obtain();
-                msg.what = NMEA_RECEIVED;
-                // remove any NMEA_RECEIVED messages already in the queue
+
                 mGnssHandler.removeMessages(NMEA_RECEIVED);
-                mGnssHandler.sendMessage(msg);
+                mGnssHandler.obtainMessage(NMEA_RECEIVED).sendToTarget();
             }
         }
     }
@@ -1832,27 +1749,12 @@
      *
      * @throws SecurityException if the ACCESS_FINE_LOCATION permission is not present
      * @deprecated use {@link #registerGnssStatusCallback(GnssStatus.Callback)} instead.
+     * @removed
      */
     @Deprecated
     @RequiresPermission(ACCESS_FINE_LOCATION)
     public boolean addGpsStatusListener(GpsStatus.Listener listener) {
-        boolean result;
-
-        if (mGpsStatusListeners.get(listener) != null) {
-            // listener is already registered
-            return true;
-        }
-        try {
-            GnssStatusListenerTransport transport = new GnssStatusListenerTransport(listener);
-            result = mService.registerGnssStatusCallback(transport, mContext.getPackageName());
-            if (result) {
-                mGpsStatusListeners.put(listener, transport);
-            }
-        } catch (RemoteException e) {
-            throw e.rethrowFromSystemServer();
-        }
-
-        return result;
+        return false;
     }
 
     /**
@@ -1860,18 +1762,10 @@
      *
      * @param listener GPS status listener object to remove
      * @deprecated use {@link #unregisterGnssStatusCallback(GnssStatus.Callback)} instead.
+     * @removed
      */
     @Deprecated
-    public void removeGpsStatusListener(GpsStatus.Listener listener) {
-        try {
-            GnssStatusListenerTransport transport = mGpsStatusListeners.remove(listener);
-            if (transport != null) {
-                mService.unregisterGnssStatusCallback(transport);
-            }
-        } catch (RemoteException e) {
-            throw e.rethrowFromSystemServer();
-        }
-    }
+    public void removeGpsStatusListener(GpsStatus.Listener listener) {}
 
     /**
      * Registers a GNSS status callback.
@@ -1883,7 +1777,7 @@
      * @throws SecurityException if the ACCESS_FINE_LOCATION permission is not present
      */
     @RequiresPermission(ACCESS_FINE_LOCATION)
-    public boolean registerGnssStatusCallback(GnssStatus.Callback callback) {
+    public boolean registerGnssStatusCallback(@NonNull GnssStatus.Callback callback) {
         return registerGnssStatusCallback(callback, null);
     }
 
@@ -1898,7 +1792,8 @@
      * @throws SecurityException if the ACCESS_FINE_LOCATION permission is not present
      */
     @RequiresPermission(ACCESS_FINE_LOCATION)
-    public boolean registerGnssStatusCallback(GnssStatus.Callback callback, Handler handler) {
+    public boolean registerGnssStatusCallback(
+            @NonNull GnssStatus.Callback callback, @Nullable Handler handler) {
         boolean result;
         if (mGnssStatusListeners.get(callback) != null) {
             // listener is already registered
@@ -1923,7 +1818,7 @@
      *
      * @param callback GNSS status callback object to remove
      */
-    public void unregisterGnssStatusCallback(GnssStatus.Callback callback) {
+    public void unregisterGnssStatusCallback(@NonNull GnssStatus.Callback callback) {
         try {
             GnssStatusListenerTransport transport = mGnssStatusListeners.remove(callback);
             if (transport != null) {
@@ -1943,27 +1838,12 @@
      *
      * @throws SecurityException if the ACCESS_FINE_LOCATION permission is not present
      * @deprecated use {@link #addNmeaListener(OnNmeaMessageListener)} instead.
+     * @removed
      */
     @Deprecated
     @RequiresPermission(ACCESS_FINE_LOCATION)
     public boolean addNmeaListener(GpsStatus.NmeaListener listener) {
-        boolean result;
-
-        if (mGpsNmeaListeners.get(listener) != null) {
-            // listener is already registered
-            return true;
-        }
-        try {
-            GnssStatusListenerTransport transport = new GnssStatusListenerTransport(listener);
-            result = mService.registerGnssStatusCallback(transport, mContext.getPackageName());
-            if (result) {
-                mGpsNmeaListeners.put(listener, transport);
-            }
-        } catch (RemoteException e) {
-            throw e.rethrowFromSystemServer();
-        }
-
-        return result;
+        return false;
     }
 
     /**
@@ -1971,18 +1851,10 @@
      *
      * @param listener a {@link GpsStatus.NmeaListener} object to remove
      * @deprecated use {@link #removeNmeaListener(OnNmeaMessageListener)} instead.
+     * @removed
      */
     @Deprecated
-    public void removeNmeaListener(GpsStatus.NmeaListener listener) {
-        try {
-            GnssStatusListenerTransport transport = mGpsNmeaListeners.remove(listener);
-            if (transport != null) {
-                mService.unregisterGnssStatusCallback(transport);
-            }
-        } catch (RemoteException e) {
-            throw e.rethrowFromSystemServer();
-        }
-    }
+    public void removeNmeaListener(GpsStatus.NmeaListener listener) {}
 
     /**
      * Adds an NMEA listener.
@@ -1994,7 +1866,7 @@
      * @throws SecurityException if the ACCESS_FINE_LOCATION permission is not present
      */
     @RequiresPermission(ACCESS_FINE_LOCATION)
-    public boolean addNmeaListener(OnNmeaMessageListener listener) {
+    public boolean addNmeaListener(@NonNull OnNmeaMessageListener listener) {
         return addNmeaListener(listener, null);
     }
 
@@ -2009,10 +1881,11 @@
      * @throws SecurityException if the ACCESS_FINE_LOCATION permission is not present
      */
     @RequiresPermission(ACCESS_FINE_LOCATION)
-    public boolean addNmeaListener(OnNmeaMessageListener listener, Handler handler) {
+    public boolean addNmeaListener(
+            @NonNull OnNmeaMessageListener listener, @Nullable Handler handler) {
         boolean result;
 
-        if (mGpsNmeaListeners.get(listener) != null) {
+        if (mGnssNmeaListeners.get(listener) != null) {
             // listener is already registered
             return true;
         }
@@ -2035,7 +1908,7 @@
      *
      * @param listener a {@link OnNmeaMessageListener} object to remove
      */
-    public void removeNmeaListener(OnNmeaMessageListener listener) {
+    public void removeNmeaListener(@NonNull OnNmeaMessageListener listener) {
         try {
             GnssStatusListenerTransport transport = mGnssNmeaListeners.remove(listener);
             if (transport != null) {
@@ -2051,6 +1924,7 @@
      * Don't use it. Use {@link #registerGnssMeasurementsCallback} instead.
      * @hide
      * @deprecated Not supported anymore.
+     * @removed
      */
     @Deprecated
     @SystemApi
@@ -2066,7 +1940,8 @@
      * @return {@code true} if the callback was added successfully, {@code false} otherwise.
      */
     @RequiresPermission(ACCESS_FINE_LOCATION)
-    public boolean registerGnssMeasurementsCallback(GnssMeasurementsEvent.Callback callback) {
+    public boolean registerGnssMeasurementsCallback(
+            @NonNull GnssMeasurementsEvent.Callback callback) {
         return registerGnssMeasurementsCallback(callback, null);
     }
 
@@ -2078,8 +1953,8 @@
      * @return {@code true} if the callback was added successfully, {@code false} otherwise.
      */
     @RequiresPermission(ACCESS_FINE_LOCATION)
-    public boolean registerGnssMeasurementsCallback(GnssMeasurementsEvent.Callback callback,
-            Handler handler) {
+    public boolean registerGnssMeasurementsCallback(
+            @NonNull GnssMeasurementsEvent.Callback callback, @Nullable Handler handler) {
         return mGnssMeasurementCallbackTransport.add(callback, handler);
     }
 
@@ -2103,15 +1978,12 @@
     }
 
     /**
-     * Returns an integer with flags representing the capabilities of the GNSS chipset.
+     * Returns the integer capability flags of the GNSS chipset as defined in {@code
+     * IGnssCallback.hal}
      *
      * @hide
      */
     @SystemApi
-    /**
-     * Returns the integer capability flags of the GNSS chipset as defined in {@code
-     * IGnssCallback.hal}
-     */
     public int getGnssCapabilities() {
         try {
             return mGnssMeasurementCallbackTransport.getGnssCapabilities();
@@ -2127,6 +1999,7 @@
      * @hide
      * @deprecated use {@link #unregisterGnssMeasurementsCallback(GnssMeasurementsEvent.Callback)}
      *     instead.
+     * @removed
      */
     @Deprecated
     @SystemApi
@@ -2138,7 +2011,8 @@
      *
      * @param callback a {@link GnssMeasurementsEvent.Callback} object to remove.
      */
-    public void unregisterGnssMeasurementsCallback(GnssMeasurementsEvent.Callback callback) {
+    public void unregisterGnssMeasurementsCallback(
+            @NonNull GnssMeasurementsEvent.Callback callback) {
         mGnssMeasurementCallbackTransport.remove(callback);
     }
 
@@ -2147,6 +2021,7 @@
      * Don't use it. Use {@link #registerGnssNavigationMessageCallback} instead.
      * @hide
      * @deprecated Not supported anymore.
+     * @removed
      */
     @Deprecated
     @SystemApi
@@ -2162,12 +2037,12 @@
      * @deprecated use
      * {@link #unregisterGnssNavigationMessageCallback(GnssNavigationMessage.Callback)}
      * instead
+     * @removed
      */
     @Deprecated
     @SystemApi
     @SuppressLint("Doclava125")
-    public void removeGpsNavigationMessageListener(GpsNavigationMessageEvent.Listener listener) {
-    }
+    public void removeGpsNavigationMessageListener(GpsNavigationMessageEvent.Listener listener) {}
 
     /**
      * Registers a GNSS Navigation Message callback.
@@ -2176,7 +2051,7 @@
      * @return {@code true} if the callback was added successfully, {@code false} otherwise.
      */
     public boolean registerGnssNavigationMessageCallback(
-            GnssNavigationMessage.Callback callback) {
+            @NonNull GnssNavigationMessage.Callback callback) {
         return registerGnssNavigationMessageCallback(callback, null);
     }
 
@@ -2189,7 +2064,7 @@
      */
     @RequiresPermission(ACCESS_FINE_LOCATION)
     public boolean registerGnssNavigationMessageCallback(
-            GnssNavigationMessage.Callback callback, Handler handler) {
+            @NonNull GnssNavigationMessage.Callback callback, @Nullable Handler handler) {
         return mGnssNavigationMessageCallbackTransport.add(callback, handler);
     }
 
@@ -2199,7 +2074,7 @@
      * @param callback a {@link GnssNavigationMessage.Callback} object to remove.
      */
     public void unregisterGnssNavigationMessageCallback(
-            GnssNavigationMessage.Callback callback) {
+            @NonNull GnssNavigationMessage.Callback callback) {
         mGnssNavigationMessageCallbackTransport.remove(callback);
     }
 
@@ -2213,19 +2088,12 @@
      *
      * @param status object containing GPS status details, or null.
      * @return status object containing updated GPS status.
+     * @removed
      */
     @Deprecated
     @RequiresPermission(ACCESS_FINE_LOCATION)
-    public GpsStatus getGpsStatus(GpsStatus status) {
-        if (status == null) {
-            status = new GpsStatus();
-        }
-        // When mGnssStatus is null, that means that this method is called outside
-        // onGpsStatusChanged().  Return an empty status to maintain backwards compatibility.
-        if (mGnssStatus != null) {
-            status.setStatus(mGnssStatus, mTimeToFirstFix);
-        }
-        return status;
+    public @Nullable GpsStatus getGpsStatus(@Nullable GpsStatus status) {
+        return null;
     }
 
     /**
@@ -2302,7 +2170,7 @@
     @SystemApi
     @RequiresPermission(Manifest.permission.LOCATION_HARDWARE)
     public boolean registerGnssBatchedLocationCallback(long periodNanos, boolean wakeOnFifoFull,
-                                  BatchedLocationCallback callback, Handler handler) {
+            @NonNull BatchedLocationCallback callback, @Nullable Handler handler) {
         mBatchedLocationCallbackTransport.add(callback, handler);
 
         try {
@@ -2340,7 +2208,8 @@
      */
     @SystemApi
     @RequiresPermission(Manifest.permission.LOCATION_HARDWARE)
-    public boolean unregisterGnssBatchedLocationCallback(BatchedLocationCallback callback) {
+    public boolean unregisterGnssBatchedLocationCallback(
+            @NonNull BatchedLocationCallback callback) {
 
         mBatchedLocationCallbackTransport.remove(callback);
 
@@ -2362,7 +2231,8 @@
      *
      * @return true if the command succeeds.
      */
-    public boolean sendExtraCommand(String provider, String command, Bundle extras) {
+    public boolean sendExtraCommand(
+            @NonNull String provider, @NonNull String command, @Nullable Bundle extras) {
         try {
             return mService.sendExtraCommand(provider, command, extras);
         } catch (RemoteException e) {
@@ -2431,7 +2301,7 @@
      * @hide
      */
     @SystemApi
-    public boolean isProviderPackage(String packageName) {
+    public boolean isProviderPackage(@NonNull String packageName) {
         try {
             return mService.isProviderPackage(packageName);
         } catch (RemoteException e) {
@@ -2447,7 +2317,7 @@
      */
     @SystemApi
     @RequiresPermission(Manifest.permission.LOCATION_HARDWARE)
-    public void setLocationControllerExtraPackage(String packageName) {
+    public void setLocationControllerExtraPackage(@NonNull String packageName) {
         try {
             mService.setLocationControllerExtraPackage(packageName);
         } catch (RemoteException e) {
diff --git a/location/java/android/location/LocationRequest.java b/location/java/android/location/LocationRequest.java
index b3953fd..a05d850 100644
--- a/location/java/android/location/LocationRequest.java
+++ b/location/java/android/location/LocationRequest.java
@@ -17,6 +17,8 @@
 package android.location;
 
 import android.Manifest;
+import android.annotation.NonNull;
+import android.annotation.Nullable;
 import android.annotation.RequiresPermission;
 import android.annotation.SystemApi;
 import android.annotation.TestApi;
@@ -183,14 +185,16 @@
      *
      * @return a new location request
      */
+    @NonNull
     public static LocationRequest create() {
         return new LocationRequest();
     }
 
     /** @hide */
     @SystemApi
-    public static LocationRequest createFromDeprecatedProvider(String provider, long minTime,
-            float minDistance, boolean singleShot) {
+    @NonNull
+    public static LocationRequest createFromDeprecatedProvider(
+            @NonNull String provider, long minTime, float minDistance, boolean singleShot) {
         if (minTime < 0) minTime = 0;
         if (minDistance < 0) minDistance = 0;
 
@@ -215,8 +219,9 @@
 
     /** @hide */
     @SystemApi
-    public static LocationRequest createFromDeprecatedCriteria(Criteria criteria, long minTime,
-            float minDistance, boolean singleShot) {
+    @NonNull
+    public static LocationRequest createFromDeprecatedCriteria(
+            @NonNull Criteria criteria, long minTime, float minDistance, boolean singleShot) {
         if (minTime < 0) minTime = 0;
         if (minDistance < 0) minDistance = 0;
 
@@ -270,7 +275,7 @@
      * Set the quality of the request.
      *
      * <p>Use with a accuracy constant such as {@link #ACCURACY_FINE}, or a power
-     * constant such as {@link #POWER_LOW}. You cannot request both and accuracy and
+     * constant such as {@link #POWER_LOW}. You cannot request both accuracy and
      * power, only one or the other can be specified. The system will then
      * maximize accuracy or minimize power as appropriate.
      *
@@ -287,7 +292,7 @@
      * @return the same object, so that setters can be chained
      * @throws IllegalArgumentException if the quality constant is not valid
      */
-    public LocationRequest setQuality(int quality) {
+    public @NonNull LocationRequest setQuality(int quality) {
         checkQuality(quality);
         mQuality = quality;
         return this;
@@ -330,7 +335,7 @@
      * @return the same object, so that setters can be chained
      * @throws IllegalArgumentException if the interval is less than zero
      */
-    public LocationRequest setInterval(long millis) {
+    public @NonNull LocationRequest setInterval(long millis) {
         checkInterval(millis);
         mInterval = millis;
         if (!mExplicitFastestInterval) {
@@ -362,7 +367,7 @@
      * @hide
      */
     @SystemApi
-    public LocationRequest setLowPowerMode(boolean enabled) {
+    public @NonNull LocationRequest setLowPowerMode(boolean enabled) {
         mLowPowerMode = enabled;
         return this;
     }
@@ -384,21 +389,16 @@
      *
      * @param locationSettingsIgnored Whether to ignore location settings
      * @return the same object, so that setters can be chained
-     * @hide
      */
     @RequiresPermission(Manifest.permission.WRITE_SECURE_SETTINGS)
-    @SystemApi
-    public LocationRequest setLocationSettingsIgnored(boolean locationSettingsIgnored) {
+    public @NonNull LocationRequest setLocationSettingsIgnored(boolean locationSettingsIgnored) {
         mLocationSettingsIgnored = locationSettingsIgnored;
         return this;
     }
 
     /**
      * Returns true if location settings will be ignored in order to satisfy this request.
-     *
-     * @hide
      */
-    @SystemApi
     public boolean isLocationSettingsIgnored() {
         return mLocationSettingsIgnored;
     }
@@ -432,7 +432,7 @@
      * @return the same object, so that setters can be chained
      * @throws IllegalArgumentException if the interval is less than zero
      */
-    public LocationRequest setFastestInterval(long millis) {
+    public @NonNull LocationRequest setFastestInterval(long millis) {
         checkInterval(millis);
         mExplicitFastestInterval = true;
         mFastestInterval = millis;
@@ -468,7 +468,7 @@
      * @param millis duration of request in milliseconds
      * @return the same object, so that setters can be chained
      */
-    public LocationRequest setExpireIn(long millis) {
+    public @NonNull LocationRequest setExpireIn(long millis) {
         long elapsedRealtime = SystemClock.elapsedRealtime();
 
         // Check for > Long.MAX_VALUE overflow (elapsedRealtime > 0):
@@ -496,7 +496,7 @@
      * @param millis expiration time of request, in milliseconds since boot including suspend
      * @return the same object, so that setters can be chained
      */
-    public LocationRequest setExpireAt(long millis) {
+    public @NonNull LocationRequest setExpireAt(long millis) {
         mExpireAt = millis;
         if (mExpireAt < 0) mExpireAt = 0;
         return this;
@@ -527,7 +527,7 @@
      * @return the same object, so that setters can be chained
      * @throws IllegalArgumentException if numUpdates is 0 or less
      */
-    public LocationRequest setNumUpdates(int numUpdates) {
+    public @NonNull LocationRequest setNumUpdates(int numUpdates) {
         if (numUpdates <= 0) {
             throw new IllegalArgumentException(
                     "invalid numUpdates: " + numUpdates);
@@ -558,10 +558,8 @@
         }
     }
 
-
-    /** @hide */
-    @SystemApi
-    public LocationRequest setProvider(String provider) {
+    /** Sets the provider to use for this location request. */
+    public @NonNull LocationRequest setProvider(@NonNull String provider) {
         checkProvider(provider);
         mProvider = provider;
         return this;
@@ -569,13 +567,13 @@
 
     /** @hide */
     @SystemApi
-    public String getProvider() {
+    public @NonNull String getProvider() {
         return mProvider;
     }
 
     /** @hide */
     @SystemApi
-    public LocationRequest setSmallestDisplacement(float meters) {
+    public @NonNull LocationRequest setSmallestDisplacement(float meters) {
         checkDisplacement(meters);
         mSmallestDisplacement = meters;
         return this;
@@ -598,13 +596,13 @@
      * @hide
      */
     @SystemApi
-    public void setWorkSource(WorkSource workSource) {
+    public void setWorkSource(@Nullable WorkSource workSource) {
         mWorkSource = workSource;
     }
 
     /** @hide */
     @SystemApi
-    public WorkSource getWorkSource() {
+    public @Nullable WorkSource getWorkSource() {
         return mWorkSource;
     }
 
@@ -669,7 +667,7 @@
         }
     }
 
-    public static final Parcelable.Creator<LocationRequest> CREATOR =
+    public static final @android.annotation.NonNull Parcelable.Creator<LocationRequest> CREATOR =
             new Parcelable.Creator<LocationRequest>() {
                 @Override
                 public LocationRequest createFromParcel(Parcel in) {
diff --git a/location/java/com/android/internal/location/GpsNetInitiatedHandler.java b/location/java/com/android/internal/location/GpsNetInitiatedHandler.java
index 866634e..e5fd0d3 100644
--- a/location/java/com/android/internal/location/GpsNetInitiatedHandler.java
+++ b/location/java/com/android/internal/location/GpsNetInitiatedHandler.java
@@ -118,8 +118,8 @@
     static private boolean mIsHexInput = true;
 
     // End time of emergency call, and extension, if set
-    private long mCallEndElapsedRealtimeMillis = 0;
-    private long mEmergencyExtensionMillis = 0;
+    private volatile long mCallEndElapsedRealtimeMillis = 0;
+    private volatile long mEmergencyExtensionMillis = 0;
 
     public static class GpsNiNotification
     {
@@ -242,8 +242,9 @@
      */
     public boolean getInEmergency() {
         boolean isInEmergencyExtension =
-                (SystemClock.elapsedRealtime() - mCallEndElapsedRealtimeMillis) <
-                        mEmergencyExtensionMillis;
+                (mCallEndElapsedRealtimeMillis > 0)
+                && ((SystemClock.elapsedRealtime() - mCallEndElapsedRealtimeMillis)
+                        < mEmergencyExtensionMillis);
         boolean isInEmergencyCallback = mTelephonyManager.getEmergencyCallbackMode();
         return mIsInEmergencyCall || isInEmergencyCallback || isInEmergencyExtension;
     }
diff --git a/location/java/com/android/internal/location/ILocationProvider.aidl b/location/java/com/android/internal/location/ILocationProvider.aidl
index 71b54fb..a571630 100644
--- a/location/java/com/android/internal/location/ILocationProvider.aidl
+++ b/location/java/com/android/internal/location/ILocationProvider.aidl
@@ -36,6 +36,8 @@
     oneway void sendExtraCommand(String command, in Bundle extras);
 
     // --- deprecated and will be removed the future ---
+    @UnsupportedAppUsage
     int getStatus(out Bundle extras);
+    @UnsupportedAppUsage
     long getStatusUpdateTime();
 }
diff --git a/location/java/com/android/internal/location/ILocationProviderManager.aidl b/location/java/com/android/internal/location/ILocationProviderManager.aidl
index 79166ae..85e18ba 100644
--- a/location/java/com/android/internal/location/ILocationProviderManager.aidl
+++ b/location/java/com/android/internal/location/ILocationProviderManager.aidl
@@ -28,9 +28,12 @@
 
     void onSetAdditionalProviderPackages(in List<String> packageNames);
 
+    @UnsupportedAppUsage
     void onSetEnabled(boolean enabled);
 
+    @UnsupportedAppUsage
     void onSetProperties(in ProviderProperties properties);
 
+    @UnsupportedAppUsage
     void onReportLocation(in Location location);
 }
diff --git a/location/java/com/android/internal/location/ProviderRequest.java b/location/java/com/android/internal/location/ProviderRequest.java
index af8123a..155f788 100644
--- a/location/java/com/android/internal/location/ProviderRequest.java
+++ b/location/java/com/android/internal/location/ProviderRequest.java
@@ -56,7 +56,7 @@
      * low power fast interval request.
      */
     @UnsupportedAppUsage
-    public List<LocationRequest> locationRequests = new ArrayList<LocationRequest>();
+    public final List<LocationRequest> locationRequests = new ArrayList<>();
 
     @UnsupportedAppUsage
     public ProviderRequest() {
diff --git a/lowpan/java/android/net/lowpan/LowpanBeaconInfo.java b/lowpan/java/android/net/lowpan/LowpanBeaconInfo.java
index 345a4c5..5d4a3a0 100644
--- a/lowpan/java/android/net/lowpan/LowpanBeaconInfo.java
+++ b/lowpan/java/android/net/lowpan/LowpanBeaconInfo.java
@@ -208,7 +208,7 @@
     }
 
     /** Implement the Parcelable interface. */
-    public static final Creator<LowpanBeaconInfo> CREATOR =
+    public static final @android.annotation.NonNull Creator<LowpanBeaconInfo> CREATOR =
             new Creator<LowpanBeaconInfo>() {
                 public LowpanBeaconInfo createFromParcel(Parcel in) {
                     Builder builder = new Builder();
diff --git a/lowpan/java/android/net/lowpan/LowpanChannelInfo.java b/lowpan/java/android/net/lowpan/LowpanChannelInfo.java
index 52b1c6d..12c98b6 100644
--- a/lowpan/java/android/net/lowpan/LowpanChannelInfo.java
+++ b/lowpan/java/android/net/lowpan/LowpanChannelInfo.java
@@ -193,7 +193,7 @@
     }
 
     /** Implement the Parcelable interface. */
-    public static final Creator<LowpanChannelInfo> CREATOR =
+    public static final @android.annotation.NonNull Creator<LowpanChannelInfo> CREATOR =
             new Creator<LowpanChannelInfo>() {
 
                 public LowpanChannelInfo createFromParcel(Parcel in) {
diff --git a/lowpan/java/android/net/lowpan/LowpanCredential.java b/lowpan/java/android/net/lowpan/LowpanCredential.java
index e9126f9..dcbb831 100644
--- a/lowpan/java/android/net/lowpan/LowpanCredential.java
+++ b/lowpan/java/android/net/lowpan/LowpanCredential.java
@@ -153,7 +153,7 @@
     }
 
     /** Implement the Parcelable interface. */
-    public static final Creator<LowpanCredential> CREATOR =
+    public static final @android.annotation.NonNull Creator<LowpanCredential> CREATOR =
             new Creator<LowpanCredential>() {
 
                 public LowpanCredential createFromParcel(Parcel in) {
diff --git a/lowpan/java/android/net/lowpan/LowpanIdentity.java b/lowpan/java/android/net/lowpan/LowpanIdentity.java
index 6cb1f98..1997bc4 100644
--- a/lowpan/java/android/net/lowpan/LowpanIdentity.java
+++ b/lowpan/java/android/net/lowpan/LowpanIdentity.java
@@ -233,7 +233,7 @@
     }
 
     /** Implement the Parcelable interface. */
-    public static final Creator<LowpanIdentity> CREATOR =
+    public static final @android.annotation.NonNull Creator<LowpanIdentity> CREATOR =
             new Creator<LowpanIdentity>() {
 
                 public LowpanIdentity createFromParcel(Parcel in) {
diff --git a/lowpan/java/android/net/lowpan/LowpanProvision.java b/lowpan/java/android/net/lowpan/LowpanProvision.java
index f126003..68c8709 100644
--- a/lowpan/java/android/net/lowpan/LowpanProvision.java
+++ b/lowpan/java/android/net/lowpan/LowpanProvision.java
@@ -128,7 +128,7 @@
     }
 
     /** Implement the Parcelable interface. */
-    public static final Creator<LowpanProvision> CREATOR =
+    public static final @android.annotation.NonNull Creator<LowpanProvision> CREATOR =
             new Creator<LowpanProvision>() {
                 public LowpanProvision createFromParcel(Parcel in) {
                     Builder builder = new Builder();
diff --git a/media/apex/java/android/media/BufferingParams.java b/media/apex/java/android/media/BufferingParams.java
index aaae5e7b..83594d4 100644
--- a/media/apex/java/android/media/BufferingParams.java
+++ b/media/apex/java/android/media/BufferingParams.java
@@ -167,7 +167,7 @@
         mResumePlaybackMarkMs = in.readInt();
     }
 
-    public static final Parcelable.Creator<BufferingParams> CREATOR =
+    public static final @android.annotation.NonNull Parcelable.Creator<BufferingParams> CREATOR =
             new Parcelable.Creator<BufferingParams>() {
                 @Override
                 public BufferingParams createFromParcel(Parcel in) {
diff --git a/media/apex/java/android/media/CallbackDataSourceDesc.java b/media/apex/java/android/media/CallbackDataSourceDesc.java
index cd36414..9209ca9 100644
--- a/media/apex/java/android/media/CallbackDataSourceDesc.java
+++ b/media/apex/java/android/media/CallbackDataSourceDesc.java
@@ -17,6 +17,7 @@
 package android.media;
 
 import android.annotation.NonNull;
+import android.annotation.Nullable;
 
 /**
  * Structure of data source descriptor for sources using callback.
@@ -37,7 +38,7 @@
      * Return the DataSourceCallback of this data source.
      * @return the DataSourceCallback of this data source
      */
-    public DataSourceCallback getDataSourceCallback() {
+    public @NonNull DataSourceCallback getDataSourceCallback() {
         return mDataSourceCallback;
     }
 
@@ -70,7 +71,7 @@
          * @param dsd the {@link CallbackDataSourceDesc} object whose data will be reused
          * in the new Builder.
          */
-        public Builder(CallbackDataSourceDesc dsd) {
+        public Builder(@Nullable CallbackDataSourceDesc dsd) {
             super(dsd);
             if (dsd == null) {
                 return;  // use default
@@ -86,6 +87,11 @@
          * @return a new {@link CallbackDataSourceDesc} object
          */
         public @NonNull CallbackDataSourceDesc build() {
+            if (mDataSourceCallback == null) {
+                throw new IllegalStateException(
+                        "DataSourceCallback should not be null");
+            }
+
             CallbackDataSourceDesc dsd = new CallbackDataSourceDesc();
             super.build(dsd);
             dsd.mDataSourceCallback = mDataSourceCallback;
diff --git a/media/apex/java/android/media/Controller2Link.java b/media/apex/java/android/media/Controller2Link.java
index d11f776..04185e7 100644
--- a/media/apex/java/android/media/Controller2Link.java
+++ b/media/apex/java/android/media/Controller2Link.java
@@ -34,7 +34,7 @@
     private static final String TAG = "Controller2Link";
     private static final boolean DEBUG = MediaController2.DEBUG;
 
-    public static final Parcelable.Creator<Controller2Link> CREATOR =
+    public static final @android.annotation.NonNull Parcelable.Creator<Controller2Link> CREATOR =
             new Parcelable.Creator<Controller2Link>() {
                 @Override
                 public Controller2Link createFromParcel(Parcel in) {
diff --git a/media/apex/java/android/media/DataSourceCallback.java b/media/apex/java/android/media/DataSourceCallback.java
index 1afcd20..6515bd6 100644
--- a/media/apex/java/android/media/DataSourceCallback.java
+++ b/media/apex/java/android/media/DataSourceCallback.java
@@ -17,6 +17,8 @@
 
 package android.media;
 
+import android.annotation.NonNull;
+
 import java.io.Closeable;
 import java.io.IOException;
 
@@ -49,7 +51,7 @@
      * @throws IOException on fatal errors.
      * @return the number of bytes read, or -1 if end of stream is reached.
      */
-    public abstract int readAt(long position, byte[] buffer, int offset, int size)
+    public abstract int readAt(long position, @NonNull byte[] buffer, int offset, int size)
             throws IOException;
 
     /**
diff --git a/media/apex/java/android/media/DataSourceDesc.java b/media/apex/java/android/media/DataSourceDesc.java
index 7fc6f79..e6fd120 100644
--- a/media/apex/java/android/media/DataSourceDesc.java
+++ b/media/apex/java/android/media/DataSourceDesc.java
@@ -17,6 +17,7 @@
 package android.media;
 
 import android.annotation.NonNull;
+import android.annotation.Nullable;
 
 /**
  * Base class of data source descriptor.
@@ -64,7 +65,7 @@
      * Return the media Id of data source.
      * @return the media Id of data source
      */
-    public String getMediaId() {
+    public @Nullable String getMediaId() {
         return mMediaId;
     }
 
@@ -149,7 +150,7 @@
          * @param mediaId the media Id of this data source
          * @return the same Builder instance.
          */
-        public @NonNull T setMediaId(String mediaId) {
+        public @NonNull T setMediaId(@Nullable String mediaId) {
             mMediaId = mediaId;
             return (T) this;
         }
diff --git a/media/apex/java/android/media/FileDataSourceDesc.java b/media/apex/java/android/media/FileDataSourceDesc.java
index e29bd00..4b70367 100644
--- a/media/apex/java/android/media/FileDataSourceDesc.java
+++ b/media/apex/java/android/media/FileDataSourceDesc.java
@@ -17,6 +17,7 @@
 package android.media;
 
 import android.annotation.NonNull;
+import android.annotation.Nullable;
 import android.os.ParcelFileDescriptor;
 import android.util.Log;
 
@@ -106,7 +107,7 @@
      * Return the ParcelFileDescriptor of this data source.
      * @return the ParcelFileDescriptor of this data source
      */
-    public ParcelFileDescriptor getParcelFileDescriptor() {
+    public @NonNull ParcelFileDescriptor getParcelFileDescriptor() {
         return mPFD;
     }
 
@@ -159,7 +160,7 @@
          * @param dsd the {@link FileDataSourceDesc} object whose data will be reused
          * in the new Builder.
          */
-        public Builder(FileDataSourceDesc dsd) {
+        public Builder(@Nullable FileDataSourceDesc dsd) {
             super(dsd);
             if (dsd == null) {
                 return;  // use default
diff --git a/media/apex/java/android/media/MediaController2.java b/media/apex/java/android/media/MediaController2.java
index 2709df0..2743a34 100644
--- a/media/apex/java/android/media/MediaController2.java
+++ b/media/apex/java/android/media/MediaController2.java
@@ -181,6 +181,7 @@
      *
      * @return Session2Token of the connected session, or {@code null} if not connected
      */
+    @Nullable
     public Session2Token getConnectedSessionToken() {
         synchronized (mLock) {
             return mConnectedToken;
diff --git a/media/apex/java/android/media/MediaItem2.java b/media/apex/java/android/media/MediaItem2.java
index c496cf7..ff0d43e 100644
--- a/media/apex/java/android/media/MediaItem2.java
+++ b/media/apex/java/android/media/MediaItem2.java
@@ -55,7 +55,7 @@
      */
     public static final long POSITION_UNKNOWN = LONG_MAX;
 
-    public static final Parcelable.Creator<MediaItem2> CREATOR =
+    public static final @android.annotation.NonNull Parcelable.Creator<MediaItem2> CREATOR =
             new Parcelable.Creator<MediaItem2>() {
                 @Override
                 public MediaItem2 createFromParcel(Parcel in) {
@@ -245,7 +245,7 @@
     /**
      * Builder for {@link MediaItem2}.
      */
-    public static class Builder {
+    public static final class Builder {
         @SuppressWarnings("WeakerAccess") /* synthetic access */
         MediaMetadata mMetadata;
         @SuppressWarnings("WeakerAccess") /* synthetic access */
diff --git a/media/apex/java/android/media/MediaPlayer2.java b/media/apex/java/android/media/MediaPlayer2.java
index 89a9540..5cd3621 100644
--- a/media/apex/java/android/media/MediaPlayer2.java
+++ b/media/apex/java/android/media/MediaPlayer2.java
@@ -344,7 +344,7 @@
      * to free the resources. If not released, too many MediaPlayer2 instances may
      * result in an exception.</p>
      */
-    public MediaPlayer2(Context context) {
+    public MediaPlayer2(@NonNull Context context) {
         mGuard.open("close");
 
         mContext = context;
@@ -488,7 +488,7 @@
      * @return a token which can be used to cancel the operation later with {@link #cancelCommand}.
      */
     // This is an asynchronous call.
-    public Object play() {
+    public @NonNull Object play() {
         return addTask(new Task(CALL_COMPLETED_PLAY, false) {
             @Override
             void process() {
@@ -508,7 +508,7 @@
      * @return a token which can be used to cancel the operation later with {@link #cancelCommand}.
      */
     // This is an asynchronous call.
-    public Object prepare() {
+    public @NonNull Object prepare() {
         return addTask(new Task(CALL_COMPLETED_PREPARE, true) {
             @Override
             void process() {
@@ -524,7 +524,7 @@
      * @return a token which can be used to cancel the operation later with {@link #cancelCommand}.
      */
     // This is an asynchronous call.
-    public Object pause() {
+    public @NonNull Object pause() {
         return addTask(new Task(CALL_COMPLETED_PAUSE, false) {
             @Override
             void process() {
@@ -542,7 +542,7 @@
      * @return a token which can be used to cancel the operation later with {@link #cancelCommand}.
      */
     // This is an asynchronous call.
-    public Object skipToNext() {
+    public @NonNull Object skipToNext() {
         return addTask(new Task(CALL_COMPLETED_SKIP_TO_NEXT, false) {
             @Override
             void process() {
@@ -700,7 +700,7 @@
      * @return a token which can be used to cancel the operation later with {@link #cancelCommand}.
      */
     // This is an asynchronous call.
-    public Object setAudioAttributes(@NonNull AudioAttributes attributes) {
+    public @NonNull Object setAudioAttributes(@NonNull AudioAttributes attributes) {
         return addTask(new Task(CALL_COMPLETED_SET_AUDIO_ATTRIBUTES, false) {
             @Override
             void process() {
@@ -735,7 +735,7 @@
      * @return a token which can be used to cancel the operation later with {@link #cancelCommand}.
      */
     // This is an asynchronous call.
-    public Object setDataSource(@NonNull DataSourceDesc dsd) {
+    public @NonNull Object setDataSource(@NonNull DataSourceDesc dsd) {
         return addTask(new Task(CALL_COMPLETED_SET_DATA_SOURCE, false) {
             @Override
             void process() throws IOException {
@@ -768,7 +768,7 @@
      * @return a token which can be used to cancel the operation later with {@link #cancelCommand}.
      */
     // This is an asynchronous call.
-    public Object setNextDataSource(@NonNull DataSourceDesc dsd) {
+    public @NonNull Object setNextDataSource(@NonNull DataSourceDesc dsd) {
         return addTask(new Task(CALL_COMPLETED_SET_NEXT_DATA_SOURCE, false) {
             @Override
             void process() {
@@ -791,7 +791,7 @@
      * @return a token which can be used to cancel the operation later with {@link #cancelCommand}.
      */
     // This is an asynchronous call.
-    public Object setNextDataSources(@NonNull List<DataSourceDesc> dsds) {
+    public @NonNull Object setNextDataSources(@NonNull List<DataSourceDesc> dsds) {
         return addTask(new Task(CALL_COMPLETED_SET_NEXT_DATA_SOURCES, false) {
             @Override
             void process() {
@@ -853,7 +853,7 @@
      * @return a token which can be used to cancel the operation later with {@link #cancelCommand}.
      */
     // This is an asynchronous call.
-    public Object clearNextDataSources() {
+    public @NonNull Object clearNextDataSources() {
         return addTask(new Task(CALL_COMPLETED_CLEAR_NEXT_DATA_SOURCES, false) {
             @Override
             void process() {
@@ -962,7 +962,7 @@
                 return;
             }
         } catch (NullPointerException | SecurityException | IOException ex) {
-            Log.w(TAG, "Couldn't open " + uri + ": " + ex);
+            Log.w(TAG, "Couldn't open " + uri == null ? "null uri" : uri.toSafeString(), ex);
             // Fallback to media server
         }
         handleDataSource(isCurrent, srcId, uri.toString(), headers, cookies, startPos, endPos);
@@ -1194,7 +1194,7 @@
      * @return a token which can be used to cancel the operation later with {@link #cancelCommand}.
      */
     // This is an asynchronous call.
-    public Object loopCurrent(boolean loop) {
+    public @NonNull Object loopCurrent(boolean loop) {
         return addTask(new Task(CALL_COMPLETED_LOOP_CURRENT, false) {
             @Override
             void process() {
@@ -1216,7 +1216,7 @@
      * @return a token which can be used to cancel the operation later with {@link #cancelCommand}.
      */
     // This is an asynchronous call.
-    public Object setPlayerVolume(float volume) {
+    public @NonNull Object setPlayerVolume(float volume) {
         return addTask(new Task(CALL_COMPLETED_SET_PLAYER_VOLUME, false) {
             @Override
             void process() {
@@ -1257,7 +1257,7 @@
      * @return a token which can be used to cancel the operation later with {@link #cancelCommand}.
      */
     // This is an asynchronous call.
-    public Object notifyWhenCommandLabelReached(@NonNull Object label) {
+    public @NonNull Object notifyWhenCommandLabelReached(@NonNull Object label) {
         return addTask(new Task(CALL_COMPLETED_NOTIFY_WHEN_COMMAND_LABEL_REACHED, false) {
             @Override
             void process() {
@@ -1285,7 +1285,7 @@
      * @param sh the SurfaceHolder to use for video display
      * @return a token which can be used to cancel the operation later with {@link #cancelCommand}.
      */
-    public Object setDisplay(SurfaceHolder sh) {
+    public @NonNull Object setDisplay(@Nullable SurfaceHolder sh) {
         return addTask(new Task(CALL_COMPLETED_SET_DISPLAY, false) {
             @Override
             void process() {
@@ -1321,7 +1321,7 @@
      * @return a token which can be used to cancel the operation later with {@link #cancelCommand}.
      */
     // This is an asynchronous call.
-    public Object setSurface(Surface surface) {
+    public @NonNull Object setSurface(@Nullable Surface surface) {
         return addTask(new Task(CALL_COMPLETED_SET_SURFACE, false) {
             @Override
             void process() {
@@ -1355,7 +1355,7 @@
      * @see android.os.PowerManager
      */
     // This is an asynchronous call.
-    public Object setWakeLock(@NonNull PowerManager.WakeLock wakeLock) {
+    public @NonNull Object setWakeLock(@NonNull PowerManager.WakeLock wakeLock) {
         return addTask(new Task(CALL_COMPLETED_SET_WAKE_LOCK, false) {
             @Override
             void process() {
@@ -1390,7 +1390,7 @@
      * @return a token which can be used to cancel the operation later with {@link #cancelCommand}.
      */
     // This is an asynchronous call.
-    public Object setScreenOnWhilePlaying(boolean screenOn) {
+    public @NonNull Object setScreenOnWhilePlaying(boolean screenOn) {
         return addTask(new Task(CALL_COMPLETED_SET_SCREEN_ON_WHILE_PLAYING, false) {
             @Override
             void process() {
@@ -1466,7 +1466,7 @@
      */
     // This is a synchronous call.
     @Override
-    public boolean setPreferredDevice(AudioDeviceInfo deviceInfo) {
+    public boolean setPreferredDevice(@Nullable AudioDeviceInfo deviceInfo) {
         boolean status = native_setPreferredDevice(deviceInfo);
         if (status) {
             synchronized (this) {
@@ -1483,7 +1483,7 @@
      * is not guaranteed to correspond to the actual device being used for playback.
      */
     @Override
-    public AudioDeviceInfo getPreferredDevice() {
+    public @Nullable AudioDeviceInfo getPreferredDevice() {
         synchronized (this) {
             return mPreferredDevice;
         }
@@ -1496,7 +1496,7 @@
      * selected device when the player was last active.
      */
     @Override
-    public native AudioDeviceInfo getRoutedDevice();
+    public @Nullable native AudioDeviceInfo getRoutedDevice();
 
     /**
      * Adds an {@link AudioRouting.OnRoutingChangedListener} to receive notifications of routing
@@ -1508,8 +1508,8 @@
      */
     // This is a synchronous call.
     @Override
-    public void addOnRoutingChangedListener(AudioRouting.OnRoutingChangedListener listener,
-            Handler handler) {
+    public void addOnRoutingChangedListener(@NonNull AudioRouting.OnRoutingChangedListener listener,
+            @Nullable Handler handler) {
         if (listener == null) {
             throw new IllegalArgumentException("addOnRoutingChangedListener: listener is NULL");
         }
@@ -1527,7 +1527,8 @@
      */
     // This is a synchronous call.
     @Override
-    public void removeOnRoutingChangedListener(AudioRouting.OnRoutingChangedListener listener) {
+    public void removeOnRoutingChangedListener(
+            @NonNull AudioRouting.OnRoutingChangedListener listener) {
         if (listener == null) {
             throw new IllegalArgumentException("removeOnRoutingChangedListener: listener is NULL");
         }
@@ -1547,7 +1548,7 @@
      * notification {@code EventCallback.onVideoSizeChanged} when the size
      * is available.
      */
-    public Size getVideoSize() {
+    public @NonNull Size getVideoSize() {
         return mVideoSize;
     }
 
@@ -1560,7 +1561,7 @@
      *
      * Additional vendor-specific fields may also be present in the return value.
      */
-    public PersistableBundle getMetrics() {
+    public @Nullable PersistableBundle getMetrics() {
         PersistableBundle bundle = native_getMetrics();
         return bundle;
     }
@@ -1592,7 +1593,7 @@
      */
     // TODO: make it public when ready
     // This is an asynchronous call.
-    Object setBufferingParams(@NonNull BufferingParams params) {
+    @NonNull Object setBufferingParams(@NonNull BufferingParams params) {
         return addTask(new Task(CALL_COMPLETED_SET_BUFFERING_PARAMS, false) {
             @Override
             void process() {
@@ -1614,7 +1615,7 @@
      * @return a token which can be used to cancel the operation later with {@link #cancelCommand}.
      */
     // This is an asynchronous call.
-    public Object setPlaybackParams(@NonNull PlaybackParams params) {
+    public @NonNull Object setPlaybackParams(@NonNull PlaybackParams params) {
         return addTask(new Task(CALL_COMPLETED_SET_PLAYBACK_PARAMS, false) {
             @Override
             void process() {
@@ -1642,7 +1643,7 @@
      * @return a token which can be used to cancel the operation later with {@link #cancelCommand}.
      */
     // This is an asynchronous call.
-    public Object setSyncParams(@NonNull SyncParams params) {
+    public @NonNull Object setSyncParams(@NonNull SyncParams params) {
         return addTask(new Task(CALL_COMPLETED_SET_SYNC_PARAMS, false) {
             @Override
             void process() {
@@ -1671,7 +1672,7 @@
      * @return a token which can be used to cancel the operation later with {@link #cancelCommand}.
      */
     // This is an asynchronous call.
-    public Object seekTo(long msec) {
+    public @NonNull Object seekTo(long msec) {
         return seekTo(msec, SEEK_PREVIOUS_SYNC /* mode */);
     }
 
@@ -1745,7 +1746,7 @@
      * @return a token which can be used to cancel the operation later with {@link #cancelCommand}.
      */
     // This is an asynchronous call.
-    public Object seekTo(long msec, @SeekMode int mode) {
+    public @NonNull Object seekTo(long msec, @SeekMode int mode) {
         return addTask(new Task(CALL_COMPLETED_SEEK_TO, true) {
             @Override
             void process() {
@@ -1846,7 +1847,7 @@
      * @return a token which can be used to cancel the operation later with {@link #cancelCommand}.
      */
     // This is an asynchronous call.
-    public Object setAudioSessionId(int sessionId) {
+    public @NonNull Object setAudioSessionId(int sessionId) {
         final AudioTrack dummyAudioTrack = new AudioTrack(AudioManager.STREAM_MUSIC, 44100,
                     AudioFormat.CHANNEL_OUT_MONO, AudioFormat.ENCODING_PCM_16BIT, 2,
                     AudioTrack.MODE_STATIC, sessionId);
@@ -1887,7 +1888,7 @@
      * @return a token which can be used to cancel the operation later with {@link #cancelCommand}.
      */
     // This is an asynchronous call.
-    public Object attachAuxEffect(int effectId) {
+    public @NonNull Object attachAuxEffect(int effectId) {
         return addTask(new Task(CALL_COMPLETED_ATTACH_AUX_EFFECT, false) {
             @Override
             void process() {
@@ -1912,7 +1913,7 @@
      * @return a token which can be used to cancel the operation later with {@link #cancelCommand}.
      */
     // This is an asynchronous call.
-    public Object setAuxEffectSendLevel(float level) {
+    public @NonNull Object setAuxEffectSendLevel(float level) {
         return addTask(new Task(CALL_COMPLETED_SET_AUX_EFFECT_SEND_LEVEL, false) {
             @Override
             void process() {
@@ -1984,7 +1985,7 @@
          * When the language is unknown or could not be determined,
          * ISO-639-2 language code, "und", is returned.
          */
-        public String getLanguage() {
+        public @NonNull String getLanguage() {
             String language = mFormat.getString(MediaFormat.KEY_LANGUAGE);
             return language == null ? "und" : language;
         }
@@ -1993,7 +1994,7 @@
          * Gets the {@link MediaFormat} of the track.  If the format is
          * unknown or could not be determined, null is returned.
          */
-        public MediaFormat getFormat() {
+        public @Nullable MediaFormat getFormat() {
             if (mTrackType == MEDIA_TRACK_TYPE_TIMEDTEXT
                     || mTrackType == MEDIA_TRACK_TYPE_SUBTITLE) {
                 return mFormat;
@@ -2201,7 +2202,7 @@
      * @see MediaPlayer2#getTrackInfo()
      */
     // This is an asynchronous call.
-    public Object selectTrack(int index) {
+    public @NonNull Object selectTrack(int index) {
         return selectTrack(getCurrentDataSource(), index);
     }
 
@@ -2235,7 +2236,7 @@
      * @see MediaPlayer2#getTrackInfo(DataSourceDesc)
      */
     // This is an asynchronous call.
-    public Object selectTrack(@NonNull DataSourceDesc dsd, int index) {
+    public @NonNull Object selectTrack(@NonNull DataSourceDesc dsd, int index) {
         return addTask(new Task(CALL_COMPLETED_SELECT_TRACK, false) {
             @Override
             void process() {
@@ -2257,7 +2258,7 @@
      * @see MediaPlayer2#getTrackInfo()
      */
     // This is an asynchronous call.
-    public Object deselectTrack(int index) {
+    public @NonNull Object deselectTrack(int index) {
         return deselectTrack(getCurrentDataSource(), index);
     }
 
@@ -2277,7 +2278,7 @@
      * @see MediaPlayer2#getTrackInfo(DataSourceDesc)
      */
     // This is an asynchronous call.
-    public Object deselectTrack(@NonNull DataSourceDesc dsd, int index) {
+    public @NonNull Object deselectTrack(@NonNull DataSourceDesc dsd, int index) {
         return addTask(new Task(CALL_COMPLETED_DESELECT_TRACK, false) {
             @Override
             void process() {
@@ -2928,7 +2929,7 @@
      * @param eventCallback the callback to be unregistered
      */
     // This is a synchronous call.
-    public void unregisterEventCallback(EventCallback eventCallback) {
+    public void unregisterEventCallback(@NonNull EventCallback eventCallback) {
         synchronized (mEventCbLock) {
             for (Pair<Executor, EventCallback> cb : mEventCallbackRecords) {
                 if (cb.second == eventCallback) {
@@ -3850,7 +3851,7 @@
      */
     // This is an asynchronous call.
     @TestApi
-    public Object prepareDrm(@NonNull DataSourceDesc dsd, @NonNull UUID uuid) {
+    public @NonNull Object prepareDrm(@NonNull DataSourceDesc dsd, @NonNull UUID uuid) {
         return addTask(newPrepareDrmTask(dsd, uuid));
     }
 
diff --git a/media/apex/java/android/media/MediaSession2.java b/media/apex/java/android/media/MediaSession2.java
index 148e16c..09ac9ca 100644
--- a/media/apex/java/android/media/MediaSession2.java
+++ b/media/apex/java/android/media/MediaSession2.java
@@ -749,6 +749,10 @@
          * You can reject the connection by returning {@code null}. In that case, controller
          * receives {@link MediaController2.ControllerCallback#onDisconnected(MediaController2)}
          * and cannot be used.
+         * <p>
+         * The controller hasn't connected yet in this method, so calls to the controller
+         * (e.g. {@link #sendSessionCommand}) would be ignored. Override {@link #onPostConnect} for
+         * the custom initialization for the controller instead.
          *
          * @param session the session for this event
          * @param controller controller information.
@@ -763,6 +767,10 @@
         /**
          * Called immediately after a controller is connected. This is a convenient method to add
          * custom initialization between the session and a controller.
+         * <p>
+         * Note that calls to the controller (e.g. {@link #sendSessionCommand}) work here but don't
+         * work in {@link #onConnect} because the controller hasn't connected yet in
+         * {@link #onConnect}.
          *
          * @param session the session for this event
          * @param controller controller information.
diff --git a/media/apex/java/android/media/Session2Command.java b/media/apex/java/android/media/Session2Command.java
index 8b285f2..20d6391 100644
--- a/media/apex/java/android/media/Session2Command.java
+++ b/media/apex/java/android/media/Session2Command.java
@@ -60,7 +60,7 @@
      */
     public static final int RESULT_ERROR_UNKNOWN_ERROR = -1;
 
-    public static final Parcelable.Creator<Session2Command> CREATOR =
+    public static final @android.annotation.NonNull Parcelable.Creator<Session2Command> CREATOR =
             new Parcelable.Creator<Session2Command>() {
                 @Override
                 public Session2Command createFromParcel(Parcel in) {
diff --git a/media/apex/java/android/media/Session2CommandGroup.java b/media/apex/java/android/media/Session2CommandGroup.java
index 2dab697..73a59d0 100644
--- a/media/apex/java/android/media/Session2CommandGroup.java
+++ b/media/apex/java/android/media/Session2CommandGroup.java
@@ -39,7 +39,7 @@
 public final class Session2CommandGroup implements Parcelable {
     private static final String TAG = "Session2CommandGroup";
 
-    public static final Parcelable.Creator<Session2CommandGroup> CREATOR =
+    public static final @android.annotation.NonNull Parcelable.Creator<Session2CommandGroup> CREATOR =
             new Parcelable.Creator<Session2CommandGroup>() {
                 @Override
                 public Session2CommandGroup createFromParcel(Parcel in) {
diff --git a/media/apex/java/android/media/Session2Link.java b/media/apex/java/android/media/Session2Link.java
index 08664aa..6e550e8 100644
--- a/media/apex/java/android/media/Session2Link.java
+++ b/media/apex/java/android/media/Session2Link.java
@@ -37,7 +37,7 @@
     private static final String TAG = "Session2Link";
     private static final boolean DEBUG = MediaSession2.DEBUG;
 
-    public static final Parcelable.Creator<Session2Link> CREATOR =
+    public static final @android.annotation.NonNull Parcelable.Creator<Session2Link> CREATOR =
             new Parcelable.Creator<Session2Link>() {
                 @Override
                 public Session2Link createFromParcel(Parcel in) {
diff --git a/media/apex/java/android/media/Session2Token.java b/media/apex/java/android/media/Session2Token.java
index 6680e40..dc970ae 100644
--- a/media/apex/java/android/media/Session2Token.java
+++ b/media/apex/java/android/media/Session2Token.java
@@ -52,7 +52,7 @@
 public final class Session2Token implements Parcelable {
     private static final String TAG = "Session2Token";
 
-    public static final Creator<Session2Token> CREATOR = new Creator<Session2Token>() {
+    public static final @android.annotation.NonNull Creator<Session2Token> CREATOR = new Creator<Session2Token>() {
         @Override
         public Session2Token createFromParcel(Parcel p) {
             return new Session2Token(p);
diff --git a/media/apex/java/android/media/UriDataSourceDesc.java b/media/apex/java/android/media/UriDataSourceDesc.java
index 4eb9e8d..c0b3c82 100644
--- a/media/apex/java/android/media/UriDataSourceDesc.java
+++ b/media/apex/java/android/media/UriDataSourceDesc.java
@@ -51,7 +51,7 @@
      * Return the Uri of this data source.
      * @return the Uri of this data source
      */
-    public Uri getUri() {
+    public @NonNull Uri getUri() {
         return mUri;
     }
 
@@ -59,7 +59,7 @@
      * Return the Uri headers of this data source.
      * @return the Uri headers of this data source
      */
-    public Map<String, String> getHeaders() {
+    public @Nullable Map<String, String> getHeaders() {
         if (mHeader == null) {
             return null;
         }
@@ -70,7 +70,7 @@
      * Return the Uri cookies of this data source.
      * @return the Uri cookies of this data source
      */
-    public List<HttpCookie> getCookies() {
+    public @Nullable List<HttpCookie> getCookies() {
         if (mCookies == null) {
             return null;
         }
@@ -81,7 +81,7 @@
      * Return the Context used for resolving the Uri of this data source.
      * @return the Context used for resolving the Uri of this data source
      */
-    public Context getContext() {
+    public @NonNull Context getContext() {
         return mContext;
     }
 
@@ -117,7 +117,7 @@
          * @param dsd the {@link UriDataSourceDesc} object whose data will be reused
          * in the new Builder.
          */
-        public Builder(UriDataSourceDesc dsd) {
+        public Builder(@Nullable UriDataSourceDesc dsd) {
             super(dsd);
             if (dsd == null) {
                 return;  // use default
@@ -136,6 +136,11 @@
          * @return a new {@link UriDataSourceDesc} object
          */
         public @NonNull UriDataSourceDesc build() {
+            if (mUri == null || mContext == null) {
+                throw new IllegalStateException(
+                        "Uri and Context should not be null");
+            }
+
             UriDataSourceDesc dsd = new UriDataSourceDesc();
             super.build(dsd);
             dsd.mUri = mUri;
diff --git a/media/java/android/media/AudioAttributes.java b/media/java/android/media/AudioAttributes.java
index ea396c6..c2f29bc 100644
--- a/media/java/android/media/AudioAttributes.java
+++ b/media/java/android/media/AudioAttributes.java
@@ -374,9 +374,15 @@
      */
     public static final int FLAG_NO_CAPTURE = 0x1 << 10;
 
+    /**
+     * @hide
+     * Flag indicating force muting haptic channels.
+     */
+    public static final int FLAG_MUTE_HAPTIC = 0x1 << 11;
+
     private final static int FLAG_ALL = FLAG_AUDIBILITY_ENFORCED | FLAG_SECURE | FLAG_SCO |
             FLAG_BEACON | FLAG_HW_AV_SYNC | FLAG_HW_HOTWORD | FLAG_BYPASS_INTERRUPTION_POLICY |
-            FLAG_BYPASS_MUTE | FLAG_LOW_LATENCY | FLAG_DEEP_BUFFER;
+            FLAG_BYPASS_MUTE | FLAG_LOW_LATENCY | FLAG_DEEP_BUFFER | FLAG_MUTE_HAPTIC;
     private final static int FLAG_ALL_PUBLIC = FLAG_AUDIBILITY_ENFORCED |
             FLAG_HW_AV_SYNC | FLAG_LOW_LATENCY;
 
@@ -467,6 +473,14 @@
     }
 
     /**
+     * Return if haptic channels are muted.
+     * @return {@code true} if haptic channels are muted, {@code false} otherwise.
+     */
+    public boolean areHapticChannelsMuted() {
+        return (mFlags & FLAG_MUTE_HAPTIC) != 0;
+    }
+
+    /**
      * Builder class for {@link AudioAttributes} objects.
      * <p> Here is an example where <code>Builder</code> is used to define the
      * {@link AudioAttributes} to be used by a new <code>AudioTrack</code> instance:
@@ -490,6 +504,7 @@
         private int mContentType = CONTENT_TYPE_UNKNOWN;
         private int mSource = MediaRecorder.AudioSource.AUDIO_SOURCE_INVALID;
         private int mFlags = 0x0;
+        private boolean mMuteHapticChannels = false;
         private HashSet<String> mTags = new HashSet<String>();
         private Bundle mBundle;
 
@@ -528,6 +543,9 @@
             aa.mUsage = mUsage;
             aa.mSource = mSource;
             aa.mFlags = mFlags;
+            if (mMuteHapticChannels) {
+                aa.mFlags |= FLAG_MUTE_HAPTIC;
+            }
             aa.mTags = (HashSet<String>) mTags.clone();
             aa.mFormattedTags = TextUtils.join(";", mTags);
             if (mBundle != null) {
@@ -630,7 +648,7 @@
          *                     true to allow apps to capture the audio
          * @return the same Builder instance
          */
-        public Builder setAllowCapture(boolean allowCapture) {
+        public @NonNull Builder setAllowCapture(boolean allowCapture) {
             if (allowCapture) {
                 mFlags &= ~FLAG_NO_CAPTURE;
             } else {
@@ -803,6 +821,17 @@
             }
             return this;
         }
+
+        /**
+         * Specifying if haptic should be muted or not when playing audio-haptic coupled data.
+         * By default, haptic channels are enabled.
+         * @param muted true to force muting haptic channels.
+         * @return the same Builder instance.
+         */
+        public Builder setMuteHapticChannels(boolean muted) {
+            mMuteHapticChannels = muted;
+            return this;
+        }
     };
 
     @Override
@@ -877,7 +906,7 @@
         }
     }
 
-    public static final Parcelable.Creator<AudioAttributes> CREATOR
+    public static final @android.annotation.NonNull Parcelable.Creator<AudioAttributes> CREATOR
             = new Parcelable.Creator<AudioAttributes>() {
         /**
          * Rebuilds an AudioAttributes previously stored with writeToParcel().
diff --git a/media/java/android/media/AudioFocusInfo.java b/media/java/android/media/AudioFocusInfo.java
index 3594ee7..3aaa7df 100644
--- a/media/java/android/media/AudioFocusInfo.java
+++ b/media/java/android/media/AudioFocusInfo.java
@@ -190,7 +190,7 @@
         return true;
     }
 
-    public static final Parcelable.Creator<AudioFocusInfo> CREATOR
+    public static final @android.annotation.NonNull Parcelable.Creator<AudioFocusInfo> CREATOR
             = new Parcelable.Creator<AudioFocusInfo>() {
 
         public AudioFocusInfo createFromParcel(Parcel in) {
diff --git a/media/java/android/media/AudioFormat.java b/media/java/android/media/AudioFormat.java
index 5516086..f0787e9 100644
--- a/media/java/android/media/AudioFormat.java
+++ b/media/java/android/media/AudioFormat.java
@@ -1096,7 +1096,7 @@
             );
     }
 
-    public static final Parcelable.Creator<AudioFormat> CREATOR =
+    public static final @android.annotation.NonNull Parcelable.Creator<AudioFormat> CREATOR =
             new Parcelable.Creator<AudioFormat>() {
         public AudioFormat createFromParcel(Parcel p) {
             return new AudioFormat(p);
diff --git a/media/java/android/media/AudioManager.java b/media/java/android/media/AudioManager.java
index 3fb2365..669baea 100644
--- a/media/java/android/media/AudioManager.java
+++ b/media/java/android/media/AudioManager.java
@@ -37,6 +37,8 @@
 import android.media.audiopolicy.AudioPolicy;
 import android.media.audiopolicy.AudioPolicy.AudioPolicyFocusListener;
 import android.media.audiopolicy.AudioProductStrategies;
+import android.media.audiopolicy.AudioVolumeGroupChangeHandler;
+import android.media.audiopolicy.AudioVolumeGroups;
 import android.media.projection.MediaProjection;
 import android.media.session.MediaController;
 import android.media.session.MediaSession;
@@ -61,6 +63,7 @@
 import android.view.KeyEvent;
 
 import com.android.internal.annotations.GuardedBy;
+import com.android.internal.util.Preconditions;
 
 import java.io.IOException;
 import java.lang.annotation.Retention;
@@ -90,6 +93,8 @@
     private static final String TAG = "AudioManager";
     private static final boolean DEBUG = false;
     private static final AudioPortEventHandler sAudioPortEventHandler = new AudioPortEventHandler();
+    private static final AudioVolumeGroupChangeHandler sAudioAudioVolumeGroupChangedHandler =
+            new AudioVolumeGroupChangeHandler();
 
     /**
      * Broadcast intent, a hint for applications that audio is about to become
@@ -1164,6 +1169,93 @@
     }
 
     /**
+     * Sets the volume index for a particular {@link AudioAttributes}.
+     * @param attr The {@link AudioAttributes} whose volume index should be set.
+     * @param index The volume index to set. See
+     *          {@link #getMaxVolumeIndexForAttributes(AudioAttributes)} for the largest valid value
+     *          {@link #getMinVolumeIndexForAttributes(AudioAttributes)} for the lowest valid value.
+     * @param flags One or more flags.
+     * @see #getMaxVolumeIndexForAttributes(AudioAttributes)
+     * @see #getMinVolumeIndexForAttributes(AudioAttributes)
+     * @see #isVolumeFixed()
+     * @hide
+     */
+    @SystemApi
+    @RequiresPermission(android.Manifest.permission.MODIFY_AUDIO_ROUTING)
+    public void setVolumeIndexForAttributes(@NonNull AudioAttributes attr, int index, int flags) {
+        Preconditions.checkNotNull(attr, "attr must not be null");
+        final IAudioService service = getService();
+        try {
+            service.setVolumeIndexForAttributes(attr, index, flags,
+                                                getContext().getOpPackageName());
+        } catch (RemoteException e) {
+            throw e.rethrowFromSystemServer();
+        }
+    }
+
+    /**
+     * Returns the current volume index for a particular {@link AudioAttributes}.
+     *
+     * @param attr The {@link AudioAttributes} whose volume index is returned.
+     * @return The current volume index for the stream.
+     * @see #getMaxVolumeIndexForAttributes(AudioAttributes)
+     * @see #getMinVolumeIndexForAttributes(AudioAttributes)
+     * @see #setVolumeForAttributes(AudioAttributes, int, int)
+     * @hide
+     */
+    @SystemApi
+    @RequiresPermission(android.Manifest.permission.MODIFY_AUDIO_ROUTING)
+    public int getVolumeIndexForAttributes(@NonNull AudioAttributes attr) {
+        Preconditions.checkNotNull(attr, "attr must not be null");
+        final IAudioService service = getService();
+        try {
+            return service.getVolumeIndexForAttributes(attr);
+        } catch (RemoteException e) {
+            throw e.rethrowFromSystemServer();
+        }
+    }
+
+    /**
+     * Returns the maximum volume index for a particular {@link AudioAttributes}.
+     *
+     * @param attr The {@link AudioAttributes} whose maximum volume index is returned.
+     * @return The maximum valid volume index for the {@link AudioAttributes}.
+     * @see #getVolumeIndexForAttributes(AudioAttributes)
+     * @hide
+     */
+    @SystemApi
+    @RequiresPermission(android.Manifest.permission.MODIFY_AUDIO_ROUTING)
+    public int getMaxVolumeIndexForAttributes(@NonNull AudioAttributes attr) {
+        Preconditions.checkNotNull(attr, "attr must not be null");
+        final IAudioService service = getService();
+        try {
+            return service.getMaxVolumeIndexForAttributes(attr);
+        } catch (RemoteException e) {
+            throw e.rethrowFromSystemServer();
+        }
+    }
+
+    /**
+     * Returns the minimum volume index for a particular {@link AudioAttributes}.
+     *
+     * @param attr The {@link AudioAttributes} whose minimum volume index is returned.
+     * @return The minimum valid volume index for the {@link AudioAttributes}.
+     * @see #getVolumeIndexForAttributes(AudioAttributes)
+     * @hide
+     */
+    @SystemApi
+    @RequiresPermission(android.Manifest.permission.MODIFY_AUDIO_ROUTING)
+    public int getMinVolumeIndexForAttributes(@NonNull AudioAttributes attr) {
+        Preconditions.checkNotNull(attr, "attr must not be null");
+        final IAudioService service = getService();
+        try {
+            return service.getMinVolumeIndexForAttributes(attr);
+        } catch (RemoteException e) {
+            throw e.rethrowFromSystemServer();
+        }
+    }
+
+    /**
      * Solo or unsolo a particular stream.
      * <p>
      * Do not use. This method has been deprecated and is now a no-op.
@@ -3976,6 +4068,10 @@
      /**
      * Indicate Hearing Aid connection state change and eventually suppress
      * the {@link AudioManager.ACTION_AUDIO_BECOMING_NOISY} intent.
+     * This operation is asynchronous but its execution will still be sequentially scheduled
+     * relative to calls to {@link #setBluetoothA2dpDeviceConnectionStateSuppressNoisyIntent(
+     * * BluetoothDevice, int, int, boolean, int)} and
+     * and {@link #handleBluetoothA2dpDeviceConfigChange(BluetoothDevice)}.
      * @param device Bluetooth device connected/disconnected
      * @param state new connection state (BluetoothProfile.STATE_xxx)
      * @param musicDevice Default get system volume for the connecting device.
@@ -3983,27 +4079,27 @@
      * {@link android.bluetooth.BluetoothProfile.HEARING_AID})
      * @param suppressNoisyIntent if true the
      * {@link AudioManager.ACTION_AUDIO_BECOMING_NOISY} intent will not be sent.
-     * @return a delay in ms that the caller should wait before broadcasting
-     * BluetoothHearingAid.ACTION_CONNECTION_STATE_CHANGED intent.
      * {@hide}
      */
-    public int setBluetoothHearingAidDeviceConnectionState(
+    public void setBluetoothHearingAidDeviceConnectionState(
                 BluetoothDevice device, int state, boolean suppressNoisyIntent,
                 int musicDevice) {
         final IAudioService service = getService();
-        int delay = 0;
         try {
-            delay = service.setBluetoothHearingAidDeviceConnectionState(device,
+            service.setBluetoothHearingAidDeviceConnectionState(device,
                 state, suppressNoisyIntent, musicDevice);
         } catch (RemoteException e) {
             throw e.rethrowFromSystemServer();
         }
-        return delay;
     }
 
      /**
      * Indicate A2DP source or sink connection state change and eventually suppress
      * the {@link AudioManager.ACTION_AUDIO_BECOMING_NOISY} intent.
+     * This operation is asynchronous but its execution will still be sequentially scheduled
+     * relative to calls to {@link #setBluetoothHearingAidDeviceConnectionState(BluetoothDevice,
+     * int, boolean, int)} and
+     * {@link #handleBluetoothA2dpDeviceConfigChange(BluetoothDevice)}.
      * @param device Bluetooth device connected/disconnected
      * @param state  new connection state, {@link BluetoothProfile#STATE_CONNECTED}
      *     or {@link BluetoothProfile#STATE_DISCONNECTED}
@@ -4013,26 +4109,27 @@
      * {@link android.bluetooth.BluetoothProfile.A2DP_SINK})
      * @param suppressNoisyIntent if true the
      * {@link AudioManager.ACTION_AUDIO_BECOMING_NOISY} intent will not be sent.
-     * @return a delay in ms that the caller should wait before broadcasting
-     * BluetoothA2dp.ACTION_CONNECTION_STATE_CHANGED intent.
      * {@hide}
      */
-    public int setBluetoothA2dpDeviceConnectionStateSuppressNoisyIntent(
+    public void setBluetoothA2dpDeviceConnectionStateSuppressNoisyIntent(
             BluetoothDevice device, int state,
             int profile, boolean suppressNoisyIntent, int a2dpVolume) {
         final IAudioService service = getService();
-        int delay = 0;
         try {
-            delay = service.setBluetoothA2dpDeviceConnectionStateSuppressNoisyIntent(device,
+            service.setBluetoothA2dpDeviceConnectionStateSuppressNoisyIntent(device,
                 state, profile, suppressNoisyIntent, a2dpVolume);
         } catch (RemoteException e) {
             throw e.rethrowFromSystemServer();
         }
-        return delay;
     }
 
      /**
      * Indicate A2DP device configuration has changed.
+     * This operation is asynchronous but its execution will still be sequentially scheduled
+     * relative to calls to
+     * {@link #setBluetoothA2dpDeviceConnectionStateSuppressNoisyIntent(BluetoothDevice, int, int,
+     * boolean, int)} and
+     * {@link #setBluetoothHearingAidDeviceConnectionState(BluetoothDevice, int, boolean, int)}
      * @param device Bluetooth device whose configuration has changed.
      * {@hide}
      */
@@ -5246,6 +5343,65 @@
         }
     }
 
+    /**
+     * @hide
+     * Introspection API to retrieve audio volume groups.
+     * When implementing {Car|Oem}AudioManager, use this method  to retrieve the collection of
+     * audio volume groups.
+     * @return a (possibly zero-length) array of
+     *         {@see android.media.audiopolicy.AudioVolumeGroups} objects.
+     */
+    @SystemApi
+    @RequiresPermission(android.Manifest.permission.MODIFY_AUDIO_ROUTING)
+    public @NonNull AudioVolumeGroups getAudioVolumeGroups() {
+        final IAudioService service = getService();
+        try {
+            return service.listAudioVolumeGroups();
+        } catch (RemoteException e) {
+            throw e.rethrowFromSystemServer();
+        }
+    }
+
+    /**
+     * @hide
+     * Callback registered by client to be notified upon volume group change.
+     */
+    @SystemApi
+    public abstract static class VolumeGroupCallback {
+        /**
+         * Callback method called upon audio volume group change.
+         * @param group the group for which the volume has changed
+         */
+        public void onAudioVolumeGroupChanged(int group, int flags) {}
+    }
+
+   /**
+    * @hide
+    * Register an audio volume group change listener.
+    * @param callback the {@link VolumeGroupCallback} to register
+    */
+    @SystemApi
+    public void registerVolumeGroupCallback(
+            @NonNull Executor executor,
+            @NonNull VolumeGroupCallback callback) {
+        Preconditions.checkNotNull(executor, "executor must not be null");
+        Preconditions.checkNotNull(callback, "volume group change cb must not be null");
+        sAudioAudioVolumeGroupChangedHandler.init();
+        // TODO: make use of executor
+        sAudioAudioVolumeGroupChangedHandler.registerListener(callback);
+    }
+
+   /**
+    * @hide
+    * Unregister an audio volume group change listener.
+    * @param callback the {@link VolumeGroupCallback} to unregister
+    */
+    @SystemApi
+    public void unregisterVolumeGroupCallback(
+            @NonNull VolumeGroupCallback callback) {
+        Preconditions.checkNotNull(callback, "volume group change cb must not be null");
+        sAudioAudioVolumeGroupChangedHandler.unregisterListener(callback);
+    }
 
     //---------------------------------------------------------
     // Inner classes
diff --git a/media/java/android/media/AudioPlaybackCaptureConfiguration.java b/media/java/android/media/AudioPlaybackCaptureConfiguration.java
index d714dc7..333cd2d 100644
--- a/media/java/android/media/AudioPlaybackCaptureConfiguration.java
+++ b/media/java/android/media/AudioPlaybackCaptureConfiguration.java
@@ -33,7 +33,7 @@
  *  - played by apps that MUST be in the same user profile as the capturing app
  *    (eg work profile can not capture user profile apps and vice-versa).
  *  - played by apps that MUST NOT have in their manifest.xml the application
- *    attribute android:allowPlaybackCapture="false"
+ *    attribute android:allowAudioPlaybackCapture="false"
  *  - played by apps that MUST have a targetSdkVersion higher or equal to 29 (Q).
  *
  * <p>An example for creating a capture configuration for capturing all media playback:
@@ -72,7 +72,7 @@
      *
      * @param audioFormat The format in which to capture the audio.
      */
-    AudioMix createAudioMix(AudioFormat audioFormat) {
+    @NonNull AudioMix createAudioMix(@NonNull AudioFormat audioFormat) {
         return new AudioMix.Builder(mAudioMixingRule)
                 .setFormat(audioFormat)
                 .setRouteFlags(AudioMix.ROUTE_FLAG_LOOP_BACK | AudioMix.ROUTE_FLAG_RENDER)
@@ -123,7 +123,7 @@
          * @throws IllegalStateException if called in conjunction with
          *     {@link #excludeUsage(AudioAttributes)}.
          */
-        public Builder addMatchingUsage(@NonNull AudioAttributes audioAttributes) {
+        public @NonNull Builder addMatchingUsage(@NonNull AudioAttributes audioAttributes) {
             Preconditions.checkNotNull(audioAttributes);
             Preconditions.checkState(
                     mUsageMatchType != MATCH_TYPE_EXCLUSIVE, ERROR_MESSAGE_MISMATCHED_RULES);
@@ -141,7 +141,7 @@
          *
          * @throws IllegalStateException if called in conjunction with {@link #excludeUid(int)}.
          */
-        public Builder addMatchingUid(int uid) {
+        public @NonNull Builder addMatchingUid(int uid) {
             Preconditions.checkState(
                     mUidMatchType != MATCH_TYPE_EXCLUSIVE, ERROR_MESSAGE_MISMATCHED_RULES);
             mAudioMixingRuleBuilder.addMixRule(AudioMixingRule.RULE_MATCH_UID, uid);
@@ -158,7 +158,7 @@
          * @throws IllegalStateException if called in conjunction with
          *     {@link #addMatchingUsage(AudioAttributes)}.
          */
-        public Builder excludeUsage(@NonNull AudioAttributes audioAttributes) {
+        public @NonNull Builder excludeUsage(@NonNull AudioAttributes audioAttributes) {
             Preconditions.checkNotNull(audioAttributes);
             Preconditions.checkState(
                     mUsageMatchType != MATCH_TYPE_INCLUSIVE, ERROR_MESSAGE_MISMATCHED_RULES);
@@ -176,7 +176,7 @@
          *
          * @throws IllegalStateException if called in conjunction with {@link #addMatchingUid(int)}.
          */
-        public Builder excludeUid(int uid) {
+        public @NonNull Builder excludeUid(int uid) {
             Preconditions.checkState(
                     mUidMatchType != MATCH_TYPE_INCLUSIVE, ERROR_MESSAGE_MISMATCHED_RULES);
             mAudioMixingRuleBuilder.excludeMixRule(AudioMixingRule.RULE_MATCH_UID, uid);
@@ -189,7 +189,7 @@
          *
          * @throws UnsupportedOperationException if the parameters set are incompatible.
          */
-        public AudioPlaybackCaptureConfiguration build() {
+        public @NonNull AudioPlaybackCaptureConfiguration build() {
             return new AudioPlaybackCaptureConfiguration(mAudioMixingRuleBuilder.build(),
                                                          mProjection);
         }
diff --git a/media/java/android/media/AudioPlaybackConfiguration.java b/media/java/android/media/AudioPlaybackConfiguration.java
index 7dfdb20..5d12c3c 100644
--- a/media/java/android/media/AudioPlaybackConfiguration.java
+++ b/media/java/android/media/AudioPlaybackConfiguration.java
@@ -430,7 +430,7 @@
                 + " -- attr:" + apc.mPlayerAttr);
     }
 
-    public static final Parcelable.Creator<AudioPlaybackConfiguration> CREATOR
+    public static final @android.annotation.NonNull Parcelable.Creator<AudioPlaybackConfiguration> CREATOR
             = new Parcelable.Creator<AudioPlaybackConfiguration>() {
         /**
          * Rebuilds an AudioPlaybackConfiguration previously stored with writeToParcel().
diff --git a/media/java/android/media/AudioPresentation.java b/media/java/android/media/AudioPresentation.java
index fca7074..894fbba 100644
--- a/media/java/android/media/AudioPresentation.java
+++ b/media/java/android/media/AudioPresentation.java
@@ -45,6 +45,9 @@
  * accessibility, end point mastering and dialogue enhancement. An audio presentation may also have
  * a set of description labels in different languages to help the user to make an informed
  * selection.
+ *
+ * Applications that parse media streams and extract presentation information on their own
+ * can create instances of AudioPresentation by using {@link AudioPresentation.Builder} class.
  */
 public final class AudioPresentation {
     private final int mPresentationId;
@@ -66,7 +69,7 @@
     private final boolean mAudioDescriptionAvailable;
     private final boolean mSpokenSubtitlesAvailable;
     private final boolean mDialogueEnhancementAvailable;
-    private final Map<ULocale, String> mLabels;
+    private final Map<ULocale, CharSequence> mLabels;
 
     /**
      * No preferred reproduction channel layout.
@@ -131,7 +134,7 @@
                              boolean audioDescriptionAvailable,
                              boolean spokenSubtitlesAvailable,
                              boolean dialogueEnhancementAvailable,
-                             @NonNull Map<ULocale, String> labels) {
+                             @NonNull Map<ULocale, CharSequence> labels) {
         mPresentationId = presentationId;
         mProgramId = programId;
         mLanguage = language;
@@ -139,7 +142,7 @@
         mAudioDescriptionAvailable = audioDescriptionAvailable;
         mSpokenSubtitlesAvailable = spokenSubtitlesAvailable;
         mDialogueEnhancementAvailable = dialogueEnhancementAvailable;
-        mLabels = new HashMap<ULocale, String>(labels);
+        mLabels = new HashMap<ULocale, CharSequence>(labels);
     }
 
     /**
@@ -164,14 +167,14 @@
      * or ISO 639-2/T could be used.
      */
     public Map<Locale, String> getLabels() {
-        Map<Locale, String> localeLabels = new HashMap<Locale, String>();
-        for (Map.Entry<ULocale, String> entry : mLabels.entrySet()) {
-            localeLabels.put(entry.getKey().toLocale(), entry.getValue());
+        Map<Locale, String> localeLabels = new HashMap<Locale, String>(mLabels.size());
+        for (Map.Entry<ULocale, CharSequence> entry : mLabels.entrySet()) {
+            localeLabels.put(entry.getKey().toLocale(), entry.getValue().toString());
         }
         return localeLabels;
     }
 
-    private Map<ULocale, String> getULabels() {
+    private Map<ULocale, CharSequence> getULabels() {
         return mLabels;
     }
 
@@ -273,7 +276,7 @@
     /**
      * A builder class for creating {@link AudioPresentation} objects.
      */
-    public static class Builder {
+    public static final class Builder {
         private final int mPresentationId;
         private int mProgramId = UNKNOWN_ID;
         private ULocale mLanguage = new ULocale("");
@@ -281,13 +284,13 @@
         private boolean mAudioDescriptionAvailable = false;
         private boolean mSpokenSubtitlesAvailable = false;
         private boolean mDialogueEnhancementAvailable = false;
-        private Map<ULocale, String> mLabels = new HashMap<ULocale, String>();
+        private Map<ULocale, CharSequence> mLabels = new HashMap<ULocale, CharSequence>();
 
         /**
          * Create a {@link Builder}. Any field that should be included in the
          * {@link AudioPresentation} must be added.
          *
-         * @param presentationId the presentation ID of this audio presentation
+         * @param presentationId The presentation ID of this audio presentation.
          */
         public Builder(int presentationId) {
             mPresentationId = presentationId;
@@ -295,7 +298,7 @@
         /**
          * Sets the ProgramId to which this audio presentation refers.
          *
-         * @param programId
+         * @param programId The program ID to be decoded.
          */
         public @NonNull Builder setProgramId(int programId) {
             mProgramId = programId;
@@ -304,9 +307,9 @@
         /**
          * Sets the language information of the audio presentation.
          *
-         * @param language code
+         * @param language Locale corresponding to ISO 639-1/639-2 language code.
          */
-        public @NonNull Builder setLocale(ULocale language) {
+        public @NonNull Builder setLocale(@NonNull ULocale language) {
             mLanguage = language;
             return this;
         }
@@ -339,17 +342,17 @@
         /**
          * Sets locale / text label pairs describing the presentation.
          *
-         * @param labels
+         * @param labels Text label indexed by its locale corresponding to the language code.
          */
-        public @NonNull Builder setLabels(@NonNull Map<ULocale, String> labels) {
-            mLabels = new HashMap<ULocale, String>(labels);
+        public @NonNull Builder setLabels(@NonNull Map<ULocale, CharSequence> labels) {
+            mLabels = new HashMap<ULocale, CharSequence>(labels);
             return this;
         }
 
         /**
          * Indicate whether the presentation contains audio description for the visually impaired.
          *
-         * @param audioDescriptionAvailable
+         * @param audioDescriptionAvailable Audio description for the visually impaired.
          */
         public @NonNull Builder setHasAudioDescription(boolean audioDescriptionAvailable) {
             mAudioDescriptionAvailable = audioDescriptionAvailable;
@@ -359,7 +362,7 @@
         /**
          * Indicate whether the presentation contains spoken subtitles for the visually impaired.
          *
-         * @param spokenSubtitlesAvailable
+         * @param spokenSubtitlesAvailable Spoken subtitles for the visually impaired.
          */
         public @NonNull Builder setHasSpokenSubtitles(boolean spokenSubtitlesAvailable) {
             mSpokenSubtitlesAvailable = spokenSubtitlesAvailable;
@@ -369,7 +372,7 @@
         /**
          * Indicate whether the presentation supports dialogue enhancement.
          *
-         * @param dialogueEnhancementAvailable
+         * @param dialogueEnhancementAvailable Dialogue enhancement.
          */
         public @NonNull Builder setHasDialogueEnhancement(boolean dialogueEnhancementAvailable) {
             mDialogueEnhancementAvailable = dialogueEnhancementAvailable;
diff --git a/media/java/android/media/AudioRecord.java b/media/java/android/media/AudioRecord.java
index ec1a854..8051236 100644
--- a/media/java/android/media/AudioRecord.java
+++ b/media/java/android/media/AudioRecord.java
@@ -22,6 +22,7 @@
 import android.annotation.NonNull;
 import android.annotation.Nullable;
 import android.annotation.SystemApi;
+import android.annotation.TestApi;
 import android.annotation.UnsupportedAppUsage;
 import android.app.ActivityThread;
 import android.media.audiopolicy.AudioMix;
@@ -618,7 +619,7 @@
          * @throws IllegalStateException if called in conjunction with {@link #setAudioSource(int)}.
          * @throws NullPointerException if {@code config} is null.
          */
-        public Builder setAudioPlaybackCaptureConfig(
+        public @NonNull Builder setAudioPlaybackCaptureConfig(
                 @NonNull AudioPlaybackCaptureConfiguration config) {
             Preconditions.checkNotNull(
                     config, "Illegal null AudioPlaybackCaptureConfiguration argument");
@@ -647,13 +648,22 @@
             return this;
         }
 
-        private AudioRecord buildAudioPlaybackCaptureRecord() {
+        private @NonNull AudioRecord buildAudioPlaybackCaptureRecord() {
             AudioMix audioMix = mAudioPlaybackCaptureConfiguration.createAudioMix(mFormat);
             MediaProjection projection = mAudioPlaybackCaptureConfiguration.getMediaProjection();
             AudioPolicy audioPolicy = new AudioPolicy.Builder(/*context=*/ null)
                     .setMediaProjection(projection)
                     .addMix(audioMix).build();
+
+            int error = AudioManager.registerAudioPolicyStatic(audioPolicy);
+            if (error != 0) {
+                throw new UnsupportedOperationException("Error: could not register audio policy");
+            }
+
             AudioRecord record = audioPolicy.createAudioRecordSink(audioMix);
+            if (record == null) {
+                throw new UnsupportedOperationException("Cannot create AudioRecord");
+            }
             record.unregisterAudioPolicyOnRelease(audioPolicy);
             return record;
         }
@@ -1782,13 +1792,14 @@
     // MicrophoneDirection
     //--------------------
     /**
-     * Specifies the logical microphone (for processing).
+     * Specifies the logical microphone (for processing). Applications can use this to specify
+     * which side of the device to optimize capture from. Typically used in conjunction with
+     * the camera capturing video.
      *
-     * @param direction Direction constant.
      * @return true if sucessful.
      */
-    public boolean setMicrophoneDirection(int direction) {
-        return native_set_microphone_direction(direction) == 0;
+    public boolean setMicrophoneDirection(@DirectionMode int direction) {
+        return native_set_microphone_direction(direction) == AudioSystem.SUCCESS;
     }
 
     /**
@@ -1800,7 +1811,9 @@
      * @return true if sucessful.
      */
     public boolean setMicrophoneFieldDimension(@FloatRange(from = -1.0, to = 1.0) float zoom) {
-        return native_set_microphone_field_dimension(zoom) == 0;
+        Preconditions.checkArgument(
+                zoom >= -1 && zoom <= 1, "Argument must fall between -1 & 1 (inclusive)");
+        return native_set_microphone_field_dimension(zoom) == AudioSystem.SUCCESS;
     }
 
     //---------------------------------------------------------
@@ -1975,41 +1988,100 @@
     {
         private MetricsConstants() {}
 
-        /**
-         * Key to extract the output format being recorded
-         * from the {@link AudioRecord#getMetrics} return value.
-         * The value is a String.
-         */
-        public static final String ENCODING = "android.media.audiorecord.encoding";
+        // MM_PREFIX is slightly different than TAG, used to avoid cut-n-paste errors.
+        private static final String MM_PREFIX = "android.media.audiorecord.";
 
         /**
-         * Key to extract the Source Type for this track
+         * Key to extract the audio data encoding for this track
          * from the {@link AudioRecord#getMetrics} return value.
-         * The value is a String.
+         * The value is a {@code String}.
          */
-        public static final String SOURCE = "android.media.audiorecord.source";
+        public static final String ENCODING = MM_PREFIX + "encoding";
+
+        /**
+         * Key to extract the source type for this track
+         * from the {@link AudioRecord#getMetrics} return value.
+         * The value is a {@code String}.
+         */
+        public static final String SOURCE = MM_PREFIX + "source";
 
         /**
          * Key to extract the estimated latency through the recording pipeline
          * from the {@link AudioRecord#getMetrics} return value.
          * This is in units of milliseconds.
-         * The value is an integer.
+         * The value is an {@code int}.
+         * @deprecated Not properly supported in the past.
          */
-        public static final String LATENCY = "android.media.audiorecord.latency";
+        @Deprecated
+        public static final String LATENCY = MM_PREFIX + "latency";
 
         /**
          * Key to extract the sink sample rate for this record track in Hz
          * from the {@link AudioRecord#getMetrics} return value.
-         * The value is an integer.
+         * The value is an {@code int}.
          */
-        public static final String SAMPLERATE = "android.media.audiorecord.samplerate";
+        public static final String SAMPLERATE = MM_PREFIX + "samplerate";
 
         /**
          * Key to extract the number of channels being recorded in this record track
          * from the {@link AudioRecord#getMetrics} return value.
-         * The value is an integer.
+         * The value is an {@code int}.
          */
-        public static final String CHANNELS = "android.media.audiorecord.channels";
+        public static final String CHANNELS = MM_PREFIX + "channels";
 
+        /**
+         * Use for testing only. Do not expose.
+         * The native channel mask.
+         * The value is a {@code long}.
+         * @hide
+         */
+        @TestApi
+        public static final String CHANNEL_MASK = MM_PREFIX + "channelMask";
+
+
+        /**
+         * Use for testing only. Do not expose.
+         * The port id of this input port in audioserver.
+         * The value is an {@code int}.
+         * @hide
+         */
+        @TestApi
+        public static final String PORT_ID = MM_PREFIX + "portId";
+
+        /**
+         * Use for testing only. Do not expose.
+         * The buffer frameCount.
+         * The value is an {@code int}.
+         * @hide
+         */
+        @TestApi
+        public static final String FRAME_COUNT = MM_PREFIX + "frameCount";
+
+        /**
+         * Use for testing only. Do not expose.
+         * The actual record track attributes used.
+         * The value is a {@code String}.
+         * @hide
+         */
+        @TestApi
+        public static final String ATTRIBUTES = MM_PREFIX + "attributes";
+
+        /**
+         * Use for testing only. Do not expose.
+         * The buffer frameCount
+         * The value is a {@code double}.
+         * @hide
+         */
+        @TestApi
+        public static final String DURATION_MS = MM_PREFIX + "durationMs";
+
+        /**
+         * Use for testing only. Do not expose.
+         * The number of times the record track has started
+         * The value is a {@code long}.
+         * @hide
+         */
+        @TestApi
+        public static final String START_COUNT = MM_PREFIX + "startCount";
     }
 }
diff --git a/media/java/android/media/AudioRecordingConfiguration.java b/media/java/android/media/AudioRecordingConfiguration.java
index 0af47e8..82bcbc1 100644
--- a/media/java/android/media/AudioRecordingConfiguration.java
+++ b/media/java/android/media/AudioRecordingConfiguration.java
@@ -317,7 +317,7 @@
         return new ArrayList<AudioEffect.Descriptor>(Arrays.asList(mDeviceEffects));
     }
 
-    public static final Parcelable.Creator<AudioRecordingConfiguration> CREATOR
+    public static final @android.annotation.NonNull Parcelable.Creator<AudioRecordingConfiguration> CREATOR
             = new Parcelable.Creator<AudioRecordingConfiguration>() {
         /**
          * Rebuilds an AudioRecordingConfiguration previously stored with writeToParcel().
diff --git a/media/java/android/media/AudioRoutesInfo.java b/media/java/android/media/AudioRoutesInfo.java
index 83cd797..46df388 100644
--- a/media/java/android/media/AudioRoutesInfo.java
+++ b/media/java/android/media/AudioRoutesInfo.java
@@ -76,7 +76,7 @@
         dest.writeInt(mainType);
     }
 
-    public static final Parcelable.Creator<AudioRoutesInfo> CREATOR
+    public static final @android.annotation.NonNull Parcelable.Creator<AudioRoutesInfo> CREATOR
             = new Parcelable.Creator<AudioRoutesInfo>() {
         public AudioRoutesInfo createFromParcel(Parcel in) {
             return new AudioRoutesInfo(in);
diff --git a/media/java/android/media/AudioSystem.java b/media/java/android/media/AudioSystem.java
index b2f970a..a976d70 100644
--- a/media/java/android/media/AudioSystem.java
+++ b/media/java/android/media/AudioSystem.java
@@ -920,6 +920,41 @@
     @UnsupportedAppUsage
     private static native int setStreamVolumeIndex(int stream, int index, int device);
     public static native int getStreamVolumeIndex(int stream, int device);
+    /**
+     * @hide
+     * set a volume for the given {@link AudioAttributes} and for all other stream that belong to
+     * the same volume group.
+     * @param attributes the {@link AudioAttributes} to be considered
+     * @param index to be applied
+     * @param device the volume device to be considered
+     * @return command completion status.
+     */
+    public static native int setVolumeIndexForAttributes(@NonNull AudioAttributes attributes,
+                                                         int index, int device);
+   /**
+    * @hide
+    * get the volume index for the given {@link AudioAttributes}.
+    * @param attributes the {@link AudioAttributes} to be considered
+    * @param device the volume device to be considered
+    * @return volume index for the given {@link AudioAttributes} and volume device.
+    */
+    public static native int getVolumeIndexForAttributes(@NonNull AudioAttributes attributes,
+                                                         int device);
+    /**
+     * @hide
+     * get the minimum volume index for the given {@link AudioAttributes}.
+     * @param attributes the {@link AudioAttributes} to be considered
+     * @return minimum volume index for the given {@link AudioAttributes}.
+     */
+    public static native int getMinVolumeIndexForAttributes(@NonNull AudioAttributes attributes);
+    /**
+     * @hide
+     * get the maximum volume index for the given {@link AudioAttributes}.
+     * @param attributes the {@link AudioAttributes} to be considered
+     * @return maximum volume index for the given {@link AudioAttributes}.
+     */
+    public static native int getMaxVolumeIndexForAttributes(@NonNull AudioAttributes attributes);
+
     public static native int setMasterVolume(float value);
     public static native float getMasterVolume();
     @UnsupportedAppUsage
diff --git a/media/java/android/media/AudioTrack.java b/media/java/android/media/AudioTrack.java
index 3440cde..09cfa95 100644
--- a/media/java/android/media/AudioTrack.java
+++ b/media/java/android/media/AudioTrack.java
@@ -17,9 +17,12 @@
 package android.media;
 
 import android.annotation.CallbackExecutor;
+import android.annotation.FloatRange;
 import android.annotation.IntDef;
+import android.annotation.IntRange;
 import android.annotation.NonNull;
 import android.annotation.Nullable;
+import android.annotation.TestApi;
 import android.annotation.UnsupportedAppUsage;
 import android.os.Binder;
 import android.os.Build;
@@ -389,6 +392,14 @@
      * Indicates whether the track is intended to play in offload mode.
      */
     private boolean mOffloaded = false;
+    /**
+     * When offloaded track: delay for decoder in frames
+     */
+    private int mOffloadDelayFrames = 0;
+    /**
+     * When offloaded track: padding for decoder in frames
+     */
+    private int mOffloadPaddingFrames = 0;
 
     //--------------------------------
     // Used exclusively by native code
@@ -827,7 +838,7 @@
          * @return the same Builder instance.
          * @throws IllegalArgumentException
          */
-        public @NonNull Builder setBufferSizeInBytes(int bufferSizeInBytes)
+        public @NonNull Builder setBufferSizeInBytes(@IntRange(from = 0) int bufferSizeInBytes)
                 throws IllegalArgumentException {
             if (bufferSizeInBytes <= 0) {
                 throw new IllegalArgumentException("Invalid buffer size " + bufferSizeInBytes);
@@ -865,7 +876,7 @@
          * @return the same Builder instance.
          * @throws IllegalArgumentException
          */
-        public @NonNull Builder setSessionId(int sessionId)
+        public @NonNull Builder setSessionId(@IntRange(from = 1) int sessionId)
                 throws IllegalArgumentException {
             if ((sessionId != AudioManager.AUDIO_SESSION_ID_GENERATE) && (sessionId < 1)) {
                 throw new IllegalArgumentException("Invalid audio session ID " + sessionId);
@@ -1007,7 +1018,8 @@
      * @param paddingInFrames number of frames to be ignored at the end of the stream. A value of 0
      *     of 0 indicates no delay is to be applied.
      */
-    public void setOffloadDelayPadding(int delayInFrames, int paddingInFrames) {
+    public void setOffloadDelayPadding(@IntRange(from = 0) int delayInFrames,
+            @IntRange(from = 0) int paddingInFrames) {
         if (paddingInFrames < 0) {
             throw new IllegalArgumentException("Illegal negative padding");
         }
@@ -1020,10 +1032,48 @@
         if (mState == STATE_UNINITIALIZED) {
             throw new IllegalStateException("Uninitialized track");
         }
+        mOffloadDelayFrames = delayInFrames;
+        mOffloadPaddingFrames = paddingInFrames;
         native_set_delay_padding(delayInFrames, paddingInFrames);
     }
 
     /**
+     * Return the decoder delay of an offloaded track, expressed in frames, previously set with
+     * {@link #setOffloadDelayPadding(int, int)}, or 0 if it was never modified.
+     * <p>This delay indicates the number of frames to be ignored at the beginning of the stream.
+     * This value can only be queried on a track successfully initialized with
+     * {@link AudioTrack.Builder#setOffloadedPlayback(boolean)}.
+     * @return decoder delay expressed in frames.
+     */
+    public @IntRange(from = 0) int getOffloadDelay() {
+        if (!mOffloaded) {
+            throw new IllegalStateException("Illegal query of delay on non-offloaded track");
+        }
+        if (mState == STATE_UNINITIALIZED) {
+            throw new IllegalStateException("Illegal query of delay on uninitialized track");
+        }
+        return mOffloadDelayFrames;
+    }
+
+    /**
+     * Return the decoder padding of an offloaded track, expressed in frames, previously set with
+     * {@link #setOffloadDelayPadding(int, int)}, or 0 if it was never modified.
+     * <p>This padding indicates the number of frames to be ignored at the end of the stream.
+     * This value can only be queried on a track successfully initialized with
+     * {@link AudioTrack.Builder#setOffloadedPlayback(boolean)}.
+     * @return decoder padding expressed in frames.
+     */
+    public @IntRange(from = 0) int getOffloadPadding() {
+        if (!mOffloaded) {
+            throw new IllegalStateException("Illegal query of padding on non-offloaded track");
+        }
+        if (mState == STATE_UNINITIALIZED) {
+            throw new IllegalStateException("Illegal query of padding on uninitialized track");
+        }
+        return mOffloadPaddingFrames;
+    }
+
+    /**
      * Declares that the last write() operation on this track provided the last buffer of this
      * stream.
      * After the end of stream, previously set padding and delay values are ignored.
@@ -1040,6 +1090,15 @@
     }
 
     /**
+     * Returns whether the track was built with {@link Builder#setOffloadedPlayback(boolean)} set
+     * to {@code true}.
+     * @return true if the track is using offloaded playback.
+     */
+    public boolean isOffloadedPlayback() {
+        return mOffloaded;
+    }
+
+    /**
      * Returns whether direct playback of an audio format with the provided attributes is
      * currently supported on the system.
      * <p>Direct playback means that the audio stream is not resampled or downmixed
@@ -1491,7 +1550,7 @@
      * @return current size in frames of the <code>AudioTrack</code> buffer.
      * @throws IllegalStateException if track is not initialized.
      */
-    public int getBufferSizeInFrames() {
+    public @IntRange (from = 0) int getBufferSizeInFrames() {
         return native_get_buffer_size_frames();
     }
 
@@ -1518,7 +1577,7 @@
      *    {@link #ERROR_BAD_VALUE}, {@link #ERROR_INVALID_OPERATION}
      * @throws IllegalStateException if track is not initialized.
      */
-    public int setBufferSizeInFrames(int bufferSizeInFrames) {
+    public int setBufferSizeInFrames(@IntRange (from = 0) int bufferSizeInFrames) {
         if (mDataLoadMode == MODE_STATIC || mState == STATE_UNINITIALIZED) {
             return ERROR_INVALID_OPERATION;
         }
@@ -1547,7 +1606,7 @@
      *  @return maximum size in frames of the <code>AudioTrack</code> buffer.
      *  @throws IllegalStateException if track is not initialized.
      */
-    public int getBufferCapacityInFrames() {
+    public @IntRange (from = 0) int getBufferCapacityInFrames() {
         return native_get_buffer_capacity_frames();
     }
 
@@ -2054,7 +2113,7 @@
      * @return error code or success, see {@link #SUCCESS}, {@link #ERROR_BAD_VALUE},
      *    {@link #ERROR_INVALID_OPERATION}
      */
-    public int setPlaybackHeadPosition(int positionInFrames) {
+    public int setPlaybackHeadPosition(@IntRange (from = 0) int positionInFrames) {
         if (mDataLoadMode == MODE_STREAM || mState == STATE_UNINITIALIZED ||
                 getPlayState() == PLAYSTATE_PLAYING) {
             return ERROR_INVALID_OPERATION;
@@ -2096,7 +2155,8 @@
      * @return error code or success, see {@link #SUCCESS}, {@link #ERROR_BAD_VALUE},
      *    {@link #ERROR_INVALID_OPERATION}
      */
-    public int setLoopPoints(int startInFrames, int endInFrames, int loopCount) {
+    public int setLoopPoints(@IntRange (from = 0) int startInFrames,
+            @IntRange (from = 0) int endInFrames, @IntRange (from = -1) int loopCount) {
         if (mDataLoadMode == MODE_STREAM || mState == STATE_UNINITIALIZED ||
                 getPlayState() == PLAYSTATE_PLAYING) {
             return ERROR_INVALID_OPERATION;
@@ -2849,7 +2909,7 @@
      * @return error code or success, see {@link #SUCCESS},
      *    {@link #ERROR_INVALID_OPERATION}, {@link #ERROR}
      */
-    public int setAuxEffectSendLevel(float level) {
+    public int setAuxEffectSendLevel(@FloatRange(from = 0.0) float level) {
         if (mState == STATE_UNINITIALIZED) {
             return ERROR_INVALID_OPERATION;
         }
@@ -3095,21 +3155,22 @@
          * gets invalidated by the system to prevent any other offload.
          * @param track the {@link AudioTrack} on which the event happened.
          */
-        public void onTearDown(AudioTrack track) { }
+        public void onTearDown(@NonNull AudioTrack track) { }
         /**
          * Called when all the buffers of an offloaded track that were queued in the audio system
          * (e.g. the combination of the Android audio framework and the device's audio hardware)
          * have been played after {@link AudioTrack#stop()} has been called.
          * @param track the {@link AudioTrack} on which the event happened.
          */
-        public void onPresentationEnded(AudioTrack track) { }
+        public void onPresentationEnded(@NonNull AudioTrack track) { }
         /**
          * Called when more audio data can be written without blocking on an offloaded track.
          * @param track the {@link AudioTrack} on which the event happened.
          * @param sizeInFrames the number of frames available to write without blocking.
          *   Note that the frame size of a compressed stream is 1 byte.
          */
-        public void onDataRequest(AudioTrack track, int sizeInFrames) { }
+        public void onDataRequest(@NonNull AudioTrack track, @IntRange(from = 0) int sizeInFrames) {
+        }
     }
 
     /**
@@ -3520,41 +3581,103 @@
     {
         private MetricsConstants() {}
 
-        /**
-         * Key to extract the Stream Type for this track
-         * from the {@link AudioTrack#getMetrics} return value.
-         * The value is a String.
-         */
-        public static final String STREAMTYPE = "android.media.audiotrack.streamtype";
+        // MM_PREFIX is slightly different than TAG, used to avoid cut-n-paste errors.
+        private static final String MM_PREFIX = "android.media.audiotrack.";
 
         /**
-         * Key to extract the Content Type for this track
+         * Key to extract the stream type for this track
          * from the {@link AudioTrack#getMetrics} return value.
-         * The value is a String.
+         * This value may not exist in API level {@link android.os.Build.VERSION_CODES#P}.
+         * The value is a {@code String}.
          */
-        public static final String CONTENTTYPE = "android.media.audiotrack.type";
+        public static final String STREAMTYPE = MM_PREFIX + "streamtype";
 
         /**
-         * Key to extract the Content Type for this track
+         * Key to extract the attribute content type for this track
          * from the {@link AudioTrack#getMetrics} return value.
-         * The value is a String.
+         * The value is a {@code String}.
          */
-        public static final String USAGE = "android.media.audiotrack.usage";
+        public static final String CONTENTTYPE = MM_PREFIX + "type";
+
+        /**
+         * Key to extract the attribute usage for this track
+         * from the {@link AudioTrack#getMetrics} return value.
+         * The value is a {@code String}.
+         */
+        public static final String USAGE = MM_PREFIX + "usage";
 
         /**
          * Key to extract the sample rate for this track in Hz
          * from the {@link AudioTrack#getMetrics} return value.
-         * The value is an integer.
+         * The value is an {@code int}.
+         * @deprecated This does not work. Use {@link AudioTrack#getSampleRate()} instead.
          */
+        @Deprecated
         public static final String SAMPLERATE = "android.media.audiorecord.samplerate";
 
         /**
-         * Key to extract the channel mask information for this track
+         * Key to extract the native channel mask information for this track
          * from the {@link AudioTrack#getMetrics} return value.
          *
-         * The value is a Long integer.
+         * The value is a {@code long}.
+         * @deprecated This does not work. Use {@link AudioTrack#getFormat()} and read from
+         * the returned format instead.
          */
+        @Deprecated
         public static final String CHANNELMASK = "android.media.audiorecord.channelmask";
 
+        /**
+         * Use for testing only. Do not expose.
+         * The current sample rate.
+         * The value is an {@code int}.
+         * @hide
+         */
+        @TestApi
+        public static final String SAMPLE_RATE = MM_PREFIX + "sampleRate";
+
+        /**
+         * Use for testing only. Do not expose.
+         * The native channel mask.
+         * The value is a {@code long}.
+         * @hide
+         */
+        @TestApi
+        public static final String CHANNEL_MASK = MM_PREFIX + "channelMask";
+
+        /**
+         * Use for testing only. Do not expose.
+         * The output audio data encoding.
+         * The value is a {@code String}.
+         * @hide
+         */
+        @TestApi
+        public static final String ENCODING = MM_PREFIX + "encoding";
+
+        /**
+         * Use for testing only. Do not expose.
+         * The port id of this track port in audioserver.
+         * The value is an {@code int}.
+         * @hide
+         */
+        @TestApi
+        public static final String PORT_ID = MM_PREFIX + "portId";
+
+        /**
+         * Use for testing only. Do not expose.
+         * The buffer frameCount.
+         * The value is an {@code int}.
+         * @hide
+         */
+        @TestApi
+        public static final String FRAME_COUNT = MM_PREFIX + "frameCount";
+
+        /**
+         * Use for testing only. Do not expose.
+         * The actual track attributes used.
+         * The value is a {@code String}.
+         * @hide
+         */
+        @TestApi
+        public static final String ATTRIBUTES = MM_PREFIX + "attributes";
     }
 }
diff --git a/media/java/android/media/ExifInterface.java b/media/java/android/media/ExifInterface.java
index 31d2232..4cd8971 100644
--- a/media/java/android/media/ExifInterface.java
+++ b/media/java/android/media/ExifInterface.java
@@ -73,6 +73,12 @@
  * Supported formats are: JPEG, DNG, CR2, NEF, NRW, ARW, RW2, ORF, PEF, SRW, RAF and HEIF.
  * <p>
  * Attribute mutation is supported for JPEG image files.
+ * <p>
+ * Note: It is recommended to use the <a href="{@docRoot}jetpack/androidx.html">AndroidX</a>
+ * <a href="{@docRoot}reference/androidx/exifinterface/media/ExifInterface.html">ExifInterface
+ * Library</a> since it is a superset of this class. In addition to the functionalities of this
+ * class, it supports parsing extra metadata such as exposure and data compression information
+ * as well as setting extra metadata such as GPS and datetime information.
  */
 public class ExifInterface {
     private static final String TAG = "ExifInterface";
@@ -1316,14 +1322,14 @@
     }
 
     @UnsupportedAppUsage(maxTargetSdk = Build.VERSION_CODES.P, trackingBug = 115609023)
-    private final String mFilename;
-    private final FileDescriptor mSeekableFileDescriptor;
-    private final AssetManager.AssetInputStream mAssetInputStream;
-    private final boolean mIsInputStream;
+    private String mFilename;
+    private FileDescriptor mSeekableFileDescriptor;
+    private AssetManager.AssetInputStream mAssetInputStream;
+    private boolean mIsInputStream;
     private int mMimeType;
     @UnsupportedAppUsage
     private final HashMap[] mAttributes = new HashMap[EXIF_TAGS.length];
-    private Set<Integer> mAttributesOffsets = new HashSet<>(EXIF_TAGS.length);
+    private Set<Integer> mHandledIfdOffsets = new HashSet<>(EXIF_TAGS.length);
     private ByteOrder mExifByteOrder = ByteOrder.BIG_ENDIAN;
     @UnsupportedAppUsage(maxTargetSdk = Build.VERSION_CODES.P, trackingBug = 115609023)
     private boolean mHasThumbnail;
@@ -1350,7 +1356,10 @@
      * Reads Exif tags from the specified image file.
      */
     public ExifInterface(@NonNull File file) throws IOException {
-        this(file.getAbsolutePath());
+        if (file == null) {
+            throw new NullPointerException("file cannot be null");
+        }
+        initForFilename(file.getName());
     }
 
     /**
@@ -1358,23 +1367,9 @@
      */
     public ExifInterface(@NonNull String filename) throws IOException {
         if (filename == null) {
-            throw new IllegalArgumentException("filename cannot be null");
+            throw new NullPointerException("filename cannot be null");
         }
-        FileInputStream in = null;
-        mAssetInputStream = null;
-        mFilename = filename;
-        mIsInputStream = false;
-        try {
-            in = new FileInputStream(filename);
-            if (isSeekableFD(in.getFD())) {
-                mSeekableFileDescriptor = in.getFD();
-            } else {
-                mSeekableFileDescriptor = null;
-            }
-            loadAttributes(in);
-        } finally {
-            IoUtils.closeQuietly(in);
-        }
+        initForFilename(filename);
     }
 
     /**
@@ -1384,7 +1379,7 @@
      */
     public ExifInterface(@NonNull FileDescriptor fileDescriptor) throws IOException {
         if (fileDescriptor == null) {
-            throw new IllegalArgumentException("fileDescriptor cannot be null");
+            throw new NullPointerException("fileDescriptor cannot be null");
         }
         mAssetInputStream = null;
         mFilename = null;
@@ -1418,7 +1413,7 @@
      */
     public ExifInterface(@NonNull InputStream inputStream) throws IOException {
         if (inputStream == null) {
-            throw new IllegalArgumentException("inputStream cannot be null");
+            throw new NullPointerException("inputStream cannot be null");
         }
         mFilename = null;
         if (inputStream instanceof AssetManager.AssetInputStream) {
@@ -1443,6 +1438,9 @@
      * @param tag the name of the tag.
      */
     private @Nullable ExifAttribute getExifAttribute(@NonNull String tag) {
+        if (tag == null) {
+            throw new NullPointerException("tag shouldn't be null");
+        }
         // Retrieves all tag groups. The value from primary image tag group has a higher priority
         // than the value from the thumbnail tag group if there are more than one candidates.
         for (int i = 0; i < EXIF_TAGS.length; ++i) {
@@ -1461,6 +1459,9 @@
      * @param tag the name of the tag.
      */
     public @Nullable String getAttribute(@NonNull String tag) {
+        if (tag == null) {
+            throw new NullPointerException("tag shouldn't be null");
+        }
         ExifAttribute attribute = getExifAttribute(tag);
         if (attribute != null) {
             if (!sTagSetForCompatibility.contains(tag)) {
@@ -1499,6 +1500,9 @@
      * @param defaultValue the value to return if the tag is not available.
      */
     public int getAttributeInt(@NonNull String tag, int defaultValue) {
+        if (tag == null) {
+            throw new NullPointerException("tag shouldn't be null");
+        }
         ExifAttribute exifAttribute = getExifAttribute(tag);
         if (exifAttribute == null) {
             return defaultValue;
@@ -1520,6 +1524,9 @@
      * @param defaultValue the value to return if the tag is not available.
      */
     public double getAttributeDouble(@NonNull String tag, double defaultValue) {
+        if (tag == null) {
+            throw new NullPointerException("tag shouldn't be null");
+        }
         ExifAttribute exifAttribute = getExifAttribute(tag);
         if (exifAttribute == null) {
             return defaultValue;
@@ -1539,6 +1546,9 @@
      * @param value the value of the tag.
      */
     public void setAttribute(@NonNull String tag, @Nullable String value) {
+        if (tag == null) {
+            throw new NullPointerException("tag shouldn't be null");
+        }
         // Convert the given value to rational values for backwards compatibility.
         if (value != null && sTagSetForCompatibility.contains(tag)) {
             if (tag.equals(TAG_GPS_TIMESTAMP)) {
@@ -1708,6 +1718,9 @@
      * determine whether the image data format is JPEG or not.
      */
     private void loadAttributes(@NonNull InputStream in) throws IOException {
+        if (in == null) {
+            throw new NullPointerException("inputstream shouldn't be null");
+        }
         try {
             // Initialize mAttributes.
             for (int i = 0; i < EXIF_TAGS.length; ++i) {
@@ -1891,7 +1904,7 @@
      *
      * @param tag the name of the tag.
      */
-    public boolean hasAttribute(String tag) {
+    public boolean hasAttribute(@NonNull String tag) {
         return (getExifAttribute(tag) != null);
     }
 
@@ -2043,6 +2056,9 @@
      *             that means offsets may have changed.
      */
     public @Nullable long[] getAttributeRange(@NonNull String tag) {
+        if (tag == null) {
+            throw new NullPointerException("tag shouldn't be null");
+        }
         if (mModified) {
             throw new IllegalStateException(
                     "The underlying file has been modified since being parsed");
@@ -2064,6 +2080,9 @@
      *         no tag was found.
      */
     public @Nullable byte[] getAttributeBytes(@NonNull String tag) {
+        if (tag == null) {
+            throw new NullPointerException("tag shouldn't be null");
+        }
         final ExifAttribute attribute = getExifAttribute(tag);
         if (attribute != null) {
             return attribute.bytes;
@@ -2234,6 +2253,24 @@
         }
     }
 
+    private void initForFilename(String filename) throws IOException {
+        FileInputStream in = null;
+        mAssetInputStream = null;
+        mFilename = filename;
+        mIsInputStream = false;
+        try {
+            in = new FileInputStream(filename);
+            if (isSeekableFD(in.getFD())) {
+                mSeekableFileDescriptor = in.getFD();
+            } else {
+                mSeekableFileDescriptor = null;
+            }
+            loadAttributes(in);
+        } finally {
+            IoUtils.closeQuietly(in);
+        }
+    }
+
     // Checks the type of image file
     private int getMimeType(BufferedInputStream in) throws IOException {
         in.mark(SIGNATURE_CHECK_SIZE);
@@ -3085,6 +3122,9 @@
     // Reads image file directory, which is a tag group in EXIF.
     private void readImageFileDirectory(ByteOrderedDataInputStream dataInputStream,
             @IfdType int ifdType) throws IOException {
+        // Save offset of current IFD to prevent reading an IFD that is already read.
+        mHandledIfdOffsets.add(dataInputStream.mPosition);
+
         if (dataInputStream.mPosition + 2 > dataInputStream.mLength) {
             // Return if there is no data from the offset.
             return;
@@ -3223,9 +3263,7 @@
                 // 1. Exists within the boundaries of the input stream
                 // 2. Does not point to a previously read IFD.
                 if (offset > 0L && offset < dataInputStream.mLength) {
-                    if (!mAttributesOffsets.contains((int) offset)) {
-                        // Save offset of current IFD to prevent reading an IFD that is already read
-                        mAttributesOffsets.add(dataInputStream.mPosition);
+                    if (!mHandledIfdOffsets.contains((int) offset)) {
                         dataInputStream.seek(offset);
                         readImageFileDirectory(dataInputStream, nextIfdType);
                     } else {
@@ -3279,9 +3317,7 @@
             // 1. Exists within the boundaries of the input stream
             // 2. Does not point to a previously read IFD.
             if (nextIfdOffset > 0L && nextIfdOffset < dataInputStream.mLength) {
-                if (!mAttributesOffsets.contains(nextIfdOffset)) {
-                    // Save offset of current IFD to prevent reading an IFD that is already read.
-                    mAttributesOffsets.add(dataInputStream.mPosition);
+                if (!mHandledIfdOffsets.contains(nextIfdOffset)) {
                     dataInputStream.seek(nextIfdOffset);
                     // Do not overwrite thumbnail IFD data if it alreay exists.
                     if (mAttributes[IFD_TYPE_THUMBNAIL].isEmpty()) {
diff --git a/media/java/android/media/HwAudioSource.java b/media/java/android/media/HwAudioSource.java
index 8bdb8a6..e53b7e8 100644
--- a/media/java/android/media/HwAudioSource.java
+++ b/media/java/android/media/HwAudioSource.java
@@ -129,6 +129,7 @@
      * Starts the playback from {@link AudioDeviceInfo}.
      */
     public void start() {
+        Preconditions.checkState(!isPlaying(), "HwAudioSource is currently playing");
         baseStart();
         mNativeHandle = AudioSystem.startAudioSource(
                 mAudioDeviceInfo.getPort().activeConfig(),
@@ -136,6 +137,14 @@
     }
 
     /**
+     * Checks whether the HwAudioSource player is playing.
+     * @return true if currently playing, false otherwise
+     */
+    public boolean isPlaying() {
+        return mNativeHandle != 0;
+    }
+
+    /**
      * Stops the playback from {@link AudioDeviceInfo}.
      */
     public void stop() {
@@ -165,7 +174,7 @@
      * If the audio attributes are not set with {@link #setAudioAttributes(AudioAttributes)},
      * attributes comprising {@link AudioAttributes#USAGE_MEDIA} will be used.
      */
-    public static class Builder {
+    public static final class Builder {
         private AudioAttributes mAudioAttributes;
         private AudioDeviceInfo mAudioDeviceInfo;
 
diff --git a/media/java/android/media/IAudioFocusDispatcher.aidl b/media/java/android/media/IAudioFocusDispatcher.aidl
index 3b33c5b..e3512fa 100644
--- a/media/java/android/media/IAudioFocusDispatcher.aidl
+++ b/media/java/android/media/IAudioFocusDispatcher.aidl
@@ -23,6 +23,7 @@
  */
 oneway interface IAudioFocusDispatcher {
 
+    @UnsupportedAppUsage
     void dispatchAudioFocusChange(int focusChange, String clientId);
 
     void dispatchFocusResultFromExtPolicy(int requestResult, String clientId);
diff --git a/media/java/android/media/IAudioService.aidl b/media/java/android/media/IAudioService.aidl
index abdc3c9..0285667 100644
--- a/media/java/android/media/IAudioService.aidl
+++ b/media/java/android/media/IAudioService.aidl
@@ -34,6 +34,7 @@
 import android.media.VolumePolicy;
 import android.media.audiopolicy.AudioPolicyConfig;
 import android.media.audiopolicy.AudioProductStrategies;
+import android.media.audiopolicy.AudioVolumeGroups;
 import android.media.audiopolicy.IAudioPolicyCallback;
 import android.media.projection.IMediaProjection;
 
@@ -65,6 +66,7 @@
 
     void adjustStreamVolume(int streamType, int direction, int flags, String callingPackage);
 
+    @UnsupportedAppUsage
     void setStreamVolume(int streamType, int index, int flags, String callingPackage);
 
     boolean isStreamMute(int streamType);
@@ -75,12 +77,24 @@
 
     void setMasterMute(boolean mute, int flags, String callingPackage, int userId);
 
+    @UnsupportedAppUsage
     int getStreamVolume(int streamType);
 
     int getStreamMinVolume(int streamType);
 
+    @UnsupportedAppUsage
     int getStreamMaxVolume(int streamType);
 
+    AudioVolumeGroups listAudioVolumeGroups();
+
+    void setVolumeIndexForAttributes(in AudioAttributes aa, int index, int flags, String callingPackage);
+
+    int getVolumeIndexForAttributes(in AudioAttributes aa);
+
+    int getMaxVolumeIndexForAttributes(in AudioAttributes aa);
+
+    int getMinVolumeIndexForAttributes(in AudioAttributes aa);
+
     int getLastAudibleStreamVolume(int streamType);
 
     AudioProductStrategies getAudioProductStrategies();
@@ -160,6 +174,7 @@
     int handleBluetoothA2dpActiveDeviceChange(in BluetoothDevice device,
             int state, int profile, boolean suppressNoisyIntent, int a2dpVolume);
 
+    @UnsupportedAppUsage
     AudioRoutesInfo startWatchingRoutes(in IAudioRoutesObserver observer);
 
     boolean isCameraSoundForced();
@@ -213,10 +228,10 @@
 
     oneway void playerHasOpPlayAudio(in int piid, in boolean hasOpPlayAudio);
 
-    int setBluetoothHearingAidDeviceConnectionState(in BluetoothDevice device,
+    void setBluetoothHearingAidDeviceConnectionState(in BluetoothDevice device,
             int state, boolean suppressNoisyIntent, int musicDevice);
 
-    int setBluetoothA2dpDeviceConnectionStateSuppressNoisyIntent(in BluetoothDevice device,
+    void setBluetoothA2dpDeviceConnectionStateSuppressNoisyIntent(in BluetoothDevice device,
             int state, int profile, boolean suppressNoisyIntent, int a2dpVolume);
 
     oneway void setFocusRequestResultFromExtPolicy(in AudioFocusInfo afi, int requestResult,
diff --git a/media/java/android/media/IMediaScannerService.aidl b/media/java/android/media/IMediaScannerService.aidl
index c531646..24b5595 100644
--- a/media/java/android/media/IMediaScannerService.aidl
+++ b/media/java/android/media/IMediaScannerService.aidl
@@ -31,6 +31,7 @@
      * @param listener an optional IMediaScannerListener. 
      * If specified, the caller will be notified when scanning is complete via the listener.
      */
+    @UnsupportedAppUsage
     void requestScanFile(String path, String mimeType, in IMediaScannerListener listener);
 
     /**
@@ -40,5 +41,6 @@
      * @param mimeType  an optional mimeType for the file.
      * If mimeType is null, then the mimeType will be inferred from the file extension.
      */
+    @UnsupportedAppUsage
     void scanFile(String path, String mimeType);
 }
diff --git a/media/java/android/media/IRemoteDisplayCallback.aidl b/media/java/android/media/IRemoteDisplayCallback.aidl
index 19cf070..584417d 100644
--- a/media/java/android/media/IRemoteDisplayCallback.aidl
+++ b/media/java/android/media/IRemoteDisplayCallback.aidl
@@ -22,5 +22,6 @@
  * {@hide}
  */
 oneway interface IRemoteDisplayCallback {
+    @UnsupportedAppUsage
     void onStateChanged(in RemoteDisplayState state);
 }
diff --git a/media/java/android/media/MediaDescription.java b/media/java/android/media/MediaDescription.java
index 39eeb3e..458562a 100644
--- a/media/java/android/media/MediaDescription.java
+++ b/media/java/android/media/MediaDescription.java
@@ -268,7 +268,7 @@
         return mTitle + ", " + mSubtitle + ", " + mDescription;
     }
 
-    public static final Parcelable.Creator<MediaDescription> CREATOR =
+    public static final @android.annotation.NonNull Parcelable.Creator<MediaDescription> CREATOR =
             new Parcelable.Creator<MediaDescription>() {
                 @Override
                 public MediaDescription createFromParcel(Parcel in) {
diff --git a/media/java/android/media/MediaHTTPConnection.java b/media/java/android/media/MediaHTTPConnection.java
index 5f324f7..d724762 100644
--- a/media/java/android/media/MediaHTTPConnection.java
+++ b/media/java/android/media/MediaHTTPConnection.java
@@ -37,7 +37,6 @@
 import java.net.UnknownServiceException;
 import java.util.HashMap;
 import java.util.Map;
-import java.util.concurrent.atomic.AtomicBoolean;
 
 /** @hide */
 public class MediaHTTPConnection extends IMediaHTTPConnection.Stub {
@@ -67,7 +66,6 @@
     // from com.squareup.okhttp.internal.http
     private final static int HTTP_TEMP_REDIRECT = 307;
     private final static int MAX_REDIRECTS = 20;
-    private AtomicBoolean mIsConnected = new AtomicBoolean(false);
 
     @UnsupportedAppUsage
     public MediaHTTPConnection() {
@@ -91,7 +89,6 @@
             mAllowCrossDomainRedirect = true;
             mURL = new URL(uri);
             mHeaders = convertHeaderStringToMap(headers);
-            mIsConnected.set(true);
         } catch (MalformedURLException e) {
             return null;
         }
@@ -142,14 +139,7 @@
     @Override
     @UnsupportedAppUsage
     public void disconnect() {
-        if (mIsConnected.getAndSet(false)) {
-            (new Thread() {
-                @Override
-                public void run() {
-                    teardownConnection();
-                }
-            }).start();
-        }
+        teardownConnection();
         mHeaders = null;
         mURL = null;
     }
@@ -334,14 +324,7 @@
     @Override
     @UnsupportedAppUsage
     public int readAt(long offset, int size) {
-        if (!mIsConnected.get()) {
-            return -1;
-        }
-        int result = native_readAt(offset, size);
-        if (!mIsConnected.get()) {
-            return -1;
-        }
-        return result;
+        return native_readAt(offset, size);
     }
 
     private int readAt(long offset, byte[] data, int size) {
diff --git a/media/java/android/media/MediaMetadata.java b/media/java/android/media/MediaMetadata.java
index dea98d5..8512dbe 100644
--- a/media/java/android/media/MediaMetadata.java
+++ b/media/java/android/media/MediaMetadata.java
@@ -632,7 +632,7 @@
         return EDITOR_KEY_MAPPING.get(editorKey, null);
     }
 
-    public static final Parcelable.Creator<MediaMetadata> CREATOR =
+    public static final @android.annotation.NonNull Parcelable.Creator<MediaMetadata> CREATOR =
             new Parcelable.Creator<MediaMetadata>() {
                 @Override
                 public MediaMetadata createFromParcel(Parcel in) {
diff --git a/media/java/android/media/MediaParceledListSlice.java b/media/java/android/media/MediaParceledListSlice.java
index 16a37d9..e90d9a4 100644
--- a/media/java/android/media/MediaParceledListSlice.java
+++ b/media/java/android/media/MediaParceledListSlice.java
@@ -185,7 +185,7 @@
         return contents;
     }
 
-    public static final Parcelable.Creator<MediaParceledListSlice> CREATOR =
+    public static final @android.annotation.NonNull Parcelable.Creator<MediaParceledListSlice> CREATOR =
             new Parcelable.Creator<MediaParceledListSlice>() {
         @Override
         public MediaParceledListSlice createFromParcel(Parcel in) {
diff --git a/media/java/android/media/MediaPlayer.java b/media/java/android/media/MediaPlayer.java
index 08ce9fc..abbfa88 100644
--- a/media/java/android/media/MediaPlayer.java
+++ b/media/java/android/media/MediaPlayer.java
@@ -1103,7 +1103,7 @@
             setDataSource(afd);
             return true;
         } catch (NullPointerException | SecurityException | IOException ex) {
-            Log.w(TAG, "Couldn't open " + uri + ": " + ex);
+            Log.w(TAG, "Couldn't open " + uri == null ? "null uri" : uri.toSafeString(), ex);
             return false;
         }
     }
@@ -2519,7 +2519,7 @@
          * Used to read a TrackInfo from a Parcel.
          */
         @UnsupportedAppUsage
-        static final Parcelable.Creator<TrackInfo> CREATOR
+        static final @android.annotation.NonNull Parcelable.Creator<TrackInfo> CREATOR
                 = new Parcelable.Creator<TrackInfo>() {
                     @Override
                     public TrackInfo createFromParcel(Parcel in) {
diff --git a/media/java/android/media/MediaRecorder.java b/media/java/android/media/MediaRecorder.java
index 1304afe..e7b4752 100644
--- a/media/java/android/media/MediaRecorder.java
+++ b/media/java/android/media/MediaRecorder.java
@@ -17,6 +17,7 @@
 package android.media;
 
 import android.annotation.CallbackExecutor;
+import android.annotation.FloatRange;
 import android.annotation.NonNull;
 import android.annotation.Nullable;
 import android.annotation.RequiresPermission;
@@ -35,6 +36,7 @@
 import android.view.Surface;
 
 import com.android.internal.annotations.GuardedBy;
+import com.android.internal.util.Preconditions;
 
 import java.io.File;
 import java.io.FileDescriptor;
@@ -45,7 +47,6 @@
 import java.util.List;
 import java.util.concurrent.Executor;
 
-
 /**
  * Used to record audio and video. The recording control is based on a
  * simple state machine (see below).
@@ -90,7 +91,8 @@
  */
 public class MediaRecorder implements AudioRouting,
                                       AudioRecordingMonitor,
-                                      AudioRecordingMonitorClient
+                                      AudioRecordingMonitorClient,
+                                      MicrophoneDirection
 {
     static {
         System.loadLibrary("media_jni");
@@ -1527,6 +1529,36 @@
             ArrayList<MicrophoneInfo> activeMicrophones);
 
     //--------------------------------------------------------------------------
+    // MicrophoneDirection
+    //--------------------
+    /**
+     * Specifies the logical microphone (for processing).
+     *
+     * @param direction Direction constant.
+     * @return true if sucessful.
+     */
+    public boolean setMicrophoneDirection(@DirectionMode int direction) {
+        return native_setMicrophoneDirection(direction) == 0;
+    }
+
+    /**
+     * Specifies the zoom factor (i.e. the field dimension) for the selected microphone
+     * (for processing). The selected microphone is determined by the use-case for the stream.
+     *
+     * @param zoom the desired field dimension of microphone capture. Range is from -1 (wide angle),
+     * though 0 (no zoom) to 1 (maximum zoom).
+     * @return true if sucessful.
+     */
+    public boolean setMicrophoneFieldDimension(@FloatRange(from = -1.0, to = 1.0) float zoom) {
+        Preconditions.checkArgument(
+                zoom >= -1 && zoom <= 1, "Argument must fall between -1 & 1 (inclusive)");
+        return native_setMicrophoneFieldDimension(zoom) == 0;
+    }
+
+    private native int native_setMicrophoneDirection(int direction);
+    private native int native_setMicrophoneFieldDimension(float zoom);
+
+    //--------------------------------------------------------------------------
     // Implementation of AudioRecordingMonitor interface
     //--------------------
 
diff --git a/media/java/android/media/MediaRouterClientState.java b/media/java/android/media/MediaRouterClientState.java
index 7643924..1fe4eef 100644
--- a/media/java/android/media/MediaRouterClientState.java
+++ b/media/java/android/media/MediaRouterClientState.java
@@ -68,7 +68,7 @@
         return "MediaRouterClientState{ routes=" + routes.toString() + " }";
     }
 
-    public static final Parcelable.Creator<MediaRouterClientState> CREATOR =
+    public static final @android.annotation.NonNull Parcelable.Creator<MediaRouterClientState> CREATOR =
             new Parcelable.Creator<MediaRouterClientState>() {
         @Override
         public MediaRouterClientState createFromParcel(Parcel in) {
@@ -180,7 +180,7 @@
         }
 
         @SuppressWarnings("hiding")
-        public static final Parcelable.Creator<RouteInfo> CREATOR =
+        public static final @android.annotation.NonNull Parcelable.Creator<RouteInfo> CREATOR =
                 new Parcelable.Creator<RouteInfo>() {
             @Override
             public RouteInfo createFromParcel(Parcel in) {
diff --git a/media/java/android/media/MediaTimestamp.java b/media/java/android/media/MediaTimestamp.java
index 03e454c..da3362a 100644
--- a/media/java/android/media/MediaTimestamp.java
+++ b/media/java/android/media/MediaTimestamp.java
@@ -134,7 +134,7 @@
      * @hide
      */
     @SystemApi
-    public static class Builder {
+    public static final class Builder {
         long mMediaTimeUs;
         long mNanoTime;
         float mClockRate = 1.0f;
diff --git a/media/java/android/media/MicrophoneDirection.java b/media/java/android/media/MicrophoneDirection.java
index 489e268..2382da5 100644
--- a/media/java/android/media/MicrophoneDirection.java
+++ b/media/java/android/media/MicrophoneDirection.java
@@ -22,6 +22,10 @@
 import java.lang.annotation.Retention;
 import java.lang.annotation.RetentionPolicy;
 
+/**
+ * Interface defining mechanism for controlling the directionality and field width of
+ * audio capture.
+ */
 public interface MicrophoneDirection {
     /**
      * Don't do any directionality processing of the activated microphone(s).
@@ -41,21 +45,23 @@
     int MIC_DIRECTION_EXTERNAL = 3;
 
     /** @hide */
-    @IntDef({
+    /*public*/ @IntDef({
             MIC_DIRECTION_UNSPECIFIED,
             MIC_DIRECTION_FRONT,
             MIC_DIRECTION_BACK,
             MIC_DIRECTION_EXTERNAL
     })
     @Retention(RetentionPolicy.SOURCE)
-    public @interface Directionmode{};
+    @interface DirectionMode{};
     /**
-     * Specifies the logical microphone (for processing).
+     * Specifies the logical microphone (for processing). Applications can use this to specify
+     * which side of the device to optimize capture from. Typically used in conjunction with
+     * the camera capturing video.
      *
      * @param direction Direction constant.
      * @return true if sucessful.
      */
-    boolean setMicrophoneDirection(@Directionmode int direction);
+    boolean setMicrophoneDirection(@DirectionMode int direction);
 
     /**
      * Specifies the zoom factor (i.e. the field dimension) for the selected microphone
diff --git a/media/java/android/media/PlaybackParams.java b/media/java/android/media/PlaybackParams.java
index 3fe1a32..b4325b6 100644
--- a/media/java/android/media/PlaybackParams.java
+++ b/media/java/android/media/PlaybackParams.java
@@ -234,7 +234,7 @@
         return mSpeed;
     }
 
-    public static final Parcelable.Creator<PlaybackParams> CREATOR =
+    public static final @android.annotation.NonNull Parcelable.Creator<PlaybackParams> CREATOR =
             new Parcelable.Creator<PlaybackParams>() {
                 @Override
                 public PlaybackParams createFromParcel(Parcel in) {
diff --git a/media/java/android/media/PlayerBase.java b/media/java/android/media/PlayerBase.java
index 7c6367e..50caf733 100644
--- a/media/java/android/media/PlayerBase.java
+++ b/media/java/android/media/PlayerBase.java
@@ -21,8 +21,6 @@
 import android.app.ActivityThread;
 import android.app.AppOpsManager;
 import android.content.Context;
-import android.media.VolumeShaper;
-import android.os.Binder;
 import android.os.IBinder;
 import android.os.Parcel;
 import android.os.Parcelable;
@@ -35,7 +33,6 @@
 import com.android.internal.app.IAppOpsCallback;
 import com.android.internal.app.IAppOpsService;
 
-import java.lang.IllegalArgumentException;
 import java.lang.ref.WeakReference;
 import java.util.Objects;
 
@@ -55,6 +52,10 @@
 
     // parameters of the player that affect AppOps
     protected AudioAttributes mAttributes;
+
+    // volumes of the subclass "player volumes", as seen by the client of the subclass
+    //   (e.g. what was passed in AudioTrack.setVolume(float)). The actual volume applied is
+    //   the combination of the player volume, and the PlayerBase pan and volume multipliers
     protected float mLeftVolume = 1.0f;
     protected float mRightVolume = 1.0f;
     protected float mAuxEffectSendLevel = 0.0f;
@@ -82,6 +83,8 @@
     private float mPanMultiplierL = 1.0f;
     @GuardedBy("mLock")
     private float mPanMultiplierR = 1.0f;
+    @GuardedBy("mLock")
+    private float mVolMultiplier = 1.0f;
 
     /**
      * Constructor. Must be given audio attributes, as they are required for AppOps.
@@ -202,18 +205,33 @@
                 mPanMultiplierR = 1.0f + p;
             }
         }
-        baseSetVolume(mLeftVolume, mRightVolume);
+        updatePlayerVolume();
+    }
+
+    private void updatePlayerVolume() {
+        final float finalLeftVol, finalRightVol;
+        final boolean isRestricted;
+        synchronized (mLock) {
+            finalLeftVol = mVolMultiplier * mLeftVolume * mPanMultiplierL;
+            finalRightVol = mVolMultiplier * mRightVolume * mPanMultiplierR;
+            isRestricted = isRestricted_sync();
+        }
+        playerSetVolume(isRestricted /*muting*/, finalLeftVol, finalRightVol);
+    }
+
+    void setVolumeMultiplier(float vol) {
+        synchronized (mLock) {
+            this.mVolMultiplier = vol;
+        }
+        updatePlayerVolume();
     }
 
     void baseSetVolume(float leftVolume, float rightVolume) {
-        final boolean isRestricted;
         synchronized (mLock) {
             mLeftVolume = leftVolume;
             mRightVolume = rightVolume;
-            isRestricted = isRestricted_sync();
         }
-        playerSetVolume(isRestricted/*muting*/,
-                leftVolume * mPanMultiplierL, rightVolume * mPanMultiplierR);
+        updatePlayerVolume();
     }
 
     int baseSetAuxEffectSendLevel(float level) {
@@ -469,7 +487,7 @@
         public void setVolume(float vol) {
             final PlayerBase pb = mWeakPB.get();
             if (pb != null) {
-                pb.baseSetVolume(vol, vol);
+                pb.setVolumeMultiplier(vol);
             }
         }
 
@@ -535,7 +553,7 @@
             dest.writeStrongBinder(mIPlayer == null ? null : mIPlayer.asBinder());
         }
 
-        public static final Parcelable.Creator<PlayerIdCard> CREATOR
+        public static final @android.annotation.NonNull Parcelable.Creator<PlayerIdCard> CREATOR
         = new Parcelable.Creator<PlayerIdCard>() {
             /**
              * Rebuilds an PlayerIdCard previously stored with writeToParcel().
@@ -574,13 +592,14 @@
     // Utilities
 
     /**
+     * @hide
      * Use to generate warning or exception in legacy code paths that allowed passing stream types
      * to qualify audio playback.
      * @param streamType the stream type to check
      * @throws IllegalArgumentException
      */
-    public static void deprecateStreamTypeForPlayback(int streamType, String className,
-            String opName) throws IllegalArgumentException {
+    public static void deprecateStreamTypeForPlayback(int streamType, @NonNull String className,
+            @NonNull String opName) throws IllegalArgumentException {
         // STREAM_ACCESSIBILITY was introduced at the same time the use of stream types
         // for audio playback was deprecated, so it is not allowed at all to qualify a playback
         // use case
diff --git a/media/java/android/media/Rating.java b/media/java/android/media/Rating.java
index ffe7e48..be75258 100644
--- a/media/java/android/media/Rating.java
+++ b/media/java/android/media/Rating.java
@@ -116,7 +116,7 @@
         dest.writeFloat(mRatingValue);
     }
 
-    public static final Parcelable.Creator<Rating> CREATOR = new Parcelable.Creator<Rating>() {
+    public static final @android.annotation.NonNull Parcelable.Creator<Rating> CREATOR = new Parcelable.Creator<Rating>() {
         /**
          * Rebuilds a Rating previously stored with writeToParcel().
          * @param p    Parcel object to read the Rating from
diff --git a/media/java/android/media/RemoteDisplayState.java b/media/java/android/media/RemoteDisplayState.java
index f8a4605..2f4ace0 100644
--- a/media/java/android/media/RemoteDisplayState.java
+++ b/media/java/android/media/RemoteDisplayState.java
@@ -76,7 +76,7 @@
         dest.writeTypedList(displays);
     }
 
-    public static final Parcelable.Creator<RemoteDisplayState> CREATOR =
+    public static final @android.annotation.NonNull Parcelable.Creator<RemoteDisplayState> CREATOR =
             new Parcelable.Creator<RemoteDisplayState>() {
         @Override
         public RemoteDisplayState createFromParcel(Parcel in) {
@@ -176,7 +176,7 @@
         }
 
         @SuppressWarnings("hiding")
-        public static final Parcelable.Creator<RemoteDisplayInfo> CREATOR =
+        public static final @android.annotation.NonNull Parcelable.Creator<RemoteDisplayInfo> CREATOR =
                 new Parcelable.Creator<RemoteDisplayInfo>() {
             @Override
             public RemoteDisplayInfo createFromParcel(Parcel in) {
diff --git a/media/java/android/media/SubtitleData.java b/media/java/android/media/SubtitleData.java
index 852babe..31622a9 100644
--- a/media/java/android/media/SubtitleData.java
+++ b/media/java/android/media/SubtitleData.java
@@ -155,7 +155,7 @@
      * @hide
      */
     @SystemApi
-    public static class Builder {
+    public static final class Builder {
         private int mTrackIndex;
         private long mStartTimeUs;
         private long mDurationUs;
diff --git a/media/java/android/media/TimedMetaData.java b/media/java/android/media/TimedMetaData.java
index 2a89888..990760c 100644
--- a/media/java/android/media/TimedMetaData.java
+++ b/media/java/android/media/TimedMetaData.java
@@ -104,7 +104,7 @@
      * @hide
      */
     @SystemApi
-    public static class Builder {
+    public static final class Builder {
         private long mTimestampUs;
         private byte[] mMetaData = new byte[0];
 
diff --git a/media/java/android/media/VolumePolicy.java b/media/java/android/media/VolumePolicy.java
index bd6667f..b193b70 100644
--- a/media/java/android/media/VolumePolicy.java
+++ b/media/java/android/media/VolumePolicy.java
@@ -95,7 +95,7 @@
         dest.writeInt(vibrateToSilentDebounce);
     }
 
-    public static final Parcelable.Creator<VolumePolicy> CREATOR
+    public static final @android.annotation.NonNull Parcelable.Creator<VolumePolicy> CREATOR
             = new Parcelable.Creator<VolumePolicy>() {
         @Override
         public VolumePolicy createFromParcel(Parcel p) {
diff --git a/media/java/android/media/VolumeShaper.java b/media/java/android/media/VolumeShaper.java
index 2f33e75..663d564 100644
--- a/media/java/android/media/VolumeShaper.java
+++ b/media/java/android/media/VolumeShaper.java
@@ -501,7 +501,7 @@
             }
         }
 
-        public static final Parcelable.Creator<VolumeShaper.Configuration> CREATOR
+        public static final @android.annotation.NonNull Parcelable.Creator<VolumeShaper.Configuration> CREATOR
                 = new Parcelable.Creator<VolumeShaper.Configuration>() {
             @Override
             public VolumeShaper.Configuration createFromParcel(Parcel p) {
@@ -1178,7 +1178,7 @@
             dest.writeFloat(mXOffset);
         }
 
-        public static final Parcelable.Creator<VolumeShaper.Operation> CREATOR
+        public static final @android.annotation.NonNull Parcelable.Creator<VolumeShaper.Operation> CREATOR
                 = new Parcelable.Creator<VolumeShaper.Operation>() {
             @Override
             public VolumeShaper.Operation createFromParcel(Parcel p) {
@@ -1397,7 +1397,7 @@
             dest.writeFloat(mXOffset);
         }
 
-        public static final Parcelable.Creator<VolumeShaper.State> CREATOR
+        public static final @android.annotation.NonNull Parcelable.Creator<VolumeShaper.State> CREATOR
                 = new Parcelable.Creator<VolumeShaper.State>() {
             @Override
             public VolumeShaper.State createFromParcel(Parcel p) {
diff --git a/media/java/android/media/audiopolicy/AudioPolicyConfig.java b/media/java/android/media/audiopolicy/AudioPolicyConfig.java
index a56fd31..a6e63c7 100644
--- a/media/java/android/media/audiopolicy/AudioPolicyConfig.java
+++ b/media/java/android/media/audiopolicy/AudioPolicyConfig.java
@@ -136,7 +136,7 @@
         }
     }
 
-    public static final Parcelable.Creator<AudioPolicyConfig> CREATOR
+    public static final @android.annotation.NonNull Parcelable.Creator<AudioPolicyConfig> CREATOR
             = new Parcelable.Creator<AudioPolicyConfig>() {
         /**
          * Rebuilds an AudioPolicyConfig previously stored with writeToParcel().
diff --git a/media/java/android/media/audiopolicy/AudioProductStrategies.java b/media/java/android/media/audiopolicy/AudioProductStrategies.java
index 6a2375f..c305b68 100644
--- a/media/java/android/media/audiopolicy/AudioProductStrategies.java
+++ b/media/java/android/media/audiopolicy/AudioProductStrategies.java
@@ -85,7 +85,7 @@
      * Returns an {@link Iterator}
      */
     @Override
-    public Iterator<AudioProductStrategy> iterator() {
+    public @NonNull Iterator<AudioProductStrategy> iterator() {
         return mAudioProductStrategyList.iterator();
     }
 
@@ -177,7 +177,50 @@
     @Nullable
     public AudioProductStrategy getProductStrategyForAudioAttributes(@NonNull AudioAttributes aa) {
         Preconditions.checkNotNull(aa, "attributes must not be null");
-        return getById(native_get_product_strategies_from_audio_attributes(aa));
+        int productStrategyId =  native_get_product_strategies_from_audio_attributes(aa);
+        if (productStrategyId < 0) {
+            Log.w(TAG, "no strategy found for Attributes " + aa.toString());
+            return null;
+        }
+        return getById(productStrategyId);
+    }
+
+   /**
+    * @hide
+    * @param attributes the {@link AudioAttributes} to be considered
+    * @return volume group associated to the given {@link AudioAttributes}.
+    *         If no group supports the given {@link AudioAttributes}, it returns the volume group
+    *         for the default attributes.
+    *         If no group supports the default attributes, it returns {@link #DEFAULT_VOLUME_GROUP}
+    */
+    @SystemApi
+    public int getVolumeGroupIdForAttributes(@NonNull AudioAttributes attributes) {
+        Preconditions.checkNotNull(attributes, "attributes must not be null");
+        int volumeGroupId = getVolumeGroupIdForAttributesInt(attributes);
+        if (volumeGroupId != AudioVolumeGroups.DEFAULT_VOLUME_GROUP) {
+            return volumeGroupId;
+        }
+        // The default volume group is the one hosted by default product strategy, i.e.
+        // supporting Default Attributes
+        return getVolumeGroupIdForAttributesInt(AudioProductStrategy.sDefaultAttributes);
+    }
+
+   /**
+    * @hide
+    * @param streamType to be considered
+    * @return volume group associated to the given stream type.
+    */
+    @SystemApi
+    public int getVolumeGroupIdForLegacyStreamType(int streamType) {
+        for (final AudioProductStrategy productStrategy : this) {
+            int volumeGroupId = productStrategy.getVolumeGroupIdForLegacyStreamType(streamType);
+            if (volumeGroupId != AudioVolumeGroups.DEFAULT_VOLUME_GROUP) {
+                return volumeGroupId;
+            }
+        }
+        // The default volume group is the one hosted by default product strategy, i.e.
+        // supporting Default Attributes
+        return getVolumeGroupIdForAttributesInt(AudioProductStrategy.sDefaultAttributes);
     }
 
     @Override
@@ -193,7 +236,22 @@
         }
     }
 
-    public static final Parcelable.Creator<AudioProductStrategies> CREATOR =
+    /**
+     * @param attributes to be considered
+     * @return volume group associated to the given {@link AudioAttributes}.
+     */
+    private int getVolumeGroupIdForAttributesInt(@NonNull AudioAttributes attributes) {
+        Preconditions.checkNotNull(attributes, "attributes must not be null");
+        for (final AudioProductStrategy productStrategy : this) {
+            int volumeGroupId = productStrategy.getVolumeGroupIdForAudioAttributes(attributes);
+            if (volumeGroupId != AudioVolumeGroups.DEFAULT_VOLUME_GROUP) {
+                return volumeGroupId;
+            }
+        }
+        return AudioVolumeGroups.DEFAULT_VOLUME_GROUP;
+    }
+
+    public static final @android.annotation.NonNull Parcelable.Creator<AudioProductStrategies> CREATOR =
             new Parcelable.Creator<AudioProductStrategies>() {
                 @Override
                 public AudioProductStrategies createFromParcel(@NonNull Parcel in) {
diff --git a/media/java/android/media/audiopolicy/AudioProductStrategy.java b/media/java/android/media/audiopolicy/AudioProductStrategy.java
index af6e8bf..48500e01 100644
--- a/media/java/android/media/audiopolicy/AudioProductStrategy.java
+++ b/media/java/android/media/audiopolicy/AudioProductStrategy.java
@@ -157,32 +157,32 @@
     /**
      * @hide
      * @param streamType legacy stream type used for volume operation only
-     * @return the {@link AudioAttributes} relevant for the given streamType.
-     *         If none is found, it builds the default attributes.
+     * @return the volume group id relevant for the given streamType.
+     *         If none is found, {@link AudioVolumeGroups#DEFAULT_VOLUME_GROUP} is returned.
      */
-    public int getGroupIdForLegacyStreamType(int streamType) {
+    public int getVolumeGroupIdForLegacyStreamType(int streamType) {
         for (final AudioAttributesGroup aag : mAudioAttributesGroups) {
             if (aag.supportsStreamType(streamType)) {
-                return aag.getGroupId();
+                return aag.getVolumeGroupId();
             }
         }
-        return DEFAULT_GROUP;
+        return AudioVolumeGroups.DEFAULT_VOLUME_GROUP;
     }
 
     /**
      * @hide
      * @param aa the {@link AudioAttributes} to be considered
-     * @return the group id associated with the given audio attributes if found,
-     *         default value otherwise.
+     * @return the volume group id associated with the given audio attributes if found,
+     *         {@link AudioVolumeGroups#DEFAULT_VOLUME_GROUP} otherwise.
      */
-    public int getGroupIdForAudioAttributes(@NonNull AudioAttributes aa) {
+    public int getVolumeGroupIdForAudioAttributes(@NonNull AudioAttributes aa) {
         Preconditions.checkNotNull(aa, "AudioAttributes must not be null");
         for (final AudioAttributesGroup aag : mAudioAttributesGroups) {
             if (aag.supportsAttributes(aa)) {
-                return aag.getGroupId();
+                return aag.getVolumeGroupId();
             }
         }
-        return DEFAULT_GROUP;
+        return AudioVolumeGroups.DEFAULT_VOLUME_GROUP;
     }
 
     @Override
@@ -200,7 +200,7 @@
         }
     }
 
-    public static final Parcelable.Creator<AudioProductStrategy> CREATOR =
+    public static final @android.annotation.NonNull Parcelable.Creator<AudioProductStrategy> CREATOR =
             new Parcelable.Creator<AudioProductStrategy>() {
                 @Override
                 public AudioProductStrategy createFromParcel(@NonNull Parcel in) {
@@ -266,15 +266,14 @@
             && ((refFormattedTags.length() == 0) || refFormattedTags.equals(cliFormattedTags));
     }
 
-
     private static final class AudioAttributesGroup implements Parcelable {
-        private int mGroupId;
+        private int mVolumeGroupId;
         private int mLegacyStreamType;
         private final AudioAttributes[] mAudioAttributes;
 
-        AudioAttributesGroup(int groupId, int streamType,
+        AudioAttributesGroup(int volumeGroupId, int streamType,
                 @NonNull AudioAttributes[] audioAttributes) {
-            mGroupId = groupId;
+            mVolumeGroupId = volumeGroupId;
             mLegacyStreamType = streamType;
             mAudioAttributes = audioAttributes;
         }
@@ -286,7 +285,7 @@
 
             AudioAttributesGroup thatAag = (AudioAttributesGroup) o;
 
-            return mGroupId == thatAag.mGroupId
+            return mVolumeGroupId == thatAag.mVolumeGroupId
                     && mLegacyStreamType == thatAag.mLegacyStreamType
                     && mAudioAttributes.equals(thatAag.mAudioAttributes);
         }
@@ -295,8 +294,8 @@
             return mLegacyStreamType;
         }
 
-        public int getGroupId() {
-            return mGroupId;
+        public int getVolumeGroupId() {
+            return mVolumeGroupId;
         }
 
         public @NonNull AudioAttributes getAudioAttributes() {
@@ -331,7 +330,7 @@
 
         @Override
         public void writeToParcel(@NonNull Parcel dest, int flags) {
-            dest.writeInt(mGroupId);
+            dest.writeInt(mVolumeGroupId);
             dest.writeInt(mLegacyStreamType);
             dest.writeInt(mAudioAttributes.length);
             for (AudioAttributes attributes : mAudioAttributes) {
@@ -339,18 +338,18 @@
             }
         }
 
-        public static final Parcelable.Creator<AudioAttributesGroup> CREATOR =
+        public static final @android.annotation.NonNull Parcelable.Creator<AudioAttributesGroup> CREATOR =
                 new Parcelable.Creator<AudioAttributesGroup>() {
                     @Override
                     public AudioAttributesGroup createFromParcel(@NonNull Parcel in) {
-                        int groupId = in.readInt();
+                        int volumeGroupId = in.readInt();
                         int streamType = in.readInt();
                         int nbAttributes = in.readInt();
                         AudioAttributes[] aa = new AudioAttributes[nbAttributes];
                         for (int index = 0; index < nbAttributes; index++) {
                             aa[index] = AudioAttributes.CREATOR.createFromParcel(in);
                         }
-                        return new AudioAttributesGroup(groupId, streamType, aa);
+                        return new AudioAttributesGroup(volumeGroupId, streamType, aa);
                     }
 
                     @Override
@@ -365,8 +364,8 @@
             StringBuilder s = new StringBuilder();
             s.append("\n    Legacy Stream Type: ");
             s.append(Integer.toString(mLegacyStreamType));
-            s.append(" Group Id: ");
-            s.append(Integer.toString(mGroupId));
+            s.append(" Volume Group Id: ");
+            s.append(Integer.toString(mVolumeGroupId));
 
             for (AudioAttributes attribute : mAudioAttributes) {
                 s.append("\n    -");
diff --git a/media/java/android/media/audiopolicy/AudioVolumeGroup.aidl b/media/java/android/media/audiopolicy/AudioVolumeGroup.aidl
new file mode 100644
index 0000000..caf1e0d
--- /dev/null
+++ b/media/java/android/media/audiopolicy/AudioVolumeGroup.aidl
@@ -0,0 +1,18 @@
+/* Copyright 2018, 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.media.audiopolicy;
+
+parcelable AudioVolumeGroup;
diff --git a/media/java/android/media/audiopolicy/AudioVolumeGroup.java b/media/java/android/media/audiopolicy/AudioVolumeGroup.java
new file mode 100644
index 0000000..b60947f
--- /dev/null
+++ b/media/java/android/media/audiopolicy/AudioVolumeGroup.java
@@ -0,0 +1,171 @@
+/*
+ * Copyright (C) 2018 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.media.audiopolicy;
+
+import android.annotation.NonNull;
+import android.annotation.SystemApi;
+import android.media.AudioAttributes;
+import android.os.Parcel;
+import android.os.Parcelable;
+
+import com.android.internal.util.Preconditions;
+
+import java.util.Arrays;
+import java.util.List;
+
+/**
+ * A class to create the association between different playback attributes
+ * (e.g. media, mapping direction) to a single volume control.
+ * @hide
+ */
+@SystemApi
+public final class AudioVolumeGroup implements Parcelable {
+    /**
+     * Unique identifier of a volume group.
+     */
+    private int mId;
+    /**
+     * human-readable name of this volume group.
+     */
+    private final String mName;
+
+    private final AudioAttributes[] mAudioAttributes;
+    private int[] mLegacyStreamTypes;
+
+    /**
+     * @param name of the volume group
+     * @param id of the volume group
+     * @param followers {@link AudioProductStrategies} strategy following this volume group
+     */
+    AudioVolumeGroup(@NonNull String name, int id,
+                     @NonNull AudioAttributes[] audioAttributes,
+                     @NonNull int[] legacyStreamTypes) {
+        Preconditions.checkNotNull(name, "name must not be null");
+        Preconditions.checkNotNull(audioAttributes, "audioAttributes must not be null");
+        Preconditions.checkNotNull(legacyStreamTypes, "legacyStreamTypes must not be null");
+        mName = name;
+        mId = id;
+        mAudioAttributes = audioAttributes;
+        mLegacyStreamTypes = legacyStreamTypes;
+    }
+
+    @Override
+    public boolean equals(@NonNull Object o) {
+        if (this == o) return true;
+        if (o == null || getClass() != o.getClass()) return false;
+
+        AudioVolumeGroup thatAvg = (AudioVolumeGroup) o;
+
+        return mName == thatAvg.mName && mId == thatAvg.mId
+                && mAudioAttributes.equals(thatAvg.mAudioAttributes);
+    }
+
+    /**
+     * @return List of {@link AudioAttributes} involved in this {@link AudioVolumeGroup}.
+     */
+    public @NonNull List<AudioAttributes> getAudioAttributes() {
+        return Arrays.asList(mAudioAttributes);
+    }
+
+    /**
+     * @return the stream types involved in this {@link AudioVolumeGroup}.
+     */
+    public @NonNull int[] getLegacyStreamTypes() {
+        return mLegacyStreamTypes;
+    }
+
+    /**
+     * @return human-readable name of this volume group.
+     */
+    public @NonNull String name() {
+        return mName;
+    }
+
+    /**
+     * @return the volume group unique identifier id.
+     */
+    public int getId() {
+        return mId;
+    }
+
+    @Override
+    public int describeContents() {
+        return 0;
+    }
+
+    @Override
+    public void writeToParcel(@NonNull Parcel dest, int flags) {
+        dest.writeString(mName);
+        dest.writeInt(mId);
+        dest.writeInt(mAudioAttributes.length);
+        for (AudioAttributes attributes : mAudioAttributes) {
+            attributes.writeToParcel(dest, flags | AudioAttributes.FLATTEN_TAGS/*flags*/);
+        }
+        dest.writeInt(mLegacyStreamTypes.length);
+        for (int streamType : mLegacyStreamTypes) {
+            dest.writeInt(streamType);
+        }
+    }
+
+    public static final Parcelable.Creator<AudioVolumeGroup> CREATOR =
+            new Parcelable.Creator<AudioVolumeGroup>() {
+                @Override
+                public @NonNull AudioVolumeGroup createFromParcel(@NonNull Parcel in) {
+                    Preconditions.checkNotNull(in, "in Parcel must not be null");
+                    String name = in.readString();
+                    int id = in.readInt();
+                    int nbAttributes = in.readInt();
+                    AudioAttributes[] audioAttributes = new AudioAttributes[nbAttributes];
+                    for (int index = 0; index < nbAttributes; index++) {
+                        audioAttributes[index] = AudioAttributes.CREATOR.createFromParcel(in);
+                    }
+                    int nbStreamTypes = in.readInt();
+                    int[] streamTypes = new int[nbStreamTypes];
+                    for (int index = 0; index < nbStreamTypes; index++) {
+                        streamTypes[index] = in.readInt();
+                    }
+                    return new AudioVolumeGroup(name, id, audioAttributes, streamTypes);
+                }
+
+                @Override
+                public @NonNull AudioVolumeGroup[] newArray(int size) {
+                    return new AudioVolumeGroup[size];
+                }
+            };
+
+    @Override
+    public @NonNull String toString() {
+        StringBuilder s = new StringBuilder();
+        s.append("\n Name: ");
+        s.append(mName);
+        s.append(" Id: ");
+        s.append(Integer.toString(mId));
+
+        s.append("\n     Supported Audio Attributes:");
+        for (AudioAttributes attribute : mAudioAttributes) {
+            s.append("\n       -");
+            s.append(attribute.toString());
+        }
+        s.append("\n     Supported Legacy Stream Types: { ");
+        for (int legacyStreamType : mLegacyStreamTypes) {
+            s.append(Integer.toString(legacyStreamType));
+            s.append(" ");
+        }
+        s.append("}");
+        return s.toString();
+    }
+}
diff --git a/media/java/android/media/audiopolicy/AudioVolumeGroupChangeHandler.java b/media/java/android/media/audiopolicy/AudioVolumeGroupChangeHandler.java
new file mode 100644
index 0000000..074188e
--- /dev/null
+++ b/media/java/android/media/audiopolicy/AudioVolumeGroupChangeHandler.java
@@ -0,0 +1,167 @@
+/*
+ * Copyright (C) 2018 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.media.audiopolicy;
+
+import android.annotation.NonNull;
+import android.media.AudioManager;
+import android.os.Handler;
+import android.os.HandlerThread;
+import android.os.Message;
+
+import com.android.internal.util.Preconditions;
+
+import java.lang.ref.WeakReference;
+import java.util.ArrayList;
+
+/**
+ * The AudioVolumeGroupChangeHandler handles AudioManager.OnAudioVolumeGroupChangedListener
+ * callbacks posted from JNI
+ *
+ * TODO: Make use of Executor of callbacks.
+ * @hide
+ */
+public class AudioVolumeGroupChangeHandler {
+    private Handler mHandler;
+    private HandlerThread mHandlerThread;
+    private final ArrayList<AudioManager.VolumeGroupCallback> mListeners =
+            new ArrayList<AudioManager.VolumeGroupCallback>();
+
+    private static final String TAG = "AudioVolumeGroupChangeHandler";
+
+    private static final int AUDIOVOLUMEGROUP_EVENT_VOLUME_CHANGED = 1000;
+    private static final int AUDIOVOLUMEGROUP_EVENT_NEW_LISTENER = 4;
+
+    /**
+     * Accessed by native methods: JNI Callback context.
+     */
+    @SuppressWarnings("unused")
+    private long mJniCallback;
+
+    /**
+     * Initialization
+     */
+    public void init() {
+        synchronized (this) {
+            if (mHandler != null) {
+                return;
+            }
+            // create a new thread for our new event handler
+            mHandlerThread = new HandlerThread(TAG);
+            mHandlerThread.start();
+
+            if (mHandlerThread.getLooper() == null) {
+                mHandler = null;
+                return;
+            }
+            mHandler = new Handler(mHandlerThread.getLooper()) {
+                @Override
+                public void handleMessage(Message msg) {
+                    ArrayList<AudioManager.VolumeGroupCallback> listeners;
+                    synchronized (this) {
+                        if (msg.what == AUDIOVOLUMEGROUP_EVENT_NEW_LISTENER) {
+                            listeners =
+                                    new ArrayList<AudioManager.VolumeGroupCallback>();
+                            if (mListeners.contains(msg.obj)) {
+                                listeners.add(
+                                        (AudioManager.VolumeGroupCallback) msg.obj);
+                            }
+                        } else {
+                            listeners = mListeners;
+                        }
+                    }
+                    if (listeners.isEmpty()) {
+                        return;
+                    }
+
+                    switch (msg.what) {
+                        case AUDIOVOLUMEGROUP_EVENT_VOLUME_CHANGED:
+                            for (int i = 0; i < listeners.size(); i++) {
+                                listeners.get(i).onAudioVolumeGroupChanged((int) msg.arg1,
+                                                                           (int) msg.arg2);
+                            }
+                            break;
+
+                        default:
+                            break;
+                    }
+                }
+            };
+            native_setup(new WeakReference<AudioVolumeGroupChangeHandler>(this));
+        }
+    }
+
+    private native void native_setup(Object moduleThis);
+
+    @Override
+    protected void finalize() {
+        native_finalize();
+        if (mHandlerThread.isAlive()) {
+            mHandlerThread.quit();
+        }
+    }
+    private native void native_finalize();
+
+   /**
+    * @param cb the {@link AudioManager.VolumeGroupCallback} to register
+    */
+    public void registerListener(@NonNull AudioManager.VolumeGroupCallback cb) {
+        Preconditions.checkNotNull(cb, "volume group callback shall not be null");
+        synchronized (this) {
+            mListeners.add(cb);
+        }
+        if (mHandler != null) {
+            Message m = mHandler.obtainMessage(
+                    AUDIOVOLUMEGROUP_EVENT_NEW_LISTENER, 0, 0, cb);
+            mHandler.sendMessage(m);
+        }
+    }
+
+   /**
+    * @param cb the {@link AudioManager.VolumeGroupCallback} to unregister
+    */
+    public void unregisterListener(@NonNull AudioManager.VolumeGroupCallback cb) {
+        Preconditions.checkNotNull(cb, "volume group callback shall not be null");
+        synchronized (this) {
+            mListeners.remove(cb);
+        }
+    }
+
+    Handler handler() {
+        return mHandler;
+    }
+
+    @SuppressWarnings("unused")
+    private static void postEventFromNative(Object moduleRef,
+                                            int what, int arg1, int arg2, Object obj) {
+        AudioVolumeGroupChangeHandler eventHandler =
+                (AudioVolumeGroupChangeHandler) ((WeakReference) moduleRef).get();
+        if (eventHandler == null) {
+            return;
+        }
+
+        if (eventHandler != null) {
+            Handler handler = eventHandler.handler();
+            if (handler != null) {
+                Message m = handler.obtainMessage(what, arg1, arg2, obj);
+                if (what != AUDIOVOLUMEGROUP_EVENT_NEW_LISTENER) {
+                    handler.removeMessages(what);
+                }
+                handler.sendMessage(m);
+            }
+        }
+    }
+}
diff --git a/media/java/android/media/audiopolicy/AudioVolumeGroups.aidl b/media/java/android/media/audiopolicy/AudioVolumeGroups.aidl
new file mode 100644
index 0000000..918cac3
--- /dev/null
+++ b/media/java/android/media/audiopolicy/AudioVolumeGroups.aidl
@@ -0,0 +1,18 @@
+/* Copyright 2018, 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.media.audiopolicy;
+
+parcelable AudioVolumeGroups;
diff --git a/media/java/android/media/audiopolicy/AudioVolumeGroups.java b/media/java/android/media/audiopolicy/AudioVolumeGroups.java
new file mode 100644
index 0000000..2e56f84
--- /dev/null
+++ b/media/java/android/media/audiopolicy/AudioVolumeGroups.java
@@ -0,0 +1,135 @@
+/*
+ * Copyright (C) 2018 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.media.audiopolicy;
+
+import android.annotation.NonNull;
+import android.annotation.Nullable;
+import android.annotation.SystemApi;
+import android.media.AudioSystem;
+import android.os.Parcel;
+import android.os.Parcelable;
+import android.util.Log;
+
+import com.android.internal.util.Preconditions;
+
+import java.util.ArrayList;
+import java.util.Iterator;
+
+/**
+ * @hide
+ * A class to encapsulate a collection of {@link AudioVolumeGroup}.
+ */
+@SystemApi
+public final class AudioVolumeGroups implements Iterable<AudioVolumeGroup>, Parcelable {
+
+    private final ArrayList<AudioVolumeGroup> mAudioVolumeGroupList;
+
+    private static final String TAG = "AudioVolumeGroups";
+
+    /**
+     * Volume group value to use when introspection API fails.
+     */
+    public static final int DEFAULT_VOLUME_GROUP = -1;
+
+    public AudioVolumeGroups() {
+        ArrayList<AudioVolumeGroup> avgList = new ArrayList<AudioVolumeGroup>();
+        int status = native_list_audio_volume_groups(avgList);
+        if (status != AudioSystem.SUCCESS) {
+            Log.w(TAG, ": listAudioVolumeGroups failed");
+        }
+        mAudioVolumeGroupList = avgList;
+    }
+
+    private AudioVolumeGroups(@NonNull ArrayList<AudioVolumeGroup> audioVolumeGroupList) {
+        Preconditions.checkNotNull(audioVolumeGroupList, "audioVolumeGroupList must not be null");
+        mAudioVolumeGroupList = audioVolumeGroupList;
+    }
+
+    /**
+     * @return number of {@link AudioProductStrategy} objects
+     */
+    public int size() {
+        return mAudioVolumeGroupList.size();
+    }
+
+    /**
+     * Returns an {@link Iterator}
+     */
+    @Override
+    public @NonNull Iterator<AudioVolumeGroup> iterator() {
+        return mAudioVolumeGroupList.iterator();
+    }
+
+    @Override
+    public boolean equals(@NonNull Object o) {
+        if (this == o) return true;
+        if (o == null || getClass() != o.getClass()) return false;
+
+        AudioVolumeGroups that = (AudioVolumeGroups) o;
+
+        return mAudioVolumeGroupList.equals(that.mAudioVolumeGroupList);
+    }
+
+    /**
+     * @return the matching {@link AudioVolumeGroup} objects with the given id,
+     *         null object if not found.
+     */
+    public @Nullable AudioVolumeGroup getById(int volumeGroupId) {
+        for (final AudioVolumeGroup avg : this) {
+            if (avg.getId() == volumeGroupId) {
+                return avg;
+            }
+        }
+        Log.e(TAG, ": invalid volume group id: " + volumeGroupId + " requested");
+        return null;
+    }
+
+    @Override
+    public int describeContents() {
+        return 0;
+    }
+
+    @Override
+    public void writeToParcel(@NonNull Parcel dest, int flags) {
+        dest.writeInt(size());
+        for (final AudioVolumeGroup volumeGroup : this) {
+            volumeGroup.writeToParcel(dest, flags);
+        }
+    }
+
+    private static native int native_list_audio_volume_groups(
+            ArrayList<AudioVolumeGroup> groups);
+
+    public static final Parcelable.Creator<AudioVolumeGroups> CREATOR =
+            new Parcelable.Creator<AudioVolumeGroups>() {
+                @Override
+                public @NonNull AudioVolumeGroups createFromParcel(@NonNull Parcel in) {
+                    Preconditions.checkNotNull(in, "in Parcel must not be null");
+                    ArrayList<AudioVolumeGroup> avgList = new ArrayList<AudioVolumeGroup>();
+                    int size = in.readInt();
+                    for (int index = 0; index < size; index++) {
+                        avgList.add(AudioVolumeGroup.CREATOR.createFromParcel(in));
+                    }
+                    return new AudioVolumeGroups(avgList);
+                }
+
+                @Override
+                public @NonNull AudioVolumeGroups[] newArray(int size) {
+                    return new AudioVolumeGroups[size];
+                }
+            };
+}
diff --git a/media/java/android/media/browse/MediaBrowser.java b/media/java/android/media/browse/MediaBrowser.java
index 2dffef9..65255a1 100644
--- a/media/java/android/media/browse/MediaBrowser.java
+++ b/media/java/android/media/browse/MediaBrowser.java
@@ -808,7 +808,7 @@
             return sb.toString();
         }
 
-        public static final Parcelable.Creator<MediaItem> CREATOR =
+        public static final @android.annotation.NonNull Parcelable.Creator<MediaItem> CREATOR =
                 new Parcelable.Creator<MediaItem>() {
                     @Override
                     public MediaItem createFromParcel(Parcel in) {
diff --git a/media/java/android/media/midi/MidiDeviceInfo.java b/media/java/android/media/midi/MidiDeviceInfo.java
index ab8af2a..c222985 100644
--- a/media/java/android/media/midi/MidiDeviceInfo.java
+++ b/media/java/android/media/midi/MidiDeviceInfo.java
@@ -325,7 +325,7 @@
                 ",mIsPrivate=" + mIsPrivate);
     }
 
-    public static final Parcelable.Creator<MidiDeviceInfo> CREATOR =
+    public static final @android.annotation.NonNull Parcelable.Creator<MidiDeviceInfo> CREATOR =
         new Parcelable.Creator<MidiDeviceInfo>() {
         public MidiDeviceInfo createFromParcel(Parcel in) {
             // Needs to be kept in sync with code in MidiDeviceInfo.cpp
diff --git a/media/java/android/media/midi/MidiDeviceStatus.java b/media/java/android/media/midi/MidiDeviceStatus.java
index acb54de..b118279 100644
--- a/media/java/android/media/midi/MidiDeviceStatus.java
+++ b/media/java/android/media/midi/MidiDeviceStatus.java
@@ -111,7 +111,7 @@
         return builder.toString();
     }
 
-    public static final Parcelable.Creator<MidiDeviceStatus> CREATOR =
+    public static final @android.annotation.NonNull Parcelable.Creator<MidiDeviceStatus> CREATOR =
         new Parcelable.Creator<MidiDeviceStatus>() {
         public MidiDeviceStatus createFromParcel(Parcel in) {
             ClassLoader classLoader = MidiDeviceInfo.class.getClassLoader();
diff --git a/media/java/android/media/projection/IMediaProjectionManager.aidl b/media/java/android/media/projection/IMediaProjectionManager.aidl
index 7e10c51..d190fce 100644
--- a/media/java/android/media/projection/IMediaProjectionManager.aidl
+++ b/media/java/android/media/projection/IMediaProjectionManager.aidl
@@ -24,6 +24,7 @@
 
 /** {@hide} */
 interface IMediaProjectionManager {
+    @UnsupportedAppUsage
     boolean hasProjectionPermission(int uid, String packageName);
     IMediaProjection createProjection(int uid, String packageName, int type,
             boolean permanentGrant);
diff --git a/media/java/android/media/projection/MediaProjection.java b/media/java/android/media/projection/MediaProjection.java
index f9c5b8d..632cfb0 100644
--- a/media/java/android/media/projection/MediaProjection.java
+++ b/media/java/android/media/projection/MediaProjection.java
@@ -21,7 +21,6 @@
 import android.content.Context;
 import android.hardware.display.DisplayManager;
 import android.hardware.display.VirtualDisplay;
-import android.media.AudioRecord;
 import android.media.projection.IMediaProjection;
 import android.media.projection.IMediaProjectionCallback;
 import android.os.Handler;
@@ -140,16 +139,6 @@
     }
 
     /**
-     * Creates an AudioRecord to capture audio played back by the system.
-     * @hide
-     */
-    public AudioRecord createAudioRecord(
-            int sampleRateInHz, int channelConfig,
-            int audioFormat, int bufferSizeInBytes) {
-        return null;
-    }
-
-    /**
      * Stops projection.
      */
     public void stop() {
diff --git a/media/java/android/media/projection/MediaProjectionInfo.java b/media/java/android/media/projection/MediaProjectionInfo.java
index 5a65e65..ff60856 100644
--- a/media/java/android/media/projection/MediaProjectionInfo.java
+++ b/media/java/android/media/projection/MediaProjectionInfo.java
@@ -78,7 +78,7 @@
         UserHandle.writeToParcel(mUserHandle, out);
     }
 
-    public static final Parcelable.Creator<MediaProjectionInfo> CREATOR =
+    public static final @android.annotation.NonNull Parcelable.Creator<MediaProjectionInfo> CREATOR =
             new Parcelable.Creator<MediaProjectionInfo>() {
         @Override
         public MediaProjectionInfo createFromParcel(Parcel in) {
diff --git a/media/java/android/media/session/ControllerCallbackLink.java b/media/java/android/media/session/ControllerCallbackLink.java
index 428be0d..67d849a 100644
--- a/media/java/android/media/session/ControllerCallbackLink.java
+++ b/media/java/android/media/session/ControllerCallbackLink.java
@@ -191,7 +191,7 @@
         dest.writeStrongBinder(mIControllerCallback.asBinder());
     }
 
-    public static final Parcelable.Creator<ControllerCallbackLink> CREATOR =
+    public static final @android.annotation.NonNull Parcelable.Creator<ControllerCallbackLink> CREATOR =
             new Parcelable.Creator<ControllerCallbackLink>() {
         @Override
         public ControllerCallbackLink createFromParcel(Parcel in) {
diff --git a/media/java/android/media/session/ControllerLink.java b/media/java/android/media/session/ControllerLink.java
index 5828fbd..d4ea2a3 100644
--- a/media/java/android/media/session/ControllerLink.java
+++ b/media/java/android/media/session/ControllerLink.java
@@ -40,7 +40,7 @@
  * @hide
  */
 public final class ControllerLink implements Parcelable {
-    public static final Parcelable.Creator<ControllerLink> CREATOR =
+    public static final @android.annotation.NonNull Parcelable.Creator<ControllerLink> CREATOR =
             new Parcelable.Creator<ControllerLink>() {
                 @Override
                 public ControllerLink createFromParcel(Parcel in) {
diff --git a/media/java/android/media/session/MediaController.java b/media/java/android/media/session/MediaController.java
index fb21f69..5ee52ce 100644
--- a/media/java/android/media/session/MediaController.java
+++ b/media/java/android/media/session/MediaController.java
@@ -1050,7 +1050,7 @@
             dest.writeParcelable(mAudioAttrs, flags);
         }
 
-        public static final Parcelable.Creator<PlaybackInfo> CREATOR =
+        public static final @android.annotation.NonNull Parcelable.Creator<PlaybackInfo> CREATOR =
                 new Parcelable.Creator<PlaybackInfo>() {
             @Override
             public PlaybackInfo createFromParcel(Parcel in) {
diff --git a/media/java/android/media/session/MediaSession.java b/media/java/android/media/session/MediaSession.java
index 9fdefa6..e0cb86e 100644
--- a/media/java/android/media/session/MediaSession.java
+++ b/media/java/android/media/session/MediaSession.java
@@ -511,7 +511,7 @@
             return mControllerLink;
         }
 
-        public static final Parcelable.Creator<Token> CREATOR =
+        public static final @android.annotation.NonNull Parcelable.Creator<Token> CREATOR =
                 new Parcelable.Creator<Token>() {
             @Override
             public Token createFromParcel(Parcel in) {
@@ -789,7 +789,7 @@
             return 0;
         }
 
-        public static final Creator<MediaSession.QueueItem> CREATOR =
+        public static final @android.annotation.NonNull Creator<MediaSession.QueueItem> CREATOR =
                 new Creator<MediaSession.QueueItem>() {
 
             @Override
diff --git a/media/java/android/media/session/PlaybackState.java b/media/java/android/media/session/PlaybackState.java
index 6b28c97..8dd6127 100644
--- a/media/java/android/media/session/PlaybackState.java
+++ b/media/java/android/media/session/PlaybackState.java
@@ -480,7 +480,7 @@
         return mExtras;
     }
 
-    public static final Parcelable.Creator<PlaybackState> CREATOR =
+    public static final @android.annotation.NonNull Parcelable.Creator<PlaybackState> CREATOR =
             new Parcelable.Creator<PlaybackState>() {
         @Override
         public PlaybackState createFromParcel(Parcel in) {
@@ -534,7 +534,7 @@
             return 0;
         }
 
-        public static final Parcelable.Creator<PlaybackState.CustomAction> CREATOR =
+        public static final @android.annotation.NonNull Parcelable.Creator<PlaybackState.CustomAction> CREATOR =
                 new Parcelable.Creator<PlaybackState.CustomAction>() {
 
                     @Override
diff --git a/media/java/android/media/session/SessionCallbackLink.java b/media/java/android/media/session/SessionCallbackLink.java
index f9fa45a..6ffdc2b 100644
--- a/media/java/android/media/session/SessionCallbackLink.java
+++ b/media/java/android/media/session/SessionCallbackLink.java
@@ -554,7 +554,7 @@
         dest.writeStrongBinder(mISessionCallback.asBinder());
     }
 
-    public static final Parcelable.Creator<SessionCallbackLink> CREATOR =
+    public static final @android.annotation.NonNull Parcelable.Creator<SessionCallbackLink> CREATOR =
             new Parcelable.Creator<SessionCallbackLink>() {
                 @Override
                 public SessionCallbackLink createFromParcel(Parcel in) {
diff --git a/media/java/android/media/session/SessionLink.java b/media/java/android/media/session/SessionLink.java
index 2331a4a..2b42a2d 100644
--- a/media/java/android/media/session/SessionLink.java
+++ b/media/java/android/media/session/SessionLink.java
@@ -36,7 +36,7 @@
  * @hide
  */
 public final class SessionLink implements Parcelable {
-    public static final Parcelable.Creator<SessionLink> CREATOR =
+    public static final @android.annotation.NonNull Parcelable.Creator<SessionLink> CREATOR =
             new Parcelable.Creator<SessionLink>() {
                 @Override
                 public SessionLink createFromParcel(Parcel in) {
diff --git a/media/java/android/media/tv/DvbDeviceInfo.java b/media/java/android/media/tv/DvbDeviceInfo.java
index e07f3a6..a574fe1 100644
--- a/media/java/android/media/tv/DvbDeviceInfo.java
+++ b/media/java/android/media/tv/DvbDeviceInfo.java
@@ -29,7 +29,7 @@
 public final class DvbDeviceInfo implements Parcelable {
     static final String TAG = "DvbDeviceInfo";
 
-    public static final Parcelable.Creator<DvbDeviceInfo> CREATOR =
+    public static final @android.annotation.NonNull Parcelable.Creator<DvbDeviceInfo> CREATOR =
             new Parcelable.Creator<DvbDeviceInfo>() {
                 @Override
                 public DvbDeviceInfo createFromParcel(Parcel source) {
diff --git a/media/java/android/media/tv/ITvRemoteServiceInput.aidl b/media/java/android/media/tv/ITvRemoteServiceInput.aidl
index df39299..a0b6c9b 100644
--- a/media/java/android/media/tv/ITvRemoteServiceInput.aidl
+++ b/media/java/android/media/tv/ITvRemoteServiceInput.aidl
@@ -21,13 +21,22 @@
  */
 oneway interface ITvRemoteServiceInput {
     // InputBridge related
+    @UnsupportedAppUsage
     void openInputBridge(IBinder token, String name, int width, int height, int maxPointers);
+    @UnsupportedAppUsage
     void closeInputBridge(IBinder token);
+    @UnsupportedAppUsage
     void clearInputBridge(IBinder token);
+    @UnsupportedAppUsage
     void sendTimestamp(IBinder token, long timestamp);
+    @UnsupportedAppUsage
     void sendKeyDown(IBinder token, int keyCode);
+    @UnsupportedAppUsage
     void sendKeyUp(IBinder token, int keyCode);
+    @UnsupportedAppUsage
     void sendPointerDown(IBinder token, int pointerId, int x, int y);
+    @UnsupportedAppUsage
     void sendPointerUp(IBinder token, int pointerId);
+    @UnsupportedAppUsage
     void sendPointerSync(IBinder token);
 }
\ No newline at end of file
diff --git a/media/java/android/media/tv/TvContentRatingSystemInfo.java b/media/java/android/media/tv/TvContentRatingSystemInfo.java
index f2e5b08..f44ded3 100644
--- a/media/java/android/media/tv/TvContentRatingSystemInfo.java
+++ b/media/java/android/media/tv/TvContentRatingSystemInfo.java
@@ -80,7 +80,7 @@
      * Used to make this class parcelable.
      * @hide
      */
-    public static final Parcelable.Creator<TvContentRatingSystemInfo> CREATOR =
+    public static final @android.annotation.NonNull Parcelable.Creator<TvContentRatingSystemInfo> CREATOR =
             new Parcelable.Creator<TvContentRatingSystemInfo>() {
         @Override
         public TvContentRatingSystemInfo createFromParcel(Parcel in) {
diff --git a/media/java/android/media/tv/TvInputHardwareInfo.java b/media/java/android/media/tv/TvInputHardwareInfo.java
index 762f0c0..5b316be 100644
--- a/media/java/android/media/tv/TvInputHardwareInfo.java
+++ b/media/java/android/media/tv/TvInputHardwareInfo.java
@@ -74,7 +74,7 @@
     public static final int CABLE_CONNECTION_STATUS_DISCONNECTED =
             Constants.CABLE_CONNECTION_STATUS_DISCONNECTED;
 
-    public static final Parcelable.Creator<TvInputHardwareInfo> CREATOR =
+    public static final @android.annotation.NonNull Parcelable.Creator<TvInputHardwareInfo> CREATOR =
             new Parcelable.Creator<TvInputHardwareInfo>() {
         @Override
         public TvInputHardwareInfo createFromParcel(Parcel source) {
diff --git a/media/java/android/media/tv/TvInputInfo.java b/media/java/android/media/tv/TvInputInfo.java
index 30907a5..1b9cac0 100644
--- a/media/java/android/media/tv/TvInputInfo.java
+++ b/media/java/android/media/tv/TvInputInfo.java
@@ -621,7 +621,7 @@
         return mService.serviceInfo.loadIcon(context.getPackageManager());
     }
 
-    public static final Parcelable.Creator<TvInputInfo> CREATOR =
+    public static final @android.annotation.NonNull Parcelable.Creator<TvInputInfo> CREATOR =
             new Parcelable.Creator<TvInputInfo>() {
         @Override
         public TvInputInfo createFromParcel(Parcel in) {
diff --git a/media/java/android/media/tv/TvStreamConfig.java b/media/java/android/media/tv/TvStreamConfig.java
index 0c2f3fe..f012b46 100644
--- a/media/java/android/media/tv/TvStreamConfig.java
+++ b/media/java/android/media/tv/TvStreamConfig.java
@@ -42,7 +42,7 @@
      */
     private int mGeneration;
 
-    public static final Parcelable.Creator<TvStreamConfig> CREATOR =
+    public static final @android.annotation.NonNull Parcelable.Creator<TvStreamConfig> CREATOR =
             new Parcelable.Creator<TvStreamConfig>() {
         @Override
         public TvStreamConfig createFromParcel(Parcel source) {
diff --git a/media/java/android/media/tv/TvTrackInfo.java b/media/java/android/media/tv/TvTrackInfo.java
index c9c881c..8142979 100644
--- a/media/java/android/media/tv/TvTrackInfo.java
+++ b/media/java/android/media/tv/TvTrackInfo.java
@@ -289,7 +289,7 @@
         return Objects.hashCode(mId);
     }
 
-    public static final Parcelable.Creator<TvTrackInfo> CREATOR =
+    public static final @android.annotation.NonNull Parcelable.Creator<TvTrackInfo> CREATOR =
             new Parcelable.Creator<TvTrackInfo>() {
                 @Override
                 public TvTrackInfo createFromParcel(Parcel in) {
diff --git a/media/jni/android_media_ImageWriter.cpp b/media/jni/android_media_ImageWriter.cpp
index 031e373..cfcba76 100644
--- a/media/jni/android_media_ImageWriter.cpp
+++ b/media/jni/android_media_ImageWriter.cpp
@@ -18,8 +18,11 @@
 #define LOG_TAG "ImageWriter_JNI"
 #include "android_media_Utils.h"
 
+#include <utils/Condition.h>
 #include <utils/Log.h>
+#include <utils/Mutex.h>
 #include <utils/String8.h>
+#include <utils/Thread.h>
 
 #include <gui/IProducerListener.h>
 #include <gui/Surface.h>
@@ -34,6 +37,8 @@
 #include <inttypes.h>
 #include <android/hardware_buffer_jni.h>
 
+#include <deque>
+
 #define IMAGE_BUFFER_JNI_ID           "mNativeBuffer"
 #define IMAGE_FORMAT_UNKNOWN          0 // This is the same value as ImageFormat#UNKNOWN.
 // ----------------------------------------------------------------------------
@@ -90,14 +95,124 @@
     int mFormat;
     int mWidth;
     int mHeight;
+
+    // Class for a shared thread used to detach buffers from buffer queues
+    // to discard buffers after consumers are done using them.
+    // This is needed because detaching buffers in onBufferReleased callback
+    // can lead to deadlock when consumer/producer are on the same process.
+    class BufferDetacher {
+    public:
+        // Called by JNIImageWriterContext ctor. Will start the thread for first ref.
+        void addRef();
+        // Called by JNIImageWriterContext dtor. Will stop the thread after ref goes to 0.
+        void removeRef();
+        // Called by onBufferReleased to signal this thread to detach a buffer
+        void detach(wp<Surface>);
+
+    private:
+
+        class DetachThread : public Thread {
+        public:
+            DetachThread() : Thread(/*canCallJava*/false) {};
+
+            void detach(wp<Surface>);
+
+            virtual void requestExit() override;
+
+        private:
+            virtual bool threadLoop() override;
+
+            Mutex     mLock;
+            Condition mCondition;
+            std::deque<wp<Surface>> mQueue;
+
+            static const nsecs_t kWaitDuration = 20000000; // 20 ms
+        };
+        sp<DetachThread> mThread;
+
+        Mutex     mLock;
+        int       mRefCount = 0;
+    };
+
+    static BufferDetacher sBufferDetacher;
 };
 
+JNIImageWriterContext::BufferDetacher JNIImageWriterContext::sBufferDetacher;
+
+void JNIImageWriterContext::BufferDetacher::addRef() {
+    Mutex::Autolock l(mLock);
+    mRefCount++;
+    if (mRefCount == 1) {
+        mThread = new DetachThread();
+        mThread->run("BufDtchThrd");
+    }
+}
+
+void JNIImageWriterContext::BufferDetacher::removeRef() {
+    Mutex::Autolock l(mLock);
+    mRefCount--;
+    if (mRefCount == 0) {
+        mThread->requestExit();
+        mThread->join();
+        mThread.clear();
+    }
+}
+
+void JNIImageWriterContext::BufferDetacher::detach(wp<Surface> bq) {
+    Mutex::Autolock l(mLock);
+    if (mThread == nullptr) {
+        ALOGE("%s: buffer detach thread is gone!", __FUNCTION__);
+        return;
+    }
+    mThread->detach(bq);
+}
+
+void JNIImageWriterContext::BufferDetacher::DetachThread::detach(wp<Surface> bq) {
+    Mutex::Autolock l(mLock);
+    mQueue.push_back(bq);
+    mCondition.signal();
+}
+
+void JNIImageWriterContext::BufferDetacher::DetachThread::requestExit() {
+    Thread::requestExit();
+    {
+        Mutex::Autolock l(mLock);
+        mQueue.clear();
+    }
+    mCondition.signal();
+}
+
+bool JNIImageWriterContext::BufferDetacher::DetachThread::threadLoop() {
+    Mutex::Autolock l(mLock);
+    mCondition.waitRelative(mLock, kWaitDuration);
+
+    while (!mQueue.empty()) {
+        if (exitPending()) {
+            return false;
+        }
+
+        wp<Surface> wbq = mQueue.front();
+        mQueue.pop_front();
+        sp<Surface> bq = wbq.promote();
+        if (bq != nullptr) {
+            sp<Fence> fence;
+            sp<GraphicBuffer> buffer;
+            ALOGV("%s: One buffer is detached", __FUNCTION__);
+            mLock.unlock();
+            bq->detachNextBuffer(&buffer, &fence);
+            mLock.lock();
+        }
+    }
+    return !exitPending();
+}
+
 JNIImageWriterContext::JNIImageWriterContext(JNIEnv* env, jobject weakThiz, jclass clazz) :
-    mWeakThiz(env->NewGlobalRef(weakThiz)),
-    mClazz((jclass)env->NewGlobalRef(clazz)),
-    mFormat(0),
-    mWidth(-1),
-    mHeight(-1) {
+        mWeakThiz(env->NewGlobalRef(weakThiz)),
+        mClazz((jclass)env->NewGlobalRef(clazz)),
+        mFormat(0),
+        mWidth(-1),
+        mHeight(-1) {
+    sBufferDetacher.addRef();
 }
 
 JNIImageWriterContext::~JNIImageWriterContext() {
@@ -115,6 +230,7 @@
     }
 
     mProducer.clear();
+    sBufferDetacher.removeRef();
 }
 
 JNIEnv* JNIImageWriterContext::getJNIEnv(bool* needsDetach) {
@@ -153,10 +269,7 @@
         // need let this callback give a BufferItem, then only detach if it was attached to this
         // Writer. Do the detach unconditionally for opaque format now. see b/19977520
         if (mFormat == HAL_PIXEL_FORMAT_IMPLEMENTATION_DEFINED) {
-            sp<Fence> fence;
-            sp<GraphicBuffer> buffer;
-            ALOGV("%s: One buffer is detached", __FUNCTION__);
-            mProducer->detachNextBuffer(&buffer, &fence);
+            sBufferDetacher.detach(mProducer);
         }
 
         env->CallStaticVoidMethod(mClazz, gImageWriterClassInfo.postEventFromNative, mWeakThiz);
diff --git a/media/jni/android_media_MediaRecorder.cpp b/media/jni/android_media_MediaRecorder.cpp
index a7c0159..3ec0903 100644
--- a/media/jni/android_media_MediaRecorder.cpp
+++ b/media/jni/android_media_MediaRecorder.cpp
@@ -760,6 +760,44 @@
     return jStatus;
 }
 
+static jint android_media_MediaRecord_setMicrophoneDirection(
+        JNIEnv *env, jobject thiz, jint direction) {
+    ALOGV("setMicrophoneDirection(%d)", direction);
+    sp<MediaRecorder> mr = getMediaRecorder(env, thiz);
+    if (mr == NULL) {
+        jniThrowException(env, "java/lang/IllegalStateException", NULL);
+        return (jint)AUDIO_JAVA_NO_INIT;
+    }
+
+    jint jStatus = AUDIO_JAVA_SUCCESS;
+    status_t status =
+        mr->setMicrophoneDirection(static_cast<audio_microphone_direction_t>(direction));
+    if (status != NO_ERROR) {
+        jStatus = nativeToJavaStatus(status);
+    }
+
+    return jStatus;
+}
+
+static jint  android_media_MediaRecord_setMicrophoneFieldDimension(
+        JNIEnv *env, jobject thiz, jfloat zoom) {
+    ALOGV("setMicrophoneFieldDimension(%f)", zoom);
+    sp<MediaRecorder> mr = getMediaRecorder(env, thiz);
+    if (mr == NULL) {
+        jniThrowException(env, "java/lang/IllegalStateException", NULL);
+        return (jint)AUDIO_JAVA_NO_INIT;
+    }
+
+    jint jStatus = AUDIO_JAVA_SUCCESS;
+    status_t status = mr->setMicrophoneFieldDimension(zoom);
+    if (status != NO_ERROR) {
+        jStatus = nativeToJavaStatus(status);
+    }
+
+    return jStatus;
+
+}
+
 static jint android_media_MediaRecord_getPortId(JNIEnv *env,  jobject thiz) {
     sp<MediaRecorder> mr = getMediaRecorder(env, thiz);
     if (mr == NULL) {
@@ -812,6 +850,8 @@
 
     {"native_getActiveMicrophones", "(Ljava/util/ArrayList;)I", (void *)android_media_MediaRecord_getActiveMicrophones},
     {"native_getPortId", "()I", (void *)android_media_MediaRecord_getPortId},
+    {"native_setMicrophoneDirection", "(I)I", (void *)android_media_MediaRecord_setMicrophoneDirection},
+    {"native_setMicrophoneFieldDimension", "(F)I", (void *)android_media_MediaRecord_setMicrophoneFieldDimension},
 };
 
 // This function only registers the native methods, and is called from
diff --git a/media/tests/MediaFrameworkTest/Android.mk b/media/tests/MediaFrameworkTest/Android.mk
index fb473f0..167d255 100644
--- a/media/tests/MediaFrameworkTest/Android.mk
+++ b/media/tests/MediaFrameworkTest/Android.mk
@@ -9,7 +9,7 @@
 
 LOCAL_STATIC_JAVA_LIBRARIES := \
     mockito-target-minus-junit4 \
-    android-support-test \
+    androidx.test.rules \
     android-ex-camera2
 
 LOCAL_PACKAGE_NAME := mediaframeworktest
diff --git a/media/tests/MediaFrameworkTest/AndroidManifest.xml b/media/tests/MediaFrameworkTest/AndroidManifest.xml
index e50a375..fb2d630 100644
--- a/media/tests/MediaFrameworkTest/AndroidManifest.xml
+++ b/media/tests/MediaFrameworkTest/AndroidManifest.xml
@@ -86,7 +86,7 @@
             android:label="MediaFramework integration tests InstrumentationRunner">
     </instrumentation>
 
-    <instrumentation android:name="android.support.test.runner.AndroidJUnitRunner"
+    <instrumentation android:name="androidx.test.runner.AndroidJUnitRunner"
             android:targetPackage="com.android.mediaframeworktest"
             android:label="media framework tests">
     </instrumentation>
diff --git a/media/tests/MediaFrameworkTest/AndroidTest.xml b/media/tests/MediaFrameworkTest/AndroidTest.xml
index 204959f..132028c 100644
--- a/media/tests/MediaFrameworkTest/AndroidTest.xml
+++ b/media/tests/MediaFrameworkTest/AndroidTest.xml
@@ -21,7 +21,7 @@
     <option name="test-tag" value="MediaFrameworkTest" />
     <test class="com.android.tradefed.testtype.AndroidJUnitTest" >
         <option name="package" value="com.android.mediaframeworktest" />
-        <option name="runner" value="android.support.test.runner.AndroidJUnitRunner" />
+        <option name="runner" value="androidx.test.runner.AndroidJUnitRunner" />
         <option name="hidden-api-checks" value="false"/>
     </test>
 </configuration>
diff --git a/media/tests/MediaFrameworkTest/src/com/android/mediaframeworktest/integration/CameraBinderTest.java b/media/tests/MediaFrameworkTest/src/com/android/mediaframeworktest/integration/CameraBinderTest.java
index d8c975f..87a59df 100644
--- a/media/tests/MediaFrameworkTest/src/com/android/mediaframeworktest/integration/CameraBinderTest.java
+++ b/media/tests/MediaFrameworkTest/src/com/android/mediaframeworktest/integration/CameraBinderTest.java
@@ -309,6 +309,10 @@
             Log.v(TAG, String.format("Camera %s has torch status changed to 0x%x",
                     cameraId, status));
         }
+        @Override
+        public void onCameraAccessPrioritiesChanged() {
+            Log.v(TAG, "Camera access permission change");
+        }
     }
 
     /**
diff --git a/media/tests/MediaFrameworkTest/src/com/android/mediaframeworktest/unit/MediaFileTest.java b/media/tests/MediaFrameworkTest/src/com/android/mediaframeworktest/unit/MediaFileTest.java
index feac63d..701454c 100644
--- a/media/tests/MediaFrameworkTest/src/com/android/mediaframeworktest/unit/MediaFileTest.java
+++ b/media/tests/MediaFrameworkTest/src/com/android/mediaframeworktest/unit/MediaFileTest.java
@@ -28,7 +28,8 @@
 import static org.junit.Assert.assertTrue;
 
 import android.mtp.MtpConstants;
-import android.support.test.runner.AndroidJUnit4;
+
+import androidx.test.runner.AndroidJUnit4;
 
 import libcore.net.MimeUtils;
 
diff --git a/native/android/OWNERS b/native/android/OWNERS
index b3f50aa..266764a 100644
--- a/native/android/OWNERS
+++ b/native/android/OWNERS
@@ -1,4 +1,4 @@
 set noparent
 
-per-file libandroid_net.map.txt, net.c = codewiz@google.com, ek@google.com, jchalard@google.com
+per-file libandroid_net.map.txt, net.c = codewiz@google.com, jchalard@google.com, junyulai@google.com
 per-file libandroid_net.map.txt, net.c = lorenzo@google.com, reminv@google.com, satk@google.com
diff --git a/native/android/choreographer.cpp b/native/android/choreographer.cpp
index 3fecd53..63e0734 100644
--- a/native/android/choreographer.cpp
+++ b/native/android/choreographer.cpp
@@ -37,6 +37,7 @@
 
 struct FrameCallback {
     AChoreographer_frameCallback callback;
+    AChoreographer_frameCallback64 callback64;
     void* data;
     nsecs_t dueTime;
 
@@ -50,8 +51,8 @@
 
 class Choreographer : public DisplayEventDispatcher, public MessageHandler {
 public:
-    void postFrameCallback(AChoreographer_frameCallback cb, void* data);
-    void postFrameCallbackDelayed(AChoreographer_frameCallback cb, void* data, nsecs_t delay);
+    void postFrameCallbackDelayed(AChoreographer_frameCallback cb,
+                                  AChoreographer_frameCallback64 cb64, void* data, nsecs_t delay);
 
     enum {
         MSG_SCHEDULE_CALLBACKS = 0,
@@ -107,14 +108,10 @@
     DisplayEventDispatcher(looper), mLooper(looper), mThreadId(std::this_thread::get_id()) {
 }
 
-void Choreographer::postFrameCallback(AChoreographer_frameCallback cb, void* data) {
-    postFrameCallbackDelayed(cb, data, 0);
-}
-
 void Choreographer::postFrameCallbackDelayed(
-        AChoreographer_frameCallback cb, void* data, nsecs_t delay) {
+        AChoreographer_frameCallback cb, AChoreographer_frameCallback64 cb64, void* data, nsecs_t delay) {
     nsecs_t now = systemTime(SYSTEM_TIME_MONOTONIC);
-    FrameCallback callback{cb, data, now + delay};
+    FrameCallback callback{cb, cb64, data, now + delay};
     {
         AutoMutex _l{mLock};
         mCallbacks.push(callback);
@@ -156,7 +153,11 @@
         }
     }
     for (const auto& cb : callbacks) {
-        cb.callback(timestamp, cb.data);
+        if (cb.callback64 != nullptr) {
+            cb.callback64(timestamp, cb.data);
+        } else if (cb.callback != nullptr) {
+            cb.callback(timestamp, cb.data);
+        }
     }
 }
 
@@ -204,10 +205,21 @@
 
 void AChoreographer_postFrameCallback(AChoreographer* choreographer,
         AChoreographer_frameCallback callback, void* data) {
-    AChoreographer_to_Choreographer(choreographer)->postFrameCallback(callback, data);
+    AChoreographer_to_Choreographer(choreographer)->postFrameCallbackDelayed(
+            callback, nullptr, data, 0);
 }
 void AChoreographer_postFrameCallbackDelayed(AChoreographer* choreographer,
         AChoreographer_frameCallback callback, void* data, long delayMillis) {
     AChoreographer_to_Choreographer(choreographer)->postFrameCallbackDelayed(
-            callback, data, ms2ns(delayMillis));
+            callback, nullptr, data, ms2ns(delayMillis));
+}
+void AChoreographer_postFrameCallback64(AChoreographer* choreographer,
+        AChoreographer_frameCallback64 callback, void* data) {
+    AChoreographer_to_Choreographer(choreographer)->postFrameCallbackDelayed(
+            nullptr, callback, data, 0);
+}
+void AChoreographer_postFrameCallbackDelayed64(AChoreographer* choreographer,
+        AChoreographer_frameCallback64 callback, void* data, uint32_t delayMillis) {
+    AChoreographer_to_Choreographer(choreographer)->postFrameCallbackDelayed(
+            nullptr, callback, data, ms2ns(delayMillis));
 }
diff --git a/native/android/libandroid.map.txt b/native/android/libandroid.map.txt
index a3db2d6..e1dc406 100644
--- a/native/android/libandroid.map.txt
+++ b/native/android/libandroid.map.txt
@@ -21,6 +21,8 @@
     AChoreographer_getInstance; # introduced=24
     AChoreographer_postFrameCallback; # introduced=24
     AChoreographer_postFrameCallbackDelayed; # introduced=24
+    AChoreographer_postFrameCallback64; # introduced=29
+    AChoreographer_postFrameCallbackDelayed64; # introduced=29
     AConfiguration_copy;
     AConfiguration_delete;
     AConfiguration_diff;
diff --git a/packages/BackupRestoreConfirmation/res/values-de/strings.xml b/packages/BackupRestoreConfirmation/res/values-de/strings.xml
index fbfe78b..1913578 100644
--- a/packages/BackupRestoreConfirmation/res/values-de/strings.xml
+++ b/packages/BackupRestoreConfirmation/res/values-de/strings.xml
@@ -21,7 +21,7 @@
     <string name="backup_confirm_text" msgid="1878021282758896593">"Es wurde eine vollständige Sicherung sämtlicher Daten auf einen verbundenen Computer angefordert. Möchtest du dies zulassen?\n\nWenn du die Sicherung nicht selbst angefordert hast, solltest du dem Vorgang nicht zustimmen."</string>
     <string name="allow_backup_button_label" msgid="4217228747769644068">"Meine Daten sichern"</string>
     <string name="deny_backup_button_label" msgid="6009119115581097708">"Nicht sichern"</string>
-    <string name="restore_confirm_text" msgid="7499866728030461776">"Es wurde eine vollständige Wiederherstellung aller Daten von einem verbundenen Desktop-Computer angefordert. Möchtest du dies zulassen?\n\nWenn du die Wiederherstellung nicht selbst angefordert hast, solltest du dem Vorgang nicht zustimmen. Dadurch werden alle derzeit auf dem Gerät befindlichen Daten ersetzt!"</string>
+    <string name="restore_confirm_text" msgid="7499866728030461776">"Es wurde eine vollständige Wiederherstellung aller Daten von einem verbundenen Computer angefordert. Möchtest du dies zulassen?\n\nWenn du die Wiederherstellung nicht selbst angefordert hast, solltest du dem Vorgang nicht zustimmen. Dadurch werden alle derzeit auf dem Gerät befindlichen Daten ersetzt!"</string>
     <string name="allow_restore_button_label" msgid="3081286752277127827">"Meine Daten wiederherstellen"</string>
     <string name="deny_restore_button_label" msgid="1724367334453104378">"Nicht wiederherstellen"</string>
     <string name="current_password_text" msgid="8268189555578298067">"Gib dein aktuelles Sicherungspasswort unten ein:"</string>
diff --git a/packages/CaptivePortalLogin/Android.bp b/packages/CaptivePortalLogin/Android.bp
index a71977f..bc614e9 100644
--- a/packages/CaptivePortalLogin/Android.bp
+++ b/packages/CaptivePortalLogin/Android.bp
@@ -18,6 +18,7 @@
     name: "CaptivePortalLogin",
     srcs: ["src/**/*.java"],
     sdk_version: "system_current",
+    min_sdk_version: "28",
     certificate: "networkstack",
     static_libs: [
         "androidx.legacy_legacy-support-v4",
diff --git a/packages/CaptivePortalLogin/AndroidManifest.xml b/packages/CaptivePortalLogin/AndroidManifest.xml
index 0894ee5..44e0a65 100644
--- a/packages/CaptivePortalLogin/AndroidManifest.xml
+++ b/packages/CaptivePortalLogin/AndroidManifest.xml
@@ -17,8 +17,11 @@
  */
 -->
 <manifest xmlns:android="http://schemas.android.com/apk/res/android"
-    package="com.android.captiveportallogin" >
+    package="com.android.captiveportallogin"
+    android:versionCode="11"
+    android:versionName="Q-initial">
 
+    <uses-sdk android:minSdkVersion="28" android:targetSdkVersion="28" />
     <uses-permission android:name="android.permission.INTERNET" />
     <uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
     <uses-permission android:name="android.permission.ACCESS_WIFI_STATE" />
diff --git a/packages/CaptivePortalLogin/OWNERS b/packages/CaptivePortalLogin/OWNERS
index 7311eee..d3836d4 100644
--- a/packages/CaptivePortalLogin/OWNERS
+++ b/packages/CaptivePortalLogin/OWNERS
@@ -1,8 +1,8 @@
 set noparent
 
 codewiz@google.com
-ek@google.com
 jchalard@google.com
+junyulai@google.com
 lorenzo@google.com
 reminv@google.com
 satk@google.com
diff --git a/packages/CarSystemUI/res/drawable/car_ic_selection_bg.xml b/packages/CarSystemUI/res/drawable/car_ic_selection_bg.xml
index 781beaf..12993f5 100644
--- a/packages/CarSystemUI/res/drawable/car_ic_selection_bg.xml
+++ b/packages/CarSystemUI/res/drawable/car_ic_selection_bg.xml
@@ -20,7 +20,7 @@
     android:viewportHeight="70.0"
     android:viewportWidth="70.0">
     <path
-        android:fillColor="@color/car_accent"
+        android:fillColor="?android:attr/colorAccent"
         android:fillType="evenOdd"
         android:pathData="M4,0L66,0A4,4 0,0 1,70 4L70,66A4,4 0,0 1,66 70L4,70A4,4 0,0 1,0 66L0,4A4,4 0,0 1,4 0z"
         android:strokeColor="#00000000"
diff --git a/packages/CarSystemUI/src/com/android/systemui/notifications/NotificationsUI.java b/packages/CarSystemUI/src/com/android/systemui/notifications/NotificationsUI.java
index efa4387..4a2d2fb 100644
--- a/packages/CarSystemUI/src/com/android/systemui/notifications/NotificationsUI.java
+++ b/packages/CarSystemUI/src/com/android/systemui/notifications/NotificationsUI.java
@@ -130,7 +130,6 @@
                 R.layout.navigation_bar_window, null);
         mCarNotificationWindow
                 .setBackgroundColor(mContext.getColor(R.color.notification_shade_background_color));
-
         inflateNotificationContent();
 
         WindowManager.LayoutParams layoutParams = new WindowManager.LayoutParams(
@@ -246,6 +245,12 @@
         public boolean onScroll(MotionEvent e1, MotionEvent e2, float distanceX, float distanceY) {
             return distanceY > 0;
         }
+
+        @Override
+        public boolean onSingleTapUp(MotionEvent motionEvent) {
+            closeCarNotifications(DEFAULT_FLING_VELOCITY);
+            return false;
+        }
     }
 
     private class NotificationListTouchListener implements View.OnTouchListener {
@@ -324,6 +329,14 @@
         @Override
         public boolean onScroll(MotionEvent event1, MotionEvent event2, float distanceX,
                 float distanceY) {
+            boolean isDown = event1.getY() - event2.getY() < 0;
+            // CarStatusBar and NavigationBar are identical so avoid the touch if it
+            // starts from NavigationBar to open.
+            if (event1.getRawY() > mCarNotificationWindow.getHeight() && isDown
+                    && mCarNotificationWindow.getVisibility() == View.GONE) {
+                mIsTracking = false;
+                return true;
+            }
             mIsTracking = true;
             mCarNotificationWindow.setVisibility(View.VISIBLE);
 
@@ -345,14 +358,15 @@
 
             boolean isUp = velocityY < 0;
             float distanceDelta = Math.abs(event1.getY() - event2.getY());
-
             if (isUp && distanceDelta > SWIPE_UP_MIN_DISTANCE) {
                 // fling up
                 mIsTracking = false;
                 closeCarNotifications(Math.abs(velocityY));
                 return true;
 
-            } else if (!isUp && distanceDelta > SWIPE_DOWN_MIN_DISTANCE) {
+            } else if (!isUp && distanceDelta > SWIPE_DOWN_MIN_DISTANCE
+                    && (event1.getRawY() < mCarNotificationWindow.getHeight()
+                    || mCarNotificationWindow.getVisibility() == View.VISIBLE)) {
                 // fling down
                 mIsTracking = false;
                 openCarNotifications(velocityY);
diff --git a/packages/CarSystemUI/src/com/android/systemui/statusbar/car/CarStatusBar.java b/packages/CarSystemUI/src/com/android/systemui/statusbar/car/CarStatusBar.java
index 369bb9f..bd0e0b8 100644
--- a/packages/CarSystemUI/src/com/android/systemui/statusbar/car/CarStatusBar.java
+++ b/packages/CarSystemUI/src/com/android/systemui/statusbar/car/CarStatusBar.java
@@ -92,6 +92,10 @@
 
     @Override
     public void start() {
+        // get the provisioned state before calling the parent class since it's that flow that
+        // builds the nav bar
+        mDeviceProvisionedController = Dependency.get(DeviceProvisionedController.class);
+        mDeviceIsProvisioned = mDeviceProvisionedController.isDeviceProvisioned();
         super.start();
         mTaskStackListener = new TaskStackListenerImpl();
         mActivityManagerWrapper = ActivityManagerWrapper.getInstance();
@@ -105,8 +109,6 @@
         mHvacController.connectToCarService();
 
         CarSystemUIFactory factory = SystemUIFactory.getInstance();
-        mDeviceProvisionedController = Dependency.get(DeviceProvisionedController.class);
-        mDeviceIsProvisioned = mDeviceProvisionedController.isDeviceProvisioned();
         if (!mDeviceIsProvisioned) {
             mDeviceProvisionedController.addCallback(
                     new DeviceProvisionedController.DeviceProvisionedListener() {
diff --git a/packages/DynamicAndroidInstallationService/src/com/android/dynandroid/DynamicAndroidInstallationService.java b/packages/DynamicAndroidInstallationService/src/com/android/dynandroid/DynamicAndroidInstallationService.java
index 7755cbc..719417e 100644
--- a/packages/DynamicAndroidInstallationService/src/com/android/dynandroid/DynamicAndroidInstallationService.java
+++ b/packages/DynamicAndroidInstallationService/src/com/android/dynandroid/DynamicAndroidInstallationService.java
@@ -114,6 +114,7 @@
     private NotificationManager mNM;
 
     private long mSystemSize;
+    private long mUserdataSize;
     private long mInstalledSize;
     private boolean mJustCancelledByUser;
 
@@ -220,9 +221,11 @@
 
         String url = intent.getStringExtra(DynamicAndroidClient.KEY_SYSTEM_URL);
         mSystemSize = intent.getLongExtra(DynamicAndroidClient.KEY_SYSTEM_SIZE, 0);
-        long userdata = intent.getLongExtra(DynamicAndroidClient.KEY_USERDATA_SIZE, 0);
+        mUserdataSize = intent.getLongExtra(DynamicAndroidClient.KEY_USERDATA_SIZE, 0);
 
-        mInstallTask = new InstallationAsyncTask(url, mSystemSize, userdata, mDynAndroid, this);
+        mInstallTask = new InstallationAsyncTask(
+                url, mSystemSize, mUserdataSize, mDynAndroid, this);
+
         mInstallTask.execute();
 
         // start fore ground
@@ -332,8 +335,8 @@
             case STATUS_IN_PROGRESS:
                 builder.setContentText(getString(R.string.notification_install_inprogress));
 
-                int max = (int) Math.max(mSystemSize >> 20, 1);
-                int progress = (int) mInstalledSize >> 20;
+                int max = (int) Math.max((mSystemSize + mUserdataSize) >> 20, 1);
+                int progress = (int) (mInstalledSize >> 20);
 
                 builder.setProgress(max, progress, false);
 
diff --git a/packages/DynamicAndroidInstallationService/src/com/android/dynandroid/InstallationAsyncTask.java b/packages/DynamicAndroidInstallationService/src/com/android/dynandroid/InstallationAsyncTask.java
index 3c759e9..03fc773 100644
--- a/packages/DynamicAndroidInstallationService/src/com/android/dynandroid/InstallationAsyncTask.java
+++ b/packages/DynamicAndroidInstallationService/src/com/android/dynandroid/InstallationAsyncTask.java
@@ -16,6 +16,7 @@
 
 package com.android.dynandroid;
 
+import android.gsi.GsiProgress;
 import android.os.AsyncTask;
 import android.os.DynamicAndroidManager;
 import android.util.Log;
@@ -63,8 +64,6 @@
     private final InstallStatusListener mListener;
     private DynamicAndroidManager.Session mInstallationSession;
 
-    private long mInstalledSize;
-    private long mReportedInstalledSize;
     private int mResult = NO_RESULT;
 
     private InputStream mStream;
@@ -89,8 +88,40 @@
         Log.d(TAG, "Start doInBackground(), URL: " + mUrl);
 
         try {
-            // call start in background
-            mInstallationSession = mDynamicAndroid.startInstallation(mSystemSize, mUserdataSize);
+            long installedSize = 0;
+            long reportedInstalledSize = 0;
+
+            long minStepToReport = (mSystemSize + mUserdataSize) / 100;
+
+            // init input stream before calling startInstallation(), which takes 90 seconds.
+            initInputStream();
+
+            Thread thread = new Thread(() -> {
+                mInstallationSession =
+                        mDynamicAndroid.startInstallation(mSystemSize, mUserdataSize);
+            });
+
+
+            thread.start();
+
+            while (thread.isAlive()) {
+                if (isCancelled()) {
+                    boolean aborted = mDynamicAndroid.abort();
+                    Log.d(TAG, "Called DynamicAndroidManager.abort(), result = " + aborted);
+                    return RESULT_OK;
+                }
+
+                GsiProgress progress = mDynamicAndroid.getInstallationProgress();
+                installedSize = progress.bytes_processed;
+
+                if (installedSize > reportedInstalledSize + minStepToReport) {
+                    publishProgress(installedSize);
+                    reportedInstalledSize = installedSize;
+                }
+
+                Thread.sleep(10);
+            }
+
 
             if (mInstallationSession == null) {
                 Log.e(TAG, "Failed to start installation with requested size: "
@@ -99,12 +130,11 @@
                 return RESULT_ERROR_IO;
             }
 
-            initInputStream();
+            installedSize = mUserdataSize;
 
             byte[] bytes = new byte[READ_BUFFER_SIZE];
 
             int numBytesRead;
-            long minStepToReport = mSystemSize / 100;
 
             Log.d(TAG, "Start installation loop");
             while ((numBytesRead = mStream.read(bytes, 0, READ_BUFFER_SIZE)) != -1) {
@@ -119,11 +149,11 @@
                     throw new IOException("Failed write() to DynamicAndroid");
                 }
 
-                mInstalledSize += numBytesRead;
+                installedSize += numBytesRead;
 
-                if (mInstalledSize > mReportedInstalledSize + minStepToReport) {
-                    publishProgress(mInstalledSize);
-                    mReportedInstalledSize = mInstalledSize;
+                if (installedSize > reportedInstalledSize + minStepToReport) {
+                    publishProgress(installedSize);
+                    reportedInstalledSize = installedSize;
                 }
             }
 
diff --git a/packages/ExtServices/Android.mk b/packages/ExtServices/Android.mk
index 467d7ed..1133499 100644
--- a/packages/ExtServices/Android.mk
+++ b/packages/ExtServices/Android.mk
@@ -33,6 +33,8 @@
 
 LOCAL_PRIVILEGED_MODULE := true
 
+LOCAL_MIN_SDK_VERSION := 28
+
 include $(BUILD_PACKAGE)
 
 # Use the following include to make our test apk.
diff --git a/packages/ExtServices/AndroidManifest.xml b/packages/ExtServices/AndroidManifest.xml
index fe6581b..e47d53c 100644
--- a/packages/ExtServices/AndroidManifest.xml
+++ b/packages/ExtServices/AndroidManifest.xml
@@ -25,6 +25,11 @@
     <uses-permission android:name="android.permission.READ_DEVICE_CONFIG" />
 
     <uses-permission android:name="android.permission.MONITOR_DEFAULT_SMS_PACKAGE" />
+    <uses-permission android:name="android.permission.REQUEST_NOTIFICATION_ASSISTANT_SERVICE" />
+
+    <uses-sdk
+        android:targetSdkVersion="28"
+    />
 
     <application android:label="@string/app_name"
         android:defaultToDeviceProtectedStorage="true"
diff --git a/packages/ExtServices/src/android/ext/services/notification/AssistantSettings.java b/packages/ExtServices/src/android/ext/services/notification/AssistantSettings.java
index 6cf72a4..46288bb 100644
--- a/packages/ExtServices/src/android/ext/services/notification/AssistantSettings.java
+++ b/packages/ExtServices/src/android/ext/services/notification/AssistantSettings.java
@@ -22,10 +22,10 @@
 import android.os.Handler;
 import android.provider.DeviceConfig;
 import android.provider.Settings;
-import android.text.TextUtils;
 import android.util.Log;
 
 import com.android.internal.annotations.VisibleForTesting;
+import com.android.internal.config.sysui.SystemUiDeviceConfigFlags;
 
 /**
  * Observes the settings for {@link Assistant}.
@@ -103,7 +103,7 @@
 
     private void registerDeviceConfigs() {
         DeviceConfig.addOnPropertyChangedListener(
-                DeviceConfig.NotificationAssistant.NAMESPACE,
+                DeviceConfig.NAMESPACE_SYSTEMUI,
                 this::postToHandler,
                 this::onDeviceConfigPropertyChanged);
 
@@ -117,7 +117,7 @@
 
     @VisibleForTesting
     void onDeviceConfigPropertyChanged(String namespace, String name, String value) {
-        if (!DeviceConfig.NotificationAssistant.NAMESPACE.equals(namespace)) {
+        if (!DeviceConfig.NAMESPACE_SYSTEMUI.equals(namespace)) {
             Log.e(LOG_TAG, "Received update from DeviceConfig for unrelated namespace: "
                     + namespace + " " + name + "=" + value);
             return;
@@ -127,18 +127,18 @@
     }
 
     private void updateFromDeviceConfigFlags() {
-        mGenerateReplies = DeviceConfigHelper.getBoolean(
-                DeviceConfig.NotificationAssistant.GENERATE_REPLIES, DEFAULT_GENERATE_REPLIES);
+        mGenerateReplies = DeviceConfig.getBoolean(DeviceConfig.NAMESPACE_SYSTEMUI,
+                SystemUiDeviceConfigFlags.NAS_GENERATE_REPLIES, DEFAULT_GENERATE_REPLIES);
 
-        mGenerateActions = DeviceConfigHelper.getBoolean(
-                DeviceConfig.NotificationAssistant.GENERATE_ACTIONS, DEFAULT_GENERATE_ACTIONS);
+        mGenerateActions = DeviceConfig.getBoolean(DeviceConfig.NAMESPACE_SYSTEMUI,
+                SystemUiDeviceConfigFlags.NAS_GENERATE_ACTIONS, DEFAULT_GENERATE_ACTIONS);
 
-        mMaxMessagesToExtract = DeviceConfigHelper.getInteger(
-                DeviceConfig.NotificationAssistant.MAX_MESSAGES_TO_EXTRACT,
+        mMaxMessagesToExtract = DeviceConfig.getInt(DeviceConfig.NAMESPACE_SYSTEMUI,
+                SystemUiDeviceConfigFlags.NAS_MAX_MESSAGES_TO_EXTRACT,
                 DEFAULT_MAX_MESSAGES_TO_EXTRACT);
 
-        mMaxSuggestions = DeviceConfigHelper.getInteger(
-                DeviceConfig.NotificationAssistant.MAX_SUGGESTIONS, DEFAULT_MAX_SUGGESTIONS);
+        mMaxSuggestions = DeviceConfig.getInt(DeviceConfig.NAMESPACE_SYSTEMUI,
+                SystemUiDeviceConfigFlags.NAS_MAX_SUGGESTIONS, DEFAULT_MAX_SUGGESTIONS);
 
         mOnUpdateRunnable.run();
     }
@@ -169,37 +169,8 @@
         mOnUpdateRunnable.run();
     }
 
-    static class DeviceConfigHelper {
-
-        static int getInteger(String key, int defaultValue) {
-            String value = getValue(key);
-            if (TextUtils.isEmpty(value)) {
-                return defaultValue;
-            }
-            try {
-                return Integer.parseInt(value);
-            } catch (NumberFormatException ex) {
-                return defaultValue;
-            }
-        }
-
-        static boolean getBoolean(String key, boolean defaultValue) {
-            String value = getValue(key);
-            if (TextUtils.isEmpty(value)) {
-                return defaultValue;
-            }
-            return Boolean.parseBoolean(value);
-        }
-
-        private static String getValue(String key) {
-            return DeviceConfig.getProperty(
-                    DeviceConfig.NotificationAssistant.NAMESPACE,
-                    key);
-        }
-    }
-
     public interface Factory {
         AssistantSettings createAndRegister(Handler handler, ContentResolver resolver, int userId,
                 Runnable onUpdateRunnable);
     }
-}
\ No newline at end of file
+}
diff --git a/packages/ExtServices/tests/Android.bp b/packages/ExtServices/tests/Android.bp
index 930b783..ae60d4e 100644
--- a/packages/ExtServices/tests/Android.bp
+++ b/packages/ExtServices/tests/Android.bp
@@ -14,14 +14,14 @@
 
     static_libs: [
         "ExtServices-core",
-        "android-support-test",
-        "compatibility-device-util",
+        "androidx.test.rules",
+        "compatibility-device-util-axt",
         "mockito-target-minus-junit4",
-        "espresso-core",
+        "androidx.test.espresso.core",
         "truth-prebuilt",
         "testables",
         "testng",
     ],
 
     platform_apis: true,
-}
\ No newline at end of file
+}
diff --git a/packages/ExtServices/tests/AndroidManifest.xml b/packages/ExtServices/tests/AndroidManifest.xml
index 3cf1527..a08a10e 100644
--- a/packages/ExtServices/tests/AndroidManifest.xml
+++ b/packages/ExtServices/tests/AndroidManifest.xml
@@ -23,7 +23,7 @@
         <uses-library android:name="android.test.runner" />
     </application>
 
-    <instrumentation android:name="android.support.test.runner.AndroidJUnitRunner"
+    <instrumentation android:name="androidx.test.runner.AndroidJUnitRunner"
                      android:targetPackage="android.ext.services.tests.unit"
                      android:label="ExtServices Test Cases">
     </instrumentation>
diff --git a/packages/ExtServices/tests/AndroidTest.xml b/packages/ExtServices/tests/AndroidTest.xml
index c3d32de..cd26ebc 100644
--- a/packages/ExtServices/tests/AndroidTest.xml
+++ b/packages/ExtServices/tests/AndroidTest.xml
@@ -23,7 +23,7 @@
     <option name="test-tag" value="ExtServicesUnitTests" />
     <test class="com.android.tradefed.testtype.AndroidJUnitTest" >
         <option name="package" value="android.ext.services.tests.unit" />
-        <option name="runner" value="android.support.test.runner.AndroidJUnitRunner" />
+        <option name="runner" value="androidx.test.runner.AndroidJUnitRunner" />
         <option name="hidden-api-checks" value="false"/>
     </test>
 </configuration>
\ No newline at end of file
diff --git a/packages/ExtServices/tests/src/android/ext/services/notification/AgingHelperTest.java b/packages/ExtServices/tests/src/android/ext/services/notification/AgingHelperTest.java
index 90018e5f..3db275a 100644
--- a/packages/ExtServices/tests/src/android/ext/services/notification/AgingHelperTest.java
+++ b/packages/ExtServices/tests/src/android/ext/services/notification/AgingHelperTest.java
@@ -39,10 +39,11 @@
 import android.os.Process;
 import android.os.UserHandle;
 import android.service.notification.StatusBarNotification;
-import android.support.test.InstrumentationRegistry;
-import android.support.test.runner.AndroidJUnit4;
 import android.testing.TestableContext;
 
+import androidx.test.InstrumentationRegistry;
+import androidx.test.runner.AndroidJUnit4;
+
 import org.junit.Before;
 import org.junit.Rule;
 import org.junit.Test;
diff --git a/packages/ExtServices/tests/src/android/ext/services/notification/AssistantSettingsTest.java b/packages/ExtServices/tests/src/android/ext/services/notification/AssistantSettingsTest.java
index d890c1a..ad52e2b 100644
--- a/packages/ExtServices/tests/src/android/ext/services/notification/AssistantSettingsTest.java
+++ b/packages/ExtServices/tests/src/android/ext/services/notification/AssistantSettingsTest.java
@@ -17,9 +17,10 @@
 package android.ext.services.notification;
 
 import static android.ext.services.notification.AssistantSettings.DEFAULT_MAX_SUGGESTIONS;
-import static android.provider.DeviceConfig.NotificationAssistant;
 import static android.provider.DeviceConfig.setProperty;
 
+import static com.android.compatibility.common.util.SystemUtil.runWithShellPermissionIdentity;
+
 import static junit.framework.Assert.assertFalse;
 import static junit.framework.Assert.assertTrue;
 
@@ -30,12 +31,16 @@
 import android.content.ContentResolver;
 import android.os.Handler;
 import android.os.Looper;
+import android.provider.DeviceConfig;
 import android.provider.Settings;
-import android.support.test.InstrumentationRegistry;
-import android.support.test.runner.AndroidJUnit4;
 import android.support.test.uiautomator.UiDevice;
 import android.testing.TestableContext;
 
+import androidx.test.InstrumentationRegistry;
+import androidx.test.runner.AndroidJUnit4;
+
+import com.android.internal.config.sysui.SystemUiDeviceConfigFlags;
+
 import org.junit.After;
 import org.junit.Before;
 import org.junit.Rule;
@@ -49,7 +54,7 @@
 @RunWith(AndroidJUnit4.class)
 public class AssistantSettingsTest {
     private static final String CLEAR_DEVICE_CONFIG_KEY_CMD =
-            "device_config delete " + NotificationAssistant.NAMESPACE;
+            "device_config delete " + DeviceConfig.NAMESPACE_SYSTEMUI;
 
     private static final int USER_ID = 5;
 
@@ -86,14 +91,14 @@
 
     @Test
     public void testGenerateRepliesDisabled() {
-        setProperty(
-                NotificationAssistant.NAMESPACE,
-                NotificationAssistant.GENERATE_REPLIES,
+        runWithShellPermissionIdentity(() -> setProperty(
+                DeviceConfig.NAMESPACE_SYSTEMUI,
+                SystemUiDeviceConfigFlags.NAS_GENERATE_REPLIES,
                 "false",
-                false /* makeDefault */);
+                false /* makeDefault */));
         mAssistantSettings.onDeviceConfigPropertyChanged(
-                NotificationAssistant.NAMESPACE,
-                NotificationAssistant.GENERATE_REPLIES,
+                DeviceConfig.NAMESPACE_SYSTEMUI,
+                SystemUiDeviceConfigFlags.NAS_GENERATE_REPLIES,
                 "false");
 
         assertFalse(mAssistantSettings.mGenerateReplies);
@@ -101,42 +106,42 @@
 
     @Test
     public void testGenerateRepliesEnabled() {
-        setProperty(
-                NotificationAssistant.NAMESPACE,
-                NotificationAssistant.GENERATE_REPLIES,
+        runWithShellPermissionIdentity(() -> setProperty(
+                DeviceConfig.NAMESPACE_SYSTEMUI,
+                SystemUiDeviceConfigFlags.NAS_GENERATE_REPLIES,
                 "true",
-                false /* makeDefault */);
+                false /* makeDefault */));
         mAssistantSettings.onDeviceConfigPropertyChanged(
-                NotificationAssistant.NAMESPACE,
-                NotificationAssistant.GENERATE_REPLIES,
+                DeviceConfig.NAMESPACE_SYSTEMUI,
+                SystemUiDeviceConfigFlags.NAS_GENERATE_REPLIES,
                 "true");
 
         assertTrue(mAssistantSettings.mGenerateReplies);
     }
 
     @Test
-    public void testGenerateRepliesEmptyFlag() {
-        setProperty(
-                NotificationAssistant.NAMESPACE,
-                NotificationAssistant.GENERATE_REPLIES,
+    public void testGenerateRepliesNullFlag() {
+        runWithShellPermissionIdentity(() -> setProperty(
+                DeviceConfig.NAMESPACE_SYSTEMUI,
+                SystemUiDeviceConfigFlags.NAS_GENERATE_REPLIES,
                 "false",
-                false /* makeDefault */);
+                false /* makeDefault */));
         mAssistantSettings.onDeviceConfigPropertyChanged(
-                NotificationAssistant.NAMESPACE,
-                NotificationAssistant.GENERATE_REPLIES,
+                DeviceConfig.NAMESPACE_SYSTEMUI,
+                SystemUiDeviceConfigFlags.NAS_GENERATE_REPLIES,
                 "false");
 
         assertFalse(mAssistantSettings.mGenerateReplies);
 
-        setProperty(
-                NotificationAssistant.NAMESPACE,
-                NotificationAssistant.GENERATE_REPLIES,
-                "",
-                false /* makeDefault */);
+        runWithShellPermissionIdentity(() -> setProperty(
+                DeviceConfig.NAMESPACE_SYSTEMUI,
+                SystemUiDeviceConfigFlags.NAS_GENERATE_REPLIES,
+                null,
+                false /* makeDefault */));
         mAssistantSettings.onDeviceConfigPropertyChanged(
-                NotificationAssistant.NAMESPACE,
-                NotificationAssistant.GENERATE_REPLIES,
-                "");
+                DeviceConfig.NAMESPACE_SYSTEMUI,
+                SystemUiDeviceConfigFlags.NAS_GENERATE_REPLIES,
+                null);
 
         // Go back to the default value.
         assertTrue(mAssistantSettings.mGenerateReplies);
@@ -144,14 +149,14 @@
 
     @Test
     public void testGenerateActionsDisabled() {
-        setProperty(
-                NotificationAssistant.NAMESPACE,
-                NotificationAssistant.GENERATE_ACTIONS,
+        runWithShellPermissionIdentity(() -> setProperty(
+                DeviceConfig.NAMESPACE_SYSTEMUI,
+                SystemUiDeviceConfigFlags.NAS_GENERATE_ACTIONS,
                 "false",
-                false /* makeDefault */);
+                false /* makeDefault */));
         mAssistantSettings.onDeviceConfigPropertyChanged(
-                NotificationAssistant.NAMESPACE,
-                NotificationAssistant.GENERATE_ACTIONS,
+                DeviceConfig.NAMESPACE_SYSTEMUI,
+                SystemUiDeviceConfigFlags.NAS_GENERATE_ACTIONS,
                 "false");
 
         assertFalse(mAssistantSettings.mGenerateActions);
@@ -159,42 +164,42 @@
 
     @Test
     public void testGenerateActionsEnabled() {
-        setProperty(
-                NotificationAssistant.NAMESPACE,
-                NotificationAssistant.GENERATE_ACTIONS,
+        runWithShellPermissionIdentity(() -> setProperty(
+                DeviceConfig.NAMESPACE_SYSTEMUI,
+                SystemUiDeviceConfigFlags.NAS_GENERATE_ACTIONS,
                 "true",
-                false /* makeDefault */);
+                false /* makeDefault */));
         mAssistantSettings.onDeviceConfigPropertyChanged(
-                NotificationAssistant.NAMESPACE,
-                NotificationAssistant.GENERATE_ACTIONS,
+                DeviceConfig.NAMESPACE_SYSTEMUI,
+                SystemUiDeviceConfigFlags.NAS_GENERATE_ACTIONS,
                 "true");
 
         assertTrue(mAssistantSettings.mGenerateActions);
     }
 
     @Test
-    public void testGenerateActionsEmptyFlag() {
-        setProperty(
-                NotificationAssistant.NAMESPACE,
-                NotificationAssistant.GENERATE_ACTIONS,
+    public void testGenerateActionsNullFlag() {
+        runWithShellPermissionIdentity(() -> setProperty(
+                DeviceConfig.NAMESPACE_SYSTEMUI,
+                SystemUiDeviceConfigFlags.NAS_GENERATE_ACTIONS,
                 "false",
-                false /* makeDefault */);
+                false /* makeDefault */));
         mAssistantSettings.onDeviceConfigPropertyChanged(
-                NotificationAssistant.NAMESPACE,
-                NotificationAssistant.GENERATE_ACTIONS,
+                DeviceConfig.NAMESPACE_SYSTEMUI,
+                SystemUiDeviceConfigFlags.NAS_GENERATE_ACTIONS,
                 "false");
 
         assertFalse(mAssistantSettings.mGenerateActions);
 
-        setProperty(
-                NotificationAssistant.NAMESPACE,
-                NotificationAssistant.GENERATE_ACTIONS,
-                "",
-                false /* makeDefault */);
+        runWithShellPermissionIdentity(() -> setProperty(
+                DeviceConfig.NAMESPACE_SYSTEMUI,
+                SystemUiDeviceConfigFlags.NAS_GENERATE_ACTIONS,
+                null,
+                false /* makeDefault */));
         mAssistantSettings.onDeviceConfigPropertyChanged(
-                NotificationAssistant.NAMESPACE,
-                NotificationAssistant.GENERATE_ACTIONS,
-                "");
+                DeviceConfig.NAMESPACE_SYSTEMUI,
+                SystemUiDeviceConfigFlags.NAS_GENERATE_ACTIONS,
+                null);
 
         // Go back to the default value.
         assertTrue(mAssistantSettings.mGenerateActions);
@@ -202,14 +207,14 @@
 
     @Test
     public void testMaxMessagesToExtract() {
-        setProperty(
-                NotificationAssistant.NAMESPACE,
-                NotificationAssistant.MAX_MESSAGES_TO_EXTRACT,
+        runWithShellPermissionIdentity(() -> setProperty(
+                DeviceConfig.NAMESPACE_SYSTEMUI,
+                SystemUiDeviceConfigFlags.NAS_MAX_MESSAGES_TO_EXTRACT,
                 "10",
-                false /* makeDefault */);
+                false /* makeDefault */));
         mAssistantSettings.onDeviceConfigPropertyChanged(
-                NotificationAssistant.NAMESPACE,
-                NotificationAssistant.MAX_MESSAGES_TO_EXTRACT,
+                DeviceConfig.NAMESPACE_SYSTEMUI,
+                SystemUiDeviceConfigFlags.NAS_MAX_MESSAGES_TO_EXTRACT,
                 "10");
 
         assertEquals(10, mAssistantSettings.mMaxMessagesToExtract);
@@ -217,14 +222,14 @@
 
     @Test
     public void testMaxSuggestions() {
-        setProperty(
-                NotificationAssistant.NAMESPACE,
-                NotificationAssistant.MAX_SUGGESTIONS,
+        runWithShellPermissionIdentity(() -> setProperty(
+                DeviceConfig.NAMESPACE_SYSTEMUI,
+                SystemUiDeviceConfigFlags.NAS_MAX_SUGGESTIONS,
                 "5",
-                false /* makeDefault */);
+                false /* makeDefault */));
         mAssistantSettings.onDeviceConfigPropertyChanged(
-                NotificationAssistant.NAMESPACE,
-                NotificationAssistant.MAX_SUGGESTIONS,
+                DeviceConfig.NAMESPACE_SYSTEMUI,
+                SystemUiDeviceConfigFlags.NAS_MAX_SUGGESTIONS,
                 "5");
 
         assertEquals(5, mAssistantSettings.mMaxSuggestions);
@@ -233,8 +238,8 @@
     @Test
     public void testMaxSuggestionsEmpty() {
         mAssistantSettings.onDeviceConfigPropertyChanged(
-                NotificationAssistant.NAMESPACE,
-                NotificationAssistant.MAX_SUGGESTIONS,
+                DeviceConfig.NAMESPACE_SYSTEMUI,
+                SystemUiDeviceConfigFlags.NAS_MAX_SUGGESTIONS,
                 "");
 
         assertEquals(DEFAULT_MAX_SUGGESTIONS, mAssistantSettings.mMaxSuggestions);
@@ -278,13 +283,14 @@
     private static void clearDeviceConfig() throws IOException {
         UiDevice uiDevice = UiDevice.getInstance(InstrumentationRegistry.getInstrumentation());
         uiDevice.executeShellCommand(
-                CLEAR_DEVICE_CONFIG_KEY_CMD + " " + NotificationAssistant.GENERATE_ACTIONS);
+                CLEAR_DEVICE_CONFIG_KEY_CMD + " " + SystemUiDeviceConfigFlags.NAS_GENERATE_ACTIONS);
         uiDevice.executeShellCommand(
-                CLEAR_DEVICE_CONFIG_KEY_CMD + " " + NotificationAssistant.GENERATE_REPLIES);
+                CLEAR_DEVICE_CONFIG_KEY_CMD + " " + SystemUiDeviceConfigFlags.NAS_GENERATE_REPLIES);
         uiDevice.executeShellCommand(
-                CLEAR_DEVICE_CONFIG_KEY_CMD + " " + NotificationAssistant.MAX_MESSAGES_TO_EXTRACT);
+                CLEAR_DEVICE_CONFIG_KEY_CMD + " "
+                + SystemUiDeviceConfigFlags.NAS_MAX_MESSAGES_TO_EXTRACT);
         uiDevice.executeShellCommand(
-                CLEAR_DEVICE_CONFIG_KEY_CMD + " " + NotificationAssistant.MAX_SUGGESTIONS);
+                CLEAR_DEVICE_CONFIG_KEY_CMD + " " + SystemUiDeviceConfigFlags.NAS_MAX_SUGGESTIONS);
     }
 
 }
diff --git a/packages/ExtServices/tests/src/android/ext/services/notification/AssistantTest.java b/packages/ExtServices/tests/src/android/ext/services/notification/AssistantTest.java
index f632814..459cd40 100644
--- a/packages/ExtServices/tests/src/android/ext/services/notification/AssistantTest.java
+++ b/packages/ExtServices/tests/src/android/ext/services/notification/AssistantTest.java
@@ -44,11 +44,12 @@
 import android.service.notification.NotificationListenerService.RankingMap;
 import android.service.notification.NotificationStats;
 import android.service.notification.StatusBarNotification;
-import android.support.test.InstrumentationRegistry;
 import android.test.ServiceTestCase;
 import android.testing.TestableContext;
 import android.util.AtomicFile;
 
+import androidx.test.InstrumentationRegistry;
+
 import com.android.internal.util.FastXmlSerializer;
 
 import org.junit.Before;
diff --git a/packages/ExtServices/tests/src/android/ext/services/notification/EntityTypeCounterTest.java b/packages/ExtServices/tests/src/android/ext/services/notification/EntityTypeCounterTest.java
index 2d29c7b..ada61d0 100644
--- a/packages/ExtServices/tests/src/android/ext/services/notification/EntityTypeCounterTest.java
+++ b/packages/ExtServices/tests/src/android/ext/services/notification/EntityTypeCounterTest.java
@@ -17,9 +17,10 @@
 
 import static com.google.common.truth.Truth.assertThat;
 
-import android.support.test.runner.AndroidJUnit4;
 import android.view.textclassifier.TextClassifier;
 
+import androidx.test.runner.AndroidJUnit4;
+
 import org.junit.Before;
 import org.junit.Test;
 import org.junit.runner.RunWith;
diff --git a/packages/ExtServices/tests/src/android/ext/services/notification/NotificationCategorizerTest.java b/packages/ExtServices/tests/src/android/ext/services/notification/NotificationCategorizerTest.java
index 05af6e7..ea77d31 100644
--- a/packages/ExtServices/tests/src/android/ext/services/notification/NotificationCategorizerTest.java
+++ b/packages/ExtServices/tests/src/android/ext/services/notification/NotificationCategorizerTest.java
@@ -32,10 +32,11 @@
 import android.app.NotificationChannel;
 import android.os.Process;
 import android.service.notification.StatusBarNotification;
-import android.support.test.InstrumentationRegistry;
-import android.support.test.runner.AndroidJUnit4;
 import android.testing.TestableContext;
 
+import androidx.test.InstrumentationRegistry;
+import androidx.test.runner.AndroidJUnit4;
+
 import org.junit.Before;
 import org.junit.Rule;
 import org.junit.Test;
diff --git a/packages/ExtServices/tests/src/android/ext/services/notification/NotificationEntryTest.java b/packages/ExtServices/tests/src/android/ext/services/notification/NotificationEntryTest.java
index 2d44e79..f51e911 100644
--- a/packages/ExtServices/tests/src/android/ext/services/notification/NotificationEntryTest.java
+++ b/packages/ExtServices/tests/src/android/ext/services/notification/NotificationEntryTest.java
@@ -39,10 +39,11 @@
 import android.os.Process;
 import android.os.UserHandle;
 import android.service.notification.StatusBarNotification;
-import android.support.test.InstrumentationRegistry;
-import android.support.test.runner.AndroidJUnit4;
 import android.testing.TestableContext;
 
+import androidx.test.InstrumentationRegistry;
+import androidx.test.runner.AndroidJUnit4;
+
 import org.junit.Before;
 import org.junit.Rule;
 import org.junit.Test;
diff --git a/packages/ExtServices/tests/src/android/ext/services/notification/SmartActionsHelperTest.java b/packages/ExtServices/tests/src/android/ext/services/notification/SmartActionsHelperTest.java
index d0b6d00..a1fbc7b 100644
--- a/packages/ExtServices/tests/src/android/ext/services/notification/SmartActionsHelperTest.java
+++ b/packages/ExtServices/tests/src/android/ext/services/notification/SmartActionsHelperTest.java
@@ -39,14 +39,15 @@
 import android.os.Process;
 import android.service.notification.NotificationAssistantService;
 import android.service.notification.StatusBarNotification;
-import android.support.test.InstrumentationRegistry;
-import android.support.test.runner.AndroidJUnit4;
 import android.view.textclassifier.ConversationAction;
 import android.view.textclassifier.ConversationActions;
 import android.view.textclassifier.TextClassificationManager;
 import android.view.textclassifier.TextClassifier;
 import android.view.textclassifier.TextClassifierEvent;
 
+import androidx.test.InstrumentationRegistry;
+import androidx.test.runner.AndroidJUnit4;
+
 import com.google.common.truth.FailureStrategy;
 import com.google.common.truth.Subject;
 import com.google.common.truth.SubjectFactory;
diff --git a/packages/NetworkStack/Android.bp b/packages/NetworkStack/Android.bp
index 5f1f26d..f210840 100644
--- a/packages/NetworkStack/Android.bp
+++ b/packages/NetworkStack/Android.bp
@@ -36,6 +36,7 @@
 android_app {
     name: "NetworkStack",
     sdk_version: "system_current",
+    min_sdk_version: "28",
     certificate: "networkstack",
     privileged: true,
     static_libs: [
diff --git a/packages/NetworkStack/AndroidManifest.xml b/packages/NetworkStack/AndroidManifest.xml
index 52c209e..003f1e5 100644
--- a/packages/NetworkStack/AndroidManifest.xml
+++ b/packages/NetworkStack/AndroidManifest.xml
@@ -18,7 +18,10 @@
 -->
 <manifest xmlns:android="http://schemas.android.com/apk/res/android"
           package="com.android.networkstack"
-          android:sharedUserId="android.uid.networkstack">
+          android:sharedUserId="android.uid.networkstack"
+          android:versionCode="11"
+          android:versionName="Q-initial">
+    <uses-sdk android:minSdkVersion="28" android:targetSdkVersion="28" />
     <uses-permission android:name="android.permission.INTERNET" />
     <uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION" />
     <uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
diff --git a/packages/NetworkStack/OWNERS b/packages/NetworkStack/OWNERS
index a395465..0e1e65d 100644
--- a/packages/NetworkStack/OWNERS
+++ b/packages/NetworkStack/OWNERS
@@ -1,5 +1,6 @@
 codewiz@google.com
 jchalard@google.com
+junyulai@google.com
 lorenzo@google.com
 reminv@google.com
 satk@google.com
diff --git a/packages/NetworkStack/TEST_MAPPING b/packages/NetworkStack/TEST_MAPPING
index 55ba591..fe9731fe 100644
--- a/packages/NetworkStack/TEST_MAPPING
+++ b/packages/NetworkStack/TEST_MAPPING
@@ -1,5 +1,5 @@
 {
-  "postsubmit": [
+  "presubmit": [
     {
       "name": "NetworkStackTests"
     }
diff --git a/packages/NetworkStack/src/android/net/apf/ApfFilter.java b/packages/NetworkStack/src/android/net/apf/ApfFilter.java
index 923f162..3dd90ee 100644
--- a/packages/NetworkStack/src/android/net/apf/ApfFilter.java
+++ b/packages/NetworkStack/src/android/net/apf/ApfFilter.java
@@ -475,7 +475,7 @@
             socket = Os.socket(AF_PACKET, SOCK_RAW, ETH_P_IPV6);
             SocketAddress addr = makePacketSocketAddress(
                     (short) ETH_P_IPV6, mInterfaceParams.index);
-            SocketUtils.bindSocket(socket, addr);
+            Os.bind(socket, addr);
             SocketUtils.attachRaFilter(socket, mApfCapabilities.apfPacketFormat);
         } catch(SocketException|ErrnoException e) {
             Log.e(TAG, "Error starting filter", e);
diff --git a/packages/NetworkStack/src/android/net/dhcp/DhcpClient.java b/packages/NetworkStack/src/android/net/dhcp/DhcpClient.java
index b0e8da9..0b7809e 100644
--- a/packages/NetworkStack/src/android/net/dhcp/DhcpClient.java
+++ b/packages/NetworkStack/src/android/net/dhcp/DhcpClient.java
@@ -317,7 +317,7 @@
         try {
             mPacketSock = Os.socket(AF_PACKET, SOCK_RAW, ETH_P_IP);
             SocketAddress addr = makePacketSocketAddress((short) ETH_P_IP, mIface.index);
-            SocketUtils.bindSocket(mPacketSock, addr);
+            Os.bind(mPacketSock, addr);
             SocketUtils.attachDhcpFilter(mPacketSock);
         } catch(SocketException|ErrnoException e) {
             Log.e(TAG, "Error creating packet socket", e);
@@ -412,8 +412,7 @@
         try {
             if (encap == DhcpPacket.ENCAP_L2) {
                 if (DBG) Log.d(TAG, "Broadcasting " + description);
-                SocketUtils.sendTo(
-                        mPacketSock, buf.array(), 0, buf.limit(), 0, mInterfaceBroadcastAddr);
+                Os.sendto(mPacketSock, buf.array(), 0, buf.limit(), 0, mInterfaceBroadcastAddr);
             } else if (encap == DhcpPacket.ENCAP_BOOTP && to.equals(INADDR_BROADCAST)) {
                 if (DBG) Log.d(TAG, "Broadcasting " + description);
                 // We only send L3-encapped broadcasts in DhcpRebindingState,
diff --git a/packages/NetworkStack/src/android/net/ip/ConnectivityPacketTracker.java b/packages/NetworkStack/src/android/net/ip/ConnectivityPacketTracker.java
index 649257a..de54824 100644
--- a/packages/NetworkStack/src/android/net/ip/ConnectivityPacketTracker.java
+++ b/packages/NetworkStack/src/android/net/ip/ConnectivityPacketTracker.java
@@ -104,8 +104,7 @@
             try {
                 s = Os.socket(AF_PACKET, SOCK_RAW | SOCK_NONBLOCK, 0);
                 SocketUtils.attachControlPacketFilter(s, ARPHRD_ETHER);
-                SocketUtils.bindSocket(
-                        s, makePacketSocketAddress((short) ETH_P_ALL, mInterface.index));
+                Os.bind(s, makePacketSocketAddress((short) ETH_P_ALL, mInterface.index));
             } catch (ErrnoException | IOException e) {
                 logError("Failed to create packet tracking socket: ", e);
                 closeFd(s);
diff --git a/packages/NetworkStack/src/android/net/ip/IpNeighborMonitor.java b/packages/NetworkStack/src/android/net/ip/IpNeighborMonitor.java
index b29d617..6ae9a2b 100644
--- a/packages/NetworkStack/src/android/net/ip/IpNeighborMonitor.java
+++ b/packages/NetworkStack/src/android/net/ip/IpNeighborMonitor.java
@@ -34,7 +34,6 @@
 import android.net.util.NetworkStackUtils;
 import android.net.util.PacketReader;
 import android.net.util.SharedLog;
-import android.net.util.SocketUtils;
 import android.os.Handler;
 import android.os.SystemClock;
 import android.system.ErrnoException;
@@ -150,7 +149,7 @@
 
         try {
             fd = Os.socket(AF_NETLINK, SOCK_DGRAM | SOCK_NONBLOCK, NETLINK_ROUTE);
-            SocketUtils.bindSocket(fd, makeNetlinkSocketAddress(0, OsConstants.RTMGRP_NEIGH));
+            Os.bind(fd, makeNetlinkSocketAddress(0, OsConstants.RTMGRP_NEIGH));
             NetlinkSocket.connectToKernel(fd);
 
             if (VDBG) {
diff --git a/packages/NetworkStack/src/android/net/metrics/DataStallStatsUtils.java b/packages/NetworkStack/src/android/net/metrics/DataStallStatsUtils.java
index 17a36ad..d1ca109 100644
--- a/packages/NetworkStack/src/android/net/metrics/DataStallStatsUtils.java
+++ b/packages/NetworkStack/src/android/net/metrics/DataStallStatsUtils.java
@@ -20,6 +20,7 @@
 import android.annotation.Nullable;
 import android.net.captiveportal.CaptivePortalProbeResult;
 import android.util.Log;
+import android.util.StatsLog;
 
 import com.android.internal.util.HexDump;
 import com.android.server.connectivity.nano.DataStallEventProto;
@@ -36,6 +37,7 @@
  */
 public class DataStallStatsUtils {
     private static final String TAG = DataStallStatsUtils.class.getSimpleName();
+    private static final int DATA_STALL_EVENT_ID = 121;
     private static final boolean DBG = false;
 
     private static int probeResultToEnum(@Nullable final CaptivePortalProbeResult result) {
@@ -61,6 +63,13 @@
             Log.d(TAG, "write: " + stats + " with result: " + validationResult
                     + ", dns: " + HexDump.toHexString(stats.mDns));
         }
-        // TODO(b/124613085): Send to Statsd once the public StatsLog API is ready.
+        // TODO(b/124613085): Update API once the public StatsLog API is ready.
+        StatsLog.write(DATA_STALL_EVENT_ID,
+                stats.mEvaluationType,
+                validationResult,
+                stats.mNetworkType,
+                stats.mWifiInfo,
+                stats.mCellularInfo,
+                stats.mDns);
     }
 }
diff --git a/packages/NetworkStack/src/com/android/server/connectivity/NetworkMonitor.java b/packages/NetworkStack/src/com/android/server/connectivity/NetworkMonitor.java
index e82a5d7..c3447fd 100644
--- a/packages/NetworkStack/src/com/android/server/connectivity/NetworkMonitor.java
+++ b/packages/NetworkStack/src/com/android/server/connectivity/NetworkMonitor.java
@@ -32,6 +32,7 @@
 import static android.net.metrics.ValidationProbeEvent.PROBE_FALLBACK;
 import static android.net.metrics.ValidationProbeEvent.PROBE_PRIVDNS;
 import static android.net.util.NetworkStackUtils.isEmpty;
+import static android.provider.Settings.Global.DATA_STALL_EVALUATION_TYPE_DNS;
 
 import android.annotation.NonNull;
 import android.annotation.Nullable;
@@ -128,9 +129,8 @@
     private static final int DEFAULT_DATA_STALL_MIN_EVALUATE_TIME_MS = 60 * 1000;
     private static final int DEFAULT_DATA_STALL_VALID_DNS_TIME_THRESHOLD_MS = 30 * 60 * 1000;
 
-    private static final int DATA_STALL_EVALUATION_TYPE_DNS = 1;
     private static final int DEFAULT_DATA_STALL_EVALUATION_TYPES =
-            (1 << DATA_STALL_EVALUATION_TYPE_DNS);
+            DATA_STALL_EVALUATION_TYPE_DNS;
     // Reevaluate it as intending to increase the number. Larger log size may cause statsd
     // log buffer bust and have stats log lost.
     private static final int DEFAULT_DNS_LOG_SIZE = 20;
@@ -1772,7 +1772,7 @@
     }
 
     private boolean dataStallEvaluateTypeEnabled(int type) {
-        return (mDataStallEvaluationType & (1 << type)) != 0;
+        return (mDataStallEvaluationType & type) != 0;
     }
 
     @VisibleForTesting
@@ -1792,7 +1792,7 @@
         }
 
         // Check dns signal. Suspect it may be a data stall if both :
-        // 1. The number of consecutive DNS query timeouts > mConsecutiveDnsTimeoutThreshold.
+        // 1. The number of consecutive DNS query timeouts >= mConsecutiveDnsTimeoutThreshold.
         // 2. Those consecutive DNS queries happened in the last mValidDataStallDnsTimeThreshold ms.
         if (dataStallEvaluateTypeEnabled(DATA_STALL_EVALUATION_TYPE_DNS)) {
             if (mDnsStallDetector.isDataStallSuspected(mConsecutiveDnsTimeoutThreshold,
diff --git a/packages/NetworkStack/src/com/android/server/util/PermissionUtil.java b/packages/NetworkStack/src/com/android/server/util/PermissionUtil.java
index f6eb900..6fbeead 100644
--- a/packages/NetworkStack/src/com/android/server/util/PermissionUtil.java
+++ b/packages/NetworkStack/src/com/android/server/util/PermissionUtil.java
@@ -33,7 +33,9 @@
     public static void checkNetworkStackCallingPermission() {
         // TODO: check that the calling PID is the system server.
         final int caller = getCallingUid();
-        if (caller != Process.SYSTEM_UID && UserHandle.getAppId(caller) != Process.BLUETOOTH_UID) {
+        if (caller != Process.SYSTEM_UID
+                && UserHandle.getAppId(caller) != Process.BLUETOOTH_UID
+                && UserHandle.getAppId(caller) != Process.PHONE_UID) {
             throw new SecurityException("Invalid caller: " + caller);
         }
     }
diff --git a/packages/NetworkStack/tests/Android.bp b/packages/NetworkStack/tests/Android.bp
index 5c7b514..e64f284 100644
--- a/packages/NetworkStack/tests/Android.bp
+++ b/packages/NetworkStack/tests/Android.bp
@@ -21,8 +21,7 @@
     test_suites: ["device-tests"],
     resource_dirs: ["res"],
     static_libs: [
-        "android-support-test",
-        "frameworks-base-testutils",
+        "androidx.test.rules",
         "mockito-target-extended-minus-junit4",
         "NetworkStackLib",
         "testables",
diff --git a/packages/NetworkStack/tests/AndroidManifest.xml b/packages/NetworkStack/tests/AndroidManifest.xml
index 9cb2c21..5dcf6ff 100644
--- a/packages/NetworkStack/tests/AndroidManifest.xml
+++ b/packages/NetworkStack/tests/AndroidManifest.xml
@@ -47,7 +47,7 @@
     <application android:debuggable="true">
         <uses-library android:name="android.test.runner" />
     </application>
-    <instrumentation android:name="android.support.test.runner.AndroidJUnitRunner"
+    <instrumentation android:name="androidx.test.runner.AndroidJUnitRunner"
         android:targetPackage="com.android.server.networkstack.tests"
         android:label="Networking service tests">
     </instrumentation>
diff --git a/packages/NetworkStack/tests/AndroidTest.xml b/packages/NetworkStack/tests/AndroidTest.xml
index 6b08b57..047bc2e 100644
--- a/packages/NetworkStack/tests/AndroidTest.xml
+++ b/packages/NetworkStack/tests/AndroidTest.xml
@@ -23,7 +23,7 @@
     <option name="test-tag" value="NetworkStackTests" />
     <test class="com.android.tradefed.testtype.AndroidJUnitTest" >
         <option name="package" value="com.android.server.networkstack.tests" />
-        <option name="runner" value="android.support.test.runner.AndroidJUnitRunner" />
+        <option name="runner" value="androidx.test.runner.AndroidJUnitRunner" />
         <option name="hidden-api-checks" value="false"/>
     </test>
 </configuration>
\ No newline at end of file
diff --git a/packages/NetworkStack/tests/src/android/net/apf/ApfTest.java b/packages/NetworkStack/tests/src/android/net/apf/ApfTest.java
index 3414397..88a05d5 100644
--- a/packages/NetworkStack/tests/src/android/net/apf/ApfTest.java
+++ b/packages/NetworkStack/tests/src/android/net/apf/ApfTest.java
@@ -53,14 +53,15 @@
 import android.os.ConditionVariable;
 import android.os.Parcelable;
 import android.os.SystemClock;
-import android.support.test.InstrumentationRegistry;
-import android.support.test.filters.SmallTest;
-import android.support.test.runner.AndroidJUnit4;
 import android.system.ErrnoException;
 import android.system.Os;
 import android.text.format.DateUtils;
 import android.util.Log;
 
+import androidx.test.InstrumentationRegistry;
+import androidx.test.filters.SmallTest;
+import androidx.test.runner.AndroidJUnit4;
+
 import com.android.internal.util.HexDump;
 import com.android.server.networkstack.tests.R;
 import com.android.server.util.NetworkStackConstants;
diff --git a/packages/NetworkStack/tests/src/android/net/dhcp/DhcpLeaseRepositoryTest.java b/packages/NetworkStack/tests/src/android/net/dhcp/DhcpLeaseRepositoryTest.java
index 4abd77e..27d7255 100644
--- a/packages/NetworkStack/tests/src/android/net/dhcp/DhcpLeaseRepositoryTest.java
+++ b/packages/NetworkStack/tests/src/android/net/dhcp/DhcpLeaseRepositoryTest.java
@@ -31,16 +31,15 @@
 import static org.junit.Assert.fail;
 import static org.mockito.Mockito.when;
 
-import static java.lang.String.format;
-
 import android.annotation.NonNull;
 import android.annotation.Nullable;
 import android.net.IpPrefix;
 import android.net.MacAddress;
 import android.net.dhcp.DhcpServer.Clock;
 import android.net.util.SharedLog;
-import android.support.test.filters.SmallTest;
-import android.support.test.runner.AndroidJUnit4;
+
+import androidx.test.filters.SmallTest;
+import androidx.test.runner.AndroidJUnit4;
 
 import org.junit.Before;
 import org.junit.Test;
@@ -48,6 +47,8 @@
 import org.mockito.Mock;
 import org.mockito.MockitoAnnotations;
 
+import static java.lang.String.format;
+
 import java.net.Inet4Address;
 import java.util.Arrays;
 import java.util.Collections;
diff --git a/packages/NetworkStack/tests/src/android/net/dhcp/DhcpPacketTest.java b/packages/NetworkStack/tests/src/android/net/dhcp/DhcpPacketTest.java
index 7544e72..4d98403 100644
--- a/packages/NetworkStack/tests/src/android/net/dhcp/DhcpPacketTest.java
+++ b/packages/NetworkStack/tests/src/android/net/dhcp/DhcpPacketTest.java
@@ -48,8 +48,9 @@
 import android.net.LinkAddress;
 import android.net.NetworkUtils;
 import android.net.metrics.DhcpErrorEvent;
-import android.support.test.filters.SmallTest;
-import android.support.test.runner.AndroidJUnit4;
+
+import androidx.test.filters.SmallTest;
+import androidx.test.runner.AndroidJUnit4;
 
 import com.android.internal.util.HexDump;
 
@@ -324,7 +325,7 @@
     @Test
     public void testOffer1() throws Exception {
         // TODO: Turn all of these into golden files. This will probably require using
-        // android.support.test.InstrumentationRegistry for obtaining a Context object
+        // androidx.test.InstrumentationRegistry for obtaining a Context object
         // to read such golden files, along with an appropriate Android.mk.
         final ByteBuffer packet = ByteBuffer.wrap(HexDump.hexStringToByteArray(
             // IP header.
diff --git a/packages/NetworkStack/tests/src/android/net/dhcp/DhcpServerTest.java b/packages/NetworkStack/tests/src/android/net/dhcp/DhcpServerTest.java
index d4c1e2e..7d5e9e3 100644
--- a/packages/NetworkStack/tests/src/android/net/dhcp/DhcpServerTest.java
+++ b/packages/NetworkStack/tests/src/android/net/dhcp/DhcpServerTest.java
@@ -51,11 +51,12 @@
 import android.net.dhcp.DhcpServer.Dependencies;
 import android.net.util.SharedLog;
 import android.os.HandlerThread;
-import android.support.test.filters.SmallTest;
 import android.testing.AndroidTestingRunner;
 import android.testing.TestableLooper;
 import android.testing.TestableLooper.RunWithLooper;
 
+import androidx.test.filters.SmallTest;
+
 import org.junit.After;
 import org.junit.Before;
 import org.junit.Test;
diff --git a/packages/NetworkStack/tests/src/android/net/dhcp/DhcpServingParamsTest.java b/packages/NetworkStack/tests/src/android/net/dhcp/DhcpServingParamsTest.java
index 1004382..57a87a4 100644
--- a/packages/NetworkStack/tests/src/android/net/dhcp/DhcpServingParamsTest.java
+++ b/packages/NetworkStack/tests/src/android/net/dhcp/DhcpServingParamsTest.java
@@ -29,8 +29,9 @@
 import android.net.LinkAddress;
 import android.net.dhcp.DhcpServingParams.InvalidParameterException;
 import android.net.shared.Inet4AddressUtils;
-import android.support.test.filters.SmallTest;
-import android.support.test.runner.AndroidJUnit4;
+
+import androidx.test.filters.SmallTest;
+import androidx.test.runner.AndroidJUnit4;
 
 import org.junit.Before;
 import org.junit.Test;
diff --git a/packages/NetworkStack/tests/src/android/net/ip/IpClientTest.java b/packages/NetworkStack/tests/src/android/net/ip/IpClientTest.java
index aaaff02..bd488ea 100644
--- a/packages/NetworkStack/tests/src/android/net/ip/IpClientTest.java
+++ b/packages/NetworkStack/tests/src/android/net/ip/IpClientTest.java
@@ -34,6 +34,7 @@
 import static org.mockito.Mockito.when;
 
 import android.app.AlarmManager;
+import android.content.ContentResolver;
 import android.content.Context;
 import android.content.res.Resources;
 import android.net.ConnectivityManager;
@@ -46,13 +47,11 @@
 import android.net.shared.InitialConfiguration;
 import android.net.shared.ProvisioningConfiguration;
 import android.net.util.InterfaceParams;
-import android.provider.Settings;
-import android.support.test.filters.SmallTest;
-import android.support.test.runner.AndroidJUnit4;
-import android.test.mock.MockContentResolver;
+
+import androidx.test.filters.SmallTest;
+import androidx.test.runner.AndroidJUnit4;
 
 import com.android.internal.R;
-import com.android.internal.util.test.FakeSettingsProvider;
 import com.android.server.NetworkObserver;
 import com.android.server.NetworkObserverRegistry;
 
@@ -93,7 +92,7 @@
     @Mock private IIpClientCallbacks mCb;
     @Mock private AlarmManager mAlarm;
     @Mock private IpClient.Dependencies mDependencies;
-    private MockContentResolver mContentResolver;
+    @Mock private ContentResolver mContentResolver;
 
     private NetworkObserver mObserver;
     private InterfaceParams mIfParams;
@@ -108,9 +107,6 @@
         when(mDependencies.getNetd(any())).thenReturn(mNetd);
         when(mResources.getInteger(R.integer.config_networkAvoidBadWifi))
                 .thenReturn(DEFAULT_AVOIDBADWIFI_CONFIG_VALUE);
-
-        mContentResolver = new MockContentResolver();
-        mContentResolver.addProvider(Settings.AUTHORITY, new FakeSettingsProvider());
         when(mContext.getContentResolver()).thenReturn(mContentResolver);
 
         mIfParams = null;
diff --git a/packages/NetworkStack/tests/src/android/net/ip/IpReachabilityMonitorTest.java b/packages/NetworkStack/tests/src/android/net/ip/IpReachabilityMonitorTest.java
index e3b5ddf..64b168a 100644
--- a/packages/NetworkStack/tests/src/android/net/ip/IpReachabilityMonitorTest.java
+++ b/packages/NetworkStack/tests/src/android/net/ip/IpReachabilityMonitorTest.java
@@ -24,8 +24,9 @@
 import android.net.util.SharedLog;
 import android.os.Handler;
 import android.os.Looper;
-import android.support.test.filters.SmallTest;
-import android.support.test.runner.AndroidJUnit4;
+
+import androidx.test.filters.SmallTest;
+import androidx.test.runner.AndroidJUnit4;
 
 import org.junit.Before;
 import org.junit.Test;
@@ -33,7 +34,6 @@
 import org.mockito.Mock;
 import org.mockito.MockitoAnnotations;
 
-
 /**
  * Tests for IpReachabilityMonitor.
  */
diff --git a/packages/NetworkStack/tests/src/android/net/util/ConnectivityPacketSummaryTest.java b/packages/NetworkStack/tests/src/android/net/util/ConnectivityPacketSummaryTest.java
index dfaf52a..71be8b3 100644
--- a/packages/NetworkStack/tests/src/android/net/util/ConnectivityPacketSummaryTest.java
+++ b/packages/NetworkStack/tests/src/android/net/util/ConnectivityPacketSummaryTest.java
@@ -20,8 +20,9 @@
 import static org.junit.Assert.assertTrue;
 
 import android.net.MacAddress;
-import android.support.test.filters.SmallTest;
-import android.support.test.runner.AndroidJUnit4;
+
+import androidx.test.filters.SmallTest;
+import androidx.test.runner.AndroidJUnit4;
 
 import libcore.util.HexEncoding;
 
diff --git a/packages/NetworkStack/tests/src/android/net/util/PacketReaderTest.java b/packages/NetworkStack/tests/src/android/net/util/PacketReaderTest.java
index 6e11c40..289dcad 100644
--- a/packages/NetworkStack/tests/src/android/net/util/PacketReaderTest.java
+++ b/packages/NetworkStack/tests/src/android/net/util/PacketReaderTest.java
@@ -31,12 +31,13 @@
 
 import android.os.Handler;
 import android.os.HandlerThread;
-import android.support.test.filters.SmallTest;
-import android.support.test.runner.AndroidJUnit4;
 import android.system.ErrnoException;
 import android.system.Os;
 import android.system.StructTimeval;
 
+import androidx.test.filters.SmallTest;
+import androidx.test.runner.AndroidJUnit4;
+
 import org.junit.After;
 import org.junit.Before;
 import org.junit.Test;
diff --git a/packages/NetworkStack/tests/src/com/android/server/connectivity/NetworkMonitorTest.java b/packages/NetworkStack/tests/src/com/android/server/connectivity/NetworkMonitorTest.java
index ddb7030..34ca6ac 100644
--- a/packages/NetworkStack/tests/src/com/android/server/connectivity/NetworkMonitorTest.java
+++ b/packages/NetworkStack/tests/src/com/android/server/connectivity/NetworkMonitorTest.java
@@ -20,6 +20,7 @@
 import static android.net.INetworkMonitor.NETWORK_TEST_RESULT_INVALID;
 import static android.net.INetworkMonitor.NETWORK_TEST_RESULT_VALID;
 import static android.net.NetworkCapabilities.NET_CAPABILITY_INTERNET;
+import static android.provider.Settings.Global.DATA_STALL_EVALUATION_TYPE_DNS;
 
 import static junit.framework.Assert.assertEquals;
 import static junit.framework.Assert.assertFalse;
@@ -60,12 +61,13 @@
 import android.os.Handler;
 import android.os.SystemClock;
 import android.provider.Settings;
-import android.support.test.filters.SmallTest;
-import android.support.test.runner.AndroidJUnit4;
 import android.telephony.CellSignalStrength;
 import android.telephony.TelephonyManager;
 import android.util.ArrayMap;
 
+import androidx.test.filters.SmallTest;
+import androidx.test.runner.AndroidJUnit4;
+
 import org.junit.Before;
 import org.junit.Test;
 import org.junit.runner.RunWith;
@@ -82,7 +84,6 @@
 
 import javax.net.ssl.SSLHandshakeException;
 
-
 @RunWith(AndroidJUnit4.class)
 @SmallTest
 public class NetworkMonitorTest {
@@ -114,7 +115,6 @@
     private static final String TEST_OTHER_FALLBACK_URL = "http://otherfallback.google.com/gen_204";
     private static final String TEST_MCCMNC = "123456";
 
-    private static final int DATA_STALL_EVALUATION_TYPE_DNS = 1;
     private static final int RETURN_CODE_DNS_SUCCESS = 0;
     private static final int RETURN_CODE_DNS_TIMEOUT = 255;
     private static final int DEFAULT_DNS_TIMEOUT_THRESHOLD = 5;
@@ -186,7 +186,7 @@
         when(mCm.getNetworkCapabilities(any())).thenReturn(METERED_CAPABILITIES);
 
         setMinDataStallEvaluateInterval(500);
-        setDataStallEvaluationType(1 << DATA_STALL_EVALUATION_TYPE_DNS);
+        setDataStallEvaluationType(DATA_STALL_EVALUATION_TYPE_DNS);
         setValidDataStallDnsTimeThreshold(500);
         setConsecutiveDnsTimeoutThreshold(5);
     }
@@ -525,7 +525,7 @@
         wrappedMonitor.setLastProbeTime(SystemClock.elapsedRealtime() - 1000);
         makeDnsTimeoutEvent(wrappedMonitor, 5);
         assertTrue(wrappedMonitor.isDataStall());
-        verify(mDataStallStatsUtils, times(1)).write(any(), any());
+        verify(mDataStallStatsUtils, times(1)).write(makeEmptyDataStallDetectionStats(), any());
     }
 
     @Test
@@ -534,7 +534,7 @@
         wrappedMonitor.setLastProbeTime(SystemClock.elapsedRealtime() - 1000);
         makeDnsTimeoutEvent(wrappedMonitor, 3);
         assertFalse(wrappedMonitor.isDataStall());
-        verify(mDataStallStatsUtils, never()).write(any(), any());
+        verify(mDataStallStatsUtils, never()).write(makeEmptyDataStallDetectionStats(), any());
     }
 
     @Test
@@ -586,6 +586,10 @@
         }
     }
 
+    private DataStallDetectionStats makeEmptyDataStallDetectionStats() {
+        return new DataStallDetectionStats.Builder().build();
+    }
+
     private void setDataStallEvaluationType(int type) {
         when(mDependencies.getSetting(any(),
             eq(Settings.Global.DATA_STALL_EVALUATION_TYPE), anyInt())).thenReturn(type);
diff --git a/packages/NetworkStack/tests/src/com/android/server/util/SharedLogTest.java b/packages/NetworkStack/tests/src/com/android/server/util/SharedLogTest.java
index 07ad3123..b1db051 100644
--- a/packages/NetworkStack/tests/src/com/android/server/util/SharedLogTest.java
+++ b/packages/NetworkStack/tests/src/com/android/server/util/SharedLogTest.java
@@ -20,8 +20,9 @@
 import static org.junit.Assert.assertTrue;
 
 import android.net.util.SharedLog;
-import android.support.test.filters.SmallTest;
-import android.support.test.runner.AndroidJUnit4;
+
+import androidx.test.filters.SmallTest;
+import androidx.test.runner.AndroidJUnit4;
 
 import org.junit.Test;
 import org.junit.runner.RunWith;
diff --git a/packages/NetworkStackPermissionStub/Android.bp b/packages/NetworkStackPermissionStub/Android.bp
index dd70cf5..8cee92e 100644
--- a/packages/NetworkStackPermissionStub/Android.bp
+++ b/packages/NetworkStackPermissionStub/Android.bp
@@ -21,6 +21,7 @@
     // a classes.dex.
     srcs: ["src/**/*.java"],
     platform_apis: true,
+    min_sdk_version: "28",
     certificate: "networkstack",
     privileged: true,
     manifest: "AndroidManifest.xml",
diff --git a/packages/NetworkStackPermissionStub/AndroidManifest.xml b/packages/NetworkStackPermissionStub/AndroidManifest.xml
index a8742d7..e83f050 100644
--- a/packages/NetworkStackPermissionStub/AndroidManifest.xml
+++ b/packages/NetworkStackPermissionStub/AndroidManifest.xml
@@ -18,7 +18,10 @@
 -->
 <manifest xmlns:android="http://schemas.android.com/apk/res/android"
     package="com.android.networkstack.permissionstub"
-    android:sharedUserId="android.uid.networkstack">
+    android:sharedUserId="android.uid.networkstack"
+    android:versionCode="11"
+    android:versionName="Q-initial">
+    <uses-sdk android:minSdkVersion="28" android:targetSdkVersion="28" />
     <!--
     This package only exists to define the below permissions, and enforce that they are only
     granted to apps sharing the same signature.
@@ -34,4 +37,4 @@
                 android:protectionLevel="signature"/>
 
     <application android:name="com.android.server.NetworkStackPermissionStub"/>
-</manifest>
\ No newline at end of file
+</manifest>
diff --git a/packages/SettingsLib/BarChartPreference/src/com/android/settingslib/widget/BarView.java b/packages/SettingsLib/BarChartPreference/src/com/android/settingslib/widget/BarView.java
index 3ef0235..03dfd3e 100644
--- a/packages/SettingsLib/BarChartPreference/src/com/android/settingslib/widget/BarView.java
+++ b/packages/SettingsLib/BarChartPreference/src/com/android/settingslib/widget/BarView.java
@@ -74,6 +74,7 @@
         // For now, we use the bar number as title.
         mBarTitle.setText(Integer.toString(barViewInfo.getHeight()));
         mBarSummary.setText(barViewInfo.getSummary());
+        mIcon.setContentDescription(barViewInfo.getContentDescription());
     }
 
     @VisibleForTesting
diff --git a/packages/SettingsLib/BarChartPreference/src/com/android/settingslib/widget/BarViewInfo.java b/packages/SettingsLib/BarChartPreference/src/com/android/settingslib/widget/BarViewInfo.java
index 409f9ea..1ef36a2 100644
--- a/packages/SettingsLib/BarChartPreference/src/com/android/settingslib/widget/BarViewInfo.java
+++ b/packages/SettingsLib/BarChartPreference/src/com/android/settingslib/widget/BarViewInfo.java
@@ -34,6 +34,7 @@
     private View.OnClickListener mClickListener;
     @StringRes
     private int mSummary;
+    private @Nullable CharSequence mContentDescription;
     // A number indicates this bar's height. The larger number shows a higher bar view.
     private int mHeight;
     // A real height of bar view.
@@ -45,11 +46,14 @@
      * @param icon      The icon of bar view.
      * @param barHeight The height of bar view. Larger number shows a higher bar view.
      * @param summary   The string resource id for summary.
+     * @param contentDescription Optional text that briefly describes the contents of the icon.
      */
-    public BarViewInfo(Drawable icon, @IntRange(from = 0) int barHeight, @StringRes int summary) {
+    public BarViewInfo(Drawable icon, @IntRange(from = 0) int barHeight, @StringRes int summary,
+            @Nullable CharSequence contentDescription) {
         mIcon = icon;
         mHeight = barHeight;
         mSummary = summary;
+        mContentDescription = contentDescription;
     }
 
     /**
@@ -91,6 +95,10 @@
         return mSummary;
     }
 
+    public @Nullable CharSequence getContentDescription() {
+        return mContentDescription;
+    }
+
     void setNormalizedHeight(@IntRange(from = 0) int barHeight) {
         mNormalizedHeight = barHeight;
     }
diff --git a/packages/SystemUI/res/drawable/ic_volume_remote.xml b/packages/SettingsLib/res/drawable/ic_volume_remote.xml
similarity index 100%
rename from packages/SystemUI/res/drawable/ic_volume_remote.xml
rename to packages/SettingsLib/res/drawable/ic_volume_remote.xml
diff --git a/packages/SystemUI/res/drawable/ic_volume_remote_mute.xml b/packages/SettingsLib/res/drawable/ic_volume_remote_mute.xml
similarity index 100%
rename from packages/SystemUI/res/drawable/ic_volume_remote_mute.xml
rename to packages/SettingsLib/res/drawable/ic_volume_remote_mute.xml
diff --git a/packages/SettingsLib/res/values-af/strings.xml b/packages/SettingsLib/res/values-af/strings.xml
index cfc76b7..835fcc2 100644
--- a/packages/SettingsLib/res/values-af/strings.xml
+++ b/packages/SettingsLib/res/values-af/strings.xml
@@ -377,7 +377,8 @@
     <string name="power_discharging_duration" msgid="8848256785736335185">"Ongeveer <xliff:g id="TIME_REMAINING">%1$s</xliff:g> oor (<xliff:g id="LEVEL">%2$s</xliff:g>)"</string>
     <string name="power_remaining_duration_only_enhanced" msgid="4189311599812296592">"Ongeveer <xliff:g id="TIME_REMAINING">%1$s</xliff:g> oor gegrond op jou gebruik"</string>
     <string name="power_discharging_duration_enhanced" msgid="1992003260664804080">"Ongeveer <xliff:g id="TIME_REMAINING">%1$s</xliff:g> oor gegrond op jou gebruik (<xliff:g id="LEVEL">%2$s</xliff:g>)"</string>
-    <string name="power_remaining_duration_only_short" msgid="3463575350656389957">"<xliff:g id="TIME_REMAINING">%1$s</xliff:g> oor"</string>
+    <!-- no translation found for power_remaining_duration_only_short (9183070574408359726) -->
+    <skip />
     <string name="power_discharge_by_enhanced" msgid="2095821536747992464">"Sal op grond van jou gebruik waarskynlik hou tot omtrent <xliff:g id="TIME">%1$s</xliff:g> (<xliff:g id="LEVEL">%2$s</xliff:g>)"</string>
     <string name="power_discharge_by_only_enhanced" msgid="2175151772952365149">"Sal op grond van jou gebruik waarskynlik hou tot omtrent <xliff:g id="TIME">%1$s</xliff:g>"</string>
     <string name="power_discharge_by" msgid="6453537733650125582">"Sal waarskynlik hou tot omtrent <xliff:g id="TIME">%1$s</xliff:g> (<xliff:g id="LEVEL">%2$s</xliff:g>)"</string>
diff --git a/packages/SettingsLib/res/values-am/strings.xml b/packages/SettingsLib/res/values-am/strings.xml
index 6e6d58f..11dde97 100644
--- a/packages/SettingsLib/res/values-am/strings.xml
+++ b/packages/SettingsLib/res/values-am/strings.xml
@@ -377,7 +377,8 @@
     <string name="power_discharging_duration" msgid="8848256785736335185">"<xliff:g id="TIME_REMAINING">%1$s</xliff:g> (<xliff:g id="LEVEL">%2$s</xliff:g>) ገደማ ቀርቷል"</string>
     <string name="power_remaining_duration_only_enhanced" msgid="4189311599812296592">"በአጠቃቀምዎ መሠረት <xliff:g id="TIME_REMAINING">%1$s</xliff:g> ገደማ ቀርቷል"</string>
     <string name="power_discharging_duration_enhanced" msgid="1992003260664804080">"በአጠቃቀምዎ መሠረት <xliff:g id="TIME_REMAINING">%1$s</xliff:g> (<xliff:g id="LEVEL">%2$s</xliff:g>) ገደማ ቀርቷል"</string>
-    <string name="power_remaining_duration_only_short" msgid="3463575350656389957">"<xliff:g id="TIME_REMAINING">%1$s</xliff:g> ቀርቷል"</string>
+    <!-- no translation found for power_remaining_duration_only_short (9183070574408359726) -->
+    <skip />
     <string name="power_discharge_by_enhanced" msgid="2095821536747992464">"በአጠቃቀምዎ (<xliff:g id="LEVEL">%2$s</xliff:g>) መሠረት እስከ <xliff:g id="TIME">%1$s</xliff:g> ገደማ መቆየት አለበት"</string>
     <string name="power_discharge_by_only_enhanced" msgid="2175151772952365149">"በአጠቃቀምዎ መሠረት እስከ <xliff:g id="TIME">%1$s</xliff:g> ገደማ መቆየት አለበት"</string>
     <string name="power_discharge_by" msgid="6453537733650125582">"እስከ <xliff:g id="TIME">%1$s</xliff:g> (<xliff:g id="LEVEL">%2$s</xliff:g>) ገደማ ድረስ መቆየት አለበት"</string>
diff --git a/packages/SettingsLib/res/values-ar/strings.xml b/packages/SettingsLib/res/values-ar/strings.xml
index 18d47ac..10d4ee5 100644
--- a/packages/SettingsLib/res/values-ar/strings.xml
+++ b/packages/SettingsLib/res/values-ar/strings.xml
@@ -377,7 +377,8 @@
     <string name="power_discharging_duration" msgid="8848256785736335185">"يتبقى <xliff:g id="TIME_REMAINING">%1$s</xliff:g> تقريبًا (<xliff:g id="LEVEL">%2$s</xliff:g>)"</string>
     <string name="power_remaining_duration_only_enhanced" msgid="4189311599812296592">"يتبقى <xliff:g id="TIME_REMAINING">%1$s</xliff:g> تقريبًا، بناءً على استخدامك"</string>
     <string name="power_discharging_duration_enhanced" msgid="1992003260664804080">"يتبقى <xliff:g id="TIME_REMAINING">%1$s</xliff:g> تقريبًا، بناءً على استخدامك (<xliff:g id="LEVEL">%2$s</xliff:g>)"</string>
-    <string name="power_remaining_duration_only_short" msgid="3463575350656389957">"الوقت المتبقي: <xliff:g id="TIME_REMAINING">%1$s</xliff:g>"</string>
+    <!-- no translation found for power_remaining_duration_only_short (9183070574408359726) -->
+    <skip />
     <string name="power_discharge_by_enhanced" msgid="2095821536747992464">"قد تكفي طاقة البطارية حتى حوالي الساعة <xliff:g id="TIME">%1$s</xliff:g> حسب استخدامك (<xliff:g id="LEVEL">%2$s</xliff:g>)."</string>
     <string name="power_discharge_by_only_enhanced" msgid="2175151772952365149">"قد تكفي طاقة البطارية حتى حوالي الساعة <xliff:g id="TIME">%1$s</xliff:g> حسب استخدامك."</string>
     <string name="power_discharge_by" msgid="6453537733650125582">"قد تكفي طاقة البطارية حتى حوالي الساعة <xliff:g id="TIME">%1$s</xliff:g> (<xliff:g id="LEVEL">%2$s</xliff:g>)."</string>
diff --git a/packages/SettingsLib/res/values-as/strings.xml b/packages/SettingsLib/res/values-as/strings.xml
index 68f1e6f..dee399e 100644
--- a/packages/SettingsLib/res/values-as/strings.xml
+++ b/packages/SettingsLib/res/values-as/strings.xml
@@ -377,7 +377,8 @@
     <string name="power_discharging_duration" msgid="8848256785736335185">"প্রায় <xliff:g id="TIME_REMAINING">%1$s</xliff:g> বাকী আছে (<xliff:g id="LEVEL">%2$s</xliff:g>)"</string>
     <string name="power_remaining_duration_only_enhanced" msgid="4189311599812296592">"আপোনাৰ ব্যৱহাৰৰ ওপৰত ভিত্তি কৰি প্ৰায় <xliff:g id="TIME_REMAINING">%1$s</xliff:g> বাকী আছে"</string>
     <string name="power_discharging_duration_enhanced" msgid="1992003260664804080">"আপোনাৰ ব্যৱহাৰৰ ওপৰত ভিত্তি কৰি প্রায় <xliff:g id="TIME_REMAINING">%1$s</xliff:g> বাকী আছে (<xliff:g id="LEVEL">%2$s</xliff:g>)"</string>
-    <string name="power_remaining_duration_only_short" msgid="3463575350656389957">"<xliff:g id="TIME_REMAINING">%1$s</xliff:g> বাকী আছে"</string>
+    <!-- no translation found for power_remaining_duration_only_short (9183070574408359726) -->
+    <skip />
     <string name="power_discharge_by_enhanced" msgid="2095821536747992464">"আপোনাৰ ব্যৱহাৰৰ ওপৰত ভিত্তি কৰি বেটাৰি আনুমানিকভাৱে <xliff:g id="TIME">%1$s</xliff:g> লৈকে চলিব (<xliff:g id="LEVEL">%2$s</xliff:g>)"</string>
     <string name="power_discharge_by_only_enhanced" msgid="2175151772952365149">"আপোনাৰ ব্যৱহাৰৰ ওপৰত ভিত্তি কৰি বেটাৰি আনুমানিকভাৱে <xliff:g id="TIME">%1$s</xliff:g> লৈকে চলিব"</string>
     <string name="power_discharge_by" msgid="6453537733650125582">"বেটাৰি আনুমানিকভাৱে <xliff:g id="TIME">%1$s</xliff:g> লৈকে চলিব (<xliff:g id="LEVEL">%2$s</xliff:g>)"</string>
diff --git a/packages/SettingsLib/res/values-az/strings.xml b/packages/SettingsLib/res/values-az/strings.xml
index 8e6e07d..73e3d51 100644
--- a/packages/SettingsLib/res/values-az/strings.xml
+++ b/packages/SettingsLib/res/values-az/strings.xml
@@ -377,7 +377,8 @@
     <string name="power_discharging_duration" msgid="8848256785736335185">"Təxminən <xliff:g id="TIME_REMAINING">%1$s</xliff:g> qalıb (<xliff:g id="LEVEL">%2$s</xliff:g>)"</string>
     <string name="power_remaining_duration_only_enhanced" msgid="4189311599812296592">"İstifadəyə əsasən təxminən <xliff:g id="TIME_REMAINING">%1$s</xliff:g> qalıb"</string>
     <string name="power_discharging_duration_enhanced" msgid="1992003260664804080">"İstifadəyə əsasən təxminən <xliff:g id="TIME_REMAINING">%1$s</xliff:g> qalıb (<xliff:g id="LEVEL">%2$s</xliff:g>)"</string>
-    <string name="power_remaining_duration_only_short" msgid="3463575350656389957">"<xliff:g id="TIME_REMAINING">%1$s</xliff:g> qalıb"</string>
+    <!-- no translation found for power_remaining_duration_only_short (9183070574408359726) -->
+    <skip />
     <string name="power_discharge_by_enhanced" msgid="2095821536747992464">"İstifadəyə (<xliff:g id="LEVEL">%2$s</xliff:g>) əsasən təxminən <xliff:g id="TIME">%1$s</xliff:g> olana qədər davam edəcək"</string>
     <string name="power_discharge_by_only_enhanced" msgid="2175151772952365149">"İstifadəyə əsasən təxminən <xliff:g id="TIME">%1$s</xliff:g> olana qədər davam edəcək"</string>
     <string name="power_discharge_by" msgid="6453537733650125582">"Təxminən <xliff:g id="TIME">%1$s</xliff:g> olana qədər davam edəcək (<xliff:g id="LEVEL">%2$s</xliff:g>)"</string>
diff --git a/packages/SettingsLib/res/values-b+sr+Latn/strings.xml b/packages/SettingsLib/res/values-b+sr+Latn/strings.xml
index 1cdd1fd..47b536c 100644
--- a/packages/SettingsLib/res/values-b+sr+Latn/strings.xml
+++ b/packages/SettingsLib/res/values-b+sr+Latn/strings.xml
@@ -377,7 +377,8 @@
     <string name="power_discharging_duration" msgid="8848256785736335185">"Preostalo je oko <xliff:g id="TIME_REMAINING">%1$s</xliff:g> (<xliff:g id="LEVEL">%2$s</xliff:g>)"</string>
     <string name="power_remaining_duration_only_enhanced" msgid="4189311599812296592">"Preostalo je oko <xliff:g id="TIME_REMAINING">%1$s</xliff:g> na osnovu korišćenja"</string>
     <string name="power_discharging_duration_enhanced" msgid="1992003260664804080">"Preostalo je oko <xliff:g id="TIME_REMAINING">%1$s</xliff:g> na osnovu korišćenja (<xliff:g id="LEVEL">%2$s</xliff:g>)"</string>
-    <string name="power_remaining_duration_only_short" msgid="3463575350656389957">"Još <xliff:g id="TIME_REMAINING">%1$s</xliff:g>"</string>
+    <!-- no translation found for power_remaining_duration_only_short (9183070574408359726) -->
+    <skip />
     <string name="power_discharge_by_enhanced" msgid="2095821536747992464">"Trajaće približno do <xliff:g id="TIME">%1$s</xliff:g> na osnovu korišćenja (<xliff:g id="LEVEL">%2$s</xliff:g>)"</string>
     <string name="power_discharge_by_only_enhanced" msgid="2175151772952365149">"Trajaće približno do <xliff:g id="TIME">%1$s</xliff:g> na osnovu korišćenja"</string>
     <string name="power_discharge_by" msgid="6453537733650125582">"Trajaće približno do <xliff:g id="TIME">%1$s</xliff:g> (<xliff:g id="LEVEL">%2$s</xliff:g>)"</string>
diff --git a/packages/SettingsLib/res/values-be/strings.xml b/packages/SettingsLib/res/values-be/strings.xml
index 1a60c3d..ee662fa 100644
--- a/packages/SettingsLib/res/values-be/strings.xml
+++ b/packages/SettingsLib/res/values-be/strings.xml
@@ -377,7 +377,8 @@
     <string name="power_discharging_duration" msgid="8848256785736335185">"Зараду (<xliff:g id="LEVEL">%2$s</xliff:g>) хопіць прыблізна на <xliff:g id="TIME_REMAINING">%1$s</xliff:g>"</string>
     <string name="power_remaining_duration_only_enhanced" msgid="4189311599812296592">"Зараду пры такім выкарыстанні хопіць прыблізна на <xliff:g id="TIME_REMAINING">%1$s</xliff:g>"</string>
     <string name="power_discharging_duration_enhanced" msgid="1992003260664804080">"Зараду (<xliff:g id="LEVEL">%2$s</xliff:g>) пры такім выкарыстанні хопіць прыблізна на <xliff:g id="TIME_REMAINING">%1$s</xliff:g>"</string>
-    <string name="power_remaining_duration_only_short" msgid="3463575350656389957">"Хопіць на <xliff:g id="TIME_REMAINING">%1$s</xliff:g>"</string>
+    <!-- no translation found for power_remaining_duration_only_short (9183070574408359726) -->
+    <skip />
     <string name="power_discharge_by_enhanced" msgid="2095821536747992464">"Зараду (<xliff:g id="LEVEL">%2$s</xliff:g>) хопіць прыблізна да <xliff:g id="TIME">%1$s</xliff:g> пры цяперашнім узроўні выкарыстання"</string>
     <string name="power_discharge_by_only_enhanced" msgid="2175151772952365149">"Зараду хопіць прыблізна да <xliff:g id="TIME">%1$s</xliff:g> пры цяперашнім узроўні выкарыстання"</string>
     <string name="power_discharge_by" msgid="6453537733650125582">"Зараду (<xliff:g id="LEVEL">%2$s</xliff:g>) хопіць прыблізна да <xliff:g id="TIME">%1$s</xliff:g>"</string>
diff --git a/packages/SettingsLib/res/values-bg/strings.xml b/packages/SettingsLib/res/values-bg/strings.xml
index aaedce4..4e4ac9b 100644
--- a/packages/SettingsLib/res/values-bg/strings.xml
+++ b/packages/SettingsLib/res/values-bg/strings.xml
@@ -377,7 +377,8 @@
     <string name="power_discharging_duration" msgid="8848256785736335185">"Още около <xliff:g id="TIME_REMAINING">%1$s</xliff:g> (<xliff:g id="LEVEL">%2$s</xliff:g>)"</string>
     <string name="power_remaining_duration_only_enhanced" msgid="4189311599812296592">"Още около <xliff:g id="TIME_REMAINING">%1$s</xliff:g> въз основа на използването"</string>
     <string name="power_discharging_duration_enhanced" msgid="1992003260664804080">"Още около <xliff:g id="TIME_REMAINING">%1$s</xliff:g> въз основа на използването (<xliff:g id="LEVEL">%2$s</xliff:g>)"</string>
-    <string name="power_remaining_duration_only_short" msgid="3463575350656389957">"Още <xliff:g id="TIME_REMAINING">%1$s</xliff:g>"</string>
+    <!-- no translation found for power_remaining_duration_only_short (9183070574408359726) -->
+    <skip />
     <string name="power_discharge_by_enhanced" msgid="2095821536747992464">"Следва да издържи приблизително до <xliff:g id="TIME">%1$s</xliff:g> въз основа на използването (<xliff:g id="LEVEL">%2$s</xliff:g>)"</string>
     <string name="power_discharge_by_only_enhanced" msgid="2175151772952365149">"Следва да издържи приблизително до <xliff:g id="TIME">%1$s</xliff:g> въз основа на използването"</string>
     <string name="power_discharge_by" msgid="6453537733650125582">"Следва да издържи приблизително до <xliff:g id="TIME">%1$s</xliff:g> (<xliff:g id="LEVEL">%2$s</xliff:g>)"</string>
diff --git a/packages/SettingsLib/res/values-bn/strings.xml b/packages/SettingsLib/res/values-bn/strings.xml
index 4f29131..c7d1c0a 100644
--- a/packages/SettingsLib/res/values-bn/strings.xml
+++ b/packages/SettingsLib/res/values-bn/strings.xml
@@ -377,7 +377,8 @@
     <string name="power_discharging_duration" msgid="8848256785736335185">"আর আনুমানিক <xliff:g id="TIME_REMAINING">%1$s</xliff:g> চলবে (<xliff:g id="LEVEL">%2$s</xliff:g>)"</string>
     <string name="power_remaining_duration_only_enhanced" msgid="4189311599812296592">"ব্যবহারের উপর ভিত্তি করে আর আনুমানিক <xliff:g id="TIME_REMAINING">%1$s</xliff:g> চলবে"</string>
     <string name="power_discharging_duration_enhanced" msgid="1992003260664804080">"ব্যবহারের উপর ভিত্তি করে আর আনুমানিক <xliff:g id="TIME_REMAINING">%1$s</xliff:g> চলবে (<xliff:g id="LEVEL">%2$s</xliff:g>)"</string>
-    <string name="power_remaining_duration_only_short" msgid="3463575350656389957">"আর <xliff:g id="TIME_REMAINING">%1$s</xliff:g> চলবে"</string>
+    <!-- no translation found for power_remaining_duration_only_short (9183070574408359726) -->
+    <skip />
     <string name="power_discharge_by_enhanced" msgid="2095821536747992464">"বর্তমান ব্যবহার অনুযায়ী আনুমানিক <xliff:g id="TIME">%1$s</xliff:g> পর্যন্ত চলবে (<xliff:g id="LEVEL">%2$s</xliff:g>)"</string>
     <string name="power_discharge_by_only_enhanced" msgid="2175151772952365149">"বর্তমান ব্যবহার অনুযায়ী আনুমানিক <xliff:g id="TIME">%1$s</xliff:g> পর্যন্ত চলবে"</string>
     <string name="power_discharge_by" msgid="6453537733650125582">"আনুমানিক <xliff:g id="TIME">%1$s</xliff:g> পর্যন্ত চলবে (<xliff:g id="LEVEL">%2$s</xliff:g>)"</string>
diff --git a/packages/SettingsLib/res/values-bs/strings.xml b/packages/SettingsLib/res/values-bs/strings.xml
index 4193d52..d5d13d1 100644
--- a/packages/SettingsLib/res/values-bs/strings.xml
+++ b/packages/SettingsLib/res/values-bs/strings.xml
@@ -377,7 +377,8 @@
     <string name="power_discharging_duration" msgid="8848256785736335185">"Preostalo je još oko <xliff:g id="TIME_REMAINING">%1$s</xliff:g> (<xliff:g id="LEVEL">%2$s</xliff:g>)"</string>
     <string name="power_remaining_duration_only_enhanced" msgid="4189311599812296592">"Preostalo je još oko <xliff:g id="TIME_REMAINING">%1$s</xliff:g> na osnovu vaše potrošnje"</string>
     <string name="power_discharging_duration_enhanced" msgid="1992003260664804080">"Preostalo je još oko <xliff:g id="TIME_REMAINING">%1$s</xliff:g> na osnovu vaše potrošnje (<xliff:g id="LEVEL">%2$s</xliff:g>)"</string>
-    <string name="power_remaining_duration_only_short" msgid="3463575350656389957">"Još <xliff:g id="TIME_REMAINING">%1$s</xliff:g>"</string>
+    <!-- no translation found for power_remaining_duration_only_short (9183070574408359726) -->
+    <skip />
     <string name="power_discharge_by_enhanced" msgid="2095821536747992464">"Trebala bi trajati otprilike do <xliff:g id="TIME">%1$s</xliff:g> na osnovu vaše upotrebe (<xliff:g id="LEVEL">%2$s</xliff:g>)"</string>
     <string name="power_discharge_by_only_enhanced" msgid="2175151772952365149">"Trebala bi trajati otprilike do <xliff:g id="TIME">%1$s</xliff:g> na osnovu vaše upotrebe"</string>
     <string name="power_discharge_by" msgid="6453537733650125582">"Trebala bi trajati do otprilike <xliff:g id="TIME">%1$s</xliff:g> (<xliff:g id="LEVEL">%2$s</xliff:g>)"</string>
diff --git a/packages/SettingsLib/res/values-ca/strings.xml b/packages/SettingsLib/res/values-ca/strings.xml
index 9c3e4d9..c000a3c 100644
--- a/packages/SettingsLib/res/values-ca/strings.xml
+++ b/packages/SettingsLib/res/values-ca/strings.xml
@@ -377,7 +377,8 @@
     <string name="power_discharging_duration" msgid="8848256785736335185">"Temps restant aproximat: <xliff:g id="TIME_REMAINING">%1$s</xliff:g> (<xliff:g id="LEVEL">%2$s</xliff:g>)"</string>
     <string name="power_remaining_duration_only_enhanced" msgid="4189311599812296592">"Temps restant aproximat segons l\'ús que en fas: <xliff:g id="TIME_REMAINING">%1$s</xliff:g>"</string>
     <string name="power_discharging_duration_enhanced" msgid="1992003260664804080">"Temps restant aproximat segons l\'ús que en fas: <xliff:g id="TIME_REMAINING">%1$s</xliff:g> (<xliff:g id="LEVEL">%2$s</xliff:g>)"</string>
-    <string name="power_remaining_duration_only_short" msgid="3463575350656389957">"Temps restant: <xliff:g id="TIME_REMAINING">%1$s</xliff:g>"</string>
+    <!-- no translation found for power_remaining_duration_only_short (9183070574408359726) -->
+    <skip />
     <string name="power_discharge_by_enhanced" msgid="2095821536747992464">"La bateria hauria de durar aproximadament fins a les <xliff:g id="TIME">%1$s</xliff:g> segons l\'ús que en fas (<xliff:g id="LEVEL">%2$s</xliff:g>)"</string>
     <string name="power_discharge_by_only_enhanced" msgid="2175151772952365149">"La bateria hauria de durar aproximadament fins a les <xliff:g id="TIME">%1$s</xliff:g> segons l\'ús que en fas"</string>
     <string name="power_discharge_by" msgid="6453537733650125582">"La bateria hauria de durar aproximadament fins a les <xliff:g id="TIME">%1$s</xliff:g> (<xliff:g id="LEVEL">%2$s</xliff:g>)"</string>
diff --git a/packages/SettingsLib/res/values-cs/strings.xml b/packages/SettingsLib/res/values-cs/strings.xml
index b6507bc..37b7c51 100644
--- a/packages/SettingsLib/res/values-cs/strings.xml
+++ b/packages/SettingsLib/res/values-cs/strings.xml
@@ -377,7 +377,8 @@
     <string name="power_discharging_duration" msgid="8848256785736335185">"Zbývá asi <xliff:g id="TIME_REMAINING">%1$s</xliff:g> (<xliff:g id="LEVEL">%2$s</xliff:g>)"</string>
     <string name="power_remaining_duration_only_enhanced" msgid="4189311599812296592">"Při vašem obvyklém využití zbývá asi <xliff:g id="TIME_REMAINING">%1$s</xliff:g>"</string>
     <string name="power_discharging_duration_enhanced" msgid="1992003260664804080">"Při vašem obvyklém využití (<xliff:g id="LEVEL">%2$s</xliff:g>) zbývá asi <xliff:g id="TIME_REMAINING">%1$s</xliff:g>"</string>
-    <string name="power_remaining_duration_only_short" msgid="3463575350656389957">"Zbývá <xliff:g id="TIME_REMAINING">%1$s</xliff:g>"</string>
+    <!-- no translation found for power_remaining_duration_only_short (9183070574408359726) -->
+    <skip />
     <string name="power_discharge_by_enhanced" msgid="2095821536747992464">"Při vašem obvyklém využití (<xliff:g id="LEVEL">%2$s</xliff:g>) vydrží asi do <xliff:g id="TIME">%1$s</xliff:g>"</string>
     <string name="power_discharge_by_only_enhanced" msgid="2175151772952365149">"Při vašem obvyklém využití vydrží asi do <xliff:g id="TIME">%1$s</xliff:g>"</string>
     <string name="power_discharge_by" msgid="6453537733650125582">"Vydrží asi do <xliff:g id="TIME">%1$s</xliff:g> (<xliff:g id="LEVEL">%2$s</xliff:g>)"</string>
diff --git a/packages/SettingsLib/res/values-da/strings.xml b/packages/SettingsLib/res/values-da/strings.xml
index a870cf8..628df26 100644
--- a/packages/SettingsLib/res/values-da/strings.xml
+++ b/packages/SettingsLib/res/values-da/strings.xml
@@ -377,7 +377,8 @@
     <string name="power_discharging_duration" msgid="8848256785736335185">"Ca. <xliff:g id="TIME_REMAINING">%1$s</xliff:g> tilbage (<xliff:g id="LEVEL">%2$s</xliff:g>)"</string>
     <string name="power_remaining_duration_only_enhanced" msgid="4189311599812296592">"Ca. <xliff:g id="TIME_REMAINING">%1$s</xliff:g> tilbage, alt efter hvordan du bruger enheden"</string>
     <string name="power_discharging_duration_enhanced" msgid="1992003260664804080">"Ca. <xliff:g id="TIME_REMAINING">%1$s</xliff:g> tilbage, alt efter hvordan du bruger enheden (<xliff:g id="LEVEL">%2$s</xliff:g>)"</string>
-    <string name="power_remaining_duration_only_short" msgid="3463575350656389957">"<xliff:g id="TIME_REMAINING">%1$s</xliff:g> tilbage"</string>
+    <!-- no translation found for power_remaining_duration_only_short (9183070574408359726) -->
+    <skip />
     <string name="power_discharge_by_enhanced" msgid="2095821536747992464">"Bør holde indtil ca. <xliff:g id="TIME">%1$s</xliff:g> baseret på dit forbrug (<xliff:g id="LEVEL">%2$s</xliff:g>)"</string>
     <string name="power_discharge_by_only_enhanced" msgid="2175151772952365149">"Bør holde indtil ca. <xliff:g id="TIME">%1$s</xliff:g> baseret på dit forbrug"</string>
     <string name="power_discharge_by" msgid="6453537733650125582">"Bør holde indtil ca. <xliff:g id="TIME">%1$s</xliff:g> (<xliff:g id="LEVEL">%2$s</xliff:g>)"</string>
diff --git a/packages/SettingsLib/res/values-de/strings.xml b/packages/SettingsLib/res/values-de/strings.xml
index c1d502e..7b63f34 100644
--- a/packages/SettingsLib/res/values-de/strings.xml
+++ b/packages/SettingsLib/res/values-de/strings.xml
@@ -209,7 +209,7 @@
     <string name="oem_unlock_enable" msgid="6040763321967327691">"OEM-Entsperrung"</string>
     <string name="oem_unlock_enable_summary" msgid="4720281828891618376">"Bootloader-Entsperrung zulassen"</string>
     <string name="confirm_enable_oem_unlock_title" msgid="4802157344812385674">"OEM-Entsperrung zulassen?"</string>
-    <string name="confirm_enable_oem_unlock_text" msgid="5517144575601647022">"Achtung: Die Geräteschutzfunktionen funktionieren auf diesem Gerät nicht, solange diese Einstellung aktiviert ist."</string>
+    <string name="confirm_enable_oem_unlock_text" msgid="5517144575601647022">"Achtung: Der Geräteschutz funktioniert auf diesem Gerät nicht, solange diese Einstellung aktiviert ist."</string>
     <string name="mock_location_app" msgid="7966220972812881854">"App für simulierte Standorte auswählen"</string>
     <string name="mock_location_app_not_set" msgid="809543285495344223">"Keine App für simulierte Standorte eingerichtet"</string>
     <string name="mock_location_app_set" msgid="8966420655295102685">"App für simulierte Standorte: <xliff:g id="APP_NAME">%1$s</xliff:g>"</string>
@@ -377,7 +377,8 @@
     <string name="power_discharging_duration" msgid="8848256785736335185">"Noch etwa <xliff:g id="TIME_REMAINING">%1$s</xliff:g> (<xliff:g id="LEVEL">%2$s</xliff:g>)"</string>
     <string name="power_remaining_duration_only_enhanced" msgid="4189311599812296592">"Noch etwa <xliff:g id="TIME_REMAINING">%1$s</xliff:g>, basierend auf deiner Nutzung"</string>
     <string name="power_discharging_duration_enhanced" msgid="1992003260664804080">"Noch etwa <xliff:g id="TIME_REMAINING">%1$s</xliff:g>, basierend auf deiner Nutzung (<xliff:g id="LEVEL">%2$s</xliff:g>)"</string>
-    <string name="power_remaining_duration_only_short" msgid="3463575350656389957">"Noch <xliff:g id="TIME_REMAINING">%1$s</xliff:g>"</string>
+    <!-- no translation found for power_remaining_duration_only_short (9183070574408359726) -->
+    <skip />
     <string name="power_discharge_by_enhanced" msgid="2095821536747992464">"Sollte basierend auf deiner Nutzung etwa bis <xliff:g id="TIME">%1$s</xliff:g> reichen (<xliff:g id="LEVEL">%2$s</xliff:g>)"</string>
     <string name="power_discharge_by_only_enhanced" msgid="2175151772952365149">"Sollte basierend auf deiner Nutzung etwa bis <xliff:g id="TIME">%1$s</xliff:g> reichen"</string>
     <string name="power_discharge_by" msgid="6453537733650125582">"Sollte etwa bis <xliff:g id="TIME">%1$s</xliff:g> reichen (<xliff:g id="LEVEL">%2$s</xliff:g>)"</string>
diff --git a/packages/SettingsLib/res/values-el/strings.xml b/packages/SettingsLib/res/values-el/strings.xml
index 22c1b26..7ddd3fc 100644
--- a/packages/SettingsLib/res/values-el/strings.xml
+++ b/packages/SettingsLib/res/values-el/strings.xml
@@ -377,7 +377,8 @@
     <string name="power_discharging_duration" msgid="8848256785736335185">"Απομένει/ουν περίπου <xliff:g id="TIME_REMAINING">%1$s</xliff:g> (<xliff:g id="LEVEL">%2$s</xliff:g>)"</string>
     <string name="power_remaining_duration_only_enhanced" msgid="4189311599812296592">"Απομένει/ουν περίπου <xliff:g id="TIME_REMAINING">%1$s</xliff:g>, βάσει της χρήσης σας"</string>
     <string name="power_discharging_duration_enhanced" msgid="1992003260664804080">"Απομένει/ουν περίπου <xliff:g id="TIME_REMAINING">%1$s</xliff:g>, βάσει της χρήσης σας (<xliff:g id="LEVEL">%2$s</xliff:g>)"</string>
-    <string name="power_remaining_duration_only_short" msgid="3463575350656389957">"Απομένει/ουν <xliff:g id="TIME_REMAINING">%1$s</xliff:g>"</string>
+    <!-- no translation found for power_remaining_duration_only_short (9183070574408359726) -->
+    <skip />
     <string name="power_discharge_by_enhanced" msgid="2095821536747992464">"Θα διαρκέσει μέχρι τις <xliff:g id="TIME">%1$s</xliff:g> περίπου, ανάλογα με τη χρήση σας (<xliff:g id="LEVEL">%2$s</xliff:g>)"</string>
     <string name="power_discharge_by_only_enhanced" msgid="2175151772952365149">"Θα διαρκέσει μέχρι τις <xliff:g id="TIME">%1$s</xliff:g> περίπου, ανάλογα με τη χρήση σας"</string>
     <string name="power_discharge_by" msgid="6453537733650125582">"Θα διαρκέσει μέχρι τις <xliff:g id="TIME">%1$s</xliff:g> περίπου (<xliff:g id="LEVEL">%2$s</xliff:g>)"</string>
diff --git a/packages/SettingsLib/res/values-en-rAU/strings.xml b/packages/SettingsLib/res/values-en-rAU/strings.xml
index d4f4e5e..47f31b4 100644
--- a/packages/SettingsLib/res/values-en-rAU/strings.xml
+++ b/packages/SettingsLib/res/values-en-rAU/strings.xml
@@ -377,7 +377,8 @@
     <string name="power_discharging_duration" msgid="8848256785736335185">"About <xliff:g id="TIME_REMAINING">%1$s</xliff:g> left (<xliff:g id="LEVEL">%2$s</xliff:g>)"</string>
     <string name="power_remaining_duration_only_enhanced" msgid="4189311599812296592">"About <xliff:g id="TIME_REMAINING">%1$s</xliff:g> left based on your usage"</string>
     <string name="power_discharging_duration_enhanced" msgid="1992003260664804080">"About <xliff:g id="TIME_REMAINING">%1$s</xliff:g> left based on your usage (<xliff:g id="LEVEL">%2$s</xliff:g>)"</string>
-    <string name="power_remaining_duration_only_short" msgid="3463575350656389957">"<xliff:g id="TIME_REMAINING">%1$s</xliff:g> left"</string>
+    <!-- no translation found for power_remaining_duration_only_short (9183070574408359726) -->
+    <skip />
     <string name="power_discharge_by_enhanced" msgid="2095821536747992464">"Should last until about <xliff:g id="TIME">%1$s</xliff:g> based on your usage (<xliff:g id="LEVEL">%2$s</xliff:g>)"</string>
     <string name="power_discharge_by_only_enhanced" msgid="2175151772952365149">"Should last until about <xliff:g id="TIME">%1$s</xliff:g> based on your usage"</string>
     <string name="power_discharge_by" msgid="6453537733650125582">"Should last until about <xliff:g id="TIME">%1$s</xliff:g> (<xliff:g id="LEVEL">%2$s</xliff:g>)"</string>
diff --git a/packages/SettingsLib/res/values-en-rCA/strings.xml b/packages/SettingsLib/res/values-en-rCA/strings.xml
index d4f4e5e..47f31b4 100644
--- a/packages/SettingsLib/res/values-en-rCA/strings.xml
+++ b/packages/SettingsLib/res/values-en-rCA/strings.xml
@@ -377,7 +377,8 @@
     <string name="power_discharging_duration" msgid="8848256785736335185">"About <xliff:g id="TIME_REMAINING">%1$s</xliff:g> left (<xliff:g id="LEVEL">%2$s</xliff:g>)"</string>
     <string name="power_remaining_duration_only_enhanced" msgid="4189311599812296592">"About <xliff:g id="TIME_REMAINING">%1$s</xliff:g> left based on your usage"</string>
     <string name="power_discharging_duration_enhanced" msgid="1992003260664804080">"About <xliff:g id="TIME_REMAINING">%1$s</xliff:g> left based on your usage (<xliff:g id="LEVEL">%2$s</xliff:g>)"</string>
-    <string name="power_remaining_duration_only_short" msgid="3463575350656389957">"<xliff:g id="TIME_REMAINING">%1$s</xliff:g> left"</string>
+    <!-- no translation found for power_remaining_duration_only_short (9183070574408359726) -->
+    <skip />
     <string name="power_discharge_by_enhanced" msgid="2095821536747992464">"Should last until about <xliff:g id="TIME">%1$s</xliff:g> based on your usage (<xliff:g id="LEVEL">%2$s</xliff:g>)"</string>
     <string name="power_discharge_by_only_enhanced" msgid="2175151772952365149">"Should last until about <xliff:g id="TIME">%1$s</xliff:g> based on your usage"</string>
     <string name="power_discharge_by" msgid="6453537733650125582">"Should last until about <xliff:g id="TIME">%1$s</xliff:g> (<xliff:g id="LEVEL">%2$s</xliff:g>)"</string>
diff --git a/packages/SettingsLib/res/values-en-rGB/strings.xml b/packages/SettingsLib/res/values-en-rGB/strings.xml
index d4f4e5e..47f31b4 100644
--- a/packages/SettingsLib/res/values-en-rGB/strings.xml
+++ b/packages/SettingsLib/res/values-en-rGB/strings.xml
@@ -377,7 +377,8 @@
     <string name="power_discharging_duration" msgid="8848256785736335185">"About <xliff:g id="TIME_REMAINING">%1$s</xliff:g> left (<xliff:g id="LEVEL">%2$s</xliff:g>)"</string>
     <string name="power_remaining_duration_only_enhanced" msgid="4189311599812296592">"About <xliff:g id="TIME_REMAINING">%1$s</xliff:g> left based on your usage"</string>
     <string name="power_discharging_duration_enhanced" msgid="1992003260664804080">"About <xliff:g id="TIME_REMAINING">%1$s</xliff:g> left based on your usage (<xliff:g id="LEVEL">%2$s</xliff:g>)"</string>
-    <string name="power_remaining_duration_only_short" msgid="3463575350656389957">"<xliff:g id="TIME_REMAINING">%1$s</xliff:g> left"</string>
+    <!-- no translation found for power_remaining_duration_only_short (9183070574408359726) -->
+    <skip />
     <string name="power_discharge_by_enhanced" msgid="2095821536747992464">"Should last until about <xliff:g id="TIME">%1$s</xliff:g> based on your usage (<xliff:g id="LEVEL">%2$s</xliff:g>)"</string>
     <string name="power_discharge_by_only_enhanced" msgid="2175151772952365149">"Should last until about <xliff:g id="TIME">%1$s</xliff:g> based on your usage"</string>
     <string name="power_discharge_by" msgid="6453537733650125582">"Should last until about <xliff:g id="TIME">%1$s</xliff:g> (<xliff:g id="LEVEL">%2$s</xliff:g>)"</string>
diff --git a/packages/SettingsLib/res/values-en-rIN/strings.xml b/packages/SettingsLib/res/values-en-rIN/strings.xml
index d4f4e5e..47f31b4 100644
--- a/packages/SettingsLib/res/values-en-rIN/strings.xml
+++ b/packages/SettingsLib/res/values-en-rIN/strings.xml
@@ -377,7 +377,8 @@
     <string name="power_discharging_duration" msgid="8848256785736335185">"About <xliff:g id="TIME_REMAINING">%1$s</xliff:g> left (<xliff:g id="LEVEL">%2$s</xliff:g>)"</string>
     <string name="power_remaining_duration_only_enhanced" msgid="4189311599812296592">"About <xliff:g id="TIME_REMAINING">%1$s</xliff:g> left based on your usage"</string>
     <string name="power_discharging_duration_enhanced" msgid="1992003260664804080">"About <xliff:g id="TIME_REMAINING">%1$s</xliff:g> left based on your usage (<xliff:g id="LEVEL">%2$s</xliff:g>)"</string>
-    <string name="power_remaining_duration_only_short" msgid="3463575350656389957">"<xliff:g id="TIME_REMAINING">%1$s</xliff:g> left"</string>
+    <!-- no translation found for power_remaining_duration_only_short (9183070574408359726) -->
+    <skip />
     <string name="power_discharge_by_enhanced" msgid="2095821536747992464">"Should last until about <xliff:g id="TIME">%1$s</xliff:g> based on your usage (<xliff:g id="LEVEL">%2$s</xliff:g>)"</string>
     <string name="power_discharge_by_only_enhanced" msgid="2175151772952365149">"Should last until about <xliff:g id="TIME">%1$s</xliff:g> based on your usage"</string>
     <string name="power_discharge_by" msgid="6453537733650125582">"Should last until about <xliff:g id="TIME">%1$s</xliff:g> (<xliff:g id="LEVEL">%2$s</xliff:g>)"</string>
diff --git a/packages/SettingsLib/res/values-en-rXC/strings.xml b/packages/SettingsLib/res/values-en-rXC/strings.xml
index 98b63ee..bb36101 100644
--- a/packages/SettingsLib/res/values-en-rXC/strings.xml
+++ b/packages/SettingsLib/res/values-en-rXC/strings.xml
@@ -377,7 +377,8 @@
     <string name="power_discharging_duration" msgid="8848256785736335185">"‎‏‎‎‎‎‎‏‎‏‏‏‎‎‎‎‎‎‏‎‎‏‎‎‎‏‎‏‏‏‏‏‏‏‏‏‏‎‏‎‏‏‎‎‏‎‏‏‎‏‎‏‎‎‏‎‏‎‏‎‏‎‏‎‏‎‏‎‎‎‏‏‎‏‎‎‎‎‎‎‏‏‏‏‏‏‏‏‎‏‎‏‎‎‎‏‎About ‎‏‎‎‏‏‎<xliff:g id="TIME_REMAINING">%1$s</xliff:g>‎‏‎‎‏‏‏‎ left (‎‏‎‎‏‏‎<xliff:g id="LEVEL">%2$s</xliff:g>‎‏‎‎‏‏‏‎)‎‏‎‎‏‎"</string>
     <string name="power_remaining_duration_only_enhanced" msgid="4189311599812296592">"‎‏‎‎‎‎‎‏‎‏‏‏‎‎‎‎‎‎‏‎‎‏‎‎‎‏‎‏‏‏‏‏‎‏‏‏‎‏‎‎‎‏‎‎‎‏‏‎‏‏‎‏‏‎‎‏‎‏‏‎‏‎‎‎‏‎‎‎‎‎‎‎‎‏‏‏‏‎‎‎‎‏‏‏‏‏‏‏‎‎‏‎‎‎‎‎About ‎‏‎‎‏‏‎<xliff:g id="TIME_REMAINING">%1$s</xliff:g>‎‏‎‎‏‏‏‎ left based on your usage‎‏‎‎‏‎"</string>
     <string name="power_discharging_duration_enhanced" msgid="1992003260664804080">"‎‏‎‎‎‎‎‏‎‏‏‏‎‎‎‎‎‎‏‎‎‏‎‎‎‏‎‏‏‏‏‎‏‏‏‎‏‏‏‎‏‎‎‏‎‏‎‎‎‎‎‏‎‎‎‏‏‎‏‎‎‏‎‏‎‏‎‏‏‏‎‏‎‏‏‎‎‎‎‏‏‏‎‎‏‎‏‏‏‏‎‎‎‎‎About ‎‏‎‎‏‏‎<xliff:g id="TIME_REMAINING">%1$s</xliff:g>‎‏‎‎‏‏‏‎ left based on your usage (‎‏‎‎‏‏‎<xliff:g id="LEVEL">%2$s</xliff:g>‎‏‎‎‏‏‏‎)‎‏‎‎‏‎"</string>
-    <string name="power_remaining_duration_only_short" msgid="3463575350656389957">"‎‏‎‎‎‎‎‏‎‏‏‏‎‎‎‎‎‎‏‎‎‏‎‎‎‏‎‏‏‏‏‏‎‏‏‎‎‎‎‎‎‎‏‎‎‎‏‎‎‎‏‎‏‏‏‎‏‏‎‏‏‏‎‎‎‏‏‏‏‎‎‏‎‏‎‏‏‎‎‎‏‎‏‎‎‏‏‎‏‎‎‎‏‎‏‎‎‏‎‎‏‏‎<xliff:g id="TIME_REMAINING">%1$s</xliff:g>‎‏‎‎‏‏‏‎ left‎‏‎‎‏‎"</string>
+    <!-- no translation found for power_remaining_duration_only_short (9183070574408359726) -->
+    <skip />
     <string name="power_discharge_by_enhanced" msgid="2095821536747992464">"‎‏‎‎‎‎‎‏‎‏‏‏‎‎‎‎‎‎‏‎‎‏‎‎‎‏‎‏‏‏‏‎‏‏‏‏‎‏‎‎‎‏‎‏‎‏‏‏‎‏‏‎‏‎‏‎‎‏‎‏‎‏‎‏‏‎‎‎‏‎‎‏‏‏‏‎‏‎‎‎‏‏‎‏‎‏‏‎‎‏‎‎‎‎‎Should last until about ‎‏‎‎‏‏‎<xliff:g id="TIME">%1$s</xliff:g>‎‏‎‎‏‏‏‎ based on your usage (‎‏‎‎‏‏‎<xliff:g id="LEVEL">%2$s</xliff:g>‎‏‎‎‏‏‏‎)‎‏‎‎‏‎"</string>
     <string name="power_discharge_by_only_enhanced" msgid="2175151772952365149">"‎‏‎‎‎‎‎‏‎‏‏‏‎‎‎‎‎‎‏‎‎‏‎‎‎‏‎‏‏‏‏‎‏‏‏‏‏‎‎‎‏‎‏‏‏‏‏‎‏‏‎‎‎‏‎‎‎‎‎‎‏‏‎‏‎‏‎‏‏‏‎‏‏‎‎‎‏‏‎‎‎‎‏‎‎‎‎‏‎‏‏‏‎‏‎Should last until about ‎‏‎‎‏‏‎<xliff:g id="TIME">%1$s</xliff:g>‎‏‎‎‏‏‏‎ based on your usage‎‏‎‎‏‎"</string>
     <string name="power_discharge_by" msgid="6453537733650125582">"‎‏‎‎‎‎‎‏‎‏‏‏‎‎‎‎‎‎‏‎‎‏‎‎‎‏‎‏‏‏‏‏‏‏‎‏‏‎‎‏‏‎‎‎‏‏‏‏‏‎‎‏‎‎‏‎‎‏‏‎‎‎‎‎‎‏‎‏‏‏‏‎‏‏‎‎‏‎‏‏‏‎‎‏‎‎‏‏‎‎‎‎‏‏‏‎‎Should last until about ‎‏‎‎‏‏‎<xliff:g id="TIME">%1$s</xliff:g>‎‏‎‎‏‏‏‎ (‎‏‎‎‏‏‎<xliff:g id="LEVEL">%2$s</xliff:g>‎‏‎‎‏‏‏‎)‎‏‎‎‏‎"</string>
diff --git a/packages/SettingsLib/res/values-es-rUS/strings.xml b/packages/SettingsLib/res/values-es-rUS/strings.xml
index e803abd..22d4748 100644
--- a/packages/SettingsLib/res/values-es-rUS/strings.xml
+++ b/packages/SettingsLib/res/values-es-rUS/strings.xml
@@ -377,7 +377,8 @@
     <string name="power_discharging_duration" msgid="8848256785736335185">"Tiempo restante: aproximadamente <xliff:g id="TIME_REMAINING">%1$s</xliff:g> (<xliff:g id="LEVEL">%2$s</xliff:g>)"</string>
     <string name="power_remaining_duration_only_enhanced" msgid="4189311599812296592">"Tiempo restante: aproximadamente <xliff:g id="TIME_REMAINING">%1$s</xliff:g> en función de tu uso"</string>
     <string name="power_discharging_duration_enhanced" msgid="1992003260664804080">"Tiempo restante: aproximadamente <xliff:g id="TIME_REMAINING">%1$s</xliff:g> en función de tu uso (<xliff:g id="LEVEL">%2$s</xliff:g>)"</string>
-    <string name="power_remaining_duration_only_short" msgid="3463575350656389957">"Tiempo restante: <xliff:g id="TIME_REMAINING">%1$s</xliff:g>"</string>
+    <!-- no translation found for power_remaining_duration_only_short (9183070574408359726) -->
+    <skip />
     <string name="power_discharge_by_enhanced" msgid="2095821536747992464">"Duración aproximada hasta <xliff:g id="TIME">%1$s</xliff:g> según el uso (<xliff:g id="LEVEL">%2$s</xliff:g>)"</string>
     <string name="power_discharge_by_only_enhanced" msgid="2175151772952365149">"Debería durar aproximadamente hasta <xliff:g id="TIME">%1$s</xliff:g> según el uso"</string>
     <string name="power_discharge_by" msgid="6453537733650125582">"Duración aproximada hasta: <xliff:g id="TIME">%1$s</xliff:g> (<xliff:g id="LEVEL">%2$s</xliff:g>)"</string>
diff --git a/packages/SettingsLib/res/values-es/strings.xml b/packages/SettingsLib/res/values-es/strings.xml
index 293eff1..47b1dfa 100644
--- a/packages/SettingsLib/res/values-es/strings.xml
+++ b/packages/SettingsLib/res/values-es/strings.xml
@@ -377,11 +377,12 @@
     <string name="power_discharging_duration" msgid="8848256785736335185">"Tiempo restante aproximado: <xliff:g id="TIME_REMAINING">%1$s</xliff:g> (<xliff:g id="LEVEL">%2$s</xliff:g>)"</string>
     <string name="power_remaining_duration_only_enhanced" msgid="4189311599812296592">"Tiempo restante aproximado según tu uso: <xliff:g id="TIME_REMAINING">%1$s</xliff:g>"</string>
     <string name="power_discharging_duration_enhanced" msgid="1992003260664804080">"Tiempo restante aproximado según tu uso: <xliff:g id="TIME_REMAINING">%1$s</xliff:g> (<xliff:g id="LEVEL">%2$s</xliff:g>)"</string>
-    <string name="power_remaining_duration_only_short" msgid="3463575350656389957">"Tiempo restante: <xliff:g id="TIME_REMAINING">%1$s</xliff:g>"</string>
+    <!-- no translation found for power_remaining_duration_only_short (9183070574408359726) -->
+    <skip />
     <string name="power_discharge_by_enhanced" msgid="2095821536747992464">"Debería durar aproximadamente hasta <xliff:g id="TIME">%1$s</xliff:g> según el uso (<xliff:g id="LEVEL">%2$s</xliff:g>)"</string>
-    <string name="power_discharge_by_only_enhanced" msgid="2175151772952365149">"Debería durar aproximadamente hasta <xliff:g id="TIME">%1$s</xliff:g> según el uso"</string>
+    <string name="power_discharge_by_only_enhanced" msgid="2175151772952365149">"Duración aproximada hasta: <xliff:g id="TIME">%1$s</xliff:g> (según el uso)"</string>
     <string name="power_discharge_by" msgid="6453537733650125582">"Debería durar aproximadamente hasta <xliff:g id="TIME">%1$s</xliff:g> (<xliff:g id="LEVEL">%2$s</xliff:g>)"</string>
-    <string name="power_discharge_by_only" msgid="107616694963545745">"Debería durar aproximadamente hasta <xliff:g id="TIME">%1$s</xliff:g>"</string>
+    <string name="power_discharge_by_only" msgid="107616694963545745">"Duración aproximada hasta: <xliff:g id="TIME">%1$s</xliff:g>"</string>
     <string name="power_discharge_by_only_short" msgid="1372817269546888804">"Hasta: <xliff:g id="TIME">%1$s</xliff:g>"</string>
     <string name="power_remaining_less_than_duration_only" msgid="5996752448813295329">"Tiempo restante: menos de <xliff:g id="THRESHOLD">%1$s</xliff:g>"</string>
     <string name="power_remaining_less_than_duration" msgid="5751885147712659423">"Queda menos del <xliff:g id="THRESHOLD">%1$s</xliff:g> (<xliff:g id="LEVEL">%2$s</xliff:g>)"</string>
diff --git a/packages/SettingsLib/res/values-et/strings.xml b/packages/SettingsLib/res/values-et/strings.xml
index 14ac827..1a704e2 100644
--- a/packages/SettingsLib/res/values-et/strings.xml
+++ b/packages/SettingsLib/res/values-et/strings.xml
@@ -377,7 +377,8 @@
     <string name="power_discharging_duration" msgid="8848256785736335185">"Ligikaudu <xliff:g id="TIME_REMAINING">%1$s</xliff:g> jäänud (<xliff:g id="LEVEL">%2$s</xliff:g>)"</string>
     <string name="power_remaining_duration_only_enhanced" msgid="4189311599812296592">"Teie kasutuse põhjal on jäänud ligikaudu <xliff:g id="TIME_REMAINING">%1$s</xliff:g>"</string>
     <string name="power_discharging_duration_enhanced" msgid="1992003260664804080">"Teie kasutuse põhjal on jäänud ligikaudu <xliff:g id="TIME_REMAINING">%1$s</xliff:g> (<xliff:g id="LEVEL">%2$s</xliff:g>)"</string>
-    <string name="power_remaining_duration_only_short" msgid="3463575350656389957">"Jäänud on <xliff:g id="TIME_REMAINING">%1$s</xliff:g>"</string>
+    <!-- no translation found for power_remaining_duration_only_short (9183070574408359726) -->
+    <skip />
     <string name="power_discharge_by_enhanced" msgid="2095821536747992464">"Peaks teie kasutuse põhjal kestma kuni <xliff:g id="TIME">%1$s</xliff:g> (<xliff:g id="LEVEL">%2$s</xliff:g>)"</string>
     <string name="power_discharge_by_only_enhanced" msgid="2175151772952365149">"Peaks teie kasutuse põhjal kestma kuni <xliff:g id="TIME">%1$s</xliff:g>"</string>
     <string name="power_discharge_by" msgid="6453537733650125582">"Peaks kestma kuni <xliff:g id="TIME">%1$s</xliff:g> (<xliff:g id="LEVEL">%2$s</xliff:g>)"</string>
diff --git a/packages/SettingsLib/res/values-eu/strings.xml b/packages/SettingsLib/res/values-eu/strings.xml
index 04710c7..9e1af11 100644
--- a/packages/SettingsLib/res/values-eu/strings.xml
+++ b/packages/SettingsLib/res/values-eu/strings.xml
@@ -377,7 +377,8 @@
     <string name="power_discharging_duration" msgid="8848256785736335185">"<xliff:g id="TIME_REMAINING">%1$s</xliff:g> inguru gelditzen dira (<xliff:g id="LEVEL">%2$s</xliff:g>)"</string>
     <string name="power_remaining_duration_only_enhanced" msgid="4189311599812296592">"Erabilera kontuan izanda, <xliff:g id="TIME_REMAINING">%1$s</xliff:g> inguru gelditzen dira"</string>
     <string name="power_discharging_duration_enhanced" msgid="1992003260664804080">"Erabilera kontuan izanda, <xliff:g id="TIME_REMAINING">%1$s</xliff:g> inguru gelditzen dira (<xliff:g id="LEVEL">%2$s</xliff:g>)"</string>
-    <string name="power_remaining_duration_only_short" msgid="3463575350656389957">"<xliff:g id="TIME_REMAINING">%1$s</xliff:g> gelditzen dira"</string>
+    <!-- no translation found for power_remaining_duration_only_short (9183070574408359726) -->
+    <skip />
     <string name="power_discharge_by_enhanced" msgid="2095821536747992464">"Erabileraren arabera, ordu honetara arte iraungo du, gutxi gorabehera: <xliff:g id="TIME">%1$s</xliff:g> (<xliff:g id="LEVEL">%2$s</xliff:g>)"</string>
     <string name="power_discharge_by_only_enhanced" msgid="2175151772952365149">"Erabileraren arabera, ordu honetara arte iraungo du, gutxi gorabehera: <xliff:g id="TIME">%1$s</xliff:g>"</string>
     <string name="power_discharge_by" msgid="6453537733650125582">"Ordu honetara arte iraungo du, gutxi gorabehera: <xliff:g id="TIME">%1$s</xliff:g> (<xliff:g id="LEVEL">%2$s</xliff:g>)"</string>
diff --git a/packages/SettingsLib/res/values-fa/strings.xml b/packages/SettingsLib/res/values-fa/strings.xml
index 8f55092..087a7ff 100644
--- a/packages/SettingsLib/res/values-fa/strings.xml
+++ b/packages/SettingsLib/res/values-fa/strings.xml
@@ -377,7 +377,8 @@
     <string name="power_discharging_duration" msgid="8848256785736335185">"تقریباً <xliff:g id="TIME_REMAINING">%1$s</xliff:g> شارژ باقی مانده است (<xliff:g id="LEVEL">%2$s</xliff:g>)"</string>
     <string name="power_remaining_duration_only_enhanced" msgid="4189311599812296592">"براساس مصرفتان، تقریباً <xliff:g id="TIME_REMAINING">%1$s</xliff:g> شارژ باقی مانده است"</string>
     <string name="power_discharging_duration_enhanced" msgid="1992003260664804080">"براساس مصرفتان، تقریباً <xliff:g id="TIME_REMAINING">%1$s</xliff:g> شارژ باقی مانده است (<xliff:g id="LEVEL">%2$s</xliff:g>)"</string>
-    <string name="power_remaining_duration_only_short" msgid="3463575350656389957">"<xliff:g id="TIME_REMAINING">%1$s</xliff:g> شارژ باقی مانده است"</string>
+    <!-- no translation found for power_remaining_duration_only_short (9183070574408359726) -->
+    <skip />
     <string name="power_discharge_by_enhanced" msgid="2095821536747992464">"با توجه به میزان مصرفتان (<xliff:g id="LEVEL">%2$s</xliff:g>)، باید حدوداً تا <xliff:g id="TIME">%1$s</xliff:g> شارژ داشته باشید"</string>
     <string name="power_discharge_by_only_enhanced" msgid="2175151772952365149">"باتوجه به میزان مصرفتان، باید حدوداً تا <xliff:g id="TIME">%1$s</xliff:g> شارژ داشته باشید"</string>
     <string name="power_discharge_by" msgid="6453537733650125582">"باید حدوداً تا <xliff:g id="TIME">%1$s</xliff:g> (<xliff:g id="LEVEL">%2$s</xliff:g>) شارژ داشته باشید"</string>
diff --git a/packages/SettingsLib/res/values-fi/strings.xml b/packages/SettingsLib/res/values-fi/strings.xml
index 5802a03..ac1f8a5 100644
--- a/packages/SettingsLib/res/values-fi/strings.xml
+++ b/packages/SettingsLib/res/values-fi/strings.xml
@@ -377,7 +377,8 @@
     <string name="power_discharging_duration" msgid="8848256785736335185">"Noin <xliff:g id="TIME_REMAINING">%1$s</xliff:g> jäljellä (<xliff:g id="LEVEL">%2$s</xliff:g>)"</string>
     <string name="power_remaining_duration_only_enhanced" msgid="4189311599812296592">"Noin <xliff:g id="TIME_REMAINING">%1$s</xliff:g> jäljellä käyttösi perusteella"</string>
     <string name="power_discharging_duration_enhanced" msgid="1992003260664804080">"Noin <xliff:g id="TIME_REMAINING">%1$s</xliff:g> jäljellä käyttösi perusteella (<xliff:g id="LEVEL">%2$s</xliff:g>)"</string>
-    <string name="power_remaining_duration_only_short" msgid="3463575350656389957">"<xliff:g id="TIME_REMAINING">%1$s</xliff:g> jäljellä"</string>
+    <!-- no translation found for power_remaining_duration_only_short (9183070574408359726) -->
+    <skip />
     <string name="power_discharge_by_enhanced" msgid="2095821536747992464">"Varaus loppuu käyttösi perusteella noin <xliff:g id="TIME">%1$s</xliff:g> (<xliff:g id="LEVEL">%2$s</xliff:g>)"</string>
     <string name="power_discharge_by_only_enhanced" msgid="2175151772952365149">"Varaus loppuu käyttösi perusteella noin <xliff:g id="TIME">%1$s</xliff:g>"</string>
     <string name="power_discharge_by" msgid="6453537733650125582">"Varaus loppuu noin <xliff:g id="TIME">%1$s</xliff:g> (<xliff:g id="LEVEL">%2$s</xliff:g>)"</string>
diff --git a/packages/SettingsLib/res/values-fr-rCA/strings.xml b/packages/SettingsLib/res/values-fr-rCA/strings.xml
index ec8d6b0..acbc028 100644
--- a/packages/SettingsLib/res/values-fr-rCA/strings.xml
+++ b/packages/SettingsLib/res/values-fr-rCA/strings.xml
@@ -377,7 +377,8 @@
     <string name="power_discharging_duration" msgid="8848256785736335185">"Il reste environ <xliff:g id="TIME_REMAINING">%1$s</xliff:g> (<xliff:g id="LEVEL">%2$s</xliff:g>)"</string>
     <string name="power_remaining_duration_only_enhanced" msgid="4189311599812296592">"Il reste environ <xliff:g id="TIME_REMAINING">%1$s</xliff:g> en fonction de votre usage"</string>
     <string name="power_discharging_duration_enhanced" msgid="1992003260664804080">"Il reste environ <xliff:g id="TIME_REMAINING">%1$s</xliff:g> en fonction de votre usage (<xliff:g id="LEVEL">%2$s</xliff:g>)"</string>
-    <string name="power_remaining_duration_only_short" msgid="3463575350656389957">"Temps restant : <xliff:g id="TIME_REMAINING">%1$s</xliff:g>"</string>
+    <!-- no translation found for power_remaining_duration_only_short (9183070574408359726) -->
+    <skip />
     <string name="power_discharge_by_enhanced" msgid="2095821536747992464">"Devrait durer jusqu\'à environ <xliff:g id="TIME">%1$s</xliff:g>, en fonction de votre usage (<xliff:g id="LEVEL">%2$s</xliff:g>)"</string>
     <string name="power_discharge_by_only_enhanced" msgid="2175151772952365149">"Devrait durer jusqu\'à environ <xliff:g id="TIME">%1$s</xliff:g>, en fonction de votre usage"</string>
     <string name="power_discharge_by" msgid="6453537733650125582">"Devrait durer jusqu\'à environ <xliff:g id="TIME">%1$s</xliff:g> (<xliff:g id="LEVEL">%2$s</xliff:g>)"</string>
diff --git a/packages/SettingsLib/res/values-fr/strings.xml b/packages/SettingsLib/res/values-fr/strings.xml
index 0b620d8..080074a 100644
--- a/packages/SettingsLib/res/values-fr/strings.xml
+++ b/packages/SettingsLib/res/values-fr/strings.xml
@@ -377,7 +377,8 @@
     <string name="power_discharging_duration" msgid="8848256785736335185">"Temps restant : environ <xliff:g id="TIME_REMAINING">%1$s</xliff:g> (<xliff:g id="LEVEL">%2$s</xliff:g>)"</string>
     <string name="power_remaining_duration_only_enhanced" msgid="4189311599812296592">"Temps restant en fonction de votre utilisation : environ <xliff:g id="TIME_REMAINING">%1$s</xliff:g>"</string>
     <string name="power_discharging_duration_enhanced" msgid="1992003260664804080">"Temps restant en fonction de votre utilisation (<xliff:g id="LEVEL">%2$s</xliff:g>) : environ <xliff:g id="TIME_REMAINING">%1$s</xliff:g>"</string>
-    <string name="power_remaining_duration_only_short" msgid="3463575350656389957">"Temps restant : <xliff:g id="TIME_REMAINING">%1$s</xliff:g>"</string>
+    <!-- no translation found for power_remaining_duration_only_short (9183070574408359726) -->
+    <skip />
     <string name="power_discharge_by_enhanced" msgid="2095821536747992464">"Devrait durer jusqu\'à environ <xliff:g id="TIME">%1$s</xliff:g> en fonction de votre utilisation (<xliff:g id="LEVEL">%2$s</xliff:g>)"</string>
     <string name="power_discharge_by_only_enhanced" msgid="2175151772952365149">"Devrait durer jusqu\'à environ <xliff:g id="TIME">%1$s</xliff:g> en fonction de votre utilisation"</string>
     <string name="power_discharge_by" msgid="6453537733650125582">"Devrait durer jusqu\'à environ <xliff:g id="TIME">%1$s</xliff:g> (<xliff:g id="LEVEL">%2$s</xliff:g>)"</string>
diff --git a/packages/SettingsLib/res/values-gl/strings.xml b/packages/SettingsLib/res/values-gl/strings.xml
index b4d7fcb..26ee53d 100644
--- a/packages/SettingsLib/res/values-gl/strings.xml
+++ b/packages/SettingsLib/res/values-gl/strings.xml
@@ -377,7 +377,8 @@
     <string name="power_discharging_duration" msgid="8848256785736335185">"Tempo restante aproximado (<xliff:g id="LEVEL">%2$s</xliff:g>): <xliff:g id="TIME_REMAINING">%1$s</xliff:g>"</string>
     <string name="power_remaining_duration_only_enhanced" msgid="4189311599812296592">"Tempo restante aproximado en función do uso: <xliff:g id="TIME_REMAINING">%1$s</xliff:g>"</string>
     <string name="power_discharging_duration_enhanced" msgid="1992003260664804080">"Tempo restante aproximado en función do uso (<xliff:g id="LEVEL">%2$s</xliff:g>): <xliff:g id="TIME_REMAINING">%1$s</xliff:g>"</string>
-    <string name="power_remaining_duration_only_short" msgid="3463575350656389957">"Tempo restante: <xliff:g id="TIME_REMAINING">%1$s</xliff:g>"</string>
+    <!-- no translation found for power_remaining_duration_only_short (9183070574408359726) -->
+    <skip />
     <string name="power_discharge_by_enhanced" msgid="2095821536747992464">"En función do uso, debería durar aproximadamente ata a seguinte hora: <xliff:g id="TIME">%1$s</xliff:g> (<xliff:g id="LEVEL">%2$s</xliff:g>)"</string>
     <string name="power_discharge_by_only_enhanced" msgid="2175151772952365149">"En función do uso, debería durar aproximadamente ata a seguinte hora: <xliff:g id="TIME">%1$s</xliff:g>"</string>
     <string name="power_discharge_by" msgid="6453537733650125582">"Debería durar aproximadamente ata a seguinte hora: <xliff:g id="TIME">%1$s</xliff:g> (<xliff:g id="LEVEL">%2$s</xliff:g>)"</string>
diff --git a/packages/SettingsLib/res/values-gu/strings.xml b/packages/SettingsLib/res/values-gu/strings.xml
index 36e04bb..937fc30 100644
--- a/packages/SettingsLib/res/values-gu/strings.xml
+++ b/packages/SettingsLib/res/values-gu/strings.xml
@@ -377,7 +377,8 @@
     <string name="power_discharging_duration" msgid="8848256785736335185">"લગભગ <xliff:g id="TIME_REMAINING">%1$s</xliff:g> બાકી છે (<xliff:g id="LEVEL">%2$s</xliff:g>)"</string>
     <string name="power_remaining_duration_only_enhanced" msgid="4189311599812296592">"તમારા વપરાશના આધારે લગભગ <xliff:g id="TIME_REMAINING">%1$s</xliff:g> બાકી છે"</string>
     <string name="power_discharging_duration_enhanced" msgid="1992003260664804080">"તમારા વપરાશના આધારે લગભગ <xliff:g id="TIME_REMAINING">%1$s</xliff:g> બાકી છે (<xliff:g id="LEVEL">%2$s</xliff:g>)"</string>
-    <string name="power_remaining_duration_only_short" msgid="3463575350656389957">"<xliff:g id="TIME_REMAINING">%1$s</xliff:g> બાકી છે"</string>
+    <!-- no translation found for power_remaining_duration_only_short (9183070574408359726) -->
+    <skip />
     <string name="power_discharge_by_enhanced" msgid="2095821536747992464">"તમારા વપરાશના આધારે લગભગ <xliff:g id="TIME">%1$s</xliff:g> સુધી ચાલવી જોઈએ (<xliff:g id="LEVEL">%2$s</xliff:g>)"</string>
     <string name="power_discharge_by_only_enhanced" msgid="2175151772952365149">"તમારા વપરાશના આધારે લગભગ <xliff:g id="TIME">%1$s</xliff:g> સુધી ચાલવી જોઈએ"</string>
     <string name="power_discharge_by" msgid="6453537733650125582">"લગભગ <xliff:g id="TIME">%1$s</xliff:g> સુધી ચાલવી જોઈએ (<xliff:g id="LEVEL">%2$s</xliff:g>)"</string>
diff --git a/packages/SettingsLib/res/values-hi/strings.xml b/packages/SettingsLib/res/values-hi/strings.xml
index 8b1ca93..0026d3e 100644
--- a/packages/SettingsLib/res/values-hi/strings.xml
+++ b/packages/SettingsLib/res/values-hi/strings.xml
@@ -377,7 +377,8 @@
     <string name="power_discharging_duration" msgid="8848256785736335185">"बैटरी लगभग <xliff:g id="TIME_REMAINING">%1$s</xliff:g> में खत्म हो जाएगी (<xliff:g id="LEVEL">%2$s</xliff:g>)"</string>
     <string name="power_remaining_duration_only_enhanced" msgid="4189311599812296592">"आपके इस्तेमाल के हिसाब से बैटरी लगभग <xliff:g id="TIME_REMAINING">%1$s</xliff:g> में खत्म हो जाएगी"</string>
     <string name="power_discharging_duration_enhanced" msgid="1992003260664804080">"आपके इस्तेमाल के हिसाब से बैटरी लगभग <xliff:g id="TIME_REMAINING">%1$s</xliff:g> में खत्म हो जाएगी (<xliff:g id="LEVEL">%2$s</xliff:g>)"</string>
-    <string name="power_remaining_duration_only_short" msgid="3463575350656389957">"<xliff:g id="TIME_REMAINING">%1$s</xliff:g> में बैटरी खत्म हो जाएगी"</string>
+    <!-- no translation found for power_remaining_duration_only_short (9183070574408359726) -->
+    <skip />
     <string name="power_discharge_by_enhanced" msgid="2095821536747992464">"आपके इस्तेमाल के हिसाब से बैटरी लगभग <xliff:g id="TIME">%1$s</xliff:g> चलेगी (<xliff:g id="LEVEL">%2$s</xliff:g>)"</string>
     <string name="power_discharge_by_only_enhanced" msgid="2175151772952365149">"आपके इस्तेमाल के हिसाब से बैटरी लगभग <xliff:g id="TIME">%1$s</xliff:g> चलेगी"</string>
     <string name="power_discharge_by" msgid="6453537733650125582">"बैटरी लगभग <xliff:g id="TIME">%1$s</xliff:g> चलेगी (<xliff:g id="LEVEL">%2$s</xliff:g>)"</string>
diff --git a/packages/SettingsLib/res/values-hr/strings.xml b/packages/SettingsLib/res/values-hr/strings.xml
index b4cbbdb..f06d01d 100644
--- a/packages/SettingsLib/res/values-hr/strings.xml
+++ b/packages/SettingsLib/res/values-hr/strings.xml
@@ -377,7 +377,8 @@
     <string name="power_discharging_duration" msgid="8848256785736335185">"Još otprilike <xliff:g id="TIME_REMAINING">%1$s</xliff:g> (<xliff:g id="LEVEL">%2$s</xliff:g>)"</string>
     <string name="power_remaining_duration_only_enhanced" msgid="4189311599812296592">"Još otprilike <xliff:g id="TIME_REMAINING">%1$s</xliff:g> na temelju vaše upotrebe"</string>
     <string name="power_discharging_duration_enhanced" msgid="1992003260664804080">"Još otprilike <xliff:g id="TIME_REMAINING">%1$s</xliff:g> na temelju vaše upotrebe (<xliff:g id="LEVEL">%2$s</xliff:g>)"</string>
-    <string name="power_remaining_duration_only_short" msgid="3463575350656389957">"Još <xliff:g id="TIME_REMAINING">%1$s</xliff:g>"</string>
+    <!-- no translation found for power_remaining_duration_only_short (9183070574408359726) -->
+    <skip />
     <string name="power_discharge_by_enhanced" msgid="2095821536747992464">"Otprilike bi trebalo trajati do <xliff:g id="TIME">%1$s</xliff:g> na temelju vaše upotrebe (<xliff:g id="LEVEL">%2$s</xliff:g>)"</string>
     <string name="power_discharge_by_only_enhanced" msgid="2175151772952365149">"Otprilike bi trebalo trajati do <xliff:g id="TIME">%1$s</xliff:g> na temelju vaše upotrebe"</string>
     <string name="power_discharge_by" msgid="6453537733650125582">"Otprilike bi trebalo trajati do <xliff:g id="TIME">%1$s</xliff:g> (<xliff:g id="LEVEL">%2$s</xliff:g>)"</string>
diff --git a/packages/SettingsLib/res/values-hu/strings.xml b/packages/SettingsLib/res/values-hu/strings.xml
index 589eb59..92b4e20 100644
--- a/packages/SettingsLib/res/values-hu/strings.xml
+++ b/packages/SettingsLib/res/values-hu/strings.xml
@@ -377,7 +377,8 @@
     <string name="power_discharging_duration" msgid="8848256785736335185">"Körülbelül <xliff:g id="TIME_REMAINING">%1$s</xliff:g> maradt hátra (<xliff:g id="LEVEL">%2$s</xliff:g>)"</string>
     <string name="power_remaining_duration_only_enhanced" msgid="4189311599812296592">"Körülbelül <xliff:g id="TIME_REMAINING">%1$s</xliff:g> maradt hátra az eszköz használata alapján"</string>
     <string name="power_discharging_duration_enhanced" msgid="1992003260664804080">"Körülbelül <xliff:g id="TIME_REMAINING">%1$s</xliff:g> maradt hátra az eszköz használata alapján (<xliff:g id="LEVEL">%2$s</xliff:g>)"</string>
-    <string name="power_remaining_duration_only_short" msgid="3463575350656389957">"<xliff:g id="TIME_REMAINING">%1$s</xliff:g> maradt hátra"</string>
+    <!-- no translation found for power_remaining_duration_only_short (9183070574408359726) -->
+    <skip />
     <string name="power_discharge_by_enhanced" msgid="2095821536747992464">"A használat alapján nagyjából még ennyit bír: <xliff:g id="TIME">%1$s</xliff:g> (<xliff:g id="LEVEL">%2$s</xliff:g>)"</string>
     <string name="power_discharge_by_only_enhanced" msgid="2175151772952365149">"A használat alapján nagyjából még ennyit bír: <xliff:g id="TIME">%1$s</xliff:g>"</string>
     <string name="power_discharge_by" msgid="6453537733650125582">"Nagyjából még ennyit bír: <xliff:g id="TIME">%1$s</xliff:g> (<xliff:g id="LEVEL">%2$s</xliff:g>)"</string>
diff --git a/packages/SettingsLib/res/values-hy/strings.xml b/packages/SettingsLib/res/values-hy/strings.xml
index 736b4c3..b5e5cf5 100644
--- a/packages/SettingsLib/res/values-hy/strings.xml
+++ b/packages/SettingsLib/res/values-hy/strings.xml
@@ -234,7 +234,7 @@
     <string name="bluetooth_select_a2dp_codec_ldac_playback_quality_dialog_title" msgid="6893955536658137179">"Գործարկել Bluetooth աուդիո LDAC կոդեկը\nԸնտրություն՝ նվագարկման որակ"</string>
     <string name="bluetooth_select_a2dp_codec_streaming_label" msgid="5347862512596240506">"Հեռարձակում՝ <xliff:g id="STREAMING_PARAMETER">%1$s</xliff:g>"</string>
     <string name="select_private_dns_configuration_title" msgid="3700456559305263922">"Մասնավոր DNS սերվեր"</string>
-    <string name="select_private_dns_configuration_dialog_title" msgid="9221994415765826811">"Ընտրեք անհատական DNS սերվերի ռեժիմը"</string>
+    <string name="select_private_dns_configuration_dialog_title" msgid="9221994415765826811">"Ընտրեք մասնավոր DNS-ի ռեժիմը"</string>
     <string name="private_dns_mode_off" msgid="8236575187318721684">"Անջատված է"</string>
     <string name="private_dns_mode_opportunistic" msgid="8314986739896927399">"Ավտոմատ"</string>
     <string name="private_dns_mode_provider" msgid="8354935160639360804">"Մասնավոր DNS ծառայության մատակարարի խնամորդի անունը"</string>
@@ -377,7 +377,8 @@
     <string name="power_discharging_duration" msgid="8848256785736335185">"Լիցքը (<xliff:g id="LEVEL">%2$s</xliff:g>) կբավարարի մոտ <xliff:g id="TIME_REMAINING">%1$s</xliff:g>"</string>
     <string name="power_remaining_duration_only_enhanced" msgid="4189311599812296592">"Լիցքը կբավարարի մոտ <xliff:g id="TIME_REMAINING">%1$s</xliff:g>՝ կախված օգտագործման եղանակից"</string>
     <string name="power_discharging_duration_enhanced" msgid="1992003260664804080">"Լիցքը (<xliff:g id="LEVEL">%2$s</xliff:g>) կբավարարի մոտ <xliff:g id="TIME_REMAINING">%1$s</xliff:g>՝ կախված օգտագործման եղանակից"</string>
-    <string name="power_remaining_duration_only_short" msgid="3463575350656389957">"Լիցքը կբավարարի <xliff:g id="TIME_REMAINING">%1$s</xliff:g>"</string>
+    <!-- no translation found for power_remaining_duration_only_short (9183070574408359726) -->
+    <skip />
     <string name="power_discharge_by_enhanced" msgid="2095821536747992464">"Լիցքը (<xliff:g id="LEVEL">%2$s</xliff:g>) պետք է, որ բավականացնի մոտ <xliff:g id="TIME">%1$s</xliff:g>՝ կախված օգտագործման եղանակից"</string>
     <string name="power_discharge_by_only_enhanced" msgid="2175151772952365149">"Լիցքը պետք է, որ բավականացնի մոտ <xliff:g id="TIME">%1$s</xliff:g>՝ կախված օգտագործման եղանակից"</string>
     <string name="power_discharge_by" msgid="6453537733650125582">"Լիցքը (<xliff:g id="LEVEL">%2$s</xliff:g>) պետք է, որ բավականացնի մոտ <xliff:g id="TIME">%1$s</xliff:g>"</string>
diff --git a/packages/SettingsLib/res/values-in/strings.xml b/packages/SettingsLib/res/values-in/strings.xml
index c5d8f30..6bd2876 100644
--- a/packages/SettingsLib/res/values-in/strings.xml
+++ b/packages/SettingsLib/res/values-in/strings.xml
@@ -377,7 +377,8 @@
     <string name="power_discharging_duration" msgid="8848256785736335185">"Sekitar <xliff:g id="TIME_REMAINING">%1$s</xliff:g> lagi (<xliff:g id="LEVEL">%2$s</xliff:g>)"</string>
     <string name="power_remaining_duration_only_enhanced" msgid="4189311599812296592">"Sekitar <xliff:g id="TIME_REMAINING">%1$s</xliff:g> lagi berdasarkan penggunaan Anda"</string>
     <string name="power_discharging_duration_enhanced" msgid="1992003260664804080">"Sekitar <xliff:g id="TIME_REMAINING">%1$s</xliff:g> lagi berdasarkan penggunaan Anda (<xliff:g id="LEVEL">%2$s</xliff:g>)"</string>
-    <string name="power_remaining_duration_only_short" msgid="3463575350656389957">"<xliff:g id="TIME_REMAINING">%1$s</xliff:g> lagi"</string>
+    <!-- no translation found for power_remaining_duration_only_short (9183070574408359726) -->
+    <skip />
     <string name="power_discharge_by_enhanced" msgid="2095821536747992464">"Akan bertahan kira-kira sampai <xliff:g id="TIME">%1$s</xliff:g> berdasarkan penggunaan Anda (<xliff:g id="LEVEL">%2$s</xliff:g>)"</string>
     <string name="power_discharge_by_only_enhanced" msgid="2175151772952365149">"Akan bertahan kira-kira sampai <xliff:g id="TIME">%1$s</xliff:g> berdasarkan penggunaan Anda"</string>
     <string name="power_discharge_by" msgid="6453537733650125582">"Akan bertahan kira-kira sampai <xliff:g id="TIME">%1$s</xliff:g> (<xliff:g id="LEVEL">%2$s</xliff:g>)"</string>
diff --git a/packages/SettingsLib/res/values-is/strings.xml b/packages/SettingsLib/res/values-is/strings.xml
index 58505f5..87006ac 100644
--- a/packages/SettingsLib/res/values-is/strings.xml
+++ b/packages/SettingsLib/res/values-is/strings.xml
@@ -377,7 +377,8 @@
     <string name="power_discharging_duration" msgid="8848256785736335185">"Um það bil <xliff:g id="TIME_REMAINING">%1$s</xliff:g> eftir (<xliff:g id="LEVEL">%2$s</xliff:g>)"</string>
     <string name="power_remaining_duration_only_enhanced" msgid="4189311599812296592">"Um það bil <xliff:g id="TIME_REMAINING">%1$s</xliff:g> eftir miðað við notkun þína"</string>
     <string name="power_discharging_duration_enhanced" msgid="1992003260664804080">"Um það bil <xliff:g id="TIME_REMAINING">%1$s</xliff:g> eftir miðað við notkun þína (<xliff:g id="LEVEL">%2$s</xliff:g>)"</string>
-    <string name="power_remaining_duration_only_short" msgid="3463575350656389957">"<xliff:g id="TIME_REMAINING">%1$s</xliff:g> eftir"</string>
+    <!-- no translation found for power_remaining_duration_only_short (9183070574408359726) -->
+    <skip />
     <string name="power_discharge_by_enhanced" msgid="2095821536747992464">"Ætti að endast til u.þ.b. <xliff:g id="TIME">%1$s</xliff:g> miðað við notkun þína (<xliff:g id="LEVEL">%2$s</xliff:g>)"</string>
     <string name="power_discharge_by_only_enhanced" msgid="2175151772952365149">"Ætti að endast til u.þ.b. <xliff:g id="TIME">%1$s</xliff:g> miðað við notkun þína"</string>
     <string name="power_discharge_by" msgid="6453537733650125582">"Ætti að endast til u.þ.b. <xliff:g id="TIME">%1$s</xliff:g> (<xliff:g id="LEVEL">%2$s</xliff:g>)"</string>
diff --git a/packages/SettingsLib/res/values-it/strings.xml b/packages/SettingsLib/res/values-it/strings.xml
index 6d863aa..b00bada 100644
--- a/packages/SettingsLib/res/values-it/strings.xml
+++ b/packages/SettingsLib/res/values-it/strings.xml
@@ -377,7 +377,8 @@
     <string name="power_discharging_duration" msgid="8848256785736335185">"Tempo rimanente: <xliff:g id="TIME_REMAINING">%1$s</xliff:g> circa (<xliff:g id="LEVEL">%2$s</xliff:g>)"</string>
     <string name="power_remaining_duration_only_enhanced" msgid="4189311599812296592">"Tempo rimanente in base al tuo utilizzo: <xliff:g id="TIME_REMAINING">%1$s</xliff:g> circa"</string>
     <string name="power_discharging_duration_enhanced" msgid="1992003260664804080">"Tempo rimanente in base al tuo utilizzo (<xliff:g id="LEVEL">%2$s</xliff:g>): <xliff:g id="TIME_REMAINING">%1$s</xliff:g>"</string>
-    <string name="power_remaining_duration_only_short" msgid="3463575350656389957">"Tempo rimanente: <xliff:g id="TIME_REMAINING">%1$s</xliff:g>"</string>
+    <!-- no translation found for power_remaining_duration_only_short (9183070574408359726) -->
+    <skip />
     <string name="power_discharge_by_enhanced" msgid="2095821536747992464">"Tempo stimato rimanente in base al tuo utilizzo: <xliff:g id="TIME">%1$s</xliff:g> circa (<xliff:g id="LEVEL">%2$s</xliff:g>)"</string>
     <string name="power_discharge_by_only_enhanced" msgid="2175151772952365149">"Tempo stimato rimanente in base al tuo utilizzo: <xliff:g id="TIME">%1$s</xliff:g> circa"</string>
     <string name="power_discharge_by" msgid="6453537733650125582">"Tempo stimato rimanente: <xliff:g id="TIME">%1$s</xliff:g> circa (<xliff:g id="LEVEL">%2$s</xliff:g>)"</string>
diff --git a/packages/SettingsLib/res/values-iw/strings.xml b/packages/SettingsLib/res/values-iw/strings.xml
index 89d6361..ae16ecb 100644
--- a/packages/SettingsLib/res/values-iw/strings.xml
+++ b/packages/SettingsLib/res/values-iw/strings.xml
@@ -377,7 +377,8 @@
     <string name="power_discharging_duration" msgid="8848256785736335185">"הזמן הנותר: בערך <xliff:g id="TIME_REMAINING">%1$s</xliff:g> (<xliff:g id="LEVEL">%2$s</xliff:g>)"</string>
     <string name="power_remaining_duration_only_enhanced" msgid="4189311599812296592">"הזמן הנותר על סמך השימוש שלך: בערך <xliff:g id="TIME_REMAINING">%1$s</xliff:g>"</string>
     <string name="power_discharging_duration_enhanced" msgid="1992003260664804080">"הזמן הנותר על סמך השימוש שלך: בערך <xliff:g id="TIME_REMAINING">%1$s</xliff:g> (<xliff:g id="LEVEL">%2$s</xliff:g>)"</string>
-    <string name="power_remaining_duration_only_short" msgid="3463575350656389957">"הזמן הנותר: <xliff:g id="TIME_REMAINING">%1$s</xliff:g>"</string>
+    <!-- no translation found for power_remaining_duration_only_short (9183070574408359726) -->
+    <skip />
     <string name="power_discharge_by_enhanced" msgid="2095821536747992464">"אמורה להחזיק מעמד בערך עד <xliff:g id="TIME">%1$s</xliff:g> על סמך השימוש במכשיר (<xliff:g id="LEVEL">%2$s</xliff:g>)"</string>
     <string name="power_discharge_by_only_enhanced" msgid="2175151772952365149">"אמורה להחזיק מעמד בערך עד <xliff:g id="TIME">%1$s</xliff:g> על סמך השימוש במכשיר"</string>
     <string name="power_discharge_by" msgid="6453537733650125582">"אמורה להחזיק מעמד בערך עד <xliff:g id="TIME">%1$s</xliff:g> (<xliff:g id="LEVEL">%2$s</xliff:g>)"</string>
diff --git a/packages/SettingsLib/res/values-ja/strings.xml b/packages/SettingsLib/res/values-ja/strings.xml
index 233e8e8..cc7ff1e 100644
--- a/packages/SettingsLib/res/values-ja/strings.xml
+++ b/packages/SettingsLib/res/values-ja/strings.xml
@@ -377,7 +377,8 @@
     <string name="power_discharging_duration" msgid="8848256785736335185">"残り時間: 約 <xliff:g id="TIME_REMAINING">%1$s</xliff:g>(<xliff:g id="LEVEL">%2$s</xliff:g>)"</string>
     <string name="power_remaining_duration_only_enhanced" msgid="4189311599812296592">"残り時間: 約 <xliff:g id="TIME_REMAINING">%1$s</xliff:g>(使用状況に基づく)"</string>
     <string name="power_discharging_duration_enhanced" msgid="1992003260664804080">"残り時間: 約 <xliff:g id="TIME_REMAINING">%1$s</xliff:g>(使用状況に基づく)(<xliff:g id="LEVEL">%2$s</xliff:g>)"</string>
-    <string name="power_remaining_duration_only_short" msgid="3463575350656389957">"残り時間: <xliff:g id="TIME_REMAINING">%1$s</xliff:g>"</string>
+    <!-- no translation found for power_remaining_duration_only_short (9183070574408359726) -->
+    <skip />
     <string name="power_discharge_by_enhanced" msgid="2095821536747992464">"電池切れの推定時間: <xliff:g id="TIME">%1$s</xliff:g>(使用状況に基づく)(<xliff:g id="LEVEL">%2$s</xliff:g>)"</string>
     <string name="power_discharge_by_only_enhanced" msgid="2175151772952365149">"電池切れの推定時間: <xliff:g id="TIME">%1$s</xliff:g>(使用状況に基づく)"</string>
     <string name="power_discharge_by" msgid="6453537733650125582">"電池切れの推定時間: <xliff:g id="TIME">%1$s</xliff:g>(<xliff:g id="LEVEL">%2$s</xliff:g>)"</string>
diff --git a/packages/SettingsLib/res/values-ka/strings.xml b/packages/SettingsLib/res/values-ka/strings.xml
index 09bea2a..c54fdfd 100644
--- a/packages/SettingsLib/res/values-ka/strings.xml
+++ b/packages/SettingsLib/res/values-ka/strings.xml
@@ -377,7 +377,8 @@
     <string name="power_discharging_duration" msgid="8848256785736335185">"დარჩა დაახლოებით <xliff:g id="TIME_REMAINING">%1$s</xliff:g> (<xliff:g id="LEVEL">%2$s</xliff:g>)"</string>
     <string name="power_remaining_duration_only_enhanced" msgid="4189311599812296592">"დარჩა დაახლოებით <xliff:g id="TIME_REMAINING">%1$s</xliff:g>, ბატარეის მოხმარების გათვალისწინებით"</string>
     <string name="power_discharging_duration_enhanced" msgid="1992003260664804080">"დარჩა დაახლოებით <xliff:g id="TIME_REMAINING">%1$s</xliff:g>, ბატარეის მოხმარების გათვალისწინებით (<xliff:g id="LEVEL">%2$s</xliff:g>)"</string>
-    <string name="power_remaining_duration_only_short" msgid="3463575350656389957">"დარჩენილია <xliff:g id="TIME_REMAINING">%1$s</xliff:g>"</string>
+    <!-- no translation found for power_remaining_duration_only_short (9183070574408359726) -->
+    <skip />
     <string name="power_discharge_by_enhanced" msgid="2095821536747992464">"უნდა იმუშაოს დაახლოებით <xliff:g id="TIME">%1$s</xliff:g>, ოხმარების გათვალისწინებით (<xliff:g id="LEVEL">%2$s</xliff:g>)"</string>
     <string name="power_discharge_by_only_enhanced" msgid="2175151772952365149">"უნდა იმუშაოს დაახლოებით <xliff:g id="TIME">%1$s</xliff:g>, მოხმარების გათვალისწინებით"</string>
     <string name="power_discharge_by" msgid="6453537733650125582">"უნდა იმუშაოს დაახლოებით <xliff:g id="TIME">%1$s</xliff:g> (<xliff:g id="LEVEL">%2$s</xliff:g>)"</string>
diff --git a/packages/SettingsLib/res/values-kk/strings.xml b/packages/SettingsLib/res/values-kk/strings.xml
index 8670ec9..e2b40bb 100644
--- a/packages/SettingsLib/res/values-kk/strings.xml
+++ b/packages/SettingsLib/res/values-kk/strings.xml
@@ -377,7 +377,8 @@
     <string name="power_discharging_duration" msgid="8848256785736335185">"Шамамен <xliff:g id="TIME_REMAINING">%1$s</xliff:g> қалды (<xliff:g id="LEVEL">%2$s</xliff:g>)"</string>
     <string name="power_remaining_duration_only_enhanced" msgid="4189311599812296592">"Пайдалану деректеріңізге сәйкес енді шамамен <xliff:g id="TIME_REMAINING">%1$s</xliff:g> қалды"</string>
     <string name="power_discharging_duration_enhanced" msgid="1992003260664804080">"Пайдалану деректеріңізге сәйкес енді шамамен <xliff:g id="TIME_REMAINING">%1$s</xliff:g> қалды (<xliff:g id="LEVEL">%2$s</xliff:g>)"</string>
-    <string name="power_remaining_duration_only_short" msgid="3463575350656389957">"<xliff:g id="TIME_REMAINING">%1$s</xliff:g> қалды"</string>
+    <!-- no translation found for power_remaining_duration_only_short (9183070574408359726) -->
+    <skip />
     <string name="power_discharge_by_enhanced" msgid="2095821536747992464">"Пайдалануға байланысты шамамен <xliff:g id="TIME">%1$s</xliff:g> уақытқа жетеді (<xliff:g id="LEVEL">%2$s</xliff:g>)"</string>
     <string name="power_discharge_by_only_enhanced" msgid="2175151772952365149">"Пайдалануға байланысты шамамен <xliff:g id="TIME">%1$s</xliff:g> уақытқа жетеді"</string>
     <string name="power_discharge_by" msgid="6453537733650125582">"Шамамен <xliff:g id="TIME">%1$s</xliff:g> (<xliff:g id="LEVEL">%2$s</xliff:g>) уақытқа жетеді"</string>
diff --git a/packages/SettingsLib/res/values-km/strings.xml b/packages/SettingsLib/res/values-km/strings.xml
index 6bf8a0f..1654831 100644
--- a/packages/SettingsLib/res/values-km/strings.xml
+++ b/packages/SettingsLib/res/values-km/strings.xml
@@ -377,7 +377,8 @@
     <string name="power_discharging_duration" msgid="8848256785736335185">"នៅសល់​ប្រហែល <xliff:g id="TIME_REMAINING">%1$s</xliff:g> ទៀត (<xliff:g id="LEVEL">%2$s</xliff:g>)"</string>
     <string name="power_remaining_duration_only_enhanced" msgid="4189311599812296592">"នៅសល់​ប្រហែល <xliff:g id="TIME_REMAINING">%1$s</xliff:g> ទៀត ផ្អែក​លើការ​ប្រើប្រាស់​របស់អ្នក"</string>
     <string name="power_discharging_duration_enhanced" msgid="1992003260664804080">"នៅសល់​ប្រហែល <xliff:g id="TIME_REMAINING">%1$s</xliff:g> ទៀត ផ្អែក​លើការ​ប្រើប្រាស់​របស់អ្នក (<xliff:g id="LEVEL">%2$s</xliff:g>)"</string>
-    <string name="power_remaining_duration_only_short" msgid="3463575350656389957">"នៅសល់ <xliff:g id="TIME_REMAINING">%1$s</xliff:g> ទៀត"</string>
+    <!-- no translation found for power_remaining_duration_only_short (9183070574408359726) -->
+    <skip />
     <string name="power_discharge_by_enhanced" msgid="2095821536747992464">"គួរ​តែ​អាច​ប្រើបាន​រហូតដល់​ម៉ោងប្រហែល <xliff:g id="TIME">%1$s</xliff:g> ដោយផ្អែក​លើការ​ប្រើប្រាស់​របស់អ្នក (<xliff:g id="LEVEL">%2$s</xliff:g>)"</string>
     <string name="power_discharge_by_only_enhanced" msgid="2175151772952365149">"គួរ​តែ​អាច​ប្រើបាន​រហូតដល់​ម៉ោងប្រហែល <xliff:g id="TIME">%1$s</xliff:g> ដោយផ្អែក​លើការ​ប្រើប្រាស់​របស់អ្នក"</string>
     <string name="power_discharge_by" msgid="6453537733650125582">"គួរ​តែ​អាច​ប្រើបាន​រហូតដល់​ម៉ោងប្រហែល <xliff:g id="TIME">%1$s</xliff:g> (<xliff:g id="LEVEL">%2$s</xliff:g>)"</string>
diff --git a/packages/SettingsLib/res/values-kn/strings.xml b/packages/SettingsLib/res/values-kn/strings.xml
index 1e9a0d5..457a163 100644
--- a/packages/SettingsLib/res/values-kn/strings.xml
+++ b/packages/SettingsLib/res/values-kn/strings.xml
@@ -377,7 +377,8 @@
     <string name="power_discharging_duration" msgid="8848256785736335185">"(<xliff:g id="LEVEL">%2$s</xliff:g>) ತಲುಪಲು <xliff:g id="TIME_REMAINING">%1$s</xliff:g> ಸಮಯ ಬಾಕಿ ಉಳಿದಿದೆ"</string>
     <string name="power_remaining_duration_only_enhanced" msgid="4189311599812296592">"ನಿಮ್ಮ ಬಳಕೆಯ ಆಧಾರದ ಮೇಲೆ ಸುಮಾರು <xliff:g id="TIME_REMAINING">%1$s</xliff:g> ಸಮಯ ಬಾಕಿ ಉಳಿದಿದೆ"</string>
     <string name="power_discharging_duration_enhanced" msgid="1992003260664804080">"ನಿಮ್ಮ ಬಳಕೆಯ (<xliff:g id="LEVEL">%2$s</xliff:g>) ಆಧಾರದ ಮೇಲೆ ಸುಮಾರು <xliff:g id="TIME_REMAINING">%1$s</xliff:g> ಉಳಿದಿದೆ"</string>
-    <string name="power_remaining_duration_only_short" msgid="3463575350656389957">"<xliff:g id="TIME_REMAINING">%1$s</xliff:g> ಉಳಿದಿದೆ"</string>
+    <!-- no translation found for power_remaining_duration_only_short (9183070574408359726) -->
+    <skip />
     <string name="power_discharge_by_enhanced" msgid="2095821536747992464">"ನಿಮ್ಮ ಬಳಕೆ (<xliff:g id="LEVEL">%2$s</xliff:g>) ಆಧರಿಸಿ <xliff:g id="TIME">%1$s</xliff:g> ಸಮಯದವರೆಗೆ ಫೋನ್‌ ರನ್‌ ಆಗಬೇಕು"</string>
     <string name="power_discharge_by_only_enhanced" msgid="2175151772952365149">"ನಿಮ್ಮ ಬಳಕೆ ಆಧರಿಸಿ <xliff:g id="TIME">%1$s</xliff:g> ಸಮಯದವರೆಗೆ ಫೋನ್‌ ರನ್‌ ಆಗಬೇಕು"</string>
     <string name="power_discharge_by" msgid="6453537733650125582">"<xliff:g id="TIME">%1$s</xliff:g> (<xliff:g id="LEVEL">%2$s</xliff:g>) ಸಮಯದವರೆಗೆ ಫೋನ್‌ ರನ್‌ ಆಗಬೇಕು"</string>
diff --git a/packages/SettingsLib/res/values-ko/strings.xml b/packages/SettingsLib/res/values-ko/strings.xml
index 877866c..d19b9f2 100644
--- a/packages/SettingsLib/res/values-ko/strings.xml
+++ b/packages/SettingsLib/res/values-ko/strings.xml
@@ -377,7 +377,8 @@
     <string name="power_discharging_duration" msgid="8848256785736335185">"남은 시간 약 <xliff:g id="TIME_REMAINING">%1$s</xliff:g>(<xliff:g id="LEVEL">%2$s</xliff:g>)"</string>
     <string name="power_remaining_duration_only_enhanced" msgid="4189311599812296592">"내 사용량을 기준으로 약 <xliff:g id="TIME_REMAINING">%1$s</xliff:g> 남음"</string>
     <string name="power_discharging_duration_enhanced" msgid="1992003260664804080">"내 사용량(<xliff:g id="LEVEL">%2$s</xliff:g>)을 기준으로 약 <xliff:g id="TIME_REMAINING">%1$s</xliff:g> 남음"</string>
-    <string name="power_remaining_duration_only_short" msgid="3463575350656389957">"남은 시간: <xliff:g id="TIME_REMAINING">%1$s</xliff:g>"</string>
+    <!-- no translation found for power_remaining_duration_only_short (9183070574408359726) -->
+    <skip />
     <string name="power_discharge_by_enhanced" msgid="2095821536747992464">"사용량(<xliff:g id="LEVEL">%2$s</xliff:g>)을 기준으로 약 <xliff:g id="TIME">%1$s</xliff:g>까지 사용 가능"</string>
     <string name="power_discharge_by_only_enhanced" msgid="2175151772952365149">"사용량을 기준으로 약 <xliff:g id="TIME">%1$s</xliff:g>까지 사용 가능"</string>
     <string name="power_discharge_by" msgid="6453537733650125582">"약 <xliff:g id="TIME">%1$s</xliff:g>까지 사용 가능(<xliff:g id="LEVEL">%2$s</xliff:g>)"</string>
diff --git a/packages/SettingsLib/res/values-ky/strings.xml b/packages/SettingsLib/res/values-ky/strings.xml
index 9e4a9a8..9bc6d58 100644
--- a/packages/SettingsLib/res/values-ky/strings.xml
+++ b/packages/SettingsLib/res/values-ky/strings.xml
@@ -377,7 +377,8 @@
     <string name="power_discharging_duration" msgid="8848256785736335185">"Болжол менен <xliff:g id="TIME_REMAINING">%1$s</xliff:g> калды (<xliff:g id="LEVEL">%2$s</xliff:g>)"</string>
     <string name="power_remaining_duration_only_enhanced" msgid="4189311599812296592">"Колдонгонуңузга караганда болжол менен <xliff:g id="TIME_REMAINING">%1$s</xliff:g> калды"</string>
     <string name="power_discharging_duration_enhanced" msgid="1992003260664804080">"Колдонгонуңузга караганда болжол менен <xliff:g id="TIME_REMAINING">%1$s</xliff:g> калды (<xliff:g id="LEVEL">%2$s</xliff:g>)"</string>
-    <string name="power_remaining_duration_only_short" msgid="3463575350656389957">"<xliff:g id="TIME_REMAINING">%1$s</xliff:g> калды"</string>
+    <!-- no translation found for power_remaining_duration_only_short (9183070574408359726) -->
+    <skip />
     <string name="power_discharge_by_enhanced" msgid="2095821536747992464">"Колдонгонуңузга караганда болжол менен <xliff:g id="TIME">%1$s</xliff:g> (<xliff:g id="LEVEL">%2$s</xliff:g>) кийин өчөт"</string>
     <string name="power_discharge_by_only_enhanced" msgid="2175151772952365149">"Колдонгонуңузга караганда болжол менен <xliff:g id="TIME">%1$s</xliff:g> кийин өчөт"</string>
     <string name="power_discharge_by" msgid="6453537733650125582">"Болжол менен <xliff:g id="TIME">%1$s</xliff:g> (<xliff:g id="LEVEL">%2$s</xliff:g>) кийин өчөт"</string>
diff --git a/packages/SettingsLib/res/values-lo/strings.xml b/packages/SettingsLib/res/values-lo/strings.xml
index 7e6aaac..5c10aab 100644
--- a/packages/SettingsLib/res/values-lo/strings.xml
+++ b/packages/SettingsLib/res/values-lo/strings.xml
@@ -377,7 +377,8 @@
     <string name="power_discharging_duration" msgid="8848256785736335185">"ເຫຼືອອີກປະມານ <xliff:g id="TIME_REMAINING">%1$s</xliff:g> (<xliff:g id="LEVEL">%2$s</xliff:g>)"</string>
     <string name="power_remaining_duration_only_enhanced" msgid="4189311599812296592">"ເຫຼືອອີກປະມານ <xliff:g id="TIME_REMAINING">%1$s</xliff:g> ອ້າງອີງຈາກການນຳໃຊ້ຂອງທ່ານ"</string>
     <string name="power_discharging_duration_enhanced" msgid="1992003260664804080">"ເຫຼືອອີກປະມານ <xliff:g id="TIME_REMAINING">%1$s</xliff:g> ອ້າງອີງຈາກການນຳໃຊ້ຂອງທ່ານ (<xliff:g id="LEVEL">%2$s</xliff:g>)"</string>
-    <string name="power_remaining_duration_only_short" msgid="3463575350656389957">"ເຫຼືອອີກ <xliff:g id="TIME_REMAINING">%1$s</xliff:g>"</string>
+    <!-- no translation found for power_remaining_duration_only_short (9183070574408359726) -->
+    <skip />
     <string name="power_discharge_by_enhanced" msgid="2095821536747992464">"Should last until about <xliff:g id="TIME">%1$s</xliff:g> based on your usage (<xliff:g id="LEVEL">%2$s</xliff:g>)"</string>
     <string name="power_discharge_by_only_enhanced" msgid="2175151772952365149">"Should last until about <xliff:g id="TIME">%1$s</xliff:g> based on your usage"</string>
     <string name="power_discharge_by" msgid="6453537733650125582">"Should last until about <xliff:g id="TIME">%1$s</xliff:g> (<xliff:g id="LEVEL">%2$s</xliff:g>)"</string>
diff --git a/packages/SettingsLib/res/values-lt/strings.xml b/packages/SettingsLib/res/values-lt/strings.xml
index 71b8cf0..d437bc7 100644
--- a/packages/SettingsLib/res/values-lt/strings.xml
+++ b/packages/SettingsLib/res/values-lt/strings.xml
@@ -377,7 +377,8 @@
     <string name="power_discharging_duration" msgid="8848256785736335185">"Liko maždaug <xliff:g id="TIME_REMAINING">%1$s</xliff:g> (<xliff:g id="LEVEL">%2$s</xliff:g>)"</string>
     <string name="power_remaining_duration_only_enhanced" msgid="4189311599812296592">"Liko maždaug <xliff:g id="TIME_REMAINING">%1$s</xliff:g>, atsižvelgiant į naudojimą"</string>
     <string name="power_discharging_duration_enhanced" msgid="1992003260664804080">"Liko maždaug <xliff:g id="TIME_REMAINING">%1$s</xliff:g>, atsižvelgiant į naudojimą (<xliff:g id="LEVEL">%2$s</xliff:g>)"</string>
-    <string name="power_remaining_duration_only_short" msgid="3463575350656389957">"Liko <xliff:g id="TIME_REMAINING">%1$s</xliff:g>"</string>
+    <!-- no translation found for power_remaining_duration_only_short (9183070574408359726) -->
+    <skip />
     <string name="power_discharge_by_enhanced" msgid="2095821536747992464">"Pagal tai, kaip naudojama, turėtų išsikrauti maždaug po <xliff:g id="TIME">%1$s</xliff:g> (<xliff:g id="LEVEL">%2$s</xliff:g>)"</string>
     <string name="power_discharge_by_only_enhanced" msgid="2175151772952365149">"Pagal tai, kaip naudojama, turėtų išsikrauti maždaug po <xliff:g id="TIME">%1$s</xliff:g>"</string>
     <string name="power_discharge_by" msgid="6453537733650125582">"Turėtų išsikrauti maždaug po <xliff:g id="TIME">%1$s</xliff:g> (<xliff:g id="LEVEL">%2$s</xliff:g>)"</string>
diff --git a/packages/SettingsLib/res/values-lv/strings.xml b/packages/SettingsLib/res/values-lv/strings.xml
index 82ec0ae..afa9127 100644
--- a/packages/SettingsLib/res/values-lv/strings.xml
+++ b/packages/SettingsLib/res/values-lv/strings.xml
@@ -377,7 +377,8 @@
     <string name="power_discharging_duration" msgid="8848256785736335185">"Aptuvenais atlikušais laiks: <xliff:g id="TIME_REMAINING">%1$s</xliff:g> (<xliff:g id="LEVEL">%2$s</xliff:g>)"</string>
     <string name="power_remaining_duration_only_enhanced" msgid="4189311599812296592">"Ņemot vērā lietojumu, atlikušais laiks: <xliff:g id="TIME_REMAINING">%1$s</xliff:g>"</string>
     <string name="power_discharging_duration_enhanced" msgid="1992003260664804080">"Ņemot vērā lietojumu, atlikušais laiks: <xliff:g id="TIME_REMAINING">%1$s</xliff:g> (<xliff:g id="LEVEL">%2$s</xliff:g>)"</string>
-    <string name="power_remaining_duration_only_short" msgid="3463575350656389957">"Atlikušais laiks: <xliff:g id="TIME_REMAINING">%1$s</xliff:g>"</string>
+    <!-- no translation found for power_remaining_duration_only_short (9183070574408359726) -->
+    <skip />
     <string name="power_discharge_by_enhanced" msgid="2095821536747992464">"Ņemot vērā lietojumu (<xliff:g id="LEVEL">%2$s</xliff:g>), darbosies aptuveni līdz <xliff:g id="TIME">%1$s</xliff:g>."</string>
     <string name="power_discharge_by_only_enhanced" msgid="2175151772952365149">"Ņemot vērā lietojumu, darbosies aptuveni līdz <xliff:g id="TIME">%1$s</xliff:g>"</string>
     <string name="power_discharge_by" msgid="6453537733650125582">"Darbosies aptuveni līdz <xliff:g id="TIME">%1$s</xliff:g> (<xliff:g id="LEVEL">%2$s</xliff:g>)"</string>
diff --git a/packages/SettingsLib/res/values-mk/strings.xml b/packages/SettingsLib/res/values-mk/strings.xml
index c99ef68..ebc4fda 100644
--- a/packages/SettingsLib/res/values-mk/strings.xml
+++ b/packages/SettingsLib/res/values-mk/strings.xml
@@ -377,7 +377,8 @@
     <string name="power_discharging_duration" msgid="8848256785736335185">"Уште околу <xliff:g id="TIME_REMAINING">%1$s</xliff:g> (<xliff:g id="LEVEL">%2$s</xliff:g>)"</string>
     <string name="power_remaining_duration_only_enhanced" msgid="4189311599812296592">"Уште околу <xliff:g id="TIME_REMAINING">%1$s</xliff:g> според вашето користење"</string>
     <string name="power_discharging_duration_enhanced" msgid="1992003260664804080">"Уште околу <xliff:g id="TIME_REMAINING">%1$s</xliff:g> според вашето користење (<xliff:g id="LEVEL">%2$s</xliff:g>)"</string>
-    <string name="power_remaining_duration_only_short" msgid="3463575350656389957">"Уште <xliff:g id="TIME_REMAINING">%1$s</xliff:g>"</string>
+    <!-- no translation found for power_remaining_duration_only_short (9183070574408359726) -->
+    <skip />
     <string name="power_discharge_by_enhanced" msgid="2095821536747992464">"Треба да трае до околу <xliff:g id="TIME">%1$s</xliff:g> според вашето користење (<xliff:g id="LEVEL">%2$s</xliff:g>)"</string>
     <string name="power_discharge_by_only_enhanced" msgid="2175151772952365149">"Треба да трае до околу <xliff:g id="TIME">%1$s</xliff:g> според вашето користење"</string>
     <string name="power_discharge_by" msgid="6453537733650125582">"Треба да трае до околу <xliff:g id="TIME">%1$s</xliff:g> (<xliff:g id="LEVEL">%2$s</xliff:g>)"</string>
diff --git a/packages/SettingsLib/res/values-ml/strings.xml b/packages/SettingsLib/res/values-ml/strings.xml
index ae97fb2..f04bfcc 100644
--- a/packages/SettingsLib/res/values-ml/strings.xml
+++ b/packages/SettingsLib/res/values-ml/strings.xml
@@ -377,7 +377,8 @@
     <string name="power_discharging_duration" msgid="8848256785736335185">"ഏതാണ്ട് <xliff:g id="TIME_REMAINING">%1$s</xliff:g> ശേഷിക്കുന്നു (<xliff:g id="LEVEL">%2$s</xliff:g>)"</string>
     <string name="power_remaining_duration_only_enhanced" msgid="4189311599812296592">"നിങ്ങളുടെ ഉപയോഗത്തെ അടിസ്ഥാനമാക്കി ഏതാണ്ട് <xliff:g id="TIME_REMAINING">%1$s</xliff:g> ശേഷിക്കുന്നു"</string>
     <string name="power_discharging_duration_enhanced" msgid="1992003260664804080">"നിങ്ങളുടെ ഉപയോഗത്തെ അടിസ്ഥാനമാക്കി ഏതാണ്ട് <xliff:g id="TIME_REMAINING">%1$s</xliff:g> ശേഷിക്കുന്നു (<xliff:g id="LEVEL">%2$s</xliff:g>)"</string>
-    <string name="power_remaining_duration_only_short" msgid="3463575350656389957">"<xliff:g id="TIME_REMAINING">%1$s</xliff:g> ശേഷിക്കുന്നു"</string>
+    <!-- no translation found for power_remaining_duration_only_short (9183070574408359726) -->
+    <skip />
     <string name="power_discharge_by_enhanced" msgid="2095821536747992464">"നിങ്ങളുടെ ഉപയോഗത്തെ അടിസ്ഥാനമാക്കി ഏകദേശം <xliff:g id="TIME">%1$s</xliff:g> വരെ നീണ്ടുനിൽക്കേണ്ടതാണ് (<xliff:g id="LEVEL">%2$s</xliff:g>)"</string>
     <string name="power_discharge_by_only_enhanced" msgid="2175151772952365149">"നിങ്ങളുടെ ഉപയോഗത്തെ അടിസ്ഥാനമാക്കി ഏകദേശം <xliff:g id="TIME">%1$s</xliff:g> വരെ നീണ്ടുനിൽക്കേണ്ടതാണ്"</string>
     <string name="power_discharge_by" msgid="6453537733650125582">"ഏകദേശം <xliff:g id="TIME">%1$s</xliff:g> വരെ നീണ്ടുനിൽക്കേണ്ടതാണ് (<xliff:g id="LEVEL">%2$s</xliff:g>)"</string>
diff --git a/packages/SettingsLib/res/values-mn/strings.xml b/packages/SettingsLib/res/values-mn/strings.xml
index 10c1415..498b855 100644
--- a/packages/SettingsLib/res/values-mn/strings.xml
+++ b/packages/SettingsLib/res/values-mn/strings.xml
@@ -377,7 +377,8 @@
     <string name="power_discharging_duration" msgid="8848256785736335185">"Ойролцоогоор <xliff:g id="TIME_REMAINING">%1$s</xliff:g> үлдсэн (<xliff:g id="LEVEL">%2$s</xliff:g>)"</string>
     <string name="power_remaining_duration_only_enhanced" msgid="4189311599812296592">"Таны хэрэглээнд үндэслэн ойролцоогоор <xliff:g id="TIME_REMAINING">%1$s</xliff:g> үлдсэн"</string>
     <string name="power_discharging_duration_enhanced" msgid="1992003260664804080">"Таны хэрэглээнд үндэслэн ойролцоогоор <xliff:g id="TIME_REMAINING">%1$s</xliff:g> үлдсэн (<xliff:g id="LEVEL">%2$s</xliff:g>)"</string>
-    <string name="power_remaining_duration_only_short" msgid="3463575350656389957">"<xliff:g id="TIME_REMAINING">%1$s</xliff:g> үлдсэн"</string>
+    <!-- no translation found for power_remaining_duration_only_short (9183070574408359726) -->
+    <skip />
     <string name="power_discharge_by_enhanced" msgid="2095821536747992464">"Таны хэрэглээнд (<xliff:g id="LEVEL">%2$s</xliff:g>) тулгуурлан ойролцоогоор <xliff:g id="TIME">%1$s</xliff:g> хүртэл барих ёстой"</string>
     <string name="power_discharge_by_only_enhanced" msgid="2175151772952365149">"Таны хэрэглээнд тулгуурлан ойролцоогоор <xliff:g id="TIME">%1$s</xliff:g> хүртэл барих ёстой"</string>
     <string name="power_discharge_by" msgid="6453537733650125582">"Ойролцоогоор <xliff:g id="TIME">%1$s</xliff:g> хүртэл барих ёстой (<xliff:g id="LEVEL">%2$s</xliff:g>)"</string>
diff --git a/packages/SettingsLib/res/values-mr/strings.xml b/packages/SettingsLib/res/values-mr/strings.xml
index 88de8f4..7729f21 100644
--- a/packages/SettingsLib/res/values-mr/strings.xml
+++ b/packages/SettingsLib/res/values-mr/strings.xml
@@ -377,7 +377,8 @@
     <string name="power_discharging_duration" msgid="8848256785736335185">"अंदाजे <xliff:g id="TIME_REMAINING">%1$s</xliff:g> बाकी आहे (<xliff:g id="LEVEL">%2$s</xliff:g>)"</string>
     <string name="power_remaining_duration_only_enhanced" msgid="4189311599812296592">"तुमच्‍या वापरावर आधारित अंदाजे <xliff:g id="TIME_REMAINING">%1$s</xliff:g> बाकी आहे"</string>
     <string name="power_discharging_duration_enhanced" msgid="1992003260664804080">"तुमच्‍या वापरावर आधारित अंदाजे <xliff:g id="TIME_REMAINING">%1$s</xliff:g> बाकी आहे (<xliff:g id="LEVEL">%2$s</xliff:g>)"</string>
-    <string name="power_remaining_duration_only_short" msgid="3463575350656389957">"<xliff:g id="TIME_REMAINING">%1$s</xliff:g> बाकी"</string>
+    <!-- no translation found for power_remaining_duration_only_short (9183070574408359726) -->
+    <skip />
     <string name="power_discharge_by_enhanced" msgid="2095821536747992464">"तुमच्या वापरावर अवलंबून सुमारे <xliff:g id="TIME">%1$s</xliff:g> पर्यंत टिकावी (<xliff:g id="LEVEL">%2$s</xliff:g>)"</string>
     <string name="power_discharge_by_only_enhanced" msgid="2175151772952365149">"तुमच्या वापरावर अवलंबून सुमारे <xliff:g id="TIME">%1$s</xliff:g> पर्यंत टिकावी"</string>
     <string name="power_discharge_by" msgid="6453537733650125582">"सुमारे <xliff:g id="TIME">%1$s</xliff:g> पर्यंत टिकेल (<xliff:g id="LEVEL">%2$s</xliff:g>)"</string>
diff --git a/packages/SettingsLib/res/values-ms/strings.xml b/packages/SettingsLib/res/values-ms/strings.xml
index e98418d..236e30d 100644
--- a/packages/SettingsLib/res/values-ms/strings.xml
+++ b/packages/SettingsLib/res/values-ms/strings.xml
@@ -377,7 +377,8 @@
     <string name="power_discharging_duration" msgid="8848256785736335185">"Kira-kira <xliff:g id="TIME_REMAINING">%1$s</xliff:g> lagi (<xliff:g id="LEVEL">%2$s</xliff:g>)"</string>
     <string name="power_remaining_duration_only_enhanced" msgid="4189311599812296592">"Kira-kira <xliff:g id="TIME_REMAINING">%1$s</xliff:g> lagi berdasarkan penggunaan anda"</string>
     <string name="power_discharging_duration_enhanced" msgid="1992003260664804080">"Kira-kira <xliff:g id="TIME_REMAINING">%1$s</xliff:g> lagi berdasarkan penggunaan anda (<xliff:g id="LEVEL">%2$s</xliff:g>)"</string>
-    <string name="power_remaining_duration_only_short" msgid="3463575350656389957">"<xliff:g id="TIME_REMAINING">%1$s</xliff:g> lagi"</string>
+    <!-- no translation found for power_remaining_duration_only_short (9183070574408359726) -->
+    <skip />
     <string name="power_discharge_by_enhanced" msgid="2095821536747992464">"Seharusnya boleh digunakan hingga kira-kira <xliff:g id="TIME">%1$s</xliff:g> berdasarkan penggunaan anda (<xliff:g id="LEVEL">%2$s</xliff:g>)"</string>
     <string name="power_discharge_by_only_enhanced" msgid="2175151772952365149">"Seharusnya boleh digunakan hingga kira-kira <xliff:g id="TIME">%1$s</xliff:g> berdasarkan penggunaan anda"</string>
     <string name="power_discharge_by" msgid="6453537733650125582">"Seharusnya boleh digunakan hingga kira-kira <xliff:g id="TIME">%1$s</xliff:g> (<xliff:g id="LEVEL">%2$s</xliff:g>)"</string>
diff --git a/packages/SettingsLib/res/values-my/strings.xml b/packages/SettingsLib/res/values-my/strings.xml
index ed2aae6..88eef56 100644
--- a/packages/SettingsLib/res/values-my/strings.xml
+++ b/packages/SettingsLib/res/values-my/strings.xml
@@ -377,7 +377,8 @@
     <string name="power_discharging_duration" msgid="8848256785736335185">"<xliff:g id="TIME_REMAINING">%1$s</xliff:g> ခန့် ကျန်သည် (<xliff:g id="LEVEL">%2$s</xliff:g>)"</string>
     <string name="power_remaining_duration_only_enhanced" msgid="4189311599812296592">"သင်၏ အသုံးပြုမှု အပေါ် မူတည်၍ <xliff:g id="TIME_REMAINING">%1$s</xliff:g> ခန့် ကျန်သည်"</string>
     <string name="power_discharging_duration_enhanced" msgid="1992003260664804080">"သင်၏ အသုံးပြုမှု အပေါ် မူတည်၍ <xliff:g id="TIME_REMAINING">%1$s</xliff:g> ခန့် ကျန်သည် (<xliff:g id="LEVEL">%2$s</xliff:g>)"</string>
-    <string name="power_remaining_duration_only_short" msgid="3463575350656389957">"<xliff:g id="TIME_REMAINING">%1$s</xliff:g> ကျန်သည်"</string>
+    <!-- no translation found for power_remaining_duration_only_short (9183070574408359726) -->
+    <skip />
     <string name="power_discharge_by_enhanced" msgid="2095821536747992464">"သင်၏ အသုံးပြုမှုအပေါ် မူတည်၍ <xliff:g id="TIME">%1$s</xliff:g> ခန့်အထိ သုံးနိုင်သည် (<xliff:g id="LEVEL">%2$s</xliff:g>)"</string>
     <string name="power_discharge_by_only_enhanced" msgid="2175151772952365149">"သင်၏ အသုံးပြုမှုအပေါ် အခြေခံ၍ <xliff:g id="TIME">%1$s</xliff:g> ခန့်အထိ သုံးနိုင်သည်"</string>
     <string name="power_discharge_by" msgid="6453537733650125582">"<xliff:g id="TIME">%1$s</xliff:g> ခန့်အထိ သုံးနိုင်သည် (<xliff:g id="LEVEL">%2$s</xliff:g>)"</string>
diff --git a/packages/SettingsLib/res/values-nb/strings.xml b/packages/SettingsLib/res/values-nb/strings.xml
index 93e53e5..259ed34 100644
--- a/packages/SettingsLib/res/values-nb/strings.xml
+++ b/packages/SettingsLib/res/values-nb/strings.xml
@@ -377,7 +377,8 @@
     <string name="power_discharging_duration" msgid="8848256785736335185">"Omtrent <xliff:g id="TIME_REMAINING">%1$s</xliff:g> gjenstår (<xliff:g id="LEVEL">%2$s</xliff:g>)"</string>
     <string name="power_remaining_duration_only_enhanced" msgid="4189311599812296592">"Omtrent <xliff:g id="TIME_REMAINING">%1$s</xliff:g> gjenstår basert på bruken din"</string>
     <string name="power_discharging_duration_enhanced" msgid="1992003260664804080">"Omtrent <xliff:g id="TIME_REMAINING">%1$s</xliff:g> gjenstår basert på bruken din (<xliff:g id="LEVEL">%2$s</xliff:g>)"</string>
-    <string name="power_remaining_duration_only_short" msgid="3463575350656389957">"<xliff:g id="TIME_REMAINING">%1$s</xliff:g> gjenstår"</string>
+    <!-- no translation found for power_remaining_duration_only_short (9183070574408359726) -->
+    <skip />
     <string name="power_discharge_by_enhanced" msgid="2095821536747992464">"Skal vare til omtrent <xliff:g id="TIME">%1$s</xliff:g>, basert på bruken din (<xliff:g id="LEVEL">%2$s</xliff:g>)"</string>
     <string name="power_discharge_by_only_enhanced" msgid="2175151772952365149">"Skal vare til omtrent <xliff:g id="TIME">%1$s</xliff:g>, basert på bruken din"</string>
     <string name="power_discharge_by" msgid="6453537733650125582">"Skal vare til omtrent <xliff:g id="TIME">%1$s</xliff:g> (<xliff:g id="LEVEL">%2$s</xliff:g>)"</string>
diff --git a/packages/SettingsLib/res/values-ne/strings.xml b/packages/SettingsLib/res/values-ne/strings.xml
index ac15f1b..451691b 100644
--- a/packages/SettingsLib/res/values-ne/strings.xml
+++ b/packages/SettingsLib/res/values-ne/strings.xml
@@ -377,7 +377,8 @@
     <string name="power_discharging_duration" msgid="8848256785736335185">"लगभग <xliff:g id="TIME_REMAINING">%1$s</xliff:g> बाँकी छ (<xliff:g id="LEVEL">%2$s</xliff:g>)"</string>
     <string name="power_remaining_duration_only_enhanced" msgid="4189311599812296592">"तपाईंको प्रयोगको आधारमा लगभग <xliff:g id="TIME_REMAINING">%1$s</xliff:g> बाँकी छ"</string>
     <string name="power_discharging_duration_enhanced" msgid="1992003260664804080">"तपाईंको प्रयोगको आधारमा लगभग <xliff:g id="TIME_REMAINING">%1$s</xliff:g> बाँकी छ (<xliff:g id="LEVEL">%2$s</xliff:g>)"</string>
-    <string name="power_remaining_duration_only_short" msgid="3463575350656389957">"<xliff:g id="TIME_REMAINING">%1$s</xliff:g> बाँकी छ"</string>
+    <!-- no translation found for power_remaining_duration_only_short (9183070574408359726) -->
+    <skip />
     <string name="power_discharge_by_enhanced" msgid="2095821536747992464">"तपाईंको प्रयोगका आधारमा लगभग <xliff:g id="TIME">%1$s</xliff:g> सम्म टिक्नु पर्छ (<xliff:g id="LEVEL">%2$s</xliff:g>)"</string>
     <string name="power_discharge_by_only_enhanced" msgid="2175151772952365149">"तपाईंको प्रयोगका आधारमा लगभग <xliff:g id="TIME">%1$s</xliff:g> सम्म टिक्नु पर्छ"</string>
     <string name="power_discharge_by" msgid="6453537733650125582">"ब्याट्री लगभग <xliff:g id="TIME">%1$s</xliff:g> सम्म टिक्नु पर्छ (<xliff:g id="LEVEL">%2$s</xliff:g>)"</string>
diff --git a/packages/SettingsLib/res/values-nl/strings.xml b/packages/SettingsLib/res/values-nl/strings.xml
index 959c1ea..00c36de 100644
--- a/packages/SettingsLib/res/values-nl/strings.xml
+++ b/packages/SettingsLib/res/values-nl/strings.xml
@@ -377,7 +377,8 @@
     <string name="power_discharging_duration" msgid="8848256785736335185">"Ongeveer <xliff:g id="TIME_REMAINING">%1$s</xliff:g> resterend (<xliff:g id="LEVEL">%2$s</xliff:g>)"</string>
     <string name="power_remaining_duration_only_enhanced" msgid="4189311599812296592">"Ongeveer <xliff:g id="TIME_REMAINING">%1$s</xliff:g> resterend op basis van je gebruik"</string>
     <string name="power_discharging_duration_enhanced" msgid="1992003260664804080">"Ongeveer <xliff:g id="TIME_REMAINING">%1$s</xliff:g> resterend op basis van je gebruik (<xliff:g id="LEVEL">%2$s</xliff:g>)"</string>
-    <string name="power_remaining_duration_only_short" msgid="3463575350656389957">"<xliff:g id="TIME_REMAINING">%1$s</xliff:g> resterend"</string>
+    <!-- no translation found for power_remaining_duration_only_short (9183070574408359726) -->
+    <skip />
     <string name="power_discharge_by_enhanced" msgid="2095821536747992464">"Is nog genoeg tot ongeveer <xliff:g id="TIME">%1$s</xliff:g> op basis van je gebruik (<xliff:g id="LEVEL">%2$s</xliff:g>)"</string>
     <string name="power_discharge_by_only_enhanced" msgid="2175151772952365149">"Is nog genoeg tot ongeveer <xliff:g id="TIME">%1$s</xliff:g> op basis van je gebruik"</string>
     <string name="power_discharge_by" msgid="6453537733650125582">"Is nog genoeg tot ongeveer <xliff:g id="TIME">%1$s</xliff:g> (<xliff:g id="LEVEL">%2$s</xliff:g>)"</string>
diff --git a/packages/SettingsLib/res/values-or/strings.xml b/packages/SettingsLib/res/values-or/strings.xml
index 847586e..b24b4a2 100644
--- a/packages/SettingsLib/res/values-or/strings.xml
+++ b/packages/SettingsLib/res/values-or/strings.xml
@@ -377,7 +377,8 @@
     <string name="power_discharging_duration" msgid="8848256785736335185">"ପାଖାପାଖି <xliff:g id="TIME_REMAINING">%1$s</xliff:g> ପାଇଁ (<xliff:g id="LEVEL">%2$s</xliff:g>) ବଳକା ଅଛି"</string>
     <string name="power_remaining_duration_only_enhanced" msgid="4189311599812296592">"ଆପଣଙ୍କ ବ୍ୟବହାରକୁ ଆଧାର କରି ପାଖାପାଖି <xliff:g id="TIME_REMAINING">%1$s</xliff:g> ବଳକା ଅଛି"</string>
     <string name="power_discharging_duration_enhanced" msgid="1992003260664804080">"ଆପଣଙ୍କର ବ୍ୟବହାରକୁ ଆଧାର କରି (<xliff:g id="LEVEL">%2$s</xliff:g>) ପାଖାପାଖି <xliff:g id="TIME_REMAINING">%1$s</xliff:g> ବଳକା ଅଛି"</string>
-    <string name="power_remaining_duration_only_short" msgid="3463575350656389957">"<xliff:g id="TIME_REMAINING">%1$s</xliff:g> ବଳକା ଅଛି"</string>
+    <!-- no translation found for power_remaining_duration_only_short (9183070574408359726) -->
+    <skip />
     <string name="power_discharge_by_enhanced" msgid="2095821536747992464">"ଆପଣଙ୍କର ବ୍ୟବହାରକୁ ଆଧାର କରି ବ୍ୟାଟେରୀ <xliff:g id="TIME">%1$s</xliff:g> ପର୍ଯ୍ୟନ୍ତ ଚାଲିବ (<xliff:g id="LEVEL">%2$s</xliff:g>)"</string>
     <string name="power_discharge_by_only_enhanced" msgid="2175151772952365149">"ଆପଣଙ୍କର ବ୍ୟବହାରକୁ ଆଧାର କରି ବ୍ୟାଟେରୀ <xliff:g id="TIME">%1$s</xliff:g> ପର୍ଯ୍ୟନ୍ତ ଚାଲିବ"</string>
     <string name="power_discharge_by" msgid="6453537733650125582">"ବ୍ୟାଟେରୀ ପାଖାପାଖି <xliff:g id="TIME">%1$s</xliff:g> ଚାଲିବ (<xliff:g id="LEVEL">%2$s</xliff:g>)"</string>
diff --git a/packages/SettingsLib/res/values-pa/strings.xml b/packages/SettingsLib/res/values-pa/strings.xml
index 0675b6b..21a7ab9 100644
--- a/packages/SettingsLib/res/values-pa/strings.xml
+++ b/packages/SettingsLib/res/values-pa/strings.xml
@@ -377,7 +377,8 @@
     <string name="power_discharging_duration" msgid="8848256785736335185">"ਲਗਭਗ <xliff:g id="TIME_REMAINING">%1$s</xliff:g> ਬਾਕੀ (<xliff:g id="LEVEL">%2$s</xliff:g>)"</string>
     <string name="power_remaining_duration_only_enhanced" msgid="4189311599812296592">"ਤੁਹਾਡੀ ਵਰਤੋਂ ਦੇ ਆਧਾਰ \'ਤੇ ਲਗਭਗ <xliff:g id="TIME_REMAINING">%1$s</xliff:g> ਬਾਕੀ"</string>
     <string name="power_discharging_duration_enhanced" msgid="1992003260664804080">"ਤੁਹਾਡੀ ਵਰਤੋਂ ਦੇ ਆਧਾਰ \'ਤੇ ਲਗਭਗ <xliff:g id="TIME_REMAINING">%1$s</xliff:g> ਬਾਕੀ (<xliff:g id="LEVEL">%2$s</xliff:g>)"</string>
-    <string name="power_remaining_duration_only_short" msgid="3463575350656389957">"<xliff:g id="TIME_REMAINING">%1$s</xliff:g> ਬਾਕੀ"</string>
+    <!-- no translation found for power_remaining_duration_only_short (9183070574408359726) -->
+    <skip />
     <string name="power_discharge_by_enhanced" msgid="2095821536747992464">"ਤੁਹਾਡੀ ਵਰਤੋਂ ਦੇ ਆਧਾਰ \'ਤੇ ਲਗਭਗ <xliff:g id="TIME">%1$s</xliff:g> ਚੱਲੇਗਾ (<xliff:g id="LEVEL">%2$s</xliff:g>)"</string>
     <string name="power_discharge_by_only_enhanced" msgid="2175151772952365149">"ਤੁਹਾਡੀ ਵਰਤੋਂ ਦੇ ਆਧਾਰ \'ਤੇ ਲਗਭਗ <xliff:g id="TIME">%1$s</xliff:g> ਚੱਲੇਗਾ"</string>
     <string name="power_discharge_by" msgid="6453537733650125582">"ਲਗਭਗ <xliff:g id="TIME">%1$s</xliff:g> ਚੱਲੇਗਾ (<xliff:g id="LEVEL">%2$s</xliff:g>)"</string>
diff --git a/packages/SettingsLib/res/values-pl/strings.xml b/packages/SettingsLib/res/values-pl/strings.xml
index 505e395..e053514 100644
--- a/packages/SettingsLib/res/values-pl/strings.xml
+++ b/packages/SettingsLib/res/values-pl/strings.xml
@@ -377,7 +377,8 @@
     <string name="power_discharging_duration" msgid="8848256785736335185">"Jeszcze około <xliff:g id="TIME_REMAINING">%1$s</xliff:g> (<xliff:g id="LEVEL">%2$s</xliff:g>)"</string>
     <string name="power_remaining_duration_only_enhanced" msgid="4189311599812296592">"Jeszcze około <xliff:g id="TIME_REMAINING">%1$s</xliff:g> (na podstawie Twojego sposobu korzystania)"</string>
     <string name="power_discharging_duration_enhanced" msgid="1992003260664804080">"Jeszcze około <xliff:g id="TIME_REMAINING">%1$s</xliff:g> (<xliff:g id="LEVEL">%2$s</xliff:g>) (na podstawie Twojego sposobu korzystania)"</string>
-    <string name="power_remaining_duration_only_short" msgid="3463575350656389957">"Jeszcze <xliff:g id="TIME_REMAINING">%1$s</xliff:g>"</string>
+    <!-- no translation found for power_remaining_duration_only_short (9183070574408359726) -->
+    <skip />
     <string name="power_discharge_by_enhanced" msgid="2095821536747992464">"Na podstawie Twojego sposobu korzystania (<xliff:g id="LEVEL">%2$s</xliff:g>) jeszcze około <xliff:g id="TIME">%1$s</xliff:g>"</string>
     <string name="power_discharge_by_only_enhanced" msgid="2175151772952365149">"Na podstawie Twojego sposobu korzystania jeszcze około <xliff:g id="TIME">%1$s</xliff:g>"</string>
     <string name="power_discharge_by" msgid="6453537733650125582">"Powinno wystarczyć do <xliff:g id="TIME">%1$s</xliff:g> (<xliff:g id="LEVEL">%2$s</xliff:g>)"</string>
diff --git a/packages/SettingsLib/res/values-pt-rBR/strings.xml b/packages/SettingsLib/res/values-pt-rBR/strings.xml
index c0f31a6..46b2f93 100644
--- a/packages/SettingsLib/res/values-pt-rBR/strings.xml
+++ b/packages/SettingsLib/res/values-pt-rBR/strings.xml
@@ -377,7 +377,8 @@
     <string name="power_discharging_duration" msgid="8848256785736335185">"Tempo restante aproximado: <xliff:g id="TIME_REMAINING">%1$s</xliff:g> (<xliff:g id="LEVEL">%2$s</xliff:g>)"</string>
     <string name="power_remaining_duration_only_enhanced" msgid="4189311599812296592">"Tempo restante aproximado, com base no seu uso: <xliff:g id="TIME_REMAINING">%1$s</xliff:g>"</string>
     <string name="power_discharging_duration_enhanced" msgid="1992003260664804080">"Tempo restante aproximado, com base no seu uso: <xliff:g id="TIME_REMAINING">%1$s</xliff:g> (<xliff:g id="LEVEL">%2$s</xliff:g>)"</string>
-    <string name="power_remaining_duration_only_short" msgid="3463575350656389957">"Tempo restante: <xliff:g id="TIME_REMAINING">%1$s</xliff:g>"</string>
+    <!-- no translation found for power_remaining_duration_only_short (9183070574408359726) -->
+    <skip />
     <string name="power_discharge_by_enhanced" msgid="2095821536747992464">"Deve durar até cerca de <xliff:g id="TIME">%1$s</xliff:g> com base no seu uso (<xliff:g id="LEVEL">%2$s</xliff:g>)"</string>
     <string name="power_discharge_by_only_enhanced" msgid="2175151772952365149">"Deve durar até cerca de <xliff:g id="TIME">%1$s</xliff:g> com base no seu uso"</string>
     <string name="power_discharge_by" msgid="6453537733650125582">"Deve durar até cerca de <xliff:g id="TIME">%1$s</xliff:g> (<xliff:g id="LEVEL">%2$s</xliff:g>)"</string>
diff --git a/packages/SettingsLib/res/values-pt-rPT/strings.xml b/packages/SettingsLib/res/values-pt-rPT/strings.xml
index 08c3cc8..dd7861d 100644
--- a/packages/SettingsLib/res/values-pt-rPT/strings.xml
+++ b/packages/SettingsLib/res/values-pt-rPT/strings.xml
@@ -377,7 +377,8 @@
     <string name="power_discharging_duration" msgid="8848256785736335185">"Resta(m) cerca de <xliff:g id="TIME_REMAINING">%1$s</xliff:g> (<xliff:g id="LEVEL">%2$s</xliff:g>)"</string>
     <string name="power_remaining_duration_only_enhanced" msgid="4189311599812296592">"Resta(m) cerca de <xliff:g id="TIME_REMAINING">%1$s</xliff:g> com base na sua utilização"</string>
     <string name="power_discharging_duration_enhanced" msgid="1992003260664804080">"Resta(m) cerca de <xliff:g id="TIME_REMAINING">%1$s</xliff:g> com base na sua utilização (<xliff:g id="LEVEL">%2$s</xliff:g>)"</string>
-    <string name="power_remaining_duration_only_short" msgid="3463575350656389957">"Resta(m) <xliff:g id="TIME_REMAINING">%1$s</xliff:g>"</string>
+    <!-- no translation found for power_remaining_duration_only_short (9183070574408359726) -->
+    <skip />
     <string name="power_discharge_by_enhanced" msgid="2095821536747992464">"Deve durar até cerca da(s) <xliff:g id="TIME">%1$s</xliff:g> com base na sua utilização (<xliff:g id="LEVEL">%2$s</xliff:g>)."</string>
     <string name="power_discharge_by_only_enhanced" msgid="2175151772952365149">"Deve durar até cerca da(s) <xliff:g id="TIME">%1$s</xliff:g> com base na sua utilização."</string>
     <string name="power_discharge_by" msgid="6453537733650125582">"Deve durar até cerca da(s) <xliff:g id="TIME">%1$s</xliff:g> (<xliff:g id="LEVEL">%2$s</xliff:g>)."</string>
diff --git a/packages/SettingsLib/res/values-pt/strings.xml b/packages/SettingsLib/res/values-pt/strings.xml
index c0f31a6..46b2f93 100644
--- a/packages/SettingsLib/res/values-pt/strings.xml
+++ b/packages/SettingsLib/res/values-pt/strings.xml
@@ -377,7 +377,8 @@
     <string name="power_discharging_duration" msgid="8848256785736335185">"Tempo restante aproximado: <xliff:g id="TIME_REMAINING">%1$s</xliff:g> (<xliff:g id="LEVEL">%2$s</xliff:g>)"</string>
     <string name="power_remaining_duration_only_enhanced" msgid="4189311599812296592">"Tempo restante aproximado, com base no seu uso: <xliff:g id="TIME_REMAINING">%1$s</xliff:g>"</string>
     <string name="power_discharging_duration_enhanced" msgid="1992003260664804080">"Tempo restante aproximado, com base no seu uso: <xliff:g id="TIME_REMAINING">%1$s</xliff:g> (<xliff:g id="LEVEL">%2$s</xliff:g>)"</string>
-    <string name="power_remaining_duration_only_short" msgid="3463575350656389957">"Tempo restante: <xliff:g id="TIME_REMAINING">%1$s</xliff:g>"</string>
+    <!-- no translation found for power_remaining_duration_only_short (9183070574408359726) -->
+    <skip />
     <string name="power_discharge_by_enhanced" msgid="2095821536747992464">"Deve durar até cerca de <xliff:g id="TIME">%1$s</xliff:g> com base no seu uso (<xliff:g id="LEVEL">%2$s</xliff:g>)"</string>
     <string name="power_discharge_by_only_enhanced" msgid="2175151772952365149">"Deve durar até cerca de <xliff:g id="TIME">%1$s</xliff:g> com base no seu uso"</string>
     <string name="power_discharge_by" msgid="6453537733650125582">"Deve durar até cerca de <xliff:g id="TIME">%1$s</xliff:g> (<xliff:g id="LEVEL">%2$s</xliff:g>)"</string>
diff --git a/packages/SettingsLib/res/values-ro/strings.xml b/packages/SettingsLib/res/values-ro/strings.xml
index 015eb92..3364ce5 100644
--- a/packages/SettingsLib/res/values-ro/strings.xml
+++ b/packages/SettingsLib/res/values-ro/strings.xml
@@ -377,7 +377,8 @@
     <string name="power_discharging_duration" msgid="8848256785736335185">"Timp aproximativ rămas: <xliff:g id="TIME_REMAINING">%1$s</xliff:g> (<xliff:g id="LEVEL">%2$s</xliff:g>)"</string>
     <string name="power_remaining_duration_only_enhanced" msgid="4189311599812296592">"În baza utilizării, timpul rămas este de aproximativ <xliff:g id="TIME_REMAINING">%1$s</xliff:g>"</string>
     <string name="power_discharging_duration_enhanced" msgid="1992003260664804080">"În baza utilizării, timpul rămas este de aproximativ <xliff:g id="TIME_REMAINING">%1$s</xliff:g> (<xliff:g id="LEVEL">%2$s</xliff:g>)"</string>
-    <string name="power_remaining_duration_only_short" msgid="3463575350656389957">"Timp rămas: <xliff:g id="TIME_REMAINING">%1$s</xliff:g>"</string>
+    <!-- no translation found for power_remaining_duration_only_short (9183070574408359726) -->
+    <skip />
     <string name="power_discharge_by_enhanced" msgid="2095821536747992464">"În baza utilizării, ar trebui să reziste până la aproximativ <xliff:g id="TIME">%1$s</xliff:g> (<xliff:g id="LEVEL">%2$s</xliff:g>)"</string>
     <string name="power_discharge_by_only_enhanced" msgid="2175151772952365149">"În baza utilizării, ar trebui să reziste până la aproximativ <xliff:g id="TIME">%1$s</xliff:g>"</string>
     <string name="power_discharge_by" msgid="6453537733650125582">"Ar trebui să reziste până la <xliff:g id="TIME">%1$s</xliff:g> (<xliff:g id="LEVEL">%2$s</xliff:g>)"</string>
diff --git a/packages/SettingsLib/res/values-ru/strings.xml b/packages/SettingsLib/res/values-ru/strings.xml
index b0b592c..ffd477d 100644
--- a/packages/SettingsLib/res/values-ru/strings.xml
+++ b/packages/SettingsLib/res/values-ru/strings.xml
@@ -377,7 +377,8 @@
     <string name="power_discharging_duration" msgid="8848256785736335185">"Заряда (<xliff:g id="LEVEL">%2$s</xliff:g>) хватит примерно на <xliff:g id="TIME_REMAINING">%1$s</xliff:g>"</string>
     <string name="power_remaining_duration_only_enhanced" msgid="4189311599812296592">"Заряда хватит примерно на <xliff:g id="TIME_REMAINING">%1$s</xliff:g> при текущем уровне расхода"</string>
     <string name="power_discharging_duration_enhanced" msgid="1992003260664804080">"Заряда (<xliff:g id="LEVEL">%2$s</xliff:g>) хватит примерно на <xliff:g id="TIME_REMAINING">%1$s</xliff:g> при текущем уровне расхода"</string>
-    <string name="power_remaining_duration_only_short" msgid="3463575350656389957">"Заряда хватит на <xliff:g id="TIME_REMAINING">%1$s</xliff:g>"</string>
+    <!-- no translation found for power_remaining_duration_only_short (9183070574408359726) -->
+    <skip />
     <string name="power_discharge_by_enhanced" msgid="2095821536747992464">"При текущем уровне использования (<xliff:g id="LEVEL">%2$s</xliff:g>) заряда хватит примерно до <xliff:g id="TIME">%1$s</xliff:g>"</string>
     <string name="power_discharge_by_only_enhanced" msgid="2175151772952365149">"При текущем уровне использования заряда хватит примерно до <xliff:g id="TIME">%1$s</xliff:g>"</string>
     <string name="power_discharge_by" msgid="6453537733650125582">"Заряда (<xliff:g id="LEVEL">%2$s</xliff:g>) хватит примерно до <xliff:g id="TIME">%1$s</xliff:g>"</string>
diff --git a/packages/SettingsLib/res/values-si/strings.xml b/packages/SettingsLib/res/values-si/strings.xml
index ca7a962..f3372b3 100644
--- a/packages/SettingsLib/res/values-si/strings.xml
+++ b/packages/SettingsLib/res/values-si/strings.xml
@@ -377,7 +377,8 @@
     <string name="power_discharging_duration" msgid="8848256785736335185">"<xliff:g id="TIME_REMAINING">%1$s</xliff:g> ක් පමණ ඉතිරියි (<xliff:g id="LEVEL">%2$s</xliff:g>)"</string>
     <string name="power_remaining_duration_only_enhanced" msgid="4189311599812296592">"ඔබේ භාවිතය මත පදනම්ව <xliff:g id="TIME_REMAINING">%1$s</xliff:g> පමණ ඉතිරිව ඇත"</string>
     <string name="power_discharging_duration_enhanced" msgid="1992003260664804080">"ඔබේ භාවිතය මත පදනම්ව <xliff:g id="TIME_REMAINING">%1$s</xliff:g> පමණ ඉතිරිව ඇත (<xliff:g id="LEVEL">%2$s</xliff:g>)"</string>
-    <string name="power_remaining_duration_only_short" msgid="3463575350656389957">"<xliff:g id="TIME_REMAINING">%1$s</xliff:g> ඉතිරිව ඇත"</string>
+    <!-- no translation found for power_remaining_duration_only_short (9183070574408359726) -->
+    <skip />
     <string name="power_discharge_by_enhanced" msgid="2095821536747992464">"<xliff:g id="TIME">%1$s</xliff:g> පමණ වන තෙක් (<xliff:g id="LEVEL">%2$s</xliff:g>) ඔබේ භාවිතය මත පදනම්ව තිබිය යුුතුය"</string>
     <string name="power_discharge_by_only_enhanced" msgid="2175151772952365149">"ඔබේ භාවිතය මත පදනම්ව <xliff:g id="TIME">%1$s</xliff:g> පමන වන තෙක් තිබිය යුතුය"</string>
     <string name="power_discharge_by" msgid="6453537733650125582">"<xliff:g id="TIME">%1$s</xliff:g> (<xliff:g id="LEVEL">%2$s</xliff:g>) පමණ වන තෙක් තිබිය යුතුය"</string>
diff --git a/packages/SettingsLib/res/values-sk/strings.xml b/packages/SettingsLib/res/values-sk/strings.xml
index dd7efdd..5451a0b 100644
--- a/packages/SettingsLib/res/values-sk/strings.xml
+++ b/packages/SettingsLib/res/values-sk/strings.xml
@@ -377,7 +377,8 @@
     <string name="power_discharging_duration" msgid="8848256785736335185">"Zostáva približne <xliff:g id="TIME_REMAINING">%1$s</xliff:g> (<xliff:g id="LEVEL">%2$s</xliff:g>)"</string>
     <string name="power_remaining_duration_only_enhanced" msgid="4189311599812296592">"Zostáva približne <xliff:g id="TIME_REMAINING">%1$s</xliff:g> – závisí to od intenzity využitia"</string>
     <string name="power_discharging_duration_enhanced" msgid="1992003260664804080">"Zostáva približne <xliff:g id="TIME_REMAINING">%1$s</xliff:g> – závisí to od intenzity využitia (<xliff:g id="LEVEL">%2$s</xliff:g>)"</string>
-    <string name="power_remaining_duration_only_short" msgid="3463575350656389957">"Zostáva <xliff:g id="TIME_REMAINING">%1$s</xliff:g>"</string>
+    <!-- no translation found for power_remaining_duration_only_short (9183070574408359726) -->
+    <skip />
     <string name="power_discharge_by_enhanced" msgid="2095821536747992464">"Mal by vydržať približne do <xliff:g id="TIME">%1$s</xliff:g> v závislosti od využitia (<xliff:g id="LEVEL">%2$s</xliff:g>)"</string>
     <string name="power_discharge_by_only_enhanced" msgid="2175151772952365149">"Mal by vydržať približne do <xliff:g id="TIME">%1$s</xliff:g> v závislosti od využitia"</string>
     <string name="power_discharge_by" msgid="6453537733650125582">"Mal by vydržať približne <xliff:g id="TIME">%1$s</xliff:g> (<xliff:g id="LEVEL">%2$s</xliff:g>)"</string>
diff --git a/packages/SettingsLib/res/values-sl/strings.xml b/packages/SettingsLib/res/values-sl/strings.xml
index fada686..57265ca 100644
--- a/packages/SettingsLib/res/values-sl/strings.xml
+++ b/packages/SettingsLib/res/values-sl/strings.xml
@@ -377,7 +377,8 @@
     <string name="power_discharging_duration" msgid="8848256785736335185">"Še približno <xliff:g id="TIME_REMAINING">%1$s</xliff:g> (<xliff:g id="LEVEL">%2$s</xliff:g>)"</string>
     <string name="power_remaining_duration_only_enhanced" msgid="4189311599812296592">"Glede na način uporabe še približno <xliff:g id="TIME_REMAINING">%1$s</xliff:g>"</string>
     <string name="power_discharging_duration_enhanced" msgid="1992003260664804080">"Glede na način uporabe še približno <xliff:g id="TIME_REMAINING">%1$s</xliff:g> (<xliff:g id="LEVEL">%2$s</xliff:g>)"</string>
-    <string name="power_remaining_duration_only_short" msgid="3463575350656389957">"Še <xliff:g id="TIME_REMAINING">%1$s</xliff:g>"</string>
+    <!-- no translation found for power_remaining_duration_only_short (9183070574408359726) -->
+    <skip />
     <string name="power_discharge_by_enhanced" msgid="2095821536747992464">"Naprava bi morala glede na način uporabe (<xliff:g id="LEVEL">%2$s</xliff:g>) delovati do približno <xliff:g id="TIME">%1$s</xliff:g>"</string>
     <string name="power_discharge_by_only_enhanced" msgid="2175151772952365149">"Naprava bi morala glede na način uporabe delovati do približno <xliff:g id="TIME">%1$s</xliff:g>"</string>
     <string name="power_discharge_by" msgid="6453537733650125582">"Naprava bi morala delovati do približno <xliff:g id="TIME">%1$s</xliff:g> (<xliff:g id="LEVEL">%2$s</xliff:g>)"</string>
diff --git a/packages/SettingsLib/res/values-sq/strings.xml b/packages/SettingsLib/res/values-sq/strings.xml
index 2132767..231cc1e 100644
--- a/packages/SettingsLib/res/values-sq/strings.xml
+++ b/packages/SettingsLib/res/values-sq/strings.xml
@@ -377,7 +377,8 @@
     <string name="power_discharging_duration" msgid="8848256785736335185">"Rreth <xliff:g id="TIME_REMAINING">%1$s</xliff:g> të mbetura (<xliff:g id="LEVEL">%2$s</xliff:g>)"</string>
     <string name="power_remaining_duration_only_enhanced" msgid="4189311599812296592">"Rreth <xliff:g id="TIME_REMAINING">%1$s</xliff:g> të mbetura bazuar në përdorimin tënd"</string>
     <string name="power_discharging_duration_enhanced" msgid="1992003260664804080">"Rreth <xliff:g id="TIME_REMAINING">%1$s</xliff:g> të mbetura bazuar në përdorimin tënd (<xliff:g id="LEVEL">%2$s</xliff:g>)"</string>
-    <string name="power_remaining_duration_only_short" msgid="3463575350656389957">"<xliff:g id="TIME_REMAINING">%1$s</xliff:g> të mbetura"</string>
+    <!-- no translation found for power_remaining_duration_only_short (9183070574408359726) -->
+    <skip />
     <string name="power_discharge_by_enhanced" msgid="2095821536747992464">"Duhet të zgjasë deri në rreth <xliff:g id="TIME">%1$s</xliff:g> bazuar në përdorimin tënd (<xliff:g id="LEVEL">%2$s</xliff:g>)"</string>
     <string name="power_discharge_by_only_enhanced" msgid="2175151772952365149">"Duhet të zgjasë deri në rreth <xliff:g id="TIME">%1$s</xliff:g> bazuar në përdorimin tënd"</string>
     <string name="power_discharge_by" msgid="6453537733650125582">"Duhet të zgjasë deri në rreth <xliff:g id="TIME">%1$s</xliff:g> (<xliff:g id="LEVEL">%2$s</xliff:g>)"</string>
diff --git a/packages/SettingsLib/res/values-sr/strings.xml b/packages/SettingsLib/res/values-sr/strings.xml
index 6cf4b20..42900f7 100644
--- a/packages/SettingsLib/res/values-sr/strings.xml
+++ b/packages/SettingsLib/res/values-sr/strings.xml
@@ -377,7 +377,8 @@
     <string name="power_discharging_duration" msgid="8848256785736335185">"Преостало је око <xliff:g id="TIME_REMAINING">%1$s</xliff:g> (<xliff:g id="LEVEL">%2$s</xliff:g>)"</string>
     <string name="power_remaining_duration_only_enhanced" msgid="4189311599812296592">"Преостало је око <xliff:g id="TIME_REMAINING">%1$s</xliff:g> на основу коришћења"</string>
     <string name="power_discharging_duration_enhanced" msgid="1992003260664804080">"Преостало је око <xliff:g id="TIME_REMAINING">%1$s</xliff:g> на основу коришћења (<xliff:g id="LEVEL">%2$s</xliff:g>)"</string>
-    <string name="power_remaining_duration_only_short" msgid="3463575350656389957">"Још <xliff:g id="TIME_REMAINING">%1$s</xliff:g>"</string>
+    <!-- no translation found for power_remaining_duration_only_short (9183070574408359726) -->
+    <skip />
     <string name="power_discharge_by_enhanced" msgid="2095821536747992464">"Трајаће приближно до <xliff:g id="TIME">%1$s</xliff:g> на основу коришћења (<xliff:g id="LEVEL">%2$s</xliff:g>)"</string>
     <string name="power_discharge_by_only_enhanced" msgid="2175151772952365149">"Трајаће приближно до <xliff:g id="TIME">%1$s</xliff:g> на основу коришћења"</string>
     <string name="power_discharge_by" msgid="6453537733650125582">"Трајаће приближно до <xliff:g id="TIME">%1$s</xliff:g> (<xliff:g id="LEVEL">%2$s</xliff:g>)"</string>
diff --git a/packages/SettingsLib/res/values-sv/strings.xml b/packages/SettingsLib/res/values-sv/strings.xml
index f2950dc..cc5b76b 100644
--- a/packages/SettingsLib/res/values-sv/strings.xml
+++ b/packages/SettingsLib/res/values-sv/strings.xml
@@ -377,7 +377,8 @@
     <string name="power_discharging_duration" msgid="8848256785736335185">"Cirka <xliff:g id="TIME_REMAINING">%1$s</xliff:g> kvar (<xliff:g id="LEVEL">%2$s</xliff:g>)"</string>
     <string name="power_remaining_duration_only_enhanced" msgid="4189311599812296592">"Cirka <xliff:g id="TIME_REMAINING">%1$s</xliff:g> kvar utifrån din användning"</string>
     <string name="power_discharging_duration_enhanced" msgid="1992003260664804080">"Cirka <xliff:g id="TIME_REMAINING">%1$s</xliff:g> kvar utifrån din användning (<xliff:g id="LEVEL">%2$s</xliff:g>)"</string>
-    <string name="power_remaining_duration_only_short" msgid="3463575350656389957">"<xliff:g id="TIME_REMAINING">%1$s</xliff:g> kvar"</string>
+    <!-- no translation found for power_remaining_duration_only_short (9183070574408359726) -->
+    <skip />
     <string name="power_discharge_by_enhanced" msgid="2095821536747992464">"Bör räcka ungefär till klockan <xliff:g id="TIME">%1$s</xliff:g> utifrån din användning (<xliff:g id="LEVEL">%2$s</xliff:g>)"</string>
     <string name="power_discharge_by_only_enhanced" msgid="2175151772952365149">"Bör räcka ungefär till klockan <xliff:g id="TIME">%1$s</xliff:g> utifrån din användning"</string>
     <string name="power_discharge_by" msgid="6453537733650125582">"Bör räcka ungefär till klockan <xliff:g id="TIME">%1$s</xliff:g> (<xliff:g id="LEVEL">%2$s</xliff:g>)"</string>
diff --git a/packages/SettingsLib/res/values-sw/strings.xml b/packages/SettingsLib/res/values-sw/strings.xml
index d8a74a1..ebe1501 100644
--- a/packages/SettingsLib/res/values-sw/strings.xml
+++ b/packages/SettingsLib/res/values-sw/strings.xml
@@ -377,7 +377,8 @@
     <string name="power_discharging_duration" msgid="8848256785736335185">"Zimesalia takribani <xliff:g id="TIME_REMAINING">%1$s</xliff:g> (<xliff:g id="LEVEL">%2$s</xliff:g>)"</string>
     <string name="power_remaining_duration_only_enhanced" msgid="4189311599812296592">"Zimesalia takribani <xliff:g id="TIME_REMAINING">%1$s</xliff:g> kulingana na jinsi unavyoitumia"</string>
     <string name="power_discharging_duration_enhanced" msgid="1992003260664804080">"Zimesalia takribani <xliff:g id="TIME_REMAINING">%1$s</xliff:g> kulingana na jinsi unavyoitumia (<xliff:g id="LEVEL">%2$s</xliff:g>)"</string>
-    <string name="power_remaining_duration_only_short" msgid="3463575350656389957">"Zimesalia <xliff:g id="TIME_REMAINING">%1$s</xliff:g>"</string>
+    <!-- no translation found for power_remaining_duration_only_short (9183070574408359726) -->
+    <skip />
     <string name="power_discharge_by_enhanced" msgid="2095821536747992464">"Inapaswa kudumu kwa takribani <xliff:g id="TIME">%1$s</xliff:g> kulingana na jinsi unavyoitumia (<xliff:g id="LEVEL">%2$s</xliff:g>)"</string>
     <string name="power_discharge_by_only_enhanced" msgid="2175151772952365149">"Inapaswa kudumu hadi <xliff:g id="TIME">%1$s</xliff:g> kulingana na jinsi unavyoitumia"</string>
     <string name="power_discharge_by" msgid="6453537733650125582">"Inapaswa kudumu kwa takribani <xliff:g id="TIME">%1$s</xliff:g> (<xliff:g id="LEVEL">%2$s</xliff:g>)"</string>
diff --git a/packages/SettingsLib/res/values-ta/strings.xml b/packages/SettingsLib/res/values-ta/strings.xml
index 3cf43c8..951bf99 100644
--- a/packages/SettingsLib/res/values-ta/strings.xml
+++ b/packages/SettingsLib/res/values-ta/strings.xml
@@ -377,7 +377,8 @@
     <string name="power_discharging_duration" msgid="8848256785736335185">"கிட்டத்தட்ட <xliff:g id="TIME_REMAINING">%1$s</xliff:g> மீதமுள்ளது (<xliff:g id="LEVEL">%2$s</xliff:g>)"</string>
     <string name="power_remaining_duration_only_enhanced" msgid="4189311599812296592">"உபயோகத்தின் அடிப்படையில் கிட்டத்தட்ட <xliff:g id="TIME_REMAINING">%1$s</xliff:g> மீதமுள்ளது"</string>
     <string name="power_discharging_duration_enhanced" msgid="1992003260664804080">"உபயோகத்தின் அடிப்படையில் கிட்டத்தட்ட <xliff:g id="TIME_REMAINING">%1$s</xliff:g> மீதமுள்ளது (<xliff:g id="LEVEL">%2$s</xliff:g>)"</string>
-    <string name="power_remaining_duration_only_short" msgid="3463575350656389957">"<xliff:g id="TIME_REMAINING">%1$s</xliff:g> மீதமுள்ளது"</string>
+    <!-- no translation found for power_remaining_duration_only_short (9183070574408359726) -->
+    <skip />
     <string name="power_discharge_by_enhanced" msgid="2095821536747992464">"நீங்கள் பயன்படுத்துவதன் அடிப்படையில், <xliff:g id="TIME">%1$s</xliff:g> வரை உபயோகிக்க முடியும் (<xliff:g id="LEVEL">%2$s</xliff:g>)"</string>
     <string name="power_discharge_by_only_enhanced" msgid="2175151772952365149">"நீங்கள் பயன்படுத்துவதன் அடிப்படையில் <xliff:g id="TIME">%1$s</xliff:g> வரை உபயோகிக்க முடியும்"</string>
     <string name="power_discharge_by" msgid="6453537733650125582">"<xliff:g id="TIME">%1$s</xliff:g> வரை பயன்படுத்த முடியும் (<xliff:g id="LEVEL">%2$s</xliff:g>)"</string>
diff --git a/packages/SettingsLib/res/values-te/strings.xml b/packages/SettingsLib/res/values-te/strings.xml
index e4dd85f..f7b98d1 100644
--- a/packages/SettingsLib/res/values-te/strings.xml
+++ b/packages/SettingsLib/res/values-te/strings.xml
@@ -377,7 +377,8 @@
     <string name="power_discharging_duration" msgid="8848256785736335185">"దాదాపు <xliff:g id="TIME_REMAINING">%1$s</xliff:g> సమయం మిగిలి ఉంది (<xliff:g id="LEVEL">%2$s</xliff:g>)"</string>
     <string name="power_remaining_duration_only_enhanced" msgid="4189311599812296592">"మీ వినియోగం ఆధారంగా దాదాపు <xliff:g id="TIME_REMAINING">%1$s</xliff:g> సమయం మిగిలి ఉంది"</string>
     <string name="power_discharging_duration_enhanced" msgid="1992003260664804080">"మీ వినియోగం ఆధారంగా దాదాపు <xliff:g id="TIME_REMAINING">%1$s</xliff:g> సమయం మిగిలి ఉంది (<xliff:g id="LEVEL">%2$s</xliff:g>)"</string>
-    <string name="power_remaining_duration_only_short" msgid="3463575350656389957">"<xliff:g id="TIME_REMAINING">%1$s</xliff:g> మిగిలి ఉంది"</string>
+    <!-- no translation found for power_remaining_duration_only_short (9183070574408359726) -->
+    <skip />
     <string name="power_discharge_by_enhanced" msgid="2095821536747992464">"మీ వినియోగం ఆధారంగా <xliff:g id="TIME">%1$s</xliff:g> వరకు ఉండాలి (<xliff:g id="LEVEL">%2$s</xliff:g>)"</string>
     <string name="power_discharge_by_only_enhanced" msgid="2175151772952365149">"మీ వినియోగం ఆధారంగా దాదాపు <xliff:g id="TIME">%1$s</xliff:g> వరకు ఉండాలి"</string>
     <string name="power_discharge_by" msgid="6453537733650125582">"దాదాపు <xliff:g id="TIME">%1$s</xliff:g> వరకు ఉండాలి (<xliff:g id="LEVEL">%2$s</xliff:g>)"</string>
diff --git a/packages/SettingsLib/res/values-th/strings.xml b/packages/SettingsLib/res/values-th/strings.xml
index cf8362f..7d161bb 100644
--- a/packages/SettingsLib/res/values-th/strings.xml
+++ b/packages/SettingsLib/res/values-th/strings.xml
@@ -377,7 +377,8 @@
     <string name="power_discharging_duration" msgid="8848256785736335185">"เหลืออีกประมาณ <xliff:g id="TIME_REMAINING">%1$s</xliff:g> (<xliff:g id="LEVEL">%2$s</xliff:g>)"</string>
     <string name="power_remaining_duration_only_enhanced" msgid="4189311599812296592">"เหลืออีกประมาณ <xliff:g id="TIME_REMAINING">%1$s</xliff:g> ขึ้นอยู่กับการใช้งานของคุณ"</string>
     <string name="power_discharging_duration_enhanced" msgid="1992003260664804080">"เหลืออีกประมาณ <xliff:g id="TIME_REMAINING">%1$s</xliff:g> ขึ้นอยู่กับการใช้งานของคุณ (<xliff:g id="LEVEL">%2$s</xliff:g>)"</string>
-    <string name="power_remaining_duration_only_short" msgid="3463575350656389957">"เหลืออีก <xliff:g id="TIME_REMAINING">%1$s</xliff:g>"</string>
+    <!-- no translation found for power_remaining_duration_only_short (9183070574408359726) -->
+    <skip />
     <string name="power_discharge_by_enhanced" msgid="2095821536747992464">"น่าจะใช้งานได้ถึงเวลาประมาณ <xliff:g id="TIME">%1$s</xliff:g> เมื่อดูจากการใช้งานของคุณ (<xliff:g id="LEVEL">%2$s</xliff:g>)"</string>
     <string name="power_discharge_by_only_enhanced" msgid="2175151772952365149">"น่าจะใช้งานได้ถึงเวลาประมาณ <xliff:g id="TIME">%1$s</xliff:g> เมื่อดูจากการใช้งานของคุณ"</string>
     <string name="power_discharge_by" msgid="6453537733650125582">"น่าจะใช้งานได้ถึงเวลาประมาณ <xliff:g id="TIME">%1$s</xliff:g> (<xliff:g id="LEVEL">%2$s</xliff:g>)"</string>
diff --git a/packages/SettingsLib/res/values-tl/strings.xml b/packages/SettingsLib/res/values-tl/strings.xml
index e690800..e9a2a6f 100644
--- a/packages/SettingsLib/res/values-tl/strings.xml
+++ b/packages/SettingsLib/res/values-tl/strings.xml
@@ -377,7 +377,8 @@
     <string name="power_discharging_duration" msgid="8848256785736335185">"Humigit-kumulang <xliff:g id="TIME_REMAINING">%1$s</xliff:g> ang natitira (<xliff:g id="LEVEL">%2$s</xliff:g>)"</string>
     <string name="power_remaining_duration_only_enhanced" msgid="4189311599812296592">"Humigit-kumulang <xliff:g id="TIME_REMAINING">%1$s</xliff:g> ang natitira batay sa iyong paggamit"</string>
     <string name="power_discharging_duration_enhanced" msgid="1992003260664804080">"Humigit-kumulang <xliff:g id="TIME_REMAINING">%1$s</xliff:g> ang natitira batay sa iyong paggamit (<xliff:g id="LEVEL">%2$s</xliff:g>)"</string>
-    <string name="power_remaining_duration_only_short" msgid="3463575350656389957">"<xliff:g id="TIME_REMAINING">%1$s</xliff:g> ang natitira"</string>
+    <!-- no translation found for power_remaining_duration_only_short (9183070574408359726) -->
+    <skip />
     <string name="power_discharge_by_enhanced" msgid="2095821536747992464">"Tatagal dapat nang hanggang humigit-kumulang <xliff:g id="TIME">%1$s</xliff:g> batay sa iyong paggamit (<xliff:g id="LEVEL">%2$s</xliff:g>)"</string>
     <string name="power_discharge_by_only_enhanced" msgid="2175151772952365149">"Tatagal dapat nang hanggang humigit-kumulang <xliff:g id="TIME">%1$s</xliff:g> batay sa iyong paggamit"</string>
     <string name="power_discharge_by" msgid="6453537733650125582">"Tatagal dapat nang hanggang humigit-kumulang <xliff:g id="TIME">%1$s</xliff:g> (<xliff:g id="LEVEL">%2$s</xliff:g>)"</string>
diff --git a/packages/SettingsLib/res/values-tr/strings.xml b/packages/SettingsLib/res/values-tr/strings.xml
index ea340e8..73f1c40 100644
--- a/packages/SettingsLib/res/values-tr/strings.xml
+++ b/packages/SettingsLib/res/values-tr/strings.xml
@@ -377,7 +377,8 @@
     <string name="power_discharging_duration" msgid="8848256785736335185">"Yaklaşık <xliff:g id="TIME_REMAINING">%1$s</xliff:g> kaldı (<xliff:g id="LEVEL">%2$s</xliff:g>)"</string>
     <string name="power_remaining_duration_only_enhanced" msgid="4189311599812296592">"Kullanımınıza dayalı olarak yaklaşık <xliff:g id="TIME_REMAINING">%1$s</xliff:g> kaldı"</string>
     <string name="power_discharging_duration_enhanced" msgid="1992003260664804080">"Kullanımınıza dayalı olarak yaklaşık <xliff:g id="TIME_REMAINING">%1$s</xliff:g> kaldı (<xliff:g id="LEVEL">%2$s</xliff:g>)"</string>
-    <string name="power_remaining_duration_only_short" msgid="3463575350656389957">"<xliff:g id="TIME_REMAINING">%1$s</xliff:g> kaldı"</string>
+    <!-- no translation found for power_remaining_duration_only_short (9183070574408359726) -->
+    <skip />
     <string name="power_discharge_by_enhanced" msgid="2095821536747992464">"Kullanımınıza göre saat yaklaşık <xliff:g id="TIME">%1$s</xliff:g> olana kadar kullanılabilmelidir (<xliff:g id="LEVEL">%2$s</xliff:g>)"</string>
     <string name="power_discharge_by_only_enhanced" msgid="2175151772952365149">"Kullanımınıza göre saat yaklaşık <xliff:g id="TIME">%1$s</xliff:g> olana kadar kullanılabilmelidir"</string>
     <string name="power_discharge_by" msgid="6453537733650125582">"Saat yaklaşık <xliff:g id="TIME">%1$s</xliff:g> olana kadar kullanılabilmelidir (<xliff:g id="LEVEL">%2$s</xliff:g>)"</string>
diff --git a/packages/SettingsLib/res/values-uk/strings.xml b/packages/SettingsLib/res/values-uk/strings.xml
index cf90ed1..41d6883 100644
--- a/packages/SettingsLib/res/values-uk/strings.xml
+++ b/packages/SettingsLib/res/values-uk/strings.xml
@@ -377,7 +377,8 @@
     <string name="power_discharging_duration" msgid="8848256785736335185">"Залишилося приблизно <xliff:g id="TIME_REMAINING">%1$s</xliff:g> (<xliff:g id="LEVEL">%2$s</xliff:g>)"</string>
     <string name="power_remaining_duration_only_enhanced" msgid="4189311599812296592">"Згідно з даними про використання залишилося приблизно <xliff:g id="TIME_REMAINING">%1$s</xliff:g>"</string>
     <string name="power_discharging_duration_enhanced" msgid="1992003260664804080">"Згідно з даними про використання залишилося приблизно <xliff:g id="TIME_REMAINING">%1$s</xliff:g> (<xliff:g id="LEVEL">%2$s</xliff:g>)"</string>
-    <string name="power_remaining_duration_only_short" msgid="3463575350656389957">"Залишилося <xliff:g id="TIME_REMAINING">%1$s</xliff:g>"</string>
+    <!-- no translation found for power_remaining_duration_only_short (9183070574408359726) -->
+    <skip />
     <string name="power_discharge_by_enhanced" msgid="2095821536747992464">"На основі даних про використання (<xliff:g id="LEVEL">%2$s</xliff:g>), вистачить приблизно до <xliff:g id="TIME">%1$s</xliff:g>"</string>
     <string name="power_discharge_by_only_enhanced" msgid="2175151772952365149">"На основі даних про використання, вистачить приблизно до <xliff:g id="TIME">%1$s</xliff:g>"</string>
     <string name="power_discharge_by" msgid="6453537733650125582">"Вистачить приблизно до <xliff:g id="TIME">%1$s</xliff:g> (<xliff:g id="LEVEL">%2$s</xliff:g>)"</string>
diff --git a/packages/SettingsLib/res/values-ur/strings.xml b/packages/SettingsLib/res/values-ur/strings.xml
index c223629..0478a76 100644
--- a/packages/SettingsLib/res/values-ur/strings.xml
+++ b/packages/SettingsLib/res/values-ur/strings.xml
@@ -377,7 +377,8 @@
     <string name="power_discharging_duration" msgid="8848256785736335185">"تقریباً <xliff:g id="TIME_REMAINING">%1$s</xliff:g> باقی ہے (<xliff:g id="LEVEL">%2$s</xliff:g>)"</string>
     <string name="power_remaining_duration_only_enhanced" msgid="4189311599812296592">"آپ کے استعمال کی بنیاد پر تقریباً <xliff:g id="TIME_REMAINING">%1$s</xliff:g> باقی ہے"</string>
     <string name="power_discharging_duration_enhanced" msgid="1992003260664804080">"آپ کے استعمال کی بنیاد پر تقریباً <xliff:g id="TIME_REMAINING">%1$s</xliff:g> باقی ہے (<xliff:g id="LEVEL">%2$s</xliff:g>)"</string>
-    <string name="power_remaining_duration_only_short" msgid="3463575350656389957">"<xliff:g id="TIME_REMAINING">%1$s</xliff:g> باقی ہے"</string>
+    <!-- no translation found for power_remaining_duration_only_short (9183070574408359726) -->
+    <skip />
     <string name="power_discharge_by_enhanced" msgid="2095821536747992464">"آپ کے استعمال کی بنیاد پر تقریباً <xliff:g id="TIME">%1$s</xliff:g> تک بیٹری چلے گی (<xliff:g id="LEVEL">%2$s</xliff:g>)"</string>
     <string name="power_discharge_by_only_enhanced" msgid="2175151772952365149">"آپ کے استعمال کی بنیاد پر تقریباً <xliff:g id="TIME">%1$s</xliff:g> تک بیٹری چلے گی"</string>
     <string name="power_discharge_by" msgid="6453537733650125582">"تقریباً <xliff:g id="TIME">%1$s</xliff:g> تک بیٹری چلے گی (<xliff:g id="LEVEL">%2$s</xliff:g>)"</string>
diff --git a/packages/SettingsLib/res/values-uz/strings.xml b/packages/SettingsLib/res/values-uz/strings.xml
index 2851baf..d4eb44b 100644
--- a/packages/SettingsLib/res/values-uz/strings.xml
+++ b/packages/SettingsLib/res/values-uz/strings.xml
@@ -377,7 +377,8 @@
     <string name="power_discharging_duration" msgid="8848256785736335185">"Taxminan <xliff:g id="TIME_REMAINING">%1$s</xliff:g> qoldi (<xliff:g id="LEVEL">%2$s</xliff:g>)"</string>
     <string name="power_remaining_duration_only_enhanced" msgid="4189311599812296592">"Joriy holatda taxminan <xliff:g id="TIME_REMAINING">%1$s</xliff:g> qoldi"</string>
     <string name="power_discharging_duration_enhanced" msgid="1992003260664804080">"Joriy holatda taxminan <xliff:g id="TIME_REMAINING">%1$s</xliff:g> qoldi (<xliff:g id="LEVEL">%2$s</xliff:g>)"</string>
-    <string name="power_remaining_duration_only_short" msgid="3463575350656389957">"<xliff:g id="TIME_REMAINING">%1$s</xliff:g> qoldi"</string>
+    <!-- no translation found for power_remaining_duration_only_short (9183070574408359726) -->
+    <skip />
     <string name="power_discharge_by_enhanced" msgid="2095821536747992464">"Joriy holatda taxminan <xliff:g id="TIME">%1$s</xliff:g> gacha davom etadi (<xliff:g id="LEVEL">%2$s</xliff:g>)"</string>
     <string name="power_discharge_by_only_enhanced" msgid="2175151772952365149">"Joriy holatda taxminan <xliff:g id="TIME">%1$s</xliff:g> gacha davom etadi"</string>
     <string name="power_discharge_by" msgid="6453537733650125582">"Taxminan <xliff:g id="TIME">%1$s</xliff:g> gacha davom etadi (<xliff:g id="LEVEL">%2$s</xliff:g>)"</string>
diff --git a/packages/SettingsLib/res/values-vi/strings.xml b/packages/SettingsLib/res/values-vi/strings.xml
index 3fb101e..050ee9c 100644
--- a/packages/SettingsLib/res/values-vi/strings.xml
+++ b/packages/SettingsLib/res/values-vi/strings.xml
@@ -377,7 +377,8 @@
     <string name="power_discharging_duration" msgid="8848256785736335185">"Còn khoảng <xliff:g id="TIME_REMAINING">%1$s</xliff:g> (<xliff:g id="LEVEL">%2$s</xliff:g>)"</string>
     <string name="power_remaining_duration_only_enhanced" msgid="4189311599812296592">"Còn khoảng <xliff:g id="TIME_REMAINING">%1$s</xliff:g> dựa trên mức sử dụng của bạn"</string>
     <string name="power_discharging_duration_enhanced" msgid="1992003260664804080">"Còn khoảng <xliff:g id="TIME_REMAINING">%1$s</xliff:g> dựa trên mức sử dụng của bạn (<xliff:g id="LEVEL">%2$s</xliff:g>)"</string>
-    <string name="power_remaining_duration_only_short" msgid="3463575350656389957">"Còn <xliff:g id="TIME_REMAINING">%1$s</xliff:g>"</string>
+    <!-- no translation found for power_remaining_duration_only_short (9183070574408359726) -->
+    <skip />
     <string name="power_discharge_by_enhanced" msgid="2095821536747992464">"Sẽ hết pin cho tới khoảng <xliff:g id="TIME">%1$s</xliff:g> dựa trên mức sử dụng của bạn (<xliff:g id="LEVEL">%2$s</xliff:g>)"</string>
     <string name="power_discharge_by_only_enhanced" msgid="2175151772952365149">"Sẽ hết pin cho tới khoảng <xliff:g id="TIME">%1$s</xliff:g> dựa trên mức sử dụng của bạn"</string>
     <string name="power_discharge_by" msgid="6453537733650125582">"Sẽ hết pin cho tới khoảng <xliff:g id="TIME">%1$s</xliff:g> (<xliff:g id="LEVEL">%2$s</xliff:g>)"</string>
diff --git a/packages/SettingsLib/res/values-zh-rCN/strings.xml b/packages/SettingsLib/res/values-zh-rCN/strings.xml
index 0a318d7..e25e4dc 100644
--- a/packages/SettingsLib/res/values-zh-rCN/strings.xml
+++ b/packages/SettingsLib/res/values-zh-rCN/strings.xml
@@ -377,7 +377,8 @@
     <string name="power_discharging_duration" msgid="8848256785736335185">"大约还可使用 <xliff:g id="TIME_REMAINING">%1$s</xliff:g> (<xliff:g id="LEVEL">%2$s</xliff:g>)"</string>
     <string name="power_remaining_duration_only_enhanced" msgid="4189311599812296592">"根据您的使用情况,大约还可使用 <xliff:g id="TIME_REMAINING">%1$s</xliff:g>"</string>
     <string name="power_discharging_duration_enhanced" msgid="1992003260664804080">"根据您的使用情况,大约还可使用 <xliff:g id="TIME_REMAINING">%1$s</xliff:g> (<xliff:g id="LEVEL">%2$s</xliff:g>)"</string>
-    <string name="power_remaining_duration_only_short" msgid="3463575350656389957">"还可使用 <xliff:g id="TIME_REMAINING">%1$s</xliff:g>"</string>
+    <!-- no translation found for power_remaining_duration_only_short (9183070574408359726) -->
+    <skip />
     <string name="power_discharge_by_enhanced" msgid="2095821536747992464">"根据您的使用情况,估计能用到<xliff:g id="TIME">%1$s</xliff:g>(目前电量为 <xliff:g id="LEVEL">%2$s</xliff:g>)"</string>
     <string name="power_discharge_by_only_enhanced" msgid="2175151772952365149">"根据您的使用情况,估计能用到<xliff:g id="TIME">%1$s</xliff:g>"</string>
     <string name="power_discharge_by" msgid="6453537733650125582">"目前电量为 <xliff:g id="LEVEL">%2$s</xliff:g>,估计能用到<xliff:g id="TIME">%1$s</xliff:g>"</string>
diff --git a/packages/SettingsLib/res/values-zh-rHK/strings.xml b/packages/SettingsLib/res/values-zh-rHK/strings.xml
index 06bee94..3e357b1 100644
--- a/packages/SettingsLib/res/values-zh-rHK/strings.xml
+++ b/packages/SettingsLib/res/values-zh-rHK/strings.xml
@@ -377,7 +377,8 @@
     <string name="power_discharging_duration" msgid="8848256785736335185">"還有大約 <xliff:g id="TIME_REMAINING">%1$s</xliff:g> (<xliff:g id="LEVEL">%2$s</xliff:g>)"</string>
     <string name="power_remaining_duration_only_enhanced" msgid="4189311599812296592">"根據您的使用情況,還有大約 <xliff:g id="TIME_REMAINING">%1$s</xliff:g>"</string>
     <string name="power_discharging_duration_enhanced" msgid="1992003260664804080">"根據您的使用情況,還有大約 <xliff:g id="TIME_REMAINING">%1$s</xliff:g> (<xliff:g id="LEVEL">%2$s</xliff:g>)"</string>
-    <string name="power_remaining_duration_only_short" msgid="3463575350656389957">"還有 <xliff:g id="TIME_REMAINING">%1$s</xliff:g>"</string>
+    <!-- no translation found for power_remaining_duration_only_short (9183070574408359726) -->
+    <skip />
     <string name="power_discharge_by_enhanced" msgid="2095821536747992464">"根據您的使用情況 (<xliff:g id="LEVEL">%2$s</xliff:g>),電量剩餘約 <xliff:g id="TIME">%1$s</xliff:g>"</string>
     <string name="power_discharge_by_only_enhanced" msgid="2175151772952365149">"根據您的使用情況,電量剩餘約 <xliff:g id="TIME">%1$s</xliff:g>"</string>
     <string name="power_discharge_by" msgid="6453537733650125582">"電量剩餘約 <xliff:g id="TIME">%1$s</xliff:g> (<xliff:g id="LEVEL">%2$s</xliff:g>)"</string>
diff --git a/packages/SettingsLib/res/values-zh-rTW/strings.xml b/packages/SettingsLib/res/values-zh-rTW/strings.xml
index a5074d9..60330ef 100644
--- a/packages/SettingsLib/res/values-zh-rTW/strings.xml
+++ b/packages/SettingsLib/res/values-zh-rTW/strings.xml
@@ -377,7 +377,8 @@
     <string name="power_discharging_duration" msgid="8848256785736335185">"目前電量為 <xliff:g id="LEVEL">%2$s</xliff:g>,還能使用約 <xliff:g id="TIME_REMAINING">%1$s</xliff:g>"</string>
     <string name="power_remaining_duration_only_enhanced" msgid="4189311599812296592">"根據你的使用情形,還能使用約 <xliff:g id="TIME_REMAINING">%1$s</xliff:g>"</string>
     <string name="power_discharging_duration_enhanced" msgid="1992003260664804080">"根據你的使用情形,目前電量為 <xliff:g id="LEVEL">%2$s</xliff:g>,還能使用約 <xliff:g id="TIME_REMAINING">%1$s</xliff:g>"</string>
-    <string name="power_remaining_duration_only_short" msgid="3463575350656389957">"還能使用 <xliff:g id="TIME_REMAINING">%1$s</xliff:g>"</string>
+    <!-- no translation found for power_remaining_duration_only_short (9183070574408359726) -->
+    <skip />
     <string name="power_discharge_by_enhanced" msgid="2095821536747992464">"根據你的使用情形,目前電量為 <xliff:g id="LEVEL">%2$s</xliff:g>,預估可持續使用到<xliff:g id="TIME">%1$s</xliff:g>"</string>
     <string name="power_discharge_by_only_enhanced" msgid="2175151772952365149">"根據你的使用情形,預估可持續使用到<xliff:g id="TIME">%1$s</xliff:g>"</string>
     <string name="power_discharge_by" msgid="6453537733650125582">"目前電量 <xliff:g id="LEVEL">%2$s</xliff:g>,預估還能持續使用到<xliff:g id="TIME">%1$s</xliff:g>"</string>
diff --git a/packages/SettingsLib/res/values-zu/strings.xml b/packages/SettingsLib/res/values-zu/strings.xml
index 5892093..a1be06c 100644
--- a/packages/SettingsLib/res/values-zu/strings.xml
+++ b/packages/SettingsLib/res/values-zu/strings.xml
@@ -377,7 +377,8 @@
     <string name="power_discharging_duration" msgid="8848256785736335185">"Cishe u-<xliff:g id="TIME_REMAINING">%1$s</xliff:g> osele (<xliff:g id="LEVEL">%2$s</xliff:g>)"</string>
     <string name="power_remaining_duration_only_enhanced" msgid="4189311599812296592">"Cishe u-<xliff:g id="TIME_REMAINING">%1$s</xliff:g> osele ngokususelwe ekusebenziseni wakho"</string>
     <string name="power_discharging_duration_enhanced" msgid="1992003260664804080">"Cishe u-<xliff:g id="TIME_REMAINING">%1$s</xliff:g> osele ngokususelwe ekusebenziseni kwakho (<xliff:g id="LEVEL">%2$s</xliff:g>)"</string>
-    <string name="power_remaining_duration_only_short" msgid="3463575350656389957">"<xliff:g id="TIME_REMAINING">%1$s</xliff:g> esele"</string>
+    <!-- no translation found for power_remaining_duration_only_short (9183070574408359726) -->
+    <skip />
     <string name="power_discharge_by_enhanced" msgid="2095821536747992464">"Kumele ihlale cishe kube ngu-<xliff:g id="TIME">%1$s</xliff:g> kusukela ekusetshenzisweni kwakho (<xliff:g id="LEVEL">%2$s</xliff:g>)"</string>
     <string name="power_discharge_by_only_enhanced" msgid="2175151772952365149">"Kumele ihlale cishe kube ngu-<xliff:g id="TIME">%1$s</xliff:g> kusukela ekusetshenzisweni kwakho"</string>
     <string name="power_discharge_by" msgid="6453537733650125582">"Kumele ihlale cishe kube ngu-<xliff:g id="TIME">%1$s</xliff:g> (<xliff:g id="LEVEL">%2$s</xliff:g>)"</string>
diff --git a/packages/SettingsLib/res/values/strings.xml b/packages/SettingsLib/res/values/strings.xml
index f5d58d8..c60e8c3 100644
--- a/packages/SettingsLib/res/values/strings.xml
+++ b/packages/SettingsLib/res/values/strings.xml
@@ -938,7 +938,7 @@
     <!-- [CHAR_LIMIT=60] Label for battery level chart when discharging with duration and using enhanced estimate -->
     <string name="power_discharging_duration_enhanced">About <xliff:g id="time_remaining">%1$s</xliff:g> left based on your usage (<xliff:g id="level">%2$s</xliff:g>)</string>
     <!-- [CHAR_LIMIT=40] Short label for estimated remaining duration of battery charging/discharging -->
-    <string name="power_remaining_duration_only_short"><xliff:g id="time_remaining">%1$s</xliff:g> left</string>
+    <string name="power_remaining_duration_only_short"><xliff:g id="time_remaining">%1$s</xliff:g></string>
 
     <!-- [CHAR_LIMIT=100] Label for enhanced estimated time that phone will run out of battery -->
     <string name="power_discharge_by_enhanced">Should last until about <xliff:g id="time">%1$s</xliff:g> based on your usage (<xliff:g id="level">%2$s</xliff:g>)</string>
@@ -950,6 +950,8 @@
     <string name="power_discharge_by_only">Should last until about <xliff:g id="time">%1$s</xliff:g></string>
     <!-- [CHAR_LIMIT=100] Label for estimated time that phone will run out of battery -->
     <string name="power_discharge_by_only_short">Until <xliff:g id="time" example="12 PM">%1$s</xliff:g></string>
+    <!-- [CHAR_LIMIT=100] Extend the battery life past a certain time -->
+    <string name="power_suggestion_extend_battery">Extend battery life past <xliff:g id="time" example="12 PM">%1$s</xliff:g></string>
 
     <!-- [CHAR_LIMIT=60] label for estimated remaining duration of battery when under a certain amount -->
     <string name="power_remaining_less_than_duration_only">Less than <xliff:g id="threshold">%1$s</xliff:g> remaining</string>
diff --git a/packages/SettingsLib/src/com/android/settingslib/bluetooth/A2dpProfile.java b/packages/SettingsLib/src/com/android/settingslib/bluetooth/A2dpProfile.java
index bed3030..785dd56 100644
--- a/packages/SettingsLib/src/com/android/settingslib/bluetooth/A2dpProfile.java
+++ b/packages/SettingsLib/src/com/android/settingslib/bluetooth/A2dpProfile.java
@@ -108,12 +108,43 @@
         return true;
     }
 
+    /**
+     * Get A2dp devices matching connection states{
+     * @code BluetoothProfile.STATE_CONNECTED,
+     * @code BluetoothProfile.STATE_CONNECTING,
+     * @code BluetoothProfile.STATE_DISCONNECTING}
+     *
+     * @return Matching device list
+     */
     public List<BluetoothDevice> getConnectedDevices() {
-        if (mService == null) return new ArrayList<BluetoothDevice>(0);
-        return mService.getDevicesMatchingConnectionStates(
-              new int[] {BluetoothProfile.STATE_CONNECTED,
-                         BluetoothProfile.STATE_CONNECTING,
-                         BluetoothProfile.STATE_DISCONNECTING});
+        return getDevicesByStates(new int[] {
+                BluetoothProfile.STATE_CONNECTED,
+                BluetoothProfile.STATE_CONNECTING,
+                BluetoothProfile.STATE_DISCONNECTING});
+    }
+
+    /**
+     * Get A2dp devices matching connection states{
+     * @code BluetoothProfile.STATE_DISCONNECTED,
+     * @code BluetoothProfile.STATE_CONNECTED,
+     * @code BluetoothProfile.STATE_CONNECTING,
+     * @code BluetoothProfile.STATE_DISCONNECTING}
+     *
+     * @return Matching device list
+     */
+    public List<BluetoothDevice> getConnectableDevices() {
+        return getDevicesByStates(new int[] {
+                BluetoothProfile.STATE_DISCONNECTED,
+                BluetoothProfile.STATE_CONNECTED,
+                BluetoothProfile.STATE_CONNECTING,
+                BluetoothProfile.STATE_DISCONNECTING});
+    }
+
+    private List<BluetoothDevice> getDevicesByStates(int[] states) {
+        if (mService == null) {
+            return new ArrayList<BluetoothDevice>(0);
+        }
+        return mService.getDevicesMatchingConnectionStates(states);
     }
 
     public boolean connect(BluetoothDevice device) {
diff --git a/packages/SettingsLib/src/com/android/settingslib/bluetooth/HearingAidProfile.java b/packages/SettingsLib/src/com/android/settingslib/bluetooth/HearingAidProfile.java
index 41c1d60..ebaeb74 100644
--- a/packages/SettingsLib/src/com/android/settingslib/bluetooth/HearingAidProfile.java
+++ b/packages/SettingsLib/src/com/android/settingslib/bluetooth/HearingAidProfile.java
@@ -106,12 +106,43 @@
         return true;
     }
 
+    /**
+     * Get Hearing Aid devices matching connection states{
+     * @code BluetoothProfile.STATE_CONNECTED,
+     * @code BluetoothProfile.STATE_CONNECTING,
+     * @code BluetoothProfile.STATE_DISCONNECTING}
+     *
+     * @return Matching device list
+     */
     public List<BluetoothDevice> getConnectedDevices() {
-        if (mService == null) return new ArrayList<BluetoothDevice>(0);
-        return mService.getDevicesMatchingConnectionStates(
-              new int[] {BluetoothProfile.STATE_CONNECTED,
-                         BluetoothProfile.STATE_CONNECTING,
-                         BluetoothProfile.STATE_DISCONNECTING});
+        return getDevicesByStates(new int[] {
+                BluetoothProfile.STATE_CONNECTED,
+                BluetoothProfile.STATE_CONNECTING,
+                BluetoothProfile.STATE_DISCONNECTING});
+    }
+
+    /**
+     * Get Hearing Aid devices matching connection states{
+     * @code BluetoothProfile.STATE_DISCONNECTED,
+     * @code BluetoothProfile.STATE_CONNECTED,
+     * @code BluetoothProfile.STATE_CONNECTING,
+     * @code BluetoothProfile.STATE_DISCONNECTING}
+     *
+     * @return Matching device list
+     */
+    public List<BluetoothDevice> getConnectableDevices() {
+        return getDevicesByStates(new int[] {
+                BluetoothProfile.STATE_DISCONNECTED,
+                BluetoothProfile.STATE_CONNECTED,
+                BluetoothProfile.STATE_CONNECTING,
+                BluetoothProfile.STATE_DISCONNECTING});
+    }
+
+    private List<BluetoothDevice> getDevicesByStates(int[] states) {
+        if (mService == null) {
+            return new ArrayList<BluetoothDevice>(0);
+        }
+        return mService.getDevicesMatchingConnectionStates(states);
     }
 
     public boolean connect(BluetoothDevice device) {
diff --git a/packages/SettingsLib/src/com/android/settingslib/drawer/Tile.java b/packages/SettingsLib/src/com/android/settingslib/drawer/Tile.java
index a6b2410..bee1b3c 100644
--- a/packages/SettingsLib/src/com/android/settingslib/drawer/Tile.java
+++ b/packages/SettingsLib/src/com/android/settingslib/drawer/Tile.java
@@ -41,6 +41,8 @@
 import android.text.TextUtils;
 import android.util.Log;
 
+import androidx.annotation.VisibleForTesting;
+
 import java.util.ArrayList;
 import java.util.Comparator;
 import java.util.List;
@@ -58,6 +60,8 @@
      */
     public ArrayList<UserHandle> userHandle = new ArrayList<>();
 
+    @VisibleForTesting
+    long mLastUpdateTime;
     private final String mActivityPackage;
     private final String mActivityName;
     private final Intent mIntent;
@@ -157,6 +161,7 @@
      */
     public CharSequence getTitle(Context context) {
         CharSequence title = null;
+        ensureMetadataNotStale(context);
         final PackageManager packageManager = context.getPackageManager();
         if (mMetaData.containsKey(META_DATA_PREFERENCE_TITLE)) {
             if (mMetaData.get(META_DATA_PREFERENCE_TITLE) instanceof Integer) {
@@ -207,6 +212,7 @@
         if (mSummaryOverride != null) {
             return mSummaryOverride;
         }
+        ensureMetadataNotStale(context);
         CharSequence summary = null;
         final PackageManager packageManager = context.getPackageManager();
         if (mMetaData != null) {
@@ -248,6 +254,7 @@
         if (!hasKey()) {
             return null;
         }
+        ensureMetadataNotStale(context);
         if (mMetaData.get(META_DATA_PREFERENCE_KEYHINT) instanceof Integer) {
             return context.getResources().getString(mMetaData.getInt(META_DATA_PREFERENCE_KEYHINT));
         } else {
@@ -268,7 +275,7 @@
         if (context == null || mMetaData == null) {
             return null;
         }
-
+        ensureMetadataNotStale(context);
         int iconResId = mMetaData.getInt(META_DATA_PREFERENCE_ICON);
         // Set the icon
         if (iconResId == 0) {
@@ -294,6 +301,7 @@
                 && mMetaData.containsKey(TileUtils.META_DATA_PREFERENCE_ICON_TINTABLE)) {
             return mMetaData.getBoolean(TileUtils.META_DATA_PREFERENCE_ICON_TINTABLE);
         }
+        ensureMetadataNotStale(context);
         final String pkgName = context.getPackageName();
         // If this drawable is coming from outside Settings, tint it to match the color.
         final ActivityInfo activityInfo = getActivityInfo(context);
@@ -301,6 +309,28 @@
                 && !TextUtils.equals(pkgName, activityInfo.packageName);
     }
 
+    /**
+     * Ensures metadata is not stale for this tile.
+     */
+    private void ensureMetadataNotStale(Context context) {
+        final PackageManager pm = context.getApplicationContext().getPackageManager();
+
+        try {
+            final long lastUpdateTime = pm.getPackageInfo(mActivityPackage,
+                    PackageManager.GET_META_DATA).lastUpdateTime;
+            if (lastUpdateTime == mLastUpdateTime) {
+                // All good. Do nothing
+                return;
+            }
+            // App has been updated since we load metadata last time. Reload metadata.
+            mActivityInfo = null;
+            getActivityInfo(context);
+            mLastUpdateTime = lastUpdateTime;
+        } catch (PackageManager.NameNotFoundException e) {
+            Log.d(TAG, "Can't find package, probably uninstalled.");
+        }
+    }
+
     private ActivityInfo getActivityInfo(Context context) {
         if (mActivityInfo == null) {
             final PackageManager pm = context.getApplicationContext().getPackageManager();
@@ -309,6 +339,7 @@
                     pm.queryIntentActivities(intent, PackageManager.GET_META_DATA);
             if (infoList != null && !infoList.isEmpty()) {
                 mActivityInfo = infoList.get(0).activityInfo;
+                mMetaData = mActivityInfo.metaData;
             }
         }
         return mActivityInfo;
diff --git a/packages/SettingsLib/src/com/android/settingslib/graph/ThemedBatteryDrawable.kt b/packages/SettingsLib/src/com/android/settingslib/graph/ThemedBatteryDrawable.kt
index 337106b..a62872c 100644
--- a/packages/SettingsLib/src/com/android/settingslib/graph/ThemedBatteryDrawable.kt
+++ b/packages/SettingsLib/src/com/android/settingslib/graph/ThemedBatteryDrawable.kt
@@ -87,7 +87,8 @@
         invalidateSelf()
     }
 
-    open var criticalLevel: Int = 0
+    open var criticalLevel: Int = context.resources.getInteger(
+            com.android.internal.R.integer.config_criticalBatteryWarningLevel)
 
     var charging = false
         set(value) {
@@ -101,46 +102,48 @@
             postInvalidate()
         }
 
-    private val fillColorStrokePaint: Paint by lazy {
-        val p = Paint(Paint.ANTI_ALIAS_FLAG)
+    private val fillColorStrokePaint = Paint(Paint.ANTI_ALIAS_FLAG).also { p ->
         p.color = frameColor
         p.isDither = true
         p.strokeWidth = 5f
         p.style = Paint.Style.STROKE
         p.blendMode = BlendMode.SRC
         p.strokeMiter = 5f
-        p
+        p.strokeJoin = Paint.Join.ROUND
     }
 
-    private val fillColorStrokeProtection: Paint by lazy {
-        val p = Paint(Paint.ANTI_ALIAS_FLAG)
+    private val fillColorStrokeProtection = Paint(Paint.ANTI_ALIAS_FLAG).also { p ->
         p.isDither = true
         p.strokeWidth = 5f
         p.style = Paint.Style.STROKE
         p.blendMode = BlendMode.CLEAR
         p.strokeMiter = 5f
-        p
+        p.strokeJoin = Paint.Join.ROUND
     }
 
-    private val fillPaint: Paint by lazy {
-        val p = Paint(Paint.ANTI_ALIAS_FLAG)
+    private val fillPaint = Paint(Paint.ANTI_ALIAS_FLAG).also { p ->
         p.color = frameColor
         p.alpha = 255
         p.isDither = true
         p.strokeWidth = 0f
         p.style = Paint.Style.FILL_AND_STROKE
-        p
+    }
+
+    private val errorPaint = Paint(Paint.ANTI_ALIAS_FLAG).also { p ->
+        p.color = Utils.getColorErrorDefaultColor(context)
+        p.alpha = 255
+        p.isDither = true
+        p.strokeWidth = 0f
+        p.style = Paint.Style.FILL_AND_STROKE
     }
 
     // Only used if dualTone is set to true
-    private val dualToneBackgroundFill: Paint by lazy {
-        val p = Paint(Paint.ANTI_ALIAS_FLAG)
+    private val dualToneBackgroundFill = Paint(Paint.ANTI_ALIAS_FLAG).also { p ->
         p.color = frameColor
         p.alpha = 255
         p.isDither = true
         p.strokeWidth = 0f
         p.style = Paint.Style.FILL_AND_STROKE
-        p
     }
 
     init {
@@ -165,9 +168,6 @@
         levels.recycle()
         colors.recycle()
 
-        criticalLevel = context.resources.getInteger(
-                com.android.internal.R.integer.config_criticalBatteryWarningLevel)
-
         loadPaths()
     }
 
@@ -187,7 +187,7 @@
 
         // The perimeter should never change
         unifiedPath.addPath(scaledPerimeter)
-        // IF drawing dual tone, the level is used only to clip the whole drawable path
+        // If drawing dual tone, the level is used only to clip the whole drawable path
         if (!dualTone) {
             unifiedPath.op(levelPath, Path.Op.UNION)
         }
@@ -204,9 +204,7 @@
         } else if (powerSaveEnabled) {
             // Clip out the plus shape
             unifiedPath.op(scaledPlus, Path.Op.DIFFERENCE)
-            if (!invertFillIcon) {
-                c.drawPath(scaledPlus, fillPaint)
-            }
+            c.drawPath(scaledPlus, errorPaint)
         }
 
         if (dualTone) {
@@ -243,18 +241,18 @@
                 c.drawPath(scaledBolt, fillColorStrokeProtection)
             }
         } else if (powerSaveEnabled) {
+            // If power save is enabled draw the perimeter path with colorError
+            c.drawPath(scaledPerimeter, errorPaint)
+
+            // But always put path protection around the plus sign
             c.clipOutPath(scaledPlus)
-            if (invertFillIcon) {
-                c.drawPath(scaledPlus, fillColorStrokePaint)
-            } else {
-                c.drawPath(scaledPlus, fillColorStrokeProtection)
-            }
+            c.drawPath(scaledPlus, fillColorStrokeProtection)
         }
     }
 
     private fun batteryColorForLevel(level: Int): Int {
         return when {
-            charging || powerSaveEnabled -> fillPaint.color
+            charging || powerSaveEnabled -> fillColor
             else -> getColorForLevel(level)
         }
     }
@@ -347,6 +345,9 @@
         backgroundColor = bgColor
         dualToneBackgroundFill.color = bgColor
 
+        // Also update the level color, since fillColor may have changed
+        levelColor = batteryColorForLevel(level)
+
         invalidateSelf()
     }
 
@@ -360,7 +361,7 @@
         if (b.isEmpty) {
             scaleMatrix.setScale(1f, 1f)
         } else {
-            scaleMatrix.setScale((b.right / Companion.WIDTH), (b.bottom / Companion.HEIGHT))
+            scaleMatrix.setScale((b.right / WIDTH), (b.bottom / HEIGHT))
         }
 
         perimeterPath.transform(scaleMatrix, scaledPerimeter)
@@ -368,6 +369,14 @@
         scaledFill.computeBounds(fillRect, true)
         boltPath.transform(scaleMatrix, scaledBolt)
         plusPath.transform(scaleMatrix, scaledPlus)
+
+        // It is expected that this view only ever scale by the same factor in each dimension, so
+        // just pick one to scale the strokeWidths
+        val scaledStrokeWidth =
+                Math.max(b.right / WIDTH * PROTECTION_STROKE_WIDTH, PROTECTION_MIN_STROKE_WIDTH)
+
+        fillColorStrokePaint.strokeWidth = scaledStrokeWidth
+        fillColorStrokeProtection.strokeWidth = scaledStrokeWidth
     }
 
     private fun loadPaths() {
@@ -400,5 +409,10 @@
         private const val WIDTH = 12f
         private const val HEIGHT = 20f
         private const val CRITICAL_LEVEL = 15
+        // On a 12x20 grid, how wide to make the fill protection stroke.
+        // Scales when our size changes
+        private const val PROTECTION_STROKE_WIDTH = 1.4f
+        // Arbitrarily chosen for visibility at small sizes
+        private const val PROTECTION_MIN_STROKE_WIDTH = 5f
     }
 }
diff --git a/packages/SettingsLib/src/com/android/settingslib/location/RecentLocationAccesses.java b/packages/SettingsLib/src/com/android/settingslib/location/RecentLocationAccesses.java
index 4ac3ce4..09107ce 100644
--- a/packages/SettingsLib/src/com/android/settingslib/location/RecentLocationAccesses.java
+++ b/packages/SettingsLib/src/com/android/settingslib/location/RecentLocationAccesses.java
@@ -48,6 +48,11 @@
     // Keep last 24 hours of location app information.
     private static final long RECENT_TIME_INTERVAL_MILLIS = DateUtils.DAY_IN_MILLIS;
 
+    /** The flags for querying ops that are trusted for showing in the UI. */
+    public static final int TRUSTED_STATE_FLAGS = AppOpsManager.OP_FLAG_SELF
+            | AppOpsManager.OP_FLAG_UNTRUSTED_PROXY
+            | AppOpsManager.OP_FLAG_TRUSTED_PROXIED;
+
     @VisibleForTesting
     static final int[] LOCATION_OPS = new int[]{
             AppOpsManager.OP_FINE_LOCATION,
@@ -136,8 +141,7 @@
         // Earliest time for a location access to end and still be shown in list.
         long recentLocationCutoffTime = now - RECENT_TIME_INTERVAL_MILLIS;
         for (AppOpsManager.OpEntry entry : entries) {
-            locationAccessFinishTime = Math.max(entry.getLastAccessBackgroundTime(),
-                    entry.getLastAccessForegroundTime());
+            locationAccessFinishTime = entry.getLastAccessTime(TRUSTED_STATE_FLAGS);
         }
         // Bail out if the entry is out of date.
         if (locationAccessFinishTime < recentLocationCutoffTime) {
diff --git a/packages/SettingsLib/src/com/android/settingslib/utils/PowerUtil.java b/packages/SettingsLib/src/com/android/settingslib/utils/PowerUtil.java
index 43c97df..5600dd2 100644
--- a/packages/SettingsLib/src/com/android/settingslib/utils/PowerUtil.java
+++ b/packages/SettingsLib/src/com/android/settingslib/utils/PowerUtil.java
@@ -101,7 +101,29 @@
         if (drainTimeMs <= ONE_DAY_MILLIS) {
             return getRegularTimeRemainingShortString(context, drainTimeMs);
         } else {
-            return getMoreThanOneDayShortString(context, drainTimeMs);
+            return getMoreThanOneDayShortString(context, drainTimeMs,
+                R.string.power_remaining_duration_only_short);
+        }
+    }
+
+    /**
+     * This method produces the text used in Settings battery tip to describe the effect after
+     * use the tip.
+     *
+     * @param context
+     * @param drainTimeMs The estimated time remaining before the phone dies in milliseconds.
+     * @return a properly formatted and localized string
+     */
+    public static String getBatteryTipStringFormatted(Context context, long drainTimeMs) {
+        if (drainTimeMs <= 0) {
+            return null;
+        }
+        if (drainTimeMs <= ONE_DAY_MILLIS) {
+            return context.getString(R.string.power_suggestion_extend_battery,
+                getDateTimeStringFromMs(context, drainTimeMs));
+        } else {
+            return getMoreThanOneDayShortString(context, drainTimeMs,
+                R.string.power_remaining_only_more_than_subtext);
         }
     }
 
@@ -144,12 +166,13 @@
         }
     }
 
-    private static String getMoreThanOneDayShortString(Context context, long drainTimeMs) {
+    private static String getMoreThanOneDayShortString(Context context, long drainTimeMs,
+            int resId) {
         final long roundedTimeMs = roundTimeToNearestThreshold(drainTimeMs, ONE_HOUR_MILLIS);
         CharSequence timeString = StringUtil.formatElapsedTime(context, roundedTimeMs,
                 false /* withSeconds */);
 
-        return context.getString(R.string.power_remaining_duration_only_short, timeString);
+        return context.getString(resId, timeString);
     }
 
     private static String getMoreThanTwoDaysString(Context context, String percentageString) {
@@ -169,17 +192,8 @@
 
     private static String getRegularTimeRemainingString(Context context, long drainTimeMs,
             String percentageString, boolean basedOnUsage) {
-        // Get the time of day we think device will die rounded to the nearest 15 min.
-        final long roundedTimeOfDayMs =
-                roundTimeToNearestThreshold(
-                        System.currentTimeMillis() + drainTimeMs,
-                        FIFTEEN_MINUTES_MILLIS);
 
-        // convert the time to a properly formatted string.
-        String skeleton = android.text.format.DateFormat.getTimeFormatString(context);
-        DateFormat fmt = DateFormat.getInstanceForSkeleton(skeleton);
-        Date date = Date.from(Instant.ofEpochMilli(roundedTimeOfDayMs));
-        CharSequence timeString = fmt.format(date);
+        CharSequence timeString = getDateTimeStringFromMs(context, drainTimeMs);
 
         if (TextUtils.isEmpty(percentageString)) {
             int id = basedOnUsage
@@ -194,7 +208,7 @@
         }
     }
 
-    private static String getRegularTimeRemainingShortString(Context context, long drainTimeMs) {
+    private static CharSequence getDateTimeStringFromMs(Context context, long drainTimeMs) {
         // Get the time of day we think device will die rounded to the nearest 15 min.
         final long roundedTimeOfDayMs =
                 roundTimeToNearestThreshold(
@@ -205,9 +219,16 @@
         String skeleton = android.text.format.DateFormat.getTimeFormatString(context);
         DateFormat fmt = DateFormat.getInstanceForSkeleton(skeleton);
         Date date = Date.from(Instant.ofEpochMilli(roundedTimeOfDayMs));
-        CharSequence timeString = fmt.format(date);
+        return fmt.format(date);
+    }
 
-        return context.getString(R.string.power_discharge_by_only_short, timeString);
+    private static String getRegularTimeRemainingShortString(Context context, long drainTimeMs) {
+        // Get the time remaining rounded to the nearest 15 min
+        final long roundedTimeMs = roundTimeToNearestThreshold(drainTimeMs, FIFTEEN_MINUTES_MILLIS);
+        CharSequence timeString = StringUtil.formatElapsedTime(context, roundedTimeMs,
+                false /* withSeconds */);
+
+        return context.getString(R.string.power_remaining_duration_only_short, timeString);
     }
 
     public static long convertUsToMs(long timeUs) {
@@ -238,4 +259,4 @@
             return time - remainder + multiple;
         }
     }
-}
+}
\ No newline at end of file
diff --git a/core/java/android/app/role/IRoleManagerCallback.aidl b/packages/SettingsLib/src/com/android/settingslib/volume/D.java
similarity index 73%
copy from core/java/android/app/role/IRoleManagerCallback.aidl
copy to packages/SettingsLib/src/com/android/settingslib/volume/D.java
index c0f8eea..7e0654d 100644
--- a/core/java/android/app/role/IRoleManagerCallback.aidl
+++ b/packages/SettingsLib/src/com/android/settingslib/volume/D.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (C) 2018 The Android Open Source Project
+ * Copyright (C) 2019 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.
@@ -14,14 +14,10 @@
  * limitations under the License.
  */
 
-package android.app.role;
+package com.android.settingslib.volume;
 
-/**
- * @hide
- */
-oneway interface IRoleManagerCallback {
+import android.util.Log;
 
-    void onSuccess();
-
-    void onFailure();
+class D {
+    public static boolean BUG = Log.isLoggable("volume", Log.DEBUG);
 }
diff --git a/packages/SystemUI/src/com/android/systemui/volume/MediaSessions.java b/packages/SettingsLib/src/com/android/settingslib/volume/MediaSessions.java
similarity index 84%
rename from packages/SystemUI/src/com/android/systemui/volume/MediaSessions.java
rename to packages/SettingsLib/src/com/android/settingslib/volume/MediaSessions.java
index 8b00eee..4ed1154 100644
--- a/packages/SystemUI/src/com/android/systemui/volume/MediaSessions.java
+++ b/packages/SettingsLib/src/com/android/settingslib/volume/MediaSessions.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (C) 2015 The Android Open Source Project
+ * Copyright (C) 2019 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.
@@ -14,7 +14,7 @@
  * limitations under the License.
  */
 
-package com.android.systemui.volume;
+package com.android.settingslib.volume;
 
 import android.app.PendingIntent;
 import android.content.Context;
@@ -27,7 +27,6 @@
 import android.media.MediaMetadata;
 import android.media.session.MediaController;
 import android.media.session.MediaController.PlaybackInfo;
-import android.media.session.MediaSession;
 import android.media.session.MediaSession.QueueItem;
 import android.media.session.MediaSession.Token;
 import android.media.session.MediaSessionManager;
@@ -41,7 +40,6 @@
 import android.util.Log;
 
 import java.io.PrintWriter;
-import java.io.StringWriter;
 import java.util.HashMap;
 import java.util.HashSet;
 import java.util.List;
@@ -73,16 +71,24 @@
         mCallbacks = callbacks;
     }
 
+    /**
+     * Dump to {@code writer}
+     */
     public void dump(PrintWriter writer) {
         writer.println(getClass().getSimpleName() + " state:");
-        writer.print("  mInit: "); writer.println(mInit);
-        writer.print("  mRecords.size: "); writer.println(mRecords.size());
+        writer.print("  mInit: ");
+        writer.println(mInit);
+        writer.print("  mRecords.size: ");
+        writer.println(mRecords.size());
         int i = 0;
         for (MediaControllerRecord r : mRecords.values()) {
             dump(++i, writer, r.controller);
         }
     }
 
+    /**
+     * init MediaSessions
+     */
     public void init() {
         if (D.BUG) Log.d(TAG, "init");
         // will throw if no permission
@@ -97,12 +103,18 @@
         mHandler.sendEmptyMessage(H.UPDATE_SESSIONS);
     }
 
+    /**
+     * Destroy MediaSessions
+     */
     public void destroy() {
         if (D.BUG) Log.d(TAG, "destroy");
         mInit = false;
         mMgr.removeOnActiveSessionsChangedListener(mSessionsListener);
     }
 
+    /**
+     * Set volume {@code level} to remote media {@code token}
+     */
     public void setVolume(Token token, int level) {
         final MediaControllerRecord r = mRecords.get(token);
         if (r == null) {
@@ -113,15 +125,17 @@
         r.controller.setVolumeTo(level, 0);
     }
 
-    private void onRemoteVolumeChangedH(MediaSession.Token sessionToken, int flags) {
+    private void onRemoteVolumeChangedH(Token sessionToken, int flags) {
         final MediaController controller = new MediaController(mContext, sessionToken);
-        if (D.BUG) Log.d(TAG, "remoteVolumeChangedH " + controller.getPackageName() + " "
-                + Util.audioManagerFlagsToString(flags));
+        if (D.BUG) {
+            Log.d(TAG, "remoteVolumeChangedH " + controller.getPackageName() + " "
+                    + Util.audioManagerFlagsToString(flags));
+        }
         final Token token = controller.getSessionToken();
         mCallbacks.onRemoteVolumeChanged(token, flags);
     }
 
-    private void onUpdateRemoteControllerH(MediaSession.Token sessionToken) {
+    private void onUpdateRemoteControllerH(Token sessionToken) {
         final MediaController controller =
                 sessionToken != null ? new MediaController(mContext, sessionToken) : null;
         final String pkg = controller != null ? controller.getPackageName() : null;
@@ -191,7 +205,8 @@
             if (appLabel.length() > 0) {
                 return appLabel;
             }
-        } catch (NameNotFoundException e) { }
+        } catch (NameNotFoundException e) {
+        }
         return pkg;
     }
 
@@ -240,29 +255,11 @@
         }
     }
 
-    public static void dumpMediaSessions(Context context) {
-        final MediaSessionManager mgr = (MediaSessionManager) context
-                .getSystemService(Context.MEDIA_SESSION_SERVICE);
-        try {
-            final List<MediaController> controllers = mgr.getActiveSessions(null);
-            final int N = controllers.size();
-            if (D.BUG) Log.d(TAG, N + " controllers");
-            for (int i = 0; i < N; i++) {
-                final StringWriter sw = new StringWriter();
-                final PrintWriter pw = new PrintWriter(sw, true);
-                dump(i + 1, pw, controllers.get(i));
-                if (D.BUG) Log.d(TAG, sw.toString());
-            }
-        } catch (SecurityException e) {
-            Log.w(TAG, "Not allowed to get sessions", e);
-        }
-    }
-
     private final class MediaControllerRecord extends MediaController.Callback {
-        private final MediaController controller;
+        public final MediaController controller;
 
-        private boolean sentRemote;
-        private String name;
+        public boolean sentRemote;
+        public String name;
 
         private MediaControllerRecord(MediaController controller) {
             this.controller = controller;
@@ -274,8 +271,10 @@
 
         @Override
         public void onAudioInfoChanged(PlaybackInfo info) {
-            if (D.BUG) Log.d(TAG, cb("onAudioInfoChanged") + Util.playbackInfoToString(info)
-                    + " sentRemote=" + sentRemote);
+            if (D.BUG) {
+                Log.d(TAG, cb("onAudioInfoChanged") + Util.playbackInfoToString(info)
+                        + " sentRemote=" + sentRemote);
+            }
             final boolean remote = isRemote(info);
             if (!remote && sentRemote) {
                 mCallbacks.onRemoteRemoved(controller.getSessionToken());
@@ -324,22 +323,22 @@
 
     private final OnActiveSessionsChangedListener mSessionsListener =
             new OnActiveSessionsChangedListener() {
-        @Override
-        public void onActiveSessionsChanged(List<MediaController> controllers) {
-            onActiveSessionsUpdatedH(controllers);
-        }
-    };
+                @Override
+                public void onActiveSessionsChanged(List<MediaController> controllers) {
+                    onActiveSessionsUpdatedH(controllers);
+                }
+            };
 
     private final IRemoteVolumeController mRvc = new IRemoteVolumeController.Stub() {
         @Override
-        public void remoteVolumeChanged(MediaSession.Token sessionToken, int flags)
+        public void remoteVolumeChanged(Token sessionToken, int flags)
                 throws RemoteException {
             mHandler.obtainMessage(H.REMOTE_VOLUME_CHANGED, flags, 0,
                     sessionToken).sendToTarget();
         }
 
         @Override
-        public void updateRemoteController(final MediaSession.Token sessionToken)
+        public void updateRemoteController(final Token sessionToken)
                 throws RemoteException {
             mHandler.obtainMessage(H.UPDATE_REMOTE_CONTROLLER, sessionToken).sendToTarget();
         }
@@ -361,18 +360,32 @@
                     onActiveSessionsUpdatedH(mMgr.getActiveSessions(null));
                     break;
                 case REMOTE_VOLUME_CHANGED:
-                    onRemoteVolumeChangedH((MediaSession.Token) msg.obj, msg.arg1);
+                    onRemoteVolumeChangedH((Token) msg.obj, msg.arg1);
                     break;
                 case UPDATE_REMOTE_CONTROLLER:
-                    onUpdateRemoteControllerH((MediaSession.Token) msg.obj);
+                    onUpdateRemoteControllerH((Token) msg.obj);
                     break;
             }
         }
     }
 
+    /**
+     * Callback for remote media sessions
+     */
     public interface Callbacks {
+        /**
+         * Invoked when remote media session is updated
+         */
         void onRemoteUpdate(Token token, String name, PlaybackInfo pi);
+
+        /**
+         * Invoked when remote media session is removed
+         */
         void onRemoteRemoved(Token t);
+
+        /**
+         * Invoked when remote volume is changed
+         */
         void onRemoteVolumeChanged(Token token, int flags);
     }
 
diff --git a/packages/SettingsLib/src/com/android/settingslib/volume/Util.java b/packages/SettingsLib/src/com/android/settingslib/volume/Util.java
new file mode 100644
index 0000000..4e770ae
--- /dev/null
+++ b/packages/SettingsLib/src/com/android/settingslib/volume/Util.java
@@ -0,0 +1,187 @@
+/*
+ * Copyright (C) 2019 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 com.android.settingslib.volume;
+
+import android.content.Context;
+import android.media.AudioManager;
+import android.media.MediaMetadata;
+import android.media.VolumeProvider;
+import android.media.session.MediaController.PlaybackInfo;
+import android.media.session.PlaybackState;
+import android.telephony.TelephonyManager;
+import android.widget.TextView;
+
+import java.util.Objects;
+
+/**
+ * Static helpers for the volume dialog.
+ */
+public class Util {
+
+    private static final int[] AUDIO_MANAGER_FLAGS = new int[]{
+            AudioManager.FLAG_SHOW_UI,
+            AudioManager.FLAG_VIBRATE,
+            AudioManager.FLAG_PLAY_SOUND,
+            AudioManager.FLAG_ALLOW_RINGER_MODES,
+            AudioManager.FLAG_REMOVE_SOUND_AND_VIBRATE,
+            AudioManager.FLAG_SHOW_VIBRATE_HINT,
+            AudioManager.FLAG_SHOW_SILENT_HINT,
+            AudioManager.FLAG_FROM_KEY,
+            AudioManager.FLAG_SHOW_UI_WARNINGS,
+    };
+
+    private static final String[] AUDIO_MANAGER_FLAG_NAMES = new String[]{
+            "SHOW_UI",
+            "VIBRATE",
+            "PLAY_SOUND",
+            "ALLOW_RINGER_MODES",
+            "REMOVE_SOUND_AND_VIBRATE",
+            "SHOW_VIBRATE_HINT",
+            "SHOW_SILENT_HINT",
+            "FROM_KEY",
+            "SHOW_UI_WARNINGS",
+    };
+
+    /**
+     * Extract log tag from {@code c}
+     */
+    public static String logTag(Class<?> c) {
+        final String tag = "vol." + c.getSimpleName();
+        return tag.length() < 23 ? tag : tag.substring(0, 23);
+    }
+
+    /**
+     * Convert media metadata to string
+     */
+    public static String mediaMetadataToString(MediaMetadata metadata) {
+        if (metadata == null) return null;
+        return metadata.getDescription().toString();
+    }
+
+    /**
+     * Convert playback info to string
+     */
+    public static String playbackInfoToString(PlaybackInfo info) {
+        if (info == null) return null;
+        final String type = playbackInfoTypeToString(info.getPlaybackType());
+        final String vc = volumeProviderControlToString(info.getVolumeControl());
+        return String.format("PlaybackInfo[vol=%s,max=%s,type=%s,vc=%s],atts=%s",
+                info.getCurrentVolume(), info.getMaxVolume(), type, vc, info.getAudioAttributes());
+    }
+
+    /**
+     * Convert type of playback info to string
+     */
+    public static String playbackInfoTypeToString(int type) {
+        switch (type) {
+            case PlaybackInfo.PLAYBACK_TYPE_LOCAL:
+                return "LOCAL";
+            case PlaybackInfo.PLAYBACK_TYPE_REMOTE:
+                return "REMOTE";
+            default:
+                return "UNKNOWN_" + type;
+        }
+    }
+
+    /**
+     * Convert state of playback info to string
+     */
+    public static String playbackStateStateToString(int state) {
+        switch (state) {
+            case PlaybackState.STATE_NONE:
+                return "STATE_NONE";
+            case PlaybackState.STATE_STOPPED:
+                return "STATE_STOPPED";
+            case PlaybackState.STATE_PAUSED:
+                return "STATE_PAUSED";
+            case PlaybackState.STATE_PLAYING:
+                return "STATE_PLAYING";
+            default:
+                return "UNKNOWN_" + state;
+        }
+    }
+
+    /**
+     * Convert volume provider control to string
+     */
+    public static String volumeProviderControlToString(int control) {
+        switch (control) {
+            case VolumeProvider.VOLUME_CONTROL_ABSOLUTE:
+                return "VOLUME_CONTROL_ABSOLUTE";
+            case VolumeProvider.VOLUME_CONTROL_FIXED:
+                return "VOLUME_CONTROL_FIXED";
+            case VolumeProvider.VOLUME_CONTROL_RELATIVE:
+                return "VOLUME_CONTROL_RELATIVE";
+            default:
+                return "VOLUME_CONTROL_UNKNOWN_" + control;
+        }
+    }
+
+    /**
+     * Convert {@link PlaybackState} to string
+     */
+    public static String playbackStateToString(PlaybackState playbackState) {
+        if (playbackState == null) return null;
+        return playbackStateStateToString(playbackState.getState()) + " " + playbackState;
+    }
+
+    /**
+     * Convert audio manager flags to string
+     */
+    public static String audioManagerFlagsToString(int value) {
+        return bitFieldToString(value, AUDIO_MANAGER_FLAGS, AUDIO_MANAGER_FLAG_NAMES);
+    }
+
+    protected static String bitFieldToString(int value, int[] values, String[] names) {
+        if (value == 0) return "";
+        final StringBuilder sb = new StringBuilder();
+        for (int i = 0; i < values.length; i++) {
+            if ((value & values[i]) != 0) {
+                if (sb.length() > 0) sb.append(',');
+                sb.append(names[i]);
+            }
+            value &= ~values[i];
+        }
+        if (value != 0) {
+            if (sb.length() > 0) sb.append(',');
+            sb.append("UNKNOWN_").append(value);
+        }
+        return sb.toString();
+    }
+
+    private static CharSequence emptyToNull(CharSequence str) {
+        return str == null || str.length() == 0 ? null : str;
+    }
+
+    /**
+     * Set text for specific {@link TextView}
+     */
+    public static boolean setText(TextView tv, CharSequence text) {
+        if (Objects.equals(emptyToNull(tv.getText()), emptyToNull(text))) return false;
+        tv.setText(text);
+        return true;
+    }
+
+    /**
+     * Return {@code true} if it is voice capable
+     */
+    public static boolean isVoiceCapable(Context context) {
+        final TelephonyManager telephony =
+                (TelephonyManager) context.getSystemService(Context.TELEPHONY_SERVICE);
+        return telephony != null && telephony.isVoiceCapable();
+    }
+}
diff --git a/packages/SettingsLib/src/com/android/settingslib/wifi/AccessPoint.java b/packages/SettingsLib/src/com/android/settingslib/wifi/AccessPoint.java
index 43affcd..d9b4885 100644
--- a/packages/SettingsLib/src/com/android/settingslib/wifi/AccessPoint.java
+++ b/packages/SettingsLib/src/com/android/settingslib/wifi/AccessPoint.java
@@ -57,6 +57,7 @@
 import androidx.annotation.NonNull;
 
 import com.android.internal.annotations.VisibleForTesting;
+import com.android.internal.util.CollectionUtils;
 import com.android.settingslib.R;
 import com.android.settingslib.utils.ThreadUtils;
 
@@ -133,6 +134,12 @@
     private final ArraySet<ScanResult> mScanResults = new ArraySet<>();
 
     /**
+     * Extra set of unused scan results corresponding to this AccessPoint for verbose logging
+     * purposes, such as a set of Passpoint roaming scan results when home scans are available.
+     */
+    private final ArraySet<ScanResult> mExtraScanResults = new ArraySet<>();
+
+    /**
      * Map of BSSIDs to scored networks for individual bssids.
      *
      * <p>This cache should not be evicted with scan results, as the values here are used to
@@ -216,6 +223,7 @@
      */
     private String mFqdn;
     private String mProviderFriendlyName;
+    private boolean mIsRoaming = false;
 
     private boolean mIsCarrierAp = false;
 
@@ -289,15 +297,12 @@
 
         // Calculate required fields
         updateKey();
-        updateRssi();
+        updateBestRssiInfo();
     }
 
     /**
      * Creates an AccessPoint with only a WifiConfiguration. This is used for the saved networks
      * page.
-     *
-     * Passpoint Credential AccessPoints should be created with this.
-     * Make sure to call setScanResults after constructing with this.
      */
     public AccessPoint(Context context, WifiConfiguration config) {
         mContext = context;
@@ -315,39 +320,33 @@
     }
 
     /**
-     * Initialize an AccessPoint object for a Passpoint OSU Provider.
-     * Make sure to call setScanResults after constructing with this.
+     * Initialize an AccessPoint object for a Passpoint network.
      */
-    public AccessPoint(Context context, OsuProvider provider) {
+    public AccessPoint(@NonNull Context context, @NonNull WifiConfiguration config,
+            @Nullable Collection<ScanResult> homeScans,
+            @Nullable Collection<ScanResult> roamingScans) {
+        mContext = context;
+        networkId = config.networkId;
+        mConfig = config;
+        setScanResultsPasspoint(homeScans, roamingScans);
+        updateKey();
+    }
+
+    /**
+     * Initialize an AccessPoint object for a Passpoint OSU Provider.
+     */
+    public AccessPoint(@NonNull Context context, @NonNull OsuProvider provider,
+            @NonNull Collection<ScanResult> results) {
         mContext = context;
         mOsuProvider = provider;
-        ssid = provider.getFriendlyName();
+        setScanResults(results);
         updateKey();
     }
 
     AccessPoint(Context context, Collection<ScanResult> results) {
         mContext = context;
-
-        if (results.isEmpty()) {
-            throw new IllegalArgumentException("Cannot construct with an empty ScanResult list");
-        }
-        mScanResults.addAll(results);
-
-        // Information derived from scan results
-        ScanResult firstResult = results.iterator().next();
-        ssid = firstResult.SSID;
-        bssid = firstResult.BSSID;
-        security = getSecurity(firstResult);
-        if (security == SECURITY_PSK) {
-            pskType = getPskType(firstResult);
-        }
+        setScanResults(results);
         updateKey();
-        updateRssi();
-
-        // Passpoint Info
-        mIsCarrierAp = firstResult.isCarrierAp;
-        mCarrierApEapType = firstResult.carrierApEapType;
-        mCarrierName = firstResult.carrierName;
     }
 
     @VisibleForTesting void loadConfig(WifiConfiguration config) {
@@ -468,7 +467,8 @@
 
         if (isVerboseLoggingEnabled()) {
             builder.append(",rssi=").append(mRssi);
-            builder.append(",scan cache size=").append(mScanResults.size());
+            builder.append(",scan cache size=").append(mScanResults.size()
+                    + mExtraScanResults.size());
         }
 
         return builder.append(')').toString();
@@ -703,14 +703,19 @@
      *
      * <p>Callers should not modify this set.
      */
-    public Set<ScanResult> getScanResults() { return mScanResults; }
+    public Set<ScanResult> getScanResults() {
+        Set<ScanResult> allScans = new ArraySet<>();
+        allScans.addAll(mScanResults);
+        allScans.addAll(mExtraScanResults);
+        return allScans;
+    }
 
     public Map<String, TimestampedScoredNetwork> getScoredNetworkCache() {
         return mScoredNetworkCache;
     }
 
     /**
-     * Updates {@link #mRssi}.
+     * Updates {@link #mRssi} and sets scan result information to that of the best RSSI scan result.
      *
      * <p>If the given connection is active, the existing value of {@link #mRssi} will be returned.
      * If the given AccessPoint is not active, a value will be calculated from previous scan
@@ -718,22 +723,41 @@
      * value. If the access point is not connected and there are no scan results, the rssi will be
      * set to {@link #UNREACHABLE_RSSI}.
      */
-    private void updateRssi() {
+    private void updateBestRssiInfo() {
         if (this.isActive()) {
             return;
         }
 
-        int rssi = UNREACHABLE_RSSI;
+        ScanResult bestResult = null;
+        int bestRssi = UNREACHABLE_RSSI;
         for (ScanResult result : mScanResults) {
-            if (result.level > rssi) {
-                rssi = result.level;
+            if (result.level > bestRssi) {
+                bestRssi = result.level;
+                bestResult = result;
             }
         }
 
-        if (rssi != UNREACHABLE_RSSI && mRssi != UNREACHABLE_RSSI) {
-            mRssi = (mRssi + rssi) / 2; // half-life previous value
+        // Set the rssi to the average of the current rssi and the previous rssi.
+        if (bestRssi != UNREACHABLE_RSSI && mRssi != UNREACHABLE_RSSI) {
+            mRssi = (mRssi + bestRssi) / 2;
         } else {
-            mRssi = rssi;
+            mRssi = bestRssi;
+        }
+
+        if (bestResult != null) {
+            ssid = bestResult.SSID;
+            bssid = bestResult.BSSID;
+            security = getSecurity(bestResult);
+            if (security == SECURITY_PSK) {
+                pskType = getPskType(bestResult);
+            }
+            mIsCarrierAp = bestResult.isCarrierAp;
+            mCarrierApEapType = bestResult.carrierApEapType;
+            mCarrierName = bestResult.carrierName;
+        }
+        // Update the config SSID of a Passpoint network to that of the best RSSI
+        if (isPasspoint()) {
+            mConfig.SSID = convertToQuotedString(ssid);
         }
     }
 
@@ -809,6 +833,11 @@
         return ssid;
     }
 
+    /**
+     * Returns the name associated with the stored config.
+     * @deprecated Please use {@link #getTitle()} instead to get the display name of an AccessPoint.
+     */
+    @Deprecated
     public String getConfigName() {
         if (mConfig != null && mConfig.isPasspoint()) {
             return mConfig.providerFriendlyName;
@@ -871,6 +900,8 @@
     public String getTitle() {
         if (isPasspoint()) {
             return mConfig.providerFriendlyName;
+        } else if (isPasspointConfig()) {
+            return mProviderFriendlyName;
         } else if (isOsuProvider()) {
             return mOsuProvider.getFriendlyName();
         } else {
@@ -897,18 +928,12 @@
                 summary.append(mContext.getString(R.string.tap_to_sign_up));
             }
         } else if (isActive()) {
-            if (isPasspoint()) {
-                // This is the active connection on passpoint
-                summary.append(getSummary(mContext, /* ssid */ null, getDetailedState(),
-                        /* isEphemeral */ false,
-                        /* suggestionOrSpecifierPackageName */ null));
-            } else if (mConfig != null && getDetailedState() == DetailedState.CONNECTED
+            if (mConfig != null && getDetailedState() == DetailedState.CONNECTED
                     && mIsCarrierAp) {
                 // This is the active connection on a carrier AP
                 summary.append(String.format(mContext.getString(R.string.connected_via_carrier),
                         mCarrierName));
             } else {
-                // This is the active connection on non-passpoint network
                 summary.append(getSummary(mContext, /* ssid */ null, getDetailedState(),
                         mInfo != null && mInfo.isEphemeral(),
                         mInfo != null ? mInfo.getNetworkSuggestionOrSpecifierPackageName() : null));
@@ -1036,8 +1061,8 @@
     public void startOsuProvisioning() {
         mContext.getSystemService(WifiManager.class).startSubscriptionProvisioning(
                 mOsuProvider,
-                new AccessPointProvisioningCallback(),
-                ThreadUtils.getUiThreadHandler()
+                mContext.getMainExecutor(),
+                new AccessPointProvisioningCallback()
         );
     }
 
@@ -1047,20 +1072,22 @@
      * match based on SSID and security.
      */
     private boolean isInfoForThisAccessPoint(WifiConfiguration config, WifiInfo info) {
-        if (info.isOsuAp()) {
-            return (mOsuStatus != null);
+        if (info.isOsuAp() || mOsuStatus != null) {
+            return (info.isOsuAp() && mOsuStatus != null);
+        } else if (info.isPasspointAp() || isPasspoint()) {
+            return (info.isPasspointAp() && isPasspoint()
+                    && TextUtils.equals(info.getFqdn(), mConfig.FQDN));
         }
 
-        if (isPasspoint() == false && networkId != WifiConfiguration.INVALID_NETWORK_ID) {
+        if (networkId != WifiConfiguration.INVALID_NETWORK_ID) {
             return networkId == info.getNetworkId();
         } else if (config != null) {
-            return matches(config);
-        }
-        else {
+            return TextUtils.equals(getKey(config), getKey());
+        } else {
             // Might be an ephemeral connection with no WifiConfiguration. Try matching on SSID.
             // (Note that we only do this if the WifiConfiguration explicitly equals INVALID).
             // TODO: Handle hex string SSIDs.
-            return ssid.equals(removeDoubleQuotes(info.getSSID()));
+            return TextUtils.equals(removeDoubleQuotes(info.getSSID()), ssid);
         }
     }
 
@@ -1105,7 +1132,8 @@
         if (mConfig != null) savedState.putParcelable(KEY_CONFIG, mConfig);
         savedState.putParcelable(KEY_WIFIINFO, mInfo);
         savedState.putParcelableArray(KEY_SCANRESULTS,
-                mScanResults.toArray(new Parcelable[mScanResults.size()]));
+                mScanResults.toArray(new Parcelable[mScanResults.size()
+                        + mExtraScanResults.size()]));
         savedState.putParcelableArrayList(KEY_SCOREDNETWORKCACHE,
                 new ArrayList<>(mScoredNetworkCache.values()));
         if (mNetworkInfo != null) {
@@ -1127,24 +1155,27 @@
     }
 
     /**
-     * Sets {@link #mScanResults} to the given collection.
+     * Sets {@link #mScanResults} to the given collection and updates info based on the best RSSI
+     * scan result.
      *
      * @param scanResults a collection of scan results to add to the internal set
-     * @throws IllegalArgumentException if any of the given ScanResults did not belong to this AP
      */
     void setScanResults(Collection<ScanResult> scanResults) {
+        if (CollectionUtils.isEmpty(scanResults)) {
+            Log.d(TAG, "Cannot set scan results to empty list");
+            return;
+        }
 
         // Validate scan results are for current AP only by matching SSID/BSSID
         // Passpoint networks are not bound to a specific SSID/BSSID, so skip this for passpoint.
-        if (!isPasspoint() && !isOsuProvider()) {
-            String key = getKey();
+        if (mKey != null && !isPasspoint() && !isOsuProvider()) {
             for (ScanResult result : scanResults) {
                 String scanResultKey = AccessPoint.getKey(result);
-                if (!mKey.equals(scanResultKey)) {
-                    throw new IllegalArgumentException(
-                            String.format(
+                if (mKey != null && !mKey.equals(scanResultKey)) {
+                    Log.d(TAG, String.format(
                                     "ScanResult %s\nkey of %s did not match current AP key %s",
-                                    result, scanResultKey, key));
+                                    result, scanResultKey, mKey));
+                    return;
                 }
             }
         }
@@ -1152,7 +1183,7 @@
         int oldLevel = getLevel();
         mScanResults.clear();
         mScanResults.addAll(scanResults);
-        updateRssi();
+        updateBestRssiInfo();
         int newLevel = getLevel();
 
         // If newLevel is 0, there will be no displayed Preference since the AP is unreachable
@@ -1172,20 +1203,26 @@
                 mAccessPointListener.onAccessPointChanged(this);
             }
         });
+    }
 
-        if (!scanResults.isEmpty()) {
-            ScanResult result = scanResults.iterator().next();
-
-            // This flag only comes from scans, is not easily saved in config
-            if (security == SECURITY_PSK) {
-                pskType = getPskType(result);
+    /**
+     * Sets the internal scan result cache to the list of home scans.
+     * If there are no home scans, then the roaming scan list is used, and the AccessPoint is
+     * marked as roaming.
+     */
+    void setScanResultsPasspoint(
+            @Nullable Collection<ScanResult> homeScans,
+            @Nullable Collection<ScanResult> roamingScans) {
+        mExtraScanResults.clear();
+        if (!CollectionUtils.isEmpty(homeScans)) {
+            if (!CollectionUtils.isEmpty(roamingScans)) {
+                mExtraScanResults.addAll(roamingScans);
             }
-
-            // The carrier info in the ScanResult is set by the platform based on the SSID and will
-            // always be the same for all matching scan results.
-            mIsCarrierAp = result.isCarrierAp;
-            mCarrierApEapType = result.carrierApEapType;
-            mCarrierName = result.carrierName;
+            mIsRoaming = false;
+            setScanResults(homeScans);
+        } else if (!CollectionUtils.isEmpty(roamingScans)) {
+            mIsRoaming = true;
+            setScanResults(roamingScans);
         }
     }
 
@@ -1202,12 +1239,11 @@
      */
     public boolean update(
             @Nullable WifiConfiguration config, WifiInfo info, NetworkInfo networkInfo) {
-
         boolean updated = false;
         final int oldLevel = getLevel();
         if (info != null && isInfoForThisAccessPoint(config, info)) {
             updated = (mInfo == null);
-            if (mConfig != config) {
+            if (!isPasspoint() && mConfig != config) {
                 // We do not set updated = true as we do not want to increase the amount of sorting
                 // and copying performed in WifiTracker at this time. If issues involving refresh
                 // are still seen, we will investigate further.
@@ -1536,7 +1572,8 @@
      *
      * All methods are invoked on the Main Thread
      */
-    private class AccessPointProvisioningCallback extends ProvisioningCallback {
+    @VisibleForTesting
+    class AccessPointProvisioningCallback extends ProvisioningCallback {
         @Override
         @MainThread public void onProvisioningFailure(int status) {
             if (TextUtils.equals(mOsuStatus, mContext.getString(R.string.osu_completing_sign_up))) {
diff --git a/packages/SettingsLib/src/com/android/settingslib/wifi/AccessPointPreference.java b/packages/SettingsLib/src/com/android/settingslib/wifi/AccessPointPreference.java
index 1fa7083..6269a71 100644
--- a/packages/SettingsLib/src/com/android/settingslib/wifi/AccessPointPreference.java
+++ b/packages/SettingsLib/src/com/android/settingslib/wifi/AccessPointPreference.java
@@ -232,7 +232,7 @@
      * Updates the title and summary; may indirectly call notifyChanged().
      */
     public void refresh() {
-        setTitle(this, mAccessPoint, mForSavedNetworks);
+        setTitle(this, mAccessPoint);
         final Context context = getContext();
         int level = mAccessPoint.getLevel();
         int wifiSpeed = mAccessPoint.getSpeed();
@@ -262,12 +262,8 @@
     }
 
     @VisibleForTesting
-    static void setTitle(AccessPointPreference preference, AccessPoint ap, boolean savedNetworks) {
-        if (savedNetworks) {
-            preference.setTitle(ap.getConfigName());
-        } else {
-            preference.setTitle(ap.getTitle());
-        }
+    static void setTitle(AccessPointPreference preference, AccessPoint ap) {
+        preference.setTitle(ap.getTitle());
     }
 
     /**
diff --git a/packages/SettingsLib/src/com/android/settingslib/wifi/WifiStatusTracker.java b/packages/SettingsLib/src/com/android/settingslib/wifi/WifiStatusTracker.java
index 871e248..3c10688 100644
--- a/packages/SettingsLib/src/com/android/settingslib/wifi/WifiStatusTracker.java
+++ b/packages/SettingsLib/src/com/android/settingslib/wifi/WifiStatusTracker.java
@@ -117,7 +117,11 @@
             if (connected) {
                 mWifiInfo = mWifiManager.getConnectionInfo();
                 if (mWifiInfo != null) {
-                    ssid = getValidSsid(mWifiInfo);
+                    if (mWifiInfo.isPasspointAp() || mWifiInfo.isOsuAp()) {
+                        ssid = mWifiInfo.getProviderFriendlyName();
+                    } else {
+                        ssid = getValidSsid(mWifiInfo);
+                    }
                     updateRssi(mWifiInfo.getRssi());
                     maybeRequestNetworkScore();
                 }
diff --git a/packages/SettingsLib/src/com/android/settingslib/wifi/WifiTracker.java b/packages/SettingsLib/src/com/android/settingslib/wifi/WifiTracker.java
index 8ea0f4b..fdc0fd3 100644
--- a/packages/SettingsLib/src/com/android/settingslib/wifi/WifiTracker.java
+++ b/packages/SettingsLib/src/com/android/settingslib/wifi/WifiTracker.java
@@ -53,7 +53,6 @@
 import androidx.annotation.NonNull;
 import androidx.annotation.VisibleForTesting;
 
-import com.android.internal.util.CollectionUtils;
 import com.android.settingslib.R;
 import com.android.settingslib.core.lifecycle.Lifecycle;
 import com.android.settingslib.core.lifecycle.LifecycleObserver;
@@ -609,23 +608,23 @@
 
             // Log accesspoints that are being removed
             if (DBG()) {
-                Log.d(TAG, "------ Dumping SSIDs that were not seen on this scan ------");
+                Log.d(TAG,
+                        "------ Dumping AccessPoints that were not seen on this scan ------");
                 for (AccessPoint prevAccessPoint : mInternalAccessPoints) {
-                    if (prevAccessPoint.getSsid() == null)
-                        continue;
-                    String prevSsid = prevAccessPoint.getSsidStr();
+                    String prevTitle = prevAccessPoint.getTitle();
                     boolean found = false;
                     for (AccessPoint newAccessPoint : accessPoints) {
-                        if (newAccessPoint.getSsidStr() != null && newAccessPoint.getSsidStr()
-                                .equals(prevSsid)) {
+                        if (newAccessPoint.getTitle() != null && newAccessPoint.getTitle()
+                                .equals(prevTitle)) {
                             found = true;
                             break;
                         }
                     }
                     if (!found)
-                        Log.d(TAG, "Did not find " + prevSsid + " in this scan");
+                        Log.d(TAG, "Did not find " + prevTitle + " in this scan");
                 }
-                Log.d(TAG, "---- Done dumping SSIDs that were not seen on this scan ----");
+                Log.d(TAG,
+                        "---- Done dumping AccessPoints that were not seen on this scan ----");
             }
 
             mInternalAccessPoints.clear();
@@ -646,30 +645,14 @@
                 Map<Integer, List<ScanResult>>> pairing : passpointConfigsAndScans) {
             WifiConfiguration config = pairing.first;
             if (seenFQDNs.add(config.FQDN)) {
-                List<ScanResult> apScanResults = new ArrayList<>();
-
                 List<ScanResult> homeScans =
                         pairing.second.get(WifiManager.PASSPOINT_HOME_NETWORK);
                 List<ScanResult> roamingScans =
                         pairing.second.get(WifiManager.PASSPOINT_ROAMING_NETWORK);
 
-                // TODO(b/118705403): Differentiate home network vs roaming network for summary info
-                if (!CollectionUtils.isEmpty(homeScans)) {
-                    apScanResults.addAll(homeScans);
-                } else if (!CollectionUtils.isEmpty(roamingScans)) {
-                    apScanResults.addAll(roamingScans);
-                }
-
-                int bestRssi = Integer.MIN_VALUE;
-                for (ScanResult result : apScanResults) {
-                    if (result.level >= bestRssi) {
-                        bestRssi = result.level;
-                        config.SSID = AccessPoint.convertToQuotedString(result.SSID);
-                    }
-                }
-
                 AccessPoint accessPoint =
-                        getCachedOrCreatePasspoint(apScanResults, accessPointCache, config);
+                        getCachedOrCreatePasspoint(config, homeScans, roamingScans,
+                                accessPointCache);
                 accessPoints.add(accessPoint);
             }
         }
@@ -688,8 +671,8 @@
         for (OsuProvider provider : providersAndScans.keySet()) {
             if (!alreadyProvisioned.contains(provider)) {
                 AccessPoint accessPointOsu =
-                        getCachedOrCreateOsu(providersAndScans.get(provider),
-                                accessPointCache, provider);
+                        getCachedOrCreateOsu(provider, providersAndScans.get(provider),
+                                accessPointCache);
                 accessPoints.add(accessPointOsu);
             }
         }
@@ -709,26 +692,29 @@
     }
 
     private AccessPoint getCachedOrCreatePasspoint(
-            List<ScanResult> scanResults,
-            List<AccessPoint> cache,
-            WifiConfiguration config) {
+            WifiConfiguration config,
+            List<ScanResult> homeScans,
+            List<ScanResult> roamingScans,
+            List<AccessPoint> cache) {
         AccessPoint accessPoint = getCachedByKey(cache, AccessPoint.getKey(config));
         if (accessPoint == null) {
-            accessPoint = new AccessPoint(mContext, config);
+            accessPoint = new AccessPoint(mContext, config, homeScans, roamingScans);
+        } else {
+            accessPoint.setScanResultsPasspoint(homeScans, roamingScans);
         }
-        accessPoint.setScanResults(scanResults);
         return accessPoint;
     }
 
     private AccessPoint getCachedOrCreateOsu(
+            OsuProvider provider,
             List<ScanResult> scanResults,
-            List<AccessPoint> cache,
-            OsuProvider provider) {
+            List<AccessPoint> cache) {
         AccessPoint accessPoint = getCachedByKey(cache, AccessPoint.getKey(provider));
         if (accessPoint == null) {
-            accessPoint = new AccessPoint(mContext, provider);
+            accessPoint = new AccessPoint(mContext, provider, scanResults);
+        } else {
+            accessPoint.setScanResults(scanResults);
         }
-        accessPoint.setScanResults(scanResults);
         return accessPoint;
     }
 
@@ -1068,7 +1054,7 @@
         }
 
         // Get and cache advanced capabilities
-        final boolean isOweSupported = mWifiManager.isOweSupported();
+        final boolean isOweSupported = mWifiManager.isEnhancedOpenSupported();
         final boolean isSaeSupported = mWifiManager.isWpa3SaeSupported();
         final boolean isSuiteBSupported = mWifiManager.isWpa3SuiteBSupported();
 
diff --git a/packages/SettingsLib/tests/integ/src/com/android/settingslib/wifi/AccessPointTest.java b/packages/SettingsLib/tests/integ/src/com/android/settingslib/wifi/AccessPointTest.java
index 5e3472b..7c367c7 100644
--- a/packages/SettingsLib/tests/integ/src/com/android/settingslib/wifi/AccessPointTest.java
+++ b/packages/SettingsLib/tests/integ/src/com/android/settingslib/wifi/AccessPointTest.java
@@ -23,6 +23,7 @@
 import static org.mockito.Mockito.any;
 import static org.mockito.Mockito.anyInt;
 import static org.mockito.Mockito.mock;
+import static org.mockito.Mockito.spy;
 import static org.mockito.Mockito.verify;
 import static org.mockito.Mockito.when;
 
@@ -42,13 +43,16 @@
 import android.net.wifi.WifiInfo;
 import android.net.wifi.WifiNetworkScoreCache;
 import android.net.wifi.WifiSsid;
+import android.net.wifi.hotspot2.OsuProvider;
 import android.net.wifi.hotspot2.PasspointConfiguration;
+import android.net.wifi.hotspot2.ProvisioningCallback;
 import android.net.wifi.hotspot2.pps.HomeSp;
 import android.os.Bundle;
 import android.os.Parcelable;
 import android.os.SystemClock;
 import android.text.SpannableString;
 import android.text.format.DateUtils;
+import android.util.ArraySet;
 
 import androidx.test.InstrumentationRegistry;
 import androidx.test.filters.SmallTest;
@@ -67,6 +71,9 @@
 import java.util.ArrayList;
 import java.util.Arrays;
 import java.util.Collections;
+import java.util.HashMap;
+import java.util.Map;
+import java.util.Set;
 import java.util.concurrent.CountDownLatch;
 
 @SmallTest
@@ -74,8 +81,11 @@
 public class AccessPointTest {
 
     private static final String TEST_SSID = "\"test_ssid\"";
+    private static final String ROAMING_SSID = "\"roaming_ssid\"";
+    private static final String OSU_FRIENDLY_NAME = "osu_friendly_name";
 
-    private static final ArrayList<ScanResult> SCAN_RESULTS = buildScanResultCache();
+    private ArrayList<ScanResult> mScanResults;
+    private ArrayList<ScanResult> mRoamingScans;
 
     private static final RssiCurve FAST_BADGE_CURVE =
             new RssiCurve(-150, 10, new byte[]{Speed.FAST});
@@ -84,12 +94,14 @@
             20 * DateUtils.MINUTE_IN_MILLIS;;
 
     private Context mContext;
+    private WifiInfo mWifiInfo;
     @Mock private RssiCurve mockBadgeCurve;
     @Mock private WifiNetworkScoreCache mockWifiNetworkScoreCache;
-    public static final int NETWORK_ID = 123;
-    public static final int DEFAULT_RSSI = -55;
+    @Mock private AccessPoint.AccessPointListener mMockAccessPointListener;
+    private static final int NETWORK_ID = 123;
+    private static final int DEFAULT_RSSI = -55;
 
-    private static ScanResult createScanResult(String ssid, String bssid, int rssi) {
+    private ScanResult createScanResult(String ssid, String bssid, int rssi) {
         ScanResult scanResult = new ScanResult();
         scanResult.SSID = ssid;
         scanResult.level = rssi;
@@ -99,10 +111,21 @@
         return scanResult;
     }
 
+    private OsuProvider createOsuProvider() {
+        Map<String, String> friendlyNames = new HashMap<>();
+        friendlyNames.put("en", OSU_FRIENDLY_NAME);
+        return new OsuProvider(null, friendlyNames, null, null, null, null, null);
+    }
+
     @Before
     public void setUp() {
         MockitoAnnotations.initMocks(this);
         mContext = InstrumentationRegistry.getTargetContext();
+        mWifiInfo = new WifiInfo();
+        mWifiInfo.setSSID(WifiSsid.createFromAsciiEncoded(TEST_SSID));
+        mWifiInfo.setBSSID(TEST_BSSID);
+        mScanResults = buildScanResultCache(TEST_SSID);
+        mRoamingScans = buildScanResultCache(ROAMING_SSID);
         WifiTracker.sVerboseLogging = false;
     }
 
@@ -568,14 +591,14 @@
         Bundle bundle = new Bundle();
         bundle.putParcelableArray(
                 AccessPoint.KEY_SCANRESULTS,
-                SCAN_RESULTS.toArray(new Parcelable[SCAN_RESULTS.size()]));
+                mScanResults.toArray(new Parcelable[mScanResults.size()]));
         return new AccessPoint(mContext, bundle);
     }
 
-    private static ArrayList<ScanResult> buildScanResultCache() {
+    private ArrayList<ScanResult> buildScanResultCache(String ssid) {
         ArrayList<ScanResult> scanResults = new ArrayList<>();
         for (int i = 0; i < 5; i++) {
-            ScanResult scanResult = createScanResult(TEST_SSID, "bssid-" + i, i);
+            ScanResult scanResult = createScanResult(ssid, "bssid-" + i, i);
             scanResults.add(scanResult);
         }
         return scanResults;
@@ -690,7 +713,7 @@
                 .setProviderFriendlyName(providerFriendlyName).build();
         assertThat(ap.isPasspointConfig()).isTrue();
         assertThat(ap.getPasspointFqdn()).isEqualTo(fqdn);
-        assertThat(ap.getConfigName()).isEqualTo(providerFriendlyName);
+        assertThat(ap.getTitle()).isEqualTo(providerFriendlyName);
     }
 
     @Test
@@ -970,12 +993,12 @@
         int speed1 = Speed.MODERATE;
         RssiCurve badgeCurve1 = mock(RssiCurve.class);
         when(badgeCurve1.lookupScore(anyInt())).thenReturn((byte) speed1);
-        when(mockWifiNetworkScoreCache.getScoredNetwork(SCAN_RESULTS.get(0)))
+        when(mockWifiNetworkScoreCache.getScoredNetwork(mScanResults.get(0)))
                 .thenReturn(buildScoredNetworkWithGivenBadgeCurve(badgeCurve1));
         int speed2 = Speed.VERY_FAST;
         RssiCurve badgeCurve2 = mock(RssiCurve.class);
         when(badgeCurve2.lookupScore(anyInt())).thenReturn((byte) speed2);
-        when(mockWifiNetworkScoreCache.getScoredNetwork(SCAN_RESULTS.get(1)))
+        when(mockWifiNetworkScoreCache.getScoredNetwork(mScanResults.get(1)))
                 .thenReturn(buildScoredNetworkWithGivenBadgeCurve(badgeCurve2));
 
         int expectedSpeed = (speed1 + speed2) / 2;
@@ -993,12 +1016,12 @@
         int speed1 = Speed.VERY_FAST;
         RssiCurve badgeCurve1 = mock(RssiCurve.class);
         when(badgeCurve1.lookupScore(anyInt())).thenReturn((byte) speed1);
-        when(mockWifiNetworkScoreCache.getScoredNetwork(SCAN_RESULTS.get(0)))
+        when(mockWifiNetworkScoreCache.getScoredNetwork(mScanResults.get(0)))
                 .thenReturn(buildScoredNetworkWithGivenBadgeCurve(badgeCurve1));
         int speed2 = Speed.NONE;
         RssiCurve badgeCurve2 = mock(RssiCurve.class);
         when(badgeCurve2.lookupScore(anyInt())).thenReturn((byte) speed2);
-        when(mockWifiNetworkScoreCache.getScoredNetwork(SCAN_RESULTS.get(1)))
+        when(mockWifiNetworkScoreCache.getScoredNetwork(mScanResults.get(1)))
                 .thenReturn(buildScoredNetworkWithGivenBadgeCurve(badgeCurve2));
 
         ap.update(
@@ -1118,7 +1141,7 @@
                 .setActive(true)
                 .setScoredNetworkCache(
                         new ArrayList(Arrays.asList(recentScore)))
-                .setScanResults(SCAN_RESULTS)
+                .setScanResults(mScanResults)
                 .build();
 
         when(mockWifiNetworkScoreCache.getScoredNetwork(any(ScanResult.class)))
@@ -1146,7 +1169,7 @@
                 .setActive(true)
                 .setScoredNetworkCache(
                         new ArrayList(Arrays.asList(recentScore)))
-                .setScanResults(SCAN_RESULTS)
+                .setScanResults(mScanResults)
                 .build();
 
         int newSpeed = Speed.MODERATE;
@@ -1160,4 +1183,224 @@
         // Fast should still be returned since cache was updated with recent time
         assertThat(ap.getSpeed()).isEqualTo(newSpeed);
     }
+
+    /**
+     * Verifies that a Passpoint WifiInfo updates the matching Passpoint AP
+     */
+    @Test
+    public void testUpdate_passpointWifiInfo_updatesPasspointAccessPoint() {
+        mWifiInfo.setFQDN("fqdn");
+        mWifiInfo.setProviderFriendlyName("providerFriendlyName");
+
+        WifiConfiguration spyConfig = spy(new WifiConfiguration());
+        when(spyConfig.isPasspoint()).thenReturn(true);
+        spyConfig.SSID = TEST_SSID;
+        spyConfig.BSSID = TEST_BSSID;
+        spyConfig.FQDN = "fqdn";
+        spyConfig.providerFriendlyName = "providerFriendlyName";
+        AccessPoint passpointAp = new AccessPoint(mContext, spyConfig);
+
+        assertThat(passpointAp.update(null, mWifiInfo, null)).isTrue();
+    }
+
+    /**
+     * Verifies that a Passpoint WifiInfo does not update a non-Passpoint AP with the same SSID.
+     */
+    @Test
+    public void testUpdate_passpointWifiInfo_doesNotUpdateNonPasspointAccessPoint() {
+        mWifiInfo.setFQDN("fqdn");
+        mWifiInfo.setProviderFriendlyName("providerFriendlyName");
+
+        AccessPoint ap = new TestAccessPointBuilder(mContext)
+                .setSsid(TEST_SSID)
+                .setBssid(TEST_BSSID)
+                .setScanResults(mScanResults)
+                .build();
+
+        assertThat(ap.update(null, mWifiInfo, null)).isFalse();
+    }
+
+    /**
+     * Verifies that a non-Passpoint WifiInfo does not update a Passpoint AP with the same SSID.
+     */
+    @Test
+    public void testUpdate_nonPasspointWifiInfo_doesNotUpdatePasspointAccessPoint() {
+        WifiConfiguration spyConfig = spy(new WifiConfiguration());
+        when(spyConfig.isPasspoint()).thenReturn(true);
+        spyConfig.SSID = TEST_SSID;
+        spyConfig.BSSID = TEST_BSSID;
+        spyConfig.FQDN = "fqdn";
+        spyConfig.providerFriendlyName = "providerFriendlyName";
+        AccessPoint passpointAp = new AccessPoint(mContext, spyConfig);
+
+        assertThat(passpointAp.update(null, mWifiInfo, null)).isFalse();
+    }
+
+    /**
+     * Verifies that an AccessPoint's getKey() is consistent with the overloaded static getKey().
+     */
+    @Test
+    public void testGetKey_matchesKeysCorrectly() {
+        AccessPoint ap = new AccessPoint(mContext, mScanResults);
+        assertThat(ap.getKey()).isEqualTo(AccessPoint.getKey(mScanResults.get(0)));
+
+        WifiConfiguration spyConfig = spy(new WifiConfiguration());
+        when(spyConfig.isPasspoint()).thenReturn(true);
+        spyConfig.FQDN = "fqdn";
+        AccessPoint passpointAp = new AccessPoint(mContext, spyConfig, mScanResults, null);
+        assertThat(passpointAp.getKey()).isEqualTo(AccessPoint.getKey(spyConfig));
+
+        OsuProvider provider = createOsuProvider();
+        AccessPoint osuAp = new AccessPoint(mContext, provider, mScanResults);
+        assertThat(osuAp.getKey()).isEqualTo(AccessPoint.getKey(provider));
+    }
+
+    /**
+     * Verifies that the Passpoint AccessPoint constructor creates AccessPoints whose isPasspoint()
+     * returns true.
+     */
+    @Test
+    public void testPasspointAccessPointConstructor_createdAccessPointIsPasspoint() {
+        WifiConfiguration spyConfig = spy(new WifiConfiguration());
+        when(spyConfig.isPasspoint()).thenReturn(true);
+        AccessPoint passpointAccessPoint = new AccessPoint(mContext, spyConfig,
+                mScanResults, mRoamingScans);
+
+        assertThat(passpointAccessPoint.isPasspoint()).isTrue();
+    }
+
+    /**
+     * Verifies that Passpoint AccessPoints set their config's SSID to the home scans', and to the
+     * roaming scans' if no home scans are available.
+     */
+    @Test
+    public void testSetScanResultsPasspoint_differentiatesHomeAndRoaming() {
+        WifiConfiguration spyConfig = spy(new WifiConfiguration());
+        when(spyConfig.isPasspoint()).thenReturn(true);
+        AccessPoint passpointAccessPoint = new AccessPoint(mContext, spyConfig,
+                mScanResults, mRoamingScans);
+        assertThat(AccessPoint.removeDoubleQuotes(spyConfig.SSID)).isEqualTo(TEST_SSID);
+
+        passpointAccessPoint.setScanResultsPasspoint(null, mRoamingScans);
+        assertThat(AccessPoint.removeDoubleQuotes(spyConfig.SSID)).isEqualTo(ROAMING_SSID);
+
+        passpointAccessPoint.setScanResultsPasspoint(mScanResults, null);
+        assertThat(AccessPoint.removeDoubleQuotes(spyConfig.SSID)).isEqualTo(TEST_SSID);
+    }
+
+    /**
+     * Verifies that getScanResults returns both home and roaming scans.
+     */
+    @Test
+    public void testGetScanResults_showsHomeAndRoamingScans() {
+        WifiConfiguration spyConfig = spy(new WifiConfiguration());
+        when(spyConfig.isPasspoint()).thenReturn(true);
+        AccessPoint passpointAccessPoint = new AccessPoint(mContext, spyConfig,
+                mScanResults, mRoamingScans);
+        Set<ScanResult> fullSet = new ArraySet<>();
+        fullSet.addAll(mScanResults);
+        fullSet.addAll(mRoamingScans);
+        assertThat(passpointAccessPoint.getScanResults()).isEqualTo(fullSet);
+    }
+
+    /**
+     * Verifies that the Passpoint AccessPoint takes the ssid of the strongest scan result.
+     */
+    @Test
+    public void testPasspointAccessPoint_setsBestSsid() {
+        WifiConfiguration spyConfig = spy(new WifiConfiguration());
+        when(spyConfig.isPasspoint()).thenReturn(true);
+
+        String badSsid = "badSsid";
+        String goodSsid = "goodSsid";
+        String bestSsid = "bestSsid";
+        ScanResult badScanResult = createScanResult(badSsid, TEST_BSSID, -100);
+        ScanResult goodScanResult = createScanResult(goodSsid, TEST_BSSID, -10);
+        ScanResult bestScanResult = createScanResult(bestSsid, TEST_BSSID, -1);
+
+        AccessPoint passpointAccessPoint = new AccessPoint(mContext, spyConfig,
+                Arrays.asList(badScanResult, goodScanResult), null);
+        assertThat(passpointAccessPoint.getConfig().SSID)
+                .isEqualTo(AccessPoint.convertToQuotedString(goodSsid));
+        passpointAccessPoint.setScanResultsPasspoint(
+                Arrays.asList(badScanResult, goodScanResult, bestScanResult), null);
+        assertThat(passpointAccessPoint.getConfig().SSID)
+                .isEqualTo(AccessPoint.convertToQuotedString(bestSsid));
+    }
+
+    /**
+     * Verifies that the OSU AccessPoint constructor creates AccessPoints whose isOsuProvider()
+     * returns true.
+     */
+    @Test
+    public void testOsuAccessPointConstructor_createdAccessPointIsOsuProvider() {
+        AccessPoint osuAccessPoint = new AccessPoint(mContext, createOsuProvider(),
+                mScanResults);
+
+        assertThat(osuAccessPoint.isOsuProvider()).isTrue();
+    }
+
+    /**
+     * Verifies that the summary of an OSU entry only shows the tap_to_sign_up string.
+     */
+    @Test
+    public void testOsuAccessPointSummary_showsTapToSignUp() {
+        AccessPoint osuAccessPoint = new AccessPoint(mContext, createOsuProvider(),
+                mScanResults);
+
+        assertThat(osuAccessPoint.getSummary())
+                .isEqualTo(mContext.getString(R.string.tap_to_sign_up));
+    }
+
+    @Test
+    public void testOsuAccessPointSummary_showsProvisioningUpdates() {
+        AccessPoint osuAccessPoint = new AccessPoint(mContext, createOsuProvider(),
+                mScanResults);
+
+        osuAccessPoint.setListener(mMockAccessPointListener);
+
+        AccessPoint.AccessPointProvisioningCallback provisioningCallback =
+                osuAccessPoint.new AccessPointProvisioningCallback();
+
+        int[] openingProviderStatuses = {
+                ProvisioningCallback.OSU_STATUS_AP_CONNECTING,
+                ProvisioningCallback.OSU_STATUS_AP_CONNECTED,
+                ProvisioningCallback.OSU_STATUS_SERVER_CONNECTING,
+                ProvisioningCallback.OSU_STATUS_SERVER_VALIDATED,
+                ProvisioningCallback.OSU_STATUS_SERVER_CONNECTED,
+                ProvisioningCallback.OSU_STATUS_INIT_SOAP_EXCHANGE,
+                ProvisioningCallback.OSU_STATUS_WAITING_FOR_REDIRECT_RESPONSE
+        };
+        int[] completingSignUpStatuses = {
+                ProvisioningCallback.OSU_STATUS_REDIRECT_RESPONSE_RECEIVED,
+                ProvisioningCallback.OSU_STATUS_SECOND_SOAP_EXCHANGE,
+                ProvisioningCallback.OSU_STATUS_THIRD_SOAP_EXCHANGE,
+                ProvisioningCallback.OSU_STATUS_RETRIEVING_TRUST_ROOT_CERTS,
+        };
+
+        for (int status : openingProviderStatuses) {
+            provisioningCallback.onProvisioningStatus(status);
+            assertThat(osuAccessPoint.getSummary())
+                    .isEqualTo(String.format(mContext.getString(R.string.osu_opening_provider),
+                            OSU_FRIENDLY_NAME));
+        }
+
+        provisioningCallback.onProvisioningFailure(0);
+        assertThat(osuAccessPoint.getSummary())
+                .isEqualTo(mContext.getString(R.string.osu_connect_failed));
+
+        for (int status : completingSignUpStatuses) {
+            provisioningCallback.onProvisioningStatus(status);
+            assertThat(osuAccessPoint.getSummary())
+                    .isEqualTo(mContext.getString(R.string.osu_completing_sign_up));
+        }
+
+        provisioningCallback.onProvisioningFailure(0);
+        assertThat(osuAccessPoint.getSummary())
+                .isEqualTo(mContext.getString(R.string.osu_sign_up_failed));
+
+        provisioningCallback.onProvisioningComplete();
+        assertThat(osuAccessPoint.getSummary())
+                .isEqualTo(mContext.getString(R.string.osu_sign_up_complete));
+    }
 }
diff --git a/packages/SettingsLib/tests/integ/src/com/android/settingslib/wifi/WifiTrackerTest.java b/packages/SettingsLib/tests/integ/src/com/android/settingslib/wifi/WifiTrackerTest.java
index 7d22788..edf414d 100644
--- a/packages/SettingsLib/tests/integ/src/com/android/settingslib/wifi/WifiTrackerTest.java
+++ b/packages/SettingsLib/tests/integ/src/com/android/settingslib/wifi/WifiTrackerTest.java
@@ -1155,8 +1155,7 @@
                 providersAndScans, cachedAccessPoints);
 
         // Verify second update AP is the same object as the first update AP
-        assertTrue(osuAccessPointsFirstUpdate.get(0)
-                == osuAccessPointsSecondUpdate.get(0));
+        assertThat(osuAccessPointsFirstUpdate.get(0)).isSameAs(osuAccessPointsSecondUpdate.get(0));
         // Verify second update AP has the average of the first and second update RSSIs
         assertThat(osuAccessPointsSecondUpdate.get(0).getRssi())
                 .isEqualTo((prevRssi + newRssi) / 2);
diff --git a/packages/SettingsLib/tests/robotests/src/com/android/settingslib/drawer/TileTest.java b/packages/SettingsLib/tests/robotests/src/com/android/settingslib/drawer/TileTest.java
index 491f32d..bfda888 100644
--- a/packages/SettingsLib/tests/robotests/src/com/android/settingslib/drawer/TileTest.java
+++ b/packages/SettingsLib/tests/robotests/src/com/android/settingslib/drawer/TileTest.java
@@ -9,7 +9,11 @@
 
 import static com.google.common.truth.Truth.assertThat;
 
+import android.content.Context;
+import android.content.Intent;
 import android.content.pm.ActivityInfo;
+import android.content.pm.ApplicationInfo;
+import android.content.pm.ResolveInfo;
 import android.os.Bundle;
 
 import org.junit.Before;
@@ -17,17 +21,22 @@
 import org.junit.runner.RunWith;
 import org.robolectric.RobolectricTestRunner;
 import org.robolectric.RuntimeEnvironment;
+import org.robolectric.shadow.api.Shadow;
+import org.robolectric.shadows.ShadowPackageManager;
 
 @RunWith(RobolectricTestRunner.class)
 public class TileTest {
 
+    private Context mContext;
     private ActivityInfo mActivityInfo;
     private Tile mTile;
 
     @Before
     public void setUp() {
+        mContext = RuntimeEnvironment.application;
         mActivityInfo = new ActivityInfo();
-        mActivityInfo.packageName = RuntimeEnvironment.application.getPackageName();
+        mActivityInfo.applicationInfo = new ApplicationInfo();
+        mActivityInfo.packageName = mContext.getPackageName();
         mActivityInfo.name = "abc";
         mActivityInfo.icon = com.android.internal.R.drawable.ic_plus;
         mActivityInfo.metaData = new Bundle();
@@ -143,4 +152,21 @@
 
         assertThat(tile.getOrder()).isEqualTo(1);
     }
+
+    @Test
+    public void getTitle_shouldEnsureMetadataNotStale() {
+        final ResolveInfo info = new ResolveInfo();
+        info.activityInfo = mActivityInfo;
+        final ShadowPackageManager spm = Shadow.extract(mContext.getPackageManager());
+        spm.addResolveInfoForIntent(
+                new Intent().setClassName(mActivityInfo.packageName, mActivityInfo.name), info);
+
+        final Tile tile = new Tile(mActivityInfo, "category");
+        final long staleTimeStamp = -10000;
+        tile.mLastUpdateTime = staleTimeStamp;
+
+        tile.getTitle(RuntimeEnvironment.application);
+
+        assertThat(tile.mLastUpdateTime).isNotEqualTo(staleTimeStamp);
+    }
 }
diff --git a/packages/SettingsLib/tests/robotests/src/com/android/settingslib/location/RecentLocationAccessesTest.java b/packages/SettingsLib/tests/robotests/src/com/android/settingslib/location/RecentLocationAccessesTest.java
index d5b89ca..c1c5fa9 100644
--- a/packages/SettingsLib/tests/robotests/src/com/android/settingslib/location/RecentLocationAccessesTest.java
+++ b/packages/SettingsLib/tests/robotests/src/com/android/settingslib/location/RecentLocationAccessesTest.java
@@ -17,6 +17,7 @@
 import android.os.UserHandle;
 import android.os.UserManager;
 
+import android.util.LongSparseLongArray;
 import org.junit.Before;
 import org.junit.Test;
 import org.junit.runner.RunWith;
@@ -152,11 +153,12 @@
     }
 
     private OpEntry createOpEntryWithTime(int op, long time) {
-        final long[] times = new long[AppOpsManager._NUM_UID_STATE];
         // Slot for background access timestamp.
-        times[AppOpsManager.UID_STATE_LAST_NON_RESTRICTED + 1] = time;
-        final long[] rejectTimes = new long[AppOpsManager._NUM_UID_STATE];
-        return new OpEntry(op, AppOpsManager.MODE_ALLOWED, times, rejectTimes, 0 /* duration */,
-                0 /* proxyUid */, "" /* proxyPackage */);
+        final LongSparseLongArray accessTimes = new LongSparseLongArray();
+        accessTimes.put(AppOpsManager.makeKey(AppOpsManager.UID_STATE_BACKGROUND,
+            AppOpsManager.OP_FLAG_SELF), time);
+
+        return new OpEntry(op, false, AppOpsManager.MODE_ALLOWED, accessTimes, null /*durations*/,
+            null /*rejectTimes*/, null /* proxyUids */, null /* proxyPackages */);
     }
 }
diff --git a/packages/SettingsLib/tests/robotests/src/com/android/settingslib/location/RecentLocationAppsTest.java b/packages/SettingsLib/tests/robotests/src/com/android/settingslib/location/RecentLocationAppsTest.java
index 08d5367..8bd5fd2 100644
--- a/packages/SettingsLib/tests/robotests/src/com/android/settingslib/location/RecentLocationAppsTest.java
+++ b/packages/SettingsLib/tests/robotests/src/com/android/settingslib/location/RecentLocationAppsTest.java
@@ -17,6 +17,7 @@
 import android.os.UserHandle;
 import android.os.UserManager;
 
+import android.util.LongSparseLongArray;
 import org.junit.Before;
 import org.junit.Test;
 import org.junit.runner.RunWith;
@@ -153,6 +154,13 @@
     }
 
     private OpEntry createOpEntryWithTime(int op, long time, int duration) {
-        return new OpEntry(op, AppOpsManager.MODE_ALLOWED, time, 0L, duration, 0, "");
+        final LongSparseLongArray accessTimes = new LongSparseLongArray();
+        accessTimes.put(AppOpsManager.makeKey(AppOpsManager.UID_STATE_TOP,
+            AppOpsManager.OP_FLAG_SELF), time);
+        final LongSparseLongArray durations = new LongSparseLongArray();
+        durations.put(AppOpsManager.makeKey(AppOpsManager.UID_STATE_TOP,
+            AppOpsManager.OP_FLAG_SELF), duration);
+        return new OpEntry(op, false, AppOpsManager.MODE_ALLOWED, accessTimes,
+            null /*rejectTimes*/, durations, null /* proxyUids */, null /* proxyPackages */);
     }
 }
diff --git a/packages/SettingsLib/tests/robotests/src/com/android/settingslib/utils/PowerUtilTest.java b/packages/SettingsLib/tests/robotests/src/com/android/settingslib/utils/PowerUtilTest.java
index 7ef31df..61fdbd5 100644
--- a/packages/SettingsLib/tests/robotests/src/com/android/settingslib/utils/PowerUtilTest.java
+++ b/packages/SettingsLib/tests/robotests/src/com/android/settingslib/utils/PowerUtilTest.java
@@ -42,6 +42,7 @@
     private static final long THIRTY_HOURS_MILLIS = Duration.ofHours(30).toMillis();
     private static final String NORMAL_CASE_EXPECTED_PREFIX = "Should last until about";
     private static final String ENHANCED_SUFFIX = " based on your usage";
+    private static final String EXTEND_PREFIX = "Extend battery life past";
     // matches a time (ex: '1:15 PM', '2 AM', '23:00')
     private static final String TIME_OF_DAY_REGEX = " (\\d)+:?(\\d)* ((AM)*)|((PM)*)";
     // matches a percentage with parenthesis (ex: '(10%)')
@@ -176,6 +177,24 @@
     }
 
     @Test
+    public void getBatteryTipStringFormatted_moreThanOneDay_usesCorrectString() {
+        String info = PowerUtil.getBatteryTipStringFormatted(mContext,
+                THREE_DAYS_MILLIS);
+
+        assertThat(info).isEqualTo("More than 3 days remaining");
+    }
+
+    @Test
+    public void getBatteryTipStringFormatted_lessThanOneDay_usesCorrectString() {
+        String info = PowerUtil.getBatteryTipStringFormatted(mContext,
+                SEVENTEEN_MIN_MILLIS);
+
+        // ex: Extend battery life past 1:15 PM
+        assertThat(info).containsMatch(Pattern.compile(
+                EXTEND_PREFIX + TIME_OF_DAY_REGEX));
+    }
+
+    @Test
     public void testRoundToNearestThreshold_roundsCorrectly() {
         // test some pretty normal values
         assertThat(PowerUtil.roundTimeToNearestThreshold(1200, 1000)).isEqualTo(1000);
diff --git a/packages/SettingsLib/tests/robotests/src/com/android/settingslib/widget/BarChartInfoTest.java b/packages/SettingsLib/tests/robotests/src/com/android/settingslib/widget/BarChartInfoTest.java
index 29d57b7..2b27248 100644
--- a/packages/SettingsLib/tests/robotests/src/com/android/settingslib/widget/BarChartInfoTest.java
+++ b/packages/SettingsLib/tests/robotests/src/com/android/settingslib/widget/BarChartInfoTest.java
@@ -72,7 +72,8 @@
         final BarViewInfo barViewInfo = new BarViewInfo(
                 null /* icon */,
                 50,
-                mTitle);
+                mTitle,
+                null);
 
         final BarChartInfo mBarChartInfo = new BarChartInfo.Builder()
                 .setTitle(mTitle)
@@ -91,7 +92,8 @@
         final BarViewInfo barViewInfo = new BarViewInfo(
                 null /* icon */,
                 50,
-                mTitle);
+                mTitle,
+                null);
         final BarChartInfo mBarChartInfo = new BarChartInfo.Builder()
                 .setTitle(mTitle)
                 .setDetails(mDetails)
@@ -113,7 +115,8 @@
         final BarViewInfo barViewInfo = new BarViewInfo(
                 null /* icon */,
                 50,
-                mTitle);
+                mTitle,
+                null);
         new BarChartInfo.Builder()
                 .setTitle(mTitle)
                 .setDetails(mDetails)
diff --git a/packages/SettingsLib/tests/robotests/src/com/android/settingslib/widget/BarChartPreferenceTest.java b/packages/SettingsLib/tests/robotests/src/com/android/settingslib/widget/BarChartPreferenceTest.java
index 3acca2a..266554b 100644
--- a/packages/SettingsLib/tests/robotests/src/com/android/settingslib/widget/BarChartPreferenceTest.java
+++ b/packages/SettingsLib/tests/robotests/src/com/android/settingslib/widget/BarChartPreferenceTest.java
@@ -113,7 +113,8 @@
         final BarChartInfo barChartInfo = new BarChartInfo.Builder()
                 .setTitle(R.string.debug_app)
                 .setDetails(R.string.debug_app)
-                .addBarViewInfo(new BarViewInfo(mIcon, 10 /* barNumber */, R.string.debug_app))
+                .addBarViewInfo(
+                        new BarViewInfo(mIcon, 10 /* barNumber */, R.string.debug_app, null))
                 .build();
 
         mPreference.initializeBarChart(barChartInfo);
@@ -128,7 +129,8 @@
         // We don't call BarChartInfo.Builder#setDetails yet.
         final BarChartInfo barChartInfo = new BarChartInfo.Builder()
                 .setTitle(R.string.debug_app)
-                .addBarViewInfo(new BarViewInfo(mIcon, 10 /* barNumber */, R.string.debug_app))
+                .addBarViewInfo(
+                        new BarViewInfo(mIcon, 10 /* barNumber */, R.string.debug_app, null))
                 .build();
 
         mPreference.initializeBarChart(barChartInfo);
@@ -144,7 +146,8 @@
                 .setDetails(R.string.debug_app)
                 .setDetailsOnClickListener(v -> {
                 })
-                .addBarViewInfo(new BarViewInfo(mIcon, 10 /* barNumber */, R.string.debug_app))
+                .addBarViewInfo(
+                        new BarViewInfo(mIcon, 10 /* barNumber */, R.string.debug_app, null))
                 .build();
 
         mPreference.initializeBarChart(barChartInfo);
@@ -157,7 +160,7 @@
     @Test
     public void setBarViewInfos_oneBarViewInfoSet_shouldShowOneBarView() {
         final BarViewInfo[] barViewsInfo = new BarViewInfo[]{
-                new BarViewInfo(mIcon, 10 /* barNumber */, R.string.debug_app)
+                new BarViewInfo(mIcon, 10 /* barNumber */, R.string.debug_app, null)
         };
 
         mPreference.initializeBarChart(mBarChartInfo);
@@ -175,8 +178,8 @@
     @Test
     public void setBarViewInfos_twoBarViewInfosSet_shouldShowTwoBarViews() {
         final BarViewInfo[] barViewsInfo = new BarViewInfo[]{
-                new BarViewInfo(mIcon, 20 /* barNumber */, R.string.debug_app),
-                new BarViewInfo(mIcon, 10 /* barNumber */, R.string.debug_app)
+                new BarViewInfo(mIcon, 20 /* barNumber */, R.string.debug_app, null),
+                new BarViewInfo(mIcon, 10 /* barNumber */, R.string.debug_app, null)
         };
 
         mPreference.initializeBarChart(mBarChartInfo);
@@ -195,9 +198,9 @@
     @Test
     public void setBarViewInfos_threeBarViewInfosSet_shouldShowThreeBarViews() {
         final BarViewInfo[] barViewsInfo = new BarViewInfo[]{
-                new BarViewInfo(mIcon, 20 /* barNumber */, R.string.debug_app),
-                new BarViewInfo(mIcon, 10 /* barNumber */, R.string.debug_app),
-                new BarViewInfo(mIcon, 5 /* barNumber */, R.string.debug_app)
+                new BarViewInfo(mIcon, 20 /* barNumber */, R.string.debug_app, null),
+                new BarViewInfo(mIcon, 10 /* barNumber */, R.string.debug_app, null),
+                new BarViewInfo(mIcon, 5 /* barNumber */, R.string.debug_app, null)
         };
 
         mPreference.initializeBarChart(mBarChartInfo);
@@ -217,10 +220,10 @@
     @Test
     public void setBarViewInfos_fourBarViewInfosSet_shouldShowFourBarViews() {
         final BarViewInfo[] barViewsInfo = new BarViewInfo[]{
-                new BarViewInfo(mIcon, 20 /* barNumber */, R.string.debug_app),
-                new BarViewInfo(mIcon, 10 /* barNumber */, R.string.debug_app),
-                new BarViewInfo(mIcon, 5 /* barNumber */, R.string.debug_app),
-                new BarViewInfo(mIcon, 2 /* barNumber */, R.string.debug_app),
+                new BarViewInfo(mIcon, 20 /* barNumber */, R.string.debug_app, null),
+                new BarViewInfo(mIcon, 10 /* barNumber */, R.string.debug_app, null),
+                new BarViewInfo(mIcon, 5 /* barNumber */, R.string.debug_app, null),
+                new BarViewInfo(mIcon, 2 /* barNumber */, R.string.debug_app, null),
         };
 
         mPreference.initializeBarChart(mBarChartInfo);
@@ -242,11 +245,11 @@
         thrown.expect(IllegalStateException.class);
 
         final BarViewInfo[] barViewsInfo = new BarViewInfo[]{
-                new BarViewInfo(mIcon, 30 /* barNumber */, R.string.debug_app),
-                new BarViewInfo(mIcon, 50 /* barNumber */, R.string.debug_app),
-                new BarViewInfo(mIcon, 5 /* barNumber */, R.string.debug_app),
-                new BarViewInfo(mIcon, 10 /* barNumber */, R.string.debug_app),
-                new BarViewInfo(mIcon, 70 /* barNumber */, R.string.debug_app),
+                new BarViewInfo(mIcon, 30 /* barNumber */, R.string.debug_app, null),
+                new BarViewInfo(mIcon, 50 /* barNumber */, R.string.debug_app, null),
+                new BarViewInfo(mIcon, 5 /* barNumber */, R.string.debug_app, null),
+                new BarViewInfo(mIcon, 10 /* barNumber */, R.string.debug_app, null),
+                new BarViewInfo(mIcon, 70 /* barNumber */, R.string.debug_app, null),
         };
 
         mPreference.setBarViewInfos(barViewsInfo);
@@ -255,10 +258,10 @@
     @Test
     public void setBarViewInfos_barViewInfosSet_shouldBeSortedInDescending() {
         final BarViewInfo[] barViewsInfo = new BarViewInfo[]{
-                new BarViewInfo(mIcon, 30 /* barNumber */, R.string.debug_app),
-                new BarViewInfo(mIcon, 50 /* barNumber */, R.string.debug_app),
-                new BarViewInfo(mIcon, 5 /* barNumber */, R.string.debug_app),
-                new BarViewInfo(mIcon, 10 /* barNumber */, R.string.debug_app),
+                new BarViewInfo(mIcon, 30 /* barNumber */, R.string.debug_app, null),
+                new BarViewInfo(mIcon, 50 /* barNumber */, R.string.debug_app, null),
+                new BarViewInfo(mIcon, 5 /* barNumber */, R.string.debug_app, null),
+                new BarViewInfo(mIcon, 10 /* barNumber */, R.string.debug_app, null),
         };
 
         mPreference.initializeBarChart(mBarChartInfo);
@@ -278,7 +281,7 @@
     @Test
     public void setBarViewInfos_validBarViewSummarySet_barViewShouldShowSummary() {
         final BarViewInfo[] barViewsInfo = new BarViewInfo[]{
-                new BarViewInfo(mIcon, 10 /* barNumber */, R.string.debug_app),
+                new BarViewInfo(mIcon, 10 /* barNumber */, R.string.debug_app, null),
         };
 
         mPreference.initializeBarChart(mBarChartInfo);
@@ -291,7 +294,8 @@
 
     @Test
     public void setBarViewInfos_clickListenerForBarViewSet_barViewShouldHaveClickListener() {
-        final BarViewInfo viewInfo = new BarViewInfo(mIcon, 30 /* barNumber */, R.string.debug_app);
+        final BarViewInfo viewInfo = new BarViewInfo(mIcon, 30 /* barNumber */, R.string.debug_app,
+                null);
         viewInfo.setClickListener(v -> {
         });
         final BarViewInfo[] barViewsInfo = new BarViewInfo[]{viewInfo};
@@ -306,7 +310,8 @@
 
     @Test
     public void onBindViewHolder_loadingStateIsTrue_shouldHideAllViews() {
-        final BarViewInfo viewInfo = new BarViewInfo(mIcon, 30 /* barNumber */, R.string.debug_app);
+        final BarViewInfo viewInfo = new BarViewInfo(mIcon, 30 /* barNumber */, R.string.debug_app,
+                null);
         viewInfo.setClickListener(v -> {
         });
         final BarViewInfo[] barViewsInfo = new BarViewInfo[]{viewInfo};
@@ -322,7 +327,8 @@
 
     @Test
     public void onBindViewHolder_loadingStateIsFalse_shouldInitAnyView() {
-        final BarViewInfo viewInfo = new BarViewInfo(mIcon, 30 /* barNumber */, R.string.debug_app);
+        final BarViewInfo viewInfo = new BarViewInfo(mIcon, 30 /* barNumber */, R.string.debug_app,
+                null);
         viewInfo.setClickListener(v -> {
         });
         final BarViewInfo[] barViewsInfo = new BarViewInfo[]{viewInfo};
diff --git a/packages/SettingsLib/tests/robotests/src/com/android/settingslib/wifi/AccessPointPreferenceTest.java b/packages/SettingsLib/tests/robotests/src/com/android/settingslib/wifi/AccessPointPreferenceTest.java
index c5cbea7..21aa526 100644
--- a/packages/SettingsLib/tests/robotests/src/com/android/settingslib/wifi/AccessPointPreferenceTest.java
+++ b/packages/SettingsLib/tests/robotests/src/com/android/settingslib/wifi/AccessPointPreferenceTest.java
@@ -98,7 +98,7 @@
                 .build();
         final AccessPointPreference preference = mock(AccessPointPreference.class);
 
-        AccessPointPreference.setTitle(preference, ap, false /* savedNetwork */);
+        AccessPointPreference.setTitle(preference, ap);
         verify(preference).setTitle(ssid);
     }
 }
diff --git a/packages/SettingsProvider/res/values/defaults.xml b/packages/SettingsProvider/res/values/defaults.xml
index 26ea6ab..d881858 100644
--- a/packages/SettingsProvider/res/values/defaults.xml
+++ b/packages/SettingsProvider/res/values/defaults.xml
@@ -40,8 +40,8 @@
     <bool name="def_wifi_display_on">false</bool>
     <bool name="def_install_non_market_apps">false</bool>
     <bool name="def_package_verifier_enable">true</bool>
-    <!-- Comma-separated list of location providers -->
-    <string name="def_location_providers_allowed" translatable="false">gps,network</string>
+    <!-- 0 == off, 3 == on -->
+    <integer name="def_location_mode">3</integer>
     <bool name="assisted_gps_enabled">true</bool>
     <bool name="def_netstats_enabled">true</bool>
     <bool name="def_usb_mass_storage_enabled">true</bool>
@@ -215,6 +215,9 @@
     <!-- Default for Settings.System.VIBRATE_WHEN_RINGING -->
     <bool name="def_vibrate_when_ringing">false</bool>
 
+    <!-- Default for Settings.Global.APPLY_RAMPING_RINGER -->
+    <bool name="def_apply_ramping_ringer">false</bool>
+
     <!-- Default for Settings.Secure.CHARGING_VIBRATION_ENABLED -->
     <bool name="def_charging_vibration_enabled">true</bool>
 
diff --git a/packages/SettingsProvider/src/com/android/providers/settings/DatabaseHelper.java b/packages/SettingsProvider/src/com/android/providers/settings/DatabaseHelper.java
index 0ee16a9..5e2b7c8 100644
--- a/packages/SettingsProvider/src/com/android/providers/settings/DatabaseHelper.java
+++ b/packages/SettingsProvider/src/com/android/providers/settings/DatabaseHelper.java
@@ -2340,9 +2340,6 @@
             stmt = db.compileStatement("INSERT OR IGNORE INTO secure(name,value)"
                     + " VALUES(?,?);");
 
-            loadStringSetting(stmt, Settings.Secure.LOCATION_PROVIDERS_ALLOWED,
-                    R.string.def_location_providers_allowed);
-
             // Don't do this.  The SystemServer will initialize ADB_ENABLED from a
             // persistent system property instead.
             //loadSetting(stmt, Settings.Secure.ADB_ENABLED, 0);
diff --git a/packages/SettingsProvider/src/com/android/providers/settings/SettingsProtoDumpUtil.java b/packages/SettingsProvider/src/com/android/providers/settings/SettingsProtoDumpUtil.java
index 0f8fd92..a33f9a8 100644
--- a/packages/SettingsProvider/src/com/android/providers/settings/SettingsProtoDumpUtil.java
+++ b/packages/SettingsProvider/src/com/android/providers/settings/SettingsProtoDumpUtil.java
@@ -1382,6 +1382,9 @@
                 Settings.Global.TEXT_CLASSIFIER_CONSTANTS,
                 GlobalSettingsProto.TEXT_CLASSIFIER_CONSTANTS);
         dumpSetting(s, p,
+                Settings.Global.TEXT_CLASSIFIER_ACTION_MODEL_PARAMS,
+                GlobalSettingsProto.TEXT_CLASSIFIER_ACTION_MODEL_PARAMS);
+        dumpSetting(s, p,
                 Settings.Global.THEATER_MODE_ON,
                 GlobalSettingsProto.THEATER_MODE_ON);
         dumpSetting(s, p,
@@ -1916,6 +1919,36 @@
         dumpSetting(s, p,
                 Settings.Secure.ENHANCED_VOICE_PRIVACY_ENABLED,
                 SecureSettingsProto.ENHANCED_VOICE_PRIVACY_ENABLED);
+
+        final long gestureToken = p.start(SecureSettingsProto.GESTURE);
+        dumpSetting(s, p,
+                Settings.Secure.AWARE_ENABLED,
+                SecureSettingsProto.Gesture.AWARE_ENABLED);
+
+        dumpSetting(s, p,
+                Settings.Secure.SILENCE_ALARMS_GESTURE_COUNT,
+                SecureSettingsProto.Gesture.SILENCE_ALARMS_COUNT);
+        dumpSetting(s, p,
+                Settings.Secure.SILENCE_CALL_GESTURE_COUNT,
+                SecureSettingsProto.Gesture.SILENCE_CALLS_COUNT);
+        dumpSetting(s, p,
+                Settings.Secure.SILENCE_GESTURE,
+                SecureSettingsProto.Gesture.SILENCE_ENABLED);
+        dumpSetting(s, p,
+                Settings.Secure.SILENCE_NOTIFICATION_GESTURE_COUNT,
+                SecureSettingsProto.Gesture.SILENCE_NOTIFICATION_COUNT);
+        dumpSetting(s, p,
+                Settings.Secure.SILENCE_TIMER_GESTURE_COUNT,
+                SecureSettingsProto.Gesture.SILENCE_TIMER_COUNT);
+
+        dumpSetting(s, p,
+                Settings.Secure.SKIP_GESTURE_COUNT,
+                SecureSettingsProto.Gesture.SKIP_COUNT);
+        dumpSetting(s, p,
+                Settings.Secure.SKIP_GESTURE,
+                SecureSettingsProto.Gesture.SKIP_ENABLED);
+        p.end(gestureToken);
+
         dumpSetting(s, p,
                 Settings.Secure.IMMERSIVE_MODE_CONFIRMATIONS,
                 SecureSettingsProto.IMMERSIVE_MODE_CONFIRMATIONS);
@@ -1974,6 +2007,9 @@
         dumpSetting(s, p,
                 Settings.Secure.LOCATION_CHANGER,
                 SecureSettingsProto.Location.CHANGER);
+        dumpSetting(s, p,
+                Settings.Secure.LOCATION_PERMISSIONS_UPGRADE_TO_Q_MODE,
+                SecureSettingsProto.Location.PERMISSIONS_UPGRADE_TO_Q_MODE);
         p.end(locationToken);
 
         final long locationAccessCheckToken = p.start(SecureSettingsProto.LOCATION_ACCESS_CHECK);
@@ -2278,6 +2314,9 @@
                 Settings.Secure.SYSTEM_NAVIGATION_KEYS_ENABLED,
                 SecureSettingsProto.SYSTEM_NAVIGATION_KEYS_ENABLED);
         dumpSetting(s, p,
+                Settings.Secure.THEME_CUSTOMIZATION_OVERLAY_PACKAGES,
+                SecureSettingsProto.THEME_CUSTOMIZATION_OVERLAY_PACKAGES);
+        dumpSetting(s, p,
                 Settings.Secure.TRUST_AGENTS_INITIALIZED,
                 SecureSettingsProto.TRUST_AGENTS_INITIALIZED);
 
@@ -2395,22 +2434,6 @@
                 SecureSettingsProto.Zen.SETTINGS_SUGGESTION_VIEWED);
         p.end(zenToken);
 
-        dumpSetting(s, p,
-                Settings.Secure.SKIP_GESTURE,
-                SecureSettingsProto.SKIP_GESTURE_ENABLED);
-
-        dumpSetting(s, p,
-                Settings.Secure.SILENCE_GESTURE,
-                SecureSettingsProto.SILENCE_GESTURE_ENABLED);
-
-        dumpSetting(s, p,
-                Settings.Secure.THEME_CUSTOMIZATION_OVERLAY_PACKAGES,
-                SecureSettingsProto.THEME_CUSTOMIZATION_OVERLAY_PACKAGES);
-
-        dumpSetting(s, p,
-                Settings.Secure.AWARE_ENABLED,
-                SecureSettingsProto.AWARE_ENABLED);
-
         // Please insert new settings using the same order as in SecureSettingsProto.
         p.end(token);
 
diff --git a/packages/SettingsProvider/src/com/android/providers/settings/SettingsProvider.java b/packages/SettingsProvider/src/com/android/providers/settings/SettingsProvider.java
index ceafbfa..2c2987c 100644
--- a/packages/SettingsProvider/src/com/android/providers/settings/SettingsProvider.java
+++ b/packages/SettingsProvider/src/com/android/providers/settings/SettingsProvider.java
@@ -969,6 +969,11 @@
                 try {
                     synchronized (mLock) {
                         Setting setting = getSecureSetting(
+                                Settings.Secure.LOCATION_MODE, userId);
+                        updateSecureSetting(Settings.Secure.LOCATION_MODE,
+                                setting != null ? setting.getValue() : null, null,
+                                true, userId, true);
+                        setting = getSecureSetting(
                                 Settings.Secure.LOCATION_PROVIDERS_ALLOWED, userId);
                         updateSecureSetting(Settings.Secure.LOCATION_PROVIDERS_ALLOWED,
                                 setting != null ? setting.getValue() : null, null,
@@ -3232,7 +3237,7 @@
         }
 
         private final class UpgradeController {
-            private static final int SETTINGS_VERSION = 174;
+            private static final int SETTINGS_VERSION = 175;
 
             private final int mUserId;
 
@@ -4229,23 +4234,18 @@
                         final Setting locationProvidersAllowed = secureSettings.getSettingLocked(
                                 Secure.LOCATION_PROVIDERS_ALLOWED);
 
-                        String defLocationMode = Integer.toString(
-                                !TextUtils.isEmpty(locationProvidersAllowed.getValue())
-                                        ? Secure.LOCATION_MODE_ON
-                                        : Secure.LOCATION_MODE_OFF);
+                        final int defLocationMode;
+                        if (locationProvidersAllowed.isNull()) {
+                            defLocationMode = getContext().getResources().getInteger(
+                                    R.integer.def_location_mode);
+                        } else {
+                            defLocationMode =
+                                    !TextUtils.isEmpty(locationProvidersAllowed.getValue())
+                                            ? Secure.LOCATION_MODE_ON
+                                            : Secure.LOCATION_MODE_OFF;
+                        }
                         secureSettings.insertSettingLocked(
-                                Secure.LOCATION_MODE, defLocationMode,
-                                null, true, SettingsState.SYSTEM_PACKAGE_NAME);
-
-                        // also reset LOCATION_PROVIDERS_ALLOWED back to the default value - this
-                        // setting is now only for debug/test purposes, and will likely be removed
-                        // in a later release. LocationManagerService is responsible for adjusting
-                        // these settings to the proper state.
-
-                        String defLocationProvidersAllowed = getContext().getResources().getString(
-                                R.string.def_location_providers_allowed);
-                        secureSettings.insertSettingLocked(
-                                Secure.LOCATION_PROVIDERS_ALLOWED, defLocationProvidersAllowed,
+                                Secure.LOCATION_MODE, Integer.toString(defLocationMode),
                                 null, true, SettingsState.SYSTEM_PACKAGE_NAME);
                     }
 
@@ -4270,6 +4270,24 @@
                     currentVersion = 174;
                 }
 
+                if (currentVersion == 174) {
+                    // Version 174: Set the default value for Global Settings: APPLY_RAMPING_RINGER
+
+                    final SettingsState globalSettings = getGlobalSettingsLocked();
+
+                    Setting currentRampingRingerSetting = globalSettings.getSettingLocked(
+                            Settings.Global.APPLY_RAMPING_RINGER);
+                    if (currentRampingRingerSetting.isNull()) {
+                        globalSettings.insertSettingLocked(
+                                Settings.Global.APPLY_RAMPING_RINGER,
+                                getContext().getResources().getBoolean(
+                                        R.bool.def_apply_ramping_ringer) ? "1" : "0", null,
+                                true, SettingsState.SYSTEM_PACKAGE_NAME);
+                    }
+
+                    currentVersion = 175;
+                }
+
                 // vXXX: Add new settings above this point.
 
                 if (currentVersion != newVersion) {
diff --git a/packages/Shell/AndroidManifest.xml b/packages/Shell/AndroidManifest.xml
index 0da3b10..fc6ef2b 100644
--- a/packages/Shell/AndroidManifest.xml
+++ b/packages/Shell/AndroidManifest.xml
@@ -146,6 +146,7 @@
     <uses-permission android:name="android.permission.SET_TIME_ZONE" />
     <uses-permission android:name="android.permission.DISABLE_HIDDEN_API_CHECKS" />
     <uses-permission android:name="android.permission.MANAGE_ROLE_HOLDERS" />
+    <uses-permission android:name="android.permission.OBSERVE_ROLE_HOLDERS" />
     <uses-permission android:name="android.permission.STATUS_BAR_SERVICE" />
     <!-- Permission needed to rename bugreport notifications (so they're not shown as Shell) -->
     <uses-permission android:name="android.permission.SUBSTITUTE_NOTIFICATION_APP_NAME" />
diff --git a/packages/SystemUI/Android.bp b/packages/SystemUI/Android.bp
index 29ae1b2..9425941 100644
--- a/packages/SystemUI/Android.bp
+++ b/packages/SystemUI/Android.bp
@@ -58,6 +58,7 @@
         "androidx.arch.core_core-runtime",
         "androidx.lifecycle_lifecycle-extensions",
         "androidx.dynamicanimation_dynamicanimation",
+        "iconloader_base",
         "SystemUI-tags",
         "SystemUI-proto",
         "dagger2-2.19",
@@ -113,7 +114,7 @@
         "SystemUI-tags",
         "SystemUI-proto",
         "metrics-helper-lib",
-        "android-support-test",
+        "androidx.test.rules", "hamcrest-library",
         "mockito-target-inline-minus-junit4",
         "testables",
         "truth-prebuilt",
diff --git a/packages/SystemUI/AndroidManifest.xml b/packages/SystemUI/AndroidManifest.xml
index 265d464..6df6c73 100644
--- a/packages/SystemUI/AndroidManifest.xml
+++ b/packages/SystemUI/AndroidManifest.xml
@@ -42,6 +42,7 @@
     <uses-permission android:name="android.permission.INJECT_EVENTS" />
     <uses-permission android:name="android.permission.DUMP" />
     <uses-permission android:name="android.permission.WRITE_SETTINGS" />
+    <uses-permission android:name="android.permission.READ_DEVICE_CONFIG" />
 
     <uses-permission android:name="android.permission.STATUS_BAR_SERVICE" />
     <uses-permission android:name="android.permission.STATUS_BAR" />
@@ -134,6 +135,7 @@
     <uses-permission android:name="android.permission.MANAGE_BIOMETRIC" />
     <uses-permission android:name="android.permission.MANAGE_SLICE_PERMISSIONS" />
     <uses-permission android:name="android.permission.CONTROL_KEYGUARD_SECURE_NOTIFICATIONS" />
+    <uses-permission android:name="android.permission.GET_RUNTIME_PERMISSIONS" />
 
     <!-- Needed for WallpaperManager.clear in ImageWallpaper.updateWallpaperLocked -->
     <uses-permission android:name="android.permission.SET_WALLPAPER"/>
diff --git a/packages/SystemUI/docs/dagger.md b/packages/SystemUI/docs/dagger.md
index cca2d13..c2159df 100644
--- a/packages/SystemUI/docs/dagger.md
+++ b/packages/SystemUI/docs/dagger.md
@@ -13,39 +13,47 @@
 ## State of the world
 
 Dagger 2 has been turned on for SystemUI and a early first pass has been taken
-for converting everything in Dependency.java to use Dagger. Since a lot of
-SystemUI depends on Dependency, stubs have been added to Dependency to proxy
-any gets through to the instances provided by dagger, this will allow migration
-of SystemUI through a number of CLs.
+for converting everything in [Dependency.java](packages/systemui/src/com/android/systemui/Dependency.java)
+to use Dagger. Since a lot of SystemUI depends on Dependency, stubs have been added to Dependency 
+to proxy any gets through to the instances provided by dagger, this will allow migration of SystemUI 
+through a number of CLs.
 
 ### How it works in SystemUI
 
 For the classes that we're using in Dependency and are switching to dagger, the
-equivalent dagger version is using @Singleton and only having one instance.
+equivalent dagger version is using `@Singleton` and therefore only has one instance.
 To have the single instance span all of SystemUI and be easily accessible for
-other components, there is a single root Component that exists that generates
-these. The component lives in SystemUIFactory and is called SystemUIRootComponent.
+other components, there is a single root `@Component` that exists that generates
+these. The component lives in [SystemUIFactory](packages/systemui/src/com/android/systemui/SystemUIFactory.java)
+and is called `SystemUIRootComponent`.
 
 ```java
+
 @Singleton
-@Component(modules = {SystemUIFactory.class, DependencyProvider.class, ContextHolder.class})
+@Component(modules = {SystemUIFactory.class, DependencyProvider.class, DependencyBinder.class,
+        ContextHolder.class})
 public interface SystemUIRootComponent {
     @Singleton
     Dependency.DependencyInjector createDependency();
 }
 ```
 
-The root modules are what provides the global singleton dependencies across
-SystemUI. ContextHolder is just a wrapper that provides a context.
-SystemUIFactory @Provide dependencies that need to be overridden by SystemUI
-variants (like other form factors). DependencyBinder creates the mapping from
-interfaces to implementation classes. DependencyProvider provides or binds any
-remaining depedencies required.
+The root component is composed of root modules, which in turn provide the global singleton 
+dependencies across all of SystemUI.
+
+- `ContextHolder` is just a wrapper that provides a context.
+
+- `SystemUIFactory` `@Provides` dependencies that need to be overridden by SystemUI
+variants (like other form factors e.g. Car). 
+
+- `DependencyBinder` creates the mapping from interfaces to implementation classes. 
+
+- `DependencyProvider` provides or binds any remaining depedencies required.
 
 ### Adding injection to a new SystemUI object
 
-Anything that depends on any @Singleton provider from SystemUIRootComponent
-should be declared as a Subcomponent of the root component, this requires
+Anything that depends on any `@Singleton` provider from SystemUIRootComponent
+should be declared as an `@Subcomponent` of the root component, this requires
 declaring your own interface for generating your own modules or just the
 object you need injected. The subcomponent also needs to be added to
 SystemUIRootComponent in SystemUIFactory so it can be acquired.
@@ -57,7 +65,7 @@
 }
 
 public class Dependency extends SystemUI {
-  ...
+  //...
 +  @Subcomponent
 +  public interface DependencyInjector {
 +      Dependency createSystemUI();
@@ -65,9 +73,9 @@
 }
 ```
 
-For objects that extend SystemUI and require injection, you can define an
+For objects which extend SystemUI and require injection, you can define an
 injector that creates the injected object for you. This other class should
-be referenced in @string/config_systemUIServiceComponents.
+be referenced in [@string/config_systemUIServiceComponents](packages/SystemUI/res/values/config.xml).
 
 ```java
 public static class DependencyCreator implements Injector {
@@ -82,7 +90,7 @@
 
 ### Adding a new injectable object
 
-First tag the constructor with @Inject. Also tag it with @Singleton if only one
+First tag the constructor with `@Inject`. Also tag it with `@Singleton` if only one
 instance should be created.
 
 ```java
@@ -97,14 +105,14 @@
 ```
 
 If you have an interface class and an implementation class, dagger needs to know
-how to map it. The simplest way to do this is to add a provides method to
-DependencyProvider.
+how to map it. The simplest way to do this is to add an `@Provides` method to
+DependencyProvider. The type of the return value tells dagger which dependency it's providing.
 
 ```java
 public class DependencyProvider {
-  ...
+  //...
   @Singleton
-  @Provide
+  @Provides
   public SomethingController provideSomethingController(Context context,
       @Named(MAIN_HANDLER_NAME) Handler mainHandler) {
     return new SomethingControllerImpl(context, mainHandler);
@@ -118,11 +126,11 @@
 
 ```java
 public class Dependency {
-  ...
+  //...
   @Inject Lazy<SomethingController> mSomethingController;
-  ...
+  //...
   public void start() {
-    ...
+    //...
     mProviders.put(SomethingController.class, mSomethingController::get);
   }
 }
@@ -192,7 +200,7 @@
 ```java
 public CustomView(@Named(VIEW_CONTEXT) Context themedViewContext, AttributeSet attrs,
         OtherCustomDependency something) {
-    ...
+    //...
 }
 ```
 
diff --git a/packages/SystemUI/plugin/src/com/android/systemui/plugins/ClockPlugin.java b/packages/SystemUI/plugin/src/com/android/systemui/plugins/ClockPlugin.java
index 38bf77d..7b7657a 100644
--- a/packages/SystemUI/plugin/src/com/android/systemui/plugins/ClockPlugin.java
+++ b/packages/SystemUI/plugin/src/com/android/systemui/plugins/ClockPlugin.java
@@ -13,6 +13,7 @@
  */
 package com.android.systemui.plugins;
 
+import android.graphics.Bitmap;
 import android.graphics.Paint.Style;
 import android.view.View;
 
@@ -21,13 +22,30 @@
 import java.util.TimeZone;
 
 /**
- * This plugin is used to replace main clock in keyguard.
+ * Plugin used to replace main clock in keyguard.
  */
 @ProvidesInterface(action = ClockPlugin.ACTION, version = ClockPlugin.VERSION)
 public interface ClockPlugin extends Plugin {
 
     String ACTION = "com.android.systemui.action.PLUGIN_CLOCK";
-    int VERSION = 1;
+    int VERSION = 2;
+
+    /**
+     * Get the name of the clock face.
+     *
+     * This name should not be translated.
+     */
+    String getName();
+
+    /**
+     * Get the title of the clock face to be shown in the picker app.
+     */
+    String getTitle();
+
+    /**
+     * Get thumbnail of clock face to be shown in the picker app.
+     */
+    Bitmap getThumbnail();
 
     /**
      * Get clock view.
@@ -62,18 +80,22 @@
     default void setColorPalette(boolean supportsDarkText, int[] colors) {}
 
     /**
-     * Notifies that time tick alarm from doze service fired.
-     */
-    default void dozeTimeTick() {}
-
-    /**
      * Set the amount (ratio) that the device has transitioned to doze.
      * @param darkAmount Amount of transition to doze: 1f for doze and 0f for awake.
      */
     default void setDarkAmount(float darkAmount) {}
 
     /**
+     * Notifies that time tick alarm from doze service fired.
+     *
+     * Implement this method instead of registering a broadcast listener for TIME_TICK.
+     */
+    default void onTimeTick() {}
+
+    /**
      * Notifies that the time zone has changed.
+     *
+     * Implement this method instead of registering a broadcast listener for TIME_ZONE_CHANGED.
      */
     default void onTimeZoneChanged(TimeZone timeZone) {}
 
diff --git a/packages/SystemUI/plugin/src/com/android/systemui/plugins/GlobalActionsPanelPlugin.java b/packages/SystemUI/plugin/src/com/android/systemui/plugins/GlobalActionsPanelPlugin.java
new file mode 100644
index 0000000..7c72688
--- /dev/null
+++ b/packages/SystemUI/plugin/src/com/android/systemui/plugins/GlobalActionsPanelPlugin.java
@@ -0,0 +1,86 @@
+/*
+ * Copyright (C) 2019 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 com.android.systemui.plugins;
+
+import android.view.View;
+
+import com.android.systemui.plugins.annotations.DependsOn;
+import com.android.systemui.plugins.annotations.ProvidesInterface;
+
+/**
+ * Plugin which provides a "Panel" {@link View} to be rendered inside of the GlobalActions menu.
+ *
+ * Implementations should construct a new {@link PanelViewController} with the given
+ * {@link Callbacks} instance inside of {@link #onPanelShown(Callbacks)}, and should not hold onto
+ * a reference, instead allowing Global Actions to manage the lifetime of the object.
+ *
+ * Under this assumption, {@link PanelViewController} represents the lifetime of a single invocation
+ * of the Global Actions menu. The {@link View} for the Panel is generated when the
+ * {@link PanelViewController} is constructed, and {@link PanelViewController#getPanelContent()}
+ * serves as a simple getter. When Global Actions is dismissed,
+ * {@link PanelViewController#onDismissed()} can be used to cleanup any resources allocated when
+ * constructed. Global Actions will then release the reference, and the {@link PanelViewController}
+ * will be garbage-collected.
+ */
+@ProvidesInterface(
+        action = GlobalActionsPanelPlugin.ACTION, version = GlobalActionsPanelPlugin.VERSION)
+@DependsOn(target = GlobalActionsPanelPlugin.Callbacks.class)
+@DependsOn(target = GlobalActionsPanelPlugin.PanelViewController.class)
+public interface GlobalActionsPanelPlugin extends Plugin {
+    String ACTION = "com.android.systemui.action.PLUGIN_GLOBAL_ACTIONS_PANEL";
+    int VERSION = 0;
+
+    /**
+     * Invoked when the GlobalActions menu is shown.
+     *
+     * @param callbacks {@link Callbacks} instance that can be used by the Panel to interact with
+     *                  the Global Actions menu.
+     * @return A {@link PanelViewController} instance used to receive Global Actions events.
+     */
+    PanelViewController onPanelShown(Callbacks callbacks);
+
+    /**
+     * Provides methods to interact with the Global Actions menu.
+     */
+    @ProvidesInterface(version = Callbacks.VERSION)
+    interface Callbacks {
+        int VERSION = 0;
+
+        /** Dismisses the Global Actions menu. */
+        void dismissGlobalActionsMenu();
+    }
+
+    /**
+     * Receives Global Actions events, and provides the Panel {@link View}.
+     */
+    @ProvidesInterface(version = PanelViewController.VERSION)
+    interface PanelViewController {
+        int VERSION = 0;
+
+        /**
+         * Returns the {@link View} for the Panel to be rendered in Global Actions. This View can be
+         * any size, and will be rendered above the Global Actions menu when z-ordered.
+         */
+        View getPanelContent();
+
+        /**
+         * Invoked when the Global Actions menu (containing the View returned from
+         * {@link #getPanelContent()}) is dismissed.
+         */
+        void onDismissed();
+    }
+}
diff --git a/packages/SystemUI/res-keyguard/drawable-xxxhdpi/default_preview.png b/packages/SystemUI/res-keyguard/drawable-xxxhdpi/default_preview.png
deleted file mode 100644
index 035a4df..0000000
--- a/packages/SystemUI/res-keyguard/drawable-xxxhdpi/default_preview.png
+++ /dev/null
Binary files differ
diff --git a/packages/SystemUI/res-keyguard/drawable/bubble_hour_hand.xml b/packages/SystemUI/res-keyguard/drawable/bubble_hour_hand.xml
index d3c3a51..a2404b0 100644
--- a/packages/SystemUI/res-keyguard/drawable/bubble_hour_hand.xml
+++ b/packages/SystemUI/res-keyguard/drawable/bubble_hour_hand.xml
@@ -1,9 +1,9 @@
 <vector xmlns:android="http://schemas.android.com/apk/res/android"
-    android:height="200dp"
-    android:width="200dp"
-    android:viewportHeight="100"
-    android:viewportWidth="100">
+    android:height="350dp"
+    android:width="350dp"
+    android:viewportHeight="254.66145"
+    android:viewportWidth="254.66145">
     <path
         android:fillColor="#000000"
-        android:pathData="M50.082,14.199m-13.985,0a13.985,13.985 0,1 1,27.97 0a13.985,13.985 0,1 1,-27.97 0"/>
+        android:pathData="M127.331,40.481m-10.914,0a10.914,10.914 0,1 1,21.828 0a10.914,10.914 0,1 1,-21.828 0"/>
 </vector>
diff --git a/packages/SystemUI/res-keyguard/drawable/bubble_minute_hand.xml b/packages/SystemUI/res-keyguard/drawable/bubble_minute_hand.xml
index a4417fb..be10b5d 100644
--- a/packages/SystemUI/res-keyguard/drawable/bubble_minute_hand.xml
+++ b/packages/SystemUI/res-keyguard/drawable/bubble_minute_hand.xml
@@ -1,9 +1,11 @@
 <vector xmlns:android="http://schemas.android.com/apk/res/android"
-    android:height="200dp"
-    android:width="200dp"
-    android:viewportHeight="100"
-    android:viewportWidth="100" >
+    android:height="350dp"
+    android:width="350dp"
+    android:viewportHeight="254.66145"
+    android:viewportWidth="254.66145" >
     <path
-        android:fillColor="#000000"
-        android:pathData="M50.082,0.025L50.082,0.025A13.985,15.63 0,0 1,64.067 15.656L64.067,49.029A13.985,15.63 0,0 1,50.082 64.659L50.082,64.659A13.985,15.63 0,0 1,36.097 49.029L36.097,15.656A13.985,15.63 0,0 1,50.082 0.025z"/>
+        android:strokeColor="#000000"
+        android:strokeWidth="5"
+        android:pathData="M125.923,29.692L128.739,29.692A27.108,30.579 0,0 1,155.847 60.271L155.847,125.268A27.108,30.579 0,0 1,128.739 155.847L125.923,155.847A27.108,30.579 0,0 1,98.815 125.268L98.815,60.271A27.108,30.579 0,0 1,125.923 29.692z"/>
 </vector>
+
diff --git a/packages/SystemUI/res-keyguard/layout/bubble_clock.xml b/packages/SystemUI/res-keyguard/layout/bubble_clock.xml
index c8dc8e4..f945b10 100644
--- a/packages/SystemUI/res-keyguard/layout/bubble_clock.xml
+++ b/packages/SystemUI/res-keyguard/layout/bubble_clock.xml
@@ -21,9 +21,9 @@
   >
   <TextClock
       android:id="@+id/digital_clock"
-      android:layout_marginLeft="20dp"
+      android:paddingStart="20dp"
       android:layout_marginTop="72dp"
-      android:layout_width="wrap_content"
+      android:layout_width="match_parent"
       android:layout_height="wrap_content"
       android:layout_gravity="top|left"
       android:textSize="44dp"
@@ -42,15 +42,15 @@
   >
     <ImageView
         android:id="@+id/minute_hand"
-        android:layout_width="300dp"
-        android:layout_height="300dp"
+        android:layout_width="350dp"
+        android:layout_height="350dp"
         android:src="@drawable/bubble_minute_hand"
         android:tint="@color/bubbleMinuteHandColor"
     />
     <ImageView
         android:id="@+id/hour_hand"
-        android:layout_width="300dp"
-        android:layout_height="300dp"
+        android:layout_width="350dp"
+        android:layout_height="350dp"
         android:src="@drawable/bubble_hour_hand"
         android:tint="@color/bubbleHourHandColor"
     />
diff --git a/packages/SystemUI/res-keyguard/layout/default_clock_preview.xml b/packages/SystemUI/res-keyguard/layout/default_clock_preview.xml
new file mode 100644
index 0000000..3e6dd13
--- /dev/null
+++ b/packages/SystemUI/res-keyguard/layout/default_clock_preview.xml
@@ -0,0 +1,30 @@
+<?xml version="1.0" encoding="utf-8"?>
+<RelativeLayout
+    xmlns:android="http://schemas.android.com/apk/res/android"
+    android:layout_width="match_parent"
+    android:layout_height="match_parent"
+    >
+    <TextClock
+        android:id="@+id/time"
+        style="@style/widget_big"
+        android:layout_width="match_parent"
+        android:layout_height="wrap_content"
+        android:layout_above="@id/date"
+        android:letterSpacing="0.03"
+        android:gravity="center_horizontal"
+        android:format12Hour="@string/keyguard_widget_12_hours_format"
+        android:format24Hour="@string/keyguard_widget_24_hours_format"
+        />
+
+    <TextClock
+        android:id="@+id/date"
+        style="@stype/widget_big"
+        android:layout_width="match_parent"
+        android:layout_height="wrap_content"
+        android:layout_centerInParent="true"
+        android:letterSpacing="0.03"
+        android:gravity="center_horizontal"
+        android:format12Hour="EEE, MMM d"
+        android:format24Hour="EEE, MMM d"
+        />
+</RelativeLayout>
diff --git a/packages/SystemUI/res-keyguard/layout/stretchanalog_clock.xml b/packages/SystemUI/res-keyguard/layout/stretchanalog_clock.xml
index 116a044..dd25df8 100644
--- a/packages/SystemUI/res-keyguard/layout/stretchanalog_clock.xml
+++ b/packages/SystemUI/res-keyguard/layout/stretchanalog_clock.xml
@@ -21,9 +21,9 @@
   >
   <TextClock
       android:id="@+id/digital_clock"
-      android:layout_marginLeft="20dp"
+      android:paddingStart="20dp"
       android:layout_marginTop="72dp"
-      android:layout_width="wrap_content"
+      android:layout_width="match_parent"
       android:layout_height="wrap_content"
       android:layout_gravity="top|left"
       android:textSize="44dp"
diff --git a/packages/SystemUI/res-keyguard/layout/type_clock.xml b/packages/SystemUI/res-keyguard/layout/type_aod_clock.xml
similarity index 74%
rename from packages/SystemUI/res-keyguard/layout/type_clock.xml
rename to packages/SystemUI/res-keyguard/layout/type_aod_clock.xml
index f4a7376..28ff5a2 100644
--- a/packages/SystemUI/res-keyguard/layout/type_clock.xml
+++ b/packages/SystemUI/res-keyguard/layout/type_aod_clock.xml
@@ -19,13 +19,5 @@
     android:layout_width="match_parent"
     android:layout_height="match_parent"
   >
-  <com.android.keyguard.clock.TypographicClock
-      android:id="@+id/type_clock"
-      android:orientation="vertical"
-      android:layout_width="match_parent"
-      android:layout_height="wrap_content"
-      android:paddingLeft="50dp"
-      style="@style/widget_big"
-      android:textSize="40dp"
-      />
+  <include layout="@layout/typographic_clock" />
 </com.android.keyguard.clock.ClockLayout>
diff --git a/packages/SystemUI/res-keyguard/layout/type_clock.xml b/packages/SystemUI/res-keyguard/layout/typographic_clock.xml
similarity index 63%
copy from packages/SystemUI/res-keyguard/layout/type_clock.xml
copy to packages/SystemUI/res-keyguard/layout/typographic_clock.xml
index f4a7376..73bb4b9 100644
--- a/packages/SystemUI/res-keyguard/layout/type_clock.xml
+++ b/packages/SystemUI/res-keyguard/layout/typographic_clock.xml
@@ -14,18 +14,13 @@
   See the License for the specific language governing permissions and
   limitations under the License.
   -->
-<com.android.keyguard.clock.ClockLayout
+<com.android.keyguard.clock.TypographicClock
     xmlns:android="http://schemas.android.com/apk/res/android"
+    android:id="@+id/type_clock"
     android:layout_width="match_parent"
-    android:layout_height="match_parent"
-  >
-  <com.android.keyguard.clock.TypographicClock
-      android:id="@+id/type_clock"
-      android:orientation="vertical"
-      android:layout_width="match_parent"
-      android:layout_height="wrap_content"
-      android:paddingLeft="50dp"
-      style="@style/widget_big"
-      android:textSize="40dp"
-      />
-</com.android.keyguard.clock.ClockLayout>
+    android:layout_height="wrap_content"
+    android:paddingStart="50dp"
+    android:textAlignment="viewStart"
+    style="@style/widget_big"
+    android:textSize="40dp"
+    />
diff --git a/packages/SystemUI/res/drawable/btn_restart.xml b/packages/SystemUI/res/drawable/btn_restart.xml
new file mode 100644
index 0000000..73a48d3
--- /dev/null
+++ b/packages/SystemUI/res/drawable/btn_restart.xml
@@ -0,0 +1,28 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!--
+     Copyright (C) 2019 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="#aa000000"
+        android:pathData="M0,12 a12,12 0 1,0 24,0 a12,12 0 1,0 -24,0" />
+    <path
+        android:fillColor="@android:color/white"
+        android:pathData="M17.65,6.35c-1.63,-1.63 -3.94,-2.57 -6.48,-2.31c-3.67,0.37 -6.69,3.35 -7.1,7.02C3.52,15.91 7.27,20 12,20c3.19,0 5.93,-1.87 7.21,-4.57c0.31,-0.66 -0.16,-1.43 -0.89,-1.43h-0.01c-0.37,0 -0.72,0.2 -0.88,0.53c-1.13,2.43 -3.84,3.97 -6.81,3.32c-2.22,-0.49 -4.01,-2.3 -4.49,-4.52C5.31,9.44 8.26,6 12,6c1.66,0 3.14,0.69 4.22,1.78l-2.37,2.37C13.54,10.46 13.76,11 14.21,11H19c0.55,0 1,-0.45 1,-1V5.21c0,-0.45 -0.54,-0.67 -0.85,-0.35L17.65,6.35z"/>
+</vector>
diff --git a/packages/SystemUI/res/values-land/integers.xml b/packages/SystemUI/res/drawable/global_action_panel_scrim.xml
similarity index 62%
copy from packages/SystemUI/res/values-land/integers.xml
copy to packages/SystemUI/res/drawable/global_action_panel_scrim.xml
index fb22665..177b8d2 100644
--- a/packages/SystemUI/res/values-land/integers.xml
+++ b/packages/SystemUI/res/drawable/global_action_panel_scrim.xml
@@ -1,6 +1,6 @@
 <?xml version="1.0" encoding="utf-8"?>
 <!--
-  ~ Copyright (C) 2018 The Android Open Source Project
+  ~ Copyright (C) 2019 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.
@@ -14,9 +14,13 @@
   ~ See the License for the specific language governing permissions and
   ~ limitations under the License
   -->
-<resources>
-    <!-- Action footer width is set to 0 to allow it to stretch (through a weight of 1) and center
-         the page indicator in between the footer and the carrier text.-->
-    <integer name="qs_footer_actions_width">0</integer>
-    <integer name="qs_footer_actions_weight">1</integer>
-</resources>
\ No newline at end of file
+
+<shape xmlns:android="http://schemas.android.com/apk/res/android"
+       android:shape="rectangle">
+    <gradient
+        android:centerY="0.45"
+        android:startColor="#be3c4043"
+        android:centerColor="#be3c4043"
+        android:endColor="#4d3c4043"
+        android:angle="270" />
+</shape>
\ No newline at end of file
diff --git a/packages/SystemUI/res/drawable/ic_media_projection_permission.xml b/packages/SystemUI/res/drawable/ic_media_projection_permission.xml
new file mode 100644
index 0000000..f46d137
--- /dev/null
+++ b/packages/SystemUI/res/drawable/ic_media_projection_permission.xml
@@ -0,0 +1,26 @@
+<!--
+Copyright (C) 2019 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.
+-->
+<inset xmlns:android="http://schemas.android.com/apk/res/android"
+    android:insetLeft="2.5dp"
+    android:insetRight="2.5dp">
+    <vector android:width="24dp"
+            android:height="24dp"
+            android:viewportWidth="24.0"
+            android:viewportHeight="24.0">
+        <path android:fillColor="#FF000000" android:pathData="M1,18v3h3C4,19.34 2.66,18 1,18zM1,14v2c2.76,0 5,2.24 5,5h2C8,17.13 4.87,14 1,14zM1,10v2c4.97,0 9,4.03 9,9h2C12,14.92 7.07,10 1,10zM21,3H3C1.9,3 1,3.9 1,5v3h2V5h18v14h-7v2h7c1.1,0 2,-0.9 2,-2V5C23,3.9 22.1,3 21,3z"/>
+        <path android:fillColor="#FF0000" android:pathData="M19,7H5v1.63c3.96,1.28 7.09,4.41 8.37,8.37H19V7z"/>
+    </vector>
+</inset>
diff --git a/packages/SystemUI/res/drawable/qs_detail_background.xml b/packages/SystemUI/res/drawable/qs_detail_background.xml
index 84c793f..672abf1 100644
--- a/packages/SystemUI/res/drawable/qs_detail_background.xml
+++ b/packages/SystemUI/res/drawable/qs_detail_background.xml
@@ -14,6 +14,20 @@
     limitations under the License.
 -->
 <transition xmlns:android="http://schemas.android.com/apk/res/android">
-    <item android:drawable="@color/qs_detail_transition" />
-    <item android:drawable="?android:attr/colorPrimary" />
+    <item>
+        <inset>
+            <shape>
+                <solid android:color="@color/qs_detail_transition"/>
+                <corners android:radius="?android:attr/dialogCornerRadius" />
+            </shape>
+        </inset>
+    </item>
+    <item>
+        <inset>
+            <shape>
+                <solid android:color="?android:attr/colorPrimary"/>
+                <corners android:radius="?android:attr/dialogCornerRadius" />
+            </shape>
+        </inset>
+    </item>
 </transition>
\ No newline at end of file
diff --git a/packages/SystemUI/res/layout-land/global_actions_grid.xml b/packages/SystemUI/res/layout-land/global_actions_grid.xml
index 480f523..235d0fc 100644
--- a/packages/SystemUI/res/layout-land/global_actions_grid.xml
+++ b/packages/SystemUI/res/layout-land/global_actions_grid.xml
@@ -10,14 +10,12 @@
     android:gravity="top|right"
     android:clipChildren="false"
 >
-
     <LinearLayout
         android:layout_height="match_parent"
         android:layout_width="wrap_content"
         android:gravity="top|right"
         android:padding="0dp"
         android:orientation="vertical"
-        android:layoutDirection="ltr"
         android:layout_marginRight="@dimen/global_actions_grid_container_bottom_margin"
     >
         <!-- Grid of action items -->
@@ -26,7 +24,6 @@
             android:layout_width="wrap_content"
             android:layout_height="wrap_content"
             android:orientation="vertical"
-            android:layoutDirection="ltr"
             android:layout_marginTop="@dimen/global_actions_grid_side_margin"
             android:translationZ="@dimen/global_actions_translate"
             android:paddingLeft="@dimen/global_actions_grid_horizontal_padding"
@@ -39,25 +36,21 @@
                 android:layout_width="wrap_content"
                 android:layout_height="wrap_content"
                 android:visibility="gone"
-                android:layoutDirection="ltr"
-                android:orientation="horizontal"
+                android:layoutDirection="locale"
             />
             <LinearLayout
                 android:layout_width="wrap_content"
                 android:layout_height="wrap_content"
                 android:visibility="gone"
-                android:layoutDirection="ltr"
-                android:orientation="horizontal"
+                android:layoutDirection="locale"
             />
             <LinearLayout
                 android:layout_width="wrap_content"
                 android:layout_height="wrap_content"
                 android:visibility="gone"
-                android:layoutDirection="ltr"
-                android:orientation="horizontal"
+                android:layoutDirection="locale"
             />
         </com.android.systemui.globalactions.ListGridLayout>
-
         <!-- For separated items-->
         <LinearLayout
             android:id="@+id/separated_button"
diff --git a/packages/SystemUI/res/layout-land/global_actions_grid_seascape.xml b/packages/SystemUI/res/layout-land/global_actions_grid_seascape.xml
index 4f86826..e028214 100644
--- a/packages/SystemUI/res/layout-land/global_actions_grid_seascape.xml
+++ b/packages/SystemUI/res/layout-land/global_actions_grid_seascape.xml
@@ -10,7 +10,6 @@
     android:gravity="top|left"
     android:clipChildren="false"
 >
-
     <LinearLayout
         android:layout_height="match_parent"
         android:layout_width="wrap_content"
@@ -37,11 +36,11 @@
             android:gravity="center"
             android:translationZ="@dimen/global_actions_translate"
         />
-
         <!-- Grid of action items -->
         <com.android.systemui.globalactions.ListGridLayout
             android:id="@android:id/list"
             android:layout_gravity="bottom|left"
+            android:gravity="right"
             android:layout_width="wrap_content"
             android:layout_height="wrap_content"
             android:orientation="vertical"
@@ -54,28 +53,22 @@
             android:background="?android:attr/colorBackgroundFloating"
         >
             <LinearLayout
-                android:layout_gravity="bottom"
                 android:layout_width="wrap_content"
                 android:layout_height="wrap_content"
                 android:visibility="gone"
-                android:layoutDirection="rtl"
-                android:orientation="horizontal"
+                android:layoutDirection="locale"
             />
             <LinearLayout
-                android:layout_gravity="bottom"
                 android:layout_width="wrap_content"
                 android:layout_height="wrap_content"
                 android:visibility="gone"
-                android:layoutDirection="rtl"
-                android:orientation="horizontal"
+                android:layoutDirection="locale"
             />
             <LinearLayout
-                android:layout_gravity="bottom"
                 android:layout_width="wrap_content"
                 android:layout_height="wrap_content"
                 android:visibility="gone"
-                android:layoutDirection="rtl"
-                android:orientation="horizontal"
+                android:layoutDirection="locale"
             />
         </com.android.systemui.globalactions.ListGridLayout>
     </LinearLayout>
diff --git a/packages/SystemUI/res/values-land/integers.xml b/packages/SystemUI/res/layout/assistant_handle.xml
similarity index 62%
copy from packages/SystemUI/res/values-land/integers.xml
copy to packages/SystemUI/res/layout/assistant_handle.xml
index fb22665..a952ca5 100644
--- a/packages/SystemUI/res/values-land/integers.xml
+++ b/packages/SystemUI/res/layout/assistant_handle.xml
@@ -1,6 +1,6 @@
 <?xml version="1.0" encoding="utf-8"?>
 <!--
-  ~ Copyright (C) 2018 The Android Open Source Project
+  ~ Copyright (C) 2019 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.
@@ -14,9 +14,12 @@
   ~ See the License for the specific language governing permissions and
   ~ limitations under the License
   -->
-<resources>
-    <!-- Action footer width is set to 0 to allow it to stretch (through a weight of 1) and center
-         the page indicator in between the footer and the carrier text.-->
-    <integer name="qs_footer_actions_width">0</integer>
-    <integer name="qs_footer_actions_weight">1</integer>
-</resources>
\ No newline at end of file
+
+<com.android.systemui.statusbar.phone.NavigationHandle
+    xmlns:android="http://schemas.android.com/apk/res/android"
+    android:id="@+id/assistant_handle"
+    android:layout_width="@dimen/navigation_assistant_handle_width"
+    android:layout_height="match_parent"
+    android:layout_weight="0"
+/>
+
diff --git a/packages/SystemUI/res/layout/global_actions_grid.xml b/packages/SystemUI/res/layout/global_actions_grid.xml
index 729e96e..a620a8e 100644
--- a/packages/SystemUI/res/layout/global_actions_grid.xml
+++ b/packages/SystemUI/res/layout/global_actions_grid.xml
@@ -10,7 +10,6 @@
     android:gravity="bottom|center"
     android:clipChildren="false"
 >
-
     <LinearLayout
         android:layout_height="wrap_content"
         android:layout_width="match_parent"
@@ -35,14 +34,13 @@
             android:gravity="center"
             android:translationZ="@dimen/global_actions_translate"
         />
-
         <!-- Grid of action items -->
         <com.android.systemui.globalactions.ListGridLayout
             android:id="@android:id/list"
             android:layout_width="wrap_content"
             android:layout_height="wrap_content"
-            android:orientation="horizontal"
-            android:layoutDirection="rtl"
+            android:orientation="vertical"
+            android:gravity="right"
             android:layout_marginRight="@dimen/global_actions_grid_side_margin"
             android:translationZ="@dimen/global_actions_translate"
             android:paddingLeft="@dimen/global_actions_grid_horizontal_padding"
@@ -55,19 +53,19 @@
                 android:layout_width="wrap_content"
                 android:layout_height="wrap_content"
                 android:visibility="gone"
-                android:orientation="vertical"
+                android:layoutDirection="locale"
             />
             <LinearLayout
                 android:layout_width="wrap_content"
                 android:layout_height="wrap_content"
                 android:visibility="gone"
-                android:orientation="vertical"
+                android:layoutDirection="locale"
             />
             <LinearLayout
                 android:layout_width="wrap_content"
                 android:layout_height="wrap_content"
                 android:visibility="gone"
-                android:orientation="vertical"
+                android:layoutDirection="locale"
             />
         </com.android.systemui.globalactions.ListGridLayout>
     </LinearLayout>
diff --git a/packages/SystemUI/res/layout/global_actions_grid_item.xml b/packages/SystemUI/res/layout/global_actions_grid_item.xml
index 5dee09d..999c7b8 100644
--- a/packages/SystemUI/res/layout/global_actions_grid_item.xml
+++ b/packages/SystemUI/res/layout/global_actions_grid_item.xml
@@ -35,7 +35,7 @@
         android:layout_marginBottom="@dimen/global_actions_grid_item_icon_bottom_margin"
         android:layout_marginLeft="@dimen/global_actions_grid_item_icon_side_margin"
         android:layout_marginRight="@dimen/global_actions_grid_item_icon_side_margin"
-        android:scaleType="center"
+        android:scaleType="centerInside"
         android:alpha="?android:attr/primaryContentAlpha"
     />
 
diff --git a/packages/SystemUI/res/layout/home_handle.xml b/packages/SystemUI/res/layout/home_handle.xml
index 48ea5c4..d950f39 100644
--- a/packages/SystemUI/res/layout/home_handle.xml
+++ b/packages/SystemUI/res/layout/home_handle.xml
@@ -18,7 +18,7 @@
 <com.android.systemui.statusbar.phone.NavigationHandle
     xmlns:android="http://schemas.android.com/apk/res/android"
     android:id="@+id/home_handle"
-    android:layout_width="@dimen/navigation_handle_width"
+    android:layout_width="@dimen/navigation_home_handle_width"
     android:layout_height="match_parent"
     android:layout_weight="0"
     />
diff --git a/packages/SystemUI/res/layout/keyguard_bottom_area.xml b/packages/SystemUI/res/layout/keyguard_bottom_area.xml
index 53b3a7e..adc0b41 100644
--- a/packages/SystemUI/res/layout/keyguard_bottom_area.xml
+++ b/packages/SystemUI/res/layout/keyguard_bottom_area.xml
@@ -83,9 +83,9 @@
         android:layout_height="@dimen/keyguard_lock_height"
         android:layout_gravity="bottom|center_horizontal"
         android:layout_marginBottom="@dimen/keyguard_lock_padding"
-        android:src="@*android:drawable/ic_lock_24dp"
+        android:src="@*android:drawable/ic_lock"
         android:contentDescription="@string/accessibility_unlock_button"
-        android:scaleType="fitCenter" />
+        android:scaleType="center" />
 
     <FrameLayout
         android:id="@+id/overlay_container"
diff --git a/packages/SystemUI/res/layout/mobile_signal_group.xml b/packages/SystemUI/res/layout/mobile_signal_group.xml
index 5ecd380..bfd079b 100644
--- a/packages/SystemUI/res/layout/mobile_signal_group.xml
+++ b/packages/SystemUI/res/layout/mobile_signal_group.xml
@@ -65,8 +65,8 @@
         android:layout_gravity="center_vertical">
         <com.android.systemui.statusbar.AnimatedImageView
             android:id="@+id/mobile_signal"
-            android:layout_height="wrap_content"
-            android:layout_width="wrap_content"
+            android:layout_height="@dimen/qs_header_mobile_icon_size"
+            android:layout_width="@dimen/qs_header_mobile_icon_size"
             systemui:hasOverlappingRendering="false"
             />
         <ImageView
diff --git a/packages/SystemUI/res/layout/notification_info.xml b/packages/SystemUI/res/layout/notification_info.xml
index 91353d7..7e0f3ae 100644
--- a/packages/SystemUI/res/layout/notification_info.xml
+++ b/packages/SystemUI/res/layout/notification_info.xml
@@ -44,7 +44,7 @@
             android:id="@+id/pkgname"
             android:layout_width="wrap_content"
             android:layout_height="wrap_content"
-            android:textAppearance="@*android:style/TextAppearance.Material.Notification.Info"
+            android:textAppearance="@*android:style/TextAppearance.DeviceDefault.Notification.Info"
             android:layout_marginStart="3dp"
             android:layout_marginEnd="2dp"
             android:singleLine="true"
@@ -54,7 +54,7 @@
             android:id="@+id/pkg_divider"
             android:layout_width="wrap_content"
             android:layout_height="wrap_content"
-            android:textAppearance="@*android:style/TextAppearance.Material.Notification.Info"
+            android:textAppearance="@*android:style/TextAppearance.DeviceDefault.Notification.Info"
             android:layout_marginStart="2dp"
             android:layout_marginEnd="2dp"
             android:text="@*android:string/notification_header_divider_symbol"
@@ -64,7 +64,7 @@
             android:id="@+id/delegate_name"
             android:layout_width="wrap_content"
             android:layout_height="wrap_content"
-            android:textAppearance="@*android:style/TextAppearance.Material.Notification.Info"
+            android:textAppearance="@*android:style/TextAppearance.DeviceDefault.Notification.Info"
             android:layout_marginStart="2dp"
             android:layout_marginEnd="2dp"
             android:ellipsize="end"
@@ -129,7 +129,7 @@
                     android:id="@+id/group_name"
                     android:layout_width="wrap_content"
                     android:layout_height="wrap_content"
-                    android:textAppearance="@*android:style/TextAppearance.Material.Notification.Title"
+                    android:textAppearance="@*android:style/TextAppearance.DeviceDefault.Notification.Title"
                     android:layout_marginStart="2dp"
                     android:layout_marginEnd="2dp"
                     android:ellipsize="end"
@@ -139,7 +139,7 @@
                     android:id="@+id/pkg_group_divider"
                     android:layout_width="wrap_content"
                     android:layout_height="wrap_content"
-                    android:textAppearance="@*android:style/TextAppearance.Material.Notification.Title"
+                    android:textAppearance="@*android:style/TextAppearance.DeviceDefault.Notification.Title"
                     android:layout_marginStart="2dp"
                     android:layout_marginEnd="2dp"
                     android:text="@*android:string/notification_header_divider_symbol"
@@ -151,7 +151,7 @@
                     android:layout_width="wrap_content"
                     android:layout_height="wrap_content"
                     android:layout_weight="1"
-                    style="@android:style/TextAppearance.Material.Notification.Title"
+                    style="@*android:style/TextAppearance.DeviceDefault.Notification.Title"
                     android:layout_toEndOf="@id/pkg_group_divider"/>
             </RelativeLayout>
             <!-- Question prompt -->
@@ -159,7 +159,7 @@
                 android:id="@+id/block_prompt"
                 android:layout_width="wrap_content"
                 android:layout_height="wrap_content"
-                style="@android:style/TextAppearance.Material.Notification" />
+                style="@*android:style/TextAppearance.DeviceDefault.Notification" />
         </LinearLayout>
 
         <!-- Settings and Done buttons -->
@@ -174,10 +174,11 @@
             android:clipToPadding="false">
             <TextView
                 android:id="@+id/done"
-                android:text="@string/inline_done_button"
+                android:text="@string/inline_ok_button"
                 android:layout_width="wrap_content"
                 android:layout_height="wrap_content"
                 android:layout_centerVertical="true"
+                android:maxWidth="100dp"
                 style="@style/TextAppearance.NotificationInfo.Button"/>
 
             <LinearLayout
@@ -186,15 +187,17 @@
                 android:layout_height="wrap_content"
                 android:layout_centerVertical="true"
                 android:layout_alignParentEnd="true"
+                android:maxWidth="200dp"
                 android:orientation="horizontal">
                 <TextView
                     android:id="@+id/deliver_silently"
-                    android:text="@string/inline_deliver_silently_button"
+                    android:text="@string/inline_silent_button_silent"
                     android:layout_width="wrap_content"
                     android:layout_height="wrap_content"
                     android:layout_centerVertical="true"
                     android:layout_marginStart="@dimen/notification_guts_button_horizontal_spacing"
                     android:paddingRight="24dp"
+                    android:maxWidth="125dp"
                     style="@style/TextAppearance.NotificationInfo.Button"/>
                 <TextView
                     android:id="@+id/block"
@@ -203,6 +206,7 @@
                     android:layout_width="wrap_content"
                     android:layout_height="wrap_content"
                     android:layout_centerVertical="true"
+                    android:maxWidth="75dp"
                     android:layout_marginStart="@dimen/notification_guts_button_horizontal_spacing"
                     style="@style/TextAppearance.NotificationInfo.Button"/>
                 <TextView
@@ -212,6 +216,7 @@
                     android:layout_width="wrap_content"
                     android:layout_height="wrap_content"
                     android:layout_centerVertical="true"
+                    android:maxWidth="75dp"
                     android:layout_marginStart="@dimen/notification_guts_button_horizontal_spacing"
                     style="@style/TextAppearance.NotificationInfo.Button"/>
             </LinearLayout>
diff --git a/packages/SystemUI/res/layout/qs_footer_carrier.xml b/packages/SystemUI/res/layout/qs_carrier.xml
similarity index 70%
rename from packages/SystemUI/res/layout/qs_footer_carrier.xml
rename to packages/SystemUI/res/layout/qs_carrier.xml
index bd492b0..6edccba 100644
--- a/packages/SystemUI/res/layout/qs_footer_carrier.xml
+++ b/packages/SystemUI/res/layout/qs_carrier.xml
@@ -14,36 +14,33 @@
   ~ limitations under the License
   -->
 
-<LinearLayout
+<com.android.systemui.qs.QSCarrier
     xmlns:android="http://schemas.android.com/apk/res/android"
-    android:id="@+id/linear_footer_carrier"
-    android:layout_width="0dp"
+    android:id="@+id/linear_carrier"
+    android:layout_width="wrap_content"
     android:layout_height="match_parent"
     android:orientation="horizontal"
-    android:layout_weight="1"
     android:gravity="center_vertical|start"
     android:background="@android:color/transparent"
     android:clickable="false"
     android:clipChildren="false"
-    android:clipToPadding="false"
-    android:paddingStart="16dp" >
+    android:clipToPadding="false" >
 
     <include
         layout="@layout/mobile_signal_group"
         android:layout_width="wrap_content"
         android:layout_height="wrap_content"
-        android:layout_marginEnd="8dp"
+        android:layout_marginEnd="@dimen/qs_carrier_margin_width"
         android:visibility="gone" />
 
-    <view class="com.android.systemui.qs.QSFooterImpl$QSCarrierText"
+    <view class="com.android.systemui.qs.QSCarrier$QSCarrierText"
         android:id="@+id/qs_carrier_text"
-        android:layout_width="0dp"
+        android:layout_width="wrap_content"
         android:layout_height="wrap_content"
         android:layout_weight="1"
-        android:ellipsize="marquee"
-        android:textAppearance="@style/TextAppearance.QS.CarrierInfo"
-        android:textColor="?android:attr/textColorPrimary"
+        android:textAppearance="@style/TextAppearance.QS.Status"
         android:textDirection="locale"
-        android:singleLine="true" />
+        android:singleLine="true"
+        android:maxEms="7"/>
 
-</LinearLayout>
\ No newline at end of file
+</com.android.systemui.qs.QSCarrier>
\ No newline at end of file
diff --git a/packages/SystemUI/res/layout/qs_carrier_group.xml b/packages/SystemUI/res/layout/qs_carrier_group.xml
new file mode 100644
index 0000000..20190b7
--- /dev/null
+++ b/packages/SystemUI/res/layout/qs_carrier_group.xml
@@ -0,0 +1,58 @@
+<!--
+  Copyright (C) 2019 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
+  -->
+
+<!-- Extends LinearLayout -->
+<com.android.systemui.qs.QSCarrierGroup
+    xmlns:android="http://schemas.android.com/apk/res/android"
+    android:id="@+id/qs_mobile"
+    android:layout_width="0dp"
+    android:layout_height="match_parent"
+    android:layout_weight="1"
+    android:gravity="end|center_vertical"
+    android:orientation="horizontal">
+
+
+    <include
+        layout="@layout/qs_carrier"
+        android:id="@+id/carrier1"
+        android:layout_weight="1"/>
+
+    <View
+        android:id="@+id/qs_carrier_divider1"
+        android:layout_width="@dimen/qs_header_carrier_separator_width"
+        android:layout_height="match_parent"
+        android:visibility="gone" />
+
+    <include
+        layout="@layout/qs_carrier"
+        android:id="@+id/carrier2"
+        android:layout_weight="1"
+        android:visibility="gone"/>
+
+    <View
+        android:id="@+id/qs_carrier_divider2"
+        android:layout_width="@dimen/qs_header_carrier_separator_width"
+        android:layout_height="match_parent"
+        android:layout_weight="1"
+        android:visibility="gone" />
+
+    <include
+        layout="@layout/qs_carrier"
+        android:id="@+id/carrier3"
+        android:layout_weight="1"
+        android:visibility="gone"/>
+
+</com.android.systemui.qs.QSCarrierGroup>
\ No newline at end of file
diff --git a/packages/SystemUI/res/layout/qs_footer_impl.xml b/packages/SystemUI/res/layout/qs_footer_impl.xml
index 67e31ac..669d53b 100644
--- a/packages/SystemUI/res/layout/qs_footer_impl.xml
+++ b/packages/SystemUI/res/layout/qs_footer_impl.xml
@@ -21,6 +21,8 @@
     android:id="@+id/qs_footer"
     android:layout_width="match_parent"
     android:layout_height="@dimen/qs_footer_height"
+    android:layout_marginStart="@dimen/qs_footer_margin"
+    android:layout_marginEnd="@dimen/qs_footer_margin"
     android:elevation="4dp"
     android:background="@android:color/transparent"
     android:baselineAligned="false"
@@ -41,34 +43,35 @@
         android:layout_gravity="center_vertical"
         android:gravity="end" >
 
-        <LinearLayout
-            android:id="@+id/qs_mobile"
-            android:layout_width="0dp"
+        <com.android.keyguard.AlphaOptimizedLinearLayout
+            android:id="@+id/qs_footer_actions_edit_container"
+            android:layout_width="@integer/qs_footer_actions_width"
             android:layout_height="match_parent"
-            android:layout_weight="1"
-            android:gravity="center_vertical|start"
-            android:orientation="horizontal"
-            android:layout_marginEnd="32dp">
+            android:layout_weight="@integer/qs_footer_actions_weight"
+            android:gravity="center_vertical|start" >
+            <com.android.systemui.statusbar.AlphaOptimizedImageView
+                android:id="@android:id/edit"
+                android:layout_width="@dimen/qs_footer_action_button_size"
+                android:layout_height="@dimen/qs_footer_action_button_size"
+                android:background="?android:attr/selectableItemBackgroundBorderless"
+                android:clickable="true"
+                android:clipToPadding="false"
+                android:contentDescription="@string/accessibility_quick_settings_edit"
+                android:focusable="true"
+                android:padding="@dimen/qs_footer_icon_padding"
+                android:src="@*android:drawable/ic_mode_edit"
+                android:tint="?android:attr/colorForeground"/>
 
-            <include
-                layout="@layout/qs_footer_carrier"
-                android:id="@+id/carrier1" />
-
-            <View
-                android:id="@+id/qs_carrier_divider"
-                android:layout_width="2dp"
+            <TextView
+                android:id="@+id/build"
+                android:layout_width="wrap_content"
                 android:layout_height="match_parent"
-                android:layout_marginTop="15dp"
-                android:layout_marginBottom="15dp"
-                android:background="?android:attr/dividerVertical"
-                android:visibility="gone" />
-
-            <include
-                layout="@layout/qs_footer_carrier"
-                android:id="@+id/carrier2"
+                android:clickable="true"
+                android:gravity="center_vertical"
+                android:focusable="true"
+                android:textAppearance="@style/TextAppearance.QS.Status"
                 android:visibility="gone"/>
-
-        </LinearLayout>
+         </com.android.keyguard.AlphaOptimizedLinearLayout>
 
         <com.android.systemui.qs.PageIndicator
             android:id="@+id/footer_page_indicator"
@@ -85,8 +88,8 @@
             android:gravity="center_vertical|end" >
             <com.android.systemui.statusbar.phone.MultiUserSwitch
                 android:id="@+id/multi_user_switch"
-                android:layout_width="48dp"
-                android:layout_height="48dp"
+                android:layout_width="@dimen/qs_footer_action_button_size"
+                android:layout_height="@dimen/qs_footer_action_button_size"
                 android:layout_alignParentEnd="true"
                 android:background="@drawable/ripple_drawable"
                 android:focusable="true">
@@ -96,26 +99,14 @@
                     android:layout_width="@dimen/multi_user_avatar_expanded_size"
                     android:layout_height="@dimen/multi_user_avatar_expanded_size"
                     android:layout_gravity="center"
+                    android:tint="?android:attr/colorAccent"
                     android:scaleType="centerInside"/>
             </com.android.systemui.statusbar.phone.MultiUserSwitch>
 
-            <com.android.systemui.statusbar.AlphaOptimizedImageView
-                android:id="@android:id/edit"
-                android:layout_width="48dp"
-                android:layout_height="48dp"
-                android:background="?android:attr/selectableItemBackgroundBorderless"
-                android:clickable="true"
-                android:clipToPadding="false"
-                android:contentDescription="@string/accessibility_quick_settings_edit"
-                android:focusable="true"
-                android:padding="15dp"
-                android:src="@*android:drawable/ic_mode_edit"
-                android:tint="?android:attr/colorForeground"/>
-
             <com.android.systemui.statusbar.AlphaOptimizedFrameLayout
                 android:id="@+id/settings_button_container"
-                android:layout_width="48dp"
-                android:layout_height="48dp"
+                android:layout_width="@dimen/qs_footer_action_button_size"
+                android:layout_height="@dimen/qs_footer_action_button_size"
                 android:clipChildren="false"
                 android:clipToPadding="false">
 
@@ -124,10 +115,12 @@
                     style="@android:style/Widget.Material.Button.Borderless"
                     android:layout_width="match_parent"
                     android:layout_height="match_parent"
+                    android:layout_gravity="center"
+                    android:padding="@dimen/qs_footer_icon_padding"
                     android:background="@drawable/ripple_drawable"
                     android:contentDescription="@string/accessibility_quick_settings_settings"
-                    android:padding="15dp"
-                    android:src="@drawable/ic_settings_16dp"
+                    android:src="@drawable/ic_settings"
+                    android:scaleType="centerInside"
                     android:tint="?android:attr/colorForeground"/>
 
                 <com.android.systemui.statusbar.AlphaOptimizedImageView
@@ -143,7 +136,6 @@
             </com.android.systemui.statusbar.AlphaOptimizedFrameLayout>
         </com.android.keyguard.AlphaOptimizedLinearLayout>
     </LinearLayout>
-
     <View
         android:id="@+id/qs_drag_handle_view"
         android:layout_width="24dp"
diff --git a/packages/SystemUI/res/layout/qs_panel.xml b/packages/SystemUI/res/layout/qs_panel.xml
index 8c57ae8..01dfeb2 100644
--- a/packages/SystemUI/res/layout/qs_panel.xml
+++ b/packages/SystemUI/res/layout/qs_panel.xml
@@ -58,7 +58,7 @@
         android:elevation="4dp"
         android:background="@android:color/transparent"
         android:focusable="true"
-        android:accessibilityTraversalBefore="@id/qs_carrier_text"
+        android:accessibilityTraversalBefore="@android:id/edit"
     />
 
     <include layout="@layout/quick_status_bar_expanded_header" />
diff --git a/packages/SystemUI/res/layout/quick_settings_footer_dialog.xml b/packages/SystemUI/res/layout/quick_settings_footer_dialog.xml
index 5bcc1b3..b969a15 100644
--- a/packages/SystemUI/res/layout/quick_settings_footer_dialog.xml
+++ b/packages/SystemUI/res/layout/quick_settings_footer_dialog.xml
@@ -39,17 +39,14 @@
                 android:layout_width="match_parent"
                 android:layout_height="wrap_content"
                 android:text="@string/monitoring_title_device_owned"
-                style="@style/TextAppearance.DeviceManagementDialog.Title"
-                android:textColor="?android:attr/textColorPrimary"
+                style="@style/DeviceManagementDialogTitle"
                 android:paddingBottom="@dimen/qs_footer_dialog_subtitle_padding"
             />
             <TextView
                 android:id="@+id/device_management_warning"
                 android:layout_width="match_parent"
                 android:layout_height="wrap_content"
-                android:text="@null"
-                style="@android:style/TextAppearance.Material.Subhead"
-                android:textColor="?android:attr/textColorPrimary"
+                android:textAppearance="@style/TextAppearance.DeviceManagementDialog.Content"
             />
         </LinearLayout>
 
@@ -64,17 +61,14 @@
                 android:layout_width="match_parent"
                 android:layout_height="wrap_content"
                 android:text="@string/monitoring_subtitle_ca_certificate"
-                style="@style/TextAppearance.DeviceManagementDialog.Title"
-                android:textColor="?android:attr/textColorPrimary"
+                style="@style/DeviceManagementDialogTitle"
                 android:paddingBottom="@dimen/qs_footer_dialog_subtitle_padding"
             />
             <TextView
                 android:id="@+id/ca_certs_warning"
                 android:layout_width="match_parent"
                 android:layout_height="wrap_content"
-                android:text="@null"
-                style="@android:style/TextAppearance.Material.Subhead"
-                android:textColor="?android:attr/textColorPrimary"
+                android:textAppearance="@style/TextAppearance.DeviceManagementDialog.Content"
             />
         </LinearLayout>
 
@@ -89,17 +83,14 @@
                 android:layout_width="match_parent"
                 android:layout_height="wrap_content"
                 android:text="@string/monitoring_subtitle_network_logging"
-                style="@style/TextAppearance.DeviceManagementDialog.Title"
-                android:textColor="?android:attr/textColorPrimary"
+                style="@style/DeviceManagementDialogTitle"
                 android:paddingBottom="@dimen/qs_footer_dialog_subtitle_padding"
             />
             <TextView
                 android:id="@+id/network_logging_warning"
                 android:layout_width="match_parent"
                 android:layout_height="wrap_content"
-                android:text="@null"
-                style="@android:style/TextAppearance.Material.Subhead"
-                android:textColor="?android:attr/textColorPrimary"
+                android:textAppearance="@style/TextAppearance.DeviceManagementDialog.Content"
             />
         </LinearLayout>
 
@@ -114,17 +105,14 @@
                 android:layout_width="match_parent"
                 android:layout_height="wrap_content"
                 android:text="@string/monitoring_subtitle_vpn"
-                style="@style/TextAppearance.DeviceManagementDialog.Title"
-                android:textColor="?android:attr/textColorPrimary"
+                style="@style/DeviceManagementDialogTitle"
                 android:paddingBottom="@dimen/qs_footer_dialog_subtitle_padding"
             />
             <TextView
                 android:id="@+id/vpn_warning"
                 android:layout_width="match_parent"
                 android:layout_height="wrap_content"
-                android:text="@null"
-                style="@android:style/TextAppearance.Material.Subhead"
-                android:textColor="?android:attr/textColorPrimary"
+                android:textAppearance="@style/TextAppearance.DeviceManagementDialog.Content"
             />
         </LinearLayout>
     </LinearLayout>
diff --git a/packages/SystemUI/res/layout/quick_settings_header_info.xml b/packages/SystemUI/res/layout/quick_settings_header_info.xml
index 967e13f..075f51d 100644
--- a/packages/SystemUI/res/layout/quick_settings_header_info.xml
+++ b/packages/SystemUI/res/layout/quick_settings_header_info.xml
@@ -25,7 +25,7 @@
         android:id="@+id/long_press_tooltip"
         android:layout_width="wrap_content"
         android:layout_height="wrap_content"
-        android:layout_gravity="center_horizontal|bottom"
+        android:layout_gravity="start|bottom"
         android:alpha="0"
         android:text="@string/quick_settings_header_onboarding_text"
         android:textAppearance="@style/TextAppearance.QS.TileLabel"
@@ -33,54 +33,69 @@
         android:visibility="invisible" />
 
     <LinearLayout
-        android:id="@+id/status_container"
         android:layout_width="wrap_content"
         android:layout_height="wrap_content"
-        android:layout_gravity="center_horizontal|bottom"
-        android:gravity="center_vertical"
-        android:alpha="0">
+        android:layout_gravity="start|bottom"
+        android:gravity="center_vertical">
 
-        <ImageView
-            android:id="@+id/next_alarm_icon"
-            android:layout_width="@dimen/qs_header_alarm_icon_size"
-            android:layout_height="@dimen/qs_header_alarm_icon_size"
-            android:src="@drawable/stat_sys_alarm"
-            android:tint="?android:attr/textColorPrimary"
-            android:visibility="gone"/>
-
-        <TextView
-            android:id="@+id/next_alarm_text"
+        <LinearLayout
+            android:id="@+id/status_container"
             android:layout_width="wrap_content"
             android:layout_height="wrap_content"
-            android:layout_marginStart="@dimen/qs_header_alarm_text_margin_start"
-            android:textAppearance="@style/TextAppearance.QS.TileLabel"
-            android:visibility="gone"/>
+            android:layout_gravity="start|center_vertical"
+            android:layout_weight="1"
+            android:gravity="center_vertical"
+            android:alpha="0">
+
+            <ImageView
+                android:id="@+id/next_alarm_icon"
+                android:layout_width="@dimen/qs_header_alarm_icon_size"
+                android:layout_height="@dimen/qs_header_alarm_icon_size"
+                android:src="@drawable/stat_sys_alarm"
+                android:tint="?android:attr/textColorPrimary"
+                android:visibility="gone"/>
+
+            <TextView
+                android:id="@+id/next_alarm_text"
+                android:layout_width="wrap_content"
+                android:layout_height="wrap_content"
+                android:layout_marginStart="@dimen/qs_header_alarm_text_margin_start"
+                android:textAppearance="@style/TextAppearance.QS.Status"
+                android:visibility="gone"/>
+
+            <View
+                android:id="@+id/status_separator"
+                android:layout_width="@dimen/qs_header_separator_width"
+                android:layout_height="match_parent"
+                android:visibility="gone"/>
+
+            <ImageView
+                android:id="@+id/ringer_mode_icon"
+                android:layout_width="@dimen/qs_header_alarm_icon_size"
+                android:layout_height="@dimen/qs_header_alarm_icon_size"
+                android:tint="?android:attr/textColorPrimary"
+                android:visibility="gone"/>
+
+            <TextView
+                android:id="@+id/ringer_mode_text"
+                android:layout_width="wrap_content"
+                android:layout_height="wrap_content"
+                android:layout_marginStart="@dimen/qs_header_alarm_text_margin_start"
+                android:textAppearance="@style/TextAppearance.QS.Status"
+                android:visibility="gone"/>
+        </LinearLayout>
 
         <View
-            android:id="@+id/status_separator"
-            android:layout_width="1dp"
+            android:minWidth="@dimen/qs_status_separator"
+            android:layout_width="0dp"
             android:layout_height="match_parent"
-            android:layout_marginStart="10dp"
-            android:layout_marginEnd="10dp"
-            android:background="@android:color/white"
-            android:backgroundTint="?android:attr/textColorPrimary"
-            android:visibility="gone"/>
+            android:layout_weight="1"/>
 
-        <ImageView
-            android:id="@+id/ringer_mode_icon"
-            android:layout_width="@dimen/qs_header_alarm_icon_size"
-            android:layout_height="@dimen/qs_header_alarm_icon_size"
-            android:tint="?android:attr/textColorPrimary"
-            android:visibility="gone"/>
-
-        <TextView
-            android:id="@+id/ringer_mode_text"
-            android:layout_width="wrap_content"
-            android:layout_height="wrap_content"
-            android:layout_marginStart="@dimen/qs_header_alarm_text_margin_start"
-            android:textAppearance="@style/TextAppearance.QS.TileLabel"
-            android:visibility="gone"/>
-
+        <include layout="@layout/qs_carrier_group"
+                 android:id="@+id/carrier_group"
+                 android:layout_width="wrap_content"
+                 android:layout_height="wrap_content"
+                 android_layout_gravity="center vertical|end"/>
     </LinearLayout>
 
 </FrameLayout>
diff --git a/packages/SystemUI/res/layout/screen_pinning_request_text_area.xml b/packages/SystemUI/res/layout/screen_pinning_request_text_area.xml
index cdad94b..8dcddc2 100644
--- a/packages/SystemUI/res/layout/screen_pinning_request_text_area.xml
+++ b/packages/SystemUI/res/layout/screen_pinning_request_text_area.xml
@@ -31,7 +31,7 @@
         android:paddingStart="48dp"
         android:paddingTop="43dp"
         android:text="@string/screen_pinning_title"
-        android:textColor="@color/screen_pinning_primary_text"
+        android:textColor="@android:color/white"
         android:textSize="24sp" />
 
     <TextView
@@ -43,7 +43,7 @@
         android:paddingStart="48dp"
         android:paddingTop="12.6dp"
         android:text="@string/screen_pinning_description"
-        android:textColor="@color/screen_pinning_primary_text"
+        android:textColor="@android:color/white"
         android:textSize="16sp" />
 
     <Button
diff --git a/packages/SystemUI/res/layout/size_compat_mode_hint.xml b/packages/SystemUI/res/layout/size_compat_mode_hint.xml
new file mode 100644
index 0000000..347c2b4
--- /dev/null
+++ b/packages/SystemUI/res/layout/size_compat_mode_hint.xml
@@ -0,0 +1,48 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!--
+     Copyright (C) 2019 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.
+-->
+<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
+    android:layout_width="wrap_content"
+    android:layout_height="wrap_content"
+    android:background="@android:color/background_light"
+    android:orientation="vertical">
+
+    <TextView
+        android:layout_width="180dp"
+        android:layout_height="wrap_content"
+        android:paddingLeft="10dp"
+        android:paddingRight="10dp"
+        android:paddingTop="10dp"
+        android:text="@string/restart_button_description"
+        android:textAlignment="viewStart"
+        android:textColor="@android:color/primary_text_light"
+        android:textSize="16sp" />
+
+    <Button
+        android:id="@+id/got_it"
+        android:layout_width="wrap_content"
+        android:layout_height="wrap_content"
+        android:includeFontPadding="false"
+        android:layout_gravity="end"
+        android:minHeight="36dp"
+        android:background="?android:attr/selectableItemBackground"
+        android:text="@string/got_it"
+        android:textAllCaps="true"
+        android:textColor="#3c78d8"
+        android:textSize="16sp"
+        android:textStyle="bold" />
+
+</LinearLayout>
diff --git a/packages/SystemUI/res/raw/image_wallpaper_fragment_shader.glsl b/packages/SystemUI/res/raw/image_wallpaper_fragment_shader.glsl
index 586cdf3..716e127 100644
--- a/packages/SystemUI/res/raw/image_wallpaper_fragment_shader.glsl
+++ b/packages/SystemUI/res/raw/image_wallpaper_fragment_shader.glsl
@@ -1,27 +1,76 @@
 precision mediump float;
 
+// The actual wallpaper texture.
 uniform sampler2D uTexture;
-uniform float uCenterReveal;
+
+// The 85th percenile for the luminance histogram of the image (a value between 0 and 1).
+// This value represents the point in histogram that includes 85% of the pixels of the image.
+uniform float uPer85;
+
+// Reveal is the animation value that goes from 1 (the image is hidden) to 0 (the image is visible).
 uniform float uReveal;
+
+// The opacity of locked screen (constant value).
 uniform float uAod2Opacity;
 varying vec2 vTextureCoordinates;
 
+/*
+ * Calculates the relative luminance of the pixel.
+ */
 vec3 luminosity(vec3 color) {
     float lum = 0.2126 * color.r + 0.7152 * color.g + 0.0722 * color.b;
     return vec3(lum);
 }
 
 vec4 transform(vec3 diffuse) {
-    // TODO: Add well comments here, tracking on b/123615467.
+    // Getting the luminance for this pixel
     vec3 lum = luminosity(diffuse);
-    diffuse = mix(diffuse, lum, smoothstep(0., uCenterReveal, uReveal));
-    float val = mix(uReveal, uCenterReveal, step(uCenterReveal, uReveal));
-    diffuse = smoothstep(val, 1.0, diffuse);
-    diffuse *= uAod2Opacity * (1. - smoothstep(uCenterReveal, 1., uReveal));
+
+    /*
+     * while the reveal > per85, it shows the luminance image (B&W image)
+     * then when moving passed that value, the image gets colored.
+     */
+    float trans = smoothstep(0., uPer85, uReveal);
+    diffuse = mix(diffuse, lum, trans);
+
+    // 'lower' value represents the capped 'reveal' value to the range [0, per85]
+    float selector = step(uPer85, uReveal);
+    float lower = mix(uReveal, uPer85, selector);
+
+    /*
+     * Remaps image:
+     * - from reveal=1 to reveal=per85 => lower=per85, diffuse=luminance
+     *   That means that remaps black and white image pixel
+     *   from a possible values of [0,1] to [per85, 1] (if the pixel is darker than per85,
+     *   it's gonna be black, if it's between per85 and 1, it's gonna be gray
+     *   and if it's 1 it's gonna be white).
+     * - from reveal=per85 to reveal=0 => lower=reveal, 'diffuse' changes from luminance to color
+     *   That means that remaps each image pixel color (rgb)
+     *   from a possible values of [0,1] to [lower, 1] (if the pixel color is darker than 'lower',
+     *   it's gonna be 0, if it's between 'lower' and 1, it's gonna be remap to a value
+     *   between 0 and 1 and if it's 1 it's gonna be 1).
+     * - if reveal=0 => lower=0, diffuse=color image
+     *   The image is shown as it is, colored.
+     */
+    vec3 remaps = smoothstep(lower, 1., diffuse);
+
+    // Interpolate between diffuse and remaps using reveal to avoid over saturation.
+    diffuse = mix(diffuse, remaps, uReveal);
+
+    /*
+     * Fades in the pixel value:
+     * - if reveal=1 => fadeInOpacity=0
+     * - from reveal=1 to reveal=per85 => 0<=fadeInOpacity<=1
+     * - if reveal>per85 => fadeInOpacity=1
+     */
+    float fadeInOpacity = 1. - smoothstep(uPer85, 1., uReveal);
+    diffuse *= uAod2Opacity * fadeInOpacity;
+
     return vec4(diffuse.r, diffuse.g, diffuse.b, 1.);
 }
 
 void main() {
+    // gets the pixel value of the wallpaper for this uv coordinates on screen.
     vec4 fragColor = texture2D(uTexture, vTextureCoordinates);
     gl_FragColor = transform(fragColor.rgb);
 }
\ No newline at end of file
diff --git a/packages/SystemUI/res/values-af/strings.xml b/packages/SystemUI/res/values-af/strings.xml
index 2f316cf..006e8041 100644
--- a/packages/SystemUI/res/values-af/strings.xml
+++ b/packages/SystemUI/res/values-af/strings.xml
@@ -325,7 +325,7 @@
     <string name="quick_settings_wifi_on_label" msgid="7607810331387031235">"Wi-Fi is aan"</string>
     <string name="quick_settings_wifi_detail_empty_text" msgid="269990350383909226">"Geen Wi-Fi-netwerke beskikbaar nie"</string>
     <string name="quick_settings_wifi_secondary_label_transient" msgid="7748206246119760554">"Skakel tans aan …"</string>
-    <string name="quick_settings_cast_title" msgid="7709016546426454729">"Saai uit"</string>
+    <string name="quick_settings_cast_title" msgid="6954684227605751758">"Skermuitsending"</string>
     <string name="quick_settings_casting" msgid="6601710681033353316">"Saai tans uit"</string>
     <string name="quick_settings_cast_device_default_name" msgid="5367253104742382945">"Onbenoemde toestel"</string>
     <string name="quick_settings_cast_device_default_description" msgid="2484573682378634413">"Gereed om uit te saai"</string>
@@ -437,7 +437,8 @@
     <string name="battery_saver_notification_title" msgid="8614079794522291840">"Batterybespaarder is aan"</string>
     <string name="battery_saver_notification_text" msgid="820318788126672692">"Verminder werkverrigting en agtergronddata"</string>
     <string name="battery_saver_notification_action_text" msgid="132118784269455533">"Skakel Batterybespaarder af"</string>
-    <string name="media_projection_dialog_text" msgid="3071431025448218928">"<xliff:g id="APP_SEEKING_PERMISSION">%s</xliff:g> sal alles begin vasvang wat op jou skerm gewys word."</string>
+    <string name="media_projection_dialog_text" msgid="1443042478990422751">"<xliff:g id="APP_SEEKING_PERMISSION">%s</xliff:g> sal begin om alles op jou skerm vas te vang, insluitend kennisgewings, wagwoorde, foto\'s, boodskappe en betaalinligting."</string>
+    <string name="media_projection_dialog_title" msgid="7574971526813630219">"Laat <xliff:g id="APP_SEEKING_PERMISSION">%s</xliff:g> toe om jou skerm op te neem of uit te saai?"</string>
     <string name="media_projection_remember_text" msgid="3103510882172746752">"Moenie weer wys nie"</string>
     <string name="clear_all_notifications_text" msgid="814192889771462828">"Vee alles uit"</string>
     <string name="manage_notifications_text" msgid="2386728145475108753">"Bestuur"</string>
@@ -814,6 +815,9 @@
     <string name="high_temp_title" msgid="4589508026407318374">"Foon raak warm"</string>
     <string name="high_temp_notif_message" msgid="5642466103153429279">"Sommige kenmerke is beperk terwyl foon afkoel"</string>
     <string name="high_temp_dialog_message" msgid="6840700639374113553">"Jou foon sal outomaties probeer om af te koel. Jy kan steeds jou foon gebruik, maar dit sal dalk stadiger wees.\n\nJou foon sal normaalweg werk nadat dit afgekoel het."</string>
+    <string name="high_temp_alarm_title" msgid="442812040762745210">"Trek laaier uit"</string>
+    <string name="high_temp_alarm_notify_message" msgid="1802871059489414932">"Kan nie hierdie toestel laai nie. Trek die kragprop uit, en wees versigtig, want die kabel kan warm wees."</string>
+    <string name="high_temp_alarm_help_care_steps" msgid="3631075329318070726">"Sien versorgingstappe"</string>
     <string name="lockscreen_shortcut_left" msgid="2182769107618938629">"Links-kortpad"</string>
     <string name="lockscreen_shortcut_right" msgid="3328683699505226536">"Regs-kortpad"</string>
     <string name="lockscreen_unlock_left" msgid="2043092136246951985">"Links-kortpad ontsluit ook"</string>
diff --git a/packages/SystemUI/res/values-am/strings.xml b/packages/SystemUI/res/values-am/strings.xml
index 00ac9ab..89dad9a 100644
--- a/packages/SystemUI/res/values-am/strings.xml
+++ b/packages/SystemUI/res/values-am/strings.xml
@@ -325,7 +325,7 @@
     <string name="quick_settings_wifi_on_label" msgid="7607810331387031235">"Wi-Fi በርቷል"</string>
     <string name="quick_settings_wifi_detail_empty_text" msgid="269990350383909226">"ምንም የWi-Fi  አውታረ መረቦች የሉም"</string>
     <string name="quick_settings_wifi_secondary_label_transient" msgid="7748206246119760554">"በማብራት ላይ..."</string>
-    <string name="quick_settings_cast_title" msgid="7709016546426454729">"Cast"</string>
+    <string name="quick_settings_cast_title" msgid="6954684227605751758">"የማያ ገጽ መውሰድ"</string>
     <string name="quick_settings_casting" msgid="6601710681033353316">"በመውሰድ ላይ"</string>
     <string name="quick_settings_cast_device_default_name" msgid="5367253104742382945">"ያልተሰየመ መሳሪያ"</string>
     <string name="quick_settings_cast_device_default_description" msgid="2484573682378634413">"ለመውሰድ ዝግጁ"</string>
@@ -437,7 +437,8 @@
     <string name="battery_saver_notification_title" msgid="8614079794522291840">"ባትሪ ቆጣቢ በርቷል"</string>
     <string name="battery_saver_notification_text" msgid="820318788126672692">"አፈጻጸምን እና የጀርባ ውሂብ ይቀንሳል"</string>
     <string name="battery_saver_notification_action_text" msgid="132118784269455533">"ባትሪ ቆጣቢን አጥፋ"</string>
-    <string name="media_projection_dialog_text" msgid="3071431025448218928">"<xliff:g id="APP_SEEKING_PERMISSION">%s</xliff:g> በማያ ገጽዎ ላይ የታየውን ነገር በሙሉ ማንሳት ይጀምራል።"</string>
+    <string name="media_projection_dialog_text" msgid="1443042478990422751">"<xliff:g id="APP_SEEKING_PERMISSION">%s</xliff:g> ማሳወቂያዎችን፣ የይለፍ ቅቃላትን፣ ፎቶዎችን፣ መልዕክቶችን እና የክፍያ መረጃን ጨምሮ በማያ ገጽዎ ያለ ነገር ሁሉ መቅረጽ ይጀምራል።"</string>
+    <string name="media_projection_dialog_title" msgid="7574971526813630219">"<xliff:g id="APP_SEEKING_PERMISSION">%s</xliff:g> ማያ ገጽዎን እንዲቀርጽ ወይም cast እንዲያደርግ ይፈቀድለት?"</string>
     <string name="media_projection_remember_text" msgid="3103510882172746752">"ዳግመኛ አታሳይ"</string>
     <string name="clear_all_notifications_text" msgid="814192889771462828">"ሁሉንም አጽዳ"</string>
     <string name="manage_notifications_text" msgid="2386728145475108753">"ያቀናብሩ"</string>
@@ -814,6 +815,9 @@
     <string name="high_temp_title" msgid="4589508026407318374">"ስልኩ እየሞቀ ነው"</string>
     <string name="high_temp_notif_message" msgid="5642466103153429279">"ስልኩ እየቀዘቀዘ ሳለ አንዳንድ ባህሪዎች ይገደባሉ"</string>
     <string name="high_temp_dialog_message" msgid="6840700639374113553">"የእርስዎ ስልክ በራስ-ሰር ለመቀዝቀዝ ይሞክራል። አሁንም ስልክዎን መጠቀም ይችላሉ፣ ነገር ግን ሊንቀራፈፍ ይችላል።\n\nአንዴ ስልክዎ ከቀዘቀዘ በኋላ በመደበኝነት ያሄዳል።"</string>
+    <string name="high_temp_alarm_title" msgid="442812040762745210">"ኃይል መሙያን ይንቀሉ"</string>
+    <string name="high_temp_alarm_notify_message" msgid="1802871059489414932">"የዚህን መሣሪያ ባትሪ መሙላት ላይ ችግር አለ። የኃይል አስማሚውን ይንቀሉትና ሊግል ስለሚችል ገመዱን ይጠብቁት።"</string>
+    <string name="high_temp_alarm_help_care_steps" msgid="3631075329318070726">"የእንክብካቤ ደረጃዎችን ይመልከቱ"</string>
     <string name="lockscreen_shortcut_left" msgid="2182769107618938629">"የግራ አቋራጭ"</string>
     <string name="lockscreen_shortcut_right" msgid="3328683699505226536">"የቀኝ አቋራጭ"</string>
     <string name="lockscreen_unlock_left" msgid="2043092136246951985">"የግራ አቋራጭ እንዲሁም ይከፍታል"</string>
diff --git a/packages/SystemUI/res/values-ar/strings.xml b/packages/SystemUI/res/values-ar/strings.xml
index eceb54fd..f1904f8 100644
--- a/packages/SystemUI/res/values-ar/strings.xml
+++ b/packages/SystemUI/res/values-ar/strings.xml
@@ -329,7 +329,7 @@
     <string name="quick_settings_wifi_on_label" msgid="7607810331387031235">"‏تم تشغيل Wi-Fi"</string>
     <string name="quick_settings_wifi_detail_empty_text" msgid="269990350383909226">"‏لا تتوفر أي شبكة Wi-Fi"</string>
     <string name="quick_settings_wifi_secondary_label_transient" msgid="7748206246119760554">"جارٍ التفعيل…"</string>
-    <string name="quick_settings_cast_title" msgid="7709016546426454729">"الإرسال"</string>
+    <string name="quick_settings_cast_title" msgid="6954684227605751758">"بث الشاشة"</string>
     <string name="quick_settings_casting" msgid="6601710681033353316">"جارٍ الإرسال"</string>
     <string name="quick_settings_cast_device_default_name" msgid="5367253104742382945">"جهاز لا يحمل اسمًا"</string>
     <string name="quick_settings_cast_device_default_description" msgid="2484573682378634413">"جاهز للإرسال"</string>
@@ -449,7 +449,8 @@
     <string name="battery_saver_notification_title" msgid="8614079794522291840">"تم تفعيل ميزة توفير شحن البطارية"</string>
     <string name="battery_saver_notification_text" msgid="820318788126672692">"لخفض مستوى الأداء وبيانات الخلفية"</string>
     <string name="battery_saver_notification_action_text" msgid="132118784269455533">"إيقاف ميزة توفير شحن البطارية"</string>
-    <string name="media_projection_dialog_text" msgid="3071431025448218928">"<xliff:g id="APP_SEEKING_PERMISSION">%s</xliff:g> سيبدأ التقاط كل شيء يتم عرضه على الشاشة."</string>
+    <string name="media_projection_dialog_text" msgid="1443042478990422751">"سيبدأ <xliff:g id="APP_SEEKING_PERMISSION">%s</xliff:g> في التقاط كل ما يظهر على شاشتك بما في ذلك الإشعارات وكلمات المرور والصور والرسائل ومعلومات الدفع."</string>
+    <string name="media_projection_dialog_title" msgid="7574971526813630219">"هل تريد السماح لـ <xliff:g id="APP_SEEKING_PERMISSION">%s</xliff:g> بتسجيل شاشتك أو إرسال محتواها؟"</string>
     <string name="media_projection_remember_text" msgid="3103510882172746752">"عدم الإظهار مرة أخرى"</string>
     <string name="clear_all_notifications_text" msgid="814192889771462828">"محو الكل"</string>
     <string name="manage_notifications_text" msgid="2386728145475108753">"إدارة"</string>
@@ -834,6 +835,9 @@
     <string name="high_temp_title" msgid="4589508026407318374">"تزداد درجة حرارة الهاتف"</string>
     <string name="high_temp_notif_message" msgid="5642466103153429279">"يتم تقييد عمل بعض الميزات إلى أن تنخفض درجة حرارة الهاتف"</string>
     <string name="high_temp_dialog_message" msgid="6840700639374113553">"سيحاول الهاتف تخفيض درجة حرارته تلقائيًا. سيظل بإمكانك استخدام هاتفك، ولكن قد يعمل بشكل أبطأ.\n\nبعد أن تنخفض درجة حرارة الهاتف، سيستعيد سرعته المعتادة."</string>
+    <string name="high_temp_alarm_title" msgid="442812040762745210">"فصل الشاحن"</string>
+    <string name="high_temp_alarm_notify_message" msgid="1802871059489414932">"هناك مشكلة في شحن هذا الجهاز. يُرجى فصل محوِّل الطاقة بحرص لأن الكابل قد يكون ساخنًا."</string>
+    <string name="high_temp_alarm_help_care_steps" msgid="3631075329318070726">"الاطّلاع على خطوات العناية"</string>
     <string name="lockscreen_shortcut_left" msgid="2182769107618938629">"اختصار اليسار"</string>
     <string name="lockscreen_shortcut_right" msgid="3328683699505226536">"اختصار اليمين"</string>
     <string name="lockscreen_unlock_left" msgid="2043092136246951985">"اختصار اليسار يلغي أيضًا تأمين"</string>
diff --git a/packages/SystemUI/res/values-as/strings.xml b/packages/SystemUI/res/values-as/strings.xml
index 53eb4cd..43fd06f 100644
--- a/packages/SystemUI/res/values-as/strings.xml
+++ b/packages/SystemUI/res/values-as/strings.xml
@@ -325,7 +325,7 @@
     <string name="quick_settings_wifi_on_label" msgid="7607810331387031235">"ৱাই-ফাই অন হৈ আছে"</string>
     <string name="quick_settings_wifi_detail_empty_text" msgid="269990350383909226">"কোনো ৱাই-ফাই নেটৱৰ্ক নাই"</string>
     <string name="quick_settings_wifi_secondary_label_transient" msgid="7748206246119760554">"অন কৰি থকা হৈছে…"</string>
-    <string name="quick_settings_cast_title" msgid="7709016546426454729">"কাষ্ট"</string>
+    <string name="quick_settings_cast_title" msgid="6954684227605751758">"স্ক্ৰীণ কাষ্ট"</string>
     <string name="quick_settings_casting" msgid="6601710681033353316">"কাষ্টিং"</string>
     <string name="quick_settings_cast_device_default_name" msgid="5367253104742382945">"নাম নথকা ডিভাইচ"</string>
     <string name="quick_settings_cast_device_default_description" msgid="2484573682378634413">"কাষ্টৰ বাবে সাজু"</string>
@@ -437,7 +437,8 @@
     <string name="battery_saver_notification_title" msgid="8614079794522291840">"বেটাৰি সঞ্চয়কাৰী অন হৈ আছে"</string>
     <string name="battery_saver_notification_text" msgid="820318788126672692">"কাৰ্যদক্ষতা আৰু নেপথ্য ডেটা হ্ৰাস কৰে"</string>
     <string name="battery_saver_notification_action_text" msgid="132118784269455533">"বেটাৰি সঞ্চয়কাৰী অফ কৰক"</string>
-    <string name="media_projection_dialog_text" msgid="3071431025448218928">"আপোনাৰ স্ক্ৰীণত প্ৰদৰ্শন হোৱা সকলো <xliff:g id="APP_SEEKING_PERMISSION">%s</xliff:g> কেপশ্বাৰ কৰা আৰম্ভ কৰিব।"</string>
+    <string name="media_projection_dialog_text" msgid="1443042478990422751">"<xliff:g id="APP_SEEKING_PERMISSION">%s</xliff:g>এ আপোনাৰ স্ক্ৰীণত প্ৰদৰ্শন হোৱা জাননী, পাছৱৰ্ড, ফট’, বাৰ্তা আৰু পৰিশোধ সম্পৰ্কীয় তথ্য আদিকে ধৰি সকলো কেপশ্বাৰ কৰিবলৈ আৰম্ভ কৰিব।"</string>
+    <string name="media_projection_dialog_title" msgid="7574971526813630219">"<xliff:g id="APP_SEEKING_PERMISSION">%s</xliff:g>ক আপোনাৰ স্ক্ৰীণ ৰেকৰ্ড বা কাষ্ট কৰিবলৈ অনুমতি দিবনে?"</string>
     <string name="media_projection_remember_text" msgid="3103510882172746752">"পুনৰাই নেদেখুৱাব"</string>
     <string name="clear_all_notifications_text" msgid="814192889771462828">"সকলো মচক"</string>
     <string name="manage_notifications_text" msgid="2386728145475108753">"পৰিচালনা"</string>
@@ -814,6 +815,9 @@
     <string name="high_temp_title" msgid="4589508026407318374">"ফ\'নটো গৰম হ\'বলৈ ধৰিছে"</string>
     <string name="high_temp_notif_message" msgid="5642466103153429279">"ফ\'নটো ঠাণ্ডা হৈ থকা সময়ত কিছুমান সুবিধা উপলব্ধ নহ’ব"</string>
     <string name="high_temp_dialog_message" msgid="6840700639374113553">"আপোনাৰ ফ\'নটোৱে নিজে নিজে ঠাণ্ডা হ\'বলৈ স্বয়ংক্ৰিয়ভাৱে চেষ্টা কৰিব। আপুনি ফ\'নটো ব্যৱহাৰ কৰি থাকিব পাৰে কিন্তু ই লাহে লাহে চলিব পাৰে।\n\nফ\'নটো সম্পূৰ্ণভাৱে ঠাণ্ডা হোৱাৰ পিছত ই আগৰ নিচিনাকৈয়েই চলিব।"</string>
+    <string name="high_temp_alarm_title" msgid="442812040762745210">"চ্চার্জাৰ আনপ্লাগ কৰক"</string>
+    <string name="high_temp_alarm_notify_message" msgid="1802871059489414932">"এই ডিভাইচটো চ্চার্জ কৰোঁতে কিবা সমস্যা হৈছে। পাৱাৰ এডাপ্টাৰটো আনপ্লাগ কৰক, কেব’লডাল গৰম হ’ব পাৰে গতিকে সাবধান হ’ব।"</string>
+    <string name="high_temp_alarm_help_care_steps" msgid="3631075329318070726">"যত্ন লোৱাৰ পদক্ষেপসমূহ চাওক"</string>
     <string name="lockscreen_shortcut_left" msgid="2182769107618938629">"বাওঁ শ্বৰ্টকাট"</string>
     <string name="lockscreen_shortcut_right" msgid="3328683699505226536">"সোঁ শ্বৰ্টকাট"</string>
     <string name="lockscreen_unlock_left" msgid="2043092136246951985">"বাওঁ শ্বৰ্টকাটটোৱেও আনলক কৰিব"</string>
diff --git a/packages/SystemUI/res/values-az/strings.xml b/packages/SystemUI/res/values-az/strings.xml
index 3b18e34..9682755 100644
--- a/packages/SystemUI/res/values-az/strings.xml
+++ b/packages/SystemUI/res/values-az/strings.xml
@@ -325,7 +325,7 @@
     <string name="quick_settings_wifi_on_label" msgid="7607810331387031235">"Wi-Fi Aktiv"</string>
     <string name="quick_settings_wifi_detail_empty_text" msgid="269990350383909226">"Heç bir Wi-Fi şəbəkəsi əlçatan deyil"</string>
     <string name="quick_settings_wifi_secondary_label_transient" msgid="7748206246119760554">"Aktiv edilir..."</string>
-    <string name="quick_settings_cast_title" msgid="7709016546426454729">"Yayım"</string>
+    <string name="quick_settings_cast_title" msgid="6954684227605751758">"Screen Cast"</string>
     <string name="quick_settings_casting" msgid="6601710681033353316">"Yayım"</string>
     <string name="quick_settings_cast_device_default_name" msgid="5367253104742382945">"Adsız cihaz"</string>
     <string name="quick_settings_cast_device_default_description" msgid="2484573682378634413">"Yayıma hazırdır"</string>
@@ -437,7 +437,8 @@
     <string name="battery_saver_notification_title" msgid="8614079794522291840">"Batareya Qənaəti aktivdir"</string>
     <string name="battery_saver_notification_text" msgid="820318788126672692">"Performansı azaldır və arxa fon datasını məhdudlaşdırır"</string>
     <string name="battery_saver_notification_action_text" msgid="132118784269455533">"Batareya Qənaətini deaktiv edin"</string>
-    <string name="media_projection_dialog_text" msgid="3071431025448218928">"<xliff:g id="APP_SEEKING_PERMISSION">%s</xliff:g> ekranınızda olan hər şeyin şəklini çəkəcək."</string>
+    <string name="media_projection_dialog_text" msgid="1443042478990422751">"<xliff:g id="APP_SEEKING_PERMISSION">%s</xliff:g> bildiriş, parol, foto, mesaj və ödəniş məlumatı daxil olmaqla ekranda görünən hər şeyi çəkməyə başlayacaq."</string>
+    <string name="media_projection_dialog_title" msgid="7574971526813630219">"<xliff:g id="APP_SEEKING_PERMISSION">%s</xliff:g> ekranı qeydə alsın və ya yayımlasın?"</string>
     <string name="media_projection_remember_text" msgid="3103510882172746752">"Daha göstərmə"</string>
     <string name="clear_all_notifications_text" msgid="814192889771462828">"Hamısını silin"</string>
     <string name="manage_notifications_text" msgid="2386728145475108753">"İdarə edin"</string>
@@ -814,6 +815,9 @@
     <string name="high_temp_title" msgid="4589508026407318374">"Telefon qızmağa başlayır"</string>
     <string name="high_temp_notif_message" msgid="5642466103153429279">"Telefon soyuyana kimi bəzi funksiyalar məhdudlaşdırılır"</string>
     <string name="high_temp_dialog_message" msgid="6840700639374113553">"Telefonunuz avtomatik olaraq soyumağa başlayacaq. Telefon istifadəsinə davam edə bilərsiniz, lakin sürəti yavaşlaya bilər.\n\nTelefonunuz soyuduqdan sonra normal işləyəcək."</string>
+    <string name="high_temp_alarm_title" msgid="442812040762745210">"Adapteri cərəyandan ayırın"</string>
+    <string name="high_temp_alarm_notify_message" msgid="1802871059489414932">"Bu cihazın batareya yığmasında problem var. Adapteri cərəyandan ayırın. Ehtiyatlı olun, kabel isti ola bilər."</string>
+    <string name="high_temp_alarm_help_care_steps" msgid="3631075329318070726">"Ehtiyat tədbiri mərhələlərinə baxın"</string>
     <string name="lockscreen_shortcut_left" msgid="2182769107618938629">"Sol qısayol"</string>
     <string name="lockscreen_shortcut_right" msgid="3328683699505226536">"Sağ qısayol"</string>
     <string name="lockscreen_unlock_left" msgid="2043092136246951985">"Sol qısayol kiliddən çıxır"</string>
diff --git a/packages/SystemUI/res/values-b+sr+Latn/strings.xml b/packages/SystemUI/res/values-b+sr+Latn/strings.xml
index 524de49..fed8601 100644
--- a/packages/SystemUI/res/values-b+sr+Latn/strings.xml
+++ b/packages/SystemUI/res/values-b+sr+Latn/strings.xml
@@ -326,7 +326,7 @@
     <string name="quick_settings_wifi_on_label" msgid="7607810331387031235">"Wi-Fi je uključen"</string>
     <string name="quick_settings_wifi_detail_empty_text" msgid="269990350383909226">"Nije dostupna nijedna Wi-Fi mreža"</string>
     <string name="quick_settings_wifi_secondary_label_transient" msgid="7748206246119760554">"Uključuje se..."</string>
-    <string name="quick_settings_cast_title" msgid="7709016546426454729">"Prebacivanje"</string>
+    <string name="quick_settings_cast_title" msgid="6954684227605751758">"Prebacivanje ekrana"</string>
     <string name="quick_settings_casting" msgid="6601710681033353316">"Prebacivanje"</string>
     <string name="quick_settings_cast_device_default_name" msgid="5367253104742382945">"Neimenovani uređaj"</string>
     <string name="quick_settings_cast_device_default_description" msgid="2484573682378634413">"Spremno za prebacivanje"</string>
@@ -440,7 +440,8 @@
     <string name="battery_saver_notification_title" msgid="8614079794522291840">"Ušteda baterije je uključena"</string>
     <string name="battery_saver_notification_text" msgid="820318788126672692">"Smanjuje performanse i pozadinske podatke"</string>
     <string name="battery_saver_notification_action_text" msgid="132118784269455533">"Isključi Uštedu baterije"</string>
-    <string name="media_projection_dialog_text" msgid="3071431025448218928">"<xliff:g id="APP_SEEKING_PERMISSION">%s</xliff:g> će početi da snima sve što se prikazuje na ekranu."</string>
+    <string name="media_projection_dialog_text" msgid="1443042478990422751">"<xliff:g id="APP_SEEKING_PERMISSION">%s</xliff:g> će početi da snima sve na ekranu, uključujući obaveštenja, lozinke, slike, poruke i informacije o plaćanju."</string>
+    <string name="media_projection_dialog_title" msgid="7574971526813630219">"Želite li da dozvolite da <xliff:g id="APP_SEEKING_PERMISSION">%s</xliff:g> snima ili prebacuje sadržaj ekrana?"</string>
     <string name="media_projection_remember_text" msgid="3103510882172746752">"Ne prikazuj ponovo"</string>
     <string name="clear_all_notifications_text" msgid="814192889771462828">"Obriši sve"</string>
     <string name="manage_notifications_text" msgid="2386728145475108753">"Upravljajte"</string>
@@ -819,6 +820,9 @@
     <string name="high_temp_title" msgid="4589508026407318374">"Telefon se zagrejao"</string>
     <string name="high_temp_notif_message" msgid="5642466103153429279">"Neke funkcije su ograničene dok se telefon ne ohladi"</string>
     <string name="high_temp_dialog_message" msgid="6840700639374113553">"Telefon će automatski pokušati da se ohladi. I dalje ćete moći da koristite telefon, ali će sporije reagovati.\n\nKada se telefon ohladi, normalno će raditi."</string>
+    <string name="high_temp_alarm_title" msgid="442812040762745210">"Isključite punjač iz napajanja"</string>
+    <string name="high_temp_alarm_notify_message" msgid="1802871059489414932">"Došlo je do problema sa punjenjem ovog uređaja. Isključite adapter iz napajanja i budite pažljivi jer kabl može da bude topao."</string>
+    <string name="high_temp_alarm_help_care_steps" msgid="3631075329318070726">"Pogledajte upozorenja"</string>
     <string name="lockscreen_shortcut_left" msgid="2182769107618938629">"Leva prečica"</string>
     <string name="lockscreen_shortcut_right" msgid="3328683699505226536">"Desna prečica"</string>
     <string name="lockscreen_unlock_left" msgid="2043092136246951985">"I leva prečica otključava"</string>
diff --git a/packages/SystemUI/res/values-be/strings.xml b/packages/SystemUI/res/values-be/strings.xml
index 94aba0b..31ce237 100644
--- a/packages/SystemUI/res/values-be/strings.xml
+++ b/packages/SystemUI/res/values-be/strings.xml
@@ -329,7 +329,7 @@
     <string name="quick_settings_wifi_on_label" msgid="7607810331387031235">"Wi-Fi уключаны"</string>
     <string name="quick_settings_wifi_detail_empty_text" msgid="269990350383909226">"Няма даступнай сеткі Wi-Fi"</string>
     <string name="quick_settings_wifi_secondary_label_transient" msgid="7748206246119760554">"Уключэнне…"</string>
-    <string name="quick_settings_cast_title" msgid="7709016546426454729">"Трансляцыя"</string>
+    <string name="quick_settings_cast_title" msgid="6954684227605751758">"Відэа з экрана"</string>
     <string name="quick_settings_casting" msgid="6601710681033353316">"Ідзе перадача"</string>
     <string name="quick_settings_cast_device_default_name" msgid="5367253104742382945">"Прылада без назвы"</string>
     <string name="quick_settings_cast_device_default_description" msgid="2484573682378634413">"Гатова для трансляцыі"</string>
@@ -445,7 +445,8 @@
     <string name="battery_saver_notification_title" msgid="8614079794522291840">"Рэжым эканоміі зараду ўключаны"</string>
     <string name="battery_saver_notification_text" msgid="820318788126672692">"Памяншае прадукцыйнасць і фонавую перадачу даных"</string>
     <string name="battery_saver_notification_action_text" msgid="132118784269455533">"Адключыць рэжым эканоміі зараду"</string>
-    <string name="media_projection_dialog_text" msgid="3071431025448218928">"<xliff:g id="APP_SEEKING_PERMISSION">%s</xliff:g> атрымае доступ да ўсяго, што адлюстроўваецца на вашым экране."</string>
+    <string name="media_projection_dialog_text" msgid="1443042478990422751">"<xliff:g id="APP_SEEKING_PERMISSION">%s</xliff:g> пачне адсочваць усё, што паказваецца на вашым экране: апавяшчэнні, паролі, фатаграфіі, паведамленні, плацежную інфармацыю і іншае."</string>
+    <string name="media_projection_dialog_title" msgid="7574971526813630219">"Дазволіць праграме \"<xliff:g id="APP_SEEKING_PERMISSION">%s</xliff:g>\" запісваць ці трансліраваць ваш экран?"</string>
     <string name="media_projection_remember_text" msgid="3103510882172746752">"Не паказваць зноў"</string>
     <string name="clear_all_notifications_text" msgid="814192889771462828">"Ачысціць усё"</string>
     <string name="manage_notifications_text" msgid="2386728145475108753">"Кіраваць"</string>
@@ -826,6 +827,9 @@
     <string name="high_temp_title" msgid="4589508026407318374">"Тэлефон награваецца"</string>
     <string name="high_temp_notif_message" msgid="5642466103153429279">"Некаторыя функцыі абмежаваны, пакуль тэлефон астывае"</string>
     <string name="high_temp_dialog_message" msgid="6840700639374113553">"Ваш тэлефон аўтаматычна паспрабуе астыць. Вы можаце па-ранейшаму карыстацца сваім тэлефонам, але ён можа працаваць больш павольна.\n\nПасля таго як ваш тэлефон астыне, ён будзе працаваць у звычайным рэжыме."</string>
+    <string name="high_temp_alarm_title" msgid="442812040762745210">"Адключыце зарадную прыладу"</string>
+    <string name="high_temp_alarm_notify_message" msgid="1802871059489414932">"Узнікла праблема з зарадкай гэтай прылады. Адключыце адаптар сілкавання і праверце, ці не нагрэўся кабель."</string>
+    <string name="high_temp_alarm_help_care_steps" msgid="3631075329318070726">"Глядзець паэтапную дапамогу"</string>
     <string name="lockscreen_shortcut_left" msgid="2182769107618938629">"Ярлык \"улева\""</string>
     <string name="lockscreen_shortcut_right" msgid="3328683699505226536">"Ярлык \"управа\""</string>
     <string name="lockscreen_unlock_left" msgid="2043092136246951985">"Разблакіроўка таксама ярлыком \"улева\""</string>
diff --git a/packages/SystemUI/res/values-bg/strings.xml b/packages/SystemUI/res/values-bg/strings.xml
index cfc9fe1..1330373 100644
--- a/packages/SystemUI/res/values-bg/strings.xml
+++ b/packages/SystemUI/res/values-bg/strings.xml
@@ -325,7 +325,7 @@
     <string name="quick_settings_wifi_on_label" msgid="7607810331387031235">"Функцията за Wi-Fi е включена"</string>
     <string name="quick_settings_wifi_detail_empty_text" msgid="269990350383909226">"Няма налични Wi-Fi мрежи"</string>
     <string name="quick_settings_wifi_secondary_label_transient" msgid="7748206246119760554">"Включва се..."</string>
-    <string name="quick_settings_cast_title" msgid="7709016546426454729">"Предаване"</string>
+    <string name="quick_settings_cast_title" msgid="6954684227605751758">"Предаване на екрана"</string>
     <string name="quick_settings_casting" msgid="6601710681033353316">"Предава се"</string>
     <string name="quick_settings_cast_device_default_name" msgid="5367253104742382945">"Устройство без име"</string>
     <string name="quick_settings_cast_device_default_description" msgid="2484573682378634413">"Готово за предаване"</string>
@@ -437,7 +437,8 @@
     <string name="battery_saver_notification_title" msgid="8614079794522291840">"Режимът за запазване на батерията е включен"</string>
     <string name="battery_saver_notification_text" msgid="820318788126672692">"Намалява ефективността и данните на заден план"</string>
     <string name="battery_saver_notification_action_text" msgid="132118784269455533">"Изключване на режима за запазване на батерията"</string>
-    <string name="media_projection_dialog_text" msgid="3071431025448218928">"<xliff:g id="APP_SEEKING_PERMISSION">%s</xliff:g> ще започне да заснема всичко, което се показва на екрана ви."</string>
+    <string name="media_projection_dialog_text" msgid="1443042478990422751">"<xliff:g id="APP_SEEKING_PERMISSION">%s</xliff:g> ще започне да записва всичко на екрана ви, включително известията, паролите, снимките, съобщенията и данните за плащане."</string>
+    <string name="media_projection_dialog_title" msgid="7574971526813630219">"Да се разреши ли на <xliff:g id="APP_SEEKING_PERMISSION">%s</xliff:g> да записва или предава екрана ви?"</string>
     <string name="media_projection_remember_text" msgid="3103510882172746752">"Да не се показва отново"</string>
     <string name="clear_all_notifications_text" msgid="814192889771462828">"Изчистване на всички"</string>
     <string name="manage_notifications_text" msgid="2386728145475108753">"Управление"</string>
@@ -814,6 +815,9 @@
     <string name="high_temp_title" msgid="4589508026407318374">"Телефонът загрява"</string>
     <string name="high_temp_notif_message" msgid="5642466103153429279">"Някои функции са ограничени, докато телефонът се охлажда"</string>
     <string name="high_temp_dialog_message" msgid="6840700639374113553">"Телефонът ви автоматично ще направи опит за охлаждане. Пак можете да го използвате, но той може да работи по-бавно.\n\nСлед като се охлади, ще работи нормално."</string>
+    <string name="high_temp_alarm_title" msgid="442812040762745210">"Изключете зарядното устройство"</string>
+    <string name="high_temp_alarm_notify_message" msgid="1802871059489414932">"При зареждането на това устройство възникна проблем. Изключете захранващия адаптер и внимавайте, тъй като кабелът може да е топъл."</string>
+    <string name="high_temp_alarm_help_care_steps" msgid="3631075329318070726">"Вижте стъпките, които да предприемете"</string>
     <string name="lockscreen_shortcut_left" msgid="2182769107618938629">"Ляв пряк път"</string>
     <string name="lockscreen_shortcut_right" msgid="3328683699505226536">"Десен пряк път"</string>
     <string name="lockscreen_unlock_left" msgid="2043092136246951985">"Левият пряк път също служи за отключване"</string>
diff --git a/packages/SystemUI/res/values-bn/strings.xml b/packages/SystemUI/res/values-bn/strings.xml
index a2e57d0..2628a24 100644
--- a/packages/SystemUI/res/values-bn/strings.xml
+++ b/packages/SystemUI/res/values-bn/strings.xml
@@ -325,7 +325,7 @@
     <string name="quick_settings_wifi_on_label" msgid="7607810331387031235">"ওয়াই-ফাই চালু আছে"</string>
     <string name="quick_settings_wifi_detail_empty_text" msgid="269990350383909226">"কোনো ওয়াই-ফাই নেটওয়ার্ক উপলব্ধ নেই"</string>
     <string name="quick_settings_wifi_secondary_label_transient" msgid="7748206246119760554">"চালু করা হচ্ছে…"</string>
-    <string name="quick_settings_cast_title" msgid="7709016546426454729">"কাস্ট করুন"</string>
+    <string name="quick_settings_cast_title" msgid="6954684227605751758">"স্ক্রিন কাস্ট"</string>
     <string name="quick_settings_casting" msgid="6601710681033353316">"কাস্ট করা হচ্ছে"</string>
     <string name="quick_settings_cast_device_default_name" msgid="5367253104742382945">"নামবিহীন ডিভাইস"</string>
     <string name="quick_settings_cast_device_default_description" msgid="2484573682378634413">"কাস্ট করার জন্য প্রস্তুত"</string>
@@ -437,7 +437,8 @@
     <string name="battery_saver_notification_title" msgid="8614079794522291840">"ব্যাটারি সেভার চালু আছে"</string>
     <string name="battery_saver_notification_text" msgid="820318788126672692">"কার্য-সম্পাদনা ও পশ্চাদপট ডেটাকে কমিয়ে দেয়"</string>
     <string name="battery_saver_notification_action_text" msgid="132118784269455533">"ব্যাটারি সেভার বন্ধ করুন"</string>
-    <string name="media_projection_dialog_text" msgid="3071431025448218928">"<xliff:g id="APP_SEEKING_PERMISSION">%s</xliff:g> আপনার স্ক্রীনে দেখানো সব কিছু ক্যাপচার করা শুরু করবে।"</string>
+    <string name="media_projection_dialog_text" msgid="1443042478990422751">"বিজ্ঞপ্তি, পাসওয়ার্ড, ফটো, মেসেজ এবং পেমেন্টের তথ্য সহ <xliff:g id="APP_SEEKING_PERMISSION">%s</xliff:g> আপনার স্ক্রিনে সবকিছু ক্যাপচার করা শুরু করবে।"</string>
+    <string name="media_projection_dialog_title" msgid="7574971526813630219">"<xliff:g id="APP_SEEKING_PERMISSION">%s</xliff:g>-কে আপনার স্ক্রিন রেকর্ড বা কাস্ট করতে দিতে চান?"</string>
     <string name="media_projection_remember_text" msgid="3103510882172746752">"আর দেখাবেন না"</string>
     <string name="clear_all_notifications_text" msgid="814192889771462828">"সবকিছু সাফ করুন"</string>
     <string name="manage_notifications_text" msgid="2386728145475108753">"পরিচালনা করুন"</string>
@@ -814,6 +815,9 @@
     <string name="high_temp_title" msgid="4589508026407318374">"ফোনটি গরম হচ্ছে"</string>
     <string name="high_temp_notif_message" msgid="5642466103153429279">"ফোনটি ঠাণ্ডা হওয়ার সময় কিছু বৈশিষ্ট্য সীমিত হতে পারে"</string>
     <string name="high_temp_dialog_message" msgid="6840700639374113553">"আপনার ফোনটি নিজে থেকেই ঠাণ্ডা হওয়ার চেষ্টা করবে৷ আপনি তবুও আপনার ফোন ব্যবহার করতে পারেন, কিন্তু এটি একটু ধীরে চলতে পারে৷\n\nআপনার ফোনটি পুরোপুরি ঠাণ্ডা হয়ে গেলে এটি স্বাভাবিকভাবে চলবে৷"</string>
+    <string name="high_temp_alarm_title" msgid="442812040762745210">"চার্জার আনপ্লাগ করুন"</string>
+    <string name="high_temp_alarm_notify_message" msgid="1802871059489414932">"এই ডিভাইস চার্জ করার সময় সমস্যা হয়েছে। চার্জিং কেবলটি হয়ত গরম হয়ে গেছে, পাওয়ার অ্যাডাপ্টারটি আনপ্লাগ করুন।"</string>
+    <string name="high_temp_alarm_help_care_steps" msgid="3631075329318070726">"কী করতে হবে ধাপে ধাপে দেখুন"</string>
     <string name="lockscreen_shortcut_left" msgid="2182769107618938629">"বাঁদিকের শর্টকাট"</string>
     <string name="lockscreen_shortcut_right" msgid="3328683699505226536">"ডানদিকের শর্টকাট"</string>
     <string name="lockscreen_unlock_left" msgid="2043092136246951985">"বাঁদিকের শর্টকাট দিয়েও আনলক করা যায়"</string>
diff --git a/packages/SystemUI/res/values-bs/strings.xml b/packages/SystemUI/res/values-bs/strings.xml
index 5822d75..11ba800 100644
--- a/packages/SystemUI/res/values-bs/strings.xml
+++ b/packages/SystemUI/res/values-bs/strings.xml
@@ -326,7 +326,7 @@
     <string name="quick_settings_wifi_on_label" msgid="7607810331387031235">"WiFi uključen"</string>
     <string name="quick_settings_wifi_detail_empty_text" msgid="269990350383909226">"Nema dostupnih WiFi mreža"</string>
     <string name="quick_settings_wifi_secondary_label_transient" msgid="7748206246119760554">"Uključivanje…"</string>
-    <string name="quick_settings_cast_title" msgid="7709016546426454729">"Emitiranje"</string>
+    <string name="quick_settings_cast_title" msgid="6954684227605751758">"Emitiranje na ekranu"</string>
     <string name="quick_settings_casting" msgid="6601710681033353316">"Prebacivanje"</string>
     <string name="quick_settings_cast_device_default_name" msgid="5367253104742382945">"Neimenovani uređaj"</string>
     <string name="quick_settings_cast_device_default_description" msgid="2484573682378634413">"Spreman za emitiranje"</string>
@@ -400,10 +400,10 @@
     <string name="interruption_level_none_twoline" msgid="3957581548190765889">"Potpuna\ntišina"</string>
     <string name="interruption_level_priority_twoline" msgid="1564715335217164124">"Samo\nprioritetni prekidi"</string>
     <string name="interruption_level_alarms_twoline" msgid="3266909566410106146">"Samo\nalarmi"</string>
-    <string name="keyguard_indication_charging_time_wireless" msgid="5376059837186496558">"<xliff:g id="PERCENTAGE">%2$s</xliff:g> • Bežično punjenje (još <xliff:g id="CHARGING_TIME_LEFT">%1$s</xliff:g> do kraja)"</string>
-    <string name="keyguard_indication_charging_time" msgid="2056340799276374421">"<xliff:g id="PERCENTAGE">%2$s</xliff:g> • Punjenje (još <xliff:g id="CHARGING_TIME_LEFT">%1$s</xliff:g> do kraja)"</string>
-    <string name="keyguard_indication_charging_time_fast" msgid="7767562163577492332">"<xliff:g id="PERCENTAGE">%2$s</xliff:g> • Brzo punjenje (još <xliff:g id="CHARGING_TIME_LEFT">%1$s</xliff:g> do kraja)"</string>
-    <string name="keyguard_indication_charging_time_slowly" msgid="3769655133567307069">"<xliff:g id="PERCENTAGE">%2$s</xliff:g> • Brzo punjenje (još <xliff:g id="CHARGING_TIME_LEFT">%1$s</xliff:g> do kraja)"</string>
+    <string name="keyguard_indication_charging_time_wireless" msgid="5376059837186496558">"<xliff:g id="PERCENTAGE">%2$s</xliff:g> • Bežično punjenje (još <xliff:g id="CHARGING_TIME_LEFT">%1$s</xliff:g> do napunjenosti"</string>
+    <string name="keyguard_indication_charging_time" msgid="2056340799276374421">"<xliff:g id="PERCENTAGE">%2$s</xliff:g> • Punjenje (još <xliff:g id="CHARGING_TIME_LEFT">%1$s</xliff:g> do napunjenosti"</string>
+    <string name="keyguard_indication_charging_time_fast" msgid="7767562163577492332">"<xliff:g id="PERCENTAGE">%2$s</xliff:g> • Brzo punjenje (još <xliff:g id="CHARGING_TIME_LEFT">%1$s</xliff:g> do napunjenosti"</string>
+    <string name="keyguard_indication_charging_time_slowly" msgid="3769655133567307069">"<xliff:g id="PERCENTAGE">%2$s</xliff:g> • Brzo punjenje (još <xliff:g id="CHARGING_TIME_LEFT">%1$s</xliff:g> do napunjenosti"</string>
     <string name="accessibility_multi_user_switch_switcher" msgid="7305948938141024937">"Zamijeni korisnika"</string>
     <string name="accessibility_multi_user_switch_switcher_with_current" msgid="8434880595284601601">"Zamijeni korisnika. Trenutni korisnik je <xliff:g id="CURRENT_USER_NAME">%s</xliff:g>"</string>
     <string name="accessibility_multi_user_switch_inactive" msgid="1424081831468083402">"Trenutni korisnik <xliff:g id="CURRENT_USER_NAME">%s</xliff:g>"</string>
@@ -440,7 +440,8 @@
     <string name="battery_saver_notification_title" msgid="8614079794522291840">"Uključena je Ušteda baterije"</string>
     <string name="battery_saver_notification_text" msgid="820318788126672692">"Minimizira rad i prijenos podataka u pozadini"</string>
     <string name="battery_saver_notification_action_text" msgid="132118784269455533">"Isključi Uštedu baterije"</string>
-    <string name="media_projection_dialog_text" msgid="3071431025448218928">"Aplikacija <xliff:g id="APP_SEEKING_PERMISSION">%s</xliff:g> će početi snimati sve što se prikaže na ekranu."</string>
+    <string name="media_projection_dialog_text" msgid="1443042478990422751">"Aplikacija <xliff:g id="APP_SEEKING_PERMISSION">%s</xliff:g> će početi snimati sve na vašem ekranu uključujući obavještenja, lozinke, fotografije, poruke i informacije o plaćanju."</string>
+    <string name="media_projection_dialog_title" msgid="7574971526813630219">"Dozvoliti aplikaciji <xliff:g id="APP_SEEKING_PERMISSION">%s</xliff:g> da snima ili emitira vaš ekran?"</string>
     <string name="media_projection_remember_text" msgid="3103510882172746752">"Ne prikazuj opet"</string>
     <string name="clear_all_notifications_text" msgid="814192889771462828">"Očisti sve"</string>
     <string name="manage_notifications_text" msgid="2386728145475108753">"Upravljaj"</string>
@@ -821,6 +822,9 @@
     <string name="high_temp_title" msgid="4589508026407318374">"Telefon se pregrijava"</string>
     <string name="high_temp_notif_message" msgid="5642466103153429279">"Neke funkcije su ograničene dok se telefon hladi"</string>
     <string name="high_temp_dialog_message" msgid="6840700639374113553">"Vaš telefon će se automatski pokušati ohladiti. I dalje možete koristi telefon, ali će možda raditi sporije.\n\nNakon što se ohladi, telefon će normalno raditi."</string>
+    <string name="high_temp_alarm_title" msgid="442812040762745210">"Isključite punjač"</string>
+    <string name="high_temp_alarm_notify_message" msgid="1802871059489414932">"Došlo je do problema prilikom punjenja ovog uređaja. Pažljivo isključite adapter za napajanje jer je moguće da je kabl vruć."</string>
+    <string name="high_temp_alarm_help_care_steps" msgid="3631075329318070726">"Prikaz koraka za zaštitu"</string>
     <string name="lockscreen_shortcut_left" msgid="2182769107618938629">"Prečica lijevo"</string>
     <string name="lockscreen_shortcut_right" msgid="3328683699505226536">"Prečica desno"</string>
     <string name="lockscreen_unlock_left" msgid="2043092136246951985">"Prečica lijevo također otključava"</string>
diff --git a/packages/SystemUI/res/values-ca/strings.xml b/packages/SystemUI/res/values-ca/strings.xml
index 03a6d8b..c19a1ef 100644
--- a/packages/SystemUI/res/values-ca/strings.xml
+++ b/packages/SystemUI/res/values-ca/strings.xml
@@ -325,7 +325,7 @@
     <string name="quick_settings_wifi_on_label" msgid="7607810331387031235">"La Wi-Fi està activada"</string>
     <string name="quick_settings_wifi_detail_empty_text" msgid="269990350383909226">"No hi ha cap xarxa Wi-Fi disponible"</string>
     <string name="quick_settings_wifi_secondary_label_transient" msgid="7748206246119760554">"S\'està activant…"</string>
-    <string name="quick_settings_cast_title" msgid="7709016546426454729">"Emet"</string>
+    <string name="quick_settings_cast_title" msgid="6954684227605751758">"Screen Cast"</string>
     <string name="quick_settings_casting" msgid="6601710681033353316">"En emissió"</string>
     <string name="quick_settings_cast_device_default_name" msgid="5367253104742382945">"Dispositiu sense nom"</string>
     <string name="quick_settings_cast_device_default_description" msgid="2484573682378634413">"A punt per emetre"</string>
@@ -437,7 +437,8 @@
     <string name="battery_saver_notification_title" msgid="8614079794522291840">"S\'ha activat l\'estalvi de bateria"</string>
     <string name="battery_saver_notification_text" msgid="820318788126672692">"Redueix el rendiment i l\'ús de les dades en segon pla."</string>
     <string name="battery_saver_notification_action_text" msgid="132118784269455533">"Desactiva l\'estalvi de bateria"</string>
-    <string name="media_projection_dialog_text" msgid="3071431025448218928">"<xliff:g id="APP_SEEKING_PERMISSION">%s</xliff:g> començarà a gravar tot el que es mostri a la pantalla."</string>
+    <string name="media_projection_dialog_text" msgid="1443042478990422751">"<xliff:g id="APP_SEEKING_PERMISSION">%s</xliff:g> començarà a capturar tot el que es mostri a la pantalla, com ara els missatges, les notificacions, les contrasenyes, les fotos i la informació de pagament."</string>
+    <string name="media_projection_dialog_title" msgid="7574971526813630219">"Vols permetre que <xliff:g id="APP_SEEKING_PERMISSION">%s</xliff:g> gravi o emeti la pantalla?"</string>
     <string name="media_projection_remember_text" msgid="3103510882172746752">"No ho tornis a mostrar"</string>
     <string name="clear_all_notifications_text" msgid="814192889771462828">"Esborra-ho tot"</string>
     <string name="manage_notifications_text" msgid="2386728145475108753">"Gestió"</string>
@@ -814,6 +815,9 @@
     <string name="high_temp_title" msgid="4589508026407318374">"El telèfon s\'està escalfant"</string>
     <string name="high_temp_notif_message" msgid="5642466103153429279">"Algunes funcions estaran limitades mentre el telèfon es refreda"</string>
     <string name="high_temp_dialog_message" msgid="6840700639374113553">"El telèfon provarà de refredar-se automàticament. Podràs continuar utilitzant-lo, però és possible que funcioni més lentament.\n\nUn cop s\'hagi refredat, funcionarà amb normalitat."</string>
+    <string name="high_temp_alarm_title" msgid="442812040762745210">"Desconnecta el carregador"</string>
+    <string name="high_temp_alarm_notify_message" msgid="1802871059489414932">"No es pot carregar el dispositiu. Desconnecta l\'adaptador de corrent amb compte, ja que el cable podria estar calent."</string>
+    <string name="high_temp_alarm_help_care_steps" msgid="3631075329318070726">"Mostra els pasos de manteniment"</string>
     <string name="lockscreen_shortcut_left" msgid="2182769107618938629">"Drecera de l\'esquerra"</string>
     <string name="lockscreen_shortcut_right" msgid="3328683699505226536">"Drecera de la dreta"</string>
     <string name="lockscreen_unlock_left" msgid="2043092136246951985">"La drecera de l\'esquerra també desbloqueja el dispositiu"</string>
diff --git a/packages/SystemUI/res/values-cs/strings.xml b/packages/SystemUI/res/values-cs/strings.xml
index 98f332a..0b10d79 100644
--- a/packages/SystemUI/res/values-cs/strings.xml
+++ b/packages/SystemUI/res/values-cs/strings.xml
@@ -327,7 +327,7 @@
     <string name="quick_settings_wifi_on_label" msgid="7607810331387031235">"Wi-Fi je zapnutá"</string>
     <string name="quick_settings_wifi_detail_empty_text" msgid="269990350383909226">"Žádné sítě Wi-Fi nejsou k dispozici"</string>
     <string name="quick_settings_wifi_secondary_label_transient" msgid="7748206246119760554">"Zapínání…"</string>
-    <string name="quick_settings_cast_title" msgid="7709016546426454729">"Odesílání"</string>
+    <string name="quick_settings_cast_title" msgid="6954684227605751758">"Vzdálená obrazovka"</string>
     <string name="quick_settings_casting" msgid="6601710681033353316">"Odesílání"</string>
     <string name="quick_settings_cast_device_default_name" msgid="5367253104742382945">"Nepojmenované zařízení"</string>
     <string name="quick_settings_cast_device_default_description" msgid="2484573682378634413">"Připraveno k vysílání"</string>
@@ -443,7 +443,8 @@
     <string name="battery_saver_notification_title" msgid="8614079794522291840">"Spořič baterie je zapnutý"</string>
     <string name="battery_saver_notification_text" msgid="820318788126672692">"Omezuje výkon a data na pozadí"</string>
     <string name="battery_saver_notification_action_text" msgid="132118784269455533">"Vypnout spořič baterie"</string>
-    <string name="media_projection_dialog_text" msgid="3071431025448218928">"Aplikace <xliff:g id="APP_SEEKING_PERMISSION">%s</xliff:g> začne zaznamenávat vše, co je zobrazeno na obrazovce."</string>
+    <string name="media_projection_dialog_text" msgid="1443042478990422751">"<xliff:g id="APP_SEEKING_PERMISSION">%s</xliff:g> začne zaznamenávat vše na obrazovce, včetně oznámení, hesel, fotek, zpráv a platebních údajů."</string>
+    <string name="media_projection_dialog_title" msgid="7574971526813630219">"Povolit aplikaci <xliff:g id="APP_SEEKING_PERMISSION">%s</xliff:g> nahrávat nebo odesílat obrazovku?"</string>
     <string name="media_projection_remember_text" msgid="3103510882172746752">"Tuto zprávu příště nezobrazovat"</string>
     <string name="clear_all_notifications_text" msgid="814192889771462828">"Smazat vše"</string>
     <string name="manage_notifications_text" msgid="2386728145475108753">"Spravovat"</string>
@@ -824,6 +825,9 @@
     <string name="high_temp_title" msgid="4589508026407318374">"Telefon se zahřívá"</string>
     <string name="high_temp_notif_message" msgid="5642466103153429279">"Některé funkce jsou při chladnutí omezeny"</string>
     <string name="high_temp_dialog_message" msgid="6840700639374113553">"Telefon se automaticky pokusí vychladnout. Lze jej nadále používat, ale může být pomalejší.\n\nAž telefon vychladne, bude fungovat normálně."</string>
+    <string name="high_temp_alarm_title" msgid="442812040762745210">"Odpojte nabíječku"</string>
+    <string name="high_temp_alarm_notify_message" msgid="1802871059489414932">"Při nabíjení zařízení došlo k problému. Odpojte napájecí adaptér (dávejte pozor, kabel může být horký)."</string>
+    <string name="high_temp_alarm_help_care_steps" msgid="3631075329318070726">"Zobrazit pokyny, co dělat"</string>
     <string name="lockscreen_shortcut_left" msgid="2182769107618938629">"Zkratka vlevo"</string>
     <string name="lockscreen_shortcut_right" msgid="3328683699505226536">"Zkratka vpravo"</string>
     <string name="lockscreen_unlock_left" msgid="2043092136246951985">"Zkratka vlevo také odemyká"</string>
diff --git a/packages/SystemUI/res/values-da/strings.xml b/packages/SystemUI/res/values-da/strings.xml
index 355507b..9d8631c 100644
--- a/packages/SystemUI/res/values-da/strings.xml
+++ b/packages/SystemUI/res/values-da/strings.xml
@@ -325,7 +325,7 @@
     <string name="quick_settings_wifi_on_label" msgid="7607810331387031235">"Wi-Fi er slået til"</string>
     <string name="quick_settings_wifi_detail_empty_text" msgid="269990350383909226">"Der er ingen tilgængelige Wi-Fi-netværk"</string>
     <string name="quick_settings_wifi_secondary_label_transient" msgid="7748206246119760554">"Aktiverer…"</string>
-    <string name="quick_settings_cast_title" msgid="7709016546426454729">"Cast"</string>
+    <string name="quick_settings_cast_title" msgid="6954684227605751758">"Cast af skærm"</string>
     <string name="quick_settings_casting" msgid="6601710681033353316">"Caster"</string>
     <string name="quick_settings_cast_device_default_name" msgid="5367253104742382945">"Enhed uden navn"</string>
     <string name="quick_settings_cast_device_default_description" msgid="2484573682378634413">"Klar til at caste"</string>
@@ -437,7 +437,8 @@
     <string name="battery_saver_notification_title" msgid="8614079794522291840">"Batterisparefunktion er aktiveret"</string>
     <string name="battery_saver_notification_text" msgid="820318788126672692">"Reducerer ydeevne og baggrundsdata"</string>
     <string name="battery_saver_notification_action_text" msgid="132118784269455533">"Deaktiver batterisparefunktion"</string>
-    <string name="media_projection_dialog_text" msgid="3071431025448218928">"<xliff:g id="APP_SEEKING_PERMISSION">%s</xliff:g> vil begynde at optage alt, hvad der vises på din skærm."</string>
+    <string name="media_projection_dialog_text" msgid="1443042478990422751">"<xliff:g id="APP_SEEKING_PERMISSION">%s</xliff:g> går i gang med at optage alt på din skærm, bl.a. notifikationer, adgangskoder, billeder, beskeder og betalingsoplysninger."</string>
+    <string name="media_projection_dialog_title" msgid="7574971526813630219">"Vil du tillade, at <xliff:g id="APP_SEEKING_PERMISSION">%s</xliff:g> optager eller caster din skærm?"</string>
     <string name="media_projection_remember_text" msgid="3103510882172746752">"Vis ikke igen"</string>
     <string name="clear_all_notifications_text" msgid="814192889771462828">"Ryd alt"</string>
     <string name="manage_notifications_text" msgid="2386728145475108753">"Administrer"</string>
@@ -814,6 +815,9 @@
     <string name="high_temp_title" msgid="4589508026407318374">"Telefonen er ved at blive varm"</string>
     <string name="high_temp_notif_message" msgid="5642466103153429279">"Nogle funktioner er begrænsede, mens telefonen køler ned"</string>
     <string name="high_temp_dialog_message" msgid="6840700639374113553">"Din telefon forsøger automatisk at køle ned. Du kan stadig bruge telefonen, men den kører muligvis langsommere.\n\nNår din telefon er kølet ned, fungerer den normalt igen."</string>
+    <string name="high_temp_alarm_title" msgid="442812040762745210">"Frakobl opladeren"</string>
+    <string name="high_temp_alarm_notify_message" msgid="1802871059489414932">"Der er et problem med opladning af denne enhed. Frakobl strømadapteren, og vær forsigtig, da kablet kan være varmt."</string>
+    <string name="high_temp_alarm_help_care_steps" msgid="3631075329318070726">"Se vejledningen i pleje"</string>
     <string name="lockscreen_shortcut_left" msgid="2182769107618938629">"Venstre genvej"</string>
     <string name="lockscreen_shortcut_right" msgid="3328683699505226536">"Højre genvej"</string>
     <string name="lockscreen_unlock_left" msgid="2043092136246951985">"Venstre genvej låser også op"</string>
diff --git a/packages/SystemUI/res/values-de/strings.xml b/packages/SystemUI/res/values-de/strings.xml
index c323fe6..b6ca09c 100644
--- a/packages/SystemUI/res/values-de/strings.xml
+++ b/packages/SystemUI/res/values-de/strings.xml
@@ -329,7 +329,7 @@
     <string name="quick_settings_wifi_on_label" msgid="7607810331387031235">"WLAN an"</string>
     <string name="quick_settings_wifi_detail_empty_text" msgid="269990350383909226">"Keine WLANs verfügbar"</string>
     <string name="quick_settings_wifi_secondary_label_transient" msgid="7748206246119760554">"Wird aktiviert…"</string>
-    <string name="quick_settings_cast_title" msgid="7709016546426454729">"Streamen"</string>
+    <string name="quick_settings_cast_title" msgid="6954684227605751758">"Bildschirm übertragen"</string>
     <string name="quick_settings_casting" msgid="6601710681033353316">"Wird übertragen"</string>
     <string name="quick_settings_cast_device_default_name" msgid="5367253104742382945">"Unbenanntes Gerät"</string>
     <string name="quick_settings_cast_device_default_description" msgid="2484573682378634413">"Startklar"</string>
@@ -441,7 +441,8 @@
     <string name="battery_saver_notification_title" msgid="8614079794522291840">"Energiesparmodus ist aktiviert"</string>
     <string name="battery_saver_notification_text" msgid="820318788126672692">"Reduzierung der Leistung und Hintergrunddaten"</string>
     <string name="battery_saver_notification_action_text" msgid="132118784269455533">"Energiesparmodus deaktivieren"</string>
-    <string name="media_projection_dialog_text" msgid="3071431025448218928">"<xliff:g id="APP_SEEKING_PERMISSION">%s</xliff:g> nimmt alle auf deinem Bildschirm angezeigten Aktivitäten auf."</string>
+    <string name="media_projection_dialog_text" msgid="1443042478990422751">"<xliff:g id="APP_SEEKING_PERMISSION">%s</xliff:g> beginnt damit, alles auf deinem Bildschirm zu erfassen, z. B. Benachrichtigungen, Passwörter, Fotos, Nachrichten und Zahlungsinformationen."</string>
+    <string name="media_projection_dialog_title" msgid="7574971526813630219">"Darf <xliff:g id="APP_SEEKING_PERMISSION">%s</xliff:g> deinen Bildschirm aufzeichnen oder streamen?"</string>
     <string name="media_projection_remember_text" msgid="3103510882172746752">"Nicht mehr anzeigen"</string>
     <string name="clear_all_notifications_text" msgid="814192889771462828">"Alle löschen"</string>
     <string name="manage_notifications_text" msgid="2386728145475108753">"Verwalten"</string>
@@ -804,7 +805,7 @@
     <string name="pip_phone_minimize" msgid="1079119422589131792">"Minimieren"</string>
     <string name="pip_phone_close" msgid="8416647892889710330">"Schließen"</string>
     <string name="pip_phone_settings" msgid="8080777499521528521">"Einstellungen"</string>
-    <string name="pip_phone_dismiss_hint" msgid="6351678169095923899">"Zum Schließen nach unten ziehen"</string>
+    <string name="pip_phone_dismiss_hint" msgid="6351678169095923899">"Zum Verwerfen nach unten ziehen"</string>
     <string name="pip_menu_title" msgid="4707292089961887657">"Menü"</string>
     <string name="pip_notification_title" msgid="3204024940158161322">"<xliff:g id="NAME">%s</xliff:g> ist in Bild im Bild"</string>
     <string name="pip_notification_message" msgid="5619512781514343311">"Wenn du nicht möchtest, dass <xliff:g id="NAME">%s</xliff:g> diese Funktion verwendet, tippe, um die Einstellungen zu öffnen und die Funktion zu deaktivieren."</string>
@@ -818,6 +819,9 @@
     <string name="high_temp_title" msgid="4589508026407318374">"Smartphone wird warm"</string>
     <string name="high_temp_notif_message" msgid="5642466103153429279">"Einige Funktionen sind während der Abkühlphase des Smartphones eingeschränkt"</string>
     <string name="high_temp_dialog_message" msgid="6840700639374113553">"Dein Smartphone kühlt sich automatisch ab. Du kannst dein Smartphone weiterhin nutzen, aber es reagiert möglicherweise langsamer.\n\nSobald dein Smartphone abgekühlt ist, funktioniert es wieder normal."</string>
+    <string name="high_temp_alarm_title" msgid="442812040762745210">"Ladegerät vom Stromnetz trennen"</string>
+    <string name="high_temp_alarm_notify_message" msgid="1802871059489414932">"Beim Laden dieses Geräts ist ein Problem aufgetreten. Trenne das Netzteil vom Stromnetz. Sei dabei vorsichtig, denn das Netzteil oder das Kabel könnte heiß sein."</string>
+    <string name="high_temp_alarm_help_care_steps" msgid="3631075329318070726">"Schritte zur Fehlerbehebung ansehen"</string>
     <string name="lockscreen_shortcut_left" msgid="2182769107618938629">"Linke Verknüpfung"</string>
     <string name="lockscreen_shortcut_right" msgid="3328683699505226536">"Rechte Verknüpfung"</string>
     <string name="lockscreen_unlock_left" msgid="2043092136246951985">"Linke Verknüpfung entsperrt außerdem"</string>
diff --git a/packages/SystemUI/res/values-el/strings.xml b/packages/SystemUI/res/values-el/strings.xml
index c9bd65c..aab426e 100644
--- a/packages/SystemUI/res/values-el/strings.xml
+++ b/packages/SystemUI/res/values-el/strings.xml
@@ -325,7 +325,7 @@
     <string name="quick_settings_wifi_on_label" msgid="7607810331387031235">"Ενεργό Wi-Fi"</string>
     <string name="quick_settings_wifi_detail_empty_text" msgid="269990350383909226">"Δεν υπάρχουν διαθέσιμα δίκτυα Wi-Fi"</string>
     <string name="quick_settings_wifi_secondary_label_transient" msgid="7748206246119760554">"Ενεργοποίηση…"</string>
-    <string name="quick_settings_cast_title" msgid="7709016546426454729">"Μετάδοση"</string>
+    <string name="quick_settings_cast_title" msgid="6954684227605751758">"Μετάδοση οθόνης"</string>
     <string name="quick_settings_casting" msgid="6601710681033353316">"Μετάδοση"</string>
     <string name="quick_settings_cast_device_default_name" msgid="5367253104742382945">"Ανώνυμη συσκευή"</string>
     <string name="quick_settings_cast_device_default_description" msgid="2484573682378634413">"Έτοιμο για μετάδοση"</string>
@@ -437,7 +437,8 @@
     <string name="battery_saver_notification_title" msgid="8614079794522291840">"Η Εξοικονόμηση μπαταρίας είναι ενεργή"</string>
     <string name="battery_saver_notification_text" msgid="820318788126672692">"Μειώνει την απόδοση και τα δεδομένα παρασκηνίου"</string>
     <string name="battery_saver_notification_action_text" msgid="132118784269455533">"Απενεργοποίηση Εξοικονόμησης μπαταρίας"</string>
-    <string name="media_projection_dialog_text" msgid="3071431025448218928">"Θα ξεκινήσει η καταγραφή του περιεχομένου που εμφανίζεται στην οθόνη σας από την εφαρμογή <xliff:g id="APP_SEEKING_PERMISSION">%s</xliff:g>."</string>
+    <string name="media_projection_dialog_text" msgid="1443042478990422751">"Το <xliff:g id="APP_SEEKING_PERMISSION">%s</xliff:g> θα ξεκινήσει τη λήψη όλου του περιεχομένου της οθόνης σας, συμπεριλαμβανομένων ειδοποιήσεων, κωδικών πρόσβασης, φωτογραφιών, μηνυμάτων και στοιχείων πληρωμής."</string>
+    <string name="media_projection_dialog_title" msgid="7574971526813630219">"Να επιτρέπεται στο <xliff:g id="APP_SEEKING_PERMISSION">%s</xliff:g> η εγγραφή ή μετάδοση της οθόνης σας;"</string>
     <string name="media_projection_remember_text" msgid="3103510882172746752">"Να μην εμφανιστεί ξανά"</string>
     <string name="clear_all_notifications_text" msgid="814192889771462828">"Διαγραφή όλων"</string>
     <string name="manage_notifications_text" msgid="2386728145475108753">"Διαχείριση"</string>
@@ -814,6 +815,9 @@
     <string name="high_temp_title" msgid="4589508026407318374">"Αύξηση θερμοκρασίας τηλεφώνου"</string>
     <string name="high_temp_notif_message" msgid="5642466103153429279">"Ορισμένες λειτουργίες περιορίζονται κατά τη μείωση της θερμοκρασίας"</string>
     <string name="high_temp_dialog_message" msgid="6840700639374113553">"Το τηλέφωνό σας θα προσπαθήσει να μειώσει αυτόματα τη θερμοκρασία. Μπορείτε να εξακολουθήσετε να το χρησιμοποιείτε, αλλά είναι πιθανό να λειτουργεί πιο αργά.\n\nΜόλις μειωθεί η θερμοκρασία του τηλεφώνου σας, θα λειτουργεί ξανά κανονικά."</string>
+    <string name="high_temp_alarm_title" msgid="442812040762745210">"Αποσυνδέστε τον φορτιστή"</string>
+    <string name="high_temp_alarm_notify_message" msgid="1802871059489414932">"Υπάρχει κάποιο πρόβλημα με τη φόρτιση αυτής της συσκευής. Αποσυνδέστε τον μετασχηματιστή με προσοχή, λαμβάνοντας υπόψη ότι το καλώδιο μπορεί να είναι ζεστό."</string>
+    <string name="high_temp_alarm_help_care_steps" msgid="3631075329318070726">"Δείτε βήματα αντιμετώπισης"</string>
     <string name="lockscreen_shortcut_left" msgid="2182769107618938629">"Αριστερή συντόμευση"</string>
     <string name="lockscreen_shortcut_right" msgid="3328683699505226536">"Δεξιά συντόμευση"</string>
     <string name="lockscreen_unlock_left" msgid="2043092136246951985">"Επίσης, η αριστερή συντόμευση ξεκλειδώνει"</string>
diff --git a/packages/SystemUI/res/values-en-rAU/strings.xml b/packages/SystemUI/res/values-en-rAU/strings.xml
index e82429b..1360b87 100644
--- a/packages/SystemUI/res/values-en-rAU/strings.xml
+++ b/packages/SystemUI/res/values-en-rAU/strings.xml
@@ -325,7 +325,7 @@
     <string name="quick_settings_wifi_on_label" msgid="7607810331387031235">"Wi-Fi On"</string>
     <string name="quick_settings_wifi_detail_empty_text" msgid="269990350383909226">"No Wi-Fi networks available"</string>
     <string name="quick_settings_wifi_secondary_label_transient" msgid="7748206246119760554">"Turning on…"</string>
-    <string name="quick_settings_cast_title" msgid="7709016546426454729">"Cast"</string>
+    <string name="quick_settings_cast_title" msgid="6954684227605751758">"Screen Cast"</string>
     <string name="quick_settings_casting" msgid="6601710681033353316">"Casting"</string>
     <string name="quick_settings_cast_device_default_name" msgid="5367253104742382945">"Unnamed device"</string>
     <string name="quick_settings_cast_device_default_description" msgid="2484573682378634413">"Ready to cast"</string>
@@ -437,7 +437,8 @@
     <string name="battery_saver_notification_title" msgid="8614079794522291840">"Battery Saver is on"</string>
     <string name="battery_saver_notification_text" msgid="820318788126672692">"Reduces performance and background data"</string>
     <string name="battery_saver_notification_action_text" msgid="132118784269455533">"Turn off Battery Saver"</string>
-    <string name="media_projection_dialog_text" msgid="3071431025448218928">"<xliff:g id="APP_SEEKING_PERMISSION">%s</xliff:g> will start capturing everything that\'s displayed on your screen."</string>
+    <string name="media_projection_dialog_text" msgid="1443042478990422751">"<xliff:g id="APP_SEEKING_PERMISSION">%s</xliff:g> will start capturing everything on your screen including notifications, passwords, photos, messages and payment information."</string>
+    <string name="media_projection_dialog_title" msgid="7574971526813630219">"Allow <xliff:g id="APP_SEEKING_PERMISSION">%s</xliff:g> to record or cast your screen?"</string>
     <string name="media_projection_remember_text" msgid="3103510882172746752">"Don\'t show again"</string>
     <string name="clear_all_notifications_text" msgid="814192889771462828">"Clear all"</string>
     <string name="manage_notifications_text" msgid="2386728145475108753">"Manage"</string>
@@ -814,6 +815,9 @@
     <string name="high_temp_title" msgid="4589508026407318374">"Phone is getting warm"</string>
     <string name="high_temp_notif_message" msgid="5642466103153429279">"Some features limited while phone cools down"</string>
     <string name="high_temp_dialog_message" msgid="6840700639374113553">"Your phone will automatically try to cool down. You can still use your phone, but it may run more slowly.\n\nOnce your phone has cooled down, it will run normally."</string>
+    <string name="high_temp_alarm_title" msgid="442812040762745210">"Unplug charger"</string>
+    <string name="high_temp_alarm_notify_message" msgid="1802871059489414932">"There’s an issue charging this device. Unplug the power adaptor, and take care as the cable may be warm."</string>
+    <string name="high_temp_alarm_help_care_steps" msgid="3631075329318070726">"See care steps"</string>
     <string name="lockscreen_shortcut_left" msgid="2182769107618938629">"Left shortcut"</string>
     <string name="lockscreen_shortcut_right" msgid="3328683699505226536">"Right shortcut"</string>
     <string name="lockscreen_unlock_left" msgid="2043092136246951985">"Left shortcut also unlocks"</string>
diff --git a/packages/SystemUI/res/values-en-rCA/strings.xml b/packages/SystemUI/res/values-en-rCA/strings.xml
index ffcd86d..926b077 100644
--- a/packages/SystemUI/res/values-en-rCA/strings.xml
+++ b/packages/SystemUI/res/values-en-rCA/strings.xml
@@ -325,7 +325,7 @@
     <string name="quick_settings_wifi_on_label" msgid="7607810331387031235">"Wi-Fi On"</string>
     <string name="quick_settings_wifi_detail_empty_text" msgid="269990350383909226">"No Wi-Fi networks available"</string>
     <string name="quick_settings_wifi_secondary_label_transient" msgid="7748206246119760554">"Turning on…"</string>
-    <string name="quick_settings_cast_title" msgid="7709016546426454729">"Cast"</string>
+    <string name="quick_settings_cast_title" msgid="6954684227605751758">"Screen Cast"</string>
     <string name="quick_settings_casting" msgid="6601710681033353316">"Casting"</string>
     <string name="quick_settings_cast_device_default_name" msgid="5367253104742382945">"Unnamed device"</string>
     <string name="quick_settings_cast_device_default_description" msgid="2484573682378634413">"Ready to cast"</string>
@@ -437,7 +437,8 @@
     <string name="battery_saver_notification_title" msgid="8614079794522291840">"Battery Saver is on"</string>
     <string name="battery_saver_notification_text" msgid="820318788126672692">"Reduces performance and background data"</string>
     <string name="battery_saver_notification_action_text" msgid="132118784269455533">"Turn off Battery Saver"</string>
-    <string name="media_projection_dialog_text" msgid="3071431025448218928">"<xliff:g id="APP_SEEKING_PERMISSION">%s</xliff:g> will start capturing everything that\'s displayed on your screen."</string>
+    <string name="media_projection_dialog_text" msgid="1443042478990422751">"<xliff:g id="APP_SEEKING_PERMISSION">%s</xliff:g> will start capturing everything on your screen including notifications, passwords, photos, messages and payment information."</string>
+    <string name="media_projection_dialog_title" msgid="7574971526813630219">"Allow <xliff:g id="APP_SEEKING_PERMISSION">%s</xliff:g> to record or cast your screen?"</string>
     <string name="media_projection_remember_text" msgid="3103510882172746752">"Don\'t show again"</string>
     <string name="clear_all_notifications_text" msgid="814192889771462828">"Clear all"</string>
     <string name="manage_notifications_text" msgid="2386728145475108753">"Manage"</string>
@@ -814,6 +815,9 @@
     <string name="high_temp_title" msgid="4589508026407318374">"Phone is getting warm"</string>
     <string name="high_temp_notif_message" msgid="5642466103153429279">"Some features limited while phone cools down"</string>
     <string name="high_temp_dialog_message" msgid="6840700639374113553">"Your phone will automatically try to cool down. You can still use your phone, but it may run more slowly.\n\nOnce your phone has cooled down, it will run normally."</string>
+    <string name="high_temp_alarm_title" msgid="442812040762745210">"Unplug charger"</string>
+    <string name="high_temp_alarm_notify_message" msgid="1802871059489414932">"There’s an issue charging this device. Unplug the power adaptor, and take care as the cable may be warm."</string>
+    <string name="high_temp_alarm_help_care_steps" msgid="3631075329318070726">"See care steps"</string>
     <string name="lockscreen_shortcut_left" msgid="2182769107618938629">"Left shortcut"</string>
     <string name="lockscreen_shortcut_right" msgid="3328683699505226536">"Right shortcut"</string>
     <string name="lockscreen_unlock_left" msgid="2043092136246951985">"Left shortcut also unlocks"</string>
diff --git a/packages/SystemUI/res/values-en-rGB/strings.xml b/packages/SystemUI/res/values-en-rGB/strings.xml
index e82429b..1360b87 100644
--- a/packages/SystemUI/res/values-en-rGB/strings.xml
+++ b/packages/SystemUI/res/values-en-rGB/strings.xml
@@ -325,7 +325,7 @@
     <string name="quick_settings_wifi_on_label" msgid="7607810331387031235">"Wi-Fi On"</string>
     <string name="quick_settings_wifi_detail_empty_text" msgid="269990350383909226">"No Wi-Fi networks available"</string>
     <string name="quick_settings_wifi_secondary_label_transient" msgid="7748206246119760554">"Turning on…"</string>
-    <string name="quick_settings_cast_title" msgid="7709016546426454729">"Cast"</string>
+    <string name="quick_settings_cast_title" msgid="6954684227605751758">"Screen Cast"</string>
     <string name="quick_settings_casting" msgid="6601710681033353316">"Casting"</string>
     <string name="quick_settings_cast_device_default_name" msgid="5367253104742382945">"Unnamed device"</string>
     <string name="quick_settings_cast_device_default_description" msgid="2484573682378634413">"Ready to cast"</string>
@@ -437,7 +437,8 @@
     <string name="battery_saver_notification_title" msgid="8614079794522291840">"Battery Saver is on"</string>
     <string name="battery_saver_notification_text" msgid="820318788126672692">"Reduces performance and background data"</string>
     <string name="battery_saver_notification_action_text" msgid="132118784269455533">"Turn off Battery Saver"</string>
-    <string name="media_projection_dialog_text" msgid="3071431025448218928">"<xliff:g id="APP_SEEKING_PERMISSION">%s</xliff:g> will start capturing everything that\'s displayed on your screen."</string>
+    <string name="media_projection_dialog_text" msgid="1443042478990422751">"<xliff:g id="APP_SEEKING_PERMISSION">%s</xliff:g> will start capturing everything on your screen including notifications, passwords, photos, messages and payment information."</string>
+    <string name="media_projection_dialog_title" msgid="7574971526813630219">"Allow <xliff:g id="APP_SEEKING_PERMISSION">%s</xliff:g> to record or cast your screen?"</string>
     <string name="media_projection_remember_text" msgid="3103510882172746752">"Don\'t show again"</string>
     <string name="clear_all_notifications_text" msgid="814192889771462828">"Clear all"</string>
     <string name="manage_notifications_text" msgid="2386728145475108753">"Manage"</string>
@@ -814,6 +815,9 @@
     <string name="high_temp_title" msgid="4589508026407318374">"Phone is getting warm"</string>
     <string name="high_temp_notif_message" msgid="5642466103153429279">"Some features limited while phone cools down"</string>
     <string name="high_temp_dialog_message" msgid="6840700639374113553">"Your phone will automatically try to cool down. You can still use your phone, but it may run more slowly.\n\nOnce your phone has cooled down, it will run normally."</string>
+    <string name="high_temp_alarm_title" msgid="442812040762745210">"Unplug charger"</string>
+    <string name="high_temp_alarm_notify_message" msgid="1802871059489414932">"There’s an issue charging this device. Unplug the power adaptor, and take care as the cable may be warm."</string>
+    <string name="high_temp_alarm_help_care_steps" msgid="3631075329318070726">"See care steps"</string>
     <string name="lockscreen_shortcut_left" msgid="2182769107618938629">"Left shortcut"</string>
     <string name="lockscreen_shortcut_right" msgid="3328683699505226536">"Right shortcut"</string>
     <string name="lockscreen_unlock_left" msgid="2043092136246951985">"Left shortcut also unlocks"</string>
diff --git a/packages/SystemUI/res/values-en-rIN/strings.xml b/packages/SystemUI/res/values-en-rIN/strings.xml
index e82429b..1360b87 100644
--- a/packages/SystemUI/res/values-en-rIN/strings.xml
+++ b/packages/SystemUI/res/values-en-rIN/strings.xml
@@ -325,7 +325,7 @@
     <string name="quick_settings_wifi_on_label" msgid="7607810331387031235">"Wi-Fi On"</string>
     <string name="quick_settings_wifi_detail_empty_text" msgid="269990350383909226">"No Wi-Fi networks available"</string>
     <string name="quick_settings_wifi_secondary_label_transient" msgid="7748206246119760554">"Turning on…"</string>
-    <string name="quick_settings_cast_title" msgid="7709016546426454729">"Cast"</string>
+    <string name="quick_settings_cast_title" msgid="6954684227605751758">"Screen Cast"</string>
     <string name="quick_settings_casting" msgid="6601710681033353316">"Casting"</string>
     <string name="quick_settings_cast_device_default_name" msgid="5367253104742382945">"Unnamed device"</string>
     <string name="quick_settings_cast_device_default_description" msgid="2484573682378634413">"Ready to cast"</string>
@@ -437,7 +437,8 @@
     <string name="battery_saver_notification_title" msgid="8614079794522291840">"Battery Saver is on"</string>
     <string name="battery_saver_notification_text" msgid="820318788126672692">"Reduces performance and background data"</string>
     <string name="battery_saver_notification_action_text" msgid="132118784269455533">"Turn off Battery Saver"</string>
-    <string name="media_projection_dialog_text" msgid="3071431025448218928">"<xliff:g id="APP_SEEKING_PERMISSION">%s</xliff:g> will start capturing everything that\'s displayed on your screen."</string>
+    <string name="media_projection_dialog_text" msgid="1443042478990422751">"<xliff:g id="APP_SEEKING_PERMISSION">%s</xliff:g> will start capturing everything on your screen including notifications, passwords, photos, messages and payment information."</string>
+    <string name="media_projection_dialog_title" msgid="7574971526813630219">"Allow <xliff:g id="APP_SEEKING_PERMISSION">%s</xliff:g> to record or cast your screen?"</string>
     <string name="media_projection_remember_text" msgid="3103510882172746752">"Don\'t show again"</string>
     <string name="clear_all_notifications_text" msgid="814192889771462828">"Clear all"</string>
     <string name="manage_notifications_text" msgid="2386728145475108753">"Manage"</string>
@@ -814,6 +815,9 @@
     <string name="high_temp_title" msgid="4589508026407318374">"Phone is getting warm"</string>
     <string name="high_temp_notif_message" msgid="5642466103153429279">"Some features limited while phone cools down"</string>
     <string name="high_temp_dialog_message" msgid="6840700639374113553">"Your phone will automatically try to cool down. You can still use your phone, but it may run more slowly.\n\nOnce your phone has cooled down, it will run normally."</string>
+    <string name="high_temp_alarm_title" msgid="442812040762745210">"Unplug charger"</string>
+    <string name="high_temp_alarm_notify_message" msgid="1802871059489414932">"There’s an issue charging this device. Unplug the power adaptor, and take care as the cable may be warm."</string>
+    <string name="high_temp_alarm_help_care_steps" msgid="3631075329318070726">"See care steps"</string>
     <string name="lockscreen_shortcut_left" msgid="2182769107618938629">"Left shortcut"</string>
     <string name="lockscreen_shortcut_right" msgid="3328683699505226536">"Right shortcut"</string>
     <string name="lockscreen_unlock_left" msgid="2043092136246951985">"Left shortcut also unlocks"</string>
diff --git a/packages/SystemUI/res/values-en-rXC/strings.xml b/packages/SystemUI/res/values-en-rXC/strings.xml
index a9821bdd0d..e23236a 100644
--- a/packages/SystemUI/res/values-en-rXC/strings.xml
+++ b/packages/SystemUI/res/values-en-rXC/strings.xml
@@ -325,7 +325,7 @@
     <string name="quick_settings_wifi_on_label" msgid="7607810331387031235">"‎‏‎‎‎‎‎‏‎‏‏‏‎‎‎‎‎‎‏‎‎‏‎‎‎‎‏‏‏‏‏‏‏‏‏‎‏‎‎‏‏‎‎‏‎‏‎‎‎‏‎‏‏‏‏‏‎‎‏‏‎‎‎‎‎‏‎‎‎‎‎‎‏‏‎‏‏‏‏‎‏‏‏‎‏‏‏‎‏‏‎‎‎‎‏‏‎Wi-Fi On‎‏‎‎‏‎"</string>
     <string name="quick_settings_wifi_detail_empty_text" msgid="269990350383909226">"‎‏‎‎‎‎‎‏‎‏‏‏‎‎‎‎‎‎‏‎‎‏‎‎‎‎‏‏‏‏‎‏‎‏‏‏‎‏‏‏‏‏‏‎‎‏‏‎‎‏‎‏‏‎‎‏‎‏‏‎‎‎‎‏‏‏‏‎‏‏‎‏‎‏‎‏‎‎‎‏‎‎‏‎‏‏‎‏‎‏‎‎No Wi-Fi networks available‎‏‎‎‏‎"</string>
     <string name="quick_settings_wifi_secondary_label_transient" msgid="7748206246119760554">"‎‏‎‎‎‎‎‏‎‏‏‏‎‎‎‎‎‎‏‎‎‏‎‎‎‎‏‏‏‏‏‏‏‏‏‎‏‎‏‏‏‎‎‎‎‏‏‏‎‎‏‎‏‎‎‎‏‎‎‎‎‏‏‏‎‏‏‏‎‎‏‎‎‏‏‎‏‏‏‎‎‏‏‎‎‎‏‎‏‎‏‎‏‎‏‎‎Turning on…‎‏‎‎‏‎"</string>
-    <string name="quick_settings_cast_title" msgid="7709016546426454729">"‎‏‎‎‎‎‎‏‎‏‏‏‎‎‎‎‎‎‏‎‎‏‎‎‎‎‏‏‏‏‏‏‏‏‏‎‏‎‏‎‏‏‏‏‏‎‏‏‏‏‏‎‏‏‎‏‏‎‏‏‎‏‎‎‎‏‏‏‎‎‎‏‎‏‎‏‏‎‏‏‏‎‎‎‎‎‏‎‏‏‎‎‏‎‎‏‎Cast‎‏‎‎‏‎"</string>
+    <string name="quick_settings_cast_title" msgid="6954684227605751758">"‎‏‎‎‎‎‎‏‎‏‏‏‎‎‎‎‎‎‏‎‎‏‎‎‎‎‏‏‏‏‏‏‏‏‏‎‎‎‎‎‏‎‎‎‎‏‎‎‎‎‎‎‎‎‎‎‎‏‏‏‎‏‎‏‎‎‎‏‏‏‏‏‎‏‏‏‎‎‏‏‏‏‏‎‎‏‏‏‏‏‎‎‏‏‏‎‎Screen Cast‎‏‎‎‏‎"</string>
     <string name="quick_settings_casting" msgid="6601710681033353316">"‎‏‎‎‎‎‎‏‎‏‏‏‎‎‎‎‎‎‏‎‎‏‎‎‎‎‏‏‏‏‏‏‏‏‎‏‏‎‏‏‏‎‎‏‏‏‎‏‏‏‏‏‏‏‎‎‏‏‏‎‎‎‏‏‎‎‎‏‎‏‎‎‏‏‏‎‎‏‎‏‎‎‏‎‏‎‎‎‎‏‏‎‎‏‎‎‎Casting‎‏‎‎‏‎"</string>
     <string name="quick_settings_cast_device_default_name" msgid="5367253104742382945">"‎‏‎‎‎‎‎‏‎‏‏‏‎‎‎‎‎‎‏‎‎‏‎‎‎‎‏‏‏‏‏‏‏‏‎‎‏‎‏‎‎‏‏‏‏‏‎‎‎‏‎‏‎‎‎‎‎‏‎‎‎‎‏‏‎‎‎‎‎‏‏‏‏‏‎‎‏‎‎‎‎‎‏‏‏‏‎‏‎‏‏‎‎‎‎‏‎Unnamed device‎‏‎‎‏‎"</string>
     <string name="quick_settings_cast_device_default_description" msgid="2484573682378634413">"‎‏‎‎‎‎‎‏‎‏‏‏‎‎‎‎‎‎‏‎‎‏‎‎‎‎‏‏‏‏‏‏‎‏‎‎‎‏‎‎‏‏‏‏‎‏‎‏‏‏‏‏‎‏‎‏‎‎‏‏‎‎‏‏‎‏‎‏‏‎‎‎‏‏‏‎‏‏‎‎‏‏‏‎‏‎‎‏‎‏‎‏‏‎‏‎Ready to cast‎‏‎‎‏‎"</string>
@@ -437,7 +437,8 @@
     <string name="battery_saver_notification_title" msgid="8614079794522291840">"‎‏‎‎‎‎‎‏‎‏‏‏‎‎‎‎‎‎‏‎‎‏‎‎‎‎‏‏‏‏‏‏‏‏‏‏‎‏‏‏‏‎‎‎‏‎‏‏‎‏‎‏‏‎‏‏‏‏‏‎‏‏‏‏‎‎‎‎‏‎‏‏‎‏‎‏‏‏‏‎‏‏‏‏‏‏‏‎‏‎‎‎‎‎‎‎‎Battery Saver is on‎‏‎‎‏‎"</string>
     <string name="battery_saver_notification_text" msgid="820318788126672692">"‎‏‎‎‎‎‎‏‎‏‏‏‎‎‎‎‎‎‏‎‎‏‎‎‎‎‏‏‏‏‏‎‎‏‎‏‏‎‏‏‎‎‎‏‎‎‏‎‏‏‎‏‏‏‎‎‏‎‏‏‏‎‏‏‏‎‎‎‎‏‏‎‏‏‏‏‎‏‎‎‎‎‏‏‏‎‎‏‏‎‏‎‎‎Reduces performance and background data‎‏‎‎‏‎"</string>
     <string name="battery_saver_notification_action_text" msgid="132118784269455533">"‎‏‎‎‎‎‎‏‎‏‏‏‎‎‎‎‎‎‏‎‎‏‎‎‎‎‏‏‏‏‎‎‏‏‏‏‎‏‎‏‎‏‎‏‏‎‎‎‎‏‎‏‎‏‎‏‎‏‏‎‎‏‎‏‎‎‏‎‎‎‏‎‎‏‏‎‎‏‎‎‎‎‏‎‏‎‏‏‎‏‎Turn off Battery Saver‎‏‎‎‏‎"</string>
-    <string name="media_projection_dialog_text" msgid="3071431025448218928">"‎‏‎‎‎‎‎‏‎‏‏‏‎‎‎‎‎‎‏‎‎‏‎‎‎‎‏‏‏‏‏‏‎‏‎‏‎‏‎‏‎‎‏‏‏‏‏‏‏‏‎‏‎‏‎‎‎‏‏‏‏‏‎‏‎‎‏‎‏‏‏‏‏‏‏‎‏‎‎‎‏‏‏‎‎‎‏‎‎‏‏‎‎‎‎‎‎‏‎‎‏‏‎<xliff:g id="APP_SEEKING_PERMISSION">%s</xliff:g>‎‏‎‎‏‏‏‎ will start capturing everything that\'s displayed on your screen.‎‏‎‎‏‎"</string>
+    <string name="media_projection_dialog_text" msgid="1443042478990422751">"‎‏‎‎‎‎‎‏‎‏‏‏‎‎‎‎‎‎‏‎‎‏‎‎‎‎‏‏‏‏‏‎‏‏‎‏‎‎‎‎‎‎‎‏‏‎‏‎‏‏‎‏‏‏‎‏‏‏‏‏‎‏‎‎‏‏‎‏‎‎‎‎‎‎‎‏‎‏‏‏‏‏‎‎‏‎‏‏‎‏‏‏‏‏‎‎‏‎‎‏‏‎<xliff:g id="APP_SEEKING_PERMISSION">%s</xliff:g>‎‏‎‎‏‏‏‎ will start capturing everything on your screen including notifications, passwords, photos, messages and payment information.‎‏‎‎‏‎"</string>
+    <string name="media_projection_dialog_title" msgid="7574971526813630219">"‎‏‎‎‎‎‎‏‎‏‏‏‎‎‎‎‎‎‏‎‎‏‎‎‎‎‏‏‏‏‏‏‏‏‏‎‏‎‎‏‎‎‎‏‏‏‏‏‏‎‏‏‎‏‎‎‎‏‏‏‏‎‎‎‎‎‏‏‏‏‏‏‎‏‏‎‏‏‎‎‏‎‏‏‏‏‏‏‎‎‎‎‏‎‏‏‎Allow ‎‏‎‎‏‏‎<xliff:g id="APP_SEEKING_PERMISSION">%s</xliff:g>‎‏‎‎‏‏‏‎ to record or cast your screen?‎‏‎‎‏‎"</string>
     <string name="media_projection_remember_text" msgid="3103510882172746752">"‎‏‎‎‎‎‎‏‎‏‏‏‎‎‎‎‎‎‏‎‎‏‎‎‎‎‏‏‏‏‏‏‎‏‎‏‎‏‏‎‎‎‏‎‎‎‏‏‏‏‎‎‎‏‎‏‎‏‏‎‏‎‎‎‏‎‎‏‎‎‎‎‏‏‏‎‏‏‏‎‎‏‏‏‏‎‎‎‎‎‎‎‎‎‎‎Don\'t show again‎‏‎‎‏‎"</string>
     <string name="clear_all_notifications_text" msgid="814192889771462828">"‎‏‎‎‎‎‎‏‎‏‏‏‎‎‎‎‎‎‏‎‎‏‎‎‎‎‏‏‏‏‏‎‎‏‎‏‏‎‏‎‎‏‏‎‎‏‎‎‏‏‎‎‎‎‎‎‏‏‏‏‎‏‎‎‏‎‏‎‏‎‏‏‏‏‎‏‎‎‎‎‏‎‎‎‎‏‎‏‎‏‏‎‎‎Clear all‎‏‎‎‏‎"</string>
     <string name="manage_notifications_text" msgid="2386728145475108753">"‎‏‎‎‎‎‎‏‎‏‏‏‎‎‎‎‎‎‏‎‎‏‎‎‎‎‏‏‏‏‏‏‎‏‎‎‎‎‏‎‎‎‏‏‏‏‏‎‏‎‏‏‏‎‎‏‎‎‏‏‎‏‎‎‏‎‏‎‏‏‎‎‏‏‏‏‎‎‎‎‏‏‏‏‏‏‏‏‎‎‏‎‎‎‏‎Manage‎‏‎‎‏‎"</string>
@@ -814,6 +815,9 @@
     <string name="high_temp_title" msgid="4589508026407318374">"‎‏‎‎‎‎‎‏‎‏‏‏‎‎‎‎‎‎‏‎‎‏‎‎‎‎‏‏‏‏‏‏‎‏‏‏‏‏‏‏‎‏‏‎‎‎‏‎‎‏‏‎‏‎‏‎‎‏‏‏‎‏‏‏‏‎‏‎‏‏‏‏‏‎‎‏‏‏‏‏‏‏‏‎‎‏‏‎‏‏‎‎‏‏‎‎Phone is getting warm‎‏‎‎‏‎"</string>
     <string name="high_temp_notif_message" msgid="5642466103153429279">"‎‏‎‎‎‎‎‏‎‏‏‏‎‎‎‎‎‎‏‎‎‏‎‎‎‎‏‏‏‏‏‏‏‏‎‎‏‏‏‎‎‏‎‎‏‏‏‎‎‎‎‏‎‎‎‏‎‎‎‎‎‏‏‎‏‎‎‏‎‏‏‏‏‎‏‎‎‏‎‎‏‎‎‎‏‎‏‏‎‎‎‏‏‏‏‏‎Some features limited while phone cools down‎‏‎‎‏‎"</string>
     <string name="high_temp_dialog_message" msgid="6840700639374113553">"‎‏‎‎‎‎‎‏‎‏‏‏‎‎‎‎‎‎‏‎‎‏‎‎‎‎‏‏‏‏‏‏‏‏‎‏‏‏‏‎‏‏‏‎‏‏‏‏‎‎‎‎‏‏‎‎‏‏‏‏‏‏‎‎‏‏‏‎‏‎‎‎‏‎‏‎‏‏‏‎‎‏‏‏‏‎‏‏‎‎‎‏‎‎‎‏‎Your phone will automatically try to cool down. You can still use your phone, but it may run slower.‎‏‎‎‏‏‎\n‎‏‎‎‏‏‏‎‎‏‎‎‏‏‎\n‎‏‎‎‏‏‏‎Once your phone has cooled down, it will run normally.‎‏‎‎‏‎"</string>
+    <string name="high_temp_alarm_title" msgid="442812040762745210">"‎‏‎‎‎‎‎‏‎‏‏‏‎‎‎‎‎‎‏‎‎‏‎‎‎‎‏‏‏‏‎‏‏‏‏‎‎‎‏‎‎‏‎‏‎‎‏‎‏‏‏‏‎‎‏‏‎‏‎‎‎‏‏‏‎‏‏‏‏‏‏‎‏‏‎‏‏‏‏‎‎‎‎‏‎‏‏‏‏‎‏‎‎Unplug charger‎‏‎‎‏‎"</string>
+    <string name="high_temp_alarm_notify_message" msgid="1802871059489414932">"‎‏‎‎‎‎‎‏‎‏‏‏‎‎‎‎‎‎‏‎‎‏‎‎‎‎‏‏‏‏‏‎‏‏‏‎‎‏‎‎‎‎‎‏‎‏‎‎‎‏‎‏‎‏‏‎‏‎‏‏‎‏‎‎‏‏‎‏‎‎‏‎‏‏‎‎‏‎‏‏‎‏‏‏‏‏‎‎‎‏‎‏‎‎‎There’s an issue charging this device. Unplug the power adapter, and take care as the cable may be warm.‎‏‎‎‏‎"</string>
+    <string name="high_temp_alarm_help_care_steps" msgid="3631075329318070726">"‎‏‎‎‎‎‎‏‎‏‏‏‎‎‎‎‎‎‏‎‎‏‎‎‎‎‏‏‏‏‏‏‎‏‏‎‎‏‎‎‏‏‎‎‏‎‎‎‎‏‎‏‎‏‏‏‏‎‎‎‏‏‎‎‎‎‏‎‏‎‎‏‎‏‏‎‎‎‎‎‎‏‎‏‎‎‏‏‏‎‎‎‏‏‎‎See care steps‎‏‎‎‏‎"</string>
     <string name="lockscreen_shortcut_left" msgid="2182769107618938629">"‎‏‎‎‎‎‎‏‎‏‏‏‎‎‎‎‎‎‏‎‎‏‎‎‎‎‏‏‏‏‏‎‏‏‏‏‏‎‎‏‎‎‏‎‏‎‏‏‎‎‎‎‎‎‏‏‏‏‎‎‎‎‎‏‎‎‎‏‏‎‎‏‎‏‎‎‏‎‏‎‏‏‏‏‏‏‎‎‎‎‎‏‎‏‎Left shortcut‎‏‎‎‏‎"</string>
     <string name="lockscreen_shortcut_right" msgid="3328683699505226536">"‎‏‎‎‎‎‎‏‎‏‏‏‎‎‎‎‎‎‏‎‎‏‎‎‎‎‏‏‏‏‏‏‎‏‎‏‏‏‎‎‎‏‏‎‎‎‏‏‏‎‏‏‏‎‎‎‎‏‏‎‎‎‎‎‏‎‎‎‏‏‎‏‎‏‎‎‏‎‎‎‏‏‎‎‎‏‏‎‎‏‎‏‎‎‎‎Right shortcut‎‏‎‎‏‎"</string>
     <string name="lockscreen_unlock_left" msgid="2043092136246951985">"‎‏‎‎‎‎‎‏‎‏‏‏‎‎‎‎‎‎‏‎‎‏‎‎‎‎‏‏‏‏‏‎‏‏‏‏‎‎‎‏‎‏‏‎‏‎‏‎‎‎‎‏‎‏‎‏‏‏‏‎‎‏‎‎‏‎‎‎‎‎‎‏‏‎‎‏‎‎‏‏‎‎‎‎‎‎‎‎‏‏‎‎‎‏‎Left shortcut also unlocks‎‏‎‎‏‎"</string>
diff --git a/packages/SystemUI/res/values-es-rUS/strings.xml b/packages/SystemUI/res/values-es-rUS/strings.xml
index a2eb86f..cb707ae 100644
--- a/packages/SystemUI/res/values-es-rUS/strings.xml
+++ b/packages/SystemUI/res/values-es-rUS/strings.xml
@@ -325,7 +325,7 @@
     <string name="quick_settings_wifi_on_label" msgid="7607810331387031235">"Wi-Fi activado"</string>
     <string name="quick_settings_wifi_detail_empty_text" msgid="269990350383909226">"No hay redes Wi-Fi disponibles"</string>
     <string name="quick_settings_wifi_secondary_label_transient" msgid="7748206246119760554">"Activando…"</string>
-    <string name="quick_settings_cast_title" msgid="7709016546426454729">"Transmitir"</string>
+    <string name="quick_settings_cast_title" msgid="6954684227605751758">"Transmisión de pantalla"</string>
     <string name="quick_settings_casting" msgid="6601710681033353316">"Transmitiendo"</string>
     <string name="quick_settings_cast_device_default_name" msgid="5367253104742382945">"Dispositivo sin nombre"</string>
     <string name="quick_settings_cast_device_default_description" msgid="2484573682378634413">"Listo para transmitir"</string>
@@ -437,7 +437,8 @@
     <string name="battery_saver_notification_title" msgid="8614079794522291840">"El Ahorro de batería está activado"</string>
     <string name="battery_saver_notification_text" msgid="820318788126672692">"Reduce el rendimiento y el uso de datos en segundo plano."</string>
     <string name="battery_saver_notification_action_text" msgid="132118784269455533">"Desactivar el Ahorro de batería"</string>
-    <string name="media_projection_dialog_text" msgid="3071431025448218928">"<xliff:g id="APP_SEEKING_PERMISSION">%s</xliff:g> comenzará la captura de todo lo que se muestre en la pantalla."</string>
+    <string name="media_projection_dialog_text" msgid="1443042478990422751">"<xliff:g id="APP_SEEKING_PERMISSION">%s</xliff:g> comenzará a capturar todo lo que aparezca en la pantalla como notificaciones, contraseñas, fotos, información de pago y mensajes."</string>
+    <string name="media_projection_dialog_title" msgid="7574971526813630219">"¿Quieres permitir que <xliff:g id="APP_SEEKING_PERMISSION">%s</xliff:g> grabe o transmita la pantalla?"</string>
     <string name="media_projection_remember_text" msgid="3103510882172746752">"No volver a mostrar"</string>
     <string name="clear_all_notifications_text" msgid="814192889771462828">"Borrar todo"</string>
     <string name="manage_notifications_text" msgid="2386728145475108753">"Administrar"</string>
@@ -814,6 +815,9 @@
     <string name="high_temp_title" msgid="4589508026407318374">"El teléfono se está calentando"</string>
     <string name="high_temp_notif_message" msgid="5642466103153429279">"Se limitarán algunas funciones mientras se enfría el teléfono"</string>
     <string name="high_temp_dialog_message" msgid="6840700639374113553">"Tu teléfono intentará enfriarse automáticamente. Podrás usarlo, pero es posible que funcione más lento.\n\nUna vez que se haya enfriado, volverá a funcionar correctamente."</string>
+    <string name="high_temp_alarm_title" msgid="442812040762745210">"Desconectar cargador"</string>
+    <string name="high_temp_alarm_notify_message" msgid="1802871059489414932">"No se puede cargar el dispositivo. Desconecta el adaptador de la corriente con cuidado, ya que el cable podría estar caliente."</string>
+    <string name="high_temp_alarm_help_care_steps" msgid="3631075329318070726">"Ver pasos de mantenimiento"</string>
     <string name="lockscreen_shortcut_left" msgid="2182769107618938629">"Acceso directo izquierdo"</string>
     <string name="lockscreen_shortcut_right" msgid="3328683699505226536">"Acceso directo derecho"</string>
     <string name="lockscreen_unlock_left" msgid="2043092136246951985">"El acceso directo izquierdo también lo desbloquea"</string>
diff --git a/packages/SystemUI/res/values-es/strings.xml b/packages/SystemUI/res/values-es/strings.xml
index e1418d2..bccfdd3 100644
--- a/packages/SystemUI/res/values-es/strings.xml
+++ b/packages/SystemUI/res/values-es/strings.xml
@@ -325,7 +325,7 @@
     <string name="quick_settings_wifi_on_label" msgid="7607810331387031235">"Wi-Fi activada"</string>
     <string name="quick_settings_wifi_detail_empty_text" msgid="269990350383909226">"No hay ninguna red Wi-Fi disponible"</string>
     <string name="quick_settings_wifi_secondary_label_transient" msgid="7748206246119760554">"Activando…"</string>
-    <string name="quick_settings_cast_title" msgid="7709016546426454729">"Enviar"</string>
+    <string name="quick_settings_cast_title" msgid="6954684227605751758">"Enviar pantalla"</string>
     <string name="quick_settings_casting" msgid="6601710681033353316">"Enviando"</string>
     <string name="quick_settings_cast_device_default_name" msgid="5367253104742382945">"Dispositivo sin nombre"</string>
     <string name="quick_settings_cast_device_default_description" msgid="2484573682378634413">"Listo para enviar"</string>
@@ -437,7 +437,8 @@
     <string name="battery_saver_notification_title" msgid="8614079794522291840">"Ahorro de batería activado"</string>
     <string name="battery_saver_notification_text" msgid="820318788126672692">"Reduce el rendimiento y los datos en segundo plano"</string>
     <string name="battery_saver_notification_action_text" msgid="132118784269455533">"Desactivar Ahorro de batería"</string>
-    <string name="media_projection_dialog_text" msgid="3071431025448218928">"<xliff:g id="APP_SEEKING_PERMISSION">%s</xliff:g> empezará a capturar todo lo que aparezca en la pantalla."</string>
+    <string name="media_projection_dialog_text" msgid="1443042478990422751">"<xliff:g id="APP_SEEKING_PERMISSION">%s</xliff:g> empezará a capturar todo lo que aparezca en la pantalla, como notificaciones, contraseñas, fotos, mensajes y datos de pago."</string>
+    <string name="media_projection_dialog_title" msgid="7574971526813630219">"¿Quieres permitir que <xliff:g id="APP_SEEKING_PERMISSION">%s</xliff:g> grabe o envíe el contenido de tu pantalla?"</string>
     <string name="media_projection_remember_text" msgid="3103510882172746752">"No volver a mostrar"</string>
     <string name="clear_all_notifications_text" msgid="814192889771462828">"Borrar todo"</string>
     <string name="manage_notifications_text" msgid="2386728145475108753">"Gestionar"</string>
@@ -814,6 +815,9 @@
     <string name="high_temp_title" msgid="4589508026407318374">"El teléfono se está calentando"</string>
     <string name="high_temp_notif_message" msgid="5642466103153429279">"Se limitan algunas funciones mientras el teléfono se enfría"</string>
     <string name="high_temp_dialog_message" msgid="6840700639374113553">"El teléfono intentará enfriarse. Puedes seguir utilizándolo, pero es posible que funcione con mayor lentitud.\n\nUna vez que se haya enfriado, funcionará con normalidad."</string>
+    <string name="high_temp_alarm_title" msgid="442812040762745210">"Desconecta el cargador"</string>
+    <string name="high_temp_alarm_notify_message" msgid="1802871059489414932">"No se puede cargar el dispositivo. Desconecta el adaptador de corriente con cuidado, ya que el cable puede estar caliente."</string>
+    <string name="high_temp_alarm_help_care_steps" msgid="3631075329318070726">"Ver pasos de mantenimiento"</string>
     <string name="lockscreen_shortcut_left" msgid="2182769107618938629">"Acceso directo a la izquierda"</string>
     <string name="lockscreen_shortcut_right" msgid="3328683699505226536">"Acceso directo a la derecha"</string>
     <string name="lockscreen_unlock_left" msgid="2043092136246951985">"Desbloquear también con el acceso directo a la izquierda"</string>
diff --git a/packages/SystemUI/res/values-et/strings.xml b/packages/SystemUI/res/values-et/strings.xml
index dae607b..2c33935 100644
--- a/packages/SystemUI/res/values-et/strings.xml
+++ b/packages/SystemUI/res/values-et/strings.xml
@@ -325,7 +325,7 @@
     <string name="quick_settings_wifi_on_label" msgid="7607810331387031235">"WiFi on sees"</string>
     <string name="quick_settings_wifi_detail_empty_text" msgid="269990350383909226">"WiFi-võrke pole saadaval"</string>
     <string name="quick_settings_wifi_secondary_label_transient" msgid="7748206246119760554">"Sisselülitamine …"</string>
-    <string name="quick_settings_cast_title" msgid="7709016546426454729">"Ülekandmine"</string>
+    <string name="quick_settings_cast_title" msgid="6954684227605751758">"Ekraanikuva ülekandmine"</string>
     <string name="quick_settings_casting" msgid="6601710681033353316">"Osatäitjad"</string>
     <string name="quick_settings_cast_device_default_name" msgid="5367253104742382945">"Nimeta seade"</string>
     <string name="quick_settings_cast_device_default_description" msgid="2484573682378634413">"Valmis ülekandmiseks"</string>
@@ -437,7 +437,8 @@
     <string name="battery_saver_notification_title" msgid="8614079794522291840">"Akusäästja on sisse lülitatud"</string>
     <string name="battery_saver_notification_text" msgid="820318788126672692">"Vähendab jõudlust ja taustaandmeid"</string>
     <string name="battery_saver_notification_action_text" msgid="132118784269455533">"Akusäästja väljalülitamine"</string>
-    <string name="media_projection_dialog_text" msgid="3071431025448218928">"<xliff:g id="APP_SEEKING_PERMISSION">%s</xliff:g> hakkab jäädvustama kõike, mida ekraanil kuvatakse."</string>
+    <string name="media_projection_dialog_text" msgid="1443042478990422751">"<xliff:g id="APP_SEEKING_PERMISSION">%s</xliff:g> jäädvustab kõik ekraanil kuvatu, sh märguanded, paroolid, fotod, sõnumid ja makseteabe."</string>
+    <string name="media_projection_dialog_title" msgid="7574971526813630219">"Kas lubada rakendusel <xliff:g id="APP_SEEKING_PERMISSION">%s</xliff:g> teie ekraanikuva salvestada või üle kanda?"</string>
     <string name="media_projection_remember_text" msgid="3103510882172746752">"Ära kuva uuesti"</string>
     <string name="clear_all_notifications_text" msgid="814192889771462828">"Tühjenda kõik"</string>
     <string name="manage_notifications_text" msgid="2386728145475108753">"Haldamine"</string>
@@ -814,6 +815,9 @@
     <string name="high_temp_title" msgid="4589508026407318374">"Telefon soojeneb"</string>
     <string name="high_temp_notif_message" msgid="5642466103153429279">"Mõned funktsioonid on piiratud, kuni telefon jahtub"</string>
     <string name="high_temp_dialog_message" msgid="6840700639374113553">"Teie telefon proovib automaatselt maha jahtuda. Saate telefoni ikka kasutada, kuid see võib olla aeglasem.\n\nKui telefon on jahtunud, töötab see tavapäraselt."</string>
+    <string name="high_temp_alarm_title" msgid="442812040762745210">"Eemaldage laadija vooluvõrgust"</string>
+    <string name="high_temp_alarm_notify_message" msgid="1802871059489414932">"Selle seadme laadimisega on probleem. Eemaldage toiteadapter ja olge ettevaatlik, sest kaabel võib olla soe."</string>
+    <string name="high_temp_alarm_help_care_steps" msgid="3631075329318070726">"Vaadake hooldusjuhiseid"</string>
     <string name="lockscreen_shortcut_left" msgid="2182769107618938629">"Vasak otsetee"</string>
     <string name="lockscreen_shortcut_right" msgid="3328683699505226536">"Parem otsetee"</string>
     <string name="lockscreen_unlock_left" msgid="2043092136246951985">"Vasak otsetee avab ka"</string>
diff --git a/packages/SystemUI/res/values-eu/strings.xml b/packages/SystemUI/res/values-eu/strings.xml
index 82792b2..7fb5950 100644
--- a/packages/SystemUI/res/values-eu/strings.xml
+++ b/packages/SystemUI/res/values-eu/strings.xml
@@ -56,7 +56,7 @@
     <string name="always_use_accessory" msgid="3257892669444535154">"Ireki <xliff:g id="APPLICATION">%1$s</xliff:g> <xliff:g id="USB_ACCESSORY">%2$s</xliff:g> konektatzen den guztietan"</string>
     <string name="usb_debugging_title" msgid="4513918393387141949">"USB arazketa onartu?"</string>
     <string name="usb_debugging_message" msgid="2220143855912376496">"Ordenagailuaren RSA gakoaren erreferentzia-gako digitala hau da:\n<xliff:g id="FINGERPRINT">%1$s</xliff:g>"</string>
-    <string name="usb_debugging_always" msgid="303335496705863070">"Onartu beti ordenagailu honetatik"</string>
+    <string name="usb_debugging_always" msgid="303335496705863070">"Eman beti ordenagailu honetatik arazteko baimena"</string>
     <string name="usb_debugging_allow" msgid="2272145052073254852">"Eman baimena"</string>
     <string name="usb_debugging_secondary_user_title" msgid="6353808721761220421">"Ez da onartzen USB arazketa"</string>
     <string name="usb_debugging_secondary_user_message" msgid="6067122453571699801">"Gailu honetan saioa hasita duen erabiltzaileak ezin du aktibatu USB arazketa. Eginbide hori erabiltzeko, aldatu erabiltzaile nagusira."</string>
@@ -325,7 +325,7 @@
     <string name="quick_settings_wifi_on_label" msgid="7607810331387031235">"Aktibatuta dago Wi-Fi konexioa"</string>
     <string name="quick_settings_wifi_detail_empty_text" msgid="269990350383909226">"Ez dago Wi-Fi sarerik erabilgarri"</string>
     <string name="quick_settings_wifi_secondary_label_transient" msgid="7748206246119760554">"Aktibatzen…"</string>
-    <string name="quick_settings_cast_title" msgid="7709016546426454729">"Igorri"</string>
+    <string name="quick_settings_cast_title" msgid="6954684227605751758">"Pantaila igortzeko aukera"</string>
     <string name="quick_settings_casting" msgid="6601710681033353316">"Igortzen"</string>
     <string name="quick_settings_cast_device_default_name" msgid="5367253104742382945">"Izenik gabeko gailua"</string>
     <string name="quick_settings_cast_device_default_description" msgid="2484573682378634413">"Igortzeko prest"</string>
@@ -437,7 +437,8 @@
     <string name="battery_saver_notification_title" msgid="8614079794522291840">"Aktibatuta dago bateria-aurrezlea"</string>
     <string name="battery_saver_notification_text" msgid="820318788126672692">"Errendimendua eta atzeko planoko datuak murrizten ditu"</string>
     <string name="battery_saver_notification_action_text" msgid="132118784269455533">"Desaktibatu bateria-aurrezlea"</string>
-    <string name="media_projection_dialog_text" msgid="3071431025448218928">"<xliff:g id="APP_SEEKING_PERMISSION">%s</xliff:g> aplikazioak pantailan bistaratzen den guztia grabatuko du."</string>
+    <string name="media_projection_dialog_text" msgid="1443042478990422751">"Pantailan duzun guztia erregistratzen hasiko da <xliff:g id="APP_SEEKING_PERMISSION">%s</xliff:g>, jakinarazpenak, pasahitzak, argazkiak, mezuak eta ordainketa-informazioa barne."</string>
+    <string name="media_projection_dialog_title" msgid="7574971526813630219">"Pantaila grabatu edo igortzeko baimena eman nahi diozu <xliff:g id="APP_SEEKING_PERMISSION">%s</xliff:g> aplikazioari?"</string>
     <string name="media_projection_remember_text" msgid="3103510882172746752">"Ez erakutsi berriro"</string>
     <string name="clear_all_notifications_text" msgid="814192889771462828">"Garbitu guztiak"</string>
     <string name="manage_notifications_text" msgid="2386728145475108753">"Kudeatu"</string>
@@ -814,6 +815,9 @@
     <string name="high_temp_title" msgid="4589508026407318374">"Berotzen ari da telefonoa"</string>
     <string name="high_temp_notif_message" msgid="5642466103153429279">"Eginbide batzuk ezingo dira erabili telefonoa hoztu arte"</string>
     <string name="high_temp_dialog_message" msgid="6840700639374113553">"Telefonoa automatikoki saiatuko da hozten. Hoztu bitartean, telefonoa erabiltzen jarrai dezakezu, baina mantsoago funtziona lezake.\n\nTelefonoaren tenperatura jaitsi bezain laster, ohi bezala funtzionatzen jarraituko du."</string>
+    <string name="high_temp_alarm_title" msgid="442812040762745210">"Deskonektatu kargagailua"</string>
+    <string name="high_temp_alarm_notify_message" msgid="1802871059489414932">"Arazo bat izan da gailua kargatzean. Deskonektatu egokigailua eta kontuz ibili, kablea bero egon baitaiteke."</string>
+    <string name="high_temp_alarm_help_care_steps" msgid="3631075329318070726">"Ikusi zaintzeko urratsak"</string>
     <string name="lockscreen_shortcut_left" msgid="2182769107618938629">"Ezkerreko lasterbidea"</string>
     <string name="lockscreen_shortcut_right" msgid="3328683699505226536">"Eskuineko lasterbidea"</string>
     <string name="lockscreen_unlock_left" msgid="2043092136246951985">"Ezkerreko lasterbideak desblokeatzeko ere balio du"</string>
diff --git a/packages/SystemUI/res/values-fa/strings.xml b/packages/SystemUI/res/values-fa/strings.xml
index 2c7194e..fc67514 100644
--- a/packages/SystemUI/res/values-fa/strings.xml
+++ b/packages/SystemUI/res/values-fa/strings.xml
@@ -325,7 +325,7 @@
     <string name="quick_settings_wifi_on_label" msgid="7607810331387031235">"‏Wi-Fi روشن"</string>
     <string name="quick_settings_wifi_detail_empty_text" msgid="269990350383909226">"‏هیچ شبکه Wi-Fi موجود نیست"</string>
     <string name="quick_settings_wifi_secondary_label_transient" msgid="7748206246119760554">"روشن کردن…"</string>
-    <string name="quick_settings_cast_title" msgid="7709016546426454729">"ارسال محتوا"</string>
+    <string name="quick_settings_cast_title" msgid="6954684227605751758">"فرستادن صفحه نمایش"</string>
     <string name="quick_settings_casting" msgid="6601710681033353316">"در حال فرستادن"</string>
     <string name="quick_settings_cast_device_default_name" msgid="5367253104742382945">"دستگاه بدون نام"</string>
     <string name="quick_settings_cast_device_default_description" msgid="2484573682378634413">"آماده برای فرستادن"</string>
@@ -437,7 +437,8 @@
     <string name="battery_saver_notification_title" msgid="8614079794522291840">"بهینه‌سازی باتری روشن است"</string>
     <string name="battery_saver_notification_text" msgid="820318788126672692">"عملکرد و اطلاعات پس‌زمینه را کاهش می‌دهد"</string>
     <string name="battery_saver_notification_action_text" msgid="132118784269455533">"بهینه‌سازی باتری را خاموش کنید"</string>
-    <string name="media_projection_dialog_text" msgid="3071431025448218928">"<xliff:g id="APP_SEEKING_PERMISSION">%s</xliff:g> شروع به ضبط هر چیزی می‌کند که در صفحه‌نمایش شما نمایش داده می‌شود."</string>
+    <string name="media_projection_dialog_text" msgid="1443042478990422751">"<xliff:g id="APP_SEEKING_PERMISSION">%s</xliff:g> هرچیزی که در صفحه‌نمایش شماست، ازجمله اعلان‌ها، گذرواژه‌ها، عکس‌ها، پیام‌ها و اطلاعات پرداخت، ضبط می‌کند."</string>
+    <string name="media_projection_dialog_title" msgid="7574971526813630219">"به <xliff:g id="APP_SEEKING_PERMISSION">%s</xliff:g> اجازه می‌دهید صفحه‌نمایشتان را ضبط کند یا به آن ارسال محتوا کند؟"</string>
     <string name="media_projection_remember_text" msgid="3103510882172746752">"دوباره نشان داده نشود"</string>
     <string name="clear_all_notifications_text" msgid="814192889771462828">"پاک کردن همه موارد"</string>
     <string name="manage_notifications_text" msgid="2386728145475108753">"مدیریت"</string>
@@ -814,6 +815,9 @@
     <string name="high_temp_title" msgid="4589508026407318374">"تلفن درحال گرم شدن است"</string>
     <string name="high_temp_notif_message" msgid="5642466103153429279">"وقتی تلفن درحال خنک شدن است، بعضی از قابلیت‌ها محدود می‌شوند"</string>
     <string name="high_temp_dialog_message" msgid="6840700639374113553">"تلفنتان به‌طور خودکار سعی می‌کند خنک شود. همچنان می‌توانید از تلفنتان استفاده کنید، اما ممکن است کندتر عمل کند.\n\nوقتی تلفن خنک شد، عملکرد عادی‌اش از سرگرفته می‌شود."</string>
+    <string name="high_temp_alarm_title" msgid="442812040762745210">"جدا کردن شارژر از برق"</string>
+    <string name="high_temp_alarm_notify_message" msgid="1802871059489414932">"مشکلی در شارژ کردن این دستگاه وجود دارد. آداپتور برق را از برق جدا کنید و مراقب باشید زیرا ممکن است کابل گرم باشد."</string>
+    <string name="high_temp_alarm_help_care_steps" msgid="3631075329318070726">"مشاهده مراحل احتیاط"</string>
     <string name="lockscreen_shortcut_left" msgid="2182769107618938629">"میان‌بر چپ"</string>
     <string name="lockscreen_shortcut_right" msgid="3328683699505226536">"میان‌بر راست"</string>
     <string name="lockscreen_unlock_left" msgid="2043092136246951985">"قفل میان‌بر چپ هم باز می‌شود"</string>
diff --git a/packages/SystemUI/res/values-fi/strings.xml b/packages/SystemUI/res/values-fi/strings.xml
index 4986ab0..e12733a 100644
--- a/packages/SystemUI/res/values-fi/strings.xml
+++ b/packages/SystemUI/res/values-fi/strings.xml
@@ -325,7 +325,7 @@
     <string name="quick_settings_wifi_on_label" msgid="7607810331387031235">"Wi-Fi on käytössä"</string>
     <string name="quick_settings_wifi_detail_empty_text" msgid="269990350383909226">"Ei Wi-Fi-verkkoja käytettävissä"</string>
     <string name="quick_settings_wifi_secondary_label_transient" msgid="7748206246119760554">"Otetaan käyttöön…"</string>
-    <string name="quick_settings_cast_title" msgid="7709016546426454729">"Suoratoisto"</string>
+    <string name="quick_settings_cast_title" msgid="6954684227605751758">"Näytön suoratoisto"</string>
     <string name="quick_settings_casting" msgid="6601710681033353316">"Lähetetään"</string>
     <string name="quick_settings_cast_device_default_name" msgid="5367253104742382945">"Nimetön laite"</string>
     <string name="quick_settings_cast_device_default_description" msgid="2484573682378634413">"Valmis lähetystä varten"</string>
@@ -437,7 +437,8 @@
     <string name="battery_saver_notification_title" msgid="8614079794522291840">"Virransäästö on käytössä"</string>
     <string name="battery_saver_notification_text" msgid="820318788126672692">"Rajoittaa suorituskykyä ja taustatiedonsiirtoa"</string>
     <string name="battery_saver_notification_action_text" msgid="132118784269455533">"Poista virransäästö käytöstä"</string>
-    <string name="media_projection_dialog_text" msgid="3071431025448218928">"<xliff:g id="APP_SEEKING_PERMISSION">%s</xliff:g> alkaa tallentaa kaiken näytölläsi näkyvän."</string>
+    <string name="media_projection_dialog_text" msgid="1443042478990422751">"<xliff:g id="APP_SEEKING_PERMISSION">%s</xliff:g> alkaa tallentaa kaiken näytölläsi näkyvän, kuten ilmoitukset, salasanat, kuvat, viestit ja maksutiedot."</string>
+    <string name="media_projection_dialog_title" msgid="7574971526813630219">"Saako <xliff:g id="APP_SEEKING_PERMISSION">%s</xliff:g> nauhoittaa tai striimata näyttöäsi?"</string>
     <string name="media_projection_remember_text" msgid="3103510882172746752">"Älä näytä uudelleen"</string>
     <string name="clear_all_notifications_text" msgid="814192889771462828">"Poista kaikki"</string>
     <string name="manage_notifications_text" msgid="2386728145475108753">"Muuta asetuksia"</string>
@@ -814,6 +815,9 @@
     <string name="high_temp_title" msgid="4589508026407318374">"Puhelin lämpenee"</string>
     <string name="high_temp_notif_message" msgid="5642466103153429279">"Joidenkin ominaisuuksien käyttöä on rajoitettu puhelimen jäähtymisen aikana."</string>
     <string name="high_temp_dialog_message" msgid="6840700639374113553">"Puhelimesi yrittää automaattisesti jäähdyttää itsensä. Voit silti käyttää puhelinta, mutta se voi toimia hitaammin.\n\nKun puhelin on jäähtynyt, se toimii normaalisti."</string>
+    <string name="high_temp_alarm_title" msgid="442812040762745210">"Irrota laturi"</string>
+    <string name="high_temp_alarm_notify_message" msgid="1802871059489414932">"Laitetta ladattaessa tapahtui virhe. Irrota virtalähde varovasti – johto voi olla lämmin."</string>
+    <string name="high_temp_alarm_help_care_steps" msgid="3631075329318070726">"Katso huoltovaiheet"</string>
     <string name="lockscreen_shortcut_left" msgid="2182769107618938629">"Vasen pikakuvake"</string>
     <string name="lockscreen_shortcut_right" msgid="3328683699505226536">"Oikea pikakuvake"</string>
     <string name="lockscreen_unlock_left" msgid="2043092136246951985">"Myös vasen pikakuvake avaa lukituksen"</string>
diff --git a/packages/SystemUI/res/values-fr-rCA/strings.xml b/packages/SystemUI/res/values-fr-rCA/strings.xml
index 8ccedce..c273475 100644
--- a/packages/SystemUI/res/values-fr-rCA/strings.xml
+++ b/packages/SystemUI/res/values-fr-rCA/strings.xml
@@ -325,7 +325,7 @@
     <string name="quick_settings_wifi_on_label" msgid="7607810331387031235">"Wi-Fi activé"</string>
     <string name="quick_settings_wifi_detail_empty_text" msgid="269990350383909226">"Aucun réseau Wi-Fi à proximité"</string>
     <string name="quick_settings_wifi_secondary_label_transient" msgid="7748206246119760554">"Activation en cours…"</string>
-    <string name="quick_settings_cast_title" msgid="7709016546426454729">"Diffuser"</string>
+    <string name="quick_settings_cast_title" msgid="6954684227605751758">"Diffusion de l\'écran"</string>
     <string name="quick_settings_casting" msgid="6601710681033353316">"Diffusion"</string>
     <string name="quick_settings_cast_device_default_name" msgid="5367253104742382945">"Appareil sans nom"</string>
     <string name="quick_settings_cast_device_default_description" msgid="2484573682378634413">"Prêt à diffuser"</string>
@@ -437,7 +437,8 @@
     <string name="battery_saver_notification_title" msgid="8614079794522291840">"La fonction Économie d\'énergie est activée"</string>
     <string name="battery_saver_notification_text" msgid="820318788126672692">"Réduire les performances et de fond"</string>
     <string name="battery_saver_notification_action_text" msgid="132118784269455533">"Désactiver la fonction Économie d\'énergie"</string>
-    <string name="media_projection_dialog_text" msgid="3071431025448218928">"<xliff:g id="APP_SEEKING_PERMISSION">%s</xliff:g> commencer à enregistrer tout ce qui s\'affiche sur votre écran."</string>
+    <string name="media_projection_dialog_text" msgid="1443042478990422751">"<xliff:g id="APP_SEEKING_PERMISSION">%s</xliff:g> commencera à capturer tout ce qui se trouve votre écran, y compris les notifications, les mots de passe, les photos, les messages et les données relatives aux paiements."</string>
+    <string name="media_projection_dialog_title" msgid="7574971526813630219">"Autoriser <xliff:g id="APP_SEEKING_PERMISSION">%s</xliff:g> à enregistrer ou à diffuser votre écran?"</string>
     <string name="media_projection_remember_text" msgid="3103510882172746752">"Ne plus afficher"</string>
     <string name="clear_all_notifications_text" msgid="814192889771462828">"Tout effacer"</string>
     <string name="manage_notifications_text" msgid="2386728145475108753">"Gérer"</string>
@@ -814,6 +815,9 @@
     <string name="high_temp_title" msgid="4589508026407318374">"Le téléphone commence à chauffer"</string>
     <string name="high_temp_notif_message" msgid="5642466103153429279">"Les fonctionnalités sont limitées pendant que le téléphone refroidit"</string>
     <string name="high_temp_dialog_message" msgid="6840700639374113553">"Votre téléphone va essayer de se refroidir automatiquement. Vous pouvez toujours l\'utiliser, mais il risque d\'être plus lent.\n\nUne fois refroidi, il fonctionnera normalement."</string>
+    <string name="high_temp_alarm_title" msgid="442812040762745210">"Débranchez le chargeur"</string>
+    <string name="high_temp_alarm_notify_message" msgid="1802871059489414932">"Il y a un problème avec la recharge de cet appareil. Débranchez l\'adaptateur d\'alimentation, et faites attention, car le câble pourrait être chaud."</string>
+    <string name="high_temp_alarm_help_care_steps" msgid="3631075329318070726">"Afficher les étapes d\'entretien"</string>
     <string name="lockscreen_shortcut_left" msgid="2182769107618938629">"Raccourci gauche"</string>
     <string name="lockscreen_shortcut_right" msgid="3328683699505226536">"Raccourci droit"</string>
     <string name="lockscreen_unlock_left" msgid="2043092136246951985">"Le raccourci gauche déverrouille aussi :"</string>
diff --git a/packages/SystemUI/res/values-fr/strings.xml b/packages/SystemUI/res/values-fr/strings.xml
index 7a87cf6..4935672 100644
--- a/packages/SystemUI/res/values-fr/strings.xml
+++ b/packages/SystemUI/res/values-fr/strings.xml
@@ -325,7 +325,7 @@
     <string name="quick_settings_wifi_on_label" msgid="7607810331387031235">"Wi-Fi activé"</string>
     <string name="quick_settings_wifi_detail_empty_text" msgid="269990350383909226">"Aucun réseau Wi-Fi disponible"</string>
     <string name="quick_settings_wifi_secondary_label_transient" msgid="7748206246119760554">"Activation…"</string>
-    <string name="quick_settings_cast_title" msgid="7709016546426454729">"Caster"</string>
+    <string name="quick_settings_cast_title" msgid="6954684227605751758">"Diffusion de l\'écran"</string>
     <string name="quick_settings_casting" msgid="6601710681033353316">"Diffusion"</string>
     <string name="quick_settings_cast_device_default_name" msgid="5367253104742382945">"Appareil sans nom"</string>
     <string name="quick_settings_cast_device_default_description" msgid="2484573682378634413">"Prêt à caster"</string>
@@ -437,7 +437,8 @@
     <string name="battery_saver_notification_title" msgid="8614079794522291840">"Économiseur de batterie activé"</string>
     <string name="battery_saver_notification_text" msgid="820318788126672692">"Limite les performances et les données en arrière-plan."</string>
     <string name="battery_saver_notification_action_text" msgid="132118784269455533">"Désactiver l\'économiseur de batterie"</string>
-    <string name="media_projection_dialog_text" msgid="3071431025448218928">"<xliff:g id="APP_SEEKING_PERMISSION">%s</xliff:g> va commencer à capturer tous les contenus affichés à l\'écran."</string>
+    <string name="media_projection_dialog_text" msgid="1443042478990422751">"<xliff:g id="APP_SEEKING_PERMISSION">%s</xliff:g> va commencer à enregistrer tous les contenus affichés à l\'écran, y compris les notifications, les mots de passe, les photos, les messages et les informations de paiement."</string>
+    <string name="media_projection_dialog_title" msgid="7574971526813630219">"Autoriser <xliff:g id="APP_SEEKING_PERMISSION">%s</xliff:g> à enregistrer ou à caster votre écran ?"</string>
     <string name="media_projection_remember_text" msgid="3103510882172746752">"Ne plus afficher"</string>
     <string name="clear_all_notifications_text" msgid="814192889771462828">"Tout effacer"</string>
     <string name="manage_notifications_text" msgid="2386728145475108753">"Gérer"</string>
@@ -814,6 +815,9 @@
     <string name="high_temp_title" msgid="4589508026407318374">"Le téléphone chauffe"</string>
     <string name="high_temp_notif_message" msgid="5642466103153429279">"Fonctionnalités limitées pendant le refroidissement du téléphone"</string>
     <string name="high_temp_dialog_message" msgid="6840700639374113553">"Votre téléphone va essayer de se refroidir automatiquement. Vous pouvez toujours l\'utiliser, mais il risque d\'être plus lent.\n\nUne fois refroidi, il fonctionnera normalement."</string>
+    <string name="high_temp_alarm_title" msgid="442812040762745210">"Débrancher le chargeur"</string>
+    <string name="high_temp_alarm_notify_message" msgid="1802871059489414932">"Un problème est survenu lors de la recharge de cet appareil. Débranchez l\'adaptateur secteur en faisant attention, car le câble risque d\'être chaud."</string>
+    <string name="high_temp_alarm_help_care_steps" msgid="3631075329318070726">"Afficher les étapes d\'entretien"</string>
     <string name="lockscreen_shortcut_left" msgid="2182769107618938629">"Raccourci gauche"</string>
     <string name="lockscreen_shortcut_right" msgid="3328683699505226536">"Raccourci droit"</string>
     <string name="lockscreen_unlock_left" msgid="2043092136246951985">"Le raccourci gauche déverrouille également"</string>
diff --git a/packages/SystemUI/res/values-gl/strings.xml b/packages/SystemUI/res/values-gl/strings.xml
index 31a18f9..524401a 100644
--- a/packages/SystemUI/res/values-gl/strings.xml
+++ b/packages/SystemUI/res/values-gl/strings.xml
@@ -325,7 +325,7 @@
     <string name="quick_settings_wifi_on_label" msgid="7607810331387031235">"Wifi activada"</string>
     <string name="quick_settings_wifi_detail_empty_text" msgid="269990350383909226">"Non hai redes wifi dispoñibles"</string>
     <string name="quick_settings_wifi_secondary_label_transient" msgid="7748206246119760554">"Activando…"</string>
-    <string name="quick_settings_cast_title" msgid="7709016546426454729">"Emisión"</string>
+    <string name="quick_settings_cast_title" msgid="6954684227605751758">"Emisión da pantalla"</string>
     <string name="quick_settings_casting" msgid="6601710681033353316">"Emitindo"</string>
     <string name="quick_settings_cast_device_default_name" msgid="5367253104742382945">"Dispositivo sen nome"</string>
     <string name="quick_settings_cast_device_default_description" msgid="2484573682378634413">"Listo para emitir"</string>
@@ -437,7 +437,8 @@
     <string name="battery_saver_notification_title" msgid="8614079794522291840">"A función Aforro de batería está activada"</string>
     <string name="battery_saver_notification_text" msgid="820318788126672692">"Reduce o rendemento e os datos en segundo plano"</string>
     <string name="battery_saver_notification_action_text" msgid="132118784269455533">"Desactivar a función Aforro de batería"</string>
-    <string name="media_projection_dialog_text" msgid="3071431025448218928">"<xliff:g id="APP_SEEKING_PERMISSION">%s</xliff:g> comezará a capturar todo o que apareza na túa pantalla."</string>
+    <string name="media_projection_dialog_text" msgid="1443042478990422751">"<xliff:g id="APP_SEEKING_PERMISSION">%s</xliff:g> empezará a capturar todo o que aparece na túa pantalla, incluídas as notificacións, os contrasinais, as fotos, as mensaxes e a información de pago."</string>
+    <string name="media_projection_dialog_title" msgid="7574971526813630219">"Queres permitir que <xliff:g id="APP_SEEKING_PERMISSION">%s</xliff:g> grave ou emita a túa pantalla?"</string>
     <string name="media_projection_remember_text" msgid="3103510882172746752">"Non mostrar outra vez"</string>
     <string name="clear_all_notifications_text" msgid="814192889771462828">"Eliminar todas"</string>
     <string name="manage_notifications_text" msgid="2386728145475108753">"Xestionar"</string>
@@ -814,6 +815,9 @@
     <string name="high_temp_title" msgid="4589508026407318374">"O teléfono está quentando"</string>
     <string name="high_temp_notif_message" msgid="5642466103153429279">"O uso dalgunhas funcións é limitado mentres o teléfono arrefría"</string>
     <string name="high_temp_dialog_message" msgid="6840700639374113553">"O teléfono tentará arrefriar automaticamente. Podes utilizalo, pero é probable que funcione máis lento.\n\nUnha vez que arrefríe, funcionará con normalidade."</string>
+    <string name="high_temp_alarm_title" msgid="442812040762745210">"Desconecta o cargador"</string>
+    <string name="high_temp_alarm_notify_message" msgid="1802871059489414932">"Produciuse un problema ao cargar este dispositivo. Desconecta o adaptador de corrente e ten coidado porque o cable pode estar quente."</string>
+    <string name="high_temp_alarm_help_care_steps" msgid="3631075329318070726">"Ver pasos de mantemento"</string>
     <string name="lockscreen_shortcut_left" msgid="2182769107618938629">"Atallo á esquerda"</string>
     <string name="lockscreen_shortcut_right" msgid="3328683699505226536">"Atallo á dereita"</string>
     <string name="lockscreen_unlock_left" msgid="2043092136246951985">"O atallo á esquerda tamén desbloquea o dispositivo"</string>
diff --git a/packages/SystemUI/res/values-gu/strings.xml b/packages/SystemUI/res/values-gu/strings.xml
index 6c4f1b2..ac2af34 100644
--- a/packages/SystemUI/res/values-gu/strings.xml
+++ b/packages/SystemUI/res/values-gu/strings.xml
@@ -325,7 +325,7 @@
     <string name="quick_settings_wifi_on_label" msgid="7607810331387031235">"વાઇ-ફાઇ ચાલુ"</string>
     <string name="quick_settings_wifi_detail_empty_text" msgid="269990350383909226">"કોઈ વાઇ-ફાઇ નેટવર્ક્સ ઉપલબ્ધ નથી"</string>
     <string name="quick_settings_wifi_secondary_label_transient" msgid="7748206246119760554">"ચાલુ કરી રહ્યાં છીએ…"</string>
-    <string name="quick_settings_cast_title" msgid="7709016546426454729">"કાસ્ટ કરો"</string>
+    <string name="quick_settings_cast_title" msgid="6954684227605751758">"સ્ક્રીન કાસ્ટ"</string>
     <string name="quick_settings_casting" msgid="6601710681033353316">"કાસ્ટ કરી રહ્યાં છે"</string>
     <string name="quick_settings_cast_device_default_name" msgid="5367253104742382945">"અનામાંકિત ઉપકરણ"</string>
     <string name="quick_settings_cast_device_default_description" msgid="2484573682378634413">"કાસ્ટ કરવા માટે તૈયાર"</string>
@@ -437,7 +437,8 @@
     <string name="battery_saver_notification_title" msgid="8614079794522291840">"બૅટરી સેવર ચાલુ છે"</string>
     <string name="battery_saver_notification_text" msgid="820318788126672692">"પ્રદર્શન અને બૅકગ્રાઉન્ડ ડેટા ઘટાડે છે"</string>
     <string name="battery_saver_notification_action_text" msgid="132118784269455533">"બૅટરી સેવર બંધ કરો"</string>
-    <string name="media_projection_dialog_text" msgid="3071431025448218928">"<xliff:g id="APP_SEEKING_PERMISSION">%s</xliff:g> તમારી સ્ક્રીન પર જે પ્રદર્શિત થાય છે તે દરેક વસ્તુને કેપ્ચર કરવાનું પ્રારંભ કરશે."</string>
+    <string name="media_projection_dialog_text" msgid="1443042478990422751">"<xliff:g id="APP_SEEKING_PERMISSION">%s</xliff:g>, નોટિફિકેશન, પાસવર્ડ, ફોટા, સંદેશા અને ચુકવણીની માહિતી સહિત તમારી સ્ક્રીન પર રહેલી દરેક વસ્તુને કૅપ્ચર કરવાનું શરૂ કરશે."</string>
+    <string name="media_projection_dialog_title" msgid="7574971526813630219">"<xliff:g id="APP_SEEKING_PERMISSION">%s</xliff:g>ને તમારી સ્ક્રીનને રેકોર્ડ અથવા કાસ્ટ કરવાની મંજૂરી આપીએ?"</string>
     <string name="media_projection_remember_text" msgid="3103510882172746752">"ફરીથી બતાવશો નહીં"</string>
     <string name="clear_all_notifications_text" msgid="814192889771462828">"બધુ સાફ કરો"</string>
     <string name="manage_notifications_text" msgid="2386728145475108753">"મેનેજ કરો"</string>
@@ -814,6 +815,9 @@
     <string name="high_temp_title" msgid="4589508026407318374">"ફોન ગરમ થઈ રહ્યો છે"</string>
     <string name="high_temp_notif_message" msgid="5642466103153429279">"ફોન ઠંડો થાય ત્યાં સુધી કેટલીક સુવિધાઓ મર્યાદિત હોય છે"</string>
     <string name="high_temp_dialog_message" msgid="6840700639374113553">"તમારો ફોન આપમેળે ઠંડો થવાનો પ્રયાસ કરશે. તમે હજી પણ તમારા ફોનનો ઉપયોગ કરી શકો છો, પરંતુ તે કદાચ થોડો ધીમો ચાલે.\n\nતમારો ફોન ઠંડો થઈ જવા પર, તે સામાન્ય રીતે ચાલશે."</string>
+    <string name="high_temp_alarm_title" msgid="442812040762745210">"ચાર્જરને અનપ્લગ કરો"</string>
+    <string name="high_temp_alarm_notify_message" msgid="1802871059489414932">"આ ડિવાઇસને ચાર્જ કરવામાં કોઈ સમસ્યા છે. પાવર અડૅપ્ટર અનપ્લગ કરો અને કાળજી લેજો કદાચ કેબલ થોડો ગરમ થયો હોઈ શકે છે."</string>
+    <string name="high_temp_alarm_help_care_steps" msgid="3631075329318070726">"સારસંભાળના પગલાં જુઓ"</string>
     <string name="lockscreen_shortcut_left" msgid="2182769107618938629">"ડાબો શૉર્ટકટ"</string>
     <string name="lockscreen_shortcut_right" msgid="3328683699505226536">"જમણો શૉર્ટકટ"</string>
     <string name="lockscreen_unlock_left" msgid="2043092136246951985">"ડાબો શૉર્ટકટ પણ અનલૉક કરે છે"</string>
diff --git a/packages/SystemUI/res/values-hi/strings.xml b/packages/SystemUI/res/values-hi/strings.xml
index 517fc54..c81a159 100644
--- a/packages/SystemUI/res/values-hi/strings.xml
+++ b/packages/SystemUI/res/values-hi/strings.xml
@@ -325,7 +325,7 @@
     <string name="quick_settings_wifi_on_label" msgid="7607810331387031235">"वाई-फ़ाई चालू है"</string>
     <string name="quick_settings_wifi_detail_empty_text" msgid="269990350383909226">"कोई भी वाई-फ़ाई नेटवर्क उपलब्‍ध नहीं है"</string>
     <string name="quick_settings_wifi_secondary_label_transient" msgid="7748206246119760554">"वाई-फ़ाई चालू हो रहा है…"</string>
-    <string name="quick_settings_cast_title" msgid="7709016546426454729">"कास्ट करें"</string>
+    <string name="quick_settings_cast_title" msgid="6954684227605751758">"स्क्रीन कास्ट करना"</string>
     <string name="quick_settings_casting" msgid="6601710681033353316">"कास्टिंग"</string>
     <string name="quick_settings_cast_device_default_name" msgid="5367253104742382945">"अनाम डिवाइस"</string>
     <string name="quick_settings_cast_device_default_description" msgid="2484573682378634413">"कास्ट करने के लिए तैयार"</string>
@@ -437,7 +437,8 @@
     <string name="battery_saver_notification_title" msgid="8614079794522291840">"बैटरी सेवर चालू है"</string>
     <string name="battery_saver_notification_text" msgid="820318788126672692">"निष्‍पादन और पृष्ठभूमि डेटा को कम करता है"</string>
     <string name="battery_saver_notification_action_text" msgid="132118784269455533">"बैटरी सेवर बंद करें"</string>
-    <string name="media_projection_dialog_text" msgid="3071431025448218928">"<xliff:g id="APP_SEEKING_PERMISSION">%s</xliff:g> आपके स्क्रीन पर दिखाई देने वाली हर सामग्री को कैप्चर करना शुरू कर देगी."</string>
+    <string name="media_projection_dialog_text" msgid="1443042478990422751">"<xliff:g id="APP_SEEKING_PERMISSION">%s</xliff:g> आपकी स्क्रीन की सभी सामग्री कैप्चर करेगा. इसमें सूचनाएं, पासवर्ड, फ़ोटो, मैसेज, और पैसे चुकाने की जानकारी भी शामिल होगी."</string>
+    <string name="media_projection_dialog_title" msgid="7574971526813630219">"<xliff:g id="APP_SEEKING_PERMISSION">%s</xliff:g> को अपनी स्क्रीन रिकॉर्ड या कास्ट करने की मंज़ूरी दें?"</string>
     <string name="media_projection_remember_text" msgid="3103510882172746752">"फिर से न दिखाएं"</string>
     <string name="clear_all_notifications_text" msgid="814192889771462828">"सभी को हटाएं"</string>
     <string name="manage_notifications_text" msgid="2386728145475108753">"प्रबंधित करें"</string>
@@ -814,6 +815,9 @@
     <string name="high_temp_title" msgid="4589508026407318374">"फ़ोन गर्म हो रहा है"</string>
     <string name="high_temp_notif_message" msgid="5642466103153429279">"फ़ोन के ठंडा होने के दौरान कुछ सुविधाएं सीमित होती हैं"</string>
     <string name="high_temp_dialog_message" msgid="6840700639374113553">"आपका फ़ोन अपने आप ठंडा होने की कोशिश करेगा. आप अभी भी अपने फ़ोन का उपयोग कर सकते हैं, लेकिन हो सकता है कि यह धीमी गति से चले.\n\nठंडा हो जाने पर आपका फ़ोन सामान्य रूप से चलेगा."</string>
+    <string name="high_temp_alarm_title" msgid="442812040762745210">"चार्जर निकालें"</string>
+    <string name="high_temp_alarm_notify_message" msgid="1802871059489414932">"इस डिवाइस को चार्ज करने में समस्या हुई. पावर अडैप्टर का प्लग निकालें. ऐसा करते समय सावधानी बरतें क्योंकि तार गर्म हो सकता है."</string>
+    <string name="high_temp_alarm_help_care_steps" msgid="3631075329318070726">"प्रबंधन से जुड़े चरण देखें"</string>
     <string name="lockscreen_shortcut_left" msgid="2182769107618938629">"बायां शॉर्टकट"</string>
     <string name="lockscreen_shortcut_right" msgid="3328683699505226536">"दायां शॉर्टकट"</string>
     <string name="lockscreen_unlock_left" msgid="2043092136246951985">"बाएं शॉर्टकट से भी अनलॉक होता है"</string>
diff --git a/packages/SystemUI/res/values-hr/strings.xml b/packages/SystemUI/res/values-hr/strings.xml
index e4ff720..3173f71 100644
--- a/packages/SystemUI/res/values-hr/strings.xml
+++ b/packages/SystemUI/res/values-hr/strings.xml
@@ -326,7 +326,7 @@
     <string name="quick_settings_wifi_on_label" msgid="7607810331387031235">"Wi-Fi uključen"</string>
     <string name="quick_settings_wifi_detail_empty_text" msgid="269990350383909226">"Nije dostupna nijedna Wi-Fi mreža"</string>
     <string name="quick_settings_wifi_secondary_label_transient" msgid="7748206246119760554">"Uključivanje…"</string>
-    <string name="quick_settings_cast_title" msgid="7709016546426454729">"Emitiranje"</string>
+    <string name="quick_settings_cast_title" msgid="6954684227605751758">"Emitiranje zaslona"</string>
     <string name="quick_settings_casting" msgid="6601710681033353316">"Emitiranje"</string>
     <string name="quick_settings_cast_device_default_name" msgid="5367253104742382945">"Uređaj bez naziva"</string>
     <string name="quick_settings_cast_device_default_description" msgid="2484573682378634413">"Spreman za emitiranje"</string>
@@ -440,7 +440,8 @@
     <string name="battery_saver_notification_title" msgid="8614079794522291840">"Štednja baterije je uključena"</string>
     <string name="battery_saver_notification_text" msgid="820318788126672692">"Smanjuje količinu rada i pozadinske podatke"</string>
     <string name="battery_saver_notification_action_text" msgid="132118784269455533">"Isključite Štednju baterije"</string>
-    <string name="media_projection_dialog_text" msgid="3071431025448218928">"Aplikacija <xliff:g id="APP_SEEKING_PERMISSION">%s</xliff:g> počet će snimati sve što se prikazuje na zaslonu."</string>
+    <string name="media_projection_dialog_text" msgid="1443042478990422751">"<xliff:g id="APP_SEEKING_PERMISSION">%s</xliff:g> će početi snimati sve na zaslonu, uključujući obavijesti, zaporke, fotografije, poruke i podatke o plaćanju."</string>
+    <string name="media_projection_dialog_title" msgid="7574971526813630219">"Dopustiti aplikaciji <xliff:g id="APP_SEEKING_PERMISSION">%s</xliff:g> da snima ili emitira vaš zaslon?"</string>
     <string name="media_projection_remember_text" msgid="3103510882172746752">"Ne prikazuj ponovo"</string>
     <string name="clear_all_notifications_text" msgid="814192889771462828">"Izbriši sve"</string>
     <string name="manage_notifications_text" msgid="2386728145475108753">"Upravljajte"</string>
@@ -819,6 +820,9 @@
     <string name="high_temp_title" msgid="4589508026407318374">"Telefon se zagrijava"</string>
     <string name="high_temp_notif_message" msgid="5642466103153429279">"Neke su značajke ograničene dok se telefon hladi"</string>
     <string name="high_temp_dialog_message" msgid="6840700639374113553">"Telefon će se automatski pokušati ohladiti. Možete ga nastaviti koristiti, no mogao bi raditi sporije.\n\nKad se ohladi, radit će normalno."</string>
+    <string name="high_temp_alarm_title" msgid="442812040762745210">"Iskopčajte punjač"</string>
+    <string name="high_temp_alarm_notify_message" msgid="1802871059489414932">"Pojavio se problem s punjenjem uređaja. Iskopčajte pretvarač napona i pazite jer se kabel može zagrijati."</string>
+    <string name="high_temp_alarm_help_care_steps" msgid="3631075329318070726">"Pogledajte upute za održavanje"</string>
     <string name="lockscreen_shortcut_left" msgid="2182769107618938629">"Lijevi prečac"</string>
     <string name="lockscreen_shortcut_right" msgid="3328683699505226536">"Desni prečac"</string>
     <string name="lockscreen_unlock_left" msgid="2043092136246951985">"Lijevi prečac također otključava"</string>
diff --git a/packages/SystemUI/res/values-hu/strings.xml b/packages/SystemUI/res/values-hu/strings.xml
index 62be0ad..815c8bc 100644
--- a/packages/SystemUI/res/values-hu/strings.xml
+++ b/packages/SystemUI/res/values-hu/strings.xml
@@ -325,7 +325,7 @@
     <string name="quick_settings_wifi_on_label" msgid="7607810331387031235">"Wi-Fi bekapcsolva"</string>
     <string name="quick_settings_wifi_detail_empty_text" msgid="269990350383909226">"Nincs elérhető Wi-Fi-hálózat"</string>
     <string name="quick_settings_wifi_secondary_label_transient" msgid="7748206246119760554">"Bekapcsolás…"</string>
-    <string name="quick_settings_cast_title" msgid="7709016546426454729">"Tartalomátküldés"</string>
+    <string name="quick_settings_cast_title" msgid="6954684227605751758">"Képernyőátküldés"</string>
     <string name="quick_settings_casting" msgid="6601710681033353316">"Átküldés"</string>
     <string name="quick_settings_cast_device_default_name" msgid="5367253104742382945">"Név nélküli eszköz"</string>
     <string name="quick_settings_cast_device_default_description" msgid="2484573682378634413">"Küldésre kész"</string>
@@ -437,7 +437,8 @@
     <string name="battery_saver_notification_title" msgid="8614079794522291840">"Akkumulátorkímélő mód bekapcsolva"</string>
     <string name="battery_saver_notification_text" msgid="820318788126672692">"Csökkenti a teljesítményt és a háttéradatok használatát"</string>
     <string name="battery_saver_notification_action_text" msgid="132118784269455533">"Akkumulátorkímélő mód kikapcsolása"</string>
-    <string name="media_projection_dialog_text" msgid="3071431025448218928">"A(z) <xliff:g id="APP_SEEKING_PERMISSION">%s</xliff:g> alkalmazás rögzíteni fog mindent, ami megjelenik a képernyőn."</string>
+    <string name="media_projection_dialog_text" msgid="1443042478990422751">"A(z) <xliff:g id="APP_SEEKING_PERMISSION">%s</xliff:g> mindent rögzíteni kezd, ami a képernyőn látható (beleértve az értesítéseket, a jelszavakat, a fotókat, az üzeneteket és a fizetési információkat is)."</string>
+    <string name="media_projection_dialog_title" msgid="7574971526813630219">"Engedélyezi a(z) <xliff:g id="APP_SEEKING_PERMISSION">%s</xliff:g> számára, hogy rögzíthesse, illetve átküldhesse a képernyő tartalmát?"</string>
     <string name="media_projection_remember_text" msgid="3103510882172746752">"Ne jelenjen meg többé"</string>
     <string name="clear_all_notifications_text" msgid="814192889771462828">"Az összes törlése"</string>
     <string name="manage_notifications_text" msgid="2386728145475108753">"Kezelés"</string>
@@ -814,6 +815,9 @@
     <string name="high_temp_title" msgid="4589508026407318374">"A telefon melegszik"</string>
     <string name="high_temp_notif_message" msgid="5642466103153429279">"Bizonyos funkciók korlátozottan működnek a telefon hűlése közben"</string>
     <string name="high_temp_dialog_message" msgid="6840700639374113553">"A telefon automatikusan megpróbál lehűlni. Továbbra is tudja használni a telefont, de elképzelhető, hogy működése lelassul.\n\nAmint a telefon lehűl, újra a szokásos módon működik majd."</string>
+    <string name="high_temp_alarm_title" msgid="442812040762745210">"Húzza ki a töltőt"</string>
+    <string name="high_temp_alarm_notify_message" msgid="1802871059489414932">"Probléma adódott az eszköz töltése során. Húzza ki a hálózati adaptert. Vigyázzon, a kábel forró lehet."</string>
+    <string name="high_temp_alarm_help_care_steps" msgid="3631075329318070726">"Olvassa el a megfelelő használat lépéseit"</string>
     <string name="lockscreen_shortcut_left" msgid="2182769107618938629">"Bal oldali parancsikon"</string>
     <string name="lockscreen_shortcut_right" msgid="3328683699505226536">"Jobb oldali parancsikon"</string>
     <string name="lockscreen_unlock_left" msgid="2043092136246951985">"A bal oldali parancsikon szintén feloldja a zárolást"</string>
diff --git a/packages/SystemUI/res/values-hy/strings.xml b/packages/SystemUI/res/values-hy/strings.xml
index 0d8c036..2f910b7 100644
--- a/packages/SystemUI/res/values-hy/strings.xml
+++ b/packages/SystemUI/res/values-hy/strings.xml
@@ -325,7 +325,7 @@
     <string name="quick_settings_wifi_on_label" msgid="7607810331387031235">"Wi-Fi-ը միացված է"</string>
     <string name="quick_settings_wifi_detail_empty_text" msgid="269990350383909226">"Հասանելի Wi-Fi ցանցեր չկան"</string>
     <string name="quick_settings_wifi_secondary_label_transient" msgid="7748206246119760554">"Միացում…"</string>
-    <string name="quick_settings_cast_title" msgid="7709016546426454729">"Հեռարձակում"</string>
+    <string name="quick_settings_cast_title" msgid="6954684227605751758">"Էկրանի հեռարձակում"</string>
     <string name="quick_settings_casting" msgid="6601710681033353316">"Հեռարձակում"</string>
     <string name="quick_settings_cast_device_default_name" msgid="5367253104742382945">"Անանուն սարք"</string>
     <string name="quick_settings_cast_device_default_description" msgid="2484573682378634413">"Պատրաստ է հեռարձակման"</string>
@@ -437,7 +437,8 @@
     <string name="battery_saver_notification_title" msgid="8614079794522291840">"Մարտկոցի տնտեսումը միացված է"</string>
     <string name="battery_saver_notification_text" msgid="820318788126672692">"Նվազեցնում է ծանրաբեռնվածությունը և ֆոնային տվյալները"</string>
     <string name="battery_saver_notification_action_text" msgid="132118784269455533">"Անջատել մարտկոցի տնտեսումը"</string>
-    <string name="media_projection_dialog_text" msgid="3071431025448218928">"<xliff:g id="APP_SEEKING_PERMISSION">%s</xliff:g> ծրագիրը կսկսի հավաքել այն ամենն ինչ ցուցադրվում է ձեր էկրանին:"</string>
+    <string name="media_projection_dialog_text" msgid="1443042478990422751">"<xliff:g id="APP_SEEKING_PERMISSION">%s</xliff:g>-ը կլուսանկարի ամենը, ինչ հայտնվի սարքի էկրանին, այդ թվում՝ ծանուցումներ, գաղտնաբառեր, լուսանկարներ, հաղորդագրություններ և վճարային տվյալներ։"</string>
+    <string name="media_projection_dialog_title" msgid="7574971526813630219">"Թույլատրե՞լ <xliff:g id="APP_SEEKING_PERMISSION">%s</xliff:g>-ին տեսագրել կամ հեռարձակել ձեր էկրանը"</string>
     <string name="media_projection_remember_text" msgid="3103510882172746752">"Այլևս ցույց չտալ"</string>
     <string name="clear_all_notifications_text" msgid="814192889771462828">"Մաքրել բոլորը"</string>
     <string name="manage_notifications_text" msgid="2386728145475108753">"Կառավարել"</string>
@@ -606,7 +607,7 @@
     <string name="tuner_full_importance_settings_off" msgid="8208165412614935229">"Անջատել"</string>
     <string name="power_notification_controls_description" msgid="4372459941671353358">"Ծանուցումների ընդլայնված կառավարման օգնությամբ կարող եք յուրաքանչյուր հավելվածի ծանուցումների համար նշանակել կարևորության աստիճան՝ 0-5 սահմաններում: \n\n"<b>"5-րդ աստիճան"</b>" \n- Ցուցադրել ծանուցումների ցանկի վերևում \n- Թույլատրել լիաէկրան ընդհատումները \n- Միշտ ցուցադրել կարճ ծանուցումները \n\n"<b>"4-րդ աստիճան"</b>" \n- Արգելել լիաէկրան ընդհատումները \n- Միշտ ցուցադրել կարճ ծանուցումները \n\n"<b>"3-րդ աստիճան"</b>" \n- Արգելել լիաէկրան ընդհատումները \n- Արգելել կարճ ծանուցումների ցուցադրումը \n\n"<b>"2-րդ աստիճան"</b>" \n- Արգելել լիաէկրան ընդհատումները \n- Արգելել կարճ ծանուցումների ցուցադրումը \n- Անջատել ձայնը և թրթռումը \n\n"<b>"1-ին աստիճան"</b>" \n- Արգելել լիաէկրան ընդհատումները \n- Արգելել կարճ ծանուցումների ցուցադրումը \n- Անջատել ձայնը և թրթռումը \n- Չցուցադրել կողպէկրանում և կարգավիճակի գոտում \n- Ցուցադրել ծանուցումների ցանկի ներքևում \n\n"<b>"0-րդ աստիճան"</b>\n"- Արգելափակել հավելվածի բոլոր ծանուցումները"</string>
     <string name="notification_header_default_channel" msgid="7506845022070889909">"Ծանուցումներ"</string>
-    <string name="notification_channel_disabled" msgid="344536703863700565">"Դուք այլևս չեք ստանա այս ծանուցումները"</string>
+    <string name="notification_channel_disabled" msgid="344536703863700565">"Այլևս չեք ստանա նման ծանուցումներ"</string>
     <string name="notification_channel_minimized" msgid="1664411570378910931">"Այս ծանուցումները կծալվեն:"</string>
     <string name="notification_channel_silenced" msgid="2877199534497961942">"Այս ծանուցումները կցուցադրվեն առանց ձայնի"</string>
     <string name="notification_channel_unsilenced" msgid="4790904571552394137">"Այս ծանուցումները կցուցադրվեն զգուշացումով"</string>
@@ -814,6 +815,9 @@
     <string name="high_temp_title" msgid="4589508026407318374">"Հեռախոսը տաքանում է"</string>
     <string name="high_temp_notif_message" msgid="5642466103153429279">"Հովանալու ընթացքում հեռախոսի որոշ գործառույթներ սահմանափակ են"</string>
     <string name="high_temp_dialog_message" msgid="6840700639374113553">"Ձեր հեռախոսն ավտոմատ կերպով կփորձի hովանալ: Կարող եք շարունակել օգտագործել հեռախոսը, սակայն հնարավոր է, որ այն ավելի դանդաղ աշխատի:\n\nՀովանալուց հետո հեռախոսը կաշխատի կանոնավոր կերպով:"</string>
+    <string name="high_temp_alarm_title" msgid="442812040762745210">"Անջատեք լիցքավորիչը հոսանքից"</string>
+    <string name="high_temp_alarm_notify_message" msgid="1802871059489414932">"Չհաջողվեց լիցքավորել սարքը: Անջատեք հոսանքի ադապտերը և ուշադիր եղեք՝ մալուխը կարող է տաքացած լինել:"</string>
+    <string name="high_temp_alarm_help_care_steps" msgid="3631075329318070726">"Քայլեր գերտաքացման ահազանգի դեպքում"</string>
     <string name="lockscreen_shortcut_left" msgid="2182769107618938629">"Ձախ դյուրանցում"</string>
     <string name="lockscreen_shortcut_right" msgid="3328683699505226536">"Աջ դյուրանցում"</string>
     <string name="lockscreen_unlock_left" msgid="2043092136246951985">"Ձախ դյուրանցումը նաև ապակողպում է"</string>
diff --git a/packages/SystemUI/res/values-in/strings.xml b/packages/SystemUI/res/values-in/strings.xml
index fdf902e..cef419e 100644
--- a/packages/SystemUI/res/values-in/strings.xml
+++ b/packages/SystemUI/res/values-in/strings.xml
@@ -325,7 +325,7 @@
     <string name="quick_settings_wifi_on_label" msgid="7607810331387031235">"Wi-Fi Aktif"</string>
     <string name="quick_settings_wifi_detail_empty_text" msgid="269990350383909226">"Tidak ada jaringan Wi-Fi yang tersedia"</string>
     <string name="quick_settings_wifi_secondary_label_transient" msgid="7748206246119760554">"Mengaktifkan…"</string>
-    <string name="quick_settings_cast_title" msgid="7709016546426454729">"Cast"</string>
+    <string name="quick_settings_cast_title" msgid="6954684227605751758">"Transmisi Layar"</string>
     <string name="quick_settings_casting" msgid="6601710681033353316">"Melakukan transmisi"</string>
     <string name="quick_settings_cast_device_default_name" msgid="5367253104742382945">"Perangkat tanpa nama"</string>
     <string name="quick_settings_cast_device_default_description" msgid="2484573682378634413">"Siap melakukan transmisi"</string>
@@ -437,7 +437,8 @@
     <string name="battery_saver_notification_title" msgid="8614079794522291840">"Penghemat Baterai aktif"</string>
     <string name="battery_saver_notification_text" msgid="820318788126672692">"Mengurangi kinerja dan data latar belakang"</string>
     <string name="battery_saver_notification_action_text" msgid="132118784269455533">"Nonaktifkan Penghemat Baterai"</string>
-    <string name="media_projection_dialog_text" msgid="3071431025448218928">"<xliff:g id="APP_SEEKING_PERMISSION">%s</xliff:g> akan mulai menangkap apa saja yang ditampilkan pada layar Anda."</string>
+    <string name="media_projection_dialog_text" msgid="1443042478990422751">"<xliff:g id="APP_SEEKING_PERMISSION">%s</xliff:g> akan mulai mengambil foto semua item di layar, termasuk notifikasi, sandi, foto, pesan, dan informasi pembayaran."</string>
+    <string name="media_projection_dialog_title" msgid="7574971526813630219">"Izinkan <xliff:g id="APP_SEEKING_PERMISSION">%s</xliff:g> merekam atau mentransmisikan layar?"</string>
     <string name="media_projection_remember_text" msgid="3103510882172746752">"Jangan tampilkan lagi"</string>
     <string name="clear_all_notifications_text" msgid="814192889771462828">"Hapus semua"</string>
     <string name="manage_notifications_text" msgid="2386728145475108753">"Kelola"</string>
@@ -814,6 +815,9 @@
     <string name="high_temp_title" msgid="4589508026407318374">"Ponsel menjadi hangat"</string>
     <string name="high_temp_notif_message" msgid="5642466103153429279">"Beberapa fitur dibatasi saat ponsel mendingin"</string>
     <string name="high_temp_dialog_message" msgid="6840700639374113553">"Ponsel akan otomatis mencoba mendingin. Anda tetap dapat menggunakan ponsel, tetapi mungkin berjalan lebih lambat.\n\nSetelah dingin, ponsel akan berjalan seperti biasa."</string>
+    <string name="high_temp_alarm_title" msgid="442812040762745210">"Cabut pengisi daya"</string>
+    <string name="high_temp_alarm_notify_message" msgid="1802871059489414932">"Ada masalah saat mengisi daya perangkat ini. Cabut adaptor daya dan berhati-hatilah karena kabelnya mungkin panas."</string>
+    <string name="high_temp_alarm_help_care_steps" msgid="3631075329318070726">"Lihat langkah-langkah perawatan"</string>
     <string name="lockscreen_shortcut_left" msgid="2182769107618938629">"Pintasan kiri"</string>
     <string name="lockscreen_shortcut_right" msgid="3328683699505226536">"Pintasan kanan"</string>
     <string name="lockscreen_unlock_left" msgid="2043092136246951985">"Pintasan kiri juga membuka kunci"</string>
diff --git a/packages/SystemUI/res/values-is/strings.xml b/packages/SystemUI/res/values-is/strings.xml
index 0a5271a..b65c7c2 100644
--- a/packages/SystemUI/res/values-is/strings.xml
+++ b/packages/SystemUI/res/values-is/strings.xml
@@ -325,7 +325,7 @@
     <string name="quick_settings_wifi_on_label" msgid="7607810331387031235">"Kveikt á Wi-Fi"</string>
     <string name="quick_settings_wifi_detail_empty_text" msgid="269990350383909226">"Engin Wi-Fi net í boði"</string>
     <string name="quick_settings_wifi_secondary_label_transient" msgid="7748206246119760554">"Kveikir…"</string>
-    <string name="quick_settings_cast_title" msgid="7709016546426454729">"Útsending"</string>
+    <string name="quick_settings_cast_title" msgid="6954684227605751758">"Skjáútsending"</string>
     <string name="quick_settings_casting" msgid="6601710681033353316">"Sendir út"</string>
     <string name="quick_settings_cast_device_default_name" msgid="5367253104742382945">"Ónefnt tæki"</string>
     <string name="quick_settings_cast_device_default_description" msgid="2484573682378634413">"Tilbúið í útsendingu"</string>
@@ -437,7 +437,8 @@
     <string name="battery_saver_notification_title" msgid="8614079794522291840">"Kveikt er á rafhlöðusparnaði"</string>
     <string name="battery_saver_notification_text" msgid="820318788126672692">"Dregur úr afköstum og bakgrunnsgögnum"</string>
     <string name="battery_saver_notification_action_text" msgid="132118784269455533">"Slökkva á rafhlöðusparnaði"</string>
-    <string name="media_projection_dialog_text" msgid="3071431025448218928">"<xliff:g id="APP_SEEKING_PERMISSION">%s</xliff:g> mun fanga allt sem birtist á skjánum."</string>
+    <string name="media_projection_dialog_text" msgid="1443042478990422751">"<xliff:g id="APP_SEEKING_PERMISSION">%s</xliff:g> mun fanga allt sem birtist á skjánum, þar á meðal tilkynningar, aðgangsorð, myndir, skilaboð og greiðsluupplýsingar."</string>
+    <string name="media_projection_dialog_title" msgid="7574971526813630219">"Viltu leyfa <xliff:g id="APP_SEEKING_PERMISSION">%s</xliff:g> að taka upp skjáinn eða senda hann út?"</string>
     <string name="media_projection_remember_text" msgid="3103510882172746752">"Ekki sýna þetta aftur"</string>
     <string name="clear_all_notifications_text" msgid="814192889771462828">"Hreinsa allt"</string>
     <string name="manage_notifications_text" msgid="2386728145475108753">"Stjórna"</string>
@@ -814,6 +815,9 @@
     <string name="high_temp_title" msgid="4589508026407318374">"Síminn er að hitna"</string>
     <string name="high_temp_notif_message" msgid="5642466103153429279">"Sumir eiginleikar eru takmarkaðir þegar síminn kælir sig"</string>
     <string name="high_temp_dialog_message" msgid="6840700639374113553">"Síminn reynir sjálfkrafa að kæla sig. Þú getur enn notað símann en hann gæti verið hægvirkari.\n\nEftir að síminn hefur kælt sig niður virkar hann eðlilega."</string>
+    <string name="high_temp_alarm_title" msgid="442812040762745210">"Taktu hleðslutækið úr sambandi"</string>
+    <string name="high_temp_alarm_notify_message" msgid="1802871059489414932">"Upp kom vandamál varðandi hleðslu tækisins. Taktu straumbreytinn úr sambandi og farðu varlega því snúran gæti verið heit."</string>
+    <string name="high_temp_alarm_help_care_steps" msgid="3631075329318070726">"Sjá varúðarskref"</string>
     <string name="lockscreen_shortcut_left" msgid="2182769107618938629">"Flýtilykill til vinstri"</string>
     <string name="lockscreen_shortcut_right" msgid="3328683699505226536">"Flýtilykill til hægri"</string>
     <string name="lockscreen_unlock_left" msgid="2043092136246951985">"Flýtilykill til vinstri opnar einnig"</string>
diff --git a/packages/SystemUI/res/values-it/strings.xml b/packages/SystemUI/res/values-it/strings.xml
index 58fc17b..ffcff5e 100644
--- a/packages/SystemUI/res/values-it/strings.xml
+++ b/packages/SystemUI/res/values-it/strings.xml
@@ -325,7 +325,7 @@
     <string name="quick_settings_wifi_on_label" msgid="7607810331387031235">"Wi-Fi attivo"</string>
     <string name="quick_settings_wifi_detail_empty_text" msgid="269990350383909226">"Nessuna rete Wi-Fi disponibile"</string>
     <string name="quick_settings_wifi_secondary_label_transient" msgid="7748206246119760554">"Attivazione…"</string>
-    <string name="quick_settings_cast_title" msgid="7709016546426454729">"Trasmetti"</string>
+    <string name="quick_settings_cast_title" msgid="6954684227605751758">"Trasmissione schermo"</string>
     <string name="quick_settings_casting" msgid="6601710681033353316">"In trasmissione"</string>
     <string name="quick_settings_cast_device_default_name" msgid="5367253104742382945">"Dispositivo senza nome"</string>
     <string name="quick_settings_cast_device_default_description" msgid="2484573682378634413">"Pronto a trasmettere"</string>
@@ -437,7 +437,8 @@
     <string name="battery_saver_notification_title" msgid="8614079794522291840">"Risparmio energetico attivo"</string>
     <string name="battery_saver_notification_text" msgid="820318788126672692">"Riduce le prestazioni e i dati in background"</string>
     <string name="battery_saver_notification_action_text" msgid="132118784269455533">"Disattiva Risparmio energetico"</string>
-    <string name="media_projection_dialog_text" msgid="3071431025448218928">"<xliff:g id="APP_SEEKING_PERMISSION">%s</xliff:g> inizierà ad acquisire tutto ciò che è visualizzato sul tuo schermo."</string>
+    <string name="media_projection_dialog_text" msgid="1443042478990422751">"<xliff:g id="APP_SEEKING_PERMISSION">%s</xliff:g> inizierà ad acquisire tutti gli elementi sullo schermo, inclusi messaggi, notifiche, password, foto e dati di pagamento."</string>
+    <string name="media_projection_dialog_title" msgid="7574971526813630219">"Vuoi consentire a <xliff:g id="APP_SEEKING_PERMISSION">%s</xliff:g> di registrare o trasmettere lo schermo?"</string>
     <string name="media_projection_remember_text" msgid="3103510882172746752">"Non mostrare più"</string>
     <string name="clear_all_notifications_text" msgid="814192889771462828">"Cancella tutto"</string>
     <string name="manage_notifications_text" msgid="2386728145475108753">"Gestisci"</string>
@@ -814,6 +815,9 @@
     <string name="high_temp_title" msgid="4589508026407318374">"Il telefono si sta scaldando"</string>
     <string name="high_temp_notif_message" msgid="5642466103153429279">"Alcune funzioni limitate durante il raffreddamento del telefono"</string>
     <string name="high_temp_dialog_message" msgid="6840700639374113553">"Il telefono cercherà automaticamente di raffreddarsi. Puoi comunque usarlo, ma potrebbe essere più lento.\n\nUna volta raffreddato, il telefono funzionerà normalmente."</string>
+    <string name="high_temp_alarm_title" msgid="442812040762745210">"Scollega il caricabatterie"</string>
+    <string name="high_temp_alarm_notify_message" msgid="1802871059489414932">"Si è verificato un problema durante la ricarica del dispositivo. Scollega l\'alimentatore e presta attenzione perché il cavo potrebbe essere caldo."</string>
+    <string name="high_temp_alarm_help_care_steps" msgid="3631075329318070726">"Leggi le misure da adottare"</string>
     <string name="lockscreen_shortcut_left" msgid="2182769107618938629">"Scorciatoia sinistra"</string>
     <string name="lockscreen_shortcut_right" msgid="3328683699505226536">"Scorciatoia destra"</string>
     <string name="lockscreen_unlock_left" msgid="2043092136246951985">"Anche la scorciatoia sinistra consente di sbloccare"</string>
diff --git a/packages/SystemUI/res/values-iw/strings.xml b/packages/SystemUI/res/values-iw/strings.xml
index 0700f72..b9844bc 100644
--- a/packages/SystemUI/res/values-iw/strings.xml
+++ b/packages/SystemUI/res/values-iw/strings.xml
@@ -327,7 +327,7 @@
     <string name="quick_settings_wifi_on_label" msgid="7607810331387031235">"‏Wi-Fi פועל"</string>
     <string name="quick_settings_wifi_detail_empty_text" msgid="269990350383909226">"‏אין רשתות Wi-Fi זמינות"</string>
     <string name="quick_settings_wifi_secondary_label_transient" msgid="7748206246119760554">"ההפעלה מתבצעת…"</string>
-    <string name="quick_settings_cast_title" msgid="7709016546426454729">"Cast"</string>
+    <string name="quick_settings_cast_title" msgid="6954684227605751758">"העברת מסך"</string>
     <string name="quick_settings_casting" msgid="6601710681033353316">"מעביר"</string>
     <string name="quick_settings_cast_device_default_name" msgid="5367253104742382945">"מכשיר ללא שם"</string>
     <string name="quick_settings_cast_device_default_description" msgid="2484573682378634413">"מוכן להעביר"</string>
@@ -443,7 +443,8 @@
     <string name="battery_saver_notification_title" msgid="8614079794522291840">"תכונת החיסכון בסוללה פועלת"</string>
     <string name="battery_saver_notification_text" msgid="820318788126672692">"מפחית את הביצועים ונתונים ברקע"</string>
     <string name="battery_saver_notification_action_text" msgid="132118784269455533">"כיבוי תכונת החיסכון בסוללה"</string>
-    <string name="media_projection_dialog_text" msgid="3071431025448218928">"<xliff:g id="APP_SEEKING_PERMISSION">%s</xliff:g> יתחיל להקליט את כל התוכן המוצג במסך שלך."</string>
+    <string name="media_projection_dialog_text" msgid="1443042478990422751">"באמצעות <xliff:g id="APP_SEEKING_PERMISSION">%s</xliff:g>, יתחיל תיעוד של כל מה שמופיע במסך, כולל התראות, סיסמאות, תמונות, הודעות ופרטי תשלום."</string>
+    <string name="media_projection_dialog_title" msgid="7574971526813630219">"האם להתיר ל-<xliff:g id="APP_SEEKING_PERMISSION">%s</xliff:g> לצלם את המסך או לבצע העברה שלו?"</string>
     <string name="media_projection_remember_text" msgid="3103510882172746752">"אל תציג שוב"</string>
     <string name="clear_all_notifications_text" msgid="814192889771462828">"נקה הכל"</string>
     <string name="manage_notifications_text" msgid="2386728145475108753">"ניהול"</string>
@@ -816,14 +817,17 @@
     <string name="pip_notification_message" msgid="5619512781514343311">"אם אינך רוצה שהתכונה הזו תשמש את <xliff:g id="NAME">%s</xliff:g>, יש להקיש כדי לפתוח את ההגדרות ולכבות את התכונה."</string>
     <string name="pip_play" msgid="1417176722760265888">"הפעל"</string>
     <string name="pip_pause" msgid="8881063404466476571">"השהה"</string>
-    <string name="pip_skip_to_next" msgid="1948440006726306284">"ברצוני לדלג אל הבא"</string>
-    <string name="pip_skip_to_prev" msgid="1955311326688637914">"ברצוני לדלג אל הקודם"</string>
+    <string name="pip_skip_to_next" msgid="1948440006726306284">"אפשר לדלג אל הבא"</string>
+    <string name="pip_skip_to_prev" msgid="1955311326688637914">"אפשר לדלג אל הקודם"</string>
     <string name="thermal_shutdown_title" msgid="4458304833443861111">"הטלפון כבה עקב התחממות"</string>
     <string name="thermal_shutdown_message" msgid="9006456746902370523">"הטלפון פועל כרגיל עכשיו"</string>
     <string name="thermal_shutdown_dialog_message" msgid="566347880005304139">"הטלפון שלך התחמם יותר מדי וכבה כדי להתקרר. הטלפון פועל כרגיל עכשיו.\n\nייתכן שהטלפון יתחמם יותר מדי אם:\n	• תשתמש באפליקציות עתירות משאבים (כגון משחקים, אפליקציות וידאו או אפליקציות ניווט)\n	• תוריד או תעלה קבצים גדולים\n	• תשתמש בטלפון בטמפרטורות גבוהות"</string>
     <string name="high_temp_title" msgid="4589508026407318374">"הטלפון מתחמם"</string>
     <string name="high_temp_notif_message" msgid="5642466103153429279">"חלק מהתכונות מוגבלות כל עוד הטלפון מתקרר"</string>
     <string name="high_temp_dialog_message" msgid="6840700639374113553">"קירור הטלפון ייעשה באופן אוטומטי. תוכל עדיין להשתמש בטלפון, אבל ייתכן שהוא יפעל לאט יותר.\n\nהטלפון יחזור לפעול כרגיל לאחר שיתקרר."</string>
+    <string name="high_temp_alarm_title" msgid="442812040762745210">"יש לנתק את המטען"</string>
+    <string name="high_temp_alarm_notify_message" msgid="1802871059489414932">"יש בעיה עם טעינת מכשיר זה. יש לנתק את מתאם המתח בזהירות כיוון שייתכן שהכבל חם."</string>
+    <string name="high_temp_alarm_help_care_steps" msgid="3631075329318070726">"לצפייה בשלבי הטיפול"</string>
     <string name="lockscreen_shortcut_left" msgid="2182769107618938629">"קיצור דרך שמאלי"</string>
     <string name="lockscreen_shortcut_right" msgid="3328683699505226536">"קיצור דרך ימני"</string>
     <string name="lockscreen_unlock_left" msgid="2043092136246951985">"קיצור דרך שמאלי גם מבטל נעילה"</string>
diff --git a/packages/SystemUI/res/values-ja/strings.xml b/packages/SystemUI/res/values-ja/strings.xml
index 2e1d96d..c871d1c 100644
--- a/packages/SystemUI/res/values-ja/strings.xml
+++ b/packages/SystemUI/res/values-ja/strings.xml
@@ -325,7 +325,7 @@
     <string name="quick_settings_wifi_on_label" msgid="7607810331387031235">"Wi-Fi: ON"</string>
     <string name="quick_settings_wifi_detail_empty_text" msgid="269990350383909226">"Wi-Fiネットワークを利用できません"</string>
     <string name="quick_settings_wifi_secondary_label_transient" msgid="7748206246119760554">"ON にしています…"</string>
-    <string name="quick_settings_cast_title" msgid="7709016546426454729">"キャスト"</string>
+    <string name="quick_settings_cast_title" msgid="6954684227605751758">"画面のキャスト"</string>
     <string name="quick_settings_casting" msgid="6601710681033353316">"キャストしています"</string>
     <string name="quick_settings_cast_device_default_name" msgid="5367253104742382945">"名前のないデバイス"</string>
     <string name="quick_settings_cast_device_default_description" msgid="2484573682378634413">"キャスト準備完了"</string>
@@ -437,7 +437,8 @@
     <string name="battery_saver_notification_title" msgid="8614079794522291840">"バッテリー セーバー ON"</string>
     <string name="battery_saver_notification_text" msgid="820318788126672692">"パフォーマンスとバックグラウンドデータを制限します"</string>
     <string name="battery_saver_notification_action_text" msgid="132118784269455533">"バッテリー セーバーを OFF"</string>
-    <string name="media_projection_dialog_text" msgid="3071431025448218928">"<xliff:g id="APP_SEEKING_PERMISSION">%s</xliff:g>で、画面に表示されているコンテンツのキャプチャを開始します。"</string>
+    <string name="media_projection_dialog_text" msgid="1443042478990422751">"<xliff:g id="APP_SEEKING_PERMISSION">%s</xliff:g>で、画面上のすべての内容(通知、パスワード、写真、メッセージ、支払い情報など)の取得が開始されます。"</string>
+    <string name="media_projection_dialog_title" msgid="7574971526813630219">"<xliff:g id="APP_SEEKING_PERMISSION">%s</xliff:g>に画面の記録やキャストを許可しますか?"</string>
     <string name="media_projection_remember_text" msgid="3103510882172746752">"次回から表示しない"</string>
     <string name="clear_all_notifications_text" msgid="814192889771462828">"すべて消去"</string>
     <string name="manage_notifications_text" msgid="2386728145475108753">"管理"</string>
@@ -814,6 +815,9 @@
     <string name="high_temp_title" msgid="4589508026407318374">"スマートフォンの温度が上昇中"</string>
     <string name="high_temp_notif_message" msgid="5642466103153429279">"スマートフォンのクールダウン中は一部の機能が制限されます"</string>
     <string name="high_temp_dialog_message" msgid="6840700639374113553">"スマートフォンは自動的にクールダウンを行います。その間もスマートフォンを使用できますが、動作が遅くなる可能性があります。\n\nクールダウンが完了すると、通常どおり動作します。"</string>
+    <string name="high_temp_alarm_title" msgid="442812040762745210">"充電器を電源から外してください"</string>
+    <string name="high_temp_alarm_notify_message" msgid="1802871059489414932">"このデバイスの充電中に問題が発生しました。電源アダプターを電源から外してください。ケーブルが熱くなっている可能性がありますのでご注意ください。"</string>
+    <string name="high_temp_alarm_help_care_steps" msgid="3631075329318070726">"取り扱いに関する手順をご覧ください"</string>
     <string name="lockscreen_shortcut_left" msgid="2182769107618938629">"左ショートカット"</string>
     <string name="lockscreen_shortcut_right" msgid="3328683699505226536">"右ショートカット"</string>
     <string name="lockscreen_unlock_left" msgid="2043092136246951985">"左ショートカットでもロックを解除"</string>
diff --git a/packages/SystemUI/res/values-ka/strings.xml b/packages/SystemUI/res/values-ka/strings.xml
index 85278a79..cd4b9df 100644
--- a/packages/SystemUI/res/values-ka/strings.xml
+++ b/packages/SystemUI/res/values-ka/strings.xml
@@ -325,7 +325,7 @@
     <string name="quick_settings_wifi_on_label" msgid="7607810331387031235">"Wi-Fi ჩართულია"</string>
     <string name="quick_settings_wifi_detail_empty_text" msgid="269990350383909226">"Wi-Fi ქსელები მიუწვდომელია"</string>
     <string name="quick_settings_wifi_secondary_label_transient" msgid="7748206246119760554">"ირთვება…"</string>
-    <string name="quick_settings_cast_title" msgid="7709016546426454729">"ტრანსლირება"</string>
+    <string name="quick_settings_cast_title" msgid="6954684227605751758">"ეკრანის გადაცემა"</string>
     <string name="quick_settings_casting" msgid="6601710681033353316">"გადაიცემა"</string>
     <string name="quick_settings_cast_device_default_name" msgid="5367253104742382945">"უსახელო მოწყობილობა"</string>
     <string name="quick_settings_cast_device_default_description" msgid="2484573682378634413">"მზად არის სამაუწყებლოდ"</string>
@@ -437,7 +437,8 @@
     <string name="battery_saver_notification_title" msgid="8614079794522291840">"ბატარეის დამზოგი ჩართულია"</string>
     <string name="battery_saver_notification_text" msgid="820318788126672692">"ამცირებს წარმადობას და უკანა ფონის მონაცემებს"</string>
     <string name="battery_saver_notification_action_text" msgid="132118784269455533">"ბატარეის დამზოგის გამორთვა"</string>
-    <string name="media_projection_dialog_text" msgid="3071431025448218928">"<xliff:g id="APP_SEEKING_PERMISSION">%s</xliff:g> დაიწყებს იმ ყველაფრის აღბეჭდვას, რაც თქვენს ეკრანზე ჩანს."</string>
+    <string name="media_projection_dialog_text" msgid="1443042478990422751">"<xliff:g id="APP_SEEKING_PERMISSION">%s</xliff:g> აღბეჭდავს ყველაფერს თქვენს ეკრანზე, მათ შორის, შეტყობინებებს, პაროლებს, ფოტოებს, SMS-ებსა და ანგარიშსწორების ინფორმაციას."</string>
+    <string name="media_projection_dialog_title" msgid="7574971526813630219">"გსურთ <xliff:g id="APP_SEEKING_PERMISSION">%s</xliff:g>-ისთვის თქვენი ეკრანის ჩაწერისა და ტრანსლირების დაშვება?"</string>
     <string name="media_projection_remember_text" msgid="3103510882172746752">"აღარ მაჩვენო"</string>
     <string name="clear_all_notifications_text" msgid="814192889771462828">"ყველას გასუფთავება"</string>
     <string name="manage_notifications_text" msgid="2386728145475108753">"მართვა"</string>
@@ -814,6 +815,9 @@
     <string name="high_temp_title" msgid="4589508026407318374">"ტელეფონი ცხელდება"</string>
     <string name="high_temp_notif_message" msgid="5642466103153429279">"ზოგიერთი ფუნქცია შეზღუდული იქნება, სანამ ტელეფონი გაგრილდება"</string>
     <string name="high_temp_dialog_message" msgid="6840700639374113553">"თქვენი ტელეფონი გაგრილებას ავტომატურად შეეცდება. შეგიძლიათ გააგრძელოთ მისით სარგებლობა, თუმცა ტელეფონმა შეიძლება უფრო ნელა იმუშაოს.\n\nგაგრილების შემდგომ ის ჩვეულებრივად იმუშავებს."</string>
+    <string name="high_temp_alarm_title" msgid="442812040762745210">"გამოაერთეთ დამტენი"</string>
+    <string name="high_temp_alarm_notify_message" msgid="1802871059489414932">"ამ მოწყობილობის დატენა ვერ ხერხდება პრობლემის გამო. გამოაერთეთ ელკვების ადაპტერი და გამოიჩინეთ სიფრთხილე, რადგან კაბელი შეიძლებოდა გაცხელებულიყო."</string>
+    <string name="high_temp_alarm_help_care_steps" msgid="3631075329318070726">"მისაღები ზომების გაცნობა"</string>
     <string name="lockscreen_shortcut_left" msgid="2182769107618938629">"მარცხენა მალსახმობი"</string>
     <string name="lockscreen_shortcut_right" msgid="3328683699505226536">"მარჯვენა მალსახმობი"</string>
     <string name="lockscreen_unlock_left" msgid="2043092136246951985">"მარცხენა მალსახმობი ასევე განბლოკავს"</string>
diff --git a/packages/SystemUI/res/values-kk/strings.xml b/packages/SystemUI/res/values-kk/strings.xml
index 2f60cf4..34eb108 100644
--- a/packages/SystemUI/res/values-kk/strings.xml
+++ b/packages/SystemUI/res/values-kk/strings.xml
@@ -325,7 +325,7 @@
     <string name="quick_settings_wifi_on_label" msgid="7607810331387031235">"Wi-Fi қосулы"</string>
     <string name="quick_settings_wifi_detail_empty_text" msgid="269990350383909226">"Қолжетімді Wi-Fi желілері жоқ"</string>
     <string name="quick_settings_wifi_secondary_label_transient" msgid="7748206246119760554">"Қосылуда…"</string>
-    <string name="quick_settings_cast_title" msgid="7709016546426454729">"Трансляция"</string>
+    <string name="quick_settings_cast_title" msgid="6954684227605751758">"Экранды трансляциялау"</string>
     <string name="quick_settings_casting" msgid="6601710681033353316">"Трансляциялануда"</string>
     <string name="quick_settings_cast_device_default_name" msgid="5367253104742382945">"Атаусыз құрылғы"</string>
     <string name="quick_settings_cast_device_default_description" msgid="2484573682378634413">"Трансляциялауға дайын"</string>
@@ -437,7 +437,8 @@
     <string name="battery_saver_notification_title" msgid="8614079794522291840">"Battery saver қосулы"</string>
     <string name="battery_saver_notification_text" msgid="820318788126672692">"Өнімділікті және фондық деректерді азайтады"</string>
     <string name="battery_saver_notification_action_text" msgid="132118784269455533">"Battery saver функциясын өшіру"</string>
-    <string name="media_projection_dialog_text" msgid="3071431025448218928">"<xliff:g id="APP_SEEKING_PERMISSION">%s</xliff:g> экранда көрсетілгеннің барлығын түсіре бастайды."</string>
+    <string name="media_projection_dialog_text" msgid="1443042478990422751">"<xliff:g id="APP_SEEKING_PERMISSION">%s</xliff:g> экранда көрсетілетін бүкіл мәліметті, соның ішінде хабарландыруларды, құпия сөздерді, фотосуреттерді, хабарларды және төлем туралы ақпаратты суретке түсіре бастайды."</string>
+    <string name="media_projection_dialog_title" msgid="7574971526813630219">"<xliff:g id="APP_SEEKING_PERMISSION">%s</xliff:g> қолданбасына экранды жазуға немесе трансляциялауға рұқсат етілсін бе?"</string>
     <string name="media_projection_remember_text" msgid="3103510882172746752">"Қайта көрсетпеу"</string>
     <string name="clear_all_notifications_text" msgid="814192889771462828">"Барлығын тазалау"</string>
     <string name="manage_notifications_text" msgid="2386728145475108753">"Басқару"</string>
@@ -814,6 +815,9 @@
     <string name="high_temp_title" msgid="4589508026407318374">"Телефон қызуда"</string>
     <string name="high_temp_notif_message" msgid="5642466103153429279">"Телефон толық суығанға дейін, кейбір функциялардың жұмысы шектеледі"</string>
     <string name="high_temp_dialog_message" msgid="6840700639374113553">"Телефон автоматты түрде суи бастайды. Оны пайдалана бере аласыз, бірақ ол баяуырақ жұмыс істеуі мүмкін.\n\nТелефон суығаннан кейін, оның жұмысы қалпына келеді."</string>
+    <string name="high_temp_alarm_title" msgid="442812040762745210">"Зарядтағышты ажыратыңыз"</string>
+    <string name="high_temp_alarm_notify_message" msgid="1802871059489414932">"Құрылғыны зарядтау кезінде ақау шықты. Қуат адаптерін ажыратыңыз. Кабель ыстық болуы мүмкін, абай болыңыз."</string>
+    <string name="high_temp_alarm_help_care_steps" msgid="3631075329318070726">"Пайдалану нұсқаулығын қараңыз"</string>
     <string name="lockscreen_shortcut_left" msgid="2182769107618938629">"Сол жақ таңбаша"</string>
     <string name="lockscreen_shortcut_right" msgid="3328683699505226536">"Оң жақ таңбаша"</string>
     <string name="lockscreen_unlock_left" msgid="2043092136246951985">"Сол жақ таңбаша құлыпты ашады"</string>
diff --git a/packages/SystemUI/res/values-km/strings.xml b/packages/SystemUI/res/values-km/strings.xml
index 5b090ab..f077c77 100644
--- a/packages/SystemUI/res/values-km/strings.xml
+++ b/packages/SystemUI/res/values-km/strings.xml
@@ -325,7 +325,7 @@
     <string name="quick_settings_wifi_on_label" msgid="7607810331387031235">"Wi-Fi បានបើក"</string>
     <string name="quick_settings_wifi_detail_empty_text" msgid="269990350383909226">"គ្មានបណ្តាញ Wi-Fi ទេ"</string>
     <string name="quick_settings_wifi_secondary_label_transient" msgid="7748206246119760554">"កំពុង​បើក..."</string>
-    <string name="quick_settings_cast_title" msgid="7709016546426454729">"ភ្ជាប់"</string>
+    <string name="quick_settings_cast_title" msgid="6954684227605751758">"ការថតវីដេអូ​នៅលើអេក្រង់"</string>
     <string name="quick_settings_casting" msgid="6601710681033353316">"ការ​ចាត់​ថ្នាក់"</string>
     <string name="quick_settings_cast_device_default_name" msgid="5367253104742382945">"ឧបករណ៍​​ដែល​មិន​មាន​ឈ្មោះ"</string>
     <string name="quick_settings_cast_device_default_description" msgid="2484573682378634413">"ត្រៀម​រួចរាល់​ដើម្បី​ចាត់​ថ្នាក់"</string>
@@ -437,7 +437,8 @@
     <string name="battery_saver_notification_title" msgid="8614079794522291840">"កម្មវិធីសន្សំថ្មបានបើក"</string>
     <string name="battery_saver_notification_text" msgid="820318788126672692">"ការ​បន្ថយ​ការ​ប្រតិបត្តិ និង​ទិន្នន័យ​ផ្ទៃ​ខាងក្រោយ"</string>
     <string name="battery_saver_notification_action_text" msgid="132118784269455533">"បិទ​កម្មវិធី​សន្សំ​ថ្ម"</string>
-    <string name="media_projection_dialog_text" msgid="3071431025448218928">"<xliff:g id="APP_SEEKING_PERMISSION">%s</xliff:g> នឹង​ចាប់ផ្ដើម​ចាប់​យក​អ្វីៗ​គ្រប់យ៉ាង​ដែល​បង្ហាញ​លើ​អេក្រង់​របស់​អ្នក។"</string>
+    <string name="media_projection_dialog_text" msgid="1443042478990422751">"<xliff:g id="APP_SEEKING_PERMISSION">%s</xliff:g> នឹង​ចាប់ផ្ដើម​ថត​អ្វីគ្រប់យ៉ាង​នៅលើ​អេក្រង់​របស់អ្នក រួមទាំង​ការជូន​ដំណឹង ពាក្យ​សម្ងាត់ រូប​ថត សារ និង​ព័ត៌មាន​ពីការទូទាត់ផងដែរ។"</string>
+    <string name="media_projection_dialog_title" msgid="7574971526813630219">"អនុញ្ញាត​ឱ្យ <xliff:g id="APP_SEEKING_PERMISSION">%s</xliff:g> ថត ឬ​បញ្ជូន​អេក្រង់​របស់អ្នក?"</string>
     <string name="media_projection_remember_text" msgid="3103510882172746752">"កុំ​បង្ហាញ​ម្ដងទៀត"</string>
     <string name="clear_all_notifications_text" msgid="814192889771462828">"សម្អាត​ទាំងអស់"</string>
     <string name="manage_notifications_text" msgid="2386728145475108753">"គ្រប់គ្រង"</string>
@@ -814,6 +815,9 @@
     <string name="high_temp_title" msgid="4589508026407318374">"ទូរសព្ទ​នេះ​កំពុង​កើន​កម្តៅ"</string>
     <string name="high_temp_notif_message" msgid="5642466103153429279">"មុខងារ​មួយ​ចំនួន​នឹង​មិន​អាច​ប្រើ​បាន​ពេញលេញ​នោះ​ទេ ខណៈពេល​ដែល​ទូរសព្ទ​កំពុង​បញ្ចុះ​កម្តៅ"</string>
     <string name="high_temp_dialog_message" msgid="6840700639374113553">"ទូរសព្ទ​របស់អ្នក​នឹង​ព្យាយាម​បញ្ចុះ​កម្តៅ​ដោយ​ស្វ័យប្រវត្តិ។ អ្នក​នៅតែ​អាច​ប្រើ​ទូរសព្ទ​របស់អ្នក​បាន​ដដែល​ ប៉ុន្តែ​វា​នឹង​ដំណើរ​ការ​យឺត​ជាង​មុន។\n\nបន្ទាប់​ពី​ទូរសព្ទ​របស់អ្នក​ត្រជាក់​ជាង​មុន​ហើយ វា​នឹង​ដំណើរការ​ដូច​ធម្មតា។"</string>
+    <string name="high_temp_alarm_title" msgid="442812040762745210">"ផ្ដាច់ឆ្នាំងសាក"</string>
+    <string name="high_temp_alarm_notify_message" msgid="1802871059489414932">"មាន​បញ្ហា​ក្នុងការសាកថ្ម​ឧបករណ៍​នេះ។ សូមផ្ដាច់​ឆ្នាំងសាក ហើយ​ប្រុងប្រយ័ត្ន ដោយសារ​ខ្សែ​អាចមាន​កម្ដៅ​ក្ដៅ។"</string>
+    <string name="high_temp_alarm_help_care_steps" msgid="3631075329318070726">"មើលជំហាន​ថែទាំ"</string>
     <string name="lockscreen_shortcut_left" msgid="2182769107618938629">"ផ្លូវកាត់​ខាង​ឆ្វេង"</string>
     <string name="lockscreen_shortcut_right" msgid="3328683699505226536">"ផ្លូវកាត់​ខាង​ស្តាំ"</string>
     <string name="lockscreen_unlock_left" msgid="2043092136246951985">"ផ្លូវកាត់​ខាង​ឆ្វេង​ក៏​ដោះសោ​ដែរ"</string>
diff --git a/packages/SystemUI/res/values-kn/strings.xml b/packages/SystemUI/res/values-kn/strings.xml
index 1fe0673..8904b9e 100644
--- a/packages/SystemUI/res/values-kn/strings.xml
+++ b/packages/SystemUI/res/values-kn/strings.xml
@@ -325,7 +325,7 @@
     <string name="quick_settings_wifi_on_label" msgid="7607810331387031235">"ವೈ-ಫೈ ಆನ್ ಆಗಿದೆ"</string>
     <string name="quick_settings_wifi_detail_empty_text" msgid="269990350383909226">"ಯಾವುದೇ ವೈ-ಫೈ ನೆಟ್‌ವರ್ಕ್‌ಗಳು ಲಭ್ಯವಿಲ್ಲ"</string>
     <string name="quick_settings_wifi_secondary_label_transient" msgid="7748206246119760554">"ಆನ್ ಮಾಡಲಾಗುತ್ತಿದೆ..."</string>
-    <string name="quick_settings_cast_title" msgid="7709016546426454729">"ಬಿತ್ತರಿಸುವಿಕೆ"</string>
+    <string name="quick_settings_cast_title" msgid="6954684227605751758">"ಸ್ಕ್ರೀನ್ ಕ್ಯಾಸ್ಟ್"</string>
     <string name="quick_settings_casting" msgid="6601710681033353316">"ಬಿತ್ತರಿಸಲಾಗುತ್ತಿದೆ"</string>
     <string name="quick_settings_cast_device_default_name" msgid="5367253104742382945">"ಹೆಸರಿಸದಿರುವ ಸಾಧನ"</string>
     <string name="quick_settings_cast_device_default_description" msgid="2484573682378634413">"ಬಿತ್ತರಿಸಲು ಸಿದ್ದವಾಗಿದೆ"</string>
@@ -437,7 +437,8 @@
     <string name="battery_saver_notification_title" msgid="8614079794522291840">"ಬ್ಯಾಟರಿ ರಕ್ಷಕ ಆನ್ ಆಗಿದೆ"</string>
     <string name="battery_saver_notification_text" msgid="820318788126672692">"ಕಾರ್ಯಕ್ಷಮತೆ ಮತ್ತು ಹಿನ್ನೆಲೆ ಡೇಟಾವನ್ನು ಕಡಿಮೆ ಮಾಡುತ್ತದೆ"</string>
     <string name="battery_saver_notification_action_text" msgid="132118784269455533">"ಬ್ಯಾಟರಿ ಸೇವರ್‌ ಆಫ್ ಮಾಡಿ"</string>
-    <string name="media_projection_dialog_text" msgid="3071431025448218928">"ನಿಮ್ಮ ಪರದೆಯ ಮೇಲೆ ಪ್ರದರ್ಶಿಸಲಾಗುವ ಎಲ್ಲವನ್ನೂ <xliff:g id="APP_SEEKING_PERMISSION">%s</xliff:g> ಯು ಸೆರೆಹಿಡಿಯಲು ಪ್ರಾರಂಭಿಸುತ್ತದೆ."</string>
+    <string name="media_projection_dialog_text" msgid="1443042478990422751">"<xliff:g id="APP_SEEKING_PERMISSION">%s</xliff:g> ನಿಮ್ಮ ಪರದೆಯಲ್ಲಿರುವ - ಅಧಿಸೂಚನೆಗಳು, ಕರೆಗಳು, ಪಾಸ್‌ವರ್ಡ್‌ಗಳು ಸೇರಿದಂತೆ ಪ್ರತಿಯೊಂದನ್ನೂ ಕ್ಯಾಪ್ಚರ್ ಮಾಡುತ್ತದೆ."</string>
+    <string name="media_projection_dialog_title" msgid="7574971526813630219">"ರೆಕಾರ್ಡ್ ಮಾಡಲು ಅಥವಾ ನಿಮ್ಮ ಸ್ಕ್ರೀನ್ ಅನ್ನು ಬಿತ್ತರಿಸಲು <xliff:g id="APP_SEEKING_PERMISSION">%s</xliff:g> ಅನ್ನು ಅನುಮತಿಸುವುದೇ?"</string>
     <string name="media_projection_remember_text" msgid="3103510882172746752">"ಮತ್ತೊಮ್ಮೆ ತೋರಿಸದಿರು"</string>
     <string name="clear_all_notifications_text" msgid="814192889771462828">"ಎಲ್ಲವನ್ನೂ ತೆರವುಗೊಳಿಸು"</string>
     <string name="manage_notifications_text" msgid="2386728145475108753">"ನಿರ್ವಹಿಸಿ"</string>
@@ -814,6 +815,9 @@
     <string name="high_temp_title" msgid="4589508026407318374">"ಫೋನ್ ಬಿಸಿಯಾಗುತ್ತಿದೆ"</string>
     <string name="high_temp_notif_message" msgid="5642466103153429279">"ಫೋನ್ ತಣ್ಣಗಾಗುವವರೆಗೂ ಕೆಲವು ವೈಶಿಷ್ಟ್ಯಗಳನ್ನು ಸೀಮಿತಗೊಳಿಸುತ್ತದೆ"</string>
     <string name="high_temp_dialog_message" msgid="6840700639374113553">"ನಿಮ್ಮ ಫೋನ್ ಸ್ವಯಂಚಾಲಿತವಾಗಿ ತಣ್ಣಗಾಗಲು ಪ್ರಯತ್ನಿಸುತ್ತದೆ. ನಿಮ್ಮ ಫೋನ್ ಅನ್ನು ನೀವು ಈಗಲೂ ಬಳಸಬಹುದಾಗಿರುತ್ತದೆ, ಆದರೆ ಇದು ನಿಧಾನವಾಗಿರಬಹುದು.\n\nಒಮ್ಮೆ ನಿಮ್ಮ ಫೋನ್ ತಣ್ಣಗಾದ ನಂತರ ಇದು ಸಾಮಾನ್ಯ ರೀತಿಯಲ್ಲಿ ಕಾರ್ಯನಿರ್ವಹಿಸುತ್ತದೆ."</string>
+    <string name="high_temp_alarm_title" msgid="442812040762745210">"ಚಾರ್ಜರ್ ಅನ್‌ಪ್ಲಗ್ ಮಾಡಿ"</string>
+    <string name="high_temp_alarm_notify_message" msgid="1802871059489414932">"ಈ ಸಾಧನವನ್ನು ಚಾರ್ಜ್ ಮಾಡುತ್ತಿರುವಾಗ ಸಮಸ್ಯೆ ಎದುರಾಗಿದೆ. ಪವರ್ ಅಡಾಪ್ಟರ್ ಅನ್ನು ಅನ್‌ಪ್ಲಗ್ ಮಾಡಿ ಮತ್ತು ಕೇಬಲ್ ಬೆಚ್ಚಗಿರಬೇಕೆಂದು ಜಾಗ್ರತೆ ವಹಿಸಿ."</string>
+    <string name="high_temp_alarm_help_care_steps" msgid="3631075329318070726">"ಕಾಳಜಿ ಹಂತಗಳನ್ನು ನೋಡಿ"</string>
     <string name="lockscreen_shortcut_left" msgid="2182769107618938629">"ಎಡ ಶಾರ್ಟ್‌ಕಟ್"</string>
     <string name="lockscreen_shortcut_right" msgid="3328683699505226536">"ಬಲ ಶಾರ್ಟ್‌ಕಟ್"</string>
     <string name="lockscreen_unlock_left" msgid="2043092136246951985">"ಎಡ ಶಾರ್ಟ್‌ಕಟ್ ಕೂಡ ಅನ್‌ಲಾಕ್ ಮಾಡುತ್ತದೆ"</string>
diff --git a/packages/SystemUI/res/values-ko/strings.xml b/packages/SystemUI/res/values-ko/strings.xml
index e7b4fc7..55d77d1 100644
--- a/packages/SystemUI/res/values-ko/strings.xml
+++ b/packages/SystemUI/res/values-ko/strings.xml
@@ -325,7 +325,7 @@
     <string name="quick_settings_wifi_on_label" msgid="7607810331387031235">"Wi-Fi 사용"</string>
     <string name="quick_settings_wifi_detail_empty_text" msgid="269990350383909226">"사용 가능한 Wi-Fi 네트워크 없음"</string>
     <string name="quick_settings_wifi_secondary_label_transient" msgid="7748206246119760554">"켜는 중..."</string>
-    <string name="quick_settings_cast_title" msgid="7709016546426454729">"전송"</string>
+    <string name="quick_settings_cast_title" msgid="6954684227605751758">"화면 전송"</string>
     <string name="quick_settings_casting" msgid="6601710681033353316">"전송 중"</string>
     <string name="quick_settings_cast_device_default_name" msgid="5367253104742382945">"이름이 없는 기기"</string>
     <string name="quick_settings_cast_device_default_description" msgid="2484573682378634413">"전송 준비 완료"</string>
@@ -437,7 +437,8 @@
     <string name="battery_saver_notification_title" msgid="8614079794522291840">"절전 모드 사용 중"</string>
     <string name="battery_saver_notification_text" msgid="820318788126672692">"성능 및 백그라운드 데이터를 줄입니다."</string>
     <string name="battery_saver_notification_action_text" msgid="132118784269455533">"절전 모드 사용 중지"</string>
-    <string name="media_projection_dialog_text" msgid="3071431025448218928">"<xliff:g id="APP_SEEKING_PERMISSION">%s</xliff:g>에서 화면에 표시된 모든 것을 캡처하기 시작합니다."</string>
+    <string name="media_projection_dialog_text" msgid="1443042478990422751">"<xliff:g id="APP_SEEKING_PERMISSION">%s</xliff:g>이(가) 알림, 비밀번호, 사진, 메시지, 결제 정보를 비롯한 화면의 모든 내용을 캡처하기 시작합니다."</string>
+    <string name="media_projection_dialog_title" msgid="7574971526813630219">"<xliff:g id="APP_SEEKING_PERMISSION">%s</xliff:g>이(가) 화면을 녹화하거나 전송하도록 허용하시겠습니까?"</string>
     <string name="media_projection_remember_text" msgid="3103510882172746752">"다시 표시 안함"</string>
     <string name="clear_all_notifications_text" msgid="814192889771462828">"모두 지우기"</string>
     <string name="manage_notifications_text" msgid="2386728145475108753">"관리"</string>
@@ -814,6 +815,9 @@
     <string name="high_temp_title" msgid="4589508026407318374">"휴대전화 온도가 높음"</string>
     <string name="high_temp_notif_message" msgid="5642466103153429279">"휴대전화 온도를 낮추는 동안 일부 기능이 제한됩니다."</string>
     <string name="high_temp_dialog_message" msgid="6840700639374113553">"휴대전화 온도를 자동으로 낮추려고 시도합니다. 휴대전화를 계속 사용할 수는 있지만 작동이 느려질 수도 있습니다.\n\n휴대전화 온도가 낮아지면 정상적으로 작동됩니다."</string>
+    <string name="high_temp_alarm_title" msgid="442812040762745210">"충전기를 연결 해제하세요"</string>
+    <string name="high_temp_alarm_notify_message" msgid="1802871059489414932">"기기를 충전하는 중에 문제가 발생했습니다. 케이블이 뜨거울 수 있으므로 주의하여 전원 어댑터를 분리하세요."</string>
+    <string name="high_temp_alarm_help_care_steps" msgid="3631075329318070726">"취해야 할 조치 확인"</string>
     <string name="lockscreen_shortcut_left" msgid="2182769107618938629">"왼쪽 바로가기"</string>
     <string name="lockscreen_shortcut_right" msgid="3328683699505226536">"오른쪽 바로가기"</string>
     <string name="lockscreen_unlock_left" msgid="2043092136246951985">"왼쪽 바로가기도 잠금 해제 가능"</string>
diff --git a/packages/SystemUI/res/values-ky/strings.xml b/packages/SystemUI/res/values-ky/strings.xml
index 596ef29..7e7af37 100644
--- a/packages/SystemUI/res/values-ky/strings.xml
+++ b/packages/SystemUI/res/values-ky/strings.xml
@@ -325,7 +325,7 @@
     <string name="quick_settings_wifi_on_label" msgid="7607810331387031235">"Wi-Fi күйүк"</string>
     <string name="quick_settings_wifi_detail_empty_text" msgid="269990350383909226">"Бир дагы жеткиликтүү Wi-Fi тармагы жок"</string>
     <string name="quick_settings_wifi_secondary_label_transient" msgid="7748206246119760554">"Күйгүзүлүүдө…"</string>
-    <string name="quick_settings_cast_title" msgid="7709016546426454729">"Тышкы экранга чыгаруу"</string>
+    <string name="quick_settings_cast_title" msgid="6954684227605751758">"Тышкы экранга чыгаруу"</string>
     <string name="quick_settings_casting" msgid="6601710681033353316">"Тышкы экранга чыгарылууда"</string>
     <string name="quick_settings_cast_device_default_name" msgid="5367253104742382945">"Аты жок түзмөк"</string>
     <string name="quick_settings_cast_device_default_description" msgid="2484573682378634413">"Тышкы экранга чыгарууга даяр"</string>
@@ -437,7 +437,8 @@
     <string name="battery_saver_notification_title" msgid="8614079794522291840">"Батареяны үнөмдөгүч режими күйүк"</string>
     <string name="battery_saver_notification_text" msgid="820318788126672692">"Иштин майнаптуулугун начарлатып, фондук дайындарды чектейт"</string>
     <string name="battery_saver_notification_action_text" msgid="132118784269455533">"Батареяны үнөмдөгүч режимин өчүрүү"</string>
-    <string name="media_projection_dialog_text" msgid="3071431025448218928">"<xliff:g id="APP_SEEKING_PERMISSION">%s</xliff:g> экранга чыккан нерсенин баарын сүрөткө тарта баштайт."</string>
+    <string name="media_projection_dialog_text" msgid="1443042478990422751">"<xliff:g id="APP_SEEKING_PERMISSION">%s</xliff:g> экранга чыккан нерсенин баарын, анын ичинде билдирмелерди, сырсөздөрдү, сүрөттөрдү, билдирүүлөрдү жана төлөм маалыматын сүрөткө тарта баштайт."</string>
+    <string name="media_projection_dialog_title" msgid="7574971526813630219">"<xliff:g id="APP_SEEKING_PERMISSION">%s</xliff:g> колдонмосу экраныңыздагы нерсени жаздырып же тышкы экранга чыгарсынбы?"</string>
     <string name="media_projection_remember_text" msgid="3103510882172746752">"Экинчи көрсөтүлбөсүн"</string>
     <string name="clear_all_notifications_text" msgid="814192889771462828">"Бардыгын тазалап салуу"</string>
     <string name="manage_notifications_text" msgid="2386728145475108753">"Башкаруу"</string>
@@ -814,6 +815,9 @@
     <string name="high_temp_title" msgid="4589508026407318374">"Телефонуңуз ысып баратат"</string>
     <string name="high_temp_notif_message" msgid="5642466103153429279">"Телефон сууганча айрым элементтердин иши чектелген"</string>
     <string name="high_temp_dialog_message" msgid="6840700639374113553">"Телефонуңуз автоматтык түрдө сууйт. Аны колдоно берсеңиз болот, бирок ал жайыраак иштеп калат.\n\nТелефонуңуз суугандан кийин адаттагыдай эле иштеп баштайт."</string>
+    <string name="high_temp_alarm_title" msgid="442812040762745210">"Кубаттагычты сууруңуз"</string>
+    <string name="high_temp_alarm_notify_message" msgid="1802871059489414932">"Бул түзмөктү кубаттоодо маселе келип чыкты. Кабель ысып кетиши мүмкүн, андыктан кубаттагыч адаптерин сууруп коюңуз."</string>
+    <string name="high_temp_alarm_help_care_steps" msgid="3631075329318070726">"Тейлөө кадамдарын көрүңүз"</string>
     <string name="lockscreen_shortcut_left" msgid="2182769107618938629">"Сол жактагы кыска жол"</string>
     <string name="lockscreen_shortcut_right" msgid="3328683699505226536">"Оң жактагы кыска жол"</string>
     <string name="lockscreen_unlock_left" msgid="2043092136246951985">"Сол жактагы кыска жол дагы кулпуну ачат"</string>
diff --git a/packages/SystemUI/res/values-lo/strings.xml b/packages/SystemUI/res/values-lo/strings.xml
index 86a35ed..c28d73b 100644
--- a/packages/SystemUI/res/values-lo/strings.xml
+++ b/packages/SystemUI/res/values-lo/strings.xml
@@ -325,7 +325,7 @@
     <string name="quick_settings_wifi_on_label" msgid="7607810331387031235">"Wi-Fi ເປີດ"</string>
     <string name="quick_settings_wifi_detail_empty_text" msgid="269990350383909226">"ບໍ່​ມີ​ເຄືອ​ຂ່າຍ Wi-Fi ຢູ່"</string>
     <string name="quick_settings_wifi_secondary_label_transient" msgid="7748206246119760554">"ກຳລັງເປີດ..."</string>
-    <string name="quick_settings_cast_title" msgid="7709016546426454729">"ການສົ່ງສັນຍານ"</string>
+    <string name="quick_settings_cast_title" msgid="6954684227605751758">"ການສົ່ງສັນຍານໜ້າຈໍ"</string>
     <string name="quick_settings_casting" msgid="6601710681033353316">"​ກຳ​ລັງ​ສົ່ງ​ສັນ​ຍານ"</string>
     <string name="quick_settings_cast_device_default_name" msgid="5367253104742382945">"​ອຸ​ປະ​ກອນບໍ່​ມີ​ຊື່"</string>
     <string name="quick_settings_cast_device_default_description" msgid="2484573682378634413">"​ພ້ອ​ມ​ສົ່ງ​ສັນ​ຍານ​ແລ້ວ"</string>
@@ -437,7 +437,8 @@
     <string name="battery_saver_notification_title" msgid="8614079794522291840">"ຕົວປະຢັດແບັດເຕີຣີເປີດຢູ່"</string>
     <string name="battery_saver_notification_text" msgid="820318788126672692">"ຫຼຸດ​ປະ​ສິ​ທິ​ພາບ​ແລະ​ການ​ນຳ​ໃຊ້​ຂໍ້​ມູນ​ພື້ນຫຼັງ"</string>
     <string name="battery_saver_notification_action_text" msgid="132118784269455533">"ປິດຕົວປະຢັດແບັດເຕີຣີ"</string>
-    <string name="media_projection_dialog_text" msgid="3071431025448218928">"<xliff:g id="APP_SEEKING_PERMISSION">%s</xliff:g> ​ຈະ​ເລີ່ມ​ບັນ​ທຶກ​ທຸກ​ຢ່າງ​ທີ່​ສະ​ແດງ​ຜົນ​ໃນ​ໜ້າ​ຈໍ​ທ່ານ."</string>
+    <string name="media_projection_dialog_text" msgid="1443042478990422751">"<xliff:g id="APP_SEEKING_PERMISSION">%s</xliff:g> ຈະເລີ່ມບັນທຶກທຸກຢ່າງຢູ່ໜ້າຈໍຂອງທ່ານ ຮວມທັງການແຈ້ງເຕືອນ, ລະຫັດຜ່ານ, ຮູບພາບ, ຂໍ້ຄວາມ ແລະ ຂໍ້ມູນການຈ່າຍເງິນ."</string>
+    <string name="media_projection_dialog_title" msgid="7574971526813630219">"ອະນຸຍາດໃຫ້ <xliff:g id="APP_SEEKING_PERMISSION">%s</xliff:g> ບັນທຶກ ຫຼື ສົ່ງສັນຍານໜ້າຈໍຂອງທ່ານບໍ?"</string>
     <string name="media_projection_remember_text" msgid="3103510882172746752">"ບໍ່​ຕ້ອງ​ສະ​ແດງ​ອີກ"</string>
     <string name="clear_all_notifications_text" msgid="814192889771462828">"ລຶບລ້າງທັງໝົດ"</string>
     <string name="manage_notifications_text" msgid="2386728145475108753">"ຈັດການ"</string>
@@ -814,6 +815,9 @@
     <string name="high_temp_title" msgid="4589508026407318374">"ໂທລະສັບກຳລັງຮ້ອນຂຶ້ນ"</string>
     <string name="high_temp_notif_message" msgid="5642466103153429279">"ຄຸນສົມບັດບາງຢ່າງຖືກຈຳກັດໄວ້ເນື່ອງໃນເວລາຫຼຸດອຸນຫະພູມຂອງໂທລະສັບ"</string>
     <string name="high_temp_dialog_message" msgid="6840700639374113553">"ໂທລະສັບຂອງທ່ານຈະພະຍາຍາມລົດອຸນຫະພູມລົງ. ທ່ານຍັງຄົງສາມາດໃຊ້ໂທລະສັບຂອງທ່ານໄດ້ຢູ່, ແຕ່ມັນຈະເຮັດວຽກຊ້າລົງ.\n\nເມື່ອໂທລະສັບຂອງທ່ານບໍ່ຮ້ອນຫຼາຍແລ້ວ, ມັນຈະກັບມາເຮັດວຽກຕາມປົກກະຕິ."</string>
+    <string name="high_temp_alarm_title" msgid="442812040762745210">"ຖອດສາຍສາກອອກ"</string>
+    <string name="high_temp_alarm_notify_message" msgid="1802871059489414932">"ເກີດບັນຫາໃນການສາກໄຟອຸປະກອນນີ້. ກະລຸນາຖອດສາຍສາກອອກ ແລະ ລະວັງເນື່ອງຈາກສາຍອາດຈະຍັງອຸ່ນຢູ່."</string>
+    <string name="high_temp_alarm_help_care_steps" msgid="3631075329318070726">"ເບິ່ງຂັ້ນຕອນການເບິ່ງແຍງ"</string>
     <string name="lockscreen_shortcut_left" msgid="2182769107618938629">"ປຸ່ມລັດຊ້າຍ"</string>
     <string name="lockscreen_shortcut_right" msgid="3328683699505226536">"ປຸ່ມລັດຂວາ"</string>
     <string name="lockscreen_unlock_left" msgid="2043092136246951985">"ປຸ່ມລັດຊ້າຍປົດລັອກນຳ"</string>
diff --git a/packages/SystemUI/res/values-lt/strings.xml b/packages/SystemUI/res/values-lt/strings.xml
index a42992b..df4017d 100644
--- a/packages/SystemUI/res/values-lt/strings.xml
+++ b/packages/SystemUI/res/values-lt/strings.xml
@@ -327,7 +327,7 @@
     <string name="quick_settings_wifi_on_label" msgid="7607810331387031235">"„Wi-Fi“ įjungtas"</string>
     <string name="quick_settings_wifi_detail_empty_text" msgid="269990350383909226">"Nėra jokių pasiekiamų „Wi-Fi“ tinklų"</string>
     <string name="quick_settings_wifi_secondary_label_transient" msgid="7748206246119760554">"Įjungiama…"</string>
-    <string name="quick_settings_cast_title" msgid="7709016546426454729">"Perdavimas"</string>
+    <string name="quick_settings_cast_title" msgid="6954684227605751758">"Ekrano perdavimas"</string>
     <string name="quick_settings_casting" msgid="6601710681033353316">"Perduodama"</string>
     <string name="quick_settings_cast_device_default_name" msgid="5367253104742382945">"Įrenginys be pavadinimo"</string>
     <string name="quick_settings_cast_device_default_description" msgid="2484573682378634413">"Paruošta perduoti"</string>
@@ -443,7 +443,8 @@
     <string name="battery_saver_notification_title" msgid="8614079794522291840">"Akumuliatoriaus tausojimo priemonė įjungta"</string>
     <string name="battery_saver_notification_text" msgid="820318788126672692">"Sumažinamas našumas ir foninių duomenų naudojimas"</string>
     <string name="battery_saver_notification_action_text" msgid="132118784269455533">"Išjungti Akumuliatoriaus tausojimo priemonę"</string>
-    <string name="media_projection_dialog_text" msgid="3071431025448218928">"„<xliff:g id="APP_SEEKING_PERMISSION">%s</xliff:g>“ pradės fiksuoti viską, kas rodoma jūsų ekrane."</string>
+    <string name="media_projection_dialog_text" msgid="1443042478990422751">"„<xliff:g id="APP_SEEKING_PERMISSION">%s</xliff:g>“ pradės fiksuoti visą ekrane rodomą turinį, įskaitant informacinius pranešimus, slaptažodžius, nuotraukas, pranešimus ir mokėjimo informaciją."</string>
+    <string name="media_projection_dialog_title" msgid="7574971526813630219">"Leisti „<xliff:g id="APP_SEEKING_PERMISSION">%s</xliff:g>“ įrašyti arba perduoti ekrano turinį?"</string>
     <string name="media_projection_remember_text" msgid="3103510882172746752">"Daugiau neberodyti"</string>
     <string name="clear_all_notifications_text" msgid="814192889771462828">"Viską išvalyti"</string>
     <string name="manage_notifications_text" msgid="2386728145475108753">"Tvarkyti"</string>
@@ -824,6 +825,9 @@
     <string name="high_temp_title" msgid="4589508026407318374">"Telefonas kaista"</string>
     <string name="high_temp_notif_message" msgid="5642466103153429279">"Kai kurios funkcijos gali neveikti, kol telefonas vėsta"</string>
     <string name="high_temp_dialog_message" msgid="6840700639374113553">"Telefonas automatiškai bandys atvėsti. Telefoną vis tiek galėsite naudoti, tačiau jis gali veikti lėčiau.\n\nKai telefonas atvės, jis veiks įprastai."</string>
+    <string name="high_temp_alarm_title" msgid="442812040762745210">"Atjunkite kroviklį"</string>
+    <string name="high_temp_alarm_notify_message" msgid="1802871059489414932">"Įkraunant šį įrenginį iškilo problema. Atjunkite maitinimo adapterį. Būkite atsargūs, nes laidas gali būti įkaitęs."</string>
+    <string name="high_temp_alarm_help_care_steps" msgid="3631075329318070726">"Žr. priežiūros veiksmus"</string>
     <string name="lockscreen_shortcut_left" msgid="2182769107618938629">"Spartusis klavišas kairėje"</string>
     <string name="lockscreen_shortcut_right" msgid="3328683699505226536">"Spartusis klavišas dešinėje"</string>
     <string name="lockscreen_unlock_left" msgid="2043092136246951985">"Spartusis klavišas kairėje taip pat atrakina"</string>
diff --git a/packages/SystemUI/res/values-lv/strings.xml b/packages/SystemUI/res/values-lv/strings.xml
index 1267faf..3a00dd6 100644
--- a/packages/SystemUI/res/values-lv/strings.xml
+++ b/packages/SystemUI/res/values-lv/strings.xml
@@ -326,7 +326,7 @@
     <string name="quick_settings_wifi_on_label" msgid="7607810331387031235">"Wi-Fi savienojums ieslēgts"</string>
     <string name="quick_settings_wifi_detail_empty_text" msgid="269990350383909226">"Nav pieejams neviens Wi-Fi tīkls."</string>
     <string name="quick_settings_wifi_secondary_label_transient" msgid="7748206246119760554">"Notiek ieslēgšana…"</string>
-    <string name="quick_settings_cast_title" msgid="7709016546426454729">"Apraide"</string>
+    <string name="quick_settings_cast_title" msgid="6954684227605751758">"Ekrāna apraide"</string>
     <string name="quick_settings_casting" msgid="6601710681033353316">"Notiek apraide…"</string>
     <string name="quick_settings_cast_device_default_name" msgid="5367253104742382945">"Nenosaukta ierīce"</string>
     <string name="quick_settings_cast_device_default_description" msgid="2484573682378634413">"Gatavs apraidei"</string>
@@ -440,7 +440,8 @@
     <string name="battery_saver_notification_title" msgid="8614079794522291840">"Akumulatora jaudas taupīšanas režīms ir ieslēgts"</string>
     <string name="battery_saver_notification_text" msgid="820318788126672692">"Samazina veiktspēju un fona datus"</string>
     <string name="battery_saver_notification_action_text" msgid="132118784269455533">"Izslēgt akumulatora jaudas taupīšanas režīmu"</string>
-    <string name="media_projection_dialog_text" msgid="3071431025448218928">"<xliff:g id="APP_SEEKING_PERMISSION">%s</xliff:g> sāks uzņemt visu, kas tiks rādīts jūsu ekrānā."</string>
+    <string name="media_projection_dialog_text" msgid="1443042478990422751">"<xliff:g id="APP_SEEKING_PERMISSION">%s</xliff:g> sāks uzņemt visu, kas ir redzams jūsu ekrānā, tostarp paziņojumus, paroles, fotoattēlus, ziņojumus un maksājumu informāciju."</string>
+    <string name="media_projection_dialog_title" msgid="7574971526813630219">"Vai atļaut <xliff:g id="APP_SEEKING_PERMISSION">%s</xliff:g> ierakstīt vai apraidīt jūsu ekrāna saturu?"</string>
     <string name="media_projection_remember_text" msgid="3103510882172746752">"Vairs nerādīt"</string>
     <string name="clear_all_notifications_text" msgid="814192889771462828">"Dzēst visu"</string>
     <string name="manage_notifications_text" msgid="2386728145475108753">"Pārvaldīt"</string>
@@ -819,6 +820,9 @@
     <string name="high_temp_title" msgid="4589508026407318374">"Tālrunis kļūst silts"</string>
     <string name="high_temp_notif_message" msgid="5642466103153429279">"Dažas funkcijas ir ierobežotas, kamēr tālrunis mēģina atdzist"</string>
     <string name="high_temp_dialog_message" msgid="6840700639374113553">"Jūsu tālrunis automātiski mēģinās atdzist. Jūs joprojām varat izmantot tālruni, taču tas, iespējams, darbosies lēnāk.\n\nTiklīdz tālrunis būs atdzisis, tas darbosies normāli."</string>
+    <string name="high_temp_alarm_title" msgid="442812040762745210">"Lādētāja atvienošana"</string>
+    <string name="high_temp_alarm_notify_message" msgid="1802871059489414932">"Uzlādējot šo ierīci, radās problēma. Atvienojiet strāvas adapteri. Esiet uzmanīgs — vads var būt uzsilis."</string>
+    <string name="high_temp_alarm_help_care_steps" msgid="3631075329318070726">"Skatīt apkopes norādījumus"</string>
     <string name="lockscreen_shortcut_left" msgid="2182769107618938629">"Saīsne kreisajā pusē"</string>
     <string name="lockscreen_shortcut_right" msgid="3328683699505226536">"Saīsne labajā pusē"</string>
     <string name="lockscreen_unlock_left" msgid="2043092136246951985">"Saīsne kreisajā pusē arī atbloķē"</string>
diff --git a/packages/SystemUI/res/values-mk/strings.xml b/packages/SystemUI/res/values-mk/strings.xml
index 40dc261..eff3492 100644
--- a/packages/SystemUI/res/values-mk/strings.xml
+++ b/packages/SystemUI/res/values-mk/strings.xml
@@ -325,7 +325,7 @@
     <string name="quick_settings_wifi_on_label" msgid="7607810331387031235">"Вклучено е Wi-Fi"</string>
     <string name="quick_settings_wifi_detail_empty_text" msgid="269990350383909226">"Нема достапни Wi-Fi мрежи"</string>
     <string name="quick_settings_wifi_secondary_label_transient" msgid="7748206246119760554">"Се вклучува…"</string>
-    <string name="quick_settings_cast_title" msgid="7709016546426454729">"Емитувај"</string>
+    <string name="quick_settings_cast_title" msgid="6954684227605751758">"Емитување на екранот"</string>
     <string name="quick_settings_casting" msgid="6601710681033353316">"Емитување"</string>
     <string name="quick_settings_cast_device_default_name" msgid="5367253104742382945">"Неименуван уред"</string>
     <string name="quick_settings_cast_device_default_description" msgid="2484573682378634413">"Подготвено за емитување"</string>
@@ -437,7 +437,8 @@
     <string name="battery_saver_notification_title" msgid="8614079794522291840">"Штедачот на батерија е вклучен"</string>
     <string name="battery_saver_notification_text" msgid="820318788126672692">"Ја намалува изведбата и податоците во заднина"</string>
     <string name="battery_saver_notification_action_text" msgid="132118784269455533">"Исклучете го штедачот на батерија"</string>
-    <string name="media_projection_dialog_text" msgid="3071431025448218928">"<xliff:g id="APP_SEEKING_PERMISSION">%s</xliff:g> ќе започне да презема сѐ што се прикажува на вашиот екран."</string>
+    <string name="media_projection_dialog_text" msgid="1443042478990422751">"<xliff:g id="APP_SEEKING_PERMISSION">%s</xliff:g> ќе започне со снимање на сѐ што се наоѓа на екранот, вклучувајќи известувања, лозинки, фотографии, пораки и информации за плаќање."</string>
+    <string name="media_projection_dialog_title" msgid="7574971526813630219">"Да ѝ се дозволи на <xliff:g id="APP_SEEKING_PERMISSION">%s</xliff:g> да снима или емитува на вашиот екран?"</string>
     <string name="media_projection_remember_text" msgid="3103510882172746752">"Не покажувај повторно"</string>
     <string name="clear_all_notifications_text" msgid="814192889771462828">"Исчисти сè"</string>
     <string name="manage_notifications_text" msgid="2386728145475108753">"Управувајте"</string>
@@ -814,6 +815,9 @@
     <string name="high_temp_title" msgid="4589508026407318374">"Телефонот се загрева"</string>
     <string name="high_temp_notif_message" msgid="5642466103153429279">"Некои функции се ограничени додека телефонот се лади"</string>
     <string name="high_temp_dialog_message" msgid="6840700639374113553">"Телефонот автоматски ќе се обиде да се олади. Вие сепак ќе може да го користите, но тој може да работи побавно.\n\nОткако ќе се олади, ќе работи нормално."</string>
+    <string name="high_temp_alarm_title" msgid="442812040762745210">"Исклучете го полначот"</string>
+    <string name="high_temp_alarm_notify_message" msgid="1802871059489414932">"Има проблем со полнењето на уредов. Исклучете го адаптерот за напојување и внимавајте зошто кабелот може да е топол."</string>
+    <string name="high_temp_alarm_help_care_steps" msgid="3631075329318070726">"Прикажи ги чекорите за грижа за уредот"</string>
     <string name="lockscreen_shortcut_left" msgid="2182769107618938629">"Лева кратенка"</string>
     <string name="lockscreen_shortcut_right" msgid="3328683699505226536">"Десна кратенка"</string>
     <string name="lockscreen_unlock_left" msgid="2043092136246951985">"Левата кратенка исто така отклучува"</string>
diff --git a/packages/SystemUI/res/values-ml/strings.xml b/packages/SystemUI/res/values-ml/strings.xml
index f5422d8..c640426 100644
--- a/packages/SystemUI/res/values-ml/strings.xml
+++ b/packages/SystemUI/res/values-ml/strings.xml
@@ -325,7 +325,7 @@
     <string name="quick_settings_wifi_on_label" msgid="7607810331387031235">"വൈഫൈ ഓണാണ്"</string>
     <string name="quick_settings_wifi_detail_empty_text" msgid="269990350383909226">"വൈഫൈ നെറ്റ്‌വർക്കുകളൊന്നും ലഭ്യമല്ല"</string>
     <string name="quick_settings_wifi_secondary_label_transient" msgid="7748206246119760554">"ഓണാക്കുന്നു…"</string>
-    <string name="quick_settings_cast_title" msgid="7709016546426454729">"കാസ്‌റ്റുചെയ്യുക"</string>
+    <string name="quick_settings_cast_title" msgid="6954684227605751758">"സ്‌ക്രീൻ കാസ്‌റ്റ്"</string>
     <string name="quick_settings_casting" msgid="6601710681033353316">"കാസ്റ്റുചെയ്യുന്നു"</string>
     <string name="quick_settings_cast_device_default_name" msgid="5367253104742382945">"പേരിടാത്ത ഉപകരണം"</string>
     <string name="quick_settings_cast_device_default_description" msgid="2484573682378634413">"കാസ്‌റ്റ് ചെയ്യാൻ തയ്യാറാണ്"</string>
@@ -437,7 +437,8 @@
     <string name="battery_saver_notification_title" msgid="8614079794522291840">"ബാറ്ററി ലാഭിക്കൽ ഓണാണ്"</string>
     <string name="battery_saver_notification_text" msgid="820318788126672692">"പ്രവർത്തനവും പശ്ചാത്തല ഡാറ്റയും കുറയ്‌ക്കുന്നു"</string>
     <string name="battery_saver_notification_action_text" msgid="132118784269455533">"ബാറ്ററി ലാഭിക്കൽ ഓഫാക്കുക"</string>
-    <string name="media_projection_dialog_text" msgid="3071431025448218928">"നിങ്ങളുടെ സ്ക്രീനിൽ പ്രദർശിപ്പിച്ചിരിക്കുന്ന എല്ലാ കാര്യങ്ങളും <xliff:g id="APP_SEEKING_PERMISSION">%s</xliff:g> ക്യാപ്‌ചർ ചെയ്യുന്നത് ആരംഭിക്കും."</string>
+    <string name="media_projection_dialog_text" msgid="1443042478990422751">"അറിയിപ്പുകൾ, പാസ്‌വേഡുകൾ, ഫോട്ടോകൾ, സന്ദേശങ്ങൾ, പേയ്മെന്റ് വിവരങ്ങൾ എന്നിവയുൾപ്പെടെ നിങ്ങളുടെ സ്‌ക്രീനിലെ എന്തുകാര്യവും <xliff:g id="APP_SEEKING_PERMISSION">%s</xliff:g> ക്യാപ്‌ചർ ചെയ്‌ത്‌ തുടങ്ങും."</string>
+    <string name="media_projection_dialog_title" msgid="7574971526813630219">"നിങ്ങളുടെ സ്ക്രീൻ റെക്കോർഡ് ചെയ്യാനോ കാസ്റ്റ് ചെയ്യാനോ <xliff:g id="APP_SEEKING_PERMISSION">%s</xliff:g>-നെ അനുവദിക്കണോ?"</string>
     <string name="media_projection_remember_text" msgid="3103510882172746752">"വീണ്ടും കാണിക്കരുത്"</string>
     <string name="clear_all_notifications_text" msgid="814192889771462828">"എല്ലാം മായ്‌ക്കുക"</string>
     <string name="manage_notifications_text" msgid="2386728145475108753">"മാനേജ് ചെയ്യുക"</string>
@@ -814,6 +815,9 @@
     <string name="high_temp_title" msgid="4589508026407318374">"ഫോൺ ചൂടായിക്കൊണ്ടിരിക്കുന്നു"</string>
     <string name="high_temp_notif_message" msgid="5642466103153429279">"ഫോൺ തണുത്തുകൊണ്ടിരിക്കുമ്പോൾ ചില ഫീച്ചറുകൾ പരിമിതപ്പെടുത്തപ്പെടും"</string>
     <string name="high_temp_dialog_message" msgid="6840700639374113553">"നിങ്ങളുടെ ഫോൺ സ്വയമേവ തണുക്കാൻ ശ്രമിക്കും. നിങ്ങൾക്ക് അപ്പോഴും ഫോൺ ഉപയോഗിക്കാമെങ്കിലും പ്രവർത്തനം മന്ദഗതിയിലായിരിക്കും.\n\nതണുത്തുകഴിഞ്ഞാൽ, ഫോൺ സാധാരണ ഗതിയിൽ പ്രവർത്തിക്കും."</string>
+    <string name="high_temp_alarm_title" msgid="442812040762745210">"ചാർജർ അൺപ്ലഗ് ചെയ്യുക"</string>
+    <string name="high_temp_alarm_notify_message" msgid="1802871059489414932">"ഈ ഉപകരണം ചാർജ് ചെയ്യുന്നതിൽ തടസ്സമുണ്ട്. പവർ അഡാപ്റ്റർ അൺപ്ലഗ് ചെയ്യുക, കേബിളിന് ചൂടുണ്ടായിരിക്കുമെന്നതിനാൽ ശ്രദ്ധിക്കണം."</string>
+    <string name="high_temp_alarm_help_care_steps" msgid="3631075329318070726">"മുൻകരുതൽ നടപടികൾ കാണുക"</string>
     <string name="lockscreen_shortcut_left" msgid="2182769107618938629">"ഇടത് കുറുക്കുവഴി"</string>
     <string name="lockscreen_shortcut_right" msgid="3328683699505226536">"വലത് കുറുക്കുവഴി"</string>
     <string name="lockscreen_unlock_left" msgid="2043092136246951985">"ഇടത് കുറുക്കുവഴിയും അൺലോക്കുചെയ്യുന്നു"</string>
diff --git a/packages/SystemUI/res/values-mn/strings.xml b/packages/SystemUI/res/values-mn/strings.xml
index 40c56b9..e73428e 100644
--- a/packages/SystemUI/res/values-mn/strings.xml
+++ b/packages/SystemUI/res/values-mn/strings.xml
@@ -325,7 +325,7 @@
     <string name="quick_settings_wifi_on_label" msgid="7607810331387031235">"Wi-Fi асаалттай"</string>
     <string name="quick_settings_wifi_detail_empty_text" msgid="269990350383909226">"Wi-Fi сүлжээ байхгүй байна"</string>
     <string name="quick_settings_wifi_secondary_label_transient" msgid="7748206246119760554">"Асааж байна…"</string>
-    <string name="quick_settings_cast_title" msgid="7709016546426454729">"Дамжуулах"</string>
+    <string name="quick_settings_cast_title" msgid="6954684227605751758">"Дэлгэцийг дамжуулах"</string>
     <string name="quick_settings_casting" msgid="6601710681033353316">"Дамжуулж байна"</string>
     <string name="quick_settings_cast_device_default_name" msgid="5367253104742382945">"Нэргүй төхөөрөмж"</string>
     <string name="quick_settings_cast_device_default_description" msgid="2484573682378634413">"Дамжуулахад бэлэн"</string>
@@ -437,7 +437,8 @@
     <string name="battery_saver_notification_title" msgid="8614079794522291840">"Тэжээл хэмнэгч асаалттай байна"</string>
     <string name="battery_saver_notification_text" msgid="820318788126672692">"Ажиллагаа болон далд датаг бууруулна"</string>
     <string name="battery_saver_notification_action_text" msgid="132118784269455533">"Тэжээл хэмнэгчийг унтраах"</string>
-    <string name="media_projection_dialog_text" msgid="3071431025448218928">"<xliff:g id="APP_SEEKING_PERMISSION">%s</xliff:g> таны дэлгэц дээр гаргасан бүх зүйлийн зургийг авч эхэлнэ."</string>
+    <string name="media_projection_dialog_text" msgid="1443042478990422751">"<xliff:g id="APP_SEEKING_PERMISSION">%s</xliff:g> мэдэгдэл, нууц үг, зураг, мессеж болон төлбөрийн мэдээлэл зэрэг таны дэлгэц дээрх бүх зүйлийн зургийг авч эхэлнэ."</string>
+    <string name="media_projection_dialog_title" msgid="7574971526813630219">"<xliff:g id="APP_SEEKING_PERMISSION">%s</xliff:g>-д таны дэлгэцийг бичих эсвэл дамжуулахыг зөвшөөрөх үү?"</string>
     <string name="media_projection_remember_text" msgid="3103510882172746752">"Дахиж үл харуулах"</string>
     <string name="clear_all_notifications_text" msgid="814192889771462828">"Бүгдийг арилгах"</string>
     <string name="manage_notifications_text" msgid="2386728145475108753">"Удирдах"</string>
@@ -814,6 +815,9 @@
     <string name="high_temp_title" msgid="4589508026407318374">"Утас халж эхэлж байна"</string>
     <string name="high_temp_notif_message" msgid="5642466103153429279">"Таны утас хөрж байх зуур зарим онцлогийг хязгаарласан"</string>
     <string name="high_temp_dialog_message" msgid="6840700639374113553">"Таны утас автоматаар хөрөх болно. Та утсаа ашиглаж болох хэдий ч удаан ажиллаж болзошгүй.\n\nТаны утас хөрсний дараагаар хэвийн ажиллана."</string>
+    <string name="high_temp_alarm_title" msgid="442812040762745210">"Цэнэглэгчийг салгана уу"</string>
+    <string name="high_temp_alarm_notify_message" msgid="1802871059489414932">"Энэ төхөөрөмжийг цэнэглэхэд асуудал гарлаа. Тэжээлийн залгуурыг салгана уу. Кабель халсан байж болзошгүй тул болгоомжтой байгаарай."</string>
+    <string name="high_temp_alarm_help_care_steps" msgid="3631075329318070726">"Хянамж болгоомжийн алхмыг харна уу"</string>
     <string name="lockscreen_shortcut_left" msgid="2182769107618938629">"Зүүн товчлол"</string>
     <string name="lockscreen_shortcut_right" msgid="3328683699505226536">"Баруун товчлол"</string>
     <string name="lockscreen_unlock_left" msgid="2043092136246951985">"Зүүн товчлол нь мөн түгжээг тайлдаг"</string>
diff --git a/packages/SystemUI/res/values-mr/strings.xml b/packages/SystemUI/res/values-mr/strings.xml
index a8104c2..7e58a39 100644
--- a/packages/SystemUI/res/values-mr/strings.xml
+++ b/packages/SystemUI/res/values-mr/strings.xml
@@ -325,7 +325,7 @@
     <string name="quick_settings_wifi_on_label" msgid="7607810331387031235">"वाय-फाय चालू"</string>
     <string name="quick_settings_wifi_detail_empty_text" msgid="269990350383909226">"वाय-फाय नेटवर्क उपलब्‍ध नाहीत"</string>
     <string name="quick_settings_wifi_secondary_label_transient" msgid="7748206246119760554">"सुरू करत आहे…"</string>
-    <string name="quick_settings_cast_title" msgid="7709016546426454729">"कास्‍ट करा"</string>
+    <string name="quick_settings_cast_title" msgid="6954684227605751758">"स्क्रीन कास्ट करा"</string>
     <string name="quick_settings_casting" msgid="6601710681033353316">"कास्ट करत आहे"</string>
     <string name="quick_settings_cast_device_default_name" msgid="5367253104742382945">"निनावी डिव्हाइस"</string>
     <string name="quick_settings_cast_device_default_description" msgid="2484573682378634413">"कास्ट करण्यास तयार"</string>
@@ -437,7 +437,8 @@
     <string name="battery_saver_notification_title" msgid="8614079794522291840">"बॅटरी सेव्‍हर चालू आहे"</string>
     <string name="battery_saver_notification_text" msgid="820318788126672692">"कामगिरी आणि पार्श्वभूमीवरील डेटा कमी करते"</string>
     <string name="battery_saver_notification_action_text" msgid="132118784269455533">"बॅटरी सेव्हर बंद करा"</string>
-    <string name="media_projection_dialog_text" msgid="3071431025448218928">"<xliff:g id="APP_SEEKING_PERMISSION">%s</xliff:g> आपल्‍या स्‍क्रीनवर प्रदर्शित होणारी प्रत्‍येक गोष्‍ट कॅप्‍चर करणे प्रारंभ करेल."</string>
+    <string name="media_projection_dialog_text" msgid="1443042478990422751">"<xliff:g id="APP_SEEKING_PERMISSION">%s</xliff:g> सूचना, पासवर्ड, फोटो, मेसेज आणि पेमेंट माहितीसह तुमच्या स्क्रीनवरील प्रत्येक गोष्ट कॅप्चर करण्यास सुरुवात करेल."</string>
+    <string name="media_projection_dialog_title" msgid="7574971526813630219">"तुमची स्क्रीन रेकॉर्ड किंवा कास्ट करण्याची <xliff:g id="APP_SEEKING_PERMISSION">%s</xliff:g> ला अनुमती द्यायची का?"</string>
     <string name="media_projection_remember_text" msgid="3103510882172746752">"पुन्हा दर्शवू नका"</string>
     <string name="clear_all_notifications_text" msgid="814192889771462828">"सर्व साफ करा"</string>
     <string name="manage_notifications_text" msgid="2386728145475108753">"व्यवस्थापित करा"</string>
@@ -814,6 +815,9 @@
     <string name="high_temp_title" msgid="4589508026407318374">"फोन ऊष्ण होत आहे"</string>
     <string name="high_temp_notif_message" msgid="5642466103153429279">"फोन थंड होत असताना काही वैशिष्‍ट्ये मर्यादित असतात"</string>
     <string name="high_temp_dialog_message" msgid="6840700639374113553">"तुमचा फोन स्वयंचलितपणे थंड होईल. तुम्ही अद्यापही तुमचा फोन वापरू शकता परंतु तो कदाचित धीमेपणे कार्य करेल.\n\nतुमचा फोन एकदा थंड झाला की, तो सामान्यपणे कार्य करेल."</string>
+    <string name="high_temp_alarm_title" msgid="442812040762745210">"चार्जर अनप्लग करा"</string>
+    <string name="high_temp_alarm_notify_message" msgid="1802871059489414932">"हे डिव्हाइस चार्ज करताना समस्या आहे. पॉवर अडॅप्टर अनप्लग करा आणि शक्य तेवढी काळजी घ्या कदाचित केबल गरम असू शकते."</string>
+    <string name="high_temp_alarm_help_care_steps" msgid="3631075329318070726">"काय काळजी घ्यावी ते पाहा"</string>
     <string name="lockscreen_shortcut_left" msgid="2182769107618938629">"डावा शॉर्टकट"</string>
     <string name="lockscreen_shortcut_right" msgid="3328683699505226536">"उजवा शॉर्टकट"</string>
     <string name="lockscreen_unlock_left" msgid="2043092136246951985">"डावा शॉर्टकट देखील अनलॉक करतो"</string>
diff --git a/packages/SystemUI/res/values-ms/strings.xml b/packages/SystemUI/res/values-ms/strings.xml
index 74a5063..63f2e76 100644
--- a/packages/SystemUI/res/values-ms/strings.xml
+++ b/packages/SystemUI/res/values-ms/strings.xml
@@ -325,7 +325,7 @@
     <string name="quick_settings_wifi_on_label" msgid="7607810331387031235">"Wi-Fi Dihidupkan"</string>
     <string name="quick_settings_wifi_detail_empty_text" msgid="269990350383909226">"Tiada rangkaian Wi-Fi tersedia"</string>
     <string name="quick_settings_wifi_secondary_label_transient" msgid="7748206246119760554">"Menghidupkan…"</string>
-    <string name="quick_settings_cast_title" msgid="7709016546426454729">"Hantar"</string>
+    <string name="quick_settings_cast_title" msgid="6954684227605751758">"Penghantaran Skrin"</string>
     <string name="quick_settings_casting" msgid="6601710681033353316">"Menghantar"</string>
     <string name="quick_settings_cast_device_default_name" msgid="5367253104742382945">"Peranti tidak bernama"</string>
     <string name="quick_settings_cast_device_default_description" msgid="2484573682378634413">"Bersedia untuk menghantar"</string>
@@ -437,7 +437,8 @@
     <string name="battery_saver_notification_title" msgid="8614079794522291840">"Penjimat Bateri dihidupkan"</string>
     <string name="battery_saver_notification_text" msgid="820318788126672692">"Mengurangkan prestasi dan data latar belakang"</string>
     <string name="battery_saver_notification_action_text" msgid="132118784269455533">"Matikan Penjimat Bateri"</string>
-    <string name="media_projection_dialog_text" msgid="3071431025448218928">"<xliff:g id="APP_SEEKING_PERMISSION">%s</xliff:g> akan mula mengabadikan semua yang dipaparkan pada skrin anda.."</string>
+    <string name="media_projection_dialog_text" msgid="1443042478990422751">"<xliff:g id="APP_SEEKING_PERMISSION">%s</xliff:g> akan mula merakam semua item pada skrin anda, termasuk pemberitahuan, kata laluan, foto, mesej dan maklumat pembayaran."</string>
+    <string name="media_projection_dialog_title" msgid="7574971526813630219">"Benarkan <xliff:g id="APP_SEEKING_PERMISSION">%s</xliff:g> merakam atau menghantar skrin anda?"</string>
     <string name="media_projection_remember_text" msgid="3103510882172746752">"Jangan tunjukkan lagi"</string>
     <string name="clear_all_notifications_text" msgid="814192889771462828">"Kosongkan semua"</string>
     <string name="manage_notifications_text" msgid="2386728145475108753">"Urus"</string>
@@ -814,6 +815,9 @@
     <string name="high_temp_title" msgid="4589508026407318374">"Telefon semakin panas"</string>
     <string name="high_temp_notif_message" msgid="5642466103153429279">"Sesetengah ciri adalah terhad semasa telefon menyejuk"</string>
     <string name="high_temp_dialog_message" msgid="6840700639374113553">"Telefon anda akan cuba menyejuk secara automatik. Anda masih dapat menggunakan telefon itu tetapi telefon tersebut mungkin berjalan lebih perlahan.\n\nSetelah telefon anda sejuk, telefon itu akan berjalan seperti biasa."</string>
+    <string name="high_temp_alarm_title" msgid="442812040762745210">"Cabut palam pengejas"</string>
+    <string name="high_temp_alarm_notify_message" msgid="1802871059489414932">"Terdapat isu semasa mengecas peranti ini. Cabut palam penyesuai kuasa. Berhati-hati kerana kabel mungkin hangat."</string>
+    <string name="high_temp_alarm_help_care_steps" msgid="3631075329318070726">"Lihat langkah penjagaan"</string>
     <string name="lockscreen_shortcut_left" msgid="2182769107618938629">"Pintasan kiri"</string>
     <string name="lockscreen_shortcut_right" msgid="3328683699505226536">"Pintasan kanan"</string>
     <string name="lockscreen_unlock_left" msgid="2043092136246951985">"Pintasan kiri juga membuka kunci"</string>
diff --git a/packages/SystemUI/res/values-my/strings.xml b/packages/SystemUI/res/values-my/strings.xml
index a7b5189..b167375 100644
--- a/packages/SystemUI/res/values-my/strings.xml
+++ b/packages/SystemUI/res/values-my/strings.xml
@@ -325,7 +325,7 @@
     <string name="quick_settings_wifi_on_label" msgid="7607810331387031235">"Wi-Fi ကိုဖွင့်ပါ"</string>
     <string name="quick_settings_wifi_detail_empty_text" msgid="269990350383909226">"Wi-Fi ကွန်ရက် မရှိပါ"</string>
     <string name="quick_settings_wifi_secondary_label_transient" msgid="7748206246119760554">"ဖွင့်နေသည်…"</string>
-    <string name="quick_settings_cast_title" msgid="7709016546426454729">"Cast"</string>
+    <string name="quick_settings_cast_title" msgid="6954684227605751758">"မျက်နှာပြင် ကာ့စ်လုပ်ခြင်း"</string>
     <string name="quick_settings_casting" msgid="6601710681033353316">"ကာစ်တင်"</string>
     <string name="quick_settings_cast_device_default_name" msgid="5367253104742382945">"အမည်မတပ် ကိရိယာ"</string>
     <string name="quick_settings_cast_device_default_description" msgid="2484573682378634413">"ကာစ်တ် လုပ်ရန် အသင့် ရှိနေပြီ"</string>
@@ -437,7 +437,8 @@
     <string name="battery_saver_notification_title" msgid="8614079794522291840">"ဘက်ထရီ အားထိန်းကို ဖွင့်ထားခြင်း"</string>
     <string name="battery_saver_notification_text" msgid="820318788126672692">"လုပ်ကိုင်မှုကို လျှော့ချလျက် နောက်ခံ ဒေတာကို ကန့်သတ်သည်"</string>
     <string name="battery_saver_notification_action_text" msgid="132118784269455533">"ဘက်ထရီ အားထိန်းကို ပိတ်ရန်"</string>
-    <string name="media_projection_dialog_text" msgid="3071431025448218928">"<xliff:g id="APP_SEEKING_PERMISSION">%s</xliff:g> က သင်၏ မျက်နှာပြင် ပေါ်မှာ ပြသထားသည့် အရာတိုင်းကို စတင် ဖမ်းယူမည်။"</string>
+    <string name="media_projection_dialog_text" msgid="1443042478990422751">"<xliff:g id="APP_SEEKING_PERMISSION">%s</xliff:g> သည် အကြောင်းကြားချက်၊ စကားဝှက်၊ ဓာတ်ပုံ၊ မက်ဆေ့ဂျ်နှင့် ငွေပေးချေမှု အချက်အလက်များ အပါအဝင် သင့်ဖန်သားပြင်ပေါ်ရှိ အရာအားလုံးကို စတင် ဖမ်းယူပါမည်။"</string>
+    <string name="media_projection_dialog_title" msgid="7574971526813630219">"သင့်ဖန်သားပြင် ရိုက်ကူးရန် သို့မဟုတ် ကာ့စ်လုပ်ရန် <xliff:g id="APP_SEEKING_PERMISSION">%s</xliff:g> ကို ခွင့်ပြုမလား။"</string>
     <string name="media_projection_remember_text" msgid="3103510882172746752">"နောက်ထပ် မပြပါနှင့်"</string>
     <string name="clear_all_notifications_text" msgid="814192889771462828">"အားလုံး ဖယ်ရှားရန်"</string>
     <string name="manage_notifications_text" msgid="2386728145475108753">"စီမံရန်"</string>
@@ -814,6 +815,9 @@
     <string name="high_temp_title" msgid="4589508026407318374">"ဖုန်း ပူနွေးလာပါပြီ"</string>
     <string name="high_temp_notif_message" msgid="5642466103153429279">"ဖုန်းကို အေးအောင်ပြုလုပ်နေစဉ်တွင် အချို့ဝန်ဆောင်မှုများကို ကန့်သတ်ထားပါသည်"</string>
     <string name="high_temp_dialog_message" msgid="6840700639374113553">"သင့်ဖုန်းသည် အလိုအလျောက် ပြန်အေးသွားပါလိမ့်မည်။ ဖုန်းကို အသုံးပြုနိုင်ပါသေးသည် သို့သော် ပိုနှေးနိုင်ပါသည်။\n\nသင့်ဖုန်း အေးသွားသည်နှင့် ပုံမှန်အတိုင်း ပြန်အလုပ်လုပ်ပါလိမ့်မည်။"</string>
+    <string name="high_temp_alarm_title" msgid="442812040762745210">"အားသွင်းကိရိယာ ပလပ်ဖြုတ်ပါ"</string>
+    <string name="high_temp_alarm_notify_message" msgid="1802871059489414932">"ဤစက်ပစ္စည်းကို အားသွင်းရာတွင် ပြဿနာရှိနေသည်။ ပါဝါ ကြားခံကိရိယာကို ပလပ်ဖြုတ်ပါ။ ကေဘယ်ကြိုး ပူနွေးနေနိုင်သဖြင့် သတိထားပါ။"</string>
+    <string name="high_temp_alarm_help_care_steps" msgid="3631075329318070726">"ဂရုပြုစရာ အဆင့်များ ကြည့်ရန်"</string>
     <string name="lockscreen_shortcut_left" msgid="2182769107618938629">"လက်ဝဲ ဖြတ်လမ်းလင့်ခ်"</string>
     <string name="lockscreen_shortcut_right" msgid="3328683699505226536">"လက်ယာ ဖြတ်လမ်းလင့်ခ်"</string>
     <string name="lockscreen_unlock_left" msgid="2043092136246951985">"လက်ဝဲ ဖြတ်လမ်းလင့်ခ်ဖြင့်လည်း လော့ခ်ဖွင့်ရန်"</string>
diff --git a/packages/SystemUI/res/values-nb/strings.xml b/packages/SystemUI/res/values-nb/strings.xml
index dbe4718..bb86aab 100644
--- a/packages/SystemUI/res/values-nb/strings.xml
+++ b/packages/SystemUI/res/values-nb/strings.xml
@@ -325,7 +325,7 @@
     <string name="quick_settings_wifi_on_label" msgid="7607810331387031235">"Wi-Fi er på"</string>
     <string name="quick_settings_wifi_detail_empty_text" msgid="269990350383909226">"Ingen tilgjengelige Wi-Fi-nettverk"</string>
     <string name="quick_settings_wifi_secondary_label_transient" msgid="7748206246119760554">"Slår på …"</string>
-    <string name="quick_settings_cast_title" msgid="7709016546426454729">"Cast"</string>
+    <string name="quick_settings_cast_title" msgid="6954684227605751758">"Skjermcasting"</string>
     <string name="quick_settings_casting" msgid="6601710681033353316">"Casting"</string>
     <string name="quick_settings_cast_device_default_name" msgid="5367253104742382945">"Enhet uten navn"</string>
     <string name="quick_settings_cast_device_default_description" msgid="2484573682378634413">"Klar til å caste"</string>
@@ -437,7 +437,8 @@
     <string name="battery_saver_notification_title" msgid="8614079794522291840">"Batterisparing er på"</string>
     <string name="battery_saver_notification_text" msgid="820318788126672692">"Reduserer ytelsen og begrenser bakgrunnsdataene"</string>
     <string name="battery_saver_notification_action_text" msgid="132118784269455533">"Slå av batterisparing"</string>
-    <string name="media_projection_dialog_text" msgid="3071431025448218928">"<xliff:g id="APP_SEEKING_PERMISSION">%s</xliff:g> tar opp alt som vies på skjermen din."</string>
+    <string name="media_projection_dialog_text" msgid="1443042478990422751">"<xliff:g id="APP_SEEKING_PERMISSION">%s</xliff:g> begynner å ta opp alt på skjermen din, inkludert varsler, passord, bilder, meldinger og betalingsopplysninger."</string>
+    <string name="media_projection_dialog_title" msgid="7574971526813630219">"Vil du tillate at <xliff:g id="APP_SEEKING_PERMISSION">%s</xliff:g> tar opp eller caster skjermen din?"</string>
     <string name="media_projection_remember_text" msgid="3103510882172746752">"Ikke vis igjen"</string>
     <string name="clear_all_notifications_text" msgid="814192889771462828">"Fjern alt"</string>
     <string name="manage_notifications_text" msgid="2386728145475108753">"Administrer"</string>
@@ -814,6 +815,9 @@
     <string name="high_temp_title" msgid="4589508026407318374">"Telefonen begynner å bli varm"</string>
     <string name="high_temp_notif_message" msgid="5642466103153429279">"Enkelte funksjoner er begrenset mens telefonen kjøles ned"</string>
     <string name="high_temp_dialog_message" msgid="6840700639374113553">"Telefonen din kommer til å prøve å kjøle seg ned automatisk. Du kan fremdeles bruke telefonen, men den kjører muligens saktere.\n\nTelefonen kommer til å kjøre som normalt, når den har kjølt seg ned."</string>
+    <string name="high_temp_alarm_title" msgid="442812040762745210">"Koble fra laderen"</string>
+    <string name="high_temp_alarm_notify_message" msgid="1802871059489414932">"Det oppsto et problem med lading av enheten. Koble fra strømadapteren, og vær forsiktig, kabelen kan være varm."</string>
+    <string name="high_temp_alarm_help_care_steps" msgid="3631075329318070726">"Se vedlikeholdstrinnene"</string>
     <string name="lockscreen_shortcut_left" msgid="2182769107618938629">"Venstre hurtigtast"</string>
     <string name="lockscreen_shortcut_right" msgid="3328683699505226536">"Høyre hurtigtast"</string>
     <string name="lockscreen_unlock_left" msgid="2043092136246951985">"Venstre hurtigtast låser også opp"</string>
diff --git a/packages/SystemUI/res/values-ne/strings.xml b/packages/SystemUI/res/values-ne/strings.xml
index 2a3d9e0..7db0aa3 100644
--- a/packages/SystemUI/res/values-ne/strings.xml
+++ b/packages/SystemUI/res/values-ne/strings.xml
@@ -325,7 +325,7 @@
     <string name="quick_settings_wifi_on_label" msgid="7607810331387031235">"Wi-Fi सक्रिय छ"</string>
     <string name="quick_settings_wifi_detail_empty_text" msgid="269990350383909226">"Wi-Fi नेटवर्क अनुपलब्ध"</string>
     <string name="quick_settings_wifi_secondary_label_transient" msgid="7748206246119760554">"सक्रिय गर्दै…"</string>
-    <string name="quick_settings_cast_title" msgid="7709016546426454729">"Cast"</string>
+    <string name="quick_settings_cast_title" msgid="6954684227605751758">"स्क्रिन Cast"</string>
     <string name="quick_settings_casting" msgid="6601710681033353316">"प्रसारण गर्दै"</string>
     <string name="quick_settings_cast_device_default_name" msgid="5367253104742382945">"बेनाम उपकरण"</string>
     <string name="quick_settings_cast_device_default_description" msgid="2484573682378634413">"प्रसारण गर्न तयार"</string>
@@ -437,7 +437,8 @@
     <string name="battery_saver_notification_title" msgid="8614079794522291840">"ब्याट्री सेभर सक्रिय छ"</string>
     <string name="battery_saver_notification_text" msgid="820318788126672692">"प्रदर्शन र पृष्ठभूमि डेटा घटाउँनुहोस्"</string>
     <string name="battery_saver_notification_action_text" msgid="132118784269455533">"ब्याट्री सेभर निष्क्रिय पार्नुहोस्"</string>
-    <string name="media_projection_dialog_text" msgid="3071431025448218928">"<xliff:g id="APP_SEEKING_PERMISSION">%s</xliff:g> ले आफ्नो स्क्रीनमा प्रदर्शित हुने सबै खिच्न शुरू गर्ने छ।"</string>
+    <string name="media_projection_dialog_text" msgid="1443042478990422751">"<xliff:g id="APP_SEEKING_PERMISSION">%s</xliff:g> ले सूचना, पासवर्ड, तस्बिर, सन्देश र भुक्तानीसम्बन्धी जानकारीलगायत तपाईंको स्क्रिनमा रहेका सबै कुरा खिच्न थाल्ने छ।"</string>
+    <string name="media_projection_dialog_title" msgid="7574971526813630219">"<xliff:g id="APP_SEEKING_PERMISSION">%s</xliff:g> लाई तपाईंको स्क्रिन रेकर्ड गर्न वा cast गर्न दिने हो?"</string>
     <string name="media_projection_remember_text" msgid="3103510882172746752">"फेरि नदेखाउनुहोस्"</string>
     <string name="clear_all_notifications_text" msgid="814192889771462828">"सबै हटाउनुहोस्"</string>
     <string name="manage_notifications_text" msgid="2386728145475108753">"व्यवस्थित गर्नुहोस्"</string>
@@ -814,6 +815,9 @@
     <string name="high_temp_title" msgid="4589508026407318374">"फोन तातो भइरहेको छ"</string>
     <string name="high_temp_notif_message" msgid="5642466103153429279">"फोन चिसो हुँदै गर्दा केही विशेषताहरूलाई सीमित गरिन्छ"</string>
     <string name="high_temp_dialog_message" msgid="6840700639374113553">"तपाईंको फोन स्वतः चिसो हुने प्रयास गर्ने छ। तपाईं अझै पनि आफ्नो फोनको प्रयोग गर्न सक्नुहुन्छ तर त्यो अझ ढिलो चल्न सक्छ।\n\nचिसो भएपछि तपाईंको फोन सामान्य गतिमा चल्नेछ।"</string>
+    <string name="high_temp_alarm_title" msgid="442812040762745210">"चार्जर अनप्लग गर्नुहोस्‌"</string>
+    <string name="high_temp_alarm_notify_message" msgid="1802871059489414932">"यो यन्त्र चार्ज गर्दा कुनै समस्या भयो। पावर एडाप्टर अनप्लग गर्नुहोस्‌ र केबल तातो हुन सक्ने भएकाले ध्यान दिनुहोस्‌।"</string>
+    <string name="high_temp_alarm_help_care_steps" msgid="3631075329318070726">"हेरचाहसम्बन्धी चरणहरू हेर्नुहोस्‌"</string>
     <string name="lockscreen_shortcut_left" msgid="2182769107618938629">"बायाँतिरको सर्टकट"</string>
     <string name="lockscreen_shortcut_right" msgid="3328683699505226536">"दायाँतिरको सर्टकट"</string>
     <string name="lockscreen_unlock_left" msgid="2043092136246951985">"बायाँतिरको सर्टकटले पनि अनलक गर्छ"</string>
diff --git a/packages/SystemUI/res/values-nl/strings.xml b/packages/SystemUI/res/values-nl/strings.xml
index 8dca672..fe0ee74 100644
--- a/packages/SystemUI/res/values-nl/strings.xml
+++ b/packages/SystemUI/res/values-nl/strings.xml
@@ -325,7 +325,7 @@
     <string name="quick_settings_wifi_on_label" msgid="7607810331387031235">"Wifi aan"</string>
     <string name="quick_settings_wifi_detail_empty_text" msgid="269990350383909226">"Geen wifi-netwerken beschikbaar"</string>
     <string name="quick_settings_wifi_secondary_label_transient" msgid="7748206246119760554">"Inschakelen..."</string>
-    <string name="quick_settings_cast_title" msgid="7709016546426454729">"Casten"</string>
+    <string name="quick_settings_cast_title" msgid="6954684227605751758">"Screencast"</string>
     <string name="quick_settings_casting" msgid="6601710681033353316">"Casten"</string>
     <string name="quick_settings_cast_device_default_name" msgid="5367253104742382945">"Naamloos apparaat"</string>
     <string name="quick_settings_cast_device_default_description" msgid="2484573682378634413">"Klaar om te casten"</string>
@@ -437,7 +437,8 @@
     <string name="battery_saver_notification_title" msgid="8614079794522291840">"Batterijbesparing aan"</string>
     <string name="battery_saver_notification_text" msgid="820318788126672692">"Vermindert de prestaties en achtergrondgegevens"</string>
     <string name="battery_saver_notification_action_text" msgid="132118784269455533">"Batterijbesparing uitschakelen"</string>
-    <string name="media_projection_dialog_text" msgid="3071431025448218928">"<xliff:g id="APP_SEEKING_PERMISSION">%s</xliff:g> gaat alles vastleggen dat wordt weergegeven op je scherm."</string>
+    <string name="media_projection_dialog_text" msgid="1443042478990422751">"Vanaf nu legt <xliff:g id="APP_SEEKING_PERMISSION">%s</xliff:g> alles op je scherm vast, waaronder meldingen, wachtwoorden, foto\'s, berichten en betalingsgegevens."</string>
+    <string name="media_projection_dialog_title" msgid="7574971526813630219">"<xliff:g id="APP_SEEKING_PERMISSION">%s</xliff:g> toestaan je scherm vast te leggen of te casten?"</string>
     <string name="media_projection_remember_text" msgid="3103510882172746752">"Niet opnieuw weergeven"</string>
     <string name="clear_all_notifications_text" msgid="814192889771462828">"Alles wissen"</string>
     <string name="manage_notifications_text" msgid="2386728145475108753">"Beheren"</string>
@@ -814,6 +815,9 @@
     <string name="high_temp_title" msgid="4589508026407318374">"De telefoon wordt warm"</string>
     <string name="high_temp_notif_message" msgid="5642466103153429279">"Bepaalde functies zijn beperkt terwijl de telefoon afkoelt"</string>
     <string name="high_temp_dialog_message" msgid="6840700639374113553">"Je telefoon probeert automatisch af te koelen. Je kunt je telefoon nog steeds gebruiken, maar deze kan langzamer werken.\n\nZodra de telefoon is afgekoeld, werkt deze weer normaal."</string>
+    <string name="high_temp_alarm_title" msgid="442812040762745210">"Oplader loskoppelen"</string>
+    <string name="high_temp_alarm_notify_message" msgid="1802871059489414932">"Er is een probleem met het opladen van dit apparaat. Koppel de voedingsadapter los. Wees voorzichtig, want de kabel kan warm zijn."</string>
+    <string name="high_temp_alarm_help_care_steps" msgid="3631075329318070726">"Onderhoudsstappen bekijken"</string>
     <string name="lockscreen_shortcut_left" msgid="2182769107618938629">"Snelkoppeling links"</string>
     <string name="lockscreen_shortcut_right" msgid="3328683699505226536">"Snelkoppeling rechts"</string>
     <string name="lockscreen_unlock_left" msgid="2043092136246951985">"Snelkoppeling links ontgrendelt ook"</string>
diff --git a/packages/SystemUI/res/values-or/strings.xml b/packages/SystemUI/res/values-or/strings.xml
index c7b6b18..03d4413 100644
--- a/packages/SystemUI/res/values-or/strings.xml
+++ b/packages/SystemUI/res/values-or/strings.xml
@@ -325,7 +325,7 @@
     <string name="quick_settings_wifi_on_label" msgid="7607810331387031235">"ୱାଇ-ଫାଇ ଅନ୍‍ ଅଛି"</string>
     <string name="quick_settings_wifi_detail_empty_text" msgid="269990350383909226">"କୌଣସି ୱାଇ-ଫାଇ ନେଟ୍‌ୱର୍କ ଉପଲବ୍ଧ ନାହିଁ"</string>
     <string name="quick_settings_wifi_secondary_label_transient" msgid="7748206246119760554">"ଅନ୍ ହେଉଛି…"</string>
-    <string name="quick_settings_cast_title" msgid="7709016546426454729">"କାଷ୍ଟ"</string>
+    <string name="quick_settings_cast_title" msgid="6954684227605751758">"ସ୍କ୍ରିନ୍ କାଷ୍ଟ"</string>
     <string name="quick_settings_casting" msgid="6601710681033353316">"କାଷ୍ଟିଙ୍ଗ"</string>
     <string name="quick_settings_cast_device_default_name" msgid="5367253104742382945">"ନାମହୀନ ଡିଭାଇସ୍‍"</string>
     <string name="quick_settings_cast_device_default_description" msgid="2484573682378634413">"କାଷ୍ଟ୍ ପାଇଁ ପ୍ରସ୍ତୁତ"</string>
@@ -437,7 +437,8 @@
     <string name="battery_saver_notification_title" msgid="8614079794522291840">"ବ୍ୟାଟେରୀ ସେଭର୍‌ ଅନ୍‌ ଅଛି"</string>
     <string name="battery_saver_notification_text" msgid="820318788126672692">"କାର୍ଯ୍ୟ ସମ୍ପାଦନ ଓ ବ୍ୟାକ୍‌ଗ୍ରାଉଣ୍ଡ ଡାଟା କମ୍ କରନ୍ତୁ"</string>
     <string name="battery_saver_notification_action_text" msgid="132118784269455533">"ବ୍ୟାଟେରୀ ସେଭର୍‌ ଅଫ୍‍ କରନ୍ତୁ"</string>
-    <string name="media_projection_dialog_text" msgid="3071431025448218928">"<xliff:g id="APP_SEEKING_PERMISSION">%s</xliff:g> ଆପଣଙ୍କ ସ୍କ୍ରୀନ୍‌ରେ ପ୍ରଦର୍ଶିତ ହେଉଥିବା ସମସ୍ତ ବସ୍ତୁକୁ କ୍ୟାପଚର୍ କରିବା ଆରମ୍ଭ ହୋଇଯିବ।"</string>
+    <string name="media_projection_dialog_text" msgid="1443042478990422751">"ବିଜ୍ଞପ୍ତି, ପାସ୍‍ୱର୍ଡ, ଫଟୋ, ମେସେଜ୍ ଏବଂ ପେମେଣ୍ଟ ସୂଚନା ସହ ଆପଣଙ୍କ ସ୍କ୍ରିନ୍‍‍ରେ ସବୁକିଛି କ୍ୟାପ୍‍ଚର୍ କରିବା <xliff:g id="APP_SEEKING_PERMISSION">%s</xliff:g> ଆରମ୍ଭ କରିବ।"</string>
+    <string name="media_projection_dialog_title" msgid="7574971526813630219">"ଆପଣଙ୍କର ସ୍କ୍ରିନ୍ କାଷ୍ଟ ବା ରେକର୍ଡ କରିବାକୁ <xliff:g id="APP_SEEKING_PERMISSION">%s</xliff:g> ଅନୁୁୁମତି ଦେବେ?"</string>
     <string name="media_projection_remember_text" msgid="3103510882172746752">"ପୁଣି ଦେଖାନ୍ତୁ ନାହିଁ"</string>
     <string name="clear_all_notifications_text" msgid="814192889771462828">"ସମସ୍ତ ଖାଲି କରନ୍ତୁ"</string>
     <string name="manage_notifications_text" msgid="2386728145475108753">"ପରିଚାଳନା କରନ୍ତୁ"</string>
@@ -814,6 +815,9 @@
     <string name="high_temp_title" msgid="4589508026407318374">"ଫୋନ୍‍ ଗରମ ହୋଇଯାଉଛି"</string>
     <string name="high_temp_notif_message" msgid="5642466103153429279">"ଫୋନ୍‍ ଥଣ୍ଡା ହେବା ସମୟରେ କିଛି ଫିଚର୍ ସୀମିତ ଭାବେ କାମ କରିଥାଏ"</string>
     <string name="high_temp_dialog_message" msgid="6840700639374113553">"ଆପଣଙ୍କ ଫୋନ୍‍ ସ୍ୱଚାଳିତ ଭାବେ ଥଣ୍ଡା ହେବାକୁ ଚେଷ୍ଟା କରିବ। ଆପଣ ତଥାପି ନିଜ ଫୋନ୍‍ ବ୍ୟବହାର କରିପାରିବେ, କିନ୍ତୁ ଏହା ଧୀରେ ଚାଲିପାରେ।\n\nଆପଣଙ୍କ ଫୋନ୍‍ ଥଣ୍ଡା ହୋଇଯିବାପରେ, ଏହା ସାମାନ୍ୟ ଭାବେ ଚାଲିବ।"</string>
+    <string name="high_temp_alarm_title" msgid="442812040762745210">"ଚାର୍ଜର୍‍ ଅନ୍‍ପ୍ଲଗ୍‌ କରନ୍ତୁ"</string>
+    <string name="high_temp_alarm_notify_message" msgid="1802871059489414932">"ଏହି ଡିଭାଇସ୍ ଚାର୍ଜ କରିବାରେ ଗୋଟିଏ ସମସ୍ୟା ଅଛି। ଯେହେତୁ କେବଳ ଗରମ ହୋଇଯାଇପାରେ, ତେଣୁ ପାୱାର୍ ଆଡପ୍ଟର୍ ଅନ୍‌ପ୍ଲଗ୍‌ କରନ୍ତୁ ଏବଂ ଯତ୍ନ ନିଅନ୍ତୁ।"</string>
+    <string name="high_temp_alarm_help_care_steps" msgid="3631075329318070726">"ସେବା ସମ୍ବନ୍ଧିତ ଷ୍ଟେପ୍‌ଗୁଡ଼ିକ ଦେଖନ୍ତୁ"</string>
     <string name="lockscreen_shortcut_left" msgid="2182769107618938629">"ବାମ ଶର୍ଟକଟ୍‍"</string>
     <string name="lockscreen_shortcut_right" msgid="3328683699505226536">"ଡାହାଣ ଶର୍ଟକଟ୍‍"</string>
     <string name="lockscreen_unlock_left" msgid="2043092136246951985">"ବାମ ଶର୍ଟକଟ୍‍ ମଧ୍ୟ ଅନଲକ୍‍ କରେ"</string>
diff --git a/packages/SystemUI/res/values-pa/strings.xml b/packages/SystemUI/res/values-pa/strings.xml
index cc39bde..acd9bd2 100644
--- a/packages/SystemUI/res/values-pa/strings.xml
+++ b/packages/SystemUI/res/values-pa/strings.xml
@@ -325,7 +325,7 @@
     <string name="quick_settings_wifi_on_label" msgid="7607810331387031235">"ਵਾਈ-ਫਾਈ ਚਾਲੂ"</string>
     <string name="quick_settings_wifi_detail_empty_text" msgid="269990350383909226">"ਕੋਈ ਵਾਈ-ਫਾਈ ਨੈੱਟਵਰਕ ਉਪਲਬਧ ਨਹੀਂ"</string>
     <string name="quick_settings_wifi_secondary_label_transient" msgid="7748206246119760554">"ਚਾਲੂ ਕੀਤਾ ਜਾ ਰਿਹਾ ਹੈ…"</string>
-    <string name="quick_settings_cast_title" msgid="7709016546426454729">"ਕਾਸਟ"</string>
+    <string name="quick_settings_cast_title" msgid="6954684227605751758">"ਸਕ੍ਰੀਨ ਕਾਸਟ"</string>
     <string name="quick_settings_casting" msgid="6601710681033353316">"ਕਾਸਟਿੰਗ"</string>
     <string name="quick_settings_cast_device_default_name" msgid="5367253104742382945">"ਬਿਨਾਂ ਨਾਮ ਦਾ ਡੀਵਾਈਸ"</string>
     <string name="quick_settings_cast_device_default_description" msgid="2484573682378634413">"ਜੋੜਨ ਲਈ ਤਿਆਰ"</string>
@@ -437,7 +437,8 @@
     <string name="battery_saver_notification_title" msgid="8614079794522291840">"ਬੈਟਰੀ ਸੇਵਰ ਚਾਲੂ ਹੈ"</string>
     <string name="battery_saver_notification_text" msgid="820318788126672692">"ਪ੍ਰਦਰਸ਼ਨ ਅਤੇ ਪਿਛੋਕੜ  ਡਾਟਾ  ਘੱਟ ਕਰਦਾ ਹੈ"</string>
     <string name="battery_saver_notification_action_text" msgid="132118784269455533">"ਬੈਟਰੀ ਸੇਵਰ ਬੰਦ ਕਰੋ"</string>
-    <string name="media_projection_dialog_text" msgid="3071431025448218928">"<xliff:g id="APP_SEEKING_PERMISSION">%s</xliff:g> ਉਹ ਸਭ ਕੁਝ ਕੈਪਚਰ ਕਰਨਾ ਸ਼ੁਰੂ ਕਰ ਦੇਵੇਗਾ, ਜੋ ਤੁਹਾਡੀ ਸਕ੍ਰੀਨ ਤੇ ਡਿਸਪਲੇ ਕੀਤਾ ਜਾਂਦਾ ਹੈ।"</string>
+    <string name="media_projection_dialog_text" msgid="1443042478990422751">"ਤੁਹਾਡੀ ਸਕ੍ਰੀਨ \'ਤੇ ਸੂਚਨਾਵਾਂ, ਪਾਸਵਰਡਾਂ, ਫ਼ੋਟੋਆਂ, ਸੁਨੇਹਿਆਂ ਅਤੇ ਭੁਗਤਾਨ ਜਾਣਕਾਰੀ ਸਮੇਤ, <xliff:g id="APP_SEEKING_PERMISSION">%s</xliff:g> ਸਭ ਕੁਝ ਕੈਪਚਰ ਕਰਨਾ ਸ਼ੁਰੂ ਕਰ ਦੇਵੇਗਾ।"</string>
+    <string name="media_projection_dialog_title" msgid="7574971526813630219">"ਕੀ <xliff:g id="APP_SEEKING_PERMISSION">%s</xliff:g> ਨੂੰ ਆਪਣੀ ਸਕ੍ਰੀਨ ਲਈ ਰਿਕਾਰਡ ਜਾਂ ਕਾਸਟ ਕਰਨ ਦੇਣਾ ਹੈ?"</string>
     <string name="media_projection_remember_text" msgid="3103510882172746752">"ਦੁਬਾਰਾ ਨਾ ਦਿਖਾਓ"</string>
     <string name="clear_all_notifications_text" msgid="814192889771462828">"ਸਭ ਕਲੀਅਰ ਕਰੋ"</string>
     <string name="manage_notifications_text" msgid="2386728145475108753">"ਪ੍ਰਬੰਧਨ ਕਰੋ"</string>
@@ -814,6 +815,9 @@
     <string name="high_temp_title" msgid="4589508026407318374">"ਫ਼ੋਨ ਗਰਮ ਹੋ ਰਿਹਾ ਹੈ"</string>
     <string name="high_temp_notif_message" msgid="5642466103153429279">"ਫ਼ੋਨ ਦੇ ਠੰਡਾ ਹੋਣ ਦੇ ਦੌਰਾਨ ਕੁਝ ਵਿਸ਼ੇਸ਼ਤਾਵਾਂ ਸੀਮਿਤ ਹੁੰਦੀਆਂ ਹਨ"</string>
     <string name="high_temp_dialog_message" msgid="6840700639374113553">"ਤੁਹਾਡਾ ਫ਼ੋਨ ਸਵੈਚਲਿਤ ਰੂਪ ਵਿੱਚ ਠੰਡਾ ਹੋਣ ਦੀ ਕੋਸ਼ਿਸ਼ ਕਰੇਗਾ। ਤੁਸੀਂ ਹਾਲੇ ਵੀ ਆਪਣੇ ਫ਼ੋਨ ਨੂੰ ਵਰਤ ਸਕਦੇ ਹੋ, ਪਰੰਤੂ ਹੋ ਸਕਦਾ ਹੈ ਕਿ ਇਹ ਵਧੇਰੇ ਹੌਲੀ ਚੱਲੇ।\n\nਇੱਕ ਵਾਰ ਠੰਡਾ ਹੋਣ ਤੋਂ ਬਾਅਦ ਤੁਹਾਡਾ ਫ਼ੋਨ ਸਧਾਰਨ ਤੌਰ \'ਤੇ ਚੱਲੇਗਾ।"</string>
+    <string name="high_temp_alarm_title" msgid="442812040762745210">"ਚਾਰਜਰ ਨੂੰ ਕੱਢੋ"</string>
+    <string name="high_temp_alarm_notify_message" msgid="1802871059489414932">"ਇਸ ਡੀਵਾਈਸ ਨੂੰ ਚਾਰਜ ਕਰਨ ਵਿੱਚ ਕੋਈ ਸਮੱਸਿਆ ਆ ਗਈ ਹੈ। ਪਾਵਰ ਅਡਾਪਟਰ ਨੂੰ ਕੱਢੋ ਅਤੇ ਧਿਆਨ ਰੱਖੋ ਸ਼ਾਇਦ ਕੇਬਲ ਗਰਮ ਹੋਵੇ।"</string>
+    <string name="high_temp_alarm_help_care_steps" msgid="3631075329318070726">"ਦੇਖਭਾਲ ਦੇ ਪੜਾਅ ਦੇਖੋ"</string>
     <string name="lockscreen_shortcut_left" msgid="2182769107618938629">"ਖੱਬਾ ਸ਼ਾਰਟਕੱਟ"</string>
     <string name="lockscreen_shortcut_right" msgid="3328683699505226536">"ਸੱਜਾ ਸ਼ਾਰਟਕੱਟ"</string>
     <string name="lockscreen_unlock_left" msgid="2043092136246951985">"ਖੱਬੇ ਸ਼ਾਰਟਕੱਟ ਨਾਲ ਵੀ ਅਣਲਾਕ ਹੁੰਦੀ ਹੈ"</string>
diff --git a/packages/SystemUI/res/values-pl/strings.xml b/packages/SystemUI/res/values-pl/strings.xml
index 565cc56..d00d349 100644
--- a/packages/SystemUI/res/values-pl/strings.xml
+++ b/packages/SystemUI/res/values-pl/strings.xml
@@ -327,7 +327,7 @@
     <string name="quick_settings_wifi_on_label" msgid="7607810331387031235">"Wi-Fi wł."</string>
     <string name="quick_settings_wifi_detail_empty_text" msgid="269990350383909226">"Brak dostępnych sieci Wi-Fi"</string>
     <string name="quick_settings_wifi_secondary_label_transient" msgid="7748206246119760554">"Włączam…"</string>
-    <string name="quick_settings_cast_title" msgid="7709016546426454729">"Przesyłanie"</string>
+    <string name="quick_settings_cast_title" msgid="6954684227605751758">"Przesyłanie ekranu"</string>
     <string name="quick_settings_casting" msgid="6601710681033353316">"Przesyłam"</string>
     <string name="quick_settings_cast_device_default_name" msgid="5367253104742382945">"Urządzenie bez nazwy"</string>
     <string name="quick_settings_cast_device_default_description" msgid="2484573682378634413">"Gotowy do działania"</string>
@@ -443,7 +443,8 @@
     <string name="battery_saver_notification_title" msgid="8614079794522291840">"Oszczędzanie baterii jest włączone"</string>
     <string name="battery_saver_notification_text" msgid="820318788126672692">"Zmniejsza wydajność i ogranicza dane w tle"</string>
     <string name="battery_saver_notification_action_text" msgid="132118784269455533">"Wyłącz Oszczędzanie baterii"</string>
-    <string name="media_projection_dialog_text" msgid="3071431025448218928">"<xliff:g id="APP_SEEKING_PERMISSION">%s</xliff:g> będzie zapisywać wszystko, co wyświetli się na ekranie."</string>
+    <string name="media_projection_dialog_text" msgid="1443042478990422751">"Aplikacja <xliff:g id="APP_SEEKING_PERMISSION">%s</xliff:g> zacznie rejestrować całą zawartość ekranu, w tym powiadomienia, hasła, zdjęcia, wiadomości i dane karty."</string>
+    <string name="media_projection_dialog_title" msgid="7574971526813630219">"Zezwolić aplikacji <xliff:g id="APP_SEEKING_PERMISSION">%s</xliff:g> na rejestrowanie lub przesyłanie zawartości ekranu?"</string>
     <string name="media_projection_remember_text" msgid="3103510882172746752">"Nie pokazuj ponownie"</string>
     <string name="clear_all_notifications_text" msgid="814192889771462828">"Ukryj wszystkie"</string>
     <string name="manage_notifications_text" msgid="2386728145475108753">"Zarządzaj"</string>
@@ -824,6 +825,9 @@
     <string name="high_temp_title" msgid="4589508026407318374">"Telefon się nagrzewa"</string>
     <string name="high_temp_notif_message" msgid="5642466103153429279">"Podczas obniżania temperatury telefonu niektóre funkcje są ograniczone"</string>
     <string name="high_temp_dialog_message" msgid="6840700639374113553">"Telefon automatycznie podejmie próbę obniżenia temperatury. Możesz go wciąż używać, ale telefon może działać wolniej.\n\nGdy temperatura się obniży, telefon będzie działał normalnie."</string>
+    <string name="high_temp_alarm_title" msgid="442812040762745210">"Odłącz ładowarkę"</string>
+    <string name="high_temp_alarm_notify_message" msgid="1802871059489414932">"Podczas ładowania tego urządzenia wystąpił błąd. Odłącz zasilacz, zwracając uwagę na kabel, który może być gorący."</string>
+    <string name="high_temp_alarm_help_care_steps" msgid="3631075329318070726">"Zobacz instrukcję postępowania"</string>
     <string name="lockscreen_shortcut_left" msgid="2182769107618938629">"Lewy skrót"</string>
     <string name="lockscreen_shortcut_right" msgid="3328683699505226536">"Prawy skrót"</string>
     <string name="lockscreen_unlock_left" msgid="2043092136246951985">"Lewy skrót również odblokowuje"</string>
diff --git a/packages/SystemUI/res/values-pt-rBR/strings.xml b/packages/SystemUI/res/values-pt-rBR/strings.xml
index 5392913..23682b6 100644
--- a/packages/SystemUI/res/values-pt-rBR/strings.xml
+++ b/packages/SystemUI/res/values-pt-rBR/strings.xml
@@ -325,7 +325,7 @@
     <string name="quick_settings_wifi_on_label" msgid="7607810331387031235">"Wi-Fi ativado"</string>
     <string name="quick_settings_wifi_detail_empty_text" msgid="269990350383909226">"Nenhuma rede Wi-Fi disponível"</string>
     <string name="quick_settings_wifi_secondary_label_transient" msgid="7748206246119760554">"Ativando…"</string>
-    <string name="quick_settings_cast_title" msgid="7709016546426454729">"Transmitir"</string>
+    <string name="quick_settings_cast_title" msgid="6954684227605751758">"Transmissão de tela"</string>
     <string name="quick_settings_casting" msgid="6601710681033353316">"Transmitindo"</string>
     <string name="quick_settings_cast_device_default_name" msgid="5367253104742382945">"Dispositivo sem nome"</string>
     <string name="quick_settings_cast_device_default_description" msgid="2484573682378634413">"Pronto para transmitir"</string>
@@ -437,7 +437,8 @@
     <string name="battery_saver_notification_title" msgid="8614079794522291840">"Economia de bateria ativada"</string>
     <string name="battery_saver_notification_text" msgid="820318788126672692">"Reduz o desempenho e os dados em segundo plano"</string>
     <string name="battery_saver_notification_action_text" msgid="132118784269455533">"Desativar a Economia de bateria"</string>
-    <string name="media_projection_dialog_text" msgid="3071431025448218928">"<xliff:g id="APP_SEEKING_PERMISSION">%s</xliff:g> começará a capturar tudo o que for exibido na tela."</string>
+    <string name="media_projection_dialog_text" msgid="1443042478990422751">"Tudo o que aparecer na sua tela, incluindo notificações, senhas, fotos, mensagens e informações de pagamento, será capturado pelo <xliff:g id="APP_SEEKING_PERMISSION">%s</xliff:g>."</string>
+    <string name="media_projection_dialog_title" msgid="7574971526813630219">"Permitir que <xliff:g id="APP_SEEKING_PERMISSION">%s</xliff:g> grave ou transmita sua tela?"</string>
     <string name="media_projection_remember_text" msgid="3103510882172746752">"Não mostrar novamente"</string>
     <string name="clear_all_notifications_text" msgid="814192889771462828">"Limpar tudo"</string>
     <string name="manage_notifications_text" msgid="2386728145475108753">"Gerenciar"</string>
@@ -814,6 +815,9 @@
     <string name="high_temp_title" msgid="4589508026407318374">"O smartphone está esquentando"</string>
     <string name="high_temp_notif_message" msgid="5642466103153429279">"Alguns recursos ficam limitados enquanto o smartphone é resfriado"</string>
     <string name="high_temp_dialog_message" msgid="6840700639374113553">"Seu smartphone tentará se resfriar automaticamente. Você ainda poderá usá-lo, mas talvez ele fique mais lento.\n\nQuando o smartphone estiver resfriado, ele voltará ao normal."</string>
+    <string name="high_temp_alarm_title" msgid="442812040762745210">"Desconecte o carregador"</string>
+    <string name="high_temp_alarm_notify_message" msgid="1802871059489414932">"Ocorreu um problema com o carregamento deste dispositivo. Desconecte o adaptador de energia com cuidado, já que o cabo pode estar quente."</string>
+    <string name="high_temp_alarm_help_care_steps" msgid="3631075329318070726">"Ver etapas de cuidado"</string>
     <string name="lockscreen_shortcut_left" msgid="2182769107618938629">"Atalho à esquerda"</string>
     <string name="lockscreen_shortcut_right" msgid="3328683699505226536">"Atalho à direita"</string>
     <string name="lockscreen_unlock_left" msgid="2043092136246951985">"O atalho à esquerda também desbloqueia"</string>
diff --git a/packages/SystemUI/res/values-pt-rPT/strings.xml b/packages/SystemUI/res/values-pt-rPT/strings.xml
index 48e0cdc..b5c2343 100644
--- a/packages/SystemUI/res/values-pt-rPT/strings.xml
+++ b/packages/SystemUI/res/values-pt-rPT/strings.xml
@@ -325,7 +325,7 @@
     <string name="quick_settings_wifi_on_label" msgid="7607810331387031235">"Wi-Fi ligado"</string>
     <string name="quick_settings_wifi_detail_empty_text" msgid="269990350383909226">"Não estão disponíveis redes Wi-Fi"</string>
     <string name="quick_settings_wifi_secondary_label_transient" msgid="7748206246119760554">"A ativar..."</string>
-    <string name="quick_settings_cast_title" msgid="7709016546426454729">"Transmitir"</string>
+    <string name="quick_settings_cast_title" msgid="6954684227605751758">"Transmissão do ecrã"</string>
     <string name="quick_settings_casting" msgid="6601710681033353316">"Transmissão"</string>
     <string name="quick_settings_cast_device_default_name" msgid="5367253104742382945">"Dispositivo sem nome"</string>
     <string name="quick_settings_cast_device_default_description" msgid="2484573682378634413">"Pronto para transmitir"</string>
@@ -437,7 +437,8 @@
     <string name="battery_saver_notification_title" msgid="8614079794522291840">"Poupança de bateria ativada"</string>
     <string name="battery_saver_notification_text" msgid="820318788126672692">"Reduz o desempenho e os dados de segundo plano"</string>
     <string name="battery_saver_notification_action_text" msgid="132118784269455533">"Desativar a Poupança de bateria"</string>
-    <string name="media_projection_dialog_text" msgid="3071431025448218928">"O(a) <xliff:g id="APP_SEEKING_PERMISSION">%s</xliff:g> vai começar a captar tudo o que é apresentado no ecrã."</string>
+    <string name="media_projection_dialog_text" msgid="1443042478990422751">"O(a) <xliff:g id="APP_SEEKING_PERMISSION">%s</xliff:g> irá começar a captar tudo o que é apresentado no ecrã, incluindo notificações, palavras-passe, fotos, mensagens e informações de pagamento."</string>
+    <string name="media_projection_dialog_title" msgid="7574971526813630219">"Pretende permitir que o(a) <xliff:g id="APP_SEEKING_PERMISSION">%s</xliff:g> grave ou transmita o seu ecrã?"</string>
     <string name="media_projection_remember_text" msgid="3103510882172746752">"Não mostrar de novo"</string>
     <string name="clear_all_notifications_text" msgid="814192889771462828">"Limpar tudo"</string>
     <string name="manage_notifications_text" msgid="2386728145475108753">"Gerir"</string>
@@ -814,6 +815,9 @@
     <string name="high_temp_title" msgid="4589508026407318374">"O telemóvel está a aquecer"</string>
     <string name="high_temp_notif_message" msgid="5642466103153429279">"Algumas funcionalidades são limitadas enquanto o telemóvel arrefece"</string>
     <string name="high_temp_dialog_message" msgid="6840700639374113553">"O telemóvel tenta arrefecer automaticamente. Pode continuar a utilizá-lo, mas este poderá funcionar mais lentamente.\n\nAssim que o telemóvel tiver arrefecido, funcionará normalmente."</string>
+    <string name="high_temp_alarm_title" msgid="442812040762745210">"Desligar o carregador"</string>
+    <string name="high_temp_alarm_notify_message" msgid="1802871059489414932">"Ocorreu um problema ao carregar este dispositivo. Desligue o transformador e tenha cuidado porque o cabo pode estar quente."</string>
+    <string name="high_temp_alarm_help_care_steps" msgid="3631075329318070726">"Ver os passos a ter em consideração"</string>
     <string name="lockscreen_shortcut_left" msgid="2182769107618938629">"Atalho esquerdo"</string>
     <string name="lockscreen_shortcut_right" msgid="3328683699505226536">"Atalho direito"</string>
     <string name="lockscreen_unlock_left" msgid="2043092136246951985">"O atalho esquerdo também desbloqueia"</string>
diff --git a/packages/SystemUI/res/values-pt/strings.xml b/packages/SystemUI/res/values-pt/strings.xml
index 5392913..23682b6 100644
--- a/packages/SystemUI/res/values-pt/strings.xml
+++ b/packages/SystemUI/res/values-pt/strings.xml
@@ -325,7 +325,7 @@
     <string name="quick_settings_wifi_on_label" msgid="7607810331387031235">"Wi-Fi ativado"</string>
     <string name="quick_settings_wifi_detail_empty_text" msgid="269990350383909226">"Nenhuma rede Wi-Fi disponível"</string>
     <string name="quick_settings_wifi_secondary_label_transient" msgid="7748206246119760554">"Ativando…"</string>
-    <string name="quick_settings_cast_title" msgid="7709016546426454729">"Transmitir"</string>
+    <string name="quick_settings_cast_title" msgid="6954684227605751758">"Transmissão de tela"</string>
     <string name="quick_settings_casting" msgid="6601710681033353316">"Transmitindo"</string>
     <string name="quick_settings_cast_device_default_name" msgid="5367253104742382945">"Dispositivo sem nome"</string>
     <string name="quick_settings_cast_device_default_description" msgid="2484573682378634413">"Pronto para transmitir"</string>
@@ -437,7 +437,8 @@
     <string name="battery_saver_notification_title" msgid="8614079794522291840">"Economia de bateria ativada"</string>
     <string name="battery_saver_notification_text" msgid="820318788126672692">"Reduz o desempenho e os dados em segundo plano"</string>
     <string name="battery_saver_notification_action_text" msgid="132118784269455533">"Desativar a Economia de bateria"</string>
-    <string name="media_projection_dialog_text" msgid="3071431025448218928">"<xliff:g id="APP_SEEKING_PERMISSION">%s</xliff:g> começará a capturar tudo o que for exibido na tela."</string>
+    <string name="media_projection_dialog_text" msgid="1443042478990422751">"Tudo o que aparecer na sua tela, incluindo notificações, senhas, fotos, mensagens e informações de pagamento, será capturado pelo <xliff:g id="APP_SEEKING_PERMISSION">%s</xliff:g>."</string>
+    <string name="media_projection_dialog_title" msgid="7574971526813630219">"Permitir que <xliff:g id="APP_SEEKING_PERMISSION">%s</xliff:g> grave ou transmita sua tela?"</string>
     <string name="media_projection_remember_text" msgid="3103510882172746752">"Não mostrar novamente"</string>
     <string name="clear_all_notifications_text" msgid="814192889771462828">"Limpar tudo"</string>
     <string name="manage_notifications_text" msgid="2386728145475108753">"Gerenciar"</string>
@@ -814,6 +815,9 @@
     <string name="high_temp_title" msgid="4589508026407318374">"O smartphone está esquentando"</string>
     <string name="high_temp_notif_message" msgid="5642466103153429279">"Alguns recursos ficam limitados enquanto o smartphone é resfriado"</string>
     <string name="high_temp_dialog_message" msgid="6840700639374113553">"Seu smartphone tentará se resfriar automaticamente. Você ainda poderá usá-lo, mas talvez ele fique mais lento.\n\nQuando o smartphone estiver resfriado, ele voltará ao normal."</string>
+    <string name="high_temp_alarm_title" msgid="442812040762745210">"Desconecte o carregador"</string>
+    <string name="high_temp_alarm_notify_message" msgid="1802871059489414932">"Ocorreu um problema com o carregamento deste dispositivo. Desconecte o adaptador de energia com cuidado, já que o cabo pode estar quente."</string>
+    <string name="high_temp_alarm_help_care_steps" msgid="3631075329318070726">"Ver etapas de cuidado"</string>
     <string name="lockscreen_shortcut_left" msgid="2182769107618938629">"Atalho à esquerda"</string>
     <string name="lockscreen_shortcut_right" msgid="3328683699505226536">"Atalho à direita"</string>
     <string name="lockscreen_unlock_left" msgid="2043092136246951985">"O atalho à esquerda também desbloqueia"</string>
diff --git a/packages/SystemUI/res/values-ro/strings.xml b/packages/SystemUI/res/values-ro/strings.xml
index fa42f76..259f1db 100644
--- a/packages/SystemUI/res/values-ro/strings.xml
+++ b/packages/SystemUI/res/values-ro/strings.xml
@@ -326,7 +326,7 @@
     <string name="quick_settings_wifi_on_label" msgid="7607810331387031235">"Wi-Fi activat"</string>
     <string name="quick_settings_wifi_detail_empty_text" msgid="269990350383909226">"Nicio rețea Wi-Fi disponibilă"</string>
     <string name="quick_settings_wifi_secondary_label_transient" msgid="7748206246119760554">"Se activează..."</string>
-    <string name="quick_settings_cast_title" msgid="7709016546426454729">"Proiectați"</string>
+    <string name="quick_settings_cast_title" msgid="6954684227605751758">"Proiectarea ecranului"</string>
     <string name="quick_settings_casting" msgid="6601710681033353316">"Se proiectează"</string>
     <string name="quick_settings_cast_device_default_name" msgid="5367253104742382945">"Dispozitiv nedenumit"</string>
     <string name="quick_settings_cast_device_default_description" msgid="2484573682378634413">"Pregătit pentru proiecție"</string>
@@ -440,7 +440,8 @@
     <string name="battery_saver_notification_title" msgid="8614079794522291840">"Economisire baterie activată"</string>
     <string name="battery_saver_notification_text" msgid="820318788126672692">"Reduce performanța și datele de fundal"</string>
     <string name="battery_saver_notification_action_text" msgid="132118784269455533">"Dezactivați economisirea bateriei"</string>
-    <string name="media_projection_dialog_text" msgid="3071431025448218928">"<xliff:g id="APP_SEEKING_PERMISSION">%s</xliff:g> va începe să captureze tot ceea ce se afișează pe ecran."</string>
+    <string name="media_projection_dialog_text" msgid="1443042478990422751">"<xliff:g id="APP_SEEKING_PERMISSION">%s</xliff:g> va începe să captureze totul de pe ecran, inclusiv notificările, parolele, fotografiile, mesajele și informațiile de plată."</string>
+    <string name="media_projection_dialog_title" msgid="7574971526813630219">"Permiteți <xliff:g id="APP_SEEKING_PERMISSION">%s</xliff:g> să înregistreze sau să proiecteze ecranul?"</string>
     <string name="media_projection_remember_text" msgid="3103510882172746752">"Nu se mai afișează"</string>
     <string name="clear_all_notifications_text" msgid="814192889771462828">"Ștergeți toate notificările"</string>
     <string name="manage_notifications_text" msgid="2386728145475108753">"Gestionați"</string>
@@ -819,6 +820,9 @@
     <string name="high_temp_title" msgid="4589508026407318374">"Telefonul se încălzește"</string>
     <string name="high_temp_notif_message" msgid="5642466103153429279">"Anumite funcții sunt limitate în timp ce telefonul se răcește"</string>
     <string name="high_temp_dialog_message" msgid="6840700639374113553">"Telefonul va încerca automat să se răcească. Puteți folosi telefonul în continuare, dar este posibil să funcționeze mai lent.\n\nDupă ce se răcește, telefonul va funcționa normal."</string>
+    <string name="high_temp_alarm_title" msgid="442812040762745210">"Deconectați încărcătorul"</string>
+    <string name="high_temp_alarm_notify_message" msgid="1802871059489414932">"Există o problemă la încărcarea acestui dispozitiv. Deconectați adaptorul de curent și aveți grijă, deoarece cablul poate fi cald."</string>
+    <string name="high_temp_alarm_help_care_steps" msgid="3631075329318070726">"Vedeți pașii pentru îngrijire"</string>
     <string name="lockscreen_shortcut_left" msgid="2182769107618938629">"Comanda rapidă din stânga"</string>
     <string name="lockscreen_shortcut_right" msgid="3328683699505226536">"Comanda rapidă din dreapta"</string>
     <string name="lockscreen_unlock_left" msgid="2043092136246951985">"Comanda rapidă din stânga și deblochează"</string>
diff --git a/packages/SystemUI/res/values-ru/strings.xml b/packages/SystemUI/res/values-ru/strings.xml
index 0f0dd78..a3d6680 100644
--- a/packages/SystemUI/res/values-ru/strings.xml
+++ b/packages/SystemUI/res/values-ru/strings.xml
@@ -327,7 +327,7 @@
     <string name="quick_settings_wifi_on_label" msgid="7607810331387031235">"Wi-Fi включен"</string>
     <string name="quick_settings_wifi_detail_empty_text" msgid="269990350383909226">"Не удалось найти доступные сети Wi-Fi"</string>
     <string name="quick_settings_wifi_secondary_label_transient" msgid="7748206246119760554">"Включение…"</string>
-    <string name="quick_settings_cast_title" msgid="7709016546426454729">"Трансляция"</string>
+    <string name="quick_settings_cast_title" msgid="6954684227605751758">"Трансляция экрана"</string>
     <string name="quick_settings_casting" msgid="6601710681033353316">"Передача изображения"</string>
     <string name="quick_settings_cast_device_default_name" msgid="5367253104742382945">"Безымянное устройство"</string>
     <string name="quick_settings_cast_device_default_description" msgid="2484573682378634413">"Готово к передаче"</string>
@@ -443,7 +443,8 @@
     <string name="battery_saver_notification_title" msgid="8614079794522291840">"Режим энергосбережения включен"</string>
     <string name="battery_saver_notification_text" msgid="820318788126672692">"Откл. фоновой передачи данных"</string>
     <string name="battery_saver_notification_action_text" msgid="132118784269455533">"Отключить режим энергосбережения"</string>
-    <string name="media_projection_dialog_text" msgid="3071431025448218928">"Приложение <xliff:g id="APP_SEEKING_PERMISSION">%s</xliff:g> получит доступ к изображению на экране устройства."</string>
+    <string name="media_projection_dialog_text" msgid="1443042478990422751">"Приложение \"<xliff:g id="APP_SEEKING_PERMISSION">%s</xliff:g>\" будет записывать всю информацию на экране, в том числе уведомления, пароли, фотографии, сообщения и платежные данные."</string>
+    <string name="media_projection_dialog_title" msgid="7574971526813630219">"Разрешить приложению \"<xliff:g id="APP_SEEKING_PERMISSION">%s</xliff:g>\" записывать или транслировать экран устройства?"</string>
     <string name="media_projection_remember_text" msgid="3103510882172746752">"Больше не показывать"</string>
     <string name="clear_all_notifications_text" msgid="814192889771462828">"Очистить все"</string>
     <string name="manage_notifications_text" msgid="2386728145475108753">"Настроить"</string>
@@ -824,6 +825,9 @@
     <string name="high_temp_title" msgid="4589508026407318374">"Телефон нагревается"</string>
     <string name="high_temp_notif_message" msgid="5642466103153429279">"Пока телефон не остынет, некоторые функции могут быть недоступны."</string>
     <string name="high_temp_dialog_message" msgid="6840700639374113553">"Ваш телефон остынет автоматически.\n\nОбратите внимание, что до тех пор он может работать медленнее, чем обычно."</string>
+    <string name="high_temp_alarm_title" msgid="442812040762745210">"Отключите зарядное устройство"</string>
+    <string name="high_temp_alarm_notify_message" msgid="1802871059489414932">"Во время зарядки возникла проблема. Отключите адаптер питания. Будьте осторожны, кабель может быть горячим."</string>
+    <string name="high_temp_alarm_help_care_steps" msgid="3631075329318070726">"Подробнее о действиях при перегреве…"</string>
     <string name="lockscreen_shortcut_left" msgid="2182769107618938629">"Ярлык слева"</string>
     <string name="lockscreen_shortcut_right" msgid="3328683699505226536">"Ярлык справа"</string>
     <string name="lockscreen_unlock_left" msgid="2043092136246951985">"Ярлык слева также разблокирует экран"</string>
diff --git a/packages/SystemUI/res/values-si/strings.xml b/packages/SystemUI/res/values-si/strings.xml
index 11a869f..e7febac 100644
--- a/packages/SystemUI/res/values-si/strings.xml
+++ b/packages/SystemUI/res/values-si/strings.xml
@@ -325,7 +325,7 @@
     <string name="quick_settings_wifi_on_label" msgid="7607810331387031235">"Wi-Fi ක්‍රියාත්මකයි"</string>
     <string name="quick_settings_wifi_detail_empty_text" msgid="269990350383909226">"Wi-Fi ජාල ලබා ගත නොහැකිය"</string>
     <string name="quick_settings_wifi_secondary_label_transient" msgid="7748206246119760554">"ක්‍රියාත්මක කරමින්…"</string>
-    <string name="quick_settings_cast_title" msgid="7709016546426454729">"Cast"</string>
+    <string name="quick_settings_cast_title" msgid="6954684227605751758">"තිර විකාශය"</string>
     <string name="quick_settings_casting" msgid="6601710681033353316">"කාස්ට් කිරීම"</string>
     <string name="quick_settings_cast_device_default_name" msgid="5367253104742382945">"නම් නොකළ උපාංගය"</string>
     <string name="quick_settings_cast_device_default_description" msgid="2484573682378634413">"කාස්ට් කිරීමට සුදානම්"</string>
@@ -437,7 +437,8 @@
     <string name="battery_saver_notification_title" msgid="8614079794522291840">"බැටරි සුරැකුම ක්‍රියාත්මකයි"</string>
     <string name="battery_saver_notification_text" msgid="820318788126672692">"ක්‍රියාකාරිත්වය සහ පසුබිම් දත්ත අඩු කරන්න"</string>
     <string name="battery_saver_notification_action_text" msgid="132118784269455533">"බැටරි සුරැකුම ක්‍රියාවිරහිත කරන්න"</string>
-    <string name="media_projection_dialog_text" msgid="3071431025448218928">"ඔබගේ තීරයේ දර්ශනය වන සෑම දෙයම <xliff:g id="APP_SEEKING_PERMISSION">%s</xliff:g> ලබාගැනීම ආරම්භ කරන ලදි."</string>
+    <string name="media_projection_dialog_text" msgid="1443042478990422751">"<xliff:g id="APP_SEEKING_PERMISSION">%s</xliff:g> දැනුම්දීම්, මුරපද, ඡායාරූප, පණිවුඩ සහ ගෙවීමේ තොරතුරු ඇතුළුව ඔබේ තිරයේ සැම දෙයක්ම ග්‍රහණ කිරීමට පටන් ගනියි."</string>
+    <string name="media_projection_dialog_title" msgid="7574971526813630219">"ඔබේ තිරය සටහන් කිරීමට හෝ විකාශන කිරීමට <xliff:g id="APP_SEEKING_PERMISSION">%s</xliff:g>ට ඉඩ දෙන්නේද?"</string>
     <string name="media_projection_remember_text" msgid="3103510882172746752">"නැවත නොපෙන්වන්න"</string>
     <string name="clear_all_notifications_text" msgid="814192889771462828">"සියල්ල හිස් කරන්න"</string>
     <string name="manage_notifications_text" msgid="2386728145475108753">"කළමනාකරණය කරන්න"</string>
@@ -814,6 +815,9 @@
     <string name="high_temp_title" msgid="4589508026407318374">"දුරකථනය උණුසුම් වෙමින්"</string>
     <string name="high_temp_notif_message" msgid="5642466103153429279">"දුරකථනය සිසිල් වන අතරතුර සමහර විශේෂාංග සීමිත විය හැකිය"</string>
     <string name="high_temp_dialog_message" msgid="6840700639374113553">"ඔබගේ දුරකථනය ස්වයංක්‍රියව සිසිල් වීමට උත්සාහ කරනු ඇත. ඔබට තවම ඔබේ දුරකථනය භාවිත කළ හැකිය, නමුත් එය සෙමින් ධාවනය විය හැකිය.\n\nඔබේ දුරකථනය සිසිල් වූ පසු, එය සාමාන්‍ය ලෙස ධාවනය වනු ඇත."</string>
+    <string name="high_temp_alarm_title" msgid="442812040762745210">"චාජරය පේනුවෙන් ඉවත් කරන්න"</string>
+    <string name="high_temp_alarm_notify_message" msgid="1802871059489414932">"මෙම උපාංගය ආරෝපණ කිරීමේ ගැටලුවක් තිබේ බල ඇඩැප්ටරය ගලවා කේබලය උණුසුම් විය හැකි බැවින් පරෙස්සම් වන්න."</string>
+    <string name="high_temp_alarm_help_care_steps" msgid="3631075329318070726">"රැකවරණ පියවර බලන්න"</string>
     <string name="lockscreen_shortcut_left" msgid="2182769107618938629">"වම් කෙටි මග"</string>
     <string name="lockscreen_shortcut_right" msgid="3328683699505226536">"දකුණු කෙටි මග"</string>
     <string name="lockscreen_unlock_left" msgid="2043092136246951985">"වම් කෙටි මගද අගුලු හැරේ"</string>
diff --git a/packages/SystemUI/res/values-sk/strings.xml b/packages/SystemUI/res/values-sk/strings.xml
index 3b9cc23..c1b80b1 100644
--- a/packages/SystemUI/res/values-sk/strings.xml
+++ b/packages/SystemUI/res/values-sk/strings.xml
@@ -327,7 +327,7 @@
     <string name="quick_settings_wifi_on_label" msgid="7607810331387031235">"Wi‑Fi je zapnuté"</string>
     <string name="quick_settings_wifi_detail_empty_text" msgid="269990350383909226">"K dispozícii nie sú žiadne siete Wi‑Fi"</string>
     <string name="quick_settings_wifi_secondary_label_transient" msgid="7748206246119760554">"Zapína sa…"</string>
-    <string name="quick_settings_cast_title" msgid="7709016546426454729">"Prenos"</string>
+    <string name="quick_settings_cast_title" msgid="6954684227605751758">"Prenos obrazovky"</string>
     <string name="quick_settings_casting" msgid="6601710681033353316">"Prenáša sa"</string>
     <string name="quick_settings_cast_device_default_name" msgid="5367253104742382945">"Nepomenované zariadenie"</string>
     <string name="quick_settings_cast_device_default_description" msgid="2484573682378634413">"Pripravené na prenášanie"</string>
@@ -443,7 +443,8 @@
     <string name="battery_saver_notification_title" msgid="8614079794522291840">"Šetrič batérie je zapnutý"</string>
     <string name="battery_saver_notification_text" msgid="820318788126672692">"Obmedzí výkonnosť a prenos údajov na pozadí"</string>
     <string name="battery_saver_notification_action_text" msgid="132118784269455533">"Vypnúť šetrič batérie"</string>
-    <string name="media_projection_dialog_text" msgid="3071431025448218928">"Aplikácia <xliff:g id="APP_SEEKING_PERMISSION">%s</xliff:g> začne zaznamenávať všetok obsah zobrazený na vašej obrazovke."</string>
+    <string name="media_projection_dialog_text" msgid="1443042478990422751">"<xliff:g id="APP_SEEKING_PERMISSION">%s</xliff:g> začne snímať všetok obsah obrazovky vrátane upozornení, hesiel, fotiek, správ a platobných údajov."</string>
+    <string name="media_projection_dialog_title" msgid="7574971526813630219">"Chcete povoliť aplikácii <xliff:g id="APP_SEEKING_PERMISSION">%s</xliff:g> zaznamenať alebo prenášať vašu obrazovku?"</string>
     <string name="media_projection_remember_text" msgid="3103510882172746752">"Nabudúce nezobrazovať"</string>
     <string name="clear_all_notifications_text" msgid="814192889771462828">"Vymazať všetko"</string>
     <string name="manage_notifications_text" msgid="2386728145475108753">"Spravovať"</string>
@@ -824,6 +825,9 @@
     <string name="high_temp_title" msgid="4589508026407318374">"Teplota telefónu stúpa"</string>
     <string name="high_temp_notif_message" msgid="5642466103153429279">"Niektoré funkcie budú obmedzené, dokým neklesne teplota telefónu"</string>
     <string name="high_temp_dialog_message" msgid="6840700639374113553">"Váš telefón sa automaticky pokúsi schladiť. Môžete ho naďalej používať, ale môže fungovať pomalšie.\n\nPo poklese teploty bude telefón fungovať ako normálne."</string>
+    <string name="high_temp_alarm_title" msgid="442812040762745210">"Odpojte nabíjačku"</string>
+    <string name="high_temp_alarm_notify_message" msgid="1802871059489414932">"Vyskytol sa problém s nabíjaním tohto zariadenia. Odpojte nabíjačku a postupujte opatrne, pretože kábel môže byť horúci."</string>
+    <string name="high_temp_alarm_help_care_steps" msgid="3631075329318070726">"Zobraziť opatrenia"</string>
     <string name="lockscreen_shortcut_left" msgid="2182769107618938629">"Ľavá skratka"</string>
     <string name="lockscreen_shortcut_right" msgid="3328683699505226536">"Pravá skratka"</string>
     <string name="lockscreen_unlock_left" msgid="2043092136246951985">"Ľavá skratka tiež odomkne"</string>
diff --git a/packages/SystemUI/res/values-sl/strings.xml b/packages/SystemUI/res/values-sl/strings.xml
index 4866f22..9992c82 100644
--- a/packages/SystemUI/res/values-sl/strings.xml
+++ b/packages/SystemUI/res/values-sl/strings.xml
@@ -327,7 +327,7 @@
     <string name="quick_settings_wifi_on_label" msgid="7607810331387031235">"Wi-Fi je vklopljen."</string>
     <string name="quick_settings_wifi_detail_empty_text" msgid="269990350383909226">"Na voljo ni nobeno omrežje Wi-Fi"</string>
     <string name="quick_settings_wifi_secondary_label_transient" msgid="7748206246119760554">"Vklapljanje …"</string>
-    <string name="quick_settings_cast_title" msgid="7709016546426454729">"Predvajanje"</string>
+    <string name="quick_settings_cast_title" msgid="6954684227605751758">"Predvajanje zaslona"</string>
     <string name="quick_settings_casting" msgid="6601710681033353316">"Predvajanje"</string>
     <string name="quick_settings_cast_device_default_name" msgid="5367253104742382945">"Neimenovana naprava"</string>
     <string name="quick_settings_cast_device_default_description" msgid="2484573682378634413">"Pripravljeno za predvajanje"</string>
@@ -443,7 +443,8 @@
     <string name="battery_saver_notification_title" msgid="8614079794522291840">"Varčevanje z energijo akumulatorja je vklopljeno"</string>
     <string name="battery_saver_notification_text" msgid="820318788126672692">"Omeji zmogljivost delovanja in prenos podatkov v ozadju"</string>
     <string name="battery_saver_notification_action_text" msgid="132118784269455533">"Izklop varčevanja z energijo akumulatorja"</string>
-    <string name="media_projection_dialog_text" msgid="3071431025448218928">"Aplikacija <xliff:g id="APP_SEEKING_PERMISSION">%s</xliff:g> bo začela zajemati vse, kar je prikazano na zaslonu."</string>
+    <string name="media_projection_dialog_text" msgid="1443042478990422751">"Aplikacija <xliff:g id="APP_SEEKING_PERMISSION">%s</xliff:g> bo začela zajemati vse podatke na zaslonu, vključno z obvestili, gesli, fotografijami, sporočili in podatki o plačilih."</string>
+    <string name="media_projection_dialog_title" msgid="7574971526813630219">"Ali aplikaciji <xliff:g id="APP_SEEKING_PERMISSION">%s</xliff:g> dovolite snemanje ali predvajanje zaslona?"</string>
     <string name="media_projection_remember_text" msgid="3103510882172746752">"Tega ne prikaži več"</string>
     <string name="clear_all_notifications_text" msgid="814192889771462828">"Izbriši vse"</string>
     <string name="manage_notifications_text" msgid="2386728145475108753">"Upravljanje"</string>
@@ -824,6 +825,9 @@
     <string name="high_temp_title" msgid="4589508026407318374">"Telefon se segreva"</string>
     <string name="high_temp_notif_message" msgid="5642466103153429279">"Nekatere funkcije bodo med ohlajanjem omejene."</string>
     <string name="high_temp_dialog_message" msgid="6840700639374113553">"Telefon se bo samodejno poskusil ohladiti. Še naprej ga lahko uporabljate, vendar bo morda deloval počasneje.\n\nKo se telefon ohladi, bo zopet deloval kot običajno."</string>
+    <string name="high_temp_alarm_title" msgid="442812040762745210">"Odklopite polnilnik"</string>
+    <string name="high_temp_alarm_notify_message" msgid="1802871059489414932">"Pri polnjenju te naprave je prišlo do težave. Previdno odklopite napajalnik, ker se je kabel morda segrel."</string>
+    <string name="high_temp_alarm_help_care_steps" msgid="3631075329318070726">"Oglejte si navodila za ukrepanje"</string>
     <string name="lockscreen_shortcut_left" msgid="2182769107618938629">"Leva bližnjica"</string>
     <string name="lockscreen_shortcut_right" msgid="3328683699505226536">"Desna bližnjica"</string>
     <string name="lockscreen_unlock_left" msgid="2043092136246951985">"Levo bližnjico uporabi tudi za odklepanje"</string>
diff --git a/packages/SystemUI/res/values-sq/strings.xml b/packages/SystemUI/res/values-sq/strings.xml
index 4fb2585..49c55d1 100644
--- a/packages/SystemUI/res/values-sq/strings.xml
+++ b/packages/SystemUI/res/values-sq/strings.xml
@@ -325,7 +325,7 @@
     <string name="quick_settings_wifi_on_label" msgid="7607810331387031235">"Wi-Fi i aktivizuar"</string>
     <string name="quick_settings_wifi_detail_empty_text" msgid="269990350383909226">"Nuk ka rrjete Wi-Fi të disponueshme"</string>
     <string name="quick_settings_wifi_secondary_label_transient" msgid="7748206246119760554">"Po aktivizohet…"</string>
-    <string name="quick_settings_cast_title" msgid="7709016546426454729">"Transmeto"</string>
+    <string name="quick_settings_cast_title" msgid="6954684227605751758">"Transmetimi i ekranit"</string>
     <string name="quick_settings_casting" msgid="6601710681033353316">"Po transmeton"</string>
     <string name="quick_settings_cast_device_default_name" msgid="5367253104742382945">"Pajisje e paemërtuar"</string>
     <string name="quick_settings_cast_device_default_description" msgid="2484573682378634413">"Gati për transmetim"</string>
@@ -437,7 +437,8 @@
     <string name="battery_saver_notification_title" msgid="8614079794522291840">"\"Kursyesi i baterisë\" është i aktivizuar"</string>
     <string name="battery_saver_notification_text" msgid="820318788126672692">"Pakëson veprimtarinë dhe të dhënat në sfond"</string>
     <string name="battery_saver_notification_action_text" msgid="132118784269455533">"Çaktivizo \"Kursyesin e baterisë\""</string>
-    <string name="media_projection_dialog_text" msgid="3071431025448218928">"<xliff:g id="APP_SEEKING_PERMISSION">%s</xliff:g> do të fillojë të regjistrojë çdo gjë që shfaqet në ekran."</string>
+    <string name="media_projection_dialog_text" msgid="1443042478990422751">"<xliff:g id="APP_SEEKING_PERMISSION">%s</xliff:g> do të fillojë të regjistrojë çdo gjë në ekranin tënd, duke përfshirë njoftimet, fjalëkalimet, fotografitë, mesazhet dhe informacionet e pagesës."</string>
+    <string name="media_projection_dialog_title" msgid="7574971526813630219">"Të lejohet që <xliff:g id="APP_SEEKING_PERMISSION">%s</xliff:g> të regjistrojë ose të transmetojë ekranin tënd?"</string>
     <string name="media_projection_remember_text" msgid="3103510882172746752">"Mos e shfaq sërish"</string>
     <string name="clear_all_notifications_text" msgid="814192889771462828">"Pastroji të gjitha"</string>
     <string name="manage_notifications_text" msgid="2386728145475108753">"Menaxho"</string>
@@ -814,6 +815,9 @@
     <string name="high_temp_title" msgid="4589508026407318374">"Telefoni po bëhet i ngrohtë"</string>
     <string name="high_temp_notif_message" msgid="5642466103153429279">"Disa funksione janë të kufizuara kur telefoni është duke u ftohur"</string>
     <string name="high_temp_dialog_message" msgid="6840700639374113553">"Telefoni yt do të përpiqet automatikisht që të ftohet. Mund ta përdorësh përsëri telefonin, por ai mund të punojë më ngadalë.\n\nPasi telefoni të jetë ftohur, ai do të punojë si normalisht."</string>
+    <string name="high_temp_alarm_title" msgid="442812040762745210">"Shkëput karikuesin"</string>
+    <string name="high_temp_alarm_notify_message" msgid="1802871059489414932">"Ka një problem me karikimin e kësaj pajisjeje. Hiqe spinën dhe trego kujdes pasi kablloja mund të jetë e ngrohtë."</string>
+    <string name="high_temp_alarm_help_care_steps" msgid="3631075329318070726">"Shiko hapat për kujdesin"</string>
     <string name="lockscreen_shortcut_left" msgid="2182769107618938629">"Shkurtorja majtas"</string>
     <string name="lockscreen_shortcut_right" msgid="3328683699505226536">"Shkurtorja djathtas"</string>
     <string name="lockscreen_unlock_left" msgid="2043092136246951985">"Shkurtorja majtas shkyç po ashtu"</string>
diff --git a/packages/SystemUI/res/values-sr/strings.xml b/packages/SystemUI/res/values-sr/strings.xml
index 535ae72..8dec319 100644
--- a/packages/SystemUI/res/values-sr/strings.xml
+++ b/packages/SystemUI/res/values-sr/strings.xml
@@ -326,7 +326,7 @@
     <string name="quick_settings_wifi_on_label" msgid="7607810331387031235">"Wi-Fi је укључен"</string>
     <string name="quick_settings_wifi_detail_empty_text" msgid="269990350383909226">"Није доступна ниједна Wi-Fi мрежа"</string>
     <string name="quick_settings_wifi_secondary_label_transient" msgid="7748206246119760554">"Укључује се..."</string>
-    <string name="quick_settings_cast_title" msgid="7709016546426454729">"Пребацивање"</string>
+    <string name="quick_settings_cast_title" msgid="6954684227605751758">"Пребацивање екрана"</string>
     <string name="quick_settings_casting" msgid="6601710681033353316">"Пребацивање"</string>
     <string name="quick_settings_cast_device_default_name" msgid="5367253104742382945">"Неименовани уређај"</string>
     <string name="quick_settings_cast_device_default_description" msgid="2484573682378634413">"Спремно за пребацивање"</string>
@@ -440,7 +440,8 @@
     <string name="battery_saver_notification_title" msgid="8614079794522291840">"Уштеда батерије је укључена"</string>
     <string name="battery_saver_notification_text" msgid="820318788126672692">"Смањује перформансе и позадинске податке"</string>
     <string name="battery_saver_notification_action_text" msgid="132118784269455533">"Искључи Уштеду батерије"</string>
-    <string name="media_projection_dialog_text" msgid="3071431025448218928">"<xliff:g id="APP_SEEKING_PERMISSION">%s</xliff:g> ће почети да снима све што се приказује на екрану."</string>
+    <string name="media_projection_dialog_text" msgid="1443042478990422751">"<xliff:g id="APP_SEEKING_PERMISSION">%s</xliff:g> ће почети да снима све на екрану, укључујући обавештења, лозинке, слике, поруке и информације о плаћању."</string>
+    <string name="media_projection_dialog_title" msgid="7574971526813630219">"Желите ли да дозволите да <xliff:g id="APP_SEEKING_PERMISSION">%s</xliff:g> снима или пребацује садржај екрана?"</string>
     <string name="media_projection_remember_text" msgid="3103510882172746752">"Не приказуј поново"</string>
     <string name="clear_all_notifications_text" msgid="814192889771462828">"Обриши све"</string>
     <string name="manage_notifications_text" msgid="2386728145475108753">"Управљајте"</string>
@@ -819,6 +820,9 @@
     <string name="high_temp_title" msgid="4589508026407318374">"Телефон се загрејао"</string>
     <string name="high_temp_notif_message" msgid="5642466103153429279">"Неке функције су ограничене док се телефон не охлади"</string>
     <string name="high_temp_dialog_message" msgid="6840700639374113553">"Телефон ће аутоматски покушати да се охлади. И даље ћете моћи да користите телефон, али ће спорије реаговати.\n\nКада се телефон охлади, нормално ће радити."</string>
+    <string name="high_temp_alarm_title" msgid="442812040762745210">"Искључите пуњач из напајања"</string>
+    <string name="high_temp_alarm_notify_message" msgid="1802871059489414932">"Дошло је до проблема са пуњењем овог уређаја. Искључите адаптер из напајања и будите пажљиви јер кабл може да буде топао."</string>
+    <string name="high_temp_alarm_help_care_steps" msgid="3631075329318070726">"Погледајте упозорења"</string>
     <string name="lockscreen_shortcut_left" msgid="2182769107618938629">"Лева пречица"</string>
     <string name="lockscreen_shortcut_right" msgid="3328683699505226536">"Десна пречица"</string>
     <string name="lockscreen_unlock_left" msgid="2043092136246951985">"И лева пречица откључава"</string>
diff --git a/packages/SystemUI/res/values-sv/strings.xml b/packages/SystemUI/res/values-sv/strings.xml
index 8352a23..106298a2 100644
--- a/packages/SystemUI/res/values-sv/strings.xml
+++ b/packages/SystemUI/res/values-sv/strings.xml
@@ -325,7 +325,7 @@
     <string name="quick_settings_wifi_on_label" msgid="7607810331387031235">"Wi-Fi är aktiverat"</string>
     <string name="quick_settings_wifi_detail_empty_text" msgid="269990350383909226">"Det finns inga tillgängliga Wi-Fi-nätverk"</string>
     <string name="quick_settings_wifi_secondary_label_transient" msgid="7748206246119760554">"Aktiverar …"</string>
-    <string name="quick_settings_cast_title" msgid="7709016546426454729">"Casta"</string>
+    <string name="quick_settings_cast_title" msgid="6954684227605751758">"Casta skärmen"</string>
     <string name="quick_settings_casting" msgid="6601710681033353316">"Castar"</string>
     <string name="quick_settings_cast_device_default_name" msgid="5367253104742382945">"Namnlös enhet"</string>
     <string name="quick_settings_cast_device_default_description" msgid="2484573682378634413">"Redo att casta"</string>
@@ -437,7 +437,8 @@
     <string name="battery_saver_notification_title" msgid="8614079794522291840">"Batterisparläget är aktiverat"</string>
     <string name="battery_saver_notification_text" msgid="820318788126672692">"Minskar prestanda och bakgrundsdata"</string>
     <string name="battery_saver_notification_action_text" msgid="132118784269455533">"Inaktivera batterisparläget"</string>
-    <string name="media_projection_dialog_text" msgid="3071431025448218928">"<xliff:g id="APP_SEEKING_PERMISSION">%s</xliff:g> tar en bild av allt som visas på skärmen."</string>
+    <string name="media_projection_dialog_text" msgid="1443042478990422751">"<xliff:g id="APP_SEEKING_PERMISSION">%s</xliff:g> börjar spela in allt på skärmen, inklusive aviseringar, lösenord, foton, meddelanden och betalningsuppgifter."</string>
+    <string name="media_projection_dialog_title" msgid="7574971526813630219">"Vill du tillåta att <xliff:g id="APP_SEEKING_PERMISSION">%s</xliff:g> spelar in eller castar skärmen?"</string>
     <string name="media_projection_remember_text" msgid="3103510882172746752">"Visa inte igen"</string>
     <string name="clear_all_notifications_text" msgid="814192889771462828">"Rensa alla"</string>
     <string name="manage_notifications_text" msgid="2386728145475108753">"Hantera"</string>
@@ -814,6 +815,9 @@
     <string name="high_temp_title" msgid="4589508026407318374">"Mobilen börjar bli varm"</string>
     <string name="high_temp_notif_message" msgid="5642466103153429279">"Vissa funktioner är begränsade medan mobilen svalnar"</string>
     <string name="high_temp_dialog_message" msgid="6840700639374113553">"Mobilen försöker svalna automatiskt. Du kan fortfarande använda mobilen, men den kan vara långsammare än vanligt.\n\nMobilen fungerar som vanligt när den har svalnat."</string>
+    <string name="high_temp_alarm_title" msgid="442812040762745210">"Koppla ur laddaren"</string>
+    <string name="high_temp_alarm_notify_message" msgid="1802871059489414932">"Det går inte att ladda denna enhet. Koppla ur nätadaptern, men var försiktig eftersom kabeln kan vara varm."</string>
+    <string name="high_temp_alarm_help_care_steps" msgid="3631075329318070726">"Visa alla skötselråd"</string>
     <string name="lockscreen_shortcut_left" msgid="2182769107618938629">"Vänster genväg"</string>
     <string name="lockscreen_shortcut_right" msgid="3328683699505226536">"Höger genväg"</string>
     <string name="lockscreen_unlock_left" msgid="2043092136246951985">"Lås även upp enheten med vänster genväg"</string>
diff --git a/packages/SystemUI/res/values-sw/strings.xml b/packages/SystemUI/res/values-sw/strings.xml
index 407c056..1df75f6 100644
--- a/packages/SystemUI/res/values-sw/strings.xml
+++ b/packages/SystemUI/res/values-sw/strings.xml
@@ -325,7 +325,7 @@
     <string name="quick_settings_wifi_on_label" msgid="7607810331387031235">"Imewasha Wi-Fi"</string>
     <string name="quick_settings_wifi_detail_empty_text" msgid="269990350383909226">"Hakuna mitandao ya Wi-Fi inayopatikana"</string>
     <string name="quick_settings_wifi_secondary_label_transient" msgid="7748206246119760554">"Inawasha..."</string>
-    <string name="quick_settings_cast_title" msgid="7709016546426454729">"Tuma"</string>
+    <string name="quick_settings_cast_title" msgid="6954684227605751758">"Kutuma kwenye Skrini"</string>
     <string name="quick_settings_casting" msgid="6601710681033353316">"Inatuma"</string>
     <string name="quick_settings_cast_device_default_name" msgid="5367253104742382945">"Kifaa hakina jina"</string>
     <string name="quick_settings_cast_device_default_description" msgid="2484573682378634413">"Tayari kutuma"</string>
@@ -437,7 +437,8 @@
     <string name="battery_saver_notification_title" msgid="8614079794522291840">"Kiokoa Betri kimewashwa"</string>
     <string name="battery_saver_notification_text" msgid="820318788126672692">"Hupunguza utendaji na data ya chini chini"</string>
     <string name="battery_saver_notification_action_text" msgid="132118784269455533">"Zima Kiokoa Betri"</string>
-    <string name="media_projection_dialog_text" msgid="3071431025448218928">"<xliff:g id="APP_SEEKING_PERMISSION">%s</xliff:g> itaanza kupiga picha kila kitu kinachoonyeshwa kwenye skrini yako."</string>
+    <string name="media_projection_dialog_text" msgid="1443042478990422751">"<xliff:g id="APP_SEEKING_PERMISSION">%s</xliff:g> itaanza kurekodi kila kitu kwenye skrini ikiwa ni pamoja na arifa, manenosiri, picha, ujumbe na maelezo ya malipo."</string>
+    <string name="media_projection_dialog_title" msgid="7574971526813630219">"Ungependa kuruhusu <xliff:g id="APP_SEEKING_PERMISSION">%s</xliff:g> irekodi au kutuma kwenye skrini yako?"</string>
     <string name="media_projection_remember_text" msgid="3103510882172746752">"Usionyeshe tena"</string>
     <string name="clear_all_notifications_text" msgid="814192889771462828">"Futa zote"</string>
     <string name="manage_notifications_text" msgid="2386728145475108753">"Dhibiti"</string>
@@ -814,6 +815,9 @@
     <string name="high_temp_title" msgid="4589508026407318374">"Joto la simu linaongezeka"</string>
     <string name="high_temp_notif_message" msgid="5642466103153429279">"Baadhi ya vipengele havitatumika kwenye simu wakati inapoa"</string>
     <string name="high_temp_dialog_message" msgid="6840700639374113553">"Simu yako itajaribu kupoa kiotomatiki. Bado unaweza kutumia simu yako, lakini huenda ikafanya kazi polepole. \n\nPindi simu yako itakapopoa, itaendelea kufanya kazi kama kawaida."</string>
+    <string name="high_temp_alarm_title" msgid="442812040762745210">"Chomoa chaja"</string>
+    <string name="high_temp_alarm_notify_message" msgid="1802871059489414932">"Kuna tatizo la kuchaji kifaa hiki. Chomoa adapta ya nishati na uwe mwangalifu, huenda kebo ni moto."</string>
+    <string name="high_temp_alarm_help_care_steps" msgid="3631075329318070726">"Angalia hatua za ulinzi"</string>
     <string name="lockscreen_shortcut_left" msgid="2182769107618938629">"Njia ya mkato ya kushoto"</string>
     <string name="lockscreen_shortcut_right" msgid="3328683699505226536">"Njia ya mkato ya kulia"</string>
     <string name="lockscreen_unlock_left" msgid="2043092136246951985">"Njia ya mkato ya kushoto pia inafungua"</string>
diff --git a/packages/SystemUI/res/values-sw320dp/dimens.xml b/packages/SystemUI/res/values-sw320dp/dimens.xml
index 0c2b1cc..8f27f45 100644
--- a/packages/SystemUI/res/values-sw320dp/dimens.xml
+++ b/packages/SystemUI/res/values-sw320dp/dimens.xml
@@ -15,9 +15,8 @@
   ~ limitations under the License
   -->
 <resources>
-
     <!-- Global actions grid -->
-    <dimen name="global_actions_grid_container_bottom_margin">16dp</dimen>
+    <dimen name="global_actions_grid_container_bottom_margin">4dp</dimen>
 
     <dimen name="global_actions_grid_vertical_padding">0dp</dimen>
     <dimen name="global_actions_grid_horizontal_padding">3dp</dimen>
@@ -29,7 +28,7 @@
 
     <dimen name="global_actions_grid_item_icon_width">18dp</dimen>
     <dimen name="global_actions_grid_item_icon_height">18dp</dimen>
-    <dimen name="global_actions_grid_item_icon_top_margin">12dp</dimen>
+    <dimen name="global_actions_grid_item_icon_top_margin">10dp</dimen>
     <dimen name="global_actions_grid_item_icon_side_margin">22dp</dimen>
     <dimen name="global_actions_grid_item_icon_bottom_margin">4dp</dimen>
 
diff --git a/packages/SystemUI/res/values-land/integers.xml b/packages/SystemUI/res/values-sw392dp-land/dimens.xml
similarity index 63%
rename from packages/SystemUI/res/values-land/integers.xml
rename to packages/SystemUI/res/values-sw392dp-land/dimens.xml
index fb22665..c718614 100644
--- a/packages/SystemUI/res/values-land/integers.xml
+++ b/packages/SystemUI/res/values-sw392dp-land/dimens.xml
@@ -1,6 +1,6 @@
 <?xml version="1.0" encoding="utf-8"?>
 <!--
-  ~ Copyright (C) 2018 The Android Open Source Project
+  ~ Copyright (C) 2019 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.
@@ -15,8 +15,13 @@
   ~ limitations under the License
   -->
 <resources>
-    <!-- Action footer width is set to 0 to allow it to stretch (through a weight of 1) and center
-         the page indicator in between the footer and the carrier text.-->
-    <integer name="qs_footer_actions_width">0</integer>
-    <integer name="qs_footer_actions_weight">1</integer>
-</resources>
\ No newline at end of file
+
+    <!-- Global actions grid -->
+    <dimen name="global_actions_grid_vertical_padding">3dp</dimen>
+    <dimen name="global_actions_grid_horizontal_padding">0dp</dimen>
+
+    <dimen name="global_actions_grid_item_side_margin">6dp</dimen>
+    <dimen name="global_actions_grid_item_vertical_margin">10dp</dimen>
+
+</resources>
+
diff --git a/packages/SystemUI/res/values-sw392dp/dimens.xml b/packages/SystemUI/res/values-sw392dp/dimens.xml
new file mode 100644
index 0000000..6fa6692
--- /dev/null
+++ b/packages/SystemUI/res/values-sw392dp/dimens.xml
@@ -0,0 +1,36 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!--
+  ~ Copyright (C) 2019 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
+  -->
+<resources>
+    <!-- Global actions grid -->
+    <dimen name="global_actions_grid_container_bottom_margin">4dp</dimen>
+
+    <dimen name="global_actions_grid_vertical_padding">0dp</dimen>
+    <dimen name="global_actions_grid_horizontal_padding">3dp</dimen>
+
+    <dimen name="global_actions_grid_item_side_margin">10dp</dimen>
+    <dimen name="global_actions_grid_item_vertical_margin">6dp</dimen>
+    <dimen name="global_actions_grid_item_width">72dp</dimen>
+    <dimen name="global_actions_grid_item_height">72dp</dimen>
+
+    <dimen name="global_actions_grid_item_icon_width">22dp</dimen>
+    <dimen name="global_actions_grid_item_icon_height">22dp</dimen>
+    <dimen name="global_actions_grid_item_icon_top_margin">12dp</dimen>
+    <dimen name="global_actions_grid_item_icon_side_margin">22dp</dimen>
+    <dimen name="global_actions_grid_item_icon_bottom_margin">4dp</dimen>
+
+</resources>
+
diff --git a/packages/SystemUI/res/values-sw410dp/dimens.xml b/packages/SystemUI/res/values-sw410dp/dimens.xml
index 4197eb2..73d1857 100644
--- a/packages/SystemUI/res/values-sw410dp/dimens.xml
+++ b/packages/SystemUI/res/values-sw410dp/dimens.xml
@@ -23,7 +23,7 @@
     <dimen name="qs_detail_items_padding_top">16dp</dimen>
 
     <!-- Global actions grid -->
-    <dimen name="global_actions_grid_container_bottom_margin">16dp</dimen>
+    <dimen name="global_actions_grid_container_bottom_margin">4dp</dimen>
 
     <dimen name="global_actions_grid_vertical_padding">8dp</dimen>
     <dimen name="global_actions_grid_horizontal_padding">4dp</dimen>
@@ -35,7 +35,7 @@
 
     <dimen name="global_actions_grid_item_icon_width">24dp</dimen>
     <dimen name="global_actions_grid_item_icon_height">24dp</dimen>
-    <dimen name="global_actions_grid_item_icon_top_margin">16dp</dimen>
+    <dimen name="global_actions_grid_item_icon_top_margin">14dp</dimen>
     <dimen name="global_actions_grid_item_icon_side_margin">24dp</dimen>
     <dimen name="global_actions_grid_item_icon_bottom_margin">4dp</dimen>
 
diff --git a/packages/SystemUI/res/values-ta/strings.xml b/packages/SystemUI/res/values-ta/strings.xml
index 3f81f72..e5fd953 100644
--- a/packages/SystemUI/res/values-ta/strings.xml
+++ b/packages/SystemUI/res/values-ta/strings.xml
@@ -325,7 +325,7 @@
     <string name="quick_settings_wifi_on_label" msgid="7607810331387031235">"வைஃபை இயக்கத்தில்"</string>
     <string name="quick_settings_wifi_detail_empty_text" msgid="269990350383909226">"வைஃபை நெட்வொர்க்குகள் இல்லை"</string>
     <string name="quick_settings_wifi_secondary_label_transient" msgid="7748206246119760554">"ஆன் செய்கிறது…"</string>
-    <string name="quick_settings_cast_title" msgid="7709016546426454729">"Cast"</string>
+    <string name="quick_settings_cast_title" msgid="6954684227605751758">"திரை அலைபரப்பல்"</string>
     <string name="quick_settings_casting" msgid="6601710681033353316">"அனுப்புகிறது"</string>
     <string name="quick_settings_cast_device_default_name" msgid="5367253104742382945">"பெயரிடப்படாத சாதனம்"</string>
     <string name="quick_settings_cast_device_default_description" msgid="2484573682378634413">"திரையிடத் தயார்"</string>
@@ -398,7 +398,7 @@
     <string name="interruption_level_none_twoline" msgid="3957581548190765889">"அறிவிப்புகள்\nவேண்டாம்"</string>
     <string name="interruption_level_priority_twoline" msgid="1564715335217164124">"முன்னுரிமைகள்\nமட்டும்"</string>
     <string name="interruption_level_alarms_twoline" msgid="3266909566410106146">"அலாரங்கள்\nமட்டும்"</string>
-    <string name="keyguard_indication_charging_time_wireless" msgid="5376059837186496558">"<xliff:g id="PERCENTAGE">%2$s</xliff:g> • வயர்லெஸ் முறையில் சார்ஜாகிறது (முழு சார்ஜ் ஆக <xliff:g id="CHARGING_TIME_LEFT">%1$s</xliff:g> ஆகும்)"</string>
+    <string name="keyguard_indication_charging_time_wireless" msgid="5376059837186496558">"<xliff:g id="PERCENTAGE">%2$s</xliff:g> • வயர்லெஸ் முறையில் சார்ஜாகிறது (முடிய <xliff:g id="CHARGING_TIME_LEFT">%1$s</xliff:g> ஆகும்)"</string>
     <string name="keyguard_indication_charging_time" msgid="2056340799276374421">"<xliff:g id="PERCENTAGE">%2$s</xliff:g> • சார்ஜாகிறது (முழு சார்ஜ்: <xliff:g id="CHARGING_TIME_LEFT">%1$s</xliff:g>)"</string>
     <string name="keyguard_indication_charging_time_fast" msgid="7767562163577492332">"<xliff:g id="PERCENTAGE">%2$s</xliff:g> • வேகமாகச் சார்ஜாகிறது (முழு சார்ஜ்: <xliff:g id="CHARGING_TIME_LEFT">%1$s</xliff:g>)"</string>
     <string name="keyguard_indication_charging_time_slowly" msgid="3769655133567307069">"<xliff:g id="PERCENTAGE">%2$s</xliff:g> • மெதுவாகச் சார்ஜாகிறது (முழு சார்ஜ்: <xliff:g id="CHARGING_TIME_LEFT">%1$s</xliff:g>)"</string>
@@ -437,7 +437,8 @@
     <string name="battery_saver_notification_title" msgid="8614079794522291840">"பேட்டரி சேமிப்பான் ஆன் செய்யப்பட்டுள்ளது"</string>
     <string name="battery_saver_notification_text" msgid="820318788126672692">"செயல்திறனையும் பின்புல டேட்டா உபயோகத்தையும் குறைக்கிறது"</string>
     <string name="battery_saver_notification_action_text" msgid="132118784269455533">"பேட்டரி சேமிப்பானை ஆஃப் செய்"</string>
-    <string name="media_projection_dialog_text" msgid="3071431025448218928">"திரையில் காட்டப்படும் அனைத்தையும் <xliff:g id="APP_SEEKING_PERMISSION">%s</xliff:g> படமெடுக்கும்."</string>
+    <string name="media_projection_dialog_text" msgid="1443042478990422751">"உங்கள் திரையில் தோன்றும் அறிவிப்புகள், கடவுச்சொற்கள், படங்கள், மெசேஜ்கள் மற்றும் கட்டணத் தகவல் போன்ற அனைத்தையும் <xliff:g id="APP_SEEKING_PERMISSION">%s</xliff:g> காட்டத் தொடங்கும்."</string>
+    <string name="media_projection_dialog_title" msgid="7574971526813630219">"<xliff:g id="APP_SEEKING_PERMISSION">%s</xliff:g> உங்கள் திரையை ரெக்கார்டு செய்யவோ அலைபரப்பவோ அனுமதிக்கவா?"</string>
     <string name="media_projection_remember_text" msgid="3103510882172746752">"மீண்டும் காட்டாதே"</string>
     <string name="clear_all_notifications_text" msgid="814192889771462828">"எல்லாவற்றையும் அழி"</string>
     <string name="manage_notifications_text" msgid="2386728145475108753">"அறிவிப்புகளை நிர்வகி"</string>
@@ -814,6 +815,9 @@
     <string name="high_temp_title" msgid="4589508026407318374">"மொபைல் சூடாகிறது"</string>
     <string name="high_temp_notif_message" msgid="5642466103153429279">"மொபைலின் வெப்ப அளவு குறையும் போது, சில அம்சங்களைப் பயன்படுத்த முடியாது"</string>
     <string name="high_temp_dialog_message" msgid="6840700639374113553">"உங்கள் மொபைலின் வெப்ப அளவு தானாகவே குறையும். தொடர்ந்து நீங்கள் மொபைலைப் பயன்படுத்தலாம், ஆனால் அதன் வேகம் குறைவாக இருக்கக்கூடும்.\n\nமொபைலின் வெப்ப அளவு குறைந்தவுடன், அது இயல்பு நிலையில் இயங்கும்."</string>
+    <string name="high_temp_alarm_title" msgid="442812040762745210">"சார்ஜரைத் துண்டிக்கவும்"</string>
+    <string name="high_temp_alarm_notify_message" msgid="1802871059489414932">"இந்தச் சாதனத்தைச் சார்ஜ் செய்வதில் சிக்கல் உள்ளது. பவர் அடாப்டரைத் துண்டிக்கவும், கேபிள் சூடாக இருக்கக்கூடும் என்பதால் கவனமாகக் கையாளவும்."</string>
+    <string name="high_temp_alarm_help_care_steps" msgid="3631075329318070726">"மேலும் விவரங்களுக்கு இதைப் பார்க்கவும்"</string>
     <string name="lockscreen_shortcut_left" msgid="2182769107618938629">"இடப்புற ஷார்ட்கட்"</string>
     <string name="lockscreen_shortcut_right" msgid="3328683699505226536">"வலப்புற ஷார்ட்கட்"</string>
     <string name="lockscreen_unlock_left" msgid="2043092136246951985">"இடப்புற ஷார்ட்கட் மூலமாகவும் திறக்கும்"</string>
diff --git a/packages/SystemUI/res/values-te/strings.xml b/packages/SystemUI/res/values-te/strings.xml
index c0a093a..86f3a87 100644
--- a/packages/SystemUI/res/values-te/strings.xml
+++ b/packages/SystemUI/res/values-te/strings.xml
@@ -38,7 +38,7 @@
     <string name="battery_saver_start_action" msgid="8187820911065797519">"బ్యాటరీ సేవర్‌ను ఆన్ చేయండి"</string>
     <string name="status_bar_settings_settings_button" msgid="3023889916699270224">"సెట్టింగ్‌లు"</string>
     <string name="status_bar_settings_wifi_button" msgid="1733928151698311923">"Wi-Fi"</string>
-    <string name="status_bar_settings_auto_rotation" msgid="3790482541357798421">"స్క్రీన్‌ను స్వయంచాలకంగా తిప్పండి"</string>
+    <string name="status_bar_settings_auto_rotation" msgid="3790482541357798421">"స్క్రీన్ ఆటో-రొటేట్‌"</string>
     <string name="status_bar_settings_mute_label" msgid="554682549917429396">"మ్యూట్"</string>
     <string name="status_bar_settings_auto_brightness_label" msgid="511453614962324674">"స్వయంచాలకం"</string>
     <string name="status_bar_settings_notifications" msgid="397146176280905137">"నోటిఫికేషన్‌లు"</string>
@@ -302,7 +302,7 @@
     <string name="quick_settings_bluetooth_secondary_label_transient" msgid="4551281899312150640">"ఆన్ చేస్తోంది…"</string>
     <string name="quick_settings_brightness_label" msgid="6968372297018755815">"ప్రకాశం"</string>
     <string name="quick_settings_rotation_unlocked_label" msgid="7305323031808150099">"స్వయంచాలకంగా తిప్పడం"</string>
-    <string name="accessibility_quick_settings_rotation" msgid="4231661040698488779">"స్క్రీన్‌ను స్వయంచాలకంగా తిప్పు"</string>
+    <string name="accessibility_quick_settings_rotation" msgid="4231661040698488779">"స్క్రీన్ ఆటో-రొటేట్‌"</string>
     <string name="accessibility_quick_settings_rotation_value" msgid="8187398200140760213">"<xliff:g id="ID_1">%s</xliff:g> మోడ్"</string>
     <string name="quick_settings_rotation_locked_label" msgid="6359205706154282377">"తిప్పడం లాక్ చేయబడింది"</string>
     <string name="quick_settings_rotation_locked_portrait_label" msgid="5102691921442135053">"పోర్ట్రెయిట్"</string>
@@ -325,7 +325,7 @@
     <string name="quick_settings_wifi_on_label" msgid="7607810331387031235">"Wi-Fi ఆన్‌లో ఉంది"</string>
     <string name="quick_settings_wifi_detail_empty_text" msgid="269990350383909226">"Wi-Fi నెట్‌వర్క్‌లు ఏవీ అందుబాటులో లేవు"</string>
     <string name="quick_settings_wifi_secondary_label_transient" msgid="7748206246119760554">"ఆన్ చేస్తోంది…"</string>
-    <string name="quick_settings_cast_title" msgid="7709016546426454729">"ప్రసారం"</string>
+    <string name="quick_settings_cast_title" msgid="6954684227605751758">"స్క్రీన్ ప్రసారం"</string>
     <string name="quick_settings_casting" msgid="6601710681033353316">"ప్రసారం చేస్తోంది"</string>
     <string name="quick_settings_cast_device_default_name" msgid="5367253104742382945">"పేరులేని పరికరం"</string>
     <string name="quick_settings_cast_device_default_description" msgid="2484573682378634413">"ప్రసారం చేయడానికి సిద్ధంగా ఉంది"</string>
@@ -437,7 +437,8 @@
     <string name="battery_saver_notification_title" msgid="8614079794522291840">"బ్యాటరీ సేవర్ ఆన్‌లో ఉంది"</string>
     <string name="battery_saver_notification_text" msgid="820318788126672692">"పనితీరుని మరియు నేపథ్య డేటాను తగ్గిస్తుంది"</string>
     <string name="battery_saver_notification_action_text" msgid="132118784269455533">"బ్యాటరీ సేవర్‌ను ఆఫ్ చేయండి"</string>
-    <string name="media_projection_dialog_text" msgid="3071431025448218928">"<xliff:g id="APP_SEEKING_PERMISSION">%s</xliff:g> మీ స్క్రీన్‌పై కనిపించే ప్రతిదాన్ని క్యాప్చర్ చేయడం ప్రారంభిస్తుంది."</string>
+    <string name="media_projection_dialog_text" msgid="1443042478990422751">"నోటిఫికేషన్‌లు, పాస్‌వర్డ్‌లు, ఫోటోలు, సందేశాలు మరియు చెల్లింపు సమాచారంతో సహా <xliff:g id="APP_SEEKING_PERMISSION">%s</xliff:g> మీ స్క్రీన్‌లోని ప్రతి సమాచారాన్నీ క్యాప్చర్ చేయడం ప్రారంభిస్తుంది."</string>
+    <string name="media_projection_dialog_title" msgid="7574971526813630219">"మీ స్క్రీన్‌ను రికార్డ్ లేదా క్యాస్ట్ చేయడానికి <xliff:g id="APP_SEEKING_PERMISSION">%s</xliff:g>ను అనుమతించాలా?"</string>
     <string name="media_projection_remember_text" msgid="3103510882172746752">"మళ్లీ చూపవద్దు"</string>
     <string name="clear_all_notifications_text" msgid="814192889771462828">"అన్నీ క్లియర్ చేయండి"</string>
     <string name="manage_notifications_text" msgid="2386728145475108753">"నిర్వహించండి"</string>
@@ -814,6 +815,9 @@
     <string name="high_temp_title" msgid="4589508026407318374">"ఫోన్ వేడెక్కుతోంది"</string>
     <string name="high_temp_notif_message" msgid="5642466103153429279">"ఫోన్‌ను చల్లబరిచే క్రమంలో కొన్ని లక్షణాలు పరిమితం చేయబడ్డాయి"</string>
     <string name="high_temp_dialog_message" msgid="6840700639374113553">"మీ ఫోన్ స్వయంచాలకంగా చల్లబడటానికి ప్రయత్నిస్తుంది. మీరు ఇప్పటికీ మీ ఫోన్‌ను ఉపయోగించవచ్చు, కానీ దాని పనితీరు నెమ్మదిగా ఉండవచ్చు.\n\nమీ ఫోన్ చల్లబడిన తర్వాత, అది సాధారణ రీతిలో పని చేస్తుంది."</string>
+    <string name="high_temp_alarm_title" msgid="442812040762745210">"ప్లగ్ నుండి ఛార్జర్‌ తీసివేయండి"</string>
+    <string name="high_temp_alarm_notify_message" msgid="1802871059489414932">"ఈ పరికరాన్ని ఛార్జ్ చేయడంలో సమస్య ఉంది. పవర్ అడాప్టర్‌ను ప్లగ్ నుండి తీసివేసి, కేబుల్ ఏమైనా వేడిగా అయితే తగిన జాగ్రత్తలు తీసుకోండి."</string>
+    <string name="high_temp_alarm_help_care_steps" msgid="3631075329318070726">"తీసుకోవాల్సిన జాగ్రత్తలు ఏమిటో చూడండి"</string>
     <string name="lockscreen_shortcut_left" msgid="2182769107618938629">"ఎడమవైపు షార్ట్‌కట్"</string>
     <string name="lockscreen_shortcut_right" msgid="3328683699505226536">"కుడివైపు షార్ట్‌కట్"</string>
     <string name="lockscreen_unlock_left" msgid="2043092136246951985">"ఎడమవైపు షార్ట్‌కట్ కూడా అన్‌లాక్ చేస్తుంది"</string>
diff --git a/packages/SystemUI/res/values-th/strings.xml b/packages/SystemUI/res/values-th/strings.xml
index 3c75c93..331945a 100644
--- a/packages/SystemUI/res/values-th/strings.xml
+++ b/packages/SystemUI/res/values-th/strings.xml
@@ -325,7 +325,7 @@
     <string name="quick_settings_wifi_on_label" msgid="7607810331387031235">"Wi-Fi เปิดอยู่"</string>
     <string name="quick_settings_wifi_detail_empty_text" msgid="269990350383909226">"ไม่มีเครือข่าย Wi-Fi พร้อมใช้งาน"</string>
     <string name="quick_settings_wifi_secondary_label_transient" msgid="7748206246119760554">"กำลังเปิด..."</string>
-    <string name="quick_settings_cast_title" msgid="7709016546426454729">"แคสต์"</string>
+    <string name="quick_settings_cast_title" msgid="6954684227605751758">"การแคสต์หน้าจอ"</string>
     <string name="quick_settings_casting" msgid="6601710681033353316">"กำลังส่ง"</string>
     <string name="quick_settings_cast_device_default_name" msgid="5367253104742382945">"อุปกรณ์ที่ไม่มีชื่อ"</string>
     <string name="quick_settings_cast_device_default_description" msgid="2484573682378634413">"พร้อมที่จะส่ง"</string>
@@ -437,7 +437,8 @@
     <string name="battery_saver_notification_title" msgid="8614079794522291840">"เปิดโหมดประหยัดแบตเตอรี่อยู่"</string>
     <string name="battery_saver_notification_text" msgid="820318788126672692">"ลดการใช้แบตเตอรี่และอินเทอร์เน็ตที่ใช้งานอยู่เบื้องหลัง"</string>
     <string name="battery_saver_notification_action_text" msgid="132118784269455533">"ปิดโหมดประหยัดแบตเตอรี่"</string>
-    <string name="media_projection_dialog_text" msgid="3071431025448218928">"<xliff:g id="APP_SEEKING_PERMISSION">%s</xliff:g> จะเริ่มจับภาพทุกอย่างที่แสดงบนหน้าจอ"</string>
+    <string name="media_projection_dialog_text" msgid="1443042478990422751">"<xliff:g id="APP_SEEKING_PERMISSION">%s</xliff:g> จะเริ่มจับภาพทุกสิ่งบนหน้าจอ รวมถึงการแจ้งเตือน รหัสผ่าน รูปภาพ ข้อความ และข้อมูลการชำระเงิน"</string>
+    <string name="media_projection_dialog_title" msgid="7574971526813630219">"อนุญาตให้ <xliff:g id="APP_SEEKING_PERMISSION">%s</xliff:g> บันทึกหรือแคสต์หน้าจอของคุณไหม"</string>
     <string name="media_projection_remember_text" msgid="3103510882172746752">"ไม่ต้องแสดงข้อความนี้อีก"</string>
     <string name="clear_all_notifications_text" msgid="814192889771462828">"ล้างทั้งหมด"</string>
     <string name="manage_notifications_text" msgid="2386728145475108753">"จัดการ"</string>
@@ -814,6 +815,9 @@
     <string name="high_temp_title" msgid="4589508026407318374">"โทรศัพท์เริ่มเครื่องร้อน"</string>
     <string name="high_temp_notif_message" msgid="5642466103153429279">"ฟีเจอร์บางอย่างจะใช้งานได้จำกัดขณะโทรศัพท์ลดอุณหภูมิลง"</string>
     <string name="high_temp_dialog_message" msgid="6840700639374113553">"โทรศัพท์จะพยายามลดอุณหภูมิลงโดยอัตโนมัติ คุณยังสามารถใช้โทรศัพท์ได้ แต่โทรศัพท์อาจทำงานช้าลง\n\nโทรศัพท์จะทำงานตามปกติเมื่อเย็นลงแล้ว"</string>
+    <string name="high_temp_alarm_title" msgid="442812040762745210">"ถอดปลั๊กที่ชาร์จ"</string>
+    <string name="high_temp_alarm_notify_message" msgid="1802871059489414932">"พบปัญหาในการชาร์จอุปกรณ์นี้ ถอดปลั๊กอะแดปเตอร์ด้วยความระมัดระวังเพราะสายอาจร้อน"</string>
+    <string name="high_temp_alarm_help_care_steps" msgid="3631075329318070726">"ดูขั้นตอนในการดูแลรักษา"</string>
     <string name="lockscreen_shortcut_left" msgid="2182769107618938629">"ทางลัดทางซ้าย"</string>
     <string name="lockscreen_shortcut_right" msgid="3328683699505226536">"ทางลัดทางขวา"</string>
     <string name="lockscreen_unlock_left" msgid="2043092136246951985">"ทางลัดทางซ้ายปลดล็อกได้ด้วย"</string>
diff --git a/packages/SystemUI/res/values-tl/strings.xml b/packages/SystemUI/res/values-tl/strings.xml
index 3c05d39..394aaaa 100644
--- a/packages/SystemUI/res/values-tl/strings.xml
+++ b/packages/SystemUI/res/values-tl/strings.xml
@@ -325,7 +325,7 @@
     <string name="quick_settings_wifi_on_label" msgid="7607810331387031235">"Naka-on Ang Wi-Fi"</string>
     <string name="quick_settings_wifi_detail_empty_text" msgid="269990350383909226">"Walang available na mga Wi-Fi network"</string>
     <string name="quick_settings_wifi_secondary_label_transient" msgid="7748206246119760554">"Ino-on…"</string>
-    <string name="quick_settings_cast_title" msgid="7709016546426454729">"I-cast"</string>
+    <string name="quick_settings_cast_title" msgid="6954684227605751758">"Screen Cast"</string>
     <string name="quick_settings_casting" msgid="6601710681033353316">"Nagka-cast"</string>
     <string name="quick_settings_cast_device_default_name" msgid="5367253104742382945">"Walang pangalang device"</string>
     <string name="quick_settings_cast_device_default_description" msgid="2484573682378634413">"Handang mag-cast"</string>
@@ -437,7 +437,8 @@
     <string name="battery_saver_notification_title" msgid="8614079794522291840">"Naka-on ang Pangtipid sa Baterya"</string>
     <string name="battery_saver_notification_text" msgid="820318788126672692">"Binabawasan ang performance at data sa background"</string>
     <string name="battery_saver_notification_action_text" msgid="132118784269455533">"I-off ang Pangtipid sa Baterya"</string>
-    <string name="media_projection_dialog_text" msgid="3071431025448218928">"Sisimulan ng i-capture ng <xliff:g id="APP_SEEKING_PERMISSION">%s</xliff:g> ang lahat ng ipinapakita sa iyong screen."</string>
+    <string name="media_projection_dialog_text" msgid="1443042478990422751">"Magsisimula ang <xliff:g id="APP_SEEKING_PERMISSION">%s</xliff:g> na i-capture ang lahat sa iyong screen kasama ang mga notification, password, larawan, mensahe at impormasyon sa pagbabayad."</string>
+    <string name="media_projection_dialog_title" msgid="7574971526813630219">"Payagan ang <xliff:g id="APP_SEEKING_PERMISSION">%s</xliff:g> na i-record o i-cast ang iyong screen?"</string>
     <string name="media_projection_remember_text" msgid="3103510882172746752">"Huwag ipakitang muli"</string>
     <string name="clear_all_notifications_text" msgid="814192889771462828">"I-clear lahat"</string>
     <string name="manage_notifications_text" msgid="2386728145475108753">"Pamahalaan"</string>
@@ -814,6 +815,9 @@
     <string name="high_temp_title" msgid="4589508026407318374">"Umiinit ang telepono"</string>
     <string name="high_temp_notif_message" msgid="5642466103153429279">"Limitado ang ilang feature habang nagku-cool down ang telepono"</string>
     <string name="high_temp_dialog_message" msgid="6840700639374113553">"Awtomatikong susubukan ng iyong telepono na mag-cool down. Magagamit mo pa rin ang iyong telepono, ngunit maaaring mas mabagal ang paggana nito.\n\nKapag nakapag-cool down na ang iyong telepono, gagana na ito nang normal."</string>
+    <string name="high_temp_alarm_title" msgid="442812040762745210">"Hugutin ang charger"</string>
+    <string name="high_temp_alarm_notify_message" msgid="1802871059489414932">"May isyu sa pag-charge ng device na ito. Hugutin ang power adapter at mag-ingat dahil maaaring mainit ang cable."</string>
+    <string name="high_temp_alarm_help_care_steps" msgid="3631075329318070726">"Tingnan ang mga hakbang sa pangangalaga"</string>
     <string name="lockscreen_shortcut_left" msgid="2182769107618938629">"Kaliwang shortcut"</string>
     <string name="lockscreen_shortcut_right" msgid="3328683699505226536">"Kanang shortcut"</string>
     <string name="lockscreen_unlock_left" msgid="2043092136246951985">"Ina-unlock din ng kaliwang shortcut ang"</string>
diff --git a/packages/SystemUI/res/values-tr/strings.xml b/packages/SystemUI/res/values-tr/strings.xml
index 0f2a7e7..8cab568 100644
--- a/packages/SystemUI/res/values-tr/strings.xml
+++ b/packages/SystemUI/res/values-tr/strings.xml
@@ -325,7 +325,7 @@
     <string name="quick_settings_wifi_on_label" msgid="7607810331387031235">"Kablosuz Bağlantı Açık"</string>
     <string name="quick_settings_wifi_detail_empty_text" msgid="269990350383909226">"Kullanılabilir kablosuz ağ yok"</string>
     <string name="quick_settings_wifi_secondary_label_transient" msgid="7748206246119760554">"Açılıyor…"</string>
-    <string name="quick_settings_cast_title" msgid="7709016546426454729">"Yayınla"</string>
+    <string name="quick_settings_cast_title" msgid="6954684227605751758">"Ekran Yayını"</string>
     <string name="quick_settings_casting" msgid="6601710681033353316">"Yayınlanıyor"</string>
     <string name="quick_settings_cast_device_default_name" msgid="5367253104742382945">"Adsız cihaz"</string>
     <string name="quick_settings_cast_device_default_description" msgid="2484573682378634413">"Yayın için hazır"</string>
@@ -437,7 +437,8 @@
     <string name="battery_saver_notification_title" msgid="8614079794522291840">"Pil Tasarrufu açık"</string>
     <string name="battery_saver_notification_text" msgid="820318788126672692">"Performansı ve arka plan verilerini azaltır"</string>
     <string name="battery_saver_notification_action_text" msgid="132118784269455533">"Pil Tasarrufu\'nu kapat"</string>
-    <string name="media_projection_dialog_text" msgid="3071431025448218928">"<xliff:g id="APP_SEEKING_PERMISSION">%s</xliff:g>, ekranınızda görüntülenen her şeyi kaydetmeye başlayacak."</string>
+    <string name="media_projection_dialog_text" msgid="1443042478990422751">"<xliff:g id="APP_SEEKING_PERMISSION">%s</xliff:g>, ekranınızda görüntülenen her şeyi (bildirimler, şifreler, fotoğraflar, mesajlar ve ödeme bilgileri dahil) kaydetmeye başlayacak."</string>
+    <string name="media_projection_dialog_title" msgid="7574971526813630219">"<xliff:g id="APP_SEEKING_PERMISSION">%s</xliff:g> öğesinin ekranınızı kaydetmesine veya yayınlamasına izin veriyor musunuz?"</string>
     <string name="media_projection_remember_text" msgid="3103510882172746752">"Bir daha gösterme"</string>
     <string name="clear_all_notifications_text" msgid="814192889771462828">"Tümünü temizle"</string>
     <string name="manage_notifications_text" msgid="2386728145475108753">"Yönet"</string>
@@ -814,6 +815,9 @@
     <string name="high_temp_title" msgid="4589508026407318374">"Telefon ısınıyor"</string>
     <string name="high_temp_notif_message" msgid="5642466103153429279">"Telefon soğurken bazı özellikler sınırlı olarak kullanılabilir"</string>
     <string name="high_temp_dialog_message" msgid="6840700639374113553">"Telefonunuz otomatik olarak soğumaya çalışacak. Bu sırada telefonunuzu kullanmaya devam edebilirsiniz ancak uygulamalar daha yavaş çalışabilir.\n\nTelefonunuz soğuduktan sonra normal şekilde çalışacaktır."</string>
+    <string name="high_temp_alarm_title" msgid="442812040762745210">"Şarj cihazını çıkarın"</string>
+    <string name="high_temp_alarm_notify_message" msgid="1802871059489414932">"Bu cihaz şarj edilirken bir sorun oluştu. Güç adaptörünün fişini çekin. Kablo sıcak olabileceğinden fişi çekerken dikkatli olun."</string>
+    <string name="high_temp_alarm_help_care_steps" msgid="3631075329318070726">"Bakımla ilgili adımlara bakın"</string>
     <string name="lockscreen_shortcut_left" msgid="2182769107618938629">"Sol kısayol"</string>
     <string name="lockscreen_shortcut_right" msgid="3328683699505226536">"Sağ kısayol"</string>
     <string name="lockscreen_unlock_left" msgid="2043092136246951985">"Sol kısayol aynı zamanda kilidi açar"</string>
diff --git a/packages/SystemUI/res/values-uk/strings.xml b/packages/SystemUI/res/values-uk/strings.xml
index a1db335..47a6046 100644
--- a/packages/SystemUI/res/values-uk/strings.xml
+++ b/packages/SystemUI/res/values-uk/strings.xml
@@ -327,7 +327,7 @@
     <string name="quick_settings_wifi_on_label" msgid="7607810331387031235">"Wi-Fi увімкнено"</string>
     <string name="quick_settings_wifi_detail_empty_text" msgid="269990350383909226">"Немає доступних мереж Wi-Fi"</string>
     <string name="quick_settings_wifi_secondary_label_transient" msgid="7748206246119760554">"Увімкнення…"</string>
-    <string name="quick_settings_cast_title" msgid="7709016546426454729">"Трансляція"</string>
+    <string name="quick_settings_cast_title" msgid="6954684227605751758">"Трансляція екрана"</string>
     <string name="quick_settings_casting" msgid="6601710681033353316">"Трансляція"</string>
     <string name="quick_settings_cast_device_default_name" msgid="5367253104742382945">"Пристрій без назви"</string>
     <string name="quick_settings_cast_device_default_description" msgid="2484573682378634413">"Готово до трансляції"</string>
@@ -443,7 +443,8 @@
     <string name="battery_saver_notification_title" msgid="8614079794522291840">"Режим економії заряду акумулятора ввімкнено"</string>
     <string name="battery_saver_notification_text" msgid="820318788126672692">"Знижується продуктивність і обмежуються фонові дані"</string>
     <string name="battery_saver_notification_action_text" msgid="132118784269455533">"Вимкнути режим економії заряду акумулятора"</string>
-    <string name="media_projection_dialog_text" msgid="3071431025448218928">"<xliff:g id="APP_SEEKING_PERMISSION">%s</xliff:g> отримає доступ до всіх даних, які відображаються на вашому екрані."</string>
+    <string name="media_projection_dialog_text" msgid="1443042478990422751">"<xliff:g id="APP_SEEKING_PERMISSION">%s</xliff:g> отримає доступ до всіх даних на екрані, зокрема до сповіщень, паролів, фотографій, повідомлень і платіжної інформації."</string>
+    <string name="media_projection_dialog_title" msgid="7574971526813630219">"Дозволити додатку <xliff:g id="APP_SEEKING_PERMISSION">%s</xliff:g> записувати або транслювати дані на екрані?"</string>
     <string name="media_projection_remember_text" msgid="3103510882172746752">"Більше не показувати"</string>
     <string name="clear_all_notifications_text" msgid="814192889771462828">"Очистити все"</string>
     <string name="manage_notifications_text" msgid="2386728145475108753">"Керувати"</string>
@@ -824,6 +825,9 @@
     <string name="high_temp_title" msgid="4589508026407318374">"Телефон нагрівається"</string>
     <string name="high_temp_notif_message" msgid="5642466103153429279">"Під час охолодження деякі функції обмежуються"</string>
     <string name="high_temp_dialog_message" msgid="6840700639374113553">"Ваш телефон охолоджуватиметься автоматично. Ви можете далі користуватися телефоном, але він може працювати повільніше.\n\nКоли телефон охолоне, він працюватиме належним чином."</string>
+    <string name="high_temp_alarm_title" msgid="442812040762745210">"Відключіть зарядний пристрій"</string>
+    <string name="high_temp_alarm_notify_message" msgid="1802871059489414932">"Виникла проблема із заряджанням пристрою. Відключіть адаптер живлення, однак будьте обережні, оскільки кабель може бути гарячим."</string>
+    <string name="high_temp_alarm_help_care_steps" msgid="3631075329318070726">"Переглянути застереження"</string>
     <string name="lockscreen_shortcut_left" msgid="2182769107618938629">"Комбінація клавіш ліворуч"</string>
     <string name="lockscreen_shortcut_right" msgid="3328683699505226536">"Комбінація клавіш праворуч"</string>
     <string name="lockscreen_unlock_left" msgid="2043092136246951985">"Комбінація клавіш ліворуч також розблоковує"</string>
diff --git a/packages/SystemUI/res/values-ur/strings.xml b/packages/SystemUI/res/values-ur/strings.xml
index 45dc3b9..9a7cd14 100644
--- a/packages/SystemUI/res/values-ur/strings.xml
+++ b/packages/SystemUI/res/values-ur/strings.xml
@@ -325,7 +325,7 @@
     <string name="quick_settings_wifi_on_label" msgid="7607810331387031235">"‏Wi-Fi آن ہے"</string>
     <string name="quick_settings_wifi_detail_empty_text" msgid="269990350383909226">"‏کوئی WI-FI نیٹ ورک دستیاب نہیں"</string>
     <string name="quick_settings_wifi_secondary_label_transient" msgid="7748206246119760554">"آن ہو رہا ہے…"</string>
-    <string name="quick_settings_cast_title" msgid="7709016546426454729">"کاسٹ کریں"</string>
+    <string name="quick_settings_cast_title" msgid="6954684227605751758">"اسکرین کاسٹ کریں"</string>
     <string name="quick_settings_casting" msgid="6601710681033353316">"کاسٹنگ"</string>
     <string name="quick_settings_cast_device_default_name" msgid="5367253104742382945">"بغیر نام والا آلہ"</string>
     <string name="quick_settings_cast_device_default_description" msgid="2484573682378634413">"کاسٹ کرنے کیلئے تیار"</string>
@@ -437,7 +437,8 @@
     <string name="battery_saver_notification_title" msgid="8614079794522291840">"بیٹری سیور آن ہے"</string>
     <string name="battery_saver_notification_text" msgid="820318788126672692">"کارکردگی اور پس منظر کا ڈیٹا کم کر دیتا ہے"</string>
     <string name="battery_saver_notification_action_text" msgid="132118784269455533">"بیٹری سیور آف کریں"</string>
-    <string name="media_projection_dialog_text" msgid="3071431025448218928">"<xliff:g id="APP_SEEKING_PERMISSION">%s</xliff:g> آپ کی اسکرین پر ڈسپلے ہونے والی ہر چیز کو کیپچر کرنا شروع کر دیگی۔"</string>
+    <string name="media_projection_dialog_text" msgid="1443042478990422751">"<xliff:g id="APP_SEEKING_PERMISSION">%s</xliff:g> آپ کی اسکرین پر ہر چیز بشمول اطلاعات، پاس ورڈز، تصاویر، پیغامات اور ادائیگی کی معلومات کو کیپچر کرنا شروع کر دے گا۔"</string>
+    <string name="media_projection_dialog_title" msgid="7574971526813630219">"<xliff:g id="APP_SEEKING_PERMISSION">%s</xliff:g> کو آپ کی اسکرین کو ریکارڈ یا کاسٹ کرنے کی اجازت دیں؟"</string>
     <string name="media_projection_remember_text" msgid="3103510882172746752">"دوبارہ نہ دکھائیں"</string>
     <string name="clear_all_notifications_text" msgid="814192889771462828">"سبھی کو صاف کریں"</string>
     <string name="manage_notifications_text" msgid="2386728145475108753">"نظم کریں"</string>
@@ -814,6 +815,9 @@
     <string name="high_temp_title" msgid="4589508026407318374">"فون گرم ہو رہا ہے"</string>
     <string name="high_temp_notif_message" msgid="5642466103153429279">"فون کے ٹھنڈے ہو جانے تک کچھ خصوصیات محدود ہیں"</string>
     <string name="high_temp_dialog_message" msgid="6840700639374113553">"آپ کا فون خودکار طور پر ٹھنڈا ہونے کی کوشش کرے گا۔ آپ ابھی بھی اپنا فون استعمال کر سکتے ہیں، مگر ہو سکتا ہے یہ سست چلے۔\n\nایک بار آپ کا فون ٹھنڈا ہوجائے تو یہ معمول کے مطابق چلے گا۔"</string>
+    <string name="high_temp_alarm_title" msgid="442812040762745210">"چارجر ان پلگ کریں"</string>
+    <string name="high_temp_alarm_notify_message" msgid="1802871059489414932">"اس آلہ کو چارج کرنے میں ایک مسئلہ ہے۔ پاور ایڈاپٹر کو ان پلگ کریں اور دھیان دیں کیونکہ تار گرم ہو سکتا ہے۔"</string>
+    <string name="high_temp_alarm_help_care_steps" msgid="3631075329318070726">"نگہداشت کے اقدامات ملاحظہ کریں"</string>
     <string name="lockscreen_shortcut_left" msgid="2182769107618938629">"بائيں جانب کا شارٹ کٹ"</string>
     <string name="lockscreen_shortcut_right" msgid="3328683699505226536">"دائیں جانب کا شارٹ کٹ"</string>
     <string name="lockscreen_unlock_left" msgid="2043092136246951985">"بائيں جانب کے شارٹ کٹ سے بھی غیرمقفل ہوتا ہے"</string>
diff --git a/packages/SystemUI/res/values-uz/strings.xml b/packages/SystemUI/res/values-uz/strings.xml
index de98f25..a1dd2e1 100644
--- a/packages/SystemUI/res/values-uz/strings.xml
+++ b/packages/SystemUI/res/values-uz/strings.xml
@@ -325,7 +325,7 @@
     <string name="quick_settings_wifi_on_label" msgid="7607810331387031235">"Wi-Fi yoqilgan"</string>
     <string name="quick_settings_wifi_detail_empty_text" msgid="269990350383909226">"Hech qanday Wi-Fi tarmog‘i mavjud emas"</string>
     <string name="quick_settings_wifi_secondary_label_transient" msgid="7748206246119760554">"Yoqilmoqda…"</string>
-    <string name="quick_settings_cast_title" msgid="7709016546426454729">"Translatsiya"</string>
+    <string name="quick_settings_cast_title" msgid="6954684227605751758">"Ekran translatsiyasi"</string>
     <string name="quick_settings_casting" msgid="6601710681033353316">"Translatsiya qilinmoqda"</string>
     <string name="quick_settings_cast_device_default_name" msgid="5367253104742382945">"Nomsiz qurilma"</string>
     <string name="quick_settings_cast_device_default_description" msgid="2484573682378634413">"Tarqatish uchun tayyor"</string>
@@ -437,7 +437,8 @@
     <string name="battery_saver_notification_title" msgid="8614079794522291840">"Quvvat tejash rejimi yoniq"</string>
     <string name="battery_saver_notification_text" msgid="820318788126672692">"Unumdorlik pasayadi va fonda internetdan foydalanish cheklanadi"</string>
     <string name="battery_saver_notification_action_text" msgid="132118784269455533">"Quvvat tejash rejimidan chiqish"</string>
-    <string name="media_projection_dialog_text" msgid="3071431025448218928">"<xliff:g id="APP_SEEKING_PERMISSION">%s</xliff:g> ilovasi qurilma ekranidagi har qanday tasvirni ko‘rishni boshlaydi."</string>
+    <string name="media_projection_dialog_text" msgid="1443042478990422751">"<xliff:g id="APP_SEEKING_PERMISSION">%s</xliff:g> ekrandagi bildirishnomalar, parollar, rasmlar, xabarlar va toʻlovlar kabi barcha narsalarni translatsiya qilishni boshlaydi."</string>
+    <string name="media_projection_dialog_title" msgid="7574971526813630219">"<xliff:g id="APP_SEEKING_PERMISSION">%s</xliff:g> ekranni yozib olishi va translatsiya qilishiga ruxsat berilsinmi?"</string>
     <string name="media_projection_remember_text" msgid="3103510882172746752">"Boshqa ko‘rsatilmasin"</string>
     <string name="clear_all_notifications_text" msgid="814192889771462828">"Hammasini tozalash"</string>
     <string name="manage_notifications_text" msgid="2386728145475108753">"Boshqarish"</string>
@@ -814,6 +815,9 @@
     <string name="high_temp_title" msgid="4589508026407318374">"Telefon qizib ketdi"</string>
     <string name="high_temp_notif_message" msgid="5642466103153429279">"Telefon sovish paytida ayrim funksiyalar ishlamasligi mumkin"</string>
     <string name="high_temp_dialog_message" msgid="6840700639374113553">"Telefon avtomatik ravishda o‘zini sovitadi. Telefoningizdan foydalanishda davom etishingiz mumkin, lekin u sekinroq ishlashi mumkin.\n\nTelefon sovishi bilan normal holatda ishlashni boshlaydi."</string>
+    <string name="high_temp_alarm_title" msgid="442812040762745210">"Quvvatlash moslamasini uzing"</string>
+    <string name="high_temp_alarm_notify_message" msgid="1802871059489414932">"Bu qurilmani quvvatlashda muammo bor. Quvvat adapteri va kabelni tarmoqdan uzing, ular qizib ketgan boʻlishi mumkin."</string>
+    <string name="high_temp_alarm_help_care_steps" msgid="3631075329318070726">"Batafsil axborot"</string>
     <string name="lockscreen_shortcut_left" msgid="2182769107618938629">"Chapga yorlig‘i"</string>
     <string name="lockscreen_shortcut_right" msgid="3328683699505226536">"O‘ngga yorlig‘i"</string>
     <string name="lockscreen_unlock_left" msgid="2043092136246951985">"Chapga tugmasi ham qulfdan chiqaradi"</string>
diff --git a/packages/SystemUI/res/values-vi/strings.xml b/packages/SystemUI/res/values-vi/strings.xml
index 42357df..67970eb 100644
--- a/packages/SystemUI/res/values-vi/strings.xml
+++ b/packages/SystemUI/res/values-vi/strings.xml
@@ -325,7 +325,7 @@
     <string name="quick_settings_wifi_on_label" msgid="7607810331387031235">"Wi-Fi đang bật"</string>
     <string name="quick_settings_wifi_detail_empty_text" msgid="269990350383909226">"Không có mạng Wi-Fi"</string>
     <string name="quick_settings_wifi_secondary_label_transient" msgid="7748206246119760554">"Đang bật…"</string>
-    <string name="quick_settings_cast_title" msgid="7709016546426454729">"Truyền"</string>
+    <string name="quick_settings_cast_title" msgid="6954684227605751758">"Truyền màn hình"</string>
     <string name="quick_settings_casting" msgid="6601710681033353316">"Đang truyền"</string>
     <string name="quick_settings_cast_device_default_name" msgid="5367253104742382945">"Thiết bị không có tên"</string>
     <string name="quick_settings_cast_device_default_description" msgid="2484573682378634413">"Sẵn sàng truyền"</string>
@@ -437,7 +437,8 @@
     <string name="battery_saver_notification_title" msgid="8614079794522291840">"Trình tiết kiệm pin đang bật"</string>
     <string name="battery_saver_notification_text" msgid="820318788126672692">"Giảm hiệu suất và dữ liệu nền"</string>
     <string name="battery_saver_notification_action_text" msgid="132118784269455533">"Tắt trình tiết kiệm pin"</string>
-    <string name="media_projection_dialog_text" msgid="3071431025448218928">"<xliff:g id="APP_SEEKING_PERMISSION">%s</xliff:g> sẽ bắt đầu chụp mọi thứ hiển thị trên màn hình."</string>
+    <string name="media_projection_dialog_text" msgid="1443042478990422751">"<xliff:g id="APP_SEEKING_PERMISSION">%s</xliff:g> sẽ bắt đầu chụp mọi thứ trên màn hình của bạn, bao gồm cả thông báo, mật khẩu, ảnh, tin nhắn và thông tin thanh toán."</string>
+    <string name="media_projection_dialog_title" msgid="7574971526813630219">"Bạn có muốn cho phép <xliff:g id="APP_SEEKING_PERMISSION">%s</xliff:g> ghi hoặc truyền màn hình của bạn không?"</string>
     <string name="media_projection_remember_text" msgid="3103510882172746752">"Không hiển thị lại"</string>
     <string name="clear_all_notifications_text" msgid="814192889771462828">"Xóa tất cả"</string>
     <string name="manage_notifications_text" msgid="2386728145475108753">"Quản lý"</string>
@@ -814,6 +815,9 @@
     <string name="high_temp_title" msgid="4589508026407318374">"Điện thoại đang nóng lên"</string>
     <string name="high_temp_notif_message" msgid="5642466103153429279">"Một số tính năng bị hạn chế trong khi điện thoại nguội dần"</string>
     <string name="high_temp_dialog_message" msgid="6840700639374113553">"Điện thoại của bạn sẽ tự động nguội dần. Bạn vẫn có thể sử dụng điện thoại, nhưng điện thoại có thể chạy chậm hơn. \n\nSau khi đã nguội, điện thoại sẽ chạy bình thường."</string>
+    <string name="high_temp_alarm_title" msgid="442812040762745210">"Rút phích cắm bộ sạc"</string>
+    <string name="high_temp_alarm_notify_message" msgid="1802871059489414932">"Đã xảy ra sự cố khi sạc thiết bị này. Hãy rút phích cắm bộ chuyển đổi điện và cẩn thận vì dây cáp có thể nóng."</string>
+    <string name="high_temp_alarm_help_care_steps" msgid="3631075329318070726">"Xem các bước chăm sóc"</string>
     <string name="lockscreen_shortcut_left" msgid="2182769107618938629">"Lối tắt bên trái"</string>
     <string name="lockscreen_shortcut_right" msgid="3328683699505226536">"Lối tắt bên phải"</string>
     <string name="lockscreen_unlock_left" msgid="2043092136246951985">"Lối tắt bên trái cũng mở khóa"</string>
diff --git a/packages/SystemUI/res/values-zh-rCN/strings.xml b/packages/SystemUI/res/values-zh-rCN/strings.xml
index c1a0bf4..30af99a 100644
--- a/packages/SystemUI/res/values-zh-rCN/strings.xml
+++ b/packages/SystemUI/res/values-zh-rCN/strings.xml
@@ -325,7 +325,7 @@
     <string name="quick_settings_wifi_on_label" msgid="7607810331387031235">"WLAN 已开启"</string>
     <string name="quick_settings_wifi_detail_empty_text" msgid="269990350383909226">"没有 WLAN 网络"</string>
     <string name="quick_settings_wifi_secondary_label_transient" msgid="7748206246119760554">"正在开启…"</string>
-    <string name="quick_settings_cast_title" msgid="7709016546426454729">"投射"</string>
+    <string name="quick_settings_cast_title" msgid="6954684227605751758">"屏幕投射"</string>
     <string name="quick_settings_casting" msgid="6601710681033353316">"正在投射"</string>
     <string name="quick_settings_cast_device_default_name" msgid="5367253104742382945">"未命名设备"</string>
     <string name="quick_settings_cast_device_default_description" msgid="2484573682378634413">"已准备好投射"</string>
@@ -437,7 +437,8 @@
     <string name="battery_saver_notification_title" msgid="8614079794522291840">"省电模式已开启"</string>
     <string name="battery_saver_notification_text" msgid="820318788126672692">"降低性能并限制后台流量"</string>
     <string name="battery_saver_notification_action_text" msgid="132118784269455533">"关闭省电模式"</string>
-    <string name="media_projection_dialog_text" msgid="3071431025448218928">"<xliff:g id="APP_SEEKING_PERMISSION">%s</xliff:g>将开始截取您的屏幕上显示的所有内容。"</string>
+    <string name="media_projection_dialog_text" msgid="1443042478990422751">"<xliff:g id="APP_SEEKING_PERMISSION">%s</xliff:g>将开始捕获您屏幕上显示的所有内容(包括通知、密码、照片、消息和付款信息)。"</string>
+    <string name="media_projection_dialog_title" msgid="7574971526813630219">"要允许<xliff:g id="APP_SEEKING_PERMISSION">%s</xliff:g>录制或投射您的屏幕内容吗?"</string>
     <string name="media_projection_remember_text" msgid="3103510882172746752">"不再显示"</string>
     <string name="clear_all_notifications_text" msgid="814192889771462828">"全部清除"</string>
     <string name="manage_notifications_text" msgid="2386728145475108753">"管理"</string>
@@ -814,6 +815,9 @@
     <string name="high_temp_title" msgid="4589508026407318374">"手机温度上升中"</string>
     <string name="high_temp_notif_message" msgid="5642466103153429279">"手机降温时,部分功能的使用会受限制"</string>
     <string name="high_temp_dialog_message" msgid="6840700639374113553">"您的手机将自动尝试降温。您依然可以使用您的手机,但是手机运行速度可能会更慢。\n\n手机降温后,就会恢复正常的运行速度。"</string>
+    <string name="high_temp_alarm_title" msgid="442812040762745210">"拔下充电器"</string>
+    <string name="high_temp_alarm_notify_message" msgid="1802871059489414932">"为此设备充电时出现问题。这可能是由数据线太热所导致,请拔下电源适配器并采取相应的处理措施。"</string>
+    <string name="high_temp_alarm_help_care_steps" msgid="3631075329318070726">"查看处理步骤"</string>
     <string name="lockscreen_shortcut_left" msgid="2182769107618938629">"向左快捷方式"</string>
     <string name="lockscreen_shortcut_right" msgid="3328683699505226536">"向右快捷方式"</string>
     <string name="lockscreen_unlock_left" msgid="2043092136246951985">"向左快捷方式也可以解锁设备"</string>
diff --git a/packages/SystemUI/res/values-zh-rHK/strings.xml b/packages/SystemUI/res/values-zh-rHK/strings.xml
index 436aecc..04e7eca 100644
--- a/packages/SystemUI/res/values-zh-rHK/strings.xml
+++ b/packages/SystemUI/res/values-zh-rHK/strings.xml
@@ -325,7 +325,7 @@
     <string name="quick_settings_wifi_on_label" msgid="7607810331387031235">"Wi-Fi 已開啟"</string>
     <string name="quick_settings_wifi_detail_empty_text" msgid="269990350383909226">"沒有可用的 Wi-Fi 網絡"</string>
     <string name="quick_settings_wifi_secondary_label_transient" msgid="7748206246119760554">"正在開啟…"</string>
-    <string name="quick_settings_cast_title" msgid="7709016546426454729">"投放"</string>
+    <string name="quick_settings_cast_title" msgid="6954684227605751758">"螢幕投放"</string>
     <string name="quick_settings_casting" msgid="6601710681033353316">"正在放送"</string>
     <string name="quick_settings_cast_device_default_name" msgid="5367253104742382945">"未命名的裝置"</string>
     <string name="quick_settings_cast_device_default_description" msgid="2484573682378634413">"放送準備完成"</string>
@@ -437,7 +437,8 @@
     <string name="battery_saver_notification_title" msgid="8614079794522291840">"省電模式已開啟"</string>
     <string name="battery_saver_notification_text" msgid="820318788126672692">"降低效能並限制背景數據傳輸"</string>
     <string name="battery_saver_notification_action_text" msgid="132118784269455533">"關閉省電模式"</string>
-    <string name="media_projection_dialog_text" msgid="3071431025448218928">"<xliff:g id="APP_SEEKING_PERMISSION">%s</xliff:g> 將開始擷取您的螢幕上顯示的內容。"</string>
+    <string name="media_projection_dialog_text" msgid="1443042478990422751">"<xliff:g id="APP_SEEKING_PERMISSION">%s</xliff:g> 將開始擷取螢幕上的所有內容,包括通知、密碼、相片、訊息和付款資料。"</string>
+    <string name="media_projection_dialog_title" msgid="7574971526813630219">"要允許 <xliff:g id="APP_SEEKING_PERMISSION">%s</xliff:g> 錄製或投放您的畫面嗎?"</string>
     <string name="media_projection_remember_text" msgid="3103510882172746752">"不用再顯示"</string>
     <string name="clear_all_notifications_text" msgid="814192889771462828">"全部清除"</string>
     <string name="manage_notifications_text" msgid="2386728145475108753">"管理"</string>
@@ -814,6 +815,9 @@
     <string name="high_temp_title" msgid="4589508026407318374">"手機溫度正在上升"</string>
     <string name="high_temp_notif_message" msgid="5642466103153429279">"手機降溫時,部分功能會受限制"</string>
     <string name="high_temp_dialog_message" msgid="6840700639374113553">"手機會自動嘗試降溫。您仍可以使用手機,但手機的運作速度可能較慢。\n\n手機降溫後便會恢復正常。"</string>
+    <string name="high_temp_alarm_title" msgid="442812040762745210">"拔下充電器"</string>
+    <string name="high_temp_alarm_notify_message" msgid="1802871059489414932">"為此裝置充電時發生問題。請拔除電源適配器並注意安全,因為連接線可能會發熱。"</string>
+    <string name="high_temp_alarm_help_care_steps" msgid="3631075329318070726">"查看保養步驟"</string>
     <string name="lockscreen_shortcut_left" msgid="2182769107618938629">"向左捷徑"</string>
     <string name="lockscreen_shortcut_right" msgid="3328683699505226536">"向右捷徑"</string>
     <string name="lockscreen_unlock_left" msgid="2043092136246951985">"向左捷徑亦能將裝置解鎖"</string>
diff --git a/packages/SystemUI/res/values-zh-rTW/strings.xml b/packages/SystemUI/res/values-zh-rTW/strings.xml
index fbb6931..86b0eea 100644
--- a/packages/SystemUI/res/values-zh-rTW/strings.xml
+++ b/packages/SystemUI/res/values-zh-rTW/strings.xml
@@ -325,7 +325,7 @@
     <string name="quick_settings_wifi_on_label" msgid="7607810331387031235">"已開啟 Wi-Fi"</string>
     <string name="quick_settings_wifi_detail_empty_text" msgid="269990350383909226">"沒有 Wi-Fi 網路"</string>
     <string name="quick_settings_wifi_secondary_label_transient" msgid="7748206246119760554">"開啟中…"</string>
-    <string name="quick_settings_cast_title" msgid="7709016546426454729">"投放"</string>
+    <string name="quick_settings_cast_title" msgid="6954684227605751758">"螢幕投放"</string>
     <string name="quick_settings_casting" msgid="6601710681033353316">"投放"</string>
     <string name="quick_settings_cast_device_default_name" msgid="5367253104742382945">"未命名的裝置"</string>
     <string name="quick_settings_cast_device_default_description" msgid="2484573682378634413">"可以開始投放了"</string>
@@ -437,7 +437,8 @@
     <string name="battery_saver_notification_title" msgid="8614079794522291840">"節約耗電量模式已開啟"</string>
     <string name="battery_saver_notification_text" msgid="820318788126672692">"降低效能並限制背景數據傳輸"</string>
     <string name="battery_saver_notification_action_text" msgid="132118784269455533">"關閉節約耗電量模式"</string>
-    <string name="media_projection_dialog_text" msgid="3071431025448218928">"<xliff:g id="APP_SEEKING_PERMISSION">%s</xliff:g> 將開始擷取你的螢幕上顯示的內容。"</string>
+    <string name="media_projection_dialog_text" msgid="1443042478990422751">"<xliff:g id="APP_SEEKING_PERMISSION">%s</xliff:g> 會開始擷取畫面上的所有內容 (包含通知、密碼、相片、訊息和付款資訊)。"</string>
+    <string name="media_projection_dialog_title" msgid="7574971526813630219">"要允許 <xliff:g id="APP_SEEKING_PERMISSION">%s</xliff:g> 錄製或投放你的畫面嗎?"</string>
     <string name="media_projection_remember_text" msgid="3103510882172746752">"不要再顯示"</string>
     <string name="clear_all_notifications_text" msgid="814192889771462828">"全部清除"</string>
     <string name="manage_notifications_text" msgid="2386728145475108753">"管理"</string>
@@ -814,6 +815,9 @@
     <string name="high_temp_title" msgid="4589508026407318374">"手機變熱"</string>
     <string name="high_temp_notif_message" msgid="5642466103153429279">"手機降溫時,部分功能會受限"</string>
     <string name="high_temp_dialog_message" msgid="6840700639374113553">"手機會自動嘗試降溫。你仍可繼續使用手機,但是手機的運作速度可能會較慢。\n\n手機降溫完畢後,就會恢復正常的運作速度。"</string>
+    <string name="high_temp_alarm_title" msgid="442812040762745210">"拔除充電器"</string>
+    <string name="high_temp_alarm_notify_message" msgid="1802871059489414932">"為這個裝置充電時發生問題。這可能是因為傳輸線過熱所致,請拔除電源變壓器並採取處理措施。"</string>
+    <string name="high_temp_alarm_help_care_steps" msgid="3631075329318070726">"查看處理步驟"</string>
     <string name="lockscreen_shortcut_left" msgid="2182769107618938629">"向左快速鍵"</string>
     <string name="lockscreen_shortcut_right" msgid="3328683699505226536">"向右快速鍵"</string>
     <string name="lockscreen_unlock_left" msgid="2043092136246951985">"向左快速鍵可一併解鎖裝置"</string>
diff --git a/packages/SystemUI/res/values-zu/strings.xml b/packages/SystemUI/res/values-zu/strings.xml
index 0eb6bd4c..612b61e 100644
--- a/packages/SystemUI/res/values-zu/strings.xml
+++ b/packages/SystemUI/res/values-zu/strings.xml
@@ -325,7 +325,7 @@
     <string name="quick_settings_wifi_on_label" msgid="7607810331387031235">"I-Wi-Fi ivuliwe"</string>
     <string name="quick_settings_wifi_detail_empty_text" msgid="269990350383909226">"Awekho amanethiwekhi we-Wi-Fi atholakalayo"</string>
     <string name="quick_settings_wifi_secondary_label_transient" msgid="7748206246119760554">"Iyavula..."</string>
-    <string name="quick_settings_cast_title" msgid="7709016546426454729">"Abalingisi"</string>
+    <string name="quick_settings_cast_title" msgid="6954684227605751758">"Linganisa isikrini"</string>
     <string name="quick_settings_casting" msgid="6601710681033353316">"Ukusakaza"</string>
     <string name="quick_settings_cast_device_default_name" msgid="5367253104742382945">"Idivayisi engenalo igama"</string>
     <string name="quick_settings_cast_device_default_description" msgid="2484573682378634413">"Ilungele ukusakaza"</string>
@@ -437,7 +437,8 @@
     <string name="battery_saver_notification_title" msgid="8614079794522291840">"Isilondolozi sebhethri sivuliwe"</string>
     <string name="battery_saver_notification_text" msgid="820318788126672692">"Sehlisa ukusebenza nedatha yasemuva"</string>
     <string name="battery_saver_notification_action_text" msgid="132118784269455533">"Vala isilondolozi sebhethri"</string>
-    <string name="media_projection_dialog_text" msgid="3071431025448218928">"<xliff:g id="APP_SEEKING_PERMISSION">%s</xliff:g> izoqala ukuthwebula yonke into eboniswa kusikrini sakho."</string>
+    <string name="media_projection_dialog_text" msgid="1443042478990422751">"I-<xliff:g id="APP_SEEKING_PERMISSION">%s</xliff:g> izoqala ukuthatha yonke into kusikrini sakho efaka izaziso, amaphasiwedi, izithombe, imilayezo, nolwazi lwenkokhelo."</string>
+    <string name="media_projection_dialog_title" msgid="7574971526813630219">"Vumela i-<xliff:g id="APP_SEEKING_PERMISSION">%s</xliff:g> ukuthi irekhode noma isakaze isikrini sakho?"</string>
     <string name="media_projection_remember_text" msgid="3103510882172746752">"Ungabonisi futhi"</string>
     <string name="clear_all_notifications_text" msgid="814192889771462828">"Sula konke"</string>
     <string name="manage_notifications_text" msgid="2386728145475108753">"Phatha"</string>
@@ -814,6 +815,9 @@
     <string name="high_temp_title" msgid="4589508026407318374">"Ifoni iyafudumala"</string>
     <string name="high_temp_notif_message" msgid="5642466103153429279">"Ezinye izici zikhawulelwe ngenkathi ifoni iphola"</string>
     <string name="high_temp_dialog_message" msgid="6840700639374113553">"Ifoni yakho izozama ngokuzenzakalela ukuphola. Ungasasebenzisa ifoni yakho, kodwa ingasebenza ngokungasheshi.\n\nUma ifoni yakho isipholile, izosebenza ngokuvamile."</string>
+    <string name="high_temp_alarm_title" msgid="442812040762745210">"Khipha ishaja"</string>
+    <string name="high_temp_alarm_notify_message" msgid="1802871059489414932">"Kukhona inkinga yokushaja le divayisi. Khipha i-adaptha yamandla, uphinde unakekele njengoba ikhebuli kungenzeka lifudumele."</string>
+    <string name="high_temp_alarm_help_care_steps" msgid="3631075329318070726">"Bona izinyathelo zokunakekelwa"</string>
     <string name="lockscreen_shortcut_left" msgid="2182769107618938629">"Isinqamuleli sangakwesokunxele"</string>
     <string name="lockscreen_shortcut_right" msgid="3328683699505226536">"Isinqamuleli sangakwesokudla"</string>
     <string name="lockscreen_unlock_left" msgid="2043092136246951985">"Isinqamuleli sangakwesokunxele naso siyavula"</string>
diff --git a/packages/SystemUI/res/values/config.xml b/packages/SystemUI/res/values/config.xml
index b4dc0eff..33e1974 100644
--- a/packages/SystemUI/res/values/config.xml
+++ b/packages/SystemUI/res/values/config.xml
@@ -40,6 +40,9 @@
     <!-- Whether or not we show the number in the bar. -->
     <bool name="config_statusBarShowNumber">false</bool>
 
+    <!-- If the lock screen should be dismissed after biometric auth. -->
+    <bool name="config_faceAuthDismissesKeyguard">false</bool>
+
     <!-- Vibrator pattern for camera gesture launch. -->
     <integer-array translatable="false" name="config_cameraLaunchGestureVibePattern">
         <item>0</item>
@@ -311,6 +314,7 @@
         <item>com.android.systemui.ScreenDecorations</item>
         <item>com.android.systemui.biometrics.BiometricDialogImpl</item>
         <item>com.android.systemui.SliceBroadcastRelayHandler</item>
+        <item>com.android.systemui.SizeCompatModeActivityController</item>
     </string-array>
 
     <!-- SystemUI vender service, used in config_systemUIServiceComponents. -->
@@ -325,7 +329,7 @@
     <!-- Nav bar button default ordering/layout -->
     <string name="config_navBarLayout" translatable="false">left[.5W],back[1WC];home;recent[1WC],right[.5W]</string>
     <string name="config_navBarLayoutQuickstep" translatable="false">back[1.7WC];home;contextual[1.7WC]</string>
-    <string name="config_navBarLayoutHandle" translatable="false">";home_handle;"</string>
+    <string name="config_navBarLayoutHandle" translatable="false">";home_handle;assistant_handle[.18WC]"</string>
 
     <bool name="quick_settings_show_full_alarm">false</bool>
 
diff --git a/packages/SystemUI/res/values/dimens.xml b/packages/SystemUI/res/values/dimens.xml
index 50cf37b..c83cb59 100644
--- a/packages/SystemUI/res/values/dimens.xml
+++ b/packages/SystemUI/res/values/dimens.xml
@@ -34,9 +34,11 @@
     <dimen name="navigation_bar_deadzone_size_max">32dp</dimen>
 
     <!-- dimensions for the navigation bar handle -->
-    <dimen name="navigation_handle_width">180dp</dimen>
     <dimen name="navigation_handle_radius">2dp</dimen>
     <dimen name="navigation_handle_bottom">8dp</dimen>
+    <dimen name="navigation_handle_horizontal_margin">30dp</dimen>
+    <dimen name="navigation_home_handle_width">180dp</dimen>
+    <dimen name="navigation_assistant_handle_width">36dp</dimen>
 
     <!-- Height of notification icons in the status bar -->
     <dimen name="status_bar_icon_size">@*android:dimen/status_bar_icon_size</dimen>
@@ -274,7 +276,16 @@
 
     <!-- The height of the quick settings footer that holds the user switcher, settings icon,
          etc. -->
-    <dimen name="qs_footer_height">56dp</dimen>
+    <dimen name="qs_footer_height">48dp</dimen>
+
+    <!-- The size of each of the icon buttons in the QS footer -->
+    <dimen name="qs_footer_action_button_size">@dimen/qs_footer_height</dimen>
+
+    <!-- Margins on each side of QS Footer -->
+    <dimen name="qs_footer_margin">2dp</dimen>
+
+    <!-- Padding on each QS Footer Icon to make the icons 20dpx20dp -->
+    <dimen name="qs_footer_icon_padding">14dp</dimen>
 
     <!-- The padding between the notifications and the quick settings container -->
     <dimen name="qs_notification_padding">@dimen/notification_side_paddings</dimen>
@@ -415,11 +426,16 @@
     <dimen name="qs_detail_item_icon_marginEnd">20dp</dimen>
     <dimen name="qs_header_tooltip_height">18dp</dimen>
     <dimen name="qs_header_alarm_icon_size">18dp</dimen>
+    <dimen name="qs_header_mobile_icon_size">18dp</dimen>
     <dimen name="qs_header_alarm_text_margin_start">6dp</dimen>
+    <dimen name="qs_header_separator_width">8dp</dimen>
+    <dimen name="qs_header_carrier_separator_width">6dp</dimen>
+    <dimen name="qs_status_separator">32dp</dimen>
+    <dimen name="qs_carrier_margin_width">4dp</dimen>
     <dimen name="qs_footer_padding_start">16dp</dimen>
     <dimen name="qs_footer_padding_end">16dp</dimen>
     <dimen name="qs_footer_icon_size">16dp</dimen>
-    <dimen name="qs_paged_tile_layout_padding_bottom">24dp</dimen>
+    <dimen name="qs_paged_tile_layout_padding_bottom">16dp</dimen>
 
     <dimen name="qs_notif_collapsed_space">64dp</dimen>
 
@@ -592,7 +608,7 @@
     <dimen name="multi_user_avatar_keyguard_size">22dp</dimen>
 
     <!-- The width of user avatar when expanded -->
-    <dimen name="multi_user_avatar_expanded_size">18dp</dimen>
+    <dimen name="multi_user_avatar_expanded_size">20dp</dimen>
 
     <!-- The font size of the time when collapsed in QS -->
     <dimen name="qs_time_collapsed_size">14sp</dimen>
@@ -661,9 +677,9 @@
     <dimen name="keyguard_affordance_width">56dp</dimen>
 
     <!-- The width/height of the unlock icon view on keyguard. -->
-    <dimen name="keyguard_lock_height">32dp</dimen>
-    <dimen name="keyguard_lock_width">32dp</dimen>
-    <dimen name="keyguard_lock_padding">24dp</dimen>
+    <dimen name="keyguard_lock_height">42dp</dimen>
+    <dimen name="keyguard_lock_width">42dp</dimen>
+    <dimen name="keyguard_lock_padding">19dp</dimen>
 
     <dimen name="keyguard_indication_margin_bottom">65dp</dimen>
 
diff --git a/packages/SystemUI/res/values/donottranslate.xml b/packages/SystemUI/res/values/donottranslate.xml
index 38f469e..67293c5 100644
--- a/packages/SystemUI/res/values/donottranslate.xml
+++ b/packages/SystemUI/res/values/donottranslate.xml
@@ -18,8 +18,8 @@
 -->
 <resources xmlns:xliff="urn:oasis:names:tc:xliff:document:1.2">
     <!-- Date format for display: should match the lockscreen in /policy.  -->
-    <string name="system_ui_date_pattern">@*android:string/system_ui_date_pattern</string>
+    <string name="system_ui_date_pattern" translatable="false">@*android:string/system_ui_date_pattern</string>
 
     <!-- Date format for the always on display.  -->
-    <item type="string" name="system_ui_aod_date_pattern">eeeMMMd</item>
+    <item type="string" name="system_ui_aod_date_pattern" translatable="false">eeeMMMd</item>
 </resources>
diff --git a/packages/SystemUI/res/values/integers.xml b/packages/SystemUI/res/values/integers.xml
index e8fabf5..a6dae45 100644
--- a/packages/SystemUI/res/values/integers.xml
+++ b/packages/SystemUI/res/values/integers.xml
@@ -19,8 +19,8 @@
 
     <!-- Action footer width used for layout_width to indicate WRAP_CONTENT (along with a weight of
          0) as we can allow the carrier text to stretch as far as needed in the QS footer. -->
-    <integer name="qs_footer_actions_width">-2</integer>
-    <integer name="qs_footer_actions_weight">0</integer>
+    <integer name="qs_footer_actions_width">0</integer>
+    <integer name="qs_footer_actions_weight">1</integer>
 
     <!-- Maximum number of bubbles to render and animate at one time. While the animations used are
          lightweight translation animations, this number can be reduced on lower end devices if any
diff --git a/packages/SystemUI/res/values/internal.xml b/packages/SystemUI/res/values/internal.xml
index e0d3cd2..930cfce 100644
--- a/packages/SystemUI/res/values/internal.xml
+++ b/packages/SystemUI/res/values/internal.xml
@@ -18,6 +18,5 @@
     <dimen name="status_bar_height">@*android:dimen/status_bar_height</dimen>
     <dimen name="navigation_bar_height">@*android:dimen/navigation_bar_height</dimen>
     <dimen name="navigation_bar_height_car_mode">@*android:dimen/navigation_bar_height_car_mode</dimen>
-    <color name="screen_pinning_primary_text">@*android:color/primary_text_default_material_light</color>
 </resources>
 
diff --git a/packages/SystemUI/res/values/strings.xml b/packages/SystemUI/res/values/strings.xml
index 4905e57..9e9aada 100644
--- a/packages/SystemUI/res/values/strings.xml
+++ b/packages/SystemUI/res/values/strings.xml
@@ -651,8 +651,6 @@
 
     <!-- The overflow indicator shown when a group has more notification inside the group than the visible ones. An example is "+ 3" [CHAR LIMIT=5] -->
     <string name="notification_group_overflow_indicator">+ <xliff:g id="number" example="3">%s</xliff:g></string>
-    <!-- The overflow indicator shown when a group has more notification inside the group than the visible ones. An example is "New message, +3" [CHAR LIMIT=7] -->
-    <string name="notification_group_overflow_indicator_ambient"><xliff:g id="notification_title" example="New message">%1$s</xliff:g>, +<xliff:g id="overflow" example="+3">%2$s</xliff:g></string>
 
     <!-- Content description describing how many more notifications are in a group [CHAR LIMIT=NONE] -->
     <plurals name="notification_group_overflow_description">
@@ -776,7 +774,7 @@
     <!-- QuickSettings: Wifi secondary label shown when the wifi is being enabled [CHAR LIMIT=NONE] -->
     <string name="quick_settings_wifi_secondary_label_transient">Turning on&#8230;</string>
     <!-- QuickSettings: Cast title [CHAR LIMIT=NONE] -->
-    <string name="quick_settings_cast_title">Cast</string>
+    <string name="quick_settings_cast_title">Screen Cast</string>
     <!-- QuickSettings: Cast detail panel, status text when casting [CHAR LIMIT=NONE] -->
     <string name="quick_settings_casting">Casting</string>
     <!-- QuickSettings: Cast detail panel, default device name [CHAR LIMIT=NONE] -->
@@ -1579,16 +1577,19 @@
     <string name="inline_blocking_helper">You usually dismiss these notifications.
     \nKeep showing them?</string>
 
-    <!-- Notification Inline controls: button to dismiss the blocking helper [CHAR_LIMIT=25] -->
+    <!-- Notification Inline controls: button to dismiss the blocking helper [CHAR_LIMIT=20] -->
     <string name="inline_done_button">Done</string>
 
+    <!-- Notification Inline controls: button to dismiss the blocking helper [CHAR_LIMIT=20] -->
+    <string name="inline_ok_button">OK</string>
+
     <!-- Notification Inline controls: continue receiving notifications prompt, channel level -->
     <string name="inline_keep_showing">Keep showing these notifications?</string>
 
     <!-- Notification inline controls: block notifications button [CHAR_LIMIT=25] -->
     <string name="inline_stop_button">Stop notifications</string>
 
-    <!-- Notification inline controls: button to deliver notifications silently from this channel [CHAR_LIMIT=35] -->
+    <!-- Notification inline controls: button to deliver notifications silently from this channel [CHAR_LIMIT=30] -->
     <string name="inline_deliver_silently_button">Deliver Silently</string>
 
     <!-- Notification inline controls: button to block notifications from this channel [CHAR_LIMIT=20] -->
@@ -2373,6 +2374,9 @@
     <!-- What to show on the ambient display player when song doesn't have a title. [CHAR LIMIT=20] -->
     <string name="music_controls_no_title">No title</string>
 
+    <!-- Description of the restart button in the hint of size compatibility mode. [CHAR LIMIT=NONE] -->
+    <string name="restart_button_description">Tap to restart this app and go full screen.</string>
+
     <!-- Text used for content description of deep link button in the header of expanded bubble
          view. [CHAR_LIMIT=NONE] -->
     <string name="bubbles_deep_link_button_description">Open <xliff:g id="app_name" example="YouTube">%1$s</xliff:g></string>
diff --git a/packages/SystemUI/res/values/styles.xml b/packages/SystemUI/res/values/styles.xml
index 30dbc8b..4adece9 100644
--- a/packages/SystemUI/res/values/styles.xml
+++ b/packages/SystemUI/res/values/styles.xml
@@ -71,11 +71,11 @@
 
     <style name="hybrid_notification_title">
         <item name="android:paddingEnd">4dp</item>
-        <item name="android:textAppearance">@*android:style/TextAppearance.Material.Notification.Title</item>
+        <item name="android:textAppearance">@*android:style/TextAppearance.DeviceDefault.Notification.Title</item>
     </style>
 
     <style name="hybrid_notification_text"
-           parent="@*android:style/Widget.Material.Notification.Text">
+           parent="@*android:style/Widget.DeviceDefault.Notification.Text">
         <item name="android:paddingEnd">4dp</item>
     </style>
 
@@ -227,6 +227,8 @@
         <item name="android:textSize">@dimen/qs_carrier_info_text_size</item>
     </style>
 
+    <style name="TextAppearance.QS.Status" parent="TextAppearance.QS.TileLabel.Secondary" />
+
     <style name="TextAppearance.AppOpsDialog" />
 
     <style name="TextAppearance.AppOpsDialog.Title">
@@ -239,10 +241,19 @@
         <item name="android:fontFamily">@*android:string/config_bodyFontFamily</item>
     </style>
 
-    <style name="TextAppearance.DeviceManagementDialog.Title" parent="@android:style/TextAppearance.DeviceDefault.DialogWindowTitle">
-        <item name="android:gravity">center</item>
+    <style name="TextAppearance.DeviceManagementDialog">
+        <item name="android:textColor">?android:attr/textColorPrimary</item>
     </style>
 
+    <style name="TextAppearance.DeviceManagementDialog.Title" parent="@android:style/TextAppearance.DeviceDefault.DialogWindowTitle"/>
+
+    <style name="DeviceManagementDialogTitle">
+        <item name="android:gravity">center</item>
+        <item name="android:textAppearance">@style/TextAppearance.DeviceManagementDialog.Title</item>
+    </style>
+
+    <style name="TextAppearance.DeviceManagementDialog.Content" parent="@*android:style/TextAppearance.DeviceDefault.Subhead"/>
+
     <style name="BaseBrightnessDialogContainer" parent="@style/Theme.SystemUI">
         <item name="android:layout_width">match_parent</item>
         <item name="android:layout_height">wrap_content</item>
@@ -276,7 +287,6 @@
         <item name="*android:lockPatternStyle">@style/LockPatternStyle</item>
         <item name="passwordStyle">@style/PasswordTheme</item>
         <item name="backgroundProtectedStyle">@style/BackgroundProtectedStyle</item>
-        <item name="android:forceDarkAllowed">false</item>
 
         <!-- Needed for MediaRoute chooser dialog -->
         <item name="*android:isLightTheme">false</item>
@@ -327,10 +337,6 @@
         <item name="android:gravity">center</item>
     </style>
 
-    <style name="TextAppearance.Material.Notification.HeaderTitle"
-        parent="@*android:style/TextAppearance.Material.Notification.Info">
-    </style>
-
     <style name="SearchPanelCircle">
         <item name="android:layout_width">match_parent</item>
         <item name="android:layout_height">match_parent</item>
@@ -460,7 +466,7 @@
     </style>
 
     <style name="TextAppearance.HeadsUpStatusBarText"
-           parent="@*android:style/TextAppearance.Material.Notification.Info">
+           parent="@*android:style/TextAppearance.DeviceDefault.Notification.Info">
     </style>
 
     <style name="TextAppearance.QSEdit.Headers"
diff --git a/packages/SystemUI/shared/src/com/android/systemui/shared/recents/IOverviewProxy.aidl b/packages/SystemUI/shared/src/com/android/systemui/shared/recents/IOverviewProxy.aidl
index 37abab9..ce615b6 100644
--- a/packages/SystemUI/shared/src/com/android/systemui/shared/recents/IOverviewProxy.aidl
+++ b/packages/SystemUI/shared/src/com/android/systemui/shared/recents/IOverviewProxy.aidl
@@ -113,4 +113,10 @@
      * Sent when there was an action on one of the onboarding tips view.
      */
     void onTip(int actionType, int viewType) = 10;
+
+    /**
+     * Sent when device assistant changes its default assistant whether it is available or not.
+     */
+    void onAssistantAvailable(boolean available) = 13;
+
 }
diff --git a/packages/SystemUI/shared/src/com/android/systemui/shared/recents/ISystemUiProxy.aidl b/packages/SystemUI/shared/src/com/android/systemui/shared/recents/ISystemUiProxy.aidl
index 078947c..953816e 100644
--- a/packages/SystemUI/shared/src/com/android/systemui/shared/recents/ISystemUiProxy.aidl
+++ b/packages/SystemUI/shared/src/com/android/systemui/shared/recents/ISystemUiProxy.aidl
@@ -17,6 +17,7 @@
 package com.android.systemui.shared.recents;
 
 import android.graphics.Rect;
+import android.os.Bundle;
 import android.view.MotionEvent;
 
 /**
@@ -82,4 +83,13 @@
      */
     boolean supportsRoundedCornersOnWindows() = 11;
 
+    /**
+     * Proxies the assistant gesture's progress started from navigation bar.
+     */
+    void onAssistantProgress(float progress) = 12;
+
+    /**
+     * Start the assistant.
+     */
+    void startAssistant(in Bundle bundle) = 13;
 }
diff --git a/packages/SystemUI/shared/src/com/android/systemui/shared/system/ActivityManagerWrapper.java b/packages/SystemUI/shared/src/com/android/systemui/shared/system/ActivityManagerWrapper.java
index 46ed715b..0f71ffb 100644
--- a/packages/SystemUI/shared/src/com/android/systemui/shared/system/ActivityManagerWrapper.java
+++ b/packages/SystemUI/shared/src/com/android/systemui/shared/system/ActivityManagerWrapper.java
@@ -16,6 +16,7 @@
 
 package com.android.systemui.shared.system;
 
+import static android.app.ActivityManager.LOCK_TASK_MODE_LOCKED;
 import static android.app.ActivityManager.LOCK_TASK_MODE_NONE;
 import static android.app.ActivityManager.LOCK_TASK_MODE_PINNED;
 import static android.app.ActivityManager.RECENT_IGNORE_UNAVAILABLE;
@@ -464,6 +465,17 @@
     }
 
     /**
+     * @return whether lock task mode is active in kiosk-mode (not screen pinning).
+     */
+    public boolean isLockTaskKioskModeActive() {
+        try {
+            return ActivityTaskManager.getService().getLockTaskModeState() == LOCK_TASK_MODE_LOCKED;
+        } catch (RemoteException e) {
+            return false;
+        }
+    }
+
+    /**
      * Shows a voice session identified by {@code token}
      * @return true if the session was shown, false otherwise
      */
diff --git a/packages/SystemUI/shared/src/com/android/systemui/shared/system/DevicePolicyManagerWrapper.java b/packages/SystemUI/shared/src/com/android/systemui/shared/system/DevicePolicyManagerWrapper.java
new file mode 100644
index 0000000..c6722ae
--- /dev/null
+++ b/packages/SystemUI/shared/src/com/android/systemui/shared/system/DevicePolicyManagerWrapper.java
@@ -0,0 +1,43 @@
+/*
+ * Copyright (C) 2019 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 com.android.systemui.shared.system;
+
+import android.app.AppGlobals;
+import android.app.admin.DevicePolicyManager;
+
+/**
+ * Wrapper for {@link DevicePolicyManager}.
+ */
+public class DevicePolicyManagerWrapper {
+    private static final DevicePolicyManagerWrapper sInstance = new DevicePolicyManagerWrapper();
+
+    private static final DevicePolicyManager sDevicePolicyManager =
+            AppGlobals.getInitialApplication().getSystemService(DevicePolicyManager.class);
+
+    private DevicePolicyManagerWrapper() { }
+
+    public static DevicePolicyManagerWrapper getInstance() {
+        return sInstance;
+    }
+
+    /**
+     * Returns whether the given package is allowed to run in Lock Task mode.
+     */
+    public boolean isLockTaskPermitted(String pkg) {
+        return sDevicePolicyManager.isLockTaskPermitted(pkg);
+    }
+}
diff --git a/packages/SystemUI/shared/src/com/android/systemui/shared/system/InputConsumerController.java b/packages/SystemUI/shared/src/com/android/systemui/shared/system/InputConsumerController.java
index 0cde9da..e554dcd 100644
--- a/packages/SystemUI/shared/src/com/android/systemui/shared/system/InputConsumerController.java
+++ b/packages/SystemUI/shared/src/com/android/systemui/shared/system/InputConsumerController.java
@@ -27,26 +27,26 @@
 import android.util.Log;
 import android.view.BatchedInputEventReceiver;
 import android.view.Choreographer;
+import android.view.IWindowManager;
 import android.view.InputChannel;
 import android.view.InputEvent;
-import android.view.IWindowManager;
-import android.view.MotionEvent;
 import android.view.WindowManagerGlobal;
 
 import java.io.PrintWriter;
 
 /**
- * Manages the input consumer that allows the SystemUI to directly receive touch input.
+ * Manages the input consumer that allows the SystemUI to directly receive input.
  */
 public class InputConsumerController {
 
     private static final String TAG = InputConsumerController.class.getSimpleName();
 
     /**
-     * Listener interface for callers to subscribe to touch events.
+     * Listener interface for callers to subscribe to input events.
      */
-    public interface TouchListener {
-        boolean onTouchEvent(MotionEvent ev);
+    public interface InputListener {
+        /** Handles any input event. */
+        boolean onInputEvent(InputEvent ev);
     }
 
     /**
@@ -71,9 +71,8 @@
         public void onInputEvent(InputEvent event) {
             boolean handled = true;
             try {
-                if (mListener != null && event instanceof MotionEvent) {
-                    MotionEvent ev = (MotionEvent) event;
-                    handled = mListener.onTouchEvent(ev);
+                if (mListener != null) {
+                    handled = mListener.onInputEvent(event);
                 }
             } finally {
                 finishInputEvent(event, handled);
@@ -86,7 +85,7 @@
     private final String mName;
 
     private InputEventReceiver mInputEventReceiver;
-    private TouchListener mListener;
+    private InputListener mListener;
     private RegistrationListener mRegistrationListener;
 
     /**
@@ -115,9 +114,9 @@
     }
 
     /**
-     * Sets the touch listener.
+     * Sets the input listener.
      */
-    public void setTouchListener(TouchListener listener) {
+    public void setInputListener(InputListener listener) {
         mListener = listener;
     }
 
diff --git a/packages/SystemUI/shared/src/com/android/systemui/shared/system/PackageManagerWrapper.java b/packages/SystemUI/shared/src/com/android/systemui/shared/system/PackageManagerWrapper.java
index 32e4bbf..443c1e1 100644
--- a/packages/SystemUI/shared/src/com/android/systemui/shared/system/PackageManagerWrapper.java
+++ b/packages/SystemUI/shared/src/com/android/systemui/shared/system/PackageManagerWrapper.java
@@ -22,8 +22,10 @@
 import android.content.pm.ActivityInfo;
 import android.content.pm.IPackageManager;
 import android.content.pm.PackageManager;
+import android.content.pm.PackageManager.ResolveInfoFlags;
 import android.content.pm.ResolveInfo;
 import android.os.RemoteException;
+import android.os.UserHandle;
 
 import java.util.List;
 
@@ -40,6 +42,8 @@
         return sInstance;
     }
 
+    private PackageManagerWrapper() {}
+
     /**
      * @return the activity info for a given {@param componentName} and {@param userId}.
      */
@@ -65,4 +69,19 @@
             return null;
         }
     }
+
+    /**
+     * Determine the best Activity to perform for a given Intent.
+     */
+    public ResolveInfo resolveActivity(Intent intent, @ResolveInfoFlags int flags) {
+        final String resolvedType =
+                intent.resolveTypeIfNeeded(AppGlobals.getInitialApplication().getContentResolver());
+        try {
+            return mIPackageManager.resolveIntent(
+                    intent, resolvedType, flags, UserHandle.getCallingUserId());
+        } catch (RemoteException e) {
+            e.printStackTrace();
+            return null;
+        }
+    }
 }
diff --git a/packages/SystemUI/shared/src/com/android/systemui/shared/system/TaskStackChangeListener.java b/packages/SystemUI/shared/src/com/android/systemui/shared/system/TaskStackChangeListener.java
index 3d2f61e..f2a961d 100644
--- a/packages/SystemUI/shared/src/com/android/systemui/shared/system/TaskStackChangeListener.java
+++ b/packages/SystemUI/shared/src/com/android/systemui/shared/system/TaskStackChangeListener.java
@@ -18,6 +18,7 @@
 
 import android.app.ActivityManager.RunningTaskInfo;
 import android.content.ComponentName;
+import android.os.IBinder;
 import android.os.UserHandle;
 import android.util.Log;
 
@@ -48,6 +49,21 @@
         onActivityLaunchOnSecondaryDisplayFailed();
     }
 
+    /**
+     * @see #onActivityLaunchOnSecondaryDisplayRerouted(RunningTaskInfo taskInfo)
+     */
+    public void onActivityLaunchOnSecondaryDisplayRerouted() { }
+
+    /**
+     * Called when an activity was requested to be launched on a secondary display but was rerouted
+     * to default display.
+     *
+     * @param taskInfo info about the Activity's task
+     */
+    public void onActivityLaunchOnSecondaryDisplayRerouted(RunningTaskInfo taskInfo) {
+        onActivityLaunchOnSecondaryDisplayRerouted();
+    }
+
     public void onTaskProfileLocked(int taskId, int userId) { }
     public void onTaskCreated(int taskId, ComponentName componentName) { }
     public void onTaskRemoved(int taskId) { }
@@ -58,6 +74,7 @@
     }
 
     public void onActivityRequestedOrientationChanged(int taskId, int requestedOrientation) { }
+    public void onSizeCompatModeActivityChanged(int displayId, IBinder activityToken) { }
 
     /**
      * Checks that the current user matches the process. Since
diff --git a/packages/SystemUI/shared/src/com/android/systemui/shared/system/TaskStackChangeListeners.java b/packages/SystemUI/shared/src/com/android/systemui/shared/system/TaskStackChangeListeners.java
index a9ac42f..6e3eb7c 100644
--- a/packages/SystemUI/shared/src/com/android/systemui/shared/system/TaskStackChangeListeners.java
+++ b/packages/SystemUI/shared/src/com/android/systemui/shared/system/TaskStackChangeListeners.java
@@ -23,6 +23,7 @@
 import android.app.TaskStackListener;
 import android.content.ComponentName;
 import android.os.Handler;
+import android.os.IBinder;
 import android.os.Looper;
 import android.os.Message;
 import android.os.RemoteException;
@@ -141,6 +142,13 @@
     }
 
     @Override
+    public void onActivityLaunchOnSecondaryDisplayRerouted(RunningTaskInfo taskInfo,
+            int requestedDisplayId) throws RemoteException {
+        mHandler.obtainMessage(H.ON_ACTIVITY_LAUNCH_ON_SECONDARY_DISPLAY_REROUTED,
+                 requestedDisplayId, 0 /* unused */, taskInfo).sendToTarget();
+    }
+
+    @Override
     public void onTaskProfileLocked(int taskId, int userId) throws RemoteException {
         mHandler.obtainMessage(H.ON_TASK_PROFILE_LOCKED, taskId, userId).sendToTarget();
     }
@@ -173,6 +181,12 @@
                 requestedOrientation).sendToTarget();
     }
 
+    @Override
+    public void onSizeCompatModeActivityChanged(int displayId, IBinder activityToken) {
+        mHandler.obtainMessage(H.ON_SIZE_COMPAT_MODE_ACTIVITY_CHANGED, displayId, 0 /* unused */,
+                activityToken).sendToTarget();
+    }
+
     private final class H extends Handler {
         private static final int ON_TASK_STACK_CHANGED = 1;
         private static final int ON_TASK_SNAPSHOT_CHANGED = 2;
@@ -189,6 +203,8 @@
         private static final int ON_TASK_REMOVED = 13;
         private static final int ON_TASK_MOVED_TO_FRONT = 14;
         private static final int ON_ACTIVITY_REQUESTED_ORIENTATION_CHANGE = 15;
+        private static final int ON_ACTIVITY_LAUNCH_ON_SECONDARY_DISPLAY_REROUTED = 16;
+        private static final int ON_SIZE_COMPAT_MODE_ACTIVITY_CHANGED = 17;
 
 
         public H(Looper looper) {
@@ -270,6 +286,14 @@
                         }
                         break;
                     }
+                    case ON_ACTIVITY_LAUNCH_ON_SECONDARY_DISPLAY_REROUTED: {
+                        final RunningTaskInfo info = (RunningTaskInfo) msg.obj;
+                        for (int i = mTaskStackListeners.size() - 1; i >= 0; i--) {
+                            mTaskStackListeners.get(i)
+                                .onActivityLaunchOnSecondaryDisplayRerouted(info);
+                        }
+                        break;
+                    }
                     case ON_TASK_PROFILE_LOCKED: {
                         for (int i = mTaskStackListeners.size() - 1; i >= 0; i--) {
                             mTaskStackListeners.get(i).onTaskProfileLocked(msg.arg1, msg.arg2);
@@ -303,6 +327,13 @@
                         }
                         break;
                     }
+                    case ON_SIZE_COMPAT_MODE_ACTIVITY_CHANGED: {
+                        for (int i = mTaskStackListeners.size() - 1; i >= 0; i--) {
+                            mTaskStackListeners.get(i).onSizeCompatModeActivityChanged(
+                                    msg.arg1, (IBinder) msg.obj);
+                        }
+                        break;
+                    }
                 }
             }
         }
diff --git a/packages/SystemUI/shared/src/com/android/systemui/shared/system/WindowManagerWrapper.java b/packages/SystemUI/shared/src/com/android/systemui/shared/system/WindowManagerWrapper.java
index 10996e88..794c30a 100644
--- a/packages/SystemUI/shared/src/com/android/systemui/shared/system/WindowManagerWrapper.java
+++ b/packages/SystemUI/shared/src/com/android/systemui/shared/system/WindowManagerWrapper.java
@@ -217,4 +217,11 @@
         WindowManagerGlobal.getWindowManagerService().registerPinnedStackListener(
                 DEFAULT_DISPLAY, mPinnedStackListenerForwarder);
     }
+
+    /**
+     * Removes a pinned stack listener.
+     */
+    public void removePinnedStackListener(IPinnedStackListener listener) {
+        mPinnedStackListenerForwarder.removeListener(listener);
+    }
 }
diff --git a/packages/SystemUI/src/com/android/keyguard/CarrierTextController.java b/packages/SystemUI/src/com/android/keyguard/CarrierTextController.java
index 1539582..64517ba 100644
--- a/packages/SystemUI/src/com/android/keyguard/CarrierTextController.java
+++ b/packages/SystemUI/src/com/android/keyguard/CarrierTextController.java
@@ -52,9 +52,11 @@
     private boolean mTelephonyCapable;
     private boolean mShowMissingSim;
     private boolean mShowAirplaneMode;
-    private KeyguardUpdateMonitor mKeyguardUpdateMonitor;
+    @VisibleForTesting
+    protected KeyguardUpdateMonitor mKeyguardUpdateMonitor;
     private WifiManager mWifiManager;
-    private boolean[] mSimErrorState = new boolean[TelephonyManager.getDefault().getPhoneCount()];
+    private boolean[] mSimErrorState;
+    private final int mSimSlotsNumber;
     private CarrierTextCallback mCarrierTextCallback;
     private Context mContext;
     private CharSequence mSeparator;
@@ -72,7 +74,8 @@
                 }
             };
 
-    private final KeyguardUpdateMonitorCallback mCallback = new KeyguardUpdateMonitorCallback() {
+    @VisibleForTesting
+    protected final KeyguardUpdateMonitorCallback mCallback = new KeyguardUpdateMonitorCallback() {
         @Override
         public void onRefreshCarrierInfo() {
             if (DEBUG) {
@@ -93,7 +96,7 @@
         }
 
         public void onSimStateChanged(int subId, int slotId, IccCardConstants.State simState) {
-            if (slotId < 0) {
+            if (slotId < 0 || slotId >= mSimSlotsNumber) {
                 Log.d(TAG, "onSimStateChanged() - slotId invalid: " + slotId
                         + " mTelephonyCapable: " + Boolean.toString(mTelephonyCapable));
                 return;
@@ -144,36 +147,48 @@
         mWifiManager = (WifiManager) context.getSystemService(Context.WIFI_SERVICE);
         mSeparator = separator;
         mWakefulnessLifecycle = Dependency.get(WakefulnessLifecycle.class);
+        mSimSlotsNumber = ((TelephonyManager) context.getSystemService(
+                Context.TELEPHONY_SERVICE)).getPhoneCount();
+        mSimErrorState = new boolean[mSimSlotsNumber];
     }
 
     /**
      * Checks if there are faulty cards. Adds the text depending on the slot of the card
      *
      * @param text:   current carrier text based on the sim state
+     * @param carrierNames names order by subscription order
+     * @param subOrderBySlot array containing the sub index for each slot ID
      * @param noSims: whether a valid sim card is inserted
      * @return text
      */
-    private CharSequence updateCarrierTextWithSimIoError(CharSequence text, boolean noSims) {
+    private CharSequence updateCarrierTextWithSimIoError(CharSequence text,
+            CharSequence[] carrierNames, int[] subOrderBySlot, boolean noSims) {
         final CharSequence carrier = "";
         CharSequence carrierTextForSimIOError = getCarrierTextForSimState(
                 IccCardConstants.State.CARD_IO_ERROR, carrier);
+        // mSimErrorState has the state of each sim indexed by slotID.
         for (int index = 0; index < mSimErrorState.length; index++) {
-            if (mSimErrorState[index]) {
-                // In the case when no sim cards are detected but a faulty card is inserted
-                // overwrite the text and only show "Invalid card"
-                if (noSims) {
-                    return concatenate(carrierTextForSimIOError,
-                            getContext().getText(
-                                    com.android.internal.R.string.emergency_calls_only),
-                            mSeparator);
-                } else if (index == 0) {
-                    // prepend "Invalid card" when faulty card is inserted in slot 0
-                    text = concatenate(carrierTextForSimIOError, text, mSeparator);
-                } else {
-                    // concatenate "Invalid card" when faulty card is inserted in slot 1
-                    text = concatenate(text, carrierTextForSimIOError, mSeparator);
-                }
+            if (!mSimErrorState[index]) {
+                continue;
             }
+            // In the case when no sim cards are detected but a faulty card is inserted
+            // overwrite the text and only show "Invalid card"
+            if (noSims) {
+                return concatenate(carrierTextForSimIOError,
+                        getContext().getText(
+                                com.android.internal.R.string.emergency_calls_only),
+                        mSeparator);
+            } else if (subOrderBySlot[index] != -1) {
+                int subIndex = subOrderBySlot[index];
+                // prepend "Invalid card" when faulty card is inserted in slot 0 or 1
+                carrierNames[subIndex] = concatenate(carrierTextForSimIOError,
+                        carrierNames[subIndex],
+                        mSeparator);
+            } else {
+                // concatenate "Invalid card" when faulty card is inserted in other slot
+                text = concatenate(text, carrierTextForSimIOError, mSeparator);
+            }
+
         }
         return text;
     }
@@ -209,16 +224,25 @@
     protected void updateCarrierText() {
         boolean allSimsMissing = true;
         boolean anySimReadyAndInService = false;
-        boolean missingSimsWithSubs = false;
         CharSequence displayText = null;
 
         List<SubscriptionInfo> subs = mKeyguardUpdateMonitor.getSubscriptionInfo(false);
         final int numSubs = subs.size();
         final int[] subsIds = new int[numSubs];
+        // This array will contain in position i, the index of subscription in slot ID i.
+        // -1 if no subscription in that slot
+        final int[] subOrderBySlot = new int[mSimSlotsNumber];
+        for (int i = 0; i < mSimSlotsNumber; i++) {
+            subOrderBySlot[i] = -1;
+        }
+        final CharSequence[] carrierNames = new CharSequence[numSubs];
         if (DEBUG) Log.d(TAG, "updateCarrierText(): " + numSubs);
+
         for (int i = 0; i < numSubs; i++) {
             int subId = subs.get(i).getSubscriptionId();
+            carrierNames[i] = "";
             subsIds[i] = subId;
+            subOrderBySlot[subs.get(i).getSimSlotIndex()] = i;
             IccCardConstants.State simState = mKeyguardUpdateMonitor.getSimState(subId);
             CharSequence carrierName = subs.get(i).getCarrierName();
             CharSequence carrierTextForSimState = getCarrierTextForSimState(simState, carrierName);
@@ -227,7 +251,7 @@
             }
             if (carrierTextForSimState != null) {
                 allSimsMissing = false;
-                displayText = concatenate(displayText, carrierTextForSimState, mSeparator);
+                carrierNames[i] = carrierTextForSimState;
             }
             if (simState == IccCardConstants.State.READY) {
                 ServiceState ss = mKeyguardUpdateMonitor.mServiceStates.get(subId);
@@ -256,7 +280,6 @@
                 // described above.
                 displayText = makeCarrierStringOnEmergencyCapable(
                         getMissingSimMessage(), subs.get(0).getCarrierName());
-                missingSimsWithSubs = true;
             } else {
                 // We don't have a SubscriptionInfo to get the emergency calls only from.
                 // Grab it from the old sticky broadcast if possible instead. We can use it
@@ -286,24 +309,32 @@
             }
         }
 
-        displayText = updateCarrierTextWithSimIoError(displayText, allSimsMissing);
+        displayText = updateCarrierTextWithSimIoError(displayText, carrierNames, subOrderBySlot,
+                allSimsMissing);
         // APM (airplane mode) != no carrier state. There are carrier services
         // (e.g. WFC = Wi-Fi calling) which may operate in APM.
         if (!anySimReadyAndInService && WirelessUtils.isAirplaneModeOn(mContext)) {
             displayText = getAirplaneModeMessage();
         }
 
-        Handler handler = Dependency.get(Dependency.MAIN_HANDLER);
+        if (TextUtils.isEmpty(displayText)) {
+            displayText = TextUtils.join(mSeparator, carrierNames);
+        }
         final CarrierTextCallbackInfo info = new CarrierTextCallbackInfo(
                 displayText,
-                displayText.toString().split(mSeparator.toString()),
-                anySimReadyAndInService && !missingSimsWithSubs,
+                carrierNames,
+                !allSimsMissing,
                 subsIds);
+        postToCallback(info);
+    }
+
+    @VisibleForTesting
+    protected void postToCallback(CarrierTextCallbackInfo info) {
+        Handler handler = Dependency.get(Dependency.MAIN_HANDLER);
         final CarrierTextCallback callback = mCarrierTextCallback;
         if (callback != null) {
             handler.post(() -> callback.updateCarrierInfo(info));
         }
-
     }
 
     private Context getContext() {
diff --git a/packages/SystemUI/src/com/android/keyguard/KeyguardClockSwitch.java b/packages/SystemUI/src/com/android/keyguard/KeyguardClockSwitch.java
index 8de84bf..d40fa66 100644
--- a/packages/SystemUI/src/com/android/keyguard/KeyguardClockSwitch.java
+++ b/packages/SystemUI/src/com/android/keyguard/KeyguardClockSwitch.java
@@ -1,6 +1,7 @@
 package com.android.keyguard;
 
 import android.animation.Animator;
+import android.animation.AnimatorListenerAdapter;
 import android.animation.AnimatorSet;
 import android.animation.ValueAnimator;
 import android.app.WallpaperManager;
@@ -31,6 +32,9 @@
 import com.android.systemui.plugins.statusbar.StatusBarStateController;
 import com.android.systemui.statusbar.StatusBarState;
 
+import java.io.FileDescriptor;
+import java.io.PrintWriter;
+import java.util.Arrays;
 import java.util.TimeZone;
 
 /**
@@ -148,6 +152,7 @@
         Dependency.get(StatusBarStateController.class).removeCallback(mStateListener);
         Dependency.get(SysuiColorExtractor.class)
             .removeOnColorsChangedListener(mColorsListener);
+        setClockPlugin(null);
     }
 
     private void setClockPlugin(ClockPlugin plugin) {
@@ -279,7 +284,7 @@
      */
     public void dozeTimeTick() {
         if (mClockPlugin != null) {
-            mClockPlugin.dozeTimeTick();
+            mClockPlugin.onTimeTick();
         }
     }
 
@@ -332,6 +337,19 @@
         return mStateListener;
     }
 
+    public void dump(FileDescriptor fd, PrintWriter pw, String[] args) {
+        pw.println("KeyguardClockSwitch:");
+        pw.println("  mClockPlugin: " + mClockPlugin);
+        pw.println("  mClockView: " + mClockView);
+        pw.println("  mSmallClockFrame: " + mSmallClockFrame);
+        pw.println("  mBigClockContainer: " + mBigClockContainer);
+        pw.println("  mKeyguardStatusArea: " + mKeyguardStatusArea);
+        pw.println("  mDarkAmount: " + mDarkAmount);
+        pw.println("  mShowingHeader: " + mShowingHeader);
+        pw.println("  mSupportsDarkText: " + mSupportsDarkText);
+        pw.println("  mColorPalette: " + Arrays.toString(mColorPalette));
+    }
+
     /**
      * Special layout transition that scales the clock view as its bounds change, to make it look
      * like the text is shrinking.
@@ -371,11 +389,23 @@
                 boundsAnimator.addUpdateListener(animation -> {
                     float scale = MathUtils.lerp(startScale, 1f /* stop */,
                             animation.getAnimatedFraction());
-                    mClockView.setPivotX(mClockView.getWidth() / 2);
+                    mClockView.setPivotX(mClockView.getWidth() / 2f);
                     mClockView.setPivotY(0);
                     mClockView.setScaleX(scale);
                     mClockView.setScaleY(scale);
                 });
+                boundsAnimator.addListener(new AnimatorListenerAdapter() {
+                    @Override
+                    public void onAnimationEnd(Animator animator) {
+                        mClockView.setScaleX(1f);
+                        mClockView.setScaleY(1f);
+                    }
+
+                    @Override
+                    public void onAnimationCancel(Animator animator) {
+                        onAnimationEnd(animator);
+                    }
+                });
             }
 
             return animator;
diff --git a/packages/SystemUI/src/com/android/keyguard/KeyguardSliceView.java b/packages/SystemUI/src/com/android/keyguard/KeyguardSliceView.java
index 2040a76..8ebe1ae 100644
--- a/packages/SystemUI/src/com/android/keyguard/KeyguardSliceView.java
+++ b/packages/SystemUI/src/com/android/keyguard/KeyguardSliceView.java
@@ -64,6 +64,8 @@
 import com.android.systemui.tuner.TunerService;
 import com.android.systemui.util.wakelock.KeepAwakeAnimationListener;
 
+import java.io.FileDescriptor;
+import java.io.PrintWriter;
 import java.util.ArrayList;
 import java.util.HashMap;
 import java.util.List;
@@ -174,6 +176,7 @@
             if (mContentChangeListener != null) {
                 mContentChangeListener.run();
             }
+            Trace.endSection();
             return;
         }
 
@@ -375,6 +378,17 @@
         Trace.endSection();
     }
 
+    public void dump(FileDescriptor fd, PrintWriter pw, String[] args) {
+        pw.println("KeyguardSliceView:");
+        pw.println("  mClickActions: " + mClickActions);
+        pw.println("  mTitle: " + (mTitle == null ? "null" : mTitle.getVisibility() == VISIBLE));
+        pw.println("  mRow: " + (mRow == null ? "null" : mRow.getVisibility() == VISIBLE));
+        pw.println("  mTextColor: " + Integer.toHexString(mTextColor));
+        pw.println("  mDarkAmount: " + mDarkAmount);
+        pw.println("  mSlice: " + mSlice);
+        pw.println("  mHasHeader: " + mHasHeader);
+    }
+
     public static class Row extends LinearLayout {
 
         /**
diff --git a/packages/SystemUI/src/com/android/keyguard/KeyguardStatusView.java b/packages/SystemUI/src/com/android/keyguard/KeyguardStatusView.java
index b0670fd..808e264 100644
--- a/packages/SystemUI/src/com/android/keyguard/KeyguardStatusView.java
+++ b/packages/SystemUI/src/com/android/keyguard/KeyguardStatusView.java
@@ -27,7 +27,6 @@
 import android.os.UserHandle;
 import android.text.TextUtils;
 import android.text.format.DateFormat;
-import android.util.ArraySet;
 import android.util.AttributeSet;
 import android.util.Log;
 import android.util.Slog;
@@ -42,8 +41,8 @@
 import com.android.systemui.Dependency;
 import com.android.systemui.statusbar.policy.ConfigurationController;
 
-import com.google.android.collect.Sets;
-
+import java.io.FileDescriptor;
+import java.io.PrintWriter;
 import java.util.Locale;
 import java.util.TimeZone;
 
@@ -63,7 +62,6 @@
     private Runnable mPendingMarqueeStart;
     private Handler mHandler;
 
-    private ArraySet<View> mVisibleInDoze;
     private boolean mPulsing;
     private float mDarkAmount = 0;
     private int mTextColor;
@@ -175,7 +173,6 @@
         }
         mOwnerInfo = findViewById(R.id.owner_info);
         mKeyguardSlice = findViewById(R.id.keyguard_status_area);
-        mVisibleInDoze = Sets.newArraySet(mClockView, mKeyguardSlice);
         mTextColor = mClockView.getCurrentTextColor();
 
         mKeyguardSlice.setContentChangeListener(this::onSliceContentChanged);
@@ -294,6 +291,24 @@
         return false;
     }
 
+    public void dump(FileDescriptor fd, PrintWriter pw, String[] args) {
+        pw.println("KeyguardStatusView:");
+        pw.println("  mOwnerInfo: " + (mOwnerInfo == null
+                ? "null" : mOwnerInfo.getVisibility() == VISIBLE));
+        pw.println("  mPulsing: " + mPulsing);
+        pw.println("  mDarkAmount: " + mDarkAmount);
+        pw.println("  mTextColor: " + Integer.toHexString(mTextColor));
+        if (mLogoutView != null) {
+            pw.println("  logout visible: " + (mLogoutView.getVisibility() == VISIBLE));
+        }
+        if (mClockView != null) {
+            mClockView.dump(fd, pw, args);
+        }
+        if (mKeyguardSlice != null) {
+            mKeyguardSlice.dump(fd, pw, args);
+        }
+    }
+
     // DateFormat.getBestDateTimePattern is extremely expensive, and refresh is called often.
     // This is an optimization to ensure we only recompute the patterns when the inputs change.
     private static final class Patterns {
@@ -348,7 +363,6 @@
         }
 
         final int blendedTextColor = ColorUtils.blendARGB(mTextColor, Color.WHITE, mDarkAmount);
-        updateDozeVisibleViews();
         mKeyguardSlice.setDarkAmount(mDarkAmount);
         mClockView.setTextColor(blendedTextColor);
     }
@@ -372,13 +386,6 @@
             return;
         }
         mPulsing = pulsing;
-        updateDozeVisibleViews();
-    }
-
-    private void updateDozeVisibleViews() {
-        for (View child : mVisibleInDoze) {
-            child.setAlpha(mDarkAmount == 1 && mPulsing ? 0.8f : 1);
-        }
     }
 
     private boolean shouldShowLogout() {
diff --git a/packages/SystemUI/src/com/android/keyguard/KeyguardUpdateMonitor.java b/packages/SystemUI/src/com/android/keyguard/KeyguardUpdateMonitor.java
index 3ac7fd4..32e447b 100644
--- a/packages/SystemUI/src/com/android/keyguard/KeyguardUpdateMonitor.java
+++ b/packages/SystemUI/src/com/android/keyguard/KeyguardUpdateMonitor.java
@@ -196,6 +196,7 @@
     private static KeyguardUpdateMonitor sInstance;
 
     private final Context mContext;
+    private final boolean mIsPrimaryUser;
     HashMap<Integer, SimData> mSimDatas = new HashMap<Integer, SimData>();
     HashMap<Integer, ServiceState> mServiceStates = new HashMap<Integer, ServiceState>();
 
@@ -242,8 +243,6 @@
     private boolean mIsDreaming;
     private final DevicePolicyManager mDevicePolicyManager;
     private boolean mLogoutEnabled;
-    private boolean mFingerprintLockedOut;
-    private boolean mFaceLockedOut;
 
     /**
      * Short delay before restarting biometric authentication after a successful try
@@ -648,11 +647,6 @@
             }
         }
 
-        if (msgId == FingerprintManager.FINGERPRINT_ERROR_LOCKOUT
-                || msgId == FingerprintManager.FINGERPRINT_ERROR_LOCKOUT_PERMANENT) {
-            mFingerprintLockedOut = true;
-        }
-
         if (msgId == FingerprintManager.FINGERPRINT_ERROR_LOCKOUT_PERMANENT) {
             mLockPatternUtils.requireStrongAuth(
                     LockPatternUtils.StrongAuthTracker.STRONG_AUTH_REQUIRED_AFTER_LOCKOUT,
@@ -668,7 +662,6 @@
     }
 
     private void handleFingerprintLockoutReset() {
-        mFingerprintLockedOut = false;
         updateFingerprintListeningState();
     }
 
@@ -806,11 +799,6 @@
             }
         }
 
-        if (msgId == FaceManager.FACE_ERROR_LOCKOUT
-                || msgId == FaceManager.FACE_ERROR_LOCKOUT_PERMANENT) {
-            mFaceLockedOut = true;
-        }
-
         if (msgId == FaceManager.FACE_ERROR_LOCKOUT_PERMANENT) {
             mLockPatternUtils.requireStrongAuth(
                     LockPatternUtils.StrongAuthTracker.STRONG_AUTH_REQUIRED_AFTER_LOCKOUT,
@@ -827,7 +815,6 @@
     }
 
     private void handleFaceLockoutReset() {
-        mFaceLockedOut = false;
         updateFaceListeningState();
     }
 
@@ -1530,6 +1517,7 @@
 
         ActivityManagerWrapper.getInstance().registerTaskStackListener(mTaskStackListener);
         mUserManager = context.getSystemService(UserManager.class);
+        mIsPrimaryUser = mUserManager.isPrimaryUser();
         mDevicePolicyManager = context.getSystemService(DevicePolicyManager.class);
         mLogoutEnabled = mDevicePolicyManager.isLogoutEnabled();
         updateAirplaneModeState();
@@ -1608,21 +1596,25 @@
     }
 
     private boolean shouldListenForFingerprint() {
-        return (mKeyguardIsVisible || !mDeviceInteractive ||
+        // Only listen if this KeyguardUpdateMonitor belongs to the primary user. There is an
+        // instance of KeyguardUpdateMonitor for each user but KeyguardUpdateMonitor is user-aware.
+        final boolean shouldListen = (mKeyguardIsVisible || !mDeviceInteractive ||
                 (mBouncer && !mKeyguardGoingAway) || mGoingToSleep ||
                 shouldListenForFingerprintAssistant() || (mKeyguardOccluded && mIsDreaming))
                 && !mSwitchingUser && !isFingerprintDisabled(getCurrentUser())
-                && !mKeyguardGoingAway && !mFingerprintLockedOut;
+                && (!mKeyguardGoingAway || !mDeviceInteractive) && mIsPrimaryUser;
+        return shouldListen;
     }
 
     private boolean shouldListenForFace() {
         final boolean awakeKeyguard = mKeyguardIsVisible && mDeviceInteractive && !mGoingToSleep;
         final int user = getCurrentUser();
-
+        // Only listen if this KeyguardUpdateMonitor belongs to the primary user. There is an
+        // instance of KeyguardUpdateMonitor for each user but KeyguardUpdateMonitor is user-aware.
         return (mBouncer || mAuthInterruptActive || awakeKeyguard || shouldListenForFaceAssistant())
                 && !mSwitchingUser && !getUserCanSkipBouncer(user) && !isFaceDisabled(user)
-                && !mKeyguardGoingAway && !mFaceLockedOut && mFaceSettingEnabledForUser
-                && mUserManager.isUserUnlocked(user);
+                && !mKeyguardGoingAway && mFaceSettingEnabledForUser
+                && mUserManager.isUserUnlocked(user) && mIsPrimaryUser;
     }
 
 
diff --git a/packages/SystemUI/src/com/android/keyguard/clock/BubbleClockController.java b/packages/SystemUI/src/com/android/keyguard/clock/BubbleClockController.java
index 3114708..870ac87 100644
--- a/packages/SystemUI/src/com/android/keyguard/clock/BubbleClockController.java
+++ b/packages/SystemUI/src/com/android/keyguard/clock/BubbleClockController.java
@@ -15,6 +15,9 @@
  */
 package com.android.keyguard.clock;
 
+import android.content.res.Resources;
+import android.graphics.Bitmap;
+import android.graphics.BitmapFactory;
 import android.graphics.Paint.Style;
 import android.view.LayoutInflater;
 import android.view.View;
@@ -31,6 +34,16 @@
 public class BubbleClockController implements ClockPlugin {
 
     /**
+     * Resources used to get title and thumbnail.
+     */
+    private final Resources mResources;
+
+    /**
+     * LayoutInflater used to inflate custom clock views.
+     */
+    private final LayoutInflater mLayoutInflater;
+
+    /**
      * Custom clock shown on AOD screen and behind stack scroller on lock.
      */
     private View mView;
@@ -48,25 +61,22 @@
      */
     private CrossFadeDarkController mDarkController;
 
-    private BubbleClockController() { }
-
     /**
      * Create a BubbleClockController instance.
      *
      * @param layoutInflater Inflater used to inflate custom clock views.
      */
-    public static BubbleClockController build(LayoutInflater layoutInflater) {
-        BubbleClockController controller = new BubbleClockController();
-        controller.createViews(layoutInflater);
-        return controller;
+    public BubbleClockController(Resources res, LayoutInflater inflater) {
+        mResources = res;
+        mLayoutInflater = inflater;
     }
 
-    private void createViews(LayoutInflater layoutInflater) {
-        mView = layoutInflater.inflate(R.layout.bubble_clock, null);
+    private void createViews() {
+        mView = mLayoutInflater.inflate(R.layout.bubble_clock, null);
         mDigitalClock = (TextClock) mView.findViewById(R.id.digital_clock);
         mAnalogClock = (ImageClock) mView.findViewById(R.id.analog_clock);
 
-        mLockClockContainer = layoutInflater.inflate(R.layout.digital_clock, null);
+        mLockClockContainer = mLayoutInflater.inflate(R.layout.digital_clock, null);
         mLockClock = (TextClock) mLockClockContainer.findViewById(R.id.lock_screen_clock);
         mLockClock.setVisibility(View.GONE);
 
@@ -74,12 +84,33 @@
     }
 
     @Override
+    public String getName() {
+        return "bubble";
+    }
+
+    @Override
+    public String getTitle() {
+        return mResources.getString(R.string.clock_title_bubble);
+    }
+
+    @Override
+    public Bitmap getThumbnail() {
+        return BitmapFactory.decodeResource(mResources, R.drawable.bubble_thumbnail);
+    }
+
+    @Override
     public View getView() {
+        if (mLockClockContainer == null) {
+            createViews();
+        }
         return mLockClockContainer;
     }
 
     @Override
     public View getBigClockView() {
+        if (mView == null) {
+            createViews();
+        }
         return mView;
     }
 
@@ -103,13 +134,13 @@
     }
 
     @Override
-    public void dozeTimeTick() {
-        mAnalogClock.onTimeChanged();
+    public void setDarkAmount(float darkAmount) {
+        mDarkController.setDarkAmount(darkAmount);
     }
 
     @Override
-    public void setDarkAmount(float darkAmount) {
-        mDarkController.setDarkAmount(darkAmount);
+    public void onTimeTick() {
+        mAnalogClock.onTimeChanged();
     }
 
     @Override
diff --git a/packages/SystemUI/src/com/android/keyguard/clock/ClockLayout.java b/packages/SystemUI/src/com/android/keyguard/clock/ClockLayout.java
index 4d8cf96..59ee267 100644
--- a/packages/SystemUI/src/com/android/keyguard/clock/ClockLayout.java
+++ b/packages/SystemUI/src/com/android/keyguard/clock/ClockLayout.java
@@ -76,8 +76,10 @@
     protected void onLayout(boolean changed, int left, int top, int right, int bottom) {
         super.onLayout(changed, left, top, right, bottom);
 
-        final float offsetX = getBurnInOffset(mBurnInPreventionOffsetX, true);
-        final float offsetY = getBurnInOffset(mBurnInPreventionOffsetY, false);
+        final float offsetX = getBurnInOffset(mBurnInPreventionOffsetX * 2, true)
+                - mBurnInPreventionOffsetX;
+        final float offsetY = getBurnInOffset(mBurnInPreventionOffsetY * 2, false)
+                - mBurnInPreventionOffsetY;
 
         // Put digital clock in two left corner of the screen.
         if (mDigitalClock != null) {
diff --git a/packages/SystemUI/src/com/android/keyguard/clock/ClockManager.java b/packages/SystemUI/src/com/android/keyguard/clock/ClockManager.java
index 3827e44..294c725 100644
--- a/packages/SystemUI/src/com/android/keyguard/clock/ClockManager.java
+++ b/packages/SystemUI/src/com/android/keyguard/clock/ClockManager.java
@@ -23,7 +23,6 @@
 import android.database.ContentObserver;
 import android.graphics.Bitmap;
 import android.graphics.Bitmap.Config;
-import android.graphics.BitmapFactory;
 import android.graphics.Canvas;
 import android.graphics.Color;
 import android.os.Handler;
@@ -31,6 +30,7 @@
 import android.provider.Settings;
 import android.util.ArrayMap;
 import android.util.DisplayMetrics;
+import android.util.Log;
 import android.view.LayoutInflater;
 import android.view.View;
 import android.view.View.MeasureSpec;
@@ -39,17 +39,19 @@
 import androidx.annotation.VisibleForTesting;
 
 import com.android.internal.colorextraction.ColorExtractor;
-import com.android.keyguard.R;
 import com.android.systemui.colorextraction.SysuiColorExtractor;
 import com.android.systemui.dock.DockManager;
 import com.android.systemui.dock.DockManager.DockEventListener;
 import com.android.systemui.plugins.ClockPlugin;
+import com.android.systemui.plugins.PluginListener;
+import com.android.systemui.shared.plugins.PluginManager;
 import com.android.systemui.util.InjectionInflationController;
 
 import java.util.ArrayList;
 import java.util.List;
 import java.util.Map;
-import java.util.function.Supplier;
+import java.util.concurrent.Callable;
+import java.util.concurrent.FutureTask;
 
 import javax.inject.Inject;
 import javax.inject.Singleton;
@@ -60,26 +62,49 @@
 @Singleton
 public final class ClockManager {
 
+    private static final String TAG = "ClockOptsProvider";
+    private static final String DEFAULT_CLOCK_ID = "default";
+
     private final List<ClockInfo> mClockInfos = new ArrayList<>();
     /**
      * Map from expected value stored in settings to supplier of custom clock face.
      */
-    private final Map<String, Supplier<ClockPlugin>> mClocks = new ArrayMap<>();
+    private final Map<String, ClockPlugin> mClocks = new ArrayMap<>();
     @Nullable private ClockPlugin mCurrentClock;
 
     private final ContentResolver mContentResolver;
     private final SettingsWrapper mSettingsWrapper;
+    private final Handler mMainHandler = new Handler(Looper.getMainLooper());
+
     /**
      * Observe settings changes to know when to switch the clock face.
      */
     private final ContentObserver mContentObserver =
-            new ContentObserver(new Handler(Looper.getMainLooper())) {
+            new ContentObserver(mMainHandler) {
                 @Override
                 public void onChange(boolean selfChange) {
                     super.onChange(selfChange);
                     reload();
                 }
             };
+
+    private final PluginListener<ClockPlugin> mClockPluginListener =
+            new PluginListener<ClockPlugin>() {
+                @Override
+                public void onPluginConnected(ClockPlugin plugin, Context pluginContext) {
+                    addClockPlugin(plugin);
+                    reload();
+                }
+
+                @Override
+                public void onPluginDisconnected(ClockPlugin plugin) {
+                    removeClockPlugin(plugin);
+                    reload();
+                }
+            };
+
+    private final PluginManager mPluginManager;
+
     /**
      * Observe changes to dock state to know when to switch the clock face.
      */
@@ -107,56 +132,29 @@
 
     @Inject
     public ClockManager(Context context, InjectionInflationController injectionInflater,
-            @Nullable DockManager dockManager, SysuiColorExtractor colorExtractor) {
-        this(context, injectionInflater, dockManager, colorExtractor, context.getContentResolver(),
-                new SettingsWrapper(context.getContentResolver()));
+            PluginManager pluginManager, @Nullable DockManager dockManager,
+            SysuiColorExtractor colorExtractor) {
+        this(context, injectionInflater, pluginManager, dockManager, colorExtractor,
+                context.getContentResolver(), new SettingsWrapper(context.getContentResolver()));
     }
 
     ClockManager(Context context, InjectionInflationController injectionInflater,
-            @Nullable DockManager dockManager, SysuiColorExtractor colorExtractor,
-            ContentResolver contentResolver, SettingsWrapper settingsWrapper) {
+            PluginManager pluginManager, @Nullable DockManager dockManager,
+            SysuiColorExtractor colorExtractor, ContentResolver contentResolver,
+            SettingsWrapper settingsWrapper) {
+        mPluginManager = pluginManager;
         mDockManager = dockManager;
         mColorExtractor = colorExtractor;
         mContentResolver = contentResolver;
         mSettingsWrapper = settingsWrapper;
 
         Resources res = context.getResources();
-        mClockInfos.add(ClockInfo.builder()
-                .setName("default")
-                .setTitle(res.getString(R.string.clock_title_default))
-                .setId("default")
-                .setThumbnail(() -> BitmapFactory.decodeResource(res, R.drawable.default_thumbnail))
-                .setPreview(() -> BitmapFactory.decodeResource(res, R.drawable.default_preview))
-                .build());
-        mClockInfos.add(ClockInfo.builder()
-                .setName("bubble")
-                .setTitle(res.getString(R.string.clock_title_bubble))
-                .setId(BubbleClockController.class.getName())
-                .setThumbnail(() -> BitmapFactory.decodeResource(res, R.drawable.bubble_thumbnail))
-                .setPreview(() -> getClockPreview(BubbleClockController.class.getName()))
-                .build());
-        mClockInfos.add(ClockInfo.builder()
-                .setName("stretch")
-                .setTitle(res.getString(R.string.clock_title_stretch))
-                .setId(StretchAnalogClockController.class.getName())
-                .setThumbnail(() -> BitmapFactory.decodeResource(res, R.drawable.stretch_thumbnail))
-                .setPreview(() -> getClockPreview(StretchAnalogClockController.class.getName()))
-                .build());
-        mClockInfos.add(ClockInfo.builder()
-                .setName("type")
-                .setTitle(res.getString(R.string.clock_title_type))
-                .setId(TypeClockController.class.getName())
-                .setThumbnail(() -> BitmapFactory.decodeResource(res, R.drawable.type_thumbnail))
-                .setPreview(() -> getClockPreview(TypeClockController.class.getName()))
-                .build());
-
         LayoutInflater layoutInflater = injectionInflater.injectable(LayoutInflater.from(context));
-        mClocks.put(BubbleClockController.class.getName(),
-                () -> BubbleClockController.build(layoutInflater));
-        mClocks.put(StretchAnalogClockController.class.getName(),
-                () -> StretchAnalogClockController.build(layoutInflater));
-        mClocks.put(TypeClockController.class.getName(),
-                () -> TypeClockController.build(layoutInflater));
+
+        addClockPlugin(new DefaultClockController(res, layoutInflater));
+        addClockPlugin(new BubbleClockController(res, layoutInflater));
+        addClockPlugin(new StretchAnalogClockController(res, layoutInflater));
+        addClockPlugin(new TypeClockController(res, layoutInflater));
 
         // Store the size of the display for generation of clock preview.
         DisplayMetrics dm = res.getDisplayMetrics();
@@ -211,6 +209,29 @@
         return mContentObserver;
     }
 
+    private void addClockPlugin(ClockPlugin plugin) {
+        final String id = plugin.getClass().getName();
+        mClocks.put(plugin.getClass().getName(), plugin);
+        mClockInfos.add(ClockInfo.builder()
+                .setName(plugin.getName())
+                .setTitle(plugin.getTitle())
+                .setId(id)
+                .setThumbnail(() -> plugin.getThumbnail())
+                .setPreview(() -> getClockPreview(id))
+                .build());
+    }
+
+    private void removeClockPlugin(ClockPlugin plugin) {
+        final String id = plugin.getClass().getName();
+        mClocks.remove(id);
+        for (int i = 0; i < mClockInfos.size(); i++) {
+            if (id.equals(mClockInfos.get(i).getId())) {
+                mClockInfos.remove(i);
+                break;
+            }
+        }
+    }
+
     /**
      * Generate a realistic preview of a clock face.
      * @param clockId ID of clock to use for preview, should be obtained from {@link getClockInfos}.
@@ -218,38 +239,54 @@
      */
     @Nullable
     private Bitmap getClockPreview(String clockId) {
-        Supplier<ClockPlugin> supplier = mClocks.get(clockId);
-        if (supplier == null) {
-            return null;
-        }
-        ClockPlugin plugin = supplier.get();
+        FutureTask<Bitmap> task = new FutureTask<>(new Callable<Bitmap>() {
+            @Override
+            public Bitmap call() {
+                Bitmap bitmap = Bitmap.createBitmap(mWidth, mHeight, Config.ARGB_8888);
+                ClockPlugin plugin = mClocks.get(clockId);
+                if (plugin == null) {
+                    return null;
+                }
 
-        // Use the big clock view for the preview
-        View clockView = plugin.getBigClockView();
-        if (clockView == null) {
-            return null;
+                // Use the big clock view for the preview
+                View clockView = plugin.getBigClockView();
+                if (clockView == null) {
+                    return null;
+                }
+
+                // Initialize state of plugin before generating preview.
+                plugin.setDarkAmount(1f);
+                plugin.setTextColor(Color.WHITE);
+
+                ColorExtractor.GradientColors colors = mColorExtractor.getColors(
+                        WallpaperManager.FLAG_LOCK, true);
+                plugin.setColorPalette(colors.supportsDarkText(), colors.getColorPalette());
+                plugin.onTimeTick();
+
+                // Draw clock view hierarchy to canvas.
+                Canvas canvas = new Canvas(bitmap);
+                canvas.drawColor(Color.BLACK);
+                dispatchVisibilityAggregated(clockView, true);
+                clockView.measure(MeasureSpec.makeMeasureSpec(mWidth, MeasureSpec.EXACTLY),
+                        MeasureSpec.makeMeasureSpec(mHeight, MeasureSpec.EXACTLY));
+                clockView.layout(0, 0, mWidth, mHeight);
+                clockView.draw(canvas);
+                return bitmap;
+            }
+        });
+
+        if (Looper.myLooper() == Looper.getMainLooper()) {
+            task.run();
+        } else {
+            mMainHandler.post(task);
         }
 
-        // Initialize state of plugin before generating preview.
-        plugin.setDarkAmount(1f);
-        plugin.setTextColor(Color.WHITE);
-
-        ColorExtractor.GradientColors colors = mColorExtractor.getColors(WallpaperManager.FLAG_LOCK,
-                true);
-        plugin.setColorPalette(colors.supportsDarkText(), colors.getColorPalette());
-        plugin.dozeTimeTick();
-
-        // Draw clock view hierarchy to canvas.
-        Bitmap bitmap = Bitmap.createBitmap(mWidth, mHeight, Config.ARGB_8888);
-        Canvas canvas = new Canvas(bitmap);
-        dispatchVisibilityAggregated(clockView, true);
-        clockView.measure(MeasureSpec.makeMeasureSpec(mWidth, MeasureSpec.EXACTLY),
-                MeasureSpec.makeMeasureSpec(mHeight, MeasureSpec.EXACTLY));
-        clockView.layout(0, 0, mWidth, mHeight);
-        canvas.drawColor(Color.BLACK);
-        clockView.draw(canvas);
-
-        return bitmap;
+        try {
+            return task.get();
+        } catch (Exception e) {
+            Log.e(TAG, "Error completing task", e);
+            return null;
+        }
     }
 
     private void dispatchVisibilityAggregated(View view, boolean isVisible) {
@@ -279,6 +316,7 @@
     }
 
     private void register() {
+        mPluginManager.addPluginListener(mClockPluginListener, ClockPlugin.class, true);
         mContentResolver.registerContentObserver(
                 Settings.Secure.getUriFor(Settings.Secure.LOCK_SCREEN_CUSTOM_CLOCK_FACE),
                 false, mContentObserver);
@@ -291,6 +329,7 @@
     }
 
     private void unregister() {
+        mPluginManager.removePluginListener(mClockPluginListener);
         mContentResolver.unregisterContentObserver(mContentObserver);
         if (mDockManager != null) {
             mDockManager.removeListener(mDockEventListener);
@@ -299,7 +338,11 @@
 
     private void reload() {
         mCurrentClock = getClockPlugin();
-        notifyClockChanged(mCurrentClock);
+        if (mCurrentClock instanceof DefaultClockController) {
+            notifyClockChanged(null);
+        } else {
+            notifyClockChanged(mCurrentClock);
+        }
     }
 
     private ClockPlugin getClockPlugin() {
@@ -307,21 +350,15 @@
         if (mIsDocked) {
             final String name = mSettingsWrapper.getDockedClockFace();
             if (name != null) {
-                Supplier<ClockPlugin> supplier = mClocks.get(name);
-                if (supplier != null) {
-                    plugin = supplier.get();
-                    if (plugin != null) {
-                        return plugin;
-                    }
+                plugin = mClocks.get(name);
+                if (plugin != null) {
+                    return plugin;
                 }
             }
         }
         final String name = mSettingsWrapper.getLockScreenCustomClockFace();
         if (name != null) {
-            Supplier<ClockPlugin> supplier = mClocks.get(name);
-            if (supplier != null) {
-                plugin = supplier.get();
-            }
+            plugin = mClocks.get(name);
         }
         return plugin;
     }
diff --git a/packages/SystemUI/src/com/android/keyguard/clock/DefaultClockController.java b/packages/SystemUI/src/com/android/keyguard/clock/DefaultClockController.java
new file mode 100644
index 0000000..8a6a4cd
--- /dev/null
+++ b/packages/SystemUI/src/com/android/keyguard/clock/DefaultClockController.java
@@ -0,0 +1,131 @@
+/*
+ * Copyright (C) 2019 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 com.android.keyguard.clock;
+
+import android.content.res.Resources;
+import android.graphics.Bitmap;
+import android.graphics.BitmapFactory;
+import android.graphics.Paint.Style;
+import android.view.LayoutInflater;
+import android.view.View;
+import android.widget.TextView;
+
+import com.android.keyguard.R;
+import com.android.systemui.plugins.ClockPlugin;
+
+import java.util.TimeZone;
+
+/**
+ * Plugin for the default clock face used only to provide a preview.
+ */
+public class DefaultClockController implements ClockPlugin {
+
+    /**
+     * Resources used to get title and thumbnail.
+     */
+    private final Resources mResources;
+
+    /**
+     * LayoutInflater used to inflate custom clock views.
+     */
+    private final LayoutInflater mLayoutInflater;
+
+    /**
+     * Root view of preview.
+     */
+    private View mView;
+
+    /**
+     * Text clock in preview view hierarchy.
+     */
+    private TextView mTextTime;
+
+    /**
+     * Date showing below time in preview view hierarchy.
+     */
+    private TextView mTextDate;
+
+    /**
+     * Create a DefaultClockController instance.
+     *
+     * @param inflater Inflater used to inflate custom clock views.
+     */
+    public DefaultClockController(Resources res, LayoutInflater inflater) {
+        mResources = res;
+        mLayoutInflater = inflater;
+    }
+
+    private void createViews() {
+        mView = mLayoutInflater.inflate(R.layout.default_clock_preview, null);
+        mTextTime = mView.findViewById(R.id.time);
+        mTextDate = mView.findViewById(R.id.date);
+    }
+
+    @Override
+    public String getName() {
+        return "default";
+    }
+
+    @Override
+    public String getTitle() {
+        return mResources.getString(R.string.clock_title_default);
+    }
+
+    @Override
+    public Bitmap getThumbnail() {
+        return BitmapFactory.decodeResource(mResources, R.drawable.default_thumbnail);
+    }
+
+    @Override
+    public View getView() {
+        return null;
+    }
+
+    @Override
+    public View getBigClockView() {
+        if (mView == null) {
+            createViews();
+        }
+        return mView;
+    }
+
+    @Override
+    public void setStyle(Style style) {}
+
+    @Override
+    public void setTextColor(int color) {
+        mTextTime.setTextColor(color);
+        mTextDate.setTextColor(color);
+    }
+
+    @Override
+    public void setColorPalette(boolean supportsDarkText, int[] colorPalette) {}
+
+    @Override
+    public void onTimeTick() {
+    }
+
+    @Override
+    public void setDarkAmount(float darkAmount) {}
+
+    @Override
+    public void onTimeZoneChanged(TimeZone timeZone) {}
+
+    @Override
+    public boolean shouldShowStatusArea() {
+        return true;
+    }
+}
diff --git a/packages/SystemUI/src/com/android/keyguard/clock/StretchAnalogClockController.java b/packages/SystemUI/src/com/android/keyguard/clock/StretchAnalogClockController.java
index c465114..7401819 100644
--- a/packages/SystemUI/src/com/android/keyguard/clock/StretchAnalogClockController.java
+++ b/packages/SystemUI/src/com/android/keyguard/clock/StretchAnalogClockController.java
@@ -15,6 +15,9 @@
  */
 package com.android.keyguard.clock;
 
+import android.content.res.Resources;
+import android.graphics.Bitmap;
+import android.graphics.BitmapFactory;
 import android.graphics.Paint.Style;
 import android.view.LayoutInflater;
 import android.view.View;
@@ -31,6 +34,16 @@
 public class StretchAnalogClockController implements ClockPlugin {
 
     /**
+     * Resources used to get title and thumbnail.
+     */
+    private final Resources mResources;
+
+    /**
+     * LayoutInflater used to inflate custom clock views.
+     */
+    private final LayoutInflater mLayoutInflater;
+
+    /**
      * Custom clock shown on AOD screen and behind stack scroller on lock.
      */
     private View mBigClockView;
@@ -48,25 +61,22 @@
      */
     private CrossFadeDarkController mDarkController;
 
-    private StretchAnalogClockController() { }
-
     /**
      * Create a BubbleClockController instance.
      *
      * @param layoutInflater Inflater used to inflate custom clock views.
      */
-    public static StretchAnalogClockController build(LayoutInflater layoutInflater) {
-        StretchAnalogClockController controller = new StretchAnalogClockController();
-        controller.createViews(layoutInflater);
-        return controller;
+    public StretchAnalogClockController(Resources res, LayoutInflater inflater) {
+        mResources = res;
+        mLayoutInflater = inflater;
     }
 
-    private void createViews(LayoutInflater layoutInflater) {
-        mBigClockView = layoutInflater.inflate(R.layout.stretchanalog_clock, null);
+    private void createViews() {
+        mBigClockView = mLayoutInflater.inflate(R.layout.stretchanalog_clock, null);
         mAnalogClock = mBigClockView.findViewById(R.id.analog_clock);
         mDigitalClock = mBigClockView.findViewById(R.id.digital_clock);
 
-        mView = layoutInflater.inflate(R.layout.digital_clock, null);
+        mView = mLayoutInflater.inflate(R.layout.digital_clock, null);
         mLockClock = mView.findViewById(R.id.lock_screen_clock);
         mLockClock.setVisibility(View.GONE);
 
@@ -74,12 +84,33 @@
     }
 
     @Override
+    public String getName() {
+        return "stretch";
+    }
+
+    @Override
+    public String getTitle() {
+        return mResources.getString(R.string.clock_title_stretch);
+    }
+
+    @Override
+    public Bitmap getThumbnail() {
+        return BitmapFactory.decodeResource(mResources, R.drawable.stretch_thumbnail);
+    }
+
+    @Override
     public View getView() {
+        if (mView == null) {
+            createViews();
+        }
         return mView;
     }
 
     @Override
     public View getBigClockView() {
+        if (mBigClockView == null) {
+            createViews();
+        }
         return mBigClockView;
     }
 
@@ -103,7 +134,7 @@
     }
 
     @Override
-    public void dozeTimeTick() {
+    public void onTimeTick() {
         mAnalogClock.onTimeChanged();
     }
 
diff --git a/packages/SystemUI/src/com/android/keyguard/clock/TypeClockController.java b/packages/SystemUI/src/com/android/keyguard/clock/TypeClockController.java
index 2ea39c4..387f265 100644
--- a/packages/SystemUI/src/com/android/keyguard/clock/TypeClockController.java
+++ b/packages/SystemUI/src/com/android/keyguard/clock/TypeClockController.java
@@ -15,6 +15,9 @@
  */
 package com.android.keyguard.clock;
 
+import android.content.res.Resources;
+import android.graphics.Bitmap;
+import android.graphics.BitmapFactory;
 import android.graphics.Paint.Style;
 import android.view.LayoutInflater;
 import android.view.View;
@@ -30,6 +33,16 @@
 public class TypeClockController implements ClockPlugin {
 
     /**
+     * Resources used to get title and thumbnail.
+     */
+    private final Resources mResources;
+
+    /**
+     * LayoutInflater used to inflate custom clock views.
+     */
+    private final LayoutInflater mLayoutInflater;
+
+    /**
      * Custom clock shown on AOD screen and behind stack scroller on lock.
      */
     private View mView;
@@ -38,43 +51,63 @@
     /**
      * Small clock shown on lock screen above stack scroller.
      */
-    private View mLockClockContainer;
+    private TypographicClock mLockClock;
 
     /**
      * Controller for transition into dark state.
      */
     private CrossFadeDarkController mDarkController;
 
-    private TypeClockController() {}
-
     /**
      * Create a TypeClockController instance.
      *
      * @param inflater Inflater used to inflate custom clock views.
      */
-    public static TypeClockController build(LayoutInflater inflater) {
-        TypeClockController controller = new TypeClockController();
-        controller.createViews(inflater);
-        return controller;
+    TypeClockController(Resources res, LayoutInflater inflater) {
+        mResources = res;
+        mLayoutInflater = inflater;
     }
 
-    private void createViews(LayoutInflater inflater) {
-        mView = inflater.inflate(R.layout.type_clock, null);
+    private void createViews() {
+        mView = mLayoutInflater.inflate(R.layout.type_aod_clock, null);
         mTypeClock = mView.findViewById(R.id.type_clock);
 
         // For now, this view is used to hide the default digital clock.
         // Need better transition to lock screen.
-        mLockClockContainer = inflater.inflate(R.layout.digital_clock, null);
-        mLockClockContainer.setVisibility(View.GONE);
+        mLockClock = (TypographicClock) mLayoutInflater.inflate(R.layout.typographic_clock, null);
+        mLockClock.setVisibility(View.GONE);
+
+        mDarkController = new CrossFadeDarkController(mView, mLockClock);
+    }
+
+    @Override
+    public String getName() {
+        return "type";
+    }
+
+    @Override
+    public String getTitle() {
+        return mResources.getString(R.string.clock_title_type);
+    }
+
+    @Override
+    public Bitmap getThumbnail() {
+        return BitmapFactory.decodeResource(mResources, R.drawable.type_thumbnail);
     }
 
     @Override
     public View getView() {
-        return mLockClockContainer;
+        if (mLockClock == null) {
+            createViews();
+        }
+        return mLockClock;
     }
 
     @Override
     public View getBigClockView() {
+        if (mView == null) {
+            createViews();
+        }
         return mView;
     }
 
@@ -84,6 +117,7 @@
     @Override
     public void setTextColor(int color) {
         mTypeClock.setTextColor(color);
+        mLockClock.setTextColor(color);
     }
 
     @Override
@@ -91,21 +125,28 @@
         if (colorPalette == null || colorPalette.length == 0) {
             return;
         }
-        final int length = colorPalette.length;
-        mTypeClock.setClockColor(colorPalette[Math.max(0, length - 5)]);
+        final int color = colorPalette[Math.max(0, colorPalette.length - 5)];
+        mTypeClock.setClockColor(color);
+        mLockClock.setClockColor(color);
     }
 
     @Override
-    public void dozeTimeTick() {
+    public void onTimeTick() {
         mTypeClock.onTimeChanged();
+        mLockClock.onTimeChanged();
     }
 
     @Override
-    public void setDarkAmount(float darkAmount) {}
+    public void setDarkAmount(float darkAmount) {
+        if (mDarkController != null) {
+            mDarkController.setDarkAmount(darkAmount);
+        }
+    }
 
     @Override
     public void onTimeZoneChanged(TimeZone timeZone) {
         mTypeClock.onTimeZoneChanged(timeZone);
+        mLockClock.onTimeZoneChanged(timeZone);
     }
 
     @Override
diff --git a/packages/SystemUI/src/com/android/keyguard/clock/TypographicClock.java b/packages/SystemUI/src/com/android/keyguard/clock/TypographicClock.java
index 7bce3c5..572ab30 100644
--- a/packages/SystemUI/src/com/android/keyguard/clock/TypographicClock.java
+++ b/packages/SystemUI/src/com/android/keyguard/clock/TypographicClock.java
@@ -119,4 +119,12 @@
         mTime.setTimeZone(mTimeZone != null ? mTimeZone : TimeZone.getDefault());
         onTimeChanged();
     }
+
+    /**
+     * Overriding hasOverlappingRendering as false to improve performance of crossfading.
+     */
+    @Override
+    public boolean hasOverlappingRendering() {
+        return false;
+    }
 }
diff --git a/packages/SystemUI/src/com/android/systemui/BatteryMeterView.java b/packages/SystemUI/src/com/android/systemui/BatteryMeterView.java
index 592b603..39a5842 100644
--- a/packages/SystemUI/src/com/android/systemui/BatteryMeterView.java
+++ b/packages/SystemUI/src/com/android/systemui/BatteryMeterView.java
@@ -355,15 +355,23 @@
         if (mBatteryPercentView != null) {
             if (mShowPercentMode == MODE_ESTIMATE && !mCharging) {
                 mBatteryController.getEstimatedTimeRemainingString((String estimate) -> {
-                    mBatteryPercentView.setText(estimate);
+                    if (estimate != null) {
+                        mBatteryPercentView.setText(estimate);
+                    } else {
+                        setPercentTextAtCurrentLevel();
+                    }
                 });
             } else {
-                mBatteryPercentView.setText(
-                        NumberFormat.getPercentInstance().format(mLevel / 100f));
+                setPercentTextAtCurrentLevel();
             }
         }
     }
 
+    private void setPercentTextAtCurrentLevel() {
+        mBatteryPercentView.setText(
+                NumberFormat.getPercentInstance().format(mLevel / 100f));
+    }
+
     private void updateShowPercent() {
         final boolean showing = mBatteryPercentView != null;
         final boolean systemSetting = 0 != Settings.System
diff --git a/packages/SystemUI/src/com/android/systemui/Dependency.java b/packages/SystemUI/src/com/android/systemui/Dependency.java
index 87f004f..b7d1900 100644
--- a/packages/SystemUI/src/com/android/systemui/Dependency.java
+++ b/packages/SystemUI/src/com/android/systemui/Dependency.java
@@ -48,6 +48,9 @@
 import com.android.systemui.privacy.PrivacyItemController;
 import com.android.systemui.recents.OverviewProxyService;
 import com.android.systemui.shared.plugins.PluginManager;
+import com.android.systemui.shared.system.ActivityManagerWrapper;
+import com.android.systemui.shared.system.DevicePolicyManagerWrapper;
+import com.android.systemui.shared.system.PackageManagerWrapper;
 import com.android.systemui.statusbar.AmbientPulseManager;
 import com.android.systemui.statusbar.NavigationBarController;
 import com.android.systemui.statusbar.NotificationListener;
@@ -188,7 +191,7 @@
             new DependencyKey<>(LEAK_REPORT_EMAIL_NAME);
 
     private final ArrayMap<Object, Object> mDependencies = new ArrayMap<>();
-    private final ArrayMap<Object, DependencyProvider> mProviders = new ArrayMap<>();
+    private final ArrayMap<Object, LazyDependencyCreator> mProviders = new ArrayMap<>();
 
     @Inject Lazy<ActivityStarter> mActivityStarter;
     @Inject Lazy<ActivityStarterDelegate> mActivityStarterDelegate;
@@ -285,6 +288,9 @@
     @Nullable
     @Inject @Named(LEAK_REPORT_EMAIL_NAME) Lazy<String> mLeakReportEmail;
     @Inject Lazy<ClockManager> mClockManager;
+    @Inject Lazy<ActivityManagerWrapper> mActivityManagerWrapper;
+    @Inject Lazy<DevicePolicyManagerWrapper> mDevicePolicyManagerWrapper;
+    @Inject Lazy<PackageManagerWrapper> mPackageManagerWrapper;
 
     @Inject
     public Dependency() {
@@ -452,6 +458,9 @@
                 mForegroundServiceNotificationListener::get);
         mProviders.put(ClockManager.class, mClockManager::get);
         mProviders.put(PrivacyItemController.class, mPrivacyItemController::get);
+        mProviders.put(ActivityManagerWrapper.class, mActivityManagerWrapper::get);
+        mProviders.put(DevicePolicyManagerWrapper.class, mDevicePolicyManagerWrapper::get);
+        mProviders.put(PackageManagerWrapper.class, mPackageManagerWrapper::get);
 
 
         // TODO(b/118592525): to support multi-display , we start to add something which is
@@ -501,7 +510,7 @@
         Preconditions.checkArgument(cls instanceof DependencyKey<?> || cls instanceof Class<?>);
 
         @SuppressWarnings("unchecked")
-        DependencyProvider<T> provider = mProviders.get(cls);
+        LazyDependencyCreator<T> provider = mProviders.get(cls);
         if (provider == null) {
             throw new IllegalArgumentException("Unsupported dependency " + cls
                     + ". " + mProviders.size() + " providers known.");
@@ -511,7 +520,11 @@
 
     private static Dependency sDependency;
 
-    public interface DependencyProvider<T> {
+    /**
+     * Interface for a class that can create a dependency. Used to implement laziness
+     * @param <T> The type of the dependency being created
+     */
+    private interface LazyDependencyCreator<T> {
         T createDependency();
     }
 
diff --git a/packages/SystemUI/src/com/android/systemui/DependencyProvider.java b/packages/SystemUI/src/com/android/systemui/DependencyProvider.java
index a517d7c..895f9b9 100644
--- a/packages/SystemUI/src/com/android/systemui/DependencyProvider.java
+++ b/packages/SystemUI/src/com/android/systemui/DependencyProvider.java
@@ -41,6 +41,9 @@
 import com.android.systemui.plugins.PluginInitializerImpl;
 import com.android.systemui.shared.plugins.PluginManager;
 import com.android.systemui.shared.plugins.PluginManagerImpl;
+import com.android.systemui.shared.system.ActivityManagerWrapper;
+import com.android.systemui.shared.system.DevicePolicyManagerWrapper;
+import com.android.systemui.shared.system.PackageManagerWrapper;
 import com.android.systemui.statusbar.NavigationBarController;
 import com.android.systemui.statusbar.phone.AutoHideController;
 import com.android.systemui.statusbar.phone.ConfigurationControllerImpl;
@@ -181,4 +184,22 @@
             @Named(MAIN_HANDLER_NAME) Handler mainHandler) {
         return new AutoHideController(context, mainHandler);
     }
+
+    @Singleton
+    @Provides
+    public ActivityManagerWrapper provideActivityManagerWrapper() {
+        return ActivityManagerWrapper.getInstance();
+    }
+
+    @Singleton
+    @Provides
+    public DevicePolicyManagerWrapper provideDevicePolicyManagerWrapper() {
+        return DevicePolicyManagerWrapper.getInstance();
+    }
+
+    @Singleton
+    @Provides
+    public PackageManagerWrapper providePackageManagerWrapper() {
+        return PackageManagerWrapper.getInstance();
+    }
 }
diff --git a/packages/SystemUI/src/com/android/systemui/HardwareUiLayout.java b/packages/SystemUI/src/com/android/systemui/HardwareUiLayout.java
index 2a1d066..5086c99 100644
--- a/packages/SystemUI/src/com/android/systemui/HardwareUiLayout.java
+++ b/packages/SystemUI/src/com/android/systemui/HardwareUiLayout.java
@@ -32,10 +32,13 @@
 import android.view.ViewTreeObserver;
 import android.widget.LinearLayout;
 
+import com.android.systemui.globalactions.GlobalActionsDialog;
 import com.android.systemui.tuner.TunerService;
 import com.android.systemui.tuner.TunerService.Tunable;
 import com.android.systemui.util.leak.RotationUtils;
 
+import java.util.ArrayList;
+
 /**
  * Layout for placing two containers at a specific physical position on the device, relative to the
  * device's hardware, regardless of screen rotation.
@@ -63,6 +66,9 @@
 
     public HardwareUiLayout(Context context, AttributeSet attrs) {
         super(context, attrs);
+        // Manually re-initialize mRotation to portrait-mode, since this view must always
+        // be constructed in portrait mode and rotated into the correct initial position.
+        mRotation = ROTATION_NONE;
         updateSettings();
     }
 
@@ -87,15 +93,6 @@
     }
 
     @Override
-    public ViewGroup getParentView(boolean separated, int index, boolean reverse) {
-        if (separated) {
-            return getSeparatedView();
-        } else {
-            return getListView();
-        }
-    }
-
-    @Override
     protected void onAttachedToWindow() {
         super.onAttachedToWindow();
         updateSettings();
@@ -172,6 +169,10 @@
                 mSeparatedView.setBackground(mSeparatedViewBackground);
                 updateEdgeMargin(mEdgeBleed ? 0 : getEdgePadding());
                 mOldHeight = mList.getMeasuredHeight();
+
+                // Must be called to initialize view rotation correctly.
+                // Requires LayoutParams, hence why this isn't called during the constructor.
+                updateRotation();
             } else {
                 return;
             }
@@ -189,7 +190,18 @@
         mSwapOrientation = swapOrientation;
     }
 
-    @Override
+    private void updateRotation() {
+        int rotation = RotationUtils.getRotation(getContext());
+        if (rotation != mRotation) {
+            rotate(mRotation, rotation);
+            mRotation = rotation;
+        }
+    }
+
+    /**
+     *  Requires LayoutParams to be set to work correctly, and therefore must be run after after
+     *  the HardwareUILayout has been added to the view hierarchy.
+     */
     protected void rotate(int from, int to) {
         super.rotate(from, to);
         if (from != ROTATION_NONE && to != ROTATION_NONE) {
@@ -203,7 +215,7 @@
         } else {
             rotateLeft();
         }
-        if (mHasSeparatedView) {
+        if (mSeparated) {
             if (from == ROTATION_SEASCAPE || to == ROTATION_SEASCAPE) {
                 // Separated view has top margin, so seascape separated view need special rotation,
                 // not a full left or right rotation.
@@ -243,6 +255,31 @@
         }
     }
 
+    @Override
+    public void onUpdateList() {
+        removeAllItems();
+        ArrayList<GlobalActionsDialog.Action> separatedActions =
+                mAdapter.getSeparatedItems(mSeparated);
+        ArrayList<GlobalActionsDialog.Action> listActions = mAdapter.getListItems(mSeparated);
+
+        for (int i = 0; i < mAdapter.getCount(); i++) {
+            Object action = mAdapter.getItem(i);
+            int separatedIndex = separatedActions.indexOf(action);
+            ViewGroup parent;
+            if (separatedIndex != -1) {
+                parent = getSeparatedView();
+            } else {
+                int listIndex = listActions.indexOf(action);
+                parent = getListView();
+            }
+            View v = mAdapter.getView(i, null, parent);
+            final int pos = i;
+            v.setOnClickListener(view -> mAdapter.onClickItem(pos));
+            v.setOnLongClickListener(view -> mAdapter.onLongClickItem(pos));
+            parent.addView(v);
+        }
+    }
+
     private void rotateRight() {
         rotateRight(this);
         rotateRight(mList);
@@ -424,8 +461,8 @@
         if (mList == null) return;
         // If got separated button, setRotatedBackground to false,
         // all items won't get white background.
-        mListBackground.setRotatedBackground(mHasSeparatedView);
-        mSeparatedViewBackground.setRotatedBackground(mHasSeparatedView);
+        mListBackground.setRotatedBackground(mSeparated);
+        mSeparatedViewBackground.setRotatedBackground(mSeparated);
         if (mDivision != null && mDivision.getVisibility() == VISIBLE) {
             int index = mRotatedBackground ? 0 : 1;
             mDivision.getLocationOnScreen(mTmp2);
@@ -476,21 +513,21 @@
             case RotationUtils.ROTATION_LANDSCAPE:
                 defaultTopPadding = getPaddingLeft();
                 viewsTotalHeight = mList.getMeasuredWidth() + mSeparatedView.getMeasuredWidth();
-                separatedViewTopMargin = mHasSeparatedView ? params.leftMargin : 0;
+                separatedViewTopMargin = mSeparated ? params.leftMargin : 0;
                 screenHeight = getMeasuredWidth();
                 targetGravity = Gravity.CENTER_HORIZONTAL|Gravity.TOP;
                 break;
             case RotationUtils.ROTATION_SEASCAPE:
                 defaultTopPadding = getPaddingRight();
                 viewsTotalHeight = mList.getMeasuredWidth() + mSeparatedView.getMeasuredWidth();
-                separatedViewTopMargin = mHasSeparatedView ? params.leftMargin : 0;
+                separatedViewTopMargin = mSeparated ? params.leftMargin : 0;
                 screenHeight = getMeasuredWidth();
                 targetGravity = Gravity.CENTER_HORIZONTAL|Gravity.BOTTOM;
                 break;
             default: // Portrait
                 defaultTopPadding = getPaddingTop();
                 viewsTotalHeight = mList.getMeasuredHeight() + mSeparatedView.getMeasuredHeight();
-                separatedViewTopMargin = mHasSeparatedView ? params.topMargin : 0;
+                separatedViewTopMargin = mSeparated ? params.topMargin : 0;
                 screenHeight = getMeasuredHeight();
                 targetGravity = Gravity.CENTER_VERTICAL|Gravity.RIGHT;
                 break;
@@ -522,4 +559,4 @@
         inoutInfo.contentInsets.set(mList.getLeft(), mList.getTop(),
                 0, getBottom() - mList.getBottom());
     };
-}
+}
\ No newline at end of file
diff --git a/packages/SystemUI/src/com/android/systemui/MultiListLayout.java b/packages/SystemUI/src/com/android/systemui/MultiListLayout.java
index 8c49d56..2bc4720 100644
--- a/packages/SystemUI/src/com/android/systemui/MultiListLayout.java
+++ b/packages/SystemUI/src/com/android/systemui/MultiListLayout.java
@@ -21,19 +21,20 @@
 import android.util.AttributeSet;
 import android.view.View;
 import android.view.ViewGroup;
+import android.widget.BaseAdapter;
 import android.widget.LinearLayout;
 
 import com.android.systemui.util.leak.RotationUtils;
 
+import java.util.ArrayList;
+
 /**
  * Layout class representing the Global Actions menu which appears when the power button is held.
  */
 public abstract class MultiListLayout extends LinearLayout {
     protected boolean mHasOutsideTouch;
-    protected boolean mHasSeparatedView;
-
-    protected int mExpectedSeparatedItemCount;
-    protected int mExpectedListItemCount;
+    protected boolean mSeparated;
+    protected MultiListAdapter mAdapter;
 
     protected int mRotation;
     protected RotationListener mRotationListener;
@@ -53,18 +54,6 @@
     public abstract void removeAllItems();
 
     /**
-     * Get the parent view which will be used to contain the item at the specified index.
-     * @param separated Whether or not this index refers to a position in the separated or list
-     *                  container.
-     * @param index The index of the item within the container.
-     * @param reverse If the MultiListLayout contains sub-lists within the list container, reverse
-     *                the order that they are filled.
-     * @return The parent ViewGroup which will be used to contain the specified item
-     * after it has been added to the layout.
-     */
-    public abstract ViewGroup getParentView(boolean separated, int index, boolean reverse);
-
-    /**
      * Sets the divided view, which may have a differently-colored background.
      */
     public abstract void setDivisionView(View v);
@@ -81,32 +70,19 @@
     }
 
     /**
-     * Sets the number of items expected to be rendered in the separated container. This allows the
-     * layout to correctly determine which parent containers will be used for items before they have
-     * beenadded to the layout.
-     * @param count The number of items expected.
-     */
-    public void setExpectedSeparatedItemCount(int count) {
-        mExpectedSeparatedItemCount = count;
-    }
-
-    /**
-     * Sets the number of items expected to be rendered in the list container. This allows the
-     * layout to correctly determine which parent containers will be used for items before they have
-     * beenadded to the layout.
-     * @param count The number of items expected.
-     */
-    public void setExpectedListItemCount(int count) {
-        mExpectedListItemCount = count;
-    }
-
-    /**
      * Sets whether the separated view should be shown, and handles updating visibility on
      * that view.
      */
-    public void setHasSeparatedView(boolean hasSeparatedView) {
-        mHasSeparatedView = hasSeparatedView;
-        setSeparatedViewVisibility(hasSeparatedView);
+    public void setSeparated(boolean separated) {
+        mSeparated = separated;
+        setSeparatedViewVisibility(separated);
+    }
+
+    /**
+     * Sets the adapter used to inflate items.
+     */
+    public void setAdapter(MultiListAdapter adapter) {
+        mAdapter = adapter;
     }
 
     /**
@@ -136,6 +112,19 @@
         }
     }
 
+    /**
+     * Update the list of items in both the separated and list views.
+     * For this to work, mAdapter must already have been set.
+     */
+    public void updateList() {
+        if (mAdapter == null) {
+            throw new IllegalStateException("mAdapter must be set before calling updateList");
+        }
+        onUpdateList();
+    }
+
+    protected abstract void onUpdateList();
+
     public void setRotationListener(RotationListener listener) {
         mRotationListener = listener;
     }
@@ -157,4 +146,35 @@
     public interface RotationListener {
         void onRotate(int from, int to);
     }
+
+    /**
+     * Adapter class for converting items into child views for MultiListLayout and handling
+     * callbacks for input events.
+     */
+    public abstract static class MultiListAdapter extends BaseAdapter {
+        /**
+         * Creates an ArrayList of items which should be rendered in the separated view.
+         * @param useSeparatedView is true if the separated view will be used, false otherwise.
+         */
+        public abstract ArrayList getSeparatedItems(boolean useSeparatedView);
+
+        /**
+         * Creates an ArrayList of items which should be rendered in the list view.
+         * @param useSeparatedView True if the separated view will be used, false otherwise.
+         */
+        public abstract ArrayList getListItems(boolean useSeparatedView);
+
+        /**
+         * Callback to run when an individual item is clicked or pressed.
+         * @param position The index of the item which was clicked.
+         */
+        public abstract void onClickItem(int position);
+
+        /**
+         * Callback to run when an individual item is long-clicked or long-pressed.
+         * @param position The index of the item which was long-clicked.
+         * @return True if the long-click was handled, false otherwise.
+         */
+        public abstract boolean onLongClickItem(int position);
+    }
 }
diff --git a/packages/SystemUI/src/com/android/systemui/ScreenDecorations.java b/packages/SystemUI/src/com/android/systemui/ScreenDecorations.java
index ab077d6..c0f03a6 100644
--- a/packages/SystemUI/src/com/android/systemui/ScreenDecorations.java
+++ b/packages/SystemUI/src/com/android/systemui/ScreenDecorations.java
@@ -471,6 +471,7 @@
             lp.width = WRAP_CONTENT;
             lp.height = MATCH_PARENT;
         }
+        lp.privateFlags |= WindowManager.LayoutParams.PRIVATE_FLAG_COLOR_SPACE_AGNOSTIC;
         return lp;
     }
 
diff --git a/packages/SystemUI/src/com/android/systemui/SizeCompatModeActivityController.java b/packages/SystemUI/src/com/android/systemui/SizeCompatModeActivityController.java
new file mode 100644
index 0000000..7a54344
--- /dev/null
+++ b/packages/SystemUI/src/com/android/systemui/SizeCompatModeActivityController.java
@@ -0,0 +1,285 @@
+/*
+ * Copyright (C) 2019 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 com.android.systemui;
+
+import android.app.ActivityTaskManager;
+import android.content.Context;
+import android.content.res.ColorStateList;
+import android.graphics.Color;
+import android.graphics.PixelFormat;
+import android.graphics.drawable.Drawable;
+import android.graphics.drawable.GradientDrawable;
+import android.graphics.drawable.RippleDrawable;
+import android.hardware.display.DisplayManager;
+import android.inputmethodservice.InputMethodService;
+import android.os.IBinder;
+import android.os.RemoteException;
+import android.util.Log;
+import android.util.SparseArray;
+import android.view.Display;
+import android.view.Gravity;
+import android.view.LayoutInflater;
+import android.view.View;
+import android.view.WindowManager;
+import android.widget.Button;
+import android.widget.ImageButton;
+import android.widget.LinearLayout;
+import android.widget.PopupWindow;
+
+import com.android.internal.annotations.VisibleForTesting;
+import com.android.systemui.shared.system.ActivityManagerWrapper;
+import com.android.systemui.shared.system.TaskStackChangeListener;
+import com.android.systemui.statusbar.CommandQueue;
+
+import java.lang.ref.WeakReference;
+
+/** Shows a restart-activity button when the foreground activity is in size compatibility mode. */
+public class SizeCompatModeActivityController extends SystemUI implements CommandQueue.Callbacks {
+    private static final String TAG = "SizeCompatMode";
+
+    /** The showing buttons by display id. */
+    private final SparseArray<RestartActivityButton> mActiveButtons = new SparseArray<>(1);
+    /** Avoid creating display context frequently for non-default display. */
+    private final SparseArray<WeakReference<Context>> mDisplayContextCache = new SparseArray<>(0);
+
+    /** Only show once automatically in the process life. */
+    private boolean mHasShownHint;
+
+    public SizeCompatModeActivityController() {
+        this(ActivityManagerWrapper.getInstance());
+    }
+
+    @VisibleForTesting
+    SizeCompatModeActivityController(ActivityManagerWrapper am) {
+        am.registerTaskStackListener(new TaskStackChangeListener() {
+            @Override
+            public void onSizeCompatModeActivityChanged(int displayId, IBinder activityToken) {
+                // Note the callback already runs on main thread.
+                updateRestartButton(displayId, activityToken);
+            }
+        });
+    }
+
+    @Override
+    public void start() {
+        SysUiServiceProvider.getComponent(mContext, CommandQueue.class).addCallback(this);
+    }
+
+    @Override
+    public void setImeWindowStatus(int displayId, IBinder token, int vis, int backDisposition,
+            boolean showImeSwitcher) {
+        RestartActivityButton button = mActiveButtons.get(displayId);
+        if (button == null) {
+            return;
+        }
+        boolean imeShown = (vis & InputMethodService.IME_VISIBLE) != 0;
+        int newVisibility = imeShown ? View.GONE : View.VISIBLE;
+        // Hide the button when input method is showing.
+        if (button.getVisibility() != newVisibility) {
+            button.setVisibility(newVisibility);
+        }
+    }
+
+    @Override
+    public void onDisplayRemoved(int displayId) {
+        mDisplayContextCache.remove(displayId);
+        removeRestartButton(displayId);
+    }
+
+    private void removeRestartButton(int displayId) {
+        RestartActivityButton button = mActiveButtons.get(displayId);
+        if (button != null) {
+            button.remove();
+            mActiveButtons.remove(displayId);
+        }
+    }
+
+    private void updateRestartButton(int displayId, IBinder activityToken) {
+        if (activityToken == null) {
+            // Null token means the current foreground activity is not in size compatibility mode.
+            removeRestartButton(displayId);
+            return;
+        }
+
+        RestartActivityButton restartButton = mActiveButtons.get(displayId);
+        if (restartButton != null) {
+            restartButton.updateLastTargetActivity(activityToken);
+            return;
+        }
+
+        Context context = getOrCreateDisplayContext(displayId);
+        if (context == null) {
+            Log.i(TAG, "Cannot get context for display " + displayId);
+            return;
+        }
+
+        restartButton = createRestartButton(context);
+        restartButton.updateLastTargetActivity(activityToken);
+        restartButton.show();
+        mActiveButtons.append(displayId, restartButton);
+    }
+
+    @VisibleForTesting
+    RestartActivityButton createRestartButton(Context context) {
+        RestartActivityButton button = new RestartActivityButton(context, mHasShownHint);
+        mHasShownHint = true;
+        return button;
+    }
+
+    private Context getOrCreateDisplayContext(int displayId) {
+        if (displayId == Display.DEFAULT_DISPLAY) {
+            return mContext;
+        }
+        Context context = null;
+        WeakReference<Context> ref = mDisplayContextCache.get(displayId);
+        if (ref != null) {
+            context = ref.get();
+        }
+        if (context == null) {
+            Display display = mContext.getSystemService(DisplayManager.class).getDisplay(displayId);
+            if (display != null) {
+                context = mContext.createDisplayContext(display);
+                mDisplayContextCache.put(displayId, new WeakReference<Context>(context));
+            }
+        }
+        return context;
+    }
+
+    @VisibleForTesting
+    static class RestartActivityButton extends ImageButton implements View.OnClickListener,
+            View.OnLongClickListener {
+
+        final WindowManager.LayoutParams mWinParams;
+        final boolean mShouldShowHint;
+        IBinder mLastActivityToken;
+
+        final int mPopupOffsetX;
+        final int mPopupOffsetY;
+        PopupWindow mShowingHint;
+
+        RestartActivityButton(Context context, boolean hasShownHint) {
+            super(context);
+            mShouldShowHint = !hasShownHint;
+            Drawable drawable = context.getDrawable(R.drawable.btn_restart);
+            setImageDrawable(drawable);
+            setContentDescription(context.getString(R.string.restart_button_description));
+
+            int drawableW = drawable.getIntrinsicWidth();
+            int drawableH = drawable.getIntrinsicHeight();
+            mPopupOffsetX = drawableW / 2;
+            mPopupOffsetY = drawableH * 2;
+
+            ColorStateList color = ColorStateList.valueOf(Color.LTGRAY);
+            GradientDrawable mask = new GradientDrawable();
+            mask.setShape(GradientDrawable.OVAL);
+            mask.setColor(color);
+            setBackground(new RippleDrawable(color, null /* content */, mask));
+            setOnClickListener(this);
+            setOnLongClickListener(this);
+
+            mWinParams = new WindowManager.LayoutParams();
+            mWinParams.gravity = getGravity(getResources().getConfiguration().getLayoutDirection());
+            mWinParams.width = drawableW * 2;
+            mWinParams.height = drawableH * 2;
+            mWinParams.type = WindowManager.LayoutParams.TYPE_APPLICATION_OVERLAY;
+            mWinParams.flags = WindowManager.LayoutParams.FLAG_NOT_FOCUSABLE
+                    | WindowManager.LayoutParams.FLAG_NOT_TOUCH_MODAL;
+            mWinParams.format = PixelFormat.TRANSLUCENT;
+            mWinParams.privateFlags |= WindowManager.LayoutParams.PRIVATE_FLAG_SHOW_FOR_ALL_USERS;
+            mWinParams.setTitle(SizeCompatModeActivityController.class.getSimpleName()
+                    + context.getDisplayId());
+        }
+
+        void updateLastTargetActivity(IBinder activityToken) {
+            mLastActivityToken = activityToken;
+        }
+
+        void show() {
+            getContext().getSystemService(WindowManager.class).addView(this, mWinParams);
+        }
+
+        void remove() {
+            getContext().getSystemService(WindowManager.class).removeViewImmediate(this);
+        }
+
+        @Override
+        public void onClick(View v) {
+            try {
+                ActivityTaskManager.getService().restartActivityProcessIfVisible(
+                        mLastActivityToken);
+            } catch (RemoteException e) {
+                Log.w(TAG, "Unable to restart activity", e);
+            }
+        }
+
+        @Override
+        public boolean onLongClick(View v) {
+            showHint();
+            return true;
+        }
+
+        @Override
+        protected void onAttachedToWindow() {
+            super.onAttachedToWindow();
+            if (mShouldShowHint) {
+                showHint();
+            }
+        }
+
+        @Override
+        public void setLayoutDirection(int layoutDirection) {
+            int gravity = getGravity(layoutDirection);
+            if (mWinParams.gravity != gravity) {
+                mWinParams.gravity = gravity;
+                if (mShowingHint != null) {
+                    mShowingHint.dismiss();
+                    showHint();
+                }
+                getContext().getSystemService(WindowManager.class).updateViewLayout(this,
+                        mWinParams);
+            }
+            super.setLayoutDirection(layoutDirection);
+        }
+
+        void showHint() {
+            if (mShowingHint != null) {
+                return;
+            }
+
+            View popupView = LayoutInflater.from(getContext()).inflate(
+                    R.layout.size_compat_mode_hint, null /* root */);
+            PopupWindow popupWindow = new PopupWindow(popupView,
+                    LinearLayout.LayoutParams.WRAP_CONTENT, LinearLayout.LayoutParams.WRAP_CONTENT);
+            popupWindow.setElevation(getResources().getDimension(R.dimen.bubble_elevation));
+            popupWindow.setAnimationStyle(android.R.style.Animation_InputMethod);
+            popupWindow.setClippingEnabled(false);
+            popupWindow.setOnDismissListener(() -> mShowingHint = null);
+            mShowingHint = popupWindow;
+
+            Button gotItButton = popupView.findViewById(R.id.got_it);
+            gotItButton.setBackground(new RippleDrawable(ColorStateList.valueOf(Color.LTGRAY),
+                    null /* content */, null /* mask */));
+            gotItButton.setOnClickListener(view -> popupWindow.dismiss());
+            popupWindow.showAtLocation(this, mWinParams.gravity, mPopupOffsetX, mPopupOffsetY);
+        }
+
+        private static int getGravity(int layoutDirection) {
+            return Gravity.BOTTOM
+                    | (layoutDirection == View.LAYOUT_DIRECTION_RTL ? Gravity.START : Gravity.END);
+        }
+    }
+}
diff --git a/packages/SystemUI/src/com/android/systemui/analytics/DataCollector.java b/packages/SystemUI/src/com/android/systemui/analytics/DataCollector.java
index 46e004c..0db5bef 100644
--- a/packages/SystemUI/src/com/android/systemui/analytics/DataCollector.java
+++ b/packages/SystemUI/src/com/android/systemui/analytics/DataCollector.java
@@ -380,6 +380,20 @@
         addEvent(PhoneEvent.ON_NOTIFICATION_START_DRAGGING_DOWN);
     }
 
+    public void onStartExpandingFromPulse() {
+        if (DEBUG) {
+            Log.d(TAG, "onStartExpandingFromPulse");
+        }
+        // TODO: maybe add event
+    }
+
+    public void onExpansionFromPulseStopped() {
+        if (DEBUG) {
+            Log.d(TAG, "onExpansionFromPulseStopped");
+        }
+        // TODO: maybe add event
+    }
+
     public void onNotificatonStopDraggingDown() {
         if (DEBUG) {
             Log.d(TAG, "onNotificationStopDraggingDown");
diff --git a/packages/SystemUI/src/com/android/systemui/appops/AppOpsControllerImpl.java b/packages/SystemUI/src/com/android/systemui/appops/AppOpsControllerImpl.java
index c013df3..ace086f 100644
--- a/packages/SystemUI/src/com/android/systemui/appops/AppOpsControllerImpl.java
+++ b/packages/SystemUI/src/com/android/systemui/appops/AppOpsControllerImpl.java
@@ -20,6 +20,7 @@
 
 import android.app.AppOpsManager;
 import android.content.Context;
+import android.content.pm.PackageManager;
 import android.os.Handler;
 import android.os.Looper;
 import android.os.UserHandle;
@@ -203,26 +204,37 @@
     }
 
     /**
+     * Does the app-op item refer to a user sensitive permission. Only user sensitive permission
+     * should be shown to the user by default.
+     *
+     * @param item The item
+     *
+     * @return {@code true} iff the app-op item is user sensitive
+     */
+    private boolean isUserSensitive(AppOpItem item) {
+        String permission = AppOpsManager.opToPermission(item.getCode());
+        if (permission == null) {
+            return false;
+        }
+        int permFlags = mContext.getPackageManager().getPermissionFlags(permission,
+                item.getPackageName(), UserHandle.getUserHandleForUid(item.getUid()));
+        return (permFlags & PackageManager.FLAG_PERMISSION_USER_SENSITIVE_WHEN_GRANTED) != 0;
+    }
+
+    /**
      * Returns a copy of the list containing all the active AppOps that the controller tracks.
      *
      * @return List of active AppOps information
      */
     public List<AppOpItem> getActiveAppOps() {
-        ArrayList<AppOpItem> active;
-        synchronized (mActiveItems) {
-            active = new ArrayList<>(mActiveItems);
-        }
-        synchronized (mNotedItems) {
-            active.addAll(mNotedItems);
-        }
-        return active;
+        return getActiveAppOpsForUser(UserHandle.USER_ALL);
     }
 
     /**
      * Returns a copy of the list containing all the active AppOps that the controller tracks, for
      * a given user id.
      *
-     * @param userId User id to track
+     * @param userId User id to track, can be {@link UserHandle#USER_ALL}
      *
      * @return List of active AppOps information for that user id
      */
@@ -232,7 +244,8 @@
             final int numActiveItems = mActiveItems.size();
             for (int i = 0; i < numActiveItems; i++) {
                 AppOpItem item = mActiveItems.get(i);
-                if (UserHandle.getUserId(item.getUid()) == userId) {
+                if ((userId == UserHandle.USER_ALL || UserHandle.getUserId(item.getUid()) == userId)
+                        && isUserSensitive(item)) {
                     list.add(item);
                 }
             }
@@ -241,7 +254,8 @@
             final int numNotedItems = mNotedItems.size();
             for (int i = 0; i < numNotedItems; i++) {
                 AppOpItem item = mNotedItems.get(i);
-                if (UserHandle.getUserId(item.getUid()) == userId) {
+                if ((userId == UserHandle.USER_ALL || UserHandle.getUserId(item.getUid()) == userId)
+                        && isUserSensitive(item)) {
                     list.add(item);
                 }
             }
diff --git a/packages/SystemUI/src/com/android/systemui/assist/AssistManager.java b/packages/SystemUI/src/com/android/systemui/assist/AssistManager.java
index 83398cf..ff68d2b 100644
--- a/packages/SystemUI/src/com/android/systemui/assist/AssistManager.java
+++ b/packages/SystemUI/src/com/android/systemui/assist/AssistManager.java
@@ -315,8 +315,13 @@
     }
 
     @Nullable
+    public ComponentName getAssistInfoForUser(int userId) {
+        return mAssistUtils.getAssistComponentForUser(userId);
+    }
+
+    @Nullable
     private ComponentName getAssistInfo() {
-        return mAssistUtils.getAssistComponentForUser(KeyguardUpdateMonitor.getCurrentUser());
+        return getAssistInfoForUser(KeyguardUpdateMonitor.getCurrentUser());
     }
 
     public void showDisclosure() {
diff --git a/packages/SystemUI/src/com/android/systemui/bubbles/BubbleController.java b/packages/SystemUI/src/com/android/systemui/bubbles/BubbleController.java
index 471619e..eb85589 100644
--- a/packages/SystemUI/src/com/android/systemui/bubbles/BubbleController.java
+++ b/packages/SystemUI/src/com/android/systemui/bubbles/BubbleController.java
@@ -23,8 +23,9 @@
 import static com.android.systemui.statusbar.StatusBarState.SHADE;
 import static com.android.systemui.statusbar.notification.NotificationAlertingManager.alertAgain;
 
+import static java.lang.annotation.RetentionPolicy.SOURCE;
+
 import android.annotation.Nullable;
-import android.app.ActivityManager;
 import android.app.ActivityManager.RunningTaskInfo;
 import android.app.ActivityTaskManager;
 import android.app.IActivityTaskManager;
@@ -43,6 +44,7 @@
 import android.view.ViewGroup;
 import android.widget.FrameLayout;
 
+import androidx.annotation.IntDef;
 import androidx.annotation.MainThread;
 
 import com.android.internal.annotations.VisibleForTesting;
@@ -60,7 +62,7 @@
 import com.android.systemui.statusbar.notification.row.NotificationContentInflater.InflationFlag;
 import com.android.systemui.statusbar.phone.StatusBarWindowController;
 
-import java.util.List;
+import java.lang.annotation.Retention;
 
 import javax.inject.Inject;
 import javax.inject.Singleton;
@@ -73,10 +75,22 @@
  */
 @Singleton
 public class BubbleController implements BubbleExpandedView.OnBubbleBlockedListener {
-    private static final int MAX_BUBBLES = 5; // TODO: actually enforce this
 
     private static final String TAG = "BubbleController";
 
+    private static final int MAX_BUBBLES = 5; // TODO: actually enforce this
+
+    @Retention(SOURCE)
+    @IntDef({DISMISS_USER_GESTURE, DISMISS_AGED, DISMISS_TASK_FINISHED, DISMISS_BLOCKED,
+            DISMISS_NOTIF_CANCEL, DISMISS_ACCESSIBILITY_ACTION})
+    @interface DismissReason {}
+    static final int DISMISS_USER_GESTURE = 1;
+    static final int DISMISS_AGED = 2;
+    static final int DISMISS_TASK_FINISHED = 3;
+    static final int DISMISS_BLOCKED = 4;
+    static final int DISMISS_NOTIF_CANCEL = 5;
+    static final int DISMISS_ACCESSIBILITY_ACTION = 6;
+
     // Enables some subset of notifs to automatically become bubbles
     private static final boolean DEBUG_ENABLE_AUTO_BUBBLE = false;
 
@@ -95,6 +109,9 @@
     /** Flag to position the header below the activity view */
     private static final String ENABLE_BUBBLE_FOOTER = "experiment_enable_bubble_footer";
 
+    private static final String BUBBLE_STIFFNESS = "experiment_bubble_stiffness";
+    private static final String BUBBLE_BOUNCINESS = "experiment_bubble_bounciness";
+
     private final Context mContext;
     private final NotificationEntryManager mNotificationEntryManager;
     private final IActivityTaskManager mActivityTaskManager;
@@ -248,11 +265,11 @@
     /**
      * Tell the stack of bubbles to be dismissed, this will remove all of the bubbles in the stack.
      */
-    void dismissStack() {
+    void dismissStack(@DismissReason int reason) {
         if (mStackView == null) {
             return;
         }
-        mStackView.stackDismissed();
+        mStackView.stackDismissed(reason);
 
         updateVisibility();
         mNotificationEntryManager.updateNotifications();
@@ -304,9 +321,9 @@
      * Must be called from the main thread.
      */
     @MainThread
-    void removeBubble(String key) {
+    void removeBubble(String key, int reason) {
         if (mStackView != null) {
-            mStackView.removeBubble(key);
+            mStackView.removeBubble(key, reason);
         }
         mNotificationEntryManager.updateNotifications();
         updateVisibility();
@@ -320,7 +337,7 @@
             boolean samePackage = entry.notification.getPackageName().equals(
                     e.notification.getPackageName());
             if (samePackage) {
-                removeBubble(entry.key);
+                removeBubble(entry.key, DISMISS_BLOCKED);
             }
         }
     }
@@ -377,7 +394,7 @@
             }
             if (!removedByUser) {
                 // This was a cancel so we should remove the bubble
-                removeBubble(entry.key);
+                removeBubble(entry.key, DISMISS_NOTIF_CANCEL);
             }
         }
     };
@@ -488,24 +505,6 @@
     @MainThread
     private class BubbleTaskStackListener extends TaskStackChangeListener {
 
-        @Nullable
-        private ActivityManager.StackInfo findStackInfo(int taskId) throws RemoteException {
-            final List<ActivityManager.StackInfo> stackInfoList =
-                    mActivityTaskManager.getAllStackInfos();
-            // Iterate through stacks from top to bottom.
-            final int stackCount = stackInfoList.size();
-            for (int stackIndex = 0; stackIndex < stackCount; stackIndex++) {
-                final ActivityManager.StackInfo stackInfo = stackInfoList.get(stackIndex);
-                // Iterate through tasks from top to bottom.
-                for (int taskIndex = stackInfo.taskIds.length - 1; taskIndex >= 0; taskIndex--) {
-                    if (stackInfo.taskIds[taskIndex] == taskId) {
-                        return stackInfo;
-                    }
-                }
-            }
-            return null;
-        }
-
         @Override
         public void onTaskMovedToFront(RunningTaskInfo taskInfo) {
             if (mStackView != null && taskInfo.displayId == Display.DEFAULT_DISPLAY) {
@@ -513,15 +512,8 @@
             }
         }
 
-        /**
-         * This is a workaround for the case when the activity had to be created in a new task.
-         * Existing code in ActivityStackSupervisor checks the display where the activity
-         * ultimately ended up, displays an error message toast, and calls this method instead of
-         * onTaskMovedToFront.
-         */
         @Override
-        public void onActivityLaunchOnSecondaryDisplayFailed(RunningTaskInfo taskInfo) {
-            // TODO(b/124058588): move to ActivityView.StateCallback, filter on virtualDisplay ID
+        public void onActivityLaunchOnSecondaryDisplayRerouted() {
             if (mStackView != null) {
                 mStackView.collapseStack();
             }
@@ -569,6 +561,20 @@
                 ENABLE_BUBBLE_FOOTER, 0) != 0;
     }
 
+    /** Default stiffness to use for bubble physics animations. */
+    public static int getBubbleStiffness(Context context, int defaultStiffness) {
+        return Settings.Secure.getInt(
+                context.getContentResolver(), BUBBLE_STIFFNESS, defaultStiffness);
+    }
+
+    /** Default bounciness/damping ratio to use for bubble physics animations. */
+    public static float getBubbleBounciness(Context context, float defaultBounciness) {
+        return Settings.Secure.getInt(
+                context.getContentResolver(),
+                BUBBLE_BOUNCINESS,
+                (int) (defaultBounciness * 100)) / 100f;
+    }
+
     /** PinnedStackListener that dispatches IME visibility updates to the stack. */
     private class BubblesImeListener extends IPinnedStackListener.Stub {
 
@@ -582,12 +588,9 @@
                 int displayRotation) throws RemoteException {}
 
         @Override
-        public void onImeVisibilityChanged(boolean imeVisible, int imeHeight)
-                throws RemoteException {
-            if (mStackView != null) {
-                mStackView.post(() -> {
-                    mStackView.onImeVisibilityChanged(imeVisible, imeHeight);
-                });
+        public void onImeVisibilityChanged(boolean imeVisible, int imeHeight) {
+            if (mStackView != null && mStackView.getBubbleCount() > 0) {
+                mStackView.post(() -> mStackView.onImeVisibilityChanged(imeVisible, imeHeight));
             }
         }
 
diff --git a/packages/SystemUI/src/com/android/systemui/bubbles/BubbleExpandedView.java b/packages/SystemUI/src/com/android/systemui/bubbles/BubbleExpandedView.java
index 603b3b9..856b9d6 100644
--- a/packages/SystemUI/src/com/android/systemui/bubbles/BubbleExpandedView.java
+++ b/packages/SystemUI/src/com/android/systemui/bubbles/BubbleExpandedView.java
@@ -49,6 +49,7 @@
 import android.util.Log;
 import android.util.StatsLog;
 import android.view.View;
+import android.view.ViewGroup;
 import android.view.WindowInsets;
 import android.widget.FrameLayout;
 import android.widget.ImageButton;
@@ -134,7 +135,8 @@
         public void onTaskRemovalStarted(int taskId) {
             if (mEntry != null) {
                 // Must post because this is called from a binder thread.
-                post(() -> mBubbleController.removeBubble(mEntry.key));
+                post(() -> mBubbleController.removeBubble(mEntry.key,
+                        BubbleController.DISMISS_TASK_FINISHED));
             }
         }
     };
@@ -316,8 +318,25 @@
     /**
      * Lets activity view know it should be shown / populated.
      */
-    public void populateActivityView() {
-        mActivityView.setCallback(mStateCallback);
+    public void populateExpandedView() {
+        if (usingActivityView()) {
+            mActivityView.setCallback(mStateCallback);
+        } else {
+            // We're using notification template
+            ViewGroup parent = (ViewGroup) mNotifRow.getParent();
+            if (parent == this) {
+                // Already added
+                return;
+            } else if (parent != null) {
+                // Still in the shade... remove it
+                parent.removeView(mNotifRow);
+            }
+            if (mShowOnTop) {
+                addView(mNotifRow);
+            } else {
+                addView(mNotifRow, mUseFooter ? 0 : 1);
+            }
+        }
     }
 
     /**
@@ -376,14 +395,8 @@
         } else {
             // Hide activity view if we had it previously
             mActivityView.setVisibility(GONE);
-
-            // Use notification view
             mNotifRow = mEntry.getRow();
-            if (mShowOnTop) {
-                addView(mNotifRow);
-            } else {
-                addView(mNotifRow, mUseFooter ? 0 : 1);
-            }
+
         }
         updateView();
     }
@@ -516,7 +529,9 @@
     /**
      * Removes and releases an ActivityView if one was previously created for this bubble.
      */
-    public void destroyActivityView() {
+    public void cleanUpExpandedState() {
+        removeView(mNotifRow);
+
         if (mActivityView == null) {
             return;
         }
diff --git a/packages/SystemUI/src/com/android/systemui/bubbles/BubbleStackView.java b/packages/SystemUI/src/com/android/systemui/bubbles/BubbleStackView.java
index 8235d8d..888e3fe 100644
--- a/packages/SystemUI/src/com/android/systemui/bubbles/BubbleStackView.java
+++ b/packages/SystemUI/src/com/android/systemui/bubbles/BubbleStackView.java
@@ -19,6 +19,8 @@
 import static android.view.ViewGroup.LayoutParams.MATCH_PARENT;
 import static android.view.ViewGroup.LayoutParams.WRAP_CONTENT;
 
+import android.app.Notification;
+import android.app.PendingIntent;
 import android.content.Context;
 import android.content.res.Resources;
 import android.graphics.Outline;
@@ -26,6 +28,7 @@
 import android.graphics.PointF;
 import android.graphics.Rect;
 import android.graphics.RectF;
+import android.os.Bundle;
 import android.service.notification.StatusBarNotification;
 import android.util.Log;
 import android.util.StatsLog;
@@ -36,6 +39,7 @@
 import android.view.ViewTreeObserver;
 import android.view.WindowInsets;
 import android.view.WindowManager;
+import android.view.accessibility.AccessibilityNodeInfo;
 import android.widget.FrameLayout;
 
 import androidx.annotation.MainThread;
@@ -47,6 +51,7 @@
 import com.android.internal.annotations.VisibleForTesting;
 import com.android.internal.widget.ViewClippingUtil;
 import com.android.systemui.R;
+import com.android.systemui.bubbles.BubbleController.DismissReason;
 import com.android.systemui.bubbles.animation.ExpandedAnimationController;
 import com.android.systemui.bubbles.animation.PhysicsAnimationLayout;
 import com.android.systemui.bubbles.animation.StackAnimationController;
@@ -60,26 +65,7 @@
  */
 public class BubbleStackView extends FrameLayout {
     private static final String TAG = "BubbleStackView";
-
-    /**
-     * Friction applied to fling animations. Since the stack must land on one of the sides of the
-     * screen, we want less friction horizontally so that the stack has a better chance of making it
-     * to the side without needing a spring.
-     */
-    private static final float FLING_FRICTION_X = 1.15f;
-    private static final float FLING_FRICTION_Y = 1.5f;
-
-    /**
-     * Damping ratio to use for the stack spring animation used to spring the stack to its final
-     * position after a fling.
-     */
-    private static final float SPRING_DAMPING_RATIO = 0.85f;
-
-    /**
-     * Minimum fling velocity required to trigger moving the stack from one side of the screen to
-     * the other.
-     */
-    private static final float ESCAPE_VELOCITY = 750f;
+    private static final boolean DEBUG = false;
 
     private Point mDisplaySize;
 
@@ -205,11 +191,16 @@
                         .setDampingRatio(SpringForce.DAMPING_RATIO_LOW_BOUNCY));
 
         setClipChildren(false);
-
+        setFocusable(true);
         mBubbleContainer.bringToFront();
     }
 
     @Override
+    public void getBoundsOnScreen(Rect outRect, boolean clipToParent) {
+        getBoundsOnScreen(outRect);
+    }
+
+    @Override
     protected void onDetachedFromWindow() {
         super.onDetachedFromWindow();
         getViewTreeObserver().removeOnPreDrawListener(mViewUpdater);
@@ -227,6 +218,36 @@
         }
     }
 
+    @Override
+    public void onInitializeAccessibilityNodeInfoInternal(AccessibilityNodeInfo info) {
+        super.onInitializeAccessibilityNodeInfoInternal(info);
+        info.addAction(AccessibilityNodeInfo.AccessibilityAction.ACTION_DISMISS);
+        if (mIsExpanded) {
+            info.addAction(AccessibilityNodeInfo.AccessibilityAction.ACTION_COLLAPSE);
+        } else {
+            info.addAction(AccessibilityNodeInfo.AccessibilityAction.ACTION_EXPAND);
+        }
+    }
+
+    @Override
+    public boolean performAccessibilityActionInternal(int action, Bundle arguments) {
+        if (super.performAccessibilityActionInternal(action, arguments)) {
+            return true;
+        }
+        switch (action) {
+            case AccessibilityNodeInfo.ACTION_DISMISS:
+                stackDismissed(BubbleController.DISMISS_ACCESSIBILITY_ACTION);
+                return true;
+            case AccessibilityNodeInfo.ACTION_COLLAPSE:
+                collapseStack();
+                return true;
+            case AccessibilityNodeInfo.ACTION_EXPAND:
+                expandStack();
+                return true;
+        }
+        return false;
+    }
+
     /**
      * Updates the visibility of the 'dot' indicating an update on the bubble.
      * @param key the {@link NotificationEntry#key} associated with the bubble.
@@ -339,18 +360,12 @@
     /**
      * Remove a bubble from the stack.
      */
-    public void removeBubble(String key) {
+    public void removeBubble(String key, int reason) {
         Bubble b = mBubbleData.removeBubble(key);
         if (b == null) {
             return;
         }
-        b.entry.setBubbleDismissed(true);
-
-        // Remove it from the views
-        int removedIndex = mBubbleContainer.indexOfChild(b.iconView);
-        b.expandedView.destroyActivityView();
-        mBubbleContainer.removeView(b.iconView);
-
+        int removedIndex = dismissBubble(b, reason);
         int bubbleCount = mBubbleContainer.getChildCount();
         if (bubbleCount == 0) {
             // If no bubbles remain, collapse the entire stack.
@@ -368,26 +383,63 @@
                 mExpandedBubble = null;
             }
         }
+        // TODO: consider logging reason code
         logBubbleEvent(b, StatsLog.BUBBLE_UICHANGED__ACTION__DISMISSED);
     }
 
     /**
      * Dismiss the stack of bubbles.
      */
-    public void stackDismissed() {
+    public void stackDismissed(int reason) {
         for (Bubble bubble : mBubbleData.getBubbles()) {
-            bubble.entry.setBubbleDismissed(true);
-            bubble.expandedView.destroyActivityView();
+            dismissBubble(bubble, reason);
         }
         mBubbleData.clear();
         collapseStack();
         mBubbleContainer.removeAllViews();
         mExpandedViewContainer.removeAllViews();
+        // TODO: consider logging reason code
         logBubbleEvent(null /* no bubble associated with bubble stack dismiss */,
                 StatsLog.BUBBLE_UICHANGED__ACTION__STACK_DISMISSED);
     }
 
     /**
+     * Marks the notification entry as dismissed, cleans up Bubble icon and expanded view UI
+     * elements and calls deleteIntent if necessary.
+     *
+     * <p>Note: This does not remove the Bubble from BubbleData.
+     *
+     * @param bubble the Bubble being dismissed
+     * @param reason code for the reason the dismiss was triggered
+     * @see BubbleController.DismissReason
+     */
+    private int dismissBubble(Bubble bubble, @DismissReason int reason) {
+        if (DEBUG) {
+            Log.d(TAG, "dismissBubble: " + bubble + " reason=" + reason);
+        }
+        bubble.entry.setBubbleDismissed(true);
+        bubble.expandedView.cleanUpExpandedState();
+
+        // Remove it from the views
+        int removedIndex = mBubbleContainer.indexOfChild(bubble.iconView);
+        mBubbleContainer.removeViewAt(removedIndex);
+
+        if (reason == BubbleController.DISMISS_USER_GESTURE) {
+            Notification.BubbleMetadata bubbleMetadata = bubble.entry.getBubbleMetadata();
+            PendingIntent deleteIntent = bubbleMetadata.getDeleteIntent();
+            if (deleteIntent != null) {
+                try {
+                    deleteIntent.send();
+                } catch (PendingIntent.CanceledException e) {
+                    Log.w(TAG, "Failed to send delete intent for bubble with key: "
+                            + (bubble.entry != null ? bubble.entry.key : " null entry"));
+                }
+            }
+        }
+        return removedIndex;
+    }
+
+    /**
      * Updates a bubble in the stack.
      *
      * @param entry the entry to update in the stack.
@@ -458,7 +510,7 @@
     }
 
     /**
-     * Expands the stack fo bubbles.
+     * Expands the stack of bubbles.
      * <p>
      * Must be called from the main thread.
      */
@@ -491,7 +543,9 @@
             if (shouldExpand) {
                 mBubbleContainer.setController(mExpandedAnimationController);
                 mExpandedAnimationController.expandFromStack(
-                        mStackAnimationController.getStackPosition(),
+                        /* collapseTo */
+                        mStackAnimationController.getStackPositionAlongNearestHorizontalEdge(),
+                        /* after */
                         () -> {
                             updatePointerPosition();
                             updateAfter.run();
@@ -614,50 +668,7 @@
             return;
         }
 
-        final boolean stackOnLeftSide = x
-                - mBubbleContainer.getChildAt(0).getWidth() / 2
-                < mDisplaySize.x / 2;
-
-        final boolean stackShouldFlingLeft = stackOnLeftSide
-                ? velX < ESCAPE_VELOCITY
-                : velX < -ESCAPE_VELOCITY;
-
-        final RectF stackBounds = mStackAnimationController.getAllowableStackPositionRegion();
-
-        // Target X translation (either the left or right side of the screen).
-        final float destinationRelativeX = stackShouldFlingLeft
-                ? stackBounds.left : stackBounds.right;
-
-        // Minimum velocity required for the stack to make it to the side of the screen.
-        final float escapeVelocity = getMinXVelocity(
-                x,
-                destinationRelativeX,
-                FLING_FRICTION_X);
-
-        // Use the touch event's velocity if it's sufficient, otherwise use the minimum velocity so
-        // that it'll make it all the way to the side of the screen.
-        final float startXVelocity = stackShouldFlingLeft
-                ? Math.min(escapeVelocity, velX)
-                : Math.max(escapeVelocity, velX);
-
-        mStackAnimationController.flingThenSpringFirstBubbleWithStackFollowing(
-                DynamicAnimation.TRANSLATION_X,
-                startXVelocity,
-                FLING_FRICTION_X,
-                new SpringForce()
-                        .setStiffness(SpringForce.STIFFNESS_LOW)
-                        .setDampingRatio(SPRING_DAMPING_RATIO),
-                destinationRelativeX);
-
-        mStackAnimationController.flingThenSpringFirstBubbleWithStackFollowing(
-                DynamicAnimation.TRANSLATION_Y,
-                velY,
-                FLING_FRICTION_Y,
-                new SpringForce()
-                        .setStiffness(SpringForce.STIFFNESS_LOW)
-                        .setDampingRatio(SPRING_DAMPING_RATIO),
-                /* destination */ null);
-
+        mStackAnimationController.flingStackThenSpringToEdge(x, velX, velY);
         logBubbleEvent(null /* no bubble associated with bubble stack move */,
                 StatsLog.BUBBLE_UICHANGED__ACTION__STACK_MOVED);
     }
@@ -702,24 +713,12 @@
         }
     }
 
-    /**
-     * Minimum velocity, in pixels/second, required to get from x to destX while being slowed by a
-     * given frictional force.
-     *
-     * This is not derived using real math, I just made it up because the math in FlingAnimation
-     * looks hard and this seems to work. It doesn't actually matter because if it doesn't make it
-     * to the edge via Fling, it'll get Spring'd there anyway.
-     *
-     * TODO(tsuji, or someone who likes math): Figure out math.
-     */
-    private float getMinXVelocity(float x, float destX, float friction) {
-        return (destX - x) * (friction * 5) + ESCAPE_VELOCITY;
-    }
-
     @Override
     public void getBoundsOnScreen(Rect outRect) {
         if (!mIsExpanded) {
-            mBubbleContainer.getChildAt(0).getBoundsOnScreen(outRect);
+            if (mBubbleContainer.getChildCount() > 0) {
+                mBubbleContainer.getChildAt(0).getBoundsOnScreen(outRect);
+            }
         } else {
             mBubbleContainer.getBoundsOnScreen(outRect);
         }
@@ -766,7 +765,7 @@
         mExpandedViewContainer.removeAllViews();
         if (mExpandedBubble != null && mIsExpanded) {
             mExpandedViewContainer.addView(mExpandedBubble.expandedView);
-            mExpandedBubble.expandedView.populateActivityView();
+            mExpandedBubble.expandedView.populateExpandedView();
             mExpandedViewContainer.setVisibility(mIsExpanded ? VISIBLE : GONE);
         }
     }
@@ -776,8 +775,12 @@
 
         mExpandedViewContainer.setVisibility(mIsExpanded ? VISIBLE : GONE);
         if (mIsExpanded) {
+            // First update the view so that it calculates a new height (ensuring the y position
+            // calculation is correct)
+            mExpandedBubble.expandedView.updateView();
             final float y = getYPositionForExpandedView();
             mExpandedViewContainer.setTranslationY(y);
+            // Then update the view so that ActivityView knows we translated
             mExpandedBubble.expandedView.updateView();
         }
 
diff --git a/packages/SystemUI/src/com/android/systemui/bubbles/BubbleTouchHandler.java b/packages/SystemUI/src/com/android/systemui/bubbles/BubbleTouchHandler.java
index 165eb1d..a7170d0 100644
--- a/packages/SystemUI/src/com/android/systemui/bubbles/BubbleTouchHandler.java
+++ b/packages/SystemUI/src/com/android/systemui/bubbles/BubbleTouchHandler.java
@@ -81,8 +81,7 @@
         // anything, collapse the stack.
         if (action == MotionEvent.ACTION_OUTSIDE || mTouchedView == null) {
             mStack.collapseStack();
-            cleanUpDismissTarget();
-            mTouchedView = null;
+            resetForNextGesture();
             return false;
         }
 
@@ -135,16 +134,15 @@
                 break;
 
             case MotionEvent.ACTION_CANCEL:
-                mTouchedView = null;
-                cleanUpDismissTarget();
+                resetForNextGesture();
                 break;
 
             case MotionEvent.ACTION_UP:
                 trackMovement(event);
                 if (mInDismissTarget && isStack) {
-                    mController.dismissStack();
+                    mController.dismissStack(BubbleController.DISMISS_USER_GESTURE);
                 } else if (mMovedEnough) {
-                    mVelocityTracker.computeCurrentVelocity(1000);
+                    mVelocityTracker.computeCurrentVelocity(/* maxVelocity */ 1000);
                     final float velX = mVelocityTracker.getXVelocity();
                     final float velY = mVelocityTracker.getYVelocity();
                     if (isStack) {
@@ -154,10 +152,11 @@
                         mStack.onBubbleDragFinish(
                                 mTouchedView, viewX, viewY, velX, velY, /* dismissed */ dismissed);
                         if (dismissed) {
-                            mController.removeBubble(((BubbleView) mTouchedView).getKey());
+                            mController.removeBubble(((BubbleView) mTouchedView).getKey(),
+                                    BubbleController.DISMISS_USER_GESTURE);
                         }
                     }
-                } else if (mTouchedView.equals(mStack.getExpandedBubbleView())) {
+                } else if (mTouchedView == mStack.getExpandedBubbleView()) {
                     mStack.collapseStack();
                 } else if (isStack) {
                     if (mStack.isExpanded()) {
@@ -169,17 +168,25 @@
                     mStack.setExpandedBubble(((BubbleView) mTouchedView).getKey());
                 }
 
-                cleanUpDismissTarget();
-                mVelocityTracker.recycle();
-                mVelocityTracker = null;
-                mTouchedView = null;
-                mMovedEnough = false;
+                resetForNextGesture();
                 break;
         }
 
         return true;
     }
 
+    /** Clears all touch-related state. */
+    private void resetForNextGesture() {
+        cleanUpDismissTarget();
+        if (mVelocityTracker != null) {
+            mVelocityTracker.recycle();
+            mVelocityTracker = null;
+        }
+        mTouchedView = null;
+        mMovedEnough = false;
+        mInDismissTarget = false;
+    }
+
     /**
      * Removes the dismiss target and cancels any pending callbacks to show it.
      */
diff --git a/packages/SystemUI/src/com/android/systemui/bubbles/animation/ExpandedAnimationController.java b/packages/SystemUI/src/com/android/systemui/bubbles/animation/ExpandedAnimationController.java
index f7896b0..1f29883 100644
--- a/packages/SystemUI/src/com/android/systemui/bubbles/animation/ExpandedAnimationController.java
+++ b/packages/SystemUI/src/com/android/systemui/bubbles/animation/ExpandedAnimationController.java
@@ -49,11 +49,8 @@
     /** How much to scale down bubbles when they're animating in/out. */
     private static final float ANIMATE_SCALE_PERCENT = 0.5f;
 
-    /**
-     * The stack position from which the bubbles were expanded. Saved in {@link #expandFromStack}
-     * and used to return to stack form in {@link #collapseBackToStack}.
-     */
-    private PointF mExpandedFrom;
+    /** The stack position to collapse back to in {@link #collapseBackToStack}. */
+    private PointF mCollapseToPoint;
 
     /** Horizontal offset between bubbles, which we need to know to re-stack them. */
     private float mStackOffsetPx;
@@ -106,8 +103,8 @@
      *
      * @return The y-value to which the bubbles were expanded, in case that's useful.
      */
-    public float expandFromStack(PointF expandedFrom, Runnable after) {
-        mExpandedFrom = expandedFrom;
+    public float expandFromStack(PointF collapseTo, Runnable after) {
+        mCollapseToPoint = collapseTo;
 
         // How much to translate the next bubble, so that it is not overlapping the previous one.
         float translateNextBubbleXBy = mBubblePaddingPx;
@@ -123,10 +120,11 @@
     /** Animate collapsing the bubbles back to their stacked position. */
     public void collapseBackToStack(Runnable after) {
         // Stack to the left if we're going to the left, or right if not.
-        final float sideMultiplier = mLayout.isFirstChildXLeftOfCenter(mExpandedFrom.x) ? -1 : 1;
+        final float sideMultiplier = mLayout.isFirstChildXLeftOfCenter(mCollapseToPoint.x) ? -1 : 1;
         for (int i = 0; i < mLayout.getChildCount(); i++) {
             mLayout.animatePositionForChildAtIndex(
-                    i, mExpandedFrom.x + (sideMultiplier * i * mStackOffsetPx), mExpandedFrom.y);
+                    i,
+                    mCollapseToPoint.x + (sideMultiplier * i * mStackOffsetPx), mCollapseToPoint.y);
         }
 
         runAfterTranslationsEnd(after);
@@ -268,8 +266,8 @@
     @Override
     SpringForce getSpringForce(DynamicAnimation.ViewProperty property, View view) {
         return new SpringForce()
-                .setStiffness(SpringForce.STIFFNESS_LOW)
-                .setDampingRatio(SpringForce.DAMPING_RATIO_LOW_BOUNCY);
+                .setDampingRatio(SpringForce.DAMPING_RATIO_LOW_BOUNCY)
+                .setStiffness(SpringForce.STIFFNESS_LOW);
     }
 
     @Override
diff --git a/packages/SystemUI/src/com/android/systemui/bubbles/animation/StackAnimationController.java b/packages/SystemUI/src/com/android/systemui/bubbles/animation/StackAnimationController.java
index f47fbe0..3c4bc72 100644
--- a/packages/SystemUI/src/com/android/systemui/bubbles/animation/StackAnimationController.java
+++ b/packages/SystemUI/src/com/android/systemui/bubbles/animation/StackAnimationController.java
@@ -30,6 +30,7 @@
 import androidx.dynamicanimation.animation.SpringForce;
 
 import com.android.systemui.R;
+import com.android.systemui.bubbles.BubbleController;
 
 import com.google.android.collect.Sets;
 
@@ -60,12 +61,35 @@
     private static final float DEFAULT_BOUNCINESS = 0.85f;
 
     /**
+     * Friction applied to fling animations. Since the stack must land on one of the sides of the
+     * screen, we want less friction horizontally so that the stack has a better chance of making it
+     * to the side without needing a spring.
+     */
+    private static final float FLING_FRICTION_X = 1.15f;
+    private static final float FLING_FRICTION_Y = 1.5f;
+
+    /**
+     * Damping ratio to use for the stack spring animation used to spring the stack to its final
+     * position after a fling.
+     */
+    private static final float SPRING_DAMPING_RATIO = 0.85f;
+
+    /**
+     * Minimum fling velocity required to trigger moving the stack from one side of the screen to
+     * the other.
+     */
+    private static final float ESCAPE_VELOCITY = 750f;
+
+    /**
      * The canonical position of the stack. This is typically the position of the first bubble, but
      * we need to keep track of it separately from the first bubble's translation in case there are
      * no bubbles, or the first bubble was just added and being animated to its new position.
      */
     private PointF mStackPosition = new PointF();
 
+    /** The most recent position in which the stack was resting on the edge of the screen. */
+    private PointF mRestingStackPosition;
+
     /** The height of the most recently visible IME. */
     private float mImeHeight = 0f;
 
@@ -134,12 +158,83 @@
     }
 
     /**
+     * Flings the stack starting with the given velocities, springing it to the nearest edge
+     * afterward.
+     */
+    public void flingStackThenSpringToEdge(float x, float velX, float velY) {
+        final boolean stackOnLeftSide = x - mIndividualBubbleSize / 2 < mLayout.getWidth() / 2;
+
+        final boolean stackShouldFlingLeft = stackOnLeftSide
+                ? velX < ESCAPE_VELOCITY
+                : velX < -ESCAPE_VELOCITY;
+
+        final RectF stackBounds = getAllowableStackPositionRegion();
+
+        // Target X translation (either the left or right side of the screen).
+        final float destinationRelativeX = stackShouldFlingLeft
+                ? stackBounds.left : stackBounds.right;
+
+        // Minimum velocity required for the stack to make it to the targeted side of the screen,
+        // taking friction into account (4.2f is the number that friction scalars are multiplied by
+        // in DynamicAnimation.DragForce). This is an estimate - it could possibly be slightly off,
+        // but the SpringAnimation at the end will ensure that it reaches the destination X
+        // regardless.
+        final float minimumVelocityToReachEdge =
+                (destinationRelativeX - x) * (FLING_FRICTION_X * 4.2f);
+
+        // Use the touch event's velocity if it's sufficient, otherwise use the minimum velocity so
+        // that it'll make it all the way to the side of the screen.
+        final float startXVelocity = stackShouldFlingLeft
+                ? Math.min(minimumVelocityToReachEdge, velX)
+                : Math.max(minimumVelocityToReachEdge, velX);
+
+        flingThenSpringFirstBubbleWithStackFollowing(
+                DynamicAnimation.TRANSLATION_X,
+                startXVelocity,
+                FLING_FRICTION_X,
+                new SpringForce()
+                        .setStiffness(SpringForce.STIFFNESS_LOW)
+                        .setDampingRatio(SPRING_DAMPING_RATIO),
+                destinationRelativeX);
+
+        flingThenSpringFirstBubbleWithStackFollowing(
+                DynamicAnimation.TRANSLATION_Y,
+                velY,
+                FLING_FRICTION_Y,
+                new SpringForce()
+                        .setStiffness(SpringForce.STIFFNESS_LOW)
+                        .setDampingRatio(SPRING_DAMPING_RATIO),
+                /* destination */ null);
+
+        mLayout.setEndListenerForProperties(
+                (animation, canceled, value, velocity) -> {
+                    mRestingStackPosition = new PointF();
+                    mRestingStackPosition.set(mStackPosition);
+                    mLayout.removeEndListenerForProperty(DynamicAnimation.TRANSLATION_X);
+                    mLayout.removeEndListenerForProperty(DynamicAnimation.TRANSLATION_Y);
+                },
+                DynamicAnimation.TRANSLATION_X, DynamicAnimation.TRANSLATION_Y);
+    }
+
+    /**
+     * Where the stack would be if it were snapped to the nearest horizontal edge (left or right).
+     */
+    public PointF getStackPositionAlongNearestHorizontalEdge() {
+        final PointF stackPos = getStackPosition();
+        final boolean onLeft = mLayout.isFirstChildXLeftOfCenter(stackPos.x);
+        final RectF bounds = getAllowableStackPositionRegion();
+
+        stackPos.x = onLeft ? bounds.left : bounds.right;
+        return stackPos;
+    }
+
+    /**
      * Flings the first bubble along the given property's axis, using the provided configuration
      * values. When the animation ends - either by hitting the min/max, or by friction sufficiently
      * reducing momentum - a SpringAnimation takes over to snap the bubble to the given final
      * position.
      */
-    public void flingThenSpringFirstBubbleWithStackFollowing(
+    protected void flingThenSpringFirstBubbleWithStackFollowing(
             DynamicAnimation.ViewProperty property,
             float vel,
             float friction,
@@ -325,8 +420,10 @@
     @Override
     SpringForce getSpringForce(DynamicAnimation.ViewProperty property, View view) {
         return new SpringForce()
-                .setDampingRatio(DEFAULT_BOUNCINESS)
-                .setStiffness(DEFAULT_STIFFNESS);
+                .setDampingRatio(BubbleController.getBubbleBounciness(
+                        mLayout.getContext(), DEFAULT_BOUNCINESS))
+                .setStiffness(BubbleController.getBubbleStiffness(
+                        mLayout.getContext(), (int) DEFAULT_STIFFNESS));
     }
 
     @Override
@@ -345,8 +442,7 @@
     @Override
     void onChildRemoved(View child, int index, Runnable finishRemoval) {
         // Animate the child out, actually removing it once its alpha is zero.
-        mLayout.animateValueForChild(
-                DynamicAnimation.ALPHA, child, 0f, finishRemoval);
+        mLayout.animateValueForChild(DynamicAnimation.ALPHA, child, 0f, finishRemoval);
         mLayout.animateValueForChild(DynamicAnimation.SCALE_X, child, ANIMATE_IN_STARTING_SCALE);
         mLayout.animateValueForChild(DynamicAnimation.SCALE_Y, child, ANIMATE_IN_STARTING_SCALE);
 
@@ -363,10 +459,13 @@
     /** Moves the stack, without any animation, to the starting position. */
     private void moveStackToStartPosition(Runnable after) {
         // Post to ensure that the layout's width and height have been calculated.
+        mLayout.setVisibility(View.INVISIBLE);
         mLayout.post(() -> {
             setStackPosition(
-                    getAllowableStackPositionRegion().right,
-                    getAllowableStackPositionRegion().top + mStackStartingVerticalOffset);
+                    mRestingStackPosition == null
+                            ? getDefaultStartPosition()
+                            : mRestingStackPosition);
+            mLayout.setVisibility(View.VISIBLE);
             after.run();
         });
     }
@@ -395,9 +494,9 @@
     }
 
     /** Moves the stack to a position instantly, with no animation. */
-    private void setStackPosition(float x, float y) {
-        Log.d(TAG, String.format("Setting position to (%f, %f).", x, y));
-        mStackPosition.set(x, y);
+    private void setStackPosition(PointF pos) {
+        Log.d(TAG, String.format("Setting position to (%f, %f).", pos.x, pos.y));
+        mStackPosition.set(pos.x, pos.y);
 
         cancelStackPositionAnimations();
 
@@ -405,11 +504,18 @@
         final float xOffset = getOffsetForChainedPropertyAnimation(DynamicAnimation.TRANSLATION_X);
         final float yOffset = getOffsetForChainedPropertyAnimation(DynamicAnimation.TRANSLATION_Y);
         for (int i = 0; i < mLayout.getChildCount(); i++) {
-            mLayout.getChildAt(i).setTranslationX(x + (i * xOffset));
-            mLayout.getChildAt(i).setTranslationY(y + (i * yOffset));
+            mLayout.getChildAt(i).setTranslationX(pos.x + (i * xOffset));
+            mLayout.getChildAt(i).setTranslationY(pos.y + (i * yOffset));
         }
     }
 
+    /** Returns the default stack position, which is on the top right. */
+    private PointF getDefaultStartPosition() {
+        return new PointF(
+                getAllowableStackPositionRegion().right,
+                getAllowableStackPositionRegion().top + mStackStartingVerticalOffset);
+    }
+
     /** Animates in the given bubble. */
     private void animateInBubble(View child) {
         child.setTranslationY(mStackPosition.y);
@@ -440,6 +546,10 @@
             DynamicAnimation.ViewProperty property, SpringForce spring,
             float vel, float finalPosition) {
 
+        if (mLayout.getChildCount() == 0) {
+            return;
+        }
+
         Log.d(TAG, String.format("Springing %s to final position %f.",
                 PhysicsAnimationLayout.getReadablePropertyName(property),
                 finalPosition));
@@ -489,7 +599,7 @@
 
         @Override
         public float getValue(StackAnimationController controller) {
-            return mProperty.getValue(mLayout.getChildAt(0));
+            return mLayout.getChildCount() > 0 ? mProperty.getValue(mLayout.getChildAt(0)) : 0;
         }
 
         @Override
diff --git a/packages/SystemUI/src/com/android/systemui/classifier/Classifier.java b/packages/SystemUI/src/com/android/systemui/classifier/Classifier.java
index 909896e..f8856ce 100644
--- a/packages/SystemUI/src/com/android/systemui/classifier/Classifier.java
+++ b/packages/SystemUI/src/com/android/systemui/classifier/Classifier.java
@@ -32,6 +32,7 @@
     public static final int RIGHT_AFFORDANCE = 6;
     public static final int GENERIC = 7;
     public static final int BOUNCER_UNLOCK = 8;
+    public static final int PULSE_EXPAND = 9;
 
     /**
      * Contains all the information about touch events from which the classifier can query
diff --git a/packages/SystemUI/src/com/android/systemui/classifier/DirectionEvaluator.java b/packages/SystemUI/src/com/android/systemui/classifier/DirectionEvaluator.java
index 5f04222..78b4168 100644
--- a/packages/SystemUI/src/com/android/systemui/classifier/DirectionEvaluator.java
+++ b/packages/SystemUI/src/com/android/systemui/classifier/DirectionEvaluator.java
@@ -22,6 +22,7 @@
         boolean vertical = Math.abs(yDiff) >= Math.abs(xDiff);
         switch (type) {
             case Classifier.QUICK_SETTINGS:
+            case Classifier.PULSE_EXPAND:
             case Classifier.NOTIFICATION_DRAG_DOWN:
                 if (!vertical || yDiff <= 0.0) {
                     return falsingEvaluation;
diff --git a/packages/SystemUI/src/com/android/systemui/classifier/FalsingManager.java b/packages/SystemUI/src/com/android/systemui/classifier/FalsingManager.java
index 8f215ff..a63fdbd 100644
--- a/packages/SystemUI/src/com/android/systemui/classifier/FalsingManager.java
+++ b/packages/SystemUI/src/com/android/systemui/classifier/FalsingManager.java
@@ -408,10 +408,22 @@
         mDataCollector.onNotificatonStartDraggingDown();
     }
 
+    public void onStartExpandingFromPulse() {
+        if (FalsingLog.ENABLED) {
+            FalsingLog.i("onStartExpandingFromPulse", "");
+        }
+        mHumanInteractionClassifier.setType(Classifier.PULSE_EXPAND);
+        mDataCollector.onStartExpandingFromPulse();
+    }
+
     public void onNotificatonStopDraggingDown() {
         mDataCollector.onNotificatonStopDraggingDown();
     }
 
+    public void onExpansionFromPulseStopped() {
+        mDataCollector.onExpansionFromPulseStopped();
+    }
+
     public void onNotificationDismissed() {
         mDataCollector.onNotificationDismissed();
     }
diff --git a/packages/SystemUI/src/com/android/systemui/classifier/HumanInteractionClassifier.java b/packages/SystemUI/src/com/android/systemui/classifier/HumanInteractionClassifier.java
index 577d57a..0cc50cd 100644
--- a/packages/SystemUI/src/com/android/systemui/classifier/HumanInteractionClassifier.java
+++ b/packages/SystemUI/src/com/android/systemui/classifier/HumanInteractionClassifier.java
@@ -128,7 +128,8 @@
         // sent to the classifiers until the finger moves far enough. When the finger if lifted
         // up, the last MotionEvent which was far enough from the finger is set as the final
         // MotionEvent and sent to the Classifiers.
-        if (mCurrentType == Classifier.NOTIFICATION_DRAG_DOWN) {
+        if (mCurrentType == Classifier.NOTIFICATION_DRAG_DOWN
+                || mCurrentType == Classifier.PULSE_EXPAND) {
             mBufferedEvents.add(MotionEvent.obtain(event));
             Point pointEnd = new Point(event.getX() / mDpi, event.getY() / mDpi);
 
diff --git a/packages/SystemUI/src/com/android/systemui/doze/DozeSensors.java b/packages/SystemUI/src/com/android/systemui/doze/DozeSensors.java
index c5799cc..77180f8 100644
--- a/packages/SystemUI/src/com/android/systemui/doze/DozeSensors.java
+++ b/packages/SystemUI/src/com/android/systemui/doze/DozeSensors.java
@@ -190,15 +190,6 @@
         }
     }
 
-    public void reregisterAllSensors() {
-        for (TriggerSensor s : mSensors) {
-            s.setListening(false);
-        }
-        for (TriggerSensor s : mSensors) {
-            s.setListening(true);
-        }
-    }
-
     public void onUserSwitched() {
         for (TriggerSensor s : mSensors) {
             s.updateListener();
diff --git a/packages/SystemUI/src/com/android/systemui/doze/DozeTriggers.java b/packages/SystemUI/src/com/android/systemui/doze/DozeTriggers.java
index 3654aac..b2f707f 100644
--- a/packages/SystemUI/src/com/android/systemui/doze/DozeTriggers.java
+++ b/packages/SystemUI/src/com/android/systemui/doze/DozeTriggers.java
@@ -238,9 +238,6 @@
             case DOZE:
             case DOZE_AOD:
                 mDozeSensors.setProxListening(newState != DozeMachine.State.DOZE);
-                if (oldState != DozeMachine.State.INITIALIZED) {
-                    mDozeSensors.reregisterAllSensors();
-                }
                 mDozeSensors.setListening(true);
                 if (newState == DozeMachine.State.DOZE_AOD && !sWakeDisplaySensorState) {
                     onWakeScreen(false, newState);
diff --git a/packages/SystemUI/src/com/android/systemui/doze/DozeUi.java b/packages/SystemUI/src/com/android/systemui/doze/DozeUi.java
index 7656564..847182d 100644
--- a/packages/SystemUI/src/com/android/systemui/doze/DozeUi.java
+++ b/packages/SystemUI/src/com/android/systemui/doze/DozeUi.java
@@ -93,7 +93,13 @@
                 new DozeHost.PulseCallback() {
                     @Override
                     public void onPulseStarted() {
-                        mMachine.requestState(DozeMachine.State.DOZE_PULSING);
+                        try {
+                            mMachine.requestState(DozeMachine.State.DOZE_PULSING);
+                        } catch (IllegalStateException e) {
+                            // It's possible that the pulse was asynchronously cancelled while
+                            // we were waiting for it to start (under stress conditions.)
+                            // In those cases we should just ignore it. b/127657926
+                        }
                     }
 
                     @Override
diff --git a/packages/SystemUI/src/com/android/systemui/globalactions/GlobalActionsDialog.java b/packages/SystemUI/src/com/android/systemui/globalactions/GlobalActionsDialog.java
index 3fa6035..b07f909 100644
--- a/packages/SystemUI/src/com/android/systemui/globalactions/GlobalActionsDialog.java
+++ b/packages/SystemUI/src/com/android/systemui/globalactions/GlobalActionsDialog.java
@@ -65,8 +65,7 @@
 import android.view.WindowManager;
 import android.view.WindowManagerGlobal;
 import android.view.accessibility.AccessibilityEvent;
-import android.widget.AdapterView.OnItemLongClickListener;
-import android.widget.BaseAdapter;
+import android.widget.FrameLayout;
 import android.widget.ImageView;
 import android.widget.ImageView.ScaleType;
 import android.widget.TextView;
@@ -86,10 +85,14 @@
 import com.android.systemui.Dependency;
 import com.android.systemui.Interpolators;
 import com.android.systemui.MultiListLayout;
+import com.android.systemui.MultiListLayout.MultiListAdapter;
 import com.android.systemui.colorextraction.SysuiColorExtractor;
 import com.android.systemui.plugins.GlobalActions.GlobalActionsManager;
+import com.android.systemui.plugins.GlobalActionsPanelPlugin;
 import com.android.systemui.statusbar.phone.ScrimController;
 import com.android.systemui.statusbar.policy.ConfigurationController;
+import com.android.systemui.statusbar.policy.ExtensionController;
+import com.android.systemui.statusbar.policy.ExtensionController.Extension;
 import com.android.systemui.util.EmergencyDialerConstants;
 import com.android.systemui.util.leak.RotationUtils;
 import com.android.systemui.volume.SystemUIInterpolators.LogAccelerateInterpolator;
@@ -102,9 +105,8 @@
  * may show depending on whether the keyguard is showing, and whether the device
  * is provisioned.
  */
-class GlobalActionsDialog implements DialogInterface.OnDismissListener,
-        DialogInterface.OnClickListener, DialogInterface.OnShowListener,
-        ConfigurationController.ConfigurationListener {
+public class GlobalActionsDialog implements DialogInterface.OnDismissListener,
+        DialogInterface.OnShowListener, ConfigurationController.ConfigurationListener {
 
     static public final String SYSTEM_DIALOG_REASON_KEY = "reason";
     static public final String SYSTEM_DIALOG_REASON_GLOBAL_ACTIONS = "globalactions";
@@ -154,12 +156,14 @@
     private boolean mHasVibrator;
     private boolean mHasLogoutButton;
     private boolean mHasLockdownButton;
-    private boolean mSeparatedEmergencyButtonEnabled;
+    private boolean mUseSeparatedList;
     private final boolean mShowSilentToggle;
     private final EmergencyAffordanceManager mEmergencyAffordanceManager;
     private final ScreenshotHelper mScreenshotHelper;
     private final ScreenRecordHelper mScreenRecordHelper;
 
+    private final Extension<GlobalActionsPanelPlugin> mPanelExtension;
+
     /**
      * @param context everything needs a context :(
      */
@@ -203,6 +207,11 @@
         mScreenRecordHelper = new ScreenRecordHelper(context);
 
         Dependency.get(ConfigurationController.class).addCallback(this);
+
+        mPanelExtension = Dependency.get(ExtensionController.class)
+            .newExtension(GlobalActionsPanelPlugin.class)
+            .withPlugin(GlobalActionsPanelPlugin.class)
+            .build();
     }
 
     /**
@@ -325,7 +334,7 @@
         ArraySet<String> addedKeys = new ArraySet<String>();
         mHasLogoutButton = false;
         mHasLockdownButton = false;
-        mSeparatedEmergencyButtonEnabled = true;
+        mUseSeparatedList = true;
         for (int i = 0; i < defaultActions.length; i++) {
             String actionKey = defaultActions[i];
             if (addedKeys.contains(actionKey)) {
@@ -373,7 +382,7 @@
                     mHasLogoutButton = true;
                 }
             } else if (GLOBAL_ACTION_KEY_EMERGENCY.equals(actionKey)) {
-                if (mSeparatedEmergencyButtonEnabled
+                if (mUseSeparatedList
                         && !mEmergencyAffordanceManager.needsEmergencyAffordance()) {
                     mItems.add(new EmergencyDialerAction());
                 }
@@ -390,16 +399,16 @@
 
         mAdapter = new MyAdapter();
 
-        OnItemLongClickListener onItemLongClickListener = (parent, view, position, id) -> {
-            final Action action = mAdapter.getItem(position);
-            if (action instanceof LongPressAction) {
-                mDialog.dismiss();
-                return ((LongPressAction) action).onLongPress();
-            }
-            return false;
-        };
-        ActionsDialog dialog = new ActionsDialog(mContext, this, mAdapter, onItemLongClickListener,
-                mSeparatedEmergencyButtonEnabled);
+        GlobalActionsPanelPlugin.PanelViewController panelViewController =
+                mPanelExtension.get() != null
+                        ? mPanelExtension.get().onPanelShown(() -> {
+                            if (mDialog != null) {
+                                mDialog.dismiss();
+                            }
+                        })
+                        : null;
+        ActionsDialog dialog = new ActionsDialog(mContext, mAdapter, mUseSeparatedList,
+                panelViewController);
         dialog.setCanceledOnTouchOutside(false); // Handled by the custom class.
         dialog.setKeyguardShowing(mKeyguardShowing);
 
@@ -474,7 +483,9 @@
         public void onPress() {
             MetricsLogger.action(mContext, MetricsEvent.ACTION_EMERGENCY_DIALER_FROM_POWER_MENU);
             Intent intent = new Intent(EmergencyDialerConstants.ACTION_DIAL);
-            intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK | Intent.FLAG_ACTIVITY_CLEAR_TOP);
+            intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK
+                    | Intent.FLAG_ACTIVITY_EXCLUDE_FROM_RECENTS
+                    | Intent.FLAG_ACTIVITY_CLEAR_TOP);
             intent.putExtra(EmergencyDialerConstants.EXTRA_ENTRY_TYPE,
                     EmergencyDialerConstants.ENTRY_TYPE_POWER_MENU);
             mContext.startActivityAsUser(intent, UserHandle.CURRENT);
@@ -527,7 +538,6 @@
         }
     }
 
-
     private class ScreenshotAction extends SinglePressAction implements LongPressAction {
         public ScreenshotAction() {
             super(R.drawable.ic_screenshot, R.string.global_action_screenshot);
@@ -692,7 +702,7 @@
 
     private Action getEmergencyAction() {
         Drawable emergencyIcon = mContext.getDrawable(R.drawable.emergency_icon);
-        if(!mSeparatedEmergencyButtonEnabled) {
+        if (!mUseSeparatedList) {
             // use un-colored legacy treatment
             emergencyIcon.setTintList(null);
         }
@@ -886,15 +896,6 @@
     }
 
     /** {@inheritDoc} */
-    public void onClick(DialogInterface dialog, int which) {
-        Action item = mAdapter.getItem(which);
-        if (!(item instanceof SilentModeTriStateAction)) {
-            dialog.dismiss();
-        }
-        item.onPress();
-    }
-
-    /** {@inheritDoc} */
     public void onShow(DialogInterface dialog) {
         MetricsLogger.visible(mContext, MetricsEvent.POWER_MENU);
     }
@@ -906,11 +907,10 @@
      * the device is provisioned
      * via {@link com.android.systemui.globalactions.GlobalActionsDialog#mDeviceProvisioned}.
      */
-    private class MyAdapter extends BaseAdapter {
-
+    public class MyAdapter extends MultiListAdapter {
+        @Override
         public int getCount() {
             int count = 0;
-
             for (int i = 0; i < mItems.size(); i++) {
                 final Action action = mItems.get(i);
 
@@ -930,7 +930,8 @@
             return getItem(position).isEnabled();
         }
 
-        public ArrayList<Action> getSeparatedActions(boolean shouldUseSeparatedView) {
+        @Override
+        public ArrayList<Action> getSeparatedItems(boolean shouldUseSeparatedView) {
             ArrayList<Action> separatedActions = new ArrayList<Action>();
             if (!shouldUseSeparatedView) {
                 return separatedActions;
@@ -944,7 +945,8 @@
             return separatedActions;
         }
 
-        public ArrayList<Action> getListActions(boolean shouldUseSeparatedView) {
+        @Override
+        public ArrayList<Action> getListItems(boolean shouldUseSeparatedView) {
             if (!shouldUseSeparatedView) {
                 return new ArrayList<Action>(mItems);
             }
@@ -963,6 +965,7 @@
             return false;
         }
 
+        @Override
         public Action getItem(int position) {
 
             int filteredPos = 0;
@@ -992,6 +995,7 @@
             return position;
         }
 
+        @Override
         public View getView(int position, View convertView, ViewGroup parent) {
             Action action = getItem(position);
             View view = action.create(mContext, convertView, parent, LayoutInflater.from(mContext));
@@ -1001,6 +1005,25 @@
             }
             return view;
         }
+
+        @Override
+        public boolean onLongClickItem(int position) {
+            final Action action = mAdapter.getItem(position);
+            if (action instanceof LongPressAction) {
+                mDialog.dismiss();
+                return ((LongPressAction) action).onLongPress();
+            }
+            return false;
+        }
+
+        @Override
+        public void onClickItem(int position) {
+            Action item = mAdapter.getItem(position);
+            if (!(item instanceof SilentModeTriStateAction)) {
+                mDialog.dismiss();
+            }
+            item.onPress();
+        }
     }
 
     // note: the scheme below made more sense when we were planning on having
@@ -1012,7 +1035,7 @@
     /**
      * What each item in the global actions dialog must be able to support.
      */
-    private interface Action {
+    public interface Action {
         /**
          * @return Text that will be announced when dialog is created.  null
          * for none.
@@ -1031,7 +1054,8 @@
 
         /**
          * @return whether this action should appear in the dialog before the
-         * device is provisioned.
+         * device is provisioned.onlongpress
+         *
          */
         boolean showBeforeProvisioning();
 
@@ -1467,24 +1491,21 @@
         private final Context mContext;
         private final MyAdapter mAdapter;
         private MultiListLayout mGlobalActionsLayout;
-        private final OnClickListener mClickListener;
-        private final OnItemLongClickListener mLongClickListener;
-        private final GradientDrawable mGradientDrawable;
+        private final Drawable mBackgroundDrawable;
         private final ColorExtractor mColorExtractor;
+        private final GlobalActionsPanelPlugin.PanelViewController mPanelController;
         private boolean mKeyguardShowing;
-        private boolean mShouldDisplaySeparatedButton;
+        private boolean mUseSeparatedList;
         private boolean mShowing;
+        private final float mScrimAlpha;
 
-        public ActionsDialog(Context context, OnClickListener clickListener, MyAdapter adapter,
-                OnItemLongClickListener longClickListener, boolean shouldDisplaySeparatedButton) {
+        ActionsDialog(Context context, MyAdapter adapter, boolean separated,
+                GlobalActionsPanelPlugin.PanelViewController plugin) {
             super(context, com.android.systemui.R.style.Theme_SystemUI_Dialog_GlobalActions);
             mContext = context;
             mAdapter = adapter;
-            mClickListener = clickListener;
-            mLongClickListener = longClickListener;
-            mGradientDrawable = new GradientDrawable(mContext);
             mColorExtractor = Dependency.get(SysuiColorExtractor.class);
-            mShouldDisplaySeparatedButton = shouldDisplaySeparatedButton;
+            mUseSeparatedList = separated;
 
             // Window initialization
             Window window = getWindow();
@@ -1503,12 +1524,44 @@
                     | WindowManager.LayoutParams.FLAG_SHOW_WHEN_LOCKED
                     | WindowManager.LayoutParams.FLAG_WATCH_OUTSIDE_TOUCH
                     | WindowManager.LayoutParams.FLAG_HARDWARE_ACCELERATED);
-            window.setBackgroundDrawable(mGradientDrawable);
             window.setType(WindowManager.LayoutParams.TYPE_VOLUME_OVERLAY);
 
             initializeLayout();
 
             setTitle(R.string.global_actions);
+
+            mPanelController = plugin;
+            View panelView = initializePanel();
+            if (panelView == null) {
+                mBackgroundDrawable = new GradientDrawable(context);
+                mScrimAlpha = ScrimController.GRADIENT_SCRIM_ALPHA;
+            } else {
+                mBackgroundDrawable = context.getDrawable(
+                        com.android.systemui.R.drawable.global_action_panel_scrim);
+                mScrimAlpha = 1f;
+                addContentView(
+                        panelView,
+                        new ViewGroup.LayoutParams(
+                                ViewGroup.LayoutParams.MATCH_PARENT,
+                                ViewGroup.LayoutParams.MATCH_PARENT));
+            }
+            window.setBackgroundDrawable(mBackgroundDrawable);
+        }
+
+        private View initializePanel() {
+            if (isPanelEnabled(mContext) && mPanelController != null) {
+                View panelView = mPanelController.getPanelContent();
+                if (panelView != null) {
+                    FrameLayout panelContainer = new FrameLayout(mContext);
+                    FrameLayout.LayoutParams panelParams =
+                            new FrameLayout.LayoutParams(
+                                    FrameLayout.LayoutParams.MATCH_PARENT,
+                                    FrameLayout.LayoutParams.WRAP_CONTENT);
+                    panelContainer.addView(panelView, panelParams);
+                    return panelContainer;
+                }
+            }
+            return null;
         }
 
         private void initializeLayout() {
@@ -1516,7 +1569,7 @@
             mGlobalActionsLayout = (MultiListLayout)
                     findViewById(com.android.systemui.R.id.global_actions_view);
             mGlobalActionsLayout.setOutsideTouchListener(view -> dismiss());
-            mGlobalActionsLayout.setHasSeparatedView(mShouldDisplaySeparatedButton);
+            mGlobalActionsLayout.setSeparated(mUseSeparatedList);
             mGlobalActionsLayout.setListViewAccessibilityDelegate(new View.AccessibilityDelegate() {
                 @Override
                 public boolean dispatchPopulateAccessibilityEvent(
@@ -1527,6 +1580,12 @@
                 }
             });
             mGlobalActionsLayout.setRotationListener(this::onRotate);
+            mGlobalActionsLayout.setAdapter(mAdapter);
+        }
+
+        private boolean isPanelEnabled(Context context) {
+            return FeatureFlagUtils.isEnabled(
+                    context, FeatureFlagUtils.GLOBAL_ACTIONS_PANEL_ENABLED);
         }
 
         private int getGlobalActionsLayoutId(Context context) {
@@ -1539,56 +1598,24 @@
             return com.android.systemui.R.layout.global_actions_wrapped;
         }
 
-        private void updateList() {
-            mGlobalActionsLayout.removeAllItems();
-            ArrayList<Action> separatedActions =
-                    mAdapter.getSeparatedActions(mShouldDisplaySeparatedButton);
-            ArrayList<Action> listActions = mAdapter.getListActions(mShouldDisplaySeparatedButton);
-            mGlobalActionsLayout.setExpectedListItemCount(listActions.size());
-            mGlobalActionsLayout.setExpectedSeparatedItemCount(separatedActions.size());
-
-            for (int i = 0; i < mAdapter.getCount(); i++) {
-                Action action = mAdapter.getItem(i);
-                int separatedIndex = separatedActions.indexOf(action);
-                ViewGroup parent;
-                if (separatedIndex != -1) {
-                    parent = mGlobalActionsLayout.getParentView(true, separatedIndex, false);
-                } else {
-                    boolean reverse = false;
-
-                    // If we're using the grid layout and we're in seascape, reverse the order
-                    // of sublists to make sure they render in the correct positions,
-                    // since we can't reverse vertical LinearLayouts through the layout xml.
-
-                    if (isGridEnabled(mContext) && RotationUtils.getRotation(mContext)
-                            == RotationUtils.ROTATION_SEASCAPE) {
-                        reverse = true;
-                    }
-                    int listIndex = listActions.indexOf(action);
-                    parent = mGlobalActionsLayout.getParentView(false, listIndex, reverse);
-                }
-                View v = mAdapter.getView(i, null, parent);
-                final int pos = i;
-                v.setOnClickListener(view -> mClickListener.onClick(this, pos));
-                v.setOnLongClickListener(view ->
-                        mLongClickListener.onItemLongClick(null, v, pos, 0));
-                parent.addView(v);
-            }
-        }
-
         @Override
         protected void onStart() {
             super.setCanceledOnTouchOutside(true);
             super.onStart();
-            updateList();
+            mGlobalActionsLayout.updateList();
 
-            Point displaySize = new Point();
-            mContext.getDisplay().getRealSize(displaySize);
-            mColorExtractor.addOnColorsChangedListener(this);
-            mGradientDrawable.setScreenSize(displaySize.x, displaySize.y);
-            GradientColors colors = mColorExtractor.getColors(mKeyguardShowing ?
-                    WallpaperManager.FLAG_LOCK : WallpaperManager.FLAG_SYSTEM);
-            updateColors(colors, false /* animate */);
+            if (mBackgroundDrawable instanceof GradientDrawable) {
+                Point displaySize = new Point();
+                mContext.getDisplay().getRealSize(displaySize);
+                mColorExtractor.addOnColorsChangedListener(this);
+                ((GradientDrawable) mBackgroundDrawable)
+                        .setScreenSize(displaySize.x, displaySize.y);
+                GradientColors colors = mColorExtractor.getColors(
+                        mKeyguardShowing
+                                ? WallpaperManager.FLAG_LOCK
+                                : WallpaperManager.FLAG_SYSTEM);
+                updateColors(colors, false /* animate */);
+            }
         }
 
         /**
@@ -1597,11 +1624,14 @@
          * @param animate Interpolates gradient if true, just sets otherwise.
          */
         private void updateColors(GradientColors colors, boolean animate) {
-            mGradientDrawable.setColors(colors, animate);
+            if (!(mBackgroundDrawable instanceof GradientDrawable)) {
+                return;
+            }
+            ((GradientDrawable) mBackgroundDrawable).setColors(colors, animate);
             View decorView = getWindow().getDecorView();
             if (colors.supportsDarkText()) {
                 decorView.setSystemUiVisibility(View.SYSTEM_UI_FLAG_LIGHT_NAVIGATION_BAR |
-                    View.SYSTEM_UI_FLAG_LIGHT_STATUS_BAR);
+                        View.SYSTEM_UI_FLAG_LIGHT_STATUS_BAR);
             } else {
                 decorView.setSystemUiVisibility(0);
             }
@@ -1617,7 +1647,7 @@
         public void show() {
             super.show();
             mShowing = true;
-            mGradientDrawable.setAlpha(0);
+            mBackgroundDrawable.setAlpha(0);
             mGlobalActionsLayout.setTranslationX(getAnimTranslation());
             mGlobalActionsLayout.setAlpha(0);
             mGlobalActionsLayout.animate()
@@ -1627,8 +1657,8 @@
                     .setInterpolator(Interpolators.FAST_OUT_SLOW_IN)
                     .setUpdateListener(animation -> {
                         int alpha = (int) ((Float) animation.getAnimatedValue()
-                                * ScrimController.GRADIENT_SCRIM_ALPHA * 255);
-                        mGradientDrawable.setAlpha(alpha);
+                                * mScrimAlpha * 255);
+                        mBackgroundDrawable.setAlpha(alpha);
                     })
                     .start();
         }
@@ -1645,14 +1675,17 @@
                     .alpha(0)
                     .translationX(getAnimTranslation())
                     .setDuration(300)
-                    .withEndAction(() -> super.dismiss())
+                    .withEndAction(super::dismiss)
                     .setInterpolator(new LogAccelerateInterpolator())
                     .setUpdateListener(animation -> {
                         int alpha = (int) ((1f - (Float) animation.getAnimatedValue())
-                                * ScrimController.GRADIENT_SCRIM_ALPHA * 255);
-                        mGradientDrawable.setAlpha(alpha);
+                                * mScrimAlpha * 255);
+                        mBackgroundDrawable.setAlpha(alpha);
                     })
                     .start();
+            if (mPanelController != null) {
+                mPanelController.onDismissed();
+            }
         }
 
         void dismissImmediately() {
@@ -1687,7 +1720,7 @@
         public void onRotate(int from, int to) {
             if (mShowing && isGridEnabled(mContext)) {
                 initializeLayout();
-                updateList();
+                mGlobalActionsLayout.updateList();
             }
         }
     }
diff --git a/packages/SystemUI/src/com/android/systemui/globalactions/GlobalActionsGridLayout.java b/packages/SystemUI/src/com/android/systemui/globalactions/GlobalActionsGridLayout.java
index 1d04277..cda7669 100644
--- a/packages/SystemUI/src/com/android/systemui/globalactions/GlobalActionsGridLayout.java
+++ b/packages/SystemUI/src/com/android/systemui/globalactions/GlobalActionsGridLayout.java
@@ -17,12 +17,17 @@
 package com.android.systemui.globalactions;
 
 import android.content.Context;
+import android.text.TextUtils;
 import android.util.AttributeSet;
 import android.view.View;
 import android.view.ViewGroup;
 
 import com.android.systemui.HardwareBgDrawable;
 import com.android.systemui.MultiListLayout;
+import com.android.systemui.util.leak.RotationUtils;
+
+import java.util.ArrayList;
+import java.util.Locale;
 
 /**
  * Grid-based implementation of the button layout created by the global actions dialog.
@@ -54,13 +59,58 @@
         }
     }
 
-    @Override
+    /**
+     * Sets the number of items expected to be rendered in the list container. This allows the
+     * layout to correctly determine which parent containers will be used for items before they have
+     * beenadded to the layout.
+     * @param count The number of items expected.
+     */
     public void setExpectedListItemCount(int count) {
-        mExpectedListItemCount = count;
         getListView().setExpectedCount(count);
     }
 
     @Override
+    public void onUpdateList() {
+        removeAllItems();
+        ArrayList<GlobalActionsDialog.Action> separatedActions =
+                mAdapter.getSeparatedItems(mSeparated);
+        ArrayList<GlobalActionsDialog.Action> listActions = mAdapter.getListItems(mSeparated);
+        setExpectedListItemCount(listActions.size());
+        int rotation = RotationUtils.getRotation(mContext);
+
+        boolean reverse = false; // should we add items to parents in the reverse order?
+        if (rotation == RotationUtils.ROTATION_NONE
+                || rotation == RotationUtils.ROTATION_SEASCAPE) {
+            reverse = !reverse; // if we're in portrait or seascape, reverse items
+        }
+        if (TextUtils.getLayoutDirectionFromLocale(Locale.getDefault())
+                == View.LAYOUT_DIRECTION_RTL) {
+            reverse = !reverse; // if we're in an RTL language, reverse items (again)
+        }
+
+        for (int i = 0; i < mAdapter.getCount(); i++) {
+            Object action = mAdapter.getItem(i);
+            int separatedIndex = separatedActions.indexOf(action);
+            ViewGroup parent;
+            if (separatedIndex != -1) {
+                parent = getParentView(true, separatedIndex, rotation);
+            } else {
+                int listIndex = listActions.indexOf(action);
+                parent = getParentView(false, listIndex, rotation);
+            }
+            View v = mAdapter.getView(i, null, parent);
+            final int pos = i;
+            v.setOnClickListener(view -> mAdapter.onClickItem(pos));
+            v.setOnLongClickListener(view -> mAdapter.onLongClickItem(pos));
+            if (reverse) {
+                parent.addView(v, 0); // reverse order of items
+            } else {
+                parent.addView(v);
+            }
+        }
+    }
+
+    @Override
     protected ViewGroup getSeparatedView() {
         return findViewById(com.android.systemui.R.id.separated_button);
     }
@@ -82,12 +132,18 @@
         }
     }
 
-    @Override
-    public ViewGroup getParentView(boolean separated, int index, boolean reverseOrder) {
+    public ViewGroup getParentView(boolean separated, int index, int rotation) {
         if (separated) {
             return getSeparatedView();
         } else {
-            return getListView().getParentView(index, reverseOrder);
+            switch (rotation) {
+                case RotationUtils.ROTATION_LANDSCAPE:
+                    return getListView().getParentView(index, false, true);
+                case RotationUtils.ROTATION_SEASCAPE:
+                    return getListView().getParentView(index, true, true);
+                default:
+                    return getListView().getParentView(index, false, false);
+            }
         }
     }
 
@@ -96,6 +152,6 @@
      */
     @Override
     public void setDivisionView(View v) {
-
+        // do nothing
     }
 }
diff --git a/packages/SystemUI/src/com/android/systemui/globalactions/ListGridLayout.java b/packages/SystemUI/src/com/android/systemui/globalactions/ListGridLayout.java
index d5dcd74..6c106df 100644
--- a/packages/SystemUI/src/com/android/systemui/globalactions/ListGridLayout.java
+++ b/packages/SystemUI/src/com/android/systemui/globalactions/ListGridLayout.java
@@ -18,7 +18,6 @@
 
 import android.content.Context;
 import android.util.AttributeSet;
-import android.util.Log;
 import android.view.View;
 import android.view.ViewGroup;
 import android.widget.LinearLayout;
@@ -39,9 +38,8 @@
  */
 
 public class ListGridLayout extends LinearLayout {
+    private static final String TAG = "ListGridLayout";
     private int mExpectedCount;
-    private int mRows;
-    private int mColumns;
 
     public ListGridLayout(Context context, AttributeSet attrs) {
         super(context, attrs);
@@ -62,11 +60,11 @@
     /**
      * Get the parent view associated with the item which should be placed at the given position.
      */
-    public ViewGroup getParentView(int index, boolean reverseSublists) {
-        if (mRows == 0) {
+    public ViewGroup getParentView(int index, boolean reverseSublists, boolean swapRowsAndColumns) {
+        if (getRowCount() == 0) {
             return null;
         }
-        int column = getParentViewIndex(index, reverseSublists);
+        int column = getParentViewIndex(index, reverseSublists, swapRowsAndColumns);
         return (ViewGroup) getChildAt(column);
     }
 
@@ -74,13 +72,19 @@
         return getChildCount() - (index + 1);
     }
 
-    private int getParentViewIndex(int index, boolean reverseSublists) {
-        int column = (int) Math.floor(index / mRows);
-        int columnCount = getChildCount();
-        if (reverseSublists) {
-            column = reverseSublistIndex(column);
+    private int getParentViewIndex(int index, boolean reverseSublists, boolean swapRowsAndColumns) {
+        int sublistIndex;
+        ViewGroup row;
+        int rows = getRowCount();
+        if (swapRowsAndColumns) {
+            sublistIndex = (int) Math.floor(index / rows);
+        } else {
+            sublistIndex = index % rows;
         }
-        return column;
+        if (reverseSublists) {
+            sublistIndex = reverseSublistIndex(sublistIndex);
+        }
+        return sublistIndex;
     }
 
     /**
@@ -88,32 +92,36 @@
      */
     public void setExpectedCount(int count) {
         mExpectedCount = count;
-        mRows = getRowCount();
-        mColumns = getColumnCount();
 
         for (int i = 0; i < getChildCount(); i++) {
-            if (i <= mColumns) {
+            if (i <= getColumnCount()) {
                 setSublistVisibility(i, true);
             } else {
                 setSublistVisibility(i, false);
             }
         }
-
     }
 
     private void setSublistVisibility(int index, boolean visible) {
         View subList = getChildAt(index);
-        Log.d("ListGrid", "index: " + index  + ", visibility: "  + visible);
         if (subList != null) {
             subList.setVisibility(visible ? View.VISIBLE : View.GONE);
         }
     }
 
     private int getRowCount() {
+        // special case for 3 to use a single row
+        if (mExpectedCount == 3) {
+            return 1;
+        }
         return (int) Math.ceil(Math.sqrt(mExpectedCount));
     }
 
     private int getColumnCount() {
+        // special case for 3 to use a single row
+        if (mExpectedCount == 3) {
+            return 3;
+        }
         return (int) Math.round(Math.sqrt(mExpectedCount));
     }
 }
diff --git a/packages/SystemUI/src/com/android/systemui/glwallpaper/ImageGLWallpaper.java b/packages/SystemUI/src/com/android/systemui/glwallpaper/ImageGLWallpaper.java
index 19d85b1..a313336 100644
--- a/packages/SystemUI/src/com/android/systemui/glwallpaper/ImageGLWallpaper.java
+++ b/packages/SystemUI/src/com/android/systemui/glwallpaper/ImageGLWallpaper.java
@@ -50,7 +50,7 @@
 
     static final String A_POSITION = "aPosition";
     static final String A_TEXTURE_COORDINATES = "aTextureCoordinates";
-    static final String U_CENTER_REVEAL = "uCenterReveal";
+    static final String U_PER85 = "uPer85";
     static final String U_REVEAL = "uReveal";
     static final String U_AOD2OPACITY = "uAod2Opacity";
     static final String U_TEXTURE = "uTexture";
@@ -87,7 +87,7 @@
     private int mAttrPosition;
     private int mAttrTextureCoordinates;
     private int mUniAod2Opacity;
-    private int mUniCenterReveal;
+    private int mUniPer85;
     private int mUniReveal;
     private int mUniTexture;
     private int mTextureId;
@@ -131,7 +131,7 @@
 
     private void setupUniforms() {
         mUniAod2Opacity = mProgram.getUniformHandle(U_AOD2OPACITY);
-        mUniCenterReveal = mProgram.getUniformHandle(U_CENTER_REVEAL);
+        mUniPer85 = mProgram.getUniformHandle(U_PER85);
         mUniReveal = mProgram.getUniformHandle(U_REVEAL);
         mUniTexture = mProgram.getUniformHandle(U_TEXTURE);
     }
@@ -144,8 +144,8 @@
                 return mAttrTextureCoordinates;
             case U_AOD2OPACITY:
                 return mUniAod2Opacity;
-            case U_CENTER_REVEAL:
-                return mUniCenterReveal;
+            case U_PER85:
+                return mUniPer85;
             case U_REVEAL:
                 return mUniReveal;
             case U_TEXTURE:
diff --git a/packages/SystemUI/src/com/android/systemui/glwallpaper/ImageWallpaperRenderer.java b/packages/SystemUI/src/com/android/systemui/glwallpaper/ImageWallpaperRenderer.java
index 991b116..9df6ba5 100644
--- a/packages/SystemUI/src/com/android/systemui/glwallpaper/ImageWallpaperRenderer.java
+++ b/packages/SystemUI/src/com/android/systemui/glwallpaper/ImageWallpaperRenderer.java
@@ -29,6 +29,7 @@
 import android.opengl.GLSurfaceView;
 import android.os.Build;
 import android.util.Log;
+import android.util.MathUtils;
 
 import com.android.systemui.ImageWallpaper;
 import com.android.systemui.ImageWallpaper.ImageGLView;
@@ -43,6 +44,8 @@
 public class ImageWallpaperRenderer implements GLSurfaceView.Renderer,
         ImageWallpaper.WallpaperStatusListener, ImageRevealHelper.RevealStateListener {
     private static final String TAG = ImageWallpaperRenderer.class.getSimpleName();
+    private static final float SCALE_VIEWPORT_MIN = 0.98f;
+    private static final float SCALE_VIEWPORT_MAX = 1f;
 
     private final WallpaperManager mWallpaperManager;
     private final ImageGLProgram mProgram;
@@ -52,6 +55,8 @@
     private final ImageGLView mGLView;
     private float mXOffset = 0f;
     private float mYOffset = 0f;
+    private int mWidth = 0;
+    private int mHeight = 0;
 
     public ImageWallpaperRenderer(Context context, ImageGLView glView) {
         mWallpaperManager = context.getSystemService(WallpaperManager.class);
@@ -87,25 +92,38 @@
             Log.d(TAG, "onSurfaceChanged: width=" + width + ", height=" + height
                     + ", xOffset=" + mXOffset + ", yOffset=" + mYOffset);
         }
+        mWidth = width;
+        mHeight = height;
         mWallpaper.adjustTextureCoordinates(mWallpaperManager.getBitmap(),
                 width, height, mXOffset, mYOffset);
     }
 
     @Override
     public void onDrawFrame(GL10 gl) {
-        float threshold = mImageProcessHelper.getPercentile85();
+        float per85 = mImageProcessHelper.getPercentile85();
         float reveal = mImageRevealHelper.getReveal();
 
         glClear(GL_COLOR_BUFFER_BIT);
 
         glUniform1f(mWallpaper.getHandle(ImageGLWallpaper.U_AOD2OPACITY), 1);
-        glUniform1f(mWallpaper.getHandle(ImageGLWallpaper.U_CENTER_REVEAL), threshold);
+        glUniform1f(mWallpaper.getHandle(ImageGLWallpaper.U_PER85), per85);
         glUniform1f(mWallpaper.getHandle(ImageGLWallpaper.U_REVEAL), reveal);
 
+        scaleViewport(reveal);
         mWallpaper.useTexture();
         mWallpaper.draw();
     }
 
+    private void scaleViewport(float reveal) {
+        // Interpolation between SCALE_VIEWPORT_MAX and SCALE_VIEWPORT_MIN by reveal.
+        float vpScaled = MathUtils.lerp(SCALE_VIEWPORT_MAX, SCALE_VIEWPORT_MIN, reveal);
+        // Calculate the offset amount from the lower left corner.
+        float offset = (SCALE_VIEWPORT_MAX - vpScaled) / 2;
+        // Change the viewport.
+        glViewport((int) (mWidth * offset), (int) (mHeight * offset),
+                (int) (mWidth * vpScaled), (int) (mHeight * vpScaled));
+    }
+
     @Override
     public void onAmbientModeChanged(boolean inAmbientMode, long duration) {
         mImageRevealHelper.updateAwake(!inAmbientMode, duration);
diff --git a/packages/SystemUI/src/com/android/systemui/keyguard/KeyguardViewMediator.java b/packages/SystemUI/src/com/android/systemui/keyguard/KeyguardViewMediator.java
index 172746e..0be9e25 100644
--- a/packages/SystemUI/src/com/android/systemui/keyguard/KeyguardViewMediator.java
+++ b/packages/SystemUI/src/com/android/systemui/keyguard/KeyguardViewMediator.java
@@ -1787,6 +1787,7 @@
             mHideAnimationRun = false;
             adjustStatusBarLocked();
             userActivity();
+            mUpdateMonitor.setKeyguardGoingAway(false /* away */);
             mShowKeyguardWakeLock.release();
         }
         mKeyguardDisplayManager.show();
@@ -1907,7 +1908,6 @@
             mHideAnimationRun = false;
             adjustStatusBarLocked();
             sendUserPresentBroadcast();
-            mUpdateMonitor.setKeyguardGoingAway(false /* goingAway */);
         }
         Trace.endSection();
     }
diff --git a/packages/SystemUI/src/com/android/systemui/media/MediaProjectionPermissionActivity.java b/packages/SystemUI/src/com/android/systemui/media/MediaProjectionPermissionActivity.java
index 9bca2cc..9f0f53e 100644
--- a/packages/SystemUI/src/com/android/systemui/media/MediaProjectionPermissionActivity.java
+++ b/packages/SystemUI/src/com/android/systemui/media/MediaProjectionPermissionActivity.java
@@ -135,7 +135,7 @@
 
         mDialog = new AlertDialog.Builder(this)
                 .setTitle(dialogTitle)
-                .setIcon(aInfo.loadIcon(packageManager))
+                .setIcon(R.drawable.ic_media_projection_permission)
                 .setMessage(message)
                 .setPositiveButton(R.string.media_projection_action_text, this)
                 .setNegativeButton(android.R.string.cancel, this)
diff --git a/packages/SystemUI/src/com/android/systemui/pip/phone/PipTouchHandler.java b/packages/SystemUI/src/com/android/systemui/pip/phone/PipTouchHandler.java
index cef1b6b..3140e6d 100644
--- a/packages/SystemUI/src/com/android/systemui/pip/phone/PipTouchHandler.java
+++ b/packages/SystemUI/src/com/android/systemui/pip/phone/PipTouchHandler.java
@@ -37,6 +37,7 @@
 import android.util.Log;
 import android.util.Size;
 import android.view.IPinnedStackController;
+import android.view.InputEvent;
 import android.view.MotionEvent;
 import android.view.ViewConfiguration;
 import android.view.accessibility.AccessibilityEvent;
@@ -206,7 +207,7 @@
         mEnableDimissDragToEdge = res.getBoolean(R.bool.config_pipEnableDismissDragToEdge);
 
         // Register the listener for input consumer touch events
-        inputConsumerController.setTouchListener(this::handleTouchEvent);
+        inputConsumerController.setInputListener(this::handleTouchEvent);
         inputConsumerController.setRegistrationListener(this::onRegistrationChanged);
         onRegistrationChanged(inputConsumerController.isRegistered());
     }
@@ -370,11 +371,16 @@
                 mMovementBounds, true /* allowMenuTimeout */, willResizeMenu());
     }
 
-    private boolean handleTouchEvent(MotionEvent ev) {
+    private boolean handleTouchEvent(InputEvent inputEvent) {
+        // Skip any non motion events
+        if (!(inputEvent instanceof MotionEvent)) {
+            return true;
+        }
         // Skip touch handling until we are bound to the controller
         if (mPinnedStackController == null) {
             return true;
         }
+        MotionEvent ev = (MotionEvent) inputEvent;
 
         // Update the touch state
         mTouchState.onTouchEvent(ev);
diff --git a/packages/SystemUI/src/com/android/systemui/power/BatteryStateSnapshot.kt b/packages/SystemUI/src/com/android/systemui/power/BatteryStateSnapshot.kt
new file mode 100644
index 0000000..d7a2d9a
--- /dev/null
+++ b/packages/SystemUI/src/com/android/systemui/power/BatteryStateSnapshot.kt
@@ -0,0 +1,55 @@
+package com.android.systemui.power
+
+import com.android.systemui.power.PowerUI.NO_ESTIMATE_AVAILABLE
+
+/**
+ * A simple data class to snapshot battery state when a particular check for the
+ * low battery warning is running in the background.
+ */
+data class BatteryStateSnapshot(
+    val batteryLevel: Int,
+    val isPowerSaver: Boolean,
+    val plugged: Boolean,
+    val bucket: Int,
+    val batteryStatus: Int,
+    val severeLevelThreshold: Int,
+    val lowLevelThreshold: Int,
+    val timeRemainingMillis: Long,
+    val severeThresholdMillis: Long,
+    val lowThresholdMillis: Long,
+    val isBasedOnUsage: Boolean
+) {
+    /**
+     * Returns whether hybrid warning logic/copy should be used for this snapshot
+     */
+    var isHybrid: Boolean = false
+        private set
+
+    init {
+        this.isHybrid = true
+    }
+
+    constructor(
+        batteryLevel: Int,
+        isPowerSaver: Boolean,
+        plugged: Boolean,
+        bucket: Int,
+        batteryStatus: Int,
+        severeLevelThreshold: Int,
+        lowLevelThreshold: Int
+    ) : this(
+        batteryLevel,
+        isPowerSaver,
+        plugged,
+        bucket,
+        batteryStatus,
+        severeLevelThreshold,
+        lowLevelThreshold,
+        NO_ESTIMATE_AVAILABLE.toLong(),
+        NO_ESTIMATE_AVAILABLE.toLong(),
+        NO_ESTIMATE_AVAILABLE.toLong(),
+        false
+    ) {
+        this.isHybrid = false
+    }
+}
diff --git a/packages/SystemUI/src/com/android/systemui/power/Estimate.java b/packages/SystemUI/src/com/android/systemui/power/Estimate.java
deleted file mode 100644
index 12a8f0a..0000000
--- a/packages/SystemUI/src/com/android/systemui/power/Estimate.java
+++ /dev/null
@@ -1,11 +0,0 @@
-package com.android.systemui.power;
-
-public class Estimate {
-    public final long estimateMillis;
-    public final boolean isBasedOnUsage;
-
-    public Estimate(long estimateMillis, boolean isBasedOnUsage) {
-        this.estimateMillis = estimateMillis;
-        this.isBasedOnUsage = isBasedOnUsage;
-    }
-}
diff --git a/packages/SystemUI/src/com/android/systemui/power/Estimate.kt b/packages/SystemUI/src/com/android/systemui/power/Estimate.kt
new file mode 100644
index 0000000..dca0d45
--- /dev/null
+++ b/packages/SystemUI/src/com/android/systemui/power/Estimate.kt
@@ -0,0 +1,3 @@
+package com.android.systemui.power
+
+data class Estimate(val estimateMillis: Long, val isBasedOnUsage: Boolean)
\ No newline at end of file
diff --git a/packages/SystemUI/src/com/android/systemui/power/PowerNotificationWarnings.java b/packages/SystemUI/src/com/android/systemui/power/PowerNotificationWarnings.java
index fdb0b36..41bcab5 100644
--- a/packages/SystemUI/src/com/android/systemui/power/PowerNotificationWarnings.java
+++ b/packages/SystemUI/src/com/android/systemui/power/PowerNotificationWarnings.java
@@ -134,10 +134,6 @@
     private int mShowing;
 
     private long mWarningTriggerTimeMs;
-
-    private Estimate mEstimate;
-    private long mLowWarningThreshold;
-    private long mSevereWarningThreshold;
     private boolean mWarning;
     private boolean mShowAutoSaverSuggestion;
     private boolean mPlaySound;
@@ -148,6 +144,7 @@
     private SystemUIDialog mHighTempDialog;
     private SystemUIDialog mThermalShutdownDialog;
     @VisibleForTesting SystemUIDialog mUsbHighTempDialog;
+    private BatteryStateSnapshot mCurrentBatterySnapshot;
 
     /**
      */
@@ -195,17 +192,8 @@
     }
 
     @Override
-    public void updateEstimate(Estimate estimate) {
-        mEstimate = estimate;
-        if (estimate.estimateMillis <= mLowWarningThreshold) {
-            mWarningTriggerTimeMs = System.currentTimeMillis();
-        }
-    }
-
-    @Override
-    public void updateThresholds(long lowThreshold, long severeThreshold) {
-        mLowWarningThreshold = lowThreshold;
-        mSevereWarningThreshold = severeThreshold;
+    public void updateSnapshot(BatteryStateSnapshot snapshot) {
+        mCurrentBatterySnapshot = snapshot;
     }
 
     private void updateNotification() {
@@ -254,15 +242,17 @@
 
     protected void showWarningNotification() {
         final String percentage = NumberFormat.getPercentInstance()
-                .format((double) mBatteryLevel / 100.0);
+                .format((double) mCurrentBatterySnapshot.getBatteryLevel() / 100.0);
 
-        // get standard notification copy
+        // get shared standard notification copy
         String title = mContext.getString(R.string.battery_low_title);
-        String contentText = mContext.getString(R.string.battery_low_percent_format, percentage);
+        String contentText;
 
-        // override notification copy if hybrid notification enabled
-        if (mEstimate != null) {
+        // get correct content text if notification is hybrid or not
+        if (mCurrentBatterySnapshot.isHybrid()) {
             contentText = getHybridContentString(percentage);
+        } else {
+            contentText = mContext.getString(R.string.battery_low_percent_format, percentage);
         }
 
         final Notification.Builder nb =
@@ -282,8 +272,9 @@
         }
         // Make the notification red if the percentage goes below a certain amount or the time
         // remaining estimate is disabled
-        if (mEstimate == null || mBucket < 0
-                || mEstimate.estimateMillis < mSevereWarningThreshold) {
+        if (!mCurrentBatterySnapshot.isHybrid() || mBucket < 0
+                || mCurrentBatterySnapshot.getTimeRemainingMillis()
+                        < mCurrentBatterySnapshot.getSevereThresholdMillis()) {
             nb.setColor(Utils.getColorAttrDefaultColor(mContext, android.R.attr.colorError));
         }
 
@@ -324,10 +315,10 @@
 
     private String getHybridContentString(String percentage) {
         return PowerUtil.getBatteryRemainingStringFormatted(
-            mContext,
-            mEstimate.estimateMillis,
-            percentage,
-            mEstimate.isBasedOnUsage);
+                mContext,
+                mCurrentBatterySnapshot.getTimeRemainingMillis(),
+                percentage,
+                mCurrentBatterySnapshot.isBasedOnUsage());
     }
 
     private PendingIntent pendingBroadcast(String action) {
diff --git a/packages/SystemUI/src/com/android/systemui/power/PowerUI.java b/packages/SystemUI/src/com/android/systemui/power/PowerUI.java
index e27c25e..1863860 100644
--- a/packages/SystemUI/src/com/android/systemui/power/PowerUI.java
+++ b/packages/SystemUI/src/com/android/systemui/power/PowerUI.java
@@ -55,6 +55,7 @@
 import java.util.concurrent.Future;
 
 public class PowerUI extends SystemUI {
+
     static final String TAG = "PowerUI";
     static final boolean DEBUG = Log.isLoggable(TAG, Log.DEBUG);
     private static final long TEMPERATURE_INTERVAL = 30 * DateUtils.SECOND_IN_MILLIS;
@@ -63,6 +64,7 @@
     static final long THREE_HOURS_IN_MILLIS = DateUtils.HOUR_IN_MILLIS * 3;
     private static final int CHARGE_CYCLE_PERCENT_RESET = 45;
     private static final long SIX_HOURS_MILLIS = Duration.ofHours(6).toMillis();
+    public static final int NO_ESTIMATE_AVAILABLE = -1;
 
     private final Handler mHandler = new Handler();
     @VisibleForTesting
@@ -71,13 +73,9 @@
     private PowerManager mPowerManager;
     private WarningsUI mWarnings;
     private final Configuration mLastConfiguration = new Configuration();
-    private long mTimeRemaining = Long.MAX_VALUE;
     private int mPlugType = 0;
     private int mInvalidCharger = 0;
     private EnhancedEstimates mEnhancedEstimates;
-    private Estimate mLastEstimate;
-    private boolean mLowWarningShownThisChargeCycle;
-    private boolean mSevereWarningShownThisChargeCycle;
     private Future mLastShowWarningTask;
     private boolean mEnableSkinTemperatureWarning;
     private boolean mEnableUsbTemperatureAlarm;
@@ -87,6 +85,10 @@
 
     private long mScreenOffTime = -1;
 
+    @VisibleForTesting boolean mLowWarningShownThisChargeCycle;
+    @VisibleForTesting boolean mSevereWarningShownThisChargeCycle;
+    @VisibleForTesting BatteryStateSnapshot mCurrentBatteryStateSnapshot;
+    @VisibleForTesting BatteryStateSnapshot mLastBatteryStateSnapshot;
     @VisibleForTesting IThermalService mThermalService;
 
     @VisibleForTesting int mBatteryLevel = 100;
@@ -205,6 +207,7 @@
                 mPlugType = intent.getIntExtra(BatteryManager.EXTRA_PLUGGED, 1);
                 final int oldInvalidCharger = mInvalidCharger;
                 mInvalidCharger = intent.getIntExtra(BatteryManager.EXTRA_INVALID_CHARGER, 0);
+                mLastBatteryStateSnapshot = mCurrentBatteryStateSnapshot;
 
                 final boolean plugged = mPlugType != 0;
                 final boolean oldPlugged = oldPlugType != 0;
@@ -233,16 +236,22 @@
                     mWarnings.dismissInvalidChargerWarning();
                 } else if (mWarnings.isInvalidChargerWarningShowing()) {
                     // if invalid charger is showing, don't show low battery
+                    if (DEBUG) {
+                        Slog.d(TAG, "Bad Charger");
+                    }
                     return;
                 }
 
                 // Show the correct version of low battery warning if needed
                 if (mLastShowWarningTask != null) {
                     mLastShowWarningTask.cancel(true);
+                    if (DEBUG) {
+                        Slog.d(TAG, "cancelled task");
+                    }
                 }
                 mLastShowWarningTask = ThreadUtils.postOnBackgroundThread(() -> {
-                    maybeShowBatteryWarning(
-                            oldBatteryLevel, plugged, oldPlugged, oldBucket, bucket);
+                    maybeShowBatteryWarningV2(
+                            plugged, bucket);
                 });
 
             } else if (Intent.ACTION_SCREEN_OFF.equals(action)) {
@@ -257,53 +266,150 @@
         }
     }
 
-    protected void maybeShowBatteryWarning(int oldBatteryLevel, boolean plugged, boolean oldPlugged,
-            int oldBucket, int bucket) {
-        boolean isPowerSaver = mPowerManager.isPowerSaveMode();
-        // only play SFX when the dialog comes up or the bucket changes
-        final boolean playSound = bucket != oldBucket || oldPlugged;
+    protected void maybeShowBatteryWarningV2(boolean plugged, int bucket) {
         final boolean hybridEnabled = mEnhancedEstimates.isHybridNotificationEnabled();
-        if (hybridEnabled) {
-            Estimate estimate = mLastEstimate;
-            if (estimate == null || mBatteryLevel != oldBatteryLevel) {
-                estimate = mEnhancedEstimates.getEstimate();
-                mLastEstimate = estimate;
-            }
-            // Turbo is not always booted once SysUI is running so we have to make sure we actually
-            // get data back
-            if (estimate != null) {
-                mTimeRemaining = estimate.estimateMillis;
-                mWarnings.updateEstimate(estimate);
-                mWarnings.updateThresholds(mEnhancedEstimates.getLowWarningThreshold(),
-                        mEnhancedEstimates.getSevereWarningThreshold());
+        final boolean isPowerSaverMode = mPowerManager.isPowerSaveMode();
 
-                // if we are now over 45% battery & 6 hours remaining we can trigger hybrid
-                // notification again
-                if (mBatteryLevel >= CHARGE_CYCLE_PERCENT_RESET
-                        && mTimeRemaining > SIX_HOURS_MILLIS) {
-                    mLowWarningShownThisChargeCycle = false;
-                    mSevereWarningShownThisChargeCycle = false;
-                }
+        // Stick current battery state into an immutable container to determine if we should show
+        // a warning.
+        if (DEBUG) {
+            Slog.d(TAG, "evaluating which notification to show");
+        }
+        if (hybridEnabled) {
+            if (DEBUG) {
+                Slog.d(TAG, "using hybrid");
+            }
+            Estimate estimate = refreshEstimateIfNeeded();
+            mCurrentBatteryStateSnapshot = new BatteryStateSnapshot(mBatteryLevel, isPowerSaverMode,
+                    plugged, bucket, mBatteryStatus, mLowBatteryReminderLevels[1],
+                    mLowBatteryReminderLevels[0], estimate.getEstimateMillis(),
+                    mEnhancedEstimates.getSevereWarningThreshold(),
+                    mEnhancedEstimates.getLowWarningThreshold(), estimate.isBasedOnUsage());
+        } else {
+            if (DEBUG) {
+                Slog.d(TAG, "using standard");
+            }
+            mCurrentBatteryStateSnapshot = new BatteryStateSnapshot(mBatteryLevel, isPowerSaverMode,
+                    plugged, bucket, mBatteryStatus, mLowBatteryReminderLevels[1],
+                    mLowBatteryReminderLevels[0]);
+        }
+
+        mWarnings.updateSnapshot(mCurrentBatteryStateSnapshot);
+        if (mCurrentBatteryStateSnapshot.isHybrid()) {
+            maybeShowHybridWarning(mCurrentBatteryStateSnapshot, mLastBatteryStateSnapshot);
+        } else {
+            maybeShowBatteryWarning(mCurrentBatteryStateSnapshot, mLastBatteryStateSnapshot);
+        }
+    }
+
+    // updates the time estimate if we don't have one or battery level has changed.
+    @VisibleForTesting
+    Estimate refreshEstimateIfNeeded() {
+        if (mLastBatteryStateSnapshot == null
+                || mLastBatteryStateSnapshot.getTimeRemainingMillis() == NO_ESTIMATE_AVAILABLE
+                || mBatteryLevel != mLastBatteryStateSnapshot.getBatteryLevel()) {
+            final Estimate estimate = mEnhancedEstimates.getEstimate();
+            if (DEBUG) {
+                Slog.d(TAG, "updated estimate: " + estimate.getEstimateMillis());
+            }
+            return estimate;
+        }
+        return new Estimate(mLastBatteryStateSnapshot.getTimeRemainingMillis(),
+                mLastBatteryStateSnapshot.isBasedOnUsage());
+    }
+
+    @VisibleForTesting
+    void maybeShowHybridWarning(BatteryStateSnapshot currentSnapshot,
+            BatteryStateSnapshot lastSnapshot) {
+        // if we are now over 45% battery & 6 hours remaining so we can trigger hybrid
+        // notification again
+        if (currentSnapshot.getBatteryLevel() >= CHARGE_CYCLE_PERCENT_RESET
+                && currentSnapshot.getTimeRemainingMillis() > SIX_HOURS_MILLIS) {
+            mLowWarningShownThisChargeCycle = false;
+            mSevereWarningShownThisChargeCycle = false;
+            if (DEBUG) {
+                Slog.d(TAG, "Charge cycle reset! Can show warnings again");
             }
         }
 
-        if (shouldShowLowBatteryWarning(plugged, oldPlugged, oldBucket, bucket,
-                mTimeRemaining, isPowerSaver, mBatteryStatus)) {
-            mWarnings.showLowBatteryWarning(playSound);
+        final boolean playSound = currentSnapshot.getBucket() != lastSnapshot.getBucket()
+                || lastSnapshot.getPlugged();
 
+        if (shouldShowHybridWarning(currentSnapshot)) {
+            mWarnings.showLowBatteryWarning(playSound);
             // mark if we've already shown a warning this cycle. This will prevent the notification
             // trigger from spamming users by only showing low/critical warnings once per cycle
-            if (hybridEnabled) {
-                if (mTimeRemaining <= mEnhancedEstimates.getSevereWarningThreshold()
-                        || mBatteryLevel <= mLowBatteryReminderLevels[1]) {
-                    mSevereWarningShownThisChargeCycle = true;
-                    mLowWarningShownThisChargeCycle = true;
-                } else {
-                    mLowWarningShownThisChargeCycle = true;
+            if (currentSnapshot.getTimeRemainingMillis()
+                    <= currentSnapshot.getSevereLevelThreshold()
+                    || currentSnapshot.getBatteryLevel() <= mLowBatteryReminderLevels[1]) {
+                mSevereWarningShownThisChargeCycle = true;
+                mLowWarningShownThisChargeCycle = true;
+                if (DEBUG) {
+                    Slog.d(TAG, "Severe warning marked as shown this cycle");
                 }
+            } else {
+                Slog.d(TAG, "Low warning marked as shown this cycle");
+                mLowWarningShownThisChargeCycle = true;
             }
-        } else if (shouldDismissLowBatteryWarning(plugged, oldBucket, bucket, mTimeRemaining,
-                isPowerSaver)) {
+
+        } else if (shouldDismissHybridWarning(currentSnapshot)) {
+            if (DEBUG) {
+                Slog.d(TAG, "Dismissing warning");
+            }
+            mWarnings.dismissLowBatteryWarning();
+        } else {
+            if (DEBUG) {
+                Slog.d(TAG, "Updating warning");
+            }
+            mWarnings.updateLowBatteryWarning();
+        }
+    }
+
+    @VisibleForTesting
+    boolean shouldShowHybridWarning(BatteryStateSnapshot snapshot) {
+        if (snapshot.getPlugged()
+                || snapshot.getBatteryStatus() == BatteryManager.BATTERY_STATUS_UNKNOWN) {
+            Slog.d(TAG, "can't show warning due to - plugged: " + snapshot.getPlugged()
+                    + " status unknown: "
+                    + (snapshot.getBatteryStatus() == BatteryManager.BATTERY_STATUS_UNKNOWN));
+            return false;
+        }
+
+        // Only show the low warning once per charge cycle & no battery saver
+        final boolean canShowWarning = !mLowWarningShownThisChargeCycle && !snapshot.isPowerSaver()
+                && (snapshot.getTimeRemainingMillis() < snapshot.getLowThresholdMillis()
+                || snapshot.getBatteryLevel() <= snapshot.getLowLevelThreshold());
+
+        // Only show the severe warning once per charge cycle
+        final boolean canShowSevereWarning = !mSevereWarningShownThisChargeCycle
+                && (snapshot.getTimeRemainingMillis() < snapshot.getSevereThresholdMillis()
+                || snapshot.getBatteryLevel() <= snapshot.getSevereLevelThreshold());
+
+        final boolean canShow = canShowWarning || canShowSevereWarning;
+        if (DEBUG) {
+            Slog.d(TAG, "Enhanced trigger is: " + canShow + "\nwith battery snapshot:"
+                    + " mLowWarningShownThisChargeCycle: " + mLowWarningShownThisChargeCycle
+                    + " mSevereWarningShownThisChargeCycle: " + mSevereWarningShownThisChargeCycle
+                    + "\n" + snapshot.toString());
+        }
+        return canShow;
+    }
+
+    @VisibleForTesting
+    boolean shouldDismissHybridWarning(BatteryStateSnapshot snapshot) {
+        return snapshot.getPlugged()
+                || snapshot.getTimeRemainingMillis() > snapshot.getLowThresholdMillis();
+    }
+
+    protected void maybeShowBatteryWarning(
+            BatteryStateSnapshot currentSnapshot,
+            BatteryStateSnapshot lastSnapshot) {
+        final boolean playSound = currentSnapshot.getBucket() != lastSnapshot.getBucket()
+                || lastSnapshot.getPlugged();
+
+        if (shouldShowLowBatteryWarning(currentSnapshot, lastSnapshot)) {
+            mWarnings.showLowBatteryWarning(playSound);
+        } else if (shouldDismissLowBatteryWarning(currentSnapshot, lastSnapshot)) {
             mWarnings.dismissLowBatteryWarning();
         } else {
             mWarnings.updateLowBatteryWarning();
@@ -311,64 +417,25 @@
     }
 
     @VisibleForTesting
-    boolean shouldShowLowBatteryWarning(boolean plugged, boolean oldPlugged, int oldBucket,
-            int bucket, long timeRemaining, boolean isPowerSaver, int batteryStatus) {
-        if (mEnhancedEstimates.isHybridNotificationEnabled()) {
-            // triggering logic when enhanced estimate is available
-            return isEnhancedTrigger(plugged, timeRemaining, isPowerSaver, batteryStatus);
-        }
-        // legacy triggering logic
-        return !plugged
-                && !isPowerSaver
-                && (((bucket < oldBucket || oldPlugged) && bucket < 0))
-                && batteryStatus != BatteryManager.BATTERY_STATUS_UNKNOWN;
+    boolean shouldShowLowBatteryWarning(
+            BatteryStateSnapshot currentSnapshot,
+            BatteryStateSnapshot lastSnapshot) {
+        return !currentSnapshot.getPlugged()
+                && !currentSnapshot.isPowerSaver()
+                && (((currentSnapshot.getBucket() < lastSnapshot.getBucket()
+                        || lastSnapshot.getPlugged())
+                && currentSnapshot.getBucket() < 0))
+                && currentSnapshot.getBatteryStatus() != BatteryManager.BATTERY_STATUS_UNKNOWN;
     }
 
     @VisibleForTesting
-    boolean shouldDismissLowBatteryWarning(boolean plugged, int oldBucket, int bucket,
-            long timeRemaining, boolean isPowerSaver) {
-        final boolean hybridEnabled = mEnhancedEstimates.isHybridNotificationEnabled();
-        final boolean hybridWouldDismiss = hybridEnabled
-                && timeRemaining > mEnhancedEstimates.getLowWarningThreshold();
-        final boolean standardWouldDismiss = (bucket > oldBucket && bucket > 0);
-        return (isPowerSaver && !hybridEnabled)
-                || plugged
-                || (standardWouldDismiss && (!mEnhancedEstimates.isHybridNotificationEnabled()
-                        || hybridWouldDismiss));
-    }
-
-    private boolean isEnhancedTrigger(boolean plugged, long timeRemaining, boolean isPowerSaver,
-            int batteryStatus) {
-        if (plugged || batteryStatus == BatteryManager.BATTERY_STATUS_UNKNOWN) {
-            return false;
-        }
-        int warnLevel = mLowBatteryReminderLevels[0];
-        int critLevel = mLowBatteryReminderLevels[1];
-
-        // Only show the low warning once per charge cycle & no battery saver
-        final boolean canShowWarning = !mLowWarningShownThisChargeCycle && !isPowerSaver
-                && (timeRemaining < mEnhancedEstimates.getLowWarningThreshold()
-                || mBatteryLevel <= warnLevel);
-
-        // Only show the severe warning once per charge cycle
-        final boolean canShowSevereWarning = !mSevereWarningShownThisChargeCycle
-                && (timeRemaining < mEnhancedEstimates.getSevereWarningThreshold()
-                || mBatteryLevel <= critLevel);
-
-        final boolean canShow = canShowWarning || canShowSevereWarning;
-        if (DEBUG) {
-            Slog.d(TAG, "Enhanced trigger is: " + canShow + "\nwith values: "
-                    + " mLowWarningShownThisChargeCycle: " + mLowWarningShownThisChargeCycle
-                    + " mSevereWarningShownThisChargeCycle: " + mSevereWarningShownThisChargeCycle
-                    + " mEnhancedEstimates.timeremaining: " + timeRemaining
-                    + " mBatteryLevel: " + mBatteryLevel
-                    + " canShowWarning: " + canShowWarning
-                    + " canShowSevereWarning: " + canShowSevereWarning
-                    + " plugged: " + plugged
-                    + " batteryStatus: " + batteryStatus
-                    + " isPowerSaver: " + isPowerSaver);
-        }
-        return canShowWarning || canShowSevereWarning;
+    boolean shouldDismissLowBatteryWarning(
+            BatteryStateSnapshot currentSnapshot,
+            BatteryStateSnapshot lastSnapshot) {
+        return currentSnapshot.isPowerSaver()
+                || currentSnapshot.getPlugged()
+                || (currentSnapshot.getBucket() > lastSnapshot.getBucket()
+                        && currentSnapshot.getBucket() > 0);
     }
 
     private void initTemperature() {
@@ -453,13 +520,21 @@
         mWarnings.dump(pw);
     }
 
+    /**
+     * The interface to allow PowerUI to communicate with whatever implementation of WarningsUI
+     * is being used by the system.
+     */
     public interface WarningsUI {
+
+        /**
+         * Updates battery and screen info for determining whether to trigger battery warnings or
+         * not.
+         * @param batteryLevel The current battery level
+         * @param bucket The current battery bucket
+         * @param screenOffTime How long the screen has been off in millis
+         */
         void update(int batteryLevel, int bucket, long screenOffTime);
 
-        void updateEstimate(Estimate estimate);
-
-        void updateThresholds(long lowThreshold, long severeThreshold);
-
         void dismissLowBatteryWarning();
 
         void showLowBatteryWarning(boolean playSound);
@@ -486,6 +561,12 @@
         void dump(PrintWriter pw);
 
         void userSwitched();
+
+        /**
+         * Updates the snapshot of battery state used for evaluating battery warnings
+         * @param snapshot object containing relevant values for making battery warning decisions.
+         */
+        void updateSnapshot(BatteryStateSnapshot snapshot);
     }
 
     // Thermal event received from thermal service manager subsystem
diff --git a/packages/SystemUI/src/com/android/systemui/privacy/PrivacyItemController.kt b/packages/SystemUI/src/com/android/systemui/privacy/PrivacyItemController.kt
index 625eacd..1c0974a 100644
--- a/packages/SystemUI/src/com/android/systemui/privacy/PrivacyItemController.kt
+++ b/packages/SystemUI/src/com/android/systemui/privacy/PrivacyItemController.kt
@@ -61,7 +61,8 @@
 
     @VisibleForTesting
     internal var privacyList = emptyList<PrivacyItem>()
-        get() = field.toList() // Provides a shallow copy of the list
+        @Synchronized get() = field.toList() // Returns a shallow copy of the list
+        @Synchronized set
 
     private val userManager = context.getSystemService(UserManager::class.java)
     private var currentUserIds = emptyList<Int>()
@@ -71,7 +72,8 @@
     private val callbacks = mutableListOf<WeakReference<Callback>>()
 
     private val notifyChanges = Runnable {
-        callbacks.forEach { it.get()?.privacyChanged(privacyList) }
+        val list = privacyList
+        callbacks.forEach { it.get()?.privacyChanged(list) }
     }
 
     private val updateListAndNotifyChanges = Runnable {
@@ -157,8 +159,10 @@
     }
 
     private fun updatePrivacyList() {
-        privacyList = currentUserIds.flatMap { appOpsController.getActiveAppOpsForUser(it) }
+
+        val list = currentUserIds.flatMap { appOpsController.getActiveAppOpsForUser(it) }
                 .mapNotNull { toPrivacyItem(it) }.distinct()
+        privacyList = list
     }
 
     private fun toPrivacyItem(appOpItem: AppOpItem): PrivacyItem? {
diff --git a/packages/SystemUI/src/com/android/systemui/qs/QSAnimator.java b/packages/SystemUI/src/com/android/systemui/qs/QSAnimator.java
index f607367..aa972e3 100644
--- a/packages/SystemUI/src/com/android/systemui/qs/QSAnimator.java
+++ b/packages/SystemUI/src/com/android/systemui/qs/QSAnimator.java
@@ -261,11 +261,9 @@
             // Fade in the tiles/labels as we reach the final position.
             mFirstPageDelayedAnimator = new TouchAnimator.Builder()
                     .setStartDelay(EXPANDED_TILE_DELAY)
-                    .addFloat(mQsPanel.getPageIndicator(), "alpha", 0, 1)
                     .addFloat(tileLayout, "alpha", 0, 1)
                     .addFloat(mQsPanel.getDivider(), "alpha", 0, 1)
                     .addFloat(mQsPanel.getFooter().getView(), "alpha", 0, 1).build();
-            mAllViews.add(mQsPanel.getPageIndicator());
             mAllViews.add(mQsPanel.getDivider());
             mAllViews.add(mQsPanel.getFooter().getView());
             float px = 0;
@@ -283,7 +281,6 @@
         }
         mNonfirstPageAnimator = new TouchAnimator.Builder()
                 .addFloat(mQuickQsPanel, "alpha", 1, 0)
-                .addFloat(mQsPanel.getPageIndicator(), "alpha", 0, 1)
                 .addFloat(mQsPanel.getDivider(), "alpha", 0, 1)
                 .setListener(mNonFirstPageListener)
                 .setEndDelay(.5f)
diff --git a/packages/SystemUI/src/com/android/systemui/qs/QSCarrier.java b/packages/SystemUI/src/com/android/systemui/qs/QSCarrier.java
new file mode 100644
index 0000000..3ff30c5
--- /dev/null
+++ b/packages/SystemUI/src/com/android/systemui/qs/QSCarrier.java
@@ -0,0 +1,141 @@
+/*
+ * Copyright (C) 2019 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 com.android.systemui.qs;
+
+import android.content.Context;
+import android.content.res.ColorStateList;
+import android.text.TextUtils;
+import android.util.AttributeSet;
+import android.view.View;
+import android.widget.ImageView;
+import android.widget.LinearLayout;
+import android.widget.TextView;
+
+import com.android.settingslib.Utils;
+import com.android.settingslib.graph.SignalDrawable;
+import com.android.systemui.R;
+
+public class QSCarrier extends LinearLayout {
+
+    private View mMobileGroup;
+    private QSCarrierText mCarrierText;
+    private ImageView mMobileSignal;
+    private ImageView mMobileRoaming;
+    private ColorStateList mColorForegroundStateList;
+    private float mColorForegroundIntensity;
+
+    public QSCarrier(Context context) {
+        super(context);
+    }
+
+    public QSCarrier(Context context, AttributeSet attrs) {
+        super(context, attrs);
+    }
+
+    public QSCarrier(Context context, AttributeSet attrs, int defStyleAttr) {
+        super(context, attrs, defStyleAttr);
+    }
+
+    public QSCarrier(Context context, AttributeSet attrs, int defStyleAttr, int defStyleRes) {
+        super(context, attrs, defStyleAttr, defStyleRes);
+    }
+
+    @Override
+    protected void onFinishInflate() {
+        super.onFinishInflate();
+        mMobileGroup = findViewById(R.id.mobile_combo);
+        mMobileSignal = findViewById(R.id.mobile_signal);
+        mMobileRoaming = findViewById(R.id.mobile_roaming);
+        mCarrierText = findViewById(R.id.qs_carrier_text);
+
+        int colorForeground = Utils.getColorAttrDefaultColor(mContext,
+                android.R.attr.colorForeground);
+        mColorForegroundStateList = ColorStateList.valueOf(colorForeground);
+        mColorForegroundIntensity = QuickStatusBarHeader.getColorIntensity(colorForeground);
+
+    }
+
+    public void updateState(QSCarrierGroup.CellSignalState state) {
+        mMobileGroup.setVisibility(state.visible ? View.VISIBLE : View.GONE);
+        if (state.visible) {
+            mMobileRoaming.setVisibility(state.roaming ? View.VISIBLE : View.GONE);
+            mMobileRoaming.setImageTintList(mColorForegroundStateList);
+            SignalDrawable d = new SignalDrawable(mContext);
+            d.setDarkIntensity(mColorForegroundIntensity);
+            mMobileSignal.setImageDrawable(d);
+            mMobileSignal.setImageLevel(state.mobileSignalIconId);
+
+            StringBuilder contentDescription = new StringBuilder();
+            if (state.contentDescription != null) {
+                contentDescription.append(state.contentDescription).append(", ");
+            }
+            if (state.roaming) {
+                contentDescription
+                        .append(mContext.getString(R.string.data_connection_roaming))
+                        .append(", ");
+            }
+            // TODO: show mobile data off/no internet text for 5 seconds before carrier text
+            if (TextUtils.equals(state.typeContentDescription,
+                    mContext.getString(R.string.data_connection_no_internet))
+                    || TextUtils.equals(state.typeContentDescription,
+                    mContext.getString(R.string.cell_data_off_content_description))) {
+                contentDescription.append(state.typeContentDescription);
+            }
+            mMobileSignal.setContentDescription(contentDescription);
+        }
+    }
+
+    public void setCarrierText(CharSequence text) {
+        mCarrierText.setText(text);
+    }
+
+    /**
+     * TextView that changes its ellipsize value with its visibility.
+     */
+    public static class QSCarrierText extends TextView {
+
+        public QSCarrierText(Context context) {
+            super(context);
+        }
+
+        public QSCarrierText(Context context, AttributeSet attrs) {
+            super(context, attrs);
+        }
+
+        public QSCarrierText(Context context, AttributeSet attrs, int defStyleAttr) {
+            super(context, attrs, defStyleAttr);
+        }
+
+        public QSCarrierText(Context context, AttributeSet attrs, int defStyleAttr,
+                int defStyleRes) {
+            super(context, attrs, defStyleAttr, defStyleRes);
+        }
+
+        @Override
+        protected void onVisibilityChanged(View changedView, int visibility) {
+            super.onVisibilityChanged(changedView, visibility);
+            // Only show marquee when visible
+            if (visibility == VISIBLE) {
+                setEllipsize(TextUtils.TruncateAt.MARQUEE);
+                setSelected(true);
+            } else {
+                setEllipsize(TextUtils.TruncateAt.END);
+                setSelected(false);
+            }
+        }
+    }
+}
diff --git a/packages/SystemUI/src/com/android/systemui/qs/QSCarrierGroup.java b/packages/SystemUI/src/com/android/systemui/qs/QSCarrierGroup.java
new file mode 100644
index 0000000..0eeaa9b
--- /dev/null
+++ b/packages/SystemUI/src/com/android/systemui/qs/QSCarrierGroup.java
@@ -0,0 +1,224 @@
+/*
+ * Copyright (C) 2019 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 com.android.systemui.qs;
+
+import static com.android.systemui.util.InjectionInflationController.VIEW_CONTEXT;
+
+import android.content.Context;
+import android.telephony.SubscriptionManager;
+import android.util.AttributeSet;
+import android.util.Log;
+import android.view.View;
+import android.widget.LinearLayout;
+
+import androidx.annotation.VisibleForTesting;
+
+import com.android.keyguard.CarrierTextController;
+import com.android.systemui.Dependency;
+import com.android.systemui.R;
+import com.android.systemui.statusbar.policy.NetworkController;
+
+import javax.inject.Inject;
+import javax.inject.Named;
+
+/**
+ * Displays Carrier name and network status in QS
+ */
+public class QSCarrierGroup extends LinearLayout implements
+        CarrierTextController.CarrierTextCallback,
+        NetworkController.SignalCallback {
+
+    private static final String TAG = "QSCarrierGroup";
+    /**
+     * Support up to 3 slots which is what's supported by {@link TelephonyManager#getPhoneCount}
+     */
+    private static final int SIM_SLOTS = 3;
+    private final NetworkController mNetworkController;
+
+    private View[] mCarrierDividers = new View[SIM_SLOTS - 1];
+    private QSCarrier[] mCarrierGroups = new QSCarrier[SIM_SLOTS];
+    private final CellSignalState[] mInfos = new CellSignalState[SIM_SLOTS];
+    private CarrierTextController mCarrierTextController;
+
+    private boolean mListening;
+
+    @Inject
+    public QSCarrierGroup(@Named(VIEW_CONTEXT) Context context, AttributeSet attrs,
+            NetworkController networkController) {
+        super(context, attrs);
+        mNetworkController = networkController;
+    }
+
+    @VisibleForTesting
+    public QSCarrierGroup(Context context, AttributeSet attrs) {
+        this(context, attrs,
+                Dependency.get(NetworkController.class));
+    }
+
+    @Override
+    protected void onFinishInflate() {
+        super.onFinishInflate();
+
+        mCarrierGroups[0] = findViewById(R.id.carrier1);
+        mCarrierGroups[1] = findViewById(R.id.carrier2);
+        mCarrierGroups[2] = findViewById(R.id.carrier3);
+
+        mCarrierDividers[0] = findViewById(R.id.qs_carrier_divider1);
+        mCarrierDividers[1] = findViewById(R.id.qs_carrier_divider2);
+
+        for (int i = 0; i < SIM_SLOTS; i++) {
+            mInfos[i] = new CellSignalState();
+        }
+
+        CharSequence separator = mContext.getString(
+                com.android.internal.R.string.kg_text_message_separator);
+        mCarrierTextController = new CarrierTextController(mContext, separator, false, false);
+        setImportantForAccessibility(IMPORTANT_FOR_ACCESSIBILITY_YES);
+    }
+
+    public void setListening(boolean listening) {
+        if (listening == mListening) {
+            return;
+        }
+        mListening = listening;
+        updateListeners();
+    }
+
+    @Override
+    @VisibleForTesting
+    public void onDetachedFromWindow() {
+        setListening(false);
+        super.onDetachedFromWindow();
+    }
+
+    private void updateListeners() {
+        if (mListening) {
+            if (mNetworkController.hasVoiceCallingFeature()) {
+                mNetworkController.addCallback(this);
+            }
+            mCarrierTextController.setListening(this);
+        } else {
+            mNetworkController.removeCallback(this);
+            mCarrierTextController.setListening(null);
+        }
+    }
+
+    private void handleUpdateState() {
+        for (int i = 0; i < SIM_SLOTS; i++) {
+            mCarrierGroups[i].updateState(mInfos[i]);
+        }
+
+        mCarrierDividers[0].setVisibility(
+                mInfos[0].visible && mInfos[1].visible ? View.VISIBLE : View.GONE);
+        // This tackles the case of slots 2 being available as well as at least one other.
+        // In that case we show the second divider. Note that if both dividers are visible, it means
+        // all three slots are in use, and that is correct.
+        mCarrierDividers[1].setVisibility(
+                (mInfos[1].visible && mInfos[2].visible)
+                        || (mInfos[0].visible && mInfos[2].visible) ? View.VISIBLE : View.GONE);
+    }
+
+    @VisibleForTesting
+    protected int getSlotIndex(int subscriptionId) {
+        return SubscriptionManager.getSlotIndex(subscriptionId);
+    }
+
+    @Override
+    public void updateCarrierInfo(CarrierTextController.CarrierTextCallbackInfo info) {
+        if (info.anySimReady) {
+            boolean[] slotSeen = new boolean[SIM_SLOTS];
+            if (info.listOfCarriers.length == info.subscriptionIds.length) {
+                for (int i = 0; i < SIM_SLOTS && i < info.listOfCarriers.length; i++) {
+                    int slot = getSlotIndex(info.subscriptionIds[i]);
+                    if (slot >= SIM_SLOTS) {
+                        Log.w(TAG, "updateInfoCarrier - slot: " + slot);
+                        continue;
+                    }
+                    if (slot == SubscriptionManager.INVALID_SIM_SLOT_INDEX) {
+                        Log.e(TAG,
+                                "Invalid SIM slot index for subscription: "
+                                        + info.subscriptionIds[i]);
+                        continue;
+                    }
+                    mInfos[slot].visible = true;
+                    slotSeen[slot] = true;
+                    mCarrierGroups[slot].setCarrierText(info.listOfCarriers[i].toString().trim());
+                    mCarrierGroups[slot].setVisibility(View.VISIBLE);
+                }
+                for (int i = 0; i < SIM_SLOTS; i++) {
+                    if (!slotSeen[i]) {
+                        mInfos[i].visible = false;
+                        mCarrierGroups[i].setVisibility(View.GONE);
+                    }
+                }
+            } else {
+                Log.e(TAG, "Carrier information arrays not of same length");
+            }
+        } else {
+            mInfos[0].visible = false;
+            mCarrierGroups[0].setCarrierText(info.carrierText);
+            mCarrierGroups[0].setVisibility(View.VISIBLE);
+            for (int i = 1; i < SIM_SLOTS; i++) {
+                mInfos[i].visible = false;
+                mCarrierGroups[i].setCarrierText("");
+                mCarrierGroups[i].setVisibility(View.GONE);
+            }
+        }
+        handleUpdateState();
+    }
+
+    @Override
+    public void setMobileDataIndicators(NetworkController.IconState statusIcon,
+            NetworkController.IconState qsIcon, int statusType,
+            int qsType, boolean activityIn, boolean activityOut,
+            String typeContentDescription,
+            String description, boolean isWide, int subId, boolean roaming) {
+        int slotIndex = getSlotIndex(subId);
+        if (slotIndex >= SIM_SLOTS) {
+            Log.w(TAG, "setMobileDataIndicators - slot: " + slotIndex);
+            return;
+        }
+        if (slotIndex == SubscriptionManager.INVALID_SIM_SLOT_INDEX) {
+            Log.e(TAG, "Invalid SIM slot index for subscription: " + subId);
+            return;
+        }
+        mInfos[slotIndex].visible = statusIcon.visible;
+        mInfos[slotIndex].mobileSignalIconId = statusIcon.icon;
+        mInfos[slotIndex].contentDescription = statusIcon.contentDescription;
+        mInfos[slotIndex].typeContentDescription = typeContentDescription;
+        mInfos[slotIndex].roaming = roaming;
+        handleUpdateState();
+    }
+
+    @Override
+    public void setNoSims(boolean hasNoSims, boolean simDetected) {
+        if (hasNoSims) {
+            for (int i = 0; i < SIM_SLOTS; i++) {
+                mInfos[i].visible = false;
+            }
+        }
+        handleUpdateState();
+    }
+
+    static final class CellSignalState {
+        boolean visible;
+        int mobileSignalIconId;
+        String contentDescription;
+        String typeContentDescription;
+        boolean roaming;
+    }
+}
diff --git a/packages/SystemUI/src/com/android/systemui/qs/QSFooterImpl.java b/packages/SystemUI/src/com/android/systemui/qs/QSFooterImpl.java
index f91c9d9..0ae8f6c 100644
--- a/packages/SystemUI/src/com/android/systemui/qs/QSFooterImpl.java
+++ b/packages/SystemUI/src/com/android/systemui/qs/QSFooterImpl.java
@@ -23,24 +23,24 @@
 import android.content.Context;
 import android.content.Intent;
 import android.content.pm.UserInfo;
-import android.content.res.ColorStateList;
 import android.content.res.Configuration;
+import android.database.ContentObserver;
 import android.graphics.PorterDuff.Mode;
 import android.graphics.drawable.Drawable;
 import android.graphics.drawable.RippleDrawable;
+import android.net.Uri;
+import android.os.Build;
 import android.os.Bundle;
+import android.os.Handler;
+import android.os.UserHandle;
 import android.os.UserManager;
-import android.telephony.SubscriptionManager;
-import android.text.TextUtils;
+import android.provider.Settings;
 import android.util.AttributeSet;
-import android.util.Log;
 import android.view.View;
 import android.view.View.OnClickListener;
-import android.view.ViewGroup;
 import android.view.accessibility.AccessibilityNodeInfo;
 import android.widget.FrameLayout;
 import android.widget.ImageView;
-import android.widget.LinearLayout;
 import android.widget.TextView;
 import android.widget.Toast;
 
@@ -49,11 +49,10 @@
 
 import com.android.internal.logging.MetricsLogger;
 import com.android.internal.logging.nano.MetricsProto;
-import com.android.keyguard.CarrierTextController;
 import com.android.keyguard.KeyguardUpdateMonitor;
 import com.android.settingslib.Utils;
+import com.android.settingslib.development.DevelopmentSettingsEnabler;
 import com.android.settingslib.drawable.UserIconDrawable;
-import com.android.settingslib.graph.SignalDrawable;
 import com.android.systemui.Dependency;
 import com.android.systemui.R;
 import com.android.systemui.R.dimen;
@@ -62,9 +61,6 @@
 import com.android.systemui.statusbar.phone.MultiUserSwitch;
 import com.android.systemui.statusbar.phone.SettingsButton;
 import com.android.systemui.statusbar.policy.DeviceProvisionedController;
-import com.android.systemui.statusbar.policy.NetworkController;
-import com.android.systemui.statusbar.policy.NetworkController.EmergencyListener;
-import com.android.systemui.statusbar.policy.NetworkController.SignalCallback;
 import com.android.systemui.statusbar.policy.UserInfoController;
 import com.android.systemui.statusbar.policy.UserInfoController.OnUserInfoChangedListener;
 import com.android.systemui.tuner.TunerService;
@@ -73,15 +69,12 @@
 import javax.inject.Named;
 
 public class QSFooterImpl extends FrameLayout implements QSFooter,
-        OnClickListener, OnUserInfoChangedListener, EmergencyListener, SignalCallback,
-        CarrierTextController.CarrierTextCallback {
+        OnClickListener, OnUserInfoChangedListener {
 
-    private static final int SIM_SLOTS = 2;
     private static final String TAG = "QSFooterImpl";
 
     private final ActivityStarter mActivityStarter;
     private final UserInfoController mUserInfoController;
-    private final NetworkController mNetworkController;
     private final DeviceProvisionedController mDeviceProvisionedController;
     private SettingsButton mSettingsButton;
     protected View mSettingsContainer;
@@ -94,7 +87,6 @@
 
     private boolean mListening;
 
-    private boolean mShowEmergencyCallsOnly;
     private View mDivider;
     protected MultiUserSwitch mMultiUserSwitch;
     private ImageView mMultiUserAvatar;
@@ -103,35 +95,30 @@
     private float mExpansionAmount;
 
     protected View mEdit;
+    protected View mEditContainer;
     private TouchAnimator mSettingsCogAnimator;
 
     private View mActionsContainer;
     private View mDragHandle;
 
-    private View mCarrierDivider;
-    private ViewGroup mMobileFooter;
-    private View[] mMobileGroups = new View[SIM_SLOTS];
-    private ViewGroup[] mCarrierGroups = new ViewGroup[SIM_SLOTS];
-    private TextView[] mCarrierTexts = new TextView[SIM_SLOTS];
-    private ImageView[] mMobileSignals = new ImageView[SIM_SLOTS];
-    private ImageView[] mMobileRoamings = new ImageView[SIM_SLOTS];
-    private final CellSignalState[] mInfos =
-            new CellSignalState[]{new CellSignalState(), new CellSignalState()};
-
-    private final int mColorForeground;
     private OnClickListener mExpandClickListener;
-    private CarrierTextController mCarrierTextController;
+
+    private final ContentObserver mDeveloperSettingsObserver = new ContentObserver(
+            new Handler(mContext.getMainLooper())) {
+        @Override
+        public void onChange(boolean selfChange, Uri uri) {
+            super.onChange(selfChange, uri);
+            setBuildText();
+        }
+    };
 
     @Inject
     public QSFooterImpl(@Named(VIEW_CONTEXT) Context context, AttributeSet attrs,
             ActivityStarter activityStarter, UserInfoController userInfoController,
-            NetworkController networkController,
             DeviceProvisionedController deviceProvisionedController) {
         super(context, attrs);
-        mColorForeground = Utils.getColorAttrDefaultColor(context, android.R.attr.colorForeground);
         mActivityStarter = activityStarter;
         mUserInfoController = userInfoController;
-        mNetworkController = networkController;
         mDeviceProvisionedController = deviceProvisionedController;
     }
 
@@ -140,7 +127,6 @@
         this(context, attrs,
                 Dependency.get(ActivityStarter.class),
                 Dependency.get(UserInfoController.class),
-                Dependency.get(NetworkController.class),
                 Dependency.get(DeviceProvisionedController.class));
     }
 
@@ -159,26 +145,12 @@
         mSettingsContainer = findViewById(R.id.settings_button_container);
         mSettingsButton.setOnClickListener(this);
 
-        mMobileFooter = findViewById(R.id.qs_mobile);
-        mCarrierGroups[0] = findViewById(R.id.carrier1);
-        mCarrierGroups[1] = findViewById(R.id.carrier2);
-
-        for (int i = 0; i < SIM_SLOTS; i++) {
-            mMobileGroups[i] = mCarrierGroups[i].findViewById(R.id.mobile_combo);
-            mMobileSignals[i] = mCarrierGroups[i].findViewById(R.id.mobile_signal);
-            mMobileRoamings[i] = mCarrierGroups[i].findViewById(R.id.mobile_roaming);
-            mCarrierTexts[i] = mCarrierGroups[i].findViewById(R.id.qs_carrier_text);
-        }
-        mCarrierDivider = findViewById(R.id.qs_carrier_divider);
-        CharSequence separator = mContext.getString(
-                com.android.internal.R.string.kg_text_message_separator);
-        mCarrierTextController = new CarrierTextController(mContext, separator, false, false);
-
         mMultiUserSwitch = findViewById(R.id.multi_user_switch);
         mMultiUserAvatar = mMultiUserSwitch.findViewById(R.id.multi_user_avatar);
 
         mDragHandle = findViewById(R.id.qs_drag_handle_view);
         mActionsContainer = findViewById(R.id.qs_footer_actions_container);
+        mEditContainer = findViewById(R.id.qs_footer_actions_edit_container);
 
         // RenderThread is doing more harm than good when touching the header (to expand quick
         // settings), so disable it for this view
@@ -190,6 +162,21 @@
                 oldBottom) -> updateAnimator(right - left));
         setImportantForAccessibility(IMPORTANT_FOR_ACCESSIBILITY_YES);
         updateEverything();
+        setBuildText();
+    }
+
+    private void setBuildText() {
+        TextView v = findViewById(R.id.build);
+        if (v == null) return;
+        if (DevelopmentSettingsEnabler.isDevelopmentSettingsEnabled(mContext)) {
+            v.setText(mContext.getString(
+                    com.android.internal.R.string.bugreport_status,
+                    Build.VERSION.RELEASE,
+                    Build.ID));
+            v.setVisibility(View.VISIBLE);
+        } else {
+            v.setVisibility(View.GONE);
+        }
     }
 
     private void updateAnimator(int width) {
@@ -222,14 +209,6 @@
 
     private void updateResources() {
         updateFooterAnimator();
-
-        // Update the width and weight of the actions container as the page indicator can sometimes
-        // show and the layout needs to center it between the carrier text and actions container.
-        LinearLayout.LayoutParams params =
-                (LinearLayout.LayoutParams) mActionsContainer.getLayoutParams();
-        params.width = mContext.getResources().getInteger(R.integer.qs_footer_actions_width);
-        params.weight = mContext.getResources().getInteger(R.integer.qs_footer_actions_weight);
-        mActionsContainer.setLayoutParams(params);
     }
 
     private void updateFooterAnimator() {
@@ -240,9 +219,8 @@
     private TouchAnimator createFooterAnimator() {
         return new TouchAnimator.Builder()
                 .addFloat(mDivider, "alpha", 0, 1)
-                .addFloat(mMobileFooter, "alpha", 0, 0, 1)
-                .addFloat(mCarrierDivider, "alpha", 0, 1)
                 .addFloat(mActionsContainer, "alpha", 0, 1)
+                .addFloat(mEditContainer, "alpha", 0, 1)
                 .addFloat(mDragHandle, "alpha", 1, 0, 0)
                 .addFloat(mPageIndicator, "alpha", 0, 1)
                 .setStartDelay(0.15f)
@@ -277,9 +255,18 @@
     }
 
     @Override
+    protected void onAttachedToWindow() {
+        super.onAttachedToWindow();
+        mContext.getContentResolver().registerContentObserver(
+                Settings.Global.getUriFor(Settings.Global.DEVELOPMENT_SETTINGS_ENABLED), false,
+                mDeveloperSettingsObserver, UserHandle.USER_ALL);
+    }
+
+    @Override
     @VisibleForTesting
     public void onDetachedFromWindow() {
         setListening(false);
+        mContext.getContentResolver().unregisterContentObserver(mDeveloperSettingsObserver);
         super.onDetachedFromWindow();
     }
 
@@ -337,7 +324,7 @@
                 TunerService.isTunerEnabled(mContext) ? View.VISIBLE : View.INVISIBLE);
         final boolean isDemo = UserManager.isDeviceInDemoMode(mContext);
         mMultiUserSwitch.setVisibility(showUserSwitcher(isDemo) ? View.VISIBLE : View.INVISIBLE);
-        mEdit.setVisibility(isDemo || !mExpanded ? View.INVISIBLE : View.VISIBLE);
+        mEditContainer.setVisibility(isDemo || !mExpanded ? View.INVISIBLE : View.VISIBLE);
         mSettingsButton.setVisibility(isDemo || !mExpanded ? View.INVISIBLE : View.VISIBLE);
     }
 
@@ -364,16 +351,8 @@
     private void updateListeners() {
         if (mListening) {
             mUserInfoController.addCallback(this);
-            if (mNetworkController.hasVoiceCallingFeature()) {
-                mNetworkController.addEmergencyListener(this);
-                mNetworkController.addCallback(this);
-            }
-            mCarrierTextController.setListening(this);
         } else {
             mUserInfoController.removeCallback(this);
-            mNetworkController.removeEmergencyListener(this);
-            mNetworkController.removeCallback(this);
-            mCarrierTextController.setListening(null);
         }
     }
 
@@ -430,17 +409,6 @@
     }
 
     @Override
-    public void setEmergencyCallsOnly(boolean show) {
-        boolean changed = show != mShowEmergencyCallsOnly;
-        if (changed) {
-            mShowEmergencyCallsOnly = show;
-            if (mExpanded) {
-                updateEverything();
-            }
-        }
-    }
-
-    @Override
     public void onUserInfoChanged(String name, Drawable picture, String userAccount) {
         if (picture != null &&
                 UserManager.get(mContext).isGuestUser(KeyguardUpdateMonitor.getCurrentUser()) &&
@@ -452,169 +420,4 @@
         }
         mMultiUserAvatar.setImageDrawable(picture);
     }
-
-    private void handleUpdateState() {
-        for (int i = 0; i < SIM_SLOTS; i++) {
-            mMobileGroups[i].setVisibility(mInfos[i].visible ? View.VISIBLE : View.GONE);
-            if (mInfos[i].visible) {
-                mMobileRoamings[i].setVisibility(mInfos[i].roaming ? View.VISIBLE : View.GONE);
-                mMobileRoamings[i].setImageTintList(ColorStateList.valueOf(mColorForeground));
-                SignalDrawable d = new SignalDrawable(mContext);
-                d.setDarkIntensity(QuickStatusBarHeader.getColorIntensity(mColorForeground));
-                mMobileSignals[i].setImageDrawable(d);
-                mMobileSignals[i].setImageLevel(mInfos[i].mobileSignalIconId);
-
-                StringBuilder contentDescription = new StringBuilder();
-                if (mInfos[i].contentDescription != null) {
-                    contentDescription.append(mInfos[i].contentDescription).append(", ");
-                }
-                if (mInfos[i].roaming) {
-                    contentDescription
-                            .append(mContext.getString(R.string.data_connection_roaming))
-                            .append(", ");
-                }
-                // TODO: show mobile data off/no internet text for 5 seconds before carrier text
-                if (TextUtils.equals(mInfos[i].typeContentDescription,
-                        mContext.getString(R.string.data_connection_no_internet))
-                        || TextUtils.equals(mInfos[i].typeContentDescription,
-                        mContext.getString(R.string.cell_data_off_content_description))) {
-                    contentDescription.append(mInfos[i].typeContentDescription);
-                }
-                mMobileSignals[i].setContentDescription(contentDescription);
-            }
-        }
-        mCarrierDivider.setVisibility(
-                mInfos[0].visible && mInfos[1].visible ? View.VISIBLE : View.GONE);
-    }
-
-    @VisibleForTesting
-    protected int getSlotIndex(int subscriptionId) {
-        return SubscriptionManager.getSlotIndex(subscriptionId);
-    }
-
-    @Override
-    public void updateCarrierInfo(CarrierTextController.CarrierTextCallbackInfo info) {
-        if (info.anySimReady) {
-            boolean[] slotSeen = new boolean[SIM_SLOTS];
-            if (info.listOfCarriers.length == info.subscriptionIds.length) {
-                for (int i = 0; i < SIM_SLOTS && i < info.listOfCarriers.length; i++) {
-                    int slot = getSlotIndex(info.subscriptionIds[i]);
-                    if (slot >= SIM_SLOTS) {
-                        Log.w(TAG, "updateInfoCarrier - slot: " + slot);
-                        continue;
-                    }
-                    if (slot == SubscriptionManager.INVALID_SIM_SLOT_INDEX) {
-                        Log.e(TAG,
-                                "Invalid SIM slot index for subscription: "
-                                        + info.subscriptionIds[i]);
-                        continue;
-                    }
-                    mInfos[slot].visible = true;
-                    slotSeen[slot] = true;
-                    mCarrierTexts[slot].setText(info.listOfCarriers[i].toString().trim());
-                    mCarrierGroups[slot].setVisibility(View.VISIBLE);
-                }
-                for (int i = 0; i < SIM_SLOTS; i++) {
-                    if (!slotSeen[i]) {
-                        mInfos[i].visible = false;
-                        mCarrierGroups[i].setVisibility(View.GONE);
-                    }
-                }
-            } else {
-                // If there are sims ready but there are not the same number of carrier names as
-                // subscription ids, just show the full text in the first slot
-                mInfos[0].visible = true;
-                mCarrierTexts[0].setText(info.carrierText);
-                mCarrierGroups[0].setVisibility(View.VISIBLE);
-                for (int i = 1; i < SIM_SLOTS; i++) {
-                    mInfos[i].visible = false;
-                    mCarrierTexts[i].setText("");
-                    mCarrierGroups[i].setVisibility(View.GONE);
-                }
-            }
-        } else {
-            mInfos[0].visible = false;
-            mCarrierTexts[0].setText(info.carrierText);
-            mCarrierGroups[0].setVisibility(View.VISIBLE);
-            for (int i = 1; i < SIM_SLOTS; i++) {
-                mInfos[i].visible = false;
-                mCarrierTexts[i].setText("");
-                mCarrierGroups[i].setVisibility(View.GONE);
-            }
-        }
-        handleUpdateState();
-    }
-
-    @Override
-    public void setMobileDataIndicators(NetworkController.IconState statusIcon,
-            NetworkController.IconState qsIcon, int statusType,
-            int qsType, boolean activityIn, boolean activityOut,
-            String typeContentDescription,
-            String description, boolean isWide, int subId, boolean roaming) {
-        int slotIndex = getSlotIndex(subId);
-        if (slotIndex >= SIM_SLOTS) {
-            Log.w(TAG, "setMobileDataIndicators - slot: " + slotIndex);
-            return;
-        }
-        if (slotIndex == SubscriptionManager.INVALID_SIM_SLOT_INDEX) {
-            Log.e(TAG, "Invalid SIM slot index for subscription: " + subId);
-            return;
-        }
-        mInfos[slotIndex].visible = statusIcon.visible;
-        mInfos[slotIndex].mobileSignalIconId = statusIcon.icon;
-        mInfos[slotIndex].contentDescription = statusIcon.contentDescription;
-        mInfos[slotIndex].typeContentDescription = typeContentDescription;
-        mInfos[slotIndex].roaming = roaming;
-        handleUpdateState();
-    }
-
-    @Override
-    public void setNoSims(boolean hasNoSims, boolean simDetected) {
-        if (hasNoSims) {
-            mInfos[0].visible = false;
-            mInfos[1].visible = false;
-        }
-        handleUpdateState();
-    }
-
-    private final class CellSignalState {
-        boolean visible;
-        int mobileSignalIconId;
-        public String contentDescription;
-        String typeContentDescription;
-        boolean roaming;
-    }
-
-    /**
-     * TextView that changes its ellipsize value with its visibility.
-     */
-    public static class QSCarrierText extends TextView {
-        public QSCarrierText(Context context) {
-            super(context);
-        }
-
-        public QSCarrierText(Context context, AttributeSet attrs) {
-            super(context, attrs);
-        }
-
-        public QSCarrierText(Context context, AttributeSet attrs, int defStyleAttr) {
-            super(context, attrs, defStyleAttr);
-        }
-
-        public QSCarrierText(Context context, AttributeSet attrs, int defStyleAttr,
-                int defStyleRes) {
-            super(context, attrs, defStyleAttr, defStyleRes);
-        }
-
-        @Override
-        protected void onVisibilityChanged(View changedView, int visibility) {
-            super.onVisibilityChanged(changedView, visibility);
-            // Only show marquee when visible
-            if (visibility == VISIBLE) {
-                setEllipsize(TextUtils.TruncateAt.MARQUEE);
-            } else {
-                setEllipsize(TextUtils.TruncateAt.END);
-            }
-        }
-    }
 }
diff --git a/packages/SystemUI/src/com/android/systemui/qs/QSPanel.java b/packages/SystemUI/src/com/android/systemui/qs/QSPanel.java
index f1f0f69..3c3dfb1 100644
--- a/packages/SystemUI/src/com/android/systemui/qs/QSPanel.java
+++ b/packages/SystemUI/src/com/android/systemui/qs/QSPanel.java
@@ -16,8 +16,6 @@
 
 package com.android.systemui.qs;
 
-import static android.content.res.Configuration.ORIENTATION_LANDSCAPE;
-
 import static com.android.systemui.qs.tileimpl.QSTileImpl.getColorForState;
 
 import android.annotation.Nullable;
@@ -79,7 +77,6 @@
     protected QSTileHost mHost;
 
     protected QSSecurityFooter mFooter;
-    private PageIndicator mPanelPageIndicator;
     private PageIndicator mFooterPageIndicator;
     private boolean mGridContentVisible = true;
 
@@ -110,11 +107,6 @@
         mTileLayout.setListening(mListening);
         addView((View) mTileLayout);
 
-        mPanelPageIndicator = (PageIndicator) LayoutInflater.from(context).inflate(
-                R.layout.qs_page_indicator, this, false);
-        addView(mPanelPageIndicator);
-
-        ((PagedTileLayout) mTileLayout).setPageIndicator(mPanelPageIndicator);
         mQsTileRevealController = new QSTileRevealController(mContext, this,
                 (PagedTileLayout) mTileLayout);
 
@@ -141,10 +133,6 @@
         return mDivider;
     }
 
-    public View getPageIndicator() {
-        return mPanelPageIndicator;
-    }
-
     public QSTileRevealController getQsTileRevealController() {
         return mQsTileRevealController;
     }
@@ -265,21 +253,11 @@
 
     private void updatePageIndicator() {
         if (mTileLayout instanceof PagedTileLayout) {
-            // If we're in landscape, and we have the footer page indicator (which we should if the
-            // footer has been initialized & linked), then we'll show the footer page indicator to
-            // save space in the main QS tile area. Otherwise, we'll use the default one under the
-            // tiles/above the footer.
-            boolean shouldUseFooterPageIndicator =
-                    getResources().getConfiguration().orientation == ORIENTATION_LANDSCAPE
-                            && mFooterPageIndicator != null;
-
-            mPanelPageIndicator.setVisibility(View.GONE);
             if (mFooterPageIndicator != null) {
                 mFooterPageIndicator.setVisibility(View.GONE);
-            }
 
-            ((PagedTileLayout) mTileLayout).setPageIndicator(
-                    shouldUseFooterPageIndicator ? mFooterPageIndicator : mPanelPageIndicator);
+                ((PagedTileLayout) mTileLayout).setPageIndicator(mFooterPageIndicator);
+            }
         }
     }
 
diff --git a/packages/SystemUI/src/com/android/systemui/qs/QuickStatusBarHeader.java b/packages/SystemUI/src/com/android/systemui/qs/QuickStatusBarHeader.java
index 6a8c19a..b502a9524 100644
--- a/packages/SystemUI/src/com/android/systemui/qs/QuickStatusBarHeader.java
+++ b/packages/SystemUI/src/com/android/systemui/qs/QuickStatusBarHeader.java
@@ -15,7 +15,6 @@
 package com.android.systemui.qs;
 
 import static android.app.StatusBarManager.DISABLE2_QUICK_SETTINGS;
-import static android.provider.Settings.System.SHOW_BATTERY_PERCENT;
 
 import static com.android.systemui.util.InjectionInflationController.VIEW_CONTEXT;
 
@@ -31,15 +30,12 @@
 import android.content.IntentFilter;
 import android.content.res.Configuration;
 import android.content.res.Resources;
-import android.database.ContentObserver;
 import android.graphics.Color;
 import android.graphics.Rect;
 import android.media.AudioManager;
-import android.net.Uri;
 import android.os.Handler;
 import android.os.Looper;
 import android.provider.AlarmClock;
-import android.provider.Settings;
 import android.service.notification.ZenModeConfig;
 import android.text.format.DateUtils;
 import android.util.AttributeSet;
@@ -75,7 +71,6 @@
 import com.android.systemui.statusbar.phone.StatusBarIconController.TintedIconManager;
 import com.android.systemui.statusbar.phone.StatusIconContainer;
 import com.android.systemui.statusbar.phone.SystemUIDialog;
-import com.android.systemui.statusbar.policy.BatteryController;
 import com.android.systemui.statusbar.policy.Clock;
 import com.android.systemui.statusbar.policy.DateView;
 import com.android.systemui.statusbar.policy.NextAlarmController;
@@ -107,7 +102,6 @@
     public static final int MAX_TOOLTIP_SHOWN_COUNT = 2;
 
     private final Handler mHandler = new Handler();
-    private final BatteryController mBatteryController;
     private final NextAlarmController mAlarmController;
     private final ZenModeController mZenController;
     private final StatusBarIconController mStatusBarIconController;
@@ -119,6 +113,7 @@
     private boolean mListening;
     private boolean mQsDisabled;
 
+    private QSCarrierGroup mCarrierGroup;
     protected QuickQSPanel mHeaderQsPanel;
     protected QSTileHost mHost;
     private TintedIconManager mIconManager;
@@ -162,9 +157,6 @@
     };
     private boolean mHasTopCutout = false;
 
-    private final PercentSettingObserver mPercentSettingObserver =
-            new PercentSettingObserver(new Handler(mContext.getMainLooper()));
-
     /**
      * Runnable for automatically fading out the long press tooltip (as if it were animating away).
      */
@@ -181,12 +173,11 @@
     @Inject
     public QuickStatusBarHeader(@Named(VIEW_CONTEXT) Context context, AttributeSet attrs,
             NextAlarmController nextAlarmController, ZenModeController zenModeController,
-            BatteryController batteryController, StatusBarIconController statusBarIconController,
+            StatusBarIconController statusBarIconController,
             ActivityStarter activityStarter, PrivacyItemController privacyItemController) {
         super(context, attrs);
         mAlarmController = nextAlarmController;
         mZenController = zenModeController;
-        mBatteryController = batteryController;
         mStatusBarIconController = statusBarIconController;
         mActivityStarter = activityStarter;
         mPrivacyItemController = privacyItemController;
@@ -217,6 +208,7 @@
         mRingerModeTextView = findViewById(R.id.ringer_mode_text);
         mPrivacyChip = findViewById(R.id.privacy_chip);
         mPrivacyChip.setOnClickListener(this);
+        mCarrierGroup = findViewById(R.id.carrier_group);
 
         updateResources();
 
@@ -241,7 +233,9 @@
         mBatteryRemainingIcon = findViewById(R.id.batteryRemainingIcon);
         // Don't need to worry about tuner settings for this icon
         mBatteryRemainingIcon.setIgnoreTunerUpdates(true);
-        updateShowPercent();
+        // QS will always show the estimate, and BatteryMeterView handles the case where
+        // it's unavailable or charging
+        mBatteryRemainingIcon.setPercentShowMode(BatteryMeterView.MODE_ESTIMATE);
     }
 
     private List<String> getIgnoredIconSlots() {
@@ -480,9 +474,6 @@
         super.onAttachedToWindow();
         mStatusBarIconController.addIconGroup(mIconManager);
         requestApplyInsets();
-        mContext.getContentResolver().registerContentObserver(
-                Settings.System.getUriFor(SHOW_BATTERY_PERCENT), false, mPercentSettingObserver,
-                ActivityManager.getCurrentUser());
     }
 
     @Override
@@ -521,7 +512,6 @@
     public void onDetachedFromWindow() {
         setListening(false);
         mStatusBarIconController.removeIconGroup(mIconManager);
-        mContext.getContentResolver().unregisterContentObserver(mPercentSettingObserver);
         super.onDetachedFromWindow();
     }
 
@@ -531,6 +521,7 @@
         }
         mHeaderQsPanel.setListening(listening);
         mListening = listening;
+        mCarrierGroup.setListening(mListening);
 
         if (listening) {
             mZenController.addCallback(this);
@@ -743,25 +734,4 @@
             lp.rightMargin = sideMargins;
         }
     }
-
-    private void updateShowPercent() {
-        final boolean systemSetting = 0 != Settings.System
-                .getIntForUser(getContext().getContentResolver(),
-                        SHOW_BATTERY_PERCENT, 0, ActivityManager.getCurrentUser());
-
-        mBatteryRemainingIcon.setPercentShowMode(systemSetting
-                ? BatteryMeterView.MODE_ESTIMATE : BatteryMeterView.MODE_ON);
-    }
-
-    private final class PercentSettingObserver extends ContentObserver {
-        PercentSettingObserver(Handler handler) {
-            super(handler);
-        }
-
-        @Override
-        public void onChange(boolean selfChange, Uri uri) {
-            super.onChange(selfChange, uri);
-            updateShowPercent();
-        }
-    }
 }
diff --git a/packages/SystemUI/src/com/android/systemui/qs/customize/TileQueryHelper.java b/packages/SystemUI/src/com/android/systemui/qs/customize/TileQueryHelper.java
index 4dcacd4..7006249 100644
--- a/packages/SystemUI/src/com/android/systemui/qs/customize/TileQueryHelper.java
+++ b/packages/SystemUI/src/com/android/systemui/qs/customize/TileQueryHelper.java
@@ -27,6 +27,7 @@
 import android.os.Build;
 import android.os.Handler;
 import android.provider.Settings;
+import android.service.quicksettings.Tile;
 import android.service.quicksettings.TileService;
 import android.text.TextUtils;
 import android.util.ArraySet;
@@ -166,7 +167,8 @@
                 icon.mutate();
                 icon.setTint(mContext.getColor(android.R.color.white));
                 CharSequence label = info.serviceInfo.loadLabel(pm);
-                addTile(spec, icon, label != null ? label.toString() : "null", appLabel);
+                createStateAndAddTile(spec, icon, label != null ? label.toString() : "null",
+                        appLabel);
             }
 
             notifyTilesChanged(true);
@@ -207,9 +209,10 @@
         mSpecs.add(spec);
     }
 
-    private void addTile(
+    private void createStateAndAddTile(
             String spec, Drawable drawable, CharSequence label, CharSequence appLabel) {
         QSTile.State state = new QSTile.State();
+        state.state = Tile.STATE_INACTIVE;
         state.label = label;
         state.contentDescription = label;
         state.icon = new DrawableIcon(drawable);
diff --git a/packages/SystemUI/src/com/android/systemui/qs/tiles/CastTile.java b/packages/SystemUI/src/com/android/systemui/qs/tiles/CastTile.java
index f05ac4c..0b1e9c3 100644
--- a/packages/SystemUI/src/com/android/systemui/qs/tiles/CastTile.java
+++ b/packages/SystemUI/src/com/android/systemui/qs/tiles/CastTile.java
@@ -21,6 +21,7 @@
 import android.app.Dialog;
 import android.content.Context;
 import android.content.Intent;
+import android.media.projection.MediaProjectionInfo;
 import android.provider.Settings;
 import android.service.quicksettings.Tile;
 import android.util.Log;
@@ -125,7 +126,30 @@
             });
             return;
         }
-        showDetail(true);
+
+        CastDevice activeProjection = getActiveDeviceMediaProjection();
+        if (activeProjection == null) {
+            showDetail(true);
+        } else {
+            mController.stopCasting(activeProjection);
+        }
+    }
+
+    private CastDevice getActiveDeviceMediaProjection() {
+        CastDevice activeDevice = null;
+        for (CastDevice device : mController.getCastDevices()) {
+            if (device.state == CastDevice.STATE_CONNECTED
+                    || device.state == CastDevice.STATE_CONNECTING) {
+                activeDevice = device;
+                break;
+            }
+        }
+
+        if (activeDevice != null && activeDevice.tag instanceof MediaProjectionInfo) {
+            return activeDevice;
+        }
+
+        return null;
     }
 
     @Override
@@ -161,21 +185,23 @@
         for (CastDevice device : devices) {
             if (device.state == CastDevice.STATE_CONNECTED) {
                 state.value = true;
-                state.label = getDeviceName(device);
+                state.secondaryLabel = getDeviceName(device);
                 state.contentDescription = state.contentDescription + "," +
                         mContext.getString(R.string.accessibility_cast_name, state.label);
             } else if (device.state == CastDevice.STATE_CONNECTING) {
                 connecting = true;
             }
         }
-        if (!state.value && connecting) {
-            state.label = mContext.getString(R.string.quick_settings_connecting);
+        if (connecting && !state.value) {
+            state.secondaryLabel = mContext.getString(R.string.quick_settings_connecting);
         }
         state.icon = ResourceIcon.get(state.value ? R.drawable.ic_qs_cast_on
                 : R.drawable.ic_qs_cast_off);
-        if (mWifiConnected) {
+        if (mWifiConnected || state.value) {
             state.state = state.value ? Tile.STATE_ACTIVE : Tile.STATE_INACTIVE;
-            state.secondaryLabel = "";
+            if (!state.value) {
+                state.secondaryLabel = "";
+            }
             state.contentDescription = state.contentDescription + ","
                     + mContext.getString(R.string.accessibility_quick_settings_open_details);
             state.expandedAccessibilityClassName = Button.class.getName();
diff --git a/packages/SystemUI/src/com/android/systemui/recents/OverviewProxyService.java b/packages/SystemUI/src/com/android/systemui/recents/OverviewProxyService.java
index 83c4cfc..4da8ca2 100644
--- a/packages/SystemUI/src/com/android/systemui/recents/OverviewProxyService.java
+++ b/packages/SystemUI/src/com/android/systemui/recents/OverviewProxyService.java
@@ -16,7 +16,7 @@
 
 package com.android.systemui.recents;
 
-import static android.content.pm.PackageManager.MATCH_DIRECT_BOOT_UNAWARE;
+import static android.content.pm.PackageManager.MATCH_SYSTEM_ONLY;
 import static android.view.MotionEvent.ACTION_CANCEL;
 import static android.view.MotionEvent.ACTION_DOWN;
 import static android.view.MotionEvent.ACTION_UP;
@@ -29,6 +29,7 @@
 import static com.android.systemui.shared.system.QuickStepContract.KEY_EXTRA_SYSUI_PROXY;
 import static com.android.systemui.shared.system.QuickStepContract.KEY_EXTRA_WINDOW_CORNER_RADIUS;
 
+import android.annotation.FloatRange;
 import android.content.BroadcastReceiver;
 import android.content.ComponentName;
 import android.content.Context;
@@ -269,6 +270,30 @@
             }
         }
 
+        public void onAssistantProgress(@FloatRange(from = 0.0, to = 1.0) float progress) {
+            if (!verifyCaller("onAssistantProgress")) {
+                return;
+            }
+            long token = Binder.clearCallingIdentity();
+            try {
+                mHandler.post(() -> notifyAssistantProgress(progress));
+            } finally {
+                Binder.restoreCallingIdentity(token);
+            }
+        }
+
+        public void startAssistant(Bundle bundle) {
+            if (!verifyCaller("startAssistant")) {
+                return;
+            }
+            long token = Binder.clearCallingIdentity();
+            try {
+                mHandler.post(() -> notifyStartAssistant(bundle));
+            } finally {
+                Binder.restoreCallingIdentity(token);
+            }
+        }
+
         private boolean verifyCaller(String reason) {
             final int callerId = Binder.getCallingUserHandle().getIdentifier();
             if (callerId != mCurrentBoundedUserId) {
@@ -590,9 +615,21 @@
         }
     }
 
+    private void notifyAssistantProgress(@FloatRange(from = 0.0, to = 1.0) float progress) {
+        for (int i = mConnectionCallbacks.size() - 1; i >= 0; --i) {
+            mConnectionCallbacks.get(i).onAssistantProgress(progress);
+        }
+    }
+
+    private void notifyStartAssistant(Bundle bundle) {
+        for (int i = mConnectionCallbacks.size() - 1; i >= 0; --i) {
+            mConnectionCallbacks.get(i).startAssistant(bundle);
+        }
+    }
+
     private void updateEnabledState() {
         mIsEnabled = mContext.getPackageManager().resolveServiceAsUser(mQuickStepIntent,
-                MATCH_DIRECT_BOOT_UNAWARE,
+                MATCH_SYSTEM_ONLY,
                 ActivityManagerWrapper.getInstance().getCurrentUserId()) != null;
     }
 
@@ -637,5 +674,7 @@
         default void onOverviewShown(boolean fromHome) {}
         default void onQuickScrubStarted() {}
         default void onBackButtonAlphaChanged(float alpha, boolean animate) {}
+        default void onAssistantProgress(@FloatRange(from = 0.0, to = 1.0) float progress) {}
+        default void startAssistant(Bundle bundle) {}
     }
 }
diff --git a/packages/SystemUI/src/com/android/systemui/screenshot/GlobalScreenshot.java b/packages/SystemUI/src/com/android/systemui/screenshot/GlobalScreenshot.java
index bed0c45..341461b 100644
--- a/packages/SystemUI/src/com/android/systemui/screenshot/GlobalScreenshot.java
+++ b/packages/SystemUI/src/com/android/systemui/screenshot/GlobalScreenshot.java
@@ -42,9 +42,11 @@
 import android.content.ContentResolver;
 import android.content.Context;
 import android.content.Intent;
+import android.content.res.Configuration;
 import android.content.res.Resources;
 import android.graphics.Bitmap;
 import android.graphics.Canvas;
+import android.graphics.Color;
 import android.graphics.ColorMatrix;
 import android.graphics.ColorMatrixColorFilter;
 import android.graphics.Matrix;
@@ -743,6 +745,15 @@
                 return (x - flashDurationPct) / (1f - flashDurationPct);
             }
         };
+
+        Resources r = mContext.getResources();
+        if ((r.getConfiguration().uiMode & Configuration.UI_MODE_NIGHT_MASK)
+                == Configuration.UI_MODE_NIGHT_YES) {
+            mScreenshotView.getBackground().setTint(Color.BLACK);
+        } else {
+            mScreenshotView.getBackground().setTintList(null);
+        }
+
         ValueAnimator anim = ValueAnimator.ofFloat(0f, 1f);
         anim.setDuration(SCREENSHOT_DROP_IN_DURATION);
         anim.addListener(new AnimatorListenerAdapter() {
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/AlertingNotificationManager.java b/packages/SystemUI/src/com/android/systemui/statusbar/AlertingNotificationManager.java
index a6af82a..33bcefb 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/AlertingNotificationManager.java
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/AlertingNotificationManager.java
@@ -237,7 +237,8 @@
      */
     protected boolean canRemoveImmediately(String key) {
         AlertEntry alertEntry = mAlertEntries.get(key);
-        return alertEntry == null || alertEntry.wasShownLongEnough();
+        return alertEntry == null || alertEntry.wasShownLongEnough()
+                || alertEntry.mEntry.isRowDismissed();
     }
 
     ///////////////////////////////////////////////////////////////////////////////////////////////
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/AmbientPulseManager.java b/packages/SystemUI/src/com/android/systemui/statusbar/AmbientPulseManager.java
index 57d0588..5f878ce 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/AmbientPulseManager.java
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/AmbientPulseManager.java
@@ -131,7 +131,7 @@
          * @param entry the entry that changed
          * @param isPulsing true if the entry is now pulsing, false otherwise
          */
-        void onAmbientStateChanged(NotificationEntry entry, boolean isPulsing);
+        void onAmbientStateChanged(@NonNull NotificationEntry entry, boolean isPulsing);
     }
 
     private final class AmbientEntry extends AlertEntry {
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/CommandQueue.java b/packages/SystemUI/src/com/android/systemui/statusbar/CommandQueue.java
index 0150852..295abcb 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/CommandQueue.java
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/CommandQueue.java
@@ -277,9 +277,13 @@
         default void hideBiometricDialog() { }
 
         /**
-        * @see IStatusBar#onDisplayReady(int)
-        */
+         * @see IStatusBar#onDisplayReady(int)
+         */
         default void onDisplayReady(int displayId) { }
+        /**
+         * @see DisplayManager.DisplayListener#onDisplayRemoved(int)
+         */
+        default void onDisplayRemoved(int displayId) { }
     }
 
     @VisibleForTesting
@@ -297,6 +301,11 @@
         synchronized (mLock) {
             mDisplayDisabled.remove(displayId);
         }
+        // This callback is registered with {@link #mHandler} that already posts to run on main
+        // thread, so it is safe to dispatch directly.
+        for (int i = mCallbacks.size() - 1; i >= 0; i--) {
+            mCallbacks.get(i).onDisplayRemoved(displayId);
+        }
     }
 
     @Override
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/KeyguardIndicationController.java b/packages/SystemUI/src/com/android/systemui/statusbar/KeyguardIndicationController.java
index a9fe3b2..dfbb32e 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/KeyguardIndicationController.java
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/KeyguardIndicationController.java
@@ -581,13 +581,12 @@
             if (!updateMonitor.isUnlockingWithBiometricAllowed()) {
                 return;
             }
-            ColorStateList errorColorState = Utils.getColorError(mContext);
             if (mStatusBarKeyguardViewManager.isBouncerShowing()) {
                 mStatusBarKeyguardViewManager.showBouncerMessage(helpString,
-                        errorColorState);
+                        mInitialTextColorState);
             } else if (updateMonitor.isScreenOn()) {
                 mLockIcon.setTransientBiometricsError(true);
-                showTransientIndication(helpString, errorColorState);
+                showTransientIndication(helpString);
                 hideTransientIndicationDelayed(TRANSIENT_BIOMETRIC_ERROR_TIMEOUT);
                 mHandler.removeMessages(MSG_CLEAR_BIOMETRIC_MSG);
                 mHandler.sendMessageDelayed(mHandler.obtainMessage(MSG_CLEAR_BIOMETRIC_MSG),
@@ -605,7 +604,6 @@
             if (shouldSuppressBiometricError(msgId, biometricSourceType, updateMonitor)) {
                 return;
             }
-            ColorStateList errorColorState = Utils.getColorError(mContext);
             if (mStatusBarKeyguardViewManager.isBouncerShowing()) {
                 // When swiping up right after receiving a biometric error, the bouncer calls
                 // authenticate leading to the same message being shown again on the bouncer.
@@ -613,10 +611,10 @@
                 // generic.
                 if (mLastSuccessiveErrorMessage != msgId) {
                     mStatusBarKeyguardViewManager.showBouncerMessage(errString,
-                            errorColorState);
+                            mInitialTextColorState);
                 }
             } else if (updateMonitor.isScreenOn()) {
-                showTransientIndication(errString, errorColorState);
+                showTransientIndication(errString);
                 // We want to keep this message around in case the screen was off
                 hideTransientIndicationDelayed(HIDE_DELAY_MS);
             } else {
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/MediaArtworkProcessor.kt b/packages/SystemUI/src/com/android/systemui/statusbar/MediaArtworkProcessor.kt
index 52b8cc2..b7ae4ed 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/MediaArtworkProcessor.kt
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/MediaArtworkProcessor.kt
@@ -51,8 +51,15 @@
         val renderScript = RenderScript.create(context)
         val rect = Rect(0, 0, artwork.width, artwork.height)
         MathUtils.fitRect(rect, Math.max(mTmpSize.x / DOWNSAMPLE, mTmpSize.y / DOWNSAMPLE))
-        val inBitmap = Bitmap.createScaledBitmap(artwork, rect.width(), rect.height(),
+        var inBitmap = Bitmap.createScaledBitmap(artwork, rect.width(), rect.height(),
                 true /* filter */)
+        // Render script blurs only support ARGB_8888, we need a conversion if we got a
+        // different bitmap config.
+        if (inBitmap.config != Bitmap.Config.ARGB_8888) {
+            val oldIn = inBitmap
+            inBitmap = oldIn.copy(Bitmap.Config.ARGB_8888, false /* isMutable */)
+            oldIn.recycle()
+        }
         val input = Allocation.createFromBitmap(renderScript, inBitmap,
                 Allocation.MipmapControl.MIPMAP_NONE, Allocation.USAGE_GRAPHICS_TEXTURE)
         val outBitmap = Bitmap.createBitmap(inBitmap.width, inBitmap.height,
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/NavigationBarController.java b/packages/SystemUI/src/com/android/systemui/statusbar/NavigationBarController.java
index 2edea78..14dc272 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/NavigationBarController.java
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/NavigationBarController.java
@@ -23,7 +23,6 @@
 
 import android.content.Context;
 import android.hardware.display.DisplayManager;
-import android.hardware.display.DisplayManager.DisplayListener;
 import android.os.Handler;
 import android.os.RemoteException;
 import android.util.Log;
@@ -50,7 +49,7 @@
 
 /** A controller to handle navigation bars. */
 @Singleton
-public class NavigationBarController implements DisplayListener, Callbacks {
+public class NavigationBarController implements Callbacks {
 
     private static final String TAG = NavigationBarController.class.getName();
 
@@ -66,22 +65,15 @@
         mContext = context;
         mHandler = handler;
         mDisplayManager = (DisplayManager) mContext.getSystemService(Context.DISPLAY_SERVICE);
-        mDisplayManager.registerDisplayListener(this, mHandler);
         getComponent(mContext, CommandQueue.class).addCallback(this);
     }
 
     @Override
-    public void onDisplayAdded(int displayId) { }
-
-    @Override
     public void onDisplayRemoved(int displayId) {
         removeNavigationBar(displayId);
     }
 
     @Override
-    public void onDisplayChanged(int displayId) { }
-
-    @Override
     public void onDisplayReady(int displayId) {
         Display display = mDisplayManager.getDisplay(displayId);
         createNavigationBar(display);
@@ -110,9 +102,7 @@
      * @param display the display to add navigation bar on.
      */
     private void createNavigationBar(Display display) {
-        if (display == null
-                || (display.getDisplayId() != DEFAULT_DISPLAY
-                        && !display.supportsSystemDecorations())) {
+        if (display == null) {
             return;
         }
 
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/NotificationMediaManager.java b/packages/SystemUI/src/com/android/systemui/statusbar/NotificationMediaManager.java
index 490317b..fa22367 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/NotificationMediaManager.java
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/NotificationMediaManager.java
@@ -38,10 +38,12 @@
 import android.os.Handler;
 import android.os.Trace;
 import android.os.UserHandle;
+import android.provider.DeviceConfig;
 import android.util.Log;
 import android.view.View;
 import android.widget.ImageView;
 
+import com.android.internal.config.sysui.SystemUiDeviceConfigFlags;
 import com.android.internal.statusbar.NotificationVisibility;
 import com.android.systemui.Dependency;
 import com.android.systemui.Dumpable;
@@ -115,6 +117,20 @@
     private ImageView mBackdropFront;
     private ImageView mBackdropBack;
 
+    private boolean mShowCompactMediaSeekbar;
+    private final DeviceConfig.OnPropertyChangedListener mPropertyChangedListener =
+            new DeviceConfig.OnPropertyChangedListener() {
+        @Override
+        public void onPropertyChanged(String namespace, String name, String value) {
+            if (SystemUiDeviceConfigFlags.COMPACT_MEDIA_SEEKBAR_ENABLED.equals(name)) {
+                if (DEBUG_MEDIA) {
+                    Log.v(TAG, "DEBUG_MEDIA: compact media seekbar flag updated: " + value);
+                }
+                mShowCompactMediaSeekbar = "true".equals(value);
+            }
+        }
+    };
+
     private final MediaController.Callback mMediaListener = new MediaController.Callback() {
         @Override
         public void onPlaybackStateChanged(PlaybackState state) {
@@ -168,6 +184,14 @@
                 onNotificationRemoved(entry.key);
             }
         });
+
+        mShowCompactMediaSeekbar = "true".equals(
+                DeviceConfig.getProperty(DeviceConfig.NAMESPACE_SYSTEMUI,
+                    SystemUiDeviceConfigFlags.COMPACT_MEDIA_SEEKBAR_ENABLED));
+
+        DeviceConfig.addOnPropertyChangedListener(DeviceConfig.NAMESPACE_SYSTEMUI,
+                mContext.getMainExecutor(),
+                mPropertyChangedListener);
     }
 
     public void setUpWithPresenter(NotificationPresenter presenter) {
@@ -189,6 +213,10 @@
         return mMediaMetadata;
     }
 
+    public boolean getShowCompactMediaSeekbar() {
+        return mShowCompactMediaSeekbar;
+    }
+
     public Icon getMediaIcon() {
         if (mMediaNotificationKey == null) {
             return null;
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/NotificationRemoteInputManager.java b/packages/SystemUI/src/com/android/systemui/statusbar/NotificationRemoteInputManager.java
index b820dc0..a630e49 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/NotificationRemoteInputManager.java
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/NotificationRemoteInputManager.java
@@ -461,9 +461,6 @@
     }
 
     public boolean shouldKeepForRemoteInputHistory(NotificationEntry entry) {
-        if (entry.isDismissed()) {
-            return false;
-        }
         if (!FORCE_REMOTE_INPUT_HISTORY) {
             return false;
         }
@@ -471,9 +468,6 @@
     }
 
     public boolean shouldKeepForSmartReplyHistory(NotificationEntry entry) {
-        if (entry.isDismissed()) {
-            return false;
-        }
         if (!FORCE_REMOTE_INPUT_HISTORY) {
             return false;
         }
@@ -661,9 +655,6 @@
     protected class RemoteInputActiveExtender extends RemoteInputExtender {
         @Override
         public boolean shouldExtendLifetime(@NonNull NotificationEntry entry) {
-            if (entry.isDismissed()) {
-                return false;
-            }
             return mRemoteInputController.isRemoteInputActive(entry);
         }
 
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/NotificationShelf.java b/packages/SystemUI/src/com/android/systemui/statusbar/NotificationShelf.java
index 110d515..2cca701 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/NotificationShelf.java
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/NotificationShelf.java
@@ -232,7 +232,7 @@
             openedAmount = Math.min(1.0f, openedAmount);
             viewState.openedAmount = openedAmount;
             viewState.clipTopAmount = 0;
-            viewState.alpha = mAmbientState.hasPulsingNotifications() ? 0 : 1;
+            viewState.alpha = 1;
             viewState.belowSpeedBump = mAmbientState.getSpeedBumpIndex() == 0;
             viewState.hideSensitive = false;
             viewState.xTranslation = getTranslationX();
@@ -290,6 +290,7 @@
                 && !mAmbientState.isPanelTracking();
         int baseZHeight = mAmbientState.getBaseZHeight();
         int backgroundTop = 0;
+        int clipTopAmount = 0;
         float firstElementRoundness = 0.0f;
         ExpandableNotificationRow previousRow = null;
 
@@ -319,7 +320,8 @@
                             rowTranslationY + getNotificationMergeSize());
                 }
             }
-            updateNotificationClipHeight(row, notificationClipEnd);
+            int clipTop = updateNotificationClipHeight(row, notificationClipEnd, notGoneIndex);
+            clipTopAmount = Math.max(clipTop, clipTopAmount);
             float inShelfAmount = updateIconAppearance(row, expandAmount, scrolling, scrollingFast,
                     expandingAnimated, isLastChild);
             numViewsInShelf += inShelfAmount;
@@ -379,9 +381,9 @@
             previousColor = ownColorUntinted;
             previousRow = row;
         }
-
         clipTransientViews();
 
+        setClipTopAmount(clipTopAmount);
         setBackgroundTop(backgroundTop);
         setFirstElementRoundness(firstElementRoundness);
         mShelfIcons.setSpeedBumpIndex(mAmbientState.getSpeedBumpIndex());
@@ -415,7 +417,7 @@
             View transientView = mHostLayout.getTransientView(i);
             if (transientView instanceof ExpandableNotificationRow) {
                 ExpandableNotificationRow transientRow = (ExpandableNotificationRow) transientView;
-                updateNotificationClipHeight(transientRow, getTranslationY());
+                updateNotificationClipHeight(transientRow, getTranslationY(), -1);
             } else {
                 Log.e(TAG, "NotificationShelf.clipTransientViews(): "
                         + "Trying to clip non-row transient view");
@@ -432,9 +434,13 @@
 
     private void updateIconClipAmount(ExpandableNotificationRow row) {
         float maxTop = row.getTranslationY();
+        if (getClipTopAmount() != 0) {
+            // if the shelf is clipped, lets make sure we also clip the icon
+            maxTop = Math.max(maxTop, getTranslationY() + getClipTopAmount());
+        }
         StatusBarIconView icon = row.getEntry().expandedIcon;
         float shelfIconPosition = getTranslationY() + icon.getTop() + icon.getTranslationY();
-        if (shelfIconPosition < maxTop && !mAmbientState.isDark()) {
+        if (shelfIconPosition < maxTop && !mAmbientState.isFullyDark()) {
             int top = (int) (maxTop - shelfIconPosition);
             Rect clipRect = new Rect(0, top, icon.getWidth(), Math.max(top, icon.getHeight()));
             icon.setClipBounds(clipRect);
@@ -485,12 +491,18 @@
         }
     }
 
-    private void updateNotificationClipHeight(ExpandableNotificationRow row,
-            float notificationClipEnd) {
+    /**
+     * Update the clipping of this view.
+     * @return the amount that our own top should be clipped
+     */
+    private int updateNotificationClipHeight(ExpandableNotificationRow row,
+            float notificationClipEnd, int childIndex) {
         float viewEnd = row.getTranslationY() + row.getActualHeight();
         boolean isPinned = (row.isPinned() || row.isHeadsUpAnimatingAway())
                 && !mAmbientState.isDozingAndNotPulsing(row);
-        if (viewEnd > notificationClipEnd
+        boolean shouldClipOwnTop = row.showingAmbientPulsing()
+                || (mAmbientState.isPulseExpanding() && childIndex == 0);
+        if (viewEnd > notificationClipEnd && !shouldClipOwnTop
                 && (mAmbientState.isShadeExpanded() || !isPinned)) {
             int clipBottomAmount = (int) (viewEnd - notificationClipEnd);
             if (isPinned) {
@@ -501,6 +513,11 @@
         } else {
             row.setClipBottomAmount(0);
         }
+        if (shouldClipOwnTop) {
+            return (int) (viewEnd - getTranslationY());
+        } else {
+            return 0;
+        }
     }
 
     @Override
@@ -653,7 +670,7 @@
                 ? fullTransitionAmount
                 : transitionAmount;
         iconState.clampedAppearAmount = clampedAmount;
-        float contentTransformationAmount = !mAmbientState.isAboveShelf(row)
+        float contentTransformationAmount = !row.isAboveShelf()
                     && (isLastChild || iconState.translateContent)
                 ? iconTransitionAmount
                 : 0.0f;
@@ -722,7 +739,7 @@
                 iconState.scaleY = 1.0f;
                 iconState.hidden = false;
             }
-            if (mAmbientState.isAboveShelf(row) || (!row.isInShelf() && (isLastChild && row.areGutsExposed()
+            if (row.isAboveShelf() || (!row.isInShelf() && (isLastChild && row.areGutsExposed()
                     || row.getTranslationZ() > mAmbientState.getBaseZHeight()))) {
                 iconState.hidden = true;
             }
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/PulseExpansionHandler.kt b/packages/SystemUI/src/com/android/systemui/statusbar/PulseExpansionHandler.kt
new file mode 100644
index 0000000..e5dbcd3
--- /dev/null
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/PulseExpansionHandler.kt
@@ -0,0 +1,272 @@
+/*
+ * Copyright (C) 2019 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 com.android.systemui.statusbar
+
+import android.animation.Animator
+import android.animation.AnimatorListenerAdapter
+import android.animation.ObjectAnimator
+import android.animation.ValueAnimator
+import android.content.Context
+import android.os.PowerManager
+import android.os.PowerManager.WAKE_REASON_GESTURE
+import android.os.SystemClock
+import android.view.MotionEvent
+import android.view.ViewConfiguration
+
+import com.android.systemui.Gefingerpoken
+import com.android.systemui.Interpolators
+import com.android.systemui.R
+import com.android.systemui.classifier.FalsingManager
+import com.android.systemui.statusbar.notification.NotificationWakeUpCoordinator
+import com.android.systemui.statusbar.notification.row.ExpandableNotificationRow
+import com.android.systemui.statusbar.notification.row.ExpandableView
+import com.android.systemui.statusbar.notification.stack.NotificationStackScrollLayout
+import com.android.systemui.statusbar.phone.ShadeController
+
+import javax.inject.Inject
+import javax.inject.Singleton
+import kotlin.math.max
+
+/**
+ * A utility class to enable the downward swipe on when pulsing.
+ */
+@Singleton
+class PulseExpansionHandler @Inject
+constructor(context: Context,
+            private val mWakeUpCoordinator: NotificationWakeUpCoordinator) : Gefingerpoken {
+    companion object {
+        private val RUBBERBAND_FACTOR_STATIC = 0.25f
+        private val SPRING_BACK_ANIMATION_LENGTH_MS = 375
+    }
+    private val mPowerManager: PowerManager?
+    private var mShadeController: ShadeController? = null
+
+    private val mMinDragDistance: Int
+    private var mInitialTouchX: Float = 0.0f
+    private var mInitialTouchY: Float = 0.0f
+    var isExpanding: Boolean = false
+        private set
+    private val mTouchSlop: Float
+    private var mExpansionCallback: ExpansionCallback? = null
+    private lateinit var mStackScroller: NotificationStackScrollLayout
+    private val mTemp2 = IntArray(2)
+    private var mDraggedFarEnough: Boolean = false
+    private var mStartingChild: ExpandableView? = null
+    private val mFalsingManager: FalsingManager
+    private var mPulsing: Boolean = false
+    var isWakingToShadeLocked: Boolean = false
+        private set
+    private var mEmptyDragAmount: Float = 0.0f
+    private var mWakeUpHeight: Float = 0.0f
+    private var mReachedWakeUpHeight: Boolean = false
+
+    private val isFalseTouch: Boolean
+        get() = mFalsingManager.isFalseTouch
+
+    init {
+        mMinDragDistance = context.resources.getDimensionPixelSize(
+                R.dimen.keyguard_drag_down_min_distance)
+        mTouchSlop = ViewConfiguration.get(context).scaledTouchSlop.toFloat()
+        mFalsingManager = FalsingManager.getInstance(context)
+        mPowerManager = context.getSystemService(PowerManager::class.java)
+    }
+
+    override fun onInterceptTouchEvent(event: MotionEvent): Boolean {
+        return maybeStartExpansion(event)
+    }
+
+    private fun maybeStartExpansion(event: MotionEvent): Boolean {
+        if (!mPulsing) {
+            return false
+        }
+        val x = event.x
+        val y = event.y
+
+        when (event.actionMasked) {
+            MotionEvent.ACTION_DOWN -> {
+                mDraggedFarEnough = false
+                isExpanding = false
+                mStartingChild = null
+                mInitialTouchY = y
+                mInitialTouchX = x
+            }
+
+            MotionEvent.ACTION_MOVE -> {
+                val h = y - mInitialTouchY
+                if (h > mTouchSlop && h > Math.abs(x - mInitialTouchX)) {
+                    mFalsingManager.onStartExpandingFromPulse()
+                    isExpanding = true
+                    captureStartingChild(mInitialTouchX, mInitialTouchY)
+                    mInitialTouchY = y
+                    mInitialTouchX = x
+                    mWakeUpHeight = mWakeUpCoordinator.getWakeUpHeight()
+                    mReachedWakeUpHeight = false
+                    return true
+                }
+            }
+        }
+        return false
+    }
+
+    override fun onTouchEvent(event: MotionEvent): Boolean {
+        if (!isExpanding) {
+            return maybeStartExpansion(event)
+        }
+        val y = event.y
+
+        when (event.actionMasked) {
+            MotionEvent.ACTION_MOVE -> updateExpansionHeight(y - mInitialTouchY)
+            MotionEvent.ACTION_UP -> if (!mFalsingManager.isUnlockingDisabled && !isFalseTouch) {
+                finishExpansion()
+            } else {
+                cancelExpansion()
+            }
+            MotionEvent.ACTION_CANCEL -> cancelExpansion()
+        }
+        return isExpanding
+    }
+
+    private fun finishExpansion() {
+        resetClock()
+        if (mStartingChild != null) {
+            setUserLocked(mStartingChild!!, false)
+            mStartingChild = null
+        }
+        isExpanding = false
+        isWakingToShadeLocked = true
+        mPowerManager!!.wakeUp(SystemClock.uptimeMillis(), WAKE_REASON_GESTURE,
+                "com.android.systemui:PULSEDRAG")
+        mShadeController!!.goToLockedShade(mStartingChild)
+        if (mStartingChild is ExpandableNotificationRow) {
+            val row = mStartingChild as ExpandableNotificationRow?
+            row!!.onExpandedByGesture(true /* userExpanded */)
+        }
+    }
+
+    private fun updateExpansionHeight(height: Float) {
+        var expansionHeight = max(height, 0.0f)
+        if (!mReachedWakeUpHeight && height > mWakeUpHeight) {
+            mReachedWakeUpHeight = true;
+        }
+        if (mStartingChild != null) {
+            val child = mStartingChild!!
+            val newHeight = Math.min((child.collapsedHeight + expansionHeight).toInt(),
+                    child.maxContentHeight)
+            child.actualHeight = newHeight
+            expansionHeight = max(newHeight.toFloat(), expansionHeight)
+        } else {
+            val target = if (mReachedWakeUpHeight) mWakeUpHeight else 0.0f
+            mWakeUpCoordinator.setNotificationsVisibleForExpansion(height > target,
+                    true /* animate */,
+                    true /* increaseSpeed */)
+            expansionHeight = max(mWakeUpHeight, expansionHeight)
+        }
+        val emptyDragAmount = mWakeUpCoordinator.setPulseHeight(expansionHeight)
+        setEmptyDragAmount(emptyDragAmount * RUBBERBAND_FACTOR_STATIC)
+    }
+
+    private fun captureStartingChild(x: Float, y: Float) {
+        if (mStartingChild == null) {
+            mStartingChild = findView(x, y)
+            if (mStartingChild != null) {
+                setUserLocked(mStartingChild!!, true)
+            }
+        }
+    }
+
+    private fun setEmptyDragAmount(amount: Float) {
+        mEmptyDragAmount = amount
+        mExpansionCallback!!.setEmptyDragAmount(amount)
+    }
+
+    private fun reset(child: ExpandableView) {
+        if (child.actualHeight == child.collapsedHeight) {
+            setUserLocked(child, false)
+            return
+        }
+        val anim = ObjectAnimator.ofInt(child, "actualHeight",
+                child.actualHeight, child.collapsedHeight)
+        anim.interpolator = Interpolators.FAST_OUT_SLOW_IN
+        anim.duration = SPRING_BACK_ANIMATION_LENGTH_MS.toLong()
+        anim.addListener(object : AnimatorListenerAdapter() {
+            override fun onAnimationEnd(animation: Animator) {
+                setUserLocked(child, false)
+            }
+        })
+        anim.start()
+    }
+
+    private fun setUserLocked(child: ExpandableView, userLocked: Boolean) {
+        if (child is ExpandableNotificationRow) {
+            child.isUserLocked = userLocked
+        }
+    }
+
+    private fun resetClock() {
+        val anim = ValueAnimator.ofFloat(mEmptyDragAmount, 0f)
+        anim.interpolator = Interpolators.FAST_OUT_SLOW_IN
+        anim.duration = SPRING_BACK_ANIMATION_LENGTH_MS.toLong()
+        anim.addUpdateListener { animation -> setEmptyDragAmount(animation.animatedValue as Float) }
+        anim.start()
+    }
+
+    private fun cancelExpansion() {
+        mFalsingManager.onExpansionFromPulseStopped()
+        if (mStartingChild != null) {
+            reset(mStartingChild!!)
+            mStartingChild = null
+        } else {
+            resetClock()
+        }
+        mWakeUpCoordinator.setNotificationsVisibleForExpansion(false /* visible */,
+                true /* animate */,
+                false /* increaseSpeed */)
+        isExpanding = false
+    }
+
+    private fun findView(x: Float, y: Float): ExpandableView? {
+        var totalX = x
+        var totalY = y
+        mStackScroller.getLocationOnScreen(mTemp2)
+        totalX += mTemp2[0].toFloat()
+        totalY += mTemp2[1].toFloat()
+        val childAtRawPosition = mStackScroller.getChildAtRawPosition(totalX, totalY)
+        return if (childAtRawPosition != null && childAtRawPosition.isContentExpandable) {
+            childAtRawPosition
+        } else null
+    }
+
+    fun setUp(notificationStackScroller: NotificationStackScrollLayout,
+             expansionCallback: ExpansionCallback,
+             shadeController: ShadeController) {
+        mExpansionCallback = expansionCallback
+        mShadeController = shadeController
+        mStackScroller = notificationStackScroller
+    }
+
+    fun setPulsing(pulsing: Boolean) {
+        mPulsing = pulsing
+    }
+
+    fun onStartedWakingUp() {
+        isWakingToShadeLocked = false
+    }
+
+    interface ExpansionCallback {
+        fun setEmptyDragAmount(amount: Float)
+    }
+}
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/StatusBarStateControllerImpl.java b/packages/SystemUI/src/com/android/systemui/statusbar/StatusBarStateControllerImpl.java
index ad5aa57..eb386dc 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/StatusBarStateControllerImpl.java
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/StatusBarStateControllerImpl.java
@@ -18,15 +18,19 @@
 
 import android.animation.ObjectAnimator;
 import android.animation.ValueAnimator;
+import android.text.format.DateFormat;
 import android.util.FloatProperty;
 import android.view.animation.Interpolator;
 
 import com.android.internal.annotations.GuardedBy;
+import com.android.systemui.Dumpable;
 import com.android.systemui.Interpolators;
 import com.android.systemui.plugins.statusbar.StatusBarStateController.StateListener;
 import com.android.systemui.statusbar.notification.stack.StackStateAnimator;
 import com.android.systemui.statusbar.policy.CallbackController;
 
+import java.io.FileDescriptor;
+import java.io.PrintWriter;
 import java.util.ArrayList;
 import java.util.Comparator;
 
@@ -38,8 +42,10 @@
  */
 @Singleton
 public class StatusBarStateControllerImpl implements SysuiStatusBarStateController,
-        CallbackController<StateListener> {
+        CallbackController<StateListener>, Dumpable {
     private static final String TAG = "SbStateController";
+    // Must be a power of 2
+    private static final int HISTORY_SIZE = 32;
 
     private static final int MAX_STATE = StatusBarState.FULLSCREEN_USER_SWITCHER;
     private static final int MIN_STATE = StatusBarState.SHADE;
@@ -66,6 +72,10 @@
     private boolean mLeaveOpenOnKeyguardHide;
     private boolean mKeyguardRequested;
 
+    // Record the HISTORY_SIZE most recent states
+    private int mHistoryIndex = 0;
+    private HistoricalState[] mHistoricalRecords = new HistoricalState[HISTORY_SIZE];
+
     /**
      * If the device is currently dozing or not.
      */
@@ -93,6 +103,9 @@
 
     @Inject
     public StatusBarStateControllerImpl() {
+        for (int i = 0; i < HISTORY_SIZE; i++) {
+            mHistoricalRecords[i] = new HistoricalState();
+        }
     }
 
     @Override
@@ -108,6 +121,10 @@
         if (state == mState) {
             return false;
         }
+
+        // Record the to-be mState and mLastState
+        recordHistoricalState(state, mState);
+
         synchronized (mListeners) {
             for (RankedListener rl : new ArrayList<>(mListeners)) {
                 rl.mListener.onStatePreChange(mState, state);
@@ -281,4 +298,58 @@
     public static String describe(int state) {
         return StatusBarState.toShortString(state);
     }
+
+    @Override
+    public void dump(FileDescriptor fd, PrintWriter pw, String[] args) {
+        pw.println("StatusBarStateController: ");
+        pw.println(" mState=" + mState + " (" + describe(mState) + ")");
+        pw.println(" mLastState=" + mLastState + " (" + describe(mLastState) + ")");
+        pw.println(" mLeaveOpenOnKeyguardHide=" + mLeaveOpenOnKeyguardHide);
+        pw.println(" mKeyguardRequested=" + mKeyguardRequested);
+        pw.println(" mIsDozing=" + mIsDozing);
+        pw.println(" Historical states:");
+        // Ignore records without a timestamp
+        int size = 0;
+        for (int i = 0; i < HISTORY_SIZE; i++) {
+            if (mHistoricalRecords[i].mTimestamp != 0) size++;
+        }
+        for (int i = mHistoryIndex + HISTORY_SIZE;
+                i >= mHistoryIndex + HISTORY_SIZE - size + 1; i--) {
+            pw.println("  (" + (mHistoryIndex + HISTORY_SIZE - i + 1) + ")"
+                    + mHistoricalRecords[i & (HISTORY_SIZE - 1)]);
+        }
+    }
+
+    private void recordHistoricalState(int currentState, int lastState) {
+        mHistoryIndex = (mHistoryIndex + 1) % HISTORY_SIZE;
+        HistoricalState state = mHistoricalRecords[mHistoryIndex];
+        state.mState = currentState;
+        state.mLastState = lastState;
+        state.mTimestamp = System.currentTimeMillis();
+    }
+
+    /**
+     * For keeping track of our previous state to help with debugging
+     */
+    private static class HistoricalState {
+        int mState;
+        int mLastState;
+        long mTimestamp;
+
+        @Override
+        public String toString() {
+            if (mTimestamp != 0) {
+                StringBuilder sb = new StringBuilder();
+                sb.append("state=").append(mState)
+                        .append(" (").append(describe(mState)).append(")");
+                sb.append("lastState=").append(mLastState).append(" (").append(describe(mLastState))
+                        .append(")");
+                sb.append("timestamp=")
+                        .append(DateFormat.format("MM-dd HH:mm:ss", mTimestamp));
+
+                return sb.toString();
+            }
+            return "Empty " + getClass().getSimpleName();
+        }
+    }
 }
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/notification/NotificationEntryManager.java b/packages/SystemUI/src/com/android/systemui/statusbar/notification/NotificationEntryManager.java
index 4ed9ae4..7d224fb 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/notification/NotificationEntryManager.java
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/notification/NotificationEntryManager.java
@@ -159,16 +159,19 @@
     }
 
     public void performRemoveNotification(StatusBarNotification n) {
-        final int rank = mNotificationData.getRank(n.getKey());
-        final int count = mNotificationData.getActiveNotifications().size();
-        NotificationVisibility.NotificationLocation location =
-                NotificationLogger.getNotificationLocation(getNotificationData().get(n.getKey()));
-        final NotificationVisibility nv = NotificationVisibility.obtain(n.getKey(), rank, count,
-                true, location);
+        final NotificationVisibility nv = obtainVisibility(n.getKey());
         removeNotificationInternal(
                 n.getKey(), null, nv, false /* forceRemove */, true /* removedByUser */);
     }
 
+    private NotificationVisibility obtainVisibility(String key) {
+        final int rank = mNotificationData.getRank(key);
+        final int count = mNotificationData.getActiveNotifications().size();
+        NotificationVisibility.NotificationLocation location =
+                NotificationLogger.getNotificationLocation(getNotificationData().get(key));
+        return NotificationVisibility.obtain(key, rank, count, true, location);
+    }
+
     private void abortExistingInflation(String key) {
         if (mPendingNotifications.containsKey(key)) {
             NotificationEntry entry = mPendingNotifications.get(key);
@@ -226,8 +229,8 @@
 
     @Override
     public void removeNotification(String key, NotificationListenerService.RankingMap ranking) {
-        removeNotificationInternal(
-                key, ranking, null, false /* forceRemove */, false /* removedByUser */);
+        removeNotificationInternal(key, ranking, obtainVisibility(key), false /* forceRemove */,
+                false /* removedByUser */);
     }
 
     private void removeNotificationInternal(
@@ -245,7 +248,8 @@
         if (entry != null) {
             // If a manager needs to keep the notification around for whatever reason, we
             // keep the notification
-            if (!forceRemove) {
+            boolean entryDismissed = entry.isRowDismissed();
+            if (!forceRemove && !entryDismissed) {
                 for (NotificationLifetimeExtender extender : mNotificationLifetimeExtenders) {
                     if (extender.shouldExtendLifetime(entry)) {
                         mLatestRankingMap = ranking;
@@ -272,6 +276,7 @@
                 mNotificationData.remove(key, ranking);
                 updateNotifications();
                 Dependency.get(LeakDetector.class).trackGarbage(entry);
+                removedByUser |= entryDismissed;
 
                 for (NotificationEntryListener listener : mNotificationEntryListeners) {
                     listener.onEntryRemoved(entry, visibility, removedByUser);
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/notification/NotificationWakeUpCoordinator.kt b/packages/SystemUI/src/com/android/systemui/statusbar/notification/NotificationWakeUpCoordinator.kt
new file mode 100644
index 0000000..ccb8d9b
--- /dev/null
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/notification/NotificationWakeUpCoordinator.kt
@@ -0,0 +1,215 @@
+/*
+ * Copyright (C) 2019 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 com.android.systemui.statusbar.notification
+
+import android.animation.ObjectAnimator
+import android.util.FloatProperty
+import com.android.systemui.Interpolators
+import com.android.systemui.plugins.statusbar.StatusBarStateController
+import com.android.systemui.statusbar.AmbientPulseManager
+import com.android.systemui.statusbar.SysuiStatusBarStateController
+import com.android.systemui.statusbar.notification.collection.NotificationEntry
+import com.android.systemui.statusbar.notification.stack.NotificationStackScrollLayout
+import com.android.systemui.statusbar.notification.stack.StackStateAnimator
+
+import javax.inject.Inject
+import javax.inject.Singleton
+
+@Singleton
+class NotificationWakeUpCoordinator @Inject constructor(
+        private val mAmbientPulseManager: AmbientPulseManager,
+        private val mStatusBarStateController: StatusBarStateController)
+    : AmbientPulseManager.OnAmbientChangedListener, StatusBarStateController.StateListener {
+
+    private val mNotificationVisibility
+            = object : FloatProperty<NotificationWakeUpCoordinator>("notificationVisibility") {
+
+        override fun setValue(coordinator: NotificationWakeUpCoordinator, value: Float) {
+            coordinator.setVisibilityAmount(value)
+        }
+
+        override fun get(coordinator: NotificationWakeUpCoordinator): Float? {
+            return coordinator.mLinearVisibilityAmount
+        }
+    }
+    private lateinit var mStackScroller: NotificationStackScrollLayout
+    private var mVisibilityInterpolator = Interpolators.FAST_OUT_SLOW_IN_REVERSE
+
+    private var mLinearDozeAmount: Float = 0.0f
+    private var mDozeAmount: Float = 0.0f
+    private var mNotificationVisibleAmount = 0.0f
+    private var mNotificationsVisible = false
+    private var mNotificationsVisibleForExpansion = false
+    private var mDarkAnimator: ObjectAnimator? = null
+    private var mVisibilityAmount = 0.0f
+    private var mLinearVisibilityAmount = 0.0f
+    private var mWakingUp = false
+    private val mEntrySetToClearWhenFinished = mutableSetOf<NotificationEntry>()
+
+    init {
+        mAmbientPulseManager.addListener(this)
+        mStatusBarStateController.addCallback(this)
+    }
+
+    fun setStackScroller(stackScroller: NotificationStackScrollLayout) {
+        mStackScroller = stackScroller
+    }
+
+    /**
+     * @param visible should notifications be visible
+     * @param animate should this change be animated
+     * @param increaseSpeed should the speed be increased of the animation
+     */
+    fun setNotificationsVisibleForExpansion(visible: Boolean, animate: Boolean,
+                                                    increaseSpeed: Boolean) {
+        mNotificationsVisibleForExpansion = visible
+        updateNotificationVisibility(animate, increaseSpeed)
+        if (!visible && mNotificationsVisible) {
+            // If we stopped expanding and we're still visible because we had a pulse that hasn't
+            // times out, let's release them all to make sure were not stuck in a state where
+            // notifications are visible
+            mAmbientPulseManager.releaseAllImmediately()
+        }
+    }
+
+    private fun updateNotificationVisibility(animate: Boolean, increaseSpeed: Boolean) {
+        var visible = mNotificationsVisibleForExpansion || mAmbientPulseManager.hasNotifications()
+        if (!visible && mNotificationsVisible && mWakingUp && mDozeAmount != 0.0f) {
+            // let's not make notifications invisible while waking up, otherwise the animation
+            // is strange
+            return;
+        }
+        setNotificationsVisible(visible, animate, increaseSpeed)
+    }
+
+    private fun setNotificationsVisible(visible: Boolean, animate: Boolean,
+                                        increaseSpeed: Boolean) {
+        if (mNotificationsVisible == visible) {
+            return
+        }
+        mNotificationsVisible = visible
+        mDarkAnimator?.cancel();
+        if (animate) {
+            notifyAnimationStart(visible)
+            startVisibilityAnimation(increaseSpeed)
+        } else {
+            setVisibilityAmount(if (visible) 1.0f else 0.0f)
+        }
+    }
+
+    override fun onDozeAmountChanged(linear: Float, eased: Float) {
+        if (linear != 1.0f && linear != 0.0f
+                && (mLinearDozeAmount == 0.0f || mLinearDozeAmount == 1.0f)) {
+            // Let's notify the scroller that an animation started
+            notifyAnimationStart(mLinearDozeAmount == 1.0f)
+        }
+        mLinearDozeAmount = linear
+        mDozeAmount = eased
+        mStackScroller.setDozeAmount(mDozeAmount)
+        updateDarkAmount()
+        if (linear == 0.0f) {
+            setNotificationsVisible(visible = false, animate = false, increaseSpeed = false);
+            setNotificationsVisibleForExpansion(visible = false, animate = false,
+                    increaseSpeed = false)
+        }
+    }
+
+    private fun startVisibilityAnimation(increaseSpeed: Boolean) {
+        if (mNotificationVisibleAmount == 0f || mNotificationVisibleAmount == 1f) {
+            mVisibilityInterpolator = if (mNotificationsVisible)
+                Interpolators.TOUCH_RESPONSE
+            else
+                Interpolators.FAST_OUT_SLOW_IN_REVERSE
+        }
+        val target = if (mNotificationsVisible) 1.0f else 0.0f
+        val darkAnimator = ObjectAnimator.ofFloat(this, mNotificationVisibility, target)
+        darkAnimator.setInterpolator(Interpolators.LINEAR)
+        var duration = StackStateAnimator.ANIMATION_DURATION_WAKEUP.toLong()
+        if (increaseSpeed) {
+            duration = (duration.toFloat() / 1.5F).toLong();
+        }
+        darkAnimator.setDuration(duration)
+        darkAnimator.start()
+        mDarkAnimator = darkAnimator
+    }
+
+    private fun setVisibilityAmount(visibilityAmount: Float) {
+        mLinearVisibilityAmount = visibilityAmount
+        mVisibilityAmount = mVisibilityInterpolator.getInterpolation(
+                visibilityAmount)
+        handleAnimationFinished();
+        updateDarkAmount()
+    }
+
+    private fun handleAnimationFinished() {
+        if (mLinearDozeAmount == 0.0f || mLinearVisibilityAmount == 0.0f) {
+            mEntrySetToClearWhenFinished.forEach { it.setAmbientGoingAway(false) }
+        }
+    }
+
+    fun getWakeUpHeight() : Float {
+        return mStackScroller.pulseHeight
+    }
+
+    private fun updateDarkAmount() {
+        val linearAmount = Math.min(1.0f - mLinearVisibilityAmount, mLinearDozeAmount)
+        val amount = Math.min(1.0f - mVisibilityAmount, mDozeAmount)
+        mStackScroller.setDarkAmount(linearAmount, amount)
+    }
+
+    private fun notifyAnimationStart(awake: Boolean) {
+        mStackScroller.notifyDarkAnimationStart(!awake)
+    }
+
+    override fun onDozingChanged(isDozing: Boolean) {
+        if (isDozing) {
+            setNotificationsVisible(visible = false, animate = false, increaseSpeed = false)
+        }
+    }
+
+    fun setPulseHeight(height: Float): Float {
+        return mStackScroller.setPulseHeight(height)
+    }
+
+    fun setWakingUp(wakingUp: Boolean) {
+        mWakingUp = wakingUp
+        if (wakingUp && mNotificationsVisible && !mNotificationsVisibleForExpansion) {
+            // We're waking up while pulsing, let's make sure the animation looks nice
+            mStackScroller.wakeUpFromPulse();
+        }
+    }
+
+    override fun onAmbientStateChanged(entry: NotificationEntry, isPulsing: Boolean) {
+        var animate = true
+        if (!isPulsing) {
+            if (mLinearDozeAmount != 0.0f) {
+                if (entry.isRowDismissed) {
+                    // if we animate, we see the shelf briefly visible. Instead we fully animate
+                    // the notification and its background out
+                    animate = false
+                } else {
+                    entry.setAmbientGoingAway(true)
+                    mEntrySetToClearWhenFinished.add(entry)
+                }
+            }
+        } else if (mEntrySetToClearWhenFinished.contains(entry)) {
+            mEntrySetToClearWhenFinished.remove(entry)
+            entry.setAmbientGoingAway(false)
+        }
+        updateNotificationVisibility(animate, increaseSpeed = false)
+    }
+}
\ No newline at end of file
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/notification/collection/NotificationData.java b/packages/SystemUI/src/com/android/systemui/statusbar/notification/collection/NotificationData.java
index 8b522a2..04ff58b 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/notification/collection/NotificationData.java
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/notification/collection/NotificationData.java
@@ -112,8 +112,8 @@
             } else if (isHeadsUp) {
                 // Provide consistent ranking with headsUpManager
                 return mHeadsUpManager.compare(a, b);
-            } else if (a.getRow().isAmbientPulsing() != b.getRow().isAmbientPulsing()) {
-                return a.getRow().isAmbientPulsing() ? -1 : 1;
+            } else if (a.getRow().showingAmbientPulsing() != b.getRow().showingAmbientPulsing()) {
+                return a.getRow().showingAmbientPulsing() ? -1 : 1;
             } else if (aMedia != bMedia) {
                 // Upsort current media notification.
                 return aMedia ? -1 : 1;
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/notification/collection/NotificationEntry.java b/packages/SystemUI/src/com/android/systemui/statusbar/notification/collection/NotificationEntry.java
index 3bf4d4b..f1373d1 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/notification/collection/NotificationEntry.java
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/notification/collection/NotificationEntry.java
@@ -543,14 +543,6 @@
         return row == null || row.isRemoved();
     }
 
-    /**
-     * @return {@code true} if the row is null or dismissed
-     */
-    public boolean isDismissed() {
-        //TODO: recycling
-        return row == null || row.isDismissed();
-    }
-
     public boolean isRowPinned() {
         return row != null && row.isPinned();
     }
@@ -571,6 +563,12 @@
         if (row != null) row.setHeadsUp(shouldHeadsUp);
     }
 
+
+    public void setAmbientGoingAway(boolean goingAway) {
+        if (row != null) row.setAmbientGoingAway(goingAway);
+    }
+
+
     public boolean mustStayOnScreen() {
         return row != null && row.mustStayOnScreen();
     }
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/notification/row/ExpandableNotificationRow.java b/packages/SystemUI/src/com/android/systemui/statusbar/notification/row/ExpandableNotificationRow.java
index 2b643d0..c769daa 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/notification/row/ExpandableNotificationRow.java
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/notification/row/ExpandableNotificationRow.java
@@ -81,6 +81,7 @@
 import com.android.systemui.plugins.statusbar.NotificationMenuRowPlugin;
 import com.android.systemui.plugins.statusbar.NotificationMenuRowPlugin.MenuItem;
 import com.android.systemui.shared.plugins.PluginManager;
+import com.android.systemui.statusbar.NotificationMediaManager;
 import com.android.systemui.statusbar.RemoteInputController;
 import com.android.systemui.statusbar.StatusBarIconView;
 import com.android.systemui.statusbar.notification.AboveShelfChangedListener;
@@ -90,7 +91,6 @@
 import com.android.systemui.statusbar.notification.collection.NotificationEntry;
 import com.android.systemui.statusbar.notification.logging.NotificationCounters;
 import com.android.systemui.statusbar.notification.row.NotificationContentInflater.InflationFlag;
-import com.android.systemui.statusbar.notification.row.wrapper.NotificationMediaTemplateViewWrapper;
 import com.android.systemui.statusbar.notification.row.wrapper.NotificationViewWrapper;
 import com.android.systemui.statusbar.notification.stack.AmbientState;
 import com.android.systemui.statusbar.notification.stack.AnimationProperties;
@@ -215,6 +215,11 @@
     private boolean mIsAmbientPulsing;
 
     /**
+     * Happens when the notification was pulsing before and goes away to ensure smooth animations.
+     */
+    private boolean mAmbientGoingAway;
+
+    /**
      * Whether or not the notification should be redacted on the lock screen, i.e has sensitive
      * content which should be redacted on the lock screen.
      */
@@ -329,8 +334,8 @@
     private boolean mUseIncreasedHeadsUpHeight;
     private float mTranslationWhenRemoved;
     private boolean mWasChildInGroupWhenRemoved;
-    private int mNotificationColorAmbient;
     private NotificationInlineImageResolver mImageResolver;
+    private NotificationMediaManager mMediaManager;
 
     private SystemNotificationAsyncTask mSystemNotificationAsyncTask =
             new SystemNotificationAsyncTask();
@@ -658,10 +663,11 @@
         View expandedView = layout.getExpandedChild();
         boolean isMediaLayout = expandedView != null
                 && expandedView.findViewById(com.android.internal.R.id.media_actions) != null;
+        boolean showCompactMediaSeekbar = mMediaManager.getShowCompactMediaSeekbar();
 
         if (customView && beforeP && !mIsSummaryWithChildren) {
             minHeight = beforeN ? mNotificationMinHeightBeforeN : mNotificationMinHeightBeforeP;
-        } else if (isMediaLayout && !NotificationMediaTemplateViewWrapper.HIDE_COMPACT_SCRUBBER) {
+        } else if (isMediaLayout && showCompactMediaSeekbar) {
             minHeight = mNotificationMinHeightMedia;
         } else if (mUseIncreasedCollapsedHeight && layout == mPrivateLayout) {
             minHeight = mNotificationMinHeightLarge;
@@ -719,8 +725,9 @@
         }
     }
 
-    public boolean isAmbientPulsing() {
-        return mIsAmbientPulsing;
+    @Override
+    public boolean showingAmbientPulsing() {
+        return mIsAmbientPulsing || mAmbientGoingAway;
     }
 
     public void setAmbientPulsing(boolean isAmbientPulsing) {
@@ -1276,18 +1283,12 @@
         mNotificationColor = ContrastColorUtil.resolveContrastColor(mContext,
                 getStatusBarNotification().getNotification().color,
                 getBackgroundColorWithoutTint(), nightMode);
-        mNotificationColorAmbient = ContrastColorUtil.resolveAmbientColor(mContext,
-                getStatusBarNotification().getNotification().color);
     }
 
     public HybridNotificationView getSingleLineView() {
         return mPrivateLayout.getSingleLineView();
     }
 
-    public HybridNotificationView getAmbientSingleLineView() {
-        return getShowingLayout().getAmbientSingleLineChild();
-    }
-
     public boolean isOnKeyguard() {
         return mOnKeyguard;
     }
@@ -1620,10 +1621,6 @@
         return mNotificationInflater;
     }
 
-    public int getNotificationColorAmbient() {
-        return mNotificationColorAmbient;
-    }
-
     public interface ExpansionLogger {
         void logNotificationExpansion(String key, boolean userAction, boolean expanded);
     }
@@ -1635,6 +1632,7 @@
         mMenuRow = new NotificationMenuRow(mContext);
         mImageResolver = new NotificationInlineImageResolver(context,
                 new NotificationInlineImageCache());
+        mMediaManager = Dependency.get(NotificationMediaManager.class);
         initDimens();
     }
 
@@ -2307,7 +2305,7 @@
             return mPrivateLayout.getMinHeight();
         } else if (mSensitive && mHideSensitiveForIntrinsicHeight) {
             return getMinHeight();
-        } else if (mIsSummaryWithChildren && (!mOnKeyguard || mOnAmbient)) {
+        } else if (mIsSummaryWithChildren && !mOnKeyguard) {
             return mChildrenContainer.getIntrinsicHeight();
         } else if (isHeadsUpAllowed() && (mIsHeadsUp || mHeadsupDisappearRunning)) {
             if (isPinned() || mHeadsupDisappearRunning) {
@@ -3001,17 +2999,14 @@
 
     @Override
     public boolean isAboveShelf() {
-        return !isOnKeyguard()
+        return showingAmbientPulsing() || (!isOnKeyguard()
                 && (mIsPinned || mHeadsupDisappearRunning || (mIsHeadsUp && mAboveShelf)
-                || mExpandAnimationRunning || mChildIsExpanding);
+                || mExpandAnimationRunning || mChildIsExpanding));
     }
 
     public void setOnAmbient(boolean onAmbient) {
         if (onAmbient != mOnAmbient) {
             mOnAmbient = onAmbient;
-            if (mChildrenContainer != null) {
-                mChildrenContainer.notifyDozingStateChanged();
-            }
             notifyHeightChanged(false /* needsAnimation */);
         }
     }
@@ -3158,6 +3153,10 @@
         }
     }
 
+    public void setAmbientGoingAway(boolean goingAway) {
+        mAmbientGoingAway = goingAway;
+    }
+
     @VisibleForTesting
     protected void setChildrenContainer(NotificationChildrenContainer childrenContainer) {
         mChildrenContainer = childrenContainer;
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/notification/row/ExpandableView.java b/packages/SystemUI/src/com/android/systemui/statusbar/notification/row/ExpandableView.java
index d1a89b4..cac41da 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/notification/row/ExpandableView.java
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/notification/row/ExpandableView.java
@@ -527,6 +527,10 @@
     public void setHeadsUpIsVisible() {
     }
 
+    public boolean showingAmbientPulsing() {
+        return false;
+    }
+
     public boolean isChildInGroup() {
         return false;
     }
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/notification/row/HybridGroupManager.java b/packages/SystemUI/src/com/android/systemui/statusbar/notification/row/HybridGroupManager.java
index 90ff4a7..fe81957 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/notification/row/HybridGroupManager.java
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/notification/row/HybridGroupManager.java
@@ -36,7 +36,6 @@
 public class HybridGroupManager {
 
     private final Context mContext;
-    private final NotificationDozeHelper mDozer;
     private final ViewGroup mParent;
 
     private float mOverflowNumberSize;
@@ -47,7 +46,6 @@
     public HybridGroupManager(Context ctx, ViewGroup parent) {
         mContext = ctx;
         mParent = parent;
-        mDozer = new NotificationDozeHelper();
         initDimens();
     }
 
@@ -94,12 +92,6 @@
                 R.style.HybridNotification);
     }
 
-    public HybridNotificationView bindAmbientFromNotification(HybridNotificationView reusableView,
-            Notification notification) {
-        return bindFromNotificationWithStyle(reusableView, notification,
-                R.style.HybridNotification);
-    }
-
     private HybridNotificationView bindFromNotificationWithStyle(
             HybridNotificationView reusableView, Notification notification, int style) {
         if (reusableView == null) {
@@ -147,15 +139,4 @@
         updateOverFlowNumberColor(reusableView);
         return reusableView;
     }
-
-    public TextView bindOverflowNumberAmbient(TextView titleView, Notification notification,
-            int number) {
-        String text = mContext.getResources().getString(
-                R.string.notification_group_overflow_indicator_ambient,
-                resolveTitle(notification), number);
-        if (!text.equals(titleView.getText())) {
-            titleView.setText(text);
-        }
-        return titleView;
-    }
 }
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/notification/row/NotificationContentInflater.java b/packages/SystemUI/src/com/android/systemui/statusbar/notification/row/NotificationContentInflater.java
index b65c4a5..b4dd114 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/notification/row/NotificationContentInflater.java
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/notification/row/NotificationContentInflater.java
@@ -34,12 +34,17 @@
 
 import com.android.internal.annotations.VisibleForTesting;
 import com.android.internal.widget.ImageMessageConsumer;
+import com.android.systemui.Dependency;
 import com.android.systemui.statusbar.InflationTask;
+import com.android.systemui.statusbar.SmartReplyController;
 import com.android.systemui.statusbar.notification.InflationException;
 import com.android.systemui.statusbar.notification.MediaNotificationProcessor;
 import com.android.systemui.statusbar.notification.collection.NotificationEntry;
 import com.android.systemui.statusbar.notification.row.wrapper.NotificationViewWrapper;
 import com.android.systemui.statusbar.phone.StatusBar;
+import com.android.systemui.statusbar.policy.HeadsUpManager;
+import com.android.systemui.statusbar.policy.InflatedSmartReplies;
+import com.android.systemui.statusbar.policy.SmartReplyConstants;
 import com.android.systemui.util.Assert;
 
 import java.lang.annotation.Retention;
@@ -278,6 +283,8 @@
         InflationProgress result = createRemoteViews(reInflateFlags, builder, mIsLowPriority,
                 mIsChildInGroup, mUsesIncreasedHeight, mUsesIncreasedHeadsUpHeight,
                 mRedactAmbient, packageContext);
+        result = inflateSmartReplyViews(result, reInflateFlags, mRow.getEntry(),
+                mRow.getContext(), mRow.getHeadsUpManager());
         apply(
                 inflateSynchronously,
                 result,
@@ -306,6 +313,7 @@
                 if (mRow.getPrivateLayout().isContentViewInactive(VISIBLE_TYPE_HEADSUP)) {
                     mRow.getPrivateLayout().setHeadsUpChild(null);
                     mCachedContentViews.remove(FLAG_CONTENT_VIEW_HEADS_UP);
+                    mRow.getPrivateLayout().setHeadsUpInflatedSmartReplies(null);
                 }
                 break;
             case FLAG_CONTENT_VIEW_AMBIENT:
@@ -336,12 +344,33 @@
         }
     }
 
+    private static InflationProgress inflateSmartReplyViews(InflationProgress result,
+            @InflationFlag int reInflateFlags, NotificationEntry entry, Context context,
+            HeadsUpManager headsUpManager) {
+        SmartReplyConstants smartReplyConstants = Dependency.get(SmartReplyConstants.class);
+        SmartReplyController smartReplyController = Dependency.get(SmartReplyController.class);
+        if ((reInflateFlags & FLAG_CONTENT_VIEW_EXPANDED) != 0 && result.newExpandedView != null) {
+            result.expandedInflatedSmartReplies =
+                    InflatedSmartReplies.inflate(
+                            context, entry, smartReplyConstants, smartReplyController,
+                            headsUpManager);
+        }
+        if ((reInflateFlags & FLAG_CONTENT_VIEW_HEADS_UP) != 0 && result.newHeadsUpView != null) {
+            result.headsUpInflatedSmartReplies =
+                    InflatedSmartReplies.inflate(
+                            context, entry, smartReplyConstants, smartReplyController,
+                            headsUpManager);
+        }
+        return result;
+    }
+
     private static InflationProgress createRemoteViews(@InflationFlag int reInflateFlags,
             Notification.Builder builder, boolean isLowPriority, boolean isChildInGroup,
             boolean usesIncreasedHeight, boolean usesIncreasedHeadsUpHeight, boolean redactAmbient,
             Context packageContext) {
         InflationProgress result = new InflationProgress();
         isLowPriority = isLowPriority && !isChildInGroup;
+
         if ((reInflateFlags & FLAG_CONTENT_VIEW_CONTRACTED) != 0) {
             result.newContentView = createContentView(builder, isLowPriority, usesIncreasedHeight);
         }
@@ -661,6 +690,12 @@
                 } else if (result.newExpandedView == null) {
                     privateLayout.setExpandedChild(null);
                 }
+                if (result.newExpandedView != null) {
+                    privateLayout.setExpandedInflatedSmartReplies(
+                            result.expandedInflatedSmartReplies);
+                } else {
+                    privateLayout.setExpandedInflatedSmartReplies(null);
+                }
                 cachedContentViews.put(FLAG_CONTENT_VIEW_EXPANDED, result.newExpandedView);
                 row.setExpandable(result.newExpandedView != null);
             }
@@ -671,6 +706,12 @@
                 } else if (result.newHeadsUpView == null) {
                     privateLayout.setHeadsUpChild(null);
                 }
+                if (result.newHeadsUpView != null) {
+                    privateLayout.setHeadsUpInflatedSmartReplies(
+                            result.headsUpInflatedSmartReplies);
+                } else {
+                    privateLayout.setHeadsUpInflatedSmartReplies(null);
+                }
                 cachedContentViews.put(FLAG_CONTENT_VIEW_HEADS_UP, result.newHeadsUpView);
             }
 
@@ -846,9 +887,12 @@
                             packageContext);
                     processor.processNotification(notification, recoveredBuilder);
                 }
-                return createRemoteViews(mReInflateFlags, recoveredBuilder, mIsLowPriority,
+                InflationProgress inflationProgress = createRemoteViews(mReInflateFlags,
+                        recoveredBuilder, mIsLowPriority,
                         mIsChildInGroup, mUsesIncreasedHeight, mUsesIncreasedHeadsUpHeight,
                         mRedactAmbient, packageContext);
+                return inflateSmartReplyViews(inflationProgress, mReInflateFlags, mRow.getEntry(),
+                        mRow.getContext(), mRow.getHeadsUpManager());
             } catch (Exception e) {
                 mError = e;
                 return null;
@@ -927,6 +971,9 @@
         private View inflatedPublicView;
         private CharSequence headsUpStatusBarText;
         private CharSequence headsUpStatusBarTextPublic;
+
+        private InflatedSmartReplies expandedInflatedSmartReplies;
+        private InflatedSmartReplies headsUpInflatedSmartReplies;
     }
 
     @VisibleForTesting
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/notification/row/NotificationContentView.java b/packages/SystemUI/src/com/android/systemui/statusbar/notification/row/NotificationContentView.java
index 1dc48d4..7850035 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/notification/row/NotificationContentView.java
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/notification/row/NotificationContentView.java
@@ -19,7 +19,6 @@
 import android.annotation.Nullable;
 import android.app.Notification;
 import android.app.PendingIntent;
-import android.app.RemoteInput;
 import android.content.Context;
 import android.graphics.Rect;
 import android.os.Build;
@@ -28,7 +27,6 @@
 import android.util.ArraySet;
 import android.util.AttributeSet;
 import android.util.Log;
-import android.util.Pair;
 import android.view.MotionEvent;
 import android.view.NotificationHeaderView;
 import android.view.View;
@@ -39,7 +37,6 @@
 import android.widget.LinearLayout;
 
 import com.android.internal.annotations.VisibleForTesting;
-import com.android.internal.util.ArrayUtils;
 import com.android.internal.util.ContrastColorUtil;
 import com.android.systemui.Dependency;
 import com.android.systemui.R;
@@ -52,13 +49,14 @@
 import com.android.systemui.statusbar.notification.row.wrapper.NotificationCustomViewWrapper;
 import com.android.systemui.statusbar.notification.row.wrapper.NotificationViewWrapper;
 import com.android.systemui.statusbar.phone.NotificationGroupManager;
+import com.android.systemui.statusbar.policy.InflatedSmartReplies;
+import com.android.systemui.statusbar.policy.InflatedSmartReplies.SmartRepliesAndActions;
 import com.android.systemui.statusbar.policy.RemoteInputView;
 import com.android.systemui.statusbar.policy.SmartReplyConstants;
 import com.android.systemui.statusbar.policy.SmartReplyView;
 
 import java.io.FileDescriptor;
 import java.io.PrintWriter;
-import java.util.List;
 
 /**
  * A frame layout containing the actual payload of the notification, including the contracted,
@@ -74,7 +72,6 @@
     public static final int VISIBLE_TYPE_HEADSUP = 2;
     private static final int VISIBLE_TYPE_SINGLELINE = 3;
     public static final int VISIBLE_TYPE_AMBIENT = 4;
-    private static final int VISIBLE_TYPE_AMBIENT_SINGLELINE = 5;
     public static final int UNDEFINED = -1;
 
     private final Rect mClipBounds = new Rect();
@@ -86,7 +83,6 @@
     private View mHeadsUpChild;
     private HybridNotificationView mSingleLineView;
     private View mAmbientChild;
-    private HybridNotificationView mAmbientSingleLineChild;
 
     private RemoteInputView mExpandedRemoteInput;
     private RemoteInputView mHeadsUpRemoteInput;
@@ -95,6 +91,8 @@
     private SmartReplyView mExpandedSmartReplyView;
     private SmartReplyView mHeadsUpSmartReplyView;
     private SmartReplyController mSmartReplyController;
+    private InflatedSmartReplies mExpandedInflatedSmartReplies;
+    private InflatedSmartReplies mHeadsUpInflatedSmartReplies;
 
     private NotificationViewWrapper mContractedWrapper;
     private NotificationViewWrapper mExpandedWrapper;
@@ -301,27 +299,6 @@
                             : MeasureSpec.AT_MOST));
             maxChildHeight = Math.max(maxChildHeight, mAmbientChild.getMeasuredHeight());
         }
-        if (mAmbientSingleLineChild != null) {
-            int size = mNotificationAmbientHeight;
-            ViewGroup.LayoutParams layoutParams = mAmbientSingleLineChild.getLayoutParams();
-            boolean useExactly = false;
-            if (layoutParams.height >= 0) {
-                // An actual height is set
-                size = Math.min(size, layoutParams.height);
-                useExactly = true;
-            }
-            int ambientSingleLineWidthSpec = widthMeasureSpec;
-            if (mSingleLineWidthIndention != 0
-                    && MeasureSpec.getMode(widthMeasureSpec) != MeasureSpec.UNSPECIFIED) {
-                ambientSingleLineWidthSpec = MeasureSpec.makeMeasureSpec(
-                        width - mSingleLineWidthIndention + mAmbientSingleLineChild.getPaddingEnd(),
-                        MeasureSpec.EXACTLY);
-            }
-            mAmbientSingleLineChild.measure(ambientSingleLineWidthSpec,
-                    MeasureSpec.makeMeasureSpec(size, useExactly ? MeasureSpec.EXACTLY
-                            : MeasureSpec.AT_MOST));
-            maxChildHeight = Math.max(maxChildHeight, mAmbientSingleLineChild.getMeasuredHeight());
-        }
         int ownHeight = Math.min(maxChildHeight, maxSize);
         setMeasuredDimension(width, ownHeight);
     }
@@ -351,22 +328,10 @@
             if (mExpandedChild != null
                     && mExpandedWrapper.getNotificationHeader() != null) {
                 NotificationHeaderView expandedHeader = mExpandedWrapper.getNotificationHeader();
-                int expandedSize = expandedHeader.getMeasuredWidth()
-                        - expandedHeader.getPaddingEnd();
-                int collapsedSize = contractedHeader.getMeasuredWidth()
-                        - expandedHeader.getPaddingEnd();
-                if (expandedSize != collapsedSize) {
-                    int paddingEnd = contractedHeader.getMeasuredWidth() - expandedSize;
-                    contractedHeader.setPadding(
-                            contractedHeader.isLayoutRtl()
-                                    ? paddingEnd
-                                    : contractedHeader.getPaddingLeft(),
-                            contractedHeader.getPaddingTop(),
-                            contractedHeader.isLayoutRtl()
-                                    ? contractedHeader.getPaddingLeft()
-                                    : paddingEnd,
-                            contractedHeader.getPaddingBottom());
-                    contractedHeader.setShowWorkBadgeAtEnd(true);
+
+                int headerTextMargin = expandedHeader.getHeaderTextMarginEnd();
+                if (headerTextMargin != contractedHeader.getHeaderTextMarginEnd()) {
+                    contractedHeader.setHeaderTextMarginEnd(headerTextMargin);
                     return true;
                 }
             } else {
@@ -432,10 +397,6 @@
         return mAmbientChild;
     }
 
-    public HybridNotificationView getAmbientSingleLineChild() {
-        return mAmbientSingleLineChild;
-    }
-
     /**
      * Sets the contracted view. Child may be null to remove the content view.
      *
@@ -693,10 +654,7 @@
         int hint;
         if (mAmbientChild != null && isVisibleOrTransitioning(VISIBLE_TYPE_AMBIENT)) {
             hint = mAmbientChild.getHeight();
-        } else if (mAmbientSingleLineChild != null && isVisibleOrTransitioning(
-                VISIBLE_TYPE_AMBIENT_SINGLELINE)) {
-            hint = mAmbientSingleLineChild.getHeight();
-        } else if (mHeadsUpChild != null && isVisibleOrTransitioning(VISIBLE_TYPE_HEADSUP)) {
+        }  else if (mHeadsUpChild != null && isVisibleOrTransitioning(VISIBLE_TYPE_HEADSUP)) {
             hint = getViewHeight(VISIBLE_TYPE_HEADSUP);
         } else if (mExpandedChild != null) {
             hint = getViewHeight(VISIBLE_TYPE_EXPANDED);
@@ -793,11 +751,11 @@
     }
 
     public int getMaxHeight() {
-        if (mContainingNotification.isOnAmbient() && getShowingAmbientView() != null) {
-            return getShowingAmbientView().getHeight();
-        } else if (mExpandedChild != null) {
+        if (mExpandedChild != null) {
             return getViewHeight(VISIBLE_TYPE_EXPANDED)
                     + getExtraRemoteInputHeight(mExpandedRemoteInput);
+        } else if (mContainingNotification.isOnAmbient() && getShowingAmbientView() != null) {
+            return getShowingAmbientView().getHeight();
         } else if (mIsHeadsUp && mHeadsUpChild != null && !mContainingNotification.isOnKeyguard()) {
             return getViewHeight(VISIBLE_TYPE_HEADSUP)
                     + getExtraRemoteInputHeight(mHeadsUpRemoteInput);
@@ -833,7 +791,7 @@
     }
 
     public View getShowingAmbientView() {
-        View v = mIsChildInGroup ? mAmbientSingleLineChild : mAmbientChild;
+        View v = mIsChildInGroup ? mSingleLineView : mAmbientChild;
         if (v != null) {
             return v;
         } else {
@@ -923,8 +881,6 @@
         forceUpdateVisibility(VISIBLE_TYPE_HEADSUP, mHeadsUpChild, mHeadsUpWrapper);
         forceUpdateVisibility(VISIBLE_TYPE_SINGLELINE, mSingleLineView, mSingleLineView);
         forceUpdateVisibility(VISIBLE_TYPE_AMBIENT, mAmbientChild, mAmbientWrapper);
-        forceUpdateVisibility(VISIBLE_TYPE_AMBIENT_SINGLELINE, mAmbientSingleLineChild,
-                mAmbientSingleLineChild);
         fireExpandedVisibleListenerIfVisible();
         // forceUpdateVisibilities cancels outstanding animations without updating the
         // mAnimationStartVisibleType. Do so here instead.
@@ -1002,8 +958,6 @@
                 mSingleLineView, mSingleLineView);
         updateViewVisibility(visibleType, VISIBLE_TYPE_AMBIENT,
                 mAmbientChild, mAmbientWrapper);
-        updateViewVisibility(visibleType, VISIBLE_TYPE_AMBIENT_SINGLELINE,
-                mAmbientSingleLineChild, mAmbientSingleLineChild);
         fireExpandedVisibleListenerIfVisible();
         // updateViewVisibilities cancels outstanding animations without updating the
         // mAnimationStartVisibleType. Do so here instead.
@@ -1066,8 +1020,6 @@
                 return mSingleLineView;
             case VISIBLE_TYPE_AMBIENT:
                 return mAmbientWrapper;
-            case VISIBLE_TYPE_AMBIENT_SINGLELINE:
-                return mAmbientSingleLineChild;
             default:
                 return mContractedWrapper;
         }
@@ -1087,8 +1039,6 @@
                 return mSingleLineView;
             case VISIBLE_TYPE_AMBIENT:
                 return mAmbientChild;
-            case VISIBLE_TYPE_AMBIENT_SINGLELINE:
-                return mAmbientSingleLineChild;
             default:
                 return mContractedChild;
         }
@@ -1113,15 +1063,6 @@
      * @return one of the static enum types in this view, calculated form the current state
      */
     public int calculateVisibleType() {
-        if (mContainingNotification.isOnAmbient()) {
-            if (mIsChildInGroup && mAmbientSingleLineChild != null) {
-                return VISIBLE_TYPE_AMBIENT_SINGLELINE;
-            } else if (mAmbientChild != null) {
-                return VISIBLE_TYPE_AMBIENT;
-            } else {
-                return VISIBLE_TYPE_CONTRACTED;
-            }
-        }
         if (mUserExpanding) {
             int height = !mIsChildInGroup || isGroupExpanded()
                     || mContainingNotification.isExpanded(true /* allowOnKeyguard */)
@@ -1152,6 +1093,7 @@
         if (!noExpandedChild && viewHeight == getViewHeight(VISIBLE_TYPE_EXPANDED)) {
             return VISIBLE_TYPE_EXPANDED;
         }
+        boolean onAmbient = mContainingNotification.isOnAmbient();
         if (!mUserExpanding && mIsChildInGroup && !isGroupExpanded()) {
             return VISIBLE_TYPE_SINGLELINE;
         }
@@ -1164,11 +1106,13 @@
                 return VISIBLE_TYPE_EXPANDED;
             }
         } else {
+            int collapsedType = onAmbient && mAmbientChild != null ? VISIBLE_TYPE_AMBIENT :
+                    VISIBLE_TYPE_CONTRACTED;
             if (noExpandedChild || (mContractedChild != null
-                    && viewHeight <= getViewHeight(VISIBLE_TYPE_CONTRACTED)
+                    && viewHeight <= getViewHeight(collapsedType)
                     && (!mIsChildInGroup || isGroupExpanded()
                             || !mContainingNotification.isExpanded(true /* allowOnKeyguard */)))) {
-                return VISIBLE_TYPE_CONTRACTED;
+                return collapsedType;
             } else {
                 return VISIBLE_TYPE_EXPANDED;
             }
@@ -1264,7 +1208,6 @@
 
     private void updateAllSingleLineViews() {
         updateSingleLineView();
-        updateAmbientSingleLineView();
     }
 
     private void updateSingleLineView() {
@@ -1282,21 +1225,6 @@
         }
     }
 
-    private void updateAmbientSingleLineView() {
-        if (mIsChildInGroup) {
-            boolean isNewView = mAmbientSingleLineChild == null;
-            mAmbientSingleLineChild = mHybridGroupManager.bindAmbientFromNotification(
-                    mAmbientSingleLineChild, mStatusBarNotification.getNotification());
-            if (isNewView) {
-                updateViewVisibility(mVisibleType, VISIBLE_TYPE_AMBIENT_SINGLELINE,
-                        mAmbientSingleLineChild, mAmbientSingleLineChild);
-            }
-        } else if (mAmbientSingleLineChild != null) {
-            removeView(mAmbientSingleLineChild);
-            mAmbientSingleLineChild = null;
-        }
-    }
-
     private void applyMediaTransfer(final NotificationEntry entry) {
         View bigContentView = mExpandedChild;
         if (bigContentView == null || !entry.isMediaNotification()) {
@@ -1318,8 +1246,22 @@
             return;
         }
 
-        SmartRepliesAndActions smartRepliesAndActions =
-                chooseSmartRepliesAndActions(mSmartReplyConstants, entry);
+        applyRemoteInput(entry, InflatedSmartReplies.hasFreeformRemoteInput(entry));
+
+        if (mExpandedInflatedSmartReplies == null && mHeadsUpInflatedSmartReplies == null) {
+            if (DEBUG) {
+                Log.d(TAG, "Both expanded, and heads-up InflatedSmartReplies are null, "
+                        + "don't add smart replies.");
+            }
+            return;
+        }
+        // The inflated smart-reply objects for the expanded view and the heads-up view both contain
+        // the same SmartRepliesAndActions to avoid discrepancies between the two views. We here
+        // reuse that object for our local SmartRepliesAndActions to avoid discrepancies between
+        // this class and the InflatedSmartReplies classes.
+        SmartRepliesAndActions smartRepliesAndActions = mExpandedInflatedSmartReplies != null
+                ? mExpandedInflatedSmartReplies.getSmartRepliesAndActions()
+                : mHeadsUpInflatedSmartReplies.getSmartRepliesAndActions();
         if (DEBUG) {
             Log.d(TAG, String.format("Adding suggestions for %s, %d actions, and %d replies.",
                     entry.notification.getKey(),
@@ -1328,86 +1270,9 @@
                     smartRepliesAndActions.smartReplies == null ? 0 :
                             smartRepliesAndActions.smartReplies.choices.length));
         }
-
-        applyRemoteInput(entry, smartRepliesAndActions.hasFreeformRemoteInput);
         applySmartReplyView(smartRepliesAndActions, entry);
     }
 
-    /**
-     * Chose what smart replies and smart actions to display. App generated suggestions take
-     * precedence. So if the app provides any smart replies, we don't show any
-     * replies or actions generated by the NotificationAssistantService (NAS), and if the app
-     * provides any smart actions we also don't show any NAS-generated replies or actions.
-     */
-    @VisibleForTesting
-    static SmartRepliesAndActions chooseSmartRepliesAndActions(
-            SmartReplyConstants smartReplyConstants,
-            final NotificationEntry entry) {
-        Notification notification = entry.notification.getNotification();
-        Pair<RemoteInput, Notification.Action> remoteInputActionPair =
-                notification.findRemoteInputActionPair(false /* freeform */);
-        Pair<RemoteInput, Notification.Action> freeformRemoteInputActionPair =
-                notification.findRemoteInputActionPair(true /* freeform */);
-
-        if (!smartReplyConstants.isEnabled()) {
-            if (DEBUG) {
-                Log.d(TAG, "Smart suggestions not enabled, not adding suggestions for "
-                        + entry.notification.getKey());
-            }
-            return new SmartRepliesAndActions(null, null, freeformRemoteInputActionPair != null);
-        }
-        // Only use smart replies from the app if they target P or above. We have this check because
-        // the smart reply API has been used for other things (Wearables) in the past. The API to
-        // add smart actions is new in Q so it doesn't require a target-sdk check.
-        boolean enableAppGeneratedSmartReplies = (!smartReplyConstants.requiresTargetingP()
-                || entry.targetSdk >= Build.VERSION_CODES.P);
-
-        boolean appGeneratedSmartRepliesExist =
-                enableAppGeneratedSmartReplies
-                        && remoteInputActionPair != null
-                        && !ArrayUtils.isEmpty(remoteInputActionPair.first.getChoices())
-                        && remoteInputActionPair.second.actionIntent != null;
-
-        List<Notification.Action> appGeneratedSmartActions = notification.getContextualActions();
-        boolean appGeneratedSmartActionsExist = !appGeneratedSmartActions.isEmpty();
-
-        SmartReplyView.SmartReplies smartReplies = null;
-        SmartReplyView.SmartActions smartActions = null;
-        if (appGeneratedSmartRepliesExist) {
-            smartReplies = new SmartReplyView.SmartReplies(
-                    remoteInputActionPair.first.getChoices(),
-                    remoteInputActionPair.first,
-                    remoteInputActionPair.second.actionIntent,
-                    false /* fromAssistant */);
-        }
-        if (appGeneratedSmartActionsExist) {
-            smartActions = new SmartReplyView.SmartActions(appGeneratedSmartActions,
-                    false /* fromAssistant */);
-        }
-        // Apps didn't provide any smart replies / actions, use those from NAS (if any).
-        if (!appGeneratedSmartRepliesExist && !appGeneratedSmartActionsExist) {
-            boolean useGeneratedReplies = !ArrayUtils.isEmpty(entry.systemGeneratedSmartReplies)
-                    && freeformRemoteInputActionPair != null
-                    && freeformRemoteInputActionPair.second.getAllowGeneratedReplies()
-                    && freeformRemoteInputActionPair.second.actionIntent != null;
-            if (useGeneratedReplies) {
-                smartReplies = new SmartReplyView.SmartReplies(
-                        entry.systemGeneratedSmartReplies,
-                        freeformRemoteInputActionPair.first,
-                        freeformRemoteInputActionPair.second.actionIntent,
-                        true /* fromAssistant */);
-            }
-            boolean useSmartActions = !ArrayUtils.isEmpty(entry.systemGeneratedSmartActions)
-                    && notification.getAllowSystemGeneratedContextualActions();
-            if (useSmartActions) {
-                smartActions = new SmartReplyView.SmartActions(
-                        entry.systemGeneratedSmartActions, true /* fromAssistant */);
-            }
-        }
-        return new SmartRepliesAndActions(
-                smartReplies, smartActions, freeformRemoteInputActionPair != null);
-    }
-
     private void applyRemoteInput(NotificationEntry entry, boolean hasFreeformRemoteInput) {
         View bigContentView = mExpandedChild;
         if (bigContentView != null) {
@@ -1507,11 +1372,12 @@
         return null;
     }
 
-    private void applySmartReplyView(SmartRepliesAndActions smartRepliesAndActions,
+    private void applySmartReplyView(
+            SmartRepliesAndActions smartRepliesAndActions,
             NotificationEntry entry) {
         if (mExpandedChild != null) {
-            mExpandedSmartReplyView =
-                    applySmartReplyView(mExpandedChild, smartRepliesAndActions, entry);
+            mExpandedSmartReplyView = applySmartReplyView(mExpandedChild, smartRepliesAndActions,
+                    entry, mExpandedInflatedSmartReplies);
             if (mExpandedSmartReplyView != null) {
                 if (smartRepliesAndActions.smartReplies != null
                         || smartRepliesAndActions.smartActions != null) {
@@ -1533,65 +1399,79 @@
             }
         }
         if (mHeadsUpChild != null && mSmartReplyConstants.getShowInHeadsUp()) {
-            mHeadsUpSmartReplyView =
-                    applySmartReplyView(mHeadsUpChild, smartRepliesAndActions, entry);
+            mHeadsUpSmartReplyView = applySmartReplyView(mHeadsUpChild, smartRepliesAndActions,
+                    entry, mHeadsUpInflatedSmartReplies);
         }
     }
 
+    @Nullable
     private SmartReplyView applySmartReplyView(View view,
-            SmartRepliesAndActions smartRepliesAndActions, NotificationEntry entry) {
+            SmartRepliesAndActions smartRepliesAndActions,
+            NotificationEntry entry, InflatedSmartReplies inflatedSmartReplyView) {
         View smartReplyContainerCandidate = view.findViewById(
                 com.android.internal.R.id.smart_reply_container);
         if (!(smartReplyContainerCandidate instanceof LinearLayout)) {
             return null;
         }
+
         LinearLayout smartReplyContainer = (LinearLayout) smartReplyContainerCandidate;
-        // If there are no smart replies and no smart actions - early out.
-        if (smartRepliesAndActions.smartReplies == null
-                && smartRepliesAndActions.smartActions == null) {
+        if (!InflatedSmartReplies.shouldShowSmartReplyView(entry, smartRepliesAndActions)) {
             smartReplyContainer.setVisibility(View.GONE);
             return null;
         }
-        // If we are showing the spinner we don't want to add the buttons.
-        boolean showingSpinner = entry.notification.getNotification()
-                .extras.getBoolean(Notification.EXTRA_SHOW_REMOTE_INPUT_SPINNER, false);
-        if (showingSpinner) {
-            smartReplyContainer.setVisibility(View.GONE);
-            return null;
-        }
-        // If we are keeping the notification around while sending we don't want to add the buttons.
-        boolean hideSmartReplies = entry.notification.getNotification()
-                .extras.getBoolean(Notification.EXTRA_HIDE_SMART_REPLIES, false);
-        if (hideSmartReplies) {
-            smartReplyContainer.setVisibility(View.GONE);
-            return null;
-        }
+
         SmartReplyView smartReplyView = null;
-        if (smartReplyContainer.getChildCount() == 0) {
-            smartReplyView = SmartReplyView.inflate(mContext, smartReplyContainer);
+        if (smartReplyContainer.getChildCount() == 1
+                && smartReplyContainer.getChildAt(0) instanceof SmartReplyView) {
+            // If we already have a SmartReplyView - replace it with the newly inflated one. The
+            // newly inflated one is connected to the new inflated smart reply/action buttons.
+            smartReplyContainer.removeAllViews();
+        }
+        if (smartReplyContainer.getChildCount() == 0
+                && inflatedSmartReplyView != null
+                && inflatedSmartReplyView.getSmartReplyView() != null) {
+            smartReplyView = inflatedSmartReplyView.getSmartReplyView();
             smartReplyContainer.addView(smartReplyView);
-        } else if (smartReplyContainer.getChildCount() == 1) {
-            View child = smartReplyContainer.getChildAt(0);
-            if (child instanceof SmartReplyView) {
-                smartReplyView = (SmartReplyView) child;
-            }
         }
         if (smartReplyView != null) {
             smartReplyView.resetSmartSuggestions(smartReplyContainer);
-            if (smartRepliesAndActions.smartReplies != null) {
-                smartReplyView.addRepliesFromRemoteInput(
-                        smartRepliesAndActions.smartReplies, mSmartReplyController, entry);
-            }
-            if (smartRepliesAndActions.smartActions != null) {
-                smartReplyView.addSmartActions(
-                        smartRepliesAndActions.smartActions, mSmartReplyController, entry,
-                        mContainingNotification.getHeadsUpManager());
-            }
+            smartReplyView.addPreInflatedButtons(
+                    inflatedSmartReplyView.getSmartSuggestionButtons());
             smartReplyContainer.setVisibility(View.VISIBLE);
         }
         return smartReplyView;
     }
 
+    /**
+     * Set pre-inflated views necessary to display smart replies and actions in the expanded
+     * notification state.
+     *
+     * @param inflatedSmartReplies the pre-inflated state to add to this view. If null the existing
+     * {@link SmartReplyView} related to the expanded notification state is cleared.
+     */
+    public void setExpandedInflatedSmartReplies(
+            @Nullable InflatedSmartReplies inflatedSmartReplies) {
+        mExpandedInflatedSmartReplies = inflatedSmartReplies;
+        if (inflatedSmartReplies == null) {
+            mExpandedSmartReplyView = null;
+        }
+    }
+
+    /**
+     * Set pre-inflated views necessary to display smart replies and actions in the heads-up
+     * notification state.
+     *
+     * @param inflatedSmartReplies the pre-inflated state to add to this view. If null the existing
+     * {@link SmartReplyView} related to the heads-up notification state is cleared.
+     */
+    public void setHeadsUpInflatedSmartReplies(
+            @Nullable InflatedSmartReplies inflatedSmartReplies) {
+        mHeadsUpInflatedSmartReplies = inflatedSmartReplies;
+        if (inflatedSmartReplies == null) {
+            mHeadsUpSmartReplyView = null;
+        }
+    }
+
     public void closeRemoteInput() {
         if (mHeadsUpRemoteInput != null) {
             mHeadsUpRemoteInput.close();
@@ -2005,22 +1885,4 @@
         }
         pw.println();
     }
-
-    @VisibleForTesting
-    static class SmartRepliesAndActions {
-        @Nullable
-        public final SmartReplyView.SmartReplies smartReplies;
-        @Nullable
-        public final SmartReplyView.SmartActions smartActions;
-        public final boolean hasFreeformRemoteInput;
-
-        SmartRepliesAndActions(
-                @Nullable SmartReplyView.SmartReplies smartReplies,
-                @Nullable SmartReplyView.SmartActions smartActions,
-                boolean hasFreeformRemoteInput) {
-            this.smartReplies = smartReplies;
-            this.smartActions = smartActions;
-            this.hasFreeformRemoteInput = hasFreeformRemoteInput;
-        }
-    }
 }
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/notification/row/wrapper/NotificationMediaTemplateViewWrapper.java b/packages/SystemUI/src/com/android/systemui/statusbar/notification/row/wrapper/NotificationMediaTemplateViewWrapper.java
index ddda3e5..99f5874 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/notification/row/wrapper/NotificationMediaTemplateViewWrapper.java
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/notification/row/wrapper/NotificationMediaTemplateViewWrapper.java
@@ -36,6 +36,7 @@
 
 import com.android.internal.R;
 import com.android.systemui.Dependency;
+import com.android.systemui.statusbar.NotificationMediaManager;
 import com.android.systemui.statusbar.TransformableView;
 import com.android.systemui.statusbar.notification.row.ExpandableNotificationRow;
 
@@ -58,12 +59,10 @@
     private TextView mSeekBarTotalTime;
     private long mDuration = 0;
     private MediaController mMediaController;
+    private NotificationMediaManager mMediaManager;
     private View mSeekBarView;
     private Context mContext;
 
-    // TODO: implement as phenotype flag
-    public static final boolean HIDE_COMPACT_SCRUBBER = true;
-
     private SeekBar.OnSeekBarChangeListener mSeekListener = new SeekBar.OnSeekBarChangeListener() {
         @Override
         public void onProgressChanged(SeekBar seekBar, int progress, boolean fromUser) {
@@ -102,6 +101,7 @@
             ExpandableNotificationRow row) {
         super(ctx, view, row);
         mContext = ctx;
+        mMediaManager = Dependency.get(NotificationMediaManager.class);
     }
 
     private void resolveViews() {
@@ -110,7 +110,8 @@
         final MediaSession.Token token = mRow.getEntry().notification.getNotification().extras
                 .getParcelable(Notification.EXTRA_MEDIA_SESSION);
 
-        if (token == null || (COMPACT_MEDIA_TAG.equals(mView.getTag()) && HIDE_COMPACT_SCRUBBER)) {
+        boolean showCompactSeekbar = mMediaManager.getShowCompactMediaSeekbar();
+        if (token == null || (COMPACT_MEDIA_TAG.equals(mView.getTag()) && !showCompactSeekbar)) {
             if (mSeekBarView != null) {
                 mSeekBarView.setVisibility(View.GONE);
             }
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/notification/stack/AmbientState.java b/packages/SystemUI/src/com/android/systemui/statusbar/notification/stack/AmbientState.java
index c246af5..ce92280 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/notification/stack/AmbientState.java
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/notification/stack/AmbientState.java
@@ -18,6 +18,7 @@
 
 import android.annotation.Nullable;
 import android.content.Context;
+import android.util.MathUtils;
 import android.view.View;
 
 import com.android.systemui.Dependency;
@@ -39,6 +40,7 @@
 public class AmbientState {
 
     private static final int NO_SECTION_BOUNDARY = -1;
+    private static final float MAX_PULSE_HEIGHT = 100000f;
 
     private ArrayList<ExpandableView> mDraggedViews = new ArrayList<>();
     private int mScrollY;
@@ -79,6 +81,8 @@
     private ExpandableNotificationRow mExpandingNotification;
     private float mDarkAmount;
     private boolean mAppearing;
+    private float mPulseHeight = MAX_PULSE_HEIGHT;
+    private float mDozeAmount = 0.0f;
 
     public AmbientState(Context context) {
         mSectionBoundaryIndices.add(NO_SECTION_BOUNDARY);
@@ -181,6 +185,10 @@
 
     /** Dark ratio of the status bar **/
     public void setDarkAmount(float darkAmount) {
+        if (darkAmount == 1.0f && mDarkAmount != darkAmount) {
+            // Whenever we are fully dark, let's reset the pulseHeight again
+            mPulseHeight = MAX_PULSE_HEIGHT;
+        }
         mDarkAmount = darkAmount;
     }
 
@@ -279,7 +287,28 @@
     }
 
     public int getInnerHeight() {
-        return Math.max(Math.min(mLayoutHeight, mMaxLayoutHeight) - mTopPadding, mLayoutMinHeight);
+        return getInnerHeight(false /* ignorePulseHeight */);
+    }
+
+    /**
+     * @param ignorePulseHeight ignore the pulse height for this request
+     * @return the inner height of the algorithm.
+     */
+    public int getInnerHeight(boolean ignorePulseHeight) {
+        if (mDozeAmount == 1.0f && !isPulseExpanding()) {
+            return mShelf.getHeight();
+        }
+        int height = Math.max(mLayoutMinHeight,
+                Math.min(mLayoutHeight, mMaxLayoutHeight) - mTopPadding);
+        if (ignorePulseHeight) {
+            return height;
+        }
+        float pulseHeight = Math.min(mPulseHeight, (float) height);
+        return (int) MathUtils.lerp(height, pulseHeight, mDozeAmount);
+    }
+
+    public boolean isPulseExpanding() {
+        return mPulseHeight != MAX_PULSE_HEIGHT && mDozeAmount != 0.0f && mDarkAmount != 1.0f;
     }
 
     public boolean isShadeExpanded() {
@@ -425,19 +454,6 @@
     }
 
     /**
-     * Similar to the normal is above shelf logic but doesn't allow it to be above in AOD1.
-     *
-     * @param expandableView the view to check
-     */
-    public boolean isAboveShelf(ExpandableView expandableView) {
-        if (!(expandableView instanceof ExpandableNotificationRow)) {
-            return expandableView.isAboveShelf();
-        }
-        ExpandableNotificationRow row = (ExpandableNotificationRow) expandableView;
-        return row.isAboveShelf() && !isDozingAndNotPulsing(row);
-    }
-
-    /**
      * @return whether a view is dozing and not pulsing right now
      */
     public boolean isDozingAndNotPulsing(ExpandableView view) {
@@ -488,4 +504,26 @@
     public boolean isAppearing() {
         return mAppearing;
     }
+
+    public void setPulseHeight(float height) {
+        mPulseHeight = height;
+    }
+
+    public void setDozeAmount(float dozeAmount) {
+        if (dozeAmount != mDozeAmount) {
+            mDozeAmount = dozeAmount;
+            if (dozeAmount == 0.0f || dozeAmount == 1.0f) {
+                // We woke all the way up, let's reset the pulse height
+                mPulseHeight = MAX_PULSE_HEIGHT;
+            }
+        }
+    }
+
+    /**
+     * Is the device fully awake, which is different from not tark at all when there are pulsing
+     * notifications.
+     */
+    public boolean isFullyAwake() {
+        return mDozeAmount == 0.0f;
+    }
 }
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/notification/stack/AnimationFilter.java b/packages/SystemUI/src/com/android/systemui/statusbar/notification/stack/AnimationFilter.java
index 507cf07..a471d87 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/notification/stack/AnimationFilter.java
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/notification/stack/AnimationFilter.java
@@ -132,10 +132,6 @@
                 // to look nice
                 customDelay = StackStateAnimator.ANIMATION_DELAY_HEADS_UP_CLICKED
                         + StackStateAnimator.ANIMATION_DELAY_HEADS_UP;
-            } else if (ev.animationType == NotificationStackScrollLayout.AnimationEvent
-                    .ANIMATION_TYPE_PULSE_APPEAR || ev.animationType ==
-                    NotificationStackScrollLayout.AnimationEvent.ANIMATION_TYPE_PULSE_DISAPPEAR) {
-                customDelay = StackStateAnimator.ANIMATION_DURATION_PULSE_APPEAR / 2;
             }
         }
     }
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/notification/stack/NotificationChildrenContainer.java b/packages/SystemUI/src/com/android/systemui/statusbar/notification/stack/NotificationChildrenContainer.java
index 8ffada4..6632ae6 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/notification/stack/NotificationChildrenContainer.java
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/notification/stack/NotificationChildrenContainer.java
@@ -55,8 +55,6 @@
     static final int NUMBER_OF_CHILDREN_WHEN_SYSTEM_EXPANDED = 5;
     @VisibleForTesting
     static final int NUMBER_OF_CHILDREN_WHEN_CHILDREN_EXPANDED = 8;
-    @VisibleForTesting
-    static final int NUMBER_OF_CHILDREN_WHEN_AMBIENT = 1;
     private static final AnimationProperties ALPHA_FADE_IN = new AnimationProperties() {
         private AnimationFilter mAnimationFilter = new AnimationFilter().animateAlpha();
 
@@ -95,8 +93,6 @@
     private NotificationViewWrapper mNotificationHeaderWrapper;
     private NotificationHeaderView mNotificationHeaderLowPriority;
     private NotificationViewWrapper mNotificationHeaderWrapperLowPriority;
-    private ViewGroup mNotificationHeaderAmbient;
-    private NotificationViewWrapper mNotificationHeaderWrapperAmbient;
     private NotificationHeaderUtil mHeaderUtil;
     private ViewState mHeaderViewState;
     private int mClipBottomAmount;
@@ -180,11 +176,6 @@
                     mNotificationHeaderLowPriority.getMeasuredWidth(),
                     mNotificationHeaderLowPriority.getMeasuredHeight());
         }
-        if (mNotificationHeaderAmbient != null) {
-            mNotificationHeaderAmbient.layout(0, 0,
-                    mNotificationHeaderAmbient.getMeasuredWidth(),
-                    mNotificationHeaderAmbient.getMeasuredHeight());
-        }
     }
 
     @Override
@@ -212,8 +203,7 @@
             // We need to measure all children even the GONE ones, such that the heights are
             // calculated correctly as they are used to calculate how many we can fit on the screen.
             boolean isOverflow = i == overflowIndex;
-            child.setSingleLineWidthIndention(isOverflow && mOverflowNumber != null &&
-                    !mContainingNotification.isOnAmbient()
+            child.setSingleLineWidthIndention(isOverflow && mOverflowNumber != null
                     ? mOverflowNumber.getMeasuredWidth() : 0);
             child.measure(widthMeasureSpec, newHeightSpec);
             // layout the divider
@@ -236,10 +226,6 @@
             headerHeightSpec = MeasureSpec.makeMeasureSpec(mHeaderHeight, MeasureSpec.EXACTLY);
             mNotificationHeaderLowPriority.measure(widthMeasureSpec, headerHeightSpec);
         }
-        if (mNotificationHeaderAmbient != null) {
-            headerHeightSpec = MeasureSpec.makeMeasureSpec(mHeaderHeight, MeasureSpec.EXACTLY);
-            mNotificationHeaderAmbient.measure(widthMeasureSpec, headerHeightSpec);
-        }
 
         setMeasuredDimension(width, height);
     }
@@ -332,33 +318,10 @@
         }
         mNotificationHeaderWrapper.onContentUpdated(mContainingNotification);
         recreateLowPriorityHeader(builder);
-        recreateAmbientHeader(builder);
         updateHeaderVisibility(false /* animate */);
         updateChildrenHeaderAppearance();
     }
 
-    private void recreateAmbientHeader(Notification.Builder builder) {
-        RemoteViews header;
-        StatusBarNotification notification = mContainingNotification.getStatusBarNotification();
-        if (builder == null) {
-            builder = Notification.Builder.recoverBuilder(getContext(),
-                    notification.getNotification());
-        }
-        header = builder.makeNotificationHeader();
-        if (mNotificationHeaderAmbient == null) {
-            mNotificationHeaderAmbient = (ViewGroup) header.apply(getContext(), this);
-            mNotificationHeaderWrapperAmbient = NotificationViewWrapper.wrap(getContext(),
-                    mNotificationHeaderAmbient, mContainingNotification);
-            mNotificationHeaderWrapperAmbient.onContentUpdated(mContainingNotification);
-            addView(mNotificationHeaderAmbient, 0);
-            invalidate();
-        } else {
-            header.reapply(getContext(), mNotificationHeaderAmbient);
-        }
-        resetHeaderVisibilityIfNeeded(mNotificationHeaderAmbient, calculateDesiredHeader());
-        mNotificationHeaderWrapperAmbient.onContentUpdated(mContainingNotification);
-    }
-
     /**
      * Recreate the low-priority header.
      *
@@ -406,17 +369,6 @@
         if (childCount > maxAllowedVisibleChildren) {
             int number = childCount - maxAllowedVisibleChildren;
             mOverflowNumber = mHybridGroupManager.bindOverflowNumber(mOverflowNumber, number);
-            if (mContainingNotification.isOnAmbient()) {
-                ExpandableNotificationRow overflowView = mChildren.get(0);
-                HybridNotificationView ambientSingleLineView = overflowView == null ? null
-                        : overflowView.getAmbientSingleLineView();
-                if (ambientSingleLineView != null) {
-                    mHybridGroupManager.bindOverflowNumberAmbient(
-                            ambientSingleLineView.getTitleView(),
-                            mContainingNotification.getStatusBarNotification().getNotification(),
-                            number);
-                }
-            }
             if (mGroupOverFlowState == null) {
                 mGroupOverFlowState = new ViewState();
                 mNeverAppliedGroupState = true;
@@ -522,7 +474,7 @@
         if (mUserLocked) {
             expandFactor = getGroupExpandFraction();
         }
-        boolean childrenExpanded = mChildrenExpanded || mContainingNotification.isOnAmbient();
+        boolean childrenExpanded = mChildrenExpanded;
         for (int i = 0; i < childCount; i++) {
             if (visibleChildren >= maxAllowedVisibleChildren) {
                 break;
@@ -563,7 +515,7 @@
     /**
      * Update the state of all its children based on a linear layout algorithm.
      * @param parentState the state of the parent
-     * @param ambientState
+     * @param ambientState the ambient state containing ambient information
      */
     public void updateState(ExpandableViewState parentState, AmbientState ambientState) {
         int childCount = mChildren.size();
@@ -639,9 +591,7 @@
                     getMaxAllowedVisibleChildren(true /* likeCollapsed */), childCount) - 1);
             mGroupOverFlowState.copyFrom(overflowView.getViewState());
 
-            if (mContainingNotification.isOnAmbient()) {
-                mGroupOverFlowState.alpha = 0.0f;
-            } else if (!mChildrenExpanded) {
+            if (!mChildrenExpanded) {
                 HybridNotificationView alignView = overflowView.getSingleLineView();
                 if (alignView != null) {
                     View mirrorView = alignView.getTextView();
@@ -708,9 +658,6 @@
 
     @VisibleForTesting
     int getMaxAllowedVisibleChildren(boolean likeCollapsed) {
-        if (mContainingNotification.isOnAmbient()) {
-            return NUMBER_OF_CHILDREN_WHEN_AMBIENT;
-        }
         if (!likeCollapsed && (mChildrenExpanded || mContainingNotification.isUserLocked())
                 && !showingAsLowPriority()) {
             return NUMBER_OF_CHILDREN_WHEN_CHILDREN_EXPANDED;
@@ -900,11 +847,6 @@
         return mCurrentHeader;
     }
 
-    public void notifyDozingStateChanged() {
-        updateHeaderVisibility(false);
-        updateGroupOverflow();
-    }
-
     private void updateHeaderVisibility(boolean animate) {
         ViewGroup desiredHeader;
         ViewGroup currentHeader = mCurrentHeader;
@@ -913,10 +855,6 @@
         if (currentHeader == desiredHeader) {
             return;
         }
-        if (desiredHeader == mNotificationHeaderAmbient
-                || currentHeader == mNotificationHeaderAmbient) {
-            animate = false;
-        }
 
         if (animate) {
             if (desiredHeader != null && currentHeader != null) {
@@ -948,7 +886,6 @@
         }
 
         resetHeaderVisibilityIfNeeded(mNotificationHeader, desiredHeader);
-        resetHeaderVisibilityIfNeeded(mNotificationHeaderAmbient, desiredHeader);
         resetHeaderVisibilityIfNeeded(mNotificationHeaderLowPriority, desiredHeader);
 
         mCurrentHeader = desiredHeader;
@@ -970,9 +907,7 @@
 
     private ViewGroup calculateDesiredHeader() {
         ViewGroup desiredHeader;
-        if (mContainingNotification.isOnAmbient()) {
-            desiredHeader = mNotificationHeaderAmbient;
-        } else if (showingAsLowPriority()) {
+        if (showingAsLowPriority()) {
             desiredHeader = mNotificationHeaderLowPriority;
         } else {
             desiredHeader = mNotificationHeader;
@@ -1015,9 +950,6 @@
         if (visibleHeader == mNotificationHeader) {
             return mNotificationHeaderWrapper;
         }
-        if (visibleHeader == mNotificationHeaderAmbient) {
-            return mNotificationHeaderWrapperAmbient;
-        }
         return mNotificationHeaderWrapperLowPriority;
     }
 
@@ -1126,9 +1058,7 @@
     }
 
     public int getMinHeight() {
-        return getMinHeight(mContainingNotification.isOnAmbient()
-                ? NUMBER_OF_CHILDREN_WHEN_AMBIENT
-                : NUMBER_OF_CHILDREN_WHEN_COLLAPSED, false /* likeHighPriority */);
+        return getMinHeight(NUMBER_OF_CHILDREN_WHEN_COLLAPSED, false /* likeHighPriority */);
     }
 
     public int getCollapsedHeight() {
@@ -1180,10 +1110,6 @@
             removeView(mNotificationHeaderLowPriority);
             mNotificationHeaderLowPriority = null;
         }
-        if (mNotificationHeaderAmbient != null) {
-            removeView(mNotificationHeaderAmbient);
-            mNotificationHeaderAmbient = null;
-        }
         recreateNotificationHeader(listener);
         initDimens();
         for (int i = 0; i < mDividers.size(); i++) {
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/notification/stack/NotificationSection.java b/packages/SystemUI/src/com/android/systemui/statusbar/notification/stack/NotificationSection.java
index 40cfd4d..dd6d383 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/notification/stack/NotificationSection.java
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/notification/stack/NotificationSection.java
@@ -228,4 +228,67 @@
         return (mBottomAnimator == null && mCurrentBounds.bottom == bottom)
                 || (mBottomAnimator != null && mEndAnimationRect.bottom == bottom);
     }
+
+    /**
+     * Update the bounds of this section based on it's views
+     *
+     * @param minTopPosition the minimum position that the top needs to have
+     * @param minBottomPosition the minimum position that the bottom needs to have
+     * @return the position of the new bottom
+     */
+    public int updateBounds(int minTopPosition, int minBottomPosition,
+            boolean shiftBackgroundWithFirst) {
+        int top = minTopPosition;
+        int bottom = minTopPosition;
+        ActivatableNotificationView firstView = getFirstVisibleChild();
+        if (firstView != null) {
+            // Round Y up to avoid seeing the background during animation
+            int finalTranslationY = (int) Math.ceil(ViewState.getFinalTranslationY(firstView));
+            // TODO: look into the already animating part
+            int newTop;
+            if (isTargetTop(finalTranslationY)) {
+                // we're ending up at the same location as we are now, let's just skip the
+                // animation
+                newTop = finalTranslationY;
+            } else {
+                newTop = (int) Math.ceil(firstView.getTranslationY());
+            }
+            top = Math.max(newTop, top);
+            if (firstView.showingAmbientPulsing()) {
+                // If we're pulsing, the notification can actually go below!
+                bottom = Math.max(bottom, finalTranslationY
+                        + ExpandableViewState.getFinalActualHeight(firstView));
+                if (shiftBackgroundWithFirst) {
+                    mBounds.left += Math.max(firstView.getTranslation(), 0);
+                }
+            }
+        }
+        top = Math.max(minTopPosition, top);
+        ActivatableNotificationView lastView = getLastVisibleChild();
+        if (lastView != null) {
+            float finalTranslationY = ViewState.getFinalTranslationY(lastView);
+            int finalHeight = ExpandableViewState.getFinalActualHeight(lastView);
+            // Round Y down to avoid seeing the background during animation
+            int finalBottom = (int) Math.floor(
+                    finalTranslationY + finalHeight - lastView.getClipBottomAmount());
+            int newBottom;
+            if (isTargetBottom(finalBottom)) {
+                // we're ending up at the same location as we are now, lets just skip the animation
+                newBottom = finalBottom;
+            } else {
+                newBottom = (int) (lastView.getTranslationY() + lastView.getActualHeight()
+                        - lastView.getClipBottomAmount());
+                // The background can never be lower than the end of the last view
+                minBottomPosition = (int) Math.min(
+                        lastView.getTranslationY() + lastView.getActualHeight(),
+                        minBottomPosition);
+            }
+            bottom = Math.max(bottom, Math.max(newBottom, minBottomPosition));
+        }
+        bottom = Math.max(top, bottom);
+        mBounds.top = top;
+        mBounds.bottom = bottom;
+        return bottom;
+    }
+
 }
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/notification/stack/NotificationStackScrollLayout.java b/packages/SystemUI/src/com/android/systemui/statusbar/notification/stack/NotificationStackScrollLayout.java
index fbf1e31..a54de5f 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/notification/stack/NotificationStackScrollLayout.java
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/notification/stack/NotificationStackScrollLayout.java
@@ -88,6 +88,7 @@
 import com.android.systemui.plugins.statusbar.NotificationSwipeActionHelper;
 import com.android.systemui.plugins.statusbar.StatusBarStateController;
 import com.android.systemui.plugins.statusbar.StatusBarStateController.StateListener;
+import com.android.systemui.statusbar.AmbientPulseManager;
 import com.android.systemui.statusbar.CommandQueue;
 import com.android.systemui.statusbar.DragDownHelper.DragDownCallback;
 import com.android.systemui.statusbar.EmptyShadeView;
@@ -167,6 +168,7 @@
      * gap is drawn between them). In this case we don't want to round their corners.
      */
     private static final int DISTANCE_BETWEEN_ADJACENT_SECTIONS_PX = 1;
+    private final AmbientPulseManager mAmbientPulseManager;
 
     private ExpandHelper mExpandHelper;
     private final NotificationSwipeHelper mSwipeHelper;
@@ -363,6 +365,7 @@
     };
     protected ViewGroup mQsContainer;
     private boolean mContinuousShadowUpdate;
+    private boolean mContinuousBackgroundUpdate;
     private ViewTreeObserver.OnPreDrawListener mShadowUpdater
             = new ViewTreeObserver.OnPreDrawListener() {
 
@@ -372,6 +375,10 @@
             return true;
         }
     };
+    private ViewTreeObserver.OnPreDrawListener mBackgroundUpdater = () -> {
+                updateBackground();
+                return true;
+            };
     private Comparator<ExpandableView> mViewPositionComparator = new Comparator<ExpandableView>() {
         @Override
         public int compare(ExpandableView view, ExpandableView otherView) {
@@ -392,7 +399,6 @@
     private boolean mGroupExpandedForMeasure;
     private boolean mScrollable;
     private View mForcedScroll;
-    private ExpandableView mNeedingPulseAnimation;
 
     /**
      * @see #setDarkAmount(float, float)
@@ -481,7 +487,8 @@
             @Named(VIEW_CONTEXT) Context context,
             AttributeSet attrs,
             @Named(ALLOW_NOTIFICATION_LONG_PRESS_NAME) boolean allowLongPress,
-            NotificationRoundnessManager notificationRoundnessManager) {
+            NotificationRoundnessManager notificationRoundnessManager,
+            AmbientPulseManager ambientPulseManager) {
         super(context, attrs, 0, 0);
         Resources res = getResources();
 
@@ -491,6 +498,7 @@
             mSections[i] = new NotificationSection(this);
         }
 
+        mAmbientPulseManager = ambientPulseManager;
         mAmbientState = new AmbientState(context);
         mRoundnessManager = notificationRoundnessManager;
         mBgColor = context.getColor(R.color.notification_shade_background_color);
@@ -575,6 +583,17 @@
         }
     }
 
+    /**
+     * @return the height at which we will wake up when pulsing
+     */
+    public float getPulseHeight() {
+        ActivatableNotificationView firstChild = getFirstChildWithBackground();
+        if (firstChild != null) {
+            return firstChild.getCollapsedHeight();
+        }
+        return 0f;
+    }
+
     @Override
     @ShadeViewRefactor(RefactorComponent.SHADE_VIEW)
     public void onDensityOrFontScaleChanged() {
@@ -802,26 +821,32 @@
         int backgroundRectTop = top;
         int lastSectionBottom =
                 mSections[0].getCurrentBounds().bottom + animationYOffset;
+        int previousLeft = left;
+        boolean first = true;
         for (NotificationSection section : mSections) {
             if (section.getFirstVisibleChild() == null) {
                 continue;
             }
             int sectionTop = section.getCurrentBounds().top + animationYOffset;
+            int ownLeft = Math.min(Math.max(left, section.getCurrentBounds().left), right);
             // If sections are directly adjacent to each other, we don't want to draw them
             // as separate roundrects, as the rounded corners right next to each other look
             // bad.
-            if (sectionTop - lastSectionBottom > DISTANCE_BETWEEN_ADJACENT_SECTIONS_PX) {
-                canvas.drawRoundRect(left,
+            if (sectionTop - lastSectionBottom > DISTANCE_BETWEEN_ADJACENT_SECTIONS_PX
+                    || (previousLeft != ownLeft && !first)) {
+                canvas.drawRoundRect(ownLeft,
                         backgroundRectTop,
                         right,
                         lastSectionBottom,
                         mCornerRadius, mCornerRadius, mBackgroundPaint);
                 backgroundRectTop = sectionTop;
             }
+            previousLeft = ownLeft;
             lastSectionBottom =
                     section.getCurrentBounds().bottom + animationYOffset;
+            first = false;
         }
-        canvas.drawRoundRect(left,
+        canvas.drawRoundRect(previousLeft,
                 backgroundRectTop,
                 right,
                 lastSectionBottom,
@@ -1277,7 +1302,8 @@
             mIsClipped = clipped;
         }
 
-        if (mPulsing || mAmbientState.isFullyDark() && mShowDarkShelf) {
+        if (!mAmbientPulseManager.hasNotifications()
+                && mAmbientState.isFullyDark() && mShowDarkShelf) {
             setClipBounds(null);
         } else if (mAmbientState.isDarkAtAll()) {
             setClipBounds(mBackgroundAnimationRect);
@@ -1360,7 +1386,7 @@
     private boolean isHeadsUpTransition() {
         NotificationSection firstVisibleSection = getFirstVisibleSection();
         return mTrackingHeadsUp && firstVisibleSection != null
-                && mAmbientState.isAboveShelf(firstVisibleSection.getFirstVisibleChild());
+                && firstVisibleSection.getFirstVisibleChild().isAboveShelf();
     }
 
     /**
@@ -1514,7 +1540,7 @@
         return null;
     }
 
-    private ExpandableView getChildAtRawPosition(float touchX, float touchY) {
+    public ExpandableView getChildAtRawPosition(float touchX, float touchY) {
         getLocationOnScreen(mTempInt2);
         return getChildAtPosition(touchX - mTempInt2[0], touchY - mTempInt2[1]);
     }
@@ -2258,9 +2284,7 @@
         float previousPaddingAmount = 0.0f;
         int numShownItems = 0;
         boolean finish = false;
-        int maxDisplayedNotifications = mAmbientState.isFullyDark()
-                ? (hasPulsingNotifications() ? 1 : 0)
-                : mMaxDisplayedNotifications;
+        int maxDisplayedNotifications = mMaxDisplayedNotifications;
 
         for (int i = 0; i < getChildCount(); i++) {
             ExpandableView expandableView = (ExpandableView) getChildAt(i);
@@ -2269,11 +2293,7 @@
                     && !expandableView.hasNoContentHeight() && !footerViewOnLockScreen) {
                 boolean limitReached = maxDisplayedNotifications != -1
                         && numShownItems >= maxDisplayedNotifications;
-                boolean notificationOnAmbientThatIsNotPulsing = mAmbientState.isFullyDark()
-                        && hasPulsingNotifications()
-                        && expandableView instanceof ExpandableNotificationRow
-                        && !isPulsing(((ExpandableNotificationRow) expandableView).getEntry());
-                if (limitReached || notificationOnAmbientThatIsNotPulsing) {
+                if (limitReached) {
                     expandableView = mShelf;
                     finish = true;
                 }
@@ -2450,129 +2470,24 @@
             }
             return;
         }
-        int top = getSectionTopOrFinalTop(getFirstVisibleSection(), mAnimateNextBackgroundTop);
+        int minTopPosition = 0;
         NotificationSection lastSection = getLastVisibleSection();
-        ActivatableNotificationView lastView =
-                mShelf.hasItemsInStableShelf() && mShelf.getVisibility() != GONE
-                        ? mShelf
-                        : lastSection == null ? null : lastSection.getLastVisibleChild();
-        int bottom;
-        if (lastView != null) {
-            bottom = getSectionBottomOrFinalBottom(
-                    lastSection, lastView, mAnimateNextBackgroundBottom);
-        } else {
-            top = mTopPadding;
-            bottom = top;
-        }
         if (mStatusBarState != StatusBarState.KEYGUARD) {
-            top = (int) Math.max(mTopPadding + mStackTranslation, top);
-        } else {
-            // otherwise the animation from the shade to the keyguard will jump as it's maxed
-            top = Math.max(0, top);
+            minTopPosition = (int) (mTopPadding + mStackTranslation);
+        } else if (lastSection == null) {
+            minTopPosition = mTopPadding;
         }
-        bottom = Math.max(bottom, top);
-
-        setSectionBoundsByPriority(left, right, top, bottom, mSections[0], mSections[1]);
-    }
-
-    private int getSectionTopOrFinalTop(
-            @Nullable NotificationSection section, boolean alreadyAnimating) {
-        int top = 0;
-        if (section != null) {
-            ActivatableNotificationView firstView = section.getFirstVisibleChild();
-            if (firstView != null) {
-                // Round Y up to avoid seeing the background during animation
-                int finalTranslationY = (int) Math.ceil(ViewState.getFinalTranslationY(firstView));
-                if (alreadyAnimating || section.isTargetTop(finalTranslationY)) {
-                    // we're ending up at the same location as we are now, let's just skip the
-                    // animation
-                    top = finalTranslationY;
-                } else {
-                    top = (int) Math.ceil(firstView.getTranslationY());
-                }
+        boolean shiftPulsingWithFirst = mAmbientPulseManager.getAllEntries().count() <= 1;
+        for (NotificationSection section : mSections) {
+            int minBottomPosition = minTopPosition;
+            if (section == lastSection) {
+                // We need to make sure the section goes all the way to the shelf
+                minBottomPosition = (int) (mShelf.getTranslationY() + mShelf.getIntrinsicHeight());
             }
+            minTopPosition = section.updateBounds(minTopPosition, minBottomPosition,
+                    shiftPulsingWithFirst);
+            shiftPulsingWithFirst = false;
         }
-        return top;
-    }
-
-    private int getSectionBottomOrFinalBottom(
-            @Nullable NotificationSection section, boolean alreadyAnimating) {
-        return section == null ? 0
-                : getSectionBottomOrFinalBottom(
-                        section, section.getLastVisibleChild(), alreadyAnimating);
-    }
-
-    private int getSectionBottomOrFinalBottom(
-            NotificationSection section,
-            ActivatableNotificationView lastView,
-            boolean alreadyAnimating) {
-        int bottom = 0;
-        if (lastView != null) {
-            float finalTranslationY;
-            if (lastView == mShelf) {
-                finalTranslationY = mShelf.getTranslationY();
-            } else {
-                finalTranslationY = ViewState.getFinalTranslationY(lastView);
-            }
-            int finalHeight = ExpandableViewState.getFinalActualHeight(lastView);
-            // Round Y down to avoid seeing the background during animation
-            int finalBottom = (int) Math.floor(
-                    finalTranslationY + finalHeight - lastView.getClipBottomAmount());
-            if (alreadyAnimating || section.isTargetBottom(finalBottom)) {
-                // we're ending up at the same location as we are now, lets just skip the animation
-                bottom = finalBottom;
-            } else {
-                bottom = (int) (lastView.getTranslationY() + lastView.getActualHeight()
-                        - lastView.getClipBottomAmount());
-            }
-        }
-        return bottom;
-    }
-
-    private void setSectionBoundsByPriority(int left, int right, int top, int bottom,
-            NotificationSection highPrioritySection, NotificationSection lowPrioritySection) {
-        if (NotificationUtils.useNewInterruptionModel(mContext)) {
-            // TODO(kprevas): can we use section boundary indices from mAmbientState instead?
-            ActivatableNotificationView lastChildAboveGap = getLastHighPriorityChild();
-            ActivatableNotificationView firstChildBelowGap = getFirstLowPriorityChild();
-            if (lastChildAboveGap != null && firstChildBelowGap != null) {
-                int gapTop = getSectionBottomOrFinalBottom(
-                        highPrioritySection, mAnimateNextSectionBoundsChange);
-                gapTop = Math.max(top, Math.min(gapTop, bottom));
-
-                int gapBottom = getSectionTopOrFinalTop(
-                        lowPrioritySection, mAnimateNextSectionBoundsChange);
-                gapBottom = Math.max(top, Math.min(gapBottom, bottom));
-
-                highPrioritySection.getBounds().set(left, top, right, gapTop);
-                lowPrioritySection.getBounds().set(left, gapBottom, right, bottom);
-            } else if (lastChildAboveGap != null) {
-                highPrioritySection.getBounds().set(left, top, right, bottom);
-                lowPrioritySection.getBounds().set(left, bottom, right, bottom);
-            } else {
-                highPrioritySection.getBounds().set(left, top, right, top);
-                lowPrioritySection.getBounds().set(left, top, right, bottom);
-            }
-        } else {
-            highPrioritySection.getBounds().set(left, top, right, bottom);
-            lowPrioritySection.getBounds().set(left, bottom, right, bottom);
-        }
-    }
-
-    @ShadeViewRefactor(RefactorComponent.COORDINATOR)
-    private ActivatableNotificationView getFirstPinnedHeadsUp() {
-        int childCount = getChildCount();
-        for (int i = 0; i < childCount; i++) {
-            View child = getChildAt(i);
-            if (child.getVisibility() != View.GONE
-                    && child instanceof ExpandableNotificationRow) {
-                ExpandableNotificationRow row = (ExpandableNotificationRow) child;
-                if (row.isPinned()) {
-                    return row;
-                }
-            }
-        }
-        return null;
     }
 
     private NotificationSection getFirstVisibleSection() {
@@ -3462,7 +3377,6 @@
         generateViewResizeEvent();
         generateGroupExpansionEvent();
         generateAnimateEverythingEvent();
-        generatePulsingAnimationEvent();
     }
 
     @ShadeViewRefactor(RefactorComponent.STATE_RESOLVER)
@@ -4462,10 +4376,12 @@
     }
 
     @ShadeViewRefactor(RefactorComponent.COORDINATOR)
-    public void setIsExpanded(boolean isExpanded) {
+    private void setIsExpanded(boolean isExpanded) {
         boolean changed = isExpanded != mIsExpanded;
         mIsExpanded = isExpanded;
         mStackScrollAlgorithm.setIsExpanded(isExpanded);
+        mAmbientState.setShadeExpanded(isExpanded);
+        mStateAnimator.setShadeExpanded(isExpanded);
         if (changed) {
             if (!mIsExpanded) {
                 mGroupManager.collapseAllGroups();
@@ -5207,12 +5123,6 @@
         }
     }
 
-    @ShadeViewRefactor(RefactorComponent.SHADE_VIEW)
-    public void setShadeExpanded(boolean shadeExpanded) {
-        mAmbientState.setShadeExpanded(shadeExpanded);
-        mStateAnimator.setShadeExpanded(shadeExpanded);
-    }
-
     /**
      * Set the boundary for the bottom heads up position. The heads up will always be above this
      * position.
@@ -5274,24 +5184,12 @@
             return;
         }
         mPulsing = pulsing;
-        mNeedingPulseAnimation = animated ? getFirstChildNotGone() : null;
         mAmbientState.setPulsing(pulsing);
         updateNotificationAnimationStates();
         updateAlgorithmHeightAndPadding();
         updateContentHeight();
         requestChildrenUpdate();
         notifyHeightChangeListener(null, animated);
-        mNeedsAnimation |= animated;
-    }
-
-    @ShadeViewRefactor(RefactorComponent.SHADE_VIEW)
-    private void generatePulsingAnimationEvent() {
-        if (mNeedingPulseAnimation != null) {
-            int type = mPulsing ? AnimationEvent.ANIMATION_TYPE_PULSE_APPEAR
-                    : AnimationEvent.ANIMATION_TYPE_PULSE_DISAPPEAR;
-            mAnimationEvents.add(new AnimationEvent(mNeedingPulseAnimation, type));
-            mNeedingPulseAnimation = null;
-        }
     }
 
     @ShadeViewRefactor(RefactorComponent.SHADE_VIEW)
@@ -5734,6 +5632,56 @@
     }
 
     /**
+     * Set how far the wake up is when waking up from pulsing. This is a height and will adjust the
+     * notification positions accordingly.
+     * @param height the new wake up height
+     * @return the overflow how much the height is further than he lowest notification
+     */
+    public float setPulseHeight(float height) {
+        mAmbientState.setPulseHeight(height);
+        requestChildrenUpdate();
+        return Math.max(0, height - mAmbientState.getInnerHeight(true /* ignorePulseHeight */));
+    }
+
+    /**
+     * Set the amount how much we're dozing. This is different from how dark the shade is, when
+     * the notification is pulsing.
+     */
+    public void setDozeAmount(float dozeAmount) {
+        mAmbientState.setDozeAmount(dozeAmount);
+        updateContinuousBackgroundDrawing();
+        requestChildrenUpdate();
+    }
+
+    public void wakeUpFromPulse() {
+        setPulseHeight(getPulseHeight());
+        // Let's place the hidden views at the end of the pulsing notification to make sure we have
+        // a smooth animation
+        boolean firstVisibleView = true;
+        float wakeUplocation = -1f;
+        int childCount = getChildCount();
+        for (int i = 0; i < childCount; i++) {
+            ExpandableView view = (ExpandableView) getChildAt(i);
+            if (view.getVisibility() == View.GONE) {
+                continue;
+            }
+            boolean isShelf = view == mShelf;
+            if (!(view instanceof ExpandableNotificationRow) && !isShelf) {
+                continue;
+            }
+            if (view.getVisibility() == View.VISIBLE && !isShelf) {
+                if (firstVisibleView) {
+                    firstVisibleView = false;
+                    wakeUplocation = view.getTranslationY()
+                            + view.getActualHeight() - mShelf.getIntrinsicHeight();
+                }
+            } else if (!firstVisibleView) {
+                view.setTranslationY(wakeUplocation);
+            }
+        }
+    }
+
+    /**
      * A listener that is notified when the empty space below the notifications is clicked on
      */
     @ShadeViewRefactor(RefactorComponent.SHADE_VIEW)
@@ -5825,6 +5773,19 @@
         mAmbientState.setSectionBoundaryIndex(0, gapIndex);
     }
 
+    private void updateContinuousBackgroundDrawing() {
+        boolean continuousBackground = !mAmbientState.isFullyAwake()
+                && !mAmbientState.getDraggedViews().isEmpty();
+        if (continuousBackground != mContinuousBackgroundUpdate) {
+            mContinuousBackgroundUpdate = continuousBackground;
+            if (continuousBackground) {
+                getViewTreeObserver().addOnPreDrawListener(mBackgroundUpdater);
+            } else {
+                getViewTreeObserver().removeOnPreDrawListener(mBackgroundUpdater);
+            }
+        }
+    }
+
     @ShadeViewRefactor(RefactorComponent.STATE_RESOLVER)
     private void updateContinuousShadowDrawing() {
         boolean continuousShadowUpdate = mAnimationRunning
@@ -5969,18 +5930,6 @@
                         .animateTopInset()
                         .animateY()
                         .animateZ(),
-
-                // ANIMATION_TYPE_PULSE_APPEAR
-                new AnimationFilter()
-                        .animateAlpha()
-                        .hasDelays()
-                        .animateY(),
-
-                // ANIMATION_TYPE_PULSE_DISAPPEAR
-                new AnimationFilter()
-                        .animateAlpha()
-                        .hasDelays()
-                        .animateY(),
         };
 
         static int[] LENGTHS = new int[]{
@@ -6035,12 +5984,6 @@
 
                 // ANIMATION_TYPE_EVERYTHING
                 StackStateAnimator.ANIMATION_DURATION_STANDARD,
-
-                // ANIMATION_TYPE_PULSE_APPEAR
-                StackStateAnimator.ANIMATION_DURATION_PULSE_APPEAR,
-
-                // ANIMATION_TYPE_PULSE_DISAPPEAR
-                StackStateAnimator.ANIMATION_DURATION_PULSE_APPEAR / 2,
         };
 
         static final int ANIMATION_TYPE_ADD = 0;
@@ -6060,8 +6003,6 @@
         static final int ANIMATION_TYPE_HEADS_UP_DISAPPEAR_CLICK = 14;
         static final int ANIMATION_TYPE_HEADS_UP_OTHER = 15;
         static final int ANIMATION_TYPE_EVERYTHING = 16;
-        static final int ANIMATION_TYPE_PULSE_APPEAR = 17;
-        static final int ANIMATION_TYPE_PULSE_DISAPPEAR = 18;
 
         static final int DARK_ANIMATION_ORIGIN_INDEX_ABOVE = -1;
         static final int DARK_ANIMATION_ORIGIN_INDEX_BELOW = -2;
@@ -6198,8 +6139,8 @@
         }
 
         @Override
-        public boolean isExpanded() {
-            return NotificationStackScrollLayout.this.isExpanded();
+        public boolean shouldDismissQuickly() {
+            return NotificationStackScrollLayout.this.isExpanded() && mAmbientState.isFullyAwake();
         }
 
         @Override
@@ -6299,6 +6240,7 @@
             setSwipingInProgress(true);
             mAmbientState.onBeginDrag((ExpandableView) v);
             updateContinuousShadowDrawing();
+            updateContinuousBackgroundDrawing();
             requestChildrenUpdate();
         }
 
@@ -6306,6 +6248,7 @@
         public void onChildSnappedBack(View animView, float targetLeft) {
             mAmbientState.onDragFinished(animView);
             updateContinuousShadowDrawing();
+            updateContinuousBackgroundDrawing();
             NotificationMenuRowPlugin menuRow = mSwipeHelper.getCurrentMenuRow();
             if (menuRow != null && targetLeft == 0) {
                 menuRow.resetMenu();
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/notification/stack/NotificationSwipeHelper.java b/packages/SystemUI/src/com/android/systemui/statusbar/notification/stack/NotificationSwipeHelper.java
index 975aee5..478427c 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/notification/stack/NotificationSwipeHelper.java
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/notification/stack/NotificationSwipeHelper.java
@@ -231,7 +231,7 @@
     public void dismissChild(final View view, float velocity,
             boolean useAccelerateInterpolator) {
         superDismissChild(view, velocity, useAccelerateInterpolator);
-        if (mCallback.isExpanded()) {
+        if (mCallback.shouldDismissQuickly()) {
             // We don't want to quick-dismiss when it's a heads up as this might lead to closing
             // of the panel early.
             mCallback.handleChildViewDismissed(view);
@@ -418,7 +418,11 @@
     }
 
     public interface NotificationCallback extends SwipeHelper.Callback{
-        boolean isExpanded();
+        /**
+         * @return if the view should be dismissed as soon as the touch is released, otherwise its
+         *         removed when the animation finishes.
+         */
+        boolean shouldDismissQuickly();
 
         void handleChildViewDismissed(View view);
 
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/notification/stack/StackScrollAlgorithm.java b/packages/SystemUI/src/com/android/systemui/statusbar/notification/stack/StackScrollAlgorithm.java
index 7882fd3..f97a7e6 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/notification/stack/StackScrollAlgorithm.java
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/notification/stack/StackScrollAlgorithm.java
@@ -101,6 +101,7 @@
         updateZValuesForState(algorithmState, ambientState);
 
         updateHeadsUpStates(algorithmState, ambientState);
+        updatePulsingStates(algorithmState, ambientState);
 
         updateDimmedActivatedHideSensitive(ambientState, algorithmState);
         updateClipping(algorithmState, ambientState);
@@ -477,6 +478,23 @@
         return algorithmState.getPaddingAfterChild(child);
     }
 
+    private void updatePulsingStates(StackScrollAlgorithmState algorithmState,
+            AmbientState ambientState) {
+        int childCount = algorithmState.visibleChildren.size();
+        for (int i = 0; i < childCount; i++) {
+            View child = algorithmState.visibleChildren.get(i);
+            if (!(child instanceof ExpandableNotificationRow)) {
+                continue;
+            }
+            ExpandableNotificationRow row = (ExpandableNotificationRow) child;
+            if (!row.showingAmbientPulsing() || (i == 0 && ambientState.isPulseExpanding())) {
+                continue;
+            }
+            ExpandableViewState viewState = row.getViewState();
+            viewState.hidden = false;
+        }
+    }
+
     private void updateHeadsUpStates(StackScrollAlgorithmState algorithmState,
             AmbientState ambientState) {
         int childCount = algorithmState.visibleChildren.size();
@@ -501,7 +519,7 @@
                 if (row.mustStayOnScreen() && !childState.headsUpIsVisible) {
                     // Ensure that the heads up is always visible even when scrolled off
                     clampHunToTop(ambientState, row, childState);
-                    if (i == 0 && ambientState.isAboveShelf(row)) {
+                    if (i == 0 && row.isAboveShelf()) {
                         // the first hun can't get off screen.
                         clampHunToMaxTranslation(ambientState, row, childState);
                         childState.hidden = false;
@@ -635,7 +653,7 @@
             }
             childViewState.zTranslation = baseZ
                     + childrenOnTop * zDistanceBetweenElements;
-        } else if (i == 0 && ambientState.isAboveShelf(child)) {
+        } else if (i == 0 && child.isAboveShelf()) {
             // In case this is a new view that has never been measured before, we don't want to
             // elevate if we are currently expanded more then the notification
             int shelfHeight = ambientState.getShelf() == null ? 0 :
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/notification/stack/StackStateAnimator.java b/packages/SystemUI/src/com/android/systemui/statusbar/notification/stack/StackStateAnimator.java
index b4c205a..7332b03 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/notification/stack/StackStateAnimator.java
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/notification/stack/StackStateAnimator.java
@@ -419,32 +419,6 @@
                 ExpandableNotificationRow row = (ExpandableNotificationRow) event.mChangingView;
                 row.prepareExpansionChanged();
             } else if (event.animationType == NotificationStackScrollLayout
-                    .AnimationEvent.ANIMATION_TYPE_PULSE_APPEAR) {
-                ExpandableViewState viewState = changingView.getViewState();
-                if (viewState != null) {
-                    mTmpState.copyFrom(viewState);
-                    mTmpState.yTranslation += mPulsingAppearingTranslation;
-                    mTmpState.alpha = 0;
-                    mTmpState.applyToView(changingView);
-
-                    mTmpState.copyFrom(mShelf.getViewState());
-                    mTmpState.applyToView(mShelf);
-                }
-            } else if (event.animationType == NotificationStackScrollLayout
-                    .AnimationEvent.ANIMATION_TYPE_PULSE_DISAPPEAR) {
-                ExpandableViewState viewState = changingView.getViewState();
-                if (viewState != null) {
-                    viewState.alpha = 0;
-                    // We want to animate the alpha away before the view starts translating,
-                    // otherwise everything will overlap and look xtra ugly.
-                    float originalYTranslation = viewState.yTranslation;
-                    viewState.yTranslation = changingView.getTranslationY();
-                    mAnimationFilter.animateAlpha = true;
-                    mAnimationProperties.duration = ANIMATION_DURATION_PULSE_APPEAR / 2;
-                    viewState.animateTo(changingView, mAnimationProperties);
-                    viewState.yTranslation = originalYTranslation;
-                }
-            } else if (event.animationType == NotificationStackScrollLayout
                     .AnimationEvent.ANIMATION_TYPE_HEADS_UP_APPEAR) {
                 // This item is added, initialize it's properties.
                 ExpandableViewState viewState = changingView.getViewState();
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/phone/AutoHideController.java b/packages/SystemUI/src/com/android/systemui/statusbar/phone/AutoHideController.java
index b9425d4..2bbc53c 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/phone/AutoHideController.java
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/phone/AutoHideController.java
@@ -75,6 +75,13 @@
         mDisplayId = context.getDisplayId();
     }
 
+    @Override
+    public void onDisplayRemoved(int displayId) {
+        if (displayId == mDisplayId) {
+            mCommandQueue.removeCallback(this);
+        }
+    }
+
     void setStatusBar(StatusBar statusBar) {
         mStatusBar = statusBar;
     }
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/phone/BiometricUnlockController.java b/packages/SystemUI/src/com/android/systemui/statusbar/phone/BiometricUnlockController.java
index 2162ea7..410eeae 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/phone/BiometricUnlockController.java
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/phone/BiometricUnlockController.java
@@ -22,17 +22,21 @@
 import android.os.PowerManager;
 import android.os.SystemClock;
 import android.os.Trace;
+import android.provider.Settings;
 import android.util.Log;
 
+import com.android.internal.annotations.VisibleForTesting;
 import com.android.internal.util.LatencyTracker;
 import com.android.keyguard.KeyguardConstants;
 import com.android.keyguard.KeyguardUpdateMonitor;
 import com.android.keyguard.KeyguardUpdateMonitorCallback;
 import com.android.systemui.Dependency;
+import com.android.systemui.R;
 import com.android.systemui.keyguard.KeyguardViewMediator;
 import com.android.systemui.keyguard.ScreenLifecycle;
 import com.android.systemui.keyguard.WakefulnessLifecycle;
 import com.android.systemui.statusbar.NotificationMediaManager;
+import com.android.systemui.tuner.TunerService;
 
 import java.io.PrintWriter;
 
@@ -95,6 +99,17 @@
      */
     private static final float BIOMETRIC_COLLAPSE_SPEEDUP_FACTOR = 1.1f;
 
+    /**
+     * If face unlock dismisses the lock screen or keeps user on keyguard by default on this device.
+     */
+    private final boolean mFaceDismissesKeyguardByDefault;
+
+    /**
+     * If face unlock dismisses the lock screen or keeps user on keyguard for the current user.
+     */
+    @VisibleForTesting
+    protected boolean mFaceDismissesKeyguard;
+
     private final NotificationMediaManager mMediaManager;
     private final PowerManager mPowerManager;
     private final Handler mHandler;
@@ -115,14 +130,42 @@
     private boolean mPendingShowBouncer;
     private boolean mHasScreenTurnedOnSinceAuthenticating;
 
+    private final TunerService.Tunable mFaceDismissedKeyguardTunable = new TunerService.Tunable() {
+        @Override
+        public void onTuningChanged(String key, String newValue) {
+            int defaultValue = mFaceDismissesKeyguardByDefault ? 1 : 0;
+            mFaceDismissesKeyguard = Settings.Secure.getIntForUser(mContext.getContentResolver(),
+                    Settings.Secure.FACE_UNLOCK_DISMISSES_KEYGUARD,
+                    defaultValue, KeyguardUpdateMonitor.getCurrentUser()) != 0;
+        }
+    };
+
     public BiometricUnlockController(Context context,
+            DozeScrimController dozeScrimController,
+            KeyguardViewMediator keyguardViewMediator,
+            ScrimController scrimController,
+            StatusBar statusBar,
+            UnlockMethodCache unlockMethodCache, Handler handler,
+            KeyguardUpdateMonitor keyguardUpdateMonitor,
+            TunerService tunerService) {
+        this(context, dozeScrimController, keyguardViewMediator, scrimController, statusBar,
+                unlockMethodCache, handler, keyguardUpdateMonitor, tunerService,
+                context.getResources()
+                        .getInteger(com.android.internal.R.integer.config_wakeUpDelayDoze),
+                context.getResources().getBoolean(R.bool.config_faceAuthDismissesKeyguard));
+    }
+
+    @VisibleForTesting
+    protected BiometricUnlockController(Context context,
                                      DozeScrimController dozeScrimController,
                                      KeyguardViewMediator keyguardViewMediator,
                                      ScrimController scrimController,
                                      StatusBar statusBar,
                                      UnlockMethodCache unlockMethodCache, Handler handler,
                                      KeyguardUpdateMonitor keyguardUpdateMonitor,
-                                     int wakeUpDelay) {
+                                     TunerService tunerService,
+                                     int wakeUpDelay,
+                                     boolean faceDismissesKeyguard) {
         mContext = context;
         mPowerManager = context.getSystemService(PowerManager.class);
         mUpdateMonitor = keyguardUpdateMonitor;
@@ -138,6 +181,9 @@
         mUnlockMethodCache = unlockMethodCache;
         mHandler = handler;
         mWakeUpDelay = wakeUpDelay;
+        mFaceDismissesKeyguardByDefault = faceDismissesKeyguard;
+        tunerService.addTunable(mFaceDismissedKeyguardTunable,
+                Settings.Secure.FACE_UNLOCK_DISMISSES_KEYGUARD);
     }
 
     public void setStatusBarKeyguardViewManager(
@@ -344,27 +390,28 @@
     private int calculateMode(BiometricSourceType biometricSourceType) {
         boolean unlockingAllowed = mUpdateMonitor.isUnlockingWithBiometricAllowed();
         boolean deviceDreaming = mUpdateMonitor.isDreaming();
-        boolean isFace = biometricSourceType == BiometricSourceType.FACE;
+        boolean faceStayingOnKeyguard = biometricSourceType == BiometricSourceType.FACE
+                && !mFaceDismissesKeyguard;
 
         if (!mUpdateMonitor.isDeviceInteractive()) {
             if (!mStatusBarKeyguardViewManager.isShowing()) {
                 return MODE_ONLY_WAKE;
             } else if (mDozeScrimController.isPulsing() && unlockingAllowed) {
-                return isFace ? MODE_NONE : MODE_WAKE_AND_UNLOCK_PULSING;
+                return faceStayingOnKeyguard ? MODE_NONE : MODE_WAKE_AND_UNLOCK_PULSING;
             } else if (unlockingAllowed || !mUnlockMethodCache.isMethodSecure()) {
                 return MODE_WAKE_AND_UNLOCK;
             } else {
                 return MODE_SHOW_BOUNCER;
             }
         }
-        if (unlockingAllowed && deviceDreaming && !isFace) {
+        if (unlockingAllowed && deviceDreaming && !faceStayingOnKeyguard) {
             return MODE_WAKE_AND_UNLOCK_FROM_DREAM;
         }
         if (mStatusBarKeyguardViewManager.isShowing()) {
             if (mStatusBarKeyguardViewManager.isBouncerShowing() && unlockingAllowed) {
                 return MODE_DISMISS_BOUNCER;
             } else if (unlockingAllowed) {
-                return isFace ? MODE_ONLY_WAKE : MODE_UNLOCK;
+                return faceStayingOnKeyguard ? MODE_ONLY_WAKE : MODE_UNLOCK;
             } else if (!mStatusBarKeyguardViewManager.isBouncerShowing()) {
                 return MODE_SHOW_BOUNCER;
             }
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/phone/LockIcon.java b/packages/SystemUI/src/com/android/systemui/statusbar/phone/LockIcon.java
index 60015ef..b7d1fc6 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/phone/LockIcon.java
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/phone/LockIcon.java
@@ -43,18 +43,15 @@
 
     private static final int STATE_LOCKED = 0;
     private static final int STATE_LOCK_OPEN = 1;
-    private static final int STATE_FACE_UNLOCK = 2;
-    private static final int STATE_FINGERPRINT = 3;
-    private static final int STATE_BIOMETRICS_ERROR = 4;
+    private static final int STATE_SCANNING_FACE = 2;
+    private static final int STATE_BIOMETRICS_ERROR = 3;
 
     private int mLastState = 0;
     private boolean mTransientBiometricsError;
     private boolean mScreenOn;
     private boolean mLastScreenOn;
-    private Drawable mUserAvatarIcon;
     private final UnlockMethodCache mUnlockMethodCache;
     private AccessibilityController mAccessibilityController;
-    private boolean mHasFingerPrintState;
     private boolean mIsFaceUnlockState;
     private int mDensity;
     private boolean mPulsing;
@@ -77,7 +74,6 @@
 
     @Override
     public void onUserInfoChanged(String name, Drawable picture, String userAccount) {
-        mUserAvatarIcon = picture;
         update();
     }
 
@@ -110,10 +106,8 @@
 
     public void update(boolean force) {
         int state = getState();
-        boolean anyFingerprintState = state == STATE_FINGERPRINT
-                || state == STATE_BIOMETRICS_ERROR;
-        mIsFaceUnlockState = state == STATE_FACE_UNLOCK;
-        if (state != mLastState || mLastDozing == mDozing || mLastPulsing == mPulsing
+        mIsFaceUnlockState = state == STATE_SCANNING_FACE;
+        if (state != mLastState || mLastDozing != mDozing || mLastPulsing != mPulsing
                 || mLastScreenOn != mScreenOn || force) {
             int iconAnimRes = getAnimationResForTransition(mLastState, state, mLastPulsing,
                     mPulsing, mLastDozing, mDozing);
@@ -138,7 +132,6 @@
                     R.string.accessibility_scanning_face));
             }
 
-            mHasFingerPrintState = anyFingerprintState;
             if (animation != null && isAnim) {
                 animation.forceAnimationOnUI();
                 animation.start();
@@ -178,7 +171,10 @@
     @Override
     public void onInitializeAccessibilityNodeInfo(AccessibilityNodeInfo info) {
         super.onInitializeAccessibilityNodeInfo(info);
-        if (mHasFingerPrintState) {
+        KeyguardUpdateMonitor updateMonitor = KeyguardUpdateMonitor.getInstance(mContext);
+        boolean fingerprintRunning = updateMonitor.isFingerprintDetectionRunning();
+        boolean unlockingAllowed = updateMonitor.isUnlockingWithBiometricAllowed();
+        if (fingerprintRunning && unlockingAllowed) {
             AccessibilityNodeInfo.AccessibilityAction unlock
                     = new AccessibilityNodeInfo.AccessibilityAction(
                     AccessibilityNodeInfo.ACTION_CLICK,
@@ -201,21 +197,16 @@
     private Drawable getIconForState(int state) {
         int iconRes;
         switch (state) {
-            case STATE_FINGERPRINT:
             case STATE_LOCKED:
-            case STATE_FACE_UNLOCK:
-                iconRes = com.android.internal.R.drawable.ic_lock_24dp;
+            // Scanning animation is a pulsing padlock. This means that the resting state is
+            // just a padlock.
+            case STATE_SCANNING_FACE:
+            // Error animation also starts and ands on the padlock.
+            case STATE_BIOMETRICS_ERROR:
+                iconRes = com.android.internal.R.drawable.ic_lock;
                 break;
             case STATE_LOCK_OPEN:
-                if (mUnlockMethodCache.isTrustManaged() && mUnlockMethodCache.isTrusted()
-                    && mUserAvatarIcon != null) {
-                    return mUserAvatarIcon;
-                } else {
-                    iconRes = com.android.internal.R.drawable.ic_lock_open_24dp;
-                }
-                break;
-            case STATE_BIOMETRICS_ERROR:
-                iconRes = com.android.internal.R.drawable.ic_auth_error;
+                iconRes = com.android.internal.R.drawable.ic_lock_open;
                 break;
             default:
                 throw new IllegalArgumentException();
@@ -224,22 +215,28 @@
         return mContext.getDrawable(iconRes);
     }
 
-    private int getAnimationResForTransition(int oldState, int newState,
+    private static int getAnimationResForTransition(int oldState, int newState,
             boolean wasPulsing, boolean pulsing,
             boolean wasDozing, boolean dozing) {
 
-        boolean isError = newState == STATE_BIOMETRICS_ERROR;
-        boolean isUnlocked = newState == STATE_LOCK_OPEN;
-        boolean isLocked = !isUnlocked;
-        boolean wasUnlocked = oldState == STATE_LOCK_OPEN;
+        // Never animate when screen is off
+        if (dozing && !pulsing) {
+            return -1;
+        }
+
+        boolean isError = oldState != STATE_BIOMETRICS_ERROR && newState == STATE_BIOMETRICS_ERROR;
+        boolean justUnlocked = oldState != STATE_LOCK_OPEN && newState == STATE_LOCK_OPEN;
+        boolean justLocked = oldState == STATE_LOCK_OPEN && newState == STATE_LOCKED;
 
         if (isError) {
             return com.android.internal.R.anim.lock_to_error;
-        } else if (isUnlocked) {
+        } else if (justUnlocked) {
             return com.android.internal.R.anim.lock_unlock;
-        } else if (wasUnlocked && isLocked && mScreenOn) {
+        } else if (justLocked) {
             return com.android.internal.R.anim.lock_lock;
-        } else if (isLocked && (!wasPulsing && pulsing || wasDozing && !dozing)) {
+        } else if (newState == STATE_SCANNING_FACE) {
+            return com.android.internal.R.anim.lock_scanning;
+        } else if (!wasPulsing && pulsing) {
             return com.android.internal.R.anim.lock_in;
         }
         return -1;
@@ -247,17 +244,13 @@
 
     private int getState() {
         KeyguardUpdateMonitor updateMonitor = KeyguardUpdateMonitor.getInstance(mContext);
-        boolean fingerprintRunning = updateMonitor.isFingerprintDetectionRunning();
-        boolean unlockingAllowed = updateMonitor.isUnlockingWithBiometricAllowed();
         if (mTransientBiometricsError) {
             return STATE_BIOMETRICS_ERROR;
         } else if (mUnlockMethodCache.canSkipBouncer()) {
             return STATE_LOCK_OPEN;
         } else if (mUnlockMethodCache.isFaceUnlockRunning()
                 || updateMonitor.isFaceDetectionRunning()) {
-            return STATE_FACE_UNLOCK;
-        } else if (fingerprintRunning && unlockingAllowed) {
-            return STATE_FINGERPRINT;
+            return STATE_SCANNING_FACE;
         } else {
             return STATE_LOCKED;
         }
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/phone/NavigationBarFragment.java b/packages/SystemUI/src/com/android/systemui/statusbar/phone/NavigationBarFragment.java
index 1eb4990..b68c7c6 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/phone/NavigationBarFragment.java
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/phone/NavigationBarFragment.java
@@ -51,10 +51,12 @@
 import android.graphics.PixelFormat;
 import android.graphics.Rect;
 import android.inputmethodservice.InputMethodService;
+import android.net.Uri;
 import android.os.Binder;
 import android.os.Bundle;
 import android.os.Handler;
 import android.os.IBinder;
+import android.os.Looper;
 import android.os.RemoteException;
 import android.os.UserHandle;
 import android.provider.Settings;
@@ -137,6 +139,7 @@
     private AccessibilityManager mAccessibilityManager;
     private MagnificationContentObserver mMagnificationObserver;
     private ContentResolver mContentResolver;
+    private boolean mAssistantAvailable;
 
     private int mDisabledFlags1;
     private int mDisabledFlags2;
@@ -167,6 +170,11 @@
         public void onConnectionChanged(boolean isConnected) {
             mNavigationBarView.updateStates();
             updateScreenPinningGestures();
+
+            // Send the assistant availability upon connection
+            if (isConnected) {
+                mNavigationBarView.setAssistantAvailable(mAssistantAvailable);
+            }
         }
 
         @Override
@@ -185,6 +193,11 @@
         }
 
         @Override
+        public void startAssistant(Bundle bundle) {
+            mAssistManager.startAssist(bundle);
+        }
+
+        @Override
         public void onBackButtonAlphaChanged(float alpha, boolean animate) {
             final ButtonDispatcher backButton = mNavigationBarView.getBackButton();
             if (QuickStepController.shouldhideBackButton(getContext())) {
@@ -208,6 +221,19 @@
 
     private final Runnable mAutoDim = () -> getBarTransitions().setAutoDim(true);
 
+    private final ContentObserver mAssistContentObserver = new ContentObserver(
+            new Handler(Looper.getMainLooper())) {
+        @Override
+        public void onChange(boolean selfChange, Uri uri) {
+            boolean available = mAssistManager
+                    .getAssistInfoForUser(UserHandle.USER_CURRENT) != null;
+            if (mAssistantAvailable != available) {
+                mNavigationBarView.setAssistantAvailable(available);
+                mAssistantAvailable = available;
+            }
+        }
+    };
+
     @Inject
     public NavigationBarFragment(AccessibilityManagerWrapper accessibilityManagerWrapper,
             DeviceProvisionedController deviceProvisionedController, MetricsLogger metricsLogger,
@@ -216,6 +242,7 @@
         mDeviceProvisionedController = deviceProvisionedController;
         mMetricsLogger = metricsLogger;
         mAssistManager = assistManager;
+        mAssistantAvailable = mAssistManager.getAssistInfoForUser(UserHandle.USER_CURRENT) != null;
         mOverviewProxyService = overviewProxyService;
     }
 
@@ -237,6 +264,9 @@
         mContentResolver.registerContentObserver(Settings.Secure.getUriFor(
                 Settings.Secure.ACCESSIBILITY_DISPLAY_MAGNIFICATION_NAVBAR_ENABLED), false,
                 mMagnificationObserver, UserHandle.USER_ALL);
+        mContentResolver.registerContentObserver(
+                Settings.Secure.getUriFor(Settings.Secure.ASSISTANT),
+                false /* notifyForDescendants */, mAssistContentObserver, UserHandle.USER_ALL);
 
         if (savedInstanceState != null) {
             mDisabledFlags1 = savedInstanceState.getInt(EXTRA_DISABLE_STATE, 0);
@@ -253,6 +283,7 @@
         super.onDestroy();
         mAccessibilityManagerWrapper.removeCallback(mAccessibilityListener);
         mContentResolver.unregisterContentObserver(mMagnificationObserver);
+        mContentResolver.unregisterContentObserver(mAssistContentObserver);
     }
 
     @Override
@@ -985,6 +1016,7 @@
         lp.setTitle("NavigationBar" + context.getDisplayId());
         lp.accessibilityTitle = context.getString(R.string.nav_bar);
         lp.windowAnimations = 0;
+        lp.privateFlags |= WindowManager.LayoutParams.PRIVATE_FLAG_COLOR_SPACE_AGNOSTIC;
 
         View navigationBarView = LayoutInflater.from(context).inflate(
                 R.layout.navigation_bar_window, null);
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/phone/NavigationBarInflaterView.java b/packages/SystemUI/src/com/android/systemui/statusbar/phone/NavigationBarInflaterView.java
index faa2ab1..2a38f77 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/phone/NavigationBarInflaterView.java
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/phone/NavigationBarInflaterView.java
@@ -63,6 +63,7 @@
     public static final String NAVSPACE = "space";
     public static final String CLIPBOARD = "clipboard";
     public static final String HOME_HANDLE = "home_handle";
+    public static final String ASSISTANT_HANDLE = "assistant_handle";
     public static final String KEY = "key";
     public static final String LEFT = "left";
     public static final String RIGHT = "right";
@@ -398,6 +399,8 @@
             v = inflater.inflate(R.layout.contextual, parent, false);
         } else if (HOME_HANDLE.equals(button)) {
             v = inflater.inflate(R.layout.home_handle, parent, false);
+        } else if (ASSISTANT_HANDLE.equals(button)) {
+            v = inflater.inflate(R.layout.assistant_handle, parent, false);
         } else if (button.startsWith(KEY)) {
             String uri = extractImage(button);
             int code = extractKeycode(button);
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/phone/NavigationBarView.java b/packages/SystemUI/src/com/android/systemui/statusbar/phone/NavigationBarView.java
index f82b05e..b540fb4 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/phone/NavigationBarView.java
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/phone/NavigationBarView.java
@@ -42,6 +42,7 @@
 import android.annotation.SuppressLint;
 import android.app.StatusBarManager;
 import android.content.Context;
+import android.content.pm.ParceledListSlice;
 import android.content.res.Configuration;
 import android.graphics.Canvas;
 import android.graphics.Point;
@@ -59,6 +60,8 @@
 import android.util.SparseArray;
 import android.view.Display;
 import android.view.Gravity;
+import android.view.IPinnedStackController;
+import android.view.IPinnedStackListener;
 import android.view.MotionEvent;
 import android.view.Surface;
 import android.view.View;
@@ -171,6 +174,7 @@
     private NotificationPanelView mPanelView;
 
     private NavBarTintController mColorAdaptionController;
+    private boolean mAssistantAvailable;
     private NavigationPrototypeController mPrototypeController;
     private NavigationGestureAction[] mDefaultGestureMap;
     private QuickScrubAction mQuickScrubAction;
@@ -347,6 +351,51 @@
         public void onHomeHandleVisiblilityChanged(boolean visible) {
             showHomeHandle(visible);
         }
+
+        @Override
+        public void onAssistantGestureEnabled(boolean enabled) {
+            updateAssistantAvailability();
+        }
+    };
+
+    private final IPinnedStackListener.Stub mImeChangedListener = new IPinnedStackListener.Stub() {
+        @Override
+        public void onListenerRegistered(IPinnedStackController controller) {
+        }
+
+        @Override
+        public void onImeVisibilityChanged(boolean imeVisible, int imeHeight) {
+            post(() -> {
+                // When the ime changes visibility, resize the edge panels to not cover the ime
+                final int width = mPrototypeController.getEdgeSensitivityWidth();
+                final int height = mContext.getDisplay().getHeight() - imeHeight
+                        - getResources().getDimensionPixelOffset(R.dimen.status_bar_height);
+                if (mLeftEdgePanel != null) {
+                    mLeftEdgePanel.setDimensions(width, height);
+                }
+                if (mRightEdgePanel != null) {
+                    mRightEdgePanel.setDimensions(width, height);
+                }
+            });
+        }
+
+        @Override
+        public void onShelfVisibilityChanged(boolean shelfVisible, int shelfHeight) {
+        }
+
+        @Override
+        public void onMinimizedStateChanged(boolean isMinimized) {
+        }
+
+        @Override
+        public void onMovementBoundsChanged(Rect insetBounds, Rect normalBounds,
+                Rect animatingBounds, boolean fromImeAdjustment, boolean fromShelfAdjustment,
+                int displayRotation) {
+        }
+
+        @Override
+        public void onActionsChanged(ParceledListSlice actions) {
+        }
     };
 
     public NavigationBarView(Context context, AttributeSet attrs) {
@@ -385,6 +434,7 @@
         mButtonDispatchers.put(R.id.back, new ButtonDispatcher(R.id.back));
         mButtonDispatchers.put(R.id.home, new ButtonDispatcher(R.id.home));
         mButtonDispatchers.put(R.id.home_handle, new ButtonDispatcher(R.id.home_handle));
+        mButtonDispatchers.put(R.id.assistant_handle, new ButtonDispatcher(R.id.assistant_handle));
         mButtonDispatchers.put(R.id.recent_apps, new ButtonDispatcher(R.id.recent_apps));
         mButtonDispatchers.put(R.id.menu, menuButton);
         mButtonDispatchers.put(R.id.ime_switcher, imeSwitcherButton);
@@ -582,6 +632,10 @@
         return mButtonDispatchers.get(R.id.home_handle);
     }
 
+    public ButtonDispatcher getAssistantHandle() {
+        return mButtonDispatchers.get(R.id.assistant_handle);
+    }
+
     public SparseArray<ButtonDispatcher> getButtonDispatchers() {
         return mButtonDispatchers;
     }
@@ -940,6 +994,24 @@
         }
     }
 
+    public void setAssistantAvailable(boolean available) {
+        mAssistantAvailable = available;
+        updateAssistantAvailability();
+    }
+
+    // TODO(b/112934365): move this back to NavigationBarFragment when prototype is removed
+    private void updateAssistantAvailability() {
+        boolean available = mAssistantAvailable && mPrototypeController.isAssistantGestureEnabled();
+        getAssistantHandle().setVisibility(available ? View.VISIBLE : View.GONE);
+        if (mOverviewProxyService.getProxy() != null) {
+            try {
+                mOverviewProxyService.getProxy().onAssistantAvailable(available);
+            } catch (RemoteException e) {
+                Log.w(TAG, "Unable to send assistant availability data to launcher");
+            }
+        }
+    }
+
     public void setMenuVisibility(final boolean show) {
         mContextualButtonGroup.setButtonVisiblity(R.id.menu, show);
     }
@@ -1267,13 +1339,19 @@
             int height = mPrototypeController.getEdgeSensitivityHeight();
             // Explicitly left and right, not start and end as this is device relative.
             mLeftEdgePanel = NavigationBarEdgePanel.create(getContext(), width, height,
-                    Gravity.LEFT | Gravity.BOTTOM);
+                    Gravity.LEFT | Gravity.TOP);
             mRightEdgePanel = NavigationBarEdgePanel.create(getContext(), width, height,
-                    Gravity.RIGHT | Gravity.BOTTOM);
+                    Gravity.RIGHT | Gravity.TOP);
             mLeftEdgePanel.setOnTouchListener(mEdgePanelTouchListener);
             mRightEdgePanel.setOnTouchListener(mEdgePanelTouchListener);
             wm.addView(mLeftEdgePanel, mLeftEdgePanel.getLayoutParams());
             wm.addView(mRightEdgePanel, mRightEdgePanel.getLayoutParams());
+
+            try {
+                WindowManagerWrapper.getInstance().addPinnedStackListener(mImeChangedListener);
+            } catch (RemoteException e) {
+                Log.e(TAG, "Failed to register pinned stack listener", e);
+            }
         }
     }
 
@@ -1298,6 +1376,7 @@
         if (mRightEdgePanel != null) {
             wm.removeView(mRightEdgePanel);
         }
+        WindowManagerWrapper.getInstance().removePinnedStackListener(mImeChangedListener);
     }
 
     private void setUpSwipeUpOnboarding(boolean connectedToOverviewProxy) {
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/phone/NavigationPrototypeController.java b/packages/SystemUI/src/com/android/systemui/statusbar/phone/NavigationPrototypeController.java
index 2c31e2c..31579c2 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/phone/NavigationPrototypeController.java
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/phone/NavigationPrototypeController.java
@@ -43,6 +43,7 @@
     private final String GESTURE_MATCH_SETTING = "quickstepcontroller_gesture_match_map";
     public static final String NAV_COLOR_ADAPT_ENABLE_SETTING = "navbar_color_adapt_enable";
     public static final String SHOW_HOME_HANDLE_SETTING = "quickstepcontroller_showhandle";
+    public static final String ENABLE_ASSISTANT_GESTURE = "ENABLE_ASSISTANT_GESTURE";
 
     @Retention(RetentionPolicy.SOURCE)
     @IntDef({ACTION_DEFAULT, ACTION_QUICKSTEP, ACTION_QUICKSCRUB, ACTION_BACK,
@@ -87,6 +88,7 @@
         registerObserver(NAV_COLOR_ADAPT_ENABLE_SETTING);
         registerObserver(EDGE_SENSITIVITY_WIDTH_SETTING);
         registerObserver(SHOW_HOME_HANDLE_SETTING);
+        registerObserver(ENABLE_ASSISTANT_GESTURE);
     }
 
     /**
@@ -119,6 +121,8 @@
                         getEdgeSensitivityHeight());
             } else if (path.endsWith(SHOW_HOME_HANDLE_SETTING)) {
                 mListener.onHomeHandleVisiblilityChanged(showHomeHandle());
+            } else if (path.endsWith(ENABLE_ASSISTANT_GESTURE)) {
+                mListener.onAssistantGestureEnabled(isAssistantGestureEnabled());
             }
         }
     }
@@ -162,6 +166,11 @@
         return getGlobalBool(SHOW_HOME_HANDLE_SETTING, false /* default */);
     }
 
+    boolean isAssistantGestureEnabled() {
+        return getGlobalBool(ENABLE_ASSISTANT_GESTURE, false /* default */);
+    }
+
+
     /**
      * Since Settings.Global cannot pass arrays, use a string to represent each character as a
      * gesture map to actions corresponding to {@see GestureAction}. The number is represented as:
@@ -201,5 +210,6 @@
         void onHomeHandleVisiblilityChanged(boolean visible);
         void onColorAdaptChanged(boolean enabled);
         void onEdgeSensitivityChanged(int width, int height);
+        void onAssistantGestureEnabled(boolean enabled);
     }
 }
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/phone/NotificationPanelView.java b/packages/SystemUI/src/com/android/systemui/statusbar/phone/NotificationPanelView.java
index f4fa1e8..142f398 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/phone/NotificationPanelView.java
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/phone/NotificationPanelView.java
@@ -18,6 +18,7 @@
 
 import static com.android.systemui.SysUiServiceProvider.getComponent;
 import static com.android.systemui.statusbar.notification.ActivityLaunchAnimator.ExpandAnimationParameters;
+import static com.android.systemui.util.InjectionInflationController.VIEW_CONTEXT;
 
 import android.animation.Animator;
 import android.animation.AnimatorListenerAdapter;
@@ -72,11 +73,13 @@
 import com.android.systemui.statusbar.KeyguardIndicationController;
 import com.android.systemui.statusbar.NotificationLockscreenUserManager;
 import com.android.systemui.statusbar.NotificationShelf;
+import com.android.systemui.statusbar.PulseExpansionHandler;
 import com.android.systemui.statusbar.RemoteInputController;
 import com.android.systemui.statusbar.StatusBarState;
 import com.android.systemui.statusbar.notification.ActivityLaunchAnimator;
 import com.android.systemui.statusbar.notification.AnimatableProperty;
 import com.android.systemui.statusbar.notification.NotificationEntryManager;
+import com.android.systemui.statusbar.notification.NotificationWakeUpCoordinator;
 import com.android.systemui.statusbar.notification.PropertyAnimator;
 import com.android.systemui.statusbar.notification.collection.NotificationEntry;
 import com.android.systemui.statusbar.notification.row.ActivatableNotificationView;
@@ -96,12 +99,16 @@
 import java.util.List;
 import java.util.function.Consumer;
 
+import javax.inject.Inject;
+import javax.inject.Named;
+
 public class NotificationPanelView extends PanelView implements
         ExpandableView.OnHeightChangedListener,
         View.OnClickListener, NotificationStackScrollLayout.OnOverscrollTopChangedListener,
         KeyguardAffordanceHelper.Callback, NotificationStackScrollLayout.OnEmptySpaceClickListener,
         OnHeadsUpChangedListener, QS.HeightListener, ZenModeController.Callback,
-        ConfigurationController.ConfigurationListener, StateListener {
+        ConfigurationController.ConfigurationListener, StateListener,
+        PulseExpansionHandler.ExpansionCallback {
 
     private static final boolean DEBUG = false;
 
@@ -136,6 +143,8 @@
 
     private final PowerManager mPowerManager;
     private final AccessibilityManager mAccessibilityManager;
+    private final NotificationWakeUpCoordinator mWakeUpCoordinator;
+    private final PulseExpansionHandler mPulseExpansionHandler;
 
     private KeyguardAffordanceHelper mAffordanceHelper;
     private KeyguardUserSwitcher mKeyguardUserSwitcher;
@@ -317,17 +326,22 @@
             Dependency.get(ShadeController.class);
     private int mDisplayId;
 
-    public NotificationPanelView(Context context, AttributeSet attrs) {
+    @Inject
+    public NotificationPanelView(@Named(VIEW_CONTEXT) Context context, AttributeSet attrs,
+            NotificationWakeUpCoordinator coordinator,
+            PulseExpansionHandler pulseExpansionHandler) {
         super(context, attrs);
         setWillNotDraw(!DEBUG);
         mFalsingManager = FalsingManager.getInstance(context);
         mPowerManager = context.getSystemService(PowerManager.class);
+        mWakeUpCoordinator = coordinator;
         mAccessibilityManager = context.getSystemService(AccessibilityManager.class);
         setAccessibilityPaneTitle(determineAccessibilityPaneTitle());
         mAlphaPaint.setXfermode(new PorterDuffXfermode(PorterDuff.Mode.MULTIPLY));
         setPanelAlpha(255, false /* animate */);
         mCommandQueue = getComponent(context, CommandQueue.class);
         mDisplayId = context.getDisplayId();
+        mPulseExpansionHandler = pulseExpansionHandler;
     }
 
     /**
@@ -364,7 +378,9 @@
 
         initBottomArea();
 
+        mWakeUpCoordinator.setStackScroller(mNotificationStackScroller);
         mQsFrame = findViewById(R.id.qs_frame);
+        mPulseExpansionHandler.setUp(mNotificationStackScroller, this, mShadeController);
     }
 
     @Override
@@ -594,8 +610,7 @@
             stackScrollerPadding = mClockPositionResult.stackScrollerPadding;
         }
         mNotificationStackScroller.setIntrinsicPadding(stackScrollerPadding);
-        int burnInXOffset = mPulsing ? 0 : mClockPositionResult.clockX;
-        mNotificationStackScroller.setAntiBurnInOffsetX(burnInXOffset);
+        mNotificationStackScroller.setAntiBurnInOffsetX(mClockPositionResult.clockX);
 
         mStackScrollerMeasuringPass++;
         requestScrollerTopPaddingUpdate(animate);
@@ -786,6 +801,9 @@
             MetricsLogger.count(mContext, COUNTER_PANEL_OPEN_PEEK, 1);
             return true;
         }
+        if (mPulseExpansionHandler.onInterceptTouchEvent(event)) {
+            return true;
+        }
 
         if (!isFullyCollapsed() && onQsIntercept(event)) {
             return true;
@@ -945,6 +963,10 @@
             return false;
         }
         initDownStates(event);
+        if (!mIsExpanding && mPulseExpansionHandler.onTouchEvent(event)) {
+            // We're expanding all the other ones shouldn't get this anymore
+            return true;
+        }
         if (mListenForHeadsUp && !mHeadsUpTouchHelper.isTrackingHeadsUp()
                 && mHeadsUpTouchHelper.onInterceptTouchEvent(event)) {
             mIsExpansionFromHeadsUp = true;
@@ -1488,16 +1510,16 @@
             int max = mBarState == StatusBarState.KEYGUARD
                     ? Math.max(maxNotificationPadding, maxQsPadding)
                     : maxQsPadding;
-            return (int) interpolate(getExpandedFraction(),
-                    mQsMinExpansionHeight, max);
+            return (int) MathUtils.lerp((float) mQsMinExpansionHeight, (float) max,
+                    getExpandedFraction());
         } else if (mQsSizeChangeAnimator != null) {
             return (int) mQsSizeChangeAnimator.getAnimatedValue();
         } else if (mKeyguardShowing) {
             // We can only do the smoother transition on Keyguard when we also are not collapsing
             // from a scrolled quick settings.
-            return interpolate(getQsExpansionFraction(),
-                    mNotificationStackScroller.getIntrinsicPadding(),
-                    mQsMaxExpansionHeight + mQsNotificationTopPadding);
+            return MathUtils.lerp((float) mNotificationStackScroller.getIntrinsicPadding(),
+                    (float) (mQsMaxExpansionHeight + mQsNotificationTopPadding),
+                    getQsExpansionFraction());
         } else {
             return mQsExpansionHeight + mQsNotificationTopPadding;
         }
@@ -1698,7 +1720,6 @@
         updateUnlockIcon();
         updateNotificationTranslucency();
         updatePanelExpanded();
-        mNotificationStackScroller.setShadeExpanded(!isFullyCollapsed());
         if (DEBUG) {
             invalidate();
         }
@@ -2812,9 +2833,6 @@
 
         final float darkAmount = dozing ? 1 : 0;
         mStatusBarStateController.setDozeAmount(darkAmount, animate);
-        if (animate) {
-            mNotificationStackScroller.notifyDarkAnimationStart(mDozing);
-        }
     }
 
     @Override
@@ -2825,7 +2843,6 @@
         mKeyguardStatusView.setDarkAmount(mInterpolatedDarkAmount);
         mKeyguardBottomArea.setDarkAmount(mInterpolatedDarkAmount);
         positionClockAndNotifications();
-        mNotificationStackScroller.setDarkAmount(linearAmount, mInterpolatedDarkAmount);
     }
 
     public void setPulsing(boolean pulsing) {
@@ -2936,6 +2953,9 @@
         if (mKeyguardStatusBar != null) {
             mKeyguardStatusBar.dump(fd, pw, args);
         }
+        if (mKeyguardStatusView != null) {
+            mKeyguardStatusView.dump(fd, pw, args);
+        }
     }
 
     public boolean hasActiveClearableNotifications() {
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/phone/PanelView.java b/packages/SystemUI/src/com/android/systemui/statusbar/phone/PanelView.java
index 4d0c8c3..2495d22 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/phone/PanelView.java
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/phone/PanelView.java
@@ -1172,9 +1172,11 @@
     }
 
     protected void notifyBarPanelExpansionChanged() {
-        mBar.panelExpansionChanged(mExpandedFraction, mExpandedFraction > 0f
-                || mPeekAnimator != null || mInstantExpanding || isPanelVisibleBecauseOfHeadsUp()
-                || mTracking || mHeightAnimator != null);
+        if (mBar != null) {
+            mBar.panelExpansionChanged(mExpandedFraction, mExpandedFraction > 0f
+                    || mPeekAnimator != null || mInstantExpanding
+                    || isPanelVisibleBecauseOfHeadsUp() || mTracking || mHeightAnimator != null);
+        }
         if (mExpansionListener != null) {
             mExpansionListener.accept(mExpandedFraction, mTracking);
         }
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/phone/QuickStepController.java b/packages/SystemUI/src/com/android/systemui/statusbar/phone/QuickStepController.java
index 73ab527..3398fd34 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/phone/QuickStepController.java
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/phone/QuickStepController.java
@@ -192,10 +192,6 @@
      */
     @Override
     public boolean onInterceptTouchEvent(MotionEvent event) {
-        if (mStatusBar.isKeyguardShowing()) {
-            // Disallow any handling when the keyguard is showing
-            return false;
-        }
         return handleTouchEvent(event);
     }
 
@@ -205,11 +201,6 @@
      */
     @Override
     public boolean onTouchEvent(MotionEvent event) {
-        if (mStatusBar.isKeyguardShowing()) {
-            // Disallow any handling when the keyguard is showing
-            return false;
-        }
-
         // The same down event was just sent on intercept and therefore can be ignored here
         final boolean ignoreProxyDownEvent = event.getAction() == MotionEvent.ACTION_DOWN
                 && mOverviewEventSender.getProxy() != null
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/phone/ScrimController.java b/packages/SystemUI/src/com/android/systemui/statusbar/phone/ScrimController.java
index 7bbd3b5..265fa2c 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/phone/ScrimController.java
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/phone/ScrimController.java
@@ -114,6 +114,7 @@
     private final DozeParameters mDozeParameters;
     private final AlarmTimeout mTimeTicker;
     private final KeyguardVisibilityCallback mKeyguardVisibilityCallback;
+    private final Handler mHandler;
 
     private final SysuiColorExtractor mColorExtractor;
     private GradientColors mLockColors;
@@ -174,8 +175,9 @@
         mKeyguardVisibilityCallback = new KeyguardVisibilityCallback();
         mKeyguardUpdateMonitor.registerCallback(mKeyguardVisibilityCallback);
         mScrimBehindAlphaResValue = mContext.getResources().getFloat(R.dimen.scrim_behind_alpha);
+        mHandler = getHandler();
         mTimeTicker = new AlarmTimeout(alarmManager, this::onHideWallpaperTimeout,
-                "hide_aod_wallpaper", new Handler());
+                "hide_aod_wallpaper", mHandler);
         mWakeLock = createWakeLock();
         // Scrim alpha is initially set to the value on the resource but might be changed
         // to make sure that text on top of it is legible.
@@ -253,8 +255,8 @@
             mScrimBehind.removeCallbacks(mPendingFrameCallback);
             mPendingFrameCallback = null;
         }
-        if (getHandler().hasCallbacks(mBlankingTransitionRunnable)) {
-            getHandler().removeCallbacks(mBlankingTransitionRunnable);
+        if (mHandler.hasCallbacks(mBlankingTransitionRunnable)) {
+            mHandler.removeCallbacks(mBlankingTransitionRunnable);
             mBlankingTransitionRunnable = null;
         }
 
@@ -419,6 +421,8 @@
                         interpolatedFract);
                 mCurrentInFrontAlpha = 0;
             }
+            mCurrentBehindTint = ColorUtils.blendARGB(ScrimState.BOUNCER.getBehindTint(),
+                    mState.getBehindTint(), interpolatedFract);
         }
     }
 
@@ -768,7 +772,7 @@
             if (DEBUG) {
                 Log.d(TAG, "Fading out scrims with delay: " + delay);
             }
-            getHandler().postDelayed(mBlankingTransitionRunnable, delay);
+            mHandler.postDelayed(mBlankingTransitionRunnable, delay);
         };
         doOnTheNextFrame(mPendingFrameCallback);
     }
@@ -786,7 +790,7 @@
 
     @VisibleForTesting
     protected Handler getHandler() {
-        return Handler.getMain();
+        return new Handler();
     }
 
     public int getBackgroundColor() {
@@ -821,8 +825,7 @@
 
     @VisibleForTesting
     protected WakeLock createWakeLock() {
-         return new DelayedWakeLock(getHandler(),
-                WakeLock.createPartial(mContext, "Scrims"));
+        return new DelayedWakeLock(mHandler, WakeLock.createPartial(mContext, "Scrims"));
     }
 
     @Override
@@ -853,12 +856,11 @@
      */
     public void onScreenTurnedOn() {
         mScreenOn = true;
-        final Handler handler = getHandler();
-        if (handler.hasCallbacks(mBlankingTransitionRunnable)) {
+        if (mHandler.hasCallbacks(mBlankingTransitionRunnable)) {
             if (DEBUG) {
                 Log.d(TAG, "Shorter blanking because screen turned on. All good.");
             }
-            handler.removeCallbacks(mBlankingTransitionRunnable);
+            mHandler.removeCallbacks(mBlankingTransitionRunnable);
             mBlankingTransitionRunnable.run();
         }
     }
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/phone/ScrimState.java b/packages/SystemUI/src/com/android/systemui/statusbar/phone/ScrimState.java
index bbeebd6..ccf5e4e 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/phone/ScrimState.java
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/phone/ScrimState.java
@@ -54,6 +54,8 @@
             } else {
                 mAnimationDuration = ScrimController.ANIMATION_DURATION;
             }
+            mCurrentInFrontTint = Color.BLACK;
+            mCurrentBehindTint = Color.BLACK;
             mCurrentBehindAlpha = mScrimBehindAlphaKeyguard;
             mCurrentInFrontAlpha = 0;
         }
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/phone/StatusBar.java b/packages/SystemUI/src/com/android/systemui/statusbar/phone/StatusBar.java
index 41580f6..60b1659 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/phone/StatusBar.java
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/phone/StatusBar.java
@@ -184,6 +184,7 @@
 import com.android.systemui.statusbar.NotificationRemoteInputManager;
 import com.android.systemui.statusbar.NotificationShelf;
 import com.android.systemui.statusbar.NotificationViewHierarchyManager;
+import com.android.systemui.statusbar.PulseExpansionHandler;
 import com.android.systemui.statusbar.ScrimView;
 import com.android.systemui.statusbar.StatusBarState;
 import com.android.systemui.statusbar.SysuiStatusBarStateController;
@@ -195,6 +196,7 @@
 import com.android.systemui.statusbar.notification.NotificationEntryManager;
 import com.android.systemui.statusbar.notification.NotificationInterruptionStateProvider;
 import com.android.systemui.statusbar.notification.NotificationListController;
+import com.android.systemui.statusbar.notification.NotificationWakeUpCoordinator;
 import com.android.systemui.statusbar.notification.VisualStabilityManager;
 import com.android.systemui.statusbar.notification.collection.NotificationEntry;
 import com.android.systemui.statusbar.notification.collection.NotificationRowBinderImpl;
@@ -223,6 +225,7 @@
 import com.android.systemui.statusbar.policy.UserInfoControllerImpl;
 import com.android.systemui.statusbar.policy.UserSwitcherController;
 import com.android.systemui.statusbar.policy.ZenModeController;
+import com.android.systemui.tuner.TunerService;
 import com.android.systemui.util.InjectionInflationController;
 import com.android.systemui.volume.VolumeComponent;
 
@@ -363,6 +366,10 @@
     protected StatusBarIconController mIconController;
     @Inject
     InjectionInflationController mInjectionInflater;
+    @Inject
+    PulseExpansionHandler mPulseExpansionHandler;
+    @Inject
+    NotificationWakeUpCoordinator mWakeUpCoordinator;
 
     // expanded notifications
     protected NotificationPanelView mNotificationPanel; // the sliding/resizing panel within the notification window
@@ -1079,7 +1086,7 @@
 
     @Override
     public boolean isDozing() {
-        return mDozing && mNotificationPanel.isFullyDark();
+        return mDozing;
     }
 
     @Override
@@ -1202,8 +1209,7 @@
         mBiometricUnlockController = new BiometricUnlockController(mContext,
                 mDozeScrimController, keyguardViewMediator,
                 mScrimController, this, UnlockMethodCache.getInstance(mContext),
-                new Handler(), mKeyguardUpdateMonitor, mContext.getResources().getInteger(
-                com.android.internal.R.integer.config_wakeUpDelayDoze));
+                new Handler(), mKeyguardUpdateMonitor, Dependency.get(TunerService.class));
         mStatusBarKeyguardViewManager = keyguardViewMediator.registerStatusBar(this,
                 getBouncerContainer(), mNotificationPanel, mBiometricUnlockController);
         mKeyguardIndicationController
@@ -2965,7 +2971,7 @@
         mHandler.removeMessages(MSG_LAUNCH_TRANSITION_TIMEOUT);
         if (mUserSwitcherController != null && mUserSwitcherController.useFullscreenUserSwitcher()) {
             mStatusBarStateController.setState(StatusBarState.FULLSCREEN_USER_SWITCHER);
-        } else {
+        } else if (!mPulseExpansionHandler.isWakingToShadeLocked()){
             mStatusBarStateController.setState(StatusBarState.KEYGUARD);
         }
         updatePanelExpansionForKeyguard();
@@ -3202,7 +3208,9 @@
 
         boolean sleepingFromKeyguard =
                 mStatusBarKeyguardViewManager.isGoingToSleepVisibleNotOccluded();
-        boolean animate = (!mDozing && mDozeServiceHost.shouldAnimateWakeup())
+        boolean wakeAndUnlock = mBiometricUnlockController.getMode()
+                == BiometricUnlockController.MODE_WAKE_AND_UNLOCK;
+        boolean animate = (!mDozing && mDozeServiceHost.shouldAnimateWakeup() && !wakeAndUnlock)
                 || (mDozing && mDozeServiceHost.shouldAnimateScreenOff() && sleepingFromKeyguard);
 
         mNotificationPanel.setDozing(mDozing, animate, mWakeUpTouchLocation);
@@ -3588,12 +3596,19 @@
         @Override
         public void onStartedWakingUp() {
             mDeviceInteractive = true;
+            mWakeUpCoordinator.setWakingUp(true);
             mAmbientPulseManager.releaseAllImmediately();
             mVisualStabilityManager.setScreenOn(true);
             updateNotificationPanelTouchState();
             updateVisibleToUser();
             updateIsKeyguard();
             mDozeServiceHost.stopDozing();
+            mPulseExpansionHandler.onStartedWakingUp();
+        }
+
+        @Override
+        public void onFinishedWakingUp() {
+            mWakeUpCoordinator.setWakingUp(false);
         }
     };
 
@@ -3866,7 +3881,7 @@
                 return;
             }
 
-            boolean passiveAuthInterrupt = reason == DozeLog.PULSE_REASON_SENSOR_WAKE_LOCK_SCREEN;
+            boolean passiveAuthInterrupt = reason == DozeLog.PULSE_REASON_NOTIFICATION;
             // Set the state to pulsing, so ScrimController will know what to do once we ask it to
             // execute the transition. The pulse callback will then be invoked when the scrims
             // are black, indicating that StatusBar is ready to present the rest of the UI.
@@ -3896,6 +3911,7 @@
                         mKeyguardUpdateMonitor.onAuthInterruptDetected(pulsing /* active */);
                     }
                     updateScrimController();
+                    mPulseExpansionHandler.setPulsing(pulsing);
                 }
             }, reason);
             // DozeScrimController is in pulse state, now let's ask ScrimController to start
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/phone/StatusBarIconControllerImpl.java b/packages/SystemUI/src/com/android/systemui/statusbar/phone/StatusBarIconControllerImpl.java
index f846036..e0b1846 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/phone/StatusBarIconControllerImpl.java
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/phone/StatusBarIconControllerImpl.java
@@ -42,6 +42,7 @@
 import java.io.FileDescriptor;
 import java.io.PrintWriter;
 import java.util.ArrayList;
+import java.util.Collections;
 import java.util.List;
 
 import javax.inject.Inject;
@@ -122,7 +123,7 @@
         // Remove all the icons.
         for (int i = currentSlots.size() - 1; i >= 0; i--) {
             Slot s = currentSlots.get(i);
-            slotsToReAdd.put(s, s.getHolderListInViewOrder());
+            slotsToReAdd.put(s, s.getHolderList());
             removeAllIconsForSlot(s.getName());
         }
 
@@ -200,6 +201,10 @@
         Slot mobileSlot = getSlot(slot);
         int slotIndex = getSlotIndex(slot);
 
+        // Reverse the sort order to show icons with left to right([Slot1][Slot2]..).
+        // StatusBarIconList has UI design that first items go to the right of second items.
+        Collections.reverse(iconStates);
+
         for (MobileIconState state : iconStates) {
             StatusBarIconHolder holder = mobileSlot.getHolderForTag(state.subId);
             if (holder == null) {
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/phone/StatusBarIconList.java b/packages/SystemUI/src/com/android/systemui/statusbar/phone/StatusBarIconList.java
index 2e41617..c876c32 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/phone/StatusBarIconList.java
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/phone/StatusBarIconList.java
@@ -250,6 +250,25 @@
             return holders;
         }
 
+        /**
+         * Build a list of the {@link StatusBarIconHolder}s in the same order.
+         * This provides a safe list that can be iterated and inserted into its group.
+         *
+         * @return all holders contained here
+         */
+        public List<StatusBarIconHolder> getHolderList() {
+            ArrayList<StatusBarIconHolder> holders = new ArrayList<>();
+            if (mHolder != null) {
+                holders.add(mHolder);
+            }
+
+            if (mSubSlots != null) {
+                holders.addAll(mSubSlots);
+            }
+
+            return holders;
+        }
+
         @Override
         public String toString() {
             return String.format("(%s) %s", mName, subSlotsString());
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/phone/StatusBarWindowController.java b/packages/SystemUI/src/com/android/systemui/statusbar/phone/StatusBarWindowController.java
index ce69a48..8d71ab8 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/phone/StatusBarWindowController.java
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/phone/StatusBarWindowController.java
@@ -280,6 +280,15 @@
         }
     }
 
+    private void applyStatusBarColorSpaceAgnosticFlag(State state) {
+        if (!isExpanded(state)) {
+            mLpChanged.privateFlags |= WindowManager.LayoutParams.PRIVATE_FLAG_COLOR_SPACE_AGNOSTIC;
+        } else {
+            mLpChanged.privateFlags &=
+                    ~WindowManager.LayoutParams.PRIVATE_FLAG_COLOR_SPACE_AGNOSTIC;
+        }
+    }
+
     private void apply(State state) {
         applyKeyguardFlags(state);
         applyForceStatusBarVisibleFlag(state);
@@ -294,6 +303,7 @@
         applyBrightness(state);
         applyHasTopUi(state);
         applyNotTouchable(state);
+        applyStatusBarColorSpaceAgnosticFlag(state);
         if (mLp != null && mLp.copyFrom(mLpChanged) != 0) {
             mWindowManager.updateViewLayout(mStatusBarView, mLp);
         }
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/phone/StatusBarWindowView.java b/packages/SystemUI/src/com/android/systemui/statusbar/phone/StatusBarWindowView.java
index 50c4fac..a8ae5f6 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/phone/StatusBarWindowView.java
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/phone/StatusBarWindowView.java
@@ -388,7 +388,8 @@
         if (mNotificationPanel.isFullyExpanded()
                 && stackScrollLayout.getVisibility() == View.VISIBLE
                 && mStatusBarStateController.getState() == StatusBarState.KEYGUARD
-                && !mService.isBouncerShowing()) {
+                && !mService.isBouncerShowing()
+                && !mService.isDozing()) {
             intercept = mDragDownHelper.onInterceptTouchEvent(ev);
         }
         if (!intercept) {
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/policy/BatteryController.java b/packages/SystemUI/src/com/android/systemui/statusbar/policy/BatteryController.java
index 5e94152..111cdd2 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/policy/BatteryController.java
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/policy/BatteryController.java
@@ -16,6 +16,8 @@
 
 package com.android.systemui.statusbar.policy;
 
+import android.annotation.Nullable;
+
 import com.android.systemui.DemoMode;
 import com.android.systemui.Dumpable;
 import com.android.systemui.statusbar.policy.BatteryController.BatteryStateChangeCallback;
@@ -78,6 +80,6 @@
          * The callback
          * @param estimate the estimate
          */
-        void onBatteryRemainingEstimateRetrieved(String estimate);
+        void onBatteryRemainingEstimateRetrieved(@Nullable String estimate);
     }
 }
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/policy/BatteryControllerImpl.java b/packages/SystemUI/src/com/android/systemui/statusbar/policy/BatteryControllerImpl.java
index af3c96f..273fa55 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/policy/BatteryControllerImpl.java
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/policy/BatteryControllerImpl.java
@@ -226,7 +226,7 @@
 
         String percentage = NumberFormat.getPercentInstance().format((double) mLevel / 100.0);
         return PowerUtil.getBatteryRemainingShortStringFormatted(
-                mContext, mEstimate.estimateMillis);
+                mContext, mEstimate.getEstimateMillis());
     }
 
     private void updateEstimateInBackground() {
@@ -237,10 +237,10 @@
 
         mFetchingEstimate = true;
         Dependency.get(Dependency.BG_HANDLER).post(() -> {
-            mEstimate = mEstimates.getEstimate();
+            // Only fetch the estimate if they are enabled
+            mEstimate = mEstimates.isHybridNotificationEnabled() ? mEstimates.getEstimate() : null;
             mLastEstimateTimestamp = System.currentTimeMillis();
             mFetchingEstimate = false;
-
             Dependency.get(Dependency.MAIN_HANDLER).post(this::notifyEstimateFetchCallbacks);
         });
     }
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/policy/HotspotControllerImpl.java b/packages/SystemUI/src/com/android/systemui/statusbar/policy/HotspotControllerImpl.java
index b561ac1..db2be0e 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/policy/HotspotControllerImpl.java
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/policy/HotspotControllerImpl.java
@@ -93,14 +93,28 @@
         return null;
     }
 
+    /**
+     * Adds {@code callback} to the controller. The controller will update the callback on state
+     * changes. It will immediately trigger the callback added to notify current state.
+     * @param callback
+     */
     @Override
     public void addCallback(Callback callback) {
         synchronized (mCallbacks) {
             if (callback == null || mCallbacks.contains(callback)) return;
             if (DEBUG) Log.d(TAG, "addCallback " + callback);
             mCallbacks.add(callback);
-
-            updateWifiStateListeners(!mCallbacks.isEmpty());
+            if (mWifiManager != null) {
+                if (mCallbacks.size() == 1) {
+                    mWifiManager.registerSoftApCallback(this, mMainHandler);
+                } else {
+                    // mWifiManager#registerSoftApCallback triggers a call to onNumClientsChanged
+                    // on the Main Handler. In order to always update the callback on added, we
+                    // make this call when adding callbacks after the first.
+                    mMainHandler.post(() ->
+                            callback.onHotspotChanged(isHotspotEnabled(), mNumConnectedDevices));
+                }
+            }
         }
     }
 
@@ -110,27 +124,9 @@
         if (DEBUG) Log.d(TAG, "removeCallback " + callback);
         synchronized (mCallbacks) {
             mCallbacks.remove(callback);
-            updateWifiStateListeners(!mCallbacks.isEmpty());
-        }
-    }
-
-    /**
-     * Updates the wifi state receiver to either start or stop listening to get updates to the
-     * hotspot status. Additionally starts listening to wifi manager state to track the number of
-     * connected devices.
-     *
-     * @param shouldListen whether we should start listening to various wifi statuses
-     */
-    private void updateWifiStateListeners(boolean shouldListen) {
-        if (mWifiManager == null) {
-            return;
-        }
-        if (shouldListen) {
-            mWifiManager.registerSoftApCallback(
-                    this,
-                    mMainHandler);
-        } else {
-            mWifiManager.unregisterSoftApCallback(this);
+            if (mCallbacks.isEmpty() && mWifiManager != null) {
+                mWifiManager.unregisterSoftApCallback(this);
+            }
         }
     }
 
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/policy/InflatedSmartReplies.java b/packages/SystemUI/src/com/android/systemui/statusbar/policy/InflatedSmartReplies.java
new file mode 100644
index 0000000..5b2e398
--- /dev/null
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/policy/InflatedSmartReplies.java
@@ -0,0 +1,264 @@
+/*
+ * Copyright (C) 2019 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 com.android.systemui.statusbar.policy;
+
+import android.annotation.NonNull;
+import android.annotation.Nullable;
+import android.app.Notification;
+import android.app.RemoteInput;
+import android.content.Context;
+import android.content.Intent;
+import android.content.pm.ResolveInfo;
+import android.os.Build;
+import android.util.Log;
+import android.util.Pair;
+import android.widget.Button;
+
+import com.android.internal.util.ArrayUtils;
+import com.android.systemui.Dependency;
+import com.android.systemui.shared.system.ActivityManagerWrapper;
+import com.android.systemui.shared.system.DevicePolicyManagerWrapper;
+import com.android.systemui.shared.system.PackageManagerWrapper;
+import com.android.systemui.statusbar.SmartReplyController;
+import com.android.systemui.statusbar.notification.collection.NotificationEntry;
+
+import java.util.ArrayList;
+import java.util.List;
+
+/**
+ * Holder for inflated smart replies and actions. These objects should be inflated on a background
+ * thread, to later be accessed and modified on the (performance critical) UI thread.
+ */
+public class InflatedSmartReplies {
+    private static final String TAG = "InflatedSmartReplies";
+    private static final boolean DEBUG = Log.isLoggable(TAG, Log.DEBUG);
+    @Nullable private final SmartReplyView mSmartReplyView;
+    @Nullable private final List<Button> mSmartSuggestionButtons;
+    @NonNull private final SmartRepliesAndActions mSmartRepliesAndActions;
+
+    private InflatedSmartReplies(
+            @Nullable SmartReplyView smartReplyView,
+            @Nullable List<Button> smartSuggestionButtons,
+            @NonNull SmartRepliesAndActions smartRepliesAndActions) {
+        mSmartReplyView = smartReplyView;
+        mSmartSuggestionButtons = smartSuggestionButtons;
+        mSmartRepliesAndActions = smartRepliesAndActions;
+    }
+
+    @Nullable public SmartReplyView getSmartReplyView() {
+        return mSmartReplyView;
+    }
+
+    @Nullable public List<Button> getSmartSuggestionButtons() {
+        return mSmartSuggestionButtons;
+    }
+
+    @NonNull public SmartRepliesAndActions getSmartRepliesAndActions() {
+        return mSmartRepliesAndActions;
+    }
+
+    /**
+     * Inflate a SmartReplyView and its smart suggestions.
+     */
+    public static InflatedSmartReplies inflate(
+            Context context,
+            NotificationEntry entry,
+            SmartReplyConstants smartReplyConstants,
+            SmartReplyController smartReplyController,
+            HeadsUpManager headsUpManager) {
+        SmartRepliesAndActions smartRepliesAndActions =
+                chooseSmartRepliesAndActions(smartReplyConstants, entry);
+        if (!shouldShowSmartReplyView(entry, smartRepliesAndActions)) {
+            return new InflatedSmartReplies(null /* smartReplyView */,
+                    null /* smartSuggestionButtons */, smartRepliesAndActions);
+        }
+
+        SmartReplyView smartReplyView = SmartReplyView.inflate(context);
+
+        List<Button> suggestionButtons = new ArrayList<>();
+        if (smartRepliesAndActions.smartReplies != null) {
+            suggestionButtons.addAll(smartReplyView.inflateRepliesFromRemoteInput(
+                    smartRepliesAndActions.smartReplies, smartReplyController, entry));
+        }
+        if (smartRepliesAndActions.smartActions != null) {
+            suggestionButtons.addAll(
+                    smartReplyView.inflateSmartActions(smartRepliesAndActions.smartActions,
+                            smartReplyController, entry, headsUpManager));
+        }
+
+        return new InflatedSmartReplies(smartReplyView, suggestionButtons,
+                smartRepliesAndActions);
+    }
+
+    /**
+     * Returns whether we should show the smart reply view and its smart suggestions.
+     */
+    public static boolean shouldShowSmartReplyView(
+            NotificationEntry entry,
+            SmartRepliesAndActions smartRepliesAndActions) {
+        if (smartRepliesAndActions.smartReplies == null
+                && smartRepliesAndActions.smartActions == null) {
+            // There are no smart replies and no smart actions.
+            return false;
+        }
+        // If we are showing the spinner we don't want to add the buttons.
+        boolean showingSpinner = entry.notification.getNotification()
+                .extras.getBoolean(Notification.EXTRA_SHOW_REMOTE_INPUT_SPINNER, false);
+        if (showingSpinner) {
+            return false;
+        }
+        // If we are keeping the notification around while sending we don't want to add the buttons.
+        boolean hideSmartReplies = entry.notification.getNotification()
+                .extras.getBoolean(Notification.EXTRA_HIDE_SMART_REPLIES, false);
+        if (hideSmartReplies) {
+            return false;
+        }
+        return true;
+    }
+
+    /**
+     * Chose what smart replies and smart actions to display. App generated suggestions take
+     * precedence. So if the app provides any smart replies, we don't show any
+     * replies or actions generated by the NotificationAssistantService (NAS), and if the app
+     * provides any smart actions we also don't show any NAS-generated replies or actions.
+     */
+    @NonNull
+    public static SmartRepliesAndActions chooseSmartRepliesAndActions(
+            SmartReplyConstants smartReplyConstants,
+            final NotificationEntry entry) {
+        Notification notification = entry.notification.getNotification();
+        Pair<RemoteInput, Notification.Action> remoteInputActionPair =
+                notification.findRemoteInputActionPair(false /* freeform */);
+        Pair<RemoteInput, Notification.Action> freeformRemoteInputActionPair =
+                notification.findRemoteInputActionPair(true /* freeform */);
+
+        if (!smartReplyConstants.isEnabled()) {
+            if (DEBUG) {
+                Log.d(TAG, "Smart suggestions not enabled, not adding suggestions for "
+                        + entry.notification.getKey());
+            }
+            return new SmartRepliesAndActions(null, null);
+        }
+        // Only use smart replies from the app if they target P or above. We have this check because
+        // the smart reply API has been used for other things (Wearables) in the past. The API to
+        // add smart actions is new in Q so it doesn't require a target-sdk check.
+        boolean enableAppGeneratedSmartReplies = (!smartReplyConstants.requiresTargetingP()
+                || entry.targetSdk >= Build.VERSION_CODES.P);
+
+        boolean appGeneratedSmartRepliesExist =
+                enableAppGeneratedSmartReplies
+                        && remoteInputActionPair != null
+                        && !ArrayUtils.isEmpty(remoteInputActionPair.first.getChoices())
+                        && remoteInputActionPair.second.actionIntent != null;
+
+        List<Notification.Action> appGeneratedSmartActions = notification.getContextualActions();
+        boolean appGeneratedSmartActionsExist = !appGeneratedSmartActions.isEmpty();
+
+        SmartReplyView.SmartReplies smartReplies = null;
+        SmartReplyView.SmartActions smartActions = null;
+        if (appGeneratedSmartRepliesExist) {
+            smartReplies = new SmartReplyView.SmartReplies(
+                    remoteInputActionPair.first.getChoices(),
+                    remoteInputActionPair.first,
+                    remoteInputActionPair.second.actionIntent,
+                    false /* fromAssistant */);
+        }
+        if (appGeneratedSmartActionsExist) {
+            smartActions = new SmartReplyView.SmartActions(appGeneratedSmartActions,
+                    false /* fromAssistant */);
+        }
+        // Apps didn't provide any smart replies / actions, use those from NAS (if any).
+        if (!appGeneratedSmartRepliesExist && !appGeneratedSmartActionsExist) {
+            boolean useGeneratedReplies = !ArrayUtils.isEmpty(entry.systemGeneratedSmartReplies)
+                    && freeformRemoteInputActionPair != null
+                    && freeformRemoteInputActionPair.second.getAllowGeneratedReplies()
+                    && freeformRemoteInputActionPair.second.actionIntent != null;
+            if (useGeneratedReplies) {
+                smartReplies = new SmartReplyView.SmartReplies(
+                        entry.systemGeneratedSmartReplies,
+                        freeformRemoteInputActionPair.first,
+                        freeformRemoteInputActionPair.second.actionIntent,
+                        true /* fromAssistant */);
+            }
+            boolean useSmartActions = !ArrayUtils.isEmpty(entry.systemGeneratedSmartActions)
+                    && notification.getAllowSystemGeneratedContextualActions();
+            if (useSmartActions) {
+                List<Notification.Action> systemGeneratedActions =
+                        entry.systemGeneratedSmartActions;
+                // Filter actions if we're in kiosk-mode - we don't care about screen pinning mode,
+                // since notifications aren't shown there anyway.
+                ActivityManagerWrapper activityManagerWrapper =
+                        Dependency.get(ActivityManagerWrapper.class);
+                if (activityManagerWrapper.isLockTaskKioskModeActive()) {
+                    systemGeneratedActions = filterWhiteListedLockTaskApps(systemGeneratedActions);
+                }
+                smartActions = new SmartReplyView.SmartActions(
+                        systemGeneratedActions, true /* fromAssistant */);
+            }
+        }
+        return new SmartRepliesAndActions(smartReplies, smartActions);
+    }
+
+    /**
+     * Filter actions so that only actions pointing to whitelisted apps are allowed.
+     * This filtering is only meaningful when in lock-task mode.
+     */
+    private static List<Notification.Action> filterWhiteListedLockTaskApps(
+            List<Notification.Action> actions) {
+        PackageManagerWrapper packageManagerWrapper = Dependency.get(PackageManagerWrapper.class);
+        DevicePolicyManagerWrapper devicePolicyManagerWrapper =
+                Dependency.get(DevicePolicyManagerWrapper.class);
+        List<Notification.Action> filteredActions = new ArrayList<>();
+        for (Notification.Action action : actions) {
+            if (action.actionIntent == null) continue;
+            Intent intent = action.actionIntent.getIntent();
+            //  Only allow actions that are explicit (implicit intents are not handled in lock-task
+            //  mode), and link to whitelisted apps.
+            ResolveInfo resolveInfo = packageManagerWrapper.resolveActivity(intent, 0 /* flags */);
+            if (resolveInfo != null && devicePolicyManagerWrapper.isLockTaskPermitted(
+                    resolveInfo.activityInfo.packageName)) {
+                filteredActions.add(action);
+            }
+        }
+        return filteredActions;
+    }
+
+    /**
+     * Returns whether the {@link Notification} represented by entry has a free-form remote input.
+     * Such an input can be used e.g. to implement smart reply buttons - by passing the replies
+     * through the remote input.
+     */
+    public static boolean hasFreeformRemoteInput(NotificationEntry entry) {
+        Notification notification = entry.notification.getNotification();
+        return null != notification.findRemoteInputActionPair(true /* freeform */);
+    }
+
+    /**
+     * A storage for smart replies and smart action.
+     */
+    public static class SmartRepliesAndActions {
+        @Nullable public final SmartReplyView.SmartReplies smartReplies;
+        @Nullable public final SmartReplyView.SmartActions smartActions;
+
+        SmartRepliesAndActions(
+                @Nullable SmartReplyView.SmartReplies smartReplies,
+                @Nullable SmartReplyView.SmartActions smartActions) {
+            this.smartReplies = smartReplies;
+            this.smartActions = smartActions;
+        }
+    }
+}
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/policy/SmartReplyConstants.java b/packages/SystemUI/src/com/android/systemui/statusbar/policy/SmartReplyConstants.java
index 8b81585..72f4fc7 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/policy/SmartReplyConstants.java
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/policy/SmartReplyConstants.java
@@ -21,13 +21,14 @@
 import android.app.RemoteInput;
 import android.content.Context;
 import android.content.res.Resources;
-import android.database.ContentObserver;
-import android.net.Uri;
 import android.os.Handler;
-import android.provider.Settings;
+import android.provider.DeviceConfig;
+import android.text.TextUtils;
 import android.util.KeyValueListParser;
 import android.util.Log;
 
+import com.android.internal.annotations.VisibleForTesting;
+import com.android.internal.config.sysui.SystemUiDeviceConfigFlags;
 import com.android.systemui.R;
 
 import javax.inject.Inject;
@@ -35,20 +36,10 @@
 import javax.inject.Singleton;
 
 @Singleton
-public final class SmartReplyConstants extends ContentObserver {
+public final class SmartReplyConstants {
 
     private static final String TAG = "SmartReplyConstants";
 
-    private static final String KEY_ENABLED = "enabled";
-    private static final String KEY_REQUIRES_TARGETING_P = "requires_targeting_p";
-    private static final String KEY_MAX_SQUEEZE_REMEASURE_ATTEMPTS =
-            "max_squeeze_remeasure_attempts";
-    private static final String KEY_EDIT_CHOICES_BEFORE_SENDING =
-            "edit_choices_before_sending";
-    private static final String KEY_SHOW_IN_HEADS_UP = "show_in_heads_up";
-    private static final String KEY_MIN_NUM_REPLIES = "min_num_system_generated_replies";
-    private static final String KEY_MAX_NUM_ACTIONS = "max_num_actions";
-
     private final boolean mDefaultEnabled;
     private final boolean mDefaultRequiresP;
     private final int mDefaultMaxSqueezeRemeasureAttempts;
@@ -69,13 +60,13 @@
     private volatile int mMinNumSystemGeneratedReplies;
     private volatile int mMaxNumActions;
 
+    private final Handler mHandler;
     private final Context mContext;
     private final KeyValueListParser mParser = new KeyValueListParser(',');
 
     @Inject
     public SmartReplyConstants(@Named(MAIN_HANDLER_NAME) Handler handler, Context context) {
-        super(handler);
-
+        mHandler = handler;
         mContext = context;
         final Resources resources = mContext.getResources();
         mDefaultEnabled = resources.getBoolean(
@@ -93,35 +84,86 @@
         mDefaultMaxNumActions = resources.getInteger(
                 R.integer.config_smart_replies_in_notifications_max_num_actions);
 
-        mContext.getContentResolver().registerContentObserver(
-                Settings.Global.getUriFor(Settings.Global.SMART_REPLIES_IN_NOTIFICATIONS_FLAGS),
-                false, this);
+        registerDeviceConfigListener();
         updateConstants();
     }
 
-    @Override
-    public void onChange(boolean selfChange, Uri uri) {
+    private void registerDeviceConfigListener() {
+        DeviceConfig.addOnPropertyChangedListener(
+                DeviceConfig.NAMESPACE_SYSTEMUI,
+                this::postToHandler,
+                this::onDeviceConfigPropertyChanged);
+    }
+
+    private void postToHandler(Runnable r) {
+        this.mHandler.post(r);
+    }
+
+    @VisibleForTesting
+    void onDeviceConfigPropertyChanged(String namespace, String name, String value) {
+        if (!DeviceConfig.NAMESPACE_SYSTEMUI.equals(namespace)) {
+            Log.e(TAG, "Received update from DeviceConfig for unrelated namespace: "
+                    + namespace + " " + name + "=" + value);
+            return;
+        }
+
         updateConstants();
     }
 
     private void updateConstants() {
         synchronized (SmartReplyConstants.this) {
-            try {
-                mParser.setString(Settings.Global.getString(mContext.getContentResolver(),
-                        Settings.Global.SMART_REPLIES_IN_NOTIFICATIONS_FLAGS));
-            } catch (IllegalArgumentException e) {
-                Log.e(TAG, "Bad smart reply constants", e);
-            }
-            mEnabled = mParser.getBoolean(KEY_ENABLED, mDefaultEnabled);
-            mRequiresTargetingP = mParser.getBoolean(KEY_REQUIRES_TARGETING_P, mDefaultRequiresP);
-            mMaxSqueezeRemeasureAttempts = mParser.getInt(
-                    KEY_MAX_SQUEEZE_REMEASURE_ATTEMPTS, mDefaultMaxSqueezeRemeasureAttempts);
-            mEditChoicesBeforeSending = mParser.getBoolean(
-                    KEY_EDIT_CHOICES_BEFORE_SENDING, mDefaultEditChoicesBeforeSending);
-            mShowInHeadsUp = mParser.getBoolean(KEY_SHOW_IN_HEADS_UP, mDefaultShowInHeadsUp);
-            mMinNumSystemGeneratedReplies =
-                    mParser.getInt(KEY_MIN_NUM_REPLIES, mDefaultMinNumSystemGeneratedReplies);
-            mMaxNumActions = mParser.getInt(KEY_MAX_NUM_ACTIONS, mDefaultMaxNumActions);
+            mEnabled = readDeviceConfigBooleanOrDefaultIfEmpty(
+                    SystemUiDeviceConfigFlags.SSIN_ENABLED,
+                    mDefaultEnabled);
+            mRequiresTargetingP = readDeviceConfigBooleanOrDefaultIfEmpty(
+                    SystemUiDeviceConfigFlags.SSIN_REQUIRES_TARGETING_P,
+                    mDefaultRequiresP);
+            mMaxSqueezeRemeasureAttempts = readDeviceConfigIntegerOrDefaultIfEmpty(
+                    SystemUiDeviceConfigFlags.SSIN_MAX_SQUEEZE_REMEASURE_ATTEMPTS,
+                    mDefaultMaxSqueezeRemeasureAttempts);
+            mEditChoicesBeforeSending = readDeviceConfigBooleanOrDefaultIfEmpty(
+                    SystemUiDeviceConfigFlags.SSIN_EDIT_CHOICES_BEFORE_SENDING,
+                    mDefaultEditChoicesBeforeSending);
+            mShowInHeadsUp = readDeviceConfigBooleanOrDefaultIfEmpty(
+                    SystemUiDeviceConfigFlags.SSIN_SHOW_IN_HEADS_UP,
+                    mDefaultShowInHeadsUp);
+            mMinNumSystemGeneratedReplies = readDeviceConfigIntegerOrDefaultIfEmpty(
+                    SystemUiDeviceConfigFlags.SSIN_MIN_NUM_SYSTEM_GENERATED_REPLIES,
+                    mDefaultMinNumSystemGeneratedReplies);
+            mMaxNumActions = readDeviceConfigIntegerOrDefaultIfEmpty(
+                    SystemUiDeviceConfigFlags.SSIN_MAX_NUM_ACTIONS,
+                    mDefaultMaxNumActions);
+        }
+    }
+
+    private static boolean readDeviceConfigBooleanOrDefaultIfEmpty(String propertyName,
+            boolean defaultValue) {
+        String value = DeviceConfig.getProperty(DeviceConfig.NAMESPACE_SYSTEMUI, propertyName);
+        if (TextUtils.isEmpty(value)) {
+            return defaultValue;
+        }
+        if ("true".equals(value)) {
+            return true;
+        }
+        if ("false".equals(value)) {
+            return false;
+        }
+        // For invalid configs we return the default value.
+        return defaultValue;
+    }
+
+    private static int readDeviceConfigIntegerOrDefaultIfEmpty(String propertyName,
+            int defaultValue) {
+        String value = DeviceConfig.getProperty(DeviceConfig.NAMESPACE_SYSTEMUI, propertyName);
+        if (TextUtils.isEmpty(value)) {
+            return defaultValue;
+        }
+        try {
+            return Integer.parseInt(value);
+        } catch (NumberFormatException e) {
+            Log.e(TAG, "Tried to read an integer flag, property name="
+                    + propertyName + ", value=" + value);
+            return defaultValue;
         }
     }
 
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/policy/SmartReplyView.java b/packages/SystemUI/src/com/android/systemui/statusbar/policy/SmartReplyView.java
index 45d215e..ed5487f 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/policy/SmartReplyView.java
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/policy/SmartReplyView.java
@@ -196,66 +196,81 @@
     }
 
     /**
+     * Add buttons to the {@link SmartReplyView} - these buttons must have been preinflated using
+     * one of the methods in this class.
+     */
+    public void addPreInflatedButtons(List<Button> smartSuggestionButtons) {
+        for (Button button : smartSuggestionButtons) {
+            addView(button);
+        }
+        reallocateCandidateButtonQueueForSqueezing();
+    }
+
+    /**
      * Add smart replies to this view, using the provided {@link RemoteInput} and
      * {@link PendingIntent} to respond when the user taps a smart reply. Only the replies that fit
      * into the notification are shown.
      */
-    public void addRepliesFromRemoteInput(
-            SmartReplies smartReplies,
+    public List<Button> inflateRepliesFromRemoteInput(
+            @NonNull SmartReplies smartReplies,
             SmartReplyController smartReplyController, NotificationEntry entry) {
+        List<Button> buttons = new ArrayList<>();
+
         if (smartReplies.remoteInput != null && smartReplies.pendingIntent != null) {
             if (smartReplies.choices != null) {
                 for (int i = 0; i < smartReplies.choices.length; ++i) {
-                    Button replyButton = inflateReplyButton(
-                            getContext(), this, i, smartReplies, smartReplyController, entry);
-                    addView(replyButton);
+                    buttons.add(inflateReplyButton(
+                            this, getContext(), i, smartReplies, smartReplyController, entry));
                 }
                 this.mSmartRepliesGeneratedByAssistant = smartReplies.fromAssistant;
             }
         }
-        reallocateCandidateButtonQueueForSqueezing();
+        return buttons;
     }
 
     /**
      * Add smart actions to be shown next to smart replies. Only the actions that fit into the
      * notification are shown.
      */
-    public void addSmartActions(SmartActions smartActions,
+    public List<Button> inflateSmartActions(@NonNull SmartActions smartActions,
             SmartReplyController smartReplyController, NotificationEntry entry,
             HeadsUpManager headsUpManager) {
+        List<Button> buttons = new ArrayList<>();
         int numSmartActions = smartActions.actions.size();
         for (int n = 0; n < numSmartActions; n++) {
             Notification.Action action = smartActions.actions.get(n);
             if (action.actionIntent != null) {
-                Button actionButton = inflateActionButton(
-                        getContext(), this, n, smartActions, smartReplyController, entry,
-                        headsUpManager);
-                addView(actionButton);
+                buttons.add(inflateActionButton(
+                        this, getContext(), n, smartActions, smartReplyController, entry,
+                        headsUpManager));
             }
         }
-        reallocateCandidateButtonQueueForSqueezing();
+        return buttons;
     }
 
-    public static SmartReplyView inflate(Context context, ViewGroup root) {
-        return (SmartReplyView)
-                LayoutInflater.from(context).inflate(R.layout.smart_reply_view, root, false);
+    /**
+     * Inflate an instance of this class.
+     */
+    public static SmartReplyView inflate(Context context) {
+        return (SmartReplyView) LayoutInflater.from(context).inflate(
+                R.layout.smart_reply_view, null /* root */);
     }
 
     @VisibleForTesting
-    Button inflateReplyButton(Context context, ViewGroup root, int replyIndex,
-            SmartReplies smartReplies, SmartReplyController smartReplyController,
+    static Button inflateReplyButton(SmartReplyView smartReplyView, Context context,
+            int replyIndex, SmartReplies smartReplies, SmartReplyController smartReplyController,
             NotificationEntry entry) {
         Button b = (Button) LayoutInflater.from(context).inflate(
-                R.layout.smart_reply_button, root, false);
+                R.layout.smart_reply_button, smartReplyView, false);
         CharSequence choice = smartReplies.choices[replyIndex];
         b.setText(choice);
 
         OnDismissAction action = () -> {
-            if (mConstants.getEffectiveEditChoicesBeforeSending(
+            if (smartReplyView.mConstants.getEffectiveEditChoicesBeforeSending(
                     smartReplies.remoteInput.getEditChoicesBeforeSending())) {
                 EditedSuggestionInfo editedSuggestionInfo =
                         new EditedSuggestionInfo(choice, replyIndex);
-                mRemoteInputManager.activateRemoteInput(b,
+                smartReplyView.mRemoteInputManager.activateRemoteInput(b,
                         new RemoteInput[] { smartReplies.remoteInput }, smartReplies.remoteInput,
                         smartReplies.pendingIntent, editedSuggestionInfo);
                 return false;
@@ -276,33 +291,41 @@
             } catch (PendingIntent.CanceledException e) {
                 Log.w(TAG, "Unable to send smart reply", e);
             }
-            mSmartReplyContainer.setVisibility(View.GONE);
+            // Note that as inflateReplyButton is called mSmartReplyContainer is null, but when the
+            // reply Button is added to the SmartReplyView mSmartReplyContainer will be set. So, it
+            // will not be possible for a user to trigger this on-click-listener without
+            // mSmartReplyContainer being set.
+            smartReplyView.mSmartReplyContainer.setVisibility(View.GONE);
             return false; // do not defer
         };
 
         b.setOnClickListener(view -> {
-            mKeyguardDismissUtil.executeWhenUnlocked(action);
+            smartReplyView.mKeyguardDismissUtil.executeWhenUnlocked(action);
         });
 
         b.setAccessibilityDelegate(new AccessibilityDelegate() {
             public void onInitializeAccessibilityNodeInfo(View host, AccessibilityNodeInfo info) {
                 super.onInitializeAccessibilityNodeInfo(host, info);
-                String label = getResources().getString(R.string.accessibility_send_smart_reply);
+                String label = smartReplyView.getResources().getString(
+                        R.string.accessibility_send_smart_reply);
                 info.addAction(new AccessibilityAction(AccessibilityNodeInfo.ACTION_CLICK, label));
             }
         });
 
-        setColors(b, mCurrentBackgroundColor, mDefaultStrokeColor, mDefaultTextColor, mRippleColor);
+        SmartReplyView.setButtonColors(b, smartReplyView.mCurrentBackgroundColor,
+                smartReplyView.mDefaultStrokeColor, smartReplyView.mDefaultTextColor,
+                smartReplyView.mRippleColor, smartReplyView.mStrokeWidth);
         return b;
     }
 
     @VisibleForTesting
-    Button inflateActionButton(Context context, ViewGroup root, int actionIndex,
-            SmartActions smartActions, SmartReplyController smartReplyController,
-            NotificationEntry entry, HeadsUpManager headsUpManager) {
+    static Button inflateActionButton(SmartReplyView smartReplyView, Context context,
+            int actionIndex, SmartActions smartActions,
+            SmartReplyController smartReplyController, NotificationEntry entry,
+            HeadsUpManager headsUpManager) {
         Notification.Action action = smartActions.actions.get(actionIndex);
         Button button = (Button) LayoutInflater.from(context).inflate(
-                R.layout.smart_action_button, root, false);
+                R.layout.smart_action_button, smartReplyView, false);
         button.setText(action.title);
 
         Drawable iconDrawable = action.getIcon().loadDrawable(context);
@@ -313,7 +336,7 @@
         button.setCompoundDrawables(iconDrawable, null, null, null);
 
         button.setOnClickListener(view ->
-                getActivityStarter().startPendingIntentDismissingKeyguard(
+                smartReplyView.getActivityStarter().startPendingIntentDismissingKeyguard(
                         action.actionIntent,
                         () -> {
                             smartReplyController.smartActionClicked(
@@ -803,12 +826,13 @@
         int childCount = getChildCount();
         for (int i = 0; i < childCount; i++) {
             final Button child = (Button) getChildAt(i);
-            setColors(child, backgroundColor, strokeColor, textColor, rippleColor);
+            setButtonColors(child, backgroundColor, strokeColor, textColor, rippleColor,
+                    mStrokeWidth);
         }
     }
 
-    private void setColors(Button button, int backgroundColor, int strokeColor, int textColor,
-            int rippleColor) {
+    private static void setButtonColors(Button button, int backgroundColor, int strokeColor,
+            int textColor, int rippleColor, int strokeWidth) {
         Drawable drawable = button.getBackground();
         if (drawable instanceof RippleDrawable) {
             // Mutate in case other notifications are using this drawable.
@@ -821,7 +845,7 @@
                 if (background instanceof GradientDrawable) {
                     GradientDrawable gradientDrawable = (GradientDrawable) background;
                     gradientDrawable.setColor(backgroundColor);
-                    gradientDrawable.setStroke(mStrokeWidth, strokeColor);
+                    gradientDrawable.setStroke(strokeWidth, strokeColor);
                 }
             }
             button.setBackground(drawable);
diff --git a/packages/SystemUI/src/com/android/systemui/util/InjectionInflationController.java b/packages/SystemUI/src/com/android/systemui/util/InjectionInflationController.java
index faebf60..e6b6672 100644
--- a/packages/SystemUI/src/com/android/systemui/util/InjectionInflationController.java
+++ b/packages/SystemUI/src/com/android/systemui/util/InjectionInflationController.java
@@ -24,9 +24,11 @@
 import android.view.View;
 
 import com.android.systemui.SystemUIFactory;
+import com.android.systemui.qs.QSCarrierGroup;
 import com.android.systemui.qs.QSFooterImpl;
 import com.android.systemui.qs.QuickStatusBarHeader;
 import com.android.systemui.statusbar.notification.stack.NotificationStackScrollLayout;
+import com.android.systemui.statusbar.phone.NotificationPanelView;
 
 import java.lang.reflect.InvocationTargetException;
 import java.lang.reflect.Method;
@@ -118,6 +120,16 @@
          * Creates the NotificationStackScrollLayout.
          */
         NotificationStackScrollLayout createNotificationStackScrollLayout();
+
+        /**
+         * Creates the NotificationPanelView.
+         */
+        NotificationPanelView createPanelView();
+
+        /**
+         * Creates the QSCarrierGroup
+         */
+        QSCarrierGroup createQSCarrierGroup();
     }
 
     /**
diff --git a/packages/SystemUI/src/com/android/systemui/volume/Util.java b/packages/SystemUI/src/com/android/systemui/volume/Util.java
index c6d6218..7edb5a5 100644
--- a/packages/SystemUI/src/com/android/systemui/volume/Util.java
+++ b/packages/SystemUI/src/com/android/systemui/volume/Util.java
@@ -16,52 +16,13 @@
 
 package com.android.systemui.volume;
 
-import android.content.Context;
 import android.media.AudioManager;
-import android.media.MediaMetadata;
-import android.media.VolumeProvider;
-import android.media.session.MediaController.PlaybackInfo;
-import android.media.session.PlaybackState;
-import android.telephony.TelephonyManager;
 import android.view.View;
-import android.widget.TextView;
-
-import java.text.SimpleDateFormat;
-import java.util.Date;
-import java.util.Locale;
-import java.util.Objects;
 
 /**
  * Static helpers for the volume dialog.
  */
-class Util {
-
-    // Note: currently not shown (only used in the text footer)
-    private static final SimpleDateFormat HMMAA = new SimpleDateFormat("h:mm aa", Locale.US);
-
-    private static int[] AUDIO_MANAGER_FLAGS = new int[] {
-        AudioManager.FLAG_SHOW_UI,
-        AudioManager.FLAG_VIBRATE,
-        AudioManager.FLAG_PLAY_SOUND,
-        AudioManager.FLAG_ALLOW_RINGER_MODES,
-        AudioManager.FLAG_REMOVE_SOUND_AND_VIBRATE,
-        AudioManager.FLAG_SHOW_VIBRATE_HINT,
-        AudioManager.FLAG_SHOW_SILENT_HINT,
-        AudioManager.FLAG_FROM_KEY,
-        AudioManager.FLAG_SHOW_UI_WARNINGS,
-    };
-
-    private static String[] AUDIO_MANAGER_FLAG_NAMES = new String[] {
-        "SHOW_UI",
-        "VIBRATE",
-        "PLAY_SOUND",
-        "ALLOW_RINGER_MODES",
-        "REMOVE_SOUND_AND_VIBRATE",
-        "SHOW_VIBRATE_HINT",
-        "SHOW_SILENT_HINT",
-        "FROM_KEY",
-        "SHOW_UI_WARNINGS",
-    };
+class Util extends com.android.settingslib.volume.Util {
 
     public static String logTag(Class<?> c) {
         final String tag = "vol." + c.getSimpleName();
@@ -70,106 +31,19 @@
 
     public static String ringerModeToString(int ringerMode) {
         switch (ringerMode) {
-            case AudioManager.RINGER_MODE_SILENT: return "RINGER_MODE_SILENT";
-            case AudioManager.RINGER_MODE_VIBRATE: return "RINGER_MODE_VIBRATE";
-            case AudioManager.RINGER_MODE_NORMAL: return "RINGER_MODE_NORMAL";
-            default: return "RINGER_MODE_UNKNOWN_" + ringerMode;
+            case AudioManager.RINGER_MODE_SILENT:
+                return "RINGER_MODE_SILENT";
+            case AudioManager.RINGER_MODE_VIBRATE:
+                return "RINGER_MODE_VIBRATE";
+            case AudioManager.RINGER_MODE_NORMAL:
+                return "RINGER_MODE_NORMAL";
+            default:
+                return "RINGER_MODE_UNKNOWN_" + ringerMode;
         }
     }
 
-    public static String mediaMetadataToString(MediaMetadata metadata) {
-        if (metadata == null) return null;
-        return metadata.getDescription().toString();
-    }
-
-    public static String playbackInfoToString(PlaybackInfo info) {
-        if (info == null) return null;
-        final String type = playbackInfoTypeToString(info.getPlaybackType());
-        final String vc = volumeProviderControlToString(info.getVolumeControl());
-        return String.format("PlaybackInfo[vol=%s,max=%s,type=%s,vc=%s],atts=%s",
-                info.getCurrentVolume(), info.getMaxVolume(), type, vc, info.getAudioAttributes());
-    }
-
-    public static String playbackInfoTypeToString(int type) {
-        switch (type) {
-            case PlaybackInfo.PLAYBACK_TYPE_LOCAL: return "LOCAL";
-            case PlaybackInfo.PLAYBACK_TYPE_REMOTE: return "REMOTE";
-            default: return "UNKNOWN_" + type;
-        }
-    }
-
-    public static String playbackStateStateToString(int state) {
-        switch (state) {
-            case PlaybackState.STATE_NONE: return "STATE_NONE";
-            case PlaybackState.STATE_STOPPED: return "STATE_STOPPED";
-            case PlaybackState.STATE_PAUSED: return "STATE_PAUSED";
-            case PlaybackState.STATE_PLAYING: return "STATE_PLAYING";
-            default: return "UNKNOWN_" + state;
-        }
-    }
-
-    public static String volumeProviderControlToString(int control) {
-        switch (control) {
-            case VolumeProvider.VOLUME_CONTROL_ABSOLUTE: return "VOLUME_CONTROL_ABSOLUTE";
-            case VolumeProvider.VOLUME_CONTROL_FIXED: return "VOLUME_CONTROL_FIXED";
-            case VolumeProvider.VOLUME_CONTROL_RELATIVE: return "VOLUME_CONTROL_RELATIVE";
-            default: return "VOLUME_CONTROL_UNKNOWN_" + control;
-        }
-    }
-
-    public static String playbackStateToString(PlaybackState playbackState) {
-        if (playbackState == null) return null;
-        return playbackStateStateToString(playbackState.getState()) + " " + playbackState;
-    }
-
-    public static String audioManagerFlagsToString(int value) {
-        return bitFieldToString(value, AUDIO_MANAGER_FLAGS, AUDIO_MANAGER_FLAG_NAMES);
-    }
-
-    private static String bitFieldToString(int value, int[] values, String[] names) {
-        if (value == 0) return "";
-        final StringBuilder sb = new StringBuilder();
-        for (int i = 0; i < values.length; i++) {
-            if ((value & values[i]) != 0) {
-                if (sb.length() > 0) sb.append(',');
-                sb.append(names[i]);
-            }
-            value &= ~values[i];
-        }
-        if (value != 0) {
-            if (sb.length() > 0) sb.append(',');
-            sb.append("UNKNOWN_").append(value);
-        }
-        return sb.toString();
-    }
-
-    public static String getShortTime(long millis) {
-        return HMMAA.format(new Date(millis));
-    }
-
-    private static CharSequence emptyToNull(CharSequence str) {
-        return str == null || str.length() == 0 ? null : str;
-    }
-
-    public static boolean setText(TextView tv, CharSequence text) {
-        if (Objects.equals(emptyToNull(tv.getText()), emptyToNull(text))) return false;
-        tv.setText(text);
-        return true;
-    }
-
     public static final void setVisOrGone(View v, boolean vis) {
         if (v == null || (v.getVisibility() == View.VISIBLE) == vis) return;
         v.setVisibility(vis ? View.VISIBLE : View.GONE);
     }
-
-    public static final void setVisOrInvis(View v, boolean vis) {
-        if (v == null || (v.getVisibility() == View.VISIBLE) == vis) return;
-        v.setVisibility(vis ? View.VISIBLE : View.INVISIBLE);
-    }
-
-    public static boolean isVoiceCapable(Context context) {
-        final TelephonyManager telephony =
-                (TelephonyManager) context.getSystemService(Context.TELEPHONY_SERVICE);
-        return telephony != null && telephony.isVoiceCapable();
-    }
 }
diff --git a/packages/SystemUI/src/com/android/systemui/volume/VolumeDialogControllerImpl.java b/packages/SystemUI/src/com/android/systemui/volume/VolumeDialogControllerImpl.java
index 32bc01c..4c16297 100644
--- a/packages/SystemUI/src/com/android/systemui/volume/VolumeDialogControllerImpl.java
+++ b/packages/SystemUI/src/com/android/systemui/volume/VolumeDialogControllerImpl.java
@@ -53,6 +53,7 @@
 import android.view.accessibility.AccessibilityManager;
 
 import com.android.internal.annotations.GuardedBy;
+import com.android.settingslib.volume.MediaSessions;
 import com.android.systemui.Dumpable;
 import com.android.systemui.R;
 import com.android.systemui.SysUiServiceProvider;
diff --git a/packages/SystemUI/tests/src/com/android/AAAPlusPlusVerifySysuiRequiredTestPropertiesTest.java b/packages/SystemUI/tests/src/com/android/AAAPlusPlusVerifySysuiRequiredTestPropertiesTest.java
index 7f83ed6..b97f55c 100644
--- a/packages/SystemUI/tests/src/com/android/AAAPlusPlusVerifySysuiRequiredTestPropertiesTest.java
+++ b/packages/SystemUI/tests/src/com/android/AAAPlusPlusVerifySysuiRequiredTestPropertiesTest.java
@@ -16,20 +16,20 @@
 
 import static org.hamcrest.Matchers.empty;
 import static org.hamcrest.Matchers.is;
-import static org.junit.Assert.assertFalse;
 import static org.junit.Assert.assertThat;
 
 import android.content.pm.PackageManager;
-import android.support.test.filters.LargeTest;
-import android.support.test.filters.MediumTest;
-import android.support.test.filters.SmallTest;
-import android.support.test.internal.runner.ClassPathScanner;
-import android.support.test.internal.runner.ClassPathScanner.ChainedClassNameFilter;
-import android.support.test.internal.runner.ClassPathScanner.ExternalClassNameFilter;
 import android.testing.AndroidTestingRunner;
 import android.text.TextUtils;
 import android.util.Log;
 
+import androidx.test.filters.LargeTest;
+import androidx.test.filters.MediumTest;
+import androidx.test.filters.SmallTest;
+import androidx.test.internal.runner.ClassPathScanner;
+import androidx.test.internal.runner.ClassPathScanner.ChainedClassNameFilter;
+import androidx.test.internal.runner.ClassPathScanner.ExternalClassNameFilter;
+
 import com.android.systemui.SysuiBaseFragmentTest;
 import com.android.systemui.SysuiTestCase;
 
diff --git a/packages/SystemUI/tests/src/com/android/keyguard/CarrierTextControllerTest.java b/packages/SystemUI/tests/src/com/android/keyguard/CarrierTextControllerTest.java
new file mode 100644
index 0000000..8e061cc
--- /dev/null
+++ b/packages/SystemUI/tests/src/com/android/keyguard/CarrierTextControllerTest.java
@@ -0,0 +1,245 @@
+/*
+ * Copyright (C) 2019 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 com.android.keyguard;
+
+
+import static android.telephony.SubscriptionManager.DATA_ROAMING_DISABLE;
+import static android.telephony.SubscriptionManager.DATA_ROAMING_ENABLE;
+import static android.telephony.SubscriptionManager.NAME_SOURCE_DEFAULT_SOURCE;
+
+import static junit.framework.Assert.assertTrue;
+
+import static org.junit.Assert.assertEquals;
+import static org.mockito.ArgumentMatchers.any;
+import static org.mockito.ArgumentMatchers.anyBoolean;
+import static org.mockito.ArgumentMatchers.anyInt;
+import static org.mockito.Mockito.never;
+import static org.mockito.Mockito.reset;
+import static org.mockito.Mockito.verify;
+import static org.mockito.Mockito.when;
+
+import android.content.Context;
+import android.net.ConnectivityManager;
+import android.net.wifi.WifiManager;
+import android.os.Handler;
+import android.telephony.SubscriptionInfo;
+import android.telephony.TelephonyManager;
+import android.test.suitebuilder.annotation.SmallTest;
+import android.testing.AndroidTestingRunner;
+import android.testing.TestableLooper;
+
+import com.android.internal.telephony.IccCardConstants;
+import com.android.systemui.Dependency;
+import com.android.systemui.SysuiTestCase;
+import com.android.systemui.keyguard.WakefulnessLifecycle;
+
+import org.junit.Before;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+import org.mockito.ArgumentCaptor;
+import org.mockito.Mock;
+import org.mockito.MockitoAnnotations;
+
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.List;
+
+@SmallTest
+@RunWith(AndroidTestingRunner.class)
+@TestableLooper.RunWithLooper
+public class CarrierTextControllerTest extends SysuiTestCase {
+
+    private static final CharSequence SEPARATOR = " \u2014 ";
+    private static final String TEST_CARRIER = "TEST_CARRIER";
+    private static final SubscriptionInfo TEST_SUBSCRIPTION = new SubscriptionInfo(0, "", 0,
+            TEST_CARRIER, TEST_CARRIER, NAME_SOURCE_DEFAULT_SOURCE, 0xFFFFFF, "",
+            DATA_ROAMING_DISABLE, null, null, null, null, false, null, "");
+    private static final SubscriptionInfo TEST_SUBSCRIPTION_ROAMING = new SubscriptionInfo(0, "", 0,
+            TEST_CARRIER, TEST_CARRIER, NAME_SOURCE_DEFAULT_SOURCE, 0xFFFFFF, "",
+            DATA_ROAMING_ENABLE, null, null, null, null, false, null, "");
+    @Mock
+    private WifiManager mWifiManager;
+    @Mock
+    private CarrierTextController.CarrierTextCallback mCarrierTextCallback;
+    @Mock
+    private KeyguardUpdateMonitor mKeyguardUpdateMonitor;
+    @Mock
+    private ConnectivityManager mConnectivityManager;
+    @Mock
+    private TelephonyManager mTelephonyManager;
+    private CarrierTextController.CarrierTextCallbackInfo mCarrierTextCallbackInfo;
+
+    private CarrierTextController mCarrierTextController;
+    private TestableLooper mTestableLooper;
+
+    @Before
+    public void setUp() {
+        MockitoAnnotations.initMocks(this);
+        mTestableLooper = TestableLooper.get(this);
+
+        mContext.addMockSystemService(WifiManager.class, mWifiManager);
+        mContext.addMockSystemService(ConnectivityManager.class, mConnectivityManager);
+        mContext.addMockSystemService(TelephonyManager.class, mTelephonyManager);
+        mDependency.injectMockDependency(WakefulnessLifecycle.class);
+        mDependency.injectTestDependency(Dependency.MAIN_HANDLER,
+                new Handler(mTestableLooper.getLooper()));
+
+        mCarrierTextCallbackInfo = new CarrierTextController.CarrierTextCallbackInfo("",
+                new CharSequence[]{}, false, new int[]{});
+        when(mTelephonyManager.getPhoneCount()).thenReturn(2);
+        mCarrierTextController = new TestCarrierTextController(mContext, SEPARATOR, true, true,
+                mKeyguardUpdateMonitor);
+        // This should not start listening on any of the real dependencies
+        mCarrierTextController.setListening(mCarrierTextCallback);
+    }
+
+    @Test
+    public void testWrongSlots() {
+        reset(mCarrierTextCallback);
+        when(mKeyguardUpdateMonitor.getSubscriptionInfo(anyBoolean())).thenReturn(
+                new ArrayList<>());
+        when(mKeyguardUpdateMonitor.getSimState(anyInt())).thenReturn(
+                IccCardConstants.State.CARD_IO_ERROR);
+        // This should not produce an out of bounds error, even though there are no subscriptions
+        mCarrierTextController.mCallback.onSimStateChanged(0, -3,
+                IccCardConstants.State.CARD_IO_ERROR);
+        mCarrierTextController.mCallback.onSimStateChanged(0, 3, IccCardConstants.State.READY);
+        verify(mCarrierTextCallback, never()).updateCarrierInfo(any());
+    }
+
+    @Test
+    public void testMoreSlotsThanSubs() {
+        reset(mCarrierTextCallback);
+        when(mKeyguardUpdateMonitor.getSubscriptionInfo(anyBoolean())).thenReturn(
+                new ArrayList<>());
+        when(mKeyguardUpdateMonitor.getSimState(anyInt())).thenReturn(
+                IccCardConstants.State.CARD_IO_ERROR);
+        // This should not produce an out of bounds error, even though there are no subscriptions
+        mCarrierTextController.mCallback.onSimStateChanged(0, 1,
+                IccCardConstants.State.CARD_IO_ERROR);
+
+        mTestableLooper.processAllMessages();
+        verify(mCarrierTextCallback).updateCarrierInfo(
+                any(CarrierTextController.CarrierTextCallbackInfo.class));
+    }
+
+    @Test
+    public void testCallback() {
+        reset(mCarrierTextCallback);
+        mCarrierTextController.postToCallback(mCarrierTextCallbackInfo);
+        mTestableLooper.processAllMessages();
+
+        ArgumentCaptor<CarrierTextController.CarrierTextCallbackInfo> captor =
+                ArgumentCaptor.forClass(
+                        CarrierTextController.CarrierTextCallbackInfo.class);
+        verify(mCarrierTextCallback).updateCarrierInfo(captor.capture());
+        assertEquals(mCarrierTextCallbackInfo, captor.getValue());
+    }
+
+    @Test
+    public void testNullingCallback() {
+        reset(mCarrierTextCallback);
+
+        mCarrierTextController.postToCallback(mCarrierTextCallbackInfo);
+        mCarrierTextController.setListening(null);
+
+        // This shouldn't produce NPE
+        mTestableLooper.processAllMessages();
+        verify(mCarrierTextCallback).updateCarrierInfo(any());
+    }
+
+    @Test
+    public void testCreateInfo_OneValidSubscription() {
+        reset(mCarrierTextCallback);
+        List<SubscriptionInfo> list = new ArrayList<>();
+        list.add(TEST_SUBSCRIPTION);
+        when(mKeyguardUpdateMonitor.getSimState(anyInt())).thenReturn(IccCardConstants.State.READY);
+        when(mKeyguardUpdateMonitor.getSubscriptionInfo(anyBoolean())).thenReturn(list);
+        mKeyguardUpdateMonitor.mServiceStates = new HashMap<>();
+
+        ArgumentCaptor<CarrierTextController.CarrierTextCallbackInfo> captor =
+                ArgumentCaptor.forClass(
+                        CarrierTextController.CarrierTextCallbackInfo.class);
+
+        mCarrierTextController.updateCarrierText();
+        mTestableLooper.processAllMessages();
+        verify(mCarrierTextCallback).updateCarrierInfo(captor.capture());
+
+        CarrierTextController.CarrierTextCallbackInfo info = captor.getValue();
+        assertEquals(1, info.listOfCarriers.length);
+        assertEquals(TEST_CARRIER, info.listOfCarriers[0]);
+        assertEquals(1, info.subscriptionIds.length);
+    }
+
+    @Test
+    public void testCreateInfo_OneValidSubscriptionWithRoaming() {
+        reset(mCarrierTextCallback);
+        List<SubscriptionInfo> list = new ArrayList<>();
+        list.add(TEST_SUBSCRIPTION_ROAMING);
+        when(mKeyguardUpdateMonitor.getSimState(anyInt())).thenReturn(IccCardConstants.State.READY);
+        when(mKeyguardUpdateMonitor.getSubscriptionInfo(anyBoolean())).thenReturn(list);
+        mKeyguardUpdateMonitor.mServiceStates = new HashMap<>();
+
+        ArgumentCaptor<CarrierTextController.CarrierTextCallbackInfo> captor =
+                ArgumentCaptor.forClass(
+                        CarrierTextController.CarrierTextCallbackInfo.class);
+
+        mCarrierTextController.updateCarrierText();
+        mTestableLooper.processAllMessages();
+        verify(mCarrierTextCallback).updateCarrierInfo(captor.capture());
+
+        CarrierTextController.CarrierTextCallbackInfo info = captor.getValue();
+        assertEquals(1, info.listOfCarriers.length);
+        assertTrue(info.listOfCarriers[0].toString().contains(TEST_CARRIER));
+        assertEquals(1, info.subscriptionIds.length);
+    }
+
+    @Test
+    public void testCreateInfo_noSubscriptions() {
+        reset(mCarrierTextCallback);
+        when(mKeyguardUpdateMonitor.getSubscriptionInfo(anyBoolean())).thenReturn(
+                new ArrayList<>());
+        ArgumentCaptor<CarrierTextController.CarrierTextCallbackInfo> captor =
+                ArgumentCaptor.forClass(
+                        CarrierTextController.CarrierTextCallbackInfo.class);
+
+        mCarrierTextController.updateCarrierText();
+        mTestableLooper.processAllMessages();
+        verify(mCarrierTextCallback).updateCarrierInfo(captor.capture());
+
+        CarrierTextController.CarrierTextCallbackInfo info = captor.getValue();
+        assertEquals(0, info.listOfCarriers.length);
+        assertEquals(0, info.subscriptionIds.length);
+
+    }
+
+    public static class TestCarrierTextController extends CarrierTextController {
+        private KeyguardUpdateMonitor mKUM;
+
+        public TestCarrierTextController(Context context, CharSequence separator,
+                boolean showAirplaneMode, boolean showMissingSim, KeyguardUpdateMonitor kum) {
+            super(context, separator, showAirplaneMode, showMissingSim);
+            mKUM = kum;
+        }
+
+        @Override
+        public void setListening(CarrierTextCallback callback) {
+            super.setListening(callback);
+            mKeyguardUpdateMonitor = mKUM;
+        }
+    }
+}
diff --git a/packages/SystemUI/tests/src/com/android/keyguard/KeyguardClockAccessibilityDelegateTest.java b/packages/SystemUI/tests/src/com/android/keyguard/KeyguardClockAccessibilityDelegateTest.java
index e37ea95..dcafa72 100644
--- a/packages/SystemUI/tests/src/com/android/keyguard/KeyguardClockAccessibilityDelegateTest.java
+++ b/packages/SystemUI/tests/src/com/android/keyguard/KeyguardClockAccessibilityDelegateTest.java
@@ -20,12 +20,13 @@
 import static org.junit.Assert.assertFalse;
 import static org.junit.Assert.assertTrue;
 
-import android.support.test.filters.SmallTest;
 import android.text.TextUtils;
 import android.view.accessibility.AccessibilityEvent;
 import android.view.accessibility.AccessibilityNodeInfo;
 import android.widget.TextView;
 
+import androidx.test.filters.SmallTest;
+
 import com.android.systemui.SysuiTestCase;
 
 import org.junit.Before;
diff --git a/packages/SystemUI/tests/src/com/android/keyguard/KeyguardPatternViewTest.kt b/packages/SystemUI/tests/src/com/android/keyguard/KeyguardPatternViewTest.kt
index ab3a3e1..e7469c3 100644
--- a/packages/SystemUI/tests/src/com/android/keyguard/KeyguardPatternViewTest.kt
+++ b/packages/SystemUI/tests/src/com/android/keyguard/KeyguardPatternViewTest.kt
@@ -16,7 +16,7 @@
 
 package com.android.keyguard
 
-import android.support.test.filters.SmallTest
+import androidx.test.filters.SmallTest
 import android.testing.AndroidTestingRunner
 import android.testing.TestableLooper
 import android.view.LayoutInflater
diff --git a/packages/SystemUI/tests/src/com/android/keyguard/KeyguardPinBasedInputViewTest.java b/packages/SystemUI/tests/src/com/android/keyguard/KeyguardPinBasedInputViewTest.java
index 58870e4..eadb1b6 100644
--- a/packages/SystemUI/tests/src/com/android/keyguard/KeyguardPinBasedInputViewTest.java
+++ b/packages/SystemUI/tests/src/com/android/keyguard/KeyguardPinBasedInputViewTest.java
@@ -21,12 +21,13 @@
 import static org.mockito.Mockito.verify;
 import static org.mockito.Mockito.verifyZeroInteractions;
 
-import android.support.test.filters.SmallTest;
 import android.testing.AndroidTestingRunner;
 import android.testing.TestableLooper.RunWithLooper;
 import android.view.KeyEvent;
 import android.view.LayoutInflater;
 
+import androidx.test.filters.SmallTest;
+
 import com.android.systemui.SysuiTestCase;
 
 import org.junit.Before;
diff --git a/packages/SystemUI/tests/src/com/android/keyguard/KeyguardSecurityContainerTest.java b/packages/SystemUI/tests/src/com/android/keyguard/KeyguardSecurityContainerTest.java
index fcf327b..8db195a 100644
--- a/packages/SystemUI/tests/src/com/android/keyguard/KeyguardSecurityContainerTest.java
+++ b/packages/SystemUI/tests/src/com/android/keyguard/KeyguardSecurityContainerTest.java
@@ -16,19 +16,18 @@
 
 package com.android.keyguard;
 
-import org.junit.Test;
-import org.junit.runner.RunWith;
-
 import android.content.Context;
-import android.support.test.filters.SmallTest;
-import android.support.test.runner.AndroidJUnit4;
 import android.test.UiThreadTest;
-import android.util.Log;
 import android.view.LayoutInflater;
-import android.view.View;
+
+import androidx.test.filters.SmallTest;
+import androidx.test.runner.AndroidJUnit4;
 
 import com.android.systemui.SysuiTestCase;
 
+import org.junit.Test;
+import org.junit.runner.RunWith;
+
 @SmallTest
 @RunWith(AndroidJUnit4.class)
 public class KeyguardSecurityContainerTest extends SysuiTestCase {
diff --git a/packages/SystemUI/tests/src/com/android/keyguard/KeyguardUpdateMonitorTest.java b/packages/SystemUI/tests/src/com/android/keyguard/KeyguardUpdateMonitorTest.java
index d5a275e..ffe3ece 100644
--- a/packages/SystemUI/tests/src/com/android/keyguard/KeyguardUpdateMonitorTest.java
+++ b/packages/SystemUI/tests/src/com/android/keyguard/KeyguardUpdateMonitorTest.java
@@ -106,6 +106,7 @@
         when(mFaceManager.hasEnrolledTemplates()).thenReturn(true);
         when(mFaceManager.hasEnrolledTemplates(anyInt())).thenReturn(true);
         when(mUserManager.isUserUnlocked(anyInt())).thenReturn(true);
+        when(mUserManager.isPrimaryUser()).thenReturn(true);
         when(mStrongAuthTracker.isUnlockingWithBiometricAllowed()).thenReturn(true);
         context.addMockSystemService(TrustManager.class, mTrustManager);
         context.addMockSystemService(FingerprintManager.class, mFingerprintManager);
@@ -320,16 +321,6 @@
     }
 
     @Test
-    public void testNeverAuthenticates_whenFaceLockout() {
-        mKeyguardUpdateMonitor.mFaceAuthenticationCallback
-                .onAuthenticationError(FaceManager.FACE_ERROR_LOCKOUT, "lockout");
-        mKeyguardUpdateMonitor.sendKeyguardBouncerChanged(true);
-        mTestableLooper.processAllMessages();
-
-        verify(mFaceManager, never()).authenticate(any(), any(), anyInt(), any(), any());
-    }
-
-    @Test
     public void testOnFaceAuthenticated_skipsFaceWhenAuthenticated() {
         mKeyguardUpdateMonitor.onFaceAuthenticated(KeyguardUpdateMonitor.getCurrentUser());
         mKeyguardUpdateMonitor.sendKeyguardBouncerChanged(true);
diff --git a/packages/SystemUI/tests/src/com/android/keyguard/clock/BubbleClockControllerTest.java b/packages/SystemUI/tests/src/com/android/keyguard/clock/BubbleClockControllerTest.java
index 9e946fa..267468f 100644
--- a/packages/SystemUI/tests/src/com/android/keyguard/clock/BubbleClockControllerTest.java
+++ b/packages/SystemUI/tests/src/com/android/keyguard/clock/BubbleClockControllerTest.java
@@ -17,6 +17,7 @@
 
 import static com.google.common.truth.Truth.assertThat;
 
+import android.content.res.Resources;
 import android.test.suitebuilder.annotation.SmallTest;
 import android.testing.AndroidTestingRunner;
 import android.testing.TestableLooper.RunWithLooper;
@@ -40,8 +41,9 @@
 
     @Before
     public void setUp() {
+        Resources res = getContext().getResources();
         LayoutInflater layoutInflater = LayoutInflater.from(getContext());
-        mClockController = BubbleClockController.build(layoutInflater);
+        mClockController = new BubbleClockController(res, layoutInflater);
     }
 
     @Test
diff --git a/packages/SystemUI/tests/src/com/android/keyguard/clock/ClockManagerTest.java b/packages/SystemUI/tests/src/com/android/keyguard/clock/ClockManagerTest.java
index 58701e7..36265d4 100644
--- a/packages/SystemUI/tests/src/com/android/keyguard/clock/ClockManagerTest.java
+++ b/packages/SystemUI/tests/src/com/android/keyguard/clock/ClockManagerTest.java
@@ -31,6 +31,7 @@
 import com.android.systemui.colorextraction.SysuiColorExtractor;
 import com.android.systemui.dock.DockManager;
 import com.android.systemui.dock.DockManagerFake;
+import com.android.systemui.shared.plugins.PluginManager;
 import com.android.systemui.util.InjectionInflationController;
 
 import org.junit.After;
@@ -52,6 +53,7 @@
     private ContentObserver mContentObserver;
     private DockManagerFake mFakeDockManager;
     @Mock InjectionInflationController mMockInjectionInflationController;
+    @Mock PluginManager mMockPluginManager;
     @Mock SysuiColorExtractor mMockColorExtractor;
     @Mock ContentResolver mMockContentResolver;
     @Mock SettingsWrapper mMockSettingsWrapper;
@@ -66,7 +68,8 @@
 
         mFakeDockManager = new DockManagerFake();
         mClockManager = new ClockManager(getContext(), mMockInjectionInflationController,
-                mFakeDockManager, mMockColorExtractor, mMockContentResolver, mMockSettingsWrapper);
+                mMockPluginManager, mFakeDockManager, mMockColorExtractor, mMockContentResolver,
+                mMockSettingsWrapper);
 
         mClockManager.addOnClockChangedListener(mMockListener);
         mContentObserver = mClockManager.getContentObserver();
diff --git a/packages/SystemUI/tests/src/com/android/keyguard/clock/StretchAnalogClockControllerTest.java b/packages/SystemUI/tests/src/com/android/keyguard/clock/StretchAnalogClockControllerTest.java
index 8de8f3d..0659b4f 100644
--- a/packages/SystemUI/tests/src/com/android/keyguard/clock/StretchAnalogClockControllerTest.java
+++ b/packages/SystemUI/tests/src/com/android/keyguard/clock/StretchAnalogClockControllerTest.java
@@ -17,6 +17,7 @@
 
 import static com.google.common.truth.Truth.assertThat;
 
+import android.content.res.Resources;
 import android.test.suitebuilder.annotation.SmallTest;
 import android.testing.AndroidTestingRunner;
 import android.testing.TestableLooper.RunWithLooper;
@@ -40,8 +41,9 @@
 
     @Before
     public void setUp() {
+        Resources res = getContext().getResources();
         LayoutInflater layoutInflater = LayoutInflater.from(getContext());
-        mClockController = StretchAnalogClockController.build(layoutInflater);
+        mClockController = new StretchAnalogClockController(res, layoutInflater);
     }
 
     @Test
diff --git a/packages/SystemUI/tests/src/com/android/systemui/BatteryMeterDrawableTest.java b/packages/SystemUI/tests/src/com/android/systemui/BatteryMeterDrawableTest.java
index e1f56a47..d1573c3 100644
--- a/packages/SystemUI/tests/src/com/android/systemui/BatteryMeterDrawableTest.java
+++ b/packages/SystemUI/tests/src/com/android/systemui/BatteryMeterDrawableTest.java
@@ -16,8 +16,6 @@
 
 package com.android.systemui;
 
-import com.android.settingslib.graph.BatteryMeterDrawableBase;
-
 import static org.mockito.Mockito.any;
 import static org.mockito.Mockito.anyFloat;
 import static org.mockito.Mockito.anyString;
@@ -30,9 +28,12 @@
 
 import android.content.res.Resources;
 import android.graphics.Canvas;
-import android.support.test.runner.AndroidJUnit4;
 import android.test.suitebuilder.annotation.SmallTest;
 
+import androidx.test.runner.AndroidJUnit4;
+
+import com.android.settingslib.graph.BatteryMeterDrawableBase;
+
 import org.junit.Before;
 import org.junit.Test;
 import org.junit.runner.RunWith;
diff --git a/packages/SystemUI/tests/src/com/android/systemui/DependencyTest.java b/packages/SystemUI/tests/src/com/android/systemui/DependencyTest.java
index 61bfa75..b1ca169 100644
--- a/packages/SystemUI/tests/src/com/android/systemui/DependencyTest.java
+++ b/packages/SystemUI/tests/src/com/android/systemui/DependencyTest.java
@@ -21,7 +21,8 @@
 import static org.mockito.Mockito.verify;
 
 import android.os.Looper;
-import android.support.test.filters.SmallTest;
+
+import androidx.test.filters.SmallTest;
 
 import com.android.systemui.Dependency.DependencyKey;
 import com.android.systemui.statusbar.policy.FlashlightController;
diff --git a/packages/SystemUI/tests/src/com/android/systemui/ExpandHelperTest.java b/packages/SystemUI/tests/src/com/android/systemui/ExpandHelperTest.java
index 948e001..e07d17f 100644
--- a/packages/SystemUI/tests/src/com/android/systemui/ExpandHelperTest.java
+++ b/packages/SystemUI/tests/src/com/android/systemui/ExpandHelperTest.java
@@ -22,12 +22,13 @@
 
 import android.animation.ObjectAnimator;
 import android.content.Context;
-import android.support.test.annotation.UiThreadTest;
-import android.support.test.filters.SmallTest;
 import android.testing.AndroidTestingRunner;
 import android.testing.TestableLooper;
 import android.testing.TestableLooper.RunWithLooper;
 
+import androidx.test.annotation.UiThreadTest;
+import androidx.test.filters.SmallTest;
+
 import com.android.systemui.statusbar.NotificationTestHelper;
 import com.android.systemui.statusbar.notification.row.ExpandableNotificationRow;
 import com.android.systemui.util.Assert;
diff --git a/packages/SystemUI/tests/src/com/android/systemui/ForegroundServiceControllerTest.java b/packages/SystemUI/tests/src/com/android/systemui/ForegroundServiceControllerTest.java
index 31e8071..8a6ee12 100644
--- a/packages/SystemUI/tests/src/com/android/systemui/ForegroundServiceControllerTest.java
+++ b/packages/SystemUI/tests/src/com/android/systemui/ForegroundServiceControllerTest.java
@@ -31,10 +31,11 @@
 import android.os.Bundle;
 import android.os.UserHandle;
 import android.service.notification.StatusBarNotification;
-import android.support.test.filters.SmallTest;
-import android.support.test.runner.AndroidJUnit4;
 import android.widget.RemoteViews;
 
+import androidx.test.filters.SmallTest;
+import androidx.test.runner.AndroidJUnit4;
+
 import com.android.internal.messages.nano.SystemMessageProto;
 import com.android.systemui.statusbar.notification.NotificationEntryListener;
 import com.android.systemui.statusbar.notification.NotificationEntryManager;
diff --git a/packages/SystemUI/tests/src/com/android/systemui/ImageWallpaperTest.java b/packages/SystemUI/tests/src/com/android/systemui/ImageWallpaperTest.java
index e4d56d7..48a5369 100644
--- a/packages/SystemUI/tests/src/com/android/systemui/ImageWallpaperTest.java
+++ b/packages/SystemUI/tests/src/com/android/systemui/ImageWallpaperTest.java
@@ -16,9 +16,10 @@
 
 package com.android.systemui;
 
-import android.support.test.runner.AndroidJUnit4;
 import android.test.suitebuilder.annotation.SmallTest;
 
+import androidx.test.runner.AndroidJUnit4;
+
 import org.junit.Before;
 import org.junit.Test;
 import org.junit.runner.RunWith;
diff --git a/packages/SystemUI/tests/src/com/android/systemui/InitControllerTest.java b/packages/SystemUI/tests/src/com/android/systemui/InitControllerTest.java
index 4d33d43..e0ca87c 100644
--- a/packages/SystemUI/tests/src/com/android/systemui/InitControllerTest.java
+++ b/packages/SystemUI/tests/src/com/android/systemui/InitControllerTest.java
@@ -19,10 +19,11 @@
 import static junit.framework.TestCase.assertFalse;
 import static junit.framework.TestCase.assertTrue;
 
-import android.support.test.filters.SmallTest;
 import android.testing.AndroidTestingRunner;
 import android.testing.TestableLooper;
 
+import androidx.test.filters.SmallTest;
+
 import org.junit.Test;
 import org.junit.runner.RunWith;
 
diff --git a/packages/SystemUI/tests/src/com/android/systemui/ScreenDecorationsTest.java b/packages/SystemUI/tests/src/com/android/systemui/ScreenDecorationsTest.java
index 0114075..64ab060 100644
--- a/packages/SystemUI/tests/src/com/android/systemui/ScreenDecorationsTest.java
+++ b/packages/SystemUI/tests/src/com/android/systemui/ScreenDecorationsTest.java
@@ -39,7 +39,6 @@
 import android.content.res.Configuration;
 import android.graphics.Rect;
 import android.os.Handler;
-import android.support.test.filters.SmallTest;
 import android.testing.AndroidTestingRunner;
 import android.testing.TestableLooper;
 import android.testing.TestableLooper.RunWithLooper;
@@ -47,6 +46,8 @@
 import android.view.View;
 import android.view.WindowManager;
 
+import androidx.test.filters.SmallTest;
+
 import com.android.systemui.R.dimen;
 import com.android.systemui.ScreenDecorations.TunablePaddingTagListener;
 import com.android.systemui.fragments.FragmentHostManager;
diff --git a/packages/SystemUI/tests/src/com/android/systemui/SizeCompatModeActivityControllerTest.java b/packages/SystemUI/tests/src/com/android/systemui/SizeCompatModeActivityControllerTest.java
new file mode 100644
index 0000000..587005e
--- /dev/null
+++ b/packages/SystemUI/tests/src/com/android/systemui/SizeCompatModeActivityControllerTest.java
@@ -0,0 +1,102 @@
+/*
+ * Copyright (C) 2019 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 com.android.systemui;
+
+import static org.mockito.ArgumentMatchers.eq;
+import static org.mockito.Mockito.doReturn;
+import static org.mockito.Mockito.verify;
+
+import android.content.Context;
+import android.inputmethodservice.InputMethodService;
+import android.os.IBinder;
+import android.testing.AndroidTestingRunner;
+import android.view.View;
+
+import androidx.test.filters.SmallTest;
+
+import com.android.systemui.SizeCompatModeActivityController.RestartActivityButton;
+import com.android.systemui.shared.system.ActivityManagerWrapper;
+import com.android.systemui.shared.system.TaskStackChangeListener;
+
+import org.junit.Before;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+import org.mockito.ArgumentCaptor;
+import org.mockito.Mock;
+import org.mockito.MockitoAnnotations;
+
+/**
+ * runtest systemui -c com.android.systemui.SizeCompatModeActivityControllerTest
+ */
+@RunWith(AndroidTestingRunner.class)
+@SmallTest
+public class SizeCompatModeActivityControllerTest extends SysuiTestCase {
+    private static final int DISPLAY_ID = 0;
+
+    private SizeCompatModeActivityController mController;
+    private TaskStackChangeListener mTaskStackListener;
+    private @Mock ActivityManagerWrapper mMockAm;
+    private @Mock RestartActivityButton mMockButton;
+    private @Mock IBinder mMockActivityToken;
+
+    @Before
+    public void setUp() {
+        MockitoAnnotations.initMocks(this);
+
+        mController = new SizeCompatModeActivityController(mMockAm) {
+            @Override
+            RestartActivityButton createRestartButton(Context context) {
+                return mMockButton;
+            };
+        };
+        mController.mContext = mContext;
+
+        ArgumentCaptor<TaskStackChangeListener> listenerCaptor =
+                ArgumentCaptor.forClass(TaskStackChangeListener.class);
+        verify(mMockAm).registerTaskStackListener(listenerCaptor.capture());
+        mTaskStackListener = listenerCaptor.getValue();
+    }
+
+    @Test
+    public void testOnSizeCompatModeActivityChanged() {
+        // Verifies that the restart button is added with non-null component name.
+        mTaskStackListener.onSizeCompatModeActivityChanged(DISPLAY_ID, mMockActivityToken);
+        verify(mMockButton).show();
+        verify(mMockButton).updateLastTargetActivity(eq(mMockActivityToken));
+
+        // Verifies that the restart button is removed with null component name.
+        mTaskStackListener.onSizeCompatModeActivityChanged(DISPLAY_ID, null /* activityToken */);
+        verify(mMockButton).remove();
+    }
+
+    @Test
+    public void testChangeButtonVisibilityOnImeShowHide() {
+        mTaskStackListener.onSizeCompatModeActivityChanged(DISPLAY_ID, mMockActivityToken);
+
+        // Verifies that the restart button is hidden when IME is visible.
+        doReturn(View.VISIBLE).when(mMockButton).getVisibility();
+        mController.setImeWindowStatus(DISPLAY_ID, null /* token */, InputMethodService.IME_VISIBLE,
+                0 /* backDisposition */, false /* showImeSwitcher */);
+        verify(mMockButton).setVisibility(eq(View.GONE));
+
+        // Verifies that the restart button is visible when IME is hidden.
+        doReturn(View.GONE).when(mMockButton).getVisibility();
+        mController.setImeWindowStatus(DISPLAY_ID, null /* token */, 0 /* vis */,
+                0 /* backDisposition */, false /* showImeSwitcher */);
+        verify(mMockButton).setVisibility(eq(View.VISIBLE));
+    }
+}
diff --git a/packages/SystemUI/tests/src/com/android/systemui/SliceBroadcastRelayHandlerTest.java b/packages/SystemUI/tests/src/com/android/systemui/SliceBroadcastRelayHandlerTest.java
index 383db05..c6e85c3 100644
--- a/packages/SystemUI/tests/src/com/android/systemui/SliceBroadcastRelayHandlerTest.java
+++ b/packages/SystemUI/tests/src/com/android/systemui/SliceBroadcastRelayHandlerTest.java
@@ -29,9 +29,10 @@
 import android.content.Intent;
 import android.content.IntentFilter;
 import android.net.Uri;
-import android.support.test.filters.SmallTest;
 import android.testing.AndroidTestingRunner;
 
+import androidx.test.filters.SmallTest;
+
 import com.android.settingslib.SliceBroadcastRelay;
 
 import org.junit.Test;
diff --git a/packages/SystemUI/tests/src/com/android/systemui/SysuiBaseFragmentTest.java b/packages/SystemUI/tests/src/com/android/systemui/SysuiBaseFragmentTest.java
index b6335f3..256cfb2 100644
--- a/packages/SystemUI/tests/src/com/android/systemui/SysuiBaseFragmentTest.java
+++ b/packages/SystemUI/tests/src/com/android/systemui/SysuiBaseFragmentTest.java
@@ -19,10 +19,11 @@
 
 import android.app.Fragment;
 import android.app.Instrumentation;
-import android.support.test.InstrumentationRegistry;
 import android.testing.BaseFragmentTest;
 import android.testing.DexmakerShareClassLoaderRule;
 
+import androidx.test.InstrumentationRegistry;
+
 import com.android.systemui.utils.leaks.LeakCheckedTest;
 import com.android.systemui.utils.leaks.LeakCheckedTest.SysuiLeakCheck;
 
diff --git a/packages/SystemUI/tests/src/com/android/systemui/SysuiTestCase.java b/packages/SystemUI/tests/src/com/android/systemui/SysuiTestCase.java
index 9c5a592..8d93f96 100644
--- a/packages/SystemUI/tests/src/com/android/systemui/SysuiTestCase.java
+++ b/packages/SystemUI/tests/src/com/android/systemui/SysuiTestCase.java
@@ -23,11 +23,12 @@
 import android.os.Looper;
 import android.os.MessageQueue;
 import android.os.ParcelFileDescriptor;
-import android.support.test.InstrumentationRegistry;
 import android.testing.DexmakerShareClassLoaderRule;
 import android.testing.LeakCheck;
 import android.util.Log;
 
+import androidx.test.InstrumentationRegistry;
+
 import com.android.keyguard.KeyguardUpdateMonitor;
 import com.android.systemui.util.Assert;
 
diff --git a/packages/SystemUI/tests/src/com/android/systemui/appops/AppOpsControllerTest.java b/packages/SystemUI/tests/src/com/android/systemui/appops/AppOpsControllerTest.java
index 2582946..b9afea1 100644
--- a/packages/SystemUI/tests/src/com/android/systemui/appops/AppOpsControllerTest.java
+++ b/packages/SystemUI/tests/src/com/android/systemui/appops/AppOpsControllerTest.java
@@ -22,16 +22,20 @@
 import static org.mockito.ArgumentMatchers.anyInt;
 import static org.mockito.ArgumentMatchers.anyLong;
 import static org.mockito.ArgumentMatchers.anyString;
+import static org.mockito.ArgumentMatchers.eq;
 import static org.mockito.Mockito.never;
 import static org.mockito.Mockito.times;
 import static org.mockito.Mockito.verify;
+import static org.mockito.Mockito.when;
 
 import android.app.AppOpsManager;
+import android.content.pm.PackageManager;
 import android.os.UserHandle;
-import android.support.test.filters.SmallTest;
 import android.testing.AndroidTestingRunner;
 import android.testing.TestableLooper;
 
+import androidx.test.filters.SmallTest;
+
 import com.android.systemui.Dependency;
 import com.android.systemui.SysuiTestCase;
 
@@ -46,12 +50,15 @@
 @TestableLooper.RunWithLooper
 public class AppOpsControllerTest extends SysuiTestCase {
     private static final String TEST_PACKAGE_NAME = "test";
-    private static final int TEST_UID = 0;
-    private static final int TEST_UID_OTHER = 500000;
+    private static final int TEST_UID = UserHandle.getUid(0, 0);
+    private static final int TEST_UID_OTHER = UserHandle.getUid(1, 0);
+    private static final int TEST_UID_NON_USER_SENSITIVE = UserHandle.getUid(2, 0);
 
     @Mock
     private AppOpsManager mAppOpsManager;
     @Mock
+    private PackageManager mPackageManager;
+    @Mock
     private AppOpsController.Callback mCallback;
     @Mock
     private AppOpsControllerImpl.H mMockHandler;
@@ -64,6 +71,18 @@
 
         getContext().addMockSystemService(AppOpsManager.class, mAppOpsManager);
 
+        // All permissions of TEST_UID and TEST_UID_OTHER are user sensitive. None of
+        // TEST_UID_NON_USER_SENSITIVE are user sensitive.
+        getContext().setMockPackageManager(mPackageManager);
+        when(mPackageManager.getPermissionFlags(anyString(), anyString(),
+                eq(UserHandle.getUserHandleForUid(TEST_UID)))).thenReturn(
+                PackageManager.FLAG_PERMISSION_USER_SENSITIVE_WHEN_GRANTED);
+        when(mPackageManager.getPermissionFlags(anyString(), anyString(),
+                eq(UserHandle.getUserHandleForUid(TEST_UID_OTHER)))).thenReturn(
+                PackageManager.FLAG_PERMISSION_USER_SENSITIVE_WHEN_GRANTED);
+        when(mPackageManager.getPermissionFlags(anyString(), anyString(),
+                eq(UserHandle.getUserHandleForUid(TEST_UID_NON_USER_SENSITIVE)))).thenReturn(0);
+
         mController = new AppOpsControllerImpl(mContext, Dependency.get(Dependency.BG_LOOPER));
     }
 
@@ -156,6 +175,14 @@
     }
 
     @Test
+    public void nonUserSensitiveOpsAreIgnored() {
+        mController.onOpActiveChanged(AppOpsManager.OP_RECORD_AUDIO,
+                TEST_UID_NON_USER_SENSITIVE, TEST_PACKAGE_NAME, true);
+        assertEquals(0, mController.getActiveAppOpsForUser(
+                UserHandle.getUserId(TEST_UID_NON_USER_SENSITIVE)).size());
+    }
+
+    @Test
     public void opNotedScheduledForRemoval() {
         mController.setBGHandler(mMockHandler);
         mController.onOpNoted(AppOpsManager.OP_FINE_LOCATION, TEST_UID, TEST_PACKAGE_NAME,
diff --git a/packages/SystemUI/tests/src/com/android/systemui/bubbles/BubbleControllerTest.java b/packages/SystemUI/tests/src/com/android/systemui/bubbles/BubbleControllerTest.java
index ca72602..42c221a 100644
--- a/packages/SystemUI/tests/src/com/android/systemui/bubbles/BubbleControllerTest.java
+++ b/packages/SystemUI/tests/src/com/android/systemui/bubbles/BubbleControllerTest.java
@@ -20,17 +20,21 @@
 import static org.junit.Assert.assertFalse;
 import static org.junit.Assert.assertTrue;
 import static org.mockito.Mockito.atLeastOnce;
+import static org.mockito.Mockito.never;
+import static org.mockito.Mockito.times;
 import static org.mockito.Mockito.verify;
 import static org.mockito.Mockito.when;
 
 import android.app.IActivityManager;
+import android.app.PendingIntent;
 import android.content.Context;
-import android.support.test.filters.SmallTest;
 import android.testing.AndroidTestingRunner;
 import android.testing.TestableLooper;
 import android.view.WindowManager;
 import android.widget.FrameLayout;
 
+import androidx.test.filters.SmallTest;
+
 import com.android.systemui.SysuiTestCase;
 import com.android.systemui.statusbar.NotificationTestHelper;
 import com.android.systemui.statusbar.notification.NotificationEntryListener;
@@ -82,6 +86,9 @@
     @Mock
     private BubbleController.BubbleExpandListener mBubbleExpandListener;
 
+    @Mock
+    private PendingIntent mDeleteIntent;
+
     private BubbleData mBubbleData;
 
     @Before
@@ -97,9 +104,9 @@
 
         // Need notifications for bubbles
         mNotificationTestHelper = new NotificationTestHelper(mContext);
-        mRow = mNotificationTestHelper.createBubble();
-        mRow2 = mNotificationTestHelper.createBubble();
-        mNoChannelRow = mNotificationTestHelper.createBubble();
+        mRow = mNotificationTestHelper.createBubble(mDeleteIntent);
+        mRow2 = mNotificationTestHelper.createBubble(mDeleteIntent);
+        mNoChannelRow = mNotificationTestHelper.createBubble(mDeleteIntent);
 
         // Return non-null notification data from the NEM
         when(mNotificationEntryManager.getNotificationData()).thenReturn(mNotificationData);
@@ -140,11 +147,10 @@
 
         verify(mBubbleStateChangeListener).onHasBubblesChanged(true);
 
-        mBubbleController.removeBubble(mRow.getEntry().key);
+        mBubbleController.removeBubble(mRow.getEntry().key, BubbleController.DISMISS_USER_GESTURE);
         assertFalse(mStatusBarWindowController.getBubblesShowing());
         assertTrue(mRow.getEntry().isBubbleDismissed());
         verify(mNotificationEntryManager).updateNotifications();
-
         verify(mBubbleStateChangeListener).onHasBubblesChanged(false);
     }
 
@@ -154,7 +160,7 @@
         mBubbleController.updateBubble(mRow2.getEntry(), true /* updatePosition */);
         assertTrue(mBubbleController.hasBubbles());
 
-        mBubbleController.dismissStack();
+        mBubbleController.dismissStack(BubbleController.DISMISS_USER_GESTURE);
         assertFalse(mStatusBarWindowController.getBubblesShowing());
         verify(mNotificationEntryManager).updateNotifications();
         assertTrue(mRow.getEntry().isBubbleDismissed());
@@ -270,7 +276,8 @@
         assertFalse(mRow2.getEntry().showInShadeWhenBubble());
 
         // Dismiss currently expanded
-        mBubbleController.removeBubble(stackView.getExpandedBubbleView().getKey());
+        mBubbleController.removeBubble(stackView.getExpandedBubbleView().getKey(),
+                BubbleController.DISMISS_USER_GESTURE);
         verify(mBubbleExpandListener).onBubbleExpandChanged(false, mRow2.getEntry().key);
 
         // Make sure next bubble is selected
@@ -278,7 +285,8 @@
         verify(mBubbleExpandListener).onBubbleExpandChanged(true, mRow.getEntry().key);
 
         // Dismiss that one
-        mBubbleController.removeBubble(stackView.getExpandedBubbleView().getKey());
+        mBubbleController.removeBubble(stackView.getExpandedBubbleView().getKey(),
+                BubbleController.DISMISS_USER_GESTURE);
 
         // Make sure state changes and collapse happens
         verify(mBubbleExpandListener).onBubbleExpandChanged(false, mRow.getEntry().key);
@@ -298,6 +306,28 @@
         assertTrue(mRow.getEntry().showInShadeWhenBubble());
     }
 
+    @Test
+    public void testDeleteIntent_removeBubble_aged() throws PendingIntent.CanceledException {
+        mBubbleController.updateBubble(mRow.getEntry(), true /* updatePosition */);
+        mBubbleController.removeBubble(mRow.getEntry().key, BubbleController.DISMISS_AGED);
+        verify(mDeleteIntent, never()).send();
+    }
+
+    @Test
+    public void testDeleteIntent_removeBubble_user() throws PendingIntent.CanceledException {
+        mBubbleController.updateBubble(mRow.getEntry(), true /* updatePosition */);
+        mBubbleController.removeBubble(mRow.getEntry().key, BubbleController.DISMISS_USER_GESTURE);
+        verify(mDeleteIntent, times(1)).send();
+    }
+
+    @Test
+    public void testDeleteIntent_dismissStack() throws PendingIntent.CanceledException {
+        mBubbleController.updateBubble(mRow.getEntry(), true /* updatePosition */);
+        mBubbleController.updateBubble(mRow2.getEntry(), true /* updatePosition */);
+        mBubbleController.dismissStack(BubbleController.DISMISS_USER_GESTURE);
+        verify(mDeleteIntent, times(2)).send();
+    }
+
     static class TestableBubbleController extends BubbleController {
 
         TestableBubbleController(Context context,
diff --git a/packages/SystemUI/tests/src/com/android/systemui/bubbles/animation/ExpandedAnimationControllerTest.java b/packages/SystemUI/tests/src/com/android/systemui/bubbles/animation/ExpandedAnimationControllerTest.java
index b4059c5..b8add89 100644
--- a/packages/SystemUI/tests/src/com/android/systemui/bubbles/animation/ExpandedAnimationControllerTest.java
+++ b/packages/SystemUI/tests/src/com/android/systemui/bubbles/animation/ExpandedAnimationControllerTest.java
@@ -21,12 +21,12 @@
 import android.content.res.Resources;
 import android.graphics.Point;
 import android.graphics.PointF;
-import android.support.test.filters.SmallTest;
 import android.testing.AndroidTestingRunner;
 import android.view.View;
 import android.widget.FrameLayout;
 
 import androidx.dynamicanimation.animation.DynamicAnimation;
+import androidx.test.filters.SmallTest;
 
 import com.android.systemui.R;
 
diff --git a/packages/SystemUI/tests/src/com/android/systemui/bubbles/animation/PhysicsAnimationLayoutTest.java b/packages/SystemUI/tests/src/com/android/systemui/bubbles/animation/PhysicsAnimationLayoutTest.java
index c3214040..a50919b 100644
--- a/packages/SystemUI/tests/src/com/android/systemui/bubbles/animation/PhysicsAnimationLayoutTest.java
+++ b/packages/SystemUI/tests/src/com/android/systemui/bubbles/animation/PhysicsAnimationLayoutTest.java
@@ -28,13 +28,13 @@
 import static org.mockito.Mockito.never;
 
 import android.os.SystemClock;
-import android.support.test.filters.SmallTest;
 import android.testing.AndroidTestingRunner;
 import android.view.View;
 import android.widget.FrameLayout;
 
 import androidx.dynamicanimation.animation.DynamicAnimation;
 import androidx.dynamicanimation.animation.SpringForce;
+import androidx.test.filters.SmallTest;
 
 import com.google.android.collect.Sets;
 
diff --git a/packages/SystemUI/tests/src/com/android/systemui/bubbles/animation/StackAnimationControllerTest.java b/packages/SystemUI/tests/src/com/android/systemui/bubbles/animation/StackAnimationControllerTest.java
index 97935ed..2ee73f3 100644
--- a/packages/SystemUI/tests/src/com/android/systemui/bubbles/animation/StackAnimationControllerTest.java
+++ b/packages/SystemUI/tests/src/com/android/systemui/bubbles/animation/StackAnimationControllerTest.java
@@ -19,13 +19,13 @@
 import static org.junit.Assert.assertEquals;
 
 import android.graphics.PointF;
-import android.support.test.filters.SmallTest;
 import android.testing.AndroidTestingRunner;
 import android.view.View;
 import android.widget.FrameLayout;
 
 import androidx.dynamicanimation.animation.DynamicAnimation;
 import androidx.dynamicanimation.animation.SpringForce;
+import androidx.test.filters.SmallTest;
 
 import com.android.systemui.R;
 
@@ -177,6 +177,7 @@
     }
 
     @Test
+    @Ignore("Occasionally flakes, ignoring pending investigation.")
     public void testChildRemoved() throws InterruptedException {
         assertEquals(0, mLayout.getTransientViewCount());
 
@@ -197,6 +198,26 @@
         assertEquals(0, mLayout.getChildAt(0).getTranslationX(), .1f);
     }
 
+    @Test
+    public void testRestoredAtRestingPosition() throws InterruptedException {
+        mStackController.flingStackThenSpringToEdge(0, 5000, 5000);
+
+        waitForPropertyAnimations(
+                DynamicAnimation.TRANSLATION_X, DynamicAnimation.TRANSLATION_Y);
+        waitForLayoutMessageQueue();
+
+        final PointF prevStackPos = mStackController.getStackPosition();
+
+        mLayout.removeAllViews();
+        mLayout.addView(new FrameLayout(getContext()));
+
+        waitForLayoutMessageQueue();
+        waitForPropertyAnimations(
+                DynamicAnimation.TRANSLATION_X, DynamicAnimation.TRANSLATION_Y);
+
+        assertEquals(prevStackPos, mStackController.getStackPosition());
+    }
+
     /**
      * Checks every child view to make sure it's stacked at the given coordinates, off to the left
      * or right side depending on offset multiplier.
@@ -216,7 +237,7 @@
      */
     private class TestableStackController extends StackAnimationController {
         @Override
-        public void flingThenSpringFirstBubbleWithStackFollowing(
+        protected void flingThenSpringFirstBubbleWithStackFollowing(
                 DynamicAnimation.ViewProperty property, float vel, float friction,
                 SpringForce spring, Float finalPosition) {
             mMainThreadHandler.post(() ->
diff --git a/packages/SystemUI/tests/src/com/android/systemui/chooser/ChooserHelperTest.java b/packages/SystemUI/tests/src/com/android/systemui/chooser/ChooserHelperTest.java
index 19ad7ca..ecfb9ee 100644
--- a/packages/SystemUI/tests/src/com/android/systemui/chooser/ChooserHelperTest.java
+++ b/packages/SystemUI/tests/src/com/android/systemui/chooser/ChooserHelperTest.java
@@ -29,9 +29,10 @@
 import android.app.ActivityTaskManager;
 import android.content.Intent;
 import android.os.Binder;
-import android.support.test.runner.AndroidJUnit4;
 import android.test.suitebuilder.annotation.SmallTest;
 
+import androidx.test.runner.AndroidJUnit4;
+
 import com.android.systemui.SysuiTestCase;
 
 import org.junit.Test;
diff --git a/packages/SystemUI/tests/src/com/android/systemui/colorextraction/SysuiColorExtractorTests.java b/packages/SystemUI/tests/src/com/android/systemui/colorextraction/SysuiColorExtractorTests.java
index 13dc36d..1649f98 100644
--- a/packages/SystemUI/tests/src/com/android/systemui/colorextraction/SysuiColorExtractorTests.java
+++ b/packages/SystemUI/tests/src/com/android/systemui/colorextraction/SysuiColorExtractorTests.java
@@ -22,8 +22,9 @@
 import android.app.WallpaperColors;
 import android.app.WallpaperManager;
 import android.graphics.Color;
-import android.support.test.filters.SmallTest;
-import android.support.test.runner.AndroidJUnit4;
+
+import androidx.test.filters.SmallTest;
+import androidx.test.runner.AndroidJUnit4;
 
 import com.android.internal.colorextraction.ColorExtractor;
 import com.android.systemui.SysuiTestCase;
diff --git a/packages/SystemUI/tests/src/com/android/systemui/doze/AlwaysOnDisplayPolicyTest.java b/packages/SystemUI/tests/src/com/android/systemui/doze/AlwaysOnDisplayPolicyTest.java
index 0bbdeb5..ec9acdf 100644
--- a/packages/SystemUI/tests/src/com/android/systemui/doze/AlwaysOnDisplayPolicyTest.java
+++ b/packages/SystemUI/tests/src/com/android/systemui/doze/AlwaysOnDisplayPolicyTest.java
@@ -19,10 +19,11 @@
 import static com.google.common.truth.Truth.assertThat;
 
 import android.provider.Settings;
-import android.support.test.filters.SmallTest;
-import android.support.test.runner.AndroidJUnit4;
 import android.text.format.DateUtils;
 
+import androidx.test.filters.SmallTest;
+import androidx.test.runner.AndroidJUnit4;
+
 import com.android.systemui.R;
 import com.android.systemui.SysuiTestCase;
 
diff --git a/packages/SystemUI/tests/src/com/android/systemui/doze/DozeConfigurationTest.java b/packages/SystemUI/tests/src/com/android/systemui/doze/DozeConfigurationTest.java
index 6807c22..20756c5 100644
--- a/packages/SystemUI/tests/src/com/android/systemui/doze/DozeConfigurationTest.java
+++ b/packages/SystemUI/tests/src/com/android/systemui/doze/DozeConfigurationTest.java
@@ -21,8 +21,9 @@
 import android.hardware.display.AmbientDisplayConfiguration;
 import android.os.UserHandle;
 import android.provider.Settings;
-import android.support.test.filters.SmallTest;
-import android.support.test.runner.AndroidJUnit4;
+
+import androidx.test.filters.SmallTest;
+import androidx.test.runner.AndroidJUnit4;
 
 import com.android.systemui.SysuiTestCase;
 
diff --git a/packages/SystemUI/tests/src/com/android/systemui/doze/DozeDockHandlerTest.java b/packages/SystemUI/tests/src/com/android/systemui/doze/DozeDockHandlerTest.java
index 23ff3d4..4ba2858 100644
--- a/packages/SystemUI/tests/src/com/android/systemui/doze/DozeDockHandlerTest.java
+++ b/packages/SystemUI/tests/src/com/android/systemui/doze/DozeDockHandlerTest.java
@@ -30,12 +30,13 @@
 import android.hardware.display.AmbientDisplayConfiguration;
 import android.os.Handler;
 import android.os.Looper;
-import android.support.test.InstrumentationRegistry;
-import android.support.test.filters.SmallTest;
 import android.testing.AndroidTestingRunner;
 import android.testing.TestableLooper;
 import android.testing.TestableLooper.RunWithLooper;
 
+import androidx.test.InstrumentationRegistry;
+import androidx.test.filters.SmallTest;
+
 import com.android.systemui.SysuiTestCase;
 import com.android.systemui.dock.DockManager;
 import com.android.systemui.dock.DockManagerFake;
diff --git a/packages/SystemUI/tests/src/com/android/systemui/doze/DozeMachineTest.java b/packages/SystemUI/tests/src/com/android/systemui/doze/DozeMachineTest.java
index f972508..6dfb19e 100644
--- a/packages/SystemUI/tests/src/com/android/systemui/doze/DozeMachineTest.java
+++ b/packages/SystemUI/tests/src/com/android/systemui/doze/DozeMachineTest.java
@@ -39,10 +39,11 @@
 import static org.mockito.Mockito.when;
 
 import android.hardware.display.AmbientDisplayConfiguration;
-import android.support.test.filters.SmallTest;
 import android.testing.AndroidTestingRunner;
 import android.testing.UiThreadTest;
 
+import androidx.test.filters.SmallTest;
+
 import com.android.systemui.SysuiTestCase;
 import com.android.systemui.util.wakelock.WakeLockFake;
 
diff --git a/packages/SystemUI/tests/src/com/android/systemui/doze/DozeScreenBrightnessTest.java b/packages/SystemUI/tests/src/com/android/systemui/doze/DozeScreenBrightnessTest.java
index 1cf73b0..cde3398 100644
--- a/packages/SystemUI/tests/src/com/android/systemui/doze/DozeScreenBrightnessTest.java
+++ b/packages/SystemUI/tests/src/com/android/systemui/doze/DozeScreenBrightnessTest.java
@@ -28,17 +28,16 @@
 import static com.android.systemui.doze.DozeMachine.State.UNINITIALIZED;
 
 import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertFalse;
 import static org.junit.Assert.assertNotEquals;
-import static org.junit.Assert.assertThat;
 import static org.junit.Assert.assertTrue;
 
 import android.content.Intent;
 import android.os.PowerManager;
 import android.os.UserHandle;
 import android.provider.Settings;
-import android.support.test.filters.SmallTest;
-import android.support.test.runner.AndroidJUnit4;
+
+import androidx.test.filters.SmallTest;
+import androidx.test.runner.AndroidJUnit4;
 
 import com.android.systemui.SysuiTestCase;
 import com.android.systemui.utils.hardware.FakeSensorManager;
diff --git a/packages/SystemUI/tests/src/com/android/systemui/doze/DozeScreenStatePreventingAdapterTest.java b/packages/SystemUI/tests/src/com/android/systemui/doze/DozeScreenStatePreventingAdapterTest.java
index a17a95f..903e4a1 100644
--- a/packages/SystemUI/tests/src/com/android/systemui/doze/DozeScreenStatePreventingAdapterTest.java
+++ b/packages/SystemUI/tests/src/com/android/systemui/doze/DozeScreenStatePreventingAdapterTest.java
@@ -22,9 +22,10 @@
 import static org.mockito.Mockito.verify;
 import static org.mockito.Mockito.when;
 
-import android.support.test.filters.SmallTest;
 import android.view.Display;
 
+import androidx.test.filters.SmallTest;
+
 import com.android.systemui.SysuiTestCase;
 import com.android.systemui.statusbar.phone.DozeParameters;
 
diff --git a/packages/SystemUI/tests/src/com/android/systemui/doze/DozeScreenStateTest.java b/packages/SystemUI/tests/src/com/android/systemui/doze/DozeScreenStateTest.java
index b6039b6..bfd448a 100644
--- a/packages/SystemUI/tests/src/com/android/systemui/doze/DozeScreenStateTest.java
+++ b/packages/SystemUI/tests/src/com/android/systemui/doze/DozeScreenStateTest.java
@@ -30,19 +30,16 @@
 import static org.junit.Assert.assertFalse;
 import static org.junit.Assert.assertThat;
 import static org.junit.Assert.assertTrue;
-import static org.mockito.Mockito.never;
-import static org.mockito.Mockito.reset;
-import static org.mockito.Mockito.verify;
 import static org.mockito.Mockito.when;
 
 import android.os.Looper;
-import android.support.test.filters.SmallTest;
-import android.support.test.runner.AndroidJUnit4;
 import android.view.Display;
 
+import androidx.test.filters.SmallTest;
+import androidx.test.runner.AndroidJUnit4;
+
 import com.android.systemui.SysuiTestCase;
 import com.android.systemui.statusbar.phone.DozeParameters;
-import com.android.systemui.util.wakelock.WakeLock;
 import com.android.systemui.util.wakelock.WakeLockFake;
 import com.android.systemui.utils.os.FakeHandler;
 
diff --git a/packages/SystemUI/tests/src/com/android/systemui/doze/DozeSensorsTest.java b/packages/SystemUI/tests/src/com/android/systemui/doze/DozeSensorsTest.java
index 463a6e6..4467faf 100644
--- a/packages/SystemUI/tests/src/com/android/systemui/doze/DozeSensorsTest.java
+++ b/packages/SystemUI/tests/src/com/android/systemui/doze/DozeSensorsTest.java
@@ -32,11 +32,12 @@
 
 import android.app.AlarmManager;
 import android.hardware.display.AmbientDisplayConfiguration;
-import android.support.test.filters.SmallTest;
 import android.testing.AndroidTestingRunner;
 import android.testing.TestableLooper;
 import android.testing.TestableLooper.RunWithLooper;
 
+import androidx.test.filters.SmallTest;
+
 import com.android.systemui.SysuiTestCase;
 import com.android.systemui.plugins.SensorManagerPlugin;
 import com.android.systemui.statusbar.phone.DozeParameters;
diff --git a/packages/SystemUI/tests/src/com/android/systemui/doze/DozeSuspendScreenStatePreventingAdapterTest.java b/packages/SystemUI/tests/src/com/android/systemui/doze/DozeSuspendScreenStatePreventingAdapterTest.java
index ed93561..fac58a0 100644
--- a/packages/SystemUI/tests/src/com/android/systemui/doze/DozeSuspendScreenStatePreventingAdapterTest.java
+++ b/packages/SystemUI/tests/src/com/android/systemui/doze/DozeSuspendScreenStatePreventingAdapterTest.java
@@ -22,9 +22,10 @@
 import static org.mockito.Mockito.verify;
 import static org.mockito.Mockito.when;
 
-import android.support.test.filters.SmallTest;
 import android.view.Display;
 
+import androidx.test.filters.SmallTest;
+
 import com.android.systemui.SysuiTestCase;
 import com.android.systemui.statusbar.phone.DozeParameters;
 
diff --git a/packages/SystemUI/tests/src/com/android/systemui/doze/DozeTriggersTest.java b/packages/SystemUI/tests/src/com/android/systemui/doze/DozeTriggersTest.java
index ca37347..8941182 100644
--- a/packages/SystemUI/tests/src/com/android/systemui/doze/DozeTriggersTest.java
+++ b/packages/SystemUI/tests/src/com/android/systemui/doze/DozeTriggersTest.java
@@ -30,11 +30,12 @@
 import android.hardware.display.AmbientDisplayConfiguration;
 import android.os.Handler;
 import android.os.Looper;
-import android.support.test.InstrumentationRegistry;
-import android.support.test.filters.SmallTest;
 import android.testing.AndroidTestingRunner;
 import android.testing.TestableLooper.RunWithLooper;
 
+import androidx.test.InstrumentationRegistry;
+import androidx.test.filters.SmallTest;
+
 import com.android.systemui.SysuiTestCase;
 import com.android.systemui.dock.DockManager;
 import com.android.systemui.dock.DockManagerFake;
diff --git a/packages/SystemUI/tests/src/com/android/systemui/doze/DozeUiTest.java b/packages/SystemUI/tests/src/com/android/systemui/doze/DozeUiTest.java
index 0d8d952..25231bc 100644
--- a/packages/SystemUI/tests/src/com/android/systemui/doze/DozeUiTest.java
+++ b/packages/SystemUI/tests/src/com/android/systemui/doze/DozeUiTest.java
@@ -27,19 +27,17 @@
 import static org.mockito.ArgumentMatchers.anyLong;
 import static org.mockito.ArgumentMatchers.eq;
 import static org.mockito.Mockito.clearInvocations;
-import static org.mockito.Mockito.mock;
 import static org.mockito.Mockito.never;
 import static org.mockito.Mockito.reset;
-import static org.mockito.Mockito.times;
 import static org.mockito.Mockito.verify;
 import static org.mockito.Mockito.when;
 
 import android.app.AlarmManager;
 import android.os.Handler;
 import android.os.HandlerThread;
-import android.os.PowerManager;
-import android.support.test.filters.SmallTest;
-import android.support.test.runner.AndroidJUnit4;
+
+import androidx.test.filters.SmallTest;
+import androidx.test.runner.AndroidJUnit4;
 
 import com.android.keyguard.KeyguardUpdateMonitor;
 import com.android.systemui.SysuiTestCase;
@@ -47,7 +45,6 @@
 import com.android.systemui.util.wakelock.WakeLockFake;
 
 import org.junit.After;
-import org.junit.Assert;
 import org.junit.Before;
 import org.junit.Test;
 import org.junit.runner.RunWith;
@@ -172,4 +169,4 @@
         mDozeUi.transitionTo(UNINITIALIZED, DOZE);
         verify(mHost).setAnimateWakeup(eq(false));
     }
-}
\ No newline at end of file
+}
diff --git a/packages/SystemUI/tests/src/com/android/systemui/doze/DozeWallpaperStateTest.java b/packages/SystemUI/tests/src/com/android/systemui/doze/DozeWallpaperStateTest.java
index 9eb94f4..beba905 100644
--- a/packages/SystemUI/tests/src/com/android/systemui/doze/DozeWallpaperStateTest.java
+++ b/packages/SystemUI/tests/src/com/android/systemui/doze/DozeWallpaperStateTest.java
@@ -24,7 +24,8 @@
 
 import android.app.IWallpaperManager;
 import android.os.RemoteException;
-import android.support.test.filters.SmallTest;
+
+import androidx.test.filters.SmallTest;
 
 import com.android.systemui.SysuiTestCase;
 import com.android.systemui.statusbar.notification.stack.StackStateAnimator;
diff --git a/packages/SystemUI/tests/src/com/android/systemui/keyguard/DismissCallbackRegistryTest.java b/packages/SystemUI/tests/src/com/android/systemui/keyguard/DismissCallbackRegistryTest.java
index 308670d..d35fc30 100644
--- a/packages/SystemUI/tests/src/com/android/systemui/keyguard/DismissCallbackRegistryTest.java
+++ b/packages/SystemUI/tests/src/com/android/systemui/keyguard/DismissCallbackRegistryTest.java
@@ -19,12 +19,11 @@
 import static org.mockito.Mockito.times;
 import static org.mockito.Mockito.verify;
 
-import android.support.test.filters.SmallTest;
-import android.support.test.runner.AndroidJUnit4;
+import androidx.test.filters.SmallTest;
+import androidx.test.runner.AndroidJUnit4;
 
 import com.android.internal.policy.IKeyguardDismissCallback;
 import com.android.systemui.SysuiTestCase;
-import com.android.systemui.UiOffloadThread;
 
 import org.junit.Before;
 import org.junit.Test;
diff --git a/packages/SystemUI/tests/src/com/android/systemui/keyguard/KeyguardSliceProviderTest.java b/packages/SystemUI/tests/src/com/android/systemui/keyguard/KeyguardSliceProviderTest.java
index e1717be..63d42a7 100644
--- a/packages/SystemUI/tests/src/com/android/systemui/keyguard/KeyguardSliceProviderTest.java
+++ b/packages/SystemUI/tests/src/com/android/systemui/keyguard/KeyguardSliceProviderTest.java
@@ -30,7 +30,6 @@
 import android.media.MediaMetadata;
 import android.net.Uri;
 import android.provider.Settings;
-import android.support.test.filters.SmallTest;
 import android.testing.AndroidTestingRunner;
 import android.testing.TestableLooper;
 import android.testing.TestableLooper.RunWithLooper;
@@ -41,6 +40,7 @@
 import androidx.slice.SliceSpecs;
 import androidx.slice.builders.ListBuilder;
 import androidx.slice.core.SliceQuery;
+import androidx.test.filters.SmallTest;
 
 import com.android.keyguard.KeyguardUpdateMonitor;
 import com.android.systemui.SysuiTestCase;
diff --git a/packages/SystemUI/tests/src/com/android/systemui/keyguard/LifecycleTest.java b/packages/SystemUI/tests/src/com/android/systemui/keyguard/LifecycleTest.java
index e0807d6..50914c8 100644
--- a/packages/SystemUI/tests/src/com/android/systemui/keyguard/LifecycleTest.java
+++ b/packages/SystemUI/tests/src/com/android/systemui/keyguard/LifecycleTest.java
@@ -19,9 +19,10 @@
 import static org.junit.Assert.assertFalse;
 import static org.junit.Assert.assertTrue;
 
-import android.support.test.filters.SmallTest;
 import android.testing.AndroidTestingRunner;
 
+import androidx.test.filters.SmallTest;
+
 import com.android.systemui.SysuiTestCase;
 
 import org.junit.Before;
diff --git a/packages/SystemUI/tests/src/com/android/systemui/keyguard/ScreenLifecycleTest.java b/packages/SystemUI/tests/src/com/android/systemui/keyguard/ScreenLifecycleTest.java
index 8c918f6..06e597e 100644
--- a/packages/SystemUI/tests/src/com/android/systemui/keyguard/ScreenLifecycleTest.java
+++ b/packages/SystemUI/tests/src/com/android/systemui/keyguard/ScreenLifecycleTest.java
@@ -21,9 +21,10 @@
 import static org.mockito.Mockito.verify;
 import static org.mockito.Mockito.verifyNoMoreInteractions;
 
-import android.support.test.filters.SmallTest;
 import android.testing.AndroidTestingRunner;
 
+import androidx.test.filters.SmallTest;
+
 import com.android.systemui.SysuiTestCase;
 
 import org.junit.Before;
diff --git a/packages/SystemUI/tests/src/com/android/systemui/keyguard/WakefulnessLifecycleTest.java b/packages/SystemUI/tests/src/com/android/systemui/keyguard/WakefulnessLifecycleTest.java
index 9eba9b8..1dc4150 100644
--- a/packages/SystemUI/tests/src/com/android/systemui/keyguard/WakefulnessLifecycleTest.java
+++ b/packages/SystemUI/tests/src/com/android/systemui/keyguard/WakefulnessLifecycleTest.java
@@ -22,9 +22,10 @@
 import static org.mockito.Mockito.verify;
 import static org.mockito.Mockito.verifyNoMoreInteractions;
 
-import android.support.test.filters.SmallTest;
 import android.testing.AndroidTestingRunner;
 
+import androidx.test.filters.SmallTest;
+
 import com.android.systemui.SysuiTestCase;
 
 import org.junit.Before;
diff --git a/packages/SystemUI/tests/src/com/android/systemui/keyguard/WorkLockActivityControllerTest.java b/packages/SystemUI/tests/src/com/android/systemui/keyguard/WorkLockActivityControllerTest.java
index 199c4c2..d26ae6a 100644
--- a/packages/SystemUI/tests/src/com/android/systemui/keyguard/WorkLockActivityControllerTest.java
+++ b/packages/SystemUI/tests/src/com/android/systemui/keyguard/WorkLockActivityControllerTest.java
@@ -16,13 +16,13 @@
 
 package com.android.systemui.keyguard;
 
+import static org.mockito.Matchers.any;
+import static org.mockito.Matchers.anyInt;
+import static org.mockito.Matchers.argThat;
 import static org.mockito.Mockito.doReturn;
 import static org.mockito.Mockito.eq;
 import static org.mockito.Mockito.never;
 import static org.mockito.Mockito.verify;
-import static org.mockito.Matchers.any;
-import static org.mockito.Matchers.anyInt;
-import static org.mockito.Matchers.argThat;
 
 import android.app.Activity;
 import android.app.ActivityManager;
@@ -36,13 +36,14 @@
 import android.os.Bundle;
 import android.os.IBinder;
 import android.os.UserHandle;
-import android.support.test.filters.SmallTest;
-import android.support.test.runner.AndroidJUnit4;
+
+import androidx.test.filters.SmallTest;
+import androidx.test.runner.AndroidJUnit4;
 
 import com.android.systemui.SysuiTestCase;
 import com.android.systemui.shared.system.ActivityManagerWrapper;
-
 import com.android.systemui.shared.system.TaskStackChangeListener;
+
 import org.junit.Before;
 import org.junit.Test;
 import org.junit.runner.RunWith;
diff --git a/packages/SystemUI/tests/src/com/android/systemui/keyguard/WorkLockActivityTest.java b/packages/SystemUI/tests/src/com/android/systemui/keyguard/WorkLockActivityTest.java
index 9f3573f..6e726cf 100644
--- a/packages/SystemUI/tests/src/com/android/systemui/keyguard/WorkLockActivityTest.java
+++ b/packages/SystemUI/tests/src/com/android/systemui/keyguard/WorkLockActivityTest.java
@@ -17,13 +17,11 @@
 package com.android.systemui.keyguard;
 
 import static android.app.ActivityManager.TaskDescription;
+
 import static org.junit.Assert.assertEquals;
 import static org.mockito.Mockito.eq;
 import static org.mockito.Mockito.when;
 
-import android.support.test.filters.SmallTest;
-import android.support.test.runner.AndroidJUnit4;
-
 import android.annotation.ColorInt;
 import android.annotation.UserIdInt;
 import android.app.KeyguardManager;
@@ -33,6 +31,9 @@
 import android.graphics.Color;
 import android.os.Looper;
 
+import androidx.test.filters.SmallTest;
+import androidx.test.runner.AndroidJUnit4;
+
 import com.android.systemui.SysuiTestCase;
 import com.android.systemui.keyguard.WorkLockActivity;
 
diff --git a/packages/SystemUI/tests/src/com/android/systemui/pip/phone/PipTouchStateTest.java b/packages/SystemUI/tests/src/com/android/systemui/pip/phone/PipTouchStateTest.java
index b7c1e8e..3155e57 100644
--- a/packages/SystemUI/tests/src/com/android/systemui/pip/phone/PipTouchStateTest.java
+++ b/packages/SystemUI/tests/src/com/android/systemui/pip/phone/PipTouchStateTest.java
@@ -26,13 +26,14 @@
 import android.os.Handler;
 import android.os.Looper;
 import android.os.SystemClock;
-import android.support.test.filters.SmallTest;
 import android.testing.AndroidTestingRunner;
 import android.testing.TestableLooper;
 import android.testing.TestableLooper.RunWithLooper;
 import android.view.MotionEvent;
 import android.view.ViewConfiguration;
 
+import androidx.test.filters.SmallTest;
+
 import com.android.systemui.SysuiTestCase;
 
 import org.junit.Before;
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 cd500b4..58c9311 100644
--- a/packages/SystemUI/tests/src/com/android/systemui/power/PowerNotificationWarningsTest.java
+++ b/packages/SystemUI/tests/src/com/android/systemui/power/PowerNotificationWarningsTest.java
@@ -30,9 +30,11 @@
 
 import android.app.Notification;
 import android.app.NotificationManager;
-import android.support.test.runner.AndroidJUnit4;
+import android.os.BatteryManager;
 import android.test.suitebuilder.annotation.SmallTest;
 
+import androidx.test.runner.AndroidJUnit4;
+
 import com.android.internal.messages.nano.SystemMessageProto.SystemMessage;
 import com.android.systemui.SysuiTestCase;
 import com.android.systemui.util.NotificationChannels;
@@ -56,6 +58,9 @@
         // Test Instance.
         mContext.addMockSystemService(NotificationManager.class, mMockNotificationManager);
         mPowerNotificationWarnings = new PowerNotificationWarnings(mContext);
+        BatteryStateSnapshot snapshot = new BatteryStateSnapshot(100, false, false, 1,
+                BatteryManager.BATTERY_HEALTH_GOOD, 5, 15);
+        mPowerNotificationWarnings.updateSnapshot(snapshot);
     }
 
     @Test
diff --git a/packages/SystemUI/tests/src/com/android/systemui/power/PowerUITest.java b/packages/SystemUI/tests/src/com/android/systemui/power/PowerUITest.java
index 0aed63d..f51e473 100644
--- a/packages/SystemUI/tests/src/com/android/systemui/power/PowerUITest.java
+++ b/packages/SystemUI/tests/src/com/android/systemui/power/PowerUITest.java
@@ -17,8 +17,7 @@
 import static android.provider.Settings.Global.SHOW_TEMPERATURE_WARNING;
 import static android.provider.Settings.Global.SHOW_USB_TEMPERATURE_ALARM;
 
-import static junit.framework.Assert.assertFalse;
-import static junit.framework.Assert.assertTrue;
+import static com.google.common.truth.Truth.assertThat;
 
 import static org.mockito.Matchers.eq;
 import static org.mockito.Mockito.anyObject;
@@ -29,7 +28,6 @@
 import static org.mockito.Mockito.when;
 
 import android.content.Context;
-import android.content.Intent;
 import android.os.BatteryManager;
 import android.os.IThermalEventListener;
 import android.os.IThermalService;
@@ -42,22 +40,20 @@
 import android.testing.TestableLooper.RunWithLooper;
 import android.testing.TestableResources;
 
-import com.android.settingslib.utils.ThreadUtils;
 import com.android.systemui.R;
 import com.android.systemui.SysuiTestCase;
 import com.android.systemui.power.PowerUI.WarningsUI;
 import com.android.systemui.statusbar.phone.StatusBar;
 
+import java.time.Duration;
+import java.util.concurrent.TimeUnit;
+
 import org.junit.Before;
 import org.junit.Test;
 import org.junit.runner.RunWith;
 import org.mockito.Mock;
 import org.mockito.MockitoAnnotations;
 
-import java.time.Duration;
-import java.util.concurrent.CountDownLatch;
-import java.util.concurrent.TimeUnit;
-
 @RunWith(AndroidTestingRunner.class)
 @RunWithLooper
 @SmallTest
@@ -75,6 +71,7 @@
     private static final int OLD_BATTERY_LEVEL_NINE = 9;
     private static final int OLD_BATTERY_LEVEL_10 = 10;
     private static final long VERY_BELOW_SEVERE_HYBRID_THRESHOLD = TimeUnit.MINUTES.toMillis(15);
+    public static final int BATTERY_LEVEL_10 = 10;
     private WarningsUI mMockWarnings;
     private PowerUI mPowerUI;
     private EnhancedEstimates mEnhancedEstimates;
@@ -176,368 +173,333 @@
     }
 
     @Test
-    public void testShouldShowLowBatteryWarning_showHybridOnly_overrideThresholdHigh_returnsNoShow() {
-        when(mEnhancedEstimates.isHybridNotificationEnabled()).thenReturn(true);
-        when(mEnhancedEstimates.getLowWarningThreshold())
-                .thenReturn(Duration.ofHours(1).toMillis());
-        when(mEnhancedEstimates.getSevereWarningThreshold()).thenReturn(ONE_HOUR_MILLIS);
+    public void testMaybeShowHybridWarning() {
         mPowerUI.start();
 
-        // unplugged device that would not show the non-hybrid notification but would show the
-        // hybrid but the threshold has been overriden to be too low
-        boolean shouldShow =
-                mPowerUI.shouldShowLowBatteryWarning(UNPLUGGED, UNPLUGGED, ABOVE_WARNING_BUCKET,
-                        ABOVE_WARNING_BUCKET, BELOW_HYBRID_THRESHOLD,
-                        POWER_SAVER_OFF, BatteryManager.BATTERY_HEALTH_GOOD);
-        assertFalse(shouldShow);
+        // verify low warning shown this cycle noticed
+        BatteryStateSnapshotWrapper state = new BatteryStateSnapshotWrapper();
+        BatteryStateSnapshot lastState = state.get();
+        state.mTimeRemainingMillis = Duration.ofHours(2).toMillis();
+        state.mBatteryLevel = 15;
+
+        mPowerUI.maybeShowHybridWarning(state.get(), lastState);
+
+        assertThat(mPowerUI.mLowWarningShownThisChargeCycle).isTrue();
+        assertThat(mPowerUI.mSevereWarningShownThisChargeCycle).isFalse();
+
+        // verify severe warning noticed this cycle
+        lastState = state.get();
+        state.mBatteryLevel = 1;
+        state.mTimeRemainingMillis = Duration.ofMinutes(10).toMillis();
+
+        mPowerUI.maybeShowHybridWarning(state.get(), lastState);
+
+        assertThat(mPowerUI.mLowWarningShownThisChargeCycle).isTrue();
+        assertThat(mPowerUI.mSevereWarningShownThisChargeCycle).isTrue();
+
+        // verify getting past threshold resets values
+        lastState = state.get();
+        state.mBatteryLevel = 100;
+        state.mTimeRemainingMillis = Duration.ofDays(1).toMillis();
+
+        mPowerUI.maybeShowHybridWarning(state.get(), lastState);
+
+        assertThat(mPowerUI.mLowWarningShownThisChargeCycle).isFalse();
+        assertThat(mPowerUI.mSevereWarningShownThisChargeCycle).isFalse();
     }
 
     @Test
-    public void testShouldShowLowBatteryWarning_showHybridOnly_overrideThresholdHigh_returnsShow() {
-        when(mEnhancedEstimates.isHybridNotificationEnabled()).thenReturn(true);
-        when(mEnhancedEstimates.getLowWarningThreshold())
-                .thenReturn(Duration.ofHours(5).toMillis());
-        when(mEnhancedEstimates.getSevereWarningThreshold()).thenReturn(ONE_HOUR_MILLIS);
+    public void testShouldShowHybridWarning_lowLevelWarning() {
         mPowerUI.start();
+        mPowerUI.mLowWarningShownThisChargeCycle = false;
+        mPowerUI.mSevereWarningShownThisChargeCycle = false;
+        BatteryStateSnapshotWrapper state = new BatteryStateSnapshotWrapper();
 
-        // unplugged device that would not show the non-hybrid notification but would show the
-        // hybrid since the threshold has been overriden to be much higher
-        boolean shouldShow =
-                mPowerUI.shouldShowLowBatteryWarning(UNPLUGGED, UNPLUGGED, ABOVE_WARNING_BUCKET,
-                        ABOVE_WARNING_BUCKET, ABOVE_HYBRID_THRESHOLD,
-                        POWER_SAVER_OFF, BatteryManager.BATTERY_HEALTH_GOOD);
-        assertTrue(shouldShow);
+        // sanity check to make sure we can show for a valid config
+        state.mBatteryLevel = 10;
+        state.mTimeRemainingMillis = Duration.ofHours(2).toMillis();
+        boolean shouldShow = mPowerUI.shouldShowHybridWarning(state.get());
+        assertThat(shouldShow).isTrue();
+
+        // Shouldn't show if plugged in
+        state.mPlugged = true;
+        shouldShow = mPowerUI.shouldShowHybridWarning(state.get());
+        assertThat(shouldShow).isFalse();
+
+        // Shouldn't show if battery is unknown
+        state.mPlugged = false;
+        state.mBatteryStatus = BatteryManager.BATTERY_STATUS_UNKNOWN;
+        shouldShow = mPowerUI.shouldShowHybridWarning(state.get());
+        assertThat(shouldShow).isFalse();
+
+        state.mBatteryStatus = BatteryManager.BATTERY_HEALTH_GOOD;
+        // Already shown both warnings
+        mPowerUI.mLowWarningShownThisChargeCycle = true;
+        mPowerUI.mSevereWarningShownThisChargeCycle = true;
+        shouldShow = mPowerUI.shouldShowHybridWarning(state.get());
+        assertThat(shouldShow).isFalse();
+
+        // Can show low warning
+        mPowerUI.mLowWarningShownThisChargeCycle = false;
+        shouldShow = mPowerUI.shouldShowHybridWarning(state.get());
+        assertThat(shouldShow).isTrue();
+
+        // Can't show if above the threshold for time & battery
+        state.mTimeRemainingMillis = Duration.ofHours(1000).toMillis();
+        state.mBatteryLevel = 100;
+        shouldShow = mPowerUI.shouldShowHybridWarning(state.get());
+        assertThat(shouldShow).isFalse();
+
+        // Battery under low percentage threshold but not time
+        state.mBatteryLevel = 10;
+        state.mLowLevelThreshold = 50;
+        shouldShow = mPowerUI.shouldShowHybridWarning(state.get());
+        assertThat(shouldShow).isTrue();
+
+        // Should also trigger if both level and time remaining under low threshold
+        state.mTimeRemainingMillis = Duration.ofHours(2).toMillis();
+        shouldShow = mPowerUI.shouldShowHybridWarning(state.get());
+        assertThat(shouldShow).isTrue();
+
+        // battery saver should block the low level warning though
+        state.mIsPowerSaver = true;
+        shouldShow = mPowerUI.shouldShowHybridWarning(state.get());
+        assertThat(shouldShow).isFalse();
     }
 
     @Test
-    public void testShouldShowLowBatteryWarning_showHybridOnly_returnsShow() {
-        when(mEnhancedEstimates.isHybridNotificationEnabled()).thenReturn(true);
-        when(mEnhancedEstimates.getLowWarningThreshold()).thenReturn(PowerUI.THREE_HOURS_IN_MILLIS);
-        when(mEnhancedEstimates.getSevereWarningThreshold()).thenReturn(ONE_HOUR_MILLIS);
+    public void testShouldShowHybridWarning_severeLevelWarning() {
         mPowerUI.start();
+        mPowerUI.mLowWarningShownThisChargeCycle = false;
+        mPowerUI.mSevereWarningShownThisChargeCycle = false;
+        BatteryStateSnapshotWrapper state = new BatteryStateSnapshotWrapper();
 
-        // unplugged device that would not show the non-hybrid notification but would show the
-        // hybrid
-        boolean shouldShow =
-                mPowerUI.shouldShowLowBatteryWarning(UNPLUGGED, UNPLUGGED, ABOVE_WARNING_BUCKET,
-                        ABOVE_WARNING_BUCKET, BELOW_HYBRID_THRESHOLD,
-                        POWER_SAVER_OFF, BatteryManager.BATTERY_HEALTH_GOOD);
-        assertTrue(shouldShow);
+        // sanity check to make sure we can show for a valid config
+        state.mBatteryLevel = 1;
+        state.mTimeRemainingMillis = Duration.ofMinutes(1).toMillis();
+        boolean shouldShow = mPowerUI.shouldShowHybridWarning(state.get());
+        assertThat(shouldShow).isTrue();
+
+        // Shouldn't show if plugged in
+        state.mPlugged = true;
+        shouldShow = mPowerUI.shouldShowHybridWarning(state.get());
+        assertThat(shouldShow).isFalse();
+
+        // Shouldn't show if battery is unknown
+        state.mPlugged = false;
+        state.mBatteryStatus = BatteryManager.BATTERY_STATUS_UNKNOWN;
+        shouldShow = mPowerUI.shouldShowHybridWarning(state.get());
+        assertThat(shouldShow).isFalse();
+
+        state.mBatteryStatus = BatteryManager.BATTERY_HEALTH_GOOD;
+        // Already shown both warnings
+        mPowerUI.mLowWarningShownThisChargeCycle = true;
+        mPowerUI.mSevereWarningShownThisChargeCycle = true;
+        shouldShow = mPowerUI.shouldShowHybridWarning(state.get());
+        assertThat(shouldShow).isFalse();
+
+        // Can show severe warning
+        mPowerUI.mSevereWarningShownThisChargeCycle = false;
+        shouldShow = mPowerUI.shouldShowHybridWarning(state.get());
+        assertThat(shouldShow).isTrue();
+
+        // Can't show if above the threshold for time & battery
+        state.mTimeRemainingMillis = Duration.ofHours(1000).toMillis();
+        state.mBatteryLevel = 100;
+        shouldShow = mPowerUI.shouldShowHybridWarning(state.get());
+        assertThat(shouldShow).isFalse();
+
+        // Battery under low percentage threshold but not time
+        state.mBatteryLevel = 1;
+        state.mSevereLevelThreshold = 5;
+        shouldShow = mPowerUI.shouldShowHybridWarning(state.get());
+        assertThat(shouldShow).isTrue();
+
+        // Should also trigger if both level and time remaining under low threshold
+        state.mTimeRemainingMillis = Duration.ofHours(2).toMillis();
+        shouldShow = mPowerUI.shouldShowHybridWarning(state.get());
+        assertThat(shouldShow).isTrue();
+
+        // battery saver should not block the severe level warning though
+        state.mIsPowerSaver = true;
+        shouldShow = mPowerUI.shouldShowHybridWarning(state.get());
+        assertThat(shouldShow).isTrue();
     }
 
     @Test
-    public void testShouldShowLowBatteryWarning_showHybrid_showStandard_returnsShow() {
-        when(mEnhancedEstimates.isHybridNotificationEnabled()).thenReturn(true);
-        when(mEnhancedEstimates.getLowWarningThreshold()).thenReturn(PowerUI.THREE_HOURS_IN_MILLIS);
-        when(mEnhancedEstimates.getSevereWarningThreshold()).thenReturn(ONE_HOUR_MILLIS);
-        mPowerUI.mBatteryLevel = 10;
+    public void testShouldDismissHybridWarning() {
         mPowerUI.start();
+        BatteryStateSnapshotWrapper state = new BatteryStateSnapshotWrapper();
 
-        // unplugged device that would show the non-hybrid notification and the hybrid
-        boolean shouldShow =
-                mPowerUI.shouldShowLowBatteryWarning(UNPLUGGED, UNPLUGGED, ABOVE_WARNING_BUCKET,
-                        BELOW_WARNING_BUCKET, BELOW_HYBRID_THRESHOLD,
-                        POWER_SAVER_OFF, BatteryManager.BATTERY_HEALTH_GOOD);
-        assertTrue(shouldShow);
+        // We should dismiss if the device is plugged in
+        state.mPlugged = true;
+        state.mTimeRemainingMillis = Duration.ofHours(1).toMillis();
+        state.mLowThresholdMillis = Duration.ofHours(2).toMillis();
+        boolean shouldDismiss = mPowerUI.shouldDismissHybridWarning(state.get());
+        assertThat(shouldDismiss).isTrue();
+
+        // If not plugged in and below the threshold we should not dismiss
+        state.mPlugged = false;
+        shouldDismiss = mPowerUI.shouldDismissHybridWarning(state.get());
+        assertThat(shouldDismiss).isFalse();
+
+        // If we go over the low warning threshold we should dismiss
+        state.mTimeRemainingMillis = Duration.ofHours(3).toMillis();
+        shouldDismiss = mPowerUI.shouldDismissHybridWarning(state.get());
+        assertThat(shouldDismiss).isTrue();
     }
 
     @Test
-    public void testShouldShowLowBatteryWarning_showStandardOnly_returnsShow() {
-        when(mEnhancedEstimates.isHybridNotificationEnabled()).thenReturn(true);
-        when(mEnhancedEstimates.getLowWarningThreshold()).thenReturn(PowerUI.THREE_HOURS_IN_MILLIS);
-        when(mEnhancedEstimates.getSevereWarningThreshold()).thenReturn(ONE_HOUR_MILLIS);
-        mPowerUI.mBatteryLevel = 10;
-        mPowerUI.start();
-
-        // unplugged device that would show the non-hybrid but not the hybrid
-        boolean shouldShow =
-                mPowerUI.shouldShowLowBatteryWarning(UNPLUGGED, UNPLUGGED, ABOVE_WARNING_BUCKET,
-                        BELOW_WARNING_BUCKET, ABOVE_HYBRID_THRESHOLD,
-                        POWER_SAVER_OFF, BatteryManager.BATTERY_HEALTH_GOOD);
-        assertTrue(shouldShow);
-    }
-
-    @Test
-    public void testShouldShowLowBatteryWarning_deviceHighBattery_returnsNoShow() {
-        when(mEnhancedEstimates.isHybridNotificationEnabled()).thenReturn(true);
-        when(mEnhancedEstimates.getLowWarningThreshold()).thenReturn(PowerUI.THREE_HOURS_IN_MILLIS);
-        when(mEnhancedEstimates.getSevereWarningThreshold()).thenReturn(ONE_HOUR_MILLIS);
-        mPowerUI.start();
-
-        // unplugged device that would show the neither due to battery level being good
-        boolean shouldShow =
-                mPowerUI.shouldShowLowBatteryWarning(UNPLUGGED, UNPLUGGED, ABOVE_WARNING_BUCKET,
-                        ABOVE_WARNING_BUCKET, ABOVE_HYBRID_THRESHOLD,
-                        POWER_SAVER_OFF, BatteryManager.BATTERY_HEALTH_GOOD);
-        assertFalse(shouldShow);
-    }
-
-    @Test
-    public void testShouldShowLowBatteryWarning_devicePlugged_returnsNoShow() {
-        when(mEnhancedEstimates.isHybridNotificationEnabled()).thenReturn(true);
-        when(mEnhancedEstimates.getLowWarningThreshold()).thenReturn(PowerUI.THREE_HOURS_IN_MILLIS);
-        when(mEnhancedEstimates.getSevereWarningThreshold()).thenReturn(ONE_HOUR_MILLIS);
-        mPowerUI.start();
-
-        // plugged device that would show the neither due to being plugged
-        boolean shouldShow =
-                mPowerUI.shouldShowLowBatteryWarning(!UNPLUGGED, UNPLUGGED, ABOVE_WARNING_BUCKET,
-                        BELOW_WARNING_BUCKET, BELOW_HYBRID_THRESHOLD,
-                        POWER_SAVER_OFF, BatteryManager.BATTERY_HEALTH_GOOD);
-        assertFalse(shouldShow);
-   }
-
-    @Test
-    public void testShouldShowLowBatteryWarning_deviceBatteryStatusUnknown_returnsNoShow() {
-        when(mEnhancedEstimates.isHybridNotificationEnabled()).thenReturn(true);
-        when(mEnhancedEstimates.getLowWarningThreshold()).thenReturn(PowerUI.THREE_HOURS_IN_MILLIS);
-        when(mEnhancedEstimates.getSevereWarningThreshold()).thenReturn(ONE_HOUR_MILLIS);
-        mPowerUI.start();
-
-        // Unknown battery status device that would show the neither due to the battery status being
-        // unknown
-        boolean shouldShow =
-                mPowerUI.shouldShowLowBatteryWarning(UNPLUGGED, UNPLUGGED, ABOVE_WARNING_BUCKET,
-                        BELOW_WARNING_BUCKET, BELOW_HYBRID_THRESHOLD,
-                        !POWER_SAVER_OFF, BatteryManager.BATTERY_STATUS_UNKNOWN);
-        assertFalse(shouldShow);
-    }
-
-    @Test
-    public void testShouldShowLowBatteryWarning_batterySaverEnabled_returnsNoShow() {
-        when(mEnhancedEstimates.isHybridNotificationEnabled()).thenReturn(true);
-        when(mEnhancedEstimates.getLowWarningThreshold()).thenReturn(PowerUI.THREE_HOURS_IN_MILLIS);
-        when(mEnhancedEstimates.getSevereWarningThreshold()).thenReturn(ONE_HOUR_MILLIS);
-        mPowerUI.start();
-
-        // BatterySaverEnabled device that would show the neither due to battery saver
-        boolean shouldShow =
-                mPowerUI.shouldShowLowBatteryWarning(UNPLUGGED, UNPLUGGED, ABOVE_WARNING_BUCKET,
-                        BELOW_WARNING_BUCKET, BELOW_HYBRID_THRESHOLD,
-                        !POWER_SAVER_OFF, BatteryManager.BATTERY_HEALTH_GOOD);
-        assertFalse(shouldShow);
-    }
-
-    @Test
-    public void testShouldShowLowBatteryWarning_onlyShowsOncePerChargeCycle() {
-        mPowerUI.start();
-        when(mEnhancedEstimates.isHybridNotificationEnabled()).thenReturn(true);
-        when(mEnhancedEstimates.getLowWarningThreshold()).thenReturn(PowerUI.THREE_HOURS_IN_MILLIS);
-        when(mEnhancedEstimates.getSevereWarningThreshold()).thenReturn(ONE_HOUR_MILLIS);
-        when(mEnhancedEstimates.getEstimate())
-                .thenReturn(new Estimate(BELOW_HYBRID_THRESHOLD, true));
-        mPowerUI.mBatteryStatus = BatteryManager.BATTERY_HEALTH_GOOD;
-
-        mPowerUI.maybeShowBatteryWarning(OLD_BATTERY_LEVEL_NINE, UNPLUGGED, UNPLUGGED,
-                ABOVE_WARNING_BUCKET, ABOVE_WARNING_BUCKET);
-
-        // reduce battery level to handle time based trigger -> level trigger interactions
-        mPowerUI.mBatteryLevel = 10;
-        boolean shouldShow =
-                mPowerUI.shouldShowLowBatteryWarning(UNPLUGGED, UNPLUGGED, ABOVE_WARNING_BUCKET,
-                        ABOVE_WARNING_BUCKET, BELOW_HYBRID_THRESHOLD,
-                        POWER_SAVER_OFF, BatteryManager.BATTERY_HEALTH_GOOD);
-        assertFalse(shouldShow);
-    }
-
-    @Test
-    public void testShouldDismissLowBatteryWarning_dismissWhenPowerSaverEnabledLegacy() {
-        mPowerUI.start();
-        when(mEnhancedEstimates.isHybridNotificationEnabled()).thenReturn(false);
-        when(mEnhancedEstimates.getLowWarningThreshold()).thenReturn(PowerUI.THREE_HOURS_IN_MILLIS);
-        when(mEnhancedEstimates.getSevereWarningThreshold()).thenReturn(ONE_HOUR_MILLIS);
-
-        // device that gets power saver turned on should dismiss
-        boolean shouldDismiss =
-                mPowerUI.shouldDismissLowBatteryWarning(UNPLUGGED, BELOW_WARNING_BUCKET,
-                        BELOW_WARNING_BUCKET, ABOVE_HYBRID_THRESHOLD, !POWER_SAVER_OFF);
-        assertTrue(shouldDismiss);
-    }
-
-    @Test
-    public void testShouldNotDismissLowBatteryWarning_dismissWhenPowerSaverEnabledHybrid() {
-        mPowerUI.start();
-        when(mEnhancedEstimates.isHybridNotificationEnabled()).thenReturn(true);
-        when(mEnhancedEstimates.getLowWarningThreshold()).thenReturn(PowerUI.THREE_HOURS_IN_MILLIS);
-        when(mEnhancedEstimates.getSevereWarningThreshold()).thenReturn(ONE_HOUR_MILLIS);
-
-        // device that gets power saver turned on should dismiss
-        boolean shouldDismiss =
-            mPowerUI.shouldDismissLowBatteryWarning(UNPLUGGED, BELOW_WARNING_BUCKET,
-                BELOW_WARNING_BUCKET, ABOVE_HYBRID_THRESHOLD, !POWER_SAVER_OFF);
-        assertFalse(shouldDismiss);
-    }
-
-    @Test
-    public void testShouldDismissLowBatteryWarning_dismissWhenPlugged() {
-        mPowerUI.start();
-        when(mEnhancedEstimates.isHybridNotificationEnabled()).thenReturn(true);
-        when(mEnhancedEstimates.getLowWarningThreshold()).thenReturn(PowerUI.THREE_HOURS_IN_MILLIS);
-        when(mEnhancedEstimates.getSevereWarningThreshold()).thenReturn(ONE_HOUR_MILLIS);
-
-        // device that gets plugged in should dismiss
-        boolean shouldDismiss =
-                mPowerUI.shouldDismissLowBatteryWarning(!UNPLUGGED, BELOW_WARNING_BUCKET,
-                        BELOW_WARNING_BUCKET, ABOVE_HYBRID_THRESHOLD, POWER_SAVER_OFF);
-        assertTrue(shouldDismiss);
-    }
-
-    @Test
-    public void testShouldDismissLowBatteryWarning_dismissHybridSignal_showStandardSignal_shouldShow() {
-        mPowerUI.start();
-        when(mEnhancedEstimates.isHybridNotificationEnabled()).thenReturn(true);
-        when(mEnhancedEstimates.getLowWarningThreshold()).thenReturn(PowerUI.THREE_HOURS_IN_MILLIS);
-        when(mEnhancedEstimates.getSevereWarningThreshold()).thenReturn(ONE_HOUR_MILLIS);
-
-        // would dismiss hybrid but not non-hybrid should not dismiss
-        boolean shouldDismiss =
-                mPowerUI.shouldDismissLowBatteryWarning(UNPLUGGED, BELOW_WARNING_BUCKET,
-                        BELOW_WARNING_BUCKET, ABOVE_HYBRID_THRESHOLD, POWER_SAVER_OFF);
-        assertFalse(shouldDismiss);
-    }
-
-    @Test
-    public void testShouldDismissLowBatteryWarning_showHybridSignal_dismissStandardSignal_shouldShow() {
-        mPowerUI.start();
-        when(mEnhancedEstimates.isHybridNotificationEnabled()).thenReturn(true);
-        when(mEnhancedEstimates.getLowWarningThreshold()).thenReturn(PowerUI.THREE_HOURS_IN_MILLIS);
-        when(mEnhancedEstimates.getSevereWarningThreshold()).thenReturn(ONE_HOUR_MILLIS);
-
-        // would dismiss non-hybrid but not hybrid should not dismiss
-        boolean shouldDismiss =
-                mPowerUI.shouldDismissLowBatteryWarning(UNPLUGGED, BELOW_WARNING_BUCKET,
-                        ABOVE_WARNING_BUCKET, BELOW_HYBRID_THRESHOLD, POWER_SAVER_OFF);
-        assertFalse(shouldDismiss);
-    }
-
-    @Test
-    public void testShouldDismissLowBatteryWarning_showBothSignal_shouldShow() {
-        mPowerUI.start();
-        when(mEnhancedEstimates.isHybridNotificationEnabled()).thenReturn(true);
-        when(mEnhancedEstimates.getLowWarningThreshold()).thenReturn(PowerUI.THREE_HOURS_IN_MILLIS);
-        when(mEnhancedEstimates.getSevereWarningThreshold()).thenReturn(ONE_HOUR_MILLIS);
-
-        // should not dismiss when both would not dismiss
-        boolean shouldDismiss =
-                mPowerUI.shouldDismissLowBatteryWarning(UNPLUGGED, BELOW_WARNING_BUCKET,
-                        BELOW_WARNING_BUCKET, BELOW_HYBRID_THRESHOLD, POWER_SAVER_OFF);
-        assertFalse(shouldDismiss);
-    }
-
-    @Test
-    public void testShouldDismissLowBatteryWarning_dismissBothSignal_shouldDismiss() {
-        mPowerUI.start();
-        when(mEnhancedEstimates.isHybridNotificationEnabled()).thenReturn(true);
-        when(mEnhancedEstimates.getLowWarningThreshold()).thenReturn(PowerUI.THREE_HOURS_IN_MILLIS);
-        when(mEnhancedEstimates.getSevereWarningThreshold()).thenReturn(ONE_HOUR_MILLIS);
-
-        //should dismiss if both would dismiss
-        boolean shouldDismiss =
-                mPowerUI.shouldDismissLowBatteryWarning(UNPLUGGED, BELOW_WARNING_BUCKET,
-                        ABOVE_WARNING_BUCKET, ABOVE_HYBRID_THRESHOLD, POWER_SAVER_OFF);
-        assertTrue(shouldDismiss);
-    }
-
-    @Test
-    public void testShouldDismissLowBatteryWarning_dismissStandardSignal_hybridDisabled_shouldDismiss() {
-        mPowerUI.start();
-        when(mEnhancedEstimates.isHybridNotificationEnabled()).thenReturn(false);
-        when(mEnhancedEstimates.getLowWarningThreshold()).thenReturn(PowerUI.THREE_HOURS_IN_MILLIS);
-        when(mEnhancedEstimates.getSevereWarningThreshold()).thenReturn(ONE_HOUR_MILLIS);
-
-        // would dismiss non-hybrid with hybrid disabled should dismiss
-        boolean shouldDismiss =
-                mPowerUI.shouldDismissLowBatteryWarning(UNPLUGGED, BELOW_WARNING_BUCKET,
-                        ABOVE_WARNING_BUCKET, ABOVE_HYBRID_THRESHOLD, POWER_SAVER_OFF);
-        assertTrue(shouldDismiss);
-    }
-
-    @Test
-    public void testShouldDismissLowBatteryWarning_powerSaverModeEnabled()
-            throws InterruptedException {
-        when(mPowerManager.isPowerSaveMode()).thenReturn(true);
-
-        mPowerUI.start();
-        mPowerUI.mReceiver.onReceive(mContext,
-                new Intent(PowerManager.ACTION_POWER_SAVE_MODE_CHANGED));
-
-        CountDownLatch latch = new CountDownLatch(1);
-        ThreadUtils.postOnBackgroundThread(() -> latch.countDown());
-        latch.await(5, TimeUnit.SECONDS);
-
-        verify(mMockWarnings).dismissLowBatteryWarning();
-    }
-
-    @Test
-    public void testShouldNotDismissLowBatteryWarning_powerSaverModeDisabled()
-            throws InterruptedException {
-        when(mPowerManager.isPowerSaveMode()).thenReturn(false);
-
-        mPowerUI.start();
-        mPowerUI.mReceiver.onReceive(mContext,
-                new Intent(PowerManager.ACTION_POWER_SAVE_MODE_CHANGED));
-
-        CountDownLatch latch = new CountDownLatch(1);
-        ThreadUtils.postOnBackgroundThread(() -> latch.countDown());
-        latch.await(5, TimeUnit.SECONDS);
-
-        verify(mMockWarnings, never()).dismissLowBatteryWarning();
-    }
-
-    @Test
-    public void testSevereWarning_countsAsLowAndSevere_WarningOnlyShownOnce() {
-        mPowerUI.start();
-        when(mEnhancedEstimates.isHybridNotificationEnabled()).thenReturn(true);
-        when(mEnhancedEstimates.getLowWarningThreshold()).thenReturn(PowerUI.THREE_HOURS_IN_MILLIS);
-        when(mEnhancedEstimates.getSevereWarningThreshold()).thenReturn(ONE_HOUR_MILLIS);
-        when(mEnhancedEstimates.getEstimate())
-                .thenReturn(new Estimate(BELOW_SEVERE_HYBRID_THRESHOLD, true));
-        mPowerUI.mBatteryStatus = BatteryManager.BATTERY_HEALTH_GOOD;
-
-        // reduce battery level to handle time based trigger -> level trigger interactions
-        mPowerUI.mBatteryLevel = 5;
-        boolean shouldShow =
-                mPowerUI.shouldShowLowBatteryWarning(UNPLUGGED, UNPLUGGED, ABOVE_WARNING_BUCKET,
-                        ABOVE_WARNING_BUCKET, BELOW_SEVERE_HYBRID_THRESHOLD,
-                        POWER_SAVER_OFF, BatteryManager.BATTERY_HEALTH_GOOD);
-        assertTrue(shouldShow);
-
-        // actually run the end to end since it handles changing the internal state.
-        mPowerUI.maybeShowBatteryWarning(OLD_BATTERY_LEVEL_10, UNPLUGGED, UNPLUGGED,
-                ABOVE_WARNING_BUCKET, ABOVE_WARNING_BUCKET);
-
-        shouldShow =
-                mPowerUI.shouldShowLowBatteryWarning(UNPLUGGED, UNPLUGGED, ABOVE_WARNING_BUCKET,
-                        ABOVE_WARNING_BUCKET, VERY_BELOW_SEVERE_HYBRID_THRESHOLD,
-                        POWER_SAVER_OFF, BatteryManager.BATTERY_HEALTH_GOOD);
-        assertFalse(shouldShow);
-    }
-
-    @Test
-    public void testMaybeShowBatteryWarning_onlyQueriesEstimateOnBatteryLevelChangeOrNull() {
+    public void testRefreshEstimateIfNeeded_onlyQueriesEstimateOnBatteryLevelChangeOrNull() {
         mPowerUI.start();
         Estimate estimate = new Estimate(BELOW_HYBRID_THRESHOLD, true);
         when(mEnhancedEstimates.isHybridNotificationEnabled()).thenReturn(true);
         when(mEnhancedEstimates.getLowWarningThreshold()).thenReturn(PowerUI.THREE_HOURS_IN_MILLIS);
         when(mEnhancedEstimates.getSevereWarningThreshold()).thenReturn(ONE_HOUR_MILLIS);
         when(mEnhancedEstimates.getEstimate()).thenReturn(estimate);
-        mPowerUI.mBatteryStatus = BatteryManager.BATTERY_HEALTH_GOOD;
+        mPowerUI.mBatteryLevel = 10;
 
-        // we expect that the first time it will query even if the level is the same
+        // we expect that the first time it will query since there is no last battery snapshot.
+        // However an invalid estimate (-1) is returned.
+        Estimate refreshedEstimate = mPowerUI.refreshEstimateIfNeeded();
+        assertThat(refreshedEstimate.getEstimateMillis()).isEqualTo(BELOW_HYBRID_THRESHOLD);
+        BatteryStateSnapshot snapshot = new BatteryStateSnapshot(
+                BATTERY_LEVEL_10, false, false, 0, BatteryManager.BATTERY_HEALTH_GOOD,
+                0, 0, -1, 0, 0, false);
+        mPowerUI.mLastBatteryStateSnapshot = snapshot;
+
+        // query again since the estimate was -1
+        estimate = new Estimate(BELOW_SEVERE_HYBRID_THRESHOLD, true);
+        when(mEnhancedEstimates.getEstimate()).thenReturn(estimate);
+        refreshedEstimate = mPowerUI.refreshEstimateIfNeeded();
+        assertThat(refreshedEstimate.getEstimateMillis()).isEqualTo(BELOW_SEVERE_HYBRID_THRESHOLD);
+        snapshot = new BatteryStateSnapshot(
+                BATTERY_LEVEL_10, false, false, 0, BatteryManager.BATTERY_HEALTH_GOOD, 0,
+                0, BELOW_SEVERE_HYBRID_THRESHOLD, 0, 0, false);
+        mPowerUI.mLastBatteryStateSnapshot = snapshot;
+
+        // Battery level hasn't changed, so we don't query again
+        estimate = new Estimate(BELOW_HYBRID_THRESHOLD, true);
+        when(mEnhancedEstimates.getEstimate()).thenReturn(estimate);
+        refreshedEstimate = mPowerUI.refreshEstimateIfNeeded();
+        assertThat(refreshedEstimate.getEstimateMillis()).isEqualTo(BELOW_SEVERE_HYBRID_THRESHOLD);
+
+        // Battery level changes so we update again
         mPowerUI.mBatteryLevel = 9;
-        mPowerUI.maybeShowBatteryWarning(OLD_BATTERY_LEVEL_NINE, UNPLUGGED, UNPLUGGED,
-                ABOVE_WARNING_BUCKET, ABOVE_WARNING_BUCKET);
-        verify(mEnhancedEstimates, times(1)).getEstimate();
+        refreshedEstimate = mPowerUI.refreshEstimateIfNeeded();
+        assertThat(refreshedEstimate.getEstimateMillis()).isEqualTo(BELOW_HYBRID_THRESHOLD);
+    }
 
-        // We should NOT query again if the battery level hasn't changed
-        mPowerUI.maybeShowBatteryWarning(OLD_BATTERY_LEVEL_NINE, UNPLUGGED, UNPLUGGED,
-                ABOVE_WARNING_BUCKET, ABOVE_WARNING_BUCKET);
-        verify(mEnhancedEstimates, times(1)).getEstimate();
+    @Test
+    public void testShouldShowStandardWarning() {
+        mPowerUI.start();
+        BatteryStateSnapshotWrapper state = new BatteryStateSnapshotWrapper();
+        state.mIsHybrid = false;
+        BatteryStateSnapshot lastState = state.get();
 
-        // Battery level has changed, so we should query again
-        mPowerUI.maybeShowBatteryWarning(OLD_BATTERY_LEVEL_10, UNPLUGGED, UNPLUGGED,
-                ABOVE_WARNING_BUCKET, ABOVE_WARNING_BUCKET);
-        verify(mEnhancedEstimates, times(2)).getEstimate();
+        // sanity check to make sure we can show for a valid config
+        state.mBatteryLevel = 10;
+        state.mBucket = -1;
+        boolean shouldShow = mPowerUI.shouldShowLowBatteryWarning(state.get(), lastState);
+        assertThat(shouldShow).isTrue();
+        lastState = state.get();
+
+        // Shouldn't show if plugged in
+        state.mPlugged = true;
+        shouldShow = mPowerUI.shouldShowLowBatteryWarning(state.get(), lastState);
+        assertThat(shouldShow).isFalse();
+
+        state.mPlugged = false;
+        // Shouldn't show if battery saver
+        state.mIsPowerSaver = true;
+        shouldShow = mPowerUI.shouldShowLowBatteryWarning(state.get(), lastState);
+        assertThat(shouldShow).isFalse();
+
+        state.mIsPowerSaver = false;
+        // Shouldn't show if battery is unknown
+        state.mPlugged = false;
+        state.mBatteryStatus = BatteryManager.BATTERY_STATUS_UNKNOWN;
+        shouldShow = mPowerUI.shouldShowLowBatteryWarning(state.get(), lastState);
+        assertThat(shouldShow).isFalse();
+
+        state.mBatteryStatus = BatteryManager.BATTERY_HEALTH_GOOD;
+        // show if plugged -> unplugged, bucket -1 -> -1
+        state.mPlugged = true;
+        state.mBucket = -1;
+        lastState = state.get();
+        state.mPlugged = false;
+        state.mBucket = -1;
+        shouldShow = mPowerUI.shouldShowLowBatteryWarning(state.get(), lastState);
+        assertThat(shouldShow).isTrue();
+
+        // don't show if plugged -> unplugged, bucket 0 -> 0
+        state.mPlugged = true;
+        state.mBucket = 0;
+        lastState = state.get();
+        state.mPlugged = false;
+        state.mBucket = 0;
+        shouldShow = mPowerUI.shouldShowLowBatteryWarning(state.get(), lastState);
+        assertThat(shouldShow).isFalse();
+
+        // show if unplugged -> unplugged, bucket 0 -> -1
+        state.mPlugged = false;
+        state.mBucket = 0;
+        lastState = state.get();
+        state.mPlugged = false;
+        state.mBucket = -1;
+        shouldShow = mPowerUI.shouldShowLowBatteryWarning(state.get(), lastState);
+        assertThat(shouldShow).isTrue();
+
+        // don't show if unplugged -> unplugged, bucket -1 -> 1
+        state.mPlugged = false;
+        state.mBucket = -1;
+        lastState = state.get();
+        state.mPlugged = false;
+        state.mBucket = 1;
+        shouldShow = mPowerUI.shouldShowLowBatteryWarning(state.get(), lastState);
+        assertThat(shouldShow).isFalse();
+    }
+
+    @Test
+    public void testShouldDismissStandardWarning() {
+        mPowerUI.start();
+        BatteryStateSnapshotWrapper state = new BatteryStateSnapshotWrapper();
+        state.mIsHybrid = false;
+        BatteryStateSnapshot lastState = state.get();
+
+        // should dismiss if battery saver
+        state.mIsPowerSaver = true;
+        boolean shouldDismiss = mPowerUI.shouldDismissLowBatteryWarning(state.get(), lastState);
+        assertThat(shouldDismiss).isTrue();
+
+        state.mIsPowerSaver = false;
+        // should dismiss if plugged
+        state.mPlugged = true;
+        shouldDismiss = mPowerUI.shouldDismissLowBatteryWarning(state.get(), lastState);
+        assertThat(shouldDismiss).isTrue();
+
+        state.mPlugged = false;
+        // should dismiss if bucket 0 -> 1
+        state.mBucket = 0;
+        lastState = state.get();
+        state.mBucket = 1;
+        shouldDismiss = mPowerUI.shouldDismissLowBatteryWarning(state.get(), lastState);
+        assertThat(shouldDismiss).isTrue();
+
+        // shouldn't dismiss if bucket -1 -> 0
+        state.mBucket = -1;
+        lastState = state.get();
+        state.mBucket = 0;
+        shouldDismiss = mPowerUI.shouldDismissLowBatteryWarning(state.get(), lastState);
+        assertThat(shouldDismiss).isFalse();
+
+        // should dismiss if powersaver & bucket 0 -> 1
+        state.mIsPowerSaver = true;
+        state.mBucket = 0;
+        lastState = state.get();
+        state.mBucket = 1;
+        shouldDismiss = mPowerUI.shouldDismissLowBatteryWarning(state.get(), lastState);
+        assertThat(shouldDismiss).isTrue();
     }
 
     private Temperature getEmergencyStatusTemp(int type, String name) {
@@ -556,4 +518,35 @@
         mPowerUI.mComponents = mContext.getComponents();
         mPowerUI.mThermalService = mThermalServiceMock;
     }
+
+    /**
+     * A simple wrapper class that sets values by default and makes them not final to improve
+     * test clarity.
+     */
+    private class BatteryStateSnapshotWrapper {
+        public int mBatteryLevel = 100;
+        public boolean mIsPowerSaver = false;
+        public boolean mPlugged = false;
+        public long mSevereThresholdMillis = Duration.ofHours(1).toMillis();
+        public long mLowThresholdMillis = Duration.ofHours(3).toMillis();
+        public int mSevereLevelThreshold = 5;
+        public int mLowLevelThreshold = 15;
+        public int mBucket = 1;
+        public int mBatteryStatus = BatteryManager.BATTERY_HEALTH_GOOD;
+        public long mTimeRemainingMillis = Duration.ofHours(24).toMillis();
+        public boolean mIsBasedOnUsage = true;
+        public boolean mIsHybrid = true;
+
+        public BatteryStateSnapshot get() {
+            if (mIsHybrid) {
+                return new BatteryStateSnapshot(mBatteryLevel, mIsPowerSaver, mPlugged, mBucket,
+                        mBatteryStatus, mSevereLevelThreshold, mLowLevelThreshold,
+                        mTimeRemainingMillis, mSevereThresholdMillis, mLowThresholdMillis,
+                        mIsBasedOnUsage);
+            } else {
+                return new BatteryStateSnapshot(mBatteryLevel, mIsPowerSaver, mPlugged, mBucket,
+                        mBatteryStatus, mSevereLevelThreshold, mLowLevelThreshold);
+            }
+        }
+    }
 }
diff --git a/packages/SystemUI/tests/src/com/android/systemui/privacy/PrivacyDialogBuilderTest.kt b/packages/SystemUI/tests/src/com/android/systemui/privacy/PrivacyDialogBuilderTest.kt
index b6e0d90..6302f9d 100644
--- a/packages/SystemUI/tests/src/com/android/systemui/privacy/PrivacyDialogBuilderTest.kt
+++ b/packages/SystemUI/tests/src/com/android/systemui/privacy/PrivacyDialogBuilderTest.kt
@@ -16,8 +16,8 @@
 
 package com.android.systemui.privacy
 
-import android.support.test.filters.SmallTest
-import android.support.test.runner.AndroidJUnit4
+import androidx.test.filters.SmallTest
+import androidx.test.runner.AndroidJUnit4
 import com.android.systemui.SysuiTestCase
 import org.junit.Assert.assertEquals
 import org.junit.Test
diff --git a/packages/SystemUI/tests/src/com/android/systemui/privacy/PrivacyItemControllerTest.kt b/packages/SystemUI/tests/src/com/android/systemui/privacy/PrivacyItemControllerTest.kt
index bb384dd..6033ed2 100644
--- a/packages/SystemUI/tests/src/com/android/systemui/privacy/PrivacyItemControllerTest.kt
+++ b/packages/SystemUI/tests/src/com/android/systemui/privacy/PrivacyItemControllerTest.kt
@@ -24,7 +24,7 @@
 import android.os.Handler
 import android.os.UserHandle
 import android.os.UserManager
-import android.support.test.filters.SmallTest
+import androidx.test.filters.SmallTest
 import android.testing.AndroidTestingRunner
 import android.testing.TestableLooper
 import android.testing.TestableLooper.RunWithLooper
@@ -264,7 +264,8 @@
         val list = listOf(PrivacyItem(PrivacyType.TYPE_CAMERA,
                 PrivacyApplication("", TEST_UID, mContext)))
         privacyItemController.privacyList = list
-        assertEquals(list, privacyItemController.privacyList)
-        assertTrue(list !== privacyItemController.privacyList)
+        val privacyList = privacyItemController.privacyList
+        assertEquals(list, privacyList)
+        assertTrue(list !== privacyList)
     }
 }
\ No newline at end of file
diff --git a/packages/SystemUI/tests/src/com/android/systemui/qs/AutoAddTrackerTest.java b/packages/SystemUI/tests/src/com/android/systemui/qs/AutoAddTrackerTest.java
index dfc1852..0ae9461 100644
--- a/packages/SystemUI/tests/src/com/android/systemui/qs/AutoAddTrackerTest.java
+++ b/packages/SystemUI/tests/src/com/android/systemui/qs/AutoAddTrackerTest.java
@@ -22,10 +22,11 @@
 import static org.junit.Assert.assertTrue;
 
 import android.provider.Settings.Secure;
-import android.support.test.filters.SmallTest;
 import android.testing.AndroidTestingRunner;
 import android.testing.TestableLooper.RunWithLooper;
 
+import androidx.test.filters.SmallTest;
+
 import com.android.systemui.Prefs;
 import com.android.systemui.Prefs.Key;
 import com.android.systemui.SysuiTestCase;
diff --git a/packages/SystemUI/tests/src/com/android/systemui/qs/QSCarrierGroupTest.java b/packages/SystemUI/tests/src/com/android/systemui/qs/QSCarrierGroupTest.java
new file mode 100644
index 0000000..f29392b
--- /dev/null
+++ b/packages/SystemUI/tests/src/com/android/systemui/qs/QSCarrierGroupTest.java
@@ -0,0 +1,177 @@
+/*
+ * Copyright (C) 2019 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 com.android.systemui.qs;
+
+import static org.mockito.ArgumentMatchers.anyInt;
+import static org.mockito.Mockito.mock;
+import static org.mockito.Mockito.when;
+
+import android.telephony.SubscriptionManager;
+import android.testing.AndroidTestingRunner;
+import android.testing.TestableLooper;
+import android.view.LayoutInflater;
+
+import androidx.test.filters.SmallTest;
+
+import com.android.keyguard.CarrierTextController;
+import com.android.systemui.R;
+import com.android.systemui.statusbar.policy.NetworkController;
+import com.android.systemui.utils.leaks.LeakCheckedTest;
+
+import org.junit.Before;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+import org.mockito.Mockito;
+import org.mockito.invocation.InvocationOnMock;
+import org.mockito.stubbing.Answer;
+
+@RunWith(AndroidTestingRunner.class)
+@TestableLooper.RunWithLooper
+@SmallTest
+public class QSCarrierGroupTest extends LeakCheckedTest {
+
+    private QSCarrierGroup mCarrierGroup;
+
+    @Before
+    public void setup() throws Exception {
+        injectLeakCheckedDependencies(ALL_SUPPORTED_CLASSES);
+        TestableLooper.get(this).runWithLooper(
+                () -> mCarrierGroup = (QSCarrierGroup) LayoutInflater.from(mContext).inflate(
+                        R.layout.qs_carrier_group, null));
+    }
+
+    @Test // throws no Exception
+    public void testUpdateCarrierText_sameLengths() {
+        QSCarrierGroup spiedCarrierGroup = Mockito.spy(mCarrierGroup);
+        when(spiedCarrierGroup.getSlotIndex(anyInt())).thenAnswer(
+                new Answer<Integer>() {
+                    @Override
+                    public Integer answer(InvocationOnMock invocationOnMock) throws Throwable {
+                        return invocationOnMock.getArgument(0);
+                    }
+                });
+
+        // listOfCarriers length 1, subscriptionIds length 1, anySims false
+        CarrierTextController.CarrierTextCallbackInfo
+                c1 = new CarrierTextController.CarrierTextCallbackInfo(
+                "",
+                new CharSequence[]{""},
+                false,
+                new int[]{0});
+        spiedCarrierGroup.updateCarrierInfo(c1);
+
+        // listOfCarriers length 1, subscriptionIds length 1, anySims true
+        CarrierTextController.CarrierTextCallbackInfo
+                c2 = new CarrierTextController.CarrierTextCallbackInfo(
+                "",
+                new CharSequence[]{""},
+                true,
+                new int[]{0});
+        spiedCarrierGroup.updateCarrierInfo(c2);
+
+        // listOfCarriers length 2, subscriptionIds length 2, anySims false
+        CarrierTextController.CarrierTextCallbackInfo
+                c3 = new CarrierTextController.CarrierTextCallbackInfo(
+                "",
+                new CharSequence[]{"", ""},
+                false,
+                new int[]{0, 1});
+        spiedCarrierGroup.updateCarrierInfo(c3);
+
+        // listOfCarriers length 2, subscriptionIds length 2, anySims true
+        CarrierTextController.CarrierTextCallbackInfo
+                c4 = new CarrierTextController.CarrierTextCallbackInfo(
+                "",
+                new CharSequence[]{"", ""},
+                true,
+                new int[]{0, 1});
+        spiedCarrierGroup.updateCarrierInfo(c4);
+    }
+
+    @Test // throws no Exception
+    public void testUpdateCarrierText_differentLength() {
+        QSCarrierGroup spiedCarrierGroup = Mockito.spy(mCarrierGroup);
+        when(spiedCarrierGroup.getSlotIndex(anyInt())).thenAnswer(
+                new Answer<Integer>() {
+                    @Override
+                    public Integer answer(InvocationOnMock invocationOnMock) throws Throwable {
+                        return invocationOnMock.getArgument(0);
+                    }
+                });
+
+        // listOfCarriers length 2, subscriptionIds length 1, anySims false
+        CarrierTextController.CarrierTextCallbackInfo
+                c1 = new CarrierTextController.CarrierTextCallbackInfo(
+                "",
+                new CharSequence[]{"", ""},
+                false,
+                new int[]{0});
+        spiedCarrierGroup.updateCarrierInfo(c1);
+
+        // listOfCarriers length 2, subscriptionIds length 1, anySims true
+        CarrierTextController.CarrierTextCallbackInfo
+                c2 = new CarrierTextController.CarrierTextCallbackInfo(
+                "",
+                new CharSequence[]{"", ""},
+                true,
+                new int[]{0});
+        spiedCarrierGroup.updateCarrierInfo(c2);
+
+        // listOfCarriers length 1, subscriptionIds length 2, anySims false
+        CarrierTextController.CarrierTextCallbackInfo
+                c3 = new CarrierTextController.CarrierTextCallbackInfo(
+                "",
+                new CharSequence[]{""},
+                false,
+                new int[]{0, 1});
+        spiedCarrierGroup.updateCarrierInfo(c3);
+
+        // listOfCarriers length 1, subscriptionIds length 2, anySims true
+        CarrierTextController.CarrierTextCallbackInfo
+                c4 = new CarrierTextController.CarrierTextCallbackInfo(
+                "",
+                new CharSequence[]{""},
+                true,
+                new int[]{0, 1});
+        spiedCarrierGroup.updateCarrierInfo(c4);
+    }
+
+    @Test // throws no Exception
+    public void testUpdateCarrierText_invalidSim() {
+        QSCarrierGroup spiedCarrierGroup = Mockito.spy(mCarrierGroup);
+        when(spiedCarrierGroup.getSlotIndex(anyInt())).thenReturn(
+                SubscriptionManager.INVALID_SIM_SLOT_INDEX);
+        CarrierTextController.CarrierTextCallbackInfo
+                c4 = new CarrierTextController.CarrierTextCallbackInfo(
+                "",
+                new CharSequence[]{"", ""},
+                true,
+                new int[]{0, 1});
+        spiedCarrierGroup.updateCarrierInfo(c4);
+    }
+
+    @Test // throws no Exception
+    public void testSetMobileDataIndicators_invalidSim() {
+        QSCarrierGroup spiedCarrierGroup = Mockito.spy(mCarrierGroup);
+        when(spiedCarrierGroup.getSlotIndex(anyInt())).thenReturn(
+                SubscriptionManager.INVALID_SIM_SLOT_INDEX);
+        spiedCarrierGroup.setMobileDataIndicators(
+                mock(NetworkController.IconState.class),
+                mock(NetworkController.IconState.class),
+                0, 0, true, true, "", "", true, 0, true);
+    }
+}
diff --git a/packages/SystemUI/tests/src/com/android/systemui/qs/QSDetailTest.java b/packages/SystemUI/tests/src/com/android/systemui/qs/QSDetailTest.java
index f845f3a..8879e83 100644
--- a/packages/SystemUI/tests/src/com/android/systemui/qs/QSDetailTest.java
+++ b/packages/SystemUI/tests/src/com/android/systemui/qs/QSDetailTest.java
@@ -23,7 +23,6 @@
 import static org.mockito.Mockito.verify;
 import static org.mockito.Mockito.when;
 
-import android.support.test.filters.SmallTest;
 import android.testing.AndroidTestingRunner;
 import android.testing.TestableLooper;
 import android.testing.TestableLooper.RunWithLooper;
@@ -31,6 +30,8 @@
 import android.view.LayoutInflater;
 import android.view.View;
 
+import androidx.test.filters.SmallTest;
+
 import com.android.internal.logging.MetricsLogger;
 import com.android.systemui.R;
 import com.android.systemui.SysuiTestCase;
diff --git a/packages/SystemUI/tests/src/com/android/systemui/qs/QSFooterImplTest.java b/packages/SystemUI/tests/src/com/android/systemui/qs/QSFooterImplTest.java
index 374a73c..d4688d7 100644
--- a/packages/SystemUI/tests/src/com/android/systemui/qs/QSFooterImplTest.java
+++ b/packages/SystemUI/tests/src/com/android/systemui/qs/QSFooterImplTest.java
@@ -16,35 +16,28 @@
 
 import static org.mockito.ArgumentMatchers.any;
 import static org.mockito.ArgumentMatchers.anyBoolean;
-import static org.mockito.ArgumentMatchers.anyInt;
-import static org.mockito.Mockito.mock;
 import static org.mockito.Mockito.never;
 import static org.mockito.Mockito.verify;
 import static org.mockito.Mockito.when;
 
-import android.support.test.filters.SmallTest;
-import android.telephony.SubscriptionManager;
 import android.testing.AndroidTestingRunner;
 import android.testing.TestableLooper;
 import android.testing.TestableLooper.RunWithLooper;
 import android.view.LayoutInflater;
 import android.view.View;
 
-import com.android.keyguard.CarrierTextController.CarrierTextCallbackInfo;
+import androidx.test.filters.SmallTest;
+
 import com.android.systemui.R;
 import com.android.systemui.R.id;
 import com.android.systemui.plugins.ActivityStarter;
 import com.android.systemui.statusbar.policy.DeviceProvisionedController;
-import com.android.systemui.statusbar.policy.NetworkController;
 import com.android.systemui.utils.leaks.LeakCheckedTest;
 
 import org.junit.Before;
 import org.junit.Ignore;
 import org.junit.Test;
 import org.junit.runner.RunWith;
-import org.mockito.Mockito;
-import org.mockito.invocation.InvocationOnMock;
-import org.mockito.stubbing.Answer;
 
 @RunWith(AndroidTestingRunner.class)
 @RunWithLooper
@@ -76,117 +69,4 @@
         // Verify Settings wasn't launched.
         verify(mActivityStarter, never()).startActivity(any(), anyBoolean());
     }
-
-    @Test // throws no Exception
-    public void testUpdateCarrierText_sameLengts() {
-        QSFooterImpl spiedFooter = Mockito.spy(mFooter);
-        when(spiedFooter.getSlotIndex(anyInt())).thenAnswer(
-                new Answer<Integer>() {
-                    @Override
-                    public Integer answer(InvocationOnMock invocationOnMock) throws Throwable {
-                        return invocationOnMock.getArgument(0);
-                    }
-                });
-
-        // listOfCarriers length 1, subscriptionIds length 1, anySims false
-        CarrierTextCallbackInfo c1 = new CarrierTextCallbackInfo(
-                "",
-                new CharSequence[]{""},
-                false,
-                new int[]{0});
-        spiedFooter.updateCarrierInfo(c1);
-
-        // listOfCarriers length 1, subscriptionIds length 1, anySims true
-        CarrierTextCallbackInfo c2 = new CarrierTextCallbackInfo(
-                "",
-                new CharSequence[]{""},
-                true,
-                new int[]{0});
-        spiedFooter.updateCarrierInfo(c2);
-
-        // listOfCarriers length 2, subscriptionIds length 2, anySims false
-        CarrierTextCallbackInfo c3 = new CarrierTextCallbackInfo(
-                "",
-                new CharSequence[]{"", ""},
-                false,
-                new int[]{0, 1});
-        spiedFooter.updateCarrierInfo(c3);
-
-        // listOfCarriers length 2, subscriptionIds length 2, anySims true
-        CarrierTextCallbackInfo c4 = new CarrierTextCallbackInfo(
-                "",
-                new CharSequence[]{"", ""},
-                true,
-                new int[]{0, 1});
-        spiedFooter.updateCarrierInfo(c4);
-    }
-
-    @Test // throws no Exception
-    public void testUpdateCarrierText_differentLength() {
-        QSFooterImpl spiedFooter = Mockito.spy(mFooter);
-        when(spiedFooter.getSlotIndex(anyInt())).thenAnswer(
-                new Answer<Integer>() {
-                    @Override
-                    public Integer answer(InvocationOnMock invocationOnMock) throws Throwable {
-                        return invocationOnMock.getArgument(0);
-                    }
-                });
-
-        // listOfCarriers length 2, subscriptionIds length 1, anySims false
-        CarrierTextCallbackInfo c1 = new CarrierTextCallbackInfo(
-                "",
-                new CharSequence[]{"", ""},
-                false,
-                new int[]{0});
-        spiedFooter.updateCarrierInfo(c1);
-
-        // listOfCarriers length 2, subscriptionIds length 1, anySims true
-        CarrierTextCallbackInfo c2 = new CarrierTextCallbackInfo(
-                "",
-                new CharSequence[]{"", ""},
-                true,
-                new int[]{0});
-        spiedFooter.updateCarrierInfo(c2);
-
-        // listOfCarriers length 1, subscriptionIds length 2, anySims false
-        CarrierTextCallbackInfo c3 = new CarrierTextCallbackInfo(
-                "",
-                new CharSequence[]{""},
-                false,
-                new int[]{0, 1});
-        spiedFooter.updateCarrierInfo(c3);
-
-        // listOfCarriers length 1, subscriptionIds length 2, anySims true
-        CarrierTextCallbackInfo c4 = new CarrierTextCallbackInfo(
-                "",
-                new CharSequence[]{""},
-                true,
-                new int[]{0, 1});
-        spiedFooter.updateCarrierInfo(c4);
-    }
-
-    @Test // throws no Exception
-    public void testUpdateCarrierText_invalidSim() {
-        QSFooterImpl spiedFooter = Mockito.spy(mFooter);
-        when(spiedFooter.getSlotIndex(anyInt())).thenReturn(
-                SubscriptionManager.INVALID_SIM_SLOT_INDEX);
-        CarrierTextCallbackInfo c4 = new CarrierTextCallbackInfo(
-                "",
-                new CharSequence[]{"", ""},
-                true,
-                new int[]{0, 1});
-        spiedFooter.updateCarrierInfo(c4);
-    }
-
-    @Test // throws no Exception
-    public void testSetMobileDataIndicators_invalidSim() {
-        QSFooterImpl spiedFooter = Mockito.spy(mFooter);
-        when(spiedFooter.getSlotIndex(anyInt())).thenReturn(
-                SubscriptionManager.INVALID_SIM_SLOT_INDEX);
-        spiedFooter.setMobileDataIndicators(
-                mock(NetworkController.IconState.class),
-                mock(NetworkController.IconState.class),
-                0, 0, true, true, "", "", true, 0, true);
-    }
-
 }
diff --git a/packages/SystemUI/tests/src/com/android/systemui/qs/QSFragmentTest.java b/packages/SystemUI/tests/src/com/android/systemui/qs/QSFragmentTest.java
index 823485f..10d1572 100644
--- a/packages/SystemUI/tests/src/com/android/systemui/qs/QSFragmentTest.java
+++ b/packages/SystemUI/tests/src/com/android/systemui/qs/QSFragmentTest.java
@@ -23,7 +23,6 @@
 import android.os.Bundle;
 import android.os.Handler;
 import android.os.Looper;
-import android.support.test.filters.SmallTest;
 import android.testing.AndroidTestingRunner;
 import android.testing.LayoutInflaterBuilder;
 import android.testing.TestableLooper;
@@ -31,6 +30,8 @@
 import android.view.View;
 import android.widget.FrameLayout;
 
+import androidx.test.filters.SmallTest;
+
 import com.android.internal.logging.MetricsLogger;
 import com.android.keyguard.CarrierText;
 import com.android.systemui.Dependency;
diff --git a/packages/SystemUI/tests/src/com/android/systemui/qs/QSPanelTest.java b/packages/SystemUI/tests/src/com/android/systemui/qs/QSPanelTest.java
index 12a122a..c6b31d0 100644
--- a/packages/SystemUI/tests/src/com/android/systemui/qs/QSPanelTest.java
+++ b/packages/SystemUI/tests/src/com/android/systemui/qs/QSPanelTest.java
@@ -23,13 +23,14 @@
 import static org.mockito.Mockito.verify;
 import static org.mockito.Mockito.when;
 
-import android.support.test.filters.SmallTest;
 import android.testing.AndroidTestingRunner;
 import android.testing.TestableLooper;
 import android.testing.TestableLooper.RunWithLooper;
 import android.view.ViewGroup;
 import android.widget.FrameLayout;
 
+import androidx.test.filters.SmallTest;
+
 import com.android.internal.logging.MetricsLogger;
 import com.android.internal.logging.nano.MetricsProto.MetricsEvent;
 import com.android.systemui.SysuiTestCase;
diff --git a/packages/SystemUI/tests/src/com/android/systemui/qs/QSTileHostTest.java b/packages/SystemUI/tests/src/com/android/systemui/qs/QSTileHostTest.java
index 78700b8..a458928 100644
--- a/packages/SystemUI/tests/src/com/android/systemui/qs/QSTileHostTest.java
+++ b/packages/SystemUI/tests/src/com/android/systemui/qs/QSTileHostTest.java
@@ -19,9 +19,10 @@
 
 import static junit.framework.TestCase.assertFalse;
 
-import android.support.test.filters.SmallTest;
 import android.testing.AndroidTestingRunner;
 
+import androidx.test.filters.SmallTest;
+
 import com.android.systemui.SysuiTestCase;
 
 import org.junit.Test;
diff --git a/packages/SystemUI/tests/src/com/android/systemui/qs/SlashImageViewTest.java b/packages/SystemUI/tests/src/com/android/systemui/qs/SlashImageViewTest.java
index e2159d2..ea8c64a 100644
--- a/packages/SystemUI/tests/src/com/android/systemui/qs/SlashImageViewTest.java
+++ b/packages/SystemUI/tests/src/com/android/systemui/qs/SlashImageViewTest.java
@@ -16,26 +16,25 @@
 
 package com.android.systemui.qs;
 
-import android.content.Context;
-import android.graphics.drawable.Drawable;
-import android.support.test.filters.SmallTest;
-import android.testing.AndroidTestingRunner;
-import android.testing.TestableLooper.RunWithLooper;
-import com.android.systemui.SysuiTestCase;
-import com.android.systemui.plugins.qs.QSTile.SlashState;
-import com.android.systemui.qs.tileimpl.SlashImageView;
-import org.junit.Test;
-import org.junit.runner.RunWith;
-
-import static org.junit.Assert.assertEquals;
 import static org.junit.Assert.assertTrue;
-import static org.mockito.ArgumentMatchers.anyInt;
 import static org.mockito.ArgumentMatchers.eq;
 import static org.mockito.Mockito.mock;
-import static org.mockito.Mockito.never;
 import static org.mockito.Mockito.verify;
 import static org.mockito.Mockito.when;
 
+import android.content.Context;
+import android.graphics.drawable.Drawable;
+import android.testing.AndroidTestingRunner;
+import android.testing.TestableLooper.RunWithLooper;
+
+import androidx.test.filters.SmallTest;
+
+import com.android.systemui.SysuiTestCase;
+import com.android.systemui.plugins.qs.QSTile.SlashState;
+import com.android.systemui.qs.tileimpl.SlashImageView;
+
+import org.junit.Test;
+import org.junit.runner.RunWith;
 
 @SmallTest
 @RunWith(AndroidTestingRunner.class)
diff --git a/packages/SystemUI/tests/src/com/android/systemui/qs/TileLayoutTest.java b/packages/SystemUI/tests/src/com/android/systemui/qs/TileLayoutTest.java
index 2040e75..fef47bd 100644
--- a/packages/SystemUI/tests/src/com/android/systemui/qs/TileLayoutTest.java
+++ b/packages/SystemUI/tests/src/com/android/systemui/qs/TileLayoutTest.java
@@ -27,12 +27,12 @@
 import static org.mockito.Mockito.times;
 import static org.mockito.Mockito.verify;
 
-import android.support.test.runner.AndroidJUnit4;
 import android.test.suitebuilder.annotation.SmallTest;
 
+import androidx.test.runner.AndroidJUnit4;
+
 import com.android.systemui.R;
 import com.android.systemui.SysuiTestCase;
-import com.android.systemui.plugins.qs.QSIconView;
 import com.android.systemui.plugins.qs.QSTile;
 import com.android.systemui.qs.tileimpl.QSIconViewImpl;
 import com.android.systemui.qs.tileimpl.QSTileView;
diff --git a/packages/SystemUI/tests/src/com/android/systemui/qs/TouchAnimatorTest.java b/packages/SystemUI/tests/src/com/android/systemui/qs/TouchAnimatorTest.java
index 4cc0e20..c43c3e6 100644
--- a/packages/SystemUI/tests/src/com/android/systemui/qs/TouchAnimatorTest.java
+++ b/packages/SystemUI/tests/src/com/android/systemui/qs/TouchAnimatorTest.java
@@ -14,17 +14,20 @@
 
 package com.android.systemui.qs;
 
-import android.support.test.runner.AndroidJUnit4;
+import static junit.framework.Assert.assertEquals;
+
 import android.test.suitebuilder.annotation.SmallTest;
 import android.view.View;
-import com.android.systemui.qs.TouchAnimator.Listener;
-import com.android.systemui.SysuiTestCase;
-import org.junit.Before;
-import org.junit.runner.RunWith;
-import org.junit.Test;
-import org.mockito.Mockito;
 
-import static junit.framework.Assert.assertEquals;
+import androidx.test.runner.AndroidJUnit4;
+
+import com.android.systemui.SysuiTestCase;
+import com.android.systemui.qs.TouchAnimator.Listener;
+
+import org.junit.Before;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+import org.mockito.Mockito;
 
 @SmallTest
 @RunWith(AndroidJUnit4.class)
diff --git a/packages/SystemUI/tests/src/com/android/systemui/qs/customize/TileAdapterTest.java b/packages/SystemUI/tests/src/com/android/systemui/qs/customize/TileAdapterTest.java
index 0239ab0..25bac7a 100644
--- a/packages/SystemUI/tests/src/com/android/systemui/qs/customize/TileAdapterTest.java
+++ b/packages/SystemUI/tests/src/com/android/systemui/qs/customize/TileAdapterTest.java
@@ -18,11 +18,12 @@
 import static org.mockito.Mockito.mock;
 import static org.mockito.Mockito.verify;
 
-import android.support.test.filters.SmallTest;
 import android.testing.AndroidTestingRunner;
 import android.testing.TestableLooper;
 import android.testing.TestableLooper.RunWithLooper;
 
+import androidx.test.filters.SmallTest;
+
 import com.android.systemui.SysuiTestCase;
 import com.android.systemui.qs.QSTileHost;
 
diff --git a/packages/SystemUI/tests/src/com/android/systemui/qs/customize/TileQueryHelperTest.java b/packages/SystemUI/tests/src/com/android/systemui/qs/customize/TileQueryHelperTest.java
index c3a3e63..9e226f6 100644
--- a/packages/SystemUI/tests/src/com/android/systemui/qs/customize/TileQueryHelperTest.java
+++ b/packages/SystemUI/tests/src/com/android/systemui/qs/customize/TileQueryHelperTest.java
@@ -14,12 +14,14 @@
 
 package com.android.systemui.qs.customize;
 
+import static junit.framework.Assert.assertEquals;
 import static junit.framework.Assert.assertTrue;
 
 import static org.hamcrest.Matchers.equalTo;
 import static org.hamcrest.Matchers.is;
 import static org.junit.Assert.assertFalse;
 import static org.junit.Assert.assertThat;
+import static org.mockito.ArgumentMatchers.anyInt;
 import static org.mockito.ArgumentMatchers.anyString;
 import static org.mockito.Mockito.any;
 import static org.mockito.Mockito.atLeastOnce;
@@ -29,15 +31,21 @@
 import static org.mockito.Mockito.verify;
 import static org.mockito.Mockito.when;
 
+import android.Manifest;
+import android.content.pm.ApplicationInfo;
 import android.content.pm.PackageManager;
+import android.content.pm.ResolveInfo;
+import android.content.pm.ServiceInfo;
 import android.provider.Settings;
-import android.support.test.filters.SmallTest;
+import android.service.quicksettings.Tile;
 import android.testing.AndroidTestingRunner;
 import android.testing.TestableLooper;
 import android.testing.TestableLooper.RunWithLooper;
 import android.text.TextUtils;
 import android.util.ArraySet;
 
+import androidx.test.filters.SmallTest;
+
 import com.android.systemui.Dependency;
 import com.android.systemui.R;
 import com.android.systemui.SysuiTestCase;
@@ -47,7 +55,9 @@
 import org.junit.Before;
 import org.junit.Test;
 import org.junit.runner.RunWith;
+import org.mockito.Answers;
 import org.mockito.ArgumentCaptor;
+import org.mockito.Captor;
 import org.mockito.Mock;
 import org.mockito.MockitoAnnotations;
 
@@ -67,6 +77,8 @@
     private static final String STOCK_TILES = "wifi,dnd,cell,battery";
     private static final String ALL_TILES = "wifi,dnd,nfc,cell,battery";
     private static final Set<String> FACTORY_TILES = new ArraySet<>();
+    private static final String TEST_PKG = "test_pkg";
+    private static final String TEST_CLS = "test_cls";
 
     static {
         FACTORY_TILES.addAll(Arrays.asList(
@@ -81,6 +93,8 @@
     private QSTileHost mQSTileHost;
     @Mock
     private PackageManager mPackageManager;
+    @Captor
+    private ArgumentCaptor<List<TileQueryHelper.TileInfo>> mCaptor;
 
     private QSTile.State mState;
     private TestableLooper mBGLooper;
@@ -153,8 +167,6 @@
 
     @Test
     public void testQueryTiles_correctTilesAndOrderOnlyStockTiles() {
-        ArgumentCaptor<List<TileQueryHelper.TileInfo>> captor = ArgumentCaptor.forClass(List.class);
-
         Settings.Secure.putString(mContext.getContentResolver(), Settings.Secure.QS_TILES,
                 ONLY_STOCK_TILES);
         mContext.getOrCreateTestableResources().addOverride(R.string.quick_settings_tiles_stock,
@@ -165,9 +177,9 @@
         mBGLooper.processAllMessages();
         waitForIdleSync(Dependency.get(Dependency.MAIN_HANDLER));
 
-        verify(mListener, atLeastOnce()).onTilesChanged(captor.capture());
+        verify(mListener, atLeastOnce()).onTilesChanged(mCaptor.capture());
         List<String> specs = new ArrayList<>();
-        for (TileQueryHelper.TileInfo t : captor.getValue()) {
+        for (TileQueryHelper.TileInfo t : mCaptor.getValue()) {
             specs.add(t.spec);
         }
         String tiles = TextUtils.join(",", specs);
@@ -176,8 +188,6 @@
 
     @Test
     public void testQueryTiles_correctTilesAndOrderOtherFactoryTiles() {
-        ArgumentCaptor<List<TileQueryHelper.TileInfo>> captor = ArgumentCaptor.forClass(List.class);
-
         Settings.Secure.putString(mContext.getContentResolver(), Settings.Secure.QS_TILES,
                 CURRENT_TILES);
         mContext.getOrCreateTestableResources().addOverride(R.string.quick_settings_tiles_stock,
@@ -188,9 +198,9 @@
         mBGLooper.processAllMessages();
         waitForIdleSync(Dependency.get(Dependency.MAIN_HANDLER));
 
-        verify(mListener, atLeastOnce()).onTilesChanged(captor.capture());
+        verify(mListener, atLeastOnce()).onTilesChanged(mCaptor.capture());
         List<String> specs = new ArrayList<>();
-        for (TileQueryHelper.TileInfo t : captor.getValue()) {
+        for (TileQueryHelper.TileInfo t : mCaptor.getValue()) {
             specs.add(t.spec);
         }
         String tiles = TextUtils.join(",", specs);
@@ -199,8 +209,6 @@
 
     @Test
     public void testQueryTiles_otherTileNotIncluded() {
-        ArgumentCaptor<List<TileQueryHelper.TileInfo>> captor = ArgumentCaptor.forClass(List.class);
-
         Settings.Secure.putString(mContext.getContentResolver(), Settings.Secure.QS_TILES,
                 WITH_OTHER_TILES);
         mContext.getOrCreateTestableResources().addOverride(R.string.quick_settings_tiles_stock,
@@ -211,15 +219,44 @@
         mBGLooper.processAllMessages();
         waitForIdleSync(Dependency.get(Dependency.MAIN_HANDLER));
 
-        verify(mListener, atLeastOnce()).onTilesChanged(captor.capture());
+        verify(mListener, atLeastOnce()).onTilesChanged(mCaptor.capture());
         List<String> specs = new ArrayList<>();
-        for (TileQueryHelper.TileInfo t : captor.getValue()) {
+        for (TileQueryHelper.TileInfo t : mCaptor.getValue()) {
             specs.add(t.spec);
         }
         assertFalse(specs.contains("other"));
     }
 
     @Test
+    public void testThirdPartyTilesInactive() {
+        ResolveInfo resolveInfo = new ResolveInfo();
+        ServiceInfo serviceInfo = mock(ServiceInfo.class, Answers.RETURNS_MOCKS);
+        resolveInfo.serviceInfo = serviceInfo;
+        serviceInfo.packageName = TEST_PKG;
+        serviceInfo.name = TEST_CLS;
+        serviceInfo.icon = R.drawable.android;
+        serviceInfo.permission = Manifest.permission.BIND_QUICK_SETTINGS_TILE;
+        serviceInfo.applicationInfo = mock(ApplicationInfo.class, Answers.RETURNS_MOCKS);
+        serviceInfo.applicationInfo.icon = R.drawable.android;
+        List<ResolveInfo> list = new ArrayList<>();
+        list.add(resolveInfo);
+        when(mPackageManager.queryIntentServicesAsUser(any(), anyInt(), anyInt())).thenReturn(list);
+
+        Settings.Secure.putString(mContext.getContentResolver(), Settings.Secure.QS_TILES, "");
+        mContext.getOrCreateTestableResources().addOverride(R.string.quick_settings_tiles_stock,
+                "");
+
+        mTileQueryHelper.queryTiles(mQSTileHost);
+        mBGLooper.processAllMessages();
+        waitForIdleSync(Dependency.get(Dependency.MAIN_HANDLER));
+
+        verify(mListener, atLeastOnce()).onTilesChanged(mCaptor.capture());
+        List<TileQueryHelper.TileInfo> tileInfos = mCaptor.getValue();
+        assertEquals(1, tileInfos.size());
+        assertEquals(Tile.STATE_INACTIVE, tileInfos.get(0).state.state);
+    }
+
+    @Test
     public void testQueryTiles_nullSetting() {
         Settings.Secure.putString(mContext.getContentResolver(), Settings.Secure.QS_TILES, null);
         mContext.getOrCreateTestableResources().addOverride(R.string.quick_settings_tiles_stock,
diff --git a/packages/SystemUI/tests/src/com/android/systemui/qs/external/TileColorPickerTest.java b/packages/SystemUI/tests/src/com/android/systemui/qs/external/TileColorPickerTest.java
index ba451e1..ec8552b 100644
--- a/packages/SystemUI/tests/src/com/android/systemui/qs/external/TileColorPickerTest.java
+++ b/packages/SystemUI/tests/src/com/android/systemui/qs/external/TileColorPickerTest.java
@@ -15,17 +15,20 @@
  */
 package com.android.systemui.qs.external;
 
+import static junit.framework.Assert.assertEquals;
+
 import android.content.res.ColorStateList;
 import android.service.quicksettings.Tile;
-import android.support.test.runner.AndroidJUnit4;
 import android.test.suitebuilder.annotation.SmallTest;
+
+import androidx.test.runner.AndroidJUnit4;
+
+import com.android.systemui.R;
 import com.android.systemui.SysuiTestCase;
+
 import org.junit.Before;
 import org.junit.Test;
 import org.junit.runner.RunWith;
-import com.android.systemui.R;
-
-import static junit.framework.Assert.assertEquals;
 
 @SmallTest
 @RunWith(AndroidJUnit4.class)
diff --git a/packages/SystemUI/tests/src/com/android/systemui/qs/external/TileLifecycleManagerTest.java b/packages/SystemUI/tests/src/com/android/systemui/qs/external/TileLifecycleManagerTest.java
index e5e8ae3..f35295c 100644
--- a/packages/SystemUI/tests/src/com/android/systemui/qs/external/TileLifecycleManagerTest.java
+++ b/packages/SystemUI/tests/src/com/android/systemui/qs/external/TileLifecycleManagerTest.java
@@ -40,9 +40,10 @@
 import android.service.quicksettings.IQSTileService;
 import android.service.quicksettings.Tile;
 import android.service.quicksettings.TileService;
-import android.support.test.runner.AndroidJUnit4;
 import android.test.suitebuilder.annotation.SmallTest;
 
+import androidx.test.runner.AndroidJUnit4;
+
 import com.android.systemui.SysuiTestCase;
 
 import org.junit.After;
diff --git a/packages/SystemUI/tests/src/com/android/systemui/qs/external/TileServiceManagerTest.java b/packages/SystemUI/tests/src/com/android/systemui/qs/external/TileServiceManagerTest.java
index cc743245..683e8f4 100644
--- a/packages/SystemUI/tests/src/com/android/systemui/qs/external/TileServiceManagerTest.java
+++ b/packages/SystemUI/tests/src/com/android/systemui/qs/external/TileServiceManagerTest.java
@@ -15,12 +15,19 @@
  */
 package com.android.systemui.qs.external;
 
+import static junit.framework.Assert.assertEquals;
+import static junit.framework.Assert.assertFalse;
+import static junit.framework.Assert.assertTrue;
+
 import android.content.ComponentName;
 import android.os.Handler;
 import android.os.HandlerThread;
-import android.support.test.runner.AndroidJUnit4;
 import android.test.suitebuilder.annotation.SmallTest;
+
+import androidx.test.runner.AndroidJUnit4;
+
 import com.android.systemui.SysuiTestCase;
+
 import org.junit.After;
 import org.junit.Before;
 import org.junit.Test;
@@ -28,10 +35,6 @@
 import org.mockito.ArgumentCaptor;
 import org.mockito.Mockito;
 
-import static junit.framework.Assert.assertEquals;
-import static junit.framework.Assert.assertFalse;
-import static junit.framework.Assert.assertTrue;
-
 @SmallTest
 @RunWith(AndroidJUnit4.class)
 public class TileServiceManagerTest extends SysuiTestCase {
diff --git a/packages/SystemUI/tests/src/com/android/systemui/qs/tileimpl/QSIconViewImplTest.java b/packages/SystemUI/tests/src/com/android/systemui/qs/tileimpl/QSIconViewImplTest.java
index c5e4043..8a36cfb 100644
--- a/packages/SystemUI/tests/src/com/android/systemui/qs/tileimpl/QSIconViewImplTest.java
+++ b/packages/SystemUI/tests/src/com/android/systemui/qs/tileimpl/QSIconViewImplTest.java
@@ -21,14 +21,14 @@
 import static org.mockito.Mockito.verify;
 import static org.mockito.Mockito.when;
 
-import android.content.res.ColorStateList;
 import android.graphics.drawable.Drawable;
 import android.service.quicksettings.Tile;
-import android.support.test.filters.SmallTest;
 import android.testing.AndroidTestingRunner;
 import android.testing.UiThreadTest;
 import android.widget.ImageView;
 
+import androidx.test.filters.SmallTest;
+
 import com.android.systemui.SysuiTestCase;
 import com.android.systemui.plugins.qs.QSTile.Icon;
 import com.android.systemui.plugins.qs.QSTile.State;
@@ -36,7 +36,6 @@
 import org.junit.Before;
 import org.junit.Test;
 import org.junit.runner.RunWith;
-import org.mockito.ArgumentMatcher;
 
 @RunWith(AndroidTestingRunner.class)
 @UiThreadTest
diff --git a/packages/SystemUI/tests/src/com/android/systemui/qs/tileimpl/QSTileImplTest.java b/packages/SystemUI/tests/src/com/android/systemui/qs/tileimpl/QSTileImplTest.java
index 86f6cd3..3df8a8a 100644
--- a/packages/SystemUI/tests/src/com/android/systemui/qs/tileimpl/QSTileImplTest.java
+++ b/packages/SystemUI/tests/src/com/android/systemui/qs/tileimpl/QSTileImplTest.java
@@ -34,15 +34,14 @@
 import static org.mockito.Mockito.verify;
 import static org.mockito.Mockito.when;
 
-import static java.lang.Thread.sleep;
-
 import android.content.Intent;
 import android.metrics.LogMaker;
-import android.support.test.filters.SmallTest;
 import android.testing.AndroidTestingRunner;
 import android.testing.TestableLooper;
 import android.testing.TestableLooper.RunWithLooper;
 
+import androidx.test.filters.SmallTest;
+
 import com.android.internal.logging.MetricsLogger;
 import com.android.systemui.Dependency;
 import com.android.systemui.SysuiTestCase;
@@ -61,6 +60,8 @@
 import org.mockito.Captor;
 import org.mockito.MockitoAnnotations;
 
+import static java.lang.Thread.sleep;
+
 @RunWith(AndroidTestingRunner.class)
 @RunWithLooper
 @SmallTest
diff --git a/packages/SystemUI/tests/src/com/android/systemui/qs/tiles/CastTileTest.java b/packages/SystemUI/tests/src/com/android/systemui/qs/tiles/CastTileTest.java
index efcbb76..ea8d4b2 100644
--- a/packages/SystemUI/tests/src/com/android/systemui/qs/tiles/CastTileTest.java
+++ b/packages/SystemUI/tests/src/com/android/systemui/qs/tiles/CastTileTest.java
@@ -22,11 +22,11 @@
 import static org.mockito.Mockito.when;
 
 import android.service.quicksettings.Tile;
-import android.support.test.filters.SmallTest;
 import android.testing.AndroidTestingRunner;
 import android.testing.TestableLooper;
 
 import androidx.lifecycle.LifecycleOwner;
+import androidx.test.filters.SmallTest;
 
 import com.android.systemui.Dependency;
 import com.android.systemui.SysuiTestCase;
@@ -46,7 +46,6 @@
 import java.util.HashSet;
 import java.util.Set;
 
-
 @RunWith(AndroidTestingRunner.class)
 @TestableLooper.RunWithLooper
 @SmallTest
diff --git a/packages/SystemUI/tests/src/com/android/systemui/qs/tiles/SensorPrivacyTileTest.java b/packages/SystemUI/tests/src/com/android/systemui/qs/tiles/SensorPrivacyTileTest.java
index 751a616..6386c4c 100644
--- a/packages/SystemUI/tests/src/com/android/systemui/qs/tiles/SensorPrivacyTileTest.java
+++ b/packages/SystemUI/tests/src/com/android/systemui/qs/tiles/SensorPrivacyTileTest.java
@@ -22,10 +22,11 @@
 import static org.mockito.Mockito.when;
 
 import android.hardware.SensorPrivacyManager;
-import android.support.test.filters.SmallTest;
 import android.testing.AndroidTestingRunner;
 import android.testing.TestableLooper;
 
+import androidx.test.filters.SmallTest;
+
 import com.android.systemui.Dependency;
 import com.android.systemui.SysuiTestCase;
 import com.android.systemui.plugins.ActivityStarter;
diff --git a/packages/SystemUI/tests/src/com/android/systemui/settings/CurrentUserTrackerTest.java b/packages/SystemUI/tests/src/com/android/systemui/settings/CurrentUserTrackerTest.java
index 17d7a41..4162bc1 100644
--- a/packages/SystemUI/tests/src/com/android/systemui/settings/CurrentUserTrackerTest.java
+++ b/packages/SystemUI/tests/src/com/android/systemui/settings/CurrentUserTrackerTest.java
@@ -17,7 +17,8 @@
 package com.android.systemui.settings;
 
 import android.content.Intent;
-import android.support.test.filters.SmallTest;
+
+import androidx.test.filters.SmallTest;
 
 import com.android.systemui.SysuiTestCase;
 
diff --git a/packages/SystemUI/tests/src/com/android/systemui/shared/plugins/PluginInstanceManagerTest.java b/packages/SystemUI/tests/src/com/android/systemui/shared/plugins/PluginInstanceManagerTest.java
index 3415c72..7d95563 100644
--- a/packages/SystemUI/tests/src/com/android/systemui/shared/plugins/PluginInstanceManagerTest.java
+++ b/packages/SystemUI/tests/src/com/android/systemui/shared/plugins/PluginInstanceManagerTest.java
@@ -41,10 +41,11 @@
 import android.content.pm.ServiceInfo;
 import android.os.HandlerThread;
 import android.os.UserHandle;
-import android.support.test.annotation.UiThreadTest;
-import android.support.test.runner.AndroidJUnit4;
 import android.test.suitebuilder.annotation.SmallTest;
 
+import androidx.test.annotation.UiThreadTest;
+import androidx.test.runner.AndroidJUnit4;
+
 import com.android.internal.messages.nano.SystemMessageProto.SystemMessage;
 import com.android.systemui.SysuiTestCase;
 import com.android.systemui.plugins.Plugin;
diff --git a/packages/SystemUI/tests/src/com/android/systemui/shared/plugins/VersionInfoTest.java b/packages/SystemUI/tests/src/com/android/systemui/shared/plugins/VersionInfoTest.java
index 9bad78d..218e7db 100644
--- a/packages/SystemUI/tests/src/com/android/systemui/shared/plugins/VersionInfoTest.java
+++ b/packages/SystemUI/tests/src/com/android/systemui/shared/plugins/VersionInfoTest.java
@@ -17,15 +17,15 @@
 import static org.junit.Assert.assertFalse;
 import static org.junit.Assert.assertTrue;
 
-import android.support.test.filters.SmallTest;
+import androidx.test.filters.SmallTest;
 
 import com.android.systemui.SysuiTestCase;
 import com.android.systemui.plugins.OverlayPlugin;
-import com.android.systemui.shared.plugins.VersionInfo.InvalidVersionException;
 import com.android.systemui.plugins.annotations.Requires;
-import com.android.systemui.plugins.qs.QS;
 import com.android.systemui.plugins.qs.DetailAdapter;
+import com.android.systemui.plugins.qs.QS;
 import com.android.systemui.plugins.qs.QS.HeightListener;
+import com.android.systemui.shared.plugins.VersionInfo.InvalidVersionException;
 
 import org.junit.Rule;
 import org.junit.Test;
diff --git a/packages/SystemUI/tests/src/com/android/systemui/statusbar/AlertingNotificationManagerTest.java b/packages/SystemUI/tests/src/com/android/systemui/statusbar/AlertingNotificationManagerTest.java
index 7b1253a..5c1f473 100644
--- a/packages/SystemUI/tests/src/com/android/systemui/statusbar/AlertingNotificationManagerTest.java
+++ b/packages/SystemUI/tests/src/com/android/systemui/statusbar/AlertingNotificationManagerTest.java
@@ -32,16 +32,16 @@
 import android.os.Looper;
 import android.os.UserHandle;
 import android.service.notification.StatusBarNotification;
-import android.support.test.filters.SmallTest;
 import android.testing.AndroidTestingRunner;
 import android.testing.TestableLooper;
 
+import androidx.test.filters.SmallTest;
+
 import com.android.systemui.R;
 import com.android.systemui.SysuiTestCase;
 import com.android.systemui.statusbar.notification.collection.NotificationEntry;
 import com.android.systemui.statusbar.notification.row.ExpandableNotificationRow;
 
-
 import org.junit.Before;
 import org.junit.Rule;
 import org.junit.Test;
diff --git a/packages/SystemUI/tests/src/com/android/systemui/statusbar/AmbientPulseManagerTest.java b/packages/SystemUI/tests/src/com/android/systemui/statusbar/AmbientPulseManagerTest.java
index f0344e6..0b25a7c 100644
--- a/packages/SystemUI/tests/src/com/android/systemui/statusbar/AmbientPulseManagerTest.java
+++ b/packages/SystemUI/tests/src/com/android/systemui/statusbar/AmbientPulseManagerTest.java
@@ -19,10 +19,11 @@
 import static junit.framework.Assert.assertFalse;
 import static junit.framework.Assert.assertTrue;
 
-import android.support.test.filters.SmallTest;
 import android.testing.AndroidTestingRunner;
 import android.testing.TestableLooper;
 
+import androidx.test.filters.SmallTest;
+
 import org.junit.Before;
 import org.junit.Rule;
 import org.junit.Test;
diff --git a/packages/SystemUI/tests/src/com/android/systemui/statusbar/CommandQueueTest.java b/packages/SystemUI/tests/src/com/android/systemui/statusbar/CommandQueueTest.java
index 51d94f0..dd26368 100644
--- a/packages/SystemUI/tests/src/com/android/systemui/statusbar/CommandQueueTest.java
+++ b/packages/SystemUI/tests/src/com/android/systemui/statusbar/CommandQueueTest.java
@@ -25,7 +25,8 @@
 import android.content.ComponentName;
 import android.graphics.Rect;
 import android.os.Bundle;
-import android.support.test.filters.SmallTest;
+
+import androidx.test.filters.SmallTest;
 
 import com.android.internal.statusbar.StatusBarIcon;
 import com.android.systemui.SysuiTestCase;
diff --git a/packages/SystemUI/tests/src/com/android/systemui/statusbar/KeyguardIndicationControllerTest.java b/packages/SystemUI/tests/src/com/android/systemui/statusbar/KeyguardIndicationControllerTest.java
index aae6d93..18ffbb5 100644
--- a/packages/SystemUI/tests/src/com/android/systemui/statusbar/KeyguardIndicationControllerTest.java
+++ b/packages/SystemUI/tests/src/com/android/systemui/statusbar/KeyguardIndicationControllerTest.java
@@ -33,12 +33,13 @@
 import android.graphics.Color;
 import android.hardware.fingerprint.FingerprintManager;
 import android.os.Looper;
-import android.support.test.InstrumentationRegistry;
-import android.support.test.filters.SmallTest;
-import android.support.test.runner.AndroidJUnit4;
 import android.view.View;
 import android.view.ViewGroup;
 
+import androidx.test.InstrumentationRegistry;
+import androidx.test.filters.SmallTest;
+import androidx.test.runner.AndroidJUnit4;
+
 import com.android.keyguard.KeyguardUpdateMonitorCallback;
 import com.android.systemui.R;
 import com.android.systemui.SysuiTestCase;
diff --git a/packages/SystemUI/tests/src/com/android/systemui/statusbar/NonPhoneDependencyTest.java b/packages/SystemUI/tests/src/com/android/systemui/statusbar/NonPhoneDependencyTest.java
index 8e926848..42f476b 100644
--- a/packages/SystemUI/tests/src/com/android/systemui/statusbar/NonPhoneDependencyTest.java
+++ b/packages/SystemUI/tests/src/com/android/systemui/statusbar/NonPhoneDependencyTest.java
@@ -19,10 +19,11 @@
 import static org.junit.Assert.assertFalse;
 
 import android.os.Handler;
-import android.support.test.filters.SmallTest;
 import android.testing.AndroidTestingRunner;
 import android.testing.TestableLooper;
 
+import androidx.test.filters.SmallTest;
+
 import com.android.systemui.Dependency;
 import com.android.systemui.InitController;
 import com.android.systemui.SysuiTestCase;
diff --git a/packages/SystemUI/tests/src/com/android/systemui/statusbar/NotificationListenerTest.java b/packages/SystemUI/tests/src/com/android/systemui/statusbar/NotificationListenerTest.java
index cffa9c7..2a01356 100644
--- a/packages/SystemUI/tests/src/com/android/systemui/statusbar/NotificationListenerTest.java
+++ b/packages/SystemUI/tests/src/com/android/systemui/statusbar/NotificationListenerTest.java
@@ -27,10 +27,11 @@
 import android.os.UserHandle;
 import android.service.notification.NotificationListenerService;
 import android.service.notification.StatusBarNotification;
-import android.support.test.filters.SmallTest;
 import android.testing.AndroidTestingRunner;
 import android.testing.TestableLooper;
 
+import androidx.test.filters.SmallTest;
+
 import com.android.systemui.Dependency;
 import com.android.systemui.SysuiTestCase;
 import com.android.systemui.statusbar.notification.NotificationEntryManager;
diff --git a/packages/SystemUI/tests/src/com/android/systemui/statusbar/NotificationLockscreenUserManagerTest.java b/packages/SystemUI/tests/src/com/android/systemui/statusbar/NotificationLockscreenUserManagerTest.java
index d7ca5b4..490b2ea 100644
--- a/packages/SystemUI/tests/src/com/android/systemui/statusbar/NotificationLockscreenUserManagerTest.java
+++ b/packages/SystemUI/tests/src/com/android/systemui/statusbar/NotificationLockscreenUserManagerTest.java
@@ -35,10 +35,11 @@
 import android.os.Looper;
 import android.os.UserManager;
 import android.provider.Settings;
-import android.support.test.filters.SmallTest;
 import android.testing.AndroidTestingRunner;
 import android.testing.TestableLooper;
 
+import androidx.test.filters.SmallTest;
+
 import com.android.systemui.Dependency;
 import com.android.systemui.SysuiTestCase;
 import com.android.systemui.statusbar.notification.NotificationEntryManager;
diff --git a/packages/SystemUI/tests/src/com/android/systemui/statusbar/NotificationRemoteInputManagerTest.java b/packages/SystemUI/tests/src/com/android/systemui/statusbar/NotificationRemoteInputManagerTest.java
index c159516..b81e048 100644
--- a/packages/SystemUI/tests/src/com/android/systemui/statusbar/NotificationRemoteInputManagerTest.java
+++ b/packages/SystemUI/tests/src/com/android/systemui/statusbar/NotificationRemoteInputManagerTest.java
@@ -16,10 +16,11 @@
 import android.os.UserHandle;
 import android.service.notification.NotificationListenerService;
 import android.service.notification.StatusBarNotification;
-import android.support.test.filters.SmallTest;
 import android.testing.AndroidTestingRunner;
 import android.testing.TestableLooper;
 
+import androidx.test.filters.SmallTest;
+
 import com.android.systemui.SysuiTestCase;
 import com.android.systemui.statusbar.NotificationRemoteInputManager.RemoteInputActiveExtender;
 import com.android.systemui.statusbar.NotificationRemoteInputManager.RemoteInputHistoryExtender;
diff --git a/packages/SystemUI/tests/src/com/android/systemui/statusbar/NotificationTestHelper.java b/packages/SystemUI/tests/src/com/android/systemui/statusbar/NotificationTestHelper.java
index 3c919a1..de15505 100644
--- a/packages/SystemUI/tests/src/com/android/systemui/statusbar/NotificationTestHelper.java
+++ b/packages/SystemUI/tests/src/com/android/systemui/statusbar/NotificationTestHelper.java
@@ -23,6 +23,7 @@
 import android.app.ActivityManager;
 import android.app.Instrumentation;
 import android.app.Notification;
+import android.app.Notification.BubbleMetadata;
 import android.app.NotificationChannel;
 import android.app.PendingIntent;
 import android.content.Context;
@@ -30,11 +31,12 @@
 import android.graphics.drawable.Icon;
 import android.os.UserHandle;
 import android.service.notification.StatusBarNotification;
-import android.support.test.InstrumentationRegistry;
 import android.text.TextUtils;
 import android.view.LayoutInflater;
 import android.widget.RemoteViews;
 
+import androidx.test.InstrumentationRegistry;
+
 import com.android.systemui.R;
 import com.android.systemui.bubbles.BubblesTestActivity;
 import com.android.systemui.statusbar.notification.collection.NotificationEntry;
@@ -151,8 +153,18 @@
      * Returns an {@link ExpandableNotificationRow} that should be shown as a bubble.
      */
     public ExpandableNotificationRow createBubble() throws Exception {
+        return createBubble(null);
+    }
+
+    /**
+     * Returns an {@link ExpandableNotificationRow} that should be shown as a bubble.
+     *
+     * @param deleteIntent the intent to assign to {@link BubbleMetadata#deleteIntent}
+     */
+    public ExpandableNotificationRow createBubble(@Nullable PendingIntent deleteIntent)
+            throws Exception {
         Notification n = createNotification(false /* isGroupSummary */,
-                null /* groupKey */, true /* isBubble */);
+                null /* groupKey */, true /* isBubble */, deleteIntent);
         return generateRow(n, PKG, UID, USER_HANDLE, 0 /* extraInflationFlags */, IMPORTANCE_HIGH);
     }
 
@@ -195,7 +207,8 @@
      * @return a notification that is in the group specified or standalone if unspecified
      */
     private Notification createNotification(boolean isGroupSummary, @Nullable String groupKey) {
-        return createNotification(isGroupSummary, groupKey, false /* isBubble */);
+        return createNotification(isGroupSummary, groupKey, false /* isBubble */,
+                null /* bubbleDeleteIntent */);
     }
 
     /**
@@ -207,7 +220,8 @@
      * @return a notification that is in the group specified or standalone if unspecified
      */
     private Notification createNotification(boolean isGroupSummary,
-            @Nullable String groupKey, boolean isBubble) {
+            @Nullable String groupKey, boolean isBubble,
+            @Nullable PendingIntent bubbleDeleteIntent) {
         Notification publicVersion = new Notification.Builder(mContext).setSmallIcon(
                 R.drawable.ic_person)
                 .setCustomContentView(new RemoteViews(mContext.getPackageName(),
@@ -226,7 +240,8 @@
             notificationBuilder.setGroup(groupKey);
         }
         if (isBubble) {
-            notificationBuilder.setBubbleMetadata(makeBubbleMetadata());
+            BubbleMetadata metadata = makeBubbleMetadata(bubbleDeleteIntent);
+            notificationBuilder.setBubbleMetadata(metadata);
         }
         return notificationBuilder.build();
     }
@@ -290,11 +305,13 @@
         return row;
     }
 
-    private Notification.BubbleMetadata makeBubbleMetadata() {
+    private BubbleMetadata makeBubbleMetadata(PendingIntent deleteIntent) {
         Intent target = new Intent(mContext, BubblesTestActivity.class);
         PendingIntent bubbleIntent = PendingIntent.getActivity(mContext, 0, target, 0);
-        return new Notification.BubbleMetadata.Builder()
+
+        return new BubbleMetadata.Builder()
                 .setIntent(bubbleIntent)
+                .setDeleteIntent(deleteIntent)
                 .setTitle("bubble title")
                 .setIcon(Icon.createWithResource(mContext, 1))
                 .setDesiredHeight(314)
diff --git a/packages/SystemUI/tests/src/com/android/systemui/statusbar/NotificationUiAdjustmentTest.java b/packages/SystemUI/tests/src/com/android/systemui/statusbar/NotificationUiAdjustmentTest.java
index db1e049..f63389c 100644
--- a/packages/SystemUI/tests/src/com/android/systemui/statusbar/NotificationUiAdjustmentTest.java
+++ b/packages/SystemUI/tests/src/com/android/systemui/statusbar/NotificationUiAdjustmentTest.java
@@ -22,7 +22,8 @@
 import android.app.RemoteInput;
 import android.content.Intent;
 import android.graphics.drawable.Icon;
-import android.support.test.filters.SmallTest;
+
+import androidx.test.filters.SmallTest;
 
 import com.android.internal.R;
 import com.android.systemui.SysuiTestCase;
diff --git a/packages/SystemUI/tests/src/com/android/systemui/statusbar/NotificationViewHierarchyManagerTest.java b/packages/SystemUI/tests/src/com/android/systemui/statusbar/NotificationViewHierarchyManagerTest.java
index 62700c0..6b2e05b 100644
--- a/packages/SystemUI/tests/src/com/android/systemui/statusbar/NotificationViewHierarchyManagerTest.java
+++ b/packages/SystemUI/tests/src/com/android/systemui/statusbar/NotificationViewHierarchyManagerTest.java
@@ -26,13 +26,14 @@
 import static org.mockito.Mockito.verify;
 import static org.mockito.Mockito.when;
 
-import android.support.test.filters.SmallTest;
 import android.testing.AndroidTestingRunner;
 import android.testing.TestableLooper;
 import android.view.View;
 import android.view.ViewGroup;
 import android.widget.LinearLayout;
 
+import androidx.test.filters.SmallTest;
+
 import com.android.systemui.Dependency;
 import com.android.systemui.InitController;
 import com.android.systemui.SysuiTestCase;
diff --git a/packages/SystemUI/tests/src/com/android/systemui/statusbar/ScrimViewTest.java b/packages/SystemUI/tests/src/com/android/systemui/statusbar/ScrimViewTest.java
index c2611e4..2020d4b 100644
--- a/packages/SystemUI/tests/src/com/android/systemui/statusbar/ScrimViewTest.java
+++ b/packages/SystemUI/tests/src/com/android/systemui/statusbar/ScrimViewTest.java
@@ -18,23 +18,17 @@
 
 import static junit.framework.Assert.assertEquals;
 
-import static org.mockito.ArgumentMatchers.anyInt;
-import static org.mockito.Mockito.mock;
-import static org.mockito.Mockito.times;
-import static org.mockito.Mockito.verify;
-
-import android.graphics.Canvas;
 import android.graphics.Color;
-import android.graphics.Rect;
 import android.graphics.drawable.ColorDrawable;
 import android.graphics.drawable.Drawable;
-import android.support.test.filters.SmallTest;
 import android.testing.AndroidTestingRunner;
 import android.testing.TestableLooper;
 import android.testing.TestableLooper.RunWithLooper;
 import android.testing.ViewUtils;
 import android.view.View;
 
+import androidx.test.filters.SmallTest;
+
 import com.android.internal.colorextraction.ColorExtractor;
 import com.android.internal.colorextraction.drawable.GradientDrawable;
 import com.android.systemui.statusbar.policy.ConfigurationController;
diff --git a/packages/SystemUI/tests/src/com/android/systemui/statusbar/SmartReplyControllerTest.java b/packages/SystemUI/tests/src/com/android/systemui/statusbar/SmartReplyControllerTest.java
index 31cd280..81e373a 100644
--- a/packages/SystemUI/tests/src/com/android/systemui/statusbar/SmartReplyControllerTest.java
+++ b/packages/SystemUI/tests/src/com/android/systemui/statusbar/SmartReplyControllerTest.java
@@ -29,10 +29,11 @@
 import android.os.RemoteException;
 import android.os.UserHandle;
 import android.service.notification.StatusBarNotification;
-import android.support.test.filters.SmallTest;
 import android.testing.AndroidTestingRunner;
 import android.testing.TestableLooper;
 
+import androidx.test.filters.SmallTest;
+
 import com.android.internal.logging.nano.MetricsProto.MetricsEvent;
 import com.android.internal.statusbar.IStatusBarService;
 import com.android.systemui.R;
diff --git a/packages/SystemUI/tests/src/com/android/systemui/statusbar/StatusBarIconListTest.java b/packages/SystemUI/tests/src/com/android/systemui/statusbar/StatusBarIconListTest.java
index e529e4c..4c20b61 100644
--- a/packages/SystemUI/tests/src/com/android/systemui/statusbar/StatusBarIconListTest.java
+++ b/packages/SystemUI/tests/src/com/android/systemui/statusbar/StatusBarIconListTest.java
@@ -1,6 +1,7 @@
 package com.android.systemui.statusbar;
 
 import static com.android.systemui.statusbar.phone.StatusBarIconController.TAG_PRIMARY;
+
 import static junit.framework.Assert.assertEquals;
 import static junit.framework.Assert.assertNull;
 import static junit.framework.Assert.assertTrue;
@@ -8,19 +9,21 @@
 import static org.mockito.Mockito.mock;
 import static org.mockito.Mockito.when;
 
-import android.support.test.runner.AndroidJUnit4;
 import android.test.suitebuilder.annotation.SmallTest;
 
+import androidx.test.runner.AndroidJUnit4;
+
 import com.android.systemui.SysuiTestCase;
 import com.android.systemui.statusbar.phone.StatusBarIconHolder;
 import com.android.systemui.statusbar.phone.StatusBarIconList;
 import com.android.systemui.statusbar.phone.StatusBarIconList.Slot;
 
-import java.util.ArrayList;
-import java.util.List;
 import org.junit.Test;
 import org.junit.runner.RunWith;
 
+import java.util.ArrayList;
+import java.util.List;
+
 @SmallTest
 @RunWith(AndroidJUnit4.class)
 public class StatusBarIconListTest extends SysuiTestCase {
diff --git a/packages/SystemUI/tests/src/com/android/systemui/statusbar/StatusBarIconViewTest.java b/packages/SystemUI/tests/src/com/android/systemui/statusbar/StatusBarIconViewTest.java
index 8fee107..9971e0c 100644
--- a/packages/SystemUI/tests/src/com/android/systemui/statusbar/StatusBarIconViewTest.java
+++ b/packages/SystemUI/tests/src/com/android/systemui/statusbar/StatusBarIconViewTest.java
@@ -38,8 +38,9 @@
 import android.graphics.Color;
 import android.graphics.drawable.Icon;
 import android.os.UserHandle;
-import android.support.test.filters.SmallTest;
-import android.support.test.runner.AndroidJUnit4;
+
+import androidx.test.filters.SmallTest;
+import androidx.test.runner.AndroidJUnit4;
 
 import com.android.internal.statusbar.StatusBarIcon;
 import com.android.internal.util.ContrastColorUtil;
diff --git a/packages/SystemUI/tests/src/com/android/systemui/statusbar/notification/MediaNotificationProcessorTest.java b/packages/SystemUI/tests/src/com/android/systemui/statusbar/notification/MediaNotificationProcessorTest.java
index 5d3a86d..b03abec 100644
--- a/packages/SystemUI/tests/src/com/android/systemui/statusbar/notification/MediaNotificationProcessorTest.java
+++ b/packages/SystemUI/tests/src/com/android/systemui/statusbar/notification/MediaNotificationProcessorTest.java
@@ -27,10 +27,11 @@
 import android.app.Notification;
 import android.graphics.Bitmap;
 import android.graphics.drawable.Drawable;
-import android.support.test.runner.AndroidJUnit4;
 import android.test.suitebuilder.annotation.SmallTest;
 import android.widget.RemoteViews;
 
+import androidx.test.runner.AndroidJUnit4;
+
 import com.android.systemui.R;
 import com.android.systemui.SysuiTestCase;
 
diff --git a/packages/SystemUI/tests/src/com/android/systemui/statusbar/notification/NotificationEntryManagerTest.java b/packages/SystemUI/tests/src/com/android/systemui/statusbar/notification/NotificationEntryManagerTest.java
index 0d4328f..c8005dd 100644
--- a/packages/SystemUI/tests/src/com/android/systemui/statusbar/notification/NotificationEntryManagerTest.java
+++ b/packages/SystemUI/tests/src/com/android/systemui/statusbar/notification/NotificationEntryManagerTest.java
@@ -42,13 +42,13 @@
 import android.os.UserHandle;
 import android.service.notification.NotificationListenerService;
 import android.service.notification.StatusBarNotification;
-import android.support.test.filters.SmallTest;
 import android.testing.AndroidTestingRunner;
 import android.testing.TestableLooper;
 import android.util.ArraySet;
 import android.widget.FrameLayout;
 
 import androidx.annotation.NonNull;
+import androidx.test.filters.SmallTest;
 
 import com.android.internal.logging.MetricsLogger;
 import com.android.systemui.Dependency;
@@ -347,7 +347,7 @@
 
         verify(mPresenter).updateNotificationViews();
         verify(mEntryListener).onEntryRemoved(
-                mEntry, null, false /* removedByUser */);
+                eq(mEntry), any(), eq(false) /* removedByUser */);
         verify(mRow).setRemoved();
 
         assertNull(mEntryManager.getNotificationData().get(mSbn.getKey()));
@@ -360,7 +360,7 @@
         mEntryManager.removeNotification("not_a_real_key", mRankingMap);
 
         verify(mEntryListener, never()).onEntryRemoved(
-                mEntry, null, false /* removedByUser */);
+                eq(mEntry), any(), eq(false) /* removedByUser */);
     }
 
     @Test
@@ -373,7 +373,7 @@
         mEntryManager.removeNotification(mSbn.getKey(), mRankingMap);
 
         verify(mEntryListener, never()).onEntryRemoved(
-                mEntry, null, false /* removedByUser */);
+                eq(mEntry), any(), eq(false /* removedByUser */));
     }
 
     @Test
@@ -455,7 +455,7 @@
         verify(extender).setShouldManageLifetime(mEntry, true);
         // THEN the notification is retained
         assertNotNull(mEntryManager.getNotificationData().get(mSbn.getKey()));
-        verify(mEntryListener, never()).onEntryRemoved(mEntry, null, false);
+        verify(mEntryListener, never()).onEntryRemoved(eq(mEntry), any(), eq(false));
     }
 
     @Test
@@ -474,7 +474,7 @@
 
         // THEN the notification is removed
         assertNull(mEntryManager.getNotificationData().get(mSbn.getKey()));
-        verify(mEntryListener).onEntryRemoved(mEntry, null, false);
+        verify(mEntryListener).onEntryRemoved(eq(mEntry), any(), eq(false));
     }
 
     @Test
diff --git a/packages/SystemUI/tests/src/com/android/systemui/statusbar/notification/NotificationFilterTest.java b/packages/SystemUI/tests/src/com/android/systemui/statusbar/notification/NotificationFilterTest.java
index 387475f..91a7ea8 100644
--- a/packages/SystemUI/tests/src/com/android/systemui/statusbar/notification/NotificationFilterTest.java
+++ b/packages/SystemUI/tests/src/com/android/systemui/statusbar/notification/NotificationFilterTest.java
@@ -31,12 +31,13 @@
 import android.content.pm.PackageManager;
 import android.os.Bundle;
 import android.service.notification.StatusBarNotification;
-import android.support.test.annotation.UiThreadTest;
-import android.support.test.filters.SmallTest;
 import android.testing.AndroidTestingRunner;
 import android.testing.TestableLooper;
 import android.testing.TestableLooper.RunWithLooper;
 
+import androidx.test.annotation.UiThreadTest;
+import androidx.test.filters.SmallTest;
+
 import com.android.systemui.ForegroundServiceController;
 import com.android.systemui.SysuiTestCase;
 import com.android.systemui.statusbar.NotificationTestHelper;
diff --git a/packages/SystemUI/tests/src/com/android/systemui/statusbar/notification/NotificationListControllerTest.java b/packages/SystemUI/tests/src/com/android/systemui/statusbar/notification/NotificationListControllerTest.java
index 4b5037b..311b81c 100644
--- a/packages/SystemUI/tests/src/com/android/systemui/statusbar/notification/NotificationListControllerTest.java
+++ b/packages/SystemUI/tests/src/com/android/systemui/statusbar/notification/NotificationListControllerTest.java
@@ -31,11 +31,12 @@
 import android.app.Notification;
 import android.os.UserHandle;
 import android.service.notification.StatusBarNotification;
-import android.support.test.filters.SmallTest;
 import android.testing.AndroidTestingRunner;
 import android.testing.TestableLooper;
 import android.util.ArraySet;
 
+import androidx.test.filters.SmallTest;
+
 import com.android.internal.statusbar.NotificationVisibility;
 import com.android.systemui.ForegroundServiceController;
 import com.android.systemui.R;
diff --git a/packages/SystemUI/tests/src/com/android/systemui/statusbar/notification/VisualStabilityManagerTest.java b/packages/SystemUI/tests/src/com/android/systemui/statusbar/notification/VisualStabilityManagerTest.java
index 813fc9d..b35dcb6 100644
--- a/packages/SystemUI/tests/src/com/android/systemui/statusbar/notification/VisualStabilityManagerTest.java
+++ b/packages/SystemUI/tests/src/com/android/systemui/statusbar/notification/VisualStabilityManagerTest.java
@@ -24,9 +24,10 @@
 import static org.mockito.Mockito.when;
 
 import android.service.notification.StatusBarNotification;
-import android.support.test.runner.AndroidJUnit4;
 import android.test.suitebuilder.annotation.SmallTest;
 
+import androidx.test.runner.AndroidJUnit4;
+
 import com.android.systemui.SysuiTestCase;
 import com.android.systemui.statusbar.NotificationPresenter;
 import com.android.systemui.statusbar.notification.collection.NotificationEntry;
diff --git a/packages/SystemUI/tests/src/com/android/systemui/statusbar/notification/collection/NotificationDataTest.java b/packages/SystemUI/tests/src/com/android/systemui/statusbar/notification/collection/NotificationDataTest.java
index 9f36a1e..79a6ac4 100644
--- a/packages/SystemUI/tests/src/com/android/systemui/statusbar/notification/collection/NotificationDataTest.java
+++ b/packages/SystemUI/tests/src/com/android/systemui/statusbar/notification/collection/NotificationDataTest.java
@@ -35,7 +35,6 @@
 import static org.junit.Assert.assertFalse;
 import static org.junit.Assert.assertTrue;
 import static org.mockito.ArgumentMatchers.any;
-import static org.mockito.ArgumentMatchers.anyString;
 import static org.mockito.Matchers.eq;
 import static org.mockito.Mockito.mock;
 import static org.mockito.Mockito.when;
@@ -57,12 +56,13 @@
 import android.service.notification.NotificationListenerService.Ranking;
 import android.service.notification.SnoozeCriterion;
 import android.service.notification.StatusBarNotification;
-import android.support.test.filters.SmallTest;
 import android.testing.AndroidTestingRunner;
 import android.testing.TestableLooper;
 import android.testing.TestableLooper.RunWithLooper;
 import android.util.ArraySet;
 
+import androidx.test.filters.SmallTest;
+
 import com.android.systemui.Dependency;
 import com.android.systemui.ForegroundServiceController;
 import com.android.systemui.InitController;
diff --git a/packages/SystemUI/tests/src/com/android/systemui/statusbar/notification/logging/ExpansionStateLoggerTest.java b/packages/SystemUI/tests/src/com/android/systemui/statusbar/notification/logging/ExpansionStateLoggerTest.java
index f1d9003..2b343c2 100644
--- a/packages/SystemUI/tests/src/com/android/systemui/statusbar/notification/logging/ExpansionStateLoggerTest.java
+++ b/packages/SystemUI/tests/src/com/android/systemui/statusbar/notification/logging/ExpansionStateLoggerTest.java
@@ -22,10 +22,11 @@
 import static org.mockito.Mockito.verify;
 
 import android.os.RemoteException;
-import android.support.test.filters.SmallTest;
 import android.testing.AndroidTestingRunner;
 import android.testing.TestableLooper;
 
+import androidx.test.filters.SmallTest;
+
 import com.android.internal.statusbar.IStatusBarService;
 import com.android.internal.statusbar.NotificationVisibility;
 import com.android.systemui.Dependency;
diff --git a/packages/SystemUI/tests/src/com/android/systemui/statusbar/notification/logging/NotificationLoggerTest.java b/packages/SystemUI/tests/src/com/android/systemui/statusbar/notification/logging/NotificationLoggerTest.java
index d47700b..5e587f8 100644
--- a/packages/SystemUI/tests/src/com/android/systemui/statusbar/notification/logging/NotificationLoggerTest.java
+++ b/packages/SystemUI/tests/src/com/android/systemui/statusbar/notification/logging/NotificationLoggerTest.java
@@ -30,10 +30,11 @@
 import android.os.Looper;
 import android.os.UserHandle;
 import android.service.notification.StatusBarNotification;
-import android.support.test.filters.SmallTest;
 import android.testing.AndroidTestingRunner;
 import android.testing.TestableLooper;
 
+import androidx.test.filters.SmallTest;
+
 import com.android.internal.statusbar.IStatusBarService;
 import com.android.internal.statusbar.NotificationVisibility;
 import com.android.systemui.Dependency;
diff --git a/packages/SystemUI/tests/src/com/android/systemui/statusbar/notification/row/ExpandableNotificationRowTest.java b/packages/SystemUI/tests/src/com/android/systemui/statusbar/notification/row/ExpandableNotificationRowTest.java
index f6fb416..0aa103f 100644
--- a/packages/SystemUI/tests/src/com/android/systemui/statusbar/notification/row/ExpandableNotificationRowTest.java
+++ b/packages/SystemUI/tests/src/com/android/systemui/statusbar/notification/row/ExpandableNotificationRowTest.java
@@ -38,7 +38,6 @@
 
 import android.app.AppOpsManager;
 import android.app.NotificationChannel;
-import android.support.test.filters.SmallTest;
 import android.testing.AndroidTestingRunner;
 import android.testing.TestableLooper;
 import android.testing.TestableLooper.RunWithLooper;
@@ -46,6 +45,8 @@
 import android.view.NotificationHeaderView;
 import android.view.View;
 
+import androidx.test.filters.SmallTest;
+
 import com.android.systemui.SysuiTestCase;
 import com.android.systemui.plugins.statusbar.NotificationMenuRowPlugin;
 import com.android.systemui.statusbar.NotificationTestHelper;
diff --git a/packages/SystemUI/tests/src/com/android/systemui/statusbar/notification/row/FooterViewTest.java b/packages/SystemUI/tests/src/com/android/systemui/statusbar/notification/row/FooterViewTest.java
index aa7889a..2336958 100644
--- a/packages/SystemUI/tests/src/com/android/systemui/statusbar/notification/row/FooterViewTest.java
+++ b/packages/SystemUI/tests/src/com/android/systemui/statusbar/notification/row/FooterViewTest.java
@@ -16,23 +16,18 @@
 
 package com.android.systemui.statusbar.notification.row;
 
-import static junit.framework.Assert.assertEquals;
 import static junit.framework.Assert.assertFalse;
 import static junit.framework.Assert.assertNotNull;
-import static junit.framework.Assert.assertNull;
 import static junit.framework.Assert.assertTrue;
 
-import static org.mockito.ArgumentMatchers.any;
-import static org.mockito.ArgumentMatchers.eq;
-import static org.mockito.Mockito.doReturn;
 import static org.mockito.Mockito.mock;
-import static org.mockito.Mockito.spy;
 
-import android.support.test.filters.SmallTest;
-import android.support.test.runner.AndroidJUnit4;
 import android.view.LayoutInflater;
 import android.view.View;
 
+import androidx.test.filters.SmallTest;
+import androidx.test.runner.AndroidJUnit4;
+
 import com.android.systemui.R;
 import com.android.systemui.SysuiTestCase;
 
diff --git a/packages/SystemUI/tests/src/com/android/systemui/statusbar/notification/row/NotificationBlockingHelperManagerTest.java b/packages/SystemUI/tests/src/com/android/systemui/statusbar/notification/row/NotificationBlockingHelperManagerTest.java
index 669b98e1..4fe364a 100644
--- a/packages/SystemUI/tests/src/com/android/systemui/statusbar/notification/row/NotificationBlockingHelperManagerTest.java
+++ b/packages/SystemUI/tests/src/com/android/systemui/statusbar/notification/row/NotificationBlockingHelperManagerTest.java
@@ -30,12 +30,13 @@
 import static org.mockito.Mockito.when;
 
 import android.content.Context;
-import android.support.test.filters.FlakyTest;
-import android.support.test.filters.SmallTest;
 import android.testing.AndroidTestingRunner;
 import android.testing.TestableLooper;
 import android.view.View;
 
+import androidx.test.filters.FlakyTest;
+import androidx.test.filters.SmallTest;
+
 import com.android.systemui.SysuiTestCase;
 import com.android.systemui.plugins.statusbar.NotificationMenuRowPlugin;
 import com.android.systemui.statusbar.NotificationTestHelper;
diff --git a/packages/SystemUI/tests/src/com/android/systemui/statusbar/notification/row/NotificationContentInflaterTest.java b/packages/SystemUI/tests/src/com/android/systemui/statusbar/notification/row/NotificationContentInflaterTest.java
index 99dc9f8..025296d 100644
--- a/packages/SystemUI/tests/src/com/android/systemui/statusbar/notification/row/NotificationContentInflaterTest.java
+++ b/packages/SystemUI/tests/src/com/android/systemui/statusbar/notification/row/NotificationContentInflaterTest.java
@@ -36,7 +36,6 @@
 import android.os.Handler;
 import android.os.Looper;
 import android.service.notification.StatusBarNotification;
-import android.support.test.filters.SmallTest;
 import android.testing.AndroidTestingRunner;
 import android.testing.TestableLooper.RunWithLooper;
 import android.util.ArrayMap;
@@ -44,6 +43,8 @@
 import android.view.ViewGroup;
 import android.widget.RemoteViews;
 
+import androidx.test.filters.SmallTest;
+
 import com.android.systemui.R;
 import com.android.systemui.SysuiTestCase;
 import com.android.systemui.statusbar.InflationTask;
diff --git a/packages/SystemUI/tests/src/com/android/systemui/statusbar/notification/row/NotificationContentViewTest.java b/packages/SystemUI/tests/src/com/android/systemui/statusbar/notification/row/NotificationContentViewTest.java
index c80396d..5cd0ca7 100644
--- a/packages/SystemUI/tests/src/com/android/systemui/statusbar/notification/row/NotificationContentViewTest.java
+++ b/packages/SystemUI/tests/src/com/android/systemui/statusbar/notification/row/NotificationContentViewTest.java
@@ -16,8 +16,6 @@
 
 package com.android.systemui.statusbar.notification.row;
 
-import static com.google.common.truth.Truth.assertThat;
-
 import static org.junit.Assert.assertFalse;
 import static org.mockito.ArgumentMatchers.any;
 import static org.mockito.ArgumentMatchers.anyFloat;
@@ -31,62 +29,32 @@
 import static org.mockito.Mockito.when;
 
 import android.app.AppOpsManager;
-import android.app.Notification;
-import android.app.PendingIntent;
-import android.app.RemoteInput;
-import android.content.Intent;
 import android.graphics.drawable.Icon;
-import android.service.notification.StatusBarNotification;
-import android.support.test.annotation.UiThreadTest;
-import android.support.test.filters.SmallTest;
-import android.support.test.runner.AndroidJUnit4;
 import android.util.ArraySet;
-import android.util.Pair;
 import android.view.NotificationHeaderView;
 import android.view.View;
 
-import com.android.systemui.R;
+import androidx.test.annotation.UiThreadTest;
+import androidx.test.filters.SmallTest;
+import androidx.test.runner.AndroidJUnit4;
+
 import com.android.systemui.SysuiTestCase;
-import com.android.systemui.statusbar.notification.collection.NotificationEntry;
-import com.android.systemui.statusbar.policy.SmartReplyConstants;
 
 import org.junit.Before;
 import org.junit.Test;
 import org.junit.runner.RunWith;
-import org.mockito.Mock;
-import org.mockito.MockitoAnnotations;
-
-import java.util.ArrayList;
-import java.util.List;
 
 @SmallTest
 @RunWith(AndroidJUnit4.class)
 public class NotificationContentViewTest extends SysuiTestCase {
 
-    private static final String TEST_ACTION = "com.android.SMART_REPLY_VIEW_ACTION";
-
     NotificationContentView mView;
 
-    @Mock
-    SmartReplyConstants mSmartReplyConstants;
-    @Mock
-    StatusBarNotification mStatusBarNotification;
-    @Mock
-    Notification mNotification;
-    NotificationEntry mEntry;
-    @Mock
-    RemoteInput mRemoteInput;
-    @Mock
-    RemoteInput mFreeFormRemoteInput;
-
     private Icon mActionIcon;
 
-
     @Before
     @UiThreadTest
     public void setup() {
-        MockitoAnnotations.initMocks(this);
-
         mView = new NotificationContentView(mContext, null);
         ExpandableNotificationRow row = new ExpandableNotificationRow(mContext, null);
         ExpandableNotificationRow mockRow = spy(row);
@@ -103,13 +71,6 @@
 
         mView.measure(View.MeasureSpec.UNSPECIFIED, View.MeasureSpec.UNSPECIFIED);
         mView.layout(0, 0, mView.getMeasuredWidth(), mView.getMeasuredHeight());
-
-        // Smart replies and actions
-        when(mNotification.getAllowSystemGeneratedContextualActions()).thenReturn(true);
-        when(mStatusBarNotification.getNotification()).thenReturn(mNotification);
-        mEntry = new NotificationEntry(mStatusBarNotification);
-        when(mSmartReplyConstants.isEnabled()).thenReturn(true);
-        mActionIcon = Icon.createWithResource(mContext, R.drawable.ic_person);
     }
 
     private View createViewWithHeight(int height) {
@@ -158,204 +119,4 @@
         verify(mockAmbient, never()).showAppOpsIcons(ops);
         verify(mockHeadsUp, times(1)).showAppOpsIcons(any());
     }
-
-    private void setupAppGeneratedReplies(CharSequence[] smartReplies) {
-        setupAppGeneratedReplies(smartReplies, true /* allowSystemGeneratedReplies */);
-    }
-
-    private void setupAppGeneratedReplies(
-            CharSequence[] smartReplies, boolean allowSystemGeneratedReplies) {
-        PendingIntent pendingIntent =
-                PendingIntent.getBroadcast(mContext, 0, new Intent(TEST_ACTION), 0);
-        Notification.Action action =
-                new Notification.Action.Builder(null, "Test Action", pendingIntent).build();
-        when(mRemoteInput.getChoices()).thenReturn(smartReplies);
-        Pair<RemoteInput, Notification.Action> remoteInputActionPair =
-                Pair.create(mRemoteInput, action);
-        when(mNotification.findRemoteInputActionPair(false)).thenReturn(remoteInputActionPair);
-
-        Notification.Action freeFormRemoteInputAction =
-                createActionBuilder("Freeform Test Action")
-                .setAllowGeneratedReplies(allowSystemGeneratedReplies)
-                .build();
-        Pair<RemoteInput, Notification.Action> freeFormRemoteInputActionPair =
-                Pair.create(mFreeFormRemoteInput, freeFormRemoteInputAction);
-        when(mNotification.findRemoteInputActionPair(true)).thenReturn(
-                freeFormRemoteInputActionPair);
-
-        when(mSmartReplyConstants.requiresTargetingP()).thenReturn(false);
-    }
-
-    private void setupAppGeneratedSuggestions(
-            CharSequence[] smartReplies, List<Notification.Action> smartActions) {
-        setupAppGeneratedReplies(smartReplies);
-        when(mNotification.getContextualActions()).thenReturn(smartActions);
-    }
-
-    @Test
-    public void chooseSmartRepliesAndActions_smartRepliesOff_noAppGeneratedSmartSuggestions() {
-        CharSequence[] smartReplies = new String[] {"Reply1", "Reply2"};
-        List<Notification.Action> smartActions =
-                createActions(new String[] {"Test Action 1", "Test Action 2"});
-        setupAppGeneratedSuggestions(smartReplies, smartActions);
-        when(mSmartReplyConstants.isEnabled()).thenReturn(false);
-
-        NotificationContentView.SmartRepliesAndActions repliesAndActions =
-                NotificationContentView.chooseSmartRepliesAndActions(mSmartReplyConstants, mEntry);
-
-        assertThat(repliesAndActions.smartReplies).isNull();
-        assertThat(repliesAndActions.smartActions).isNull();
-    }
-
-    @Test
-    public void chooseSmartRepliesAndActions_smartRepliesOff_noSystemGeneratedSmartSuggestions() {
-        mEntry.systemGeneratedSmartReplies =
-                new String[] {"Sys Smart Reply 1", "Sys Smart Reply 2"};
-        mEntry.systemGeneratedSmartActions =
-                createActions(new String[] {"Sys Smart Action 1", "Sys Smart Action 2"});
-        when(mSmartReplyConstants.isEnabled()).thenReturn(false);
-
-        NotificationContentView.SmartRepliesAndActions repliesAndActions =
-                NotificationContentView.chooseSmartRepliesAndActions(mSmartReplyConstants, mEntry);
-
-        assertThat(repliesAndActions.smartReplies).isNull();
-        assertThat(repliesAndActions.smartActions).isNull();
-    }
-
-    @Test
-    public void chooseSmartRepliesAndActions_appGeneratedSmartReplies() {
-        CharSequence[] smartReplies = new String[] {"Reply1", "Reply2"};
-        setupAppGeneratedReplies(smartReplies);
-
-        NotificationContentView.SmartRepliesAndActions repliesAndActions =
-                NotificationContentView.chooseSmartRepliesAndActions(mSmartReplyConstants, mEntry);
-
-        assertThat(repliesAndActions.smartReplies.choices).isEqualTo(smartReplies);
-        assertThat(repliesAndActions.smartReplies.fromAssistant).isFalse();
-        assertThat(repliesAndActions.smartActions).isNull();
-    }
-
-    @Test
-    public void chooseSmartRepliesAndActions_appGeneratedSmartRepliesAndActions() {
-        CharSequence[] smartReplies = new String[] {"Reply1", "Reply2"};
-        List<Notification.Action> smartActions =
-                createActions(new String[] {"Test Action 1", "Test Action 2"});
-        setupAppGeneratedSuggestions(smartReplies, smartActions);
-
-        NotificationContentView.SmartRepliesAndActions repliesAndActions =
-                NotificationContentView.chooseSmartRepliesAndActions(mSmartReplyConstants, mEntry);
-
-        assertThat(repliesAndActions.smartReplies.choices).isEqualTo(smartReplies);
-        assertThat(repliesAndActions.smartReplies.fromAssistant).isFalse();
-        assertThat(repliesAndActions.smartActions.actions).isEqualTo(smartActions);
-        assertThat(repliesAndActions.smartActions.fromAssistant).isFalse();
-    }
-
-    @Test
-    public void chooseSmartRepliesAndActions_sysGeneratedSmartReplies() {
-        // Pass a null-array as app-generated smart replies, so that we use NAS-generated smart
-        // replies.
-        setupAppGeneratedReplies(null /* smartReplies */);
-
-        mEntry.systemGeneratedSmartReplies =
-                new String[] {"Sys Smart Reply 1", "Sys Smart Reply 2"};
-        NotificationContentView.SmartRepliesAndActions repliesAndActions =
-                NotificationContentView.chooseSmartRepliesAndActions(mSmartReplyConstants, mEntry);
-
-        assertThat(repliesAndActions.smartReplies.choices).isEqualTo(
-                mEntry.systemGeneratedSmartReplies);
-        assertThat(repliesAndActions.smartReplies.fromAssistant).isTrue();
-        assertThat(repliesAndActions.smartActions).isNull();
-    }
-
-    @Test
-    public void chooseSmartRepliesAndActions_noSysGeneratedSmartRepliesIfNotAllowed() {
-        // Pass a null-array as app-generated smart replies, so that we use NAS-generated smart
-        // replies.
-        setupAppGeneratedReplies(null /* smartReplies */, false /* allowSystemGeneratedReplies */);
-
-        mEntry.systemGeneratedSmartReplies =
-                new String[] {"Sys Smart Reply 1", "Sys Smart Reply 2"};
-        NotificationContentView.SmartRepliesAndActions repliesAndActions =
-                NotificationContentView.chooseSmartRepliesAndActions(mSmartReplyConstants, mEntry);
-
-        assertThat(repliesAndActions.smartReplies).isNull();
-        assertThat(repliesAndActions.smartActions).isNull();
-    }
-
-    @Test
-    public void chooseSmartRepliesAndActions_sysGeneratedSmartActions() {
-        // Pass a null-array as app-generated smart replies, so that we use NAS-generated smart
-        // actions.
-        setupAppGeneratedReplies(null /* smartReplies */);
-
-        mEntry.systemGeneratedSmartActions =
-                createActions(new String[] {"Sys Smart Action 1", "Sys Smart Action 2"});
-        NotificationContentView.SmartRepliesAndActions repliesAndActions =
-                NotificationContentView.chooseSmartRepliesAndActions(mSmartReplyConstants, mEntry);
-
-        assertThat(repliesAndActions.smartReplies).isNull();
-        assertThat(repliesAndActions.smartActions.actions)
-                .isEqualTo(mEntry.systemGeneratedSmartActions);
-        assertThat(repliesAndActions.smartActions.fromAssistant).isTrue();
-    }
-
-    @Test
-    public void chooseSmartRepliesAndActions_appGenPreferredOverSysGen() {
-        CharSequence[] appGenSmartReplies = new String[] {"Reply1", "Reply2"};
-        // Pass a null-array as app-generated smart replies, so that we use NAS-generated smart
-        // replies.
-        List<Notification.Action> appGenSmartActions =
-                createActions(new String[] {"Test Action 1", "Test Action 2"});
-        setupAppGeneratedSuggestions(appGenSmartReplies, appGenSmartActions);
-
-        mEntry.systemGeneratedSmartReplies =
-                new String[] {"Sys Smart Reply 1", "Sys Smart Reply 2"};
-        mEntry.systemGeneratedSmartActions =
-                createActions(new String[] {"Sys Smart Action 1", "Sys Smart Action 2"});
-
-        NotificationContentView.SmartRepliesAndActions repliesAndActions =
-                NotificationContentView.chooseSmartRepliesAndActions(mSmartReplyConstants, mEntry);
-
-        assertThat(repliesAndActions.smartReplies.choices).isEqualTo(appGenSmartReplies);
-        assertThat(repliesAndActions.smartReplies.fromAssistant).isFalse();
-        assertThat(repliesAndActions.smartActions.actions).isEqualTo(appGenSmartActions);
-        assertThat(repliesAndActions.smartActions.fromAssistant).isFalse();
-    }
-
-    @Test
-    public void chooseSmartRepliesAndActions_disallowSysGenSmartActions() {
-        // Pass a null-array as app-generated smart replies, so that we use NAS-generated smart
-        // actions.
-        setupAppGeneratedReplies(null /* smartReplies */, false /* allowSystemGeneratedReplies */);
-        when(mNotification.getAllowSystemGeneratedContextualActions()).thenReturn(false);
-        mEntry.systemGeneratedSmartReplies =
-                new String[] {"Sys Smart Reply 1", "Sys Smart Reply 2"};
-        mEntry.systemGeneratedSmartActions =
-                createActions(new String[] {"Sys Smart Action 1", "Sys Smart Action 2"});
-
-        NotificationContentView.SmartRepliesAndActions repliesAndActions =
-                NotificationContentView.chooseSmartRepliesAndActions(mSmartReplyConstants, mEntry);
-
-        assertThat(repliesAndActions.smartActions).isNull();
-        assertThat(repliesAndActions.smartReplies).isNull();
-    }
-
-    private Notification.Action.Builder createActionBuilder(String actionTitle) {
-        PendingIntent pendingIntent = PendingIntent.getBroadcast(mContext, 0,
-                new Intent(TEST_ACTION), 0);
-        return new Notification.Action.Builder(mActionIcon, actionTitle, pendingIntent);
-    }
-
-    private Notification.Action createAction(String actionTitle) {
-        return createActionBuilder(actionTitle).build();
-    }
-
-    private List<Notification.Action> createActions(String[] actionTitles) {
-        List<Notification.Action> actions = new ArrayList<>();
-        for (String title : actionTitles) {
-            actions.add(createAction(title));
-        }
-        return actions;
-    }
 }
diff --git a/packages/SystemUI/tests/src/com/android/systemui/statusbar/notification/row/NotificationGutsManagerTest.java b/packages/SystemUI/tests/src/com/android/systemui/statusbar/notification/row/NotificationGutsManagerTest.java
index 727e9af..ff849c3 100644
--- a/packages/SystemUI/tests/src/com/android/systemui/statusbar/notification/row/NotificationGutsManagerTest.java
+++ b/packages/SystemUI/tests/src/com/android/systemui/statusbar/notification/row/NotificationGutsManagerTest.java
@@ -49,12 +49,13 @@
 import android.os.Handler;
 import android.provider.Settings;
 import android.service.notification.StatusBarNotification;
-import android.support.test.filters.SmallTest;
 import android.testing.AndroidTestingRunner;
 import android.testing.TestableLooper;
 import android.util.ArraySet;
 import android.view.View;
 
+import androidx.test.filters.SmallTest;
+
 import com.android.internal.logging.MetricsLogger;
 import com.android.systemui.SysuiTestCase;
 import com.android.systemui.plugins.statusbar.NotificationMenuRowPlugin;
@@ -68,6 +69,7 @@
 import com.android.systemui.util.Assert;
 
 import org.junit.Before;
+import org.junit.Ignore;
 import org.junit.Rule;
 import org.junit.Test;
 import org.junit.runner.RunWith;
@@ -460,6 +462,7 @@
     }
 
     @Test
+    @Ignore
     public void testSetShouldManageLifetime_setShouldManage() {
         NotificationEntry entry = createTestNotificationRow().getEntry();
         mGutsManager.setShouldManageLifetime(entry, true /* shouldManage */);
diff --git a/packages/SystemUI/tests/src/com/android/systemui/statusbar/notification/row/NotificationMenuRowTest.java b/packages/SystemUI/tests/src/com/android/systemui/statusbar/notification/row/NotificationMenuRowTest.java
index 04d7509..e6389c4 100644
--- a/packages/SystemUI/tests/src/com/android/systemui/statusbar/notification/row/NotificationMenuRowTest.java
+++ b/packages/SystemUI/tests/src/com/android/systemui/statusbar/notification/row/NotificationMenuRowTest.java
@@ -27,13 +27,14 @@
 
 import android.app.NotificationChannel;
 import android.service.notification.StatusBarNotification;
-import android.support.test.filters.SmallTest;
 import android.testing.AndroidTestingRunner;
 import android.testing.TestableLooper;
 import android.testing.TestableLooper.RunWithLooper;
 import android.testing.ViewUtils;
 import android.view.ViewGroup;
 
+import androidx.test.filters.SmallTest;
+
 import com.android.systemui.plugins.statusbar.NotificationMenuRowPlugin;
 import com.android.systemui.statusbar.notification.collection.NotificationEntry;
 import com.android.systemui.utils.leaks.LeakCheckedTest;
diff --git a/packages/SystemUI/tests/src/com/android/systemui/statusbar/notification/row/wrapper/NotificationCustomViewWrapperTest.java b/packages/SystemUI/tests/src/com/android/systemui/statusbar/notification/row/wrapper/NotificationCustomViewWrapperTest.java
index fed66af..63e18ce 100644
--- a/packages/SystemUI/tests/src/com/android/systemui/statusbar/notification/row/wrapper/NotificationCustomViewWrapperTest.java
+++ b/packages/SystemUI/tests/src/com/android/systemui/statusbar/notification/row/wrapper/NotificationCustomViewWrapperTest.java
@@ -16,13 +16,14 @@
 
 package com.android.systemui.statusbar.notification.row.wrapper;
 
-import android.support.test.filters.SmallTest;
 import android.testing.AndroidTestingRunner;
 import android.testing.TestableLooper;
 import android.testing.TestableLooper.RunWithLooper;
 import android.view.View;
 import android.widget.RemoteViews;
 
+import androidx.test.filters.SmallTest;
+
 import com.android.systemui.R;
 import com.android.systemui.SysuiTestCase;
 import com.android.systemui.statusbar.NotificationTestHelper;
diff --git a/packages/SystemUI/tests/src/com/android/systemui/statusbar/notification/row/wrapper/NotificationViewWrapperTest.java b/packages/SystemUI/tests/src/com/android/systemui/statusbar/notification/row/wrapper/NotificationViewWrapperTest.java
index 637b30c..5463159 100644
--- a/packages/SystemUI/tests/src/com/android/systemui/statusbar/notification/row/wrapper/NotificationViewWrapperTest.java
+++ b/packages/SystemUI/tests/src/com/android/systemui/statusbar/notification/row/wrapper/NotificationViewWrapperTest.java
@@ -19,7 +19,6 @@
 import static org.mockito.Mockito.mock;
 
 import android.content.Context;
-import android.support.test.filters.SmallTest;
 import android.testing.AndroidTestingRunner;
 import android.testing.TestableLooper;
 import android.testing.TestableLooper.RunWithLooper;
@@ -27,6 +26,8 @@
 import android.widget.LinearLayout;
 import android.widget.TextView;
 
+import androidx.test.filters.SmallTest;
+
 import com.android.systemui.SysuiTestCase;
 import com.android.systemui.statusbar.NotificationTestHelper;
 import com.android.systemui.statusbar.notification.row.ExpandableNotificationRow;
diff --git a/packages/SystemUI/tests/src/com/android/systemui/statusbar/notification/stack/NotificationChildrenContainerTest.java b/packages/SystemUI/tests/src/com/android/systemui/statusbar/notification/stack/NotificationChildrenContainerTest.java
index bbafb4e..22d2585 100644
--- a/packages/SystemUI/tests/src/com/android/systemui/statusbar/notification/stack/NotificationChildrenContainerTest.java
+++ b/packages/SystemUI/tests/src/com/android/systemui/statusbar/notification/stack/NotificationChildrenContainerTest.java
@@ -16,13 +16,14 @@
 
 package com.android.systemui.statusbar.notification.stack;
 
-import android.support.test.filters.SmallTest;
 import android.testing.AndroidTestingRunner;
 import android.testing.TestableLooper;
 import android.testing.TestableLooper.RunWithLooper;
 import android.view.NotificationHeaderView;
 import android.view.View;
 
+import androidx.test.filters.SmallTest;
+
 import com.android.systemui.SysuiTestCase;
 import com.android.systemui.statusbar.NotificationTestHelper;
 import com.android.systemui.statusbar.notification.row.ExpandableNotificationRow;
@@ -50,13 +51,6 @@
     }
 
     @Test
-    public void testGetMaxAllowedVisibleChildren_ambient() {
-        mGroup.setOnAmbient(true);
-        Assert.assertEquals(mChildrenContainer.getMaxAllowedVisibleChildren(),
-            NotificationChildrenContainer.NUMBER_OF_CHILDREN_WHEN_AMBIENT);
-    }
-
-    @Test
     public void testGetMaxAllowedVisibleChildren_lowPriority() {
         mChildrenContainer.setIsLowPriority(true);
         Assert.assertEquals(mChildrenContainer.getMaxAllowedVisibleChildren(),
diff --git a/packages/SystemUI/tests/src/com/android/systemui/statusbar/notification/stack/NotificationRoundnessManagerTest.java b/packages/SystemUI/tests/src/com/android/systemui/statusbar/notification/stack/NotificationRoundnessManagerTest.java
index ff30a4d..1b4acd7 100644
--- a/packages/SystemUI/tests/src/com/android/systemui/statusbar/notification/stack/NotificationRoundnessManagerTest.java
+++ b/packages/SystemUI/tests/src/com/android/systemui/statusbar/notification/stack/NotificationRoundnessManagerTest.java
@@ -23,16 +23,16 @@
 import static org.mockito.Mockito.verify;
 import static org.mockito.Mockito.when;
 
-import android.support.test.filters.SmallTest;
 import android.testing.AndroidTestingRunner;
 import android.testing.TestableLooper;
 import android.testing.TestableLooper.RunWithLooper;
 
+import androidx.test.filters.SmallTest;
+
 import com.android.systemui.SysuiTestCase;
 import com.android.systemui.statusbar.AmbientPulseManager;
 import com.android.systemui.statusbar.NotificationTestHelper;
 import com.android.systemui.statusbar.notification.collection.NotificationEntry;
-import com.android.systemui.statusbar.notification.row.ActivatableNotificationView;
 import com.android.systemui.statusbar.notification.row.ExpandableNotificationRow;
 import com.android.systemui.statusbar.notification.row.ExpandableView;
 
diff --git a/packages/SystemUI/tests/src/com/android/systemui/statusbar/notification/stack/NotificationStackScrollLayoutTest.java b/packages/SystemUI/tests/src/com/android/systemui/statusbar/notification/stack/NotificationStackScrollLayoutTest.java
index d835082..1f57593 100644
--- a/packages/SystemUI/tests/src/com/android/systemui/statusbar/notification/stack/NotificationStackScrollLayoutTest.java
+++ b/packages/SystemUI/tests/src/com/android/systemui/statusbar/notification/stack/NotificationStackScrollLayoutTest.java
@@ -38,11 +38,12 @@
 
 import android.metrics.LogMaker;
 import android.provider.Settings;
-import android.support.test.annotation.UiThreadTest;
-import android.support.test.filters.SmallTest;
-import android.support.test.runner.AndroidJUnit4;
 import android.view.View;
 
+import androidx.test.annotation.UiThreadTest;
+import androidx.test.filters.SmallTest;
+import androidx.test.runner.AndroidJUnit4;
+
 import com.android.internal.logging.MetricsLogger;
 import com.android.internal.logging.nano.MetricsProto;
 import com.android.systemui.Dependency;
@@ -52,6 +53,7 @@
 import com.android.systemui.SysuiTestCase;
 import com.android.systemui.plugins.statusbar.NotificationMenuRowPlugin;
 import com.android.systemui.plugins.statusbar.StatusBarStateController;
+import com.android.systemui.statusbar.AmbientPulseManager;
 import com.android.systemui.statusbar.EmptyShadeView;
 import com.android.systemui.statusbar.NotificationPresenter;
 import com.android.systemui.statusbar.NotificationRemoteInputManager;
@@ -141,7 +143,8 @@
         // holds a copy of the CUT's instances of these classes, so they still refer to the CUT's
         // member variables, not the spy's member variables.
         mStackScrollerInternal = new NotificationStackScrollLayout(getContext(), null,
-                true /* allowLongPress */, mNotificationRoundnessManager);
+                true /* allowLongPress */, mNotificationRoundnessManager,
+                new AmbientPulseManager(mContext));
         mStackScroller = spy(mStackScrollerInternal);
         mStackScroller.setShelf(notificationShelf);
         mStackScroller.setStatusBar(mBar);
diff --git a/packages/SystemUI/tests/src/com/android/systemui/statusbar/notification/stack/NotificationSwipeHelperTest.java b/packages/SystemUI/tests/src/com/android/systemui/statusbar/notification/stack/NotificationSwipeHelperTest.java
index db39373..b24c3dd 100644
--- a/packages/SystemUI/tests/src/com/android/systemui/statusbar/notification/stack/NotificationSwipeHelperTest.java
+++ b/packages/SystemUI/tests/src/com/android/systemui/statusbar/notification/stack/NotificationSwipeHelperTest.java
@@ -31,12 +31,13 @@
 import android.animation.ValueAnimator.AnimatorUpdateListener;
 import android.os.Handler;
 import android.service.notification.StatusBarNotification;
-import android.support.test.filters.SmallTest;
 import android.testing.AndroidTestingRunner;
 import android.testing.TestableLooper;
 import android.view.MotionEvent;
 import android.view.View;
 
+import androidx.test.filters.SmallTest;
+
 import com.android.systemui.SwipeHelper;
 import com.android.systemui.SysuiTestCase;
 import com.android.systemui.plugins.statusbar.NotificationMenuRowPlugin;
@@ -211,7 +212,7 @@
 
     @Test
     public void testDismissChild_notExpanded() {
-        when(mCallback.isExpanded()).thenReturn(false);
+        when(mCallback.shouldDismissQuickly()).thenReturn(false);
         doNothing().when(mSwipeHelper).superDismissChild(mView, 0, false);
         doNothing().when(mSwipeHelper).handleMenuCoveredOrDismissed();
 
diff --git a/packages/SystemUI/tests/src/com/android/systemui/statusbar/phone/AutoTileManagerTest.java b/packages/SystemUI/tests/src/com/android/systemui/statusbar/phone/AutoTileManagerTest.java
index 87699b8..1248cbb 100644
--- a/packages/SystemUI/tests/src/com/android/systemui/statusbar/phone/AutoTileManagerTest.java
+++ b/packages/SystemUI/tests/src/com/android/systemui/statusbar/phone/AutoTileManagerTest.java
@@ -24,11 +24,12 @@
 import android.hardware.display.ColorDisplayManager;
 import android.hardware.display.NightDisplayListener;
 import android.os.Handler;
-import android.support.test.filters.SmallTest;
 import android.testing.AndroidTestingRunner;
 import android.testing.TestableLooper;
 import android.testing.TestableLooper.RunWithLooper;
 
+import androidx.test.filters.SmallTest;
+
 import com.android.systemui.SysuiTestCase;
 import com.android.systemui.qs.AutoAddTracker;
 import com.android.systemui.qs.QSTileHost;
diff --git a/packages/SystemUI/tests/src/com/android/systemui/statusbar/phone/BiometricsUnlockControllerTest.java b/packages/SystemUI/tests/src/com/android/systemui/statusbar/phone/BiometricsUnlockControllerTest.java
index 7be4756..057f752 100644
--- a/packages/SystemUI/tests/src/com/android/systemui/statusbar/phone/BiometricsUnlockControllerTest.java
+++ b/packages/SystemUI/tests/src/com/android/systemui/statusbar/phone/BiometricsUnlockControllerTest.java
@@ -36,6 +36,7 @@
 import com.android.systemui.SysuiTestCase;
 import com.android.systemui.keyguard.KeyguardViewMediator;
 import com.android.systemui.statusbar.NotificationMediaManager;
+import com.android.systemui.tuner.TunerService;
 
 import org.junit.Before;
 import org.junit.Test;
@@ -68,6 +69,8 @@
     private StatusBar mStatusBar;
     @Mock
     private UnlockMethodCache mUnlockMethodCache;
+    @Mock
+    private TunerService mTunerService;
     private BiometricUnlockController mBiometricUnlockController;
 
     @Before
@@ -79,9 +82,8 @@
         mDependency.injectTestDependency(NotificationMediaManager.class, mMediaManager);
         mDependency.injectTestDependency(StatusBarWindowController.class,
                 mStatusBarWindowController);
-        mBiometricUnlockController = new BiometricUnlockController(mContext, mDozeScrimController,
-                mKeyguardViewMediator, mScrimController, mStatusBar, mUnlockMethodCache,
-                new Handler(), mUpdateMonitor, 0 /* wakeUpDelay */);
+        mBiometricUnlockController = new TestableBiometricUnlockController(
+                false /* faceDismissesKeyguard */);
         mBiometricUnlockController.setStatusBarKeyguardViewManager(mStatusBarKeyguardViewManager);
     }
 
@@ -136,6 +138,19 @@
     }
 
     @Test
+    public void onBiometricAuthenticated_whenFace_dismissingKeyguard() {
+        mBiometricUnlockController = new TestableBiometricUnlockController(
+                true /* faceDismissesKeyguard */);
+        mBiometricUnlockController.setStatusBarKeyguardViewManager(mStatusBarKeyguardViewManager);
+
+        when(mUpdateMonitor.isUnlockingWithBiometricAllowed()).thenReturn(true);
+        mBiometricUnlockController.onBiometricAuthenticated(UserHandle.USER_CURRENT,
+                BiometricSourceType.FACE);
+
+        verify(mStatusBarKeyguardViewManager).animateCollapsePanels(anyFloat());
+    }
+
+    @Test
     public void onBiometricAuthenticated_whenFaceOnBouncer_dismissBouncer() {
         when(mUpdateMonitor.isUnlockingWithBiometricAllowed()).thenReturn(true);
         when(mStatusBarKeyguardViewManager.isBouncerShowing()).thenReturn(true);
@@ -156,4 +171,15 @@
 
         verify(mStatusBarKeyguardViewManager, never()).animateCollapsePanels(anyFloat());
     }
+
+    private class TestableBiometricUnlockController extends BiometricUnlockController {
+
+        TestableBiometricUnlockController(boolean faceDismissesKeyguard) {
+            super(mContext, mDozeScrimController,
+                    mKeyguardViewMediator, mScrimController, mStatusBar, mUnlockMethodCache,
+                    new Handler(), mUpdateMonitor, mTunerService, 0 /* wakeUpDelay */,
+                    faceDismissesKeyguard);
+            mFaceDismissesKeyguard = faceDismissesKeyguard;
+        }
+    }
 }
diff --git a/packages/SystemUI/tests/src/com/android/systemui/statusbar/phone/CollapsedStatusBarFragmentTest.java b/packages/SystemUI/tests/src/com/android/systemui/statusbar/phone/CollapsedStatusBarFragmentTest.java
index 3c5425c..33af96f 100644
--- a/packages/SystemUI/tests/src/com/android/systemui/statusbar/phone/CollapsedStatusBarFragmentTest.java
+++ b/packages/SystemUI/tests/src/com/android/systemui/statusbar/phone/CollapsedStatusBarFragmentTest.java
@@ -24,12 +24,13 @@
 import static org.mockito.Mockito.when;
 
 import android.app.StatusBarManager;
-import android.support.test.filters.SmallTest;
 import android.testing.AndroidTestingRunner;
 import android.testing.TestableLooper.RunWithLooper;
 import android.view.View;
 import android.view.ViewPropertyAnimator;
 
+import androidx.test.filters.SmallTest;
+
 import com.android.systemui.R;
 import com.android.systemui.SysuiBaseFragmentTest;
 import com.android.systemui.plugins.statusbar.StatusBarStateController;
diff --git a/packages/SystemUI/tests/src/com/android/systemui/statusbar/phone/ConfigurationControllerImplTest.kt b/packages/SystemUI/tests/src/com/android/systemui/statusbar/phone/ConfigurationControllerImplTest.kt
index 0d13e97..fee3ccb 100644
--- a/packages/SystemUI/tests/src/com/android/systemui/statusbar/phone/ConfigurationControllerImplTest.kt
+++ b/packages/SystemUI/tests/src/com/android/systemui/statusbar/phone/ConfigurationControllerImplTest.kt
@@ -14,7 +14,7 @@
 
 package com.android.systemui.statusbar.phone
 
-import android.support.test.filters.SmallTest
+import androidx.test.filters.SmallTest
 import android.testing.AndroidTestingRunner
 import com.android.systemui.SysuiTestCase
 import com.android.systemui.statusbar.policy.ConfigurationController.ConfigurationListener
diff --git a/packages/SystemUI/tests/src/com/android/systemui/statusbar/phone/DozeParametersTest.java b/packages/SystemUI/tests/src/com/android/systemui/statusbar/phone/DozeParametersTest.java
index 532019f..f6f4eb48 100644
--- a/packages/SystemUI/tests/src/com/android/systemui/statusbar/phone/DozeParametersTest.java
+++ b/packages/SystemUI/tests/src/com/android/systemui/statusbar/phone/DozeParametersTest.java
@@ -16,11 +16,21 @@
 
 package com.android.systemui.statusbar.phone;
 
+import static junit.framework.Assert.assertFalse;
+import static junit.framework.Assert.assertTrue;
+import static junit.framework.Assert.fail;
+
+import static org.mockito.ArgumentMatchers.eq;
+import static org.mockito.Mockito.mock;
+import static org.mockito.Mockito.reset;
+import static org.mockito.Mockito.verify;
+
 import android.content.Context;
 import android.os.PowerManager;
-import android.support.test.runner.AndroidJUnit4;
 import android.test.suitebuilder.annotation.SmallTest;
 
+import androidx.test.runner.AndroidJUnit4;
+
 import com.android.systemui.SysuiTestCase;
 import com.android.systemui.doze.DozeScreenState;
 import com.android.systemui.statusbar.phone.DozeParameters.IntInOutMatcher;
@@ -29,18 +39,6 @@
 import org.junit.Test;
 import org.junit.runner.RunWith;
 
-import static junit.framework.Assert.assertTrue;
-import static junit.framework.Assert.assertFalse;
-import static junit.framework.Assert.fail;
-
-import static org.mockito.ArgumentMatchers.any;
-import static org.mockito.ArgumentMatchers.eq;
-import static org.mockito.Mockito.mock;
-import static org.mockito.Mockito.never;
-import static org.mockito.Mockito.reset;
-import static org.mockito.Mockito.verify;
-import static org.mockito.Mockito.when;
-
 @SmallTest
 @RunWith(AndroidJUnit4.class)
 public class DozeParametersTest extends SysuiTestCase {
diff --git a/packages/SystemUI/tests/src/com/android/systemui/statusbar/phone/DozeScrimControllerTest.java b/packages/SystemUI/tests/src/com/android/systemui/statusbar/phone/DozeScrimControllerTest.java
index fe36b6d..20c739f 100644
--- a/packages/SystemUI/tests/src/com/android/systemui/statusbar/phone/DozeScrimControllerTest.java
+++ b/packages/SystemUI/tests/src/com/android/systemui/statusbar/phone/DozeScrimControllerTest.java
@@ -20,10 +20,11 @@
 import static org.mockito.Mockito.never;
 import static org.mockito.Mockito.verify;
 
-import android.support.test.filters.SmallTest;
 import android.testing.AndroidTestingRunner;
 import android.testing.TestableLooper;
 
+import androidx.test.filters.SmallTest;
+
 import com.android.systemui.SysuiTestCase;
 import com.android.systemui.doze.DozeHost;
 
diff --git a/packages/SystemUI/tests/src/com/android/systemui/statusbar/phone/HeadsUpAppearanceControllerTest.java b/packages/SystemUI/tests/src/com/android/systemui/statusbar/phone/HeadsUpAppearanceControllerTest.java
index 38d9ae7..44df237 100644
--- a/packages/SystemUI/tests/src/com/android/systemui/statusbar/phone/HeadsUpAppearanceControllerTest.java
+++ b/packages/SystemUI/tests/src/com/android/systemui/statusbar/phone/HeadsUpAppearanceControllerTest.java
@@ -22,13 +22,14 @@
 import static org.mockito.Mockito.verify;
 import static org.mockito.Mockito.when;
 
-import android.support.test.filters.SmallTest;
 import android.testing.AndroidTestingRunner;
 import android.testing.TestableLooper;
 import android.testing.TestableLooper.RunWithLooper;
 import android.view.View;
 import android.widget.TextView;
 
+import androidx.test.filters.SmallTest;
+
 import com.android.systemui.SysuiTestCase;
 import com.android.systemui.plugins.DarkIconDispatcher;
 import com.android.systemui.statusbar.HeadsUpStatusBarView;
diff --git a/packages/SystemUI/tests/src/com/android/systemui/statusbar/phone/HeadsUpManagerPhoneTest.java b/packages/SystemUI/tests/src/com/android/systemui/statusbar/phone/HeadsUpManagerPhoneTest.java
index 9ceb325..7797cb3 100644
--- a/packages/SystemUI/tests/src/com/android/systemui/statusbar/phone/HeadsUpManagerPhoneTest.java
+++ b/packages/SystemUI/tests/src/com/android/systemui/statusbar/phone/HeadsUpManagerPhoneTest.java
@@ -21,11 +21,12 @@
 
 import static org.mockito.Mockito.when;
 
-import android.support.test.filters.SmallTest;
 import android.testing.AndroidTestingRunner;
 import android.testing.TestableLooper;
 import android.view.View;
 
+import androidx.test.filters.SmallTest;
+
 import com.android.systemui.statusbar.AlertingNotificationManager;
 import com.android.systemui.statusbar.AlertingNotificationManagerTest;
 import com.android.systemui.statusbar.notification.VisualStabilityManager;
diff --git a/packages/SystemUI/tests/src/com/android/systemui/statusbar/phone/KeyguardBottomAreaTest.kt b/packages/SystemUI/tests/src/com/android/systemui/statusbar/phone/KeyguardBottomAreaTest.kt
index 96f1976..3010996 100644
--- a/packages/SystemUI/tests/src/com/android/systemui/statusbar/phone/KeyguardBottomAreaTest.kt
+++ b/packages/SystemUI/tests/src/com/android/systemui/statusbar/phone/KeyguardBottomAreaTest.kt
@@ -1,6 +1,6 @@
 package com.android.systemui.statusbar.phone
 
-import android.support.test.filters.SmallTest
+import androidx.test.filters.SmallTest
 import android.testing.AndroidTestingRunner
 import android.testing.TestableLooper
 import android.view.LayoutInflater
diff --git a/packages/SystemUI/tests/src/com/android/systemui/statusbar/phone/KeyguardBouncerTest.java b/packages/SystemUI/tests/src/com/android/systemui/statusbar/phone/KeyguardBouncerTest.java
index f7a95c5..e84dd68 100644
--- a/packages/SystemUI/tests/src/com/android/systemui/statusbar/phone/KeyguardBouncerTest.java
+++ b/packages/SystemUI/tests/src/com/android/systemui/statusbar/phone/KeyguardBouncerTest.java
@@ -30,13 +30,14 @@
 
 import android.content.res.ColorStateList;
 import android.graphics.Color;
-import android.support.test.filters.SmallTest;
 import android.testing.AndroidTestingRunner;
 import android.testing.TestableLooper;
 import android.view.ViewGroup;
 import android.view.ViewTreeObserver;
 import android.widget.FrameLayout;
 
+import androidx.test.filters.SmallTest;
+
 import com.android.internal.widget.LockPatternUtils;
 import com.android.keyguard.KeyguardHostView;
 import com.android.keyguard.KeyguardSecurityModel;
diff --git a/packages/SystemUI/tests/src/com/android/systemui/statusbar/phone/KeyguardClockPositionAlgorithmTest.java b/packages/SystemUI/tests/src/com/android/systemui/statusbar/phone/KeyguardClockPositionAlgorithmTest.java
index cd52e87..fcf4c71 100644
--- a/packages/SystemUI/tests/src/com/android/systemui/statusbar/phone/KeyguardClockPositionAlgorithmTest.java
+++ b/packages/SystemUI/tests/src/com/android/systemui/statusbar/phone/KeyguardClockPositionAlgorithmTest.java
@@ -18,10 +18,11 @@
 
 import static com.google.common.truth.Truth.assertThat;
 
-import android.support.test.filters.SmallTest;
 import android.testing.AndroidTestingRunner;
 import android.testing.TestableLooper;
 
+import androidx.test.filters.SmallTest;
+
 import com.android.systemui.SysuiTestCase;
 
 import org.junit.Before;
diff --git a/packages/SystemUI/tests/src/com/android/systemui/statusbar/phone/KeyguardPresentationTest.java b/packages/SystemUI/tests/src/com/android/systemui/statusbar/phone/KeyguardPresentationTest.java
index c587555..eec836f 100644
--- a/packages/SystemUI/tests/src/com/android/systemui/statusbar/phone/KeyguardPresentationTest.java
+++ b/packages/SystemUI/tests/src/com/android/systemui/statusbar/phone/KeyguardPresentationTest.java
@@ -16,11 +16,12 @@
 
 package com.android.systemui.statusbar.phone;
 
-import android.support.test.filters.SmallTest;
 import android.testing.AndroidTestingRunner;
 import android.testing.TestableLooper;
 import android.view.LayoutInflater;
 
+import androidx.test.filters.SmallTest;
+
 import com.android.systemui.R;
 import com.android.systemui.SysuiTestCase;
 
diff --git a/packages/SystemUI/tests/src/com/android/systemui/statusbar/phone/LightBarTransitionsControllerTest.java b/packages/SystemUI/tests/src/com/android/systemui/statusbar/phone/LightBarTransitionsControllerTest.java
index 0031c32..93fdce1 100644
--- a/packages/SystemUI/tests/src/com/android/systemui/statusbar/phone/LightBarTransitionsControllerTest.java
+++ b/packages/SystemUI/tests/src/com/android/systemui/statusbar/phone/LightBarTransitionsControllerTest.java
@@ -22,10 +22,11 @@
 import static org.mockito.Mockito.times;
 import static org.mockito.Mockito.verify;
 
-import android.support.test.filters.SmallTest;
 import android.testing.AndroidTestingRunner;
 import android.testing.TestableLooper;
 
+import androidx.test.filters.SmallTest;
+
 import com.android.systemui.SysuiTestCase;
 import com.android.systemui.statusbar.CommandQueue;
 import com.android.systemui.statusbar.phone.LightBarTransitionsController.DarkIntensityApplier;
diff --git a/packages/SystemUI/tests/src/com/android/systemui/statusbar/phone/NavigationBarButtonTest.java b/packages/SystemUI/tests/src/com/android/systemui/statusbar/phone/NavigationBarButtonTest.java
index 5c80718..81e8abf 100644
--- a/packages/SystemUI/tests/src/com/android/systemui/statusbar/phone/NavigationBarButtonTest.java
+++ b/packages/SystemUI/tests/src/com/android/systemui/statusbar/phone/NavigationBarButtonTest.java
@@ -25,13 +25,14 @@
 import android.hardware.display.VirtualDisplay;
 import android.media.ImageReader;
 import android.os.SystemClock;
-import android.support.test.filters.SmallTest;
 import android.testing.AndroidTestingRunner;
 import android.testing.TestableLooper.RunWithLooper;
 import android.util.Log;
 import android.view.Display;
 import android.view.DisplayInfo;
 
+import androidx.test.filters.SmallTest;
+
 import com.android.systemui.SysuiTestCase;
 import com.android.systemui.SysuiTestableContext;
 import com.android.systemui.statusbar.CommandQueue;
diff --git a/packages/SystemUI/tests/src/com/android/systemui/statusbar/phone/NavigationBarContextTest.java b/packages/SystemUI/tests/src/com/android/systemui/statusbar/phone/NavigationBarContextTest.java
index c792459..6293b06 100644
--- a/packages/SystemUI/tests/src/com/android/systemui/statusbar/phone/NavigationBarContextTest.java
+++ b/packages/SystemUI/tests/src/com/android/systemui/statusbar/phone/NavigationBarContextTest.java
@@ -17,26 +17,28 @@
 package com.android.systemui.statusbar.phone;
 
 import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertFalse;
 import static org.junit.Assert.assertNotEquals;
 import static org.junit.Assert.assertNull;
-import static org.junit.Assert.assertFalse;
 import static org.junit.Assert.assertTrue;
 import static org.junit.Assert.fail;
+import static org.mockito.Mockito.doReturn;
 import static org.mockito.Mockito.mock;
 import static org.mockito.Mockito.spy;
-import static org.mockito.Mockito.doReturn;
 
 import android.graphics.drawable.Drawable;
-import android.support.test.filters.SmallTest;
 import android.view.View;
-import com.android.systemui.statusbar.policy.KeyButtonDrawable;
+
+import androidx.test.filters.SmallTest;
+import androidx.test.runner.AndroidJUnit4;
+
 import com.android.systemui.SysuiTestCase;
+import com.android.systemui.statusbar.policy.KeyButtonDrawable;
+
 import org.junit.Before;
 import org.junit.Test;
 import org.junit.runner.RunWith;
 
-import android.support.test.runner.AndroidJUnit4;
-
 /** atest NavigationBarContextTest */
 @SmallTest
 @RunWith(AndroidJUnit4.class)
diff --git a/packages/SystemUI/tests/src/com/android/systemui/statusbar/phone/NavigationBarFragmentTest.java b/packages/SystemUI/tests/src/com/android/systemui/statusbar/phone/NavigationBarFragmentTest.java
index babd452..6a0d61d 100644
--- a/packages/SystemUI/tests/src/com/android/systemui/statusbar/phone/NavigationBarFragmentTest.java
+++ b/packages/SystemUI/tests/src/com/android/systemui/statusbar/phone/NavigationBarFragmentTest.java
@@ -22,7 +22,6 @@
 import android.content.Context;
 import android.os.Bundle;
 import android.os.Looper;
-import android.support.test.filters.SmallTest;
 import android.testing.AndroidTestingRunner;
 import android.testing.LeakCheck.Tracker;
 import android.testing.TestableLooper.RunWithLooper;
@@ -30,6 +29,8 @@
 import android.view.WindowManager;
 import android.view.accessibility.AccessibilityManager.AccessibilityServicesStateChangeListener;
 
+import androidx.test.filters.SmallTest;
+
 import com.android.internal.logging.MetricsLogger;
 import com.android.systemui.Dependency;
 import com.android.systemui.SysuiBaseFragmentTest;
diff --git a/packages/SystemUI/tests/src/com/android/systemui/statusbar/phone/NavigationBarInflaterViewTest.java b/packages/SystemUI/tests/src/com/android/systemui/statusbar/phone/NavigationBarInflaterViewTest.java
index 093749a..cec7feb 100644
--- a/packages/SystemUI/tests/src/com/android/systemui/statusbar/phone/NavigationBarInflaterViewTest.java
+++ b/packages/SystemUI/tests/src/com/android/systemui/statusbar/phone/NavigationBarInflaterViewTest.java
@@ -22,13 +22,14 @@
 import static org.mockito.Mockito.mock;
 import static org.mockito.Mockito.spy;
 
-import android.support.test.filters.SmallTest;
 import android.testing.AndroidTestingRunner;
 import android.testing.TestableLooper.RunWithLooper;
 import android.util.SparseArray;
 import android.view.View;
 import android.widget.FrameLayout;
 
+import androidx.test.filters.SmallTest;
+
 import com.android.systemui.SysuiTestCase;
 import com.android.systemui.statusbar.CommandQueue;
 
diff --git a/packages/SystemUI/tests/src/com/android/systemui/statusbar/phone/NavigationBarRotationContextTest.java b/packages/SystemUI/tests/src/com/android/systemui/statusbar/phone/NavigationBarRotationContextTest.java
index be26d91..28e91ea 100644
--- a/packages/SystemUI/tests/src/com/android/systemui/statusbar/phone/NavigationBarRotationContextTest.java
+++ b/packages/SystemUI/tests/src/com/android/systemui/statusbar/phone/NavigationBarRotationContextTest.java
@@ -22,13 +22,14 @@
 import static org.mockito.Mockito.times;
 import static org.mockito.Mockito.verify;
 
-import android.support.test.InstrumentationRegistry;
-import android.support.test.filters.SmallTest;
-import android.support.test.runner.AndroidJUnit4;
 import android.view.View;
 
-import com.android.systemui.SysuiTestableContext;
+import androidx.test.InstrumentationRegistry;
+import androidx.test.filters.SmallTest;
+import androidx.test.runner.AndroidJUnit4;
+
 import com.android.systemui.SysuiTestCase;
+import com.android.systemui.SysuiTestableContext;
 import com.android.systemui.TestableDependency;
 import com.android.systemui.statusbar.policy.KeyButtonDrawable;
 import com.android.systemui.statusbar.policy.RotationLockController;
diff --git a/packages/SystemUI/tests/src/com/android/systemui/statusbar/phone/NavigationBarTransitionsTest.java b/packages/SystemUI/tests/src/com/android/systemui/statusbar/phone/NavigationBarTransitionsTest.java
index 40d5415..bb109bd 100644
--- a/packages/SystemUI/tests/src/com/android/systemui/statusbar/phone/NavigationBarTransitionsTest.java
+++ b/packages/SystemUI/tests/src/com/android/systemui/statusbar/phone/NavigationBarTransitionsTest.java
@@ -21,11 +21,12 @@
 import static org.mockito.Mockito.spy;
 import static org.mockito.Mockito.when;
 
-import android.support.test.filters.SmallTest;
 import android.testing.AndroidTestingRunner;
 import android.testing.TestableLooper.RunWithLooper;
 import android.view.IWindowManager;
 
+import androidx.test.filters.SmallTest;
+
 import com.android.systemui.SysuiTestCase;
 import com.android.systemui.statusbar.CommandQueue;
 
diff --git a/packages/SystemUI/tests/src/com/android/systemui/statusbar/phone/NearestTouchFrameTest.java b/packages/SystemUI/tests/src/com/android/systemui/statusbar/phone/NearestTouchFrameTest.java
index 4dee438..a04bcc0 100644
--- a/packages/SystemUI/tests/src/com/android/systemui/statusbar/phone/NearestTouchFrameTest.java
+++ b/packages/SystemUI/tests/src/com/android/systemui/statusbar/phone/NearestTouchFrameTest.java
@@ -23,12 +23,13 @@
 import static org.mockito.Mockito.when;
 
 import android.content.res.Configuration;
-import android.support.test.filters.SmallTest;
 import android.testing.AndroidTestingRunner;
 import android.testing.TestableLooper.RunWithLooper;
 import android.view.MotionEvent;
 import android.view.View;
 
+import androidx.test.filters.SmallTest;
+
 import com.android.systemui.SysuiTestCase;
 
 import org.junit.Before;
diff --git a/packages/SystemUI/tests/src/com/android/systemui/statusbar/phone/NotificationGroupAlertTransferHelperTest.java b/packages/SystemUI/tests/src/com/android/systemui/statusbar/phone/NotificationGroupAlertTransferHelperTest.java
index cefd4ac..337c35c 100644
--- a/packages/SystemUI/tests/src/com/android/systemui/statusbar/phone/NotificationGroupAlertTransferHelperTest.java
+++ b/packages/SystemUI/tests/src/com/android/systemui/statusbar/phone/NotificationGroupAlertTransferHelperTest.java
@@ -26,10 +26,11 @@
 
 import android.app.Notification;
 import android.service.notification.StatusBarNotification;
-import android.support.test.filters.SmallTest;
 import android.testing.AndroidTestingRunner;
 import android.testing.TestableLooper;
 
+import androidx.test.filters.SmallTest;
+
 import com.android.systemui.SysuiTestCase;
 import com.android.systemui.statusbar.AmbientPulseManager;
 import com.android.systemui.statusbar.notification.NotificationEntryListener;
diff --git a/packages/SystemUI/tests/src/com/android/systemui/statusbar/phone/NotificationGroupManagerTest.java b/packages/SystemUI/tests/src/com/android/systemui/statusbar/phone/NotificationGroupManagerTest.java
index ecb3e4d..43685f0 100644
--- a/packages/SystemUI/tests/src/com/android/systemui/statusbar/phone/NotificationGroupManagerTest.java
+++ b/packages/SystemUI/tests/src/com/android/systemui/statusbar/phone/NotificationGroupManagerTest.java
@@ -23,10 +23,11 @@
 import static org.junit.Assert.assertNull;
 import static org.mockito.Mockito.when;
 
-import android.support.test.filters.SmallTest;
 import android.testing.AndroidTestingRunner;
 import android.testing.TestableLooper;
 
+import androidx.test.filters.SmallTest;
+
 import com.android.systemui.SysuiTestCase;
 import com.android.systemui.statusbar.AmbientPulseManager;
 import com.android.systemui.statusbar.notification.collection.NotificationEntry;
@@ -40,7 +41,6 @@
 import org.mockito.junit.MockitoJUnit;
 import org.mockito.junit.MockitoRule;
 
-
 @SmallTest
 @RunWith(AndroidTestingRunner.class)
 @TestableLooper.RunWithLooper
diff --git a/packages/SystemUI/tests/src/com/android/systemui/statusbar/phone/NotificationIconAreaControllerTest.java b/packages/SystemUI/tests/src/com/android/systemui/statusbar/phone/NotificationIconAreaControllerTest.java
index 120d0b0..7f7a3e7 100644
--- a/packages/SystemUI/tests/src/com/android/systemui/statusbar/phone/NotificationIconAreaControllerTest.java
+++ b/packages/SystemUI/tests/src/com/android/systemui/statusbar/phone/NotificationIconAreaControllerTest.java
@@ -22,10 +22,11 @@
 import static org.junit.Assert.assertTrue;
 
 import android.provider.Settings;
-import android.support.test.filters.SmallTest;
 import android.testing.AndroidTestingRunner;
 import android.testing.TestableLooper;
 
+import androidx.test.filters.SmallTest;
+
 import com.android.systemui.SysuiTestCase;
 import com.android.systemui.plugins.statusbar.StatusBarStateController;
 import com.android.systemui.statusbar.NotificationListener;
diff --git a/packages/SystemUI/tests/src/com/android/systemui/statusbar/phone/NotificationPanelViewTest.java b/packages/SystemUI/tests/src/com/android/systemui/statusbar/phone/NotificationPanelViewTest.java
index a97fa1f..db8357a 100644
--- a/packages/SystemUI/tests/src/com/android/systemui/statusbar/phone/NotificationPanelViewTest.java
+++ b/packages/SystemUI/tests/src/com/android/systemui/statusbar/phone/NotificationPanelViewTest.java
@@ -21,15 +21,20 @@
 import static org.mockito.Mockito.verify;
 import static org.mockito.Mockito.when;
 
-import android.support.test.filters.SmallTest;
 import android.testing.AndroidTestingRunner;
 import android.testing.TestableLooper;
 
+import androidx.test.filters.SmallTest;
+
 import com.android.keyguard.KeyguardStatusView;
 import com.android.systemui.SysuiTestCase;
 import com.android.systemui.plugins.statusbar.StatusBarStateController;
+import com.android.systemui.statusbar.AmbientPulseManager;
 import com.android.systemui.statusbar.NotificationLockscreenUserManager;
+import com.android.systemui.statusbar.PulseExpansionHandler;
+import com.android.systemui.statusbar.StatusBarStateControllerImpl;
 import com.android.systemui.statusbar.SysuiStatusBarStateController;
+import com.android.systemui.statusbar.notification.NotificationWakeUpCoordinator;
 import com.android.systemui.statusbar.notification.stack.NotificationStackScrollLayout;
 import com.android.systemui.statusbar.policy.ConfigurationController;
 import com.android.systemui.statusbar.policy.ZenModeController;
@@ -65,7 +70,12 @@
         mDependency.injectMockDependency(NotificationLockscreenUserManager.class);
         mDependency.injectMockDependency(ConfigurationController.class);
         mDependency.injectMockDependency(ZenModeController.class);
-        mNotificationPanelView = new TestableNotificationPanelView();
+        NotificationWakeUpCoordinator coordinator =
+                new NotificationWakeUpCoordinator(
+                        new AmbientPulseManager(mContext),
+                        new StatusBarStateControllerImpl());
+        PulseExpansionHandler expansionHandler = new PulseExpansionHandler(mContext, coordinator);
+        mNotificationPanelView = new TestableNotificationPanelView(coordinator, expansionHandler);
     }
 
     @Test
@@ -92,8 +102,9 @@
     }
 
     private class TestableNotificationPanelView extends NotificationPanelView {
-        TestableNotificationPanelView() {
-            super(NotificationPanelViewTest.this.mContext, null);
+        TestableNotificationPanelView(NotificationWakeUpCoordinator coordinator,
+                PulseExpansionHandler expansionHandler) {
+            super(NotificationPanelViewTest.this.mContext, null, coordinator, expansionHandler);
             mNotificationStackScroller = mNotificationStackScrollLayout;
             mKeyguardStatusView = NotificationPanelViewTest.this.mKeyguardStatusView;
             mKeyguardStatusBar = NotificationPanelViewTest.this.mKeyguardStatusBar;
diff --git a/packages/SystemUI/tests/src/com/android/systemui/statusbar/phone/QuickStepControllerTest.java b/packages/SystemUI/tests/src/com/android/systemui/statusbar/phone/QuickStepControllerTest.java
index dbf00a3..7829830 100644
--- a/packages/SystemUI/tests/src/com/android/systemui/statusbar/phone/QuickStepControllerTest.java
+++ b/packages/SystemUI/tests/src/com/android/systemui/statusbar/phone/QuickStepControllerTest.java
@@ -40,12 +40,13 @@
 
 import android.content.Context;
 import android.content.res.Resources;
-import android.support.test.filters.SmallTest;
 import android.testing.AndroidTestingRunner;
 import android.testing.TestableLooper.RunWithLooper;
 import android.view.MotionEvent;
 import android.view.View;
 
+import androidx.test.filters.SmallTest;
+
 import com.android.systemui.R;
 import com.android.systemui.SysuiTestCase;
 import com.android.systemui.recents.OverviewProxyService;
diff --git a/packages/SystemUI/tests/src/com/android/systemui/statusbar/phone/ScrimControllerTest.java b/packages/SystemUI/tests/src/com/android/systemui/statusbar/phone/ScrimControllerTest.java
index f72d411..7e5c3db 100644
--- a/packages/SystemUI/tests/src/com/android/systemui/statusbar/phone/ScrimControllerTest.java
+++ b/packages/SystemUI/tests/src/com/android/systemui/statusbar/phone/ScrimControllerTest.java
@@ -37,13 +37,12 @@
 import android.app.AlarmManager;
 import android.graphics.Color;
 import android.os.Handler;
-import android.os.Looper;
-import android.support.test.filters.FlakyTest;
-import android.support.test.filters.SmallTest;
 import android.testing.AndroidTestingRunner;
 import android.testing.TestableLooper;
 import android.view.View;
 
+import androidx.test.filters.SmallTest;
+
 import com.android.internal.colorextraction.ColorExtractor.GradientColors;
 import com.android.internal.util.function.TriConsumer;
 import com.android.systemui.SysuiTestCase;
@@ -52,6 +51,7 @@
 import com.android.systemui.util.wakelock.WakeLock;
 import com.android.systemui.utils.os.FakeHandler;
 
+import org.junit.After;
 import org.junit.Assert;
 import org.junit.Before;
 import org.junit.Test;
@@ -77,6 +77,7 @@
     private WakeLock mWakeLock;
     private boolean mAlwaysOnEnabled;
     private AlarmManager mAlarmManager;
+    private TestableLooper mLooper;
 
 
     @Before
@@ -87,6 +88,7 @@
         mAlarmManager = mock(AlarmManager.class);
         mAlwaysOnEnabled = true;
         mDozeParamenters = mock(DozeParameters.class);
+        mLooper = TestableLooper.get(this);
         when(mDozeParamenters.getAlwaysOn()).thenAnswer(invocation -> mAlwaysOnEnabled);
         when(mDozeParamenters.getDisplayNeedsBlanking()).thenReturn(true);
         mScrimController = new SynchronousScrimController(mScrimBehind, mScrimInFront,
@@ -98,12 +100,13 @@
                 visible -> mScrimVisibility = visible, mDozeParamenters, mAlarmManager);
         mScrimController.setHasBackdrop(false);
         mScrimController.setWallpaperSupportsAmbientMode(false);
+        mScrimController.transitionTo(ScrimState.KEYGUARD);
+        mScrimController.finishAnimationsImmediately();
     }
 
-    @Test
-    public void initialState() {
-        Assert.assertEquals("ScrimController should start initialized",
-                mScrimController.getState(), ScrimState.UNINITIALIZED);
+    @After
+    public void tearDown() {
+        mScrimController.finishAnimationsImmediately();
     }
 
     @Test
@@ -113,7 +116,7 @@
         // Front scrim should be transparent
         // Back scrim should be visible without tint
         assertScrimVisibility(VISIBILITY_FULLY_TRANSPARENT, VISIBILITY_SEMI_TRANSPARENT);
-        assertScrimTint(mScrimBehind, false /* tinted */);
+        assertScrimTint(mScrimBehind, true /* tinted */);
     }
 
     @Test
@@ -252,7 +255,6 @@
         assertScrimTint(mScrimBehind, false /* tinted */);
     }
 
-    @FlakyTest(bugId = 124858892)
     @Test
     public void transitionToUnlocked() {
         mScrimController.setPanelExpansion(0f);
@@ -297,7 +299,6 @@
         Assert.assertEquals(mScrimState, ScrimState.BOUNCER_SCRIMMED);
     }
 
-    @FlakyTest(bugId = 124858892)
     @Test
     public void panelExpansion() {
         mScrimController.setPanelExpansion(0f);
@@ -308,19 +309,18 @@
         reset(mScrimBehind);
         mScrimController.setPanelExpansion(0f);
         mScrimController.setPanelExpansion(1.0f);
-        mScrimController.onPreDraw();
+        mScrimController.finishAnimationsImmediately();
 
         Assert.assertEquals("Scrim alpha should change after setPanelExpansion",
                 mScrimBehindAlpha, mScrimBehind.getViewAlpha(), 0.01f);
 
         mScrimController.setPanelExpansion(0f);
-        mScrimController.onPreDraw();
+        mScrimController.finishAnimationsImmediately();
 
         Assert.assertEquals("Scrim alpha should change after setPanelExpansion",
                 mScrimBehindAlpha, mScrimBehind.getViewAlpha(), 0.01f);
     }
 
-    @FlakyTest(bugId = 124858892)
     @Test
     public void panelExpansionAffectsAlpha() {
         mScrimController.setPanelExpansion(0f);
@@ -338,6 +338,7 @@
 
         mScrimController.setExpansionAffectsAlpha(true);
         mScrimController.setPanelExpansion(0.1f);
+        mScrimController.finishAnimationsImmediately();
         Assert.assertNotEquals("Scrim opacity should change when setExpansionAffectsAlpha "
                 + "is true", scrimAlpha, mScrimBehind.getViewAlpha(), 0.01f);
     }
@@ -665,7 +666,6 @@
      */
     private class SynchronousScrimController extends ScrimController {
 
-        private FakeHandler mHandler;
         private boolean mAnimationCancelled;
         boolean mOnPreDrawCalled;
 
@@ -675,7 +675,6 @@
                 AlarmManager alarmManager) {
             super(scrimBehind, scrimInFront, scrimStateListener, scrimVisibleListener,
                     dozeParameters, alarmManager);
-            mHandler = new FakeHandler(Looper.myLooper());
         }
 
         @Override
@@ -687,13 +686,10 @@
         void finishAnimationsImmediately() {
             boolean[] animationFinished = {false};
             setOnAnimationFinished(()-> animationFinished[0] = true);
-
             // Execute code that will trigger animations.
             onPreDraw();
-
-            // Force finish screen blanking.
-            mHandler.dispatchQueuedMessages();
             // Force finish all animations.
+            mLooper.processAllMessages();
             endAnimation(mScrimBehind, TAG_KEY_ANIM);
             endAnimation(mScrimInFront, TAG_KEY_ANIM);
 
@@ -723,7 +719,7 @@
 
         @Override
         protected Handler getHandler() {
-            return mHandler;
+            return new FakeHandler(mLooper.getLooper());
         }
 
         @Override
diff --git a/packages/SystemUI/tests/src/com/android/systemui/statusbar/phone/StatusBarIconControllerTest.java b/packages/SystemUI/tests/src/com/android/systemui/statusbar/phone/StatusBarIconControllerTest.java
index 4f95bc5..a27ed1e 100644
--- a/packages/SystemUI/tests/src/com/android/systemui/statusbar/phone/StatusBarIconControllerTest.java
+++ b/packages/SystemUI/tests/src/com/android/systemui/statusbar/phone/StatusBarIconControllerTest.java
@@ -22,12 +22,13 @@
 
 import static org.mockito.Mockito.mock;
 
-import android.support.test.filters.SmallTest;
 import android.testing.AndroidTestingRunner;
 import android.testing.TestableLooper.RunWithLooper;
 import android.view.ViewGroup;
 import android.widget.LinearLayout;
 
+import androidx.test.filters.SmallTest;
+
 import com.android.internal.statusbar.StatusBarIcon;
 import com.android.systemui.plugins.DarkIconDispatcher;
 import com.android.systemui.statusbar.StatusBarIconView;
diff --git a/packages/SystemUI/tests/src/com/android/systemui/statusbar/phone/StatusBarKeyguardViewManagerTest.java b/packages/SystemUI/tests/src/com/android/systemui/statusbar/phone/StatusBarKeyguardViewManagerTest.java
index 93dedfb..1a27765 100644
--- a/packages/SystemUI/tests/src/com/android/systemui/statusbar/phone/StatusBarKeyguardViewManagerTest.java
+++ b/packages/SystemUI/tests/src/com/android/systemui/statusbar/phone/StatusBarKeyguardViewManagerTest.java
@@ -25,11 +25,12 @@
 import static org.mockito.Mockito.when;
 
 import android.content.Context;
-import android.support.test.filters.SmallTest;
 import android.testing.AndroidTestingRunner;
 import android.testing.TestableLooper;
 import android.view.ViewGroup;
 
+import androidx.test.filters.SmallTest;
+
 import com.android.internal.widget.LockPatternUtils;
 import com.android.keyguard.ViewMediatorCallback;
 import com.android.systemui.SysuiTestCase;
diff --git a/packages/SystemUI/tests/src/com/android/systemui/statusbar/phone/StatusBarNotificationPresenterTest.java b/packages/SystemUI/tests/src/com/android/systemui/statusbar/phone/StatusBarNotificationPresenterTest.java
index d2b0f7f..e811e1d 100644
--- a/packages/SystemUI/tests/src/com/android/systemui/statusbar/phone/StatusBarNotificationPresenterTest.java
+++ b/packages/SystemUI/tests/src/com/android/systemui/statusbar/phone/StatusBarNotificationPresenterTest.java
@@ -26,13 +26,14 @@
 import android.metrics.LogMaker;
 import android.os.UserHandle;
 import android.service.notification.StatusBarNotification;
-import android.support.test.filters.SmallTest;
 import android.support.test.metricshelper.MetricsAsserts;
 import android.testing.AndroidTestingRunner;
 import android.testing.TestableLooper;
 import android.testing.TestableLooper.RunWithLooper;
 import android.view.ViewGroup;
 
+import androidx.test.filters.SmallTest;
+
 import com.android.internal.logging.MetricsLogger;
 import com.android.internal.logging.nano.MetricsProto.MetricsEvent;
 import com.android.internal.logging.testing.FakeMetricsLogger;
diff --git a/packages/SystemUI/tests/src/com/android/systemui/statusbar/phone/StatusBarRemoteInputCallbackTest.java b/packages/SystemUI/tests/src/com/android/systemui/statusbar/phone/StatusBarRemoteInputCallbackTest.java
index f28757f..a88a595 100644
--- a/packages/SystemUI/tests/src/com/android/systemui/statusbar/phone/StatusBarRemoteInputCallbackTest.java
+++ b/packages/SystemUI/tests/src/com/android/systemui/statusbar/phone/StatusBarRemoteInputCallbackTest.java
@@ -23,14 +23,13 @@
 import static org.mockito.Mockito.when;
 import static org.mockito.internal.verification.VerificationModeFactory.times;
 
-import android.content.BroadcastReceiver;
-import android.content.Context;
 import android.content.Intent;
 import android.os.UserManager;
-import android.support.test.filters.SmallTest;
 import android.testing.AndroidTestingRunner;
 import android.testing.TestableLooper;
 
+import androidx.test.filters.SmallTest;
+
 import com.android.systemui.SysuiTestCase;
 import com.android.systemui.statusbar.CommandQueue;
 import com.android.systemui.statusbar.NotificationLockscreenUserManager;
diff --git a/packages/SystemUI/tests/src/com/android/systemui/statusbar/phone/StatusBarTest.java b/packages/SystemUI/tests/src/com/android/systemui/statusbar/phone/StatusBarTest.java
index a95361f..cbbee39 100644
--- a/packages/SystemUI/tests/src/com/android/systemui/statusbar/phone/StatusBarTest.java
+++ b/packages/SystemUI/tests/src/com/android/systemui/statusbar/phone/StatusBarTest.java
@@ -52,7 +52,6 @@
 import android.os.UserHandle;
 import android.service.dreams.IDreamManager;
 import android.service.notification.StatusBarNotification;
-import android.support.test.filters.SmallTest;
 import android.support.test.metricshelper.MetricsAsserts;
 import android.testing.AndroidTestingRunner;
 import android.testing.TestableLooper;
@@ -60,6 +59,8 @@
 import android.util.SparseArray;
 import android.view.ViewGroup.LayoutParams;
 
+import androidx.test.filters.SmallTest;
+
 import com.android.internal.logging.MetricsLogger;
 import com.android.internal.logging.nano.MetricsProto.MetricsEvent;
 import com.android.internal.logging.testing.FakeMetricsLogger;
@@ -640,10 +641,10 @@
     @Test
     public void testPulseWhileDozing_notifyAuthInterrupt() {
         HashSet<Integer> reasonsWantingAuth = new HashSet<>(
-                Collections.singletonList(DozeLog.PULSE_REASON_SENSOR_WAKE_LOCK_SCREEN));
+                Collections.singletonList(DozeLog.PULSE_REASON_NOTIFICATION));
         HashSet<Integer> reasonsSkippingAuth = new HashSet<>(
                 Arrays.asList(DozeLog.PULSE_REASON_INTENT,
-                        DozeLog.PULSE_REASON_NOTIFICATION,
+                        DozeLog.PULSE_REASON_SENSOR_WAKE_LOCK_SCREEN,
                         DozeLog.PULSE_REASON_SENSOR_SIGMOTION,
                         DozeLog.REASON_SENSOR_PICKUP,
                         DozeLog.REASON_SENSOR_DOUBLE_TAP,
diff --git a/packages/SystemUI/tests/src/com/android/systemui/statusbar/phone/StatusBarWindowControllerTest.java b/packages/SystemUI/tests/src/com/android/systemui/statusbar/phone/StatusBarWindowControllerTest.java
index 9996a9e..fea41a4 100644
--- a/packages/SystemUI/tests/src/com/android/systemui/statusbar/phone/StatusBarWindowControllerTest.java
+++ b/packages/SystemUI/tests/src/com/android/systemui/statusbar/phone/StatusBarWindowControllerTest.java
@@ -25,12 +25,13 @@
 import static org.mockito.Mockito.when;
 
 import android.app.IActivityManager;
-import android.support.test.filters.SmallTest;
 import android.testing.AndroidTestingRunner;
 import android.testing.TestableLooper.RunWithLooper;
 import android.view.ViewGroup;
 import android.view.WindowManager;
 
+import androidx.test.filters.SmallTest;
+
 import com.android.systemui.SysuiTestCase;
 
 import org.junit.Before;
diff --git a/packages/SystemUI/tests/src/com/android/systemui/statusbar/phone/StatusBarWindowViewTest.java b/packages/SystemUI/tests/src/com/android/systemui/statusbar/phone/StatusBarWindowViewTest.java
index 11284d6..00d87c3 100644
--- a/packages/SystemUI/tests/src/com/android/systemui/statusbar/phone/StatusBarWindowViewTest.java
+++ b/packages/SystemUI/tests/src/com/android/systemui/statusbar/phone/StatusBarWindowViewTest.java
@@ -22,10 +22,12 @@
 import static org.mockito.Mockito.when;
 
 import android.os.SystemClock;
-import android.support.test.filters.SmallTest;
-import android.support.test.runner.AndroidJUnit4;
+import android.testing.TestableLooper;
 import android.view.MotionEvent;
 
+import androidx.test.filters.SmallTest;
+import androidx.test.runner.AndroidJUnit4;
+
 import com.android.systemui.Dependency;
 import com.android.systemui.SysuiTestCase;
 import com.android.systemui.plugins.statusbar.StatusBarStateController;
@@ -38,6 +40,7 @@
 import org.junit.runner.RunWith;
 
 @RunWith(AndroidJUnit4.class)
+@TestableLooper.RunWithLooper
 @SmallTest
 public class StatusBarWindowViewTest extends SysuiTestCase {
 
diff --git a/packages/SystemUI/tests/src/com/android/systemui/statusbar/phone/SystemUIDialogTest.java b/packages/SystemUI/tests/src/com/android/systemui/statusbar/phone/SystemUIDialogTest.java
index 090963b..ca64823 100644
--- a/packages/SystemUI/tests/src/com/android/systemui/statusbar/phone/SystemUIDialogTest.java
+++ b/packages/SystemUI/tests/src/com/android/systemui/statusbar/phone/SystemUIDialogTest.java
@@ -23,10 +23,11 @@
 import android.content.Context;
 import android.content.Intent;
 import android.content.IntentFilter;
-import android.support.test.filters.SmallTest;
 import android.testing.AndroidTestingRunner;
 import android.testing.TestableLooper.RunWithLooper;
 
+import androidx.test.filters.SmallTest;
+
 import com.android.systemui.SysuiTestCase;
 
 import org.junit.Before;
@@ -34,7 +35,6 @@
 import org.junit.runner.RunWith;
 import org.mockito.ArgumentCaptor;
 
-
 @RunWith(AndroidTestingRunner.class)
 @RunWithLooper
 @SmallTest
diff --git a/packages/SystemUI/tests/src/com/android/systemui/statusbar/policy/BluetoothControllerImplTest.java b/packages/SystemUI/tests/src/com/android/systemui/statusbar/policy/BluetoothControllerImplTest.java
index b65b0f7..7f3c34e 100644
--- a/packages/SystemUI/tests/src/com/android/systemui/statusbar/policy/BluetoothControllerImplTest.java
+++ b/packages/SystemUI/tests/src/com/android/systemui/statusbar/policy/BluetoothControllerImplTest.java
@@ -15,8 +15,8 @@
 package com.android.systemui.statusbar.policy;
 
 import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertTrue;
 import static org.junit.Assert.assertFalse;
+import static org.junit.Assert.assertTrue;
 import static org.mockito.Mockito.mock;
 import static org.mockito.Mockito.verify;
 import static org.mockito.Mockito.when;
@@ -25,11 +25,11 @@
 import android.bluetooth.BluetoothDevice;
 import android.bluetooth.BluetoothProfile;
 import android.os.Looper;
-import android.support.test.filters.SmallTest;
 import android.testing.AndroidTestingRunner;
 import android.testing.TestableLooper;
 import android.testing.TestableLooper.RunWithLooper;
-import android.util.Log;
+
+import androidx.test.filters.SmallTest;
 
 import com.android.settingslib.bluetooth.BluetoothEventManager;
 import com.android.settingslib.bluetooth.CachedBluetoothDevice;
diff --git a/packages/SystemUI/tests/src/com/android/systemui/statusbar/policy/CallbackControllerTest.java b/packages/SystemUI/tests/src/com/android/systemui/statusbar/policy/CallbackControllerTest.java
index 93c97ec..fa711f1 100644
--- a/packages/SystemUI/tests/src/com/android/systemui/statusbar/policy/CallbackControllerTest.java
+++ b/packages/SystemUI/tests/src/com/android/systemui/statusbar/policy/CallbackControllerTest.java
@@ -20,7 +20,6 @@
 import static org.mockito.Mockito.mock;
 import static org.mockito.Mockito.verify;
 
-import android.support.test.filters.SmallTest;
 import android.testing.AndroidTestingRunner;
 import android.testing.TestableLooper.RunWithLooper;
 
@@ -28,6 +27,7 @@
 import androidx.lifecycle.Lifecycle.Event;
 import androidx.lifecycle.LifecycleEventObserver;
 import androidx.lifecycle.LifecycleOwner;
+import androidx.test.filters.SmallTest;
 
 import com.android.systemui.SysuiTestCase;
 
diff --git a/packages/SystemUI/tests/src/com/android/systemui/statusbar/policy/CallbackHandlerTest.java b/packages/SystemUI/tests/src/com/android/systemui/statusbar/policy/CallbackHandlerTest.java
index ed0f9ab..85f6033 100644
--- a/packages/SystemUI/tests/src/com/android/systemui/statusbar/policy/CallbackHandlerTest.java
+++ b/packages/SystemUI/tests/src/com/android/systemui/statusbar/policy/CallbackHandlerTest.java
@@ -15,29 +15,33 @@
  */
 package com.android.systemui.statusbar.policy;
 
+import static junit.framework.Assert.assertEquals;
+import static junit.framework.Assert.assertTrue;
+
+import static org.mockito.Matchers.eq;
+
 import android.os.HandlerThread;
-import android.support.test.runner.AndroidJUnit4;
 import android.telephony.SubscriptionInfo;
 import android.test.suitebuilder.annotation.SmallTest;
+
+import androidx.test.runner.AndroidJUnit4;
+
 import com.android.systemui.R;
 import com.android.systemui.SysuiTestCase;
 import com.android.systemui.statusbar.policy.NetworkController.EmergencyListener;
 import com.android.systemui.statusbar.policy.NetworkController.IconState;
 import com.android.systemui.statusbar.policy.NetworkController.SignalCallback;
-import java.util.ArrayList;
-import java.util.List;
+
 import org.junit.Before;
-import org.junit.runner.RunWith;
 import org.junit.Test;
+import org.junit.runner.RunWith;
 import org.mockito.ArgumentCaptor;
 import org.mockito.Mock;
 import org.mockito.Mockito;
 import org.mockito.MockitoAnnotations;
 
-import static junit.framework.Assert.assertTrue;
-import static junit.framework.Assert.assertEquals;
-
-import static org.mockito.Matchers.eq;
+import java.util.ArrayList;
+import java.util.List;
 
 @SmallTest
 @RunWith(AndroidJUnit4.class)
diff --git a/packages/SystemUI/tests/src/com/android/systemui/statusbar/policy/CastControllerImplTest.java b/packages/SystemUI/tests/src/com/android/systemui/statusbar/policy/CastControllerImplTest.java
index 1ee7094..016e402 100644
--- a/packages/SystemUI/tests/src/com/android/systemui/statusbar/policy/CastControllerImplTest.java
+++ b/packages/SystemUI/tests/src/com/android/systemui/statusbar/policy/CastControllerImplTest.java
@@ -1,28 +1,29 @@
 package com.android.systemui.statusbar.policy;
 
 
+import static org.junit.Assert.fail;
 import static org.mockito.Mockito.mock;
 import static org.mockito.Mockito.never;
 import static org.mockito.Mockito.times;
 import static org.mockito.Mockito.verify;
 import static org.mockito.Mockito.when;
-import static org.junit.Assert.fail;
 
 import android.media.MediaRouter;
 import android.media.projection.MediaProjectionInfo;
 import android.media.projection.MediaProjectionManager;
-import android.support.test.filters.SmallTest;
 import android.testing.AndroidTestingRunner;
 import android.testing.TestableLooper;
 
+import androidx.test.filters.SmallTest;
+
 import com.android.systemui.SysuiTestCase;
 import com.android.systemui.statusbar.policy.CastController.Callback;
 
 import org.junit.Before;
+import org.junit.Test;
 import org.junit.runner.RunWith;
 import org.mockito.Mock;
 import org.mockito.MockitoAnnotations;
-import org.junit.Test;
 
 import java.util.ConcurrentModificationException;
 import java.util.concurrent.CountDownLatch;
diff --git a/packages/SystemUI/tests/src/com/android/systemui/statusbar/policy/ExtensionControllerImplTest.java b/packages/SystemUI/tests/src/com/android/systemui/statusbar/policy/ExtensionControllerImplTest.java
index 2553ac1..1240a48 100644
--- a/packages/SystemUI/tests/src/com/android/systemui/statusbar/policy/ExtensionControllerImplTest.java
+++ b/packages/SystemUI/tests/src/com/android/systemui/statusbar/policy/ExtensionControllerImplTest.java
@@ -23,11 +23,12 @@
 import static org.mockito.Mockito.when;
 
 import android.content.res.Configuration;
-import android.support.test.filters.SmallTest;
 import android.testing.AndroidTestingRunner;
 import android.testing.TestableLooper;
 import android.testing.TestableLooper.RunWithLooper;
 
+import androidx.test.filters.SmallTest;
+
 import com.android.systemui.SysuiTestCase;
 import com.android.systemui.plugins.OverlayPlugin;
 import com.android.systemui.plugins.Plugin;
diff --git a/packages/SystemUI/tests/src/com/android/systemui/statusbar/policy/HotspotControllerImplTest.java b/packages/SystemUI/tests/src/com/android/systemui/statusbar/policy/HotspotControllerImplTest.java
new file mode 100644
index 0000000..3e4c4d6
--- /dev/null
+++ b/packages/SystemUI/tests/src/com/android/systemui/statusbar/policy/HotspotControllerImplTest.java
@@ -0,0 +1,116 @@
+/*
+ * Copyright (C) 2019 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 com.android.systemui.statusbar.policy;
+
+import static org.mockito.ArgumentMatchers.anyBoolean;
+import static org.mockito.ArgumentMatchers.anyInt;
+import static org.mockito.ArgumentMatchers.eq;
+import static org.mockito.Mockito.any;
+import static org.mockito.Mockito.doAnswer;
+import static org.mockito.Mockito.never;
+import static org.mockito.Mockito.times;
+import static org.mockito.Mockito.verify;
+
+import android.net.ConnectivityManager;
+import android.net.wifi.WifiManager;
+import android.os.Handler;
+import android.testing.AndroidTestingRunner;
+import android.testing.TestableLooper;
+
+import androidx.test.filters.SmallTest;
+
+import com.android.systemui.SysuiTestCase;
+
+import org.junit.Before;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+import org.mockito.Mock;
+import org.mockito.MockitoAnnotations;
+import org.mockito.invocation.InvocationOnMock;
+
+@SmallTest
+@RunWith(AndroidTestingRunner.class)
+@TestableLooper.RunWithLooper
+public class HotspotControllerImplTest extends SysuiTestCase {
+
+    @Mock
+    private ConnectivityManager mConnectivityManager;
+    @Mock
+    private WifiManager mWifiManager;
+    @Mock
+    private HotspotController.Callback mCallback1;
+    @Mock
+    private HotspotController.Callback mCallback2;
+    private HotspotControllerImpl mController;
+    private TestableLooper mLooper;
+
+    @Before
+    public void setUp() {
+        MockitoAnnotations.initMocks(this);
+        mLooper = TestableLooper.get(this);
+
+        mContext.addMockSystemService(ConnectivityManager.class, mConnectivityManager);
+        mContext.addMockSystemService(WifiManager.class, mWifiManager);
+
+        doAnswer((InvocationOnMock invocation) -> {
+            ((WifiManager.SoftApCallback) invocation.getArgument(0)).onNumClientsChanged(1);
+            return null;
+        }).when(mWifiManager).registerSoftApCallback(any(WifiManager.SoftApCallback.class),
+                any(Handler.class));
+
+        mController = new HotspotControllerImpl(mContext, new Handler(mLooper.getLooper()));
+    }
+
+    @Test
+    public void testAddingTwoCallbacksRegistersToWifiManagerOnce() {
+        mController.addCallback(mCallback1);
+        mController.addCallback(mCallback2);
+
+        verify(mWifiManager, times(1)).registerSoftApCallback(eq(mController), any());
+    }
+
+    @Test
+    public void testAddingCallbacksDoesntUpdateAll() {
+        mController.addCallback(mCallback1);
+        mController.addCallback(mCallback2);
+
+        mLooper.processAllMessages();
+        // Each callback should be updated only once
+        verify(mCallback1, times(1)).onHotspotChanged(anyBoolean(), anyInt());
+        verify(mCallback2, times(1)).onHotspotChanged(anyBoolean(), anyInt());
+    }
+
+    @Test
+    public void testRemovingTwoCallbacksUnegistersToWifiManagerOnce() {
+        mController.addCallback(mCallback1);
+        mController.addCallback(mCallback2);
+
+        mController.removeCallback(mCallback1);
+        mController.removeCallback(mCallback2);
+
+        verify(mWifiManager, times(1)).unregisterSoftApCallback(mController);
+    }
+
+    @Test
+    public void testDoNotUnregisterIfRemainingCallbacks() {
+        mController.addCallback(mCallback1);
+        mController.addCallback(mCallback2);
+
+        verify(mWifiManager, never()).unregisterSoftApCallback(any());
+    }
+
+}
diff --git a/packages/SystemUI/tests/src/com/android/systemui/statusbar/policy/InflatedSmartRepliesTest.java b/packages/SystemUI/tests/src/com/android/systemui/statusbar/policy/InflatedSmartRepliesTest.java
new file mode 100644
index 0000000..de1072d
--- /dev/null
+++ b/packages/SystemUI/tests/src/com/android/systemui/statusbar/policy/InflatedSmartRepliesTest.java
@@ -0,0 +1,382 @@
+/*
+ * Copyright (C) 2019 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 com.android.systemui.statusbar.policy;
+
+import static com.google.common.truth.Truth.assertThat;
+
+import static org.mockito.ArgumentMatchers.anyInt;
+import static org.mockito.ArgumentMatchers.anyString;
+import static org.mockito.ArgumentMatchers.argThat;
+import static org.mockito.Mockito.when;
+
+import android.app.Notification;
+import android.app.PendingIntent;
+import android.app.RemoteInput;
+import android.content.Intent;
+import android.content.pm.ActivityInfo;
+import android.content.pm.ResolveInfo;
+import android.graphics.drawable.Icon;
+import android.service.notification.StatusBarNotification;
+import android.util.Pair;
+
+import androidx.test.annotation.UiThreadTest;
+import androidx.test.filters.SmallTest;
+import androidx.test.runner.AndroidJUnit4;
+
+import com.android.systemui.R;
+import com.android.systemui.SysuiTestCase;
+import com.android.systemui.shared.system.ActivityManagerWrapper;
+import com.android.systemui.shared.system.DevicePolicyManagerWrapper;
+import com.android.systemui.shared.system.PackageManagerWrapper;
+import com.android.systemui.statusbar.notification.collection.NotificationEntry;
+import com.android.systemui.statusbar.policy.InflatedSmartReplies.SmartRepliesAndActions;
+
+import org.junit.Before;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+import org.mockito.Mock;
+import org.mockito.MockitoAnnotations;
+
+import java.util.ArrayList;
+import java.util.List;
+
+@SmallTest
+@RunWith(AndroidJUnit4.class)
+public class InflatedSmartRepliesTest extends SysuiTestCase {
+
+    private static final Intent TEST_INTENT = new Intent("com.android.SMART_REPLY_VIEW_ACTION");
+    private static final Intent WHITELISTED_TEST_INTENT =
+            new Intent("com.android.WHITELISTED_TEST_ACTION");
+
+    @Mock SmartReplyConstants mSmartReplyConstants;
+    @Mock StatusBarNotification mStatusBarNotification;
+    @Mock Notification mNotification;
+    NotificationEntry mEntry;
+    @Mock RemoteInput mRemoteInput;
+    @Mock RemoteInput mFreeFormRemoteInput;
+    @Mock ActivityManagerWrapper mActivityManagerWrapper;
+    @Mock PackageManagerWrapper mPackageManagerWrapper;
+    @Mock DevicePolicyManagerWrapper mDevicePolicyManagerWrapper;
+
+    private Icon mActionIcon;
+
+    @Before
+    @UiThreadTest
+    public void setUp() {
+        MockitoAnnotations.initMocks(this);
+
+        mDependency.injectTestDependency(ActivityManagerWrapper.class, mActivityManagerWrapper);
+        mDependency.injectTestDependency(
+                DevicePolicyManagerWrapper.class, mDevicePolicyManagerWrapper);
+        mDependency.injectTestDependency(PackageManagerWrapper.class, mPackageManagerWrapper);
+
+        when(mNotification.getAllowSystemGeneratedContextualActions()).thenReturn(true);
+        when(mStatusBarNotification.getNotification()).thenReturn(mNotification);
+        mEntry = new NotificationEntry(mStatusBarNotification);
+        when(mSmartReplyConstants.isEnabled()).thenReturn(true);
+        mActionIcon = Icon.createWithResource(mContext, R.drawable.ic_person);
+
+        when(mActivityManagerWrapper.isLockTaskKioskModeActive()).thenReturn(false);
+    }
+
+    @Test
+    public void chooseSmartRepliesAndActions_smartRepliesOff_noAppGeneratedSmartSuggestions() {
+        CharSequence[] smartReplies = new String[] {"Reply1", "Reply2"};
+        List<Notification.Action> smartActions =
+                createActions(new String[] {"Test Action 1", "Test Action 2"});
+        setupAppGeneratedSuggestions(smartReplies, smartActions);
+        when(mSmartReplyConstants.isEnabled()).thenReturn(false);
+
+        SmartRepliesAndActions repliesAndActions =
+                InflatedSmartReplies.chooseSmartRepliesAndActions(mSmartReplyConstants, mEntry);
+
+        assertThat(repliesAndActions.smartReplies).isNull();
+        assertThat(repliesAndActions.smartActions).isNull();
+    }
+
+    @Test
+    public void chooseSmartRepliesAndActions_smartRepliesOff_noSystemGeneratedSmartSuggestions() {
+        mEntry.systemGeneratedSmartReplies =
+                new String[] {"Sys Smart Reply 1", "Sys Smart Reply 2"};
+        mEntry.systemGeneratedSmartActions =
+                createActions(new String[] {"Sys Smart Action 1", "Sys Smart Action 2"});
+        when(mSmartReplyConstants.isEnabled()).thenReturn(false);
+
+        SmartRepliesAndActions repliesAndActions =
+                InflatedSmartReplies.chooseSmartRepliesAndActions(mSmartReplyConstants, mEntry);
+
+        assertThat(repliesAndActions.smartReplies).isNull();
+        assertThat(repliesAndActions.smartActions).isNull();
+    }
+
+    @Test
+    public void chooseSmartRepliesAndActions_appGeneratedSmartReplies() {
+        CharSequence[] smartReplies = new String[] {"Reply1", "Reply2"};
+        setupAppGeneratedReplies(smartReplies);
+
+        SmartRepliesAndActions repliesAndActions =
+                InflatedSmartReplies.chooseSmartRepliesAndActions(mSmartReplyConstants, mEntry);
+
+        assertThat(repliesAndActions.smartReplies.choices).isEqualTo(smartReplies);
+        assertThat(repliesAndActions.smartReplies.fromAssistant).isFalse();
+        assertThat(repliesAndActions.smartActions).isNull();
+    }
+
+    @Test
+    public void chooseSmartRepliesAndActions_appGeneratedSmartRepliesAndActions() {
+        CharSequence[] smartReplies = new String[] {"Reply1", "Reply2"};
+        List<Notification.Action> smartActions =
+                createActions(new String[] {"Test Action 1", "Test Action 2"});
+        setupAppGeneratedSuggestions(smartReplies, smartActions);
+
+        SmartRepliesAndActions repliesAndActions =
+                InflatedSmartReplies.chooseSmartRepliesAndActions(mSmartReplyConstants, mEntry);
+
+        assertThat(repliesAndActions.smartReplies.choices).isEqualTo(smartReplies);
+        assertThat(repliesAndActions.smartReplies.fromAssistant).isFalse();
+        assertThat(repliesAndActions.smartActions.actions).isEqualTo(smartActions);
+        assertThat(repliesAndActions.smartActions.fromAssistant).isFalse();
+    }
+
+    @Test
+    public void chooseSmartRepliesAndActions_sysGeneratedSmartReplies() {
+        // Pass a null-array as app-generated smart replies, so that we use NAS-generated smart
+        // replies.
+        setupAppGeneratedReplies(null /* smartReplies */);
+
+        mEntry.systemGeneratedSmartReplies =
+                new String[] {"Sys Smart Reply 1", "Sys Smart Reply 2"};
+        SmartRepliesAndActions repliesAndActions =
+                InflatedSmartReplies.chooseSmartRepliesAndActions(mSmartReplyConstants, mEntry);
+
+        assertThat(repliesAndActions.smartReplies.choices).isEqualTo(
+                mEntry.systemGeneratedSmartReplies);
+        assertThat(repliesAndActions.smartReplies.fromAssistant).isTrue();
+        assertThat(repliesAndActions.smartActions).isNull();
+    }
+
+    @Test
+    public void chooseSmartRepliesAndActions_noSysGeneratedSmartRepliesIfNotAllowed() {
+        // Pass a null-array as app-generated smart replies, so that we use NAS-generated smart
+        // replies.
+        setupAppGeneratedReplies(null /* smartReplies */, false /* allowSystemGeneratedReplies */);
+
+        mEntry.systemGeneratedSmartReplies =
+                new String[] {"Sys Smart Reply 1", "Sys Smart Reply 2"};
+        SmartRepliesAndActions repliesAndActions =
+                InflatedSmartReplies.chooseSmartRepliesAndActions(mSmartReplyConstants, mEntry);
+
+        assertThat(repliesAndActions.smartReplies).isNull();
+        assertThat(repliesAndActions.smartActions).isNull();
+    }
+
+    @Test
+    public void chooseSmartRepliesAndActions_sysGeneratedSmartActions() {
+        // Pass a null-array as app-generated smart replies, so that we use NAS-generated smart
+        // actions.
+        setupAppGeneratedReplies(null /* smartReplies */);
+
+        mEntry.systemGeneratedSmartActions =
+                createActions(new String[] {"Sys Smart Action 1", "Sys Smart Action 2"});
+        SmartRepliesAndActions repliesAndActions =
+                InflatedSmartReplies.chooseSmartRepliesAndActions(mSmartReplyConstants, mEntry);
+
+        assertThat(repliesAndActions.smartReplies).isNull();
+        assertThat(repliesAndActions.smartActions.actions)
+                .isEqualTo(mEntry.systemGeneratedSmartActions);
+        assertThat(repliesAndActions.smartActions.fromAssistant).isTrue();
+    }
+
+    @Test
+    public void chooseSmartRepliesAndActions_appGenPreferredOverSysGen() {
+        CharSequence[] appGenSmartReplies = new String[] {"Reply1", "Reply2"};
+        // Pass a null-array as app-generated smart replies, so that we use NAS-generated smart
+        // replies.
+        List<Notification.Action> appGenSmartActions =
+                createActions(new String[] {"Test Action 1", "Test Action 2"});
+        setupAppGeneratedSuggestions(appGenSmartReplies, appGenSmartActions);
+
+        mEntry.systemGeneratedSmartReplies =
+                new String[] {"Sys Smart Reply 1", "Sys Smart Reply 2"};
+        mEntry.systemGeneratedSmartActions =
+                createActions(new String[] {"Sys Smart Action 1", "Sys Smart Action 2"});
+
+        SmartRepliesAndActions repliesAndActions =
+                InflatedSmartReplies.chooseSmartRepliesAndActions(mSmartReplyConstants, mEntry);
+
+        assertThat(repliesAndActions.smartReplies.choices).isEqualTo(appGenSmartReplies);
+        assertThat(repliesAndActions.smartReplies.fromAssistant).isFalse();
+        assertThat(repliesAndActions.smartActions.actions).isEqualTo(appGenSmartActions);
+        assertThat(repliesAndActions.smartActions.fromAssistant).isFalse();
+    }
+
+    @Test
+    public void chooseSmartRepliesAndActions_disallowSysGenSmartActions() {
+        // Pass a null-array as app-generated smart replies, so that we use NAS-generated smart
+        // actions.
+        setupAppGeneratedReplies(null /* smartReplies */, false /* allowSystemGeneratedReplies */);
+        when(mNotification.getAllowSystemGeneratedContextualActions()).thenReturn(false);
+        mEntry.systemGeneratedSmartReplies =
+                new String[] {"Sys Smart Reply 1", "Sys Smart Reply 2"};
+        mEntry.systemGeneratedSmartActions =
+                createActions(new String[] {"Sys Smart Action 1", "Sys Smart Action 2"});
+
+        SmartRepliesAndActions repliesAndActions =
+                InflatedSmartReplies.chooseSmartRepliesAndActions(mSmartReplyConstants, mEntry);
+
+        assertThat(repliesAndActions.smartActions).isNull();
+        assertThat(repliesAndActions.smartReplies).isNull();
+    }
+
+    @Test
+    public void chooseSmartRepliesAndActions_lockTaskKioskModeEnabled_smartRepliesUnaffected() {
+        when(mActivityManagerWrapper.isLockTaskKioskModeActive()).thenReturn(true);
+        // No apps are white-listed
+        when(mDevicePolicyManagerWrapper.isLockTaskPermitted(anyString())).thenReturn(false);
+
+        // Pass a null-array as app-generated smart replies, so that we use NAS-generated smart
+        // suggestions.
+        setupAppGeneratedReplies(null /* smartReplies */);
+        mEntry.systemGeneratedSmartReplies =
+                new String[] {"Sys Smart Reply 1", "Sys Smart Reply 2"};
+        mEntry.systemGeneratedSmartActions =
+                createActions(new String[] {"Sys Smart Action 1", "Sys Smart Action 2"});
+
+        SmartRepliesAndActions repliesAndActions =
+                InflatedSmartReplies.chooseSmartRepliesAndActions(mSmartReplyConstants, mEntry);
+
+        assertThat(repliesAndActions.smartReplies.choices).isEqualTo(
+                mEntry.systemGeneratedSmartReplies);
+        // Since no apps are whitelisted no actions should be shown.
+        assertThat(repliesAndActions.smartActions.actions).isEmpty();
+    }
+
+    @Test
+    public void chooseSmartRepliesAndActions_lockTaskKioskModeEnabled_smartActionsAffected() {
+        when(mActivityManagerWrapper.isLockTaskKioskModeActive()).thenReturn(true);
+        String allowedPackage = "allowedPackage";
+        ResolveInfo allowedResolveInfo = new ResolveInfo();
+        allowedResolveInfo.activityInfo = new ActivityInfo();
+        allowedResolveInfo.activityInfo.packageName = allowedPackage;
+        when(mPackageManagerWrapper
+                .resolveActivity(
+                        argThat(intent -> WHITELISTED_TEST_INTENT.getAction().equals(
+                                intent.getAction())),
+                        anyInt() /* flags */))
+                .thenReturn(allowedResolveInfo);
+        when(mDevicePolicyManagerWrapper.isLockTaskPermitted(allowedPackage)).thenReturn(true);
+
+        // Pass a null-array as app-generated smart replies, so that we use NAS-generated smart
+        // suggestions.
+        setupAppGeneratedReplies(null /* smartReplies */);
+        mEntry.systemGeneratedSmartReplies =
+                new String[] {"Sys Smart Reply 1", "Sys Smart Reply 2"};
+        List<Notification.Action> actions = new ArrayList<>();
+        actions.add(createAction("allowed action", WHITELISTED_TEST_INTENT));
+        actions.add(createAction("non-allowed action", TEST_INTENT));
+        mEntry.systemGeneratedSmartActions = actions;
+
+        SmartRepliesAndActions repliesAndActions =
+                InflatedSmartReplies.chooseSmartRepliesAndActions(mSmartReplyConstants, mEntry);
+
+        // Only the action for the whitelisted package should be allowed.
+        assertThat(repliesAndActions.smartActions.actions.size()).isEqualTo(1);
+        assertThat(repliesAndActions.smartActions.actions.get(0)).isEqualTo(
+                mEntry.systemGeneratedSmartActions.get(0));
+    }
+
+    @Test
+    public void chooseSmartRepliesAndActions_screenPinningModeEnabled_suggestionsUnaffected() {
+        when(mActivityManagerWrapper.isLockToAppActive()).thenReturn(true);
+        // No apps are white-listed
+        when(mDevicePolicyManagerWrapper.isLockTaskPermitted(anyString())).thenReturn(false);
+
+        // Pass a null-array as app-generated smart replies, so that we use NAS-generated smart
+        // suggestions.
+        setupAppGeneratedReplies(null /* smartReplies */);
+        mEntry.systemGeneratedSmartReplies =
+                new String[] {"Sys Smart Reply 1", "Sys Smart Reply 2"};
+        mEntry.systemGeneratedSmartActions =
+                createActions(new String[] {"Sys Smart Action 1", "Sys Smart Action 2"});
+
+        SmartRepliesAndActions repliesAndActions =
+                InflatedSmartReplies.chooseSmartRepliesAndActions(mSmartReplyConstants, mEntry);
+
+        // We don't restrict replies or actions in screen pinning mode.
+        assertThat(repliesAndActions.smartReplies.choices).isEqualTo(
+                mEntry.systemGeneratedSmartReplies);
+        assertThat(repliesAndActions.smartActions.actions).isEqualTo(
+                mEntry.systemGeneratedSmartActions);
+    }
+
+    private void setupAppGeneratedReplies(CharSequence[] smartReplies) {
+        setupAppGeneratedReplies(smartReplies, true /* allowSystemGeneratedReplies */);
+    }
+
+    private void setupAppGeneratedReplies(
+            CharSequence[] smartReplies, boolean allowSystemGeneratedReplies) {
+        PendingIntent pendingIntent =
+                PendingIntent.getBroadcast(mContext, 0, TEST_INTENT, 0);
+        Notification.Action action =
+                new Notification.Action.Builder(null, "Test Action", pendingIntent).build();
+        when(mRemoteInput.getChoices()).thenReturn(smartReplies);
+        Pair<RemoteInput, Notification.Action> remoteInputActionPair =
+                Pair.create(mRemoteInput, action);
+        when(mNotification.findRemoteInputActionPair(false)).thenReturn(remoteInputActionPair);
+
+        Notification.Action freeFormRemoteInputAction =
+                createActionBuilder("Freeform Test Action")
+                .setAllowGeneratedReplies(allowSystemGeneratedReplies)
+                .build();
+        Pair<RemoteInput, Notification.Action> freeFormRemoteInputActionPair =
+                Pair.create(mFreeFormRemoteInput, freeFormRemoteInputAction);
+        when(mNotification.findRemoteInputActionPair(true)).thenReturn(
+                freeFormRemoteInputActionPair);
+
+        when(mSmartReplyConstants.requiresTargetingP()).thenReturn(false);
+    }
+
+    private void setupAppGeneratedSuggestions(
+            CharSequence[] smartReplies, List<Notification.Action> smartActions) {
+        setupAppGeneratedReplies(smartReplies);
+        when(mNotification.getContextualActions()).thenReturn(smartActions);
+    }
+
+    private Notification.Action.Builder createActionBuilder(String actionTitle) {
+        return createActionBuilder(actionTitle, TEST_INTENT);
+    }
+
+    private Notification.Action.Builder createActionBuilder(String actionTitle, Intent intent) {
+        PendingIntent pendingIntent = PendingIntent.getBroadcast(mContext, 0, intent, 0);
+        return new Notification.Action.Builder(mActionIcon, actionTitle, pendingIntent);
+    }
+
+    private Notification.Action createAction(String actionTitle) {
+        return createActionBuilder(actionTitle).build();
+    }
+
+    private Notification.Action createAction(String actionTitle, Intent intent) {
+        return createActionBuilder(actionTitle, intent).build();
+    }
+
+    private List<Notification.Action> createActions(String[] actionTitles) {
+        List<Notification.Action> actions = new ArrayList<>();
+        for (String title : actionTitles) {
+            actions.add(createAction(title));
+        }
+        return actions;
+    }
+}
diff --git a/packages/SystemUI/tests/src/com/android/systemui/statusbar/policy/KeyButtonViewTest.java b/packages/SystemUI/tests/src/com/android/systemui/statusbar/policy/KeyButtonViewTest.java
index f859235..39bdf20 100644
--- a/packages/SystemUI/tests/src/com/android/systemui/statusbar/policy/KeyButtonViewTest.java
+++ b/packages/SystemUI/tests/src/com/android/systemui/statusbar/policy/KeyButtonViewTest.java
@@ -21,12 +21,13 @@
 import static org.mockito.ArgumentMatchers.argThat;
 
 import android.metrics.LogMaker;
-import android.support.test.filters.SmallTest;
 import android.testing.AndroidTestingRunner;
 import android.testing.TestableLooper;
 import android.testing.TestableLooper.RunWithLooper;
 import android.view.KeyEvent;
 
+import androidx.test.filters.SmallTest;
+
 import com.android.internal.logging.MetricsLogger;
 import com.android.internal.logging.nano.MetricsProto.MetricsEvent;
 import com.android.systemui.SysuiTestCase;
diff --git a/packages/SystemUI/tests/src/com/android/systemui/statusbar/policy/LocationControllerImplTest.java b/packages/SystemUI/tests/src/com/android/systemui/statusbar/policy/LocationControllerImplTest.java
index a0fb330..3dcb34a 100644
--- a/packages/SystemUI/tests/src/com/android/systemui/statusbar/policy/LocationControllerImplTest.java
+++ b/packages/SystemUI/tests/src/com/android/systemui/statusbar/policy/LocationControllerImplTest.java
@@ -20,11 +20,12 @@
 
 import android.content.Intent;
 import android.location.LocationManager;
-import android.support.test.filters.SmallTest;
 import android.testing.AndroidTestingRunner;
 import android.testing.TestableLooper;
 import android.testing.TestableLooper.RunWithLooper;
 
+import androidx.test.filters.SmallTest;
+
 import com.android.systemui.SysuiTestCase;
 import com.android.systemui.statusbar.policy.LocationController.LocationChangeCallback;
 
diff --git a/packages/SystemUI/tests/src/com/android/systemui/statusbar/policy/NetworkControllerEthernetTest.java b/packages/SystemUI/tests/src/com/android/systemui/statusbar/policy/NetworkControllerEthernetTest.java
index eefdeee..93cf3e8 100644
--- a/packages/SystemUI/tests/src/com/android/systemui/statusbar/policy/NetworkControllerEthernetTest.java
+++ b/packages/SystemUI/tests/src/com/android/systemui/statusbar/policy/NetworkControllerEthernetTest.java
@@ -1,7 +1,8 @@
 package com.android.systemui.statusbar.policy;
 
+import static junit.framework.Assert.assertEquals;
+
 import android.net.NetworkCapabilities;
-import android.support.test.runner.AndroidJUnit4;
 import android.test.suitebuilder.annotation.SmallTest;
 import android.testing.AndroidTestingRunner;
 import android.testing.TestableLooper.RunWithLooper;
@@ -13,8 +14,6 @@
 import org.mockito.ArgumentCaptor;
 import org.mockito.Mockito;
 
-import static junit.framework.Assert.assertEquals;
-
 @SmallTest
 @RunWith(AndroidTestingRunner.class)
 @RunWithLooper
diff --git a/packages/SystemUI/tests/src/com/android/systemui/statusbar/policy/NetworkControllerSignalTest.java b/packages/SystemUI/tests/src/com/android/systemui/statusbar/policy/NetworkControllerSignalTest.java
index c24336d..bcbba8b 100644
--- a/packages/SystemUI/tests/src/com/android/systemui/statusbar/policy/NetworkControllerSignalTest.java
+++ b/packages/SystemUI/tests/src/com/android/systemui/statusbar/policy/NetworkControllerSignalTest.java
@@ -15,11 +15,16 @@
  */
 package com.android.systemui.statusbar.policy;
 
+import static junit.framework.Assert.assertEquals;
+import static junit.framework.Assert.assertFalse;
+import static junit.framework.Assert.assertTrue;
+
+import static org.mockito.Mockito.mock;
+
 import android.content.Intent;
 import android.net.ConnectivityManager;
 import android.net.NetworkCapabilities;
 import android.os.Looper;
-import android.support.test.runner.AndroidJUnit4;
 import android.telephony.ServiceState;
 import android.telephony.SignalStrength;
 import android.telephony.SubscriptionInfo;
@@ -42,11 +47,6 @@
 import java.util.ArrayList;
 import java.util.List;
 
-import static junit.framework.Assert.assertEquals;
-import static junit.framework.Assert.assertTrue;
-import static junit.framework.Assert.assertFalse;
-import static org.mockito.Mockito.mock;
-
 @SmallTest
 @RunWith(AndroidTestingRunner.class)
 @RunWithLooper
diff --git a/packages/SystemUI/tests/src/com/android/systemui/statusbar/policy/RemoteInputQuickSettingsDisablerTest.java b/packages/SystemUI/tests/src/com/android/systemui/statusbar/policy/RemoteInputQuickSettingsDisablerTest.java
index 8b8e3f1..fea3a08 100644
--- a/packages/SystemUI/tests/src/com/android/systemui/statusbar/policy/RemoteInputQuickSettingsDisablerTest.java
+++ b/packages/SystemUI/tests/src/com/android/systemui/statusbar/policy/RemoteInputQuickSettingsDisablerTest.java
@@ -24,9 +24,10 @@
 import static org.mockito.Mockito.verify;
 
 import android.content.res.Configuration;
-import android.support.test.runner.AndroidJUnit4;
 import android.test.suitebuilder.annotation.SmallTest;
 
+import androidx.test.runner.AndroidJUnit4;
+
 import com.android.systemui.SysuiTestCase;
 import com.android.systemui.statusbar.CommandQueue;
 import com.android.systemui.statusbar.policy.ConfigurationController;
diff --git a/packages/SystemUI/tests/src/com/android/systemui/statusbar/policy/RemoteInputViewTest.java b/packages/SystemUI/tests/src/com/android/systemui/statusbar/policy/RemoteInputViewTest.java
index 568ff55f..8bf1606 100644
--- a/packages/SystemUI/tests/src/com/android/systemui/statusbar/policy/RemoteInputViewTest.java
+++ b/packages/SystemUI/tests/src/com/android/systemui/statusbar/policy/RemoteInputViewTest.java
@@ -26,7 +26,6 @@
 import android.os.Handler;
 import android.os.Process;
 import android.os.UserHandle;
-import android.support.test.filters.SmallTest;
 import android.testing.AndroidTestingRunner;
 import android.testing.TestableLooper;
 import android.view.View;
@@ -35,6 +34,8 @@
 import android.widget.EditText;
 import android.widget.ImageButton;
 
+import androidx.test.filters.SmallTest;
+
 import com.android.systemui.Dependency;
 import com.android.systemui.R;
 import com.android.systemui.SysuiTestCase;
diff --git a/packages/SystemUI/tests/src/com/android/systemui/statusbar/policy/SecurityControllerTest.java b/packages/SystemUI/tests/src/com/android/systemui/statusbar/policy/SecurityControllerTest.java
index 3ac42de..854cc2f 100644
--- a/packages/SystemUI/tests/src/com/android/systemui/statusbar/policy/SecurityControllerTest.java
+++ b/packages/SystemUI/tests/src/com/android/systemui/statusbar/policy/SecurityControllerTest.java
@@ -23,11 +23,9 @@
 import static org.mockito.Matchers.anyInt;
 import static org.mockito.Matchers.argThat;
 import static org.mockito.Mockito.mock;
-import static org.mockito.Mockito.when;
-import static org.mockito.Mockito.doThrow;
-import static org.mockito.Mockito.doNothing;
 import static org.mockito.Mockito.times;
 import static org.mockito.Mockito.verify;
+import static org.mockito.Mockito.when;
 
 import android.app.admin.DevicePolicyManager;
 import android.content.ComponentName;
@@ -37,30 +35,28 @@
 import android.content.pm.UserInfo;
 import android.net.ConnectivityManager;
 import android.net.ConnectivityManager.NetworkCallback;
-import android.net.NetworkCapabilities;
 import android.net.NetworkRequest;
 import android.os.Handler;
 import android.os.Looper;
 import android.os.UserManager;
 import android.security.IKeyChainService;
-import android.support.test.runner.AndroidJUnit4;
 import android.test.suitebuilder.annotation.SmallTest;
 
-import com.android.systemui.statusbar.policy.SecurityController.SecurityControllerCallback;
-import com.android.systemui.SysuiTestCase;
+import androidx.test.runner.AndroidJUnit4;
 
-import java.util.ArrayList;
-import java.util.Arrays;
-import java.util.concurrent.CountDownLatch;
-import java.util.concurrent.TimeUnit;
-import java.util.List;
+import com.android.systemui.SysuiTestCase;
+import com.android.systemui.statusbar.policy.SecurityController.SecurityControllerCallback;
 
 import org.junit.After;
 import org.junit.Before;
-import org.junit.Ignore;
 import org.junit.Test;
 import org.junit.runner.RunWith;
 
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.List;
+import java.util.concurrent.CountDownLatch;
+import java.util.concurrent.TimeUnit;
 
 @SmallTest
 @RunWith(AndroidJUnit4.class)
diff --git a/packages/SystemUI/tests/src/com/android/systemui/statusbar/policy/SmartReplyConstantsTest.java b/packages/SystemUI/tests/src/com/android/systemui/statusbar/policy/SmartReplyConstantsTest.java
index bc0f742..cd9069a 100644
--- a/packages/SystemUI/tests/src/com/android/systemui/statusbar/policy/SmartReplyConstantsTest.java
+++ b/packages/SystemUI/tests/src/com/android/systemui/statusbar/policy/SmartReplyConstantsTest.java
@@ -23,15 +23,17 @@
 import android.app.RemoteInput;
 import android.os.Handler;
 import android.os.Looper;
-import android.provider.Settings;
+import android.provider.DeviceConfig;
 import android.test.suitebuilder.annotation.SmallTest;
 import android.testing.AndroidTestingRunner;
 import android.testing.TestableLooper;
 import android.testing.TestableResources;
 
+import com.android.internal.config.sysui.SystemUiDeviceConfigFlags;
 import com.android.systemui.R;
 import com.android.systemui.SysuiTestCase;
 
+import org.junit.After;
 import org.junit.Before;
 import org.junit.Test;
 import org.junit.runner.RunWith;
@@ -47,7 +49,7 @@
 
     @Before
     public void setUp() {
-        overrideSetting(null); // No config.
+        resetAllDeviceConfigFlags();
         TestableResources resources = mContext.getOrCreateTestableResources();
         resources.addOverride(R.bool.config_smart_replies_in_notifications_enabled, true);
         resources.addOverride(
@@ -58,9 +60,16 @@
         resources.addOverride(
                 R.integer.config_smart_replies_in_notifications_min_num_system_generated_replies,
                 2);
+        resources.addOverride(
+                R.integer.config_smart_replies_in_notifications_max_num_actions, -1);
         mConstants = new SmartReplyConstants(Handler.createAsync(Looper.myLooper()), mContext);
     }
 
+    @After
+    public void tearDown() {
+        resetAllDeviceConfigFlags();
+    }
+
     @Test
     public void testIsEnabledWithNoConfig() {
         assertTrue(mConstants.isEnabled());
@@ -68,25 +77,25 @@
 
     @Test
     public void testIsEnabledWithInvalidConfig() {
-        overrideSetting("invalid config");
+        overrideSetting(SystemUiDeviceConfigFlags.SSIN_ENABLED, "invalid config");
         triggerConstantsOnChange();
         assertTrue(mConstants.isEnabled());
     }
 
     @Test
     public void testIsEnabledWithValidConfig() {
-        overrideSetting("enabled=false,max_squeeze_remeasure_attempts=5");
+        overrideSetting(SystemUiDeviceConfigFlags.SSIN_ENABLED, "false");
         triggerConstantsOnChange();
         assertFalse(mConstants.isEnabled());
     }
 
     @Test
     public void testRequiresTargetingPConfig() {
-        overrideSetting("enabled=true,requires_targeting_p=false");
+        overrideSetting(SystemUiDeviceConfigFlags.SSIN_REQUIRES_TARGETING_P, "false");
         triggerConstantsOnChange();
         assertEquals(false, mConstants.requiresTargetingP());
 
-        overrideSetting("enabled=true");
+        overrideSetting(SystemUiDeviceConfigFlags.SSIN_REQUIRES_TARGETING_P, "");
         triggerConstantsOnChange();
         assertEquals(true, mConstants.requiresTargetingP());
     }
@@ -99,21 +108,21 @@
 
     @Test
     public void testGetMaxSqueezeRemeasureAttemptsWithInvalidConfig() {
-        overrideSetting("invalid config");
+        overrideSetting(SystemUiDeviceConfigFlags.SSIN_MAX_SQUEEZE_REMEASURE_ATTEMPTS,
+                "invalid config");
         triggerConstantsOnChange();
         assertEquals(7, mConstants.getMaxSqueezeRemeasureAttempts());
     }
 
     @Test
     public void testGetMaxSqueezeRemeasureAttemptsWithValidConfig() {
-        overrideSetting("enabled=false,max_squeeze_remeasure_attempts=5");
+        overrideSetting(SystemUiDeviceConfigFlags.SSIN_MAX_SQUEEZE_REMEASURE_ATTEMPTS, "5");
         triggerConstantsOnChange();
         assertEquals(5, mConstants.getMaxSqueezeRemeasureAttempts());
     }
 
     @Test
     public void testGetEffectiveEditChoicesBeforeSendingWithNoConfig() {
-        overrideSetting("enabled=true");
         triggerConstantsOnChange();
         assertFalse(
                 mConstants.getEffectiveEditChoicesBeforeSending(
@@ -128,7 +137,7 @@
 
     @Test
     public void testGetEffectiveEditChoicesBeforeSendingWithEnabledConfig() {
-        overrideSetting("enabled=true,edit_choices_before_sending=true");
+        overrideSetting(SystemUiDeviceConfigFlags.SSIN_EDIT_CHOICES_BEFORE_SENDING, "true");
         triggerConstantsOnChange();
         assertTrue(
                 mConstants.getEffectiveEditChoicesBeforeSending(
@@ -143,7 +152,7 @@
 
     @Test
     public void testGetEffectiveEditChoicesBeforeSendingWithDisabledConfig() {
-        overrideSetting("enabled=true,edit_choices_before_sending=false");
+        overrideSetting(SystemUiDeviceConfigFlags.SSIN_EDIT_CHOICES_BEFORE_SENDING, "false");
         triggerConstantsOnChange();
         assertFalse(
                 mConstants.getEffectiveEditChoicesBeforeSending(
@@ -164,37 +173,19 @@
 
     @Test
     public void testShowInHeadsUpEnabled() {
-        overrideSetting("enabled=true,show_in_heads_up=true");
+        overrideSetting(SystemUiDeviceConfigFlags.SSIN_SHOW_IN_HEADS_UP, "true");
         triggerConstantsOnChange();
         assertTrue(mConstants.getShowInHeadsUp());
     }
 
     @Test
     public void testShowInHeadsUpDisabled() {
-        overrideSetting("enabled=true,show_in_heads_up=false");
+        overrideSetting(SystemUiDeviceConfigFlags.SSIN_SHOW_IN_HEADS_UP, "false");
         triggerConstantsOnChange();
         assertFalse(mConstants.getShowInHeadsUp());
     }
 
     @Test
-    public void testMaxNumActionsWithNoConfig() {
-        assertTrue(mConstants.isEnabled());
-        assertEquals(-1, mConstants.getMaxNumActions());
-    }
-
-    @Test
-    public void testMaxNumActionsSet() {
-        overrideSetting("enabled=true,max_num_actions=10");
-        triggerConstantsOnChange();
-        assertEquals(10, mConstants.getMaxNumActions());
-    }
-
-    private void overrideSetting(String flags) {
-        Settings.Global.putString(mContext.getContentResolver(),
-                Settings.Global.SMART_REPLIES_IN_NOTIFICATIONS_FLAGS, flags);
-    }
-
-    @Test
     public void testGetMinNumSystemGeneratedRepliesWithNoConfig() {
         assertTrue(mConstants.isEnabled());
         assertEquals(2, mConstants.getMinNumSystemGeneratedReplies());
@@ -202,15 +193,51 @@
 
     @Test
     public void testGetMinNumSystemGeneratedRepliesWithValidConfig() {
-        overrideSetting("enabled=true,min_num_system_generated_replies=5");
+        overrideSetting(SystemUiDeviceConfigFlags.SSIN_MIN_NUM_SYSTEM_GENERATED_REPLIES, "5");
         triggerConstantsOnChange();
         assertEquals(5, mConstants.getMinNumSystemGeneratedReplies());
     }
 
+    @Test
+    public void testMaxNumActionsWithNoConfig() {
+        assertTrue(mConstants.isEnabled());
+        assertEquals(-1, mConstants.getMaxNumActions());
+    }
+
+    @Test
+    public void testMaxNumActionsSet() {
+        overrideSetting(SystemUiDeviceConfigFlags.SSIN_MAX_NUM_ACTIONS, "10");
+        triggerConstantsOnChange();
+        assertEquals(10, mConstants.getMaxNumActions());
+    }
+
+    private void overrideSetting(String propertyName, String value) {
+        DeviceConfig.setProperty(DeviceConfig.NAMESPACE_SYSTEMUI,
+                propertyName, value, false /* makeDefault */);
+    }
+
     private void triggerConstantsOnChange() {
-        // Since Settings.Global is mocked in TestableContext, we need to manually trigger the
-        // content observer.
-        mConstants.onChange(false,
-                Settings.Global.getUriFor(Settings.Global.SMART_REPLIES_IN_NOTIFICATIONS_FLAGS));
+        mConstants.onDeviceConfigPropertyChanged(DeviceConfig.NAMESPACE_SYSTEMUI,
+                "" /* name */, "" /* value */);
+    }
+
+    private void resetAllDeviceConfigFlags() {
+        DeviceConfig.setProperty(DeviceConfig.NAMESPACE_SYSTEMUI,
+                SystemUiDeviceConfigFlags.SSIN_ENABLED, "", false /* makeDefault */);
+        DeviceConfig.setProperty(DeviceConfig.NAMESPACE_SYSTEMUI,
+                SystemUiDeviceConfigFlags.SSIN_REQUIRES_TARGETING_P, "", false /* makeDefault */);
+        DeviceConfig.setProperty(DeviceConfig.NAMESPACE_SYSTEMUI,
+                SystemUiDeviceConfigFlags.SSIN_MAX_SQUEEZE_REMEASURE_ATTEMPTS, "",
+                false /* makeDefault */);
+        DeviceConfig.setProperty(DeviceConfig.NAMESPACE_SYSTEMUI,
+                SystemUiDeviceConfigFlags.SSIN_EDIT_CHOICES_BEFORE_SENDING, "",
+                false /* makeDefault */);
+        DeviceConfig.setProperty(DeviceConfig.NAMESPACE_SYSTEMUI,
+                SystemUiDeviceConfigFlags.SSIN_SHOW_IN_HEADS_UP, "", false /* makeDefault */);
+        DeviceConfig.setProperty(DeviceConfig.NAMESPACE_SYSTEMUI,
+                SystemUiDeviceConfigFlags.SSIN_MIN_NUM_SYSTEM_GENERATED_REPLIES, "",
+                false /* makeDefault */);
+        DeviceConfig.setProperty(DeviceConfig.NAMESPACE_SYSTEMUI,
+                SystemUiDeviceConfigFlags.SSIN_MAX_NUM_ACTIONS, "", false /* makeDefault */);
     }
 }
diff --git a/packages/SystemUI/tests/src/com/android/systemui/statusbar/policy/SmartReplyViewTest.java b/packages/SystemUI/tests/src/com/android/systemui/statusbar/policy/SmartReplyViewTest.java
index 6793eca..0ce1df3 100644
--- a/packages/SystemUI/tests/src/com/android/systemui/statusbar/policy/SmartReplyViewTest.java
+++ b/packages/SystemUI/tests/src/com/android/systemui/statusbar/policy/SmartReplyViewTest.java
@@ -37,7 +37,6 @@
 import android.graphics.drawable.Drawable;
 import android.graphics.drawable.Icon;
 import android.service.notification.StatusBarNotification;
-import android.support.test.filters.SmallTest;
 import android.testing.AndroidTestingRunner;
 import android.testing.TestableLooper;
 import android.view.View;
@@ -45,6 +44,8 @@
 import android.widget.Button;
 import android.widget.LinearLayout;
 
+import androidx.test.filters.SmallTest;
+
 import com.android.internal.logging.nano.MetricsProto.MetricsEvent;
 import com.android.systemui.R;
 import com.android.systemui.SysuiTestCase;
@@ -113,7 +114,7 @@
         mDependency.injectTestDependency(SmartReplyConstants.class, mConstants);
 
         mContainer = new View(mContext, null);
-        mView = SmartReplyView.inflate(mContext, null);
+        mView = SmartReplyView.inflate(mContext);
 
         // Any number of replies are fine.
         when(mConstants.getMinNumSystemGeneratedReplies()).thenReturn(0);
@@ -402,17 +403,18 @@
     }
 
     private void setSmartReplies(CharSequence[] choices) {
-        setSmartReplies(choices, false /* fromAssistant */);
+        mView.resetSmartSuggestions(mContainer);
+        List<Button> replyButtons = inflateSmartReplies(choices, false /* fromAssistant */);
+        mView.addPreInflatedButtons(replyButtons);
     }
 
-    private void setSmartReplies(CharSequence[] choices, boolean fromAssistant) {
+    private List<Button> inflateSmartReplies(CharSequence[] choices, boolean fromAssistant) {
         PendingIntent pendingIntent = PendingIntent.getBroadcast(mContext, 0,
                 new Intent(TEST_ACTION), 0);
         RemoteInput input = new RemoteInput.Builder(TEST_RESULT_KEY).setChoices(choices).build();
         SmartReplyView.SmartReplies smartReplies =
                 new SmartReplyView.SmartReplies(choices, input, pendingIntent, fromAssistant);
-        mView.resetSmartSuggestions(mContainer);
-        mView.addRepliesFromRemoteInput(smartReplies, mLogger, mEntry);
+        return mView.inflateRepliesFromRemoteInput(smartReplies, mLogger, mEntry);
     }
 
     private Notification.Action createAction(String actionTitle) {
@@ -431,11 +433,12 @@
 
     private void setSmartActions(String[] actionTitles) {
         mView.resetSmartSuggestions(mContainer);
-        mView.addSmartActions(
+        List<Button> actions = mView.inflateSmartActions(
                 new SmartReplyView.SmartActions(createActions(actionTitles), false),
                 mLogger,
                 mEntry,
                 mHeadsUpManager);
+        mView.addPreInflatedButtons(actions);
     }
 
     private void setSmartRepliesAndActions(CharSequence[] choices, String[] actionTitles) {
@@ -444,12 +447,14 @@
 
     private void setSmartRepliesAndActions(
             CharSequence[] choices, String[] actionTitles, boolean fromAssistant) {
-        setSmartReplies(choices, fromAssistant);
-        mView.addSmartActions(
+        mView.resetSmartSuggestions(mContainer);
+        List<Button> smartSuggestions = inflateSmartReplies(choices, fromAssistant);
+        smartSuggestions.addAll(mView.inflateSmartActions(
                 new SmartReplyView.SmartActions(createActions(actionTitles), fromAssistant),
                 mLogger,
                 mEntry,
-                mHeadsUpManager);
+                mHeadsUpManager));
+        mView.addPreInflatedButtons(smartSuggestions);
     }
 
     private ViewGroup buildExpectedView(CharSequence[] choices, int lineCount) {
@@ -485,8 +490,8 @@
         SmartReplyView.SmartReplies smartReplies =
                 new SmartReplyView.SmartReplies(choices, null, null, false);
         for (int i = 0; i < choices.length; ++i) {
-            Button current = mView.inflateReplyButton(mContext, mView, i, smartReplies,
-                    null, null);
+            Button current = SmartReplyView.inflateReplyButton(mView, mContext, i, smartReplies,
+                    null /* SmartReplyController */, null /* NotificationEntry */);
             current.setPadding(paddingHorizontal, current.getPaddingTop(), paddingHorizontal,
                     current.getPaddingBottom());
             if (previous != null) {
@@ -752,7 +757,7 @@
     }
 
     private Button inflateActionButton(Notification.Action action) {
-        return mView.inflateActionButton(getContext(), mView, 0,
+        return SmartReplyView.inflateActionButton(mView, getContext(), 0,
                 new SmartReplyView.SmartActions(Collections.singletonList(action), false),
                 mLogger, mEntry, mHeadsUpManager);
     }
diff --git a/packages/SystemUI/tests/src/com/android/systemui/statusbar/policy/ZenModeControllerImplTest.java b/packages/SystemUI/tests/src/com/android/systemui/statusbar/policy/ZenModeControllerImplTest.java
index 8f5f072..47e4492 100644
--- a/packages/SystemUI/tests/src/com/android/systemui/statusbar/policy/ZenModeControllerImplTest.java
+++ b/packages/SystemUI/tests/src/com/android/systemui/statusbar/policy/ZenModeControllerImplTest.java
@@ -27,10 +27,11 @@
 import android.os.Looper;
 import android.provider.Settings;
 import android.service.notification.ZenModeConfig;
-import android.support.test.filters.SmallTest;
 import android.testing.AndroidTestingRunner;
 import android.testing.TestableLooper.RunWithLooper;
 
+import androidx.test.filters.SmallTest;
+
 import com.android.systemui.SysuiTestCase;
 import com.android.systemui.statusbar.policy.ZenModeController.Callback;
 
diff --git a/packages/SystemUI/tests/src/com/android/systemui/tuner/TunablePaddingTest.java b/packages/SystemUI/tests/src/com/android/systemui/tuner/TunablePaddingTest.java
index 1e27915..683397e 100644
--- a/packages/SystemUI/tests/src/com/android/systemui/tuner/TunablePaddingTest.java
+++ b/packages/SystemUI/tests/src/com/android/systemui/tuner/TunablePaddingTest.java
@@ -20,14 +20,14 @@
 import static org.mockito.Mockito.mock;
 import static org.mockito.Mockito.verify;
 import static org.mockito.Mockito.when;
-import static org.mockito.Mockito.withSettings;
 
-import android.support.test.filters.SmallTest;
 import android.testing.LeakCheck.Tracker;
 import android.util.DisplayMetrics;
 import android.view.View;
 import android.view.WindowManager;
 
+import androidx.test.filters.SmallTest;
+
 import com.android.systemui.utils.leaks.LeakCheckedTest;
 
 import org.junit.Before;
diff --git a/packages/SystemUI/tests/src/com/android/systemui/util/AsyncSensorManagerTest.java b/packages/SystemUI/tests/src/com/android/systemui/util/AsyncSensorManagerTest.java
index 77df791..4a9b1b3 100644
--- a/packages/SystemUI/tests/src/com/android/systemui/util/AsyncSensorManagerTest.java
+++ b/packages/SystemUI/tests/src/com/android/systemui/util/AsyncSensorManagerTest.java
@@ -25,9 +25,10 @@
 
 import android.hardware.SensorEventListener;
 import android.hardware.SensorManager;
-import android.support.test.filters.SmallTest;
 import android.testing.AndroidTestingRunner;
 
+import androidx.test.filters.SmallTest;
+
 import com.android.systemui.SysuiTestCase;
 import com.android.systemui.plugins.SensorManagerPlugin;
 import com.android.systemui.shared.plugins.PluginManager;
diff --git a/packages/SystemUI/tests/src/com/android/systemui/util/ChannelsTest.java b/packages/SystemUI/tests/src/com/android/systemui/util/ChannelsTest.java
index 0d398be..f1c9980 100644
--- a/packages/SystemUI/tests/src/com/android/systemui/util/ChannelsTest.java
+++ b/packages/SystemUI/tests/src/com/android/systemui/util/ChannelsTest.java
@@ -15,22 +15,19 @@
 package com.android.systemui.util;
 
 import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertNull;
 import static org.junit.Assert.assertTrue;
-import static org.mockito.Matchers.eq;
 import static org.mockito.Mockito.mock;
 import static org.mockito.Mockito.verify;
-import static org.mockito.Mockito.when;
 
-import android.app.Notification;
 import android.app.NotificationChannel;
 import android.app.NotificationManager;
 import android.content.Context;
-import android.net.Uri;
 import android.provider.Settings;
-import android.support.test.runner.AndroidJUnit4;
 import android.test.suitebuilder.annotation.SmallTest;
 import android.util.ArraySet;
+
+import androidx.test.runner.AndroidJUnit4;
+
 import com.android.systemui.SysuiTestCase;
 import com.android.systemui.util.NotificationChannels;
 
diff --git a/packages/SystemUI/tests/src/com/android/systemui/util/LifecycleFragmentTest.java b/packages/SystemUI/tests/src/com/android/systemui/util/LifecycleFragmentTest.java
index d4e38d8..0e1c560 100644
--- a/packages/SystemUI/tests/src/com/android/systemui/util/LifecycleFragmentTest.java
+++ b/packages/SystemUI/tests/src/com/android/systemui/util/LifecycleFragmentTest.java
@@ -27,12 +27,12 @@
 import static org.mockito.Mockito.mock;
 import static org.mockito.Mockito.verify;
 
-import android.support.test.filters.SmallTest;
 import android.testing.AndroidTestingRunner;
 import android.testing.TestableLooper;
 import android.testing.TestableLooper.RunWithLooper;
 
 import androidx.lifecycle.LifecycleEventObserver;
+import androidx.test.filters.SmallTest;
 
 import com.android.systemui.SysuiBaseFragmentTest;
 
diff --git a/packages/SystemUI/tests/src/com/android/systemui/util/SysuiLifecycleTest.java b/packages/SystemUI/tests/src/com/android/systemui/util/SysuiLifecycleTest.java
index d63bbe6..ce8085a 100644
--- a/packages/SystemUI/tests/src/com/android/systemui/util/SysuiLifecycleTest.java
+++ b/packages/SystemUI/tests/src/com/android/systemui/util/SysuiLifecycleTest.java
@@ -29,7 +29,6 @@
 import static org.mockito.Mockito.mock;
 import static org.mockito.Mockito.verify;
 
-import android.support.test.filters.SmallTest;
 import android.testing.AndroidTestingRunner;
 import android.testing.TestableLooper;
 import android.testing.TestableLooper.RunWithLooper;
@@ -38,6 +37,7 @@
 
 import androidx.lifecycle.LifecycleEventObserver;
 import androidx.lifecycle.LifecycleOwner;
+import androidx.test.filters.SmallTest;
 
 import com.android.systemui.SysuiTestCase;
 
diff --git a/packages/SystemUI/tests/src/com/android/systemui/util/leak/GarbageMonitorTest.java b/packages/SystemUI/tests/src/com/android/systemui/util/leak/GarbageMonitorTest.java
index c095472..bcc20c2 100644
--- a/packages/SystemUI/tests/src/com/android/systemui/util/leak/GarbageMonitorTest.java
+++ b/packages/SystemUI/tests/src/com/android/systemui/util/leak/GarbageMonitorTest.java
@@ -24,11 +24,12 @@
 
 import android.content.Context;
 import android.os.Looper;
-import android.support.test.filters.SmallTest;
 import android.testing.AndroidTestingRunner;
 import android.testing.TestableLooper;
 import android.testing.TestableLooper.RunWithLooper;
 
+import androidx.test.filters.SmallTest;
+
 import com.android.systemui.SysuiTestCase;
 
 import org.junit.Before;
diff --git a/packages/SystemUI/tests/src/com/android/systemui/util/leak/LeakDetectorTest.java b/packages/SystemUI/tests/src/com/android/systemui/util/leak/LeakDetectorTest.java
index 11bb398..c68c920 100644
--- a/packages/SystemUI/tests/src/com/android/systemui/util/leak/LeakDetectorTest.java
+++ b/packages/SystemUI/tests/src/com/android/systemui/util/leak/LeakDetectorTest.java
@@ -17,8 +17,8 @@
 package com.android.systemui.util.leak;
 
 
-import android.support.test.filters.SmallTest;
-import android.support.test.runner.AndroidJUnit4;
+import androidx.test.filters.SmallTest;
+import androidx.test.runner.AndroidJUnit4;
 
 import com.android.systemui.SysuiTestCase;
 import com.android.systemui.util.leak.ReferenceTestUtils.CollectionWaiter;
@@ -28,8 +28,6 @@
 import org.junit.Test;
 import org.junit.runner.RunWith;
 
-import java.io.FileDescriptor;
-import java.io.FileNotFoundException;
 import java.io.FileOutputStream;
 import java.io.PrintWriter;
 import java.util.ArrayList;
diff --git a/packages/SystemUI/tests/src/com/android/systemui/util/leak/LeakReporterTest.java b/packages/SystemUI/tests/src/com/android/systemui/util/leak/LeakReporterTest.java
index 6711ce8..abec80e 100644
--- a/packages/SystemUI/tests/src/com/android/systemui/util/leak/LeakReporterTest.java
+++ b/packages/SystemUI/tests/src/com/android/systemui/util/leak/LeakReporterTest.java
@@ -24,8 +24,9 @@
 import static org.mockito.Mockito.verify;
 
 import android.app.NotificationManager;
-import android.support.test.filters.MediumTest;
-import android.support.test.runner.AndroidJUnit4;
+
+import androidx.test.filters.MediumTest;
+import androidx.test.runner.AndroidJUnit4;
 
 import com.android.systemui.SysuiTestCase;
 
diff --git a/packages/SystemUI/tests/src/com/android/systemui/util/leak/ReferenceTestUtilsTest.java b/packages/SystemUI/tests/src/com/android/systemui/util/leak/ReferenceTestUtilsTest.java
index b8a3e39..726187d 100644
--- a/packages/SystemUI/tests/src/com/android/systemui/util/leak/ReferenceTestUtilsTest.java
+++ b/packages/SystemUI/tests/src/com/android/systemui/util/leak/ReferenceTestUtilsTest.java
@@ -18,8 +18,8 @@
 
 import static org.junit.Assert.assertEquals;
 
-import android.support.test.filters.SmallTest;
-import android.support.test.runner.AndroidJUnit4;
+import androidx.test.filters.SmallTest;
+import androidx.test.runner.AndroidJUnit4;
 
 import com.android.systemui.SysuiTestCase;
 
diff --git a/packages/SystemUI/tests/src/com/android/systemui/util/leak/WeakIdentityHashMapTest.java b/packages/SystemUI/tests/src/com/android/systemui/util/leak/WeakIdentityHashMapTest.java
index ce6212e..2b28e2f 100644
--- a/packages/SystemUI/tests/src/com/android/systemui/util/leak/WeakIdentityHashMapTest.java
+++ b/packages/SystemUI/tests/src/com/android/systemui/util/leak/WeakIdentityHashMapTest.java
@@ -20,8 +20,8 @@
 import static org.junit.Assert.assertNotSame;
 import static org.junit.Assert.assertTrue;
 
-import android.support.test.filters.SmallTest;
-import android.support.test.runner.AndroidJUnit4;
+import androidx.test.filters.SmallTest;
+import androidx.test.runner.AndroidJUnit4;
 
 import com.android.systemui.SysuiTestCase;
 import com.android.systemui.util.leak.ReferenceTestUtils.CollectionWaiter;
diff --git a/packages/SystemUI/tests/src/com/android/systemui/util/wakelock/KeepAwakeAnimationListenerTest.java b/packages/SystemUI/tests/src/com/android/systemui/util/wakelock/KeepAwakeAnimationListenerTest.java
index 0792a05..20dcbb7 100644
--- a/packages/SystemUI/tests/src/com/android/systemui/util/wakelock/KeepAwakeAnimationListenerTest.java
+++ b/packages/SystemUI/tests/src/com/android/systemui/util/wakelock/KeepAwakeAnimationListenerTest.java
@@ -22,10 +22,11 @@
 
 import android.animation.Animator;
 import android.os.Looper;
-import android.support.test.filters.SmallTest;
 import android.testing.AndroidTestingRunner;
 import android.testing.TestableLooper;
 
+import androidx.test.filters.SmallTest;
+
 import com.android.systemui.SysuiTestCase;
 import com.android.systemui.util.Assert;
 
diff --git a/packages/SystemUI/tests/src/com/android/systemui/util/wakelock/SettableWakeLockTest.java b/packages/SystemUI/tests/src/com/android/systemui/util/wakelock/SettableWakeLockTest.java
index f739fe6..d0eaaf5 100644
--- a/packages/SystemUI/tests/src/com/android/systemui/util/wakelock/SettableWakeLockTest.java
+++ b/packages/SystemUI/tests/src/com/android/systemui/util/wakelock/SettableWakeLockTest.java
@@ -21,8 +21,8 @@
 import static org.junit.Assert.assertEquals;
 import static org.junit.Assert.assertFalse;
 
-import android.support.test.filters.SmallTest;
-import android.support.test.runner.AndroidJUnit4;
+import androidx.test.filters.SmallTest;
+import androidx.test.runner.AndroidJUnit4;
 
 import com.android.systemui.SysuiTestCase;
 
diff --git a/packages/SystemUI/tests/src/com/android/systemui/util/wakelock/WakeLockTest.java b/packages/SystemUI/tests/src/com/android/systemui/util/wakelock/WakeLockTest.java
index 4425def..66eb299 100644
--- a/packages/SystemUI/tests/src/com/android/systemui/util/wakelock/WakeLockTest.java
+++ b/packages/SystemUI/tests/src/com/android/systemui/util/wakelock/WakeLockTest.java
@@ -20,8 +20,9 @@
 import static org.junit.Assert.assertTrue;
 
 import android.os.PowerManager;
-import android.support.test.filters.SmallTest;
-import android.support.test.runner.AndroidJUnit4;
+
+import androidx.test.filters.SmallTest;
+import androidx.test.runner.AndroidJUnit4;
 
 import com.android.systemui.SysuiTestCase;
 
diff --git a/packages/SystemUI/tests/src/com/android/systemui/volume/UtilTest.java b/packages/SystemUI/tests/src/com/android/systemui/volume/UtilTest.java
index 6b20a1e..fb82b8f 100644
--- a/packages/SystemUI/tests/src/com/android/systemui/volume/UtilTest.java
+++ b/packages/SystemUI/tests/src/com/android/systemui/volume/UtilTest.java
@@ -16,7 +16,8 @@
 package com.android.systemui.volume;
 
 import android.media.MediaMetadata;
-import android.support.test.filters.SmallTest;
+
+import androidx.test.filters.SmallTest;
 
 import com.android.systemui.SysuiTestCase;
 
diff --git a/packages/SystemUI/tests/src/com/android/systemui/volume/VolumeDialogControllerImplTest.java b/packages/SystemUI/tests/src/com/android/systemui/volume/VolumeDialogControllerImplTest.java
index a4ed459..f4d0854 100644
--- a/packages/SystemUI/tests/src/com/android/systemui/volume/VolumeDialogControllerImplTest.java
+++ b/packages/SystemUI/tests/src/com/android/systemui/volume/VolumeDialogControllerImplTest.java
@@ -25,7 +25,9 @@
 import android.content.Context;
 import android.media.AudioManager;
 import android.media.session.MediaSession;
-import android.support.test.filters.SmallTest;
+
+import androidx.test.filters.SmallTest;
+
 import com.android.systemui.SysuiTestCase;
 import com.android.systemui.keyguard.WakefulnessLifecycle;
 import com.android.systemui.statusbar.phone.StatusBar;
diff --git a/packages/SystemUI/tests/src/com/android/systemui/volume/VolumeDialogImplTest.java b/packages/SystemUI/tests/src/com/android/systemui/volume/VolumeDialogImplTest.java
index 5f02fad..617c17e 100644
--- a/packages/SystemUI/tests/src/com/android/systemui/volume/VolumeDialogImplTest.java
+++ b/packages/SystemUI/tests/src/com/android/systemui/volume/VolumeDialogImplTest.java
@@ -16,37 +16,26 @@
 
 package com.android.systemui.volume;
 
-import static android.media.AudioManager.RINGER_MODE_NORMAL;
-import static android.media.AudioManager.RINGER_MODE_SILENT;
-import static android.media.AudioManager.RINGER_MODE_VIBRATE;
-import static android.media.AudioManager.STREAM_RING;
-
-import static com.android.systemui.volume.Events.DISMISS_REASON_UNKNOWN;
-import static com.android.systemui.volume.Events.SHOW_REASON_UNKNOWN;
 import static com.android.systemui.volume.VolumeDialogControllerImpl.STREAMS;
 
 import static junit.framework.Assert.assertTrue;
 
 import static org.mockito.ArgumentMatchers.any;
-import static org.mockito.Mockito.times;
 import static org.mockito.Mockito.verify;
-import static org.mockito.Mockito.when;
 
 import android.app.KeyguardManager;
 import android.media.AudioManager;
 import android.os.SystemClock;
-import android.support.test.filters.SmallTest;
 import android.testing.AndroidTestingRunner;
 import android.testing.TestableLooper;
-import android.text.TextUtils;
 import android.view.InputDevice;
 import android.view.MotionEvent;
 import android.view.View;
 import android.view.ViewGroup;
 import android.view.accessibility.AccessibilityManager;
-import android.widget.ImageView;
 
-import com.android.systemui.R;
+import androidx.test.filters.SmallTest;
+
 import com.android.systemui.SysuiTestCase;
 import com.android.systemui.plugins.VolumeDialogController;
 import com.android.systemui.plugins.VolumeDialogController.State;
diff --git a/packages/overlays/Android.mk b/packages/overlays/Android.mk
index 7ce13c2..a15e89c 100644
--- a/packages/overlays/Android.mk
+++ b/packages/overlays/Android.mk
@@ -25,12 +25,15 @@
 	DisplayCutoutEmulationTallOverlay \
 	FontNotoSerifSourceOverlay \
 	IconPackCircularAndroidOverlay \
+	IconPackCircularLauncherOverlay \
 	IconPackCircularSettingsOverlay \
 	IconPackCircularSystemUIOverlay \
 	IconPackFilledAndroidOverlay \
+	IconPackFilledLauncherOverlay \
 	IconPackFilledSettingsOverlay \
 	IconPackFilledSystemUIOverlay \
 	IconPackRoundedAndroidOverlay \
+	IconPackRoundedLauncherOverlay \
 	IconPackRoundedSettingsOverlay \
 	IconPackRoundedSystemUIOverlay \
 	IconShapeRoundedRectOverlay \
diff --git a/tests/LowStorageTest/Android.mk b/packages/overlays/IconPackCircularLauncherOverlay/Android.mk
similarity index 68%
rename from tests/LowStorageTest/Android.mk
rename to packages/overlays/IconPackCircularLauncherOverlay/Android.mk
index bdde6bd..a5277fa 100644
--- a/tests/LowStorageTest/Android.mk
+++ b/packages/overlays/IconPackCircularLauncherOverlay/Android.mk
@@ -1,26 +1,31 @@
-# Copyright (C) 2009 The Android Open Source Project
+#
+#  Copyright 2019, 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
+#     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.
+#
 
 LOCAL_PATH:= $(call my-dir)
 include $(CLEAR_VARS)
 
-LOCAL_MODULE_TAGS := tests
+LOCAL_RRO_THEME := IconPackCircularLauncher
 LOCAL_CERTIFICATE := platform
+LOCAL_PRODUCT_MODULE := true
 
 LOCAL_SRC_FILES := $(call all-subdir-java-files)
 
-LOCAL_PACKAGE_NAME := lowstoragetest
+LOCAL_RESOURCE_DIR := $(LOCAL_PATH)/res
+
+LOCAL_PACKAGE_NAME := IconPackCircularLauncherOverlay
 LOCAL_SDK_VERSION := current
 
-include $(BUILD_PACKAGE)
+include $(BUILD_RRO_PACKAGE)
diff --git a/packages/overlays/IconPackCircularLauncherOverlay/AndroidManifest.xml b/packages/overlays/IconPackCircularLauncherOverlay/AndroidManifest.xml
new file mode 100644
index 0000000..0b69eca
--- /dev/null
+++ b/packages/overlays/IconPackCircularLauncherOverlay/AndroidManifest.xml
@@ -0,0 +1,24 @@
+<!--
+/**
+ * Copyright (c) 2019, 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.
+ */
+-->
+<manifest xmlns:android="http://schemas.android.com/apk/res/android"
+    package="com.android.theme.icon_pack.circular.launcher"
+    android:versionCode="1"
+    android:versionName="1.0">
+    <overlay android:targetPackage="com.android.launcher3" android:category="android.theme.customization.icon_pack.launcher" android:priority="1"/>
+    <application android:label="Circular" android:hasCode="false"/>
+</manifest>
diff --git a/packages/overlays/IconPackCircularLauncherOverlay/res/drawable/ic_clear.xml b/packages/overlays/IconPackCircularLauncherOverlay/res/drawable/ic_clear.xml
new file mode 100644
index 0000000..74ed9ed
--- /dev/null
+++ b/packages/overlays/IconPackCircularLauncherOverlay/res/drawable/ic_clear.xml
@@ -0,0 +1,32 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!--
+    Copyright (C) 2019 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="#000000"
+        android:pathData="M9,20h6c1.66,0,3-1.34,3-3V6h0.5c0.41,0,0.75-0.34,0.75-0.75S18.91,4.5,18.5,4.5H18h-3l-1-1h-4l-1,1H6H5.5 c-0.41,0-0.75,0.34-0.75,0.75S5.09,6,5.5,6H6v11C6,18.66,7.34,20,9,20z M16.5,6v11c0,0.83-0.67,1.5-1.5,1.5H9 c-0.83,0-1.5-0.67-1.5-1.5V6H16.5z" />
+    <path
+        android:fillColor="#000000"
+        android:pathData="M13.97,16c0.41,0,0.75-0.34,0.75-0.75v-6.5c0-0.41-0.34-0.75-0.75-0.75s-0.75,0.34-0.75,0.75v6.5 C13.22,15.66,13.55,16,13.97,16z" />
+    <path
+        android:fillColor="#000000"
+        android:pathData="M10,16c0.41,0,0.75-0.34,0.75-0.75v-6.5C10.75,8.34,10.41,8,10,8S9.25,8.34,9.25,8.75v6.5C9.25,15.66,9.59,16,10,16z" />
+</vector>
\ No newline at end of file
diff --git a/packages/overlays/IconPackCircularLauncherOverlay/res/drawable/ic_corp.xml b/packages/overlays/IconPackCircularLauncherOverlay/res/drawable/ic_corp.xml
new file mode 100644
index 0000000..6c4e1de
--- /dev/null
+++ b/packages/overlays/IconPackCircularLauncherOverlay/res/drawable/ic_corp.xml
@@ -0,0 +1,26 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!--
+    Copyright (C) 2019 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="#000000"
+        android:pathData="M16,4c0-1.1-0.9-2-2-2h-4C8.9,2,8,2.9,8,4v2H2v12c0,1.66,1.34,3,3,3h14c1.66,0,3-1.34,3-3V6h-6V4z M9.5,4 c0-0.28,0.22-0.5,0.5-0.5h4c0.28,0,0.5,0.22,0.5,0.5v2h-5V4z M20.5,7.5V18c0,0.83-0.67,1.5-1.5,1.5H5c-0.83,0-1.5-0.67-1.5-1.5V7.5 H20.5z" />
+</vector>
\ No newline at end of file
diff --git a/packages/overlays/IconPackCircularLauncherOverlay/res/drawable/ic_empty_recents.xml b/packages/overlays/IconPackCircularLauncherOverlay/res/drawable/ic_empty_recents.xml
new file mode 100644
index 0000000..7e363f6
--- /dev/null
+++ b/packages/overlays/IconPackCircularLauncherOverlay/res/drawable/ic_empty_recents.xml
@@ -0,0 +1,32 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!--
+    Copyright (C) 2019 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="#000000"
+        android:pathData="M17,18V6c0-1.1-0.9-2-2-2H9C7.9,4,7,4.9,7,6v12c0,1.1,0.9,2,2,2h6C16.1,20,17,19.1,17,18z M8.5,18V6 c0-0.28,0.22-0.5,0.5-0.5h6c0.28,0,0.5,0.22,0.5,0.5v12c0,0.28-0.22,0.5-0.5,0.5H9C8.72,18.5,8.5,18.28,8.5,18z" />
+    <path
+        android:fillColor="#000000"
+        android:pathData="M21,7h-2c-0.55,0-1,0.45-1,1v8c0,0.55,0.45,1,1,1h2c0.55,0,1-0.45,1-1V8C22,7.45,21.55,7,21,7z M20.5,15.5h-1v-7h1V15.5z" />
+    <path
+        android:fillColor="#000000"
+        android:pathData="M5,17c0.55,0,1-0.45,1-1V8c0-0.55-0.45-1-1-1H3C2.45,7,2,7.45,2,8v8c0,0.55,0.45,1,1,1H5z M3.5,8.5h1v7h-1V8.5z" />
+</vector>
\ No newline at end of file
diff --git a/packages/overlays/IconPackCircularLauncherOverlay/res/drawable/ic_info_no_shadow.xml b/packages/overlays/IconPackCircularLauncherOverlay/res/drawable/ic_info_no_shadow.xml
new file mode 100644
index 0000000..e4bc8e6
--- /dev/null
+++ b/packages/overlays/IconPackCircularLauncherOverlay/res/drawable/ic_info_no_shadow.xml
@@ -0,0 +1,32 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!--
+    Copyright (C) 2019 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="#000000"
+        android:pathData="M11.99,2C6.47,2,2,6.48,2,12c0,5.52,4.47,10,9.99,10C17.52,22,22,17.52,22,12C22,6.48,17.52,2,11.99,2z M11.99,20.5 c-4.68,0-8.49-3.81-8.49-8.5c0-4.69,3.81-8.5,8.49-8.5c4.69,0,8.51,3.81,8.51,8.5C20.5,16.69,16.68,20.5,11.99,20.5z" />
+    <path
+        android:fillColor="#000000"
+        android:pathData="M12,10.5c-0.41,0-0.75,0.34-0.75,0.75v5c0,0.41,0.34,0.75,0.75,0.75s0.75-0.34,0.75-0.75v-5 C12.75,10.84,12.41,10.5,12,10.5z" />
+    <path
+        android:fillColor="#000000"
+        android:pathData="M 12 7 C 12.5522847498 7 13 7.44771525017 13 8 C 13 8.55228474983 12.5522847498 9 12 9 C 11.4477152502 9 11 8.55228474983 11 8 C 11 7.44771525017 11.4477152502 7 12 7 Z" />
+</vector>
\ No newline at end of file
diff --git a/packages/overlays/IconPackCircularLauncherOverlay/res/drawable/ic_remove_no_shadow.xml b/packages/overlays/IconPackCircularLauncherOverlay/res/drawable/ic_remove_no_shadow.xml
new file mode 100644
index 0000000..c104e3e
--- /dev/null
+++ b/packages/overlays/IconPackCircularLauncherOverlay/res/drawable/ic_remove_no_shadow.xml
@@ -0,0 +1,26 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!--
+    Copyright (C) 2019 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="#000000"
+        android:pathData="M3.97,20.03c0.15,0.15,0.34,0.22,0.53,0.22s0.38-0.07,0.53-0.22L12,13.06l6.97,6.97c0.15,0.15,0.34,0.22,0.53,0.22 s0.38-0.07,0.53-0.22c0.29-0.29,0.29-0.77,0-1.06L13.06,12l6.97-6.97c0.29-0.29,0.29-0.77,0-1.06s-0.77-0.29-1.06,0L12,10.94 L5.03,3.97c-0.29-0.29-0.77-0.29-1.06,0s-0.29,0.77,0,1.06L10.94,12l-6.97,6.97C3.68,19.26,3.68,19.74,3.97,20.03z" />
+</vector>
\ No newline at end of file
diff --git a/packages/overlays/IconPackCircularLauncherOverlay/res/drawable/ic_setting.xml b/packages/overlays/IconPackCircularLauncherOverlay/res/drawable/ic_setting.xml
new file mode 100644
index 0000000..e526329
--- /dev/null
+++ b/packages/overlays/IconPackCircularLauncherOverlay/res/drawable/ic_setting.xml
@@ -0,0 +1,26 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!--
+    Copyright (C) 2019 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="#000000"
+        android:pathData="M12,8.5c-1.93,0-3.5,1.57-3.5,3.5s1.57,3.5,3.5,3.5c1.93,0,3.5-1.57,3.5-3.5S13.93,8.5,12,8.5z M12,14c-1.1,0-2-0.9-2-2 s0.9-2,2-2c1.1,0,2,0.9,2,2S13.1,14,12,14z M21.29,13.9l-1.83-1.05c-0.3-0.17-0.49-0.49-0.48-0.84v-0.01 c0-0.35,0.18-0.67,0.48-0.84l1.83-1.05c0.48-0.28,0.64-0.89,0.37-1.37l-2-3.46c-0.19-0.32-0.52-0.5-0.87-0.5 c-0.17,0-0.34,0.04-0.5,0.13l-1.84,1.06c-0.14,0.08-0.29,0.12-0.45,0.12c-0.17,0-0.35-0.05-0.5-0.14c0,0-0.01,0-0.01-0.01 C15.2,5.77,15,5.47,15,5.12V3c0-0.55-0.45-1-1-1h-4C9.45,2,9,2.45,9,3v2.12c0,0.34-0.2,0.65-0.5,0.82c0,0-0.01,0-0.01,0.01 c-0.16,0.09-0.33,0.14-0.5,0.14c-0.15,0-0.31-0.04-0.45-0.12L5.71,4.9c-0.16-0.09-0.33-0.13-0.5-0.13c-0.35,0-0.68,0.18-0.87,0.5 l-2,3.46C2.06,9.21,2.23,9.82,2.71,10.1l1.83,1.05c0.3,0.17,0.49,0.49,0.48,0.84v0.01c0,0.35-0.18,0.67-0.48,0.84L2.71,13.9 c-0.48,0.28-0.64,0.89-0.37,1.37l2,3.46c0.19,0.32,0.52,0.5,0.87,0.5c0.17,0,0.34-0.04,0.5-0.13l1.84-1.06 c0.14-0.08,0.29-0.12,0.45-0.12c0.17,0,0.35,0.05,0.5,0.14c0,0,0.01,0,0.01,0.01C8.8,18.23,9,18.53,9,18.88V21c0,0.55,0.45,1,1,1h4 c0.55,0,1-0.45,1-1v-2.12c0-0.34,0.2-0.65,0.5-0.82c0,0,0.01,0,0.01-0.01c0.16-0.09,0.33-0.14,0.5-0.14c0.15,0,0.31,0.04,0.45,0.12 l1.84,1.06c0.16,0.09,0.33,0.13,0.5,0.13c0.35,0,0.68-0.18,0.87-0.5l2-3.46C21.94,14.79,21.77,14.18,21.29,13.9z M18.61,17.55 l-1.41-0.81c-0.36-0.21-0.78-0.32-1.2-0.32c-0.43,0-0.86,0.12-1.25,0.34c-0.77,0.44-1.25,1.25-1.25,2.12v1.62h-3v-1.62 c0-0.87-0.48-1.68-1.26-2.12c-0.38-0.22-0.81-0.33-1.25-0.33c-0.42,0-0.84,0.11-1.2,0.32l-1.41,0.81l-1.5-2.6l1.39-0.8 c0.76-0.44,1.24-1.26,1.23-2.15c0-0.88-0.47-1.7-1.23-2.14l-1.39-0.8l1.5-2.6L6.8,7.26c0.36,0.21,0.78,0.32,1.2,0.32 c0.43,0,0.86-0.12,1.25-0.34c0.77-0.44,1.25-1.25,1.25-2.12V3.5h3v1.62c0,0.87,0.48,1.68,1.26,2.12c0.38,0.22,0.81,0.33,1.25,0.33 c0.42,0,0.84-0.11,1.2-0.32l1.41-0.81l1.5,2.6l-1.39,0.8c-0.76,0.44-1.24,1.26-1.23,2.15c0,0.88,0.47,1.7,1.23,2.14l1.39,0.8 L18.61,17.55z" />
+</vector>
\ No newline at end of file
diff --git a/packages/overlays/IconPackCircularLauncherOverlay/res/drawable/ic_smartspace_preferences.xml b/packages/overlays/IconPackCircularLauncherOverlay/res/drawable/ic_smartspace_preferences.xml
new file mode 100644
index 0000000..78de832
--- /dev/null
+++ b/packages/overlays/IconPackCircularLauncherOverlay/res/drawable/ic_smartspace_preferences.xml
@@ -0,0 +1,26 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!--
+    Copyright (C) 2019 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="#000000"
+        android:pathData="M15.08,8.01c-0.39-0.39-0.91-0.59-1.42-0.59c-0.51,0-1.02,0.2-1.41,0.59L0.59,19.67l3.75,3.75l11.66-11.66 c0.78-0.78,0.78-2.04,0.01-2.82L15.08,8.01z M4.34,21.29l-1.63-1.63l7.45-7.45l1.63,1.63L4.34,21.29z M14.93,10.7l-2.09,2.09 l-1.63-1.63l2.09-2.09c0.13-0.13,0.28-0.15,0.35-0.15c0.08,0,0.23,0.02,0.36,0.15l0.92,0.93C15.13,10.18,15.13,10.5,14.93,10.7z M17.67,5.25h1.08v1.08c0,0.41,0.34,0.75,0.75,0.75s0.75-0.34,0.75-0.75V5.25h1.08c0.41,0,0.75-0.34,0.75-0.75 s-0.34-0.75-0.75-0.75h-1.08V2.67c0-0.41-0.34-0.75-0.75-0.75s-0.75,0.34-0.75,0.75v1.08h-1.08c-0.41,0-0.75,0.34-0.75,0.75 S17.26,5.25,17.67,5.25z M5.67,5.25h1.08v1.08c0,0.41,0.34,0.75,0.75,0.75s0.75-0.34,0.75-0.75V5.25h1.08 c0.41,0,0.75-0.34,0.75-0.75S9.74,3.75,9.33,3.75H8.25V2.67c0-0.41-0.34-0.75-0.75-0.75S6.75,2.26,6.75,2.67v1.08H5.67 c-0.41,0-0.75,0.34-0.75,0.75S5.26,5.25,5.67,5.25z M21.33,15.75h-1.08v-1.08c0-0.41-0.34-0.75-0.75-0.75s-0.75,0.34-0.75,0.75 v1.08h-1.08c-0.41,0-0.75,0.34-0.75,0.75s0.34,0.75,0.75,0.75h1.08v1.08c0,0.41,0.34,0.75,0.75,0.75s0.75-0.34,0.75-0.75v-1.08 h1.08c0.41,0,0.75-0.34,0.75-0.75S21.74,15.75,21.33,15.75z" />
+</vector>
\ No newline at end of file
diff --git a/packages/overlays/IconPackCircularLauncherOverlay/res/drawable/ic_split_screen.xml b/packages/overlays/IconPackCircularLauncherOverlay/res/drawable/ic_split_screen.xml
new file mode 100644
index 0000000..11f0b4b
--- /dev/null
+++ b/packages/overlays/IconPackCircularLauncherOverlay/res/drawable/ic_split_screen.xml
@@ -0,0 +1,29 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!--
+    Copyright (C) 2019 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="#000000"
+        android:pathData="M4,6v3c0,1.1,0.9,2,2,2h12c1.1,0,2-0.9,2-2V6c0-1.1-0.9-2-2-2H6C4.9,4,4,4.9,4,6z M18.5,6v3c0,0.28-0.22,0.5-0.5,0.5H6 C5.72,9.5,5.5,9.28,5.5,9V6c0-0.28,0.22-0.5,0.5-0.5h12C18.28,5.5,18.5,5.72,18.5,6z" />
+    <path
+        android:fillColor="#000000"
+        android:pathData="M4,18c0,1.1,0.9,2,2,2h12c1.1,0,2-0.9,2-2v-3c0-1.1-0.9-2-2-2H6c-1.1,0-2,0.9-2,2V18z M5.5,15c0-0.28,0.22-0.5,0.5-0.5h12 c0.28,0,0.5,0.22,0.5,0.5v3c0,0.28-0.22,0.5-0.5,0.5H6c-0.28,0-0.5-0.22-0.5-0.5V15z" />
+</vector>
\ No newline at end of file
diff --git a/packages/overlays/IconPackCircularLauncherOverlay/res/drawable/ic_wallpaper.xml b/packages/overlays/IconPackCircularLauncherOverlay/res/drawable/ic_wallpaper.xml
new file mode 100644
index 0000000..3834fb6
--- /dev/null
+++ b/packages/overlays/IconPackCircularLauncherOverlay/res/drawable/ic_wallpaper.xml
@@ -0,0 +1,46 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!--
+    Copyright (C) 2019 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">
+
+    <group
+            android:translateX="119.000000"
+            android:translateY="358.000000">
+        <group
+                android:translateX="2.000000"
+                android:translateY="2.000000">
+            <path
+                android:fillColor="#000000"
+                android:pathData="M-109-356.5c4.69,0,8.5,3.36,8.5,7.5c0,2.48-2.02,4.5-4.5,4.5h-1.77c-1.1,0-2,0.9-2,2 c0,0.45,0.16,0.89,0.46,1.27l0.02,0.02l0.02,0.02c0.17,0.2,0.27,0.44,0.27,0.68c0,0.55-0.45,1-1,1c-4.69,0-8.5-3.81-8.5-8.5 S-113.69-356.5-109-356.5 M-109-358c-5.51,0-10,4.49-10,10s4.49,10,10,10c1.38,0,2.5-1.12,2.5-2.5c0-0.61-0.23-1.2-0.64-1.67 c-0.08-0.1-0.13-0.21-0.13-0.33c0-0.28,0.22-0.5,0.5-0.5h1.77c3.31,0,6-2.69,6-6C-99-353.96-103.49-358-109-358L-109-358z" />
+        </group>
+    </group>
+    <path
+        android:fillColor="#000000"
+        android:pathData="M 6.5 10 C 7.32842712475 10 8 10.6715728753 8 11.5 C 8 12.3284271247 7.32842712475 13 6.5 13 C 5.67157287525 13 5 12.3284271247 5 11.5 C 5 10.6715728753 5.67157287525 10 6.5 10 Z" />
+    <path
+        android:fillColor="#000000"
+        android:pathData="M 9.5 6 C 10.3284271247 6 11 6.67157287525 11 7.5 C 11 8.32842712475 10.3284271247 9 9.5 9 C 8.67157287525 9 8 8.32842712475 8 7.5 C 8 6.67157287525 8.67157287525 6 9.5 6 Z" />
+    <path
+        android:fillColor="#000000"
+        android:pathData="M 14.5 6 C 15.3284271247 6 16 6.67157287525 16 7.5 C 16 8.32842712475 15.3284271247 9 14.5 9 C 13.6715728753 9 13 8.32842712475 13 7.5 C 13 6.67157287525 13.6715728753 6 14.5 6 Z" />
+    <path
+        android:fillColor="#000000"
+        android:pathData="M 17.5 10 C 18.3284271247 10 19 10.6715728753 19 11.5 C 19 12.3284271247 18.3284271247 13 17.5 13 C 16.6715728753 13 16 12.3284271247 16 11.5 C 16 10.6715728753 16.6715728753 10 17.5 10 Z" />
+</vector>
\ No newline at end of file
diff --git a/packages/overlays/IconPackCircularLauncherOverlay/res/drawable/ic_warning.xml b/packages/overlays/IconPackCircularLauncherOverlay/res/drawable/ic_warning.xml
new file mode 100644
index 0000000..f73a9cc
--- /dev/null
+++ b/packages/overlays/IconPackCircularLauncherOverlay/res/drawable/ic_warning.xml
@@ -0,0 +1,32 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!--
+    Copyright (C) 2019 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="#000000"
+        android:pathData="M4.47,21h15.06c1.54,0,2.5-1.67,1.73-3L13.73,4.99c-0.39-0.67-1.06-1-1.73-1s-1.35,0.33-1.73,1L2.74,18 C1.97,19.33,2.93,21,4.47,21z M4.04,18.75l7.53-13.01c0.13-0.22,0.33-0.25,0.43-0.25s0.31,0.03,0.43,0.25l7.53,13.01 c0.13,0.22,0.05,0.41,0,0.5c-0.05,0.09-0.18,0.25-0.43,0.25H4.47c-0.25,0-0.38-0.16-0.43-0.25C3.98,19.16,3.91,18.97,4.04,18.75z" />
+    <path
+        android:fillColor="#000000"
+        android:pathData="M12,14.75c0.41,0,0.75-0.34,0.75-0.75V9.75C12.75,9.33,12.41,9,12,9s-0.75,0.34-0.75,0.75V14 C11.25,14.41,11.59,14.75,12,14.75z" />
+    <path
+        android:fillColor="#000000"
+        android:pathData="M 12 16 C 12.5522847498 16 13 16.4477152502 13 17 C 13 17.5522847498 12.5522847498 18 12 18 C 11.4477152502 18 11 17.5522847498 11 17 C 11 16.4477152502 11.4477152502 16 12 16 Z" />
+</vector>
\ No newline at end of file
diff --git a/packages/overlays/IconPackCircularLauncherOverlay/res/drawable/ic_widget.xml b/packages/overlays/IconPackCircularLauncherOverlay/res/drawable/ic_widget.xml
new file mode 100644
index 0000000..1c2470e
--- /dev/null
+++ b/packages/overlays/IconPackCircularLauncherOverlay/res/drawable/ic_widget.xml
@@ -0,0 +1,35 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!--
+    Copyright (C) 2019 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="#000000"
+        android:pathData="M11,5c0-1.1-0.9-2-2-2H5C3.9,3,3,3.9,3,5v4c0,1.1,0.9,2,2,2h4c1.1,0,2-0.9,2-2V5z M9.5,9c0,0.28-0.22,0.5-0.5,0.5H5 C4.72,9.5,4.5,9.28,4.5,9V5c0-0.28,0.22-0.5,0.5-0.5h4c0.28,0,0.5,0.22,0.5,0.5V9z" />
+    <path
+        android:fillColor="#000000"
+        android:pathData="M9,13H5c-1.1,0-2,0.9-2,2v4c0,1.1,0.9,2,2,2h4c1.1,0,2-0.9,2-2v-4C11,13.9,10.1,13,9,13z M9.5,19c0,0.28-0.22,0.5-0.5,0.5 H5c-0.28,0-0.5-0.22-0.5-0.5v-4c0-0.28,0.22-0.5,0.5-0.5h4c0.28,0,0.5,0.22,0.5,0.5V19z" />
+    <path
+        android:fillColor="#000000"
+        android:pathData="M19,13h-4c-1.1,0-2,0.9-2,2v4c0,1.1,0.9,2,2,2h4c1.1,0,2-0.9,2-2v-4C21,13.9,20.1,13,19,13z M19.5,19 c0,0.28-0.22,0.5-0.5,0.5h-4c-0.28,0-0.5-0.22-0.5-0.5v-4c0-0.28,0.22-0.5,0.5-0.5h4c0.28,0,0.5,0.22,0.5,0.5V19z" />
+    <path
+        android:fillColor="#000000"
+        android:pathData="M18.41,2.76c-0.39-0.39-0.9-0.59-1.41-0.59s-1.02,0.2-1.41,0.59l-2.83,2.83c-0.78,0.78-0.78,2.05,0,2.83l2.83,2.83 c0.39,0.39,0.9,0.59,1.41,0.59s1.02-0.2,1.41-0.59l2.83-2.83c0.78-0.78,0.78-2.05,0-2.83L18.41,2.76z M20.18,7.35l-2.83,2.83 c-0.13,0.13-0.28,0.15-0.35,0.15s-0.23-0.02-0.35-0.15l-2.83-2.83C13.69,7.23,13.67,7.08,13.67,7s0.02-0.23,0.15-0.35l2.83-2.83 c0.13-0.13,0.28-0.15,0.35-0.15s0.23,0.02,0.35,0.15l2.83,2.83c0.13,0.13,0.15,0.28,0.15,0.35S20.31,7.23,20.18,7.35z" />
+</vector>
\ No newline at end of file
diff --git a/tests/LowStorageTest/Android.mk b/packages/overlays/IconPackFilledLauncherOverlay/Android.mk
similarity index 68%
copy from tests/LowStorageTest/Android.mk
copy to packages/overlays/IconPackFilledLauncherOverlay/Android.mk
index bdde6bd..d2e5b60 100644
--- a/tests/LowStorageTest/Android.mk
+++ b/packages/overlays/IconPackFilledLauncherOverlay/Android.mk
@@ -1,26 +1,31 @@
-# Copyright (C) 2009 The Android Open Source Project
+#
+#  Copyright 2019, 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
+#     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.
+#
 
 LOCAL_PATH:= $(call my-dir)
 include $(CLEAR_VARS)
 
-LOCAL_MODULE_TAGS := tests
+LOCAL_RRO_THEME := IconPackFilledLauncher
 LOCAL_CERTIFICATE := platform
+LOCAL_PRODUCT_MODULE := true
 
 LOCAL_SRC_FILES := $(call all-subdir-java-files)
 
-LOCAL_PACKAGE_NAME := lowstoragetest
+LOCAL_RESOURCE_DIR := $(LOCAL_PATH)/res
+
+LOCAL_PACKAGE_NAME := IconPackFilledLauncherOverlay
 LOCAL_SDK_VERSION := current
 
-include $(BUILD_PACKAGE)
+include $(BUILD_RRO_PACKAGE)
diff --git a/packages/overlays/IconPackFilledLauncherOverlay/AndroidManifest.xml b/packages/overlays/IconPackFilledLauncherOverlay/AndroidManifest.xml
new file mode 100644
index 0000000..0b9f636
--- /dev/null
+++ b/packages/overlays/IconPackFilledLauncherOverlay/AndroidManifest.xml
@@ -0,0 +1,24 @@
+<!--
+/**
+ * Copyright (c) 2019, 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.
+ */
+-->
+<manifest xmlns:android="http://schemas.android.com/apk/res/android"
+    package="com.android.theme.icon_pack.filled.launcher"
+    android:versionCode="1"
+    android:versionName="1.0">
+    <overlay android:targetPackage="com.android.launcher3" android:category="android.theme.customization.icon_pack.launcher" android:priority="1"/>
+    <application android:label="Filled" android:hasCode="false"/>
+</manifest>
diff --git a/packages/overlays/IconPackFilledLauncherOverlay/res/drawable/ic_clear.xml b/packages/overlays/IconPackFilledLauncherOverlay/res/drawable/ic_clear.xml
new file mode 100644
index 0000000..1a2f778
--- /dev/null
+++ b/packages/overlays/IconPackFilledLauncherOverlay/res/drawable/ic_clear.xml
@@ -0,0 +1,32 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!--
+    Copyright (C) 2019 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="#000000"
+        android:pathData="M20,4h-1h-4c0-0.55-0.45-1-1-1h-4C9.45,3,9,3.45,9,4H5H4C3.59,4,3.25,4.34,3.25,4.75S3.59,5.5,4,5.5h1V18 c0,1.66,1.34,3,3,3h8c1.66,0,3-1.34,3-3V5.5h1c0.41,0,0.75-0.34,0.75-0.75S20.41,4,20,4z M17.5,18c0,0.83-0.67,1.5-1.5,1.5H8 c-0.83,0-1.5-0.67-1.5-1.5V5.5h11V18z" />
+    <path
+        android:fillColor="#000000"
+        android:pathData="M14.25,8c-0.41,0-0.75,0.34-0.75,0.75v7.5c0,0.41,0.34,0.75,0.75,0.75S15,16.66,15,16.25v-7.5C15,8.34,14.66,8,14.25,8z" />
+    <path
+        android:fillColor="#000000"
+        android:pathData="M9.75,8C9.34,8,9,8.34,9,8.75v7.5C9,16.66,9.34,17,9.75,17s0.75-0.34,0.75-0.75v-7.5C10.5,8.34,10.16,8,9.75,8z" />
+</vector>
\ No newline at end of file
diff --git a/packages/overlays/IconPackFilledLauncherOverlay/res/drawable/ic_corp.xml b/packages/overlays/IconPackFilledLauncherOverlay/res/drawable/ic_corp.xml
new file mode 100644
index 0000000..8910308
--- /dev/null
+++ b/packages/overlays/IconPackFilledLauncherOverlay/res/drawable/ic_corp.xml
@@ -0,0 +1,26 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!--
+    Copyright (C) 2019 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="#000000"
+        android:pathData="M20,6h-4V4c0-1.1-0.9-2-2-2h-4C8.9,2,8,2.9,8,4v2H4C2.9,6,2,6.9,2,8v11c0,1.1,0.9,2,2,2h16c1.1,0,2-0.9,2-2V8 C22,6.9,21.1,6,20,6z M9.5,4c0-0.28,0.22-0.5,0.5-0.5h4c0.28,0,0.5,0.22,0.5,0.5v2h-5V4z M20.5,19c0,0.28-0.22,0.5-0.5,0.5H4 c-0.28,0-0.5-0.22-0.5-0.5V8c0-0.28,0.22-0.5,0.5-0.5h16c0.28,0,0.5,0.22,0.5,0.5V19z" />
+</vector>
\ No newline at end of file
diff --git a/packages/overlays/IconPackFilledLauncherOverlay/res/drawable/ic_empty_recents.xml b/packages/overlays/IconPackFilledLauncherOverlay/res/drawable/ic_empty_recents.xml
new file mode 100644
index 0000000..1d4c8d7
--- /dev/null
+++ b/packages/overlays/IconPackFilledLauncherOverlay/res/drawable/ic_empty_recents.xml
@@ -0,0 +1,32 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!--
+    Copyright (C) 2019 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="#000000"
+        android:pathData="M17,18V6c0-1.1-0.9-2-2-2H9C7.9,4,7,4.9,7,6v12c0,1.1,0.9,2,2,2h6C16.1,20,17,19.1,17,18z M8.5,18V6 c0-0.28,0.22-0.5,0.5-0.5h6c0.28,0,0.5,0.22,0.5,0.5v12c0,0.28-0.22,0.5-0.5,0.5H9C8.72,18.5,8.5,18.28,8.5,18z" />
+    <path
+        android:fillColor="#000000"
+        android:pathData="M21,17c0.55,0,1-0.45,1-1V8c0-0.55-0.45-1-1-1h-2c-0.55,0-1,0.45-1,1v8c0,0.55,0.45,1,1,1H21z M19.5,8.5h1v7h-1V8.5z" />
+    <path
+        android:fillColor="#000000"
+        android:pathData="M5,7H3C2.45,7,2,7.45,2,8v8c0,0.55,0.45,1,1,1h2c0.55,0,1-0.45,1-1V8C6,7.45,5.55,7,5,7z M4.5,15.5h-1v-7h1V15.5z" />
+</vector>
\ No newline at end of file
diff --git a/packages/overlays/IconPackFilledLauncherOverlay/res/drawable/ic_info_no_shadow.xml b/packages/overlays/IconPackFilledLauncherOverlay/res/drawable/ic_info_no_shadow.xml
new file mode 100644
index 0000000..a90141d
--- /dev/null
+++ b/packages/overlays/IconPackFilledLauncherOverlay/res/drawable/ic_info_no_shadow.xml
@@ -0,0 +1,32 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!--
+    Copyright (C) 2019 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="#000000"
+        android:pathData="M4.92,4.94c-3.9,3.91-3.9,10.24,0.01,14.14s10.24,3.9,14.14-0.01C20.95,17.2,22,14.65,22,12c0-2.65-1.06-5.19-2.93-7.07 C15.16,1.03,8.83,1.03,4.92,4.94z M18,18c-1.6,1.59-3.76,2.48-6.02,2.48c-4.69-0.01-8.49-3.83-8.48-8.52 c0.01-4.69,3.83-8.49,8.52-8.48c4.69,0.01,8.49,3.83,8.48,8.52C20.49,14.25,19.6,16.41,18,18z" />
+    <path
+        android:fillColor="#000000"
+        android:pathData="M 12 7 C 12.5522847498 7 13 7.44771525017 13 8 C 13 8.55228474983 12.5522847498 9 12 9 C 11.4477152502 9 11 8.55228474983 11 8 C 11 7.44771525017 11.4477152502 7 12 7 Z" />
+    <path
+        android:fillColor="#000000"
+        android:pathData="M12,10.5c-0.41,0-0.75,0.34-0.75,0.75v5c0,0.41,0.34,0.75,0.75,0.75s0.75-0.34,0.75-0.75v-5 C12.75,10.84,12.41,10.5,12,10.5z" />
+</vector>
\ No newline at end of file
diff --git a/packages/overlays/IconPackFilledLauncherOverlay/res/drawable/ic_remove_no_shadow.xml b/packages/overlays/IconPackFilledLauncherOverlay/res/drawable/ic_remove_no_shadow.xml
new file mode 100644
index 0000000..d31b6a1
--- /dev/null
+++ b/packages/overlays/IconPackFilledLauncherOverlay/res/drawable/ic_remove_no_shadow.xml
@@ -0,0 +1,26 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!--
+    Copyright (C) 2019 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="#000000"
+        android:pathData="M5.22,18.78C5.37,18.93,5.56,19,5.75,19s0.38-0.07,0.53-0.22L12,13.06l5.72,5.72c0.15,0.15,0.34,0.22,0.53,0.22 s0.38-0.07,0.53-0.22c0.29-0.29,0.29-0.77,0-1.06L13.06,12l5.72-5.72c0.29-0.29,0.29-0.77,0-1.06s-0.77-0.29-1.06,0L12,10.94 L6.28,5.22c-0.29-0.29-0.77-0.29-1.06,0s-0.29,0.77,0,1.06L10.94,12l-5.72,5.72C4.93,18.01,4.93,18.49,5.22,18.78z" />
+</vector>
\ No newline at end of file
diff --git a/packages/overlays/IconPackFilledLauncherOverlay/res/drawable/ic_setting.xml b/packages/overlays/IconPackFilledLauncherOverlay/res/drawable/ic_setting.xml
new file mode 100644
index 0000000..70dc701
--- /dev/null
+++ b/packages/overlays/IconPackFilledLauncherOverlay/res/drawable/ic_setting.xml
@@ -0,0 +1,29 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!--
+    Copyright (C) 2019 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="#000000"
+        android:pathData="M2.43,15.45l1.79,3.09c0.25,0.45,0.74,0.73,1.25,0.73c0.17,0,0.35-0.03,0.52-0.09l1.76-0.7c0.25,0.17,0.51,0.31,0.77,0.45 l0.26,1.84c0.09,0.71,0.69,1.24,1.42,1.24h3.61c0.72,0,1.33-0.53,1.43-1.19l0.26-1.86c0.25-0.14,0.51-0.28,0.76-0.45l1.76,0.7 c0.17,0.07,0.35,0.1,0.53,0.1c0.5,0,0.98-0.27,1.23-0.72l1.82-3.14c0.34-0.61,0.19-1.38-0.36-1.82l-1.48-1.16 c0.01-0.15,0.02-0.29,0.02-0.45s-0.01-0.3-0.02-0.45l1.48-1.16c0.55-0.43,0.7-1.19,0.35-1.84l-1.8-3.1 c-0.25-0.45-0.74-0.73-1.26-0.73c-0.17,0-0.35,0.03-0.52,0.09l-1.76,0.7c-0.25-0.17-0.51-0.31-0.77-0.45l-0.26-1.84 c-0.09-0.71-0.69-1.24-1.42-1.24h-3.61c-0.71,0-1.32,0.54-1.41,1.22L8.52,5.09C8.26,5.23,8.01,5.37,7.75,5.54L5.99,4.83 c-0.17-0.07-0.35-0.1-0.52-0.1c-0.5,0-0.98,0.27-1.22,0.72L2.43,8.55c-0.36,0.61-0.21,1.4,0.36,1.84l1.48,1.16 C4.27,11.7,4.26,11.85,4.26,12c0,0.16,0.01,0.3,0.02,0.45l-1.49,1.16C2.24,14.04,2.09,14.8,2.43,15.45z M5.2,13.63l0.63-0.49 l-0.05-0.79c-0.01-0.11-0.01-0.58,0-0.7l0.05-0.79L5.2,10.37L3.77,9.25l1.74-3l1.69,0.68l0.73,0.29l0.66-0.43 c0.19-0.13,0.4-0.25,0.65-0.38l0.67-0.36L10,5.3l0.25-1.79h3.48l0.26,1.8l0.11,0.76l0.69,0.36c0.23,0.12,0.44,0.24,0.64,0.37 l0.65,0.43l0.72-0.29l1.7-0.68l1.75,3.02l-1.43,1.12l-0.62,0.49l0.05,0.79c0.01,0.11,0.01,0.58,0,0.7l-0.05,0.79l0.62,0.49 l1.43,1.12l-1.74,3.02l-1.69-0.68l-0.72-0.29l-0.65,0.43c-0.19,0.13-0.4,0.25-0.65,0.38l-0.67,0.36l-0.11,0.75l-0.25,1.77h-3.5 L10,18.71l-0.11-0.76l-0.69-0.36c-0.23-0.12-0.44-0.24-0.64-0.37l-0.65-0.43l-0.72,0.29L5.5,17.76l-1.73-3.01L5.2,13.63z" />
+    <path
+        android:fillColor="#000000"
+        android:pathData="M12,16c2.21,0,4-1.79,4-4s-1.79-4-4-4c-2.21,0-4,1.79-4,4S9.79,16,12,16z M12,9.5c1.38,0,2.5,1.12,2.5,2.5 s-1.12,2.5-2.5,2.5c-1.38,0-2.5-1.12-2.5-2.5S10.62,9.5,12,9.5z" />
+</vector>
\ No newline at end of file
diff --git a/packages/overlays/IconPackFilledLauncherOverlay/res/drawable/ic_smartspace_preferences.xml b/packages/overlays/IconPackFilledLauncherOverlay/res/drawable/ic_smartspace_preferences.xml
new file mode 100644
index 0000000..d754cbe
--- /dev/null
+++ b/packages/overlays/IconPackFilledLauncherOverlay/res/drawable/ic_smartspace_preferences.xml
@@ -0,0 +1,26 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!--
+    Copyright (C) 2019 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="#000000"
+        android:pathData="M14.38,7.3C14.18,7.1,13.92,7,13.66,7c-0.26,0-0.51,0.1-0.71,0.29L1.29,18.96c-0.39,0.39-0.39,1.02,0,1.41l2.34,2.34 C3.82,22.9,4.08,23,4.34,23s0.51-0.1,0.71-0.29L16.7,11.05c0.39-0.39,0.39-1.02,0-1.41L14.38,7.3z M4.34,21.29l-1.63-1.63 l7.45-7.45l1.63,1.63L4.34,21.29z M12.84,12.78l-1.63-1.63l2.45-2.45l1.62,1.64L12.84,12.78z M17.75,5.25h1v1 C18.75,6.66,19.09,7,19.5,7s0.75-0.34,0.75-0.75v-1h1C21.66,5.25,22,4.91,22,4.5s-0.34-0.75-0.75-0.75h-1v-1 C20.25,2.34,19.91,2,19.5,2s-0.75,0.34-0.75,0.75v1h-1C17.34,3.75,17,4.09,17,4.5S17.34,5.25,17.75,5.25z M5.75,5.25h1v1 C6.75,6.66,7.09,7,7.5,7s0.75-0.34,0.75-0.75v-1h1C9.66,5.25,10,4.91,10,4.5S9.66,3.75,9.25,3.75h-1v-1C8.25,2.34,7.91,2,7.5,2 S6.75,2.34,6.75,2.75v1h-1C5.34,3.75,5,4.09,5,4.5S5.34,5.25,5.75,5.25z M21.25,15.75h-1v-1c0-0.41-0.34-0.75-0.75-0.75 s-0.75,0.34-0.75,0.75v1h-1c-0.41,0-0.75,0.34-0.75,0.75s0.34,0.75,0.75,0.75h1v1c0,0.41,0.34,0.75,0.75,0.75s0.75-0.34,0.75-0.75 v-1h1c0.41,0,0.75-0.34,0.75-0.75S21.66,15.75,21.25,15.75z" />
+</vector>
\ No newline at end of file
diff --git a/packages/overlays/IconPackFilledLauncherOverlay/res/drawable/ic_split_screen.xml b/packages/overlays/IconPackFilledLauncherOverlay/res/drawable/ic_split_screen.xml
new file mode 100644
index 0000000..87a9546
--- /dev/null
+++ b/packages/overlays/IconPackFilledLauncherOverlay/res/drawable/ic_split_screen.xml
@@ -0,0 +1,29 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!--
+    Copyright (C) 2019 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="#000000"
+        android:pathData="M5,11h14c0.55,0,1-0.45,1-1V4c0-0.55-0.45-1-1-1H5C4.45,3,4,3.45,4,4v6C4,10.55,4.45,11,5,11z M5.5,4.5h13v5h-13V4.5z" />
+    <path
+        android:fillColor="#000000"
+        android:pathData="M4,20c0,0.55,0.45,1,1,1h14c0.55,0,1-0.45,1-1v-6c0-0.55-0.45-1-1-1H5c-0.55,0-1,0.45-1,1V20z M5.5,14.5h13v5h-13V14.5z" />
+</vector>
\ No newline at end of file
diff --git a/packages/overlays/IconPackFilledLauncherOverlay/res/drawable/ic_wallpaper.xml b/packages/overlays/IconPackFilledLauncherOverlay/res/drawable/ic_wallpaper.xml
new file mode 100644
index 0000000..3834fb6
--- /dev/null
+++ b/packages/overlays/IconPackFilledLauncherOverlay/res/drawable/ic_wallpaper.xml
@@ -0,0 +1,46 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!--
+    Copyright (C) 2019 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">
+
+    <group
+            android:translateX="119.000000"
+            android:translateY="358.000000">
+        <group
+                android:translateX="2.000000"
+                android:translateY="2.000000">
+            <path
+                android:fillColor="#000000"
+                android:pathData="M-109-356.5c4.69,0,8.5,3.36,8.5,7.5c0,2.48-2.02,4.5-4.5,4.5h-1.77c-1.1,0-2,0.9-2,2 c0,0.45,0.16,0.89,0.46,1.27l0.02,0.02l0.02,0.02c0.17,0.2,0.27,0.44,0.27,0.68c0,0.55-0.45,1-1,1c-4.69,0-8.5-3.81-8.5-8.5 S-113.69-356.5-109-356.5 M-109-358c-5.51,0-10,4.49-10,10s4.49,10,10,10c1.38,0,2.5-1.12,2.5-2.5c0-0.61-0.23-1.2-0.64-1.67 c-0.08-0.1-0.13-0.21-0.13-0.33c0-0.28,0.22-0.5,0.5-0.5h1.77c3.31,0,6-2.69,6-6C-99-353.96-103.49-358-109-358L-109-358z" />
+        </group>
+    </group>
+    <path
+        android:fillColor="#000000"
+        android:pathData="M 6.5 10 C 7.32842712475 10 8 10.6715728753 8 11.5 C 8 12.3284271247 7.32842712475 13 6.5 13 C 5.67157287525 13 5 12.3284271247 5 11.5 C 5 10.6715728753 5.67157287525 10 6.5 10 Z" />
+    <path
+        android:fillColor="#000000"
+        android:pathData="M 9.5 6 C 10.3284271247 6 11 6.67157287525 11 7.5 C 11 8.32842712475 10.3284271247 9 9.5 9 C 8.67157287525 9 8 8.32842712475 8 7.5 C 8 6.67157287525 8.67157287525 6 9.5 6 Z" />
+    <path
+        android:fillColor="#000000"
+        android:pathData="M 14.5 6 C 15.3284271247 6 16 6.67157287525 16 7.5 C 16 8.32842712475 15.3284271247 9 14.5 9 C 13.6715728753 9 13 8.32842712475 13 7.5 C 13 6.67157287525 13.6715728753 6 14.5 6 Z" />
+    <path
+        android:fillColor="#000000"
+        android:pathData="M 17.5 10 C 18.3284271247 10 19 10.6715728753 19 11.5 C 19 12.3284271247 18.3284271247 13 17.5 13 C 16.6715728753 13 16 12.3284271247 16 11.5 C 16 10.6715728753 16.6715728753 10 17.5 10 Z" />
+</vector>
\ No newline at end of file
diff --git a/packages/overlays/IconPackFilledLauncherOverlay/res/drawable/ic_warning.xml b/packages/overlays/IconPackFilledLauncherOverlay/res/drawable/ic_warning.xml
new file mode 100644
index 0000000..614828c
--- /dev/null
+++ b/packages/overlays/IconPackFilledLauncherOverlay/res/drawable/ic_warning.xml
@@ -0,0 +1,32 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!--
+    Copyright (C) 2019 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="#000000"
+        android:pathData="M4.47,21h15.06c1.54,0,2.5-1.67,1.73-3L13.73,4.99c-0.39-0.67-1.06-1-1.73-1s-1.35,0.33-1.73,1L2.74,18 C1.97,19.33,2.93,21,4.47,21z M4.04,18.75l7.53-13.01c0.13-0.22,0.33-0.25,0.43-0.25s0.31,0.03,0.43,0.25l7.53,13.01 c0.13,0.22,0.05,0.41,0,0.5c-0.05,0.09-0.18,0.25-0.43,0.25H4.47c-0.25,0-0.38-0.16-0.43-0.25C3.98,19.16,3.91,18.97,4.04,18.75z" />
+    <path
+        android:fillColor="#000000"
+        android:pathData="M12,14.5c0.41,0,0.75-0.34,0.75-0.75v-4C12.75,9.33,12.41,9,12,9s-0.75,0.34-0.75,0.75v4C11.25,14.16,11.59,14.5,12,14.5z" />
+    <path
+        android:fillColor="#000000"
+        android:pathData="M 12 16 C 12.5522847498 16 13 16.4477152502 13 17 C 13 17.5522847498 12.5522847498 18 12 18 C 11.4477152502 18 11 17.5522847498 11 17 C 11 16.4477152502 11.4477152502 16 12 16 Z" />
+</vector>
\ No newline at end of file
diff --git a/packages/overlays/IconPackFilledLauncherOverlay/res/drawable/ic_widget.xml b/packages/overlays/IconPackFilledLauncherOverlay/res/drawable/ic_widget.xml
new file mode 100644
index 0000000..a8aeaf2
--- /dev/null
+++ b/packages/overlays/IconPackFilledLauncherOverlay/res/drawable/ic_widget.xml
@@ -0,0 +1,35 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!--
+    Copyright (C) 2019 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="#000000"
+        android:pathData="M10,3H4C3.45,3,3,3.45,3,4v6c0,0.55,0.45,1,1,1h6c0.55,0,1-0.45,1-1V4C11,3.45,10.55,3,10,3z M9.5,9.5h-5v-5h5V9.5z" />
+    <path
+        android:fillColor="#000000"
+        android:pathData="M10,13H4c-0.55,0-1,0.45-1,1v6c0,0.55,0.45,1,1,1h6c0.55,0,1-0.45,1-1v-6C11,13.45,10.55,13,10,13z M9.5,19.5h-5v-5h5 V19.5z" />
+    <path
+        android:fillColor="#000000"
+        android:pathData="M20,13h-6c-0.55,0-1,0.45-1,1v6c0,0.55,0.45,1,1,1h6c0.55,0,1-0.45,1-1v-6C21,13.45,20.55,13,20,13z M19.5,19.5h-5v-5h5 V19.5z" />
+    <path
+        android:fillColor="#000000"
+        android:pathData="M21.95,6.29l-4.24-4.24c-0.2-0.2-0.45-0.29-0.71-0.29s-0.51,0.1-0.71,0.29l-4.24,4.24c-0.39,0.39-0.39,1.02,0,1.41 l4.24,4.24c0.2,0.2,0.45,0.29,0.71,0.29s0.51-0.1,0.71-0.29l4.24-4.24C22.34,7.32,22.34,6.68,21.95,6.29z M17,10.54L13.46,7 L17,3.46L20.54,7L17,10.54z" />
+</vector>
\ No newline at end of file
diff --git a/tests/LowStorageTest/Android.mk b/packages/overlays/IconPackRoundedLauncherOverlay/Android.mk
similarity index 68%
copy from tests/LowStorageTest/Android.mk
copy to packages/overlays/IconPackRoundedLauncherOverlay/Android.mk
index bdde6bd..7adfe3b 100644
--- a/tests/LowStorageTest/Android.mk
+++ b/packages/overlays/IconPackRoundedLauncherOverlay/Android.mk
@@ -1,26 +1,31 @@
-# Copyright (C) 2009 The Android Open Source Project
+#
+#  Copyright 2019, 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
+#     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.
+#
 
 LOCAL_PATH:= $(call my-dir)
 include $(CLEAR_VARS)
 
-LOCAL_MODULE_TAGS := tests
+LOCAL_RRO_THEME := IconPackRoundedLauncher
 LOCAL_CERTIFICATE := platform
+LOCAL_PRODUCT_MODULE := true
 
 LOCAL_SRC_FILES := $(call all-subdir-java-files)
 
-LOCAL_PACKAGE_NAME := lowstoragetest
+LOCAL_RESOURCE_DIR := $(LOCAL_PATH)/res
+
+LOCAL_PACKAGE_NAME := IconPackRoundedLauncherOverlay
 LOCAL_SDK_VERSION := current
 
-include $(BUILD_PACKAGE)
+include $(BUILD_RRO_PACKAGE)
diff --git a/packages/overlays/IconPackRoundedLauncherOverlay/AndroidManifest.xml b/packages/overlays/IconPackRoundedLauncherOverlay/AndroidManifest.xml
new file mode 100644
index 0000000..8406f42
--- /dev/null
+++ b/packages/overlays/IconPackRoundedLauncherOverlay/AndroidManifest.xml
@@ -0,0 +1,24 @@
+<!--
+/**
+ * Copyright (c) 2019, 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.
+ */
+-->
+<manifest xmlns:android="http://schemas.android.com/apk/res/android"
+    package="com.android.theme.icon_pack.rounded.launcher"
+    android:versionCode="1"
+    android:versionName="1.0">
+    <overlay android:targetPackage="com.android.launcher3" android:category="android.theme.customization.icon_pack.launcher" android:priority="1"/>
+    <application android:label="Rounded" android:hasCode="false"/>
+</manifest>
diff --git a/packages/overlays/IconPackRoundedLauncherOverlay/res/drawable/ic_clear.xml b/packages/overlays/IconPackRoundedLauncherOverlay/res/drawable/ic_clear.xml
new file mode 100644
index 0000000..919e93e
--- /dev/null
+++ b/packages/overlays/IconPackRoundedLauncherOverlay/res/drawable/ic_clear.xml
@@ -0,0 +1,29 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!--
+    Copyright (C) 2019 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="#000000"
+        android:pathData="M18,4h-2.5l-0.71-0.71C14.61,3.11,14.35,3,14.09,3H9.9C9.64,3,9.38,3.11,9.2,3.29L8.49,4h-2.5c-0.55,0-1,0.45-1,1 s0.45,1,1,1h12c0.55,0,1-0.45,1-1C19,4.45,18.55,4,18,4z" />
+    <path
+        android:fillColor="#000000"
+        android:pathData="M6,19c0,1.1,0.9,2,2,2h8c1.1,0,2-0.9,2-2V7H6V19z" />
+</vector>
\ No newline at end of file
diff --git a/packages/overlays/IconPackRoundedLauncherOverlay/res/drawable/ic_corp.xml b/packages/overlays/IconPackRoundedLauncherOverlay/res/drawable/ic_corp.xml
new file mode 100644
index 0000000..5a14373
--- /dev/null
+++ b/packages/overlays/IconPackRoundedLauncherOverlay/res/drawable/ic_corp.xml
@@ -0,0 +1,26 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!--
+    Copyright (C) 2019 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="#000000"
+        android:pathData="M20,6h-4V4c0-1.11-0.89-2-2-2h-4C8.89,2,8,2.89,8,4v2H4C2.89,6,2.01,6.89,2.01,8L2,19c0,1.11,0.89,2,2,2h16 c1.11,0,2-0.89,2-2V8C22,6.89,21.11,6,20,6z M14,6h-4V4h4V6z" />
+</vector>
\ No newline at end of file
diff --git a/packages/overlays/IconPackRoundedLauncherOverlay/res/drawable/ic_empty_recents.xml b/packages/overlays/IconPackRoundedLauncherOverlay/res/drawable/ic_empty_recents.xml
new file mode 100644
index 0000000..76f8831
--- /dev/null
+++ b/packages/overlays/IconPackRoundedLauncherOverlay/res/drawable/ic_empty_recents.xml
@@ -0,0 +1,32 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!--
+    Copyright (C) 2019 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="#000000"
+        android:pathData="M3,6h2c0.55,0,1,0.45,1,1v9c0,0.55-0.45,1-1,1H3c-0.55,0-1-0.45-1-1V7C2,6.45,2.45,6,3,6z" />
+    <path
+        android:fillColor="#000000"
+        android:pathData="M8,19h8c0.55,0,1-0.45,1-1V5c0-0.55-0.45-1-1-1H8C7.45,4,7,4.45,7,5v13C7,18.55,7.45,19,8,19z" />
+    <path
+        android:fillColor="#000000"
+        android:pathData="M19,6h2c0.55,0,1,0.45,1,1v9c0,0.55-0.45,1-1,1h-2c-0.55,0-1-0.45-1-1V7C18,6.45,18.45,6,19,6z" />
+</vector>
\ No newline at end of file
diff --git a/packages/overlays/IconPackRoundedLauncherOverlay/res/drawable/ic_info_no_shadow.xml b/packages/overlays/IconPackRoundedLauncherOverlay/res/drawable/ic_info_no_shadow.xml
new file mode 100644
index 0000000..6a4e448
--- /dev/null
+++ b/packages/overlays/IconPackRoundedLauncherOverlay/res/drawable/ic_info_no_shadow.xml
@@ -0,0 +1,26 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!--
+    Copyright (C) 2019 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="#000000"
+        android:pathData="M12,2C6.48,2,2,6.48,2,12c0,5.52,4.48,10,10,10s10-4.48,10-10C22,6.48,17.52,2,12,2z M13,17c0,0.55-0.45,1-1,1s-1-0.45-1-1 v-5c0-0.55,0.45-1,1-1s1,0.45,1,1V17z M12,9.25c-0.69,0-1.25-0.56-1.25-1.25S11.31,6.75,12,6.75S13.25,7.31,13.25,8 S12.69,9.25,12,9.25z" />
+</vector>
\ No newline at end of file
diff --git a/packages/overlays/IconPackRoundedLauncherOverlay/res/drawable/ic_remove_no_shadow.xml b/packages/overlays/IconPackRoundedLauncherOverlay/res/drawable/ic_remove_no_shadow.xml
new file mode 100644
index 0000000..08ae89f
--- /dev/null
+++ b/packages/overlays/IconPackRoundedLauncherOverlay/res/drawable/ic_remove_no_shadow.xml
@@ -0,0 +1,26 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!--
+    Copyright (C) 2019 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="#000000"
+        android:pathData="M5.7,18.3c0.39,0.39,1.02,0.39,1.41,0L12,13.41l4.89,4.89c0.39,0.39,1.02,0.39,1.41,0s0.39-1.02,0-1.41L13.41,12l4.89-4.89 c0.38-0.38,0.38-1.02,0-1.4c-0.39-0.39-1.02-0.39-1.41,0c0,0,0,0,0,0L12,10.59L7.11,5.7c-0.39-0.39-1.02-0.39-1.41,0 s-0.39,1.02,0,1.41L10.59,12L5.7,16.89C5.31,17.28,5.31,17.91,5.7,18.3z" />
+</vector>
\ No newline at end of file
diff --git a/packages/overlays/IconPackRoundedLauncherOverlay/res/drawable/ic_setting.xml b/packages/overlays/IconPackRoundedLauncherOverlay/res/drawable/ic_setting.xml
new file mode 100644
index 0000000..842b687
--- /dev/null
+++ b/packages/overlays/IconPackRoundedLauncherOverlay/res/drawable/ic_setting.xml
@@ -0,0 +1,26 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!--
+    Copyright (C) 2019 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="#000000"
+        android:pathData="M21.64,8.39l-1.6-2.76c-0.28-0.48-0.88-0.7-1.36-0.5l-2.14,0.91c-0.48-0.37-1.01-0.68-1.57-0.92l-0.27-2.2 C14.64,2.4,14.14,2,13.59,2h-3.18C9.86,2,9.36,2.4,9.3,2.92L9.04,5.11c-0.57,0.24-1.1,0.55-1.58,0.92L5.32,5.12 c-0.48-0.2-1.08,0.02-1.36,0.5l-1.6,2.76C2.08,8.86,2.18,9.48,2.6,9.8l1.94,1.45C4.51,11.49,4.5,11.74,4.5,12s0.01,0.51,0.04,0.76 L2.6,14.2c-0.42,0.31-0.52,0.94-0.24,1.41l1.6,2.76c0.28,0.48,0.88,0.7,1.36,0.5l2.14-0.91c0.48,0.37,1.01,0.68,1.57,0.92 l0.27,2.19C9.36,21.6,9.86,22,10.41,22h3.18c0.55,0,1.04-0.4,1.11-0.92l0.27-2.19c0.56-0.24,1.09-0.55,1.57-0.92l2.14,0.91 c0.48,0.2,1.08-0.02,1.36-0.5l1.6-2.76c0.28-0.48,0.18-1.1-0.24-1.42l-1.94-1.45c0.03-0.25,0.04-0.5,0.04-0.76 s-0.01-0.51-0.04-0.76L21.4,9.8C21.82,9.49,21.92,8.86,21.64,8.39z M12,15.5c-1.93,0-3.5-1.57-3.5-3.5s1.57-3.5,3.5-3.5 s3.5,1.57,3.5,3.5S13.93,15.5,12,15.5z" />
+</vector>
\ No newline at end of file
diff --git a/packages/overlays/IconPackRoundedLauncherOverlay/res/drawable/ic_smartspace_preferences.xml b/packages/overlays/IconPackRoundedLauncherOverlay/res/drawable/ic_smartspace_preferences.xml
new file mode 100644
index 0000000..8950fbd
--- /dev/null
+++ b/packages/overlays/IconPackRoundedLauncherOverlay/res/drawable/ic_smartspace_preferences.xml
@@ -0,0 +1,32 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!--
+    Copyright (C) 2019 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="#000000"
+        android:pathData="M21.23,2.43L19.5,3.4l-1.73-0.97c-0.22-0.12-0.46,0.12-0.34,0.34L18.4,4.5l-0.97,1.73c-0.12,0.22,0.12,0.46,0.34,0.34 L19.5,5.6l1.73,0.97c0.22,0.12,0.46-0.12,0.34-0.34L20.6,4.5l0.97-1.73C21.69,2.55,21.45,2.31,21.23,2.43z M14.37,7.29 c-0.39-0.39-1.02-0.39-1.41,0L1.29,18.96c-0.39,0.39-0.39,1.02,0,1.41l2.34,2.34c0.39,0.39,1.02,0.39,1.41,0L16.7,11.05 c0.39-0.39,0.39-1.02,0-1.41L14.37,7.29z M13.34,12.78l-2.12-2.12l2.44-2.44l2.12,2.12L13.34,12.78z" />
+    <path
+        android:fillColor="#000000"
+        android:pathData="M21.23,14.43L19.5,15.4l-1.73-0.97c-0.22-0.12-0.46,0.12-0.34,0.34l0.97,1.73l-0.97,1.73c-0.12,0.22,0.12,0.46,0.34,0.34 l1.73-0.97l1.73,0.97c0.22,0.12,0.46-0.12,0.34-0.34L20.6,16.5l0.97-1.73C21.69,14.55,21.45,14.31,21.23,14.43z" />
+    <path
+        android:fillColor="#000000"
+        android:pathData="M9.23,2.43L7.5,3.4L5.77,2.43C5.55,2.31,5.31,2.55,5.43,2.77L6.4,4.5L5.43,6.23C5.31,6.45,5.55,6.69,5.77,6.57L7.5,5.6 l1.73,0.97c0.22,0.12,0.46-0.12,0.34-0.34L8.6,4.5l0.97-1.73C9.69,2.55,9.45,2.31,9.23,2.43z" />
+</vector>
\ No newline at end of file
diff --git a/packages/overlays/IconPackRoundedLauncherOverlay/res/drawable/ic_split_screen.xml b/packages/overlays/IconPackRoundedLauncherOverlay/res/drawable/ic_split_screen.xml
new file mode 100644
index 0000000..30478b3
--- /dev/null
+++ b/packages/overlays/IconPackRoundedLauncherOverlay/res/drawable/ic_split_screen.xml
@@ -0,0 +1,29 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!--
+    Copyright (C) 2019 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="#000000"
+        android:pathData="M18,2H6C4.9,2,4,2.9,4,4v5c0,1.1,0.9,2,2,2h12c1.1,0,2-0.9,2-2V4C20,2.9,19.1,2,18,2z" />
+    <path
+        android:fillColor="#000000"
+        android:pathData="M18,13H6c-1.1,0-2,0.9-2,2v5c0,1.1,0.9,2,2,2h12c1.1,0,2-0.9,2-2v-5C20,13.9,19.1,13,18,13z" />
+</vector>
\ No newline at end of file
diff --git a/packages/overlays/IconPackRoundedLauncherOverlay/res/drawable/ic_wallpaper.xml b/packages/overlays/IconPackRoundedLauncherOverlay/res/drawable/ic_wallpaper.xml
new file mode 100644
index 0000000..72d1d31
--- /dev/null
+++ b/packages/overlays/IconPackRoundedLauncherOverlay/res/drawable/ic_wallpaper.xml
@@ -0,0 +1,26 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!--
+    Copyright (C) 2019 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="#000000"
+        android:pathData="M12,2C6.49,2,2,6.49,2,12s4.49,10,10,10c1.38,0,2.5-1.12,2.5-2.5c0-0.61-0.23-1.2-0.64-1.67c-0.08-0.1-0.13-0.21-0.13-0.33 c0-0.28,0.22-0.5,0.5-0.5H16c3.31,0,6-2.69,6-6C22,6.04,17.51,2,12,2z M6.5,13C5.67,13,5,12.33,5,11.5S5.67,10,6.5,10 S8,10.67,8,11.5S7.33,13,6.5,13z M9.5,9C8.67,9,8,8.33,8,7.5S8.67,6,9.5,6S11,6.67,11,7.5S10.33,9,9.5,9z M14.5,9 C13.67,9,13,8.33,13,7.5S13.67,6,14.5,6S16,6.67,16,7.5S15.33,9,14.5,9z M17.5,13c-0.83,0-1.5-0.67-1.5-1.5s0.67-1.5,1.5-1.5 s1.5,0.67,1.5,1.5S18.33,13,17.5,13z" />
+</vector>
\ No newline at end of file
diff --git a/packages/overlays/IconPackRoundedLauncherOverlay/res/drawable/ic_warning.xml b/packages/overlays/IconPackRoundedLauncherOverlay/res/drawable/ic_warning.xml
new file mode 100644
index 0000000..f92842a
--- /dev/null
+++ b/packages/overlays/IconPackRoundedLauncherOverlay/res/drawable/ic_warning.xml
@@ -0,0 +1,26 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!--
+    Copyright (C) 2019 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="#000000"
+        android:pathData="M12.87,3.49c-0.39-0.67-1.35-0.67-1.73,0l-9.27,16C1.48,20.17,1.96,21,2.73,21h18.53c0.77,0,1.25-0.83,0.87-1.5L12.87,3.49 z M11,10c0-0.55,0.45-1,1-1s1,0.45,1,1v3c0,0.55-0.45,1-1,1s-1-0.45-1-1V10z M12,18.25c-0.69,0-1.25-0.56-1.25-1.25 s0.56-1.25,1.25-1.25s1.25,0.56,1.25,1.25S12.69,18.25,12,18.25z" />
+</vector>
\ No newline at end of file
diff --git a/packages/overlays/IconPackRoundedLauncherOverlay/res/drawable/ic_widget.xml b/packages/overlays/IconPackRoundedLauncherOverlay/res/drawable/ic_widget.xml
new file mode 100644
index 0000000..511757f
--- /dev/null
+++ b/packages/overlays/IconPackRoundedLauncherOverlay/res/drawable/ic_widget.xml
@@ -0,0 +1,35 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!--
+    Copyright (C) 2019 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="#000000"
+        android:pathData="M17.7,2.3c-0.4-0.4-1-0.4-1.4,0l-4,4c-0.4,0.4-0.4,1,0,1.4l4,4c0.4,0.4,1,0.4,1.4,0l4-4c0.4-0.4,0.4-1,0-1.4L17.7,2.3z" />
+    <path
+        android:fillColor="#000000"
+        android:pathData="M11,4c0-0.5-0.4-1-1-1H4C3.5,3,3,3.5,3,4v6c0,0.6,0.5,1,1,1h6c0.6,0,1-0.4,1-1V4z" />
+    <path
+        android:fillColor="#000000"
+        android:pathData="M20,21c0.5,0,1-0.5,1-1v-6c0-0.6-0.5-1-1-1h-6c-0.6,0-1,0.4-1,1v6c0,0.5,0.4,1,1,1H20z" />
+    <path
+        android:fillColor="#000000"
+        android:pathData="M10,13H4c-0.5,0-1,0.4-1,1v6c0,0.5,0.5,1,1,1h6c0.6,0,1-0.5,1-1v-6C11,13.4,10.6,13,10,13z" />
+</vector>
\ No newline at end of file
diff --git a/proto/src/metrics_constants/metrics_constants.proto b/proto/src/metrics_constants/metrics_constants.proto
index 8929e82..9673a84 100644
--- a/proto/src/metrics_constants/metrics_constants.proto
+++ b/proto/src/metrics_constants/metrics_constants.proto
@@ -253,6 +253,13 @@
     MANAGED_PROFILE = 2;
   }
 
+  // Subtypes for showing direct sharing targets
+  enum DirectShareTargetPreviousState {
+    PREVIOUSLY_UNKNOWN = 0;
+    PREVIOUSLY_HIDDEN = 1;
+    PREVIOUSLY_VISIBLE = 2;
+  }
+
   // Known visual elements: views or controls.
   enum View {
     // Unknown view
@@ -5434,7 +5441,7 @@
     FIELD_END_BATTERY_PERCENT = 1308;
 
     // ACTION: Settings > Display > Night Light
-    // SUBTYPE: com.android.server.display.ColorDisplayService.AutoMode value
+    // SUBTYPE: com.android.server.display.color.ColorDisplayService.AutoMode value
     // CATEGORY: SETTINGS
     // OS: P
     ACTION_NIGHT_DISPLAY_AUTO_MODE_CHANGED = 1309;
@@ -7065,6 +7072,24 @@
 
     ACTION_ATCHNUC = 1681;
 
+    // OPEN: Accessibility detail settings (android.settings.ACCESSIBILITY_DETAILS_SETTINGS intent)
+    ACCESSIBILITY_DETAILS_SETTINGS = 1682;
+
+    // Open: Settings will show the conditional when Grayscale mode is on
+    SETTINGS_CONDITION_GRAYSCALE_MODE = 1683;
+
+    // ACTION: Individual contextual card loading time
+    ACTION_CONTEXTUAL_CARD_LOAD = 1684;
+
+    //ACTION: Contextual card loading timeout
+    ACTION_CONTEXTUAL_CARD_LOAD_TIMEOUT = 1685;
+
+    //ACTION: Log result for each card's eligibility check
+    ACTION_CONTEXTUAL_CARD_ELIGIBILITY = 1686;
+
+    // Panel for Wifi
+    PANEL_WIFI = 1687;
+
     // ---- End Q Constants, all Q constants go above this line ----
     // Add new aosp constants above this line.
     // END OF AOSP CONSTANTS
diff --git a/proto/src/wifi.proto b/proto/src/wifi.proto
index 670e794..9f049cf 100644
--- a/proto/src/wifi.proto
+++ b/proto/src/wifi.proto
@@ -524,6 +524,15 @@
 
   // Link Probe metrics
   optional LinkProbeStats link_probe_stats = 139;
+
+  // List of NetworkSelectionExperimentDecisions stats for each experiment
+  repeated NetworkSelectionExperimentDecisions network_selection_experiment_decisions_list = 140;
+
+  // Network Request API surface metrics.
+  optional WifiNetworkRequestApiLog wifi_network_request_api_log = 141;
+
+  // Network Suggestion API surface metrics.
+  optional WifiNetworkSuggestionApiLog wifi_network_suggestion_api_log = 142;
 }
 
 // Information that gets logged for every WiFi connection.
@@ -651,6 +660,59 @@
     HLF_UNWANTED = 4;
   }
 
+  // Level 2 failure reason.
+  enum Level2FailureReason {
+
+    // Unknown default
+    FAILURE_REASON_UNKNOWN = 0;
+
+    // The reason code if there is no error during authentication. It could
+    // also imply that there no authentication in progress.
+    AUTH_FAILURE_NONE = 1;
+
+    // The reason code if there was a timeout authenticating.
+    AUTH_FAILURE_TIMEOUT = 2;
+
+    // The reason code if there was a wrong password while authenticating.
+    AUTH_FAILURE_WRONG_PSWD = 3;
+
+    // The reason code if there was EAP failure while authenticating.
+    AUTH_FAILURE_EAP_FAILURE = 4;
+  }
+
+  // Entity that recommended connecting to this network.
+  enum ConnectionNominator {
+    // Unknown nominator
+    NOMINATOR_UNKNOWN = 0;
+
+    // User selected network manually
+    NOMINATOR_MANUAL = 1;
+
+    // Saved network
+    NOMINATOR_SAVED = 2;
+
+    // Suggestion API
+    NOMINATOR_SUGGESTION = 3;
+
+    // Passpoint
+    NOMINATOR_PASSPOINT = 4;
+
+    // Carrier suggestion
+    NOMINATOR_CARRIER = 5;
+
+    // External scorer
+    NOMINATOR_EXTERNAL_SCORED = 6;
+
+    // Netrec
+    NOMINATOR_NETREC = 7;
+
+    // User connected choice override
+    NOMINATOR_SAVED_USER_CONNECT_CHOICE = 8;
+
+    // Open Network Available Pop-up
+    NOMINATOR_OPEN_NETWORK_AVAILABLE = 9;
+  }
+
   // Start time of the connection.
   optional int64 start_time_millis = 1;// [(datapol.semantic_type) = ST_TIMESTAMP];
 
@@ -680,6 +742,16 @@
 
   // Connection is using locally generated random MAC address.
   optional bool use_randomized_mac = 10 [default = false];
+
+  // Who chose to connect.
+  optional ConnectionNominator connection_nominator = 11;
+
+  // The currently running network selector when this connection event occurred.
+  optional int32 network_selector_experiment_id = 12;
+
+  // Breakdown of level_2_failure_code with more detailed reason.
+  optional Level2FailureReason level_2_failure_reason = 13
+          [default = FAILURE_REASON_UNKNOWN];
 }
 
 // Number of occurrences of a specific RSSI poll rssi value
@@ -1726,6 +1798,9 @@
   // Prediction horizon (in second) of Wifi usability score provided by external
   // system app
   optional int32 last_prediction_horizon_sec = 12 [default = -1];
+
+  // Whether screen status is on when WifiIsUnusableEvent happens.
+  optional bool screen_on = 13 [default = false];
 }
 
 message PasspointProfileTypeCount {
@@ -2276,3 +2351,62 @@
   // Counts the occurrences of error codes for failed link probes.
   repeated LinkProbeFailureReasonCount failure_reason_counts = 8;
 }
+
+// Stores the decisions that were made by a experiment when compared against another experiment
+message NetworkSelectionExperimentDecisions {
+  // the id of one experiment
+  optional int32 experiment1_id = 1;
+
+  // the id of the other experiment
+  optional int32 experiment2_id = 2;
+
+  // Counts occurrences of the number of network choices there were when experiment1 makes the
+  // same network selection as experiment2.
+  // The keys are the number of network choices, and the values are the number of occurrences of
+  // this number of network choices when exp1 and exp2 make the same network selection.
+  repeated MapEntryInt32Int32 same_selection_num_choices_counter = 3;
+
+  // Counts occurrences of the number of network choices there were when experiment1 makes the
+  // same network selection as experiment2.
+  // The keys are the number of network choices, and the values are the number of occurrences of
+  // this number of network choices when exp1 and exp2 make different network selections.
+  // Note that it is possible for the network selection to be different even when there only exists
+  // a single network choice, since choosing not to connect to that network is a valid choice.
+  repeated MapEntryInt32Int32 different_selection_num_choices_counter = 4;
+}
+
+// NetworkRequest API metrics.
+message WifiNetworkRequestApiLog {
+  // Number of requests via this API surface.
+  optional int32 num_request = 1;
+
+  // Histogram of requests via this API surface to number of networks matched in scan results.
+  repeated HistogramBucketInt32 network_match_size_histogram = 2;
+
+  // Number of successful network connection from this API.
+  optional int32 num_connect_success = 3;
+
+  // Number of requests via this API surface that bypassed user approval.
+  optional int32 num_user_approval_bypass = 4;
+
+  // Number of requests via this API surface that was rejected by the user.
+  optional int32 num_user_reject = 5;
+
+  // Number of unique apps using this API surface.
+  optional int32 num_apps = 6;
+}
+
+// NetworkSuggestion API metrics.
+message WifiNetworkSuggestionApiLog {
+  // Number of modifications to their suggestions by apps.
+  optional int32 num_modification = 1;
+
+  // Number of successful network connection from app suggestions.
+  optional int32 num_connect_success = 2;
+
+  // Number of network connection failures from app suggestions.
+  optional int32 num_connect_failure = 3;
+
+  // Histogram for size of the network lists provided by various apps on the device.
+  repeated HistogramBucketInt32 network_list_size_histogram = 4;
+}
diff --git a/rs/java/android/renderscript/ScriptIntrinsicBlur.java b/rs/java/android/renderscript/ScriptIntrinsicBlur.java
index a36873e..0891d51 100644
--- a/rs/java/android/renderscript/ScriptIntrinsicBlur.java
+++ b/rs/java/android/renderscript/ScriptIntrinsicBlur.java
@@ -62,6 +62,10 @@
         if (ain.getType().getY() == 0) {
             throw new RSIllegalArgumentException("Input set to a 1D Allocation");
         }
+        Element e = ain.getElement();
+        if ((!e.isCompatible(Element.U8_4(mRS))) && (!e.isCompatible(Element.U8(mRS)))) {
+            throw new RSIllegalArgumentException("Unsupported element type.");
+        }
         mInput = ain;
         setVar(1, ain);
     }
diff --git a/services/appprediction/java/com/android/server/appprediction/RemoteAppPredictionService.java b/services/appprediction/java/com/android/server/appprediction/RemoteAppPredictionService.java
index 45ea86f..922b327 100644
--- a/services/appprediction/java/com/android/server/appprediction/RemoteAppPredictionService.java
+++ b/services/appprediction/java/com/android/server/appprediction/RemoteAppPredictionService.java
@@ -46,7 +46,8 @@
             ComponentName componentName, int userId,
             RemoteAppPredictionServiceCallbacks callback, boolean bindInstantServiceAllowed,
             boolean verbose) {
-        super(context, serviceInterface, componentName, userId, callback, bindInstantServiceAllowed,
+        super(context, serviceInterface, componentName, userId, callback,
+                context.getMainThreadHandler(), bindInstantServiceAllowed,
                 verbose, /* initialCapacity= */ 1);
     }
 
diff --git a/services/art-profile b/services/art-profile
index 7892fcb..6de96e8 100644
--- a/services/art-profile
+++ b/services/art-profile
@@ -1013,7 +1013,7 @@
 HPLcom/android/server/display/AutomaticBrightnessController;->weightIntegral(J)F
 HPLcom/android/server/display/BrightnessTracker$Injector;->currentTimeMillis()J
 HPLcom/android/server/display/BrightnessTracker$Injector;->elapsedRealtimeNanos()J
-HPLcom/android/server/display/ColorDisplayService$ColorMatrixEvaluator;->evaluate(F[F[F)[F
+HPLcom/android/server/display/color/ColorDisplayService$ColorMatrixEvaluator;->evaluate(F[F[F)[F
 HPLcom/android/server/display/ColorFade;->draw(F)Z
 HPLcom/android/server/display/ColorFade;->drawFaded(FF)V
 HPLcom/android/server/display/DisplayManagerService$BinderService;->getDisplayIds()[I
@@ -3413,7 +3413,7 @@
 Lcom/android/server/devicepolicy/DevicePolicyManagerService$Lifecycle;
 Lcom/android/server/display/-$$Lambda$VirtualDisplayAdapter$PFyqe-aYIEBicSVtuy5lL_bT8B0;
 Lcom/android/server/display/AutomaticBrightnessController$Callbacks;
-Lcom/android/server/display/ColorDisplayService;
+Lcom/android/server/display/color/ColorDisplayService;
 Lcom/android/server/display/DisplayAdapter$1;
 Lcom/android/server/display/DisplayAdapter$2;
 Lcom/android/server/display/DisplayAdapter$Listener;
@@ -3433,7 +3433,7 @@
 Lcom/android/server/display/DisplayManagerService;
 Lcom/android/server/display/DisplayManagerShellCommand;
 Lcom/android/server/display/DisplayPowerController;
-Lcom/android/server/display/DisplayTransformManager;
+Lcom/android/server/display/color/DisplayTransformManager;
 Lcom/android/server/display/LocalDisplayAdapter$DisplayModeRecord;
 Lcom/android/server/display/LocalDisplayAdapter$HotplugDisplayEventReceiver;
 Lcom/android/server/display/LocalDisplayAdapter$LocalDisplayDevice$1;
@@ -10616,39 +10616,39 @@
 PLcom/android/server/display/BrightnessTracker;->writeAmbientBrightnessStats()V
 PLcom/android/server/display/BrightnessTracker;->writeEvents()V
 PLcom/android/server/display/BrightnessTracker;->writeEventsLocked(Ljava/io/OutputStream;)V
-PLcom/android/server/display/ColorDisplayService$2;-><init>(Lcom/android/server/display/ColorDisplayService;Lcom/android/server/display/DisplayTransformManager;)V
-PLcom/android/server/display/ColorDisplayService$2;->onAnimationUpdate(Landroid/animation/ValueAnimator;)V
-PLcom/android/server/display/ColorDisplayService$3;-><init>(Lcom/android/server/display/ColorDisplayService;Lcom/android/server/display/DisplayTransformManager;[F)V
-PLcom/android/server/display/ColorDisplayService$3;->onAnimationEnd(Landroid/animation/Animator;)V
-PLcom/android/server/display/ColorDisplayService$AutoMode;-><init>(Lcom/android/server/display/ColorDisplayService;)V
-PLcom/android/server/display/ColorDisplayService$AutoMode;-><init>(Lcom/android/server/display/ColorDisplayService;Lcom/android/server/display/ColorDisplayService$1;)V
-PLcom/android/server/display/ColorDisplayService$ColorMatrixEvaluator;-><init>()V
-PLcom/android/server/display/ColorDisplayService$ColorMatrixEvaluator;-><init>(Lcom/android/server/display/ColorDisplayService$1;)V
-PLcom/android/server/display/ColorDisplayService$ColorMatrixEvaluator;->evaluate(FLjava/lang/Object;Ljava/lang/Object;)Ljava/lang/Object;
-PLcom/android/server/display/ColorDisplayService$CustomAutoMode$1;-><init>(Lcom/android/server/display/ColorDisplayService$CustomAutoMode;Lcom/android/server/display/ColorDisplayService;)V
-PLcom/android/server/display/ColorDisplayService$CustomAutoMode;-><init>(Lcom/android/server/display/ColorDisplayService;)V
-PLcom/android/server/display/ColorDisplayService$CustomAutoMode;->onActivated(Z)V
-PLcom/android/server/display/ColorDisplayService$CustomAutoMode;->onAlarm()V
-PLcom/android/server/display/ColorDisplayService$CustomAutoMode;->onStart()V
-PLcom/android/server/display/ColorDisplayService$CustomAutoMode;->updateActivated()V
-PLcom/android/server/display/ColorDisplayService$CustomAutoMode;->updateNextAlarm(Ljava/lang/Boolean;Ljava/time/LocalDateTime;)V
-PLcom/android/server/display/ColorDisplayService;-><init>(Landroid/content/Context;)V
-PLcom/android/server/display/ColorDisplayService;->access$1000(Lcom/android/server/display/ColorDisplayService;)Ljava/lang/Boolean;
-PLcom/android/server/display/ColorDisplayService;->access$602(Lcom/android/server/display/ColorDisplayService;Landroid/animation/ValueAnimator;)Landroid/animation/ValueAnimator;
-PLcom/android/server/display/ColorDisplayService;->applyTint(Z)V
-PLcom/android/server/display/ColorDisplayService;->getDateTimeAfter(Ljava/time/LocalTime;Ljava/time/LocalDateTime;)Ljava/time/LocalDateTime;
-PLcom/android/server/display/ColorDisplayService;->getDateTimeBefore(Ljava/time/LocalTime;Ljava/time/LocalDateTime;)Ljava/time/LocalDateTime;
-PLcom/android/server/display/ColorDisplayService;->isUserSetupCompleted(Landroid/content/ContentResolver;I)Z
-PLcom/android/server/display/ColorDisplayService;->onActivated(Z)V
-PLcom/android/server/display/ColorDisplayService;->onAutoModeChanged(I)V
-PLcom/android/server/display/ColorDisplayService;->onBootPhase(I)V
-PLcom/android/server/display/ColorDisplayService;->onDisplayColorModeChanged(I)V
-PLcom/android/server/display/ColorDisplayService;->onStart()V
-PLcom/android/server/display/ColorDisplayService;->onStartUser(I)V
-PLcom/android/server/display/ColorDisplayService;->onUserChanged(I)V
-PLcom/android/server/display/ColorDisplayService;->setCoefficientMatrix(Landroid/content/Context;Z)V
-PLcom/android/server/display/ColorDisplayService;->setMatrix(I[F)V
-PLcom/android/server/display/ColorDisplayService;->setUp()V
+PLcom/android/server/display/color/ColorDisplayService$2;-><init>(Lcom/android/server/display/color/ColorDisplayService;Lcom/android/server/display/color/DisplayTransformManager;)V
+PLcom/android/server/display/color/ColorDisplayService$2;->onAnimationUpdate(Landroid/animation/ValueAnimator;)V
+PLcom/android/server/display/color/ColorDisplayService$3;-><init>(Lcom/android/server/display/color/ColorDisplayService;Lcom/android/server/display/color/DisplayTransformManager;[F)V
+PLcom/android/server/display/color/ColorDisplayService$3;->onAnimationEnd(Landroid/animation/Animator;)V
+PLcom/android/server/display/color/ColorDisplayService$AutoMode;-><init>(Lcom/android/server/display/color/ColorDisplayService;)V
+PLcom/android/server/display/color/ColorDisplayService$AutoMode;-><init>(Lcom/android/server/display/color/ColorDisplayService;Lcom/android/server/display/color/ColorDisplayService$1;)V
+PLcom/android/server/display/color/ColorDisplayService$ColorMatrixEvaluator;-><init>()V
+PLcom/android/server/display/color/ColorDisplayService$ColorMatrixEvaluator;-><init>(Lcom/android/server/display/color/ColorDisplayService$1;)V
+PLcom/android/server/display/color/ColorDisplayService$ColorMatrixEvaluator;->evaluate(FLjava/lang/Object;Ljava/lang/Object;)Ljava/lang/Object;
+PLcom/android/server/display/color/ColorDisplayService$CustomAutoMode$1;-><init>(Lcom/android/server/display/color/ColorDisplayService$CustomAutoMode;Lcom/android/server/display/color/ColorDisplayService;)V
+PLcom/android/server/display/color/ColorDisplayService$CustomAutoMode;-><init>(Lcom/android/server/display/color/ColorDisplayService;)V
+PLcom/android/server/display/color/ColorDisplayService$CustomAutoMode;->onActivated(Z)V
+PLcom/android/server/display/color/ColorDisplayService$CustomAutoMode;->onAlarm()V
+PLcom/android/server/display/color/ColorDisplayService$CustomAutoMode;->onStart()V
+PLcom/android/server/display/color/ColorDisplayService$CustomAutoMode;->updateActivated()V
+PLcom/android/server/display/color/ColorDisplayService$CustomAutoMode;->updateNextAlarm(Ljava/lang/Boolean;Ljava/time/LocalDateTime;)V
+PLcom/android/server/display/color/ColorDisplayService;-><init>(Landroid/content/Context;)V
+PLcom/android/server/display/color/ColorDisplayService;->access$1000(Lcom/android/server/display/color/ColorDisplayService;)Ljava/lang/Boolean;
+PLcom/android/server/display/color/ColorDisplayService;->access$602(Lcom/android/server/display/color/ColorDisplayService;Landroid/animation/ValueAnimator;)Landroid/animation/ValueAnimator;
+PLcom/android/server/display/color/ColorDisplayService;->applyTint(Z)V
+PLcom/android/server/display/color/ColorDisplayService;->getDateTimeAfter(Ljava/time/LocalTime;Ljava/time/LocalDateTime;)Ljava/time/LocalDateTime;
+PLcom/android/server/display/color/ColorDisplayService;->getDateTimeBefore(Ljava/time/LocalTime;Ljava/time/LocalDateTime;)Ljava/time/LocalDateTime;
+PLcom/android/server/display/color/ColorDisplayService;->isUserSetupCompleted(Landroid/content/ContentResolver;I)Z
+PLcom/android/server/display/color/ColorDisplayService;->onActivated(Z)V
+PLcom/android/server/display/color/ColorDisplayService;->onAutoModeChanged(I)V
+PLcom/android/server/display/color/ColorDisplayService;->onBootPhase(I)V
+PLcom/android/server/display/color/ColorDisplayService;->onDisplayColorModeChanged(I)V
+PLcom/android/server/display/color/ColorDisplayService;->onStart()V
+PLcom/android/server/display/color/ColorDisplayService;->onStartUser(I)V
+PLcom/android/server/display/color/ColorDisplayService;->onUserChanged(I)V
+PLcom/android/server/display/color/ColorDisplayService;->setCoefficientMatrix(Landroid/content/Context;Z)V
+PLcom/android/server/display/color/ColorDisplayService;->setMatrix(I[F)V
+PLcom/android/server/display/color/ColorDisplayService;->setUp()V
 PLcom/android/server/display/ColorFade$NaturalSurfaceLayout;-><init>(Landroid/hardware/display/DisplayManagerInternal;ILandroid/view/SurfaceControl;)V
 PLcom/android/server/display/ColorFade$NaturalSurfaceLayout;->dispose()V
 PLcom/android/server/display/ColorFade$NaturalSurfaceLayout;->onDisplayTransaction()V
@@ -10878,17 +10878,17 @@
 PLcom/android/server/display/DisplayPowerState;->setScreenBrightness(I)V
 PLcom/android/server/display/DisplayPowerState;->setScreenState(I)V
 PLcom/android/server/display/DisplayPowerState;->waitUntilClean(Ljava/lang/Runnable;)Z
-PLcom/android/server/display/DisplayTransformManager;->applyColorMatrix([F)V
-PLcom/android/server/display/DisplayTransformManager;->applySaturation(F)V
-PLcom/android/server/display/DisplayTransformManager;->computeColorMatrixLocked()[F
-PLcom/android/server/display/DisplayTransformManager;->getColorMatrix(I)[F
-PLcom/android/server/display/DisplayTransformManager;->needsLinearColorMatrix()Z
-PLcom/android/server/display/DisplayTransformManager;->needsLinearColorMatrix(I)Z
-PLcom/android/server/display/DisplayTransformManager;->setColorMatrix(I[F)V
-PLcom/android/server/display/DisplayTransformManager;->setColorMode(I[F)Z
-PLcom/android/server/display/DisplayTransformManager;->setDaltonizerMode(I)V
-PLcom/android/server/display/DisplayTransformManager;->setDisplayColor(I)V
-PLcom/android/server/display/DisplayTransformManager;->updateConfiguration()V
+PLcom/android/server/display/color/DisplayTransformManager;->applyColorMatrix([F)V
+PLcom/android/server/display/color/DisplayTransformManager;->applySaturation(F)V
+PLcom/android/server/display/color/DisplayTransformManager;->computeColorMatrixLocked()[F
+PLcom/android/server/display/color/DisplayTransformManager;->getColorMatrix(I)[F
+PLcom/android/server/display/color/DisplayTransformManager;->needsLinearColorMatrix()Z
+PLcom/android/server/display/color/DisplayTransformManager;->needsLinearColorMatrix(I)Z
+PLcom/android/server/display/color/DisplayTransformManager;->setColorMatrix(I[F)V
+PLcom/android/server/display/color/DisplayTransformManager;->setColorMode(I[F)Z
+PLcom/android/server/display/color/DisplayTransformManager;->setDaltonizerMode(I)V
+PLcom/android/server/display/color/DisplayTransformManager;->setDisplayColor(I)V
+PLcom/android/server/display/color/DisplayTransformManager;->updateConfiguration()V
 PLcom/android/server/display/HysteresisLevels;-><init>([I[I[I)V
 PLcom/android/server/display/HysteresisLevels;->getBrighteningThreshold(F)F
 PLcom/android/server/display/HysteresisLevels;->getDarkeningThreshold(F)F
@@ -19436,7 +19436,7 @@
 SPLcom/android/server/display/DisplayManagerService;->sendDisplayEventLocked(II)V
 SPLcom/android/server/display/DisplayManagerService;->updateDisplayStateLocked(Lcom/android/server/display/DisplayDevice;)Ljava/lang/Runnable;
 SPLcom/android/server/display/DisplayManagerService;->updateLogicalDisplaysLocked()Z
-SPLcom/android/server/display/DisplayTransformManager;-><init>()V
+SPLcom/android/server/display/color/DisplayTransformManager;-><init>()V
 SPLcom/android/server/display/LocalDisplayAdapter$DisplayModeRecord;-><init>(Landroid/view/SurfaceControl$PhysicalDisplayInfo;)V
 SPLcom/android/server/display/LocalDisplayAdapter$DisplayModeRecord;->hasMatchingMode(Landroid/view/SurfaceControl$PhysicalDisplayInfo;)Z
 SPLcom/android/server/display/LocalDisplayAdapter$HotplugDisplayEventReceiver;-><init>(Lcom/android/server/display/LocalDisplayAdapter;Landroid/os/Looper;)V
diff --git a/services/autofill/java/com/android/server/autofill/AutofillManagerService.java b/services/autofill/java/com/android/server/autofill/AutofillManagerService.java
index 245e2c9..0e852f8 100644
--- a/services/autofill/java/com/android/server/autofill/AutofillManagerService.java
+++ b/services/autofill/java/com/android/server/autofill/AutofillManagerService.java
@@ -479,13 +479,16 @@
 
     private void setDeviceConfigProperties() {
         synchronized (mLock) {
-            mAugmentedServiceIdleUnbindTimeoutMs = Helper.getIntDeviceConfigProperty(
+            mAugmentedServiceIdleUnbindTimeoutMs = DeviceConfig.getInt(
+                    DeviceConfig.NAMESPACE_AUTOFILL,
                     AutofillManager.DEVICE_CONFIG_AUGMENTED_SERVICE_IDLE_UNBIND_TIMEOUT,
                     (int) AbstractRemoteService.PERMANENT_BOUND_TIMEOUT_MS);
-            mAugmentedServiceRequestTimeoutMs = Helper.getIntDeviceConfigProperty(
+            mAugmentedServiceRequestTimeoutMs = DeviceConfig.getInt(
+                    DeviceConfig.NAMESPACE_AUTOFILL,
                     AutofillManager.DEVICE_CONFIG_AUGMENTED_SERVICE_REQUEST_TIMEOUT,
                     DEFAULT_AUGMENTED_AUTOFILL_REQUEST_TIMEOUT_MILLIS);
-            mSupportedSmartSuggestionModes = Helper.getIntDeviceConfigProperty(
+            mSupportedSmartSuggestionModes = DeviceConfig.getInt(
+                    DeviceConfig.NAMESPACE_AUTOFILL,
                     AutofillManager.DEVICE_CONFIG_AUTOFILL_SMART_SUGGESTION_SUPPORTED_MODES,
                     AutofillManager.FLAG_SMART_SUGGESTION_SYSTEM);
             if (verbose) {
diff --git a/services/autofill/java/com/android/server/autofill/AutofillManagerServiceImpl.java b/services/autofill/java/com/android/server/autofill/AutofillManagerServiceImpl.java
index 3f33813..f5f26a3 100644
--- a/services/autofill/java/com/android/server/autofill/AutofillManagerServiceImpl.java
+++ b/services/autofill/java/com/android/server/autofill/AutofillManagerServiceImpl.java
@@ -72,6 +72,7 @@
 
 import com.android.internal.R;
 import com.android.internal.annotations.GuardedBy;
+import com.android.internal.infra.WhitelistHelper;
 import com.android.internal.logging.MetricsLogger;
 import com.android.internal.logging.nano.MetricsProto.MetricsEvent;
 import com.android.server.LocalServices;
@@ -173,10 +174,10 @@
     private ServiceInfo mRemoteAugmentedAutofillServiceInfo;
 
     /**
-     * List of packages that are whitelisted to be trigger augmented autofill.
+     * List of packages/activities that are whitelisted to be trigger augmented autofill.
      */
     @GuardedBy("mLock")
-    private final ArraySet<String> mWhitelistedAugmentAutofillPackages = new ArraySet<>();
+    private final WhitelistHelper mAugmentedWhitelistHelper = new WhitelistHelper();
 
     AutofillManagerServiceImpl(AutofillManagerService master, Object lock,
             LocalLog uiLatencyHistory, LocalLog wtfHistory, int userId, AutoFillUI ui,
@@ -905,13 +906,7 @@
             pw.println(mRemoteAugmentedAutofillServiceInfo);
         }
 
-        final int whitelistSize = mWhitelistedAugmentAutofillPackages.size();
-        pw.print(prefix); pw.print("Packages whitelisted for augmented autofill: ");
-        pw.println(whitelistSize);
-        for (int i = 0; i < whitelistSize; i++) {
-            final String whitelistedPkg = mWhitelistedAugmentAutofillPackages.valueAt(i);
-            pw.print(prefix2); pw.print(i + 1); pw.print(": "); pw.println(whitelistedPkg);
-        }
+        mAugmentedWhitelistHelper.dump(prefix, "Augmented autofill whitelist", pw);
 
         pw.print(prefix); pw.print("Field classification enabled: ");
             pw.println(isFieldClassificationEnabledLocked());
@@ -1107,6 +1102,7 @@
                 }
                 mRemoteAugmentedAutofillService.destroy();
                 mRemoteAugmentedAutofillService = null;
+                mRemoteAugmentedAutofillServiceInfo = null;
             }
 
             mRemoteAugmentedAutofillService = getRemoteAugmentedAutofillServiceLocked();
@@ -1129,9 +1125,8 @@
             Slog.v(TAG, "setAugmentedAutofillWhitelistLocked(packages=" + packages + ", activities="
                     + activities + ")");
         }
-        whitelistForAugmentedAutofillPackages(packages);
+        whitelistForAugmentedAutofillPackages(packages, activities);
 
-        // TODO(b/123100824): whitelist activities as well
         // TODO(b/122858578): log metrics
         return true;
     }
@@ -1171,28 +1166,29 @@
 
     @GuardedBy("mLock")
     boolean isWhitelistedForAugmentedAutofillLocked(@NonNull ComponentName componentName) {
-        // TODO(b/122595322): need to check whitelisted activities as well.
-        final String packageName = componentName.getPackageName();
-        return mWhitelistedAugmentAutofillPackages.contains(packageName);
+        return mAugmentedWhitelistHelper.isWhitelisted(componentName);
     }
 
     @GuardedBy("mLock")
     void setAugmentedAutofillWhitelistLocked(@NonNull AutofillOptions options,
             @NonNull String packageName) {
-        // TODO(b/122595322): need to setwhitelisted activities as well.
-        options.augmentedEnabled = mWhitelistedAugmentAutofillPackages.contains(packageName);
+        options.augmentedAutofillEnabled = mAugmentedWhitelistHelper.isWhitelisted(packageName);
+        options.whitelistedActivitiesForAugmentedAutofill = mAugmentedWhitelistHelper
+                .getWhitelistedComponents(packageName);
     }
 
-    private void whitelistForAugmentedAutofillPackages(@NonNull List<String> packages) {
+    /**
+     *
+     * @throws IllegalArgumentException if packages or components are empty.
+     */
+    private void whitelistForAugmentedAutofillPackages(@Nullable List<String> packages,
+            @Nullable List<ComponentName> components) {
         // TODO(b/123100824): add CTS test for when it's null
         synchronized (mLock) {
-            if (packages == null) {
-                if (mMaster.verbose) Slog.v(TAG, "clearing all whitelisted augmented packages");
-                mWhitelistedAugmentAutofillPackages.clear();
-            } else {
-                if (mMaster.verbose) Slog.v(TAG, "whitelisting augmented packages: " + packages);
-                mWhitelistedAugmentAutofillPackages.addAll(packages);
+            if (mMaster.verbose) {
+                Slog.v(TAG, "whitelisting packages: " + packages + "and activities: " + components);
             }
+            mAugmentedWhitelistHelper.setWhitelist(packages, components);
             mRemoteAugmentedAutofillService = getRemoteAugmentedAutofillServiceLocked();
         }
     }
diff --git a/services/autofill/java/com/android/server/autofill/Helper.java b/services/autofill/java/com/android/server/autofill/Helper.java
index d300bf2..3c0da7d 100644
--- a/services/autofill/java/com/android/server/autofill/Helper.java
+++ b/services/autofill/java/com/android/server/autofill/Helper.java
@@ -22,11 +22,9 @@
 import android.app.assist.AssistStructure.ViewNode;
 import android.content.ComponentName;
 import android.metrics.LogMaker;
-import android.provider.DeviceConfig;
 import android.service.autofill.Dataset;
 import android.util.ArrayMap;
 import android.util.ArraySet;
-import android.util.Log;
 import android.util.Slog;
 import android.view.WindowManager;
 import android.view.autofill.AutofillId;
@@ -207,21 +205,6 @@
         }
     }
 
-    /**
-     * Gets the value of a device config property from the Autofill namespace.
-     */
-    static int getIntDeviceConfigProperty(@NonNull String key, int defaultValue) {
-        final String value = DeviceConfig.getProperty(DeviceConfig.NAMESPACE_AUTOFILL, key);
-        if (value == null) return defaultValue;
-
-        try {
-            return Integer.parseInt(value);
-        } catch (Exception e) {
-            Log.w(TAG, "error parsing value (" + value + ") of property " + key + ": " + e);
-            return defaultValue;
-        }
-    }
-
     private interface ViewNodeFilter {
         boolean matches(ViewNode node);
     }
diff --git a/services/autofill/java/com/android/server/autofill/RemoteAugmentedAutofillService.java b/services/autofill/java/com/android/server/autofill/RemoteAugmentedAutofillService.java
index a38c3cf..aaba1ed 100644
--- a/services/autofill/java/com/android/server/autofill/RemoteAugmentedAutofillService.java
+++ b/services/autofill/java/com/android/server/autofill/RemoteAugmentedAutofillService.java
@@ -55,7 +55,7 @@
             boolean bindInstantServiceAllowed, boolean verbose, int idleUnbindTimeoutMs,
             int requestTimeoutMs) {
         super(context, AugmentedAutofillService.SERVICE_INTERFACE, serviceName, userId, callbacks,
-                bindInstantServiceAllowed, verbose);
+                context.getMainThreadHandler(), bindInstantServiceAllowed, verbose);
         mIdleUnbindTimeoutMs = idleUnbindTimeoutMs;
         mRequestTimeoutMs = requestTimeoutMs;
 
diff --git a/services/autofill/java/com/android/server/autofill/RemoteFillService.java b/services/autofill/java/com/android/server/autofill/RemoteFillService.java
index e8a52b4..b8a7d44 100644
--- a/services/autofill/java/com/android/server/autofill/RemoteFillService.java
+++ b/services/autofill/java/com/android/server/autofill/RemoteFillService.java
@@ -64,7 +64,7 @@
     RemoteFillService(Context context, ComponentName componentName, int userId,
             FillServiceCallbacks callbacks, boolean bindInstantServiceAllowed) {
         super(context, AutofillService.SERVICE_INTERFACE, componentName, userId, callbacks,
-                bindInstantServiceAllowed, sVerbose);
+                context.getMainThreadHandler(), bindInstantServiceAllowed, sVerbose);
         mCallbacks = callbacks;
     }
 
diff --git a/services/autofill/java/com/android/server/autofill/Session.java b/services/autofill/java/com/android/server/autofill/Session.java
index 2b94d10d6..7fbfc42 100644
--- a/services/autofill/java/com/android/server/autofill/Session.java
+++ b/services/autofill/java/com/android/server/autofill/Session.java
@@ -335,7 +335,7 @@
                 if (mContexts == null) {
                     mContexts = new ArrayList<>(1);
                 }
-                mContexts.add(new FillContext(requestId, structure));
+                mContexts.add(new FillContext(requestId, structure, mCurrentViewId));
 
                 cancelCurrentRequestLocked();
 
diff --git a/services/contentcapture/java/com/android/server/contentcapture/ContentCaptureManagerService.java b/services/contentcapture/java/com/android/server/contentcapture/ContentCaptureManagerService.java
index 9f7a940..c75b4c6 100644
--- a/services/contentcapture/java/com/android/server/contentcapture/ContentCaptureManagerService.java
+++ b/services/contentcapture/java/com/android/server/contentcapture/ContentCaptureManagerService.java
@@ -43,6 +43,7 @@
 import android.os.UserManager;
 import android.provider.DeviceConfig;
 import android.provider.Settings;
+import android.service.contentcapture.ActivityEvent.ActivityEventType;
 import android.util.LocalLog;
 import android.util.Slog;
 import android.util.SparseBooleanArray;
@@ -89,11 +90,11 @@
     private ActivityManagerInternal mAm;
 
     /**
-     * Users disabled by {@link android.provider.Settings.Secure#CONTENT_CAPTURE_ENABLED}.
+     * Users disabled by {@link android.provider.Settings.Secure#CONTENT_CAPTURE_ENABLED}
      */
     @GuardedBy("mLock")
     @Nullable
-    private SparseBooleanArray mDisabledUsers;
+    private SparseBooleanArray mDisabledBySettings;
 
     /**
      * Global kill-switch based on value defined by
@@ -130,18 +131,18 @@
             mRequestsHistory = null;
         }
 
-        // Sets which services are disabled
+        // Sets which services are disabled by settings
         final UserManager um = getContext().getSystemService(UserManager.class);
         final List<UserInfo> users = um.getUsers();
         for (int i = 0; i < users.size(); i++) {
             final int userId = users.get(i).id;
-            final boolean disabled = mDisabledByDeviceConfig || isDisabledBySettings(userId);
+            final boolean disabled = !isEnabledBySettings(userId);
             if (disabled) {
-                Slog.i(mTag, "user " + userId + " disabled by settings or device config");
-                if (mDisabledUsers == null) {
-                    mDisabledUsers = new SparseBooleanArray(1);
+                Slog.i(mTag, "user " + userId + " disabled by settings");
+                if (mDisabledBySettings == null) {
+                    mDisabledBySettings = new SparseBooleanArray(1);
                 }
-                mDisabledUsers.put(userId, true);
+                mDisabledBySettings.put(userId, true);
             }
         }
     }
@@ -187,7 +188,8 @@
     protected void onSettingsChanged(@UserIdInt int userId, @NonNull String property) {
         switch (property) {
             case Settings.Secure.CONTENT_CAPTURE_ENABLED:
-                setContentCaptureFeatureEnabledFromSettings(userId);
+                setContentCaptureFeatureEnabledBySettingsForUser(userId,
+                        isEnabledBySettings(userId));
                 return;
             default:
                 Slog.w(mTag, "Unexpected property (" + property + "); updating cache instead");
@@ -201,31 +203,13 @@
     }
 
     private boolean isDisabledBySettingsLocked(@UserIdInt int userId) {
-        return mDisabledUsers != null && mDisabledUsers.get(userId);
+        return mDisabledBySettings != null && mDisabledBySettings.get(userId);
     }
 
-    private void setContentCaptureFeatureEnabledFromSettings(@UserIdInt int userId) {
-        setContentCaptureFeatureEnabledForUser(userId, !isDisabledBySettings(userId));
-    }
-
-    private boolean isDisabledBySettings(@UserIdInt int userId) {
-        final String property = Settings.Secure.CONTENT_CAPTURE_ENABLED;
-        final String value = Settings.Secure.getStringForUser(getContext().getContentResolver(),
-                property, userId);
-        if (value == null) {
-            if (verbose) {
-                Slog.v(mTag, "isDisabledBySettings(): assuming false as '" + property
-                        + "' is not set");
-            }
-            return false;
-        }
-
-        try {
-            return !Boolean.valueOf(value);
-        } catch (Exception e) {
-            Slog.w(mTag, "Invalid value for property " + property + ": " + value);
-        }
-        return false;
+    private boolean isEnabledBySettings(@UserIdInt int userId) {
+        final boolean enabled = Settings.Secure.getIntForUser(getContext().getContentResolver(),
+                Settings.Secure.CONTENT_CAPTURE_ENABLED, 1, userId) == 1 ? true : false;
+        return enabled;
     }
 
     private void onDeviceConfigChange(@NonNull String key, @Nullable String value) {
@@ -250,18 +234,23 @@
 
     private void setFineTuneParamsFromDeviceConfig() {
         synchronized (mLock) {
-            mDevCfgMaxBufferSize = ContentCaptureHelper.getIntDeviceConfigProperty(
+            mDevCfgMaxBufferSize = DeviceConfig.getInt(
+                    DeviceConfig.NAMESPACE_CONTENT_CAPTURE,
                     ContentCaptureManager.DEVICE_CONFIG_PROPERTY_MAX_BUFFER_SIZE,
                     ContentCaptureManager.DEFAULT_MAX_BUFFER_SIZE);
-            mDevCfgIdleFlushingFrequencyMs = ContentCaptureHelper.getIntDeviceConfigProperty(
+            mDevCfgIdleFlushingFrequencyMs = DeviceConfig.getInt(
+                    DeviceConfig.NAMESPACE_CONTENT_CAPTURE,
                     ContentCaptureManager.DEVICE_CONFIG_PROPERTY_IDLE_FLUSH_FREQUENCY,
                     ContentCaptureManager.DEFAULT_IDLE_FLUSHING_FREQUENCY_MS);
-            mDevCfgTextChangeFlushingFrequencyMs = ContentCaptureHelper.getIntDeviceConfigProperty(
+            mDevCfgTextChangeFlushingFrequencyMs = DeviceConfig.getInt(
+                    DeviceConfig.NAMESPACE_CONTENT_CAPTURE,
                     ContentCaptureManager.DEVICE_CONFIG_PROPERTY_TEXT_CHANGE_FLUSH_FREQUENCY,
                     ContentCaptureManager.DEFAULT_TEXT_CHANGE_FLUSHING_FREQUENCY_MS);
-            mDevCfgLogHistorySize = ContentCaptureHelper.getIntDeviceConfigProperty(
+            mDevCfgLogHistorySize = DeviceConfig.getInt(
+                    DeviceConfig.NAMESPACE_CONTENT_CAPTURE,
                     ContentCaptureManager.DEVICE_CONFIG_PROPERTY_LOG_HISTORY_SIZE, 20);
-            mDevCfgIdleUnbindTimeoutMs = ContentCaptureHelper.getIntDeviceConfigProperty(
+            mDevCfgIdleUnbindTimeoutMs = DeviceConfig.getInt(
+                    DeviceConfig.NAMESPACE_CONTENT_CAPTURE,
                     ContentCaptureManager.DEVICE_CONFIG_PROPERTY_IDLE_UNBIND_TIMEOUT,
                     (int) AbstractRemoteService.PERMANENT_BOUND_TIMEOUT_MS);
             if (verbose) {
@@ -276,7 +265,8 @@
     }
 
     private void setLoggingLevelFromDeviceConfig() {
-        mDevCfgLoggingLevel = ContentCaptureHelper.getIntDeviceConfigProperty(
+        mDevCfgLoggingLevel = DeviceConfig.getInt(
+                DeviceConfig.NAMESPACE_CONTENT_CAPTURE,
                 ContentCaptureManager.DEVICE_CONFIG_PROPERTY_LOGGING_LEVEL,
                 ContentCaptureHelper.getDefaultLoggingLevel());
         ContentCaptureHelper.setLoggingLevel(mDevCfgLoggingLevel);
@@ -331,12 +321,13 @@
         }
     }
 
-    private void setContentCaptureFeatureEnabledForUser(@UserIdInt int userId, boolean enabled) {
+    private void setContentCaptureFeatureEnabledBySettingsForUser(@UserIdInt int userId,
+            boolean enabled) {
         synchronized (mLock) {
-            if (mDisabledUsers == null) {
-                mDisabledUsers = new SparseBooleanArray();
+            if (mDisabledBySettings == null) {
+                mDisabledBySettings = new SparseBooleanArray();
             }
-            final boolean alreadyEnabled = !mDisabledUsers.get(userId);
+            final boolean alreadyEnabled = !mDisabledBySettings.get(userId);
             if (!(enabled ^ alreadyEnabled)) {
                 if (debug) {
                     Slog.d(mTag, "setContentCaptureFeatureEnabledForUser(): already " + enabled);
@@ -346,13 +337,14 @@
             if (enabled) {
                 Slog.i(mTag, "setContentCaptureFeatureEnabled(): enabling service for user "
                         + userId);
-                mDisabledUsers.delete(userId);
+                mDisabledBySettings.delete(userId);
             } else {
                 Slog.i(mTag, "setContentCaptureFeatureEnabled(): disabling service for user "
                         + userId);
-                mDisabledUsers.put(userId, true);
+                mDisabledBySettings.put(userId, true);
             }
-            updateCachedServiceLocked(userId, !enabled);
+            final boolean disabled = !enabled || mDisabledByDeviceConfig;
+            updateCachedServiceLocked(userId, disabled);
         }
     }
 
@@ -472,7 +464,7 @@
 
         final String prefix2 = prefix + "  ";
 
-        pw.print(prefix); pw.print("Disabled users: "); pw.println(mDisabledUsers);
+        pw.print(prefix); pw.print("Users disabled by Settings: "); pw.println(mDisabledBySettings);
         pw.print(prefix); pw.println("DeviceConfig Settings: ");
         pw.print(prefix2); pw.print("disabled: "); pw.println(mDisabledByDeviceConfig);
         pw.print(prefix2); pw.print("loggingLevel: "); pw.println(mDevCfgLoggingLevel);
@@ -632,7 +624,7 @@
         }
 
         @Override
-        public ContentCaptureOptions getOptionsForPackage(int userId, String packageName) {
+        public ContentCaptureOptions getOptionsForPackage(int userId, @NonNull String packageName) {
             synchronized (mLock) {
                 final ContentCapturePerUserService service = peekServiceForUserLocked(userId);
                 if (service != null) {
@@ -641,5 +633,16 @@
             }
             return null;
         }
+
+        @Override
+        public void notifyActivityEvent(int userId, @NonNull ComponentName activityComponent,
+                @ActivityEventType int eventType) {
+            synchronized (mLock) {
+                final ContentCapturePerUserService service = peekServiceForUserLocked(userId);
+                if (service != null) {
+                    service.onActivityEventLocked(activityComponent, eventType);
+                }
+            }
+        }
     }
 }
diff --git a/services/contentcapture/java/com/android/server/contentcapture/ContentCapturePerUserService.java b/services/contentcapture/java/com/android/server/contentcapture/ContentCapturePerUserService.java
index b33259d..feb1ac1 100644
--- a/services/contentcapture/java/com/android/server/contentcapture/ContentCapturePerUserService.java
+++ b/services/contentcapture/java/com/android/server/contentcapture/ContentCapturePerUserService.java
@@ -20,8 +20,8 @@
 import static android.view.contentcapture.ContentCaptureSession.STATE_DISABLED;
 import static android.view.contentcapture.ContentCaptureSession.STATE_DUPLICATED_ID;
 import static android.view.contentcapture.ContentCaptureSession.STATE_INTERNAL_ERROR;
+import static android.view.contentcapture.ContentCaptureSession.STATE_NOT_WHITELISTED;
 import static android.view.contentcapture.ContentCaptureSession.STATE_NO_SERVICE;
-import static android.view.contentcapture.ContentCaptureSession.STATE_PACKAGE_NOT_WHITELISTED;
 
 import static com.android.server.wm.ActivityTaskManagerInternal.ASSIST_KEY_CONTENT;
 import static com.android.server.wm.ActivityTaskManagerInternal.ASSIST_KEY_DATA;
@@ -29,6 +29,7 @@
 
 import android.Manifest;
 import android.annotation.NonNull;
+import android.annotation.Nullable;
 import android.annotation.UserIdInt;
 import android.app.ActivityManagerInternal;
 import android.app.AppGlobals;
@@ -46,6 +47,8 @@
 import android.os.RemoteException;
 import android.os.UserHandle;
 import android.provider.Settings;
+import android.service.contentcapture.ActivityEvent;
+import android.service.contentcapture.ActivityEvent.ActivityEventType;
 import android.service.contentcapture.ContentCaptureService;
 import android.service.contentcapture.IContentCaptureServiceCallback;
 import android.service.contentcapture.SnapshotData;
@@ -55,6 +58,7 @@
 import android.view.contentcapture.UserDataRemovalRequest;
 
 import com.android.internal.annotations.GuardedBy;
+import com.android.internal.infra.WhitelistHelper;
 import com.android.internal.os.IResultReceiver;
 import com.android.server.LocalServices;
 import com.android.server.contentcapture.RemoteContentCaptureService.ContentCaptureServiceCallbacks;
@@ -94,7 +98,7 @@
      * List of packages that are whitelisted to be content captured.
      */
     @GuardedBy("mLock")
-    private final ArraySet<String> mWhitelistedPackages = new ArraySet<>();
+    private final WhitelistHelper mWhitelistHelper = new WhitelistHelper();
 
     // TODO(b/111276913): add mechanism to prune stale sessions, similar to Autofill's
 
@@ -173,10 +177,8 @@
 
     @Override // from ContentCaptureServiceCallbacks
     public void onServiceDied(@NonNull RemoteContentCaptureService service) {
-        if (mMaster.debug) Slog.d(TAG, "remote service died: " + service);
-        synchronized (mLock) {
-            removeSelfFromCacheLocked();
-        }
+        // Don't do anything; eventually the system will bind to it again...
+        Slog.w(TAG, "remote service died: " + service);
     }
 
     // TODO(b/119613670): log metrics
@@ -194,7 +196,7 @@
         final int taskId = activityPresentationInfo.taskId;
         final int displayId = activityPresentationInfo.displayId;
         final ComponentName componentName = activityPresentationInfo.componentName;
-        final boolean whitelisted = isWhitelistedLocked(componentName);
+        final boolean whiteListed = isWhitelistedLocked(componentName);
         final ComponentName serviceComponentName = getServiceComponentName();
         final boolean enabled = isEnabledLocked();
         if (mMaster.mRequestsHistory != null) {
@@ -204,7 +206,7 @@
                     + " t=" + taskId + " d=" + displayId
                     + " s=" + ComponentName.flattenToShortString(serviceComponentName)
                     + " u=" + mUserId + " f=" + flags + (enabled ? "" : " (disabled)")
-                    + " w=" + whitelisted;
+                    + " w=" + whiteListed;
             mMaster.mRequestsHistory.log(historyItem);
         }
 
@@ -225,12 +227,12 @@
             return;
         }
 
-        if (!whitelisted) {
+        if (!whiteListed) {
             if (mMaster.debug) {
-                Slog.d(TAG, "startSession(" + componentName + "): not whitelisted");
+                Slog.d(TAG, "startSession(" + componentName + "): package or component "
+                        + "not whitelisted");
             }
-            // TODO(b/122595322): need to return STATE_ACTIVITY_NOT_WHITELISTED as well
-            setClientState(clientReceiver, STATE_DISABLED | STATE_PACKAGE_NOT_WHITELISTED,
+            setClientState(clientReceiver, STATE_DISABLED | STATE_NOT_WHITELISTED,
                     /* binder= */ null);
             return;
         }
@@ -270,21 +272,21 @@
 
     @GuardedBy("mLock")
     private boolean isWhitelistedLocked(@NonNull ComponentName componentName) {
-        // TODO(b/122595322): need to check whitelisted activities as well.
-        final String packageName = componentName.getPackageName();
-        return mWhitelistedPackages.contains(packageName);
+        return mWhitelistHelper.isWhitelisted(componentName);
     }
 
-    private void whitelistPackages(@NonNull List<String> packages) {
+    /**
+     * @throws IllegalArgumentException if packages or components are empty.
+     */
+    private void setWhitelist(@Nullable List<String> packages,
+            @Nullable List<ComponentName> components) {
         // TODO(b/122595322): add CTS test for when it's null
         synchronized (mLock) {
-            if (packages == null) {
-                if (mMaster.verbose) Slog.v(TAG, "clearing all whitelisted packages");
-                mWhitelistedPackages.clear();
-            } else {
-                if (mMaster.verbose) Slog.v(TAG, "whitelisting packages: " + packages);
-                mWhitelistedPackages.addAll(packages);
+            if (mMaster.verbose) {
+                Slog.v(TAG, "whitelisting packages: " + packages + " and activities: "
+                        + components);
             }
+            mWhitelistHelper.setWhitelist(packages, components);
         }
     }
 
@@ -411,15 +413,15 @@
 
     @GuardedBy("mLock")
     ContentCaptureOptions getOptionsForPackageLocked(@NonNull String packageName) {
-        if (!mWhitelistedPackages.contains(packageName)) {
+        if (!mWhitelistHelper.isWhitelisted(packageName)) {
             if (mMaster.verbose) {
                 Slog.v(mTag, "getOptionsForPackage(" + packageName + "): not whitelisted");
             }
             return null;
         }
 
-        // TODO(b/122595322): need to check whitelisted activities as well.
-        final ArraySet<ComponentName> whitelistedComponents = null;
+        final ArraySet<ComponentName> whitelistedComponents = mWhitelistHelper
+                .getWhitelistedComponents(packageName);
         ContentCaptureOptions options = new ContentCaptureOptions(mMaster.mDevCfgLoggingLevel,
                 mMaster.mDevCfgMaxBufferSize, mMaster.mDevCfgIdleFlushingFrequencyMs,
                 mMaster.mDevCfgTextChangeFlushingFrequencyMs, mMaster.mDevCfgLogHistorySize,
@@ -430,6 +432,19 @@
         return options;
     }
 
+    @GuardedBy("mLock")
+    void onActivityEventLocked(@NonNull ComponentName componentName, @ActivityEventType int type) {
+        if (mRemoteService == null) {
+            if (mMaster.debug) Slog.d(mTag, "onActivityEvent(): no remote service");
+            return;
+        }
+        final ActivityEvent event = new ActivityEvent(componentName, type);
+
+        if (mMaster.verbose) Slog.v(mTag, "onActivityEvent(): " + event);
+
+        mRemoteService.onActivityLifecycleEvent(event);
+    }
+
     @Override
     protected void dumpLocked(String prefix, PrintWriter pw) {
         super.dumpLocked(prefix, pw);
@@ -440,12 +455,7 @@
             mRemoteService.dump(prefix2, pw);
         }
 
-        final int whitelistSize = mWhitelistedPackages.size();
-        pw.print(prefix); pw.print("Whitelisted packages: "); pw.println(whitelistSize);
-        for (int i = 0; i < whitelistSize; i++) {
-            final String whitelistedPkg = mWhitelistedPackages.valueAt(i);
-            pw.print(prefix2); pw.print(i + 1); pw.print(": "); pw.println(whitelistedPkg);
-        }
+        mWhitelistHelper.dump(prefix, "Whitelist", pw);
 
         if (mSessions.isEmpty()) {
             pw.print(prefix); pw.println("no sessions");
@@ -485,9 +495,8 @@
                 Slog.v(TAG, "setContentCaptureWhitelist(packages=" + packages + ", activities="
                         + activities + ")");
             }
-            whitelistPackages(packages);
+            setWhitelist(packages, activities);
 
-            // TODO(b/122595322): whitelist activities as well
             // TODO(b/119613670): log metrics
         }
 
@@ -498,7 +507,7 @@
             final long token = Binder.clearCallingIdentity();
             try {
                 Settings.Secure.putStringForUser(getContext().getContentResolver(),
-                        Settings.Secure.CONTENT_CAPTURE_ENABLED, "false", mUserId);
+                        Settings.Secure.CONTENT_CAPTURE_ENABLED, "0", mUserId);
             } finally {
                 Binder.restoreCallingIdentity(token);
             }
diff --git a/services/contentcapture/java/com/android/server/contentcapture/RemoteContentCaptureService.java b/services/contentcapture/java/com/android/server/contentcapture/RemoteContentCaptureService.java
index dc07c0a..1d2d625 100644
--- a/services/contentcapture/java/com/android/server/contentcapture/RemoteContentCaptureService.java
+++ b/services/contentcapture/java/com/android/server/contentcapture/RemoteContentCaptureService.java
@@ -23,6 +23,7 @@
 import android.content.ComponentName;
 import android.content.Context;
 import android.os.IBinder;
+import android.service.contentcapture.ActivityEvent;
 import android.service.contentcapture.IContentCaptureService;
 import android.service.contentcapture.IContentCaptureServiceCallback;
 import android.service.contentcapture.SnapshotData;
@@ -45,7 +46,8 @@
             ContentCaptureServiceCallbacks callbacks, boolean bindInstantServiceAllowed,
             boolean verbose, int idleUnbindTimeoutMs) {
         super(context, serviceInterface, serviceComponentName, userId, callbacks,
-                bindInstantServiceAllowed, verbose, /* initialCapacity= */ 2);
+                context.getMainThreadHandler(), bindInstantServiceAllowed, verbose,
+                /* initialCapacity= */ 2);
         mServerCallback = callback.asBinder();
         mIdleUnbindTimeoutMs = idleUnbindTimeoutMs;
 
@@ -111,6 +113,13 @@
         scheduleAsyncRequest((s) -> s.onUserDataRemovalRequest(request));
     }
 
+    /**
+     * Called by {@link ContentCaptureServerSession} to notify a high-level activity event.
+     */
+    public void onActivityLifecycleEvent(@NonNull ActivityEvent event) {
+        scheduleAsyncRequest((s) -> s.onActivityEvent(event));
+    }
+
     public interface ContentCaptureServiceCallbacks
             extends VultureCallback<RemoteContentCaptureService> {
         // NOTE: so far we don't need to notify the callback implementation
diff --git a/services/contentsuggestions/java/com/android/server/contentsuggestions/ContentSuggestionsManagerServiceShellCommand.java b/services/contentsuggestions/java/com/android/server/contentsuggestions/ContentSuggestionsManagerServiceShellCommand.java
index e34f1ea..08cc69d 100644
--- a/services/contentsuggestions/java/com/android/server/contentsuggestions/ContentSuggestionsManagerServiceShellCommand.java
+++ b/services/contentsuggestions/java/com/android/server/contentsuggestions/ContentSuggestionsManagerServiceShellCommand.java
@@ -43,29 +43,13 @@
         }
         final PrintWriter pw = getOutPrintWriter();
         switch (cmd) {
-            case "set": {
-                final String what = getNextArgRequired();
-                switch (what) {
-                    case "temporary-service": {
-                        final int userId = Integer.parseInt(getNextArgRequired());
-                        String serviceName = getNextArg();
-                        if (serviceName == null) {
-                            mService.resetTemporaryService(userId);
-                            return 0;
-                        }
-                        final int duration = Integer.parseInt(getNextArgRequired());
-                        mService.setTemporaryService(userId, serviceName, duration);
-                        pw.println("ContentSuggestionsService temporarily set to " + serviceName
-                                + " for " + duration + "ms");
-                        break;
-                    }
-                }
-            }
-            break;
+            case "set":
+                return requestSet(pw);
+            case "get":
+                return requestGet(pw);
             default:
                 return handleDefaultCommands(cmd);
         }
-        return 0;
     }
 
     @Override
@@ -76,9 +60,72 @@
             pw.println("    Prints this help text.");
             pw.println("");
             pw.println("  set temporary-service USER_ID [COMPONENT_NAME DURATION]");
-            pw.println("    Temporarily (for DURATION ms) changes the service implemtation.");
+            pw.println("    Temporarily (for DURATION ms) changes the service implementation.");
             pw.println("    To reset, call with just the USER_ID argument.");
             pw.println("");
+            pw.println("  set default-service-enabled USER_ID [true|false]");
+            pw.println("    Enable / disable the default service for the user.");
+            pw.println("");
+            pw.println("  get default-service-enabled USER_ID");
+            pw.println("    Checks whether the default service is enabled for the user.");
+            pw.println("");
         }
     }
+
+    private int requestSet(PrintWriter pw) {
+        final String what = getNextArgRequired();
+
+        switch(what) {
+            case "temporary-service":
+                return setTemporaryService(pw);
+            case "default-service-enabled":
+                return setDefaultServiceEnabled();
+            default:
+                pw.println("Invalid set: " + what);
+                return -1;
+        }
+    }
+
+    private int requestGet(PrintWriter pw) {
+        final String what = getNextArgRequired();
+        switch(what) {
+            case "default-service-enabled":
+                return getDefaultServiceEnabled(pw);
+            default:
+                pw.println("Invalid get: " + what);
+                return -1;
+        }
+    }
+
+    private int setTemporaryService(PrintWriter pw) {
+        final int userId = Integer.parseInt(getNextArgRequired());
+        String serviceName = getNextArg();
+        if (serviceName == null) {
+            mService.resetTemporaryService(userId);
+            return 0;
+        }
+        final int duration = Integer.parseInt(getNextArgRequired());
+        mService.setTemporaryService(userId, serviceName, duration);
+        pw.println("ContentSuggestionsService temporarily set to " + serviceName
+                + " for " + duration + "ms");
+        return 0;
+    }
+
+    private int setDefaultServiceEnabled() {
+        final int userId = getNextIntArgRequired();
+        final boolean enabled = Boolean.parseBoolean(getNextArg());
+        mService.setDefaultServiceEnabled(userId, enabled);
+        return 0;
+    }
+
+    private int getDefaultServiceEnabled(PrintWriter pw) {
+        final int userId = getNextIntArgRequired();
+        final boolean enabled = mService.isDefaultServiceEnabled(userId);
+        pw.println(enabled);
+        return 0;
+    }
+
+    private int getNextIntArgRequired() {
+        return Integer.parseInt(getNextArgRequired());
+    }
 }
diff --git a/services/contentsuggestions/java/com/android/server/contentsuggestions/ContentSuggestionsPerUserService.java b/services/contentsuggestions/java/com/android/server/contentsuggestions/ContentSuggestionsPerUserService.java
index 385bc6c..9b70272 100644
--- a/services/contentsuggestions/java/com/android/server/contentsuggestions/ContentSuggestionsPerUserService.java
+++ b/services/contentsuggestions/java/com/android/server/contentsuggestions/ContentSuggestionsPerUserService.java
@@ -16,6 +16,7 @@
 
 package com.android.server.contentsuggestions;
 
+import android.Manifest;
 import android.annotation.NonNull;
 import android.annotation.Nullable;
 import android.app.ActivityManager;
@@ -73,6 +74,13 @@
             throw new PackageManager.NameNotFoundException(
                     "Could not get service for " + serviceComponent);
         }
+        if (!Manifest.permission.BIND_CONTENT_SUGGESTIONS_SERVICE.equals(si.permission)) {
+            Slog.w(TAG, "ContentSuggestionsService from '" + si.packageName
+                    + "' does not require permission "
+                    + Manifest.permission.BIND_CONTENT_SUGGESTIONS_SERVICE);
+            throw new SecurityException("Service does not require permission "
+                    + Manifest.permission.BIND_CONTENT_SUGGESTIONS_SERVICE);
+        }
         return si;
     }
 
@@ -80,12 +88,7 @@
     @Override // from PerUserSystemService
     protected boolean updateLocked(boolean disabled) {
         final boolean enabledChanged = super.updateLocked(disabled);
-        if (enabledChanged) {
-            if (!isEnabledLocked()) {
-                // Clear the remote service for the next call
-                mRemoteService = null;
-            }
-        }
+        updateRemoteServiceLocked();
         return enabledChanged;
     }
 
@@ -133,6 +136,15 @@
     }
 
     @GuardedBy("mLock")
+    private void updateRemoteServiceLocked() {
+        if (mRemoteService != null) {
+            mRemoteService.destroy();
+            mRemoteService = null;
+        }
+    }
+
+
+    @GuardedBy("mLock")
     @Nullable
     private RemoteContentSuggestionsService getRemoteServiceLocked() {
         if (mRemoteService == null) {
diff --git a/services/contentsuggestions/java/com/android/server/contentsuggestions/RemoteContentSuggestionsService.java b/services/contentsuggestions/java/com/android/server/contentsuggestions/RemoteContentSuggestionsService.java
index bf48d76..442972a 100644
--- a/services/contentsuggestions/java/com/android/server/contentsuggestions/RemoteContentSuggestionsService.java
+++ b/services/contentsuggestions/java/com/android/server/contentsuggestions/RemoteContentSuggestionsService.java
@@ -47,7 +47,8 @@
             int userId, Callbacks callbacks,
             boolean bindInstantServiceAllowed, boolean verbose) {
         super(context, ContentSuggestionsService.SERVICE_INTERFACE, serviceName, userId, callbacks,
-                bindInstantServiceAllowed, verbose, /* initialCapacity= */ 1);
+                context.getMainThreadHandler(), bindInstantServiceAllowed, verbose,
+                /* initialCapacity= */ 1);
     }
 
     @Override
diff --git a/services/core/java/com/android/server/ConnectivityService.java b/services/core/java/com/android/server/ConnectivityService.java
index c37a805..199477c 100644
--- a/services/core/java/com/android/server/ConnectivityService.java
+++ b/services/core/java/com/android/server/ConnectivityService.java
@@ -71,6 +71,9 @@
 import android.net.INetworkPolicyListener;
 import android.net.INetworkPolicyManager;
 import android.net.INetworkStatsService;
+import android.net.ITetheringEventCallback;
+import android.net.InetAddresses;
+import android.net.IpPrefix;
 import android.net.LinkProperties;
 import android.net.LinkProperties.CompareResult;
 import android.net.MatchAllNetworkSpecifier;
@@ -1573,8 +1576,7 @@
     public boolean isActiveNetworkMetered() {
         enforceAccessPermission();
 
-        final int uid = Binder.getCallingUid();
-        final NetworkCapabilities caps = getUnfilteredActiveNetworkState(uid).networkCapabilities;
+        final NetworkCapabilities caps = getNetworkCapabilities(getActiveNetwork());
         if (caps != null) {
             return !caps.hasCapability(NetworkCapabilities.NET_CAPABILITY_NOT_METERED);
         } else {
@@ -1742,6 +1744,12 @@
                 }
             }
         }
+
+        @Override
+        public void onNat64PrefixEvent(int netId, boolean added,
+                                       String prefixString, int prefixLength) {
+            mHandler.post(() -> handleNat64PrefixEvent(netId, added, prefixString, prefixLength));
+        }
     };
 
     @VisibleForTesting
@@ -2783,6 +2791,29 @@
         handleUpdateLinkProperties(nai, new LinkProperties(nai.linkProperties));
     }
 
+    private void handleNat64PrefixEvent(int netId, boolean added, String prefixString,
+            int prefixLength) {
+        NetworkAgentInfo nai = mNetworkForNetId.get(netId);
+        if (nai == null) return;
+
+        log(String.format("NAT64 prefix %s on netId %d: %s/%d",
+                          (added ? "added" : "removed"), netId, prefixString, prefixLength));
+
+        IpPrefix prefix = null;
+        if (added) {
+            try {
+                prefix = new IpPrefix(InetAddresses.parseNumericAddress(prefixString),
+                        prefixLength);
+            } catch (IllegalArgumentException e) {
+                loge("Invalid NAT64 prefix " + prefixString + "/" + prefixLength);
+                return;
+            }
+        }
+
+        nai.clatd.setNat64Prefix(prefix);
+        handleUpdateLinkProperties(nai, new LinkProperties(nai.linkProperties));
+    }
+
     private void updateLingerState(NetworkAgentInfo nai, long now) {
         // 1. Update the linger timer. If it's changed, reschedule or cancel the alarm.
         // 2. If the network was lingering and there are now requests, unlinger it.
@@ -2910,7 +2941,7 @@
             e.rethrowFromSystemServer();
         }
         mNetworkAgentInfos.remove(nai.messenger);
-        nai.maybeStopClat();
+        nai.clatd.update();
         synchronized (mNetworkForNetId) {
             // Remove the NetworkAgent, but don't mark the netId as
             // available until we've told netd to delete it below.
@@ -3762,10 +3793,26 @@
      * if it's really needed.
      */
     @Override
-    public void getLatestTetheringEntitlementValue(int type, ResultReceiver receiver,
+    public void getLatestTetheringEntitlementResult(int type, ResultReceiver receiver,
             boolean showEntitlementUi, String callerPkg) {
         ConnectivityManager.enforceTetherChangePermission(mContext, callerPkg);
-        mTethering.getLatestTetheringEntitlementValue(type, receiver, showEntitlementUi);
+        mTethering.getLatestTetheringEntitlementResult(type, receiver, showEntitlementUi);
+    }
+
+    /** Register tethering event callback. */
+    @Override
+    public void registerTetheringEventCallback(ITetheringEventCallback callback,
+            String callerPkg) {
+        ConnectivityManager.enforceTetherChangePermission(mContext, callerPkg);
+        mTethering.registerTetheringEventCallback(callback);
+    }
+
+    /** Unregister tethering event callback. */
+    @Override
+    public void unregisterTetheringEventCallback(ITetheringEventCallback callback,
+            String callerPkg) {
+        ConnectivityManager.enforceTetherChangePermission(mContext, callerPkg);
+        mTethering.unregisterTetheringEventCallback(callback);
     }
 
     // Called when we lose the default network and have no replacement yet.
@@ -4099,12 +4146,14 @@
     }
 
     /**
-     * Return the information of all ongoing VPNs. This method is used by NetworkStatsService
-     * and not available in ConnectivityManager.
+     * Return the information of all ongoing VPNs.
+     *
+     * <p>This method is used to update NetworkStatsService.
+     *
+     * <p>Must be called on the handler thread.
      */
-    @Override
-    public VpnInfo[] getAllVpnInfo() {
-        enforceConnectivityInternalPermission();
+    private VpnInfo[] getAllVpnInfo() {
+        ensureRunningOnConnectivityServiceThread();
         synchronized (mVpns) {
             if (mLockdownEnabled) {
                 return new VpnInfo[0];
@@ -5256,11 +5305,10 @@
             LinkProperties oldLp) {
         int netId = networkAgent.network.netId;
 
-        // The NetworkAgentInfo does not know whether clatd is running on its network or not. Before
-        // we do anything else, make sure its LinkProperties are accurate.
-        if (networkAgent.clatd != null) {
-            networkAgent.clatd.fixupLinkProperties(oldLp, newLp);
-        }
+        // The NetworkAgentInfo does not know whether clatd is running on its network or not, or
+        // whether there is a NAT64 prefix. Before we do anything else, make sure its LinkProperties
+        // are accurate.
+        networkAgent.clatd.fixupLinkProperties(oldLp, newLp);
 
         updateInterfaces(newLp, oldLp, netId, networkAgent.networkCapabilities);
         updateMtu(newLp, oldLp);
@@ -5290,8 +5338,8 @@
             synchronized (networkAgent) {
                 networkAgent.linkProperties = newLp;
             }
-            // Start or stop clat accordingly to network state.
-            networkAgent.updateClat(mNMS);
+            // Start or stop DNS64 detection and 464xlat according to network state.
+            networkAgent.clatd.update();
             notifyIfacesChangedForNetworkStats();
             if (networkAgent.everConnected) {
                 try {
@@ -5599,6 +5647,8 @@
     }
 
     public void handleUpdateLinkProperties(NetworkAgentInfo nai, LinkProperties newLp) {
+        ensureRunningOnConnectivityServiceThread();
+
         if (getNetworkAgentInfoForNetId(nai.network.netId) != nai) {
             // Ignore updates for disconnected networks
             return;
@@ -6439,6 +6489,7 @@
      * Must be called on the handler thread.
      */
     private Network[] getDefaultNetworks() {
+        ensureRunningOnConnectivityServiceThread();
         ArrayList<Network> defaultNetworks = new ArrayList<>();
         NetworkAgentInfo defaultNetwork = getDefaultNetwork();
         for (NetworkAgentInfo nai : mNetworkAgentInfos.values()) {
@@ -6454,8 +6505,15 @@
      * properties tracked by NetworkStatsService on an active iface has changed.
      */
     private void notifyIfacesChangedForNetworkStats() {
+        ensureRunningOnConnectivityServiceThread();
+        String activeIface = null;
+        LinkProperties activeLinkProperties = getActiveLinkProperties();
+        if (activeLinkProperties != null) {
+            activeIface = activeLinkProperties.getInterfaceName();
+        }
         try {
-            mStatsService.forceUpdateIfaces(getDefaultNetworks());
+            mStatsService.forceUpdateIfaces(
+                    getDefaultNetworks(), getAllVpnInfo(), getAllNetworkState(), activeIface);
         } catch (Exception ignored) {
         }
     }
diff --git a/services/core/java/com/android/server/DeviceIdleController.java b/services/core/java/com/android/server/DeviceIdleController.java
index 6b66394..3ab3c34 100644
--- a/services/core/java/com/android/server/DeviceIdleController.java
+++ b/services/core/java/com/android/server/DeviceIdleController.java
@@ -1132,7 +1132,7 @@
                         KEY_SMS_TEMP_APP_WHITELIST_DURATION, 20 * 1000L);
                 NOTIFICATION_WHITELIST_DURATION = mParser.getDurationMillis(
                         KEY_NOTIFICATION_WHITELIST_DURATION, 30 * 1000L);
-                WAIT_FOR_UNLOCK = mParser.getBoolean(KEY_WAIT_FOR_UNLOCK, false);
+                WAIT_FOR_UNLOCK = mParser.getBoolean(KEY_WAIT_FOR_UNLOCK, true);
                 PRE_IDLE_FACTOR_LONG = mParser.getFloat(KEY_PRE_IDLE_FACTOR_LONG, 1.67f);
                 PRE_IDLE_FACTOR_SHORT = mParser.getFloat(KEY_PRE_IDLE_FACTOR_SHORT, 0.33f);
             }
diff --git a/services/core/java/com/android/server/DynamicAndroidService.java b/services/core/java/com/android/server/DynamicAndroidService.java
index 12a3f02..8488941 100644
--- a/services/core/java/com/android/server/DynamicAndroidService.java
+++ b/services/core/java/com/android/server/DynamicAndroidService.java
@@ -118,7 +118,9 @@
         if (gsiService.isGsiRunning()) {
             return gsiService.disableGsiInstall();
         } else {
-            return gsiService.setGsiBootable() == 0;
+            final int status = gsiService.getGsiBootStatus();
+            final boolean singleBoot = (status == IGsiService.BOOT_STATUS_SINGLE_BOOT);
+            return gsiService.setGsiBootable(singleBoot) == 0;
         }
     }
 
@@ -129,6 +131,6 @@
 
     @Override
     public boolean commit() throws RemoteException {
-        return getGsiService().setGsiBootable() == 0;
+        return getGsiService().setGsiBootable(true) == 0;
     }
 }
diff --git a/services/core/java/com/android/server/ExtconUEventObserver.java b/services/core/java/com/android/server/ExtconUEventObserver.java
index 775e4c8..6b42b3d 100644
--- a/services/core/java/com/android/server/ExtconUEventObserver.java
+++ b/services/core/java/com/android/server/ExtconUEventObserver.java
@@ -162,15 +162,6 @@
     /** Does the {@link /sys/class/extcon} directory exist */
     public static boolean extconExists() {
         File extconDir = new File("/sys/class/extcon");
-        boolean retVal = extconDir.exists() && extconDir.isDirectory();
-        // TODO(b/124364409): return the correct value after selinux policy is updated.
-        if (retVal) {
-            Slog.w(TAG, extconDir + " exists " + extconDir.exists() + " isDir "
-                    + extconDir.isDirectory()
-                    + " but reporting it does not exist until selinux policies are updated."
-                    + " see b/124364409"
-            );
-        }
-        return false;
+        return extconDir.exists() && extconDir.isDirectory();
     }
 }
diff --git a/services/core/java/com/android/server/LocationManagerService.java b/services/core/java/com/android/server/LocationManagerService.java
index d8b96e4..c2a0611 100644
--- a/services/core/java/com/android/server/LocationManagerService.java
+++ b/services/core/java/com/android/server/LocationManagerService.java
@@ -22,6 +22,7 @@
 import static android.location.LocationManager.NETWORK_PROVIDER;
 import static android.location.LocationManager.PASSIVE_PROVIDER;
 import static android.location.LocationProvider.AVAILABLE;
+import static android.os.PowerManager.locationPowerSaveModeToString;
 import static android.provider.Settings.Global.LOCATION_DISABLE_STATUS_CALLBACKS;
 
 import static com.android.internal.util.Preconditions.checkNotNull;
@@ -69,6 +70,8 @@
 import android.os.IBinder;
 import android.os.IInterface;
 import android.os.PowerManager;
+import android.os.PowerManager.ServiceType;
+import android.os.PowerManagerInternal;
 import android.os.Process;
 import android.os.RemoteException;
 import android.os.SystemClock;
@@ -254,6 +257,10 @@
     @GuardedBy("mLock")
     private boolean mGnssBatchingInProgress = false;
 
+    @GuardedBy("mLock")
+    @PowerManager.LocationPowerSaveMode
+    private int mBatterySaverMode;
+
     public LocationManagerService(Context context) {
         super();
         mContext = context;
@@ -337,7 +344,7 @@
                     @Override
                     public void onChange(boolean selfChange) {
                         synchronized (mLock) {
-                            onProviderAllowedChangedLocked(true);
+                            onProviderAllowedChangedLocked();
                         }
                     }
                 }, UserHandle.USER_ALL);
@@ -376,6 +383,14 @@
                         }
                     }
                 }, UserHandle.USER_ALL);
+        PowerManagerInternal localPowerManager =
+                LocalServices.getService(PowerManagerInternal.class);
+        localPowerManager.registerLowPowerModeObserver(ServiceType.LOCATION,
+                state -> {
+                    synchronized (mLock) {
+                        onBatterySaverModeChangedLocked(state.locationMode);
+                    }
+                });
 
         new PackageMonitor() {
             @Override
@@ -390,17 +405,29 @@
         intentFilter.addAction(Intent.ACTION_USER_SWITCHED);
         intentFilter.addAction(Intent.ACTION_MANAGED_PROFILE_ADDED);
         intentFilter.addAction(Intent.ACTION_MANAGED_PROFILE_REMOVED);
+        intentFilter.addAction(Intent.ACTION_SCREEN_OFF);
+        intentFilter.addAction(Intent.ACTION_SCREEN_ON);
 
         mContext.registerReceiverAsUser(new BroadcastReceiver() {
             @Override
             public void onReceive(Context context, Intent intent) {
+                final String action = intent.getAction();
+                if (action == null) {
+                    return;
+                }
                 synchronized (mLock) {
-                    String action = intent.getAction();
-                    if (Intent.ACTION_USER_SWITCHED.equals(action)) {
-                        onUserChangedLocked(intent.getIntExtra(Intent.EXTRA_USER_HANDLE, 0));
-                    } else if (Intent.ACTION_MANAGED_PROFILE_ADDED.equals(action)
-                            || Intent.ACTION_MANAGED_PROFILE_REMOVED.equals(action)) {
-                        onUserProfilesChangedLocked();
+                    switch (action) {
+                        case Intent.ACTION_USER_SWITCHED:
+                            onUserChangedLocked(intent.getIntExtra(Intent.EXTRA_USER_HANDLE, 0));
+                            break;
+                        case Intent.ACTION_MANAGED_PROFILE_ADDED:
+                        case Intent.ACTION_MANAGED_PROFILE_REMOVED:
+                            onUserProfilesChangedLocked();
+                            break;
+                        case Intent.ACTION_SCREEN_ON:
+                        case Intent.ACTION_SCREEN_OFF:
+                            onScreenStateChangedLocked();
+                            break;
                     }
                 }
             }
@@ -415,6 +442,7 @@
         // initialize in-memory settings values
         onBackgroundThrottleWhitelistChangedLocked();
         onIgnoreSettingsWhitelistChangedLocked();
+        onBatterySaverModeChangedLocked(mPowerManager.getLocationPowerSaveMode());
     }
 
     @GuardedBy("mLock")
@@ -435,7 +463,39 @@
     }
 
     @GuardedBy("mLock")
+    private void onBatterySaverModeChangedLocked(int newLocationMode) {
+        if (D) {
+            Slog.d(TAG,
+                    "Battery Saver location mode changed from "
+                            + locationPowerSaveModeToString(mBatterySaverMode) + " to "
+                            + locationPowerSaveModeToString(newLocationMode));
+        }
+
+        if (mBatterySaverMode == newLocationMode) {
+            return;
+        }
+
+        mBatterySaverMode = newLocationMode;
+        for (LocationProvider p : mProviders) {
+            applyRequirementsLocked(p);
+        }
+    }
+
+    @GuardedBy("mLock")
+    private void onScreenStateChangedLocked() {
+        if (mBatterySaverMode == PowerManager.LOCATION_MODE_THROTTLE_REQUESTS_WHEN_SCREEN_OFF) {
+            for (LocationProvider p : mProviders) {
+                applyRequirementsLocked(p);
+            }
+        }
+    }
+
+    @GuardedBy("mLock")
     private void onLocationModeChangedLocked(boolean broadcast) {
+        if (D) {
+            Log.d(TAG, "location enabled is now " + isLocationEnabled());
+        }
+
         for (LocationProvider p : mProviders) {
             p.onLocationModeChangedLocked();
         }
@@ -448,16 +508,10 @@
     }
 
     @GuardedBy("mLock")
-    private void onProviderAllowedChangedLocked(boolean broadcast) {
+    private void onProviderAllowedChangedLocked() {
         for (LocationProvider p : mProviders) {
             p.onAllowedChangedLocked();
         }
-
-        if (broadcast) {
-            mContext.sendBroadcastAsUser(
-                    new Intent(LocationManager.PROVIDERS_CHANGED_ACTION),
-                    UserHandle.ALL);
-        }
     }
 
     @GuardedBy("mLock")
@@ -827,6 +881,10 @@
             return;
         }
 
+        if (D) {
+            Log.d(TAG, "foreground user is changing to " + userId);
+        }
+
         // let providers know the current user is on the way out before changing the user
         for (LocationProvider p : mProviders) {
             p.onUserChangingLocked();
@@ -839,7 +897,12 @@
 
         // if the user changes, per-user settings may also have changed
         onLocationModeChangedLocked(false);
-        onProviderAllowedChangedLocked(false);
+        onProviderAllowedChangedLocked();
+
+        // always force useability to be rechecked, even if no per-user settings have changed
+        for (LocationProvider p : mProviders) {
+            p.onUseableChangedLocked(false);
+        }
     }
 
     private class LocationProvider implements AbstractLocationProvider.LocationProviderManager {
@@ -891,9 +954,13 @@
         public void attachLocked(AbstractLocationProvider provider) {
             checkNotNull(provider);
             checkState(mProvider == null);
-            mProvider = provider;
 
-            onUseableChangedLocked();
+            if (D) {
+                Log.d(TAG, mName + " provider attached");
+            }
+
+            mProvider = provider;
+            onUseableChangedLocked(false);
         }
 
         public String getName() {
@@ -1054,26 +1121,12 @@
                         return;
                     }
 
-                    mEnabled = enabled;
-
-                    // update provider allowed settings to reflect enabled status
-                    if (mIsManagedBySettings) {
-                        if (mEnabled && !mAllowed) {
-                            Settings.Secure.putStringForUser(
-                                    mContext.getContentResolver(),
-                                    Settings.Secure.LOCATION_PROVIDERS_ALLOWED,
-                                    "+" + mName,
-                                    mCurrentUserId);
-                        } else if (!mEnabled && mAllowed) {
-                            Settings.Secure.putStringForUser(
-                                    mContext.getContentResolver(),
-                                    Settings.Secure.LOCATION_PROVIDERS_ALLOWED,
-                                    "-" + mName,
-                                    mCurrentUserId);
-                        }
+                    if (D) {
+                        Log.d(TAG, mName + " provider enabled is now " + mEnabled);
                     }
 
-                    onUseableChangedLocked();
+                    mEnabled = enabled;
+                    onUseableChangedLocked(false);
                 }
             });
         }
@@ -1091,41 +1144,28 @@
 
         @GuardedBy("mLock")
         public void onLocationModeChangedLocked() {
-            onUseableChangedLocked();
-        }
-
-        private boolean isAllowed() {
-            return isAllowedForUser(mCurrentUserId);
-        }
-
-        private boolean isAllowedForUser(int userId) {
-            String allowedProviders = Settings.Secure.getStringForUser(
-                    mContext.getContentResolver(),
-                    Settings.Secure.LOCATION_PROVIDERS_ALLOWED,
-                    userId);
-            return TextUtils.delimitedStringContains(allowedProviders, ',', mName);
+            onUseableChangedLocked(false);
         }
 
         @GuardedBy("mLock")
         public void onAllowedChangedLocked() {
             if (mIsManagedBySettings) {
-                boolean allowed = isAllowed();
+                String allowedProviders = Settings.Secure.getStringForUser(
+                        mContext.getContentResolver(),
+                        Settings.Secure.LOCATION_PROVIDERS_ALLOWED,
+                        mCurrentUserId);
+                boolean allowed = TextUtils.delimitedStringContains(allowedProviders, ',', mName);
+
                 if (allowed == mAllowed) {
                     return;
                 }
-                mAllowed = allowed;
 
-                // make a best effort to keep the setting matching the real enabled state of the
-                // provider so that legacy applications aren't broken.
-                if (mAllowed && !mEnabled) {
-                    Settings.Secure.putStringForUser(
-                            mContext.getContentResolver(),
-                            Settings.Secure.LOCATION_PROVIDERS_ALLOWED,
-                            "-" + mName,
-                            mCurrentUserId);
+                if (D) {
+                    Log.d(TAG, mName + " provider allowed is now " + mAllowed);
                 }
 
-                onUseableChangedLocked();
+                mAllowed = allowed;
+                onUseableChangedLocked(true);
             }
         }
 
@@ -1136,21 +1176,53 @@
 
         @GuardedBy("mLock")
         public boolean isUseableForUserLocked(int userId) {
-            return userId == mCurrentUserId && mUseable;
+            return isCurrentProfileLocked(userId) && mUseable;
         }
 
         @GuardedBy("mLock")
-        public void onUseableChangedLocked() {
+        private boolean isUseableIgnoringAllowedLocked() {
+            return mProvider != null && mProviders.contains(this) && isLocationEnabled()
+                    && mEnabled;
+        }
+
+        @GuardedBy("mLock")
+        public void onUseableChangedLocked(boolean isAllowedChanged) {
             // if any property that contributes to "useability" here changes state, it MUST result
             // in a direct or indrect call to onUseableChangedLocked. this allows the provider to
             // guarantee that it will always eventually reach the correct state.
-            boolean useable = mProvider != null
-                    && mProviders.contains(this) && isLocationEnabled() && mAllowed && mEnabled;
+            boolean useableIgnoringAllowed = isUseableIgnoringAllowedLocked();
+            boolean useable = useableIgnoringAllowed && mAllowed;
+
+            // update deprecated provider allowed settings for backwards compatibility, and do this
+            // even if there is no change in overall useability state. this may result in trying to
+            // overwrite the same value, but Settings handles deduping this.
+            if (mIsManagedBySettings) {
+                // a "-" change derived from the allowed setting should not be overwritten, but a
+                // "+" change should be corrected if necessary
+                if (useableIgnoringAllowed && !isAllowedChanged) {
+                    Settings.Secure.putStringForUser(
+                            mContext.getContentResolver(),
+                            Settings.Secure.LOCATION_PROVIDERS_ALLOWED,
+                            "+" + mName,
+                            mCurrentUserId);
+                } else if (!useableIgnoringAllowed) {
+                    Settings.Secure.putStringForUser(
+                            mContext.getContentResolver(),
+                            Settings.Secure.LOCATION_PROVIDERS_ALLOWED,
+                            "-" + mName,
+                            mCurrentUserId);
+                }
+            }
+
             if (useable == mUseable) {
                 return;
             }
             mUseable = useable;
 
+            if (D) {
+                Log.d(TAG, mName + " provider useable is now " + mUseable);
+            }
+
             if (!mUseable) {
                 // If any provider has been disabled, clear all last locations for all
                 // providers. This is to be on the safe side in case a provider has location
@@ -1160,6 +1232,10 @@
             }
 
             updateProviderUseableLocked(this);
+
+            mContext.sendBroadcastAsUser(
+                    new Intent(LocationManager.PROVIDERS_CHANGED_ACTION),
+                    UserHandle.ALL);
         }
 
         @GuardedBy("mLock")
@@ -1174,6 +1250,8 @@
 
     private class MockLocationProvider extends LocationProvider {
 
+        private ProviderRequest mCurrentRequest;
+
         private MockLocationProvider(String name) {
             super(name);
         }
@@ -1212,6 +1290,13 @@
             }
         }
 
+        @Override
+        @GuardedBy("mLock")
+        public void setRequestLocked(ProviderRequest request, WorkSource workSource) {
+            super.setRequestLocked(request, workSource);
+            mCurrentRequest = request;
+        }
+
         @GuardedBy("mLock")
         public void setStatusLocked(int status, Bundle extras, long updateTime) {
             if (mProvider != null) {
@@ -1720,7 +1805,7 @@
         mProviders.add(provider);
 
         provider.onAllowedChangedLocked();  // allowed state may change while provider was inactive
-        provider.onUseableChangedLocked();
+        provider.onUseableChangedLocked(false);
     }
 
     @GuardedBy("mLock")
@@ -1728,7 +1813,7 @@
         if (mProviders.remove(provider)) {
             long identity = Binder.clearCallingIdentity();
             try {
-                provider.onUseableChangedLocked();
+                provider.onUseableChangedLocked(false);
             } finally {
                 Binder.restoreCallingIdentity(identity);
             }
@@ -2024,8 +2109,11 @@
             }
 
             final boolean isForegroundOnlyMode =
-                    mPowerManager.getLocationPowerSaveMode()
-                            == PowerManager.LOCATION_MODE_FOREGROUND_ONLY;
+                    mBatterySaverMode == PowerManager.LOCATION_MODE_FOREGROUND_ONLY;
+            final boolean shouldThrottleRequests =
+                    mBatterySaverMode
+                            == PowerManager.LOCATION_MODE_THROTTLE_REQUESTS_WHEN_SCREEN_OFF
+                            && !mPowerManager.isInteractive();
             // initialize the low power mode to true and set to false if any of the records requires
             providerRequest.lowPowerMode = true;
             for (UpdateRecord record : records) {
@@ -2040,8 +2128,8 @@
                         record.mReceiver.mAllowedResolutionLevel)) {
                     continue;
                 }
-                final boolean isBatterySaverDisablingLocation =
-                        isForegroundOnlyMode && !record.mIsForegroundUid;
+                final boolean isBatterySaverDisablingLocation = shouldThrottleRequests
+                        || (isForegroundOnlyMode && !record.mIsForegroundUid);
                 if (!provider.isUseableLocked() || isBatterySaverDisablingLocation) {
                     if (isSettingsExemptLocked(record)) {
                         providerRequest.locationSettingsIgnored = true;
@@ -2113,7 +2201,6 @@
             }
         }
 
-        if (D) Log.d(TAG, "provider request: " + provider + " " + providerRequest);
         provider.setRequestLocked(providerRequest, worksource);
     }
 
@@ -2507,7 +2594,6 @@
 
     @Override
     public Location getLastLocation(LocationRequest r, String packageName) {
-        if (D) Log.d(TAG, "getLastLocation: " + r);
         synchronized (mLock) {
             LocationRequest request = r != null ? r : DEFAULT_LOCATION_REQUEST;
             int allowedResolutionLevel = getCallerAllowedResolutionLevel();
@@ -2643,33 +2729,33 @@
         synchronized (mLock) {
             checkResolutionLevelIsSufficientForProviderUseLocked(allowedResolutionLevel,
                     request.getProvider());
-            // Require that caller can manage given document
-            boolean callerHasLocationHardwarePermission =
-                    mContext.checkCallingPermission(android.Manifest.permission.LOCATION_HARDWARE)
-                            == PERMISSION_GRANTED;
-            LocationRequest sanitizedRequest = createSanitizedRequest(request,
+        }
+        // Require that caller can manage given document
+        boolean callerHasLocationHardwarePermission =
+                mContext.checkCallingPermission(android.Manifest.permission.LOCATION_HARDWARE)
+                        == PERMISSION_GRANTED;
+        LocationRequest sanitizedRequest = createSanitizedRequest(request,
+                allowedResolutionLevel,
+                callerHasLocationHardwarePermission);
+
+        if (D) {
+            Log.d(TAG, "requestGeofence: " + sanitizedRequest + " " + geofence + " " + intent);
+        }
+
+        // geo-fence manager uses the public location API, need to clear identity
+        int uid = Binder.getCallingUid();
+        if (UserHandle.getUserId(uid) != UserHandle.USER_SYSTEM) {
+            // temporary measure until geofences work for secondary users
+            Log.w(TAG, "proximity alerts are currently available only to the primary user");
+            return;
+        }
+        long identity = Binder.clearCallingIdentity();
+        try {
+            mGeofenceManager.addFence(sanitizedRequest, geofence, intent,
                     allowedResolutionLevel,
-                    callerHasLocationHardwarePermission);
-
-            if (D) {
-                Log.d(TAG, "requestGeofence: " + sanitizedRequest + " " + geofence + " " + intent);
-            }
-
-            // geo-fence manager uses the public location API, need to clear identity
-            int uid = Binder.getCallingUid();
-            if (UserHandle.getUserId(uid) != UserHandle.USER_SYSTEM) {
-                // temporary measure until geofences work for secondary users
-                Log.w(TAG, "proximity alerts are currently available only to the primary user");
-                return;
-            }
-            long identity = Binder.clearCallingIdentity();
-            try {
-                mGeofenceManager.addFence(sanitizedRequest, geofence, intent,
-                        allowedResolutionLevel,
-                        uid, packageName);
-            } finally {
-                Binder.restoreCallingIdentity(identity);
-            }
+                    uid, packageName);
+        } finally {
+            Binder.restoreCallingIdentity(identity);
         }
     }
 
@@ -3124,18 +3210,6 @@
                 continue;
             }
 
-            if (!reportLocationAccessNoThrow(
-                    receiver.mCallerIdentity.mPid,
-                    receiver.mCallerIdentity.mUid,
-                    receiver.mCallerIdentity.mPackageName,
-                    receiver.mAllowedResolutionLevel)) {
-                if (D) {
-                    Log.d(TAG, "skipping loc update for no op app: " +
-                            receiver.mCallerIdentity.mPackageName);
-                }
-                continue;
-            }
-
             Location notifyLocation;
             if (receiver.mAllowedResolutionLevel < RESOLUTION_LEVEL_FINE) {
                 notifyLocation = coarseLocation;  // use coarse location
@@ -3152,6 +3226,20 @@
                     } else {
                         lastLoc.set(notifyLocation);
                     }
+                    // Report location access before delivering location to the client. This will
+                    // note location delivery to appOps, so it should be called only when a
+                    // location is really being delivered to the client.
+                    if (!reportLocationAccessNoThrow(
+                            receiver.mCallerIdentity.mPid,
+                            receiver.mCallerIdentity.mUid,
+                            receiver.mCallerIdentity.mPackageName,
+                            receiver.mAllowedResolutionLevel)) {
+                        if (D) {
+                            Log.d(TAG, "skipping loc update for no op app: "
+                                    + receiver.mCallerIdentity.mPackageName);
+                        }
+                        continue;
+                    }
                     if (!receiver.callLocationChangedLocked(notifyLocation)) {
                         Slog.w(TAG, "RemoteException calling onLocationChanged on "
                                 + receiver);
@@ -3397,6 +3485,32 @@
     }
 
     @Override
+    @NonNull
+    public List<LocationRequest> getTestProviderCurrentRequests(String providerName,
+            String opPackageName) {
+        if (!canCallerAccessMockLocation(opPackageName)) {
+            return Collections.emptyList();
+        }
+
+        synchronized (mLock) {
+            LocationProvider testProvider = getLocationProviderLocked(providerName);
+            if (testProvider == null || !testProvider.isMock()) {
+                throw new IllegalArgumentException("Provider \"" + providerName + "\" unknown");
+            }
+
+            MockLocationProvider provider = (MockLocationProvider) testProvider;
+            if (provider.mCurrentRequest == null) {
+                return Collections.emptyList();
+            }
+            List<LocationRequest> requests = new ArrayList<>();
+            for (LocationRequest request : provider.mCurrentRequest.locationRequests) {
+                requests.add(new LocationRequest(request));
+            }
+            return requests;
+        }
+    }
+
+    @Override
     protected void dump(FileDescriptor fd, PrintWriter pw, String[] args) {
         if (!DumpUtils.checkDumpPermission(mContext, TAG, pw)) return;
 
@@ -3411,6 +3525,8 @@
             pw.println("  Current user: " + mCurrentUserId + " " + Arrays.toString(
                     mCurrentUserProfiles));
             pw.println("  Location mode: " + isLocationEnabled());
+            pw.println("  Battery Saver Location Mode: "
+                    + locationPowerSaveModeToString(mBatterySaverMode));
             pw.println("  Location Listeners:");
             for (Receiver receiver : mReceivers.values()) {
                 pw.println("    " + receiver);
diff --git a/services/core/java/com/android/server/LooperStatsService.java b/services/core/java/com/android/server/LooperStatsService.java
index b423f62..965b64b 100644
--- a/services/core/java/com/android/server/LooperStatsService.java
+++ b/services/core/java/com/android/server/LooperStatsService.java
@@ -55,7 +55,7 @@
     private static final String DEBUG_SYS_LOOPER_STATS_ENABLED =
             "debug.sys.looper_stats_enabled";
     private static final int DEFAULT_SAMPLING_INTERVAL = 1000;
-    private static final int DEFAULT_ENTRIES_SIZE_CAP = 2000;
+    private static final int DEFAULT_ENTRIES_SIZE_CAP = 1500;
     private static final boolean DEFAULT_ENABLED = true;
     private static final boolean DEFAULT_TRACK_SCREEN_INTERACTIVE = false;
 
diff --git a/services/core/java/com/android/server/NetworkManagementService.java b/services/core/java/com/android/server/NetworkManagementService.java
index dc394d0..5582ad7 100644
--- a/services/core/java/com/android/server/NetworkManagementService.java
+++ b/services/core/java/com/android/server/NetworkManagementService.java
@@ -2512,6 +2512,10 @@
                 modifyRoute(MODIFY_OPERATION_ADD, INetd.LOCAL_NET_ID, route);
             }
         }
+
+        // IPv6 link local should be activated always.
+        modifyRoute(MODIFY_OPERATION_ADD, INetd.LOCAL_NET_ID,
+                new RouteInfo(new IpPrefix("fe80::/64"), null, iface));
     }
 
     @Override
diff --git a/services/core/java/com/android/server/PackageWatchdog.java b/services/core/java/com/android/server/PackageWatchdog.java
index ec40971..660109c 100644
--- a/services/core/java/com/android/server/PackageWatchdog.java
+++ b/services/core/java/com/android/server/PackageWatchdog.java
@@ -21,6 +21,7 @@
 import android.annotation.IntDef;
 import android.annotation.Nullable;
 import android.content.Context;
+import android.content.pm.PackageManager;
 import android.content.pm.VersionedPackage;
 import android.os.Environment;
 import android.os.Handler;
@@ -76,6 +77,7 @@
     private static final String ATTR_VERSION = "version";
     private static final String ATTR_NAME = "name";
     private static final String ATTR_DURATION = "duration";
+    private static final String ATTR_PASSED_HEALTH_CHECK = "passed-health-check";
 
     private static PackageWatchdog sPackageWatchdog;
 
@@ -102,7 +104,7 @@
     // 0 if mPackageCleanup not running.
     private long mDurationAtLastReschedule;
 
-    // TODO(zezeozue): Remove redundant context param
+    // TODO(b/120598832): Remove redundant context param
     private PackageWatchdog(Context context) {
         mContext = context;
         mPolicyFile = new AtomicFile(new File(new File(Environment.getDataDirectory(), "system"),
@@ -161,21 +163,29 @@
      * Starts observing the health of the {@code packages} for {@code observer} and notifies
      * {@code observer} of any package failures within the monitoring duration.
      *
+     * <p>If monitoring a package with {@code withExplicitHealthCheck}, at the end of the monitoring
+     * duration if {@link #onExplicitHealthCheckPassed} was never called,
+     * {@link PackageHealthObserver#execute} will be called as if the package failed.
+     *
      * <p>If {@code observer} is already monitoring a package in {@code packageNames},
-     * the monitoring window of that package will be reset to {@code durationMs}.
+     * the monitoring window of that package will be reset to {@code durationMs} and the health
+     * check state will be reset to a default depending on {@code withExplictHealthCheck}.
      *
      * @throws IllegalArgumentException if {@code packageNames} is empty
      * or {@code durationMs} is less than 1
      */
     public void startObservingHealth(PackageHealthObserver observer, List<String> packageNames,
-            long durationMs) {
+            long durationMs, boolean withExplicitHealthCheck) {
         if (packageNames.isEmpty() || durationMs < 1) {
             throw new IllegalArgumentException("Observation not started, no packages specified"
                     + "or invalid duration");
         }
         List<MonitoredPackage> packages = new ArrayList<>();
         for (int i = 0; i < packageNames.size(); i++) {
-            packages.add(new MonitoredPackage(packageNames.get(i), durationMs));
+            // When observing packages withExplicitHealthCheck,
+            // MonitoredPackage#mHasExplicitHealthCheckPassed will be false initially.
+            packages.add(new MonitoredPackage(packageNames.get(i), durationMs,
+                            !withExplicitHealthCheck));
         }
         synchronized (mLock) {
             ObserverInternal oldObserver = mAllObservers.get(observer.getName());
@@ -276,7 +286,38 @@
         });
     }
 
-    // TODO(zezeozue): Optimize write? Maybe only write a separate smaller file?
+    /**
+     * Updates the observers monitoring {@code packageName} that explicit health check has passed.
+     *
+     * <p> This update is strictly for registered observers at the time of the call
+     * Observers that register after this signal will have no knowledge of prior signals and will
+     * effectively behave as if the explicit health check hasn't passed for {@code packageName}.
+     *
+     * <p> {@code packageName} can still be considered failed if reported by
+     * {@link #onPackageFailure} before the package expires.
+     *
+     * <p> Triggered by components outside the system server when they are fully functional after an
+     * update.
+     */
+    public void onExplicitHealthCheckPassed(String packageName) {
+        Slog.i(TAG, "Health check passed for package: " + packageName);
+        boolean shouldUpdateFile = false;
+        synchronized (mLock) {
+            for (int observerIdx = 0; observerIdx < mAllObservers.size(); observerIdx++) {
+                ObserverInternal observer = mAllObservers.valueAt(observerIdx);
+                MonitoredPackage monitoredPackage = observer.mPackages.get(packageName);
+                if (monitoredPackage != null && !monitoredPackage.mHasPassedHealthCheck) {
+                    monitoredPackage.mHasPassedHealthCheck = true;
+                    shouldUpdateFile = true;
+                }
+            }
+        }
+        if (shouldUpdateFile) {
+            saveToFileAsync();
+        }
+    }
+
+    // TODO(b/120598832): Optimize write? Maybe only write a separate smaller file?
     // This currently adds about 7ms extra to shutdown thread
     /** Writes the package information to file during shutdown. */
     public void writeNow() {
@@ -322,7 +363,7 @@
          */
         boolean execute(VersionedPackage versionedPackage);
 
-        // TODO(zezeozue): Ensure uniqueness?
+        // TODO(b/120598832): Ensure uniqueness?
         /**
          * Identifier for the observer, should not change across device updates otherwise the
          * watchdog may drop observing packages with the old name.
@@ -393,7 +434,12 @@
             Iterator<ObserverInternal> it = mAllObservers.values().iterator();
             while (it.hasNext()) {
                 ObserverInternal observer = it.next();
-                if (!observer.updateMonitoringDurations(elapsedMs)) {
+                List<MonitoredPackage> failedPackages =
+                        observer.updateMonitoringDurations(elapsedMs);
+                if (!failedPackages.isEmpty()) {
+                    onExplicitHealthCheckFailed(observer, failedPackages);
+                }
+                if (observer.mPackages.isEmpty()) {
                     Slog.i(TAG, "Discarding observer " + observer.mName + ". All packages expired");
                     it.remove();
                 }
@@ -402,6 +448,32 @@
         saveToFileAsync();
     }
 
+    private void onExplicitHealthCheckFailed(ObserverInternal observer,
+            List<MonitoredPackage> failedPackages) {
+        mWorkerHandler.post(() -> {
+            synchronized (mLock) {
+                PackageHealthObserver registeredObserver = observer.mRegisteredObserver;
+                if (registeredObserver != null) {
+                    PackageManager pm = mContext.getPackageManager();
+                    for (int i = 0; i < failedPackages.size(); i++) {
+                        String packageName = failedPackages.get(i).mName;
+                        long versionCode = 0;
+                        try {
+                            versionCode = pm.getPackageInfo(
+                                    packageName, 0 /* flags */).getLongVersionCode();
+                        } catch (PackageManager.NameNotFoundException e) {
+                            Slog.w(TAG, "Explicit health check failed but could not find package "
+                                    + packageName);
+                            // TODO(b/120598832): Skip. We only continue to pass tests for now since
+                            // the tests don't install any packages
+                        }
+                        registeredObserver.execute(new VersionedPackage(packageName, versionCode));
+                    }
+                }
+            }
+        });
+    }
+
     /**
      * Loads mAllObservers from file.
      *
@@ -480,6 +552,7 @@
      */
     static class ObserverInternal {
         public final String mName;
+        //TODO(b/120598832): Add getter for mPackages
         public final ArrayMap<String, MonitoredPackage> mPackages;
         @Nullable
         public PackageHealthObserver mRegisteredObserver;
@@ -505,6 +578,8 @@
                     out.startTag(null, TAG_PACKAGE);
                     out.attribute(null, ATTR_NAME, p.mName);
                     out.attribute(null, ATTR_DURATION, String.valueOf(p.mDurationMs));
+                    out.attribute(null, ATTR_PASSED_HEALTH_CHECK,
+                            String.valueOf(p.mHasPassedHealthCheck));
                     out.endTag(null, TAG_PACKAGE);
                 }
                 out.endTag(null, TAG_OBSERVER);
@@ -529,10 +604,12 @@
          *  {@code elapsedMs}. If any duration is less than 0, the package is removed from
          * observation.
          *
-         * @returns {@code true} if there are still packages to be observed, {@code false} otherwise
+         * @returns a {@link List} of packages that were removed from the observer without explicit
+         * health check passing, or an empty list if no package expired for which an explicit health
+         * check was still pending
          */
-        public boolean updateMonitoringDurations(long elapsedMs) {
-            List<MonitoredPackage> packages = new ArrayList<>();
+        public List<MonitoredPackage> updateMonitoringDurations(long elapsedMs) {
+            List<MonitoredPackage> removedPackages = new ArrayList<>();
             synchronized (mName) {
                 Iterator<MonitoredPackage> it = mPackages.values().iterator();
                 while (it.hasNext()) {
@@ -541,10 +618,13 @@
                     if (newDuration > 0) {
                         p.mDurationMs = newDuration;
                     } else {
+                        if (!p.mHasPassedHealthCheck) {
+                            removedPackages.add(p);
+                        }
                         it.remove();
                     }
                 }
-                return !mPackages.isEmpty();
+                return removedPackages;
             }
         }
 
@@ -574,6 +654,7 @@
             if (TAG_OBSERVER.equals(parser.getName())) {
                 observerName = parser.getAttributeValue(null, ATTR_NAME);
                 if (TextUtils.isEmpty(observerName)) {
+                    Slog.wtf(TAG, "Unable to read observer name");
                     return null;
                 }
             }
@@ -582,17 +663,24 @@
             try {
                 while (XmlUtils.nextElementWithin(parser, innerDepth)) {
                     if (TAG_PACKAGE.equals(parser.getName())) {
-                        String packageName = parser.getAttributeValue(null, ATTR_NAME);
-                        long duration = Long.parseLong(
-                                parser.getAttributeValue(null, ATTR_DURATION));
-                        if (!TextUtils.isEmpty(packageName)) {
-                            packages.add(new MonitoredPackage(packageName, duration));
+                        try {
+                            String packageName = parser.getAttributeValue(null, ATTR_NAME);
+                            long duration = Long.parseLong(
+                                    parser.getAttributeValue(null, ATTR_DURATION));
+                            boolean hasPassedHealthCheck = Boolean.parseBoolean(
+                                    parser.getAttributeValue(null, ATTR_PASSED_HEALTH_CHECK));
+                            if (!TextUtils.isEmpty(packageName)) {
+                                packages.add(new MonitoredPackage(packageName, duration,
+                                        hasPassedHealthCheck));
+                            }
+                        } catch (NumberFormatException e) {
+                            Slog.wtf(TAG, "Skipping package for observer " + observerName, e);
+                            continue;
                         }
                     }
                 }
-            } catch (IOException e) {
-                return null;
-            } catch (XmlPullParserException e) {
+            } catch (XmlPullParserException | IOException e) {
+                Slog.wtf(TAG, "Unable to read observer " + observerName, e);
                 return null;
             }
             if (packages.isEmpty()) {
@@ -605,6 +693,8 @@
     /** Represents a package along with the time it should be monitored for. */
     static class MonitoredPackage {
         public final String mName;
+        // Whether an explicit health check has passed
+        public boolean mHasPassedHealthCheck;
         // System uptime duration to monitor package
         public long mDurationMs;
         // System uptime of first package failure
@@ -612,9 +702,10 @@
         // Number of failures since mUptimeStartMs
         private int mFailures;
 
-        MonitoredPackage(String name, long durationMs) {
+        MonitoredPackage(String name, long durationMs, boolean hasPassedHealthCheck) {
             mName = name;
             mDurationMs = durationMs;
+            mHasPassedHealthCheck = hasPassedHealthCheck;
         }
 
         /**
@@ -626,7 +717,7 @@
             final long now = SystemClock.uptimeMillis();
             final long duration = now - mUptimeStartMs;
             if (duration > TRIGGER_DURATION_MS) {
-                // TODO(zezeozue): Reseting to 1 is not correct
+                // TODO(b/120598832): Reseting to 1 is not correct
                 // because there may be more than 1 failure in the last trigger window from now
                 // This is the RescueParty impl, will leave for now
                 mFailures = 1;
diff --git a/services/core/java/com/android/server/RescueParty.java b/services/core/java/com/android/server/RescueParty.java
index 18c2722..1fe0271 100644
--- a/services/core/java/com/android/server/RescueParty.java
+++ b/services/core/java/com/android/server/RescueParty.java
@@ -38,9 +38,11 @@
 
 import com.android.internal.annotations.VisibleForTesting;
 import com.android.internal.util.ArrayUtils;
+import com.android.server.am.SettingsToPropertiesMapper;
 import com.android.server.utils.FlagNamespaceUtils;
 
 import java.io.File;
+import java.util.Arrays;
 
 /**
  * Utilities to help rescue the system from crash loops. Callers are expected to
@@ -129,10 +131,10 @@
     }
 
     /**
-     * Take note of a persistent app crash. If we notice too many of these
+     * Take note of a persistent app or apex module crash. If we notice too many of these
      * events happening in rapid succession, we'll send out a rescue party.
      */
-    public static void notePersistentAppCrash(Context context, int uid) {
+    public static void noteAppCrash(Context context, int uid) {
         if (isDisabled()) return;
         Threshold t = sApps.get(uid);
         if (t == null) {
@@ -158,6 +160,7 @@
      * opportunity to reset any settings depending on our rescue level.
      */
     public static void onSettingsProviderPublished(Context context) {
+        handleNativeRescuePartyResets();
         executeRescueLevel(context);
     }
 
@@ -176,6 +179,13 @@
         return SystemClock.elapsedRealtime();
     }
 
+    private static void handleNativeRescuePartyResets() {
+        if (SettingsToPropertiesMapper.isNativeFlagsResetPerformed()) {
+            FlagNamespaceUtils.resetDeviceConfig(Settings.RESET_MODE_TRUSTED_DEFAULTS,
+                    Arrays.asList(SettingsToPropertiesMapper.getResetNativeCategories()));
+        }
+    }
+
     /**
      * Escalate to the next rescue level. After incrementing the level you'll
      * probably want to call {@link #executeRescueLevel(Context)}.
@@ -235,15 +245,15 @@
         Exception res = null;
         final ContentResolver resolver = context.getContentResolver();
         try {
-            Settings.Global.resetToDefaultsAsUser(resolver, null, mode, UserHandle.USER_SYSTEM);
-        } catch (Exception e) {
-            res = new RuntimeException("Failed to reset global settings", e);
-        }
-        try {
             FlagNamespaceUtils.resetDeviceConfig(mode);
         } catch (Exception e) {
             res = new RuntimeException("Failed to reset config settings", e);
         }
+        try {
+            Settings.Global.resetToDefaultsAsUser(resolver, null, mode, UserHandle.USER_SYSTEM);
+        } catch (Exception e) {
+            res = new RuntimeException("Failed to reset global settings", e);
+        }
         for (int userId : getAllUserIds()) {
             try {
                 Settings.Secure.resetToDefaultsAsUser(resolver, null, mode, userId);
diff --git a/services/core/java/com/android/server/StorageManagerService.java b/services/core/java/com/android/server/StorageManagerService.java
index ada3947..e28d484 100644
--- a/services/core/java/com/android/server/StorageManagerService.java
+++ b/services/core/java/com/android/server/StorageManagerService.java
@@ -205,6 +205,9 @@
 
     private static final boolean ENABLE_ISOLATED_STORAGE = StorageManager.hasIsolatedStorage();
 
+    private static final boolean ENABLE_LEGACY_GREYLIST = SystemProperties
+            .getBoolean(StorageManager.PROP_LEGACY_GREYLIST, true);
+
     public static class Lifecycle extends SystemService {
         private StorageManagerService mStorageManagerService;
 
@@ -1724,7 +1727,8 @@
         final List<AppOpsManager.PackageOps> pkgs = manager.getOpsForPackage(uid, packageName, ops);
         for (AppOpsManager.PackageOps pkg : CollectionUtils.emptyIfNull(pkgs)) {
             for (AppOpsManager.OpEntry op : CollectionUtils.emptyIfNull(pkg.getOps())) {
-                maxTime = Math.max(maxTime, op.getLastAccessTime());
+                maxTime = Math.max(maxTime, op.getLastAccessTime(
+                    AppOpsManager.OP_FLAGS_ALL_TRUSTED));
             }
         }
         return maxTime;
@@ -2289,7 +2293,26 @@
                 refreshIsolatedStorageSettings();
 
                 // Perform hard reboot to kick policy into place
-                mContext.getSystemService(PowerManager.class).reboot(null);
+                mHandler.post(() -> {
+                    mContext.getSystemService(PowerManager.class).reboot(null);
+                });
+            } finally {
+                Binder.restoreCallingIdentity(token);
+            }
+        }
+
+        if ((mask & StorageManager.DEBUG_LEGACY_GREYLIST) != 0) {
+            final boolean enabled = (flags & StorageManager.DEBUG_LEGACY_GREYLIST) != 0;
+
+            final long token = Binder.clearCallingIdentity();
+            try {
+                SystemProperties.set(StorageManager.PROP_LEGACY_GREYLIST,
+                        Boolean.toString(enabled));
+
+                // Perform hard reboot to kick policy into place
+                mHandler.post(() -> {
+                    mContext.getSystemService(PowerManager.class).reboot(null);
+                });
             } finally {
                 Binder.restoreCallingIdentity(token);
             }
@@ -2639,8 +2662,8 @@
         mContext.enforceCallingOrSelfPermission(Manifest.permission.CRYPT_KEEPER,
             "no permission to access the crypt keeper");
 
-        if (StorageManager.isFileEncryptedNativeOnly()) {
-            // Not supported on FBE devices
+        if (!StorageManager.isBlockEncrypted()) {
+            // Only supported on FDE devices
             return;
         }
 
@@ -2663,8 +2686,8 @@
         mContext.enforceCallingOrSelfPermission(Manifest.permission.CRYPT_KEEPER,
             "no permission to access the crypt keeper");
 
-        if (StorageManager.isFileEncryptedNativeOnly()) {
-            // Not supported on FBE devices
+        if (!StorageManager.isBlockEncrypted()) {
+            // Only supported on FDE devices
             return null;
         }
 
@@ -2961,7 +2984,9 @@
 
     @Override
     public void mkdirs(String callingPkg, String appPath) {
-        final int userId = UserHandle.getUserId(Binder.getCallingUid());
+        final int callingPid = Binder.getCallingPid();
+        final int callingUid = Binder.getCallingUid();
+        final int userId = UserHandle.getUserId(callingUid);
         final UserEnvironment userEnv = new UserEnvironment(userId);
         final String propertyName = "sys.user." + userId + ".ce_available";
 
@@ -2979,7 +3004,7 @@
         // Validate that reported package name belongs to caller
         final AppOpsManager appOps = (AppOpsManager) mContext.getSystemService(
                 Context.APP_OPS_SERVICE);
-        appOps.checkPackage(Binder.getCallingUid(), callingPkg);
+        appOps.checkPackage(callingUid, callingPkg);
 
         File appFile = null;
         try {
@@ -2998,11 +3023,13 @@
                 appPath = appPath + "/";
             }
 
+            final String systemPath = translateAppToSystem(appPath, callingPid, callingUid);
+
             try {
-                mVold.mkdirs(appPath);
+                mVold.mkdirs(systemPath);
                 return;
             } catch (Exception e) {
-                throw new IllegalStateException("Failed to prepare " + appPath + ": " + e);
+                throw new IllegalStateException("Failed to prepare " + systemPath + ": " + e);
             }
         }
 
@@ -3675,16 +3702,17 @@
             } else if (mPmInternal.isInstantApp(packageName, UserHandle.getUserId(uid))) {
                 return Zygote.MOUNT_EXTERNAL_NONE;
             } else {
-                // STOPSHIP: remove this temporary workaround once developers
-                // fix bugs where they're opening _data paths in native code
-                switch (packageName) {
-                    case "com.facebook.katana": // b/123996076
-                    case "jp.naver.line.android": // b/124767356
-                    case "com.mxtech.videoplayer.ad": // b/124531483
-                        return Zygote.MOUNT_EXTERNAL_LEGACY;
-                    default:
-                        return Zygote.MOUNT_EXTERNAL_WRITE;
+                if (ENABLE_LEGACY_GREYLIST) {
+                    // STOPSHIP: remove this temporary workaround once developers
+                    // fix bugs where they're opening _data paths in native code
+                    switch (packageName) {
+                        case "com.facebook.katana": // b/123996076
+                        case "jp.naver.line.android": // b/124767356
+                        case "com.mxtech.videoplayer.ad": // b/124531483
+                            return Zygote.MOUNT_EXTERNAL_LEGACY;
+                    }
                 }
+                return Zygote.MOUNT_EXTERNAL_WRITE;
             }
         } catch (RemoteException e) {
             // Should not happen
diff --git a/services/core/java/com/android/server/TelephonyRegistry.java b/services/core/java/com/android/server/TelephonyRegistry.java
index 5633082c..d6fdbe3 100644
--- a/services/core/java/com/android/server/TelephonyRegistry.java
+++ b/services/core/java/com/android/server/TelephonyRegistry.java
@@ -259,7 +259,7 @@
                 PhoneStateListener.LISTEN_CALL_FORWARDING_INDICATOR
                         | PhoneStateListener.LISTEN_MESSAGE_WAITING_INDICATOR
                         | PhoneStateListener.LISTEN_EMERGENCY_NUMBER_LIST
-                        | PhoneStateListener.LISTEN_ACTIVE_DATA_SUBID_CHANGE;
+                        | PhoneStateListener.LISTEN_ACTIVE_DATA_SUBSCRIPTION_ID_CHANGE;
 
     static final int PRECISE_PHONE_STATE_PERMISSION_MASK =
                 PhoneStateListener.LISTEN_PRECISE_CALL_STATE |
@@ -819,7 +819,8 @@
                             remove(r.binder);
                         }
                     }
-                    if ((events & PhoneStateListener.LISTEN_ACTIVE_DATA_SUBID_CHANGE) != 0) {
+                    if ((events & PhoneStateListener
+                            .LISTEN_ACTIVE_DATA_SUBSCRIPTION_ID_CHANGE) != 0) {
                         try {
                             r.callback.onActiveDataSubIdChanged(mActiveDataSubId);
                         } catch (RemoteException ex) {
@@ -1455,7 +1456,7 @@
         synchronized (mRecords) {
             mPreciseDataConnectionState = new PreciseDataConnectionState(
                     TelephonyManager.DATA_UNKNOWN,TelephonyManager.NETWORK_TYPE_UNKNOWN,
-                    ApnSetting.getApnTypesBitmaskFromString(apnType), "", null,
+                    ApnSetting.getApnTypesBitmaskFromString(apnType), null, null,
                     DataFailCause.NONE);
             for (Record r : mRecords) {
                 if (r.matchPhoneStateListenerEvent(
@@ -1471,7 +1472,7 @@
         }
         broadcastDataConnectionFailed(apnType, subId);
         broadcastPreciseDataConnectionStateChanged(TelephonyManager.DATA_UNKNOWN,
-                TelephonyManager.NETWORK_TYPE_UNKNOWN, apnType, "", null,
+                TelephonyManager.NETWORK_TYPE_UNKNOWN, apnType, null, null,
                 DataFailCause.NONE);
     }
 
@@ -1550,6 +1551,13 @@
                 log("notifyPreciseCallState: mCallQuality is null, skipping call attributes");
                 notifyCallAttributes = false;
             } else {
+                // If the precise call state is no longer active, reset the call network type and
+                // call quality.
+                if (mPreciseCallState.getForegroundCallState()
+                        != PreciseCallState.PRECISE_CALL_STATE_ACTIVE) {
+                    mCallNetworkType = TelephonyManager.NETWORK_TYPE_UNKNOWN;
+                    mCallQuality = new CallQuality();
+                }
                 mCallAttributes = new CallAttributes(mPreciseCallState, mCallNetworkType,
                         mCallQuality);
             }
@@ -1748,7 +1756,7 @@
 
             for (Record r : mRecords) {
                 if (r.matchPhoneStateListenerEvent(
-                        PhoneStateListener.LISTEN_ACTIVE_DATA_SUBID_CHANGE)) {
+                        PhoneStateListener.LISTEN_ACTIVE_DATA_SUBSCRIPTION_ID_CHANGE)) {
                     try {
                         r.callback.onActiveDataSubIdChanged(activeDataSubId);
                     } catch (RemoteException ex) {
@@ -1795,7 +1803,7 @@
         synchronized (mRecords) {
             TelephonyManager tm = (TelephonyManager) mContext.getSystemService(
                     Context.TELEPHONY_SERVICE);
-            mEmergencyNumberList = tm.getCurrentEmergencyNumberList();
+            mEmergencyNumberList = tm.getEmergencyNumberList();
 
             for (Record r : mRecords) {
                 if (r.matchPhoneStateListenerEvent(
diff --git a/services/core/java/com/android/server/TestNetworkService.java b/services/core/java/com/android/server/TestNetworkService.java
new file mode 100644
index 0000000..e64ab78
--- /dev/null
+++ b/services/core/java/com/android/server/TestNetworkService.java
@@ -0,0 +1,338 @@
+/*
+ * Copyright (C) 2018 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 com.android.server;
+
+import static com.android.internal.util.Preconditions.checkNotNull;
+
+import android.annotation.NonNull;
+import android.content.Context;
+import android.net.ConnectivityManager;
+import android.net.INetd;
+import android.net.ITestNetworkManager;
+import android.net.IpPrefix;
+import android.net.LinkAddress;
+import android.net.LinkProperties;
+import android.net.NetworkAgent;
+import android.net.NetworkCapabilities;
+import android.net.NetworkInfo;
+import android.net.NetworkInfo.DetailedState;
+import android.net.RouteInfo;
+import android.net.StringNetworkSpecifier;
+import android.net.TestNetworkInterface;
+import android.net.util.NetdService;
+import android.os.Binder;
+import android.os.Handler;
+import android.os.HandlerThread;
+import android.os.IBinder;
+import android.os.INetworkManagementService;
+import android.os.Looper;
+import android.os.ParcelFileDescriptor;
+import android.os.RemoteException;
+import android.util.SparseArray;
+
+import com.android.internal.annotations.GuardedBy;
+import com.android.internal.annotations.VisibleForTesting;
+
+import java.io.UncheckedIOException;
+import java.net.Inet4Address;
+import java.net.Inet6Address;
+import java.net.InterfaceAddress;
+import java.net.NetworkInterface;
+import java.net.SocketException;
+import java.util.concurrent.atomic.AtomicInteger;
+
+/** @hide */
+class TestNetworkService extends ITestNetworkManager.Stub {
+    @NonNull private static final String TAG = TestNetworkService.class.getSimpleName();
+    @NonNull private static final String TEST_NETWORK_TYPE = "TEST_NETWORK";
+    @NonNull private static final String TEST_TUN_PREFIX = "testtun";
+    @NonNull private static final AtomicInteger sTestTunIndex = new AtomicInteger();
+
+    @NonNull private final Context mContext;
+    @NonNull private final INetworkManagementService mNMS;
+    @NonNull private final INetd mNetd;
+
+    @NonNull private final HandlerThread mHandlerThread;
+    @NonNull private final Handler mHandler;
+
+    // Native method stubs
+    private static native int jniCreateTun(@NonNull String iface);
+
+    @VisibleForTesting
+    protected TestNetworkService(
+            @NonNull Context context, @NonNull INetworkManagementService netManager) {
+        mHandlerThread = new HandlerThread("TestNetworkServiceThread");
+        mHandlerThread.start();
+        mHandler = new Handler(mHandlerThread.getLooper());
+
+        mContext = checkNotNull(context, "missing Context");
+        mNMS = checkNotNull(netManager, "missing INetworkManagementService");
+        mNetd = checkNotNull(NetdService.getInstance(), "could not get netd instance");
+    }
+
+    /**
+     * Create a TUN interface with the given interface name and link addresses
+     *
+     * <p>This method will return the FileDescriptor to the TUN interface. Close it to tear down the
+     * TUN interface.
+     */
+    @Override
+    public TestNetworkInterface createTunInterface(@NonNull LinkAddress[] linkAddrs) {
+        enforceTestNetworkPermissions(mContext);
+
+        checkNotNull(linkAddrs, "missing linkAddrs");
+
+        String iface = TEST_TUN_PREFIX + sTestTunIndex.getAndIncrement();
+        return Binder.withCleanCallingIdentity(
+                () -> {
+                    try {
+                        ParcelFileDescriptor tunIntf =
+                                ParcelFileDescriptor.adoptFd(jniCreateTun(iface));
+                        for (LinkAddress addr : linkAddrs) {
+                            mNetd.interfaceAddAddress(
+                                    iface,
+                                    addr.getAddress().getHostAddress(),
+                                    addr.getPrefixLength());
+                        }
+
+                        return new TestNetworkInterface(tunIntf, iface);
+                    } catch (RemoteException e) {
+                        throw e.rethrowFromSystemServer();
+                    }
+                });
+    }
+
+    // Tracker for TestNetworkAgents
+    @GuardedBy("mTestNetworkTracker")
+    @NonNull
+    private final SparseArray<TestNetworkAgent> mTestNetworkTracker = new SparseArray<>();
+
+    public class TestNetworkAgent extends NetworkAgent implements IBinder.DeathRecipient {
+        private static final int NETWORK_SCORE = 1; // Use a low, non-zero score.
+
+        private final int mUid;
+        @NonNull private final NetworkInfo mNi;
+        @NonNull private final NetworkCapabilities mNc;
+        @NonNull private final LinkProperties mLp;
+
+        @GuardedBy("mBinderLock")
+        @NonNull
+        private IBinder mBinder;
+
+        @NonNull private final Object mBinderLock = new Object();
+
+        private TestNetworkAgent(
+                @NonNull Looper looper,
+                @NonNull Context context,
+                @NonNull NetworkInfo ni,
+                @NonNull NetworkCapabilities nc,
+                @NonNull LinkProperties lp,
+                int uid,
+                @NonNull IBinder binder)
+                throws RemoteException {
+            super(looper, context, TEST_NETWORK_TYPE, ni, nc, lp, NETWORK_SCORE);
+
+            mUid = uid;
+            mNi = ni;
+            mNc = nc;
+            mLp = lp;
+
+            synchronized (mBinderLock) {
+                mBinder = binder; // Binder null-checks in create()
+
+                try {
+                    mBinder.linkToDeath(this, 0);
+                } catch (RemoteException e) {
+                    binderDied();
+                    throw e; // Abort, signal failure up the stack.
+                }
+            }
+        }
+
+        /**
+         * If the Binder object dies, this function is called to free the resources of this
+         * TestNetworkAgent
+         */
+        @Override
+        public void binderDied() {
+            teardown();
+        }
+
+        @Override
+        protected void unwanted() {
+            teardown();
+        }
+
+        private void teardown() {
+            mNi.setDetailedState(DetailedState.DISCONNECTED, null, null);
+            mNi.setIsAvailable(false);
+            sendNetworkInfo(mNi);
+
+            // Synchronize on mBinderLock to ensure that unlinkToDeath is never called more than
+            // once (otherwise it could throw an exception)
+            synchronized (mBinderLock) {
+                // If mBinder is null, this Test Network has already been cleaned up.
+                if (mBinder == null) return;
+                mBinder.unlinkToDeath(this, 0);
+                mBinder = null;
+            }
+
+            // Has to be in TestNetworkAgent to ensure all teardown codepaths properly clean up
+            // resources, even for binder death or unwanted calls.
+            synchronized (mTestNetworkTracker) {
+                mTestNetworkTracker.remove(netId);
+            }
+        }
+    }
+
+    private TestNetworkAgent registerTestNetworkAgent(
+            @NonNull Looper looper,
+            @NonNull Context context,
+            @NonNull String iface,
+            int callingUid,
+            @NonNull IBinder binder)
+            throws RemoteException, SocketException {
+        checkNotNull(looper, "missing Looper");
+        checkNotNull(context, "missing Context");
+        // iface and binder validity checked by caller
+
+        // Build network info with special testing type
+        NetworkInfo ni = new NetworkInfo(ConnectivityManager.TYPE_TEST, 0, TEST_NETWORK_TYPE, "");
+        ni.setDetailedState(DetailedState.CONNECTED, null, null);
+        ni.setIsAvailable(true);
+
+        // Build narrow set of NetworkCapabilities, useful only for testing
+        NetworkCapabilities nc = new NetworkCapabilities();
+        nc.clearAll(); // Remove default capabilities.
+        nc.addTransportType(NetworkCapabilities.TRANSPORT_TEST);
+        nc.addCapability(NetworkCapabilities.NET_CAPABILITY_NOT_SUSPENDED);
+        nc.addCapability(NetworkCapabilities.NET_CAPABILITY_NOT_RESTRICTED);
+        nc.setNetworkSpecifier(new StringNetworkSpecifier(iface));
+
+        // Build LinkProperties
+        LinkProperties lp = new LinkProperties();
+        lp.setInterfaceName(iface);
+
+        // Find the currently assigned addresses, and add them to LinkProperties
+        boolean allowIPv4 = false, allowIPv6 = false;
+        NetworkInterface netIntf = NetworkInterface.getByName(iface);
+        checkNotNull(netIntf, "No such network interface found: " + netIntf);
+
+        for (InterfaceAddress intfAddr : netIntf.getInterfaceAddresses()) {
+            lp.addLinkAddress(
+                    new LinkAddress(intfAddr.getAddress(), intfAddr.getNetworkPrefixLength()));
+
+            if (intfAddr.getAddress() instanceof Inet6Address) {
+                allowIPv6 |= !intfAddr.getAddress().isLinkLocalAddress();
+            } else if (intfAddr.getAddress() instanceof Inet4Address) {
+                allowIPv4 = true;
+            }
+        }
+
+        // Add global routes (but as non-default, non-internet providing network)
+        if (allowIPv4) {
+            lp.addRoute(new RouteInfo(new IpPrefix(Inet4Address.ANY, 0), null, iface));
+        }
+        if (allowIPv6) {
+            lp.addRoute(new RouteInfo(new IpPrefix(Inet6Address.ANY, 0), null, iface));
+        }
+
+        return new TestNetworkAgent(looper, context, ni, nc, lp, callingUid, binder);
+    }
+
+    /**
+     * Sets up a Network with extremely limited privileges, guarded by the MANAGE_TEST_NETWORKS
+     * permission.
+     *
+     * <p>This method provides a Network that is useful only for testing.
+     */
+    @Override
+    public void setupTestNetwork(@NonNull String iface, @NonNull IBinder binder) {
+        enforceTestNetworkPermissions(mContext);
+
+        checkNotNull(iface, "missing Iface");
+        checkNotNull(binder, "missing IBinder");
+
+        if (!(iface.startsWith(INetd.IPSEC_INTERFACE_PREFIX)
+                || iface.startsWith(TEST_TUN_PREFIX))) {
+            throw new IllegalArgumentException(
+                    "Cannot create network for non ipsec, non-testtun interface");
+        }
+
+        // Setup needs to be done with NETWORK_STACK privileges.
+        int callingUid = Binder.getCallingUid();
+        Binder.withCleanCallingIdentity(
+                () -> {
+                    try {
+                        mNMS.setInterfaceUp(iface);
+
+                        // Synchronize all accesses to mTestNetworkTracker to prevent the case
+                        // where:
+                        // 1. TestNetworkAgent successfully binds to death of binder
+                        // 2. Before it is added to the mTestNetworkTracker, binder dies,
+                        // binderDied() is called (on a different thread)
+                        // 3. This thread is pre-empted, put() is called after remove()
+                        synchronized (mTestNetworkTracker) {
+                            TestNetworkAgent agent =
+                                    registerTestNetworkAgent(
+                                            mHandler.getLooper(),
+                                            mContext,
+                                            iface,
+                                            callingUid,
+                                            binder);
+
+                            mTestNetworkTracker.put(agent.netId, agent);
+                        }
+                    } catch (SocketException e) {
+                        throw new UncheckedIOException(e);
+                    } catch (RemoteException e) {
+                        throw e.rethrowFromSystemServer();
+                    }
+                });
+    }
+
+    /** Teardown a test network */
+    @Override
+    public void teardownTestNetwork(int netId) {
+        enforceTestNetworkPermissions(mContext);
+
+        TestNetworkAgent agent;
+        synchronized (mTestNetworkTracker) {
+            agent = mTestNetworkTracker.get(netId);
+        }
+
+        if (agent == null) {
+            return; // Already torn down
+        } else if (agent.mUid != Binder.getCallingUid()) {
+            throw new SecurityException("Attempted to modify other user's test networks");
+        }
+
+        // Safe to be called multiple times.
+        agent.teardown();
+    }
+
+    // STOPSHIP: Change this back to android.Manifest.permission.MANAGE_TEST_NETWORKS
+    private static final String PERMISSION_NAME = "dummy";
+
+    public static void enforceTestNetworkPermissions(@NonNull Context context) {
+        // STOPSHIP: Re-enable these checks. Disabled until adoptShellPermissionIdentity() can be
+        //           called from CTS test code.
+        if (false) {
+            context.enforceCallingOrSelfPermission(PERMISSION_NAME, "TestNetworkService");
+        }
+    }
+}
diff --git a/services/core/java/com/android/server/VibratorService.java b/services/core/java/com/android/server/VibratorService.java
index 545baa0..5d0fa26 100644
--- a/services/core/java/com/android/server/VibratorService.java
+++ b/services/core/java/com/android/server/VibratorService.java
@@ -111,6 +111,8 @@
     // intensity level. It's important that we apply the scaling on the delta between the two so
     // that the default intensity level applies no scaling to application provided effects.
     private final SparseArray<ScaleLevel> mScaleLevels;
+    private final LinkedList<VibrationInfo> mPreviousRingVibrations;
+    private final LinkedList<VibrationInfo> mPreviousNotificationVibrations;
     private final LinkedList<VibrationInfo> mPreviousVibrations;
     private final int mPreviousVibrationsLimit;
     private final boolean mAllowPriorityVibrationsInLowPowerMode;
@@ -354,6 +356,8 @@
         mAllowPriorityVibrationsInLowPowerMode = mContext.getResources().getBoolean(
                 com.android.internal.R.bool.config_allowPriorityVibrationsInLowPowerMode);
 
+        mPreviousRingVibrations = new LinkedList<>();
+        mPreviousNotificationVibrations = new LinkedList<>();
         mPreviousVibrations = new LinkedList<>();
 
         IntentFilter filter = new IntentFilter();
@@ -594,8 +598,9 @@
                 if (mProcStatesCache.get(uid, ActivityManager.PROCESS_STATE_IMPORTANT_FOREGROUND)
                         > ActivityManager.PROCESS_STATE_IMPORTANT_FOREGROUND
                         && !vib.isNotification() && !vib.isRingtone()) {
-                    Slog.e(TAG, "Ignoring incoming vibration as process with uid = "
-                            + uid + " is background");
+                    Slog.e(TAG, "Ignoring incoming vibration as process with"
+                            + " uid = " + uid + " is background,"
+                            + " usage = " + AudioAttributes.usageToString(vib.usageHint));
                     return;
                 }
                 linkVibration(vib);
@@ -619,10 +624,19 @@
     }
 
     private void addToPreviousVibrationsLocked(Vibration vib) {
-        if (mPreviousVibrations.size() > mPreviousVibrationsLimit) {
-            mPreviousVibrations.removeFirst();
+        final LinkedList<VibrationInfo> previousVibrations;
+        if (vib.isRingtone()) {
+            previousVibrations = mPreviousRingVibrations;
+        } else if (vib.isNotification()) {
+            previousVibrations = mPreviousNotificationVibrations;
+        } else {
+            previousVibrations = mPreviousVibrations;
         }
-        mPreviousVibrations.addLast(vib.toInfo());
+
+        if (previousVibrations.size() > mPreviousVibrationsLimit) {
+            previousVibrations.removeFirst();
+        }
+        previousVibrations.addLast(vib.toInfo());
     }
 
     @Override // Binder call
@@ -1354,6 +1368,18 @@
             pw.println("  mNotificationIntensity=" + mNotificationIntensity);
             pw.println("  mRingIntensity=" + mRingIntensity);
             pw.println("");
+            pw.println("  Previous ring vibrations:");
+            for (VibrationInfo info : mPreviousRingVibrations) {
+                pw.print("    ");
+                pw.println(info.toString());
+            }
+
+            pw.println("  Previous notification vibrations:");
+            for (VibrationInfo info : mPreviousNotificationVibrations) {
+                pw.print("    ");
+                pw.println(info.toString());
+            }
+
             pw.println("  Previous vibrations:");
             for (VibrationInfo info : mPreviousVibrations) {
                 pw.print("    ");
diff --git a/services/core/java/com/android/server/am/ActiveServices.java b/services/core/java/com/android/server/am/ActiveServices.java
index fb541e0..85ec2dd 100644
--- a/services/core/java/com/android/server/am/ActiveServices.java
+++ b/services/core/java/com/android/server/am/ActiveServices.java
@@ -933,6 +933,27 @@
         }
     }
 
+    /**
+     * Return the current foregroundServiceType of the ServiceRecord.
+     * @param className ComponentName of the Service class.
+     * @param token IBinder token.
+     * @return current foreground service type.
+     */
+    public int getForegroundServiceTypeLocked(ComponentName className, IBinder token) {
+        final int userId = UserHandle.getCallingUserId();
+        final long origId = Binder.clearCallingIdentity();
+        int ret = ServiceInfo.FOREGROUND_SERVICE_TYPE_NONE;
+        try {
+            ServiceRecord r = findServiceLocked(className, token, userId);
+            if (r != null) {
+                ret = r.foregroundServiceType;
+            }
+        } finally {
+            Binder.restoreCallingIdentity(origId);
+        }
+        return ret;
+    }
+
     boolean foregroundAppShownEnoughLocked(ActiveForegroundApp aa, long nowElapsed) {
         if (DEBUG_FOREGROUND_SERVICE) Slog.d(TAG, "Shown enough: pkg=" + aa.mPackageName + ", uid="
                 + aa.mUid);
@@ -2190,7 +2211,7 @@
                 return new ServiceLookupResult(null, r.permission);
             } else if (r.permission != null && callingPackage != null) {
                 final int opCode = AppOpsManager.permissionToOpCode(r.permission);
-                if (opCode != AppOpsManager.OP_NONE && mAm.mAppOpsService.noteOperation(
+                if (opCode != AppOpsManager.OP_NONE && mAm.mAppOpsService.checkOperation(
                         opCode, callingUid, callingPackage) != AppOpsManager.MODE_ALLOWED) {
                     Slog.w(TAG, "Appop Denial: Accessing service " + r.shortInstanceName
                             + " from pid=" + callingPid
diff --git a/services/core/java/com/android/server/am/ActivityManagerConstants.java b/services/core/java/com/android/server/am/ActivityManagerConstants.java
index de41152..f9fcef6 100644
--- a/services/core/java/com/android/server/am/ActivityManagerConstants.java
+++ b/services/core/java/com/android/server/am/ActivityManagerConstants.java
@@ -16,8 +16,6 @@
 
 package com.android.server.am;
 
-import static android.provider.DeviceConfig.ActivityManager.KEY_MAX_CACHED_PROCESSES;
-
 import static com.android.server.am.ActivityManagerDebugConfig.DEBUG_POWER_QUICK;
 
 import android.app.ActivityThread;
@@ -29,6 +27,8 @@
 import android.provider.DeviceConfig.OnPropertyChangedListener;
 import android.provider.Settings;
 import android.text.TextUtils;
+import android.text.TextUtils.SimpleStringSplitter;
+import android.util.ArraySet;
 import android.util.KeyValueListParser;
 import android.util.Slog;
 
@@ -105,6 +105,12 @@
     private static final long DEFAULT_MEMORY_INFO_THROTTLE_TIME = 5*60*1000;
     private static final long DEFAULT_TOP_TO_FGS_GRACE_DURATION = 15 * 1000;
 
+    // Flag stored in the DeviceConfig API.
+    /**
+     * Maximum number of cached processes.
+     */
+    private static final String KEY_MAX_CACHED_PROCESSES = "max_cached_processes";
+
     // Maximum number of cached processes we will allow.
     public int MAX_CACHED_PROCESSES = DEFAULT_MAX_CACHED_PROCESSES;
 
@@ -231,6 +237,8 @@
     // Controlled by Settings.Global.BACKGROUND_ACTIVITY_STARTS_ENABLED
     volatile boolean mFlagBackgroundActivityStartsEnabled;
 
+    volatile ArraySet<String> mPackageNamesWhitelistedForBgActivityStarts = new ArraySet<>();
+
     private final ActivityManagerService mService;
     private ContentResolver mResolver;
     private final KeyValueListParser mParser = new KeyValueListParser(',');
@@ -269,6 +277,10 @@
                 Settings.Global.getUriFor(
                         Settings.Global.BACKGROUND_ACTIVITY_STARTS_ENABLED);
 
+    private static final Uri BACKGROUND_ACTIVITY_STARTS_PACKAGE_NAMES_WHITELIST_URI =
+                Settings.Global.getUriFor(
+                        Settings.Global.BACKGROUND_ACTIVITY_STARTS_PACKAGE_NAMES_WHITELIST);
+
     private final OnPropertyChangedListener mOnDeviceConfigChangedListener =
             new OnPropertyChangedListener() {
                 @Override
@@ -289,10 +301,13 @@
         mResolver.registerContentObserver(ACTIVITY_MANAGER_CONSTANTS_URI, false, this);
         mResolver.registerContentObserver(ACTIVITY_STARTS_LOGGING_ENABLED_URI, false, this);
         mResolver.registerContentObserver(BACKGROUND_ACTIVITY_STARTS_ENABLED_URI, false, this);
+        mResolver.registerContentObserver(BACKGROUND_ACTIVITY_STARTS_PACKAGE_NAMES_WHITELIST_URI,
+                false, this);
         updateConstants();
         updateActivityStartsLoggingEnabled();
         updateBackgroundActivityStartsEnabled();
-        DeviceConfig.addOnPropertyChangedListener(DeviceConfig.ActivityManager.NAMESPACE,
+        updateBackgroundActivityStartsPackageNamesWhitelist();
+        DeviceConfig.addOnPropertyChangedListener(DeviceConfig.NAMESPACE_ACTIVITY_MANAGER,
                 ActivityThread.currentApplication().getMainExecutor(),
                 mOnDeviceConfigChangedListener);
         updateMaxCachedProcesses();
@@ -321,6 +336,8 @@
             updateActivityStartsLoggingEnabled();
         } else if (BACKGROUND_ACTIVITY_STARTS_ENABLED_URI.equals(uri)) {
             updateBackgroundActivityStartsEnabled();
+        } else if (BACKGROUND_ACTIVITY_STARTS_PACKAGE_NAMES_WHITELIST_URI.equals(uri)) {
+            updateBackgroundActivityStartsPackageNamesWhitelist();
         }
     }
 
@@ -410,9 +427,24 @@
                 Settings.Global.BACKGROUND_ACTIVITY_STARTS_ENABLED, 1) == 1;
     }
 
+    private void updateBackgroundActivityStartsPackageNamesWhitelist() {
+        final String setting = Settings.Global.getString(mResolver,
+                Settings.Global.BACKGROUND_ACTIVITY_STARTS_PACKAGE_NAMES_WHITELIST);
+        if (TextUtils.isEmpty(setting)) {
+            return;
+        }
+        ArraySet<String> newSet = new ArraySet<>();
+        SimpleStringSplitter splitter = new SimpleStringSplitter(':');
+        splitter.setString(setting);
+        while (splitter.hasNext()) {
+            newSet.add(splitter.next());
+        }
+        mPackageNamesWhitelistedForBgActivityStarts = newSet;
+    }
+
     private void updateMaxCachedProcesses() {
         String maxCachedProcessesFlag = DeviceConfig.getProperty(
-                DeviceConfig.ActivityManager.NAMESPACE, KEY_MAX_CACHED_PROCESSES);
+                DeviceConfig.NAMESPACE_ACTIVITY_MANAGER, KEY_MAX_CACHED_PROCESSES);
         try {
             CUR_MAX_CACHED_PROCESSES = mOverrideMaxCachedProcesses < 0
                     ? (TextUtils.isEmpty(maxCachedProcessesFlag)
diff --git a/services/core/java/com/android/server/am/ActivityManagerService.java b/services/core/java/com/android/server/am/ActivityManagerService.java
index f2902b1..0a80d45 100644
--- a/services/core/java/com/android/server/am/ActivityManagerService.java
+++ b/services/core/java/com/android/server/am/ActivityManagerService.java
@@ -185,6 +185,7 @@
 import android.app.WindowConfiguration.WindowingMode;
 import android.app.backup.IBackupManager;
 import android.app.usage.UsageEvents;
+import android.app.usage.UsageEvents.Event;
 import android.app.usage.UsageStatsManagerInternal;
 import android.appwidget.AppWidgetManager;
 import android.content.AutofillOptions;
@@ -1489,6 +1490,11 @@
 
     private ParcelFileDescriptor[] mLifeMonitorFds;
 
+    /**
+     * Used to notify activity lifecycle events.
+     */
+    @Nullable ContentCaptureManagerInternal mContentCaptureService;
+
     final class UiHandler extends Handler {
         public UiHandler() {
             super(com.android.server.UiThread.get().getLooper(), null, true);
@@ -1983,6 +1989,16 @@
         mActivityTaskManager.setUsageStatsManager(usageStatsManager);
     }
 
+    /**
+     * Sets the internal content capture manager service.
+     *
+     * <p>It's called when {@code SystemServer} starts, so we don't really need to acquire the lock.
+     */
+    public void setContentCaptureManager(
+            @Nullable ContentCaptureManagerInternal contentCaptureManager) {
+        mContentCaptureService = contentCaptureManager;
+    }
+
     public void startObservingNativeCrashes() {
         final NativeCrashListener ncl = new NativeCrashListener(this);
         ncl.start();
@@ -2129,6 +2145,7 @@
         private String mExemptionsStr;
         private List<String> mExemptions = Collections.emptyList();
         private int mLogSampleRate = -1;
+        private int mStatslogSampleRate = -1;
         @HiddenApiEnforcementPolicy private int mPolicy = HIDDEN_API_ENFORCEMENT_DEFAULT;
 
         public HiddenApiSettings(Handler handler, Context context) {
@@ -2146,6 +2163,11 @@
                     false,
                     this);
             mContext.getContentResolver().registerContentObserver(
+                    Settings.Global.getUriFor(
+                        Settings.Global.HIDDEN_API_ACCESS_STATSLOG_SAMPLING_RATE),
+                    false,
+                    this);
+            mContext.getContentResolver().registerContentObserver(
                     Settings.Global.getUriFor(Settings.Global.HIDDEN_API_POLICY),
                     false,
                     this);
@@ -2181,6 +2203,15 @@
                 mLogSampleRate = logSampleRate;
                 ZYGOTE_PROCESS.setHiddenApiAccessLogSampleRate(mLogSampleRate);
             }
+            int statslogSampleRate = Settings.Global.getInt(mContext.getContentResolver(),
+                    Settings.Global.HIDDEN_API_ACCESS_STATSLOG_SAMPLING_RATE, 0);
+            if (statslogSampleRate < 0 || statslogSampleRate > 0x10000) {
+                statslogSampleRate = -1;
+            }
+            if (statslogSampleRate != -1 && statslogSampleRate != mStatslogSampleRate) {
+                mStatslogSampleRate = statslogSampleRate;
+                ZYGOTE_PROCESS.setHiddenApiAccessStatslogSampleRate(mStatslogSampleRate);
+            }
             mPolicy = getValidEnforcementPolicy(Settings.Global.HIDDEN_API_POLICY);
         }
 
@@ -2900,6 +2931,10 @@
                         taskRoot);
             }
         }
+        if (mContentCaptureService != null
+                && (event == Event.ACTIVITY_PAUSED || event == Event.ACTIVITY_RESUMED)) {
+            mContentCaptureService.notifyActivityEvent(userId, activity, event);
+        }
     }
 
     /**
@@ -3934,11 +3969,12 @@
         final long callingId = Binder.clearCallingIdentity();
         try {
             synchronized (this) {
-                mProcessList.killAllBackgroundProcessesLocked();
-
+                // Allow memory level to go down (the flag needs to be set before updating oom adj)
+                // because this method is also used to simulate low memory.
                 mAllowLowerMemLevel = true;
+                mProcessList.killPackageProcessesLocked(null /* packageName */, -1 /* appId */,
+                        UserHandle.USER_ALL, ProcessList.CACHED_APP_MIN_ADJ, "kill all background");
 
-                updateOomAdjLocked();
                 doLowMemReportIfNeededLocked(null);
             }
         } finally {
@@ -13586,6 +13622,13 @@
     }
 
     @Override
+    public int getForegroundServiceType(ComponentName className, IBinder token) {
+        synchronized (this) {
+            return mServices.getForegroundServiceTypeLocked(className, token);
+        }
+    }
+
+    @Override
     public int handleIncomingUser(int callingPid, int callingUid, int userId, boolean allowAll,
             boolean requireFull, String name, String callerPackage) {
         return mUserController.handleIncomingUser(callingPid, callingUid, userId, allowAll,
@@ -17601,6 +17644,16 @@
         }
 
         @Override
+        public void killProcess(String processName, int uid, String reason) {
+            synchronized (ActivityManagerService.this) {
+                final ProcessRecord proc = getProcessRecordLocked(processName, uid,
+                        true /* keepIfLarge */);
+                mProcessList.removeProcessLocked(proc, false /* callerWillRestart */,
+                        true /* allowRestart */, reason);
+            }
+        }
+
+        @Override
         public boolean hasRunningActivity(int uid, @Nullable String packageName) {
             if (packageName == null) return false;
 
@@ -17840,6 +17893,10 @@
             return mConstants.mFlagActivityStartsLoggingEnabled;
         }
 
+        public boolean isPackageNameWhitelistedForBgActivityStarts(String packageName) {
+            return mConstants.mPackageNamesWhitelistedForBgActivityStarts.contains(packageName);
+        }
+
         public boolean isBackgroundActivityStartsEnabled() {
             return mConstants.mFlagBackgroundActivityStartsEnabled;
         }
@@ -18453,7 +18510,12 @@
         public int checkPermission(String permName, String pkgName, int userId,
                 TriFunction<String, String, Integer, Integer> superImpl) {
             if (mTargetPackageName.equals(pkgName) && isTargetPermission(permName)) {
-                return superImpl.apply(permName, "com.android.shell", userId);
+                final long identity = Binder.clearCallingIdentity();
+                try {
+                    return superImpl.apply(permName, "com.android.shell", userId);
+                } finally {
+                    Binder.restoreCallingIdentity(identity);
+                }
             }
             return superImpl.apply(permName, pkgName, userId);
         }
@@ -18462,7 +18524,12 @@
         public int checkUidPermission(String permName, int uid,
                 BiFunction<String, Integer, Integer> superImpl) {
             if (uid == mTargetUid  && isTargetPermission(permName)) {
-                return superImpl.apply(permName, Process.SHELL_UID);
+                final long identity = Binder.clearCallingIdentity();
+                try {
+                    return superImpl.apply(permName, Process.SHELL_UID);
+                } finally {
+                    Binder.restoreCallingIdentity(identity);
+                }
             }
             return superImpl.apply(permName, uid);
         }
diff --git a/services/core/java/com/android/server/am/ActivityManagerShellCommand.java b/services/core/java/com/android/server/am/ActivityManagerShellCommand.java
index 4f6f9fd..85322d6 100644
--- a/services/core/java/com/android/server/am/ActivityManagerShellCommand.java
+++ b/services/core/java/com/android/server/am/ActivityManagerShellCommand.java
@@ -492,7 +492,6 @@
             final long endTime = SystemClock.uptimeMillis();
             PrintWriter out = mWaitOption ? pw : getErrPrintWriter();
             boolean launched = false;
-            boolean hotLaunch = false;
             switch (res) {
                 case ActivityManager.START_SUCCESS:
                     launched = true;
@@ -518,8 +517,6 @@
                     break;
                 case ActivityManager.START_TASK_TO_FRONT:
                     launched = true;
-                    //TODO(b/120981435) remove special case
-                    hotLaunch = true;
                     out.println(
                             "Warning: Activity not started, its current "
                                     + "task has been brought to the front");
@@ -567,9 +564,7 @@
                     result.who = intent.getComponent();
                 }
                 pw.println("Status: " + (result.timeout ? "timeout" : "ok"));
-                final @WaitResult.LaunchState int launchState =
-                        hotLaunch ? WaitResult.LAUNCH_STATE_HOT : result.launchState;
-                pw.println("LaunchState: " + launchStateToString(launchState));
+                pw.println("LaunchState: " + launchStateToString(result.launchState));
                 if (result.who != null) {
                     pw.println("Activity: " + result.who.flattenToShortString());
                 }
diff --git a/services/core/java/com/android/server/am/AppCompactor.java b/services/core/java/com/android/server/am/AppCompactor.java
index 17ffd9c..1f21160 100644
--- a/services/core/java/com/android/server/am/AppCompactor.java
+++ b/services/core/java/com/android/server/am/AppCompactor.java
@@ -17,14 +17,6 @@
 package com.android.server.am;
 
 import static android.os.Process.THREAD_PRIORITY_FOREGROUND;
-import static android.provider.DeviceConfig.ActivityManager.KEY_COMPACT_ACTION_1;
-import static android.provider.DeviceConfig.ActivityManager.KEY_COMPACT_ACTION_2;
-import static android.provider.DeviceConfig.ActivityManager.KEY_COMPACT_STATSD_SAMPLE_RATE;
-import static android.provider.DeviceConfig.ActivityManager.KEY_COMPACT_THROTTLE_1;
-import static android.provider.DeviceConfig.ActivityManager.KEY_COMPACT_THROTTLE_2;
-import static android.provider.DeviceConfig.ActivityManager.KEY_COMPACT_THROTTLE_3;
-import static android.provider.DeviceConfig.ActivityManager.KEY_COMPACT_THROTTLE_4;
-import static android.provider.DeviceConfig.ActivityManager.KEY_USE_COMPACTION;
 
 import android.app.ActivityManager;
 import android.app.ActivityThread;
@@ -51,6 +43,17 @@
 
 public final class AppCompactor {
 
+    // Flags stored in the DeviceConfig API.
+    @VisibleForTesting static final String KEY_USE_COMPACTION = "use_compaction";
+    @VisibleForTesting static final String KEY_COMPACT_ACTION_1 = "compact_action_1";
+    @VisibleForTesting static final String KEY_COMPACT_ACTION_2 = "compact_action_2";
+    @VisibleForTesting static final String KEY_COMPACT_THROTTLE_1 = "compact_throttle_1";
+    @VisibleForTesting static final String KEY_COMPACT_THROTTLE_2 = "compact_throttle_2";
+    @VisibleForTesting static final String KEY_COMPACT_THROTTLE_3 = "compact_throttle_3";
+    @VisibleForTesting static final String KEY_COMPACT_THROTTLE_4 = "compact_throttle_4";
+    @VisibleForTesting static final String KEY_COMPACT_STATSD_SAMPLE_RATE =
+            "compact_statsd_sample_rate";
+
     // Phenotype sends int configurations and we map them to the strings we'll use on device,
     // preventing a weird string value entering the kernel.
     private static final int COMPACT_ACTION_FILE_FLAG = 1;
@@ -165,7 +168,7 @@
      * starts the background thread if necessary.
      */
     public void init() {
-        DeviceConfig.addOnPropertyChangedListener(DeviceConfig.ActivityManager.NAMESPACE,
+        DeviceConfig.addOnPropertyChangedListener(DeviceConfig.NAMESPACE_ACTIVITY_MANAGER,
                 ActivityThread.currentApplication().getMainExecutor(), mOnFlagsChangedListener);
         synchronized (mPhenotypeFlagLock) {
             updateUseCompaction();
@@ -228,7 +231,7 @@
     @GuardedBy("mPhenotypeFlagLock")
     private void updateUseCompaction() {
         String useCompactionFlag =
-                DeviceConfig.getProperty(DeviceConfig.ActivityManager.NAMESPACE,
+                DeviceConfig.getProperty(DeviceConfig.NAMESPACE_ACTIVITY_MANAGER,
                     KEY_USE_COMPACTION);
         mUseCompaction = TextUtils.isEmpty(useCompactionFlag)
                 ? DEFAULT_USE_COMPACTION : Boolean.parseBoolean(useCompactionFlag);
@@ -241,10 +244,10 @@
     @GuardedBy("mPhenotypeFlagLock")
     private void updateCompactionActions() {
         String compactAction1Flag =
-                DeviceConfig.getProperty(DeviceConfig.ActivityManager.NAMESPACE,
+                DeviceConfig.getProperty(DeviceConfig.NAMESPACE_ACTIVITY_MANAGER,
                         KEY_COMPACT_ACTION_1);
         String compactAction2Flag =
-                DeviceConfig.getProperty(DeviceConfig.ActivityManager.NAMESPACE,
+                DeviceConfig.getProperty(DeviceConfig.NAMESPACE_ACTIVITY_MANAGER,
                         KEY_COMPACT_ACTION_2);
 
         int compactAction1 = DEFAULT_COMPACT_ACTION_1;
@@ -271,16 +274,16 @@
     private void updateCompactionThrottles() {
         boolean useThrottleDefaults = false;
         String throttleSomeSomeFlag =
-                DeviceConfig.getProperty(DeviceConfig.ActivityManager.NAMESPACE,
+                DeviceConfig.getProperty(DeviceConfig.NAMESPACE_ACTIVITY_MANAGER,
                     KEY_COMPACT_THROTTLE_1);
         String throttleSomeFullFlag =
-                DeviceConfig.getProperty(DeviceConfig.ActivityManager.NAMESPACE,
+                DeviceConfig.getProperty(DeviceConfig.NAMESPACE_ACTIVITY_MANAGER,
                     KEY_COMPACT_THROTTLE_2);
         String throttleFullSomeFlag =
-                DeviceConfig.getProperty(DeviceConfig.ActivityManager.NAMESPACE,
+                DeviceConfig.getProperty(DeviceConfig.NAMESPACE_ACTIVITY_MANAGER,
                     KEY_COMPACT_THROTTLE_3);
         String throttleFullFullFlag =
-                DeviceConfig.getProperty(DeviceConfig.ActivityManager.NAMESPACE,
+                DeviceConfig.getProperty(DeviceConfig.NAMESPACE_ACTIVITY_MANAGER,
                     KEY_COMPACT_THROTTLE_4);
 
         if (TextUtils.isEmpty(throttleSomeSomeFlag) || TextUtils.isEmpty(throttleSomeFullFlag)
@@ -309,7 +312,7 @@
 
     @GuardedBy("mPhenotypeFlagLock")
     private void updateStatsdSampleRate() {
-        String sampleRateFlag = DeviceConfig.getProperty(DeviceConfig.ActivityManager.NAMESPACE,
+        String sampleRateFlag = DeviceConfig.getProperty(DeviceConfig.NAMESPACE_ACTIVITY_MANAGER,
                 KEY_COMPACT_STATSD_SAMPLE_RATE);
         try {
             mStatsdSampleRate = TextUtils.isEmpty(sampleRateFlag)
diff --git a/services/core/java/com/android/server/am/AppErrors.java b/services/core/java/com/android/server/am/AppErrors.java
index f153ab9..1ff6f4d 100644
--- a/services/core/java/com/android/server/am/AppErrors.java
+++ b/services/core/java/com/android/server/am/AppErrors.java
@@ -34,6 +34,8 @@
 import android.content.Context;
 import android.content.Intent;
 import android.content.pm.ApplicationInfo;
+import android.content.pm.ModuleInfo;
+import android.content.pm.PackageManager;
 import android.content.pm.VersionedPackage;
 import android.net.Uri;
 import android.os.Binder;
@@ -406,15 +408,29 @@
         }
 
         if (r != null) {
-            if (r.isPersistent()) {
-                // If a persistent app is stuck in a crash loop, the device isn't very
-                // usable, so we want to consider sending out a rescue party.
-                RescueParty.notePersistentAppCrash(mContext, r.uid);
-            } else {
-                // If a non-persistent app is stuck in crash loop, we want to inform
-                // the package watchdog, maybe an update or experiment can be rolled back.
-                mPackageWatchdog.onPackageFailure(r.getPackageListWithVersionCode());
+            boolean isApexModule = false;
+            try {
+                for (String androidPackage : r.getPackageList()) {
+                    ModuleInfo moduleInfo = mContext.getPackageManager().getModuleInfo(
+                            androidPackage, /*flags=*/ 0);
+                    if (moduleInfo != null) {
+                        isApexModule = true;
+                        break;
+                    }
+                }
+            } catch (IllegalStateException | PackageManager.NameNotFoundException e) {
+                // Call to PackageManager#getModuleInfo() can result in NameNotFoundException or
+                // IllegalStateException. In case they are thrown, there isn't much we can do
+                // other than proceed with app crash handling.
             }
+
+            if (r.isPersistent() || isApexModule) {
+                // If a persistent app or apex module is stuck in a crash loop, the device isn't
+                // very usable, so we want to consider sending out a rescue party.
+                RescueParty.noteAppCrash(mContext, r.uid);
+            }
+
+            mPackageWatchdog.onPackageFailure(r.getPackageListWithVersionCode());
         }
 
         final int relaunchReason = r != null
diff --git a/services/core/java/com/android/server/am/BroadcastDispatcher.java b/services/core/java/com/android/server/am/BroadcastDispatcher.java
index 0b38ef9..b0b1840 100644
--- a/services/core/java/com/android/server/am/BroadcastDispatcher.java
+++ b/services/core/java/com/android/server/am/BroadcastDispatcher.java
@@ -617,11 +617,9 @@
      * Cancel all current deferrals; that is, make all currently-deferred broadcasts
      * immediately deliverable.  Used by the wait-for-broadcast-idle mechanism.
      */
-    public void cancelDeferrals() {
-        synchronized (mLock) {
-            zeroDeferralTimes(mAlarmBroadcasts);
-            zeroDeferralTimes(mDeferredBroadcasts);
-        }
+    public void cancelDeferralsLocked() {
+        zeroDeferralTimes(mAlarmBroadcasts);
+        zeroDeferralTimes(mDeferredBroadcasts);
     }
 
     private static void zeroDeferralTimes(ArrayList<Deferrals> list) {
diff --git a/services/core/java/com/android/server/am/BroadcastFilter.java b/services/core/java/com/android/server/am/BroadcastFilter.java
index 8e2ca06..34fca23 100644
--- a/services/core/java/com/android/server/am/BroadcastFilter.java
+++ b/services/core/java/com/android/server/am/BroadcastFilter.java
@@ -81,7 +81,9 @@
         StringBuilder sb = new StringBuilder();
         sb.append("BroadcastFilter{");
         sb.append(Integer.toHexString(System.identityHashCode(this)));
-        sb.append(" u");
+        sb.append(' ');
+        sb.append(owningUid);
+        sb.append("/u");
         sb.append(owningUserId);
         sb.append(' ');
         sb.append(receiverList);
diff --git a/services/core/java/com/android/server/am/BroadcastQueue.java b/services/core/java/com/android/server/am/BroadcastQueue.java
index efb1c44..70733ef 100644
--- a/services/core/java/com/android/server/am/BroadcastQueue.java
+++ b/services/core/java/com/android/server/am/BroadcastQueue.java
@@ -445,7 +445,7 @@
         final long elapsed = finishTime - r.receiverTime;
         r.state = BroadcastRecord.IDLE;
         if (state == BroadcastRecord.IDLE) {
-            Slog.w(TAG, "finishReceiver [" + mQueueName + "] called but state is IDLE");
+            Slog.w(TAG_BROADCAST, "finishReceiver [" + mQueueName + "] called but state is IDLE");
         }
         if (r.allowBackgroundActivityStarts && r.curApp != null) {
             if (elapsed > mConstants.ALLOW_BG_ACTIVITY_START_TIMEOUT) {
@@ -478,12 +478,13 @@
         if (!r.timeoutExempt) {
             if (mConstants.SLOW_TIME > 0 && elapsed > mConstants.SLOW_TIME) {
                 if (DEBUG_BROADCAST_DEFERRAL) {
-                    Slog.i(TAG, "Broadcast receiver was slow: " + receiver + " br=" + r);
+                    Slog.i(TAG_BROADCAST, "Broadcast receiver " + (r.nextReceiver - 1)
+                            + " was slow: " + receiver + " br=" + r);
                 }
                 if (r.curApp != null) {
                     mDispatcher.startDeferring(r.curApp.uid);
                 } else {
-                    Slog.d(TAG, "finish receiver curApp is null? " + r);
+                    Slog.d(TAG_BROADCAST, "finish receiver curApp is null? " + r);
                 }
             }
         } else {
@@ -796,9 +797,7 @@
                     skipReceiverLocked(r);
                 }
             } else {
-                if (r.receiverTime == 0) {
-                    r.receiverTime = SystemClock.uptimeMillis();
-                }
+                r.receiverTime = SystemClock.uptimeMillis();
                 maybeAddAllowBackgroundActivityStartsToken(filter.receiverList.app, r);
                 performReceiveLocked(filter.receiverList.app, filter.receiverList.receiver,
                         new Intent(r.intent), r.resultCode, r.resultData,
@@ -1083,16 +1082,19 @@
                         if (newCount == 0) {
                             // done!  clear out this record's bookkeeping and deliver
                             if (DEBUG_BROADCAST_DEFERRAL) {
-                                Slog.i(TAG, "Sending broadcast completion for split token "
-                                        + r.splitToken);
+                                Slog.i(TAG_BROADCAST,
+                                        "Sending broadcast completion for split token "
+                                        + r.splitToken + " : " + r.intent.getAction());
                             }
                             mSplitRefcounts.delete(r.splitToken);
                         } else {
                             // still have some split broadcast records in flight; update refcount
                             // and hold off on the callback
                             if (DEBUG_BROADCAST_DEFERRAL) {
-                                Slog.i(TAG, "Result refcount " + newCount + " for split token "
-                                        + r.splitToken + " - not sending completion yet");
+                                Slog.i(TAG_BROADCAST,
+                                        "Result refcount now " + newCount + " for split token "
+                                        + r.splitToken + " : " + r.intent.getAction()
+                                        + " - not sending completion yet");
                             }
                             sendResult = false;
                             mSplitRefcounts.put(r.splitToken, newCount);
@@ -1155,7 +1157,7 @@
                     BroadcastRecord defer;
                     if (r.nextReceiver + 1 == numReceivers) {
                         if (DEBUG_BROADCAST_DEFERRAL) {
-                            Slog.i(TAG, "Sole receiver of " + r
+                            Slog.i(TAG_BROADCAST, "Sole receiver of " + r
                                     + " is under deferral; setting aside and proceeding");
                         }
                         defer = r;
@@ -1185,15 +1187,25 @@
                                 // first split of this record; refcount for 'r' and 'deferred'
                                 r.splitToken = defer.splitToken = nextSplitTokenLocked();
                                 mSplitRefcounts.put(r.splitToken, 2);
+                                if (DEBUG_BROADCAST_DEFERRAL) {
+                                    Slog.i(TAG_BROADCAST,
+                                            "Broadcast needs split refcount; using new token "
+                                            + r.splitToken);
+                                }
                             } else {
                                 // new split from an already-refcounted situation; increment count
                                 final int curCount = mSplitRefcounts.get(token);
                                 if (DEBUG_BROADCAST_DEFERRAL) {
                                     if (curCount == 0) {
-                                        Slog.wtf(TAG, "Split refcount is zero with token for " + r);
+                                        Slog.wtf(TAG_BROADCAST,
+                                                "Split refcount is zero with token for " + r);
                                     }
                                 }
                                 mSplitRefcounts.put(token, curCount + 1);
+                                if (DEBUG_BROADCAST_DEFERRAL) {
+                                    Slog.i(TAG_BROADCAST, "New split count for token " + token
+                                            + " is " + (curCount + 1));
+                                }
                             }
                         }
                     }
@@ -1529,7 +1541,7 @@
         if (skip) {
             if (DEBUG_BROADCAST)  Slog.v(TAG_BROADCAST,
                     "Skipping delivery of ordered [" + mQueueName + "] "
-                    + r + " for whatever reason");
+                    + r + " for reason described above");
             r.delivery[recIdx] = BroadcastRecord.DELIVERY_SKIPPED;
             r.receiver = null;
             r.curFilter = null;
@@ -1858,7 +1870,10 @@
     // Used by wait-for-broadcast-idle : fast-forward all current deferrals to
     // be immediately deliverable.
     void cancelDeferrals() {
-        mDispatcher.cancelDeferrals();
+        synchronized (mService) {
+            mDispatcher.cancelDeferralsLocked();
+            scheduleBroadcastsLocked();
+        }
     }
 
     String describeState() {
diff --git a/services/core/java/com/android/server/am/BroadcastRecord.java b/services/core/java/com/android/server/am/BroadcastRecord.java
index fa9b79d..1352504 100644
--- a/services/core/java/com/android/server/am/BroadcastRecord.java
+++ b/services/core/java/com/android/server/am/BroadcastRecord.java
@@ -332,7 +332,6 @@
                 }
                 splitReceivers.add(o);
                 receivers.remove(i);
-                break;
             } else {
                 i++;
             }
@@ -350,6 +349,7 @@
                 resultData, resultExtras, ordered, sticky, initialSticky, userId,
                 allowBackgroundActivityStarts, timeoutExempt);
 
+        split.splitToken = this.splitToken;
         return split;
     }
 
diff --git a/services/core/java/com/android/server/am/ProcessList.java b/services/core/java/com/android/server/am/ProcessList.java
index 30798a8..d02fd73 100644
--- a/services/core/java/com/android/server/am/ProcessList.java
+++ b/services/core/java/com/android/server/am/ProcessList.java
@@ -249,6 +249,10 @@
     // Threshold of number of cached+empty where we consider memory critical.
     static final int TRIM_LOW_THRESHOLD = 5;
 
+    // If true, then we pass the flag to ART to load the app image startup cache.
+    private static final String PROPERTY_USE_APP_IMAGE_STARTUP_CACHE =
+            "persist.device_config.runtime_native.use_app_image_startup_cache";
+
     // Low Memory Killer Daemon command codes.
     // These must be kept in sync with the definitions in lmkd.c
     //
@@ -1157,11 +1161,11 @@
      *
      * @param pid The process identifier to set.
      * @param uid The uid of the app
-     * @param amt Adjustment value -- lmkd allows -16 to +15.
+     * @param amt Adjustment value -- lmkd allows -1000 to +1000
      *
      * {@hide}
      */
-    public static final void setOomAdj(int pid, int uid, int amt) {
+    public static void setOomAdj(int pid, int uid, int amt) {
         // This indicates that the process is not started yet and so no need to proceed further.
         if (pid <= 0) {
             return;
@@ -1559,6 +1563,13 @@
                 runtimeFlags |= policyBits;
             }
 
+            String useAppImageCache = SystemProperties.get(
+                    PROPERTY_USE_APP_IMAGE_STARTUP_CACHE, "");
+            // Property defaults to true currently.
+            if (!TextUtils.isEmpty(useAppImageCache) && !useAppImageCache.equals("false")) {
+                runtimeFlags |= Zygote.USE_APP_IMAGE_STARTUP_CACHE;
+            }
+
             String invokeWith = null;
             if ((app.info.flags & ApplicationInfo.FLAG_DEBUGGABLE) != 0) {
                 // Debuggable apps may include a wrapper script with their library directory.
@@ -1783,7 +1794,7 @@
                         app.processName, uid, uid, gids, runtimeFlags, mountExternal,
                         app.info.targetSdkVersion, seInfo, requiredAbi, instructionSet,
                         app.info.dataDir, null, app.info.packageName,
-                        packageNames, sandboxId, /*useBlastulaPool=*/ false,
+                        packageNames, sandboxId, /*useUnspecializedAppProcessPool=*/ false,
                         new String[] {PROC_START_SEQ_IDENT + app.startSeq});
             } else {
                 startResult = Process.start(entryPoint,
@@ -2074,25 +2085,6 @@
         }
     }
 
-    void killAllBackgroundProcessesLocked() {
-        final ArrayList<ProcessRecord> procs = new ArrayList<>();
-        final int NP = mProcessNames.getMap().size();
-        for (int ip = 0; ip < NP; ip++) {
-            final SparseArray<ProcessRecord> apps = mProcessNames.getMap().valueAt(ip);
-            final int NA = apps.size();
-            for (int ia = 0; ia < NA; ia++) {
-                final ProcessRecord app = apps.valueAt(ia);
-                if (app.isPersistent()) {
-                    // We don't kill persistent processes.
-                    continue;
-                }
-                if (app.removed || app.setAdj >= ProcessList.CACHED_APP_MIN_ADJ) {
-                    procs.add(app);
-                }
-            }
-        }
-    }
-
     @GuardedBy("mService")
     boolean killPackageProcessesLocked(String packageName, int appId, int userId, int minOomAdj,
             String reason) {
@@ -2129,6 +2121,11 @@
 
                 // Skip process if it doesn't meet our oom adj requirement.
                 if (app.setAdj < minOomAdj) {
+                    // Note it is still possible to have a process with oom adj 0 in the killed
+                    // processes, but it does not mean misjudgment. E.g. a bound service process
+                    // and its client activity process are both in the background, so they are
+                    // collected to be killed. If the client activity is killed first, the service
+                    // may be scheduled to unbind and become an executing service (oom adj 0).
                     continue;
                 }
 
@@ -2852,6 +2849,15 @@
                     pos--;
                 }
                 mLruProcesses.add(pos, app);
+                if (pos == mLruProcessActivityStart) {
+                    mLruProcessActivityStart++;
+                }
+                if (pos == mLruProcessServiceStart) {
+                    // Unless {@code #hasService} is implemented, currently the starting position
+                    // for activity and service are the same, so the incoming position may equal to
+                    // the starting position of service.
+                    mLruProcessServiceStart++;
+                }
                 // If this process is part of a group, need to pull up any other processes
                 // in that group to be with it.
                 int endIndex = pos - 1;
diff --git a/services/core/java/com/android/server/am/ProcessRecord.java b/services/core/java/com/android/server/am/ProcessRecord.java
index fcc857b..51b1ae1 100644
--- a/services/core/java/com/android/server/am/ProcessRecord.java
+++ b/services/core/java/com/android/server/am/ProcessRecord.java
@@ -55,6 +55,7 @@
 import android.util.TimeUtils;
 import android.util.proto.ProtoOutputStream;
 
+import com.android.internal.annotations.VisibleForTesting;
 import com.android.internal.app.procstats.ProcessState;
 import com.android.internal.app.procstats.ProcessStats;
 import com.android.internal.os.BatteryStatsImpl;
@@ -73,7 +74,7 @@
  * Full information about a particular process that
  * is currently running.
  */
-final class ProcessRecord implements WindowProcessListener {
+class ProcessRecord implements WindowProcessListener {
     private static final String TAG = TAG_WITH_CLASS_NAME ? "ProcessRecord" : TAG_AM;
 
     private final ActivityManagerService mService; // where we came from
@@ -1303,6 +1304,27 @@
             ServerProtoEnums.DATA_APP;
     }
 
+    /**
+     * Unless configured otherwise, swallow ANRs in background processes & kill the process.
+     * Non-private access is for tests only.
+     */
+    @VisibleForTesting
+    boolean isSilentAnr() {
+        return !getShowBackground() && !isInterestingForBackgroundTraces();
+    }
+
+    /** Non-private access is for tests only. */
+    @VisibleForTesting
+    List<ProcessRecord> getLruProcessList() {
+        return mService.mProcessList.mLruProcesses;
+    }
+
+    /** Non-private access is for tests only. */
+    @VisibleForTesting
+    boolean isMonitorCpuUsage() {
+        return mService.MONITOR_CPU_USAGE;
+    }
+
     void appNotResponding(String activityShortComponentName, ApplicationInfo aInfo,
             String parentShortComponentName, WindowProcessController parentProcess,
             boolean aboveSystem, String annotation) {
@@ -1312,16 +1334,10 @@
         mWindowProcessController.appEarlyNotResponding(annotation, () -> kill("anr", true));
 
         long anrTime = SystemClock.uptimeMillis();
-        if (ActivityManagerService.MONITOR_CPU_USAGE) {
+        if (isMonitorCpuUsage()) {
             mService.updateCpuStatsNow();
         }
 
-        // Unless configured otherwise, swallow ANRs in background processes & kill the process.
-        boolean showBackground = Settings.Secure.getInt(mService.mContext.getContentResolver(),
-                Settings.Secure.ANR_SHOW_BACKGROUND, 0) != 0;
-
-        boolean isSilentANR;
-
         synchronized (mService) {
             // PowerManager.reboot() can block for a long time, so ignore ANRs while shutting down.
             if (mService.mAtmInternal.isShuttingDown()) {
@@ -1353,8 +1369,7 @@
             firstPids.add(pid);
 
             // Don't dump other PIDs if it's a background ANR
-            isSilentANR = !showBackground && !isInterestingForBackgroundTraces();
-            if (!isSilentANR) {
+            if (!isSilentAnr()) {
                 int parentPid = pid;
                 if (parentProcess != null && parentProcess.getPid() > 0) {
                     parentPid = parentProcess.getPid();
@@ -1363,8 +1378,8 @@
 
                 if (MY_PID != pid && MY_PID != parentPid) firstPids.add(MY_PID);
 
-                for (int i = mService.mProcessList.mLruProcesses.size() - 1; i >= 0; i--) {
-                    ProcessRecord r = mService.mProcessList.mLruProcesses.get(i);
+                for (int i = getLruProcessList().size() - 1; i >= 0; i--) {
+                    ProcessRecord r = getLruProcessList().get(i);
                     if (r != null && r.thread != null) {
                         int myPid = r.pid;
                         if (myPid > 0 && myPid != pid && myPid != parentPid && myPid != MY_PID) {
@@ -1405,7 +1420,7 @@
 
         // don't dump native PIDs for background ANRs unless it is the process of interest
         String[] nativeProcs = null;
-        if (isSilentANR) {
+        if (isSilentAnr()) {
             for (int i = 0; i < NATIVE_STACKS_OF_INTEREST.length; i++) {
                 if (NATIVE_STACKS_OF_INTEREST[i].equals(processName)) {
                     nativeProcs = new String[] { processName };
@@ -1429,11 +1444,11 @@
         // For background ANRs, don't pass the ProcessCpuTracker to
         // avoid spending 1/2 second collecting stats to rank lastPids.
         File tracesFile = ActivityManagerService.dumpStackTraces(firstPids,
-                (isSilentANR) ? null : processCpuTracker, (isSilentANR) ? null : lastPids,
+                (isSilentAnr()) ? null : processCpuTracker, (isSilentAnr()) ? null : lastPids,
                 nativePids);
 
         String cpuInfo = null;
-        if (ActivityManagerService.MONITOR_CPU_USAGE) {
+        if (isMonitorCpuUsage()) {
             mService.updateCpuStatsNow();
             synchronized (mService.mProcessCpuTracker) {
                 cpuInfo = mService.mProcessCpuTracker.printCurrentState(anrTime);
@@ -1477,9 +1492,13 @@
         }
 
         synchronized (mService) {
-            mService.mBatteryStatsService.noteProcessAnr(processName, uid);
+            // mBatteryStatsService can be null if the AMS is constructed with injector only. This
+            // will only happen in tests.
+            if (mService.mBatteryStatsService != null) {
+                mService.mBatteryStatsService.noteProcessAnr(processName, uid);
+            }
 
-            if (isSilentANR) {
+            if (isSilentAnr()) {
                 kill("bg anr", true);
                 return;
             }
@@ -1488,20 +1507,28 @@
             makeAppNotRespondingLocked(activityShortComponentName,
                     annotation != null ? "ANR " + annotation : "ANR", info.toString());
 
-            // Bring up the infamous App Not Responding dialog
-            Message msg = Message.obtain();
-            msg.what = ActivityManagerService.SHOW_NOT_RESPONDING_UI_MSG;
-            msg.obj = new AppNotRespondingDialog.Data(this, aInfo, aboveSystem);
+            // mUiHandler can be null if the AMS is constructed with injector only. This will only
+            // happen in tests.
+            if (mService.mUiHandler != null) {
+                // Bring up the infamous App Not Responding dialog
+                Message msg = Message.obtain();
+                msg.what = ActivityManagerService.SHOW_NOT_RESPONDING_UI_MSG;
+                msg.obj = new AppNotRespondingDialog.Data(this, aInfo, aboveSystem);
 
-            mService.mUiHandler.sendMessage(msg);
+                mService.mUiHandler.sendMessage(msg);
+            }
         }
     }
 
     private void makeAppNotRespondingLocked(String activity, String shortMsg, String longMsg) {
         setNotResponding(true);
-        notRespondingReport = mService.mAppErrors.generateProcessError(this,
-                ActivityManager.ProcessErrorStateInfo.NOT_RESPONDING,
-                activity, shortMsg, longMsg, null);
+        // mAppErrors can be null if the AMS is constructed with injector only. This will only
+        // happen in tests.
+        if (mService.mAppErrors != null) {
+            notRespondingReport = mService.mAppErrors.generateProcessError(this,
+                    ActivityManager.ProcessErrorStateInfo.NOT_RESPONDING,
+                    activity, shortMsg, longMsg, null);
+        }
         startAppProblemLocked();
         getWindowProcessController().stopFreezingActivities();
     }
@@ -1539,4 +1566,9 @@
                 (info != null && "com.android.systemui".equals(info.packageName))
                 || (hasTopUi() || hasOverlayUi());
     }
+
+    private boolean getShowBackground() {
+        return Settings.Secure.getInt(mService.mContext.getContentResolver(),
+                Settings.Secure.ANR_SHOW_BACKGROUND, 0) != 0;
+    }
 }
diff --git a/services/core/java/com/android/server/am/SettingsToPropertiesMapper.java b/services/core/java/com/android/server/am/SettingsToPropertiesMapper.java
index 894a704..194549f 100644
--- a/services/core/java/com/android/server/am/SettingsToPropertiesMapper.java
+++ b/services/core/java/com/android/server/am/SettingsToPropertiesMapper.java
@@ -16,6 +16,7 @@
 
 package com.android.server.am;
 
+import android.annotation.NonNull;
 import android.content.ContentResolver;
 import android.database.ContentObserver;
 import android.net.Uri;
@@ -78,11 +79,11 @@
     // permission in the corresponding .te file your feature belongs to.
     @VisibleForTesting
     static final String[] sDeviceConfigScopes = new String[] {
-        DeviceConfig.ActivityManagerNativeBoot.NAMESPACE,
-        DeviceConfig.MediaNative.NAMESPACE,
+        DeviceConfig.NAMESPACE_ACTIVITY_MANAGER_NATIVE_BOOT,
         DeviceConfig.NAMESPACE_INPUT_NATIVE_BOOT,
+        DeviceConfig.NAMESPACE_MEDIA_NATIVE,
         DeviceConfig.NAMESPACE_NETD_NATIVE,
-        DeviceConfig.RuntimeNativeBoot.NAMESPACE,
+        DeviceConfig.NAMESPACE_RUNTIME_NATIVE_BOOT,
         DeviceConfig.RuntimeNative.NAMESPACE,
     };
 
@@ -167,7 +168,7 @@
      * booting.
      * @return
      */
-    public static String[] getResetNativeCategories() {
+    public static @NonNull String[] getResetNativeCategories() {
         if (!isNativeFlagsResetPerformed()) {
             return new String[0];
         }
diff --git a/services/core/java/com/android/server/appop/AppOpsService.java b/services/core/java/com/android/server/appop/AppOpsService.java
index 70c28a8..ba7288e 100644
--- a/services/core/java/com/android/server/appop/AppOpsService.java
+++ b/services/core/java/com/android/server/appop/AppOpsService.java
@@ -16,6 +16,9 @@
 
 package com.android.server.appop;
 
+import static android.app.AppOpsManager.MAX_PRIORITY_UID_STATE;
+import static android.app.AppOpsManager.MIN_PRIORITY_UID_STATE;
+import static android.app.AppOpsManager.OP_FLAGS_ALL;
 import static android.app.AppOpsManager.OP_NONE;
 import static android.app.AppOpsManager.OP_PLAY_AUDIO;
 import static android.app.AppOpsManager.UID_STATE_BACKGROUND;
@@ -23,12 +26,12 @@
 import static android.app.AppOpsManager.UID_STATE_FOREGROUND;
 import static android.app.AppOpsManager.UID_STATE_FOREGROUND_SERVICE;
 import static android.app.AppOpsManager.UID_STATE_FOREGROUND_SERVICE_LOCATION;
-import static android.app.AppOpsManager.UID_STATE_LAST_NON_RESTRICTED;
+import static android.app.AppOpsManager.UID_STATE_MAX_LAST_NON_RESTRICTED;
 import static android.app.AppOpsManager.UID_STATE_PERSISTENT;
 import static android.app.AppOpsManager.UID_STATE_TOP;
-import static android.app.AppOpsManager._NUM_UID_STATE;
 import static android.app.AppOpsManager.modeToName;
 import static android.app.AppOpsManager.opToName;
+import static android.app.AppOpsManager.resolveFirstUnrestrictedUidState;
 
 import android.Manifest;
 import android.annotation.NonNull;
@@ -39,6 +42,9 @@
 import android.app.AppOpsManager;
 import android.app.AppOpsManager.HistoricalOps;
 import android.app.AppOpsManager.HistoricalOpsRequest;
+import android.app.AppOpsManager.Mode;
+import android.app.AppOpsManager.OpEntry;
+import android.app.AppOpsManager.OpFlags;
 import android.app.AppOpsManagerInternal;
 import android.app.AppOpsManagerInternal.CheckOpsDelegate;
 import android.content.BroadcastReceiver;
@@ -76,6 +82,8 @@
 import android.util.ArraySet;
 import android.util.AtomicFile;
 import android.util.KeyValueListParser;
+import android.util.LongSparseArray;
+import android.util.LongSparseLongArray;
 import android.util.Slog;
 import android.util.SparseArray;
 import android.util.SparseBooleanArray;
@@ -164,36 +172,6 @@
         UID_STATE_CACHED,               // ActivityManager.PROCESS_STATE_NONEXISTENT
     };
 
-    static final String[] UID_STATE_NAMES = new String[] {
-            "pers ",    // UID_STATE_PERSISTENT
-            "top  ",    // UID_STATE_TOP
-            "fgsvcl",   // UID_STATE_FOREGROUND_SERVICE_LOCATION
-            "fgsvc",    // UID_STATE_FOREGROUND_SERVICE
-            "fg   ",    // UID_STATE_FOREGROUND
-            "bg   ",    // UID_STATE_BACKGROUND
-            "cch  ",    // UID_STATE_CACHED
-    };
-
-    static final String[] UID_STATE_TIME_ATTRS = new String[] {
-            "tp",       // UID_STATE_PERSISTENT
-            "tt",       // UID_STATE_TOP
-            "tfsl",     // UID_STATE_FOREGROUND_SERVICE_LOCATION
-            "tfs",      // UID_STATE_FOREGROUND_SERVICE
-            "tf",       // UID_STATE_FOREGROUND
-            "tb",       // UID_STATE_BACKGROUND
-            "tc",       // UID_STATE_CACHED
-    };
-
-    static final String[] UID_STATE_REJECT_ATTRS = new String[] {
-            "rp",       // UID_STATE_PERSISTENT
-            "rt",       // UID_STATE_TOP
-            "rfsl",     // UID_STATE_FOREGROUND_SERVICE_LOCATION
-            "rfs",      // UID_STATE_FOREGROUND_SERVICE
-            "rf",       // UID_STATE_FOREGROUND
-            "rb",       // UID_STATE_BACKGROUND
-            "rc",       // UID_STATE_CACHED
-    };
-
     Context mContext;
     final AtomicFile mFile;
     final Handler mHandler;
@@ -355,12 +333,14 @@
 
         public boolean isDefault() {
             return (pkgOps == null || pkgOps.isEmpty())
-                    && (opModes == null || opModes.size() <= 0);
+                    && (opModes == null || opModes.size() <= 0)
+                    && (state == UID_STATE_CACHED
+                    && (pendingState == UID_STATE_CACHED));
         }
 
-        int evalMode(int mode) {
+        int evalMode(int op, int mode) {
             if (mode == AppOpsManager.MODE_FOREGROUND) {
-                return state <= UID_STATE_LAST_NON_RESTRICTED
+                return state <= AppOpsManager.resolveLastRestrictedUidState(op)
                         ? AppOpsManager.MODE_ALLOWED : AppOpsManager.MODE_IGNORED;
             }
             return mode;
@@ -425,41 +405,121 @@
     }
 
     final static class Op {
+        int op;
+        boolean running;
         final UidState uidState;
-        final int uid;
-        final String packageName;
-        final int op;
-        int proxyUid = -1;
-        String proxyPackageName;
-        int mode;
-        int duration;
-        long time[] = new long[_NUM_UID_STATE];
-        long rejectTime[] = new long[_NUM_UID_STATE];
+        final @NonNull String packageName;
+
+        private @Mode int mode;
+        private @Nullable LongSparseLongArray mAccessTimes;
+        private @Nullable LongSparseLongArray mRejectTimes;
+        private @Nullable LongSparseLongArray mDurations;
+        private @Nullable LongSparseLongArray mProxyUids;
+        private @Nullable LongSparseArray<String> mProxyPackageNames;
+
         int startNesting;
         long startRealtime;
 
-        Op(UidState _uidState, String _packageName, int _op) {
-            uidState = _uidState;
-            uid = _uidState.uid;
-            packageName = _packageName;
-            op = _op;
-            mode = AppOpsManager.opToDefaultMode(op);
-        }
-
-        boolean hasAnyTime() {
-            for (int i = 0; i < AppOpsManager._NUM_UID_STATE; i++) {
-                if (time[i] != 0) {
-                    return true;
-                }
-                if (rejectTime[i] != 0) {
-                    return true;
-                }
-            }
-            return false;
+        Op(UidState uidState, String packageName, int op) {
+            this.op = op;
+            this.uidState = uidState;
+            this.packageName = packageName;
+            this.mode = AppOpsManager.opToDefaultMode(op);
         }
 
         int getMode() {
-            return uidState.evalMode(mode);
+            return mode;
+        }
+
+        int evalMode() {
+            return uidState.evalMode(op, mode);
+        }
+
+        /** @hide */
+        public void accessed(long time, int proxyUid, @Nullable String proxyPackageName,
+            @AppOpsManager.UidState int uidState, @OpFlags int flags) {
+            final long key = AppOpsManager.makeKey(uidState, flags);
+            if (mAccessTimes == null) {
+                mAccessTimes = new LongSparseLongArray();
+            }
+            mAccessTimes.put(key, time);
+            updateProxyState(key, proxyUid, proxyPackageName);
+            if (mDurations != null) {
+                mDurations.delete(key);
+            }
+        }
+
+        /** @hide */
+        public void rejected(long time, int proxyUid, @Nullable String proxyPackageName,
+            @AppOpsManager.UidState int uidState, @OpFlags int flags) {
+            final long key = AppOpsManager.makeKey(uidState, flags);
+            if (mRejectTimes == null) {
+                mRejectTimes = new LongSparseLongArray();
+            }
+            mRejectTimes.put(key, time);
+            updateProxyState(key, proxyUid, proxyPackageName);
+            if (mDurations != null) {
+                mDurations.delete(key);
+            }
+        }
+
+        /** @hide */
+        public void started(long time, @AppOpsManager.UidState int uidState, @OpFlags int flags) {
+            updateAccessTimeAndDuration(time, -1 /*duration*/, uidState, flags);
+            running = true;
+        }
+
+        /** @hide */
+        public void finished(long time, long duration, @AppOpsManager.UidState int uidState,
+            @OpFlags int flags) {
+            updateAccessTimeAndDuration(time, duration, uidState, flags);
+            running = false;
+        }
+
+        /** @hide */
+        public void running(long time, long duration, @AppOpsManager.UidState int uidState,
+            @OpFlags int flags) {
+            updateAccessTimeAndDuration(time, duration, uidState, flags);
+        }
+
+        /** @hide */
+        public void continuing(long duration, @AppOpsManager.UidState int uidState,
+            @OpFlags int flags) {
+            final long key = AppOpsManager.makeKey(uidState, flags);
+            if (mDurations == null) {
+                mDurations = new LongSparseLongArray();
+            }
+            mDurations.put(key, duration);
+        }
+
+        private void updateAccessTimeAndDuration(long time, long duration,
+            @AppOpsManager.UidState int uidState, @OpFlags int flags) {
+            final long key = AppOpsManager.makeKey(uidState, flags);
+            if (mAccessTimes == null) {
+                mAccessTimes = new LongSparseLongArray();
+            }
+            mAccessTimes.put(key, time);
+            if (mDurations == null) {
+                mDurations = new LongSparseLongArray();
+            }
+            mDurations.put(key, duration);
+        }
+
+        private void updateProxyState(long key, int proxyUid,
+            @Nullable String proxyPackageName) {
+            if (mProxyUids == null) {
+                mProxyUids = new LongSparseLongArray();
+            }
+            mProxyUids.put(key, proxyUid);
+            if (mProxyPackageNames == null) {
+                mProxyPackageNames = new LongSparseArray<>();
+            }
+            mProxyPackageNames.put(key, proxyPackageName);
+        }
+
+        boolean hasAnyTime() {
+            return (mAccessTimes != null && mAccessTimes.size() > 0)
+                || (mRejectTimes != null && mRejectTimes.size() > 0);
         }
     }
 
@@ -812,7 +872,7 @@
                 final int opCount = client.mStartedOps.size();
                 for (int j = opCount - 1; j >= 0; j--) {
                     final Op op = client.mStartedOps.get(j);
-                    if (uid == op.uid && packageName.equals(op.packageName)) {
+                    if (uid == op.uidState.uid && packageName.equals(op.packageName)) {
                         finishOperationLocked(op, /*finishNested*/ true);
                         client.mStartedOps.remove(j);
                         if (op.startNesting <= 0) {
@@ -829,9 +889,9 @@
                 final int opCount = ops.size();
                 for (int i = 0; i < opCount; i++) {
                     final Op op = ops.valueAt(i);
-                    if (op.duration == -1) {
+                    if (op.running) {
                         scheduleOpActiveChangedIfNeededLocked(
-                                op.op, op.uid, op.packageName, false);
+                                op.op, op.uidState.uid, op.packageName, false);
                     }
                 }
             }
@@ -854,7 +914,7 @@
             if (uidState != null && uidState.pendingState != newState) {
                 final int oldPendingState = uidState.pendingState;
                 uidState.pendingState = newState;
-                if (newState < uidState.state || newState <= UID_STATE_LAST_NON_RESTRICTED) {
+                if (newState < uidState.state || newState <= UID_STATE_MAX_LAST_NON_RESTRICTED) {
                     // We are moving to a more important state, or the new state is in the
                     // foreground, then always do it immediately.
                     commitUidPendingStateLocked(uidState);
@@ -880,8 +940,18 @@
                         for (int j = ops.size() - 1; j >= 0; j--) {
                             final Op op = ops.valueAt(j);
                             if (op.startNesting > 0) {
-                                op.time[oldPendingState] = now;
-                                op.time[newState] = now;
+                                final long duration = SystemClock.elapsedRealtime()
+                                        - op.startRealtime;
+                                // We don't support proxy long running ops (start/stop)
+                                mHistoricalRegistry.increaseOpAccessDuration(op.op,
+                                        op.uidState.uid, op.packageName, oldPendingState,
+                                        AppOpsManager.OP_FLAG_SELF, duration);
+                                // Finish the op in the old state
+                                op.finished(now, duration, oldPendingState,
+                                        AppOpsManager.OP_FLAG_SELF);
+                                // Start the op in the new state
+                                op.startRealtime = now;
+                                op.started(now, newState, AppOpsManager.OP_FLAG_SELF);
                             }
                         }
                     }
@@ -911,13 +981,7 @@
             resOps = new ArrayList<>();
             for (int j=0; j<pkgOps.size(); j++) {
                 Op curOp = pkgOps.valueAt(j);
-                final boolean running = curOp.duration == -1;
-                long duration = running
-                        ? (elapsedNow - curOp.startRealtime)
-                        : curOp.duration;
-                resOps.add(new AppOpsManager.OpEntry(curOp.op, curOp.mode, curOp.time,
-                        curOp.rejectTime, (int) duration, running, curOp.proxyUid,
-                        curOp.proxyPackageName));
+                resOps.add(getOpEntryForResult(curOp, elapsedNow));
             }
         } else {
             for (int j=0; j<ops.length; j++) {
@@ -926,13 +990,7 @@
                     if (resOps == null) {
                         resOps = new ArrayList<>();
                     }
-                    final boolean running = curOp.duration == -1;
-                    final long duration = running
-                            ? (elapsedNow - curOp.startRealtime)
-                            : curOp.duration;
-                    resOps.add(new AppOpsManager.OpEntry(curOp.op, curOp.mode, curOp.time,
-                            curOp.rejectTime, (int) duration, running, curOp.proxyUid,
-                            curOp.proxyPackageName));
+                    resOps.add(getOpEntryForResult(curOp, elapsedNow));
                 }
             }
         }
@@ -947,8 +1005,7 @@
         if (ops == null) {
             resOps = new ArrayList<>();
             for (int j=0; j<uidOps.size(); j++) {
-                resOps.add(new AppOpsManager.OpEntry(uidOps.keyAt(j), uidOps.valueAt(j),
-                        0, 0, 0, -1, null));
+                resOps.add(new OpEntry(uidOps.keyAt(j), uidOps.valueAt(j)));
             }
         } else {
             for (int j=0; j<ops.length; j++) {
@@ -957,14 +1014,27 @@
                     if (resOps == null) {
                         resOps = new ArrayList<>();
                     }
-                    resOps.add(new AppOpsManager.OpEntry(uidOps.keyAt(index), uidOps.valueAt(index),
-                            0, 0, 0, -1, null));
+                    resOps.add(new OpEntry(uidOps.keyAt(j), uidOps.valueAt(j)));
                 }
             }
         }
         return resOps;
     }
 
+    private static @NonNull OpEntry getOpEntryForResult(@NonNull Op op, long elapsedNow) {
+        if (op.running) {
+            op.continuing(elapsedNow - op.startRealtime,
+                op.uidState.state, AppOpsManager.OP_FLAG_SELF);
+        }
+        final OpEntry entry = new OpEntry(op.op, op.running, op.mode,
+            op.mAccessTimes != null ? op.mAccessTimes.clone() : null,
+            op.mRejectTimes != null ? op.mRejectTimes.clone() : null,
+            op.mDurations != null ? op.mDurations.clone() : null,
+            op.mProxyUids != null ? op.mProxyUids.clone() : null,
+            op.mProxyPackageNames != null ? op.mProxyPackageNames.clone() : null);
+        return entry;
+    }
+
     @Override
     public List<AppOpsManager.PackageOps> getPackagesForOps(int[] ops) {
         mContext.enforcePermission(android.Manifest.permission.GET_APP_OPS_STATS,
@@ -1026,13 +1096,14 @@
     @Override
     public void getHistoricalOps(int uid, @NonNull String packageName,
             @Nullable List<String> opNames, long beginTimeMillis, long endTimeMillis,
-            @NonNull RemoteCallback callback) {
+            @OpFlags int flags, @NonNull RemoteCallback callback) {
         // Use the builder to validate arguments.
-        final HistoricalOpsRequest request = new HistoricalOpsRequest.Builder(
+        new HistoricalOpsRequest.Builder(
                 beginTimeMillis, endTimeMillis)
                 .setUid(uid)
                 .setPackageName(packageName)
                 .setOpNames(opNames)
+                .setFlags(flags)
                 .build();
         Preconditions.checkNotNull(callback, "callback cannot be null");
 
@@ -1041,79 +1112,23 @@
 
         final String[] opNamesArray = (opNames != null)
                 ? opNames.toArray(new String[opNames.size()]) : null;
-        if (mHistoricalRegistry.getMode() == AppOpsManager.HISTORICAL_MODE_DISABLED) {
-            // TODO (bug:122218838): Remove once the feature fully enabled.
-            getHistoricalPackagesOpsCompat(uid, packageName, opNamesArray, beginTimeMillis,
-                    endTimeMillis, callback);
-        } else {
-            // Must not hold the appops lock
-            mHistoricalRegistry.getHistoricalOps(uid, packageName, opNamesArray,
-                    beginTimeMillis, endTimeMillis, callback);
-        }
-    }
 
-    private void getHistoricalPackagesOpsCompat(int uid, @NonNull String packageName,
-            @Nullable String[] opNames, long beginTimeMillis, long endTimeMillis,
-            @NonNull RemoteCallback callback) {
-        synchronized (AppOpsService.this) {
-            final HistoricalOps ops = new HistoricalOps(beginTimeMillis, endTimeMillis);
-            if (opNames == null) {
-                opNames = AppOpsManager.getOpStrs();
-            }
-            final int uidStateCount = mUidStates.size();
-            for (int uidIdx = 0; uidIdx < uidStateCount; uidIdx++) {
-                final UidState uidState = mUidStates.valueAt(uidIdx);
-                if (uidState.pkgOps == null || uidState.pkgOps.isEmpty()
-                        || (uid != Process.INVALID_UID && uid != uidState.uid)) {
-                    continue;
-                }
-                final ArrayMap<String, Ops> packages = uidState.pkgOps;
-                final int packageCount = packages.size();
-                for (int pkgIdx = 0; pkgIdx < packageCount; pkgIdx++) {
-                    final Ops pkgOps = packages.valueAt(pkgIdx);
-                    if (packageName != null && !packageName.equals(pkgOps.packageName)) {
-                        continue;
-                    }
-                    final int opCount = opNames.length;
-                    for (int opIdx = 0; opIdx < opCount; opIdx++) {
-                        final String opName = opNames[opIdx];
-                        if (!ArrayUtils.contains(opNames, opName)) {
-                            continue;
-                        }
-                        final int opCode = AppOpsManager.strOpToOp(opName);
-                        final Op op = pkgOps.get(opCode);
-                        if (op == null) {
-                            continue;
-                        }
-                        final int stateCount = AppOpsManager._NUM_UID_STATE;
-                        for (int stateIdx = 0; stateIdx < stateCount; stateIdx++) {
-                            if (op.rejectTime[stateIdx] != 0) {
-                                ops.increaseRejectCount(opCode, uidState.uid,
-                                        pkgOps.packageName, stateIdx, 1);
-                            } else if (op.time[stateIdx] != 0) {
-                                ops.increaseAccessCount(opCode, uidState.uid,
-                                        pkgOps.packageName, stateIdx, 1);
-                            }
-                        }
-                    }
-                }
-            }
-            final Bundle payload = new Bundle();
-            payload.putParcelable(AppOpsManager.KEY_HISTORICAL_OPS, ops);
-            callback.sendResult(payload);
-        }
+        // Must not hold the appops lock
+        mHistoricalRegistry.getHistoricalOps(uid, packageName, opNamesArray,
+                beginTimeMillis, endTimeMillis, flags, callback);
     }
 
     @Override
     public void getHistoricalOpsFromDiskRaw(int uid, @NonNull String packageName,
             @Nullable List<String> opNames, long beginTimeMillis, long endTimeMillis,
-            @NonNull RemoteCallback callback) {
+            @OpFlags int flags, @NonNull RemoteCallback callback) {
         // Use the builder to validate arguments.
-        final HistoricalOpsRequest request = new HistoricalOpsRequest.Builder(
+        new HistoricalOpsRequest.Builder(
                 beginTimeMillis, endTimeMillis)
                 .setUid(uid)
                 .setPackageName(packageName)
                 .setOpNames(opNames)
+                .setFlags(flags)
                 .build();
         Preconditions.checkNotNull(callback, "callback cannot be null");
 
@@ -1125,7 +1140,7 @@
 
         // Must not hold the appops lock
         mHistoricalRegistry.getHistoricalOpsFromDiskRaw(uid, packageName, opNamesArray,
-                beginTimeMillis, endTimeMillis, callback);
+                beginTimeMillis, endTimeMillis, flags, callback);
     }
 
     @Override
@@ -1172,7 +1187,7 @@
         }
     }
 
-    void enforceManageAppOpsModes(int callingPid, int callingUid, int targetUid) {
+    private void enforceManageAppOpsModes(int callingPid, int callingUid, int targetUid) {
         if (callingPid == Process.myPid()) {
             return;
         }
@@ -1316,6 +1331,8 @@
                 return;
             }
 
+            boolean scheduleWrite = false;
+
             int numPkgs = pkgOps.size();
             for (int pkgNum = 0; pkgNum < numPkgs; pkgNum++) {
                 Ops ops = pkgOps.valueAt(pkgNum);
@@ -1327,14 +1344,14 @@
 
                 int defaultMode = AppOpsManager.opToDefaultMode(code);
                 if (op.mode != defaultMode) {
-                    Slog.w(TAG, "resetting app-op mode for " + AppOpsManager.opToName(code) + " of "
-                            + pkgOps.keyAt(pkgNum));
-
                     op.mode = defaultMode;
-
-                    scheduleWriteLocked();
+                    scheduleWrite = true;
                 }
             }
+
+            if (scheduleWrite) {
+                scheduleWriteLocked();
+            }
         }
     }
 
@@ -1544,9 +1561,10 @@
                             curOp.mode = AppOpsManager.opToDefaultMode(curOp.op);
                             changed = true;
                             uidChanged = true;
-                            callbacks = addCallbacks(callbacks, curOp.op, curOp.uid, packageName,
+                            final int uid = curOp.uidState.uid;
+                            callbacks = addCallbacks(callbacks, curOp.op, uid, packageName,
                                     mOpModeWatchers.get(curOp.op));
-                            callbacks = addCallbacks(callbacks, curOp.op, curOp.uid, packageName,
+                            callbacks = addCallbacks(callbacks, curOp.op, uid, packageName,
                                     mPackageModeWatchers.get(packageName));
                             if (!curOp.hasAnyTime()) {
                                 pkgOps.removeAt(j);
@@ -1727,6 +1745,7 @@
     private int checkOperationUnchecked(int code, int uid, String packageName,
                 boolean raw) {
         synchronized (this) {
+            checkPackage(uid, packageName);
             if (isOpRestrictedLocked(uid, code, packageName)) {
                 return AppOpsManager.MODE_IGNORED;
             }
@@ -1735,13 +1754,13 @@
             if (uidState != null && uidState.opModes != null
                     && uidState.opModes.indexOfKey(code) >= 0) {
                 final int rawMode = uidState.opModes.get(code);
-                return raw ? rawMode : uidState.evalMode(rawMode);
+                return raw ? rawMode : uidState.evalMode(code, rawMode);
             }
             Op op = getOpLocked(code, uid, packageName, false, true, false);
             if (op == null) {
                 return AppOpsManager.opToDefaultMode(code);
             }
-            return op.mode;
+            return raw ? op.mode : op.evalMode();
         }
     }
 
@@ -1855,21 +1874,32 @@
             String proxyPackageName, int proxiedUid, String proxiedPackageName) {
         verifyIncomingUid(proxyUid);
         verifyIncomingOp(code);
+
         String resolveProxyPackageName = resolvePackageName(proxyUid, proxyPackageName);
         if (resolveProxyPackageName == null) {
             return AppOpsManager.MODE_IGNORED;
         }
+
+        final boolean isProxyTrusted = mContext.checkPermission(
+                Manifest.permission.UPDATE_APP_OPS_STATS, -1, proxyUid)
+                == PackageManager.PERMISSION_GRANTED;
+
+        final int proxyFlags = isProxyTrusted ? AppOpsManager.OP_FLAG_TRUSTED_PROXY
+                : AppOpsManager.OP_FLAG_UNTRUSTED_PROXY;
         final int proxyMode = noteOperationUnchecked(code, proxyUid,
-                resolveProxyPackageName, -1, null);
+                resolveProxyPackageName, Process.INVALID_UID, null, proxyFlags);
         if (proxyMode != AppOpsManager.MODE_ALLOWED || Binder.getCallingUid() == proxiedUid) {
             return proxyMode;
         }
+
         String resolveProxiedPackageName = resolvePackageName(proxiedUid, proxiedPackageName);
         if (resolveProxiedPackageName == null) {
             return AppOpsManager.MODE_IGNORED;
         }
+        final int proxiedFlags = isProxyTrusted ? AppOpsManager.OP_FLAG_TRUSTED_PROXIED
+                : AppOpsManager.OP_FLAG_UNTRUSTED_PROXIED;
         return noteOperationUnchecked(code, proxiedUid, resolveProxiedPackageName,
-                proxyMode, resolveProxyPackageName);
+                proxyUid, resolveProxyPackageName, proxiedFlags);
     }
 
     @Override
@@ -1892,11 +1922,12 @@
         if (resolvedPackageName == null) {
             return AppOpsManager.MODE_IGNORED;
         }
-        return noteOperationUnchecked(code, uid, resolvedPackageName, 0, null);
+        return noteOperationUnchecked(code, uid, resolvedPackageName, Process.INVALID_UID, null,
+                AppOpsManager.OP_FLAG_SELF);
     }
 
     private int noteOperationUnchecked(int code, int uid, String packageName,
-            int proxyUid, String proxyPackageName) {
+            int proxyUid, String proxyPackageName, @OpFlags int flags) {
         synchronized (this) {
             final Ops ops = getOpsRawLocked(uid, packageName, true /* edit */,
                     false /* uidMismatchExpected */);
@@ -1914,49 +1945,52 @@
                 return AppOpsManager.MODE_IGNORED;
             }
             final UidState uidState = ops.uidState;
-            if (op.duration == -1) {
+            if (op.running) {
+                final OpEntry entry = new OpEntry(op.op, op.running, op.mode, op.mAccessTimes,
+                    op.mRejectTimes, op.mDurations, op.mProxyUids, op.mProxyPackageNames);
                 Slog.w(TAG, "Noting op not finished: uid " + uid + " pkg " + packageName
-                        + " code " + code + " time=" + op.time[uidState.state]
-                        + " duration=" + op.duration);
+                        + " code " + code + " time=" + entry.getLastAccessTime(uidState.state,
+                        uidState.state, flags) + " duration=" + entry.getLastDuration(
+                                uidState.state, uidState.state, flags));
             }
-            op.duration = 0;
+
             final int switchCode = AppOpsManager.opToSwitch(code);
             // If there is a non-default per UID policy (we set UID op mode only if
             // non-default) it takes over, otherwise use the per package policy.
             if (uidState.opModes != null && uidState.opModes.indexOfKey(switchCode) >= 0) {
-                final int uidMode = uidState.evalMode(uidState.opModes.get(switchCode));
+                final int uidMode = uidState.evalMode(code, uidState.opModes.get(switchCode));
                 if (uidMode != AppOpsManager.MODE_ALLOWED) {
                     if (DEBUG) Slog.d(TAG, "noteOperation: uid reject #" + uidMode + " for code "
                             + switchCode + " (" + code + ") uid " + uid + " package "
                             + packageName);
-                    op.rejectTime[uidState.state] = System.currentTimeMillis();
+                    op.rejected(System.currentTimeMillis(), proxyUid, proxyPackageName,
+                            uidState.state, flags);
+                    mHistoricalRegistry.incrementOpRejected(code, uid, packageName,
+                            uidState.state, flags);
                     scheduleOpNotedIfNeededLocked(code, uid, packageName, uidMode);
-                    mHistoricalRegistry.incrementOpRejected(op.op, uid, packageName,
-                            uidState.state);
                     return uidMode;
                 }
             } else {
                 final Op switchOp = switchCode != code ? getOpLocked(ops, switchCode, true) : op;
-                final int mode = switchOp.getMode();
-                if (mode != AppOpsManager.MODE_ALLOWED) {
+                final int mode = switchOp.evalMode();
+                if (switchOp.mode != AppOpsManager.MODE_ALLOWED) {
                     if (DEBUG) Slog.d(TAG, "noteOperation: reject #" + mode + " for code "
                             + switchCode + " (" + code + ") uid " + uid + " package "
                             + packageName);
-                    op.rejectTime[uidState.state] = System.currentTimeMillis();
-                    scheduleOpNotedIfNeededLocked(op.op, uid, packageName, mode);
-                    mHistoricalRegistry.incrementOpRejected(op.op, uid, packageName,
-                            uidState.state);
+                    op.rejected(System.currentTimeMillis(), proxyUid, proxyPackageName,
+                            uidState.state, flags);
+                    mHistoricalRegistry.incrementOpRejected(code, uid, packageName,
+                            uidState.state, flags);
+                    scheduleOpNotedIfNeededLocked(code, uid, packageName, mode);
                     return mode;
                 }
             }
             if (DEBUG) Slog.d(TAG, "noteOperation: allowing code " + code + " uid " + uid
                     + " package " + packageName);
-            op.time[uidState.state] = System.currentTimeMillis();
+            op.accessed(System.currentTimeMillis(), proxyUid, proxyPackageName,
+                    uidState.state, flags);
             mHistoricalRegistry.incrementOpAccessedCount(op.op, uid, packageName,
-                    uidState.state);
-            op.rejectTime[uidState.state] = 0;
-            op.proxyUid = proxyUid;
-            op.proxyPackageName = proxyPackageName;
+                    uidState.state, flags);
             scheduleOpNotedIfNeededLocked(code, uid, packageName,
                     AppOpsManager.MODE_ALLOWED);
             return AppOpsManager.MODE_ALLOWED;
@@ -2080,29 +2114,34 @@
             final UidState uidState = ops.uidState;
             // If there is a non-default per UID policy (we set UID op mode only if
             // non-default) it takes over, otherwise use the per package policy.
+            final int opCode = op.op;
             if (uidState.opModes != null && uidState.opModes.indexOfKey(switchCode) >= 0) {
-                final int uidMode = uidState.evalMode(uidState.opModes.get(switchCode));
+                final int uidMode = uidState.evalMode(code, uidState.opModes.get(switchCode));
                 if (uidMode != AppOpsManager.MODE_ALLOWED
                         && (!startIfModeDefault || uidMode != AppOpsManager.MODE_DEFAULT)) {
                     if (DEBUG) Slog.d(TAG, "noteOperation: uid reject #" + uidMode + " for code "
                             + switchCode + " (" + code + ") uid " + uid + " package "
                             + resolvedPackageName);
-                    op.rejectTime[uidState.state] = System.currentTimeMillis();
-                    mHistoricalRegistry.incrementOpRejected(op.op, uid, packageName,
-                            uidState.state);
+                    // We don't support proxy long running ops (start/stop)
+                    op.rejected(System.currentTimeMillis(), -1 /*proxyUid*/,
+                            null /*proxyPackage*/, uidState.state, AppOpsManager.OP_FLAG_SELF);
+                    mHistoricalRegistry.incrementOpRejected(opCode, uid, packageName,
+                            uidState.state, AppOpsManager.OP_FLAG_SELF);
                     return uidMode;
                 }
             } else {
                 final Op switchOp = switchCode != code ? getOpLocked(ops, switchCode, true) : op;
-                final int mode = switchOp.getMode();
+                final int mode = switchOp.evalMode();
                 if (mode != AppOpsManager.MODE_ALLOWED
                         && (!startIfModeDefault || mode != AppOpsManager.MODE_DEFAULT)) {
                     if (DEBUG) Slog.d(TAG, "startOperation: reject #" + mode + " for code "
                             + switchCode + " (" + code + ") uid " + uid + " package "
                             + resolvedPackageName);
-                    op.rejectTime[uidState.state] = System.currentTimeMillis();
-                    mHistoricalRegistry.incrementOpRejected(op.op, uid, packageName,
-                            uidState.state);
+                    // We don't support proxy long running ops (start/stop)
+                    op.rejected(System.currentTimeMillis(), -1 /*proxyUid*/,
+                            null /*proxyPackage*/, uidState.state, AppOpsManager.OP_FLAG_SELF);
+                    mHistoricalRegistry.incrementOpRejected(opCode, uid, packageName,
+                            uidState.state, AppOpsManager.OP_FLAG_SELF);
                     return mode;
                 }
             }
@@ -2110,11 +2149,12 @@
                     + " package " + resolvedPackageName);
             if (op.startNesting == 0) {
                 op.startRealtime = SystemClock.elapsedRealtime();
-                op.time[uidState.state] = System.currentTimeMillis();
-                mHistoricalRegistry.incrementOpAccessedCount(op.op, uid, packageName,
-                        uidState.state);
-                op.rejectTime[uidState.state] = 0;
-                op.duration = -1;
+                // We don't support proxy long running ops (start/stop)
+                op.started(System.currentTimeMillis(), uidState.state,
+                        AppOpsManager.OP_FLAG_SELF);
+                mHistoricalRegistry.incrementOpAccessedCount(opCode, uid, packageName,
+                        uidState.state, AppOpsManager.OP_FLAG_SELF);
+
                 scheduleOpActiveChangedIfNeededLocked(code, uid, packageName, true);
             }
             op.startNesting++;
@@ -2161,7 +2201,7 @@
                 } finally {
                     Binder.restoreCallingIdentity(identity);
                 }
-                Slog.wtf(TAG, "Operation not started: uid=" + op.uid + " pkg="
+                Slog.wtf(TAG, "Operation not started: uid=" + op.uidState.uid + " pkg="
                         + op.packageName + " op=" + AppOpsManager.opToName(op.op));
                 return;
             }
@@ -2272,16 +2312,24 @@
     }
 
     void finishOperationLocked(Op op, boolean finishNested) {
+        final int opCode = op.op;
+        final int uid = op.uidState.uid;
         if (op.startNesting <= 1 || finishNested) {
             if (op.startNesting == 1 || finishNested) {
-                op.duration = (int)(SystemClock.elapsedRealtime() - op.startRealtime);
-                mHistoricalRegistry.increaseOpAccessDuration(op.op, op.uid, op.packageName,
-                        op.uidState.state, op.duration);
-                op.time[op.uidState.state] = System.currentTimeMillis();
+                // We don't support proxy long running ops (start/stop)
+                final long duration = SystemClock.elapsedRealtime() - op.startRealtime;
+                op.finished(System.currentTimeMillis(), duration, op.uidState.state,
+                        AppOpsManager.OP_FLAG_SELF);
+                mHistoricalRegistry.increaseOpAccessDuration(opCode, uid, op.packageName,
+                        op.uidState.state, AppOpsManager.OP_FLAG_SELF, duration);
             } else {
-                Slog.w(TAG, "Finishing op nesting under-run: uid " + op.uid + " pkg "
-                        + op.packageName + " code " + op.op + " time=" + op.time
-                        + " duration=" + op.duration + " nesting=" + op.startNesting);
+                final OpEntry entry = new OpEntry(op.op, op.running, op.mode, op.mAccessTimes,
+                    op.mRejectTimes, op.mDurations, op.mProxyUids, op.mProxyPackageNames);
+                Slog.w(TAG, "Finishing op nesting under-run: uid " + uid + " pkg "
+                        + op.packageName + " code " + opCode + " time="
+                        + entry.getLastAccessTime(OP_FLAGS_ALL)
+                        + " duration=" + entry.getLastDuration(MAX_PRIORITY_UID_STATE,
+                        MIN_PRIORITY_UID_STATE, OP_FLAGS_ALL) + " nesting=" + op.startNesting);
             }
             if (op.startNesting >= 1) {
                 op.uidState.startNesting -= op.startNesting;
@@ -2311,7 +2359,7 @@
         throw new IllegalArgumentException("Bad operation #" + op);
     }
 
-    private UidState getUidStateLocked(int uid, boolean edit) {
+    private @NonNull UidState getUidStateLocked(int uid, boolean edit) {
         UidState uidState = mUidStates.get(uid);
         if (uidState == null) {
             if (!edit) {
@@ -2335,8 +2383,8 @@
     }
 
     private void commitUidPendingStateLocked(UidState uidState) {
-        final boolean lastForeground = uidState.state <= UID_STATE_LAST_NON_RESTRICTED;
-        final boolean nowForeground = uidState.pendingState <= UID_STATE_LAST_NON_RESTRICTED;
+        final boolean lastForeground = uidState.state <= UID_STATE_MAX_LAST_NON_RESTRICTED;
+        final boolean nowForeground = uidState.pendingState <= UID_STATE_MAX_LAST_NON_RESTRICTED;
         uidState.state = uidState.pendingState;
         uidState.pendingStateCommitTime = 0;
         if (uidState.hasForegroundWatchers && lastForeground != nowForeground) {
@@ -2345,7 +2393,15 @@
                     continue;
                 }
                 final int code = uidState.foregroundOps.keyAt(fgi);
-
+                // For location ops we consider fg state only if the fg service
+                // is of location type, for all other ops any fg service will do.
+                final long resolvedLastRestrictedUidState = resolveFirstUnrestrictedUidState(code);
+                final boolean resolvedLastFg = uidState.state <= resolvedLastRestrictedUidState;
+                final boolean resolvedNowBg = uidState.pendingState
+                        <= resolvedLastRestrictedUidState;
+                if (resolvedLastFg == resolvedNowBg) {
+                    continue;
+                }
                 final ArraySet<ModeCallback> callbacks = mOpModeWatchers.get(code);
                 if (callbacks != null) {
                     for (int cbi = callbacks.size() - 1; cbi >= 0; cbi--) {
@@ -2360,8 +2416,10 @@
                         if (uidState.pkgOps != null) {
                             for (int pkgi = uidState.pkgOps.size() - 1; pkgi >= 0; pkgi--) {
                                 final Op op = uidState.pkgOps.valueAt(pkgi).get(code);
-                                if (doAllPackages || (op != null
-                                        && op.mode == AppOpsManager.MODE_FOREGROUND)) {
+                                if (op == null) {
+                                    continue;
+                                }
+                                if (doAllPackages || op.mode == AppOpsManager.MODE_FOREGROUND) {
                                     mHandler.sendMessage(PooledLambda.obtainMessage(
                                             AppOpsService::notifyOpChanged,
                                             this, callback, code, uidState.uid,
@@ -2651,7 +2709,7 @@
                 final int idx = uidState.opModes.indexOfKey(AppOpsManager.OP_RUN_IN_BACKGROUND);
                 if (idx >= 0) {
                     uidState.opModes.put(AppOpsManager.OP_RUN_ANY_IN_BACKGROUND,
-                            uidState.opModes.valueAt(idx));
+                        uidState.opModes.valueAt(idx));
                 }
             }
             if (uidState.pkgOps == null) {
@@ -2664,7 +2722,7 @@
                     final Op op = ops.get(AppOpsManager.OP_RUN_IN_BACKGROUND);
                     if (op != null && op.mode != AppOpsManager.opToDefaultMode(op.op)) {
                         final Op copy = new Op(op.uidState, op.packageName,
-                                AppOpsManager.OP_RUN_ANY_IN_BACKGROUND);
+                            AppOpsManager.OP_RUN_ANY_IN_BACKGROUND);
                         copy.mode = op.mode;
                         ops.put(AppOpsManager.OP_RUN_ANY_IN_BACKGROUND, copy);
                         changed = true;
@@ -2692,7 +2750,7 @@
         scheduleFastWriteLocked();
     }
 
-    void readUidOps(XmlPullParser parser) throws NumberFormatException,
+    private void readUidOps(XmlPullParser parser) throws NumberFormatException,
             XmlPullParserException, IOException {
         final int uid = Integer.parseInt(parser.getAttributeValue(null, "n"));
         int outerDepth = parser.getDepth();
@@ -2720,8 +2778,8 @@
         }
     }
 
-    void readPackage(XmlPullParser parser) throws NumberFormatException,
-            XmlPullParserException, IOException {
+    private void readPackage(XmlPullParser parser)
+            throws NumberFormatException, XmlPullParserException, IOException {
         String pkgName = parser.getAttributeValue(null, "n");
         int outerDepth = parser.getDepth();
         int type;
@@ -2742,9 +2800,10 @@
         }
     }
 
-    void readUid(XmlPullParser parser, String pkgName) throws NumberFormatException,
-            XmlPullParserException, IOException {
+    private void readUid(XmlPullParser parser, String pkgName)
+            throws NumberFormatException, XmlPullParserException, IOException {
         int uid = Integer.parseInt(parser.getAttributeValue(null, "n"));
+        final UidState uidState = getUidStateLocked(uid, true);
         String isPrivilegedString = parser.getAttributeValue(null, "p");
         boolean isPrivileged = false;
         if (isPrivilegedString == null) {
@@ -2774,113 +2833,73 @@
             if (type == XmlPullParser.END_TAG || type == XmlPullParser.TEXT) {
                 continue;
             }
-
             String tagName = parser.getName();
             if (tagName.equals("op")) {
-                UidState uidState = getUidStateLocked(uid, true);
-                if (uidState.pkgOps == null) {
-                    uidState.pkgOps = new ArrayMap<>();
-                }
-
-                Op op = new Op(uidState, pkgName,
-                        Integer.parseInt(parser.getAttributeValue(null, "n")));
-
-                for (int i = parser.getAttributeCount()-1; i >= 0; i--) {
-                    final String name = parser.getAttributeName(i);
-                    final String value = parser.getAttributeValue(i);
-                    switch (name) {
-                        case "m":
-                            op.mode = Integer.parseInt(value);
-                            break;
-                        case "d":
-                            op.duration = Integer.parseInt(value);
-                            break;
-                        case "pu":
-                            op.proxyUid = Integer.parseInt(value);
-                            break;
-                        case "pp":
-                            op.proxyPackageName = value;
-                            break;
-                        case "tp":
-                            op.time[AppOpsManager.UID_STATE_PERSISTENT] = Long.parseLong(value);
-                            break;
-                        case "tt":
-                            op.time[AppOpsManager.UID_STATE_TOP] = Long.parseLong(value);
-                            break;
-                        case "tfsl":
-                            op.time[AppOpsManager.UID_STATE_FOREGROUND_SERVICE_LOCATION] =
-                                    Long.parseLong(value);
-                            break;
-                        case "tfs":
-                            op.time[AppOpsManager.UID_STATE_FOREGROUND_SERVICE] =
-                                    Long.parseLong(value);
-                            break;
-                        case "tf":
-                            op.time[AppOpsManager.UID_STATE_FOREGROUND] = Long.parseLong(value);
-                            break;
-                        case "tb":
-                            op.time[AppOpsManager.UID_STATE_BACKGROUND] = Long.parseLong(value);
-                            break;
-                        case "tc":
-                            op.time[AppOpsManager.UID_STATE_CACHED] = Long.parseLong(value);
-                            break;
-                        case "rp":
-                            op.rejectTime[AppOpsManager.UID_STATE_PERSISTENT] =
-                                    Long.parseLong(value);
-                            break;
-                        case "rt":
-                            op.rejectTime[AppOpsManager.UID_STATE_TOP] = Long.parseLong(value);
-                            break;
-                        case "rfsl":
-                            op.rejectTime[AppOpsManager.UID_STATE_FOREGROUND_SERVICE_LOCATION] =
-                                    Long.parseLong(value);
-                            break;
-                        case "rfs":
-                            op.rejectTime[AppOpsManager.UID_STATE_FOREGROUND_SERVICE] =
-                                    Long.parseLong(value);
-                            break;
-                        case "rf":
-                            op.rejectTime[AppOpsManager.UID_STATE_FOREGROUND] =
-                                    Long.parseLong(value);
-                            break;
-                        case "rb":
-                            op.rejectTime[AppOpsManager.UID_STATE_BACKGROUND] =
-                                    Long.parseLong(value);
-                            break;
-                        case "rc":
-                            op.rejectTime[AppOpsManager.UID_STATE_CACHED] =
-                                    Long.parseLong(value);
-                            break;
-                        case "t":
-                            // Backwards compat.
-                            op.time[AppOpsManager.UID_STATE_TOP] = Long.parseLong(value);
-                            break;
-                        case "r":
-                            // Backwards compat.
-                            op.rejectTime[AppOpsManager.UID_STATE_TOP] = Long.parseLong(value);
-                            break;
-                        default:
-                            Slog.w(TAG, "Unknown attribute in 'op' tag: " + name);
-                            break;
-                    }
-                }
-
-                Ops ops = uidState.pkgOps.get(pkgName);
-                if (ops == null) {
-                    ops = new Ops(pkgName, uidState, isPrivileged);
-                    uidState.pkgOps.put(pkgName, ops);
-                }
-                ops.put(op.op, op);
+                readOp(parser, uidState, pkgName, isPrivileged);
             } else {
                 Slog.w(TAG, "Unknown element under <pkg>: "
                         + parser.getName());
                 XmlUtils.skipCurrentTag(parser);
             }
         }
-        UidState uidState = getUidStateLocked(uid, false);
-        if (uidState != null) {
-            uidState.evalForegroundOps(mOpModeWatchers);
+        uidState.evalForegroundOps(mOpModeWatchers);
+    }
+
+    private void readOp(XmlPullParser parser, @NonNull UidState uidState,
+            @NonNull String pkgName, boolean isPrivileged) throws NumberFormatException,
+            XmlPullParserException, IOException {
+        Op op = new Op(uidState, pkgName,
+                Integer.parseInt(parser.getAttributeValue(null, "n")));
+
+        final int mode = XmlUtils.readIntAttribute(parser, "m",
+                AppOpsManager.opToDefaultMode(op.op));
+        op.mode = mode;
+
+        int outerDepth = parser.getDepth();
+        int type;
+        while ((type = parser.next()) != XmlPullParser.END_DOCUMENT
+                && (type != XmlPullParser.END_TAG || parser.getDepth() > outerDepth)) {
+            if (type == XmlPullParser.END_TAG || type == XmlPullParser.TEXT) {
+                continue;
+            }
+            String tagName = parser.getName();
+            if (tagName.equals("st")) {
+                final long key = XmlUtils.readLongAttribute(parser, "n");
+
+                final int flags = AppOpsManager.extractFlagsFromKey(key);
+                final int state = AppOpsManager.extractUidStateFromKey(key);
+
+                final long accessTime = XmlUtils.readLongAttribute(parser, "t", 0);
+                final long rejectTime = XmlUtils.readLongAttribute(parser, "r", 0);
+                final long accessDuration = XmlUtils.readLongAttribute(parser, "d", 0);
+                final String proxyPkg = XmlUtils.readStringAttribute(parser, "pp");
+                final int proxyUid = XmlUtils.readIntAttribute(parser, "pu", 0);
+
+                if (accessTime > 0) {
+                    op.accessed(accessTime, proxyUid, proxyPkg, state, flags);
+                }
+                if (rejectTime > 0) {
+                    op.rejected(rejectTime, proxyUid, proxyPkg, state, flags);
+                }
+                if (accessDuration > 0) {
+                    op.running(accessTime, accessDuration, state, flags);
+                }
+            } else {
+                Slog.w(TAG, "Unknown element under <op>: "
+                        + parser.getName());
+                XmlUtils.skipCurrentTag(parser);
+            }
         }
+
+        if (uidState.pkgOps == null) {
+            uidState.pkgOps = new ArrayMap<>();
+        }
+        Ops ops = uidState.pkgOps.get(pkgName);
+        if (ops == null) {
+            ops = new Ops(pkgName, uidState, isPrivileged);
+            uidState.pkgOps.put(pkgName, ops);
+        }
+        ops.put(op.op, op);
     }
 
     void writeState() {
@@ -2955,30 +2974,53 @@
                             if (op.getMode() != AppOpsManager.opToDefaultMode(op.getOp())) {
                                 out.attribute(null, "m", Integer.toString(op.getMode()));
                             }
-                            for (int k = 0; k < _NUM_UID_STATE; k++) {
-                                final long time = op.getLastTimeFor(k);
-                                if (time != 0) {
-                                    out.attribute(null, UID_STATE_TIME_ATTRS[k],
-                                            Long.toString(time));
+
+                            final LongSparseArray keys = op.collectKeys();
+                            if (keys == null || keys.size() <= 0) {
+                                continue;
+                            }
+
+                            final int keyCount = keys.size();
+                            for (int k = 0; k < keyCount; k++) {
+                                final long key = keys.keyAt(k);
+
+                                final int uidState = AppOpsManager.extractUidStateFromKey(key);
+                                final int flags = AppOpsManager.extractFlagsFromKey(key);
+
+                                final long accessTime = op.getLastAccessTime(
+                                        uidState, uidState, flags);
+                                final long rejectTime = op.getLastRejectTime(
+                                        uidState, uidState, flags);
+                                final long accessDuration = op.getLastDuration(
+                                        uidState, uidState, flags);
+                                final String proxyPkg = op.getProxyPackageName(uidState, flags);
+                                final int proxyUid = op.getProxyUid(uidState, flags);
+
+                                if (accessTime <= 0 && rejectTime <= 0 && accessDuration <= 0
+                                        && proxyPkg == null && proxyUid < 0) {
+                                    continue;
                                 }
-                                final long rejectTime = op.getLastRejectTimeFor(k);
-                                if (rejectTime != 0) {
-                                    out.attribute(null, UID_STATE_REJECT_ATTRS[k],
-                                            Long.toString(rejectTime));
+
+                                out.startTag(null, "st");
+                                out.attribute(null, "n", Long.toString(key));
+                                if (accessTime > 0) {
+                                    out.attribute(null, "t", Long.toString(accessTime));
                                 }
+                                if (rejectTime > 0) {
+                                    out.attribute(null, "r", Long.toString(rejectTime));
+                                }
+                                if (accessDuration > 0) {
+                                    out.attribute(null, "d", Long.toString(accessDuration));
+                                }
+                                if (proxyPkg != null) {
+                                    out.attribute(null, "pp", proxyPkg);
+                                }
+                                if (proxyUid >= 0) {
+                                    out.attribute(null, "pu", Integer.toString(proxyUid));
+                                }
+                                out.endTag(null, "st");
                             }
-                            int dur = op.getDuration();
-                            if (dur != 0) {
-                                out.attribute(null, "d", Integer.toString(dur));
-                            }
-                            int proxyUid = op.getProxyUid();
-                            if (proxyUid != -1) {
-                                out.attribute(null, "pu", Integer.toString(proxyUid));
-                            }
-                            String proxyPackageName = op.getProxyPackageName();
-                            if (proxyPackageName != null) {
-                                out.attribute(null, "pp", proxyPackageName);
-                            }
+
                             out.endTag(null, "op");
                         }
                         out.endTag(null, "uid");
@@ -3462,32 +3504,80 @@
         pw.println("    Limit output to data associated with the given package name.");
         pw.println("  --watchers");
         pw.println("    Only output the watcher sections.");
+        pw.println("  --history");
+        pw.println("    Output the historical data.");
     }
 
-    private void dumpTimesLocked(PrintWriter pw, String firstPrefix, String prefix, long[] times,
-            long now, SimpleDateFormat sdf, Date date) {
-        boolean hasTime = false;
-        for (int i = 0; i < _NUM_UID_STATE; i++) {
-            if (times[i] != 0) {
-                hasTime = true;
-                break;
-            }
-        }
-        if (!hasTime) {
+    private void dumpStatesLocked(@NonNull PrintWriter pw, @NonNull Op op,
+            long now, @NonNull SimpleDateFormat sdf, @NonNull Date date, @NonNull String prefix) {
+
+        final OpEntry entry = new OpEntry(op.op, op.running, op.mode, op.mAccessTimes,
+            op.mRejectTimes, op.mDurations, op.mProxyUids, op.mProxyPackageNames);
+
+        final LongSparseArray keys = entry.collectKeys();
+        if (keys == null || keys.size() <= 0) {
             return;
         }
-        boolean first = true;
-        for (int i = 0; i < _NUM_UID_STATE; i++) {
-            if (times[i] != 0) {
-                pw.print(first ? firstPrefix : prefix);
-                first = false;
-                pw.print(UID_STATE_NAMES[i]);
-                pw.print(" = ");
-                date.setTime(times[i]);
+
+        final int keyCount = keys.size();
+        for (int k = 0; k < keyCount; k++) {
+            final long key = keys.keyAt(k);
+
+            final int uidState = AppOpsManager.extractUidStateFromKey(key);
+            final int flags = AppOpsManager.extractFlagsFromKey(key);
+
+            final long accessTime = entry.getLastAccessTime(
+                    uidState, uidState, flags);
+            final long rejectTime = entry.getLastRejectTime(
+                    uidState, uidState, flags);
+            final long accessDuration = entry.getLastDuration(
+                    uidState, uidState, flags);
+            final String proxyPkg = entry.getProxyPackageName(uidState, flags);
+            final int proxyUid = entry.getProxyUid(uidState, flags);
+
+            if (accessTime > 0) {
+                pw.print(prefix);
+                pw.print("Access: ");
+                pw.print(AppOpsManager.keyToString(key));
+                pw.print(" ");
+                date.setTime(accessTime);
                 pw.print(sdf.format(date));
                 pw.print(" (");
-                TimeUtils.formatDuration(times[i]-now, pw);
-                pw.println(")");
+                TimeUtils.formatDuration(accessTime - now, pw);
+                pw.print(")");
+                if (accessDuration > 0) {
+                    pw.print(" duration=");
+                    TimeUtils.formatDuration(accessDuration, pw);
+                }
+                if (proxyUid >= 0) {
+                    pw.print(" proxy[");
+                    pw.print("uid=");
+                    pw.print(proxyUid);
+                    pw.print(", pkg=");
+                    pw.print(proxyPkg);
+                    pw.print("]");
+                }
+                pw.println();
+            }
+
+            if (rejectTime > 0) {
+                pw.print(prefix);
+                pw.print("Reject: ");
+                pw.print(AppOpsManager.keyToString(key));
+                date.setTime(rejectTime);
+                pw.print(sdf.format(date));
+                pw.print(" (");
+                TimeUtils.formatDuration(rejectTime - now, pw);
+                pw.print(")");
+                if (proxyUid >= 0) {
+                    pw.print(" proxy[");
+                    pw.print("uid=");
+                    pw.print(proxyUid);
+                    pw.print(", pkg=");
+                    pw.print(proxyPkg);
+                    pw.print("]");
+                }
+                pw.println();
             }
         }
     }
@@ -3501,6 +3591,7 @@
         int dumpUid = Process.INVALID_UID;
         int dumpMode = -1;
         boolean dumpWatchers = false;
+        boolean dumpHistory = false;
 
         if (args != null) {
             for (int i=0; i<args.length; i++) {
@@ -3550,6 +3641,8 @@
                     }
                 } else if ("--watchers".equals(arg)) {
                     dumpWatchers = true;
+                } else if ("--history".equals(arg)) {
+                    dumpHistory = true;
                 } else if (arg.length() > 0 && arg.charAt(0) == '-'){
                     pw.println("Unknown option: " + arg);
                     return;
@@ -3562,7 +3655,9 @@
 
         synchronized (this) {
             pw.println("Current AppOps Service state:");
-            mConstants.dump(pw);
+            if (!dumpHistory && !dumpWatchers) {
+                mConstants.dump(pw);
+            }
             pw.println();
             final long now = System.currentTimeMillis();
             final long nowElapsed = SystemClock.elapsedRealtime();
@@ -3571,7 +3666,7 @@
             final Date date = new Date();
             boolean needSep = false;
             if (dumpOp < 0 && dumpMode < 0 && dumpPackage == null && mProfileOwners != null
-                    && !dumpWatchers) {
+                    && !dumpWatchers && !dumpHistory) {
                 pw.println("  Profile owners:");
                 for (int poi = 0; poi < mProfileOwners.size(); poi++) {
                     pw.print("    User #");
@@ -3582,7 +3677,7 @@
                 }
                 pw.println();
             }
-            if (mOpModeWatchers.size() > 0) {
+            if (mOpModeWatchers.size() > 0 && !dumpHistory) {
                 boolean printedHeader = false;
                 for (int i=0; i<mOpModeWatchers.size(); i++) {
                     if (dumpOp >= 0 && dumpOp != mOpModeWatchers.keyAt(i)) {
@@ -3612,7 +3707,7 @@
                     }
                 }
             }
-            if (mPackageModeWatchers.size() > 0 && dumpOp < 0) {
+            if (mPackageModeWatchers.size() > 0 && dumpOp < 0 && !dumpHistory) {
                 boolean printedHeader = false;
                 for (int i=0; i<mPackageModeWatchers.size(); i++) {
                     if (dumpPackage != null && !dumpPackage.equals(mPackageModeWatchers.keyAt(i))) {
@@ -3632,7 +3727,7 @@
                     }
                 }
             }
-            if (mModeWatchers.size() > 0 && dumpOp < 0) {
+            if (mModeWatchers.size() > 0 && dumpOp < 0 && !dumpHistory) {
                 boolean printedHeader = false;
                 for (int i=0; i<mModeWatchers.size(); i++) {
                     final ModeCallback cb = mModeWatchers.valueAt(i);
@@ -3730,7 +3825,7 @@
                     pw.println(cb);
                 }
             }
-            if (mClients.size() > 0 && dumpMode < 0 && !dumpWatchers) {
+            if (mClients.size() > 0 && dumpMode < 0 && !dumpWatchers && !dumpHistory) {
                 needSep = true;
                 boolean printedHeader = false;
                 for (int i=0; i<mClients.size(); i++) {
@@ -3759,7 +3854,7 @@
                                 pw.println("      Started ops:");
                                 printedStarted = true;
                             }
-                            pw.print("        "); pw.print("uid="); pw.print(op.uid);
+                            pw.print("        "); pw.print("uid="); pw.print(op.uidState.uid);
                             pw.print(" pkg="); pw.print(op.packageName);
                             pw.print(" op="); pw.println(AppOpsManager.opToName(op.op));
                         }
@@ -3767,7 +3862,7 @@
                 }
             }
             if (mAudioRestrictions.size() > 0 && dumpOp < 0 && dumpPackage != null
-                    && dumpMode < 0 && !dumpWatchers) {
+                    && dumpMode < 0 && !dumpWatchers && !dumpWatchers) {
                 boolean printedHeader = false;
                 for (int o=0; o<mAudioRestrictions.size(); o++) {
                     final String op = AppOpsManager.opToName(mAudioRestrictions.keyAt(o));
@@ -3800,7 +3895,7 @@
                 final SparseIntArray opModes = uidState.opModes;
                 final ArrayMap<String, Ops> pkgOps = uidState.pkgOps;
 
-                if (dumpWatchers) {
+                if (dumpWatchers || dumpHistory) {
                     continue;
                 }
                 if (dumpOp >= 0 || dumpPackage != null || dumpMode >= 0) {
@@ -3847,10 +3942,10 @@
 
                 pw.print("  Uid "); UserHandle.formatUid(pw, uidState.uid); pw.println(":");
                 pw.print("    state=");
-                pw.println(UID_STATE_NAMES[uidState.state]);
+                pw.println(AppOpsManager.getUidStateName(uidState.state));
                 if (uidState.state != uidState.pendingState) {
                     pw.print("    pendingState=");
-                    pw.println(UID_STATE_NAMES[uidState.pendingState]);
+                    pw.println(AppOpsManager.getUidStateName(uidState.pendingState));
                 }
                 if (uidState.pendingStateCommitTime != 0) {
                     pw.print("    pendingStateCommitTime=");
@@ -3906,7 +4001,8 @@
                     boolean printedPackage = false;
                     for (int j=0; j<ops.size(); j++) {
                         final Op op = ops.valueAt(j);
-                        if (dumpOp >= 0 && dumpOp != op.op) {
+                        final int opCode = op.op;
+                        if (dumpOp >= 0 && dumpOp != opCode) {
                             continue;
                         }
                         if (dumpMode >= 0 && dumpMode != op.mode) {
@@ -3916,32 +4012,23 @@
                             pw.print("    Package "); pw.print(ops.packageName); pw.println(":");
                             printedPackage = true;
                         }
-                        pw.print("      "); pw.print(AppOpsManager.opToName(op.op));
+                        pw.print("      "); pw.print(AppOpsManager.opToName(opCode));
                         pw.print(" ("); pw.print(AppOpsManager.modeToName(op.mode));
-                        final int switchOp = AppOpsManager.opToSwitch(op.op);
-                        if (switchOp != op.op) {
+                        final int switchOp = AppOpsManager.opToSwitch(opCode);
+                        if (switchOp != opCode) {
                             pw.print(" / switch ");
                             pw.print(AppOpsManager.opToName(switchOp));
                             final Op switchObj = ops.get(switchOp);
-                            int mode = switchObj != null
-                                    ? switchObj.mode : AppOpsManager.opToDefaultMode(switchOp);
+                            int mode = switchObj != null ? switchObj.mode
+                                    : AppOpsManager.opToDefaultMode(switchOp);
                             pw.print("="); pw.print(AppOpsManager.modeToName(mode));
                         }
                         pw.println("): ");
-                        dumpTimesLocked(pw,
-                                "          Access: ",
-                                "                  ", op.time, now, sdf, date);
-                        dumpTimesLocked(pw,
-                                "          Reject: ",
-                                "                  ", op.rejectTime, now, sdf, date);
-                        if (op.duration == -1) {
+                        dumpStatesLocked(pw, op, now, sdf, date, "          ");
+                        if (op.running) {
                             pw.print("          Running start at: ");
                             TimeUtils.formatDuration(nowElapsed-op.startRealtime, pw);
                             pw.println();
-                        } else if (op.duration != 0) {
-                            pw.print("          duration=");
-                            TimeUtils.formatDuration(op.duration, pw);
-                            pw.println();
                         }
                         if (op.startNesting != 0) {
                             pw.print("          startNesting=");
@@ -3960,7 +4047,7 @@
                 ClientRestrictionState restrictionState = mOpUserRestrictions.valueAt(i);
                 boolean printedTokenHeader = false;
 
-                if (dumpMode >= 0 || dumpWatchers) {
+                if (dumpMode >= 0 || dumpWatchers || dumpHistory) {
                     continue;
                 }
 
@@ -4044,7 +4131,9 @@
         }
 
         // Must not hold the appops lock
-        mHistoricalRegistry.dump("  ", pw, dumpUid, dumpPackage, dumpOp);
+        if (dumpHistory && !dumpWatchers) {
+            mHistoricalRegistry.dump("  ", pw, dumpUid, dumpPackage, dumpOp);
+        }
     }
 
     private static final class Restriction {
@@ -4158,7 +4247,7 @@
                 final ClientState client = mClients.valueAt(i);
                 for (int j = client.mStartedOps.size() - 1; j >= 0; j--) {
                     final Op op = client.mStartedOps.get(j);
-                    if (op.op == code && op.uid == uid) return true;
+                    if (op.op == code && op.uidState.uid == uid) return true;
                 }
             }
         }
diff --git a/services/core/java/com/android/server/appop/HistoricalRegistry.java b/services/core/java/com/android/server/appop/HistoricalRegistry.java
index 4485a54..d723c7b 100644
--- a/services/core/java/com/android/server/appop/HistoricalRegistry.java
+++ b/services/core/java/com/android/server/appop/HistoricalRegistry.java
@@ -23,6 +23,7 @@
 import android.app.AppOpsManager.HistoricalOps;
 import android.app.AppOpsManager.HistoricalPackageOps;
 import android.app.AppOpsManager.HistoricalUidOps;
+import android.app.AppOpsManager.OpFlags;
 import android.app.AppOpsManager.UidState;
 import android.content.ContentResolver;
 import android.database.ContentObserver;
@@ -37,6 +38,7 @@
 import android.os.UserHandle;
 import android.provider.Settings;
 import android.util.ArraySet;
+import android.util.LongSparseArray;
 import android.util.Slog;
 import android.util.TimeUtils;
 import android.util.Xml;
@@ -144,7 +146,7 @@
      * Whether history is enabled.
      */
     @GuardedBy("mInMemoryLock")
-    private int mMode = AppOpsManager.HISTORICAL_MODE_DISABLED;
+    private int mMode = AppOpsManager.HISTORICAL_MODE_ENABLED_ACTIVE;
 
     /**
      * This granularity has been chosen to allow clean delineation for intervals
@@ -297,20 +299,20 @@
         }
     }
 
-    @Nullable void getHistoricalOpsFromDiskRaw(int uid, @NonNull String packageName,
+    void getHistoricalOpsFromDiskRaw(int uid, @NonNull String packageName,
             @Nullable String[] opNames, long beginTimeMillis, long endTimeMillis,
-            @NonNull RemoteCallback callback) {
+            @OpFlags int flags, @NonNull RemoteCallback callback) {
         final HistoricalOps result = new HistoricalOps(beginTimeMillis, endTimeMillis);
         mPersistence.collectHistoricalOpsDLocked(result, uid, packageName, opNames,
-                beginTimeMillis, endTimeMillis);
+                beginTimeMillis, endTimeMillis, flags);
         final Bundle payload = new Bundle();
         payload.putParcelable(AppOpsManager.KEY_HISTORICAL_OPS, result);
         callback.sendResult(payload);
     }
 
-    @Nullable void getHistoricalOps(int uid, @NonNull String packageName,
+    void getHistoricalOps(int uid, @NonNull String packageName,
             @Nullable String[] opNames, long beginTimeMillis, long endTimeMillis,
-            @NonNull RemoteCallback callback) {
+            @OpFlags int flags, @NonNull RemoteCallback callback) {
         final long currentTimeMillis = System.currentTimeMillis();
         if (endTimeMillis == Long.MAX_VALUE) {
             endTimeMillis = currentTimeMillis;
@@ -326,6 +328,8 @@
         synchronized (mOnDiskLock) {
             final List<HistoricalOps> pendingWrites;
             final HistoricalOps currentOps;
+            boolean collectOpsFromDisk;
+
             synchronized (mInMemoryLock) {
                 currentOps = getUpdatedPendingHistoricalOpsMLocked(currentTimeMillis);
                 if (!(inMemoryAdjBeginTimeMillis >= currentOps.getEndTimeMillis()
@@ -338,10 +342,11 @@
                 }
                 pendingWrites = new ArrayList<>(mPendingWrites);
                 mPendingWrites.clear();
+                collectOpsFromDisk = inMemoryAdjEndTimeMillis > currentOps.getEndTimeMillis();
             }
 
             // If the query was only for in-memory state - done.
-            if (inMemoryAdjEndTimeMillis > currentOps.getEndTimeMillis()) {
+            if (collectOpsFromDisk) {
                 // If there is a write in flight we need to force it now
                 persistPendingHistory(pendingWrites);
                 // Collect persisted state.
@@ -352,7 +357,7 @@
                 final long onDiskAdjEndTimeMillis = Math.max(inMemoryAdjEndTimeMillis
                         - onDiskAndInMemoryOffsetMillis, 0);
                 mPersistence.collectHistoricalOpsDLocked(result, uid, packageName, opNames,
-                        onDiskAdjBeginTimeMillis, onDiskAdjEndTimeMillis);
+                        onDiskAdjBeginTimeMillis, onDiskAdjEndTimeMillis, flags);
             }
 
             // Rebase the result time to be since epoch.
@@ -366,32 +371,31 @@
     }
 
     void incrementOpAccessedCount(int op, int uid, @NonNull String packageName,
-            @UidState int uidState) {
+            @UidState int uidState, @OpFlags int flags) {
         synchronized (mInMemoryLock) {
             if (mMode == AppOpsManager.HISTORICAL_MODE_ENABLED_ACTIVE) {
                 getUpdatedPendingHistoricalOpsMLocked(System.currentTimeMillis())
-                        .increaseAccessCount(op, uid, packageName, uidState, 1);
-
+                        .increaseAccessCount(op, uid, packageName, uidState, flags, 1);
             }
         }
     }
 
     void incrementOpRejected(int op, int uid, @NonNull String packageName,
-            @UidState int uidState) {
+            @UidState int uidState, @OpFlags int flags) {
         synchronized (mInMemoryLock) {
             if (mMode == AppOpsManager.HISTORICAL_MODE_ENABLED_ACTIVE) {
                 getUpdatedPendingHistoricalOpsMLocked(System.currentTimeMillis())
-                        .increaseRejectCount(op, uid, packageName, uidState, 1);
+                        .increaseRejectCount(op, uid, packageName, uidState, flags, 1);
             }
         }
     }
 
     void increaseOpAccessDuration(int op, int uid, @NonNull String packageName,
-            @UidState int uidState, long increment) {
+            @UidState int uidState, @OpFlags int flags, long increment) {
         synchronized (mInMemoryLock) {
             if (mMode == AppOpsManager.HISTORICAL_MODE_ENABLED_ACTIVE) {
                 getUpdatedPendingHistoricalOpsMLocked(System.currentTimeMillis())
-                        .increaseAccessDuration(op, uid, packageName, uidState, increment);
+                        .increaseAccessDuration(op, uid, packageName, uidState, flags, increment);
             }
         }
     }
@@ -593,20 +597,20 @@
         private static final String TAG_HISTORY = "history";
         private static final String TAG_OPS = "ops";
         private static final String TAG_UID = "uid";
-        private static final String TAG_PACKAGE = "package";
+        private static final String TAG_PACKAGE = "pkg";
         private static final String TAG_OP = "op";
-        private static final String TAG_STATE = "state";
+        private static final String TAG_STATE = "st";
 
-        private static final String ATTR_VERSION = "version";
-        private static final String ATTR_NAME = "name";
-        private static final String ATTR_ACCESS_COUNT = "accessCount";
-        private static final String ATTR_REJECT_COUNT = "rejectCount";
-        private static final String ATTR_ACCESS_DURATION = "accessDuration";
-        private static final String ATTR_BEGIN_TIME = "beginTime";
-        private static final String ATTR_END_TIME = "endTime";
-        private static final String ATTR_OVERFLOW = "overflow";
+        private static final String ATTR_VERSION = "ver";
+        private static final String ATTR_NAME = "na";
+        private static final String ATTR_ACCESS_COUNT = "ac";
+        private static final String ATTR_REJECT_COUNT = "rc";
+        private static final String ATTR_ACCESS_DURATION = "du";
+        private static final String ATTR_BEGIN_TIME = "beg";
+        private static final String ATTR_END_TIME = "end";
+        private static final String ATTR_OVERFLOW = "ov";
 
-        private static final int CURRENT_VERSION = 1;
+        private static final int CURRENT_VERSION = 2;
 
         private final long mBaseSnapshotInterval;
         private final long mIntervalCompressionMultiplier;
@@ -657,7 +661,8 @@
         @Nullable List<HistoricalOps> readHistoryRawDLocked() {
             return collectHistoricalOpsBaseDLocked(Process.INVALID_UID /*filterUid*/,
                     null /*filterPackageName*/, null /*filterOpNames*/,
-                    0 /*filterBeginTimeMills*/, Long.MAX_VALUE /*filterEndTimeMills*/);
+                    0 /*filterBeginTimeMills*/, Long.MAX_VALUE /*filterEndTimeMills*/,
+                    AppOpsManager.OP_FLAGS_ALL);
         }
 
         @Nullable List<HistoricalOps> readHistoryDLocked() {
@@ -697,9 +702,10 @@
 
         private void collectHistoricalOpsDLocked(@NonNull HistoricalOps currentOps,
                 int filterUid, @NonNull String filterPackageName, @Nullable String[] filterOpNames,
-                long filterBeingMillis, long filterEndMillis) {
+                long filterBeingMillis, long filterEndMillis, @OpFlags int filterFlags) {
             final List<HistoricalOps> readOps = collectHistoricalOpsBaseDLocked(filterUid,
-                    filterPackageName, filterOpNames, filterBeingMillis, filterEndMillis);
+                    filterPackageName, filterOpNames, filterBeingMillis, filterEndMillis,
+                    filterFlags);
             if (readOps != null) {
                 final int readCount = readOps.size();
                 for (int i = 0; i < readCount; i++) {
@@ -711,7 +717,7 @@
 
         private @Nullable LinkedList<HistoricalOps> collectHistoricalOpsBaseDLocked(
                 int filterUid, @NonNull String filterPackageName, @Nullable String[] filterOpNames,
-                long filterBeginTimeMillis, long filterEndTimeMillis) {
+                long filterBeginTimeMillis, long filterEndTimeMillis, @OpFlags int filterFlags) {
             File baseDir = null;
             try {
                 baseDir = mHistoricalAppOpsDir.startRead();
@@ -724,8 +730,8 @@
                 final long[] globalContentOffsetMillis = {0};
                 final LinkedList<HistoricalOps> ops = collectHistoricalOpsRecursiveDLocked(
                         baseDir, filterUid, filterPackageName, filterOpNames, filterBeginTimeMillis,
-                        filterEndTimeMillis, globalContentOffsetMillis, null /*outOps*/,
-                        0 /*depth*/, historyFiles);
+                        filterEndTimeMillis, filterFlags, globalContentOffsetMillis,
+                        null /*outOps*/, 0 /*depth*/, historyFiles);
                 if (DEBUG) {
                     filesInvariant.stopTracking(baseDir);
                 }
@@ -741,7 +747,8 @@
         private @Nullable LinkedList<HistoricalOps> collectHistoricalOpsRecursiveDLocked(
                 @NonNull File baseDir, int filterUid, @NonNull String filterPackageName,
                 @Nullable String[] filterOpNames, long filterBeginTimeMillis,
-                long filterEndTimeMillis, @NonNull long[] globalContentOffsetMillis,
+                long filterEndTimeMillis, @OpFlags int filterFlags,
+                @NonNull long[] globalContentOffsetMillis,
                 @Nullable LinkedList<HistoricalOps> outOps, int depth,
                 @NonNull Set<String> historyFiles)
                 throws IOException, XmlPullParserException {
@@ -757,7 +764,7 @@
             final List<HistoricalOps> readOps = readHistoricalOpsLocked(baseDir,
                     previousIntervalEndMillis, currentIntervalEndMillis, filterUid,
                     filterPackageName, filterOpNames, filterBeginTimeMillis, filterEndTimeMillis,
-                    globalContentOffsetMillis, depth, historyFiles);
+                    filterFlags, globalContentOffsetMillis, depth, historyFiles);
 
             // Empty is a special signal to stop diving
             if (readOps != null && readOps.isEmpty()) {
@@ -767,7 +774,7 @@
             // Collect older historical data from subsequent levels
             outOps = collectHistoricalOpsRecursiveDLocked(
                     baseDir, filterUid, filterPackageName, filterOpNames, filterBeginTimeMillis,
-                    filterEndTimeMillis, globalContentOffsetMillis, outOps, depth + 1,
+                    filterEndTimeMillis, filterFlags, globalContentOffsetMillis, outOps, depth + 1,
                     historyFiles);
 
             // Make older historical data relative to the current historical level
@@ -836,22 +843,24 @@
                     previousIntervalEndMillis, currentIntervalEndMillis,
                     Process.INVALID_UID /*filterUid*/, null /*filterPackageName*/,
                     null /*filterOpNames*/, Long.MIN_VALUE /*filterBeginTimeMillis*/,
-                    Long.MAX_VALUE /*filterEndTimeMillis*/, null, depth,
-                    null /*historyFiles*/);
+                    Long.MAX_VALUE /*filterEndTimeMillis*/, AppOpsManager.OP_FLAGS_ALL,
+                    null, depth, null /*historyFiles*/);
 
             if (DEBUG) {
                 enforceOpsWellFormed(existingOps);
             }
 
             // Offset existing ops to account for elapsed time
-            final int existingOpCount = existingOps.size();
-            if (existingOpCount > 0) {
-                // Compute elapsed time
-                final long elapsedTimeMillis = passedOps.get(passedOps.size() - 1)
+            if (existingOps != null) {
+                final int existingOpCount = existingOps.size();
+                if (existingOpCount > 0) {
+                    // Compute elapsed time
+                    final long elapsedTimeMillis = passedOps.get(passedOps.size() - 1)
                         .getEndTimeMillis();
-                for (int i = 0; i < existingOpCount; i++) {
-                    final HistoricalOps existingOp = existingOps.get(i);
-                    existingOp.offsetBeginAndEndTime(elapsedTimeMillis);
+                    for (int i = 0; i < existingOpCount; i++) {
+                        final HistoricalOps existingOp = existingOps.get(i);
+                        existingOp.offsetBeginAndEndTime(elapsedTimeMillis);
+                    }
                 }
             }
 
@@ -864,9 +873,10 @@
             // Consolidate passed ops at the current slot duration ensuring each snapshot is
             // full. To achieve this we put all passed and existing ops in a list and will
             // merge them to ensure each represents a snapshot at the current granularity.
-            final List<HistoricalOps> allOps = new LinkedList<>();
-            allOps.addAll(passedOps);
-            allOps.addAll(existingOps);
+            final List<HistoricalOps> allOps = new LinkedList<>(passedOps);
+            if (existingOps != null) {
+                allOps.addAll(existingOps);
+            }
 
             if (DEBUG) {
                 enforceOpsWellFormed(allOps);
@@ -944,10 +954,10 @@
                     overflowedOps, oldFileNames, depth + 1);
         }
 
-        private @NonNull List<HistoricalOps> readHistoricalOpsLocked(File baseDir,
-                long intervalBeginMillis, long intervalEndMillis, int filterUid,
-                @Nullable String filterPackageName, @Nullable String[] filterOpNames,
-                long filterBeginTimeMillis, long filterEndTimeMillis,
+        private @Nullable List<HistoricalOps> readHistoricalOpsLocked(File baseDir,
+                long intervalBeginMillis, long intervalEndMillis,
+                int filterUid, @Nullable String filterPackageName, @Nullable String[] filterOpNames,
+                long filterBeginTimeMillis, long filterEndTimeMillis, @OpFlags int filterFlags,
                 @Nullable long[] cumulativeOverflowMillis, int depth,
                 @NonNull Set<String> historyFiles)
                 throws IOException, XmlPullParserException {
@@ -973,12 +983,13 @@
                 }
             }
             return readHistoricalOpsLocked(file, filterUid, filterPackageName, filterOpNames,
-                    filterBeginTimeMillis, filterEndTimeMillis, cumulativeOverflowMillis);
+                    filterBeginTimeMillis, filterEndTimeMillis, filterFlags,
+                    cumulativeOverflowMillis);
         }
 
         private @Nullable List<HistoricalOps> readHistoricalOpsLocked(@NonNull File file,
                 int filterUid, @Nullable String filterPackageName, @Nullable String[] filterOpNames,
-                long filterBeginTimeMillis, long filterEndTimeMillis,
+                long filterBeginTimeMillis, long filterEndTimeMillis, @OpFlags int filterFlags,
                 @Nullable long[] cumulativeOverflowMillis)
                 throws IOException, XmlPullParserException {
             if (DEBUG) {
@@ -989,13 +1000,22 @@
                 final XmlPullParser parser = Xml.newPullParser();
                 parser.setInput(stream, StandardCharsets.UTF_8.name());
                 XmlUtils.beginDocument(parser, TAG_HISTORY);
+
+                // We haven't released version 1 and have more detailed
+                // accounting - just nuke the current state
+                final int version = XmlUtils.readIntAttribute(parser, ATTR_VERSION);
+                if (CURRENT_VERSION == 2 && version < CURRENT_VERSION) {
+                    throw new IllegalStateException("Dropping unsupported history "
+                            + "version 1 for file:" + file);
+                }
+
                 final long overflowMillis = XmlUtils.readLongAttribute(parser, ATTR_OVERFLOW, 0);
                 final int depth = parser.getDepth();
                 while (XmlUtils.nextElementWithin(parser, depth)) {
                     if (TAG_OPS.equals(parser.getName())) {
                         final HistoricalOps ops = readeHistoricalOpsDLocked(parser,
                                 filterUid, filterPackageName, filterOpNames, filterBeginTimeMillis,
-                                filterEndTimeMillis, cumulativeOverflowMillis);
+                                filterEndTimeMillis, filterFlags, cumulativeOverflowMillis);
                         if (ops == null) {
                             continue;
                         }
@@ -1029,7 +1049,8 @@
         private @Nullable HistoricalOps readeHistoricalOpsDLocked(
                 @NonNull XmlPullParser parser, int filterUid, @Nullable String filterPackageName,
                 @Nullable String[] filterOpNames, long filterBeginTimeMillis,
-                long filterEndTimeMillis, @Nullable long[] cumulativeOverflowMillis)
+                long filterEndTimeMillis, @OpFlags int filterFlags,
+                @Nullable long[] cumulativeOverflowMillis)
                 throws IOException, XmlPullParserException {
             final long beginTimeMillis = XmlUtils.readLongAttribute(parser, ATTR_BEGIN_TIME, 0)
                     + (cumulativeOverflowMillis != null ? cumulativeOverflowMillis[0] : 0);
@@ -1045,6 +1066,10 @@
             }
             final long filteredBeginTimeMillis = Math.max(beginTimeMillis, filterBeginTimeMillis);
             final long filteredEndTimeMillis = Math.min(endTimeMillis, filterEndTimeMillis);
+            // // Keep reading as subsequent records may start matching
+            // if (filteredEndTimeMillis - filterBeginTimeMillis <= 0) {
+            //     return null;
+            // }
             final double filterScale = (double) (filteredEndTimeMillis - filteredBeginTimeMillis)
                     / (double) (endTimeMillis - beginTimeMillis);
             HistoricalOps ops = null;
@@ -1052,7 +1077,7 @@
             while (XmlUtils.nextElementWithin(parser, depth)) {
                 if (TAG_UID.equals(parser.getName())) {
                     final HistoricalOps returnedOps = readHistoricalUidOpsDLocked(ops, parser,
-                            filterUid, filterPackageName, filterOpNames, filterScale);
+                            filterUid, filterPackageName, filterOpNames, filterFlags, filterScale);
                     if (ops == null) {
                         ops = returnedOps;
                     }
@@ -1067,7 +1092,8 @@
         private @Nullable HistoricalOps readHistoricalUidOpsDLocked(
                 @Nullable HistoricalOps ops, @NonNull XmlPullParser parser, int filterUid,
                 @Nullable String filterPackageName, @Nullable String[] filterOpNames,
-                double filterScale) throws IOException, XmlPullParserException {
+                @OpFlags int filterFlags, double filterScale)
+                throws IOException, XmlPullParserException {
             final int uid = XmlUtils.readIntAttribute(parser, ATTR_NAME);
             if (filterUid != Process.INVALID_UID && filterUid != uid) {
                 XmlUtils.skipCurrentTag(parser);
@@ -1077,7 +1103,8 @@
             while (XmlUtils.nextElementWithin(parser, depth)) {
                 if (TAG_PACKAGE.equals(parser.getName())) {
                     final HistoricalOps returnedOps = readHistoricalPackageOpsDLocked(ops,
-                            uid, parser, filterPackageName, filterOpNames, filterScale);
+                            uid, parser, filterPackageName, filterOpNames, filterFlags,
+                            filterScale);
                     if (ops == null) {
                         ops = returnedOps;
                     }
@@ -1089,7 +1116,8 @@
         private @Nullable HistoricalOps readHistoricalPackageOpsDLocked(
                 @Nullable HistoricalOps ops, int uid, @NonNull XmlPullParser parser,
                 @Nullable String filterPackageName, @Nullable String[] filterOpNames,
-                double filterScale) throws IOException, XmlPullParserException {
+                @OpFlags int filterFlags, double filterScale)
+                throws IOException, XmlPullParserException {
             final String packageName = XmlUtils.readStringAttribute(parser, ATTR_NAME);
             if (filterPackageName != null && !filterPackageName.equals(packageName)) {
                 XmlUtils.skipCurrentTag(parser);
@@ -1099,7 +1127,7 @@
             while (XmlUtils.nextElementWithin(parser, depth)) {
                 if (TAG_OP.equals(parser.getName())) {
                     final HistoricalOps returnedOps = readHistoricalOpDLocked(ops, uid,
-                            packageName, parser, filterOpNames, filterScale);
+                            packageName, parser, filterOpNames, filterFlags, filterScale);
                     if (ops == null) {
                         ops = returnedOps;
                     }
@@ -1110,7 +1138,7 @@
 
         private @Nullable HistoricalOps readHistoricalOpDLocked(@Nullable HistoricalOps ops,
                 int uid, String packageName, @NonNull XmlPullParser parser,
-                @Nullable String[] filterOpNames, double filterScale)
+                @Nullable String[] filterOpNames, @OpFlags int filterFlags, double filterScale)
                 throws IOException, XmlPullParserException {
             final int op = XmlUtils.readIntAttribute(parser, ATTR_NAME);
             if (filterOpNames != null && !ArrayUtils.contains(filterOpNames,
@@ -1121,8 +1149,8 @@
             final int depth = parser.getDepth();
             while (XmlUtils.nextElementWithin(parser, depth)) {
                 if (TAG_STATE.equals(parser.getName())) {
-                    final HistoricalOps returnedOps = readUidStateDLocked(ops, uid,
-                            packageName, op, parser, filterScale);
+                    final HistoricalOps returnedOps = readStateDLocked(ops, uid,
+                            packageName, op, parser, filterFlags, filterScale);
                     if (ops == null) {
                         ops = returnedOps;
                     }
@@ -1131,10 +1159,15 @@
             return ops;
         }
 
-        private @Nullable HistoricalOps readUidStateDLocked(@Nullable HistoricalOps ops,
+        private @Nullable HistoricalOps readStateDLocked(@Nullable HistoricalOps ops,
                 int uid, String packageName, int op, @NonNull XmlPullParser parser,
-                double filterScale) throws IOException {
-            final int uidState = XmlUtils.readIntAttribute(parser, ATTR_NAME);
+                @OpFlags int filterFlags, double filterScale) throws IOException {
+            final long key = XmlUtils.readLongAttribute(parser, ATTR_NAME);
+            final int flags = AppOpsManager.extractFlagsFromKey(key) & filterFlags;
+            if (flags == 0) {
+                return null;
+            }
+            final int uidState = AppOpsManager.extractUidStateFromKey(key);
             long accessCount = XmlUtils.readLongAttribute(parser, ATTR_ACCESS_COUNT, 0);
             if (accessCount > 0) {
                 if (!Double.isNaN(filterScale)) {
@@ -1144,7 +1177,7 @@
                 if (ops == null) {
                     ops = new HistoricalOps(0, 0);
                 }
-                ops.increaseAccessCount(op, uid, packageName, uidState, accessCount);
+                ops.increaseAccessCount(op, uid, packageName, uidState, flags, accessCount);
             }
             long rejectCount = XmlUtils.readLongAttribute(parser, ATTR_REJECT_COUNT, 0);
             if (rejectCount > 0) {
@@ -1155,7 +1188,7 @@
                 if (ops == null) {
                     ops = new HistoricalOps(0, 0);
                 }
-                ops.increaseRejectCount(op, uid, packageName, uidState, rejectCount);
+                ops.increaseRejectCount(op, uid, packageName, uidState, flags, rejectCount);
             }
             long accessDuration =  XmlUtils.readLongAttribute(parser, ATTR_ACCESS_DURATION, 0);
             if (accessDuration > 0) {
@@ -1166,7 +1199,7 @@
                 if (ops == null) {
                     ops = new HistoricalOps(0, 0);
                 }
-                ops.increaseAccessDuration(op, uid, packageName, uidState, accessDuration);
+                ops.increaseAccessDuration(op, uid, packageName, uidState, flags, accessDuration);
             }
             return ops;
         }
@@ -1241,24 +1274,34 @@
 
         private void writeHistoricalOpDLocked(@NonNull HistoricalOp op,
                 @NonNull XmlSerializer serializer) throws IOException {
+            final LongSparseArray keys = op.collectKeys();
+            if (keys == null || keys.size() <= 0) {
+                return;
+            }
             serializer.startTag(null, TAG_OP);
             serializer.attribute(null, ATTR_NAME, Integer.toString(op.getOpCode()));
-            for (int uidState = 0; uidState < AppOpsManager._NUM_UID_STATE; uidState++) {
-                writeUidStateOnLocked(op, uidState, serializer);
+            final int keyCount = keys.size();
+            for (int i = 0; i < keyCount; i++) {
+                writeStateOnLocked(op, keys.keyAt(i), serializer);
             }
             serializer.endTag(null, TAG_OP);
         }
 
-        private void writeUidStateOnLocked(@NonNull HistoricalOp op, @UidState int uidState,
+        private void writeStateOnLocked(@NonNull HistoricalOp op, long key,
                 @NonNull XmlSerializer serializer) throws IOException {
-            final long accessCount = op.getAccessCount(uidState);
-            final long rejectCount = op.getRejectCount(uidState);
-            final long accessDuration = op.getAccessDuration(uidState);
-            if (accessCount == 0 && rejectCount == 0 && accessDuration == 0) {
+            final int uidState = AppOpsManager.extractUidStateFromKey(key);
+            final int flags = AppOpsManager.extractFlagsFromKey(key);
+
+            final long accessCount = op.getAccessCount(uidState, uidState, flags);
+            final long rejectCount = op.getRejectCount(uidState, uidState, flags);
+            final long accessDuration = op.getAccessDuration(uidState, uidState, flags);
+
+            if (accessCount <= 0 && rejectCount <= 0 && accessDuration <= 0) {
                 return;
             }
+
             serializer.startTag(null, TAG_STATE);
-            serializer.attribute(null, ATTR_NAME, Integer.toString(uidState));
+            serializer.attribute(null, ATTR_NAME, Long.toString(key));
             if (accessCount > 0) {
                 serializer.attribute(null, ATTR_ACCESS_COUNT, Long.toString(accessCount));
             }
@@ -1532,24 +1575,29 @@
             mWriter.print(mEntryPrefix);
             mWriter.print(AppOpsManager.opToName(ops.getOpCode()));
             mWriter.println(":");
-            for (int uidState = 0; uidState < AppOpsManager._NUM_UID_STATE; uidState++) {
+            final LongSparseArray keys = ops.collectKeys();
+            final int keyCount = keys.size();
+            for (int i = 0; i < keyCount; i++) {
+                final long key = keys.keyAt(i);
+                final int uidState = AppOpsManager.extractUidStateFromKey(key);
+                final int flags = AppOpsManager.extractFlagsFromKey(key);
                 boolean printedUidState = false;
-                final long accessCount = ops.getAccessCount(uidState);
+                final long accessCount = ops.getAccessCount(uidState, uidState, flags);
                 if (accessCount > 0) {
                     if (!printedUidState) {
                         mWriter.print(mUidStatePrefix);
-                        mWriter.print(AppOpsService.UID_STATE_NAMES[uidState]);
+                        mWriter.print(AppOpsManager.keyToString(key));
                         mWriter.print(" = ");
                         printedUidState = true;
                     }
                     mWriter.print("access=");
                     mWriter.print(accessCount);
                 }
-                final long rejectCount = ops.getRejectCount(uidState);
+                final long rejectCount = ops.getRejectCount(uidState, uidState, flags);
                 if (rejectCount > 0) {
                     if (!printedUidState) {
                         mWriter.print(mUidStatePrefix);
-                        mWriter.print(AppOpsService.UID_STATE_NAMES[uidState]);
+                        mWriter.print(AppOpsManager.keyToString(key));
                         mWriter.print(" = ");
                         printedUidState = true;
                     } else {
@@ -1558,11 +1606,11 @@
                     mWriter.print("reject=");
                     mWriter.print(rejectCount);
                 }
-                final long accessDuration = ops.getAccessDuration(uidState);
+                final long accessDuration = ops.getAccessDuration(uidState, uidState, flags);
                 if (accessDuration > 0) {
                     if (!printedUidState) {
                         mWriter.print(mUidStatePrefix);
-                        mWriter.print(AppOpsService.UID_STATE_NAMES[uidState]);
+                        mWriter.print(AppOpsManager.keyToString(key));
                         mWriter.print(" = ");
                         printedUidState = true;
                     } else {
diff --git a/services/core/java/com/android/server/appop/TEST_MAPPING b/services/core/java/com/android/server/appop/TEST_MAPPING
new file mode 100644
index 0000000..a53797d
--- /dev/null
+++ b/services/core/java/com/android/server/appop/TEST_MAPPING
@@ -0,0 +1,15 @@
+{
+    "presubmit": [
+        {
+            "name": "CtsAppOpsTestCases"
+        },
+        {
+            "name": "FrameworksServicesTests",
+            "options": [
+                {
+                    "include-filter": "com.android.server.appop"
+                }
+            ]
+        }
+    ]
+}
diff --git a/services/core/java/com/android/server/attention/AttentionManagerService.java b/services/core/java/com/android/server/attention/AttentionManagerService.java
index 47c9b86..5965d59 100644
--- a/services/core/java/com/android/server/attention/AttentionManagerService.java
+++ b/services/core/java/com/android/server/attention/AttentionManagerService.java
@@ -127,8 +127,7 @@
     }
 
     private boolean isServiceEnabled() {
-        final String enabled = DeviceConfig.getProperty(NAMESPACE, SERVICE_ENABLED);
-        return enabled == null ? DEFAULT_SERVICE_ENABLED : "true".equals(enabled);
+        return DeviceConfig.getBoolean(NAMESPACE, SERVICE_ENABLED, DEFAULT_SERVICE_ENABLED);
     }
 
     /**
diff --git a/services/core/java/com/android/server/audio/AudioDeviceBroker.java b/services/core/java/com/android/server/audio/AudioDeviceBroker.java
index 9af57da..451fd66 100644
--- a/services/core/java/com/android/server/audio/AudioDeviceBroker.java
+++ b/services/core/java/com/android/server/audio/AudioDeviceBroker.java
@@ -201,51 +201,72 @@
         }
     }
 
-    /*package*/ int setBluetoothA2dpDeviceConnectionStateSuppressNoisyIntent(
+    private static final class BtDeviceConnectionInfo {
+        final @NonNull BluetoothDevice mDevice;
+        final @AudioService.BtProfileConnectionState int mState;
+        final int mProfile;
+        final boolean mSupprNoisy;
+        final int mVolume;
+
+        BtDeviceConnectionInfo(@NonNull BluetoothDevice device,
+                @AudioService.BtProfileConnectionState int state,
+                int profile, boolean suppressNoisyIntent, int vol) {
+            mDevice = device;
+            mState = state;
+            mProfile = profile;
+            mSupprNoisy = suppressNoisyIntent;
+            mVolume = vol;
+        }
+    }
+
+    /*package*/ void postBluetoothA2dpDeviceConnectionStateSuppressNoisyIntent(
             @NonNull BluetoothDevice device, @AudioService.BtProfileConnectionState int state,
             int profile, boolean suppressNoisyIntent, int a2dpVolume) {
-        AudioService.sDeviceLogger.log((new AudioEventLogger.StringEvent(
-                "setBluetoothA2dpDeviceConnectionStateSuppressNoisyIntent state=" + state
-                        // only querying address as this is the only readily available field
-                        // on the device
-                        + " addr=" + device.getAddress()
-                        + " prof=" + profile + " supprNoisy=" + suppressNoisyIntent
-                        + " vol=" + a2dpVolume)).printLog(TAG));
-        synchronized (mDeviceStateLock) {
-            if (mBrokerHandler.hasMessages(MSG_IL_SET_A2DP_SINK_CONNECTION_STATE,
-                    new BtHelper.BluetoothA2dpDeviceInfo(device))) {
-                AudioService.sDeviceLogger.log(new AudioEventLogger.StringEvent(
-                        "A2DP connection state ignored"));
-                return 0;
-            }
-            return mDeviceInventory.setBluetoothA2dpDeviceConnectionState(
-                    device, state, profile, suppressNoisyIntent,
-                    AudioSystem.DEVICE_NONE, a2dpVolume);
-        }
+        final BtDeviceConnectionInfo info = new BtDeviceConnectionInfo(device, state, profile,
+                suppressNoisyIntent, a2dpVolume);
+
+        // TODO add a check to try to remove unprocessed messages for the same device (the old
+        //      check didn't work), and  make sure it doesn't conflict with config change message
+        sendLMsgNoDelay(MSG_L_A2DP_DEVICE_CONNECTION_CHANGE_EXT, SENDMSG_QUEUE, info);
     }
 
     /*package*/ int handleBluetoothA2dpActiveDeviceChange(
             @NonNull BluetoothDevice device,
             @AudioService.BtProfileConnectionState int state, int profile,
             boolean suppressNoisyIntent, int a2dpVolume) {
+        // FIXME method was added by @a8439e2 but never used, and now conflicts with async behavior
+        //   of handleBluetoothA2dpDeviceConfigChange and
+        //   setBluetoothA2dpDeviceConnectionStateSuppressNoisyIntent
         synchronized (mDeviceStateLock) {
             return mDeviceInventory.handleBluetoothA2dpActiveDeviceChange(device, state, profile,
                     suppressNoisyIntent, a2dpVolume);
         }
     }
 
-    /*package*/ int setBluetoothHearingAidDeviceConnectionState(
+    private static final class HearingAidDeviceConnectionInfo {
+        final @NonNull BluetoothDevice mDevice;
+        final @AudioService.BtProfileConnectionState int mState;
+        final boolean mSupprNoisy;
+        final int mMusicDevice;
+        final @NonNull String mEventSource;
+
+        HearingAidDeviceConnectionInfo(@NonNull BluetoothDevice device,
+                @AudioService.BtProfileConnectionState int state,
+                boolean suppressNoisyIntent, int musicDevice, @NonNull String eventSource) {
+            mDevice = device;
+            mState = state;
+            mSupprNoisy = suppressNoisyIntent;
+            mMusicDevice = musicDevice;
+            mEventSource = eventSource;
+        }
+    }
+
+    /*package*/ void postBluetoothHearingAidDeviceConnectionState(
             @NonNull BluetoothDevice device, @AudioService.BtProfileConnectionState int state,
             boolean suppressNoisyIntent, int musicDevice, @NonNull String eventSource) {
-        AudioService.sDeviceLogger.log((new AudioEventLogger.StringEvent(
-                "setHearingAidDeviceConnectionState state=" + state
-                        + " addr=" + device.getAddress()
-                        + " supprNoisy=" + suppressNoisyIntent
-                        + " src=" + eventSource)).printLog(TAG));
-        synchronized (mDeviceStateLock) {
-            return mDeviceInventory.setBluetoothHearingAidDeviceConnectionState(
-                    device, state, suppressNoisyIntent, musicDevice);
-        }
+        final HearingAidDeviceConnectionInfo info = new HearingAidDeviceConnectionInfo(
+                device, state, suppressNoisyIntent, musicDevice, eventSource);
+        sendLMsgNoDelay(MSG_L_HEARING_AID_DEVICE_CONNECTION_CHANGE_EXT, SENDMSG_QUEUE, info);
     }
 
     // never called by system components
@@ -766,6 +787,35 @@
                         mBtHelper.onHeadsetProfileConnected((BluetoothHeadset) msg.obj);
                     }
                     break;
+                case MSG_L_A2DP_DEVICE_CONNECTION_CHANGE_EXT: {
+                    final BtDeviceConnectionInfo info = (BtDeviceConnectionInfo) msg.obj;
+                    AudioService.sDeviceLogger.log((new AudioEventLogger.StringEvent(
+                            "setBluetoothA2dpDeviceConnectionStateSuppressNoisyIntent "
+                                    + " state=" + info.mState
+                                    // only querying address as this is the only readily available
+                                    // field on the device
+                                    + " addr=" + info.mDevice.getAddress()
+                                    + " prof=" + info.mProfile + " supprNoisy=" + info.mSupprNoisy
+                                    + " vol=" + info.mVolume)).printLog(TAG));
+                    synchronized (mDeviceStateLock) {
+                        mDeviceInventory.setBluetoothA2dpDeviceConnectionState(
+                                info.mDevice, info.mState, info.mProfile, info.mSupprNoisy,
+                                AudioSystem.DEVICE_NONE, info.mVolume);
+                    }
+                } break;
+                case MSG_L_HEARING_AID_DEVICE_CONNECTION_CHANGE_EXT: {
+                    final HearingAidDeviceConnectionInfo info =
+                            (HearingAidDeviceConnectionInfo) msg.obj;
+                    AudioService.sDeviceLogger.log((new AudioEventLogger.StringEvent(
+                            "setHearingAidDeviceConnectionState state=" + info.mState
+                                    + " addr=" + info.mDevice.getAddress()
+                                    + " supprNoisy=" + info.mSupprNoisy
+                                    + " src=" + info.mEventSource)).printLog(TAG));
+                    synchronized (mDeviceStateLock) {
+                        mDeviceInventory.setBluetoothHearingAidDeviceConnectionState(
+                                info.mDevice, info.mState, info.mSupprNoisy, info.mMusicDevice);
+                    }
+                } break;
                 default:
                     Log.wtf(TAG, "Invalid message " + msg.what);
             }
@@ -809,6 +859,10 @@
     private static final int MSG_L_BT_SERVICE_CONNECTED_PROFILE_A2DP_SINK = 24;
     private static final int MSG_L_BT_SERVICE_CONNECTED_PROFILE_HEARING_AID = 25;
     private static final int MSG_L_BT_SERVICE_CONNECTED_PROFILE_HEADSET = 26;
+    // process external command to (dis)connect an A2DP device
+    private static final int MSG_L_A2DP_DEVICE_CONNECTION_CHANGE_EXT = 27;
+    // process external command to (dis)connect a hearing aid device
+    private static final int MSG_L_HEARING_AID_DEVICE_CONNECTION_CHANGE_EXT = 28;
 
 
     private static boolean isMessageHandledUnderWakelock(int msgId) {
@@ -821,6 +875,8 @@
             case MSG_L_A2DP_DEVICE_CONFIG_CHANGE:
             case MSG_TOGGLE_HDMI:
             case MSG_L_A2DP_ACTIVE_DEVICE_CHANGE:
+            case MSG_L_A2DP_DEVICE_CONNECTION_CHANGE_EXT:
+            case MSG_L_HEARING_AID_DEVICE_CONNECTION_CHANGE_EXT:
                 return true;
             default:
                 return false;
diff --git a/services/core/java/com/android/server/audio/AudioDeviceInventory.java b/services/core/java/com/android/server/audio/AudioDeviceInventory.java
index 37f0496..41a3c98 100644
--- a/services/core/java/com/android/server/audio/AudioDeviceInventory.java
+++ b/services/core/java/com/android/server/audio/AudioDeviceInventory.java
@@ -578,7 +578,7 @@
         return mCurAudioRoutes;
     }
 
-    /*package*/ int setBluetoothA2dpDeviceConnectionState(
+    /*package*/ void setBluetoothA2dpDeviceConnectionState(
             @NonNull BluetoothDevice device, @AudioService.BtProfileConnectionState int state,
             int profile, boolean suppressNoisyIntent, int musicDevice, int a2dpVolume) {
         int delay;
@@ -614,46 +614,50 @@
                         delay);
             }
         }
-        return delay;
     }
 
     /*package*/ int handleBluetoothA2dpActiveDeviceChange(
             @NonNull BluetoothDevice device,
             @AudioService.BtProfileConnectionState int state, int profile,
             boolean suppressNoisyIntent, int a2dpVolume) {
-        if (state == BluetoothProfile.STATE_DISCONNECTED) {
-            return setBluetoothA2dpDeviceConnectionState(device, state, profile,
-                    suppressNoisyIntent, AudioSystem.DEVICE_NONE, a2dpVolume);
-        }
-        // state == BluetoothProfile.STATE_CONNECTED
-        synchronized (mConnectedDevices) {
-            for (int i = 0; i < mConnectedDevices.size(); i++) {
-                final DeviceInfo deviceInfo = mConnectedDevices.valueAt(i);
-                if (deviceInfo.mDeviceType != AudioSystem.DEVICE_OUT_BLUETOOTH_A2DP) {
-                    continue;
-                }
-                // If A2DP device exists, this is either an active device change or
-                // device config change
-                final String existingDevicekey = mConnectedDevices.keyAt(i);
-                final String deviceName = device.getName();
-                final String address = device.getAddress();
-                final String newDeviceKey = DeviceInfo.makeDeviceListKey(
-                        AudioSystem.DEVICE_OUT_BLUETOOTH_A2DP, address);
-                int a2dpCodec = mDeviceBroker.getA2dpCodec(device);
-                // Device not equal to existing device, active device change
-                if (!TextUtils.equals(existingDevicekey, newDeviceKey)) {
-                    mConnectedDevices.remove(existingDevicekey);
-                    mConnectedDevices.put(newDeviceKey, new DeviceInfo(
-                            AudioSystem.DEVICE_OUT_BLUETOOTH_A2DP, deviceName,
-                            address, a2dpCodec));
-                    mDeviceBroker.postA2dpActiveDeviceChange(
-                            new BtHelper.BluetoothA2dpDeviceInfo(
-                                    device, a2dpVolume, a2dpCodec));
-                    return 0;
-                } else {
-                    // Device config change for existing device
-                    mDeviceBroker.postBluetoothA2dpDeviceConfigChange(device);
-                    return 0;
+        // method was added by QC but never used, and now conflicts with async behavior of
+        // handleBluetoothA2dpDeviceConfigChange and
+        // setBluetoothA2dpDeviceConnectionStateSuppressNoisyIntent
+        if (false) {
+            if (state == BluetoothProfile.STATE_DISCONNECTED) {
+                setBluetoothA2dpDeviceConnectionState(device, state, profile,
+                        suppressNoisyIntent, AudioSystem.DEVICE_NONE, a2dpVolume);
+            }
+            // state == BluetoothProfile.STATE_CONNECTED
+            synchronized (mConnectedDevices) {
+                for (int i = 0; i < mConnectedDevices.size(); i++) {
+                    final DeviceInfo deviceInfo = mConnectedDevices.valueAt(i);
+                    if (deviceInfo.mDeviceType != AudioSystem.DEVICE_OUT_BLUETOOTH_A2DP) {
+                        continue;
+                    }
+                    // If A2DP device exists, this is either an active device change or
+                    // device config change
+                    final String existingDevicekey = mConnectedDevices.keyAt(i);
+                    final String deviceName = device.getName();
+                    final String address = device.getAddress();
+                    final String newDeviceKey = DeviceInfo.makeDeviceListKey(
+                            AudioSystem.DEVICE_OUT_BLUETOOTH_A2DP, address);
+                    int a2dpCodec = mDeviceBroker.getA2dpCodec(device);
+                    // Device not equal to existing device, active device change
+                    if (!TextUtils.equals(existingDevicekey, newDeviceKey)) {
+                        mConnectedDevices.remove(existingDevicekey);
+                        mConnectedDevices.put(newDeviceKey, new DeviceInfo(
+                                AudioSystem.DEVICE_OUT_BLUETOOTH_A2DP, deviceName,
+                                address, a2dpCodec));
+                        mDeviceBroker.postA2dpActiveDeviceChange(
+                                new BtHelper.BluetoothA2dpDeviceInfo(
+                                        device, a2dpVolume, a2dpCodec));
+                        return 0;
+                    } else {
+                        // Device config change for existing device
+                        mDeviceBroker.postBluetoothA2dpDeviceConfigChange(device);
+                        return 0;
+                    }
                 }
             }
         }
diff --git a/services/core/java/com/android/server/audio/AudioService.java b/services/core/java/com/android/server/audio/AudioService.java
index 5d802a7..91d19de 100644
--- a/services/core/java/com/android/server/audio/AudioService.java
+++ b/services/core/java/com/android/server/audio/AudioService.java
@@ -89,6 +89,8 @@
 import android.media.audiopolicy.AudioPolicy;
 import android.media.audiopolicy.AudioPolicyConfig;
 import android.media.audiopolicy.AudioProductStrategies;
+import android.media.audiopolicy.AudioVolumeGroup;
+import android.media.audiopolicy.AudioVolumeGroups;
 import android.media.audiopolicy.IAudioPolicyCallback;
 import android.media.projection.IMediaProjection;
 import android.media.projection.IMediaProjectionManager;
@@ -128,6 +130,7 @@
 
 import com.android.internal.annotations.GuardedBy;
 import com.android.internal.util.DumpUtils;
+import com.android.internal.util.Preconditions;
 import com.android.internal.util.XmlUtils;
 import com.android.server.EventLogTags;
 import com.android.server.LocalServices;
@@ -277,6 +280,8 @@
 
     /** @see AudioProductStrategies */
     private static AudioProductStrategies sAudioProductStrategies;
+    /** @see AudioVolumeGroups */
+    private static AudioVolumeGroups sAudioVolumeGroups;
 
     private int mMode = AudioSystem.MODE_NORMAL;
     // protects mRingerMode
@@ -629,6 +634,7 @@
         mHasVibrator = mVibrator == null ? false : mVibrator.hasVibrator();
 
         sAudioProductStrategies = new AudioProductStrategies();
+        sAudioVolumeGroups = new AudioVolumeGroups();
 
         // Initialize volume
         int maxCallVolume = SystemProperties.getInt("ro.config.vc_call_vol_steps", -1);
@@ -1002,6 +1008,14 @@
         return sAudioProductStrategies;
     }
 
+    /**
+     * @return the {@link android.media.audiopolicy.AudioVolumeGroups} discovered from the
+     * platform configuration file.
+     */
+    public @NonNull AudioVolumeGroups listAudioVolumeGroups() {
+        return sAudioVolumeGroups;
+    }
+
     private void checkAllAliasStreamVolumes() {
         synchronized (mSettingsLock) {
             synchronized (VolumeStreamState.class) {
@@ -1892,6 +1906,62 @@
         mStreamStates[stream].mute(index == 0);
     }
 
+    private void enforceModifyAudioRoutingPermission() {
+        if (mContext.checkCallingPermission(
+                    android.Manifest.permission.MODIFY_AUDIO_ROUTING)
+                != PackageManager.PERMISSION_GRANTED) {
+            throw new SecurityException("Missing MODIFY_AUDIO_ROUTING permission");
+        }
+    }
+
+    /** @see AudioManager#setVolumeIndexForAttributes(attr, int, int) */
+    public void setVolumeIndexForAttributes(@NonNull AudioAttributes attr, int index, int flags,
+                                            String callingPackage) {
+        enforceModifyAudioRoutingPermission();
+        Preconditions.checkNotNull(attr, "attr must not be null");
+        // @todo not hold the caller context, post message
+        int stream = sAudioProductStrategies.getLegacyStreamTypeForAudioAttributes(attr);
+        final int device = getDeviceForStream(stream);
+
+        int oldIndex = AudioSystem.getVolumeIndexForAttributes(attr, device);
+
+        AudioSystem.setVolumeIndexForAttributes(attr, index, device);
+
+        final int volumeGroup = sAudioProductStrategies.getVolumeGroupIdForAttributes(attr);
+        final AudioVolumeGroup avg = sAudioVolumeGroups.getById(volumeGroup);
+        if (avg == null) {
+            return;
+        }
+        for (final int groupedStream : avg.getLegacyStreamTypes()) {
+            setStreamVolume(stream, index, flags, callingPackage, callingPackage,
+                            Binder.getCallingUid());
+        }
+    }
+
+    /** @see AudioManager#getVolumeIndexForAttributes(attr) */
+    public int getVolumeIndexForAttributes(@NonNull AudioAttributes attr) {
+        enforceModifyAudioRoutingPermission();
+        Preconditions.checkNotNull(attr, "attr must not be null");
+        int stream = sAudioProductStrategies.getLegacyStreamTypeForAudioAttributes(attr);
+        final int device = getDeviceForStream(stream);
+
+        return AudioSystem.getVolumeIndexForAttributes(attr, device);
+    }
+
+    /** @see AudioManager#getMaxVolumeIndexForAttributes(attr) */
+    public int getMaxVolumeIndexForAttributes(@NonNull AudioAttributes attr) {
+        enforceModifyAudioRoutingPermission();
+        Preconditions.checkNotNull(attr, "attr must not be null");
+        return AudioSystem.getMaxVolumeIndexForAttributes(attr);
+    }
+
+    /** @see AudioManager#getMinVolumeIndexForAttributes(attr) */
+    public int getMinVolumeIndexForAttributes(@NonNull AudioAttributes attr) {
+        enforceModifyAudioRoutingPermission();
+        Preconditions.checkNotNull(attr, "attr must not be null");
+        return AudioSystem.getMinVolumeIndexForAttributes(attr);
+    }
+
     /** @see AudioManager#setStreamVolume(int, int, int) */
     public void setStreamVolume(int streamType, int index, int flags, String callingPackage) {
         if ((streamType == AudioManager.STREAM_ACCESSIBILITY) && !canChangeAccessibilityVolume()) {
@@ -3971,7 +4041,10 @@
     @Retention(RetentionPolicy.SOURCE)
     public @interface BtProfileConnectionState {}
 
-    public int setBluetoothHearingAidDeviceConnectionState(
+    /**
+     * See AudioManager.setBluetoothHearingAidDeviceConnectionState()
+     */
+    public void setBluetoothHearingAidDeviceConnectionState(
             @NonNull BluetoothDevice device, @BtProfileConnectionState int state,
             boolean suppressNoisyIntent, int musicDevice)
     {
@@ -3983,14 +4056,14 @@
             throw new IllegalArgumentException("Illegal BluetoothProfile state for device "
                     + " (dis)connection, got " + state);
         }
-        return mDeviceBroker.setBluetoothHearingAidDeviceConnectionState(
+        mDeviceBroker.postBluetoothHearingAidDeviceConnectionState(
                 device, state, suppressNoisyIntent, musicDevice, "AudioService");
     }
 
     /**
      * See AudioManager.setBluetoothA2dpDeviceConnectionStateSuppressNoisyIntent()
      */
-    public int setBluetoothA2dpDeviceConnectionStateSuppressNoisyIntent(
+    public void setBluetoothA2dpDeviceConnectionStateSuppressNoisyIntent(
             @NonNull BluetoothDevice device, @AudioService.BtProfileConnectionState int state,
             int profile, boolean suppressNoisyIntent, int a2dpVolume) {
         if (device == null) {
@@ -4001,7 +4074,7 @@
             throw new IllegalArgumentException("Illegal BluetoothProfile state for device "
                     + " (dis)connection, got " + state);
         }
-        return mDeviceBroker.setBluetoothA2dpDeviceConnectionStateSuppressNoisyIntent(device, state,
+        mDeviceBroker.postBluetoothA2dpDeviceConnectionStateSuppressNoisyIntent(device, state,
                 profile, suppressNoisyIntent, a2dpVolume);
     }
 
@@ -4024,6 +4097,9 @@
     public int handleBluetoothA2dpActiveDeviceChange(
             BluetoothDevice device, int state, int profile, boolean suppressNoisyIntent,
             int a2dpVolume) {
+        // FIXME method was added by @a8439e2 but never used, and now conflicts with async behavior
+        //   of handleBluetoothA2dpDeviceConfigChange and
+        //   setBluetoothA2dpDeviceConnectionStateSuppressNoisyIntent
         if (device == null) {
             throw new IllegalArgumentException("Illegal null device");
         }
diff --git a/services/core/java/com/android/server/audio/BtHelper.java b/services/core/java/com/android/server/audio/BtHelper.java
index 58c1882..04073cb 100644
--- a/services/core/java/com/android/server/audio/BtHelper.java
+++ b/services/core/java/com/android/server/audio/BtHelper.java
@@ -426,7 +426,7 @@
         final BluetoothDevice btDevice = deviceList.get(0);
         final @BluetoothProfile.BtProfileState int state =
                 mHearingAid.getConnectionState(btDevice);
-        mDeviceBroker.setBluetoothHearingAidDeviceConnectionState(
+        mDeviceBroker.postBluetoothHearingAidDeviceConnectionState(
                 btDevice, state,
                 /*suppressNoisyIntent*/ false,
                 /*musicDevice*/ android.media.AudioSystem.DEVICE_NONE,
diff --git a/services/core/java/com/android/server/biometrics/BiometricServiceBase.java b/services/core/java/com/android/server/biometrics/BiometricServiceBase.java
index 92a8d93..d787758 100644
--- a/services/core/java/com/android/server/biometrics/BiometricServiceBase.java
+++ b/services/core/java/com/android/server/biometrics/BiometricServiceBase.java
@@ -542,6 +542,9 @@
                     + " failed to respond to cancel, starting client "
                     + (mPendingClient != null ? mPendingClient.getOwnerString() : "null"));
 
+            StatsLog.write(StatsLog.BIOMETRIC_SYSTEM_HEALTH_ISSUE_DETECTED,
+                    statsModality(), BiometricsProtoEnums.ISSUE_CANCEL_TIMED_OUT);
+
             mCurrentClient = null;
             startClient(mPendingClient, false);
         }
@@ -817,6 +820,7 @@
         mHandler.post(() -> {
             ClientMonitor client = mCurrentClient;
             if (client instanceof EnrollClient && client.getToken() == token) {
+                if (DEBUG) Slog.v(getTag(), "Cancelling enrollment");
                 client.stop(client.getToken() == token);
             }
         });
diff --git a/services/core/java/com/android/server/biometrics/ClientMonitor.java b/services/core/java/com/android/server/biometrics/ClientMonitor.java
index 89fa2de..87b9eaa 100644
--- a/services/core/java/com/android/server/biometrics/ClientMonitor.java
+++ b/services/core/java/com/android/server/biometrics/ClientMonitor.java
@@ -158,6 +158,7 @@
      */
     public boolean onAcquired(int acquiredInfo, int vendorCode) {
         super.logOnAcquired(acquiredInfo, vendorCode, getTargetUserId());
+        if (DEBUG) Slog.v(getLogTag(), "Acquired: " + acquiredInfo + " " + vendorCode);
         try {
             if (mListener != null) {
                 mListener.onAcquired(getHalDeviceId(), acquiredInfo, vendorCode);
diff --git a/services/core/java/com/android/server/biometrics/EnrollClient.java b/services/core/java/com/android/server/biometrics/EnrollClient.java
index 882a929..d5e626a 100644
--- a/services/core/java/com/android/server/biometrics/EnrollClient.java
+++ b/services/core/java/com/android/server/biometrics/EnrollClient.java
@@ -76,7 +76,10 @@
         }
         mMetricsLogger.action(mMetrics.actionBiometricEnroll());
         try {
-            getListener().onEnrollResult(identifier, remaining);
+            final BiometricServiceBase.ServiceListener listener = getListener();
+            if (listener != null) {
+                listener.onEnrollResult(identifier, remaining);
+            }
             return remaining == 0;
         } catch (RemoteException e) {
             Slog.w(getLogTag(), "Failed to notify EnrollResult:", e);
diff --git a/services/core/java/com/android/server/biometrics/face/FaceService.java b/services/core/java/com/android/server/biometrics/face/FaceService.java
index d2d1482..feeb16b 100644
--- a/services/core/java/com/android/server/biometrics/face/FaceService.java
+++ b/services/core/java/com/android/server/biometrics/face/FaceService.java
@@ -32,6 +32,7 @@
 import android.hardware.biometrics.IBiometricServiceReceiverInternal;
 import android.hardware.biometrics.face.V1_0.IBiometricsFace;
 import android.hardware.biometrics.face.V1_0.IBiometricsFaceClientCallback;
+import android.hardware.biometrics.face.V1_0.OptionalBool;
 import android.hardware.biometrics.face.V1_0.Status;
 import android.hardware.face.Face;
 import android.hardware.face.FaceManager;
@@ -54,7 +55,6 @@
 import com.android.server.biometrics.AuthenticationClient;
 import com.android.server.biometrics.BiometricServiceBase;
 import com.android.server.biometrics.BiometricUtils;
-import com.android.server.biometrics.ClientMonitor;
 import com.android.server.biometrics.EnumerateClient;
 import com.android.server.biometrics.Metrics;
 import com.android.server.biometrics.RemovalClient;
@@ -385,38 +385,61 @@
         }
 
         @Override
-        public int setFeature(int feature, boolean enabled, final byte[] token) {
+        public boolean setFeature(int feature, boolean enabled, final byte[] token) {
             checkPermission(MANAGE_BIOMETRIC);
 
+            if (!FaceService.this.hasEnrolledBiometrics(mCurrentUserId)) {
+                Slog.e(TAG, "No enrolled biometrics while setting feature: " + feature);
+                return false;
+            }
+
             final ArrayList<Byte> byteToken = new ArrayList<>();
             for (int i = 0; i < token.length; i++) {
                 byteToken.add(token[i]);
             }
 
-            int result;
-            try {
-                result = mDaemon != null ? mDaemon.setFeature(feature, enabled, byteToken)
-                        : Status.INTERNAL_ERROR;
-            } catch (RemoteException e) {
-                Slog.e(getTag(), "Unable to set feature: " + feature + " to enabled:" + enabled,
-                        e);
-                result = Status.INTERNAL_ERROR;
-            }
+            // TODO: Support multiple faces
+            final int faceId = getFirstTemplateForUser(mCurrentUserId);
 
-            return result;
+            if (mDaemon != null) {
+                try {
+                    return mDaemon.setFeature(feature, enabled, byteToken, faceId) == Status.OK;
+                } catch (RemoteException e) {
+                    Slog.e(getTag(), "Unable to set feature: " + feature + " to enabled:" + enabled,
+                            e);
+                }
+            }
+            return false;
         }
 
         @Override
         public boolean getFeature(int feature) {
             checkPermission(MANAGE_BIOMETRIC);
 
-            boolean result = true;
-            try {
-                result = mDaemon != null ? mDaemon.getFeature(feature) : true;
-            } catch (RemoteException e) {
-                Slog.e(getTag(), "Unable to getRequireAttention", e);
+            // This should ideally return tri-state, but the user isn't shown settings unless
+            // they are enrolled so it's fine for now.
+            if (!FaceService.this.hasEnrolledBiometrics(mCurrentUserId)) {
+                Slog.e(TAG, "No enrolled biometrics while getting feature: " + feature);
+                return false;
             }
-            return result;
+
+            // TODO: Support multiple faces
+            final int faceId = getFirstTemplateForUser(mCurrentUserId);
+
+            if (mDaemon != null) {
+                try {
+                    OptionalBool result = mDaemon.getFeature(feature, faceId);
+                    if (result.status == Status.OK) {
+                        return result.value;
+                    } else {
+                        // Same tri-state comment applies here.
+                        return false;
+                    }
+                } catch (RemoteException e) {
+                    Slog.e(getTag(), "Unable to getRequireAttention", e);
+                }
+            }
+            return false;
         }
 
         @Override
@@ -431,6 +454,15 @@
                 }
             }
         }
+
+        // TODO: Support multiple faces
+        private int getFirstTemplateForUser(int user) {
+            final List<Face> faces = FaceService.this.getEnrolledTemplates(user);
+            if (!faces.isEmpty()) {
+                return faces.get(0).getBiometricId();
+            }
+            return 0;
+        }
     }
 
     /**
diff --git a/services/core/java/com/android/server/connectivity/Nat464Xlat.java b/services/core/java/com/android/server/connectivity/Nat464Xlat.java
index 9d9b1cf..2646d76 100644
--- a/services/core/java/com/android/server/connectivity/Nat464Xlat.java
+++ b/services/core/java/com/android/server/connectivity/Nat464Xlat.java
@@ -18,19 +18,24 @@
 
 import android.net.ConnectivityManager;
 import android.net.INetd;
+import android.net.InetAddresses;
 import android.net.InterfaceConfiguration;
+import android.net.IpPrefix;
 import android.net.LinkAddress;
 import android.net.LinkProperties;
 import android.net.NetworkInfo;
 import android.net.RouteInfo;
 import android.os.INetworkManagementService;
 import android.os.RemoteException;
+import android.os.ServiceSpecificException;
 import android.util.Slog;
 
+import com.android.internal.annotations.VisibleForTesting;
 import com.android.internal.util.ArrayUtils;
 import com.android.server.net.BaseNetworkObserver;
 
 import java.net.Inet4Address;
+import java.net.Inet6Address;
 import java.util.Objects;
 
 /**
@@ -67,15 +72,16 @@
     private final NetworkAgentInfo mNetwork;
 
     private enum State {
-        IDLE,       // start() not called. Base iface and stacked iface names are null.
-        STARTING,   // start() called. Base iface and stacked iface names are known.
-        RUNNING,    // start() called, and the stacked iface is known to be up.
-        STOPPING;   // stop() called, this Nat464Xlat is still registered as a network observer for
-                    // the stacked interface.
+        IDLE,         // start() not called. Base iface and stacked iface names are null.
+        DISCOVERING,  // same as IDLE, except prefix discovery in progress.
+        STARTING,     // start() called. Base iface and stacked iface names are known.
+        RUNNING,      // start() called, and the stacked iface is known to be up.
     }
 
+    private IpPrefix mNat64Prefix;
     private String mBaseIface;
     private String mIface;
+    private Inet6Address mIPv6Address;
     private State mState = State.IDLE;
 
     public Nat464Xlat(NetworkAgentInfo nai, INetd netd, INetworkManagementService nmService) {
@@ -85,20 +91,51 @@
     }
 
     /**
-     * Determines whether a network requires clat.
+     * Whether to attempt 464xlat on this network. This is true for an IPv6-only network that is
+     * currently connected and where the NetworkAgent has not disabled 464xlat. It is the signal to
+     * enable NAT64 prefix discovery.
+     *
      * @param network the NetworkAgentInfo corresponding to the network.
      * @return true if the network requires clat, false otherwise.
      */
-    public static boolean requiresClat(NetworkAgentInfo nai) {
+    @VisibleForTesting
+    protected static boolean requiresClat(NetworkAgentInfo nai) {
         // TODO: migrate to NetworkCapabilities.TRANSPORT_*.
         final boolean supported = ArrayUtils.contains(NETWORK_TYPES, nai.networkInfo.getType());
         final boolean connected = ArrayUtils.contains(NETWORK_STATES, nai.networkInfo.getState());
-        // We only run clat on networks that don't have a native IPv4 address.
-        final boolean hasIPv4Address =
-                (nai.linkProperties != null) && nai.linkProperties.hasIPv4Address();
-        final boolean skip464xlat =
-                (nai.netMisc() != null) && nai.netMisc().skip464xlat;
-        return supported && connected && !hasIPv4Address && !skip464xlat;
+
+        // Only run clat on networks that have a global IPv6 address and don't have a native IPv4
+        // address.
+        LinkProperties lp = nai.linkProperties;
+        final boolean isIpv6OnlyNetwork = (lp != null) && lp.hasGlobalIPv6Address()
+                && !lp.hasIPv4Address();
+
+        // If the network tells us it doesn't use clat, respect that.
+        final boolean skip464xlat = (nai.netMisc() != null) && nai.netMisc().skip464xlat;
+
+        return supported && connected && isIpv6OnlyNetwork && !skip464xlat;
+    }
+
+    /**
+     * Whether the clat demon should be started on this network now. This is true if requiresClat is
+     * true and a NAT64 prefix has been discovered.
+     *
+     * @param nai the NetworkAgentInfo corresponding to the network.
+     * @return true if the network should start clat, false otherwise.
+     */
+    @VisibleForTesting
+    protected static boolean shouldStartClat(NetworkAgentInfo nai) {
+        LinkProperties lp = nai.linkProperties;
+        return requiresClat(nai) && lp != null && lp.getNat64Prefix() != null;
+    }
+
+    /**
+     * @return true if we have started prefix discovery and not yet stopped it (regardless of
+     * whether it is still running or has succeeded).
+     * A true result corresponds to internal states DISCOVERING, STARTING and RUNNING.
+     */
+    public boolean isPrefixDiscoveryStarted() {
+        return mState == State.DISCOVERING || isStarted();
     }
 
     /**
@@ -106,7 +143,7 @@
      * A true result corresponds to internal states STARTING and RUNNING.
      */
     public boolean isStarted() {
-        return mState != State.IDLE;
+        return (mState == State.STARTING || mState == State.RUNNING);
     }
 
     /**
@@ -124,32 +161,31 @@
     }
 
     /**
-     * @return true if clatd has been stopped.
-     */
-    public boolean isStopping() {
-        return mState == State.STOPPING;
-    }
-
-    /**
      * Start clatd, register this Nat464Xlat as a network observer for the stacked interface,
      * and set internal state.
      */
     private void enterStartingState(String baseIface) {
         try {
             mNMService.registerObserver(this);
-        } catch(RemoteException e) {
-            Slog.e(TAG,
-                    "startClat: Can't register interface observer for clat on " + mNetwork.name());
+        } catch (RemoteException e) {
+            Slog.e(TAG, "Can't register interface observer for clat on " + mNetwork.name());
             return;
         }
+
+        String addrStr = null;
         try {
-            mNetd.clatdStart(baseIface);
-        } catch(RemoteException|IllegalStateException e) {
-            Slog.e(TAG, "Error starting clatd on " + baseIface, e);
+            addrStr = mNetd.clatdStart(baseIface, mNat64Prefix.toString());
+        } catch (RemoteException | ServiceSpecificException e) {
+            Slog.e(TAG, "Error starting clatd on " + baseIface + ": " + e);
         }
         mIface = CLAT_PREFIX + baseIface;
         mBaseIface = baseIface;
         mState = State.STARTING;
+        try {
+            mIPv6Address = (Inet6Address) InetAddresses.parseNumericAddress(addrStr);
+        } catch (ClassCastException | IllegalArgumentException | NullPointerException e) {
+            Slog.e(TAG, "Invalid IPv6 address " + addrStr);
+        }
     }
 
     /**
@@ -161,37 +197,27 @@
     }
 
     /**
-     * Stop clatd, and turn ND offload on if it had been turned off.
-     */
-    private void enterStoppingState() {
-        try {
-            mNetd.clatdStop(mBaseIface);
-        } catch(RemoteException|IllegalStateException e) {
-            Slog.e(TAG, "Error stopping clatd on " + mBaseIface, e);
-        }
-
-        mState = State.STOPPING;
-    }
-
-    /**
      * Unregister as a base observer for the stacked interface, and clear internal state.
      */
-    private void enterIdleState() {
+    private void leaveStartedState() {
         try {
             mNMService.unregisterObserver(this);
-        } catch(RemoteException|IllegalStateException e) {
-            Slog.e(TAG, "Error unregistering clatd observer on " + mBaseIface, e);
+        } catch (RemoteException | IllegalStateException e) {
+            Slog.e(TAG, "Error unregistering clatd observer on " + mBaseIface + ": " + e);
         }
-
         mIface = null;
         mBaseIface = null;
         mState = State.IDLE;
+        if (requiresClat(mNetwork)) {
+            mState = State.DISCOVERING;
+        } else {
+            stopPrefixDiscovery();
+            mState = State.IDLE;
+        }
     }
 
-    /**
-     * Starts the clat daemon.
-     */
-    public void start() {
+    @VisibleForTesting
+    protected void start() {
         if (isStarted()) {
             Slog.e(TAG, "startClat: already started");
             return;
@@ -212,20 +238,82 @@
         enterStartingState(baseIface);
     }
 
-    /**
-     * Stops the clat daemon.
-     */
-    public void stop() {
+    @VisibleForTesting
+    protected void stop() {
         if (!isStarted()) {
+            Slog.e(TAG, "stopClat: already stopped");
             return;
         }
-        Slog.i(TAG, "Stopping clatd on " + mBaseIface);
 
-        boolean wasStarting = isStarting();
-        enterStoppingState();
-        if (wasStarting) {
-            enterIdleState();
+        Slog.i(TAG, "Stopping clatd on " + mBaseIface);
+        try {
+            mNetd.clatdStop(mBaseIface);
+        } catch (RemoteException | ServiceSpecificException e) {
+            Slog.e(TAG, "Error stopping clatd on " + mBaseIface + ": " + e);
         }
+
+        String iface = mIface;
+        boolean wasRunning = isRunning();
+
+        // Change state before updating LinkProperties. handleUpdateLinkProperties ends up calling
+        // fixupLinkProperties, and if at that time the state is still RUNNING, fixupLinkProperties
+        // would wrongly inform ConnectivityService that there is still a stacked interface.
+        leaveStartedState();
+
+        if (wasRunning) {
+            LinkProperties lp = new LinkProperties(mNetwork.linkProperties);
+            lp.removeStackedLink(iface);
+            mNetwork.connService().handleUpdateLinkProperties(mNetwork, lp);
+        }
+    }
+
+    private void startPrefixDiscovery() {
+        try {
+            mNetd.resolverStartPrefix64Discovery(getNetId());
+            mState = State.DISCOVERING;
+        } catch (RemoteException | ServiceSpecificException e) {
+            Slog.e(TAG, "Error starting prefix discovery on netId " + getNetId() + ": " + e);
+        }
+    }
+
+    private void stopPrefixDiscovery() {
+        try {
+            mNetd.resolverStopPrefix64Discovery(getNetId());
+        } catch (RemoteException | ServiceSpecificException e) {
+            Slog.e(TAG, "Error stopping prefix discovery on netId " + getNetId() + ": " + e);
+        }
+    }
+
+    /**
+     * Starts/stops NAT64 prefix discovery and clatd as necessary.
+     */
+    public void update() {
+        // TODO: turn this class into a proper StateMachine. // http://b/126113090
+        if (requiresClat(mNetwork)) {
+            if (!isPrefixDiscoveryStarted()) {
+                startPrefixDiscovery();
+            } else if (shouldStartClat(mNetwork)) {
+                // NAT64 prefix detected. Start clatd.
+                // TODO: support the NAT64 prefix changing after it's been discovered. There is no
+                // need to support this at the moment because it cannot happen without changes to
+                // the Dns64Configuration code in netd.
+                start();
+            } else {
+                // NAT64 prefix removed. Stop clatd and go back into DISCOVERING state.
+                stop();
+            }
+        } else {
+            // Network no longer requires clat. Stop clat and prefix discovery.
+            if (isStarted()) {
+                stop();
+            } else if (isPrefixDiscoveryStarted()) {
+                leaveStartedState();
+            }
+        }
+    }
+
+    public void setNat64Prefix(IpPrefix nat64Prefix) {
+        mNat64Prefix = nat64Prefix;
     }
 
     /**
@@ -234,6 +322,8 @@
      * has no idea that 464xlat is running on top of it.
      */
     public void fixupLinkProperties(LinkProperties oldLp, LinkProperties lp) {
+        lp.setNat64Prefix(mNat64Prefix);
+
         if (!isRunning()) {
             return;
         }
@@ -272,7 +362,7 @@
         try {
             InterfaceConfiguration config = mNMService.getInterfaceConfig(iface);
             return config.getLinkAddress();
-        } catch(RemoteException|IllegalStateException e) {
+        } catch (RemoteException | IllegalStateException e) {
             Slog.e(TAG, "Error getting link properties: " + e);
             return null;
         }
@@ -282,6 +372,20 @@
      * Adds stacked link on base link and transitions to RUNNING state.
      */
     private void handleInterfaceLinkStateChanged(String iface, boolean up) {
+        // TODO: if we call start(), then stop(), then start() again, and the
+        // interfaceLinkStateChanged notification for the first start is delayed past the first
+        // stop, then the code becomes out of sync with system state and will behave incorrectly.
+        //
+        // This is not trivial to fix because:
+        // 1. It is not guaranteed that start() will eventually result in the interface coming up,
+        //    because there could be an error starting clat (e.g., if the interface goes down before
+        //    the packet socket can be bound).
+        // 2. If start is called multiple times, there is nothing in the interfaceLinkStateChanged
+        //    notification that says which start() call the interface was created by.
+        //
+        // Once this code is converted to StateMachine, it will be possible to use deferMessage to
+        // ensure it stays in STARTING state until the interfaceLinkStateChanged notification fires,
+        // and possibly use a timeout (or provide some guarantees at the lower layer) to address #1.
         if (!isStarting() || !up || !Objects.equals(mIface, iface)) {
             return;
         }
@@ -307,20 +411,16 @@
         if (!Objects.equals(mIface, iface)) {
             return;
         }
-        if (!isRunning() && !isStopping()) {
+        if (!isRunning()) {
             return;
         }
 
         Slog.i(TAG, "interface " + iface + " removed");
-        if (!isStopping()) {
-            // Ensure clatd is stopped if stop() has not been called: this likely means that clatd
-            // has crashed.
-            enterStoppingState();
-        }
-        enterIdleState();
-        LinkProperties lp = new LinkProperties(mNetwork.linkProperties);
-        lp.removeStackedLink(iface);
-        mNetwork.connService().handleUpdateLinkProperties(mNetwork, lp);
+        // If we're running, and the interface was removed, then we didn't call stop(), and it's
+        // likely that clatd crashed. Ensure we call stop() so we can start clatd again. Calling
+        // stop() will also update LinkProperties, and if clatd crashed, the LinkProperties update
+        // will cause ConnectivityService to call start() again.
+        stop();
     }
 
     @Override
@@ -337,4 +437,9 @@
     public String toString() {
         return "mBaseIface: " + mBaseIface + ", mIface: " + mIface + ", mState: " + mState;
     }
+
+    @VisibleForTesting
+    protected int getNetId() {
+        return mNetwork.network.netId;
+    }
 }
diff --git a/services/core/java/com/android/server/connectivity/NetworkAgentInfo.java b/services/core/java/com/android/server/connectivity/NetworkAgentInfo.java
index cd4ce2d..6ef9fbb 100644
--- a/services/core/java/com/android/server/connectivity/NetworkAgentInfo.java
+++ b/services/core/java/com/android/server/connectivity/NetworkAgentInfo.java
@@ -238,7 +238,7 @@
     public final int factorySerialNumber;
 
     // Used by ConnectivityService to keep track of 464xlat.
-    public Nat464Xlat clatd;
+    public final Nat464Xlat clatd;
 
     // Set after asynchronous creation of the NetworkMonitor.
     private volatile INetworkMonitor mNetworkMonitor;
@@ -246,8 +246,6 @@
     private static final String TAG = ConnectivityService.class.getSimpleName();
     private static final boolean VDBG = false;
     private final ConnectivityService mConnService;
-    private final INetd mNetd;
-    private final INetworkManagementService mNMS;
     private final Context mContext;
     private final Handler mHandler;
 
@@ -262,9 +260,8 @@
         linkProperties = lp;
         networkCapabilities = nc;
         currentScore = score;
+        clatd = new Nat464Xlat(this, netd, nms);
         mConnService = connService;
-        mNetd = netd;
-        mNMS = nms;
         mContext = context;
         mHandler = handler;
         networkMisc = misc;
@@ -598,32 +595,6 @@
         for (LingerTimer timer : mLingerTimers) { pw.println(timer); }
     }
 
-    public void updateClat(INetworkManagementService netd) {
-        if (Nat464Xlat.requiresClat(this)) {
-            maybeStartClat();
-        } else {
-            maybeStopClat();
-        }
-    }
-
-    /** Ensure clat has started for this network. */
-    public void maybeStartClat() {
-        if (clatd != null && clatd.isStarted()) {
-            return;
-        }
-        clatd = new Nat464Xlat(this, mNetd, mNMS);
-        clatd.start();
-    }
-
-    /** Ensure clat has stopped for this network. */
-    public void maybeStopClat() {
-        if (clatd == null) {
-            return;
-        }
-        clatd.stop();
-        clatd = null;
-    }
-
     public String toString() {
         return "NetworkAgentInfo{ ni{" + networkInfo + "}  "
                 + "network{" + network + "}  nethandle{" + network.getNetworkHandle() + "}  "
diff --git a/services/core/java/com/android/server/connectivity/PacManager.java b/services/core/java/com/android/server/connectivity/PacManager.java
index 9789688..1ac09ad 100644
--- a/services/core/java/com/android/server/connectivity/PacManager.java
+++ b/services/core/java/com/android/server/connectivity/PacManager.java
@@ -70,9 +70,8 @@
     private static final long MAX_PAC_SIZE = 20 * 1000 * 1000;
 
     // Return values for #setCurrentProxyScriptUrl
-    enum ToSendOrNotToSendBroadcast {
-        DONT_SEND_BROADCAST, DO_SEND_BROADCAST
-    }
+    public static final boolean DONT_SEND_BROADCAST = false;
+    public static final boolean DO_SEND_BROADCAST = true;
 
     private String mCurrentPac;
     @GuardedBy("mProxyLock")
@@ -176,11 +175,11 @@
      * @param proxy Proxy information that is about to be broadcast.
      * @return Returns whether the broadcast should be sent : either DO_ or DONT_SEND_BROADCAST
      */
-    synchronized ToSendOrNotToSendBroadcast setCurrentProxyScriptUrl(ProxyInfo proxy) {
+    synchronized boolean setCurrentProxyScriptUrl(ProxyInfo proxy) {
         if (!Uri.EMPTY.equals(proxy.getPacFileUrl())) {
             if (proxy.getPacFileUrl().equals(mPacUrl) && (proxy.getPort() > 0)) {
                 // Allow to send broadcast, nothing to do.
-                return ToSendOrNotToSendBroadcast.DO_SEND_BROADCAST;
+                return DO_SEND_BROADCAST;
             }
             mPacUrl = proxy.getPacFileUrl();
             mCurrentDelay = DELAY_1;
@@ -188,7 +187,7 @@
             mHasDownloaded = false;
             getAlarmManager().cancel(mPacRefreshIntent);
             bind();
-            return ToSendOrNotToSendBroadcast.DONT_SEND_BROADCAST;
+            return DONT_SEND_BROADCAST;
         } else {
             getAlarmManager().cancel(mPacRefreshIntent);
             synchronized (mProxyLock) {
@@ -204,7 +203,7 @@
                     }
                 }
             }
-            return ToSendOrNotToSendBroadcast.DO_SEND_BROADCAST;
+            return DO_SEND_BROADCAST;
         }
     }
 
diff --git a/services/core/java/com/android/server/connectivity/ProxyTracker.java b/services/core/java/com/android/server/connectivity/ProxyTracker.java
index a671287..e715890 100644
--- a/services/core/java/com/android/server/connectivity/ProxyTracker.java
+++ b/services/core/java/com/android/server/connectivity/ProxyTracker.java
@@ -208,8 +208,7 @@
     public void sendProxyBroadcast() {
         final ProxyInfo defaultProxy = getDefaultProxy();
         final ProxyInfo proxyInfo = null != defaultProxy ? defaultProxy : new ProxyInfo("", 0, "");
-        if (mPacManager.setCurrentProxyScriptUrl(proxyInfo)
-                == PacManager.ToSendOrNotToSendBroadcast.DONT_SEND_BROADCAST) {
+        if (mPacManager.setCurrentProxyScriptUrl(proxyInfo) == PacManager.DONT_SEND_BROADCAST) {
             return;
         }
         if (DBG) Slog.d(TAG, "sending Proxy Broadcast for " + proxyInfo);
diff --git a/services/core/java/com/android/server/connectivity/TcpKeepaliveController.java b/services/core/java/com/android/server/connectivity/TcpKeepaliveController.java
index 8a9ac23..65de83b 100644
--- a/services/core/java/com/android/server/connectivity/TcpKeepaliveController.java
+++ b/services/core/java/com/android/server/connectivity/TcpKeepaliveController.java
@@ -16,10 +16,12 @@
 package com.android.server.connectivity;
 
 import static android.net.SocketKeepalive.DATA_RECEIVED;
+import static android.net.SocketKeepalive.ERROR_HARDWARE_UNSUPPORTED;
 import static android.net.SocketKeepalive.ERROR_INVALID_SOCKET;
 import static android.net.SocketKeepalive.ERROR_SOCKET_NOT_IDLE;
 import static android.os.MessageQueue.OnFileDescriptorEventListener.EVENT_ERROR;
 import static android.os.MessageQueue.OnFileDescriptorEventListener.EVENT_INPUT;
+import static android.system.OsConstants.ENOPROTOOPT;
 import static android.system.OsConstants.FIONREAD;
 import static android.system.OsConstants.IPPROTO_TCP;
 import static android.system.OsConstants.TIOCOUTQ;
@@ -179,12 +181,13 @@
             trw = NetworkUtils.getTcpRepairWindow(fd);
         } catch (ErrnoException e) {
             Log.e(TAG, "Exception reading TCP state from socket", e);
-            try {
-                Os.setsockoptInt(fd, IPPROTO_TCP, TCP_REPAIR, TCP_REPAIR_OFF);
-            } catch (ErrnoException ex) {
-                Log.e(TAG, "Exception while turning off repair mode due to exception", ex);
+            if (e.errno == ENOPROTOOPT) {
+                // ENOPROTOOPT may happen in kernel version lower than 4.8.
+                // Treat it as ERROR_HARDWARE_UNSUPPORTED.
+                throw new InvalidSocketException(ERROR_HARDWARE_UNSUPPORTED, e);
+            } else {
+                throw new InvalidSocketException(ERROR_INVALID_SOCKET, e);
             }
-            throw new InvalidSocketException(ERROR_INVALID_SOCKET, e);
         } finally {
             dropAllIncomingPackets(fd, false);
         }
diff --git a/services/core/java/com/android/server/connectivity/Tethering.java b/services/core/java/com/android/server/connectivity/Tethering.java
index c91e1a1..35704d40 100644
--- a/services/core/java/com/android/server/connectivity/Tethering.java
+++ b/services/core/java/com/android/server/connectivity/Tethering.java
@@ -62,6 +62,7 @@
 import android.hardware.usb.UsbManager;
 import android.net.INetworkPolicyManager;
 import android.net.INetworkStatsService;
+import android.net.ITetheringEventCallback;
 import android.net.IpPrefix;
 import android.net.LinkAddress;
 import android.net.LinkProperties;
@@ -82,6 +83,7 @@
 import android.os.Looper;
 import android.os.Message;
 import android.os.Parcel;
+import android.os.RemoteCallbackList;
 import android.os.RemoteException;
 import android.os.ResultReceiver;
 import android.os.UserHandle;
@@ -184,6 +186,9 @@
     private final VersionedBroadcastListener mDefaultSubscriptionChange;
     private final TetheringDependencies mDeps;
     private final EntitlementManager mEntitlementMgr;
+    private final Handler mHandler;
+    private final RemoteCallbackList<ITetheringEventCallback> mTetheringEventCallbacks =
+            new RemoteCallbackList<>();
 
     private volatile TetheringConfiguration mConfig;
     private InterfaceSet mCurrentUpstreamIfaceSet;
@@ -193,6 +198,7 @@
     private boolean mRndisEnabled;       // track the RNDIS function enabled state
     // True iff. WiFi tethering should be started when soft AP is ready.
     private boolean mWifiTetherRequested;
+    private Network mTetherUpstream;
 
     public Tethering(Context context, INetworkManagementService nmService,
             INetworkStatsService statsService, INetworkPolicyManager policyManager,
@@ -213,9 +219,9 @@
         mTetherMasterSM = new TetherMasterSM("TetherMaster", mLooper, deps);
         mTetherMasterSM.start();
 
-        final Handler smHandler = mTetherMasterSM.getHandler();
-        mOffloadController = new OffloadController(smHandler,
-                mDeps.getOffloadHardwareInterface(smHandler, mLog),
+        mHandler = mTetherMasterSM.getHandler();
+        mOffloadController = new OffloadController(mHandler,
+                mDeps.getOffloadHardwareInterface(mHandler, mLog),
                 mContext.getContentResolver(), mNMService,
                 mLog);
         mUpstreamNetworkMonitor = deps.getUpstreamNetworkMonitor(mContext, mTetherMasterSM, mLog,
@@ -227,7 +233,7 @@
         mEntitlementMgr = mDeps.getEntitlementManager(mContext, mTetherMasterSM,
                 mLog, systemProperties);
         mCarrierConfigChange = new VersionedBroadcastListener(
-                "CarrierConfigChangeListener", mContext, smHandler, filter,
+                "CarrierConfigChangeListener", mContext, mHandler, filter,
                 (Intent ignored) -> {
                     mLog.log("OBSERVED carrier config change");
                     updateConfiguration();
@@ -237,7 +243,7 @@
         filter = new IntentFilter();
         filter.addAction(TelephonyIntents.ACTION_DEFAULT_DATA_SUBSCRIPTION_CHANGED);
         mDefaultSubscriptionChange = new VersionedBroadcastListener(
-                "DefaultSubscriptionChangeListener", mContext, smHandler, filter,
+                "DefaultSubscriptionChangeListener", mContext, mHandler, filter,
                 (Intent ignored) -> {
                     mLog.log("OBSERVED default data subscription change");
                     updateConfiguration();
@@ -248,14 +254,13 @@
         // Load tethering configuration.
         updateConfiguration();
 
-        startStateMachineUpdaters();
+        startStateMachineUpdaters(mHandler);
     }
 
-    private void startStateMachineUpdaters() {
+    private void startStateMachineUpdaters(Handler handler) {
         mCarrierConfigChange.startListening();
         mDefaultSubscriptionChange.startListening();
 
-        final Handler handler = mTetherMasterSM.getHandler();
         IntentFilter filter = new IntentFilter();
         filter.addAction(UsbManager.ACTION_USB_STATE);
         filter.addAction(CONNECTIVITY_ACTION);
@@ -289,8 +294,8 @@
     }
 
     private void maybeUpdateConfiguration() {
-        final int dunCheck = TetheringConfiguration.checkDunRequired(mContext);
-        if (dunCheck == mConfig.dunCheck) return;
+        final boolean isDunRequired = TetheringConfiguration.checkDunRequired(mContext);
+        if (isDunRequired == mConfig.isDunRequired) return;
         updateConfiguration();
     }
 
@@ -1229,8 +1234,13 @@
                     sendMessageDelayed(CMD_RETRY_UPSTREAM, UPSTREAM_SETTLE_TIME_MS);
                 }
             }
-            mUpstreamNetworkMonitor.setCurrentUpstream((ns != null) ? ns.network : null);
             setUpstreamNetwork(ns);
+            final Network newUpstream = (ns != null) ? ns.network : null;
+            if (mTetherUpstream != newUpstream) {
+                mTetherUpstream = newUpstream;
+                mUpstreamNetworkMonitor.setCurrentUpstream(mTetherUpstream);
+                reportUpstreamChanged(mTetherUpstream);
+            }
         }
 
         protected void setUpstreamNetwork(NetworkState ns) {
@@ -1413,6 +1423,10 @@
                 mUpstreamNetworkMonitor.stop();
                 notifyDownstreamsOfNewUpstreamIface(null);
                 handleNewUpstreamNetworkState(null);
+                if (mTetherUpstream != null) {
+                    mTetherUpstream = null;
+                    reportUpstreamChanged(null);
+                }
             }
 
             private boolean updateUpstreamWanted() {
@@ -1677,10 +1691,44 @@
     }
 
     /** Get the latest value of the tethering entitlement check. */
-    public void getLatestTetheringEntitlementValue(int type, ResultReceiver receiver,
+    public void getLatestTetheringEntitlementResult(int type, ResultReceiver receiver,
             boolean showEntitlementUi) {
         if (receiver != null) {
-            mEntitlementMgr.getLatestTetheringEntitlementValue(type, receiver, showEntitlementUi);
+            mEntitlementMgr.getLatestTetheringEntitlementResult(type, receiver, showEntitlementUi);
+        }
+    }
+
+    /** Register tethering event callback */
+    public void registerTetheringEventCallback(ITetheringEventCallback callback) {
+        mHandler.post(() -> {
+            try {
+                callback.onUpstreamChanged(mTetherUpstream);
+            } catch (RemoteException e) {
+                // Not really very much to do here.
+            }
+            mTetheringEventCallbacks.register(callback);
+        });
+    }
+
+    /** Unregister tethering event callback */
+    public void unregisterTetheringEventCallback(ITetheringEventCallback callback) {
+        mHandler.post(() -> {
+            mTetheringEventCallbacks.unregister(callback);
+        });
+    }
+
+    private void reportUpstreamChanged(Network network) {
+        final int length = mTetheringEventCallbacks.beginBroadcast();
+        try {
+            for (int i = 0; i < length; i++) {
+                try {
+                    mTetheringEventCallbacks.getBroadcastItem(i).onUpstreamChanged(network);
+                } catch (RemoteException e) {
+                    // Not really very much to do here.
+                }
+            }
+        } finally {
+            mTetheringEventCallbacks.finishBroadcast();
         }
     }
 
diff --git a/services/core/java/com/android/server/connectivity/Vpn.java b/services/core/java/com/android/server/connectivity/Vpn.java
index 59fffb4..8005dda 100644
--- a/services/core/java/com/android/server/connectivity/Vpn.java
+++ b/services/core/java/com/android/server/connectivity/Vpn.java
@@ -1842,6 +1842,7 @@
         config.interfaze = iface;
         config.session = profile.name;
         config.isMetered = false;
+        config.proxyInfo = profile.proxy;
 
         config.addLegacyRoutes(profile.routes);
         if (!profile.dnsServers.isEmpty()) {
diff --git a/services/core/java/com/android/server/connectivity/tethering/EntitlementManager.java b/services/core/java/com/android/server/connectivity/tethering/EntitlementManager.java
index 75aac10..65cc516 100644
--- a/services/core/java/com/android/server/connectivity/tethering/EntitlementManager.java
+++ b/services/core/java/com/android/server/connectivity/tethering/EntitlementManager.java
@@ -291,7 +291,7 @@
     }
 
     /** Get the last value of the tethering entitlement check. */
-    public void getLatestTetheringEntitlementValue(int downstream, ResultReceiver receiver,
+    public void getLatestTetheringEntitlementResult(int downstream, ResultReceiver receiver,
             boolean showEntitlementUi) {
         if (!isTetherProvisioningRequired()) {
             receiver.send(TETHER_ERROR_NO_ERROR, null);
diff --git a/services/core/java/com/android/server/connectivity/tethering/TetheringConfiguration.java b/services/core/java/com/android/server/connectivity/tethering/TetheringConfiguration.java
index 8a46ff1..935b795 100644
--- a/services/core/java/com/android/server/connectivity/tethering/TetheringConfiguration.java
+++ b/services/core/java/com/android/server/connectivity/tethering/TetheringConfiguration.java
@@ -67,11 +67,6 @@
 
     private static final String[] EMPTY_STRING_ARRAY = new String[0];
 
-    @VisibleForTesting
-    public static final int DUN_NOT_REQUIRED = 0;
-    public static final int DUN_REQUIRED = 1;
-    public static final int DUN_UNSPECIFIED = 2;
-
     // Default ranges used for the legacy DHCP server.
     // USB is  192.168.42.1 and 255.255.255.0
     // Wifi is 192.168.43.1 and 255.255.255.0
@@ -90,7 +85,6 @@
     public final String[] tetherableUsbRegexs;
     public final String[] tetherableWifiRegexs;
     public final String[] tetherableBluetoothRegexs;
-    public final int dunCheck;
     public final boolean isDunRequired;
     public final boolean chooseUpstreamAutomatically;
     public final Collection<Integer> preferredUpstreamIfaceTypes;
@@ -116,12 +110,10 @@
         tetherableWifiRegexs = getResourceStringArray(res, config_tether_wifi_regexs);
         tetherableBluetoothRegexs = getResourceStringArray(res, config_tether_bluetooth_regexs);
 
-        dunCheck = checkDunRequired(ctx);
-        configLog.log("DUN check returned: " + dunCheckString(dunCheck));
+        isDunRequired = checkDunRequired(ctx);
 
         chooseUpstreamAutomatically = getResourceBoolean(res, config_tether_upstream_automatic);
-        preferredUpstreamIfaceTypes = getUpstreamIfaceTypes(res, dunCheck);
-        isDunRequired = preferredUpstreamIfaceTypes.contains(TYPE_MOBILE_DUN);
+        preferredUpstreamIfaceTypes = getUpstreamIfaceTypes(res, isDunRequired);
 
         legacyDhcpRanges = getLegacyDhcpRanges(res);
         defaultIPv4DNS = copy(DEFAULT_IPV4_DNS);
@@ -230,53 +222,43 @@
         return upstreamNames;
     }
 
-    public static int checkDunRequired(Context ctx) {
+    /** Check whether dun is required. */
+    public static boolean checkDunRequired(Context ctx) {
         final TelephonyManager tm = (TelephonyManager) ctx.getSystemService(TELEPHONY_SERVICE);
-        return (tm != null) ? tm.getTetherApnRequired() : DUN_UNSPECIFIED;
+        return (tm != null) ? tm.getTetherApnRequired() : false;
     }
 
-    private static String dunCheckString(int dunCheck) {
-        switch (dunCheck) {
-            case DUN_NOT_REQUIRED: return "DUN_NOT_REQUIRED";
-            case DUN_REQUIRED:     return "DUN_REQUIRED";
-            case DUN_UNSPECIFIED:  return "DUN_UNSPECIFIED";
-            default:
-                return String.format("UNKNOWN (%s)", dunCheck);
-        }
-    }
-
-    private static Collection<Integer> getUpstreamIfaceTypes(Resources res, int dunCheck) {
+    private static Collection<Integer> getUpstreamIfaceTypes(Resources res, boolean dunRequired) {
         final int[] ifaceTypes = res.getIntArray(config_tether_upstream_types);
         final ArrayList<Integer> upstreamIfaceTypes = new ArrayList<>(ifaceTypes.length);
         for (int i : ifaceTypes) {
             switch (i) {
                 case TYPE_MOBILE:
                 case TYPE_MOBILE_HIPRI:
-                    if (dunCheck == DUN_REQUIRED) continue;
+                    if (dunRequired) continue;
                     break;
                 case TYPE_MOBILE_DUN:
-                    if (dunCheck == DUN_NOT_REQUIRED) continue;
+                    if (!dunRequired) continue;
                     break;
             }
             upstreamIfaceTypes.add(i);
         }
 
         // Fix up upstream interface types for DUN or mobile. NOTE: independent
-        // of the value of |dunCheck|, cell data of one form or another is
+        // of the value of |dunRequired|, cell data of one form or another is
         // *always* an upstream, regardless of the upstream interface types
         // specified by configuration resources.
-        if (dunCheck == DUN_REQUIRED) {
+        if (dunRequired) {
             appendIfNotPresent(upstreamIfaceTypes, TYPE_MOBILE_DUN);
-        } else if (dunCheck == DUN_NOT_REQUIRED) {
-            appendIfNotPresent(upstreamIfaceTypes, TYPE_MOBILE);
-            appendIfNotPresent(upstreamIfaceTypes, TYPE_MOBILE_HIPRI);
         } else {
-            // Fix upstream interface types for case DUN_UNSPECIFIED.
             // Do not modify if a cellular interface type is already present in the
             // upstream interface types. Add TYPE_MOBILE and TYPE_MOBILE_HIPRI if no
             // cellular interface types are found in the upstream interface types.
-            if (!(containsOneOf(upstreamIfaceTypes,
-                    TYPE_MOBILE_DUN, TYPE_MOBILE, TYPE_MOBILE_HIPRI))) {
+            // This preserves backwards compatibility and prevents the DUN and default
+            // mobile types incorrectly appearing together, which could happen on
+            // previous releases in the common case where checkDunRequired returned
+            // DUN_UNSPECIFIED.
+            if (!containsOneOf(upstreamIfaceTypes, TYPE_MOBILE, TYPE_MOBILE_HIPRI)) {
                 upstreamIfaceTypes.add(TYPE_MOBILE);
                 upstreamIfaceTypes.add(TYPE_MOBILE_HIPRI);
             }
diff --git a/services/core/java/com/android/server/content/SyncManager.java b/services/core/java/com/android/server/content/SyncManager.java
index 8a208a5..9f80a83 100644
--- a/services/core/java/com/android/server/content/SyncManager.java
+++ b/services/core/java/com/android/server/content/SyncManager.java
@@ -1639,13 +1639,12 @@
             }
         }
 
-        if (syncOperation.isAppStandbyExempted()) {
-            final UsageStatsManagerInternal usmi = LocalServices.getService(
-                    UsageStatsManagerInternal.class);
-            if (usmi != null) {
-                usmi.reportExemptedSyncScheduled(syncOperation.owningPackage,
-                        UserHandle.getUserId(syncOperation.owningUid));
-            }
+        final UsageStatsManagerInternal usmi =
+                LocalServices.getService(UsageStatsManagerInternal.class);
+        if (usmi != null) {
+            usmi.reportSyncScheduled(syncOperation.owningPackage,
+                    UserHandle.getUserId(syncOperation.owningUid),
+                    syncOperation.isAppStandbyExempted());
         }
 
         getJobScheduler().scheduleAsPackage(b.build(), syncOperation.owningPackage,
diff --git a/services/core/java/com/android/server/contentcapture/ContentCaptureManagerInternal.java b/services/core/java/com/android/server/contentcapture/ContentCaptureManagerInternal.java
index d04f920..fa7d3fc 100644
--- a/services/core/java/com/android/server/contentcapture/ContentCaptureManagerInternal.java
+++ b/services/core/java/com/android/server/contentcapture/ContentCaptureManagerInternal.java
@@ -18,9 +18,11 @@
 import android.annotation.NonNull;
 import android.annotation.Nullable;
 import android.annotation.UserIdInt;
+import android.content.ComponentName;
 import android.content.ContentCaptureOptions;
 import android.os.Bundle;
 import android.os.IBinder;
+import android.service.contentcapture.ActivityEvent.ActivityEventType;
 
 /**
  * ContentCapture Manager local system service interface.
@@ -51,4 +53,10 @@
     @Nullable
     public abstract ContentCaptureOptions getOptionsForPackage(@UserIdInt int userId,
             @NonNull String packageName);
+
+    /**
+     * Notifies the intelligence service of a high-level activity event for the given user.
+     */
+    public abstract void notifyActivityEvent(@UserIdInt int userId,
+            @NonNull ComponentName activityComponent, @ActivityEventType int eventType);
 }
diff --git a/services/core/java/com/android/server/display/AutomaticBrightnessController.java b/services/core/java/com/android/server/display/AutomaticBrightnessController.java
index d57431e..6d7dff5 100644
--- a/services/core/java/com/android/server/display/AutomaticBrightnessController.java
+++ b/services/core/java/com/android/server/display/AutomaticBrightnessController.java
@@ -216,7 +216,7 @@
     private PackageManager mPackageManager;
 
     public AutomaticBrightnessController(Callbacks callbacks, Looper looper,
-            SensorManager sensorManager, BrightnessMappingStrategy mapper,
+            SensorManager sensorManager, Sensor lightSensor, BrightnessMappingStrategy mapper,
             int lightSensorWarmUpTime, int brightnessMin, int brightnessMax, float dozeScaleFactor,
             int lightSensorRate, int initialLightSensorRate, long brighteningLightDebounceConfig,
             long darkeningLightDebounceConfig, boolean resetAmbientLuxAfterWarmUpConfig,
@@ -249,7 +249,7 @@
             new AmbientLightRingBuffer(mNormalLightSensorRate, mAmbientLightHorizon);
 
         if (!DEBUG_PRETEND_LIGHT_SENSOR_ABSENT) {
-            mLightSensor = mSensorManager.getDefaultSensor(Sensor.TYPE_LIGHT);
+            mLightSensor = lightSensor;
         }
 
         mActivityTaskManager = ActivityTaskManager.getService();
@@ -288,6 +288,10 @@
         return mScreenAutoBrightness;
     }
 
+    public boolean hasValidAmbientLux() {
+        return mAmbientLuxValid;
+    }
+
     public float getAutomaticScreenBrightnessAdjustment() {
         return mBrightnessMapper.getAutoBrightnessAdjustment();
     }
@@ -648,9 +652,9 @@
                 mLightSensorWarmUpTimeConfig + mLightSensorEnableTime;
             if (time < timeWhenSensorWarmedUp) {
                 if (mLoggingEnabled) {
-                    Slog.d(TAG, "updateAmbientLux: Sensor not  ready yet: " +
-                            "time=" + time + ", " +
-                            "timeWhenSensorWarmedUp=" + timeWhenSensorWarmedUp);
+                    Slog.d(TAG, "updateAmbientLux: Sensor not ready yet: "
+                            + "time=" + time + ", "
+                            + "timeWhenSensorWarmedUp=" + timeWhenSensorWarmedUp);
                 }
                 mHandler.sendEmptyMessageAtTime(MSG_UPDATE_AMBIENT_LUX,
                         timeWhenSensorWarmedUp);
diff --git a/services/core/java/com/android/server/display/DisplayDevice.java b/services/core/java/com/android/server/display/DisplayDevice.java
index e9ae516..9882f6c 100644
--- a/services/core/java/com/android/server/display/DisplayDevice.java
+++ b/services/core/java/com/android/server/display/DisplayDevice.java
@@ -138,9 +138,19 @@
     }
 
     /**
-     * Sets the mode, if supported.
+     * Sets the display modes the system is allowed to switch between, roughly ordered by
+     * preference.
+     *
+     * Not all display devices will automatically switch between modes, so it's important that the
+     * most-desired modes are at the beginning of the allowed array.
      */
-    public void requestDisplayModesLocked(int colorMode, int modeId) {
+    public void setAllowedDisplayModesLocked(int[] modes) {
+    }
+
+    /**
+     * Sets the requested color mode.
+     */
+    public void setRequestedColorModeLocked(int colorMode) {
     }
 
     public void onOverlayChangedLocked() {
diff --git a/services/core/java/com/android/server/display/DisplayManagerService.java b/services/core/java/com/android/server/display/DisplayManagerService.java
index 01d19c0..32f34b8 100644
--- a/services/core/java/com/android/server/display/DisplayManagerService.java
+++ b/services/core/java/com/android/server/display/DisplayManagerService.java
@@ -96,7 +96,6 @@
 import com.android.server.LocalServices;
 import com.android.server.SystemService;
 import com.android.server.UiThread;
-import com.android.server.display.ColorDisplayService.ColorDisplayServiceInternal;
 import com.android.server.wm.SurfaceAnimationThread;
 import com.android.server.wm.WindowManagerInternal;
 
@@ -168,13 +167,13 @@
     private static final int MSG_DELIVER_DISPLAY_EVENT = 3;
     private static final int MSG_REQUEST_TRAVERSAL = 4;
     private static final int MSG_UPDATE_VIEWPORT = 5;
-    private static final int MSG_REGISTER_BRIGHTNESS_TRACKER = 6;
-    private static final int MSG_LOAD_BRIGHTNESS_CONFIGURATION = 7;
+    private static final int MSG_LOAD_BRIGHTNESS_CONFIGURATION = 6;
 
     private final Context mContext;
     private final DisplayManagerHandler mHandler;
     private final Handler mUiHandler;
     private final DisplayAdapterListener mDisplayAdapterListener;
+    private final DisplayModeDirector mDisplayModeDirector;
     private WindowManagerInternal mWindowManagerInternal;
     private InputManagerInternal mInputManagerInternal;
     private IMediaProjectionManager mProjectionService;
@@ -311,6 +310,7 @@
         mHandler = new DisplayManagerHandler(DisplayThread.get().getLooper());
         mUiHandler = UiThread.getHandler();
         mDisplayAdapterListener = new DisplayAdapterListener();
+        mDisplayModeDirector = new DisplayModeDirector(context, mHandler);
         mSingleDisplayDemoMode = SystemProperties.getBoolean("persist.demo.singledisplay", false);
         Resources resources = mContext.getResources();
         mDefaultDisplayDefaultColorMode = mContext.getResources().getInteger(
@@ -323,7 +323,7 @@
         mMinimumBrightnessCurve = new Curve(lux, nits);
         mMinimumBrightnessSpline = Spline.createSpline(lux, nits);
 
-        PowerManager pm = (PowerManager) mContext.getSystemService(Context.POWER_SERVICE);
+        PowerManager pm = mContext.getSystemService(PowerManager.class);
         mGlobalDisplayBrightness = pm.getDefaultScreenBrightnessSetting();
         mCurrentUserId = UserHandle.USER_SYSTEM;
         ColorSpace[] colorSpaces = SurfaceControl.getCompositionColorSpaces();
@@ -348,16 +348,15 @@
         // adapter is up so that we have it's configuration. We could load it lazily, but since
         // we're going to have to read it in eventually we may as well do it here rather than after
         // we've waited for the display to register itself with us.
-		synchronized(mSyncRoot) {
-			mPersistentDataStore.loadIfNeeded();
-			loadStableDisplayValuesLocked();
+        synchronized (mSyncRoot) {
+            mPersistentDataStore.loadIfNeeded();
+            loadStableDisplayValuesLocked();
         }
         mHandler.sendEmptyMessage(MSG_REGISTER_DEFAULT_DISPLAY_ADAPTERS);
 
         publishBinderService(Context.DISPLAY_SERVICE, new BinderService(),
                 true /*allowIsolated*/);
         publishLocalService(DisplayManagerInternal.class, new LocalService());
-        publishLocalService(DisplayTransformManager.class, new DisplayTransformManager());
     }
 
     @Override
@@ -419,8 +418,10 @@
             mOnlyCore = onlyCore;
         }
 
+        mDisplayModeDirector.setListener(new AllowedDisplayModeObserver());
+        mDisplayModeDirector.start();
+
         mHandler.sendEmptyMessage(MSG_REGISTER_ADDITIONAL_DISPLAY_ADAPTERS);
-        mHandler.sendEmptyMessage(MSG_REGISTER_BRIGHTNESS_TRACKER);
     }
 
     @VisibleForTesting
@@ -1196,13 +1197,8 @@
                 requestedModeId = display.getDisplayInfoLocked().findDefaultModeByRefreshRate(
                         requestedRefreshRate);
             }
-            if (display.getRequestedModeIdLocked() != requestedModeId) {
-                if (DEBUG) {
-                    Slog.d(TAG, "Display " + displayId + " switching to mode " + requestedModeId);
-                }
-                display.setRequestedModeIdLocked(requestedModeId);
-                scheduleTraversalLocked(inTraversal);
-            }
+            mDisplayModeDirector.getAppRequestObserver().setAppRequestedMode(
+                    displayId, requestedModeId);
         }
     }
 
@@ -1321,6 +1317,28 @@
         return SurfaceControl.getDisplayedContentSample(token, maxFrames, timestamp);
     }
 
+    private void onAllowedDisplayModesChangedInternal() {
+        boolean changed = false;
+        synchronized (mSyncRoot) {
+            final int count = mLogicalDisplays.size();
+            for (int i = 0; i < count; i++) {
+                LogicalDisplay display = mLogicalDisplays.valueAt(i);
+                int displayId = mLogicalDisplays.keyAt(i);
+                int[] allowedModes = mDisplayModeDirector.getAllowedModes(displayId);
+                // Note that order is important here since not all display devices are capable of
+                // automatically switching, so we do actually want to check for equality and not
+                // just equivalent contents (regardless of order).
+                if (!Arrays.equals(allowedModes, display.getAllowedDisplayModesLocked())) {
+                    display.setAllowedDisplayModesLocked(allowedModes);
+                    changed = true;
+                }
+            }
+            if (changed) {
+                scheduleTraversalLocked(false);
+            }
+        }
+    }
+
     private void clearViewportsLocked() {
         mViewports.clear();
     }
@@ -1520,6 +1538,9 @@
                 display.dumpLocked(ipw);
             }
 
+            pw.println();
+            mDisplayModeDirector.dump(pw);
+
             final int callbackCount = mCallbacks.size();
             pw.println();
             pw.println("Callbacks: size=" + callbackCount);
@@ -1535,13 +1556,6 @@
 
             pw.println();
             mPersistentDataStore.dump(pw);
-
-            final ColorDisplayServiceInternal cds = LocalServices.getService(
-                    ColorDisplayServiceInternal.class);
-            if (cds != null) {
-                pw.println();
-                cds.dump(pw);
-            }
         }
     }
 
@@ -1698,8 +1712,9 @@
          * Returns information about the specified logical display.
          *
          * @param displayId The logical display id.
-         * @return The logical display info, or null if the display does not exist.  The
-         * returned object must be treated as immutable.
+         * @return The logical display info, return {@code null} if the display does not exist or
+         * the calling UID isn't present on the display.  The returned object must be treated as
+         * immutable.
          */
         @Override // Binder call
         public DisplayInfo getDisplayInfo(int displayId) {
@@ -1726,6 +1741,16 @@
             }
         }
 
+        @Override // Binder call
+        public boolean isUidPresentOnDisplay(int uid, int displayId) {
+            final long token = Binder.clearCallingIdentity();
+            try {
+                return isUidPresentOnDisplayInternal(uid, displayId);
+            } finally {
+                Binder.restoreCallingIdentity(token);
+            }
+        }
+
         /**
          * Returns the stable device display size, in pixels.
          */
@@ -2394,11 +2419,6 @@
         }
 
         @Override
-        public boolean isUidPresentOnDisplay(int uid, int displayId) {
-            return isUidPresentOnDisplayInternal(uid, displayId);
-        }
-
-        @Override
         public void persistBrightnessTrackerState() {
             synchronized (mSyncRoot) {
                 mDisplayPowerController.persistBrightnessTrackerState();
@@ -2434,4 +2454,10 @@
         }
 
     }
+
+    class AllowedDisplayModeObserver implements DisplayModeDirector.Listener {
+        public void onAllowedDisplayModesChanged() {
+            onAllowedDisplayModesChangedInternal();
+        }
+    }
 }
diff --git a/services/core/java/com/android/server/display/DisplayModeDirector.java b/services/core/java/com/android/server/display/DisplayModeDirector.java
new file mode 100644
index 0000000..b0d8813
--- /dev/null
+++ b/services/core/java/com/android/server/display/DisplayModeDirector.java
@@ -0,0 +1,691 @@
+/*
+ * Copyright (C) 2019 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 com.android.server.display;
+
+import android.annotation.NonNull;
+import android.annotation.Nullable;
+import android.content.ContentResolver;
+import android.content.Context;
+import android.database.ContentObserver;
+import android.hardware.display.DisplayManager;
+import android.net.Uri;
+import android.os.Handler;
+import android.os.Looper;
+import android.os.Message;
+import android.os.UserHandle;
+import android.provider.Settings;
+import android.util.Slog;
+import android.util.SparseArray;
+import android.view.Display;
+import android.view.DisplayInfo;
+
+import com.android.internal.R;
+
+import java.io.PrintWriter;
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.Objects;
+
+/**
+ * The DisplayModeDirector is responsible for determining what modes are allowed to be
+ * automatically picked by the system based on system-wide and display-specific configuration.
+ */
+public class DisplayModeDirector {
+    private static final String TAG = "DisplayModeDirector";
+    private static final boolean DEBUG = false;
+
+    private static final int MSG_ALLOWED_MODES_CHANGED = 1;
+
+    // Special ID used to indicate that given vote is to be applied globally, rather than to a
+    // specific display.
+    private static final int GLOBAL_ID = -1;
+
+    // What we consider to be the system's "default" refresh rate.
+    private static final float DEFAULT_REFRESH_RATE = 60f;
+
+    // The tolerance within which we consider something approximately equals.
+    private static final float EPSILON = 0.001f;
+
+    private final Object mLock = new Object();
+    private final Context mContext;
+
+    private final DisplayModeDirectorHandler mHandler;
+
+    // A map from the display ID to the collection of votes and their priority. The latter takes
+    // the form of another map from the priority to the vote itself so that each priority is
+    // guaranteed to have exactly one vote, which is also easily and efficiently replaceable.
+    private final SparseArray<SparseArray<Vote>> mVotesByDisplay;
+    // A map from the display ID to the supported modes on that display.
+    private final SparseArray<Display.Mode[]> mSupportedModesByDisplay;
+    // A map from the display ID to the default mode of that display.
+    private final SparseArray<Display.Mode> mDefaultModeByDisplay;
+
+    private final AppRequestObserver mAppRequestObserver;
+    private final SettingsObserver mSettingsObserver;
+    private final DisplayObserver mDisplayObserver;
+
+
+    private Listener mListener;
+
+    public DisplayModeDirector(@NonNull Context context, @NonNull Handler handler) {
+        mContext = context;
+        mHandler = new DisplayModeDirectorHandler(handler.getLooper());
+        mVotesByDisplay = new SparseArray<>();
+        mSupportedModesByDisplay = new SparseArray<>();
+        mDefaultModeByDisplay =  new SparseArray<>();
+        mAppRequestObserver = new AppRequestObserver();
+        mSettingsObserver = new SettingsObserver(context, handler);
+        mDisplayObserver = new DisplayObserver(context, handler);
+    }
+
+    /**
+     * Tells the DisplayModeDirector to update allowed votes and begin observing relevant system
+     * state.
+     *
+     * This has to be deferred because the object may be constructed before the rest of the system
+     * is ready.
+     */
+    public void start() {
+        mSettingsObserver.observe();
+        mDisplayObserver.observe();
+        mSettingsObserver.observe();
+        synchronized (mLock) {
+            // We may have a listener already registered before the call to start, so go ahead and
+            // notify them to pick up our newly initialized state.
+            notifyAllowedModesChangedLocked();
+        }
+    }
+
+    /**
+     * Calculates the modes the system is allowed to freely switch between based on global and
+     * display-specific constraints.
+     *
+     * @param displayId The display to query for.
+     * @return The IDs of the modes the system is allowed to freely switch between.
+     */
+    @NonNull
+    public int[] getAllowedModes(int displayId) {
+        synchronized (mLock) {
+            SparseArray<Vote> votes = getVotesLocked(displayId);
+            Display.Mode[] modes = mSupportedModesByDisplay.get(displayId);
+            Display.Mode defaultMode = mDefaultModeByDisplay.get(displayId);
+            if (modes == null || defaultMode == null) {
+                Slog.e(TAG, "Asked about unknown display, returning empty allowed set! (id="
+                        + displayId + ")");
+                return new int[0];
+            }
+            return getAllowedModesLocked(votes, modes, defaultMode);
+        }
+    }
+
+    @NonNull
+    private SparseArray<Vote> getVotesLocked(int displayId) {
+        SparseArray<Vote> displayVotes = mVotesByDisplay.get(displayId);
+        final SparseArray<Vote> votes;
+        if (displayVotes != null) {
+            votes = displayVotes.clone();
+        } else {
+            votes = new SparseArray<>();
+        }
+
+        SparseArray<Vote> globalVotes = mVotesByDisplay.get(GLOBAL_ID);
+        if (globalVotes != null) {
+            for (int i = 0; i < globalVotes.size(); i++) {
+                int priority = globalVotes.keyAt(i);
+                if (votes.indexOfKey(priority) < 0) {
+                    votes.put(priority, globalVotes.valueAt(i));
+                }
+            }
+        }
+        return votes;
+    }
+
+    @NonNull
+    private int[] getAllowedModesLocked(@NonNull SparseArray<Vote> votes,
+            @NonNull Display.Mode[] modes, @NonNull Display.Mode defaultMode) {
+        int lowestConsideredPriority = Vote.MIN_PRIORITY;
+        while (lowestConsideredPriority <= Vote.MAX_PRIORITY) {
+            float minRefreshRate = 0f;
+            float maxRefreshRate = Float.POSITIVE_INFINITY;
+            int height = Vote.INVALID_SIZE;
+            int width = Vote.INVALID_SIZE;
+
+            for (int priority = Vote.MAX_PRIORITY;
+                    priority >= lowestConsideredPriority;
+                    priority--) {
+                Vote vote = votes.get(priority);
+                if (vote == null) {
+                    continue;
+                }
+                // For refresh rates, just use the tightest bounds of all the votes
+                minRefreshRate = Math.max(minRefreshRate, vote.minRefreshRate);
+                maxRefreshRate = Math.min(maxRefreshRate, vote.maxRefreshRate);
+                // For display size, use only the first vote we come across (i.e. the highest
+                // priority vote that includes the width / height).
+                if (height == Vote.INVALID_SIZE && width == Vote.INVALID_SIZE
+                        && vote.height > 0 && vote.width > 0) {
+                    width = vote.width;
+                    height = vote.height;
+                }
+            }
+
+            // If we don't have anything specifying the width / height of the display, just use the
+            // default width and height. We don't want these switching out from underneath us since
+            // it's a pretty disruptive behavior.
+            if (height == Vote.INVALID_SIZE || width == Vote.INVALID_SIZE) {
+                width = defaultMode.getPhysicalWidth();
+                height = defaultMode.getPhysicalHeight();
+            }
+
+            int[] availableModes =
+                    filterModes(modes, width, height, minRefreshRate, maxRefreshRate);
+            if (availableModes.length > 0) {
+                if (DEBUG) {
+                    Slog.w(TAG, "Found available modes=" + Arrays.toString(availableModes)
+                            + " with lowest priority considered "
+                            + Vote.priorityToString(lowestConsideredPriority)
+                            + " and constraints: "
+                            + "width=" + width
+                            + ", height=" + height
+                            + ", minRefreshRate=" + minRefreshRate
+                            + ", maxRefreshRate=" + maxRefreshRate);
+                }
+                return availableModes;
+            }
+
+            if (DEBUG) {
+                Slog.w(TAG, "Couldn't find available modes with lowest priority set to "
+                        + Vote.priorityToString(lowestConsideredPriority)
+                        + " and with the following constraints: "
+                        + "width=" + width
+                        + ", height=" + height
+                        + ", minRefreshRate=" + minRefreshRate
+                        + ", maxRefreshRate=" + maxRefreshRate);
+            }
+            // If we haven't found anything with the current set of votes, drop the current lowest
+            // priority vote.
+            lowestConsideredPriority++;
+        }
+
+        // If we still haven't found anything that matches our current set of votes, just fall back
+        // to the default mode.
+        return new int[] { defaultMode.getModeId() };
+    }
+
+    private int[] filterModes(Display.Mode[] supportedModes,
+            int width, int height, float minRefreshRate, float maxRefreshRate) {
+        ArrayList<Display.Mode> availableModes = new ArrayList<>();
+        for (Display.Mode mode : supportedModes) {
+            if (mode.getPhysicalWidth() != width || mode.getPhysicalHeight() != height) {
+                if (DEBUG) {
+                    Slog.w(TAG, "Discarding mode " + mode.getModeId() + ", wrong size"
+                            + ": desiredWidth=" + width
+                            + ": desiredHeight=" + height
+                            + ": actualWidth=" + mode.getPhysicalWidth()
+                            + ": actualHeight=" + mode.getPhysicalHeight());
+                }
+                continue;
+            }
+            final float refreshRate = mode.getRefreshRate();
+            // Some refresh rates are calculated based on frame timings, so they aren't *exactly*
+            // equal to expected refresh rate. Given that, we apply a bit of tolerance to this
+            // comparison.
+            if (refreshRate < (minRefreshRate - EPSILON)
+                    || refreshRate > (maxRefreshRate + EPSILON)) {
+                if (DEBUG) {
+                    Slog.w(TAG, "Discarding mode " + mode.getModeId()
+                            + ", outside refresh rate bounds"
+                            + ": minRefreshRate=" + minRefreshRate
+                            + ", maxRefreshRate=" + maxRefreshRate
+                            + ", modeRefreshRate=" + refreshRate);
+                }
+                continue;
+            }
+            availableModes.add(mode);
+        }
+        final int size = availableModes.size();
+        int[] availableModeIds = new int[size];
+        for (int i = 0; i < size; i++) {
+            availableModeIds[i] = availableModes.get(i).getModeId();
+        }
+        return availableModeIds;
+    }
+
+    /**
+     * Gets the observer responsible for application display mode requests.
+     */
+    @NonNull
+    public AppRequestObserver getAppRequestObserver() {
+        // We don't need to lock here because mAppRequestObserver is a final field, which is
+        // guaranteed to be visible on all threads after construction.
+        return mAppRequestObserver;
+    }
+
+    /**
+     * Sets the listener for changes to allowed display modes.
+     */
+    public void setListener(@Nullable Listener listener) {
+        synchronized (mLock) {
+            mListener = listener;
+        }
+    }
+
+    /**
+     * Print the object's state and debug information into the given stream.
+     *
+     * @param pw The stream to dump information to.
+     */
+    public void dump(PrintWriter pw) {
+        pw.println("DisplayModeDirector");
+        synchronized (mLock) {
+            pw.println("  mSupportedModesByDisplay:");
+            for (int i = 0; i < mSupportedModesByDisplay.size(); i++) {
+                final int id = mSupportedModesByDisplay.keyAt(i);
+                final Display.Mode[] modes = mSupportedModesByDisplay.valueAt(i);
+                pw.println("    " + id + " -> " + Arrays.toString(modes));
+            }
+            pw.println("  mDefaultModeByDisplay:");
+            for (int i = 0; i < mDefaultModeByDisplay.size(); i++) {
+                final int id = mDefaultModeByDisplay.keyAt(i);
+                final Display.Mode mode = mDefaultModeByDisplay.valueAt(i);
+                pw.println("    " + id + " -> " + mode);
+            }
+            pw.println("  mVotesByDisplay:");
+            for (int i = 0; i < mVotesByDisplay.size(); i++) {
+                pw.println("    " + mVotesByDisplay.keyAt(i) + ":");
+                SparseArray<Vote> votes = mVotesByDisplay.valueAt(i);
+                for (int p = Vote.MAX_PRIORITY; p >= Vote.MIN_PRIORITY; p--) {
+                    Vote vote = votes.get(p);
+                    if (vote == null) {
+                        continue;
+                    }
+                    pw.println("      " + Vote.priorityToString(p) + " -> " + vote);
+                }
+            }
+            mSettingsObserver.dumpLocked(pw);
+            mAppRequestObserver.dumpLocked(pw);
+        }
+    }
+
+    private void updateVoteLocked(int priority, Vote vote) {
+        updateVoteLocked(GLOBAL_ID, priority, vote);
+    }
+
+    private void updateVoteLocked(int displayId, int priority, Vote vote) {
+        if (DEBUG) {
+            Slog.i(TAG, "updateVoteLocked(displayId=" + displayId
+                    + ", priority=" + Vote.priorityToString(priority)
+                    + ", vote=" + vote + ")");
+        }
+        if (priority < Vote.MIN_PRIORITY || priority > Vote.MAX_PRIORITY) {
+            Slog.w(TAG, "Received a vote with an invalid priority, ignoring:"
+                    + " priority=" + Vote.priorityToString(priority)
+                    + ", vote=" + vote, new Throwable());
+            return;
+        }
+        final SparseArray<Vote> votes = getOrCreateVotesByDisplay(displayId);
+
+        Vote currentVote = votes.get(priority);
+        if (vote != null) {
+            votes.put(priority, vote);
+        } else {
+            votes.remove(priority);
+        }
+
+        if (votes.size() == 0) {
+            if (DEBUG) {
+                Slog.i(TAG, "No votes left for display " + displayId + ", removing.");
+            }
+            mVotesByDisplay.remove(displayId);
+        }
+
+        notifyAllowedModesChangedLocked();
+    }
+
+    private void notifyAllowedModesChangedLocked() {
+        if (mListener != null && !mHandler.hasMessages(MSG_ALLOWED_MODES_CHANGED)) {
+            // We need to post this to a handler to avoid calling out while holding the lock
+            // since we know there are things that both listen for changes as well as provide
+            // information. If we did call out while holding the lock, then there's no guaranteed
+            // lock order and we run the real of risk deadlock.
+            Message msg = mHandler.obtainMessage(MSG_ALLOWED_MODES_CHANGED, mListener);
+            msg.sendToTarget();
+        }
+    }
+
+    private SparseArray<Vote> getOrCreateVotesByDisplay(int displayId) {
+        int index = mVotesByDisplay.indexOfKey(displayId);
+        if (mVotesByDisplay.indexOfKey(displayId) >= 0) {
+            return mVotesByDisplay.get(displayId);
+        } else {
+            SparseArray<Vote> votes = new SparseArray<>();
+            mVotesByDisplay.put(displayId, votes);
+            return votes;
+        }
+    }
+
+    /**
+     * Listens for changes to display mode coordination.
+     */
+    public interface Listener {
+        /**
+         * Called when the allowed display modes may have changed.
+         */
+        void onAllowedDisplayModesChanged();
+    }
+
+    private static final class DisplayModeDirectorHandler extends Handler {
+        DisplayModeDirectorHandler(Looper looper) {
+            super(looper, null, true /*async*/);
+        }
+
+        @Override
+        public void handleMessage(Message msg) {
+            switch (msg.what) {
+                case MSG_ALLOWED_MODES_CHANGED:
+                    Listener listener = (Listener) msg.obj;
+                    listener.onAllowedDisplayModesChanged();
+                    break;
+            }
+        }
+    }
+
+    private static final class Vote {
+        public static final int PRIORITY_USER_SETTING = 0;
+        // We split the app request into two priorities in case we can satisfy one desire without
+        // the other.
+        public static final int PRIORITY_APP_REQUEST_REFRESH_RATE = 1;
+        public static final int PRIORITY_APP_REQUEST_SIZE = 2;
+        public static final int PRIORITY_LOW_POWER_MODE = 3;
+
+        // Whenever a new priority is added, remember to update MIN_PRIORITY and/or MAX_PRIORITY as
+        // appropriate, as well as priorityToString.
+
+        public static final int MIN_PRIORITY = PRIORITY_USER_SETTING;
+        public static final int MAX_PRIORITY = PRIORITY_LOW_POWER_MODE;
+
+        /**
+         * A value signifying an invalid width or height in a vote.
+         */
+        public static final int INVALID_SIZE = -1;
+
+        /**
+         * The requested width of the display in pixels, or INVALID_SIZE;
+         */
+        public final int width;
+        /**
+         * The requested height of the display in pixels, or INVALID_SIZE;
+         */
+        public final int height;
+
+        /**
+         * The lowest desired refresh rate.
+         */
+        public final float minRefreshRate;
+        /**
+         * The highest desired refresh rate.
+         */
+        public final float maxRefreshRate;
+
+        public static Vote forRefreshRates(float minRefreshRate, float maxRefreshRate) {
+            return new Vote(INVALID_SIZE, INVALID_SIZE, minRefreshRate, maxRefreshRate);
+        }
+
+        public static Vote forSize(int width, int height) {
+            return new Vote(width, height, 0f, Float.POSITIVE_INFINITY);
+        }
+
+        private Vote(int width, int height,
+                float minRefreshRate, float maxRefreshRate) {
+            this.width = width;
+            this.height = height;
+            this.minRefreshRate = minRefreshRate;
+            this.maxRefreshRate = maxRefreshRate;
+        }
+
+        public static String priorityToString(int priority) {
+            switch (priority) {
+                case PRIORITY_USER_SETTING:
+                    return "PRIORITY_USER_SETTING";
+                case PRIORITY_APP_REQUEST_REFRESH_RATE:
+                    return "PRIORITY_APP_REQUEST_REFRESH_RATE";
+                case PRIORITY_APP_REQUEST_SIZE:
+                    return "PRIORITY_APP_REQUEST_SIZE";
+                case PRIORITY_LOW_POWER_MODE:
+                    return "PRIORITY_LOW_POWER_MODE";
+                default:
+                    return Integer.toString(priority);
+            }
+        }
+
+        @Override
+        public String toString() {
+            return "Vote{"
+                + "width=" + width
+                + ", height=" + height
+                + ", minRefreshRate=" + minRefreshRate
+                + ", maxRefreshRate=" + maxRefreshRate
+                + "}";
+        }
+    }
+
+    private final class SettingsObserver extends ContentObserver {
+        private final Uri mRefreshRateSetting =
+                Settings.System.getUriFor(Settings.System.PEAK_REFRESH_RATE);
+        private final Uri mLowPowerModeSetting =
+                Settings.Global.getUriFor(Settings.Global.LOW_POWER_MODE);
+
+        private final Context mContext;
+        private final float mDefaultPeakRefreshRate;
+
+        SettingsObserver(@NonNull Context context, @NonNull Handler handler) {
+            super(handler);
+            mContext = context;
+            mDefaultPeakRefreshRate = (float) context.getResources().getInteger(
+                    R.integer.config_defaultPeakRefreshRate);
+        }
+
+        public void observe() {
+            final ContentResolver cr = mContext.getContentResolver();
+            cr.registerContentObserver(mRefreshRateSetting, false /*notifyDescendants*/, this,
+                    UserHandle.USER_SYSTEM);
+            cr.registerContentObserver(mLowPowerModeSetting, false /*notifyDescendants*/, this,
+                    UserHandle.USER_SYSTEM);
+            synchronized (mLock) {
+                updateRefreshRateSettingLocked();
+                updateLowPowerModeSettingLocked();
+            }
+        }
+
+        @Override
+        public void onChange(boolean selfChange, Uri uri, int userId) {
+            synchronized (mLock) {
+                if (mRefreshRateSetting.equals(uri)) {
+                    updateRefreshRateSettingLocked();
+                } else if (mLowPowerModeSetting.equals(uri)) {
+                    updateLowPowerModeSettingLocked();
+                }
+            }
+        }
+
+        private void updateLowPowerModeSettingLocked() {
+            boolean inLowPowerMode = Settings.Global.getInt(mContext.getContentResolver(),
+                    Settings.Global.LOW_POWER_MODE, 0 /*default*/) != 0;
+            final Vote vote;
+            if (inLowPowerMode) {
+                vote = Vote.forRefreshRates(0f, 60f);
+            } else {
+                vote = null;
+            }
+            updateVoteLocked(Vote.PRIORITY_LOW_POWER_MODE, vote);
+        }
+
+        private void updateRefreshRateSettingLocked() {
+            float peakRefreshRate = Settings.System.getFloat(mContext.getContentResolver(),
+                    Settings.System.PEAK_REFRESH_RATE, DEFAULT_REFRESH_RATE);
+            Vote vote = Vote.forRefreshRates(0f, peakRefreshRate);
+            updateVoteLocked(Vote.PRIORITY_USER_SETTING, vote);
+        }
+
+        public void dumpLocked(PrintWriter pw) {
+            pw.println("  SettingsObserver");
+            pw.println("    mDefaultPeakRefreshRate: " + mDefaultPeakRefreshRate);
+        }
+    }
+
+    final class AppRequestObserver {
+        private SparseArray<Display.Mode> mAppRequestedModeByDisplay;
+
+        AppRequestObserver() {
+            mAppRequestedModeByDisplay = new SparseArray<>();
+        }
+
+        public void setAppRequestedMode(int displayId, int modeId) {
+            synchronized (mLock) {
+                setAppRequestedModeLocked(displayId, modeId);
+            }
+        }
+
+        private void setAppRequestedModeLocked(int displayId, int modeId) {
+            final Display.Mode requestedMode = findModeByIdLocked(displayId, modeId);
+            if (Objects.equals(requestedMode, mAppRequestedModeByDisplay.get(displayId))) {
+                return;
+            }
+
+            final Vote refreshRateVote;
+            final Vote sizeVote;
+            if (requestedMode != null) {
+                mAppRequestedModeByDisplay.put(displayId, requestedMode);
+                float refreshRate = requestedMode.getRefreshRate();
+                refreshRateVote = Vote.forRefreshRates(refreshRate, refreshRate);
+                sizeVote = Vote.forSize(requestedMode.getPhysicalWidth(),
+                        requestedMode.getPhysicalHeight());
+            } else {
+                mAppRequestedModeByDisplay.remove(displayId);
+                refreshRateVote = null;
+                sizeVote = null;
+            }
+            updateVoteLocked(displayId, Vote.PRIORITY_APP_REQUEST_REFRESH_RATE, refreshRateVote);
+            updateVoteLocked(displayId, Vote.PRIORITY_APP_REQUEST_SIZE, sizeVote);
+            return;
+        }
+
+        private Display.Mode findModeByIdLocked(int displayId, int modeId) {
+            Display.Mode[] modes = mSupportedModesByDisplay.get(displayId);
+            if (modes == null) {
+                return null;
+            }
+            for (Display.Mode mode : modes) {
+                if (mode.getModeId() == modeId) {
+                    return mode;
+                }
+            }
+            return null;
+        }
+
+        public void dumpLocked(PrintWriter pw) {
+            pw.println("  AppRequestObserver");
+            pw.println("    mAppRequestedModeByDisplay:");
+            for (int i = 0; i < mAppRequestedModeByDisplay.size(); i++) {
+                final int id = mAppRequestedModeByDisplay.keyAt(i);
+                final Display.Mode mode = mAppRequestedModeByDisplay.valueAt(i);
+                pw.println("    " + id + " -> " + mode);
+            }
+        }
+    }
+
+    private final class DisplayObserver implements DisplayManager.DisplayListener {
+        // Note that we can never call into DisplayManager or any of the non-POD classes it
+        // returns, while holding mLock since it may call into DMS, which might be simultaneously
+        // calling into us already holding its own lock.
+        private final Context mContext;
+        private final Handler mHandler;
+
+        DisplayObserver(Context context, Handler handler) {
+            mContext = context;
+            mHandler = handler;
+        }
+
+        public void observe() {
+            DisplayManager dm = mContext.getSystemService(DisplayManager.class);
+            dm.registerDisplayListener(this, mHandler);
+
+            // Populate existing displays
+            SparseArray<Display.Mode[]> modes = new SparseArray<>();
+            SparseArray<Display.Mode> defaultModes = new SparseArray<>();
+            DisplayInfo info = new DisplayInfo();
+            Display[] displays = dm.getDisplays();
+            for (Display d : displays) {
+                final int displayId = d.getDisplayId();
+                d.getDisplayInfo(info);
+                modes.put(displayId, info.supportedModes);
+                defaultModes.put(displayId, info.getDefaultMode());
+            }
+            synchronized (mLock) {
+                final int size = modes.size();
+                for (int i = 0; i < size; i++) {
+                    mSupportedModesByDisplay.put(modes.keyAt(i), modes.valueAt(i));
+                    mDefaultModeByDisplay.put(defaultModes.keyAt(i), defaultModes.valueAt(i));
+                }
+            }
+        }
+
+        @Override
+        public void onDisplayAdded(int displayId) {
+            updateDisplayModes(displayId);
+        }
+
+        @Override
+        public void onDisplayRemoved(int displayId) {
+            synchronized (mLock) {
+                mSupportedModesByDisplay.remove(displayId);
+                mDefaultModeByDisplay.remove(displayId);
+            }
+        }
+
+        @Override
+        public void onDisplayChanged(int displayId) {
+            updateDisplayModes(displayId);
+        }
+
+        private void updateDisplayModes(int displayId) {
+            Display d = mContext.getSystemService(DisplayManager.class).getDisplay(displayId);
+            if (d == null) {
+                // We can occasionally get a display added or changed event for a display that was
+                // subsequently removed, which means this returns null. Check this case and bail
+                // out early; if it gets re-attached we'll eventually get another call back for it.
+                return;
+            }
+            DisplayInfo info = new DisplayInfo();
+            d.getDisplayInfo(info);
+            boolean changed = false;
+            synchronized (mLock) {
+                if (!Arrays.equals(mSupportedModesByDisplay.get(displayId), info.supportedModes)) {
+                    mSupportedModesByDisplay.put(displayId, info.supportedModes);
+                    changed = true;
+                }
+                if (!Objects.equals(mDefaultModeByDisplay.get(displayId), info.getDefaultMode())) {
+                    changed = true;
+                    mDefaultModeByDisplay.put(displayId, info.getDefaultMode());
+                }
+                if (changed) {
+                    notifyAllowedModesChangedLocked();
+                }
+            }
+        }
+    }
+}
diff --git a/services/core/java/com/android/server/display/DisplayPowerController.java b/services/core/java/com/android/server/display/DisplayPowerController.java
index 15c7ef7..b79ead0 100644
--- a/services/core/java/com/android/server/display/DisplayPowerController.java
+++ b/services/core/java/com/android/server/display/DisplayPowerController.java
@@ -44,6 +44,7 @@
 import android.os.Trace;
 import android.os.UserHandle;
 import android.provider.Settings;
+import android.text.TextUtils;
 import android.util.MathUtils;
 import android.util.Slog;
 import android.util.TimeUtils;
@@ -58,6 +59,7 @@
 import com.android.server.policy.WindowManagerPolicy;
 
 import java.io.PrintWriter;
+import java.util.List;
 
 /**
  * Controls the power state of the display.
@@ -474,10 +476,14 @@
             int shortTermModelTimeout = resources.getInteger(
                     com.android.internal.R.integer.config_autoBrightnessShortTermModelTimeout);
 
+            String lightSensorType = resources.getString(
+                    com.android.internal.R.string.config_displayLightSensorType);
+            Sensor lightSensor = findDisplayLightSensor(lightSensorType);
+
             mBrightnessMapper = BrightnessMappingStrategy.create(resources);
             if (mBrightnessMapper != null) {
                 mAutomaticBrightnessController = new AutomaticBrightnessController(this,
-                        handler.getLooper(), sensorManager, mBrightnessMapper,
+                        handler.getLooper(), sensorManager, lightSensor, mBrightnessMapper,
                         lightSensorWarmUpTimeConfig, mScreenBrightnessRangeMinimum,
                         mScreenBrightnessRangeMaximum, dozeScaleFactor, lightSensorRate,
                         initialLightSensorRate, brighteningLightDebounce, darkeningLightDebounce,
@@ -530,6 +536,19 @@
         mDisplayWhiteBalanceController = displayWhiteBalanceController;
     }
 
+    private Sensor findDisplayLightSensor(String sensorType) {
+        if (!TextUtils.isEmpty(sensorType)) {
+            List<Sensor> sensors = mSensorManager.getSensorList(Sensor.TYPE_ALL);
+            for (int i = 0; i < sensors.size(); i++) {
+                Sensor sensor = sensors.get(i);
+                if (sensorType.equals(sensor.getStringType())) {
+                    return sensor;
+                }
+            }
+        }
+        return mSensorManager.getDefaultSensor(Sensor.TYPE_LIGHT);
+    }
+
     /**
      * Returns true if the proximity sensor screen-off function is available.
      */
@@ -874,7 +893,7 @@
 
         // If the brightness is already set then it's been overridden by something other than the
         // user, or is a temporary adjustment.
-        final boolean userInitiatedChange = brightness < 0
+        boolean userInitiatedChange = brightness < 0
                 && (autoBrightnessAdjustmentChanged || userSetBrightnessChanged);
 
         boolean hadUserBrightnessPoint = false;
@@ -1010,6 +1029,12 @@
             }
 
             if (!brightnessIsTemporary) {
+                if (userInitiatedChange && (mAutomaticBrightnessController == null
+                        || !mAutomaticBrightnessController.hasValidAmbientLux())) {
+                    // If we don't have a valid lux reading we can't report a valid
+                    // slider event so notify as if the system changed the brightness.
+                    userInitiatedChange = false;
+                }
                 notifyBrightnessChanged(brightness, userInitiatedChange, hadUserBrightnessPoint);
             }
 
diff --git a/services/core/java/com/android/server/display/LocalDisplayAdapter.java b/services/core/java/com/android/server/display/LocalDisplayAdapter.java
index 77df10b..5e5ef26 100644
--- a/services/core/java/com/android/server/display/LocalDisplayAdapter.java
+++ b/services/core/java/com/android/server/display/LocalDisplayAdapter.java
@@ -112,16 +112,18 @@
                 activeColorMode = Display.COLOR_MODE_INVALID;
             }
             int[] colorModes = SurfaceControl.getDisplayColorModes(displayToken);
+            int[] allowedConfigs = SurfaceControl.getAllowedDisplayConfigs(displayToken);
             LocalDisplayDevice device = mDevices.get(physicalDisplayId);
             if (device == null) {
                 // Display was added.
                 final boolean isInternal = mDevices.size() == 0;
                 device = new LocalDisplayDevice(displayToken, physicalDisplayId,
-                        configs, activeConfig, colorModes, activeColorMode, isInternal);
+                        configs, activeConfig, allowedConfigs, colorModes, activeColorMode,
+                        isInternal);
                 mDevices.put(physicalDisplayId, device);
                 sendDisplayDeviceEventLocked(device, DISPLAY_DEVICE_EVENT_ADDED);
             } else if (device.updatePhysicalDisplayInfoLocked(configs, activeConfig,
-                        colorModes, activeColorMode)) {
+                        allowedConfigs, colorModes, activeColorMode)) {
                 // Display properties changed.
                 sendDisplayDeviceEventLocked(device, DISPLAY_DEVICE_EVENT_CHANGED);
             }
@@ -167,26 +169,30 @@
         private boolean mHavePendingChanges;
         private int mState = Display.STATE_UNKNOWN;
         private int mBrightness = PowerManager.BRIGHTNESS_DEFAULT;
-        private int mActivePhysIndex;
         private int mDefaultModeId;
         private int mActiveModeId;
         private boolean mActiveModeInvalid;
+        private int[] mAllowedModeIds;
+        private boolean mAllowedModeIdsInvalid;
+        private int mActivePhysIndex;
+        private int[] mAllowedPhysIndexes;
         private int mActiveColorMode;
         private boolean mActiveColorModeInvalid;
         private Display.HdrCapabilities mHdrCapabilities;
         private boolean mSidekickActive;
         private SidekickInternal mSidekickInternal;
 
-        private  SurfaceControl.PhysicalDisplayInfo mDisplayInfos[];
+        private SurfaceControl.PhysicalDisplayInfo[] mDisplayInfos;
 
         LocalDisplayDevice(IBinder displayToken, long physicalDisplayId,
                 SurfaceControl.PhysicalDisplayInfo[] physicalDisplayInfos, int activeDisplayInfo,
-                int[] colorModes, int activeColorMode, boolean isInternal) {
+                int[] allowedDisplayInfos, int[] colorModes, int activeColorMode,
+                boolean isInternal) {
             super(LocalDisplayAdapter.this, displayToken, UNIQUE_ID_PREFIX + physicalDisplayId);
             mPhysicalDisplayId = physicalDisplayId;
             mIsInternal = isInternal;
             updatePhysicalDisplayInfoLocked(physicalDisplayInfos, activeDisplayInfo,
-                    colorModes, activeColorMode);
+                    allowedDisplayInfos, colorModes, activeColorMode);
             updateColorModesLocked(colorModes, activeColorMode);
             mSidekickInternal = LocalServices.getService(SidekickInternal.class);
             if (mIsInternal) {
@@ -205,9 +211,10 @@
 
         public boolean updatePhysicalDisplayInfoLocked(
                 SurfaceControl.PhysicalDisplayInfo[] physicalDisplayInfos, int activeDisplayInfo,
-                int[] colorModes, int activeColorMode) {
+                int[] allowedDisplayInfos, int[] colorModes, int activeColorMode) {
             mDisplayInfos = Arrays.copyOf(physicalDisplayInfos, physicalDisplayInfos.length);
             mActivePhysIndex = activeDisplayInfo;
+            mAllowedPhysIndexes = Arrays.copyOf(allowedDisplayInfos, allowedDisplayInfos.length);
             // Build an updated list of all existing modes.
             ArrayList<DisplayModeRecord> records = new ArrayList<DisplayModeRecord>();
             boolean modesAdded = false;
@@ -246,8 +253,9 @@
                     break;
                 }
             }
-            // Check whether surface flinger spontaneously changed modes out from under us. Schedule
-            // traversals to ensure that the correct state is reapplied if necessary.
+
+            // Check whether surface flinger spontaneously changed modes out from under us.
+            // Schedule traversals to ensure that the correct state is reapplied if necessary.
             if (mActiveModeId != 0
                     && mActiveModeId != activeRecord.mMode.getModeId()) {
                 mActiveModeInvalid = true;
@@ -266,6 +274,7 @@
             for (DisplayModeRecord record : records) {
                 mSupportedModes.put(record.mMode.getModeId(), record);
             }
+
             // Update the default mode, if needed.
             if (findDisplayInfoIndexLocked(mDefaultModeId) < 0) {
                 if (mDefaultModeId != 0) {
@@ -274,6 +283,7 @@
                 }
                 mDefaultModeId = activeRecord.mMode.getModeId();
             }
+
             // Determine whether the active mode is still there.
             if (mSupportedModes.indexOfKey(mActiveModeId) < 0) {
                 if (mActiveModeId != 0) {
@@ -284,6 +294,21 @@
                 mActiveModeInvalid = true;
             }
 
+            // Determine what the currently allowed modes are
+            mAllowedModeIds = new int[] { mActiveModeId };
+            int[] allowedModeIds = new int[mAllowedPhysIndexes.length];
+            int size = 0;
+            for (int physIndex : mAllowedPhysIndexes) {
+                int modeId = findMatchingModeIdLocked(physIndex);
+                if (modeId > 0) {
+                    allowedModeIds[size++] = modeId;
+                }
+            }
+
+            // If this is different from our desired allowed modes, then mark our current set as
+            // invalid so we correct this on the next traversal.
+            mAllowedModeIdsInvalid = !Arrays.equals(allowedModeIds, mAllowedModeIds);
+
             // Schedule traversals so that we apply pending changes.
             sendTraversalRequestLocked();
             return true;
@@ -368,11 +393,7 @@
                 mInfo.height = phys.height;
                 mInfo.modeId = mActiveModeId;
                 mInfo.defaultModeId = mDefaultModeId;
-                mInfo.supportedModes = new Display.Mode[mSupportedModes.size()];
-                for (int i = 0; i < mSupportedModes.size(); i++) {
-                    DisplayModeRecord record = mSupportedModes.valueAt(i);
-                    mInfo.supportedModes[i] = record.mMode;
-                }
+                mInfo.supportedModes = getDisplayModes(mSupportedModes);
                 mInfo.colorMode = mActiveColorMode;
                 mInfo.supportedColorModes =
                         new int[mSupportedColorModes.size()];
@@ -593,44 +614,104 @@
         }
 
         @Override
-        public void requestDisplayModesLocked(int colorMode, int modeId) {
-            if (requestModeLocked(modeId) ||
-                    requestColorModeLocked(colorMode)) {
+        public void setRequestedColorModeLocked(int colorMode) {
+            if (requestColorModeLocked(colorMode)) {
                 updateDeviceInfoLocked();
             }
         }
 
         @Override
+        public void setAllowedDisplayModesLocked(int[] modes) {
+            updateAllowedModesLocked(modes);
+        }
+
+        @Override
         public void onOverlayChangedLocked() {
             updateDeviceInfoLocked();
         }
 
-        public boolean requestModeLocked(int modeId) {
-            if (modeId == 0) {
-                modeId = mDefaultModeId;
-            } else if (mSupportedModes.indexOfKey(modeId) < 0) {
-                Slog.w(TAG, "Requested mode " + modeId + " is not supported by this display,"
-                        + " reverting to default display mode.");
-                modeId = mDefaultModeId;
+        public void onActivePhysicalDisplayModeChangedLocked(int physIndex) {
+            if (updateActiveModeLocked(physIndex)) {
+                updateDeviceInfoLocked();
             }
+        }
 
-            int physIndex = findDisplayInfoIndexLocked(modeId);
-            if (physIndex < 0) {
-                Slog.w(TAG, "Requested mode ID " + modeId + " not available,"
-                        + " trying with default mode ID");
-                modeId = mDefaultModeId;
-                physIndex = findDisplayInfoIndexLocked(modeId);
-            }
-            if (mActivePhysIndex == physIndex) {
+        public boolean updateActiveModeLocked(int activePhysIndex) {
+            if (mActivePhysIndex == activePhysIndex) {
                 return false;
             }
-            SurfaceControl.setActiveConfig(getDisplayTokenLocked(), physIndex);
-            mActivePhysIndex = physIndex;
-            mActiveModeId = modeId;
-            mActiveModeInvalid = false;
+            mActivePhysIndex = activePhysIndex;
+            mActiveModeId = findMatchingModeIdLocked(activePhysIndex);
+            mActiveModeInvalid = mActiveModeId == 0;
+            if (mActiveModeInvalid) {
+                Slog.w(TAG, "In unknown mode after setting allowed configs"
+                        + ": allowedPhysIndexes=" + mAllowedPhysIndexes
+                        + ", activePhysIndex=" + mActivePhysIndex);
+            }
             return true;
         }
 
+        public void updateAllowedModesLocked(int[] allowedModes) {
+            if (Arrays.equals(allowedModes, mAllowedModeIds) && !mAllowedModeIdsInvalid) {
+                return;
+            }
+            if (updateAllowedModesInternalLocked(allowedModes)) {
+                updateDeviceInfoLocked();
+            }
+        }
+
+        public boolean updateAllowedModesInternalLocked(int[] allowedModes) {
+            if (DEBUG) {
+                Slog.w(TAG, "updateAllowedModesInternalLocked(allowedModes="
+                        + Arrays.toString(allowedModes) + ")");
+            }
+            int[] allowedPhysIndexes = new int[allowedModes.length];
+            int size = 0;
+            for (int modeId : allowedModes) {
+                int physIndex = findDisplayInfoIndexLocked(modeId);
+                if (physIndex < 0) {
+                    Slog.w(TAG, "Requested mode ID " + modeId + " not available,"
+                            + " dropping from allowed set.");
+                } else {
+                    allowedPhysIndexes[size++] = physIndex;
+                }
+            }
+
+            // If we couldn't find one or more of the suggested allowed modes then we need to
+            // shrink the array to its actual size.
+            if (size != allowedModes.length) {
+                allowedPhysIndexes = Arrays.copyOf(allowedPhysIndexes, size);
+            }
+
+            // If we found no suitable modes, then we try again with the default mode which we
+            // assume has a suitable physical config.
+            if (size == 0) {
+                if (DEBUG) {
+                    Slog.w(TAG, "No valid modes allowed, falling back to default mode (id="
+                            + mDefaultModeId + ")");
+                }
+                allowedModes = new int[] { mDefaultModeId };
+                allowedPhysIndexes = new int[] { findDisplayInfoIndexLocked(mDefaultModeId) };
+            }
+
+            mAllowedModeIds = allowedModes;
+            mAllowedModeIdsInvalid = false;
+
+            if (Arrays.equals(mAllowedPhysIndexes, allowedPhysIndexes)) {
+                return false;
+            }
+            mAllowedPhysIndexes = allowedPhysIndexes;
+
+            if (DEBUG) {
+                Slog.w(TAG, "Setting allowed physical configs: allowedPhysIndexes="
+                        + Arrays.toString(allowedPhysIndexes));
+            }
+
+            SurfaceControl.setAllowedDisplayConfigs(getDisplayTokenLocked(), allowedPhysIndexes);
+            int activePhysIndex = SurfaceControl.getActiveConfig(getDisplayTokenLocked());
+            return updateActiveModeLocked(activePhysIndex);
+        }
+
         public boolean requestColorModeLocked(int colorMode) {
             if (mActiveColorMode == colorMode) {
                 return false;
@@ -650,9 +731,13 @@
         public void dumpLocked(PrintWriter pw) {
             super.dumpLocked(pw);
             pw.println("mPhysicalDisplayId=" + mPhysicalDisplayId);
+            pw.println("mAllowedPhysIndexes=" + Arrays.toString(mAllowedPhysIndexes));
+            pw.println("mAllowedModeIds=" + Arrays.toString(mAllowedModeIds));
+            pw.println("mAllowedModeIdsInvalid=" + mAllowedModeIdsInvalid);
             pw.println("mActivePhysIndex=" + mActivePhysIndex);
             pw.println("mActiveModeId=" + mActiveModeId);
             pw.println("mActiveColorMode=" + mActiveColorMode);
+            pw.println("mDefaultModeId=" + mDefaultModeId);
             pw.println("mState=" + Display.stateToString(mState));
             pw.println("mBrightness=" + mBrightness);
             pw.println("mBacklight=" + mBacklight);
@@ -687,10 +772,31 @@
             return -1;
         }
 
+        private int findMatchingModeIdLocked(int physIndex) {
+            SurfaceControl.PhysicalDisplayInfo info = mDisplayInfos[physIndex];
+            for (int i = 0; i < mSupportedModes.size(); i++) {
+                DisplayModeRecord record = mSupportedModes.valueAt(i);
+                if (record.hasMatchingMode(info)) {
+                    return record.mMode.getModeId();
+                }
+            }
+            return 0;
+        }
+
         private void updateDeviceInfoLocked() {
             mInfo = null;
             sendDisplayDeviceEventLocked(this, DISPLAY_DEVICE_EVENT_CHANGED);
         }
+
+        private Display.Mode[] getDisplayModes(SparseArray<DisplayModeRecord> records) {
+            final int size = records.size();
+            Display.Mode[] modes = new Display.Mode[size];
+            for (int i = 0; i < size; i++) {
+                DisplayModeRecord record = records.valueAt(i);
+                modes[i] = record.mMode;
+            }
+            return modes;
+        }
     }
 
     /** Supplies a context whose Resources apply runtime-overlays */
@@ -745,12 +851,23 @@
         }
 
         @Override
-        public void onConfigChanged(long timestampNanos, long physicalDisplayId, int configId) {
+        public void onConfigChanged(long timestampNanos, long physicalDisplayId, int physIndex) {
             if (DEBUG) {
                 Slog.d(TAG, "onConfigChanged("
                         + "timestampNanos=" + timestampNanos
-                        + ", builtInDisplayId=" + physicalDisplayId
-                        + ", configId=" + configId + ")");
+                        + ", physicalDisplayId=" + physicalDisplayId
+                        + ", physIndex=" + physIndex + ")");
+            }
+            synchronized (getSyncRoot()) {
+                LocalDisplayDevice device = mDevices.get(physicalDisplayId);
+                if (device == null) {
+                    if (DEBUG) {
+                        Slog.d(TAG, "Received config change for unhandled physical display: "
+                                + "physicalDisplayId=" + physicalDisplayId);
+                    }
+                    return;
+                }
+                device.onActivePhysicalDisplayModeChangedLocked(physIndex);
             }
         }
     }
diff --git a/services/core/java/com/android/server/display/LogicalDisplay.java b/services/core/java/com/android/server/display/LogicalDisplay.java
index 7ee8422..a7b9051 100644
--- a/services/core/java/com/android/server/display/LogicalDisplay.java
+++ b/services/core/java/com/android/server/display/LogicalDisplay.java
@@ -87,7 +87,7 @@
     // True if the logical display has unique content.
     private boolean mHasContent;
 
-    private int mRequestedModeId;
+    private int[] mAllowedDisplayModes = new int[0];
     private int mRequestedColorMode;
 
     // The display offsets to apply to the display projection.
@@ -301,6 +301,7 @@
             boolean maskCutout =
                     (deviceInfo.flags & DisplayDeviceInfo.FLAG_MASK_DISPLAY_CUTOUT) != 0;
             mBaseDisplayInfo.displayCutout = maskCutout ? null : deviceInfo.displayCutout;
+            mBaseDisplayInfo.displayId = mDisplayId;
 
             mPrimaryDisplayDeviceInfo = deviceInfo;
             mInfo = null;
@@ -353,12 +354,14 @@
         // Set the layer stack.
         device.setLayerStackLocked(t, isBlanked ? BLANK_LAYER_STACK : mLayerStack);
 
-        // Set the color mode and mode.
+        // Set the color mode and allowed display mode.
         if (device == mPrimaryDisplayDevice) {
-            device.requestDisplayModesLocked(
-                    mRequestedColorMode, mRequestedModeId);
+            device.setAllowedDisplayModesLocked(mAllowedDisplayModes);
+            device.setRequestedColorModeLocked(mRequestedColorMode);
         } else {
-            device.requestDisplayModesLocked(0, 0);  // Revert to default.
+            // Reset to default for non primary displays
+            device.setAllowedDisplayModesLocked(new int[] {0});
+            device.setRequestedColorModeLocked(0);
         }
 
         // Only grab the display info now as it may have been changed based on the requests above.
@@ -462,17 +465,17 @@
     }
 
     /**
-     * Requests the given mode.
+     * Sets the display modes the system is free to switch between.
      */
-    public void setRequestedModeIdLocked(int modeId) {
-        mRequestedModeId = modeId;
+    public void setAllowedDisplayModesLocked(int[] modes) {
+        mAllowedDisplayModes = modes;
     }
 
     /**
-     * Returns the pending requested mode.
+     * Returns the display modes the system is free to switch between.
      */
-    public int getRequestedModeIdLocked() {
-        return mRequestedModeId;
+    public int[] getAllowedDisplayModesLocked() {
+        return mAllowedDisplayModes;
     }
 
     /**
@@ -531,7 +534,7 @@
         pw.println("mDisplayId=" + mDisplayId);
         pw.println("mLayerStack=" + mLayerStack);
         pw.println("mHasContent=" + mHasContent);
-        pw.println("mRequestedMode=" + mRequestedModeId);
+        pw.println("mAllowedDisplayModes=" + Arrays.toString(mAllowedDisplayModes));
         pw.println("mRequestedColorMode=" + mRequestedColorMode);
         pw.println("mDisplayOffset=(" + mDisplayOffsetX + ", " + mDisplayOffsetY + ")");
         pw.println("mDisplayScalingDisabled=" + mDisplayScalingDisabled);
diff --git a/services/core/java/com/android/server/display/OWNERS b/services/core/java/com/android/server/display/OWNERS
index 0d64dbd..25cb5ae 100644
--- a/services/core/java/com/android/server/display/OWNERS
+++ b/services/core/java/com/android/server/display/OWNERS
@@ -2,5 +2,3 @@
 dangittik@google.com
 hackbod@google.com
 ogunwale@google.com
-
-per-file ColorDisplayService.java=christyfranks@google.com
diff --git a/services/core/java/com/android/server/display/OverlayDisplayAdapter.java b/services/core/java/com/android/server/display/OverlayDisplayAdapter.java
index 2f507d1..60cfbd0 100644
--- a/services/core/java/com/android/server/display/OverlayDisplayAdapter.java
+++ b/services/core/java/com/android/server/display/OverlayDisplayAdapter.java
@@ -16,9 +16,6 @@
 
 package com.android.server.display;
 
-import com.android.internal.util.DumpUtils;
-import com.android.internal.util.IndentingPrintWriter;
-
 import android.content.Context;
 import android.database.ContentObserver;
 import android.graphics.SurfaceTexture;
@@ -32,6 +29,9 @@
 import android.view.Surface;
 import android.view.SurfaceControl;
 
+import com.android.internal.util.DumpUtils;
+import com.android.internal.util.IndentingPrintWriter;
+
 import java.io.PrintWriter;
 import java.util.ArrayList;
 import java.util.Arrays;
@@ -315,7 +315,16 @@
         }
 
         @Override
-        public void requestDisplayModesLocked(int color, int id) {
+        public void setAllowedDisplayModesLocked(int[] modes) {
+            final int id;
+            if (modes.length > 0) {
+                // The allowed modes should be ordered by preference, so just use the first mode
+                // here.
+                id = modes[0];
+            } else {
+                // If we don't have any allowed modes, just use the default mode.
+                id = 0;
+            }
             int index = -1;
             if (id == 0) {
                 // Use the default.
diff --git a/services/core/java/com/android/server/display/AppSaturationController.java b/services/core/java/com/android/server/display/color/AppSaturationController.java
similarity index 98%
rename from services/core/java/com/android/server/display/AppSaturationController.java
rename to services/core/java/com/android/server/display/color/AppSaturationController.java
index 5d5e4f7..e42be02 100644
--- a/services/core/java/com/android/server/display/AppSaturationController.java
+++ b/services/core/java/com/android/server/display/color/AppSaturationController.java
@@ -14,14 +14,14 @@
  * limitations under the License.
  */
 
-package com.android.server.display;
+package com.android.server.display.color;
 
 import android.annotation.UserIdInt;
 import android.util.SparseArray;
 
 import com.android.internal.annotations.GuardedBy;
 import com.android.internal.annotations.VisibleForTesting;
-import com.android.server.display.ColorDisplayService.ColorTransformController;
+import com.android.server.display.color.ColorDisplayService.ColorTransformController;
 
 import java.io.PrintWriter;
 import java.lang.ref.WeakReference;
diff --git a/services/core/java/com/android/server/display/ColorDisplayService.java b/services/core/java/com/android/server/display/color/ColorDisplayService.java
similarity index 96%
rename from services/core/java/com/android/server/display/ColorDisplayService.java
rename to services/core/java/com/android/server/display/color/ColorDisplayService.java
index 7dd3b36..2311776 100644
--- a/services/core/java/com/android/server/display/ColorDisplayService.java
+++ b/services/core/java/com/android/server/display/color/ColorDisplayService.java
@@ -14,7 +14,7 @@
  * limitations under the License.
  */
 
-package com.android.server.display;
+package com.android.server.display.color;
 
 import static android.hardware.display.ColorDisplayManager.AUTO_MODE_CUSTOM_TIME;
 import static android.hardware.display.ColorDisplayManager.AUTO_MODE_DISABLED;
@@ -24,9 +24,9 @@
 import static android.hardware.display.ColorDisplayManager.COLOR_MODE_NATURAL;
 import static android.hardware.display.ColorDisplayManager.COLOR_MODE_SATURATED;
 
-import static com.android.server.display.DisplayTransformManager.LEVEL_COLOR_MATRIX_DISPLAY_WHITE_BALANCE;
-import static com.android.server.display.DisplayTransformManager.LEVEL_COLOR_MATRIX_NIGHT_DISPLAY;
-import static com.android.server.display.DisplayTransformManager.LEVEL_COLOR_MATRIX_SATURATION;
+import static com.android.server.display.color.DisplayTransformManager.LEVEL_COLOR_MATRIX_DISPLAY_WHITE_BALANCE;
+import static com.android.server.display.color.DisplayTransformManager.LEVEL_COLOR_MATRIX_NIGHT_DISPLAY;
+import static com.android.server.display.color.DisplayTransformManager.LEVEL_COLOR_MATRIX_SATURATION;
 
 import android.Manifest;
 import android.animation.Animator;
@@ -233,6 +233,7 @@
     public void onStart() {
         publishBinderService(Context.COLOR_DISPLAY_SERVICE, new BinderService());
         publishLocalService(ColorDisplayServiceInternal.class, new ColorDisplayServiceInternal());
+        publishLocalService(DisplayTransformManager.class, new DisplayTransformManager());
     }
 
     @Override
@@ -632,9 +633,9 @@
     @VisibleForTesting
     void updateDisplayWhiteBalanceStatus() {
         boolean oldActivated = mDisplayWhiteBalanceTintController.isActivated();
-        mDisplayWhiteBalanceTintController.setActivated(isDisplayWhiteBalanceSettingEnabled() &&
-                !mNightDisplayTintController.isActivated() &&
-                DisplayTransformManager.needsLinearColorMatrix());
+        mDisplayWhiteBalanceTintController.setActivated(isDisplayWhiteBalanceSettingEnabled()
+                && !mNightDisplayTintController.isActivated()
+                && DisplayTransformManager.needsLinearColorMatrix());
         boolean activated = mDisplayWhiteBalanceTintController.isActivated();
 
         if (mDisplayWhiteBalanceListener != null && oldActivated != activated) {
@@ -819,7 +820,7 @@
     /**
      * Get the current color mode from system properties, or return -1 if invalid.
      *
-     * See {@link com.android.server.display.DisplayTransformManager}
+     * See {@link DisplayTransformManager}
      */
     private @ColorMode int getCurrentColorModeFromSystemProperties() {
         final int displayColorSetting = SystemProperties.getInt("persist.sys.sf.native_mode", 0);
@@ -851,7 +852,7 @@
     private void dumpInternal(PrintWriter pw) {
         pw.println("COLOR DISPLAY MANAGER dumpsys (color_display)");
 
-        pw.println("Night Display:");
+        pw.println("Night display:");
         if (mNightDisplayTintController.isAvailable(getContext())) {
             pw.println("    Activated: " + mNightDisplayTintController.isActivated());
             pw.println("    Color temp: " + mNightDisplayTintController.getColorTemperature());
@@ -923,14 +924,15 @@
 
             if (mLastActivatedTime != null) {
                 // Maintain the existing activated state if within the current period.
-                if (mLastActivatedTime.isBefore(now) && mLastActivatedTime.isAfter(start)
+                if (mLastActivatedTime.isBefore(now)
+                        && mLastActivatedTime.isAfter(start)
                         && (mLastActivatedTime.isAfter(end) || now.isBefore(end))) {
                     activate = mNightDisplayTintController.isActivatedSetting();
                 }
             }
 
-            if (mNightDisplayTintController.isActivatedStateNotSet() || (
-                    mNightDisplayTintController.isActivated() != activate)) {
+            if (mNightDisplayTintController.isActivatedStateNotSet()
+                    || (mNightDisplayTintController.isActivated() != activate)) {
                 mNightDisplayTintController.setActivated(activate);
             }
 
@@ -1274,11 +1276,17 @@
         }
 
         boolean isActivatedSetting() {
+            if (mCurrentUser == UserHandle.USER_NULL) {
+                return false;
+            }
             return Secure.getIntForUser(getContext().getContentResolver(),
                     Secure.NIGHT_DISPLAY_ACTIVATED, 0, mCurrentUser) == 1;
         }
 
         int getColorTemperatureSetting() {
+            if (mCurrentUser == UserHandle.USER_NULL) {
+                return NOT_SET;
+            }
             return clampNightDisplayColorTemperature(Secure.getIntForUser(
                     getContext().getContentResolver(), Secure.NIGHT_DISPLAY_COLOR_TEMPERATURE,
                     NOT_SET,
@@ -1305,10 +1313,11 @@
     }
 
     final class DisplayWhiteBalanceTintController extends TintController {
+
         // Three chromaticity coordinates per color: X, Y, and Z
-        private final int NUM_VALUES_PER_PRIMARY = 3;
+        private static final int NUM_VALUES_PER_PRIMARY = 3;
         // Four colors: red, green, blue, and white
-        private final int NUM_DISPLAY_PRIMARIES_VALS = 4 * NUM_VALUES_PER_PRIMARY;
+        private static final int NUM_DISPLAY_PRIMARIES_VALS = 4 * NUM_VALUES_PER_PRIMARY;
 
         private final Object mLock = new Object();
         @VisibleForTesting
@@ -1478,25 +1487,25 @@
                 pw.println("    mTemperatureMax = " + mTemperatureMax);
                 pw.println("    mTemperatureDefault = " + mTemperatureDefault);
                 pw.println("    mCurrentColorTemperature = " + mCurrentColorTemperature);
-                pw.println("    mCurrentColorTemperatureXYZ = " +
-                        matrixToString(mCurrentColorTemperatureXYZ, 3));
-                pw.println("    mDisplayColorSpaceRGB RGB-to-XYZ = " +
-                        matrixToString(mDisplayColorSpaceRGB.getTransform(), 3));
-                pw.println("    mChromaticAdaptationMatrix = " +
-                        matrixToString(mChromaticAdaptationMatrix, 3));
-                pw.println("    mDisplayColorSpaceRGB XYZ-to-RGB = " +
-                        matrixToString(mDisplayColorSpaceRGB.getInverseTransform(), 3));
-                pw.println("    mMatrixDisplayWhiteBalance = " +
-                        matrixToString(mMatrixDisplayWhiteBalance, 4));
+                pw.println("    mCurrentColorTemperatureXYZ = "
+                        + matrixToString(mCurrentColorTemperatureXYZ, 3));
+                pw.println("    mDisplayColorSpaceRGB RGB-to-XYZ = "
+                        + matrixToString(mDisplayColorSpaceRGB.getTransform(), 3));
+                pw.println("    mChromaticAdaptationMatrix = "
+                        + matrixToString(mChromaticAdaptationMatrix, 3));
+                pw.println("    mDisplayColorSpaceRGB XYZ-to-RGB = "
+                        + matrixToString(mDisplayColorSpaceRGB.getInverseTransform(), 3));
+                pw.println("    mMatrixDisplayWhiteBalance = "
+                        + matrixToString(mMatrixDisplayWhiteBalance, 4));
             }
         }
 
         private ColorSpace.Rgb makeRgbColorSpaceFromXYZ(float[] redGreenBlueXYZ, float[] whiteXYZ) {
             return new ColorSpace.Rgb(
-                "Display Color Space",
-                redGreenBlueXYZ,
-                whiteXYZ,
-                2.2f // gamma, unused for display white balance
+                    "Display Color Space",
+                    redGreenBlueXYZ,
+                    whiteXYZ,
+                    2.2f // gamma, unused for display white balance
             );
         }
 
@@ -1507,19 +1516,19 @@
             }
 
             DisplayPrimaries primaries = SurfaceControl.getDisplayNativePrimaries(displayToken);
-            if (primaries == null || primaries.red == null || primaries.green == null ||
-                primaries.blue == null || primaries.white == null) {
+            if (primaries == null || primaries.red == null || primaries.green == null
+                    || primaries.blue == null || primaries.white == null) {
                 return null;
             }
 
             return makeRgbColorSpaceFromXYZ(
-                    new float[] {
-                        primaries.red.X, primaries.red.Y, primaries.red.Z,
-                        primaries.green.X, primaries.green.Y, primaries.green.Z,
-                        primaries.blue.X, primaries.blue.Y, primaries.blue.Z,
+                    new float[]{
+                            primaries.red.X, primaries.red.Y, primaries.red.Z,
+                            primaries.green.X, primaries.green.Y, primaries.green.Z,
+                            primaries.blue.X, primaries.blue.Y, primaries.blue.Z,
                     },
-                    new float[] { primaries.white.X, primaries.white.Y, primaries.white.Z }
-                    );
+                    new float[]{primaries.white.X, primaries.white.Y, primaries.white.Z}
+            );
         }
 
         private ColorSpace.Rgb getDisplayColorSpaceFromResources(Resources res) {
@@ -1540,7 +1549,7 @@
 
             return makeRgbColorSpaceFromXYZ(displayRedGreenBlueXYZ, displayWhiteXYZ);
         }
-    };
+    }
 
     /**
      * Local service that allows color transforms to be enabled from other system services.
@@ -1572,10 +1581,6 @@
             return mDisplayWhiteBalanceTintController.isActivated();
         }
 
-        public void dump(PrintWriter pw) {
-            mDisplayWhiteBalanceTintController.dump(pw);
-        }
-
         /**
          * Adds a {@link WeakReference<ColorTransformController>} for a newly started activity, and
          * invokes {@link ColorTransformController#applyAppSaturation(float[], float[])} if needed.
diff --git a/services/core/java/com/android/server/display/DisplayTransformManager.java b/services/core/java/com/android/server/display/color/DisplayTransformManager.java
similarity index 96%
rename from services/core/java/com/android/server/display/DisplayTransformManager.java
rename to services/core/java/com/android/server/display/color/DisplayTransformManager.java
index ef92401..026837f 100644
--- a/services/core/java/com/android/server/display/DisplayTransformManager.java
+++ b/services/core/java/com/android/server/display/color/DisplayTransformManager.java
@@ -14,7 +14,7 @@
  * limitations under the License.
  */
 
-package com.android.server.display;
+package com.android.server.display.color;
 
 import android.app.ActivityTaskManager;
 import android.hardware.display.ColorDisplayManager;
@@ -117,12 +117,12 @@
     /**
      * Sets and applies a current color transform matrix for a given level.
      * <p>
-     * Note: all color transforms are first composed to a single matrix in ascending order based
-     * on level before being applied to the display.
+     * Note: all color transforms are first composed to a single matrix in ascending order based on
+     * level before being applied to the display.
      *
      * @param level the level used to identify and compose the color transform (low -> high)
      * @param value the 4x4 color transform matrix (in column-major order), or {@code null} to
-     *              remove the color transform matrix associated with the provided level
+     * remove the color transform matrix associated with the provided level
      */
     public void setColorMatrix(int level, float[] value) {
         if (value != null && value.length != 16) {
@@ -235,13 +235,15 @@
     }
 
     /**
-     * Return true when the specified colorMode requires the color matrix to
-     * work in linear space.
+     * Return true when the specified colorMode requires the color matrix to work in linear space.
      */
     public static boolean needsLinearColorMatrix(int colorMode) {
         return colorMode != ColorDisplayManager.COLOR_MODE_SATURATED;
     }
 
+    /**
+     * Sets color mode and updates night display transform values.
+     */
     public boolean setColorMode(int colorMode, float[] nightDisplayMatrix) {
         if (colorMode == ColorDisplayManager.COLOR_MODE_NATURAL) {
             applySaturation(COLOR_SATURATION_NATURAL);
@@ -264,8 +266,8 @@
     }
 
     /**
-     * Returns whether the screen is color managed via SurfaceFlinger's
-     * {@link #SURFACE_FLINGER_TRANSACTION_QUERY_COLOR_MANAGED}.
+     * Returns whether the screen is color managed via SurfaceFlinger's {@link
+     * #SURFACE_FLINGER_TRANSACTION_QUERY_COLOR_MANAGED}.
      */
     public boolean isDeviceColorManaged() {
         final IBinder flinger = ServiceManager.getService(SURFACE_FLINGER);
diff --git a/services/core/java/com/android/server/display/color/OWNERS b/services/core/java/com/android/server/display/color/OWNERS
new file mode 100644
index 0000000..27adf12
--- /dev/null
+++ b/services/core/java/com/android/server/display/color/OWNERS
@@ -0,0 +1,4 @@
+christyfranks@google.com
+justinklaassen@google.com
+
+per-file DisplayTransformManager.java=michaelwr@google.com
\ No newline at end of file
diff --git a/services/core/java/com/android/server/display/whitebalance/DisplayWhiteBalanceController.java b/services/core/java/com/android/server/display/whitebalance/DisplayWhiteBalanceController.java
index d95e92b..e7181e2 100644
--- a/services/core/java/com/android/server/display/whitebalance/DisplayWhiteBalanceController.java
+++ b/services/core/java/com/android/server/display/whitebalance/DisplayWhiteBalanceController.java
@@ -22,7 +22,7 @@
 
 import com.android.internal.util.Preconditions;
 import com.android.server.LocalServices;
-import com.android.server.display.ColorDisplayService.ColorDisplayServiceInternal;
+import com.android.server.display.color.ColorDisplayService.ColorDisplayServiceInternal;
 import com.android.server.display.utils.History;
 
 import java.io.PrintWriter;
diff --git a/services/core/java/com/android/server/display/whitebalance/DisplayWhiteBalanceSettings.java b/services/core/java/com/android/server/display/whitebalance/DisplayWhiteBalanceSettings.java
index a53e91c..1b7251c 100644
--- a/services/core/java/com/android/server/display/whitebalance/DisplayWhiteBalanceSettings.java
+++ b/services/core/java/com/android/server/display/whitebalance/DisplayWhiteBalanceSettings.java
@@ -29,8 +29,8 @@
 
 import com.android.internal.util.Preconditions;
 import com.android.server.LocalServices;
-import com.android.server.display.ColorDisplayService;
-import com.android.server.display.ColorDisplayService.ColorDisplayServiceInternal;
+import com.android.server.display.color.ColorDisplayService;
+import com.android.server.display.color.ColorDisplayService.ColorDisplayServiceInternal;
 import com.android.server.display.whitebalance.DisplayWhiteBalanceController.Callbacks;
 
 import java.io.PrintWriter;
diff --git a/services/core/java/com/android/server/inputmethod/InputMethodManagerService.java b/services/core/java/com/android/server/inputmethod/InputMethodManagerService.java
index 96ba084..150303a 100644
--- a/services/core/java/com/android/server/inputmethod/InputMethodManagerService.java
+++ b/services/core/java/com/android/server/inputmethod/InputMethodManagerService.java
@@ -64,7 +64,6 @@
 import android.content.res.TypedArray;
 import android.database.ContentObserver;
 import android.graphics.drawable.Drawable;
-import android.hardware.display.DisplayManagerInternal;
 import android.inputmethodservice.InputMethodService;
 import android.net.Uri;
 import android.os.Binder;
@@ -99,8 +98,6 @@
 import android.util.Printer;
 import android.util.Slog;
 import android.view.ContextThemeWrapper;
-import android.view.Display;
-import android.view.DisplayInfo;
 import android.view.IWindowManager;
 import android.view.InputChannel;
 import android.view.LayoutInflater;
@@ -952,15 +949,15 @@
         }
     }
 
-    class ImmsBroadcastReceiver extends BroadcastReceiver {
+    /**
+     * {@link BroadcastReceiver} that is intended to listen to broadcasts sent to the system user
+     * only.
+     */
+    private final class ImmsBroadcastReceiverForSystemUser extends BroadcastReceiver {
         @Override
         public void onReceive(Context context, Intent intent) {
             final String action = intent.getAction();
-            if (Intent.ACTION_CLOSE_SYSTEM_DIALOGS.equals(action)) {
-                hideInputMethodMenu();
-                // No need to update mIsInteractive
-                return;
-            } else if (Intent.ACTION_USER_ADDED.equals(action)
+            if (Intent.ACTION_USER_ADDED.equals(action)
                     || Intent.ACTION_USER_REMOVED.equals(action)) {
                 updateCurrentProfileIds();
                 return;
@@ -984,6 +981,35 @@
     }
 
     /**
+     * {@link BroadcastReceiver} that is intended to listen to broadcasts sent to all the users.
+     */
+    private final class ImmsBroadcastReceiverForAllUsers extends BroadcastReceiver {
+        @Override
+        public void onReceive(Context context, Intent intent) {
+            final String action = intent.getAction();
+            if (Intent.ACTION_CLOSE_SYSTEM_DIALOGS.equals(action)) {
+                final PendingResult pendingResult = getPendingResult();
+                if (pendingResult == null) {
+                    return;
+                }
+                // sender userId can be a real user ID or USER_ALL.
+                final int senderUserId = pendingResult.getSendingUserId();
+                if (senderUserId != UserHandle.USER_ALL) {
+                    final int resolvedUserId = PER_PROFILE_IME_ENABLED
+                            ? senderUserId : mUserManagerInternal.getProfileParentId(senderUserId);
+                    if (resolvedUserId != mSettings.getCurrentUserId()) {
+                        // A background user is trying to hide the dialog. Ignore.
+                        return;
+                    }
+                }
+                hideInputMethodMenu();
+            } else {
+                Slog.w(TAG, "Unexpected intent " + intent);
+            }
+        }
+    }
+
+    /**
      * Handles {@link Intent#ACTION_LOCALE_CHANGED}.
      *
      * <p>Note: For historical reasons, {@link Intent#ACTION_LOCALE_CHANGED} has been sent to all
@@ -1374,13 +1400,7 @@
         mIWindowManager = IWindowManager.Stub.asInterface(
                 ServiceManager.getService(Context.WINDOW_SERVICE));
         mWindowManagerInternal = LocalServices.getService(WindowManagerInternal.class);
-        final DisplayManagerInternal displayManagerInternal = LocalServices.getService(
-                DisplayManagerInternal.class);
-        mImeDisplayValidator = (displayId) -> {
-            final DisplayInfo displayInfo = displayManagerInternal.getDisplayInfo(displayId);
-            return displayInfo != null
-                    && (displayInfo.flags & Display.FLAG_SHOULD_SHOW_SYSTEM_DECORATIONS) != 0;
-        };
+        mImeDisplayValidator = mWindowManagerInternal::shouldShowSystemDecorOnDisplay;
         mCaller = new HandlerCaller(context, null, new HandlerCaller.Callback() {
             @Override
             public void executeMessage(Message msg) {
@@ -1557,13 +1577,18 @@
                 mMyPackageMonitor.register(mContext, null, UserHandle.ALL, true);
                 mSettingsObserver.registerContentObserverLocked(currentUserId);
 
-                final IntentFilter broadcastFilter = new IntentFilter();
-                broadcastFilter.addAction(Intent.ACTION_CLOSE_SYSTEM_DIALOGS);
-                broadcastFilter.addAction(Intent.ACTION_USER_ADDED);
-                broadcastFilter.addAction(Intent.ACTION_USER_REMOVED);
-                broadcastFilter.addAction(Intent.ACTION_LOCALE_CHANGED);
-                broadcastFilter.addAction(ACTION_SHOW_INPUT_METHOD_PICKER);
-                mContext.registerReceiver(new ImmsBroadcastReceiver(), broadcastFilter);
+                final IntentFilter broadcastFilterForSystemUser = new IntentFilter();
+                broadcastFilterForSystemUser.addAction(Intent.ACTION_USER_ADDED);
+                broadcastFilterForSystemUser.addAction(Intent.ACTION_USER_REMOVED);
+                broadcastFilterForSystemUser.addAction(Intent.ACTION_LOCALE_CHANGED);
+                broadcastFilterForSystemUser.addAction(ACTION_SHOW_INPUT_METHOD_PICKER);
+                mContext.registerReceiver(new ImmsBroadcastReceiverForSystemUser(),
+                        broadcastFilterForSystemUser);
+
+                final IntentFilter broadcastFilterForAllUsers = new IntentFilter();
+                broadcastFilterForAllUsers.addAction(Intent.ACTION_CLOSE_SYSTEM_DIALOGS);
+                mContext.registerReceiverAsUser(new ImmsBroadcastReceiverForAllUsers(),
+                        UserHandle.ALL, broadcastFilterForAllUsers, null, null);
 
                 final String defaultImiId = mSettings.getSelectedInputMethod();
                 final boolean imeSelectedOnBoot = !TextUtils.isEmpty(defaultImiId);
@@ -4665,9 +4690,11 @@
     private int handleShellCommandEnableDisableInputMethod(
             @NonNull ShellCommand shellCommand, boolean enabled) {
         final String id = shellCommand.getNextArgRequired();
-
         final boolean previouslyEnabled;
         synchronized (mMethodMap) {
+            if (!userHasDebugPriv(mSettings.getCurrentUserId(), shellCommand)) {
+                return ShellCommandResult.SUCCESS;
+            }
             previouslyEnabled = setInputMethodEnabledLocked(id, enabled);
         }
         final PrintWriter pr = shellCommand.getOutPrintWriter();
@@ -4689,6 +4716,9 @@
     private int handleShellCommandSetInputMethod(@NonNull ShellCommand shellCommand) {
         final String id = shellCommand.getNextArgRequired();
         synchronized (mMethodMap) {
+            if (!userHasDebugPriv(mSettings.getCurrentUserId(), shellCommand)) {
+                return ShellCommandResult.SUCCESS;
+            }
             setInputMethodLocked(id, NOT_A_SUBTYPE_ID);
         }
         final PrintWriter pr = shellCommand.getOutPrintWriter();
@@ -4707,6 +4737,9 @@
     @ShellCommandResult
     private int handleShellCommandResetInputMethod(@NonNull ShellCommand shellCommand) {
         synchronized (mMethodMap) {
+            if (!userHasDebugPriv(mSettings.getCurrentUserId(), shellCommand)) {
+                return ShellCommandResult.SUCCESS;
+            }
             final String nextIme;
             final List<InputMethodInfo> nextEnabledImes;
             hideCurrentInputLocked(0, null);
@@ -4744,6 +4777,22 @@
         }
     }
 
+    /**
+     * @param userId the actual user handle obtained by {@link UserHandle#getIdentifier()}
+     * and *not* pseudo ids like {@link UserHandle#USER_ALL etc}.
+     * @return {@code true} if userId has debugging privileges.
+     * i.e. {@link UserManager#DISALLOW_DEBUGGING_FEATURES} is {@code false}.
+     */
+    private boolean userHasDebugPriv(int userId, final ShellCommand shellCommand) {
+        if (mUserManager.hasUserRestriction(
+                UserManager.DISALLOW_DEBUGGING_FEATURES, UserHandle.of(userId))) {
+            shellCommand.getErrPrintWriter().println("User #" + userId
+                    + " is restricted with DISALLOW_DEBUGGING_FEATURES.");
+            return false;
+        }
+        return true;
+    }
+
     private static final class InputMethodPrivilegedOperationsImpl
             extends IInputMethodPrivilegedOperations.Stub {
         private final InputMethodManagerService mImms;
diff --git a/services/core/java/com/android/server/inputmethod/MultiClientInputMethodManagerService.java b/services/core/java/com/android/server/inputmethod/MultiClientInputMethodManagerService.java
index 500c388..a2515c8 100644
--- a/services/core/java/com/android/server/inputmethod/MultiClientInputMethodManagerService.java
+++ b/services/core/java/com/android/server/inputmethod/MultiClientInputMethodManagerService.java
@@ -29,6 +29,8 @@
 import android.annotation.UserIdInt;
 import android.annotation.WorkerThread;
 import android.app.AppOpsManager;
+import android.app.Notification;
+import android.app.NotificationManager;
 import android.app.PendingIntent;
 import android.content.BroadcastReceiver;
 import android.content.ComponentName;
@@ -44,6 +46,7 @@
 import android.net.Uri;
 import android.os.Binder;
 import android.os.Build;
+import android.os.Bundle;
 import android.os.Debug;
 import android.os.Handler;
 import android.os.HandlerThread;
@@ -66,6 +69,7 @@
 import android.view.inputmethod.InputMethodSubtype;
 import android.view.inputmethod.InputMethodSystemProperty;
 
+import com.android.internal.R;
 import com.android.internal.annotations.GuardedBy;
 import com.android.internal.inputmethod.IMultiClientInputMethod;
 import com.android.internal.inputmethod.IMultiClientInputMethodPrivilegedOperations;
@@ -73,6 +77,8 @@
 import com.android.internal.inputmethod.StartInputFlags;
 import com.android.internal.inputmethod.StartInputReason;
 import com.android.internal.inputmethod.UnbindReason;
+import com.android.internal.messages.nano.SystemMessageProto;
+import com.android.internal.notification.SystemNotificationChannels;
 import com.android.internal.util.function.pooled.PooledLambda;
 import com.android.internal.view.IInputContext;
 import com.android.internal.view.IInputMethodClient;
@@ -96,8 +102,15 @@
  * we can switch the implementation at the boot time.</p>
  */
 public final class MultiClientInputMethodManagerService {
-    static final String TAG = "MultiClientInputMethodManagerService";
-    static final boolean DEBUG = false;
+    private static final String TAG = "MultiClientInputMethodManagerService";
+    private static final boolean DEBUG = false;
+
+    private static final String PER_DISPLAY_FOCUS_DISABLED_WARNING_TITLE =
+            "config_perDisplayFocusEnabled is not true.";
+
+    private static final String PER_DISPLAY_FOCUS_DISABLED_WARNING_MSG =
+            "Consider rebuilding the system image after enabling config_perDisplayFocusEnabled to "
+                    + "make IME focus compatible with multi-client IME mode.";
 
     private static final long RECONNECT_DELAY_MSEC = 1000;
 
@@ -465,8 +478,33 @@
                             onPackageAdded(intent);
                         }
                     }, filter, null, mHandler);
+                    break;
                 }
-                break;
+                case SystemService.PHASE_BOOT_COMPLETED: {
+                    final boolean perDisplayFocusEnabled = mContext.getResources().getBoolean(
+                            com.android.internal.R.bool.config_perDisplayFocusEnabled);
+                    if (!perDisplayFocusEnabled) {
+                        final Bundle extras = new Bundle();
+                        extras.putBoolean(Notification.EXTRA_ALLOW_DURING_SETUP, true);
+                        mContext.getSystemService(NotificationManager.class).notifyAsUser(TAG,
+                                SystemMessageProto.SystemMessage.NOTE_SELECT_INPUT_METHOD,
+                                new Notification.Builder(mContext,
+                                        SystemNotificationChannels.VIRTUAL_KEYBOARD)
+                                        .setContentTitle(PER_DISPLAY_FOCUS_DISABLED_WARNING_TITLE)
+                                        .setStyle(new Notification.BigTextStyle()
+                                                .bigText(PER_DISPLAY_FOCUS_DISABLED_WARNING_MSG))
+                                        .setSmallIcon(R.drawable.ic_notification_ime_default)
+                                        .setWhen(0)
+                                        .setOngoing(true)
+                                        .setLocalOnly(true)
+                                        .addExtras(extras)
+                                        .setCategory(Notification.CATEGORY_SYSTEM)
+                                        .setColor(mContext.getColor(
+                                                R.color.system_notification_accent_color))
+                                        .build(), UserHandle.ALL);
+                    }
+                    break;
+                }
             }
         }
 
diff --git a/services/core/java/com/android/server/inputmethod/multi-client-ime.md b/services/core/java/com/android/server/inputmethod/multi-client-ime.md
index 3021d2f..ba92cd2 100644
--- a/services/core/java/com/android/server/inputmethod/multi-client-ime.md
+++ b/services/core/java/com/android/server/inputmethod/multi-client-ime.md
@@ -39,7 +39,9 @@
 
 ## How to test
 
-On AOSP-based development devices (e.g. phones) where `android.os.Build.IS_DEBUGGABLE` returns `true` and you can have root access, you can enable multi-client IME feature by setting a valid component name that supports multi-client IME protocol to the system property `persist.debug.multi_client_ime`. Reboot is required for this to take effect.
+For multi-client IME to properly work, an internal boolean resource `com.android.internal.R.bool.config_perDisplayFocusEnabled` needs to be `true`. Since this value cannot be overridden at the run time, you may need to rebuild the system image to enable per-display focus mode.
+
+As for multi-client IME mode itself, you can enable multi-client IME mode just by setting a valid component name that supports multi-client IME protocol to the system property `persist.debug.multi_client_ime`, as long as `android.os.Build.IS_DEBUGGABLE` returns `true` and you can have root access. Reboot is required for this to take effect.
 
 ```shell
 # Build and install a sample multi-client IME
diff --git a/services/core/java/com/android/server/job/JobStore.java b/services/core/java/com/android/server/job/JobStore.java
index 4f8b1dc..6255306 100644
--- a/services/core/java/com/android/server/job/JobStore.java
+++ b/services/core/java/com/android/server/job/JobStore.java
@@ -174,6 +174,7 @@
     public void getRtcCorrectedJobsLocked(final ArrayList<JobStatus> toAdd,
             final ArrayList<JobStatus> toRemove) {
         final long elapsedNow = sElapsedRealtimeClock.millis();
+        final IActivityManager am = ActivityManager.getService();
 
         // Find the jobs that need to be fixed up, collecting them for post-iteration
         // replacement with their new versions
@@ -182,9 +183,11 @@
             if (utcTimes != null) {
                 Pair<Long, Long> elapsedRuntimes =
                         convertRtcBoundsToElapsed(utcTimes, elapsedNow);
-                toAdd.add(new JobStatus(job, job.getBaseHeartbeat(),
+                JobStatus newJob = new JobStatus(job, job.getBaseHeartbeat(),
                         elapsedRuntimes.first, elapsedRuntimes.second,
-                        0, job.getLastSuccessfulRunTime(), job.getLastFailedRunTime()));
+                        0, job.getLastSuccessfulRunTime(), job.getLastFailedRunTime());
+                newJob.prepareLocked(am);
+                toAdd.add(newJob);
                 toRemove.add(job);
             }
         });
diff --git a/services/core/java/com/android/server/location/GnssLocationProvider.java b/services/core/java/com/android/server/location/GnssLocationProvider.java
index 5156300..c173d66 100644
--- a/services/core/java/com/android/server/location/GnssLocationProvider.java
+++ b/services/core/java/com/android/server/location/GnssLocationProvider.java
@@ -67,6 +67,7 @@
 import android.util.Log;
 import android.util.StatsLog;
 
+import com.android.internal.annotations.GuardedBy;
 import com.android.internal.app.IBatteryStats;
 import com.android.internal.location.GpsNetInitiatedHandler;
 import com.android.internal.location.GpsNetInitiatedHandler.GpsNiNotification;
@@ -142,6 +143,7 @@
 
     // these need to match ElapsedRealtimeFlags enum in types.hal
     private static final int ELAPSED_REALTIME_HAS_TIMESTAMP_NS = 1;
+    private static final int ELAPSED_REALTIME_HAS_TIME_UNCERTAINTY_NS = 2;
 
     // IMPORTANT - the GPS_DELETE_* symbols here must match GnssAidingData enum in IGnss.hal
     private static final int GPS_DELETE_EPHEMERIS = 0x0001;
@@ -600,12 +602,11 @@
         // while IO initialization and registration is delegated to our internal handler
         // this approach is just fine because events are posted to our handler anyway
         mGnssConfiguration = new GnssConfiguration(mContext);
-        sendMessage(INITIALIZE_HANDLER, 0, null);
-
-        // Create a GPS net-initiated handler.
+        // Create a GPS net-initiated handler (also needed by handleInitialize)
         mNIHandler = new GpsNetInitiatedHandler(context,
                 mNetInitiatedListener,
                 mSuplEsEnabled);
+        sendMessage(INITIALIZE_HANDLER, 0, null);
 
         mGnssStatusListenerHelper = new GnssStatusListenerHelper(mContext, mHandler) {
             @Override
@@ -687,7 +688,7 @@
         }
     }
 
-    private void handleRequestLocation(boolean independentFromGnss) {
+    private void handleRequestLocation(boolean independentFromGnss, boolean isUserEmergency) {
         if (isRequestLocationRateLimited()) {
             if (DEBUG) {
                 Log.d(TAG, "RequestLocation is denied due to too frequent requests.");
@@ -723,9 +724,17 @@
                 String.format(
                         "GNSS HAL Requesting location updates from %s provider for %d millis.",
                         provider, durationMillis));
+
+        LocationRequest locationRequest = LocationRequest.createFromDeprecatedProvider(provider,
+                LOCATION_UPDATE_MIN_TIME_INTERVAL_MILLIS, /* minDistance= */ 0,
+                /* singleShot= */ false);
+
+        // Ignore location settings if in emergency mode.
+        if (isUserEmergency && mNIHandler.getInEmergency()) {
+            locationRequest.setLocationSettingsIgnored(true);
+        }
         try {
-            locationManager.requestLocationUpdates(provider,
-                    LOCATION_UPDATE_MIN_TIME_INTERVAL_MILLIS, /*minDistance=*/ 0,
+            locationManager.requestLocationUpdates(locationRequest,
                     locationListener, mHandler.getLooper());
             locationListener.mNumLocationUpdateRequest++;
             mHandler.postDelayed(() -> {
@@ -761,15 +770,18 @@
         float bearingAccuracyDegrees = location.getBearingAccuracyDegrees();
         long timestamp = location.getTime();
 
-        int elapsedRealtimeFlags = ELAPSED_REALTIME_HAS_TIMESTAMP_NS;
+        int elapsedRealtimeFlags = ELAPSED_REALTIME_HAS_TIMESTAMP_NS
+                | (location.hasElapsedRealtimeUncertaintyNanos()
+                        ? ELAPSED_REALTIME_HAS_TIME_UNCERTAINTY_NS : 0);
         long elapsedRealtimeNanos = location.getElapsedRealtimeNanos();
+        long elapsedRealtimeUncertaintyNanos = location.getElapsedRealtimeUncertaintyNanos();
 
         native_inject_best_location(
                 gnssLocationFlags, latitudeDegrees, longitudeDegrees,
                 altitudeMeters, speedMetersPerSec, bearingDegrees,
                 horizontalAccuracyMeters, verticalAccuracyMeters,
                 speedAccuracyMetersPerSecond, bearingAccuracyDegrees, timestamp,
-                elapsedRealtimeFlags, elapsedRealtimeNanos);
+                elapsedRealtimeFlags, elapsedRealtimeNanos, elapsedRealtimeUncertaintyNanos);
     }
 
     /** Returns true if the location request is too frequent. */
@@ -879,12 +891,14 @@
         return GPS_POSITION_MODE_STANDALONE;
     }
 
-    private boolean handleEnable() {
-        if (DEBUG) Log.d(TAG, "handleEnable");
+    @GuardedBy("mLock")
+    private void handleEnableLocked() {
+        if (DEBUG) Log.d(TAG, "handleEnableLocked");
 
         boolean inited = native_init();
 
         if (inited) {
+            mEnabled = true;
             mSupportsXtra = native_supports_xtra();
 
             // TODO: remove the following native calls if we can make sure they are redundant.
@@ -901,15 +915,16 @@
             mGnssNavigationMessageProvider.onGpsEnabledChanged();
             mGnssBatchingProvider.enable();
         } else {
+            mEnabled = false;
             Log.w(TAG, "Failed to enable location provider");
         }
-
-        return inited;
     }
 
-    private void handleDisable() {
-        if (DEBUG) Log.d(TAG, "handleDisable");
+    @GuardedBy("mLock")
+    private void handleDisableLocked() {
+        if (DEBUG) Log.d(TAG, "handleDisableLocked");
 
+        mEnabled = false;
         updateClientUids(new WorkSource());
         stopNavigating();
         mAlarmManager.cancel(mWakeupIntent);
@@ -935,10 +950,9 @@
             }
 
             if (enabled) {
-                mEnabled = handleEnable();
+                handleEnableLocked();
             } else {
-                mEnabled = false;
-                handleDisable();
+                handleDisableLocked();
             }
         }
     }
@@ -1308,10 +1322,6 @@
                 mAlarmManager.cancel(mTimeoutIntent);
             }
 
-            // send an intent to notify that the GPS is receiving fixes.
-            Intent intent = new Intent(LocationManager.GPS_FIX_CHANGE_ACTION);
-            intent.putExtra(LocationManager.EXTRA_GPS_ENABLED, true);
-            mContext.sendBroadcastAsUser(intent, UserHandle.ALL);
             updateStatus(LocationProvider.AVAILABLE);
         }
 
@@ -1343,11 +1353,6 @@
 
         if (wasNavigating != mNavigating) {
             mGnssStatusListenerHelper.onStatusChanged(mNavigating);
-
-            // send an intent to notify that the GPS has been enabled or disabled
-            Intent intent = new Intent(LocationManager.GPS_ENABLED_CHANGE_ACTION);
-            intent.putExtra(LocationManager.EXTRA_GPS_ENABLED, mNavigating);
-            mContext.sendBroadcastAsUser(intent, UserHandle.ALL);
         }
     }
 
@@ -1427,10 +1432,6 @@
 
         if (mNavigating && mStatus == LocationProvider.AVAILABLE && mLastFixTime > 0 &&
                 SystemClock.elapsedRealtime() - mLastFixTime > RECENT_FIX_TIMEOUT) {
-            // send an intent to notify that the GPS is no longer receiving fixes.
-            Intent intent = new Intent(LocationManager.GPS_FIX_CHANGE_ACTION);
-            intent.putExtra(LocationManager.EXTRA_GPS_ENABLED, false);
-            mContext.sendBroadcastAsUser(intent, UserHandle.ALL);
             updateStatus(LocationProvider.TEMPORARILY_UNAVAILABLE);
         }
     }
@@ -1828,11 +1829,13 @@
     }
 
     @NativeEntryPoint
-    private void requestLocation(boolean independentFromGnss) {
+    private void requestLocation(boolean independentFromGnss, boolean isUserEmergency) {
         if (DEBUG) {
-            Log.d(TAG, "requestLocation. independentFromGnss: " + independentFromGnss);
+            Log.d(TAG, "requestLocation. independentFromGnss: " + independentFromGnss
+                    + ", isUserEmergency: "
+                    + isUserEmergency);
         }
-        sendMessage(REQUEST_LOCATION, 0, independentFromGnss);
+        sendMessage(REQUEST_LOCATION, independentFromGnss ? 1 : 0, isUserEmergency);
     }
 
     @NativeEntryPoint
@@ -1923,7 +1926,7 @@
                     mNtpTimeHelper.retrieveAndInjectNtpTime();
                     break;
                 case REQUEST_LOCATION:
-                    handleRequestLocation((boolean) msg.obj);
+                    handleRequestLocation(msg.arg1 == 1, (boolean) msg.obj);
                     break;
                 case DOWNLOAD_XTRA_DATA:
                     handleDownloadXtraData();
@@ -2161,7 +2164,8 @@
             double altitudeMeters, float speedMetersPerSec, float bearingDegrees,
             float horizontalAccuracyMeters, float verticalAccuracyMeters,
             float speedAccuracyMetersPerSecond, float bearingAccuracyDegrees,
-            long timestamp, int elapsedRealtimeFlags, long elapsedRealtimeNanos);
+            long timestamp, int elapsedRealtimeFlags, long elapsedRealtimeNanos,
+            long elapsedRealtimeUncertaintyNanos);
 
     private native void native_inject_location(double latitude, double longitude, float accuracy);
 
diff --git a/services/core/java/com/android/server/locksettings/LockSettingsService.java b/services/core/java/com/android/server/locksettings/LockSettingsService.java
index ee968c8..a53ab84 100644
--- a/services/core/java/com/android/server/locksettings/LockSettingsService.java
+++ b/services/core/java/com/android/server/locksettings/LockSettingsService.java
@@ -21,6 +21,7 @@
 import static android.content.Context.KEYGUARD_SERVICE;
 import static android.content.pm.PackageManager.PERMISSION_GRANTED;
 
+import static com.android.internal.widget.LockPatternUtils.EscrowTokenStateChangeCallback;
 import static com.android.internal.widget.LockPatternUtils.SYNTHETIC_PASSWORD_ENABLED_KEY;
 import static com.android.internal.widget.LockPatternUtils.SYNTHETIC_PASSWORD_HANDLE_KEY;
 import static com.android.internal.widget.LockPatternUtils.StrongAuthTracker.STRONG_AUTH_REQUIRED_AFTER_BOOT;
@@ -409,7 +410,8 @@
         }
 
         public SyntheticPasswordManager getSyntheticPasswordManager(LockSettingsStorage storage) {
-            return new SyntheticPasswordManager(getContext(), storage, getUserManager());
+            return new SyntheticPasswordManager(getContext(), storage, getUserManager(),
+                    new PasswordSlotManager());
         }
 
         public boolean hasBiometrics() {
@@ -1973,8 +1975,7 @@
         } catch (RemoteException ex) {
             Slog.w(TAG, "unable to clear GK secure user id");
         }
-        UserInfo userInfo = mUserManager.getUserInfo(userId);
-        if (unknownUser || userInfo == null || userInfo.isManagedProfile()) {
+        if (unknownUser || mUserManager.getUserInfo(userId).isManagedProfile()) {
             removeKeystoreProfileKey(userId);
         }
     }
@@ -2648,7 +2649,8 @@
         }
     }
 
-    private long addEscrowToken(byte[] token, int userId) throws RemoteException {
+    private long addEscrowToken(byte[] token, int userId, EscrowTokenStateChangeCallback callback)
+            throws RemoteException {
         if (DEBUG) Slog.d(TAG, "addEscrowToken: user=" + userId);
         synchronized (mSpManager) {
             enableSyntheticPasswordLocked();
@@ -2672,7 +2674,7 @@
                     throw new SecurityException("Escrow token is disabled on the current user");
                 }
             }
-            long handle = mSpManager.createTokenBasedSyntheticPassword(token, userId);
+            long handle = mSpManager.createTokenBasedSyntheticPassword(token, userId, callback);
             if (auth != null) {
                 mSpManager.activateTokenBasedSyntheticPassword(handle, auth, userId);
             }
@@ -2943,9 +2945,10 @@
     private final class LocalService extends LockSettingsInternal {
 
         @Override
-        public long addEscrowToken(byte[] token, int userId) {
+        public long addEscrowToken(byte[] token, int userId,
+                EscrowTokenStateChangeCallback callback) {
             try {
-                return LockSettingsService.this.addEscrowToken(token, userId);
+                return LockSettingsService.this.addEscrowToken(token, userId, callback);
             } catch (RemoteException re) {
                 throw re.rethrowFromSystemServer();
             }
diff --git a/services/core/java/com/android/server/locksettings/PasswordSlotManager.java b/services/core/java/com/android/server/locksettings/PasswordSlotManager.java
new file mode 100644
index 0000000..686ae2b
--- /dev/null
+++ b/services/core/java/com/android/server/locksettings/PasswordSlotManager.java
@@ -0,0 +1,191 @@
+/*
+ * Copyright (C) 2019 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 com.android.server.locksettings;
+
+import android.os.SystemProperties;
+import android.util.Slog;
+
+import com.android.internal.annotations.VisibleForTesting;
+
+import java.io.File;
+import java.io.FileInputStream;
+import java.io.FileOutputStream;
+import java.io.IOException;
+import java.io.InputStream;
+import java.io.OutputStream;
+import java.nio.file.Paths;
+import java.util.Collections;
+import java.util.HashMap;
+import java.util.HashSet;
+import java.util.Map;
+import java.util.Properties;
+import java.util.Set;
+
+/**
+ * A class that maintains a mapping of which password slots are used by alternate OS images when
+ * dual-booting a device. Currently, slots can either be owned by the host OS or a live GSI.
+ * This mapping is stored in /metadata/password_slots/slot_map using Java Properties.
+ *
+ * If a /metadata partition does not exist, GSIs are not supported, and PasswordSlotManager will
+ * simply not persist the slot mapping.
+ */
+public class PasswordSlotManager {
+    private static final String TAG = "PasswordSlotManager";
+
+    private static final String GSI_RUNNING_PROP = "ro.gsid.image_running";
+    private static final String SLOT_MAP_DIR = "/metadata/password_slots";
+
+    // This maps each used password slot to the OS image that created it. Password slots are
+    // integer keys/indices into secure storage. The OS image is recorded as a string. The factory
+    // image is "host" and GSIs are "gsi<N>" where N >= 1.
+    private final Map<Integer, String> mSlotMap;
+
+    public PasswordSlotManager() {
+        mSlotMap = loadSlotMap();
+    }
+
+    @VisibleForTesting
+    protected String getSlotMapDir() {
+        return SLOT_MAP_DIR;
+    }
+
+    @VisibleForTesting
+    protected int getGsiImageNumber() {
+        return SystemProperties.getInt(GSI_RUNNING_PROP, 0);
+    }
+
+    /**
+     * Notify the manager of which slots are definitively in use by the current OS image.
+     *
+     * @throws RuntimeException
+     */
+    public void refreshActiveSlots(Set<Integer> activeSlots) throws RuntimeException {
+        // Update which slots are owned by the current image.
+        final HashSet<Integer> slotsToDelete = new HashSet<Integer>();
+        for (Map.Entry<Integer, String> entry : mSlotMap.entrySet()) {
+            // Delete possibly stale entries for the current image.
+            if (entry.getValue().equals(getMode())) {
+                slotsToDelete.add(entry.getKey());
+            }
+        }
+        for (Integer slot : slotsToDelete) {
+            mSlotMap.remove(slot);
+        }
+
+        // Add slots for the current image.
+        for (Integer slot : activeSlots) {
+            mSlotMap.put(slot, getMode());
+        }
+
+        saveSlotMap();
+    }
+
+    /**
+     * Mark the given slot as in use by the current OS image.
+     *
+     * @throws RuntimeException
+     */
+    public void markSlotInUse(int slot) throws RuntimeException {
+        if (mSlotMap.containsKey(slot) && !mSlotMap.get(slot).equals(getMode())) {
+            throw new RuntimeException("password slot " + slot + " is not available");
+        }
+        mSlotMap.put(slot, getMode());
+        saveSlotMap();
+    }
+
+    /**
+     * Mark the given slot as no longer in use by the current OS image.
+     *
+     * @throws RuntimeException
+     */
+    public void markSlotDeleted(int slot) throws RuntimeException {
+        if (mSlotMap.containsKey(slot) && mSlotMap.get(slot) != getMode()) {
+            throw new RuntimeException("password slot " + slot + " cannot be deleted");
+        }
+        mSlotMap.remove(slot);
+        saveSlotMap();
+    }
+
+    /**
+     * Return the set of slots used across all OS images.
+     *
+     * @return Integer set of all used slots.
+     */
+    public Set<Integer> getUsedSlots() {
+        return Collections.unmodifiableSet(mSlotMap.keySet());
+    }
+
+    private File getSlotMapFile() {
+        return Paths.get(getSlotMapDir(), "slot_map").toFile();
+    }
+
+    private String getMode() {
+        int gsiIndex = getGsiImageNumber();
+        if (gsiIndex > 0) {
+            return "gsi" + gsiIndex;
+        }
+        return "host";
+    }
+
+    @VisibleForTesting
+    protected Map<Integer, String> loadSlotMap(InputStream stream) throws IOException {
+        final HashMap<Integer, String> map = new HashMap<Integer, String>();
+        final Properties props = new Properties();
+        props.load(stream);
+        for (String slotString : props.stringPropertyNames()) {
+            final int slot = Integer.parseInt(slotString);
+            final String owner = props.getProperty(slotString);
+            map.put(slot, owner);
+        }
+        return map;
+    }
+
+    private Map<Integer, String> loadSlotMap() {
+        // It's okay if the file doesn't exist.
+        final File file = getSlotMapFile();
+        if (file.exists()) {
+            try (FileInputStream stream = new FileInputStream(file)) {
+                return loadSlotMap(stream);
+            } catch (Exception e) {
+                Slog.e(TAG, "Could not load slot map file", e);
+            }
+        }
+        return new HashMap<Integer, String>();
+    }
+
+    @VisibleForTesting
+    protected void saveSlotMap(OutputStream stream) throws IOException {
+        final Properties props = new Properties();
+        for (Map.Entry<Integer, String> entry : mSlotMap.entrySet()) {
+            props.setProperty(entry.getKey().toString(), entry.getValue());
+        }
+        props.store(stream, "");
+    }
+
+    private void saveSlotMap() {
+        if (!getSlotMapFile().getParentFile().exists()) {
+            Slog.w(TAG, "Not saving slot map, " + getSlotMapDir() + " does not exist");
+            return;
+        }
+
+        try (FileOutputStream fos = new FileOutputStream(getSlotMapFile())) {
+            saveSlotMap(fos);
+        } catch (IOException e) {
+            Slog.e(TAG, "failed to save password slot map", e);
+        }
+    }
+}
diff --git a/services/core/java/com/android/server/locksettings/SyntheticPasswordManager.java b/services/core/java/com/android/server/locksettings/SyntheticPasswordManager.java
index ea39dff..142ad53 100644
--- a/services/core/java/com/android/server/locksettings/SyntheticPasswordManager.java
+++ b/services/core/java/com/android/server/locksettings/SyntheticPasswordManager.java
@@ -16,6 +16,8 @@
 
 package com.android.server.locksettings;
 
+import static com.android.internal.widget.LockPatternUtils.EscrowTokenStateChangeCallback;
+
 import android.annotation.NonNull;
 import android.annotation.Nullable;
 import android.app.admin.DevicePolicyManager;
@@ -281,20 +283,23 @@
         byte[] secdiscardableOnDisk;
         byte[] weaverSecret;
         byte[] aggregatedSecret;
+        EscrowTokenStateChangeCallback mCallback;
     }
 
     private final Context mContext;
     private LockSettingsStorage mStorage;
     private IWeaver mWeaver;
     private WeaverConfig mWeaverConfig;
+    private PasswordSlotManager mPasswordSlotManager;
 
     private final UserManager mUserManager;
 
     public SyntheticPasswordManager(Context context, LockSettingsStorage storage,
-            UserManager userManager) {
+            UserManager userManager, PasswordSlotManager passwordSlotManager) {
         mContext = context;
         mStorage = storage;
         mUserManager = userManager;
+        mPasswordSlotManager = passwordSlotManager;
     }
 
     @VisibleForTesting
@@ -324,6 +329,7 @@
                         mWeaver = null;
                     }
                 });
+                mPasswordSlotManager.refreshActiveSlots(getUsedWeaverSlots());
             }
         } catch (RemoteException e) {
             Slog.e(TAG, "Failed to get weaver service", e);
@@ -561,6 +567,7 @@
                 Log.i(TAG, "Destroy weaver slot " + slot + " for user " + userId);
                 try {
                     weaverEnroll(slot, null, null);
+                    mPasswordSlotManager.markSlotDeleted(slot);
                 } catch (RemoteException e) {
                     Log.w(TAG, "Failed to destroy slot", e);
                 }
@@ -595,6 +602,7 @@
 
     private int getNextAvailableWeaverSlot() {
         Set<Integer> usedSlots = getUsedWeaverSlots();
+        usedSlots.addAll(mPasswordSlotManager.getUsedSlots());
         for (int i = 0; i < mWeaverConfig.slots; i++) {
             if (!usedSlots.contains(i)) {
                 return i;
@@ -640,6 +648,7 @@
                 return DEFAULT_HANDLE;
             }
             saveWeaverSlot(weaverSlot, handle, userId);
+            mPasswordSlotManager.markSlotInUse(weaverSlot);
             synchronizeWeaverFrpPassword(pwd, requestedQuality, userId, weaverSlot);
 
             pwd.passwordHandle = null;
@@ -740,7 +749,12 @@
 
     private ArrayMap<Integer, ArrayMap<Long, TokenData>> tokenMap = new ArrayMap<>();
 
-    public long createTokenBasedSyntheticPassword(byte[] token, int userId) {
+    /**
+     * Create a token based Synthetic password for the given user.
+     * @return
+     */
+    public long createTokenBasedSyntheticPassword(byte[] token, int userId,
+            @Nullable EscrowTokenStateChangeCallback changeCallback) {
         long handle = generateHandle();
         if (!tokenMap.containsKey(userId)) {
             tokenMap.put(userId, new ArrayMap<>());
@@ -756,6 +770,7 @@
             tokenData.weaverSecret = null;
         }
         tokenData.aggregatedSecret = transformUnderSecdiscardable(token, secdiscardable);
+        tokenData.mCallback = changeCallback;
 
         tokenMap.get(userId).put(handle, tokenData);
         return handle;
@@ -798,11 +813,15 @@
                 return false;
             }
             saveWeaverSlot(slot, handle, userId);
+            mPasswordSlotManager.markSlotInUse(slot);
         }
         saveSecdiscardable(handle, tokenData.secdiscardableOnDisk, userId);
         createSyntheticPasswordBlob(handle, SYNTHETIC_PASSWORD_TOKEN_BASED, authToken,
                 tokenData.aggregatedSecret, 0L, userId);
         tokenMap.get(userId).remove(handle);
+        if (tokenData.mCallback != null) {
+            tokenData.mCallback.onEscrowTokenActivated(handle, userId);
+        }
         return true;
     }
 
diff --git a/services/core/java/com/android/server/locksettings/recoverablekeystore/RecoverableKeyStoreManager.java b/services/core/java/com/android/server/locksettings/recoverablekeystore/RecoverableKeyStoreManager.java
index 47b9c27..1b14ce2 100644
--- a/services/core/java/com/android/server/locksettings/recoverablekeystore/RecoverableKeyStoreManager.java
+++ b/services/core/java/com/android/server/locksettings/recoverablekeystore/RecoverableKeyStoreManager.java
@@ -53,6 +53,7 @@
 import com.android.server.locksettings.recoverablekeystore.certificate.CertXml;
 import com.android.server.locksettings.recoverablekeystore.certificate.SigXml;
 import com.android.server.locksettings.recoverablekeystore.storage.ApplicationKeyStorage;
+import com.android.server.locksettings.recoverablekeystore.storage.CleanupManager;
 import com.android.server.locksettings.recoverablekeystore.storage.RecoverableKeyStoreDb;
 import com.android.server.locksettings.recoverablekeystore.storage.RecoverySessionStorage;
 import com.android.server.locksettings.recoverablekeystore.storage.RecoverySnapshotStorage;
@@ -100,6 +101,7 @@
     private final PlatformKeyManager mPlatformKeyManager;
     private final ApplicationKeyStorage mApplicationKeyStorage;
     private final TestOnlyInsecureCertificateHelper mTestCertHelper;
+    private final CleanupManager mCleanupManager;
 
     /**
      * Returns a new or existing instance.
@@ -122,16 +124,24 @@
                 throw new ServiceSpecificException(ERROR_SERVICE_INTERNAL_ERROR, e.getMessage());
             }
 
+            RecoverySnapshotStorage snapshotStorage =
+                    RecoverySnapshotStorage.newInstance();
+            CleanupManager cleanupManager = CleanupManager.getInstance(
+                    context.getApplicationContext(),
+                    snapshotStorage,
+                    db,
+                    applicationKeyStorage);
             mInstance = new RecoverableKeyStoreManager(
                     context.getApplicationContext(),
                     db,
                     new RecoverySessionStorage(),
                     Executors.newSingleThreadExecutor(),
-                    RecoverySnapshotStorage.newInstance(),
+                    snapshotStorage,
                     new RecoverySnapshotListenersStorage(),
                     platformKeyManager,
                     applicationKeyStorage,
-                    new TestOnlyInsecureCertificateHelper());
+                    new TestOnlyInsecureCertificateHelper(),
+                    cleanupManager);
         }
         return mInstance;
     }
@@ -146,7 +156,8 @@
             RecoverySnapshotListenersStorage listenersStorage,
             PlatformKeyManager platformKeyManager,
             ApplicationKeyStorage applicationKeyStorage,
-            TestOnlyInsecureCertificateHelper TestOnlyInsecureCertificateHelper) {
+            TestOnlyInsecureCertificateHelper testOnlyInsecureCertificateHelper,
+            CleanupManager cleanupManager) {
         mContext = context;
         mDatabase = recoverableKeyStoreDb;
         mRecoverySessionStorage = recoverySessionStorage;
@@ -155,8 +166,10 @@
         mSnapshotStorage = snapshotStorage;
         mPlatformKeyManager = platformKeyManager;
         mApplicationKeyStorage = applicationKeyStorage;
-        mTestCertHelper = TestOnlyInsecureCertificateHelper;
-
+        mTestCertHelper = testOnlyInsecureCertificateHelper;
+        mCleanupManager = cleanupManager;
+        // Clears data for removed users.
+        mCleanupManager.verifyKnownUsers();
         try {
             mRecoverableKeyGenerator = RecoverableKeyGenerator.newInstance(mDatabase);
         } catch (NoSuchAlgorithmException e) {
@@ -955,6 +968,9 @@
         mContext.enforceCallingOrSelfPermission(
                 Manifest.permission.RECOVER_KEYSTORE,
                 "Caller " + Binder.getCallingUid() + " doesn't have RecoverKeyStore permission.");
+        int userId = UserHandle.getCallingUserId();
+        int uid = Binder.getCallingUid();
+        mCleanupManager.registerRecoveryAgent(userId, uid);
     }
 
     private boolean publicKeysMatch(PublicKey publicKey, byte[] vaultParams) {
diff --git a/services/core/java/com/android/server/locksettings/recoverablekeystore/storage/CleanupManager.java b/services/core/java/com/android/server/locksettings/recoverablekeystore/storage/CleanupManager.java
new file mode 100644
index 0000000..be35b50
--- /dev/null
+++ b/services/core/java/com/android/server/locksettings/recoverablekeystore/storage/CleanupManager.java
@@ -0,0 +1,178 @@
+/*
+ * Copyright (C) 2019 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 com.android.server.locksettings.recoverablekeystore.storage;
+
+import android.content.Context;
+import android.os.ServiceSpecificException;
+import android.os.UserHandle;
+import android.os.UserManager;
+import android.util.Log;
+
+import com.android.internal.annotations.VisibleForTesting;
+import com.android.server.locksettings.recoverablekeystore.WrappedKey;
+
+import java.util.ArrayList;
+import java.util.List;
+import java.util.Map;
+
+/**
+ * Cleans up data when user is removed.
+ */
+public class CleanupManager {
+    private static final String TAG = "CleanupManager";
+
+    private final Context mContext;
+    private final UserManager mUserManager;
+    private final RecoverableKeyStoreDb mDatabase;
+    private final RecoverySnapshotStorage mSnapshotStorage;
+    private final ApplicationKeyStorage mApplicationKeyStorage;
+
+    // Serial number can not be changed at runtime.
+    private Map<Integer, Long> mSerialNumbers; // Always in sync with the database.
+
+    /**
+     * Creates a new instance of the class.
+     * IMPORTANT: {@code verifyKnownUsers} must be called before the first data access.
+     */
+    public static CleanupManager getInstance(
+            Context context,
+            RecoverySnapshotStorage snapshotStorage,
+            RecoverableKeyStoreDb recoverableKeyStoreDb,
+            ApplicationKeyStorage applicationKeyStorage) {
+        return new CleanupManager(
+                context,
+                snapshotStorage,
+                recoverableKeyStoreDb,
+                UserManager.get(context),
+                applicationKeyStorage);
+    }
+
+    @VisibleForTesting
+    CleanupManager(
+            Context context,
+            RecoverySnapshotStorage snapshotStorage,
+            RecoverableKeyStoreDb recoverableKeyStoreDb,
+            UserManager userManager,
+            ApplicationKeyStorage applicationKeyStorage) {
+        mContext = context;
+        mSnapshotStorage = snapshotStorage;
+        mDatabase = recoverableKeyStoreDb;
+        mUserManager = userManager;
+        mApplicationKeyStorage = applicationKeyStorage;
+    }
+
+    /**
+     * Registers recovery agent in the system, if necessary.
+     */
+    public synchronized void registerRecoveryAgent(int userId, int uid) {
+        if (mSerialNumbers == null) {
+            // Table was uninitialized.
+            verifyKnownUsers();
+        }
+        // uid is ignored since recovery agent is a system app.
+        Long storedSerialNumber =  mSerialNumbers.get(userId);
+        if (storedSerialNumber == null) {
+            storedSerialNumber = -1L;
+        }
+        if (storedSerialNumber != -1) {
+            // User was already registered.
+            return;
+        }
+        // User was added after {@code verifyAllUsers} call.
+        long currentSerialNumber = mUserManager.getSerialNumberForUser(UserHandle.of(userId));
+        if (currentSerialNumber != -1) {
+            storeUserSerialNumber(userId, currentSerialNumber);
+        }
+    }
+
+    /**
+     * Removes data if serial number for a user was changed.
+     */
+    public synchronized void verifyKnownUsers() {
+        mSerialNumbers =  mDatabase.getUserSerialNumbers();
+        List<Integer> deletedUserIds = new ArrayList<Integer>(){};
+        for (Map.Entry<Integer, Long> entry : mSerialNumbers.entrySet()) {
+            Integer userId = entry.getKey();
+            Long storedSerialNumber = entry.getValue();
+            if (storedSerialNumber == null) {
+                storedSerialNumber = -1L;
+            }
+            long currentSerialNumber = mUserManager.getSerialNumberForUser(UserHandle.of(userId));
+            if (currentSerialNumber == -1) {
+                // User was removed.
+                deletedUserIds.add(userId);
+                removeDataForUser(userId);
+            } else if (storedSerialNumber == -1) {
+                // User is detected for the first time
+                storeUserSerialNumber(userId, currentSerialNumber);
+            } else if (storedSerialNumber != currentSerialNumber) {
+                // User has unexpected serial number - delete data related to old serial number.
+                deletedUserIds.add(userId);
+                removeDataForUser(userId);
+                // Register new user.
+                storeUserSerialNumber(userId, currentSerialNumber);
+            }
+        }
+
+        for (Integer deletedUser : deletedUserIds) {
+            mSerialNumbers.remove(deletedUser);
+        }
+    }
+
+    private void storeUserSerialNumber(int userId, long userSerialNumber) {
+        Log.d(TAG, "Storing serial number for user " + userId + ".");
+        mSerialNumbers.put(userId, userSerialNumber);
+        mDatabase.setUserSerialNumber(userId, userSerialNumber);
+    }
+
+    /**
+     * Removes all data for given user, including
+     *
+     * <ul>
+     *     <li> Recovery snapshots for all agents belonging to the {@code userId}.
+     *     <li> Entries with data related to {@code userId} from the database.
+     * </ul>
+     */
+    private void removeDataForUser(int userId) {
+        Log.d(TAG, "Removing data for user " + userId + ".");
+        List<Integer> recoveryAgents = mDatabase.getRecoveryAgents(userId);
+        for (Integer uid : recoveryAgents) {
+            mSnapshotStorage.remove(uid);
+            removeAllKeysForRecoveryAgent(userId, uid);
+        }
+
+        mDatabase.removeUserFromAllTables(userId);
+    }
+
+    /**
+     * Removes keys from Android KeyStore for the recovery agent;
+     * Doesn't remove encrypted key material from the database.
+     */
+    private void removeAllKeysForRecoveryAgent(int userId, int uid) {
+        int generationId = mDatabase.getPlatformKeyGenerationId(userId);
+        Map<String, WrappedKey> allKeys = mDatabase.getAllKeys(userId, uid, generationId);
+        for (String alias : allKeys.keySet()) {
+            try {
+                // Delete KeyStore copy.
+                mApplicationKeyStorage.deleteEntry(userId, uid, alias);
+            } catch (ServiceSpecificException e) {
+                // Ignore errors during key removal.
+                Log.e(TAG, "Error while removing recoverable key " + alias + " : " + e);
+            }
+        }
+    }
+}
diff --git a/services/core/java/com/android/server/locksettings/recoverablekeystore/storage/RecoverableKeyStoreDb.java b/services/core/java/com/android/server/locksettings/recoverablekeystore/storage/RecoverableKeyStoreDb.java
index dffaffe..3f5ac8e 100644
--- a/services/core/java/com/android/server/locksettings/recoverablekeystore/storage/RecoverableKeyStoreDb.java
+++ b/services/core/java/com/android/server/locksettings/recoverablekeystore/storage/RecoverableKeyStoreDb.java
@@ -24,6 +24,7 @@
 import android.database.sqlite.SQLiteDatabase;
 import android.security.keystore.recovery.RecoveryController;
 import android.text.TextUtils;
+import android.util.ArrayMap;
 import android.util.Log;
 
 import com.android.server.locksettings.recoverablekeystore.TestOnlyInsecureCertificateHelper;
@@ -261,7 +262,7 @@
      *
      * @hide
      */
-    public Map<String, WrappedKey> getAllKeys(int userId, int recoveryAgentUid,
+    public @NonNull Map<String, WrappedKey> getAllKeys(int userId, int recoveryAgentUid,
             int platformKeyGenerationId) {
         SQLiteDatabase db = mKeyStoreDbHelper.getReadableDatabase();
         String[] projection = {
@@ -337,6 +338,58 @@
     }
 
     /**
+     * Returns serial numbers associated with all known users.
+     * -1 is used for uninitialized serial numbers.
+     *
+     * See {@code UserHandle.getSerialNumberForUser}.
+     * @return Map from userId to serial numbers.
+     */
+    public @NonNull Map<Integer, Long> getUserSerialNumbers() {
+        SQLiteDatabase db = mKeyStoreDbHelper.getReadableDatabase();
+        String[] projection = {
+                UserMetadataEntry.COLUMN_NAME_USER_ID,
+                UserMetadataEntry.COLUMN_NAME_USER_SERIAL_NUMBER};
+        String selection = null; // get all rows.
+        String[] selectionArguments = {};
+
+        try (
+            Cursor cursor = db.query(
+                UserMetadataEntry.TABLE_NAME,
+                projection,
+                selection,
+                selectionArguments,
+                /*groupBy=*/ null,
+                /*having=*/ null,
+                /*orderBy=*/ null)
+        ) {
+            Map<Integer, Long> serialNumbers = new ArrayMap<>();
+            while (cursor.moveToNext()) {
+                int userId = cursor.getInt(
+                        cursor.getColumnIndexOrThrow(UserMetadataEntry.COLUMN_NAME_USER_ID));
+                long serialNumber = cursor.getLong(cursor.getColumnIndexOrThrow(
+                        UserMetadataEntry.COLUMN_NAME_USER_SERIAL_NUMBER));
+                serialNumbers.put(userId, serialNumber);
+            }
+            return serialNumbers;
+        }
+    }
+
+    /**
+     * Sets the {@code serialNumber} for the user {@code userId}.
+     *
+     * @return The primary key of the inserted row, or -1 if failed.
+     */
+    public long setUserSerialNumber(int userId, long serialNumber) {
+        SQLiteDatabase db = mKeyStoreDbHelper.getWritableDatabase();
+        ContentValues values = new ContentValues();
+        values.put(UserMetadataEntry.COLUMN_NAME_USER_ID, userId);
+        values.put(UserMetadataEntry.COLUMN_NAME_USER_SERIAL_NUMBER, serialNumber);
+        long result = db.replace(
+                UserMetadataEntry.TABLE_NAME, /*nullColumnHack=*/ null, values);
+        return result;
+    }
+
+    /**
      * Updates status of old keys to {@code RecoveryController.RECOVERY_STATUS_PERMANENT_FAILURE}.
      */
     public void invalidateKeysWithOldGenerationId(int userId, int newGenerationId) {
@@ -424,8 +477,7 @@
      */
     @Nullable
     public Long getRecoveryServiceCertSerial(int userId, int uid, @NonNull String rootAlias) {
-        return getLong(userId, uid, rootAlias,
-                RecoveryServiceMetadataEntry.COLUMN_NAME_CERT_SERIAL);
+        return getLong(userId, uid, rootAlias, RootOfTrustEntry.COLUMN_NAME_CERT_SERIAL);
     }
 
     /**
@@ -441,7 +493,7 @@
      */
     public long setRecoveryServiceCertSerial(int userId, int uid, @NonNull String rootAlias,
             long serial) {
-        return setLong(userId, uid, rootAlias, RecoveryServiceMetadataEntry.COLUMN_NAME_CERT_SERIAL,
+        return setLong(userId, uid, rootAlias, RootOfTrustEntry.COLUMN_NAME_CERT_SERIAL,
                 serial);
     }
 
@@ -457,8 +509,7 @@
      */
     @Nullable
     public CertPath getRecoveryServiceCertPath(int userId, int uid, @NonNull String rootAlias) {
-        byte[] bytes = getBytes(userId, uid, rootAlias,
-                RecoveryServiceMetadataEntry.COLUMN_NAME_CERT_PATH);
+        byte[] bytes = getBytes(userId, uid, rootAlias, RootOfTrustEntry.COLUMN_NAME_CERT_PATH);
         if (bytes == null) {
             return null;
         }
@@ -489,7 +540,7 @@
         if (certPath.getCertificates().size() == 0) {
             throw new CertificateEncodingException("No certificate contained in the cert path.");
         }
-        return setBytes(userId, uid, rootAlias, RecoveryServiceMetadataEntry.COLUMN_NAME_CERT_PATH,
+        return setBytes(userId, uid, rootAlias, RootOfTrustEntry.COLUMN_NAME_CERT_PATH,
                 certPath.getEncoded(CERT_PATH_ENCODING));
     }
 
@@ -1189,6 +1240,63 @@
                 RootOfTrustEntry.TABLE_NAME, values, selection, selectionArguments);
     }
 
+    /**
+     * Removes all entries for given {@code userId}.
+     */
+    public void removeUserFromAllTables(int userId) {
+        removeUserFromKeysTable(userId);
+        removeUserFromUserMetadataTable(userId);
+        removeUserFromRecoveryServiceMetadataTable(userId);
+        removeUserFromRootOfTrustTable(userId);
+    }
+
+    /**
+     * Removes all entries for given userId from Keys table.
+     *
+     * @return {@code true} if deleted a row.
+     */
+    private boolean removeUserFromKeysTable(int userId) {
+        SQLiteDatabase db = mKeyStoreDbHelper.getWritableDatabase();
+        String selection = KeysEntry.COLUMN_NAME_USER_ID + " = ?";
+        String[] selectionArgs = {Integer.toString(userId)};
+        return db.delete(KeysEntry.TABLE_NAME, selection, selectionArgs) > 0;
+    }
+
+    /**
+     * Removes all entries for given userId from UserMetadata table.
+     *
+     * @return {@code true} if deleted a row.
+     */
+    private boolean removeUserFromUserMetadataTable(int userId) {
+        SQLiteDatabase db = mKeyStoreDbHelper.getWritableDatabase();
+        String selection = UserMetadataEntry.COLUMN_NAME_USER_ID + " = ?";
+        String[] selectionArgs = {Integer.toString(userId)};
+        return db.delete(UserMetadataEntry.TABLE_NAME, selection, selectionArgs) > 0;
+    }
+
+    /**
+     * Removes all entries for given userId from RecoveryServiceMetadata table.
+     *
+     * @return {@code true} if deleted a row.
+     */
+    private boolean removeUserFromRecoveryServiceMetadataTable(int userId) {
+        SQLiteDatabase db = mKeyStoreDbHelper.getWritableDatabase();
+        String selection = RecoveryServiceMetadataEntry.COLUMN_NAME_USER_ID + " = ?";
+        String[] selectionArgs = {Integer.toString(userId)};
+        return db.delete(RecoveryServiceMetadataEntry.TABLE_NAME, selection, selectionArgs) > 0;
+    }
+
+    /**
+     * Removes all entries for given userId from RootOfTrust table.
+     *
+     * @return {@code true} if deleted a row.
+     */
+    private boolean removeUserFromRootOfTrustTable(int userId) {
+        SQLiteDatabase db = mKeyStoreDbHelper.getWritableDatabase();
+        String selection = RootOfTrustEntry.COLUMN_NAME_USER_ID + " = ?";
+        String[] selectionArgs = {Integer.toString(userId)};
+        return db.delete(RootOfTrustEntry.TABLE_NAME, selection, selectionArgs) > 0;
+    }
 
     /**
      * Creates an empty row in the recovery service metadata table if such a row doesn't exist for
diff --git a/services/core/java/com/android/server/locksettings/recoverablekeystore/storage/RecoverableKeyStoreDbContract.java b/services/core/java/com/android/server/locksettings/recoverablekeystore/storage/RecoverableKeyStoreDbContract.java
index b58ee4b..e79d117 100644
--- a/services/core/java/com/android/server/locksettings/recoverablekeystore/storage/RecoverableKeyStoreDbContract.java
+++ b/services/core/java/com/android/server/locksettings/recoverablekeystore/storage/RecoverableKeyStoreDbContract.java
@@ -20,6 +20,8 @@
 
 /**
  * Contract for recoverable key database. Describes the tables present.
+ *
+ * Make sure that {@code removeUserFromAllKnownTables} is updated, when new table is added.
  */
 class RecoverableKeyStoreDbContract {
     /**
@@ -91,6 +93,11 @@
          * is used to wrap recoverable keys on disk.
          */
         static final String COLUMN_NAME_PLATFORM_KEY_GENERATION_ID = "platform_key_generation_id";
+
+        /**
+         * Serial number for the user which can not be reused. Default value is {@code -1}.
+         */
+        static final String COLUMN_NAME_USER_SERIAL_NUMBER = "user_serial_number";
     }
 
     /**
diff --git a/services/core/java/com/android/server/locksettings/recoverablekeystore/storage/RecoverableKeyStoreDbHelper.java b/services/core/java/com/android/server/locksettings/recoverablekeystore/storage/RecoverableKeyStoreDbHelper.java
index b0613da..3e7b0a7 100644
--- a/services/core/java/com/android/server/locksettings/recoverablekeystore/storage/RecoverableKeyStoreDbHelper.java
+++ b/services/core/java/com/android/server/locksettings/recoverablekeystore/storage/RecoverableKeyStoreDbHelper.java
@@ -32,7 +32,7 @@
 class RecoverableKeyStoreDbHelper extends SQLiteOpenHelper {
     private static final String TAG = "RecoverableKeyStoreDbHp";
 
-    static final int DATABASE_VERSION = 5;
+    static final int DATABASE_VERSION = 6; // Added user id serial number.
     private static final String DATABASE_NAME = "recoverablekeystore.db";
 
     private static final String SQL_CREATE_KEYS_ENTRY =
@@ -54,7 +54,8 @@
             "CREATE TABLE " + UserMetadataEntry.TABLE_NAME + "( "
                     + UserMetadataEntry._ID + " INTEGER PRIMARY KEY,"
                     + UserMetadataEntry.COLUMN_NAME_USER_ID + " INTEGER UNIQUE,"
-                    + UserMetadataEntry.COLUMN_NAME_PLATFORM_KEY_GENERATION_ID + " INTEGER)";
+                    + UserMetadataEntry.COLUMN_NAME_PLATFORM_KEY_GENERATION_ID + " INTEGER,"
+                    + UserMetadataEntry.COLUMN_NAME_USER_SERIAL_NUMBER + " INTEGER DEFAULT -1)";
 
     private static final String SQL_CREATE_RECOVERY_SERVICE_METADATA_ENTRY =
             "CREATE TABLE " + RecoveryServiceMetadataEntry.TABLE_NAME + " ("
@@ -79,7 +80,7 @@
                     + RootOfTrustEntry._ID + " INTEGER PRIMARY KEY,"
                     + RootOfTrustEntry.COLUMN_NAME_USER_ID + " INTEGER,"
                     + RootOfTrustEntry.COLUMN_NAME_UID + " INTEGER,"
-                    + RootOfTrustEntry.COLUMN_NAME_ROOT_ALIAS + " TEST,"
+                    + RootOfTrustEntry.COLUMN_NAME_ROOT_ALIAS + " TEXT,"
                     + RootOfTrustEntry.COLUMN_NAME_CERT_PATH + " BLOB,"
                     + RootOfTrustEntry.COLUMN_NAME_CERT_SERIAL + " INTEGER,"
                     + "UNIQUE("
@@ -141,6 +142,11 @@
             oldVersion = 5;
         }
 
+        if (oldVersion < 6 && newVersion >= 6) {
+            upgradeDbForVersion6(db);
+            oldVersion = 6;
+        }
+
         if (oldVersion != newVersion) {
             Log.e(TAG, "Failed to update recoverablekeystore database to the most recent version");
         }
@@ -179,6 +185,15 @@
                 KeysEntry.COLUMN_NAME_KEY_METADATA, "BLOB", /*defaultStr=*/ null);
     }
 
+    private void upgradeDbForVersion6(SQLiteDatabase db) {
+        Log.d(TAG, "Updating recoverable keystore database to version 6");
+        // adds a column to store the user serial number
+        addColumnToTable(db, UserMetadataEntry.TABLE_NAME,
+                UserMetadataEntry.COLUMN_NAME_USER_SERIAL_NUMBER,
+                "INTEGER DEFAULT -1",
+                 /*defaultStr=*/ null);
+    }
+
     private static void addColumnToTable(
             SQLiteDatabase db, String tableName, String column, String columnType,
             String defaultStr) {
diff --git a/services/core/java/com/android/server/media/projection/MediaProjectionManagerService.java b/services/core/java/com/android/server/media/projection/MediaProjectionManagerService.java
index fccff57..270fbc6 100644
--- a/services/core/java/com/android/server/media/projection/MediaProjectionManagerService.java
+++ b/services/core/java/com/android/server/media/projection/MediaProjectionManagerService.java
@@ -16,17 +16,15 @@
 
 package com.android.server.media.projection;
 
-import com.android.server.Watchdog;
-
 import android.Manifest;
 import android.app.AppOpsManager;
 import android.content.Context;
 import android.content.pm.PackageManager;
 import android.hardware.display.DisplayManager;
 import android.media.MediaRouter;
-import android.media.projection.IMediaProjectionManager;
 import android.media.projection.IMediaProjection;
 import android.media.projection.IMediaProjectionCallback;
+import android.media.projection.IMediaProjectionManager;
 import android.media.projection.IMediaProjectionWatcherCallback;
 import android.media.projection.MediaProjectionInfo;
 import android.media.projection.MediaProjectionManager;
@@ -41,6 +39,7 @@
 
 import com.android.internal.util.DumpUtils;
 import com.android.server.SystemService;
+import com.android.server.Watchdog;
 
 import java.io.FileDescriptor;
 import java.io.PrintWriter;
@@ -361,8 +360,9 @@
 
         @Override // Binder call
         public boolean canProjectAudio() {
-            return mType == MediaProjectionManager.TYPE_MIRRORING ||
-                    mType == MediaProjectionManager.TYPE_PRESENTATION;
+            return mType == MediaProjectionManager.TYPE_MIRRORING
+                || mType == MediaProjectionManager.TYPE_PRESENTATION
+                || mType == MediaProjectionManager.TYPE_SCREEN_CAPTURE;
         }
 
         @Override // Binder call
diff --git a/services/core/java/com/android/server/net/NetworkStatsService.java b/services/core/java/com/android/server/net/NetworkStatsService.java
index bffd60b..205ddb0 100644
--- a/services/core/java/com/android/server/net/NetworkStatsService.java
+++ b/services/core/java/com/android/server/net/NetworkStatsService.java
@@ -82,7 +82,6 @@
 import android.content.pm.ApplicationInfo;
 import android.content.pm.PackageManager;
 import android.net.DataUsageRequest;
-import android.net.IConnectivityManager;
 import android.net.INetworkManagementEventObserver;
 import android.net.INetworkStatsService;
 import android.net.INetworkStatsSession;
@@ -196,8 +195,6 @@
 
     private final boolean mUseBpfTrafficStats;
 
-    private IConnectivityManager mConnManager;
-
     @VisibleForTesting
     public static final String ACTION_NETWORK_STATS_POLL =
             "com.android.server.action.NETWORK_STATS_POLL";
@@ -259,6 +256,7 @@
     private final ArrayMap<String, NetworkIdentitySet> mActiveUidIfaces = new ArrayMap<>();
 
     /** Current default active iface. */
+    @GuardedBy("mStatsLock")
     private String mActiveIface;
 
     /** Set of any ifaces associated with mobile networks since boot. */
@@ -269,6 +267,10 @@
     @GuardedBy("mStatsLock")
     private Network[] mDefaultNetworks = new Network[0];
 
+    /** Set containing info about active VPNs and their underlying networks. */
+    @GuardedBy("mStatsLock")
+    private VpnInfo[] mVpnInfos = new VpnInfo[0];
+
     private final DropBoxNonMonotonicObserver mNonMonotonicObserver =
             new DropBoxNonMonotonicObserver();
 
@@ -382,10 +384,6 @@
         mHandlerCallback = callback;
     }
 
-    public void bindConnectivityManager(IConnectivityManager connManager) {
-        mConnManager = checkNotNull(connManager, "missing IConnectivityManager");
-    }
-
     public void systemReady() {
         mSystemReady = true;
 
@@ -864,13 +862,17 @@
     }
 
     @Override
-    public void forceUpdateIfaces(Network[] defaultNetworks) {
+    public void forceUpdateIfaces(
+            Network[] defaultNetworks,
+            VpnInfo[] vpnArray,
+            NetworkState[] networkStates,
+            String activeIface) {
         mContext.enforceCallingOrSelfPermission(READ_NETWORK_USAGE_HISTORY, TAG);
         assertBandwidthControlEnabled();
 
         final long token = Binder.clearCallingIdentity();
         try {
-            updateIfaces(defaultNetworks);
+            updateIfaces(defaultNetworks, vpnArray, networkStates, activeIface);
         } finally {
             Binder.restoreCallingIdentity(token);
         }
@@ -1134,11 +1136,17 @@
         }
     };
 
-    private void updateIfaces(Network[] defaultNetworks) {
+    private void updateIfaces(
+            Network[] defaultNetworks,
+            VpnInfo[] vpnArray,
+            NetworkState[] networkStates,
+            String activeIface) {
         synchronized (mStatsLock) {
             mWakeLock.acquire();
             try {
-                updateIfacesLocked(defaultNetworks);
+                mVpnInfos = vpnArray;
+                mActiveIface = activeIface;
+                updateIfacesLocked(defaultNetworks, networkStates);
             } finally {
                 mWakeLock.release();
             }
@@ -1152,7 +1160,7 @@
      * {@link NetworkIdentitySet}.
      */
     @GuardedBy("mStatsLock")
-    private void updateIfacesLocked(Network[] defaultNetworks) {
+    private void updateIfacesLocked(Network[] defaultNetworks, NetworkState[] states) {
         if (!mSystemReady) return;
         if (LOGV) Slog.v(TAG, "updateIfacesLocked()");
 
@@ -1164,18 +1172,6 @@
         // will be persisted during next alarm poll event.
         performPollLocked(FLAG_PERSIST_NETWORK);
 
-        final NetworkState[] states;
-        final LinkProperties activeLink;
-        try {
-            states = mConnManager.getAllNetworkState();
-            activeLink = mConnManager.getActiveLinkProperties();
-        } catch (RemoteException e) {
-            // ignored; service lives in system_server
-            return;
-        }
-
-        mActiveIface = activeLink != null ? activeLink.getInterfaceName() : null;
-
         // Rebuild active interfaces based on connected networks
         mActiveIfaces.clear();
         mActiveUidIfaces.clear();
@@ -1287,7 +1283,7 @@
         Trace.traceEnd(TRACE_TAG_NETWORK);
 
         // For per-UID stats, pass the VPN info so VPN traffic is reattributed to responsible apps.
-        VpnInfo[] vpnArray = mConnManager.getAllVpnInfo();
+        VpnInfo[] vpnArray = mVpnInfos;
         Trace.traceBegin(TRACE_TAG_NETWORK, "recordUid");
         mUidRecorder.recordSnapshotLocked(uidSnapshot, mActiveUidIfaces, vpnArray, currentTime);
         Trace.traceEnd(TRACE_TAG_NETWORK);
diff --git a/services/core/java/com/android/server/net/OWNERS b/services/core/java/com/android/server/net/OWNERS
index 2e91f99..28ae6a4 100644
--- a/services/core/java/com/android/server/net/OWNERS
+++ b/services/core/java/com/android/server/net/OWNERS
@@ -1,12 +1,11 @@
 set noparent
 
 codewiz@google.com
-ek@google.com
 jchalard@google.com
 jsharkey@android.com
+junyulai@google.com
 lorenzo@google.com
 reminv@google.com
 satk@google.com
-silberst@google.com
 sudheersai@google.com
 yamasani@google.com
diff --git a/services/core/java/com/android/server/notification/ConditionProviders.java b/services/core/java/com/android/server/notification/ConditionProviders.java
index 41f2cc5..64477a5 100644
--- a/services/core/java/com/android/server/notification/ConditionProviders.java
+++ b/services/core/java/com/android/server/notification/ConditionProviders.java
@@ -192,6 +192,11 @@
         return true;
     }
 
+    @Override
+    protected String getRequiredPermission() {
+        return null;
+    }
+
     public ManagedServiceInfo checkServiceToken(IConditionProvider provider) {
         synchronized(mMutex) {
             return checkServiceTokenLocked(provider);
diff --git a/services/core/java/com/android/server/notification/ManagedServices.java b/services/core/java/com/android/server/notification/ManagedServices.java
index cf09b8f..0c0c23a 100644
--- a/services/core/java/com/android/server/notification/ManagedServices.java
+++ b/services/core/java/com/android/server/notification/ManagedServices.java
@@ -64,6 +64,7 @@
 import com.android.internal.annotations.GuardedBy;
 import com.android.internal.annotations.VisibleForTesting;
 import com.android.internal.util.XmlUtils;
+import com.android.internal.util.function.TriPredicate;
 import com.android.server.notification.NotificationManagerService.DumpFilter;
 
 import org.xmlpull.v1.XmlPullParser;
@@ -333,6 +334,7 @@
                         out.attribute(null, ATT_APPROVED_LIST, allowedItems);
                         out.attribute(null, ATT_USER_ID, Integer.toString(approvedUserId));
                         out.attribute(null, ATT_IS_PRIMARY, Boolean.toString(isPrimary));
+                        writeExtraAttributes(out, approvedUserId);
                         out.endTag(null, TAG_MANAGED_SERVICES);
 
                         if (!forBackup && isPrimary) {
@@ -345,17 +347,21 @@
                 }
             }
         }
-
         out.endTag(null, getConfig().xmlTag);
     }
 
+    /**
+     * Writes extra xml attributes to {@link #TAG_MANAGED_SERVICES} tag.
+     */
+    protected void writeExtraAttributes(XmlSerializer out, int userId) throws IOException {}
+
     protected void migrateToXml() {
         loadAllowedComponentsFromSettings();
     }
 
     public void readXml(
             XmlPullParser parser,
-            Predicate<String> allowedManagedServicePackages,
+            TriPredicate<String, Integer, String> allowedManagedServicePackages,
             boolean forRestore,
             int userId)
             throws XmlPullParserException, IOException {
@@ -377,9 +383,9 @@
                             ? userId : XmlUtils.readIntAttribute(parser, ATT_USER_ID, 0);
                     final boolean isPrimary =
                             XmlUtils.readBooleanAttribute(parser, ATT_IS_PRIMARY, true);
-
-                    if (allowedManagedServicePackages == null ||
-                            allowedManagedServicePackages.test(getPackageName(approved))) {
+                    readExtraAttributes(tag, parser, resolvedUserId);
+                    if (allowedManagedServicePackages == null || allowedManagedServicePackages.test(
+                            getPackageName(approved), resolvedUserId, getRequiredPermission())) {
                         if (mUm.getUserInfo(resolvedUserId) != null) {
                             addApprovedList(approved, resolvedUserId, isPrimary);
                         }
@@ -391,6 +397,14 @@
         rebindServices(false, USER_ALL);
     }
 
+    /**
+     * Read extra attributes in the {@link #TAG_MANAGED_SERVICES} tag.
+     */
+    protected void readExtraAttributes(String tag, XmlPullParser parser, int userId)
+            throws IOException {}
+
+    protected abstract String getRequiredPermission();
+
     private void loadAllowedComponentsFromSettings() {
         for (UserInfo user : mUm.getUsers()) {
             final ContentResolver cr = mContext.getContentResolver();
@@ -1098,7 +1112,7 @@
                             binder.linkToDeath(info, 0);
                             added = mServices.add(info);
                         } catch (RemoteException e) {
-                            // already dead
+                            Slog.e(TAG, "Failed to linkToDeath, already dead", e);
                         }
                     }
                     if (added) {
@@ -1130,6 +1144,11 @@
                         }
                     }
                 }
+
+                @Override
+                public void onNullBinding(ComponentName name) {
+                    Slog.v(TAG, "onNullBinding() called with: name = [" + name + "]");
+                }
             };
             if (!mContext.bindServiceAsUser(intent,
                     serviceConnection,
diff --git a/services/core/java/com/android/server/notification/NotificationManagerService.java b/services/core/java/com/android/server/notification/NotificationManagerService.java
index e8c402c..88e697c 100644
--- a/services/core/java/com/android/server/notification/NotificationManagerService.java
+++ b/services/core/java/com/android/server/notification/NotificationManagerService.java
@@ -153,6 +153,7 @@
 import android.os.UserHandle;
 import android.os.VibrationEffect;
 import android.os.Vibrator;
+import android.provider.DeviceConfig;
 import android.provider.Settings;
 import android.service.notification.Adjustment;
 import android.service.notification.Condition;
@@ -190,6 +191,7 @@
 import com.android.internal.R;
 import com.android.internal.annotations.GuardedBy;
 import com.android.internal.annotations.VisibleForTesting;
+import com.android.internal.config.sysui.SystemUiDeviceConfigFlags;
 import com.android.internal.logging.MetricsLogger;
 import com.android.internal.logging.nano.MetricsProto;
 import com.android.internal.logging.nano.MetricsProto.MetricsEvent;
@@ -203,6 +205,7 @@
 import com.android.internal.util.FastXmlSerializer;
 import com.android.internal.util.Preconditions;
 import com.android.internal.util.XmlUtils;
+import com.android.internal.util.function.TriPredicate;
 import com.android.server.DeviceIdleController;
 import com.android.server.EventLogTags;
 import com.android.server.IoThread;
@@ -248,7 +251,6 @@
 import java.util.Set;
 import java.util.concurrent.TimeUnit;
 import java.util.function.BiConsumer;
-import java.util.function.Predicate;
 
 /** {@hide} */
 public class NotificationManagerService extends SystemService {
@@ -430,7 +432,7 @@
     private boolean mIsAutomotive;
 
     private MetricsLogger mMetricsLogger;
-    private Predicate<String> mAllowedManagedServicePackages;
+    private TriPredicate<String, Integer, String> mAllowedManagedServicePackages;
 
     private static class Archive {
         final int mBufferSize;
@@ -515,26 +517,32 @@
             }
         }
 
-        readDefaultAssistant(userId);
+        setDefaultAssistantForUser(userId);
     }
 
-    protected void readDefaultAssistant(int userId) {
-        String defaultAssistantAccess = getContext().getResources().getString(
-                com.android.internal.R.string.config_defaultAssistantAccessPackage);
-        if (defaultAssistantAccess != null) {
-            // Gather all notification assistant components for candidate pkg. There should
-            // only be one
-            Set<ComponentName> approvedAssistants =
-                    mAssistants.queryPackageForServices(defaultAssistantAccess,
-                            MATCH_DIRECT_BOOT_AWARE
-                                    | MATCH_DIRECT_BOOT_UNAWARE, userId);
-            for (ComponentName cn : approvedAssistants) {
-                try {
-                    getBinderService().setNotificationAssistantAccessGrantedForUser(
-                            cn, userId, true);
-                } catch (RemoteException e) {
-                    e.printStackTrace();
-                }
+    protected void setDefaultAssistantForUser(int userId) {
+        List<ComponentName> validAssistants = new ArrayList<>(
+                mAssistants.queryPackageForServices(
+                        null, MATCH_DIRECT_BOOT_AWARE | MATCH_DIRECT_BOOT_UNAWARE, userId));
+
+        List<String> candidateStrs = new ArrayList<>();
+        candidateStrs.add(DeviceConfig.getProperty(
+                DeviceConfig.NAMESPACE_SYSTEMUI,
+                SystemUiDeviceConfigFlags.NAS_DEFAULT_SERVICE));
+        candidateStrs.add(getContext().getResources().getString(
+                com.android.internal.R.string.config_defaultAssistantAccessComponent));
+
+        for (String candidateStr : candidateStrs) {
+            if (TextUtils.isEmpty(candidateStr)) {
+                continue;
+            }
+            ComponentName candidate = ComponentName.unflattenFromString(candidateStr);
+            if (candidate != null && validAssistants.contains(candidate)) {
+                setNotificationAssistantAccessGrantedForUserInternal(candidate, userId, true);
+                Slog.d(TAG, String.format("Set default NAS to be %s in %d", candidateStr, userId));
+                return;
+            } else {
+                Slog.w(TAG, "Invalid default NAS config is found: " + candidateStr);
             }
         }
     }
@@ -594,6 +602,8 @@
             mConditionProviders.migrateToXml();
             handleSavePolicyFile();
         }
+
+        mAssistants.resetDefaultAssistantsIfNecessary();
     }
 
     private void loadPolicyFile() {
@@ -748,7 +758,7 @@
             synchronized (mNotificationLock) {
                 NotificationRecord r = mNotificationsByKey.get(key);
                 if (r == null) {
-                    Log.w(TAG, "No notification with key: " + key);
+                    Slog.w(TAG, "No notification with key: " + key);
                     return;
                 }
                 final long now = System.currentTimeMillis();
@@ -778,7 +788,7 @@
             synchronized (mNotificationLock) {
                 NotificationRecord r = mNotificationsByKey.get(key);
                 if (r == null) {
-                    Log.w(TAG, "No notification with key: " + key);
+                    Slog.w(TAG, "No notification with key: " + key);
                     return;
                 }
                 final long now = System.currentTimeMillis();
@@ -1740,6 +1750,21 @@
         publishLocalService(NotificationManagerInternal.class, mInternalService);
     }
 
+    private void registerDeviceConfigChange() {
+        DeviceConfig.addOnPropertyChangedListener(
+                DeviceConfig.NAMESPACE_SYSTEMUI,
+                getContext().getMainExecutor(),
+                (namespace, name, value) -> {
+                    if (!DeviceConfig.NAMESPACE_SYSTEMUI.equals(namespace)) {
+                        return;
+                    }
+                    if (SystemUiDeviceConfigFlags.NAS_DEFAULT_SERVICE.equals(name)) {
+                        mAssistants.resetDefaultAssistantsIfNecessary();
+                    }
+                });
+    }
+
+
     private GroupHelper getGroupHelper() {
         mAutoGroupAtCount =
                 getContext().getResources().getInteger(R.integer.config_autoGroupAtCount);
@@ -1803,6 +1828,7 @@
             mListeners.onBootPhaseAppsCanStart();
             mAssistants.onBootPhaseAppsCanStart();
             mConditionProviders.onBootPhaseAppsCanStart();
+            registerDeviceConfigChange();
         }
     }
 
@@ -2450,29 +2476,27 @@
             checkCallerIsSameApp(callingPkg);
             final int callingUid = Binder.getCallingUid();
             UserHandle user = UserHandle.getUserHandleForUid(callingUid);
-            try {
-                ApplicationInfo info =
-                        mPackageManager.getApplicationInfo(delegate,
-                                MATCH_DIRECT_BOOT_AWARE | MATCH_DIRECT_BOOT_UNAWARE,
-                                user.getIdentifier());
-                if (info != null) {
-                    mPreferencesHelper.setNotificationDelegate(
-                            callingPkg, callingUid, delegate, info.uid);
-                    handleSavePolicyFile();
+            if (delegate == null) {
+                mPreferencesHelper.revokeNotificationDelegate(callingPkg, Binder.getCallingUid());
+                handleSavePolicyFile();
+            } else {
+                try {
+                    ApplicationInfo info =
+                            mPackageManager.getApplicationInfo(delegate,
+                                    MATCH_DIRECT_BOOT_AWARE | MATCH_DIRECT_BOOT_UNAWARE,
+                                    user.getIdentifier());
+                    if (info != null) {
+                        mPreferencesHelper.setNotificationDelegate(
+                                callingPkg, callingUid, delegate, info.uid);
+                        handleSavePolicyFile();
+                    }
+                } catch (RemoteException e) {
+                    e.rethrowFromSystemServer();
                 }
-            } catch (RemoteException e) {
-                // :(
             }
         }
 
         @Override
-        public void revokeNotificationDelegate(String callingPkg) {
-            checkCallerIsSameApp(callingPkg);
-            mPreferencesHelper.revokeNotificationDelegate(callingPkg, Binder.getCallingUid());
-            handleSavePolicyFile();
-        }
-
-        @Override
         public String getNotificationDelegate(String callingPkg) {
             // callable by Settings also
             checkCallerIsSystemOrSameApp(callingPkg);
@@ -3108,7 +3132,7 @@
                 synchronized (mNotificationLock) {
                     final ManagedServiceInfo info = mListeners.checkServiceTokenLocked(token);
                     if (info.supportsProfiles()) {
-                        Log.e(TAG, "Ignoring deprecated cancelNotification(pkg, tag, id) "
+                        Slog.e(TAG, "Ignoring deprecated cancelNotification(pkg, tag, id) "
                                 + "from " + info.component
                                 + " use cancelNotification(key) instead.");
                     } else {
@@ -3588,7 +3612,8 @@
             checkCallerIsSystemOrShell();
             final long identity = Binder.clearCallingIdentity();
             try {
-                if (mAllowedManagedServicePackages.test(pkg)) {
+                if (mAllowedManagedServicePackages.test(
+                        pkg, userId, mConditionProviders.getRequiredPermission())) {
                     mConditionProviders.setPackageOrComponentEnabled(
                             pkg, userId, true, granted);
 
@@ -3733,19 +3758,20 @@
 
         @Override
         public void setNotificationAssistantAccessGranted(ComponentName assistant,
-                boolean granted) throws RemoteException {
+                boolean granted) {
             setNotificationAssistantAccessGrantedForUser(
                     assistant, getCallingUserHandle().getIdentifier(), granted);
         }
 
         @Override
         public void setNotificationListenerAccessGrantedForUser(ComponentName listener, int userId,
-                boolean granted) throws RemoteException {
+                boolean granted) {
             Preconditions.checkNotNull(listener);
             checkCallerIsSystemOrShell();
             final long identity = Binder.clearCallingIdentity();
             try {
-                if (mAllowedManagedServicePackages.test(listener.getPackageName())) {
+                if (mAllowedManagedServicePackages.test(
+                        listener.getPackageName(), userId, mListeners.getRequiredPermission())) {
                     mConditionProviders.setPackageOrComponentEnabled(listener.flattenToString(),
                             userId, false, granted);
                     mListeners.setPackageOrComponentEnabled(listener.flattenToString(),
@@ -3766,32 +3792,12 @@
 
         @Override
         public void setNotificationAssistantAccessGrantedForUser(ComponentName assistant,
-                int userId, boolean granted) throws RemoteException {
+                int userId, boolean granted) {
             checkCallerIsSystemOrShell();
-            if (assistant == null) {
-                ComponentName allowedAssistant = CollectionUtils.firstOrNull(
-                        mAssistants.getAllowedComponents(userId));
-                if (allowedAssistant != null) {
-                    setNotificationAssistantAccessGrantedForUser(allowedAssistant, userId, false);
-                }
-                return;
-            }
+            mAssistants.setUserSet(userId, true);
             final long identity = Binder.clearCallingIdentity();
             try {
-                if (mAllowedManagedServicePackages.test(assistant.getPackageName())) {
-                    mConditionProviders.setPackageOrComponentEnabled(assistant.flattenToString(),
-                            userId, false, granted);
-                    mAssistants.setPackageOrComponentEnabled(assistant.flattenToString(),
-                            userId, true, granted);
-
-                    getContext().sendBroadcastAsUser(new Intent(
-                            NotificationManager.ACTION_NOTIFICATION_POLICY_ACCESS_GRANTED_CHANGED)
-                                    .setPackage(assistant.getPackageName())
-                                    .addFlags(Intent.FLAG_RECEIVER_REGISTERED_ONLY),
-                            UserHandle.of(userId), null);
-
-                    handleSavePolicyFile();
-                }
+                setNotificationAssistantAccessGrantedForUserInternal(assistant, userId, granted);
             } finally {
                 Binder.restoreCallingIdentity(identity);
             }
@@ -4004,6 +4010,35 @@
         }
     };
 
+    @VisibleForTesting
+    protected void setNotificationAssistantAccessGrantedForUserInternal(
+            ComponentName assistant, int userId, boolean granted) {
+        if (assistant == null) {
+            ComponentName allowedAssistant = CollectionUtils.firstOrNull(
+                    mAssistants.getAllowedComponents(userId));
+            if (allowedAssistant != null) {
+                setNotificationAssistantAccessGrantedForUserInternal(
+                        allowedAssistant, userId, false);
+            }
+            return;
+        }
+        if (mAllowedManagedServicePackages.test(assistant.getPackageName(), userId,
+                mAssistants.getRequiredPermission())) {
+            mConditionProviders.setPackageOrComponentEnabled(assistant.flattenToString(),
+                    userId, false, granted);
+            mAssistants.setPackageOrComponentEnabled(assistant.flattenToString(),
+                    userId, true, granted);
+
+            getContext().sendBroadcastAsUser(new Intent(
+                            NotificationManager.ACTION_NOTIFICATION_POLICY_ACCESS_GRANTED_CHANGED)
+                            .setPackage(assistant.getPackageName())
+                            .addFlags(Intent.FLAG_RECEIVER_REGISTERED_ONLY),
+                    UserHandle.of(userId), null);
+
+            handleSavePolicyFile();
+        }
+    }
+
     private void applyAdjustment(NotificationRecord r, Adjustment adjustment) {
         if (r == null) {
             return;
@@ -4517,7 +4552,7 @@
                     + ", incomingUserId=" + incomingUserId
                     + ", notificationUid=" + notificationUid
                     + ", notification=" + notification;
-            Log.e(TAG, noChannelStr);
+            Slog.e(TAG, noChannelStr);
             boolean appNotificationsOff = mPreferencesHelper.getImportance(pkg, notificationUid)
                     == NotificationManager.IMPORTANCE_NONE;
 
@@ -4614,7 +4649,7 @@
                     android.Manifest.permission.USE_FULL_SCREEN_INTENT, pkg);
             if (fullscreenIntentPermission != PERMISSION_GRANTED) {
                 notification.fullScreenIntent = null;
-                Log.w(TAG, "Package " + pkg +
+                Slog.w(TAG, "Package " + pkg +
                         ": Use of fullScreenIntent requires the USE_FULL_SCREEN_INTENT permission");
             }
         }
@@ -5143,7 +5178,7 @@
         // Ignore summary updates because we don't display most of the information.
         if (r.sbn.isGroup() && r.sbn.getNotification().isGroupSummary()) {
             if (DEBUG_INTERRUPTIVENESS) {
-                Log.v(TAG, "INTERRUPTIVENESS: "
+                Slog.v(TAG, "INTERRUPTIVENESS: "
                         +  r.getKey() + " is not interruptive: summary");
             }
             return false;
@@ -5151,7 +5186,7 @@
 
         if (old == null) {
             if (DEBUG_INTERRUPTIVENESS) {
-                Log.v(TAG, "INTERRUPTIVENESS: "
+                Slog.v(TAG, "INTERRUPTIVENESS: "
                         +  r.getKey() + " is interruptive: new notification");
             }
             return true;
@@ -5159,7 +5194,7 @@
 
         if (r == null) {
             if (DEBUG_INTERRUPTIVENESS) {
-                Log.v(TAG, "INTERRUPTIVENESS: "
+                Slog.v(TAG, "INTERRUPTIVENESS: "
                         +  r.getKey() + " is not interruptive: null");
             }
             return false;
@@ -5170,7 +5205,7 @@
 
         if (oldN.extras == null || newN.extras == null) {
             if (DEBUG_INTERRUPTIVENESS) {
-                Log.v(TAG, "INTERRUPTIVENESS: "
+                Slog.v(TAG, "INTERRUPTIVENESS: "
                         +  r.getKey() + " is not interruptive: no extras");
             }
             return false;
@@ -5180,7 +5215,7 @@
         // consider them one 'session'. Count them for everything else.
         if ((r.sbn.getNotification().flags & FLAG_FOREGROUND_SERVICE) != 0) {
             if (DEBUG_INTERRUPTIVENESS) {
-                Log.v(TAG, "INTERRUPTIVENESS: "
+                Slog.v(TAG, "INTERRUPTIVENESS: "
                         +  r.getKey() + " is not interruptive: foreground service");
             }
             return false;
@@ -5190,11 +5225,11 @@
         final String newTitle = String.valueOf(newN.extras.get(Notification.EXTRA_TITLE));
         if (!Objects.equals(oldTitle, newTitle)) {
             if (DEBUG_INTERRUPTIVENESS) {
-                Log.v(TAG, "INTERRUPTIVENESS: "
+                Slog.v(TAG, "INTERRUPTIVENESS: "
                         +  r.getKey() + " is interruptive: changed title");
-                Log.v(TAG, "INTERRUPTIVENESS: " + String.format("   old title: %s (%s@0x%08x)",
+                Slog.v(TAG, "INTERRUPTIVENESS: " + String.format("   old title: %s (%s@0x%08x)",
                         oldTitle, oldTitle.getClass(), oldTitle.hashCode()));
-                Log.v(TAG, "INTERRUPTIVENESS: " + String.format("   new title: %s (%s@0x%08x)",
+                Slog.v(TAG, "INTERRUPTIVENESS: " + String.format("   new title: %s (%s@0x%08x)",
                         newTitle, newTitle.getClass(), newTitle.hashCode()));
             }
             return true;
@@ -5204,18 +5239,18 @@
         final String newText = String.valueOf(newN.extras.get(Notification.EXTRA_TEXT));
         if (!Objects.equals(oldText, newText)) {
             if (DEBUG_INTERRUPTIVENESS) {
-                Log.v(TAG, "INTERRUPTIVENESS: "
+                Slog.v(TAG, "INTERRUPTIVENESS: "
                         + r.getKey() + " is interruptive: changed text");
-                Log.v(TAG, "INTERRUPTIVENESS: " + String.format("   old text: %s (%s@0x%08x)",
+                Slog.v(TAG, "INTERRUPTIVENESS: " + String.format("   old text: %s (%s@0x%08x)",
                         oldText, oldText.getClass(), oldText.hashCode()));
-                Log.v(TAG, "INTERRUPTIVENESS: " + String.format("   new text: %s (%s@0x%08x)",
+                Slog.v(TAG, "INTERRUPTIVENESS: " + String.format("   new text: %s (%s@0x%08x)",
                         newText, newText.getClass(), newText.hashCode()));
             }
             return true;
         }
         if (oldN.hasCompletedProgress() != newN.hasCompletedProgress()) {
             if (DEBUG_INTERRUPTIVENESS) {
-                Log.v(TAG, "INTERRUPTIVENESS: "
+                Slog.v(TAG, "INTERRUPTIVENESS: "
                     +  r.getKey() + " is interruptive: completed progress");
             }
             return true;
@@ -5223,7 +5258,7 @@
         // Actions
         if (Notification.areActionsVisiblyDifferent(oldN, newN)) {
             if (DEBUG_INTERRUPTIVENESS) {
-                Log.v(TAG, "INTERRUPTIVENESS: "
+                Slog.v(TAG, "INTERRUPTIVENESS: "
                         +  r.getKey() + " is interruptive: changed actions");
             }
             return true;
@@ -5236,7 +5271,7 @@
             // Style based comparisons
             if (Notification.areStyledNotificationsVisiblyDifferent(oldB, newB)) {
                 if (DEBUG_INTERRUPTIVENESS) {
-                    Log.v(TAG, "INTERRUPTIVENESS: "
+                    Slog.v(TAG, "INTERRUPTIVENESS: "
                             +  r.getKey() + " is interruptive: styles differ");
                 }
                 return true;
@@ -5245,7 +5280,7 @@
             // Remote views
             if (Notification.areRemoteViewsChanged(oldB, newB)) {
                 if (DEBUG_INTERRUPTIVENESS) {
-                    Log.v(TAG, "INTERRUPTIVENESS: "
+                    Slog.v(TAG, "INTERRUPTIVENESS: "
                             +  r.getKey() + " is interruptive: remoteviews differ");
                 }
                 return true;
@@ -5474,12 +5509,12 @@
             // Ignore summary updates because we don't display most of the information.
             if (record.sbn.isGroup() && record.sbn.getNotification().isGroupSummary()) {
                 if (DEBUG_INTERRUPTIVENESS) {
-                    Log.v(TAG, "INTERRUPTIVENESS: "
+                    Slog.v(TAG, "INTERRUPTIVENESS: "
                             + record.getKey() + " is not interruptive: summary");
                 }
             } else {
                 if (DEBUG_INTERRUPTIVENESS) {
-                    Log.v(TAG, "INTERRUPTIVENESS: "
+                    Slog.v(TAG, "INTERRUPTIVENESS: "
                             + record.getKey() + " is interruptive: alerted");
                 }
                 record.setInterruptive(true);
@@ -6567,7 +6602,7 @@
         String pkg = r.sbn.getPackageName();
 
         if (pkg == null) {
-            if (DBG) Log.e(TAG, "No package for group summary: " + r.getKey());
+            if (DBG) Slog.e(TAG, "No package for group summary: " + r.getKey());
             return;
         }
 
@@ -6826,7 +6861,7 @@
                 return;
             }
         } catch (RemoteException re) {
-            if (DBG) Log.e(TAG, "Unable to confirm if it's safe to skip category "
+            if (DBG) Slog.e(TAG, "Unable to confirm if it's safe to skip category "
                     + "restrictions check thus the check will be done anyway");
         }
         if (Notification.CATEGORY_CAR_EMERGENCY.equals(notification.category)
@@ -7050,7 +7085,7 @@
     }
 
     @VisibleForTesting
-    boolean canUseManagedServices(String pkg) {
+    boolean canUseManagedServices(String pkg, Integer userId, String requiredPermission) {
         boolean canUseManagedServices = !mActivityManager.isLowRamDevice()
                 || mPackageManagerClient.hasSystemFeature(PackageManager.FEATURE_WATCH);
 
@@ -7061,6 +7096,17 @@
             }
         }
 
+        if (requiredPermission != null) {
+            try {
+                if (mPackageManager.checkPermission(requiredPermission, pkg, userId)
+                    != PackageManager.PERMISSION_GRANTED) {
+                    canUseManagedServices = false;
+                }
+            } catch (RemoteException e) {
+                Slog.e(TAG, "can't talk to pm", e);
+            }
+        }
+
         return canUseManagedServices;
     }
 
@@ -7091,6 +7137,13 @@
     public class NotificationAssistants extends ManagedServices {
         static final String TAG_ENABLED_NOTIFICATION_ASSISTANTS = "enabled_assistants";
 
+        private static final String ATT_USER_SET = "user_set";
+
+        private final Object mLock = new Object();
+
+        @GuardedBy("mLock")
+        private ArrayMap<Integer, Boolean> mUserSetMap = new ArrayMap<>();
+
         public NotificationAssistants(Context context, Object lock, UserProfiles up,
                 IPackageManager pm) {
             super(context, lock, up, pm);
@@ -7138,6 +7191,12 @@
             rebindServices(true, user);
         }
 
+        @Override
+        protected String getRequiredPermission() {
+            // only signature/privileged apps can be bound.
+            return android.Manifest.permission.REQUEST_NOTIFICATION_ASSISTANT_SERVICE;
+        }
+
         protected void onNotificationsSeenLocked(ArrayList<NotificationRecord> records) {
             // There should be only one, but it's a list, so while we enforce
             // singularity elsewhere, we keep it general here, to avoid surprises.
@@ -7157,27 +7216,59 @@
             }
         }
 
+        boolean hasUserSet(int userId) {
+            synchronized (mLock) {
+                return mUserSetMap.getOrDefault(userId, false);
+            }
+        }
+
+        void setUserSet(int userId, boolean set) {
+            synchronized (mLock) {
+                mUserSetMap.put(userId, set);
+            }
+        }
+
+        @Override
+        protected void writeExtraAttributes(XmlSerializer out, int userId) throws IOException {
+            out.attribute(null, ATT_USER_SET, Boolean.toString(hasUserSet(userId)));
+        }
+
+        @Override
+        protected void readExtraAttributes(String tag, XmlPullParser parser, int userId)
+                throws IOException {
+            boolean userSet = XmlUtils.readBooleanAttribute(parser, ATT_USER_SET, false);
+            setUserSet(userId, userSet);
+        }
+
         private void notifySeen(final ManagedServiceInfo info,
                 final ArrayList<String> keys) {
             final INotificationListener assistant = (INotificationListener) info.service;
             try {
                 assistant.onNotificationsSeen(keys);
             } catch (RemoteException ex) {
-                Log.e(TAG, "unable to notify assistant (seen): " + assistant, ex);
+                Slog.e(TAG, "unable to notify assistant (seen): " + assistant, ex);
             }
         }
 
         @GuardedBy("mNotificationLock")
         private void onNotificationEnqueuedLocked(final NotificationRecord r) {
+            final boolean debug = isVerboseLogEnabled();
+            if (debug) {
+                Slog.v(TAG, "onNotificationEnqueuedLocked() called with: r = [" + r + "]");
+            }
             final StatusBarNotification sbn = r.sbn;
             notifyAssistantLocked(
                     sbn,
                     true /* sameUserOnly */,
                     (assistant, sbnHolder) -> {
                         try {
+                            if (debug) {
+                                Slog.v(TAG,
+                                        "calling onNotificationEnqueuedWithChannel " + sbnHolder);
+                            }
                             assistant.onNotificationEnqueuedWithChannel(sbnHolder, r.getChannel());
                         } catch (RemoteException ex) {
-                            Log.e(TAG, "unable to notify assistant (enqueued): " + assistant, ex);
+                            Slog.e(TAG, "unable to notify assistant (enqueued): " + assistant, ex);
                         }
                     });
         }
@@ -7195,7 +7286,7 @@
                         try {
                             assistant.onNotificationExpansionChanged(key, isUserAction, isExpanded);
                         } catch (RemoteException ex) {
-                            Log.e(TAG, "unable to notify assistant (expanded): " + assistant, ex);
+                            Slog.e(TAG, "unable to notify assistant (expanded): " + assistant, ex);
                         }
                     });
         }
@@ -7211,7 +7302,7 @@
                         try {
                             assistant.onNotificationDirectReply(key);
                         } catch (RemoteException ex) {
-                            Log.e(TAG, "unable to notify assistant (expanded): " + assistant, ex);
+                            Slog.e(TAG, "unable to notify assistant (expanded): " + assistant, ex);
                         }
                     });
         }
@@ -7232,7 +7323,7 @@
                                             ? NotificationAssistantService.SOURCE_FROM_ASSISTANT
                                             : NotificationAssistantService.SOURCE_FROM_APP);
                         } catch (RemoteException ex) {
-                            Log.e(TAG, "unable to notify assistant (snoozed): " + assistant, ex);
+                            Slog.e(TAG, "unable to notify assistant (snoozed): " + assistant, ex);
                         }
                     });
         }
@@ -7254,7 +7345,7 @@
                                             ? NotificationAssistantService.SOURCE_FROM_ASSISTANT
                                             : NotificationAssistantService.SOURCE_FROM_APP);
                         } catch (RemoteException ex) {
-                            Log.e(TAG, "unable to notify assistant (snoozed): " + assistant, ex);
+                            Slog.e(TAG, "unable to notify assistant (snoozed): " + assistant, ex);
                         }
                     });
         }
@@ -7274,7 +7365,7 @@
                             assistant.onNotificationSnoozedUntilContext(
                                     sbnHolder, snoozeCriterionId);
                         } catch (RemoteException ex) {
-                            Log.e(TAG, "unable to notify assistant (snoozed): " + assistant, ex);
+                            Slog.e(TAG, "unable to notify assistant (snoozed): " + assistant, ex);
                         }
                     });
         }
@@ -7296,9 +7387,19 @@
             TrimCache trimCache = new TrimCache(sbn);
             // There should be only one, but it's a list, so while we enforce
             // singularity elsewhere, we keep it general here, to avoid surprises.
+
+            final boolean debug = isVerboseLogEnabled();
+            if (debug) {
+                Slog.v(TAG,
+                        "notifyAssistantLocked() called with: sbn = [" + sbn + "], sameUserOnly = ["
+                                + sameUserOnly + "], callback = [" + callback + "]");
+            }
             for (final ManagedServiceInfo info : NotificationAssistants.this.getServices()) {
                 boolean sbnVisible = isVisibleToListener(sbn, info)
                         && (!sameUserOnly || info.isSameUser(sbn.getUserId()));
+                if (debug) {
+                    Slog.v(TAG, "notifyAssistantLocked info=" + info + " snbVisible=" + sbnVisible);
+                }
                 if (!sbnVisible) {
                     continue;
                 }
@@ -7314,13 +7415,13 @@
             return !getServices().isEmpty();
         }
 
-        protected void ensureAssistant() {
+        protected void resetDefaultAssistantsIfNecessary() {
             final List<UserInfo> activeUsers = mUm.getUsers(true);
             for (UserInfo userInfo : activeUsers) {
                 int userId = userInfo.getUserHandle().getIdentifier();
-                if (getAllowedPackages(userId).isEmpty()) {
+                if (!hasUserSet(userId)) {
                     Slog.d(TAG, "Approving default notification assistant for user " + userId);
-                    readDefaultAssistant(userId);
+                    setDefaultAssistantForUser(userId);
                 }
             }
         }
@@ -7334,16 +7435,28 @@
                 if (!allowedComponents.isEmpty()) {
                     ComponentName currentComponent = CollectionUtils.firstOrNull(allowedComponents);
                     if (currentComponent.flattenToString().equals(pkgOrComponent)) return;
-                    try {
-                        getBinderService().setNotificationAssistantAccessGrantedForUser(
-                                currentComponent, userId, false);
-                    } catch (RemoteException e) {
-                        e.rethrowFromSystemServer();
-                    }
+                    setNotificationAssistantAccessGrantedForUserInternal(
+                            currentComponent, userId, false);
                 }
             }
             super.setPackageOrComponentEnabled(pkgOrComponent, userId, isPrimary, enabled);
         }
+
+        @Override
+        public void dump(PrintWriter pw, DumpFilter filter) {
+            super.dump(pw, filter);
+            pw.println("    Has user set:");
+            synchronized (mLock) {
+                Set<Integer> userIds = mUserSetMap.keySet();
+                for (int userId : userIds) {
+                    pw.println("      userId=" + userId + " value=" + mUserSetMap.get(userId));
+                }
+            }
+        }
+
+        private boolean isVerboseLogEnabled() {
+            return Log.isLoggable("notification_assistant", Log.VERBOSE);
+        }
     }
 
     public class NotificationListeners extends ManagedServices {
@@ -7413,6 +7526,11 @@
             mLightTrimListeners.remove(removed);
         }
 
+        @Override
+        protected String getRequiredPermission() {
+            return null;
+        }
+
         @GuardedBy("mNotificationLock")
         public void setOnNotificationPostedTrimLocked(ManagedServiceInfo info, int trim) {
             if (trim == TRIM_LIGHT) {
@@ -7433,7 +7551,7 @@
                      try {
                         listener.onStatusBarIconsBehaviorChanged(hideSilentStatusIcons);
                     } catch (RemoteException ex) {
-                        Log.e(TAG, "unable to notify listener "
+                        Slog.e(TAG, "unable to notify listener "
                                 + "(hideSilentStatusIcons): " + listener, ex);
                     }
                 });
@@ -7727,7 +7845,7 @@
             try {
                 listener.onNotificationPosted(sbnHolder, rankingUpdate);
             } catch (RemoteException ex) {
-                Log.e(TAG, "unable to notify listener (posted): " + listener, ex);
+                Slog.e(TAG, "unable to notify listener (posted): " + listener, ex);
             }
         }
 
@@ -7741,7 +7859,7 @@
             try {
                 listener.onNotificationRemoved(sbnHolder, rankingUpdate, stats, reason);
             } catch (RemoteException ex) {
-                Log.e(TAG, "unable to notify listener (removed): " + listener, ex);
+                Slog.e(TAG, "unable to notify listener (removed): " + listener, ex);
             }
         }
 
@@ -7751,7 +7869,7 @@
             try {
                 listener.onNotificationRankingUpdate(rankingUpdate);
             } catch (RemoteException ex) {
-                Log.e(TAG, "unable to notify listener (ranking update): " + listener, ex);
+                Slog.e(TAG, "unable to notify listener (ranking update): " + listener, ex);
             }
         }
 
@@ -7760,7 +7878,7 @@
             try {
                 listener.onListenerHintsChanged(hints);
             } catch (RemoteException ex) {
-                Log.e(TAG, "unable to notify listener (listener hints): " + listener, ex);
+                Slog.e(TAG, "unable to notify listener (listener hints): " + listener, ex);
             }
         }
 
@@ -7770,7 +7888,7 @@
             try {
                 listener.onInterruptionFilterChanged(interruptionFilter);
             } catch (RemoteException ex) {
-                Log.e(TAG, "unable to notify listener (interruption filter): " + listener, ex);
+                Slog.e(TAG, "unable to notify listener (interruption filter): " + listener, ex);
             }
         }
 
@@ -7781,7 +7899,7 @@
             try {
                 listener.onNotificationChannelModification(pkg, user, channel, modificationType);
             } catch (RemoteException ex) {
-                Log.e(TAG, "unable to notify listener (channel changed): " + listener, ex);
+                Slog.e(TAG, "unable to notify listener (channel changed): " + listener, ex);
             }
         }
 
@@ -7792,7 +7910,7 @@
             try {
                 listener.onNotificationChannelGroupModification(pkg, user, group, modificationType);
             } catch (RemoteException ex) {
-                Log.e(TAG, "unable to notify listener (channel group changed): " + listener, ex);
+                Slog.e(TAG, "unable to notify listener (channel group changed): " + listener, ex);
             }
         }
 
@@ -7896,6 +8014,19 @@
     }
 
     @VisibleForTesting
+    void resetAssistantUserSet(int userId) {
+        mAssistants.setUserSet(userId, false);
+        handleSavePolicyFile();
+    }
+
+    @VisibleForTesting
+    @Nullable
+    ComponentName getApprovedAssistant(int userId) {
+        List<ComponentName> allowedComponents = mAssistants.getAllowedComponents(userId);
+        return CollectionUtils.firstOrNull(allowedComponents);
+    }
+
+    @VisibleForTesting
     protected void simulatePackageSuspendBroadcast(boolean suspend, String pkg) {
         // only use for testing: mimic receive broadcast that package is (un)suspended
         // but does not actually (un)suspend the package
diff --git a/services/core/java/com/android/server/notification/NotificationRecord.java b/services/core/java/com/android/server/notification/NotificationRecord.java
index 48818f5..46ce4bf 100644
--- a/services/core/java/com/android/server/notification/NotificationRecord.java
+++ b/services/core/java/com/android/server/notification/NotificationRecord.java
@@ -637,25 +637,17 @@
                     final ArrayList<String> people =
                             adjustment.getSignals().getStringArrayList(Adjustment.KEY_PEOPLE);
                     setPeopleOverride(people);
-                    MetricsLogger.action(getAdjustmentLogMaker()
-                            .addTaggedData(MetricsEvent.ADJUSTMENT_KEY_PEOPLE, people.size()));
                 }
                 if (signals.containsKey(Adjustment.KEY_SNOOZE_CRITERIA)) {
                     final ArrayList<SnoozeCriterion> snoozeCriterionList =
                             adjustment.getSignals().getParcelableArrayList(
                                     Adjustment.KEY_SNOOZE_CRITERIA);
                     setSnoozeCriteria(snoozeCriterionList);
-                    MetricsLogger.action(getAdjustmentLogMaker()
-                            .addTaggedData(MetricsEvent.ADJUSTMENT_KEY_SNOOZE_CRITERIA,
-                                    snoozeCriterionList.size()));
                 }
                 if (signals.containsKey(Adjustment.KEY_GROUP_KEY)) {
                     final String groupOverrideKey =
                             adjustment.getSignals().getString(Adjustment.KEY_GROUP_KEY);
                     setOverrideGroupKey(groupOverrideKey);
-                    MetricsLogger.action(getAdjustmentLogMaker()
-                            .addTaggedData(MetricsEvent.ADJUSTMENT_KEY_GROUP_KEY,
-                                    groupOverrideKey));
                 }
                 if (signals.containsKey(Adjustment.KEY_USER_SENTIMENT)) {
                     // Only allow user sentiment update from assistant if user hasn't already
@@ -664,32 +656,20 @@
                             && (getChannel().getUserLockedFields() & USER_LOCKED_IMPORTANCE) == 0) {
                         setUserSentiment(adjustment.getSignals().getInt(
                                 Adjustment.KEY_USER_SENTIMENT, USER_SENTIMENT_NEUTRAL));
-                        MetricsLogger.action(getAdjustmentLogMaker()
-                                .addTaggedData(MetricsEvent.ADJUSTMENT_KEY_USER_SENTIMENT,
-                                        getUserSentiment()));
                     }
                 }
                 if (signals.containsKey(Adjustment.KEY_CONTEXTUAL_ACTIONS)) {
                     setSystemGeneratedSmartActions(
                             signals.getParcelableArrayList(Adjustment.KEY_CONTEXTUAL_ACTIONS));
-                    MetricsLogger.action(getAdjustmentLogMaker()
-                            .addTaggedData(MetricsEvent.ADJUSTMENT_KEY_SMART_ACTIONS,
-                                    getSystemGeneratedSmartActions().size()));
                 }
                 if (signals.containsKey(Adjustment.KEY_TEXT_REPLIES)) {
                     setSmartReplies(signals.getCharSequenceArrayList(Adjustment.KEY_TEXT_REPLIES));
-                    MetricsLogger.action(getAdjustmentLogMaker()
-                            .addTaggedData(MetricsEvent.ADJUSTMENT_KEY_SMART_REPLIES,
-                                    getSmartReplies().size()));
                 }
                 if (signals.containsKey(Adjustment.KEY_IMPORTANCE)) {
                     int importance = signals.getInt(Adjustment.KEY_IMPORTANCE);
                     importance = Math.max(IMPORTANCE_UNSPECIFIED, importance);
                     importance = Math.min(IMPORTANCE_HIGH, importance);
                     setAssistantImportance(importance);
-                    MetricsLogger.action(getAdjustmentLogMaker()
-                            .addTaggedData(MetricsEvent.ADJUSTMENT_KEY_IMPORTANCE,
-                                    importance));
                 }
             }
             // We have now gotten all the information out of the adjustments and can forget them.
@@ -1280,12 +1260,6 @@
         return getLogMaker().setCategory(MetricsEvent.NOTIFICATION_ITEM);
     }
 
-    public LogMaker getAdjustmentLogMaker() {
-        return getLogMaker()
-                .setCategory(MetricsEvent.NOTIFICATION_ITEM)
-                .setType(MetricsEvent.TYPE_NOTIFICATION_ASSISTANT_ADJUSTMENT);
-    }
-
     @VisibleForTesting
     static final class Light {
         public final int color;
diff --git a/services/core/java/com/android/server/notification/NotificationShellCmd.java b/services/core/java/com/android/server/notification/NotificationShellCmd.java
index 26cc0c1..dd0f420 100644
--- a/services/core/java/com/android/server/notification/NotificationShellCmd.java
+++ b/services/core/java/com/android/server/notification/NotificationShellCmd.java
@@ -58,6 +58,8 @@
             + "  disallow_dnd PACKAGE [user_id (current user if not specified)]\n"
             + "  suspend_package PACKAGE\n"
             + "  unsuspend_package PACKAGE\n"
+            + "  reset_assistant_user_set [user_id (current user if not specified)]\n"
+            + "  get_approved_assistant [user_id (current user if not specified)]\n"
             + "  post [--help | flags] TAG TEXT";
 
     private static final String NOTIFY_USAGE =
@@ -199,8 +201,29 @@
                     mDirectService.simulatePackageDistractionBroadcast(
                             Integer.parseInt(getNextArgRequired()),
                             getNextArgRequired().split(","));
+                    break;
                 }
-                break;
+                case "reset_assistant_user_set": {
+                    int userId = ActivityManager.getCurrentUser();
+                    if (peekNextArg() != null) {
+                        userId = Integer.parseInt(getNextArgRequired());
+                    }
+                    mDirectService.resetAssistantUserSet(userId);
+                    break;
+                }
+                case "get_approved_assistant": {
+                    int userId = ActivityManager.getCurrentUser();
+                    if (peekNextArg() != null) {
+                        userId = Integer.parseInt(getNextArgRequired());
+                    }
+                    ComponentName approvedAssistant = mDirectService.getApprovedAssistant(userId);
+                    if (approvedAssistant == null) {
+                        pw.println("null");
+                    } else {
+                        pw.println(approvedAssistant.flattenToString());
+                    }
+                    break;
+                }
                 case "post":
                 case "notify":
                     doNotify(pw);
diff --git a/services/core/java/com/android/server/om/IdmapManager.java b/services/core/java/com/android/server/om/IdmapManager.java
index 74fbea1..9e0cb0f 100644
--- a/services/core/java/com/android/server/om/IdmapManager.java
+++ b/services/core/java/com/android/server/om/IdmapManager.java
@@ -36,6 +36,7 @@
 import android.util.Slog;
 
 import com.android.internal.os.BackgroundThread;
+import com.android.server.om.OverlayManagerServiceImpl.PackageManagerHelper;
 import com.android.server.pm.Installer;
 
 import java.io.File;
@@ -52,6 +53,7 @@
     private static final boolean FEATURE_FLAG_IDMAP2 = true;
 
     private final Installer mInstaller;
+    private final PackageManagerHelper mPackageManager;
     private IIdmap2 mIdmap2Service;
 
     private static final boolean VENDOR_IS_Q_OR_LATER;
@@ -61,8 +63,9 @@
         VENDOR_IS_Q_OR_LATER = value.equals("Q") || value.equals("q");
     }
 
-    IdmapManager(final Installer installer) {
+    IdmapManager(final Installer installer, final PackageManagerHelper packageManager) {
         mInstaller = installer;
+        mPackageManager = packageManager;
         if (FEATURE_FLAG_IDMAP2) {
             connectToIdmap2d();
         }
@@ -79,7 +82,7 @@
         final String overlayPath = overlayPackage.applicationInfo.getBaseCodePath();
         try {
             if (FEATURE_FLAG_IDMAP2) {
-                int policies = determineFulfilledPolicies(overlayPackage);
+                int policies = determineFulfilledPolicies(targetPackage, overlayPackage, userId);
                 boolean enforce = enforceOverlayable(overlayPackage);
                 if (mIdmap2Service.verifyIdmap(overlayPath, policies, enforce, userId)) {
                     return true;
@@ -197,14 +200,18 @@
      * Retrieves a bitmask for idmap2 that represents the policies the specified overlay fulfills.
      * @throws SecurityException if the overlay is not allowed to overlay any resource
      */
-    private int determineFulfilledPolicies(@NonNull final PackageInfo overlayPackage)
-            throws SecurityException {
+    private int determineFulfilledPolicies(@NonNull final PackageInfo targetPackage,
+            @NonNull final PackageInfo overlayPackage, int userId) throws SecurityException {
         final ApplicationInfo ai = overlayPackage.applicationInfo;
         final boolean overlayIsQOrLater = ai.targetSdkVersion >= VERSION_CODES.Q;
 
         int fulfilledPolicies = 0;
 
-        // TODO(b/119402606) : Add signature policy
+        // Overlay matches target signature
+        if (mPackageManager.signaturesMatching(targetPackage.packageName,
+                overlayPackage.packageName, userId)) {
+            fulfilledPolicies |= IIdmap2.POLICY_SIGNATURE;
+        }
 
         // Vendor partition (/vendor)
         if (ai.isVendor()) {
diff --git a/services/core/java/com/android/server/om/OverlayManagerService.java b/services/core/java/com/android/server/om/OverlayManagerService.java
index d0c59c1..8905eb9 100644
--- a/services/core/java/com/android/server/om/OverlayManagerService.java
+++ b/services/core/java/com/android/server/om/OverlayManagerService.java
@@ -232,7 +232,7 @@
                     new File(Environment.getDataSystemDirectory(), "overlays.xml"), "overlays");
             mPackageManager = new PackageManagerHelper();
             mUserManager = UserManagerService.getInstance();
-            IdmapManager im = new IdmapManager(installer);
+            IdmapManager im = new IdmapManager(installer, mPackageManager);
             mSettings = new OverlayManagerSettings();
             mImpl = new OverlayManagerServiceImpl(mPackageManager, im, mSettings,
                     getDefaultOverlayPackages(), new OverlayChangeListener());
diff --git a/services/core/java/com/android/server/os/BugreportManagerServiceImpl.java b/services/core/java/com/android/server/os/BugreportManagerServiceImpl.java
index f4454ae..64f31cd 100644
--- a/services/core/java/com/android/server/os/BugreportManagerServiceImpl.java
+++ b/services/core/java/com/android/server/os/BugreportManagerServiceImpl.java
@@ -31,10 +31,12 @@
 import android.os.SystemClock;
 import android.os.SystemProperties;
 import android.os.UserManager;
+import android.util.ArraySet;
 import android.util.Slog;
 
 import com.android.internal.annotations.GuardedBy;
 import com.android.internal.util.Preconditions;
+import com.android.server.SystemConfig;
 
 import java.io.FileDescriptor;
 
@@ -55,10 +57,13 @@
     private final Object mLock = new Object();
     private final Context mContext;
     private final AppOpsManager mAppOps;
+    private final ArraySet<String> mBugreportWhitelistedPackages;
 
     BugreportManagerServiceImpl(Context context) {
         mContext = context;
         mAppOps = (AppOpsManager) context.getSystemService(Context.APP_OPS_SERVICE);
+        mBugreportWhitelistedPackages =
+                SystemConfig.getInstance().getBugreportWhitelistedPackages();
     }
 
     @Override
@@ -78,11 +83,20 @@
         Preconditions.checkNotNull(bugreportFd);
         Preconditions.checkNotNull(listener);
         validateBugreportMode(bugreportMode);
-        ensureIsPrimaryUser();
+        final long identity = Binder.clearCallingIdentity();
+        try {
+            ensureIsPrimaryUser();
+        } finally {
+            Binder.restoreCallingIdentity(identity);
+        }
 
         int callingUid = Binder.getCallingUid();
         mAppOps.checkPackage(callingUid, callingPackage);
 
+        if (!mBugreportWhitelistedPackages.contains(callingPackage)) {
+            throw new SecurityException(
+                    callingPackage + " is not whitelisted to use Bugreport API");
+        }
         synchronized (mLock) {
             startBugreportLocked(callingUid, callingPackage, bugreportFd, screenshotFd,
                     bugreportMode, listener);
diff --git a/services/core/java/com/android/server/pm/DynamicCodeLoggingService.java b/services/core/java/com/android/server/pm/DynamicCodeLoggingService.java
index d53d81c..a1ff76fc 100644
--- a/services/core/java/com/android/server/pm/DynamicCodeLoggingService.java
+++ b/services/core/java/com/android/server/pm/DynamicCodeLoggingService.java
@@ -61,7 +61,7 @@
     private static final Pattern EXECUTE_NATIVE_AUDIT_PATTERN =
             Pattern.compile(".*\\bavc: granted \\{ execute(?:_no_trans|) \\} .*"
                     + "\\bpath=(?:\"([^\" ]*)\"|([0-9A-F]+)) .*"
-                    + "\\bscontext=u:r:untrusted_app_2(?:5|7):.*"
+                    + "\\bscontext=u:r:untrusted_app(?:_25|_27)?:.*"
                     + "\\btcontext=u:object_r:app_data_file:.*"
                     + "\\btclass=file\\b.*");
 
diff --git a/services/core/java/com/android/server/pm/LauncherAppsService.java b/services/core/java/com/android/server/pm/LauncherAppsService.java
index 9e912843..05af13a 100644
--- a/services/core/java/com/android/server/pm/LauncherAppsService.java
+++ b/services/core/java/com/android/server/pm/LauncherAppsService.java
@@ -744,12 +744,8 @@
             if (!canAccessProfile(user.getIdentifier(), "Cannot access usage limit")) {
                 return null;
             }
-
-            final PackageManagerInternal pmi =
-                    LocalServices.getService(PackageManagerInternal.class);
-            final ComponentName cn = pmi.getDefaultHomeActivity(user.getIdentifier());
-            if (!cn.getPackageName().equals(callingPackage)) {
-                throw new SecurityException("Caller is not the active launcher");
+            if (!mActivityTaskManagerInternal.isCallerRecents(Binder.getCallingUid())) {
+                throw new SecurityException("Caller is not the recents app");
             }
 
             final UsageStatsManagerInternal.AppUsageLimitData data =
diff --git a/services/core/java/com/android/server/pm/OWNERS b/services/core/java/com/android/server/pm/OWNERS
index 8ce2568..3c1ee3e 100644
--- a/services/core/java/com/android/server/pm/OWNERS
+++ b/services/core/java/com/android/server/pm/OWNERS
@@ -14,72 +14,72 @@
 per-file StagingManager.java = dariofreni@google.com, narayan@google.com, toddke@android.com, toddke@google.com
 
 # dex
-per-file AbstractStatsBase.java = agampe@google.com
-per-file AbstractStatsBase.java = calin@google.com
-per-file AbstractStatsBase.java = ngeoffray@google.com
-per-file BackgroundDexOptService.java = agampe@google.com
-per-file BackgroundDexOptService.java = calin@google.com
-per-file BackgroundDexOptService.java = ngeoffray@google.com
-per-file CompilerStats.java = agampe@google.com
-per-file CompilerStats.java = calin@google.com
-per-file CompilerStats.java = ngeoffray@google.com
-per-file DynamicCodeLoggingService.java = agampe@google.com
-per-file DynamicCodeLoggingService.java = calin@google.com
-per-file DynamicCodeLoggingService.java = ngeoffray@google.com
-per-file InstructionSets.java = agampe@google.com
-per-file InstructionSets.java = calin@google.com
-per-file InstructionSets.java = ngeoffray@google.com
-per-file OtaDexoptService.java = agampe@google.com
-per-file OtaDexoptService.java = calin@google.com
-per-file OtaDexoptService.java = ngeoffray@google.com
-per-file OtaDexoptShellCommand.java = agampe@google.com
-per-file OtaDexoptShellCommand.java = calin@google.com
-per-file OtaDexoptShellCommand.java = ngeoffray@google.com
-per-file PackageDexOptimizer.java = agampe@google.com
-per-file PackageDexOptimizer.java = calin@google.com
-per-file PackageDexOptimizer.java = ngeoffray@google.com
-per-file PackageManagerServiceCompilerMapping.java = agampe@google.com
-per-file PackageManagerServiceCompilerMapping.java = calin@google.com
-per-file PackageManagerServiceCompilerMapping.java = ngeoffray@google.com
-per-file PackageUsage.java = agampe@google.com
-per-file PackageUsage.java = calin@google.com
-per-file PackageUsage.java = ngeoffray@google.com
+per-file AbstractStatsBase.java = agampe@google.com, toddke@google.com, svetoslavganov@google.com
+per-file AbstractStatsBase.java = calin@google.com, toddke@google.com, svetoslavganov@google.com
+per-file AbstractStatsBase.java = ngeoffray@google.com, toddke@google.com, svetoslavganov@google.com
+per-file BackgroundDexOptService.java = agampe@google.com, toddke@google.com, svetoslavganov@google.com
+per-file BackgroundDexOptService.java = calin@google.com, toddke@google.com, svetoslavganov@google.com
+per-file BackgroundDexOptService.java = ngeoffray@google.com, toddke@google.com, svetoslavganov@google.com
+per-file CompilerStats.java = agampe@google.com, toddke@google.com, svetoslavganov@google.com
+per-file CompilerStats.java = calin@google.com, toddke@google.com, svetoslavganov@google.com
+per-file CompilerStats.java = ngeoffray@google.com, toddke@google.com, svetoslavganov@google.com
+per-file DynamicCodeLoggingService.java = agampe@google.com, toddke@google.com, svetoslavganov@google.com
+per-file DynamicCodeLoggingService.java = calin@google.com, toddke@google.com, svetoslavganov@google.com
+per-file DynamicCodeLoggingService.java = ngeoffray@google.com, toddke@google.com, svetoslavganov@google.com
+per-file InstructionSets.java = agampe@google.com, toddke@google.com, svetoslavganov@google.com
+per-file InstructionSets.java = calin@google.com, toddke@google.com, svetoslavganov@google.com
+per-file InstructionSets.java = ngeoffray@google.com, toddke@google.com, svetoslavganov@google.com
+per-file OtaDexoptService.java = agampe@google.com, toddke@google.com, svetoslavganov@google.com
+per-file OtaDexoptService.java = calin@google.com, toddke@google.com, svetoslavganov@google.com
+per-file OtaDexoptService.java = ngeoffray@google.com, toddke@google.com, svetoslavganov@google.com
+per-file OtaDexoptShellCommand.java = agampe@google.com, toddke@google.com, svetoslavganov@google.com
+per-file OtaDexoptShellCommand.java = calin@google.com, toddke@google.com, svetoslavganov@google.com
+per-file OtaDexoptShellCommand.java = ngeoffray@google.com, toddke@google.com, svetoslavganov@google.com
+per-file PackageDexOptimizer.java = agampe@google.com, toddke@google.com, svetoslavganov@google.com
+per-file PackageDexOptimizer.java = calin@google.com, toddke@google.com, svetoslavganov@google.com
+per-file PackageDexOptimizer.java = ngeoffray@google.com, toddke@google.com, svetoslavganov@google.com
+per-file PackageManagerServiceCompilerMapping.java = agampe@google.com, toddke@google.com, svetoslavganov@google.com
+per-file PackageManagerServiceCompilerMapping.java = calin@google.com, toddke@google.com, svetoslavganov@google.com
+per-file PackageManagerServiceCompilerMapping.java = ngeoffray@google.com, toddke@google.com, svetoslavganov@google.com
+per-file PackageUsage.java = agampe@google.com, toddke@google.com, svetoslavganov@google.com
+per-file PackageUsage.java = calin@google.com, toddke@google.com, svetoslavganov@google.com
+per-file PackageUsage.java = ngeoffray@google.com, toddke@google.com, svetoslavganov@google.com
 
 # multi user / cross profile
-per-file CrossProfileAppsServiceImpl.java = omakoto@google.com
-per-file CrossProfileAppsServiceImpl.java = yamasani@google.com
-per-file CrossProfileAppsService.java = omakoto@google.com
-per-file CrossProfileAppsService.java = yamasani@google.com
-per-file CrossProfileIntentFilter.java = omakoto@google.com
-per-file CrossProfileIntentFilter.java = yamasani@google.com
-per-file CrossProfileIntentResolver.java = omakoto@google.com
-per-file CrossProfileIntentResolver.java = yamasani@google.com
-per-file UserManagerService.java = omakoto@google.com
-per-file UserManagerService.java = yamasani@google.com
-per-file UserRestrictionsUtils.java = omakoto@google.com
-per-file UserRestrictionsUtils.java = yamasani@google.com
-per-file UserRestrictionsUtils.java = rubinxu@google.com
-per-file UserRestrictionsUtils.java = sandness@google.com
+per-file CrossProfileAppsServiceImpl.java = omakoto@google.com, yamasani@google.com, hackbod@google.com
+per-file CrossProfileAppsServiceImpl.java = yamasani@google.com, omakoto@google.com, hackbod@google.com
+per-file CrossProfileAppsService.java = omakoto@google.com, yamasani@google.com, hackbod@google.com
+per-file CrossProfileAppsService.java = yamasani@google.com, omakoto@google.com, hackbod@google.com
+per-file CrossProfileIntentFilter.java = omakoto@google.com, yamasani@google.com, hackbod@google.com
+per-file CrossProfileIntentFilter.java = yamasani@google.com, omakoto@google.com, hackbod@google.com
+per-file CrossProfileIntentResolver.java = omakoto@google.com, yamasani@google.com, hackbod@google.com
+per-file CrossProfileIntentResolver.java = yamasani@google.com, omakoto@google.com, hackbod@google.com
+per-file UserManagerService.java = omakoto@google.com, yamasani@google.com, hackbod@google.com
+per-file UserManagerService.java = yamasani@google.com, omakoto@google.com, hackbod@google.com
+per-file UserRestrictionsUtils.java = omakoto@google.com, yamasani@google.com, hackbod@google.com
+per-file UserRestrictionsUtils.java = yamasani@google.com, omakoto@google.com, hackbod@google.com
+per-file UserRestrictionsUtils.java = rubinxu@google.com, yamasani@google.com, hackbod@google.com
+per-file UserRestrictionsUtils.java = sandness@google.com, yamasani@google.com, hackbod@google.com
 
 # security
-per-file KeySetHandle.java = cbrubaker@google.com
-per-file KeySetManagerService.java = cbrubaker@google.com
-per-file PackageKeySetData.java = cbrubaker@google.com
-per-file PackageSignatures.java = cbrubaker@google.com
-per-file SELinuxMMAC.java = cbrubaker@google.com
+per-file KeySetHandle.java = cbrubaker@google.com, svetoslavganov@google.com, hackbod@google.com
+per-file KeySetManagerService.java = cbrubaker@google.com, svetoslavganov@google.com, hackbod@google.com
+per-file PackageKeySetData.java = cbrubaker@google.com, svetoslavganov@google.com, hackbod@google.com
+per-file PackageSignatures.java = cbrubaker@google.com, svetoslavganov@google.com, hackbod@google.com
+per-file SELinuxMMAC.java = cbrubaker@google.com, svetoslavganov@google.com, hackbod@google.com
 
 # shortcuts
-per-file LauncherAppsService.java = omakoto@google.com
-per-file ShareTargetInfo.java = omakoto@google.com
-per-file ShortcutBitmapSaver.java = omakoto@google.com
-per-file ShortcutDumpFiles.java = omakoto@google.com
-per-file ShortcutLauncher.java = omakoto@google.com
-per-file ShortcutNonPersistentUser.java = omakoto@google.com
-per-file ShortcutPackage.java = omakoto@google.com
-per-file ShortcutPackageInfo.java = omakoto@google.com
-per-file ShortcutPackageItem.java = omakoto@google.com
-per-file ShortcutParser.java = omakoto@google.com
-per-file ShortcutRequestPinProcessor.java = omakoto@google.com
-per-file ShortcutService.java = omakoto@google.com
-per-file ShortcutUser.java = omakoto@google.com
+per-file LauncherAppsService.java = omakoto@google.com, yamasani@google.com, hackbod@google.com
+per-file ShareTargetInfo.java = omakoto@google.com, yamasani@google.com, hackbod@google.com
+per-file ShortcutBitmapSaver.java = omakoto@google.com, yamasani@google.com, hackbod@google.com
+per-file ShortcutDumpFiles.java = omakoto@google.com, yamasani@google.com, hackbod@google.com
+per-file ShortcutLauncher.java = omakoto@google.com, yamasani@google.com, hackbod@google.com
+per-file ShortcutNonPersistentUser.java = omakoto@google.com, yamasani@google.com, hackbod@google.com
+per-file ShortcutPackage.java = omakoto@google.com, yamasani@google.com, hackbod@google.com
+per-file ShortcutPackageInfo.java = omakoto@google.com, yamasani@google.com, hackbod@google.com
+per-file ShortcutPackageItem.java = omakoto@google.com, yamasani@google.com, hackbod@google.com
+per-file ShortcutParser.java = omakoto@google.com, yamasani@google.com, hackbod@google.com
+per-file ShortcutRequestPinProcessor.java = omakoto@google.com, yamasani@google.com, hackbod@google.com
+per-file ShortcutService.java = omakoto@google.com, yamasani@google.com, hackbod@google.com
+per-file ShortcutUser.java = omakoto@google.com, yamasani@google.com, hackbod@google.com
 
diff --git a/services/core/java/com/android/server/pm/PackageDexOptimizer.java b/services/core/java/com/android/server/pm/PackageDexOptimizer.java
index 580137d..4b46374 100644
--- a/services/core/java/com/android/server/pm/PackageDexOptimizer.java
+++ b/services/core/java/com/android/server/pm/PackageDexOptimizer.java
@@ -47,10 +47,12 @@
 import android.content.pm.dex.DexMetadataHelper;
 import android.os.FileUtils;
 import android.os.PowerManager;
+import android.os.Process;
 import android.os.SystemClock;
 import android.os.SystemProperties;
 import android.os.UserHandle;
 import android.os.WorkSource;
+import android.os.storage.StorageManager;
 import android.util.Log;
 import android.util.Slog;
 
@@ -146,6 +148,51 @@
         }
     }
 
+    int performDexOpt(SharedLibraryInfo info, String[] instructionSets, DexoptOptions options) {
+        String classLoaderContext = DexoptUtils.getClassLoaderContext(info);
+        final String[] dexCodeInstructionSets = getDexCodeInstructionSets(instructionSets);
+        String compilerFilter = PackageManagerServiceCompilerMapping.getCompilerFilterForReason(
+                PackageManagerService.REASON_SHARED);
+        int result = DEX_OPT_SKIPPED;
+        for (String instructionSet : dexCodeInstructionSets) {
+            int dexoptNeeded = getDexoptNeeded(
+                        info.getPath(), instructionSet, compilerFilter,
+                        classLoaderContext, false /* newProfile */,
+                        false /* downgrade */);
+            if (Math.abs(dexoptNeeded) == DexFile.NO_DEXOPT_NEEDED) {
+                continue;
+            }
+            // Special string recognized by installd.
+            final String packageName = "*";
+            final String outputPath = null;
+            int dexFlags = DEXOPT_PUBLIC
+                    | (options.isBootComplete() ? DEXOPT_BOOTCOMPLETE : 0)
+                    | (options.isDexoptIdleBackgroundJob() ? DEXOPT_IDLE_BACKGROUND_JOB : 0);
+            dexFlags = adjustDexoptFlags(dexFlags);
+            final String uuid = StorageManager.UUID_SYSTEM;
+            final String seInfo = null;
+            final int targetSdkVersion = 0;  // Builtin libraries targets the system's SDK version
+            try {
+                mInstaller.dexopt(info.getPath(), Process.SYSTEM_UID, packageName,
+                        instructionSet, dexoptNeeded, outputPath, dexFlags, compilerFilter,
+                        uuid, classLoaderContext, seInfo, false /* downgrade */,
+                        targetSdkVersion, /*profileName*/ null, /*dexMetadataPath*/ null,
+                        getReasonName(options.getCompilationReason()));
+                // The end result is:
+                //  - FAILED if any path failed,
+                //  - PERFORMED if at least one path needed compilation,
+                //  - SKIPPED when all paths are up to date
+                if (result != DEX_OPT_FAILED) {
+                    result = DEX_OPT_PERFORMED;
+                }
+            } catch (InstallerException e) {
+                Slog.w(TAG, "Failed to dexopt", e);
+                result = DEX_OPT_FAILED;
+            }
+        }
+        return result;
+    }
+
     /**
      * Performs dexopt on all code paths of the given package.
      * It assumes the install lock is held.
diff --git a/services/core/java/com/android/server/pm/PackageInstallerService.java b/services/core/java/com/android/server/pm/PackageInstallerService.java
index b72e836..3a4bcca 100644
--- a/services/core/java/com/android/server/pm/PackageInstallerService.java
+++ b/services/core/java/com/android/server/pm/PackageInstallerService.java
@@ -481,6 +481,12 @@
             }
         }
 
+        if (callingUid == Process.SYSTEM_UID) {
+            params.installFlags |= PackageManager.INSTALL_ALLOW_DOWNGRADE;
+        } else {
+            params.installFlags &= ~PackageManager.INSTALL_ALLOW_DOWNGRADE;
+        }
+
         boolean isApex = (params.installFlags & PackageManager.INSTALL_APEX) != 0;
         if (params.isStaged || isApex) {
             mContext.enforceCallingOrSelfPermission(Manifest.permission.INSTALL_PACKAGES, TAG);
diff --git a/services/core/java/com/android/server/pm/PackageManagerService.java b/services/core/java/com/android/server/pm/PackageManagerService.java
index 80e794f..4dcab5e 100644
--- a/services/core/java/com/android/server/pm/PackageManagerService.java
+++ b/services/core/java/com/android/server/pm/PackageManagerService.java
@@ -1935,7 +1935,7 @@
                             final PackageSetting pkgSetting = mSettings.mPackages.get(packageName);
                             if (pkgSetting.getInstallReason(userId)
                                     != PackageManager.INSTALL_REASON_DEVICE_RESTORE) {
-                                setDefaultBrowserPackageName(null, userId);
+                                setDefaultBrowserAsyncLPw(null, userId);
                             }
                         }
 
@@ -2945,7 +2945,7 @@
                         + mSdkVersion + "; regranting permissions for internal storage");
             }
             mPermissionManager.updateAllPermissions(
-                    StorageManager.UUID_PRIVATE_INTERNAL, sdkUpdated, mPackages.values(),
+                    StorageManager.UUID_PRIVATE_INTERNAL, sdkUpdated, false, mPackages.values(),
                     mPermissionCallback);
             ver.sdkVersion = mSdkVersion;
 
@@ -5382,7 +5382,7 @@
 
         synchronized (mPackages) {
             mPermissionManager.updateAllPermissions(
-                    StorageManager.UUID_PRIVATE_INTERNAL, false, mPackages.values(),
+                    StorageManager.UUID_PRIVATE_INTERNAL, false, false, mPackages.values(),
                     mPermissionCallback);
             for (int userId : UserManagerService.getInstance().getUserIds()) {
                 final int packageCount = mPackages.size();
@@ -9404,18 +9404,27 @@
         // at boot, or background job), the passed 'targetCompilerFilter' stays the same,
         // and the first package that uses the library will dexopt it. The
         // others will see that the compiled code for the library is up to date.
-        Collection<PackageParser.Package> deps = findSharedNonSystemLibraries(p);
+        Collection<SharedLibraryInfo> deps = findSharedLibraries(p);
         final String[] instructionSets = getAppDexInstructionSets(p.applicationInfo);
         if (!deps.isEmpty()) {
             DexoptOptions libraryOptions = new DexoptOptions(options.getPackageName(),
                     options.getCompilationReason(), options.getCompilerFilter(),
                     options.getSplitName(),
                     options.getFlags() | DexoptOptions.DEXOPT_AS_SHARED_LIBRARY);
-            for (PackageParser.Package depPackage : deps) {
-                // TODO: Analyze and investigate if we (should) profile libraries.
-                pdo.performDexOpt(depPackage, instructionSets,
-                        getOrCreateCompilerPackageStats(depPackage),
-                    mDexManager.getPackageUseInfoOrDefault(depPackage.packageName), libraryOptions);
+            for (SharedLibraryInfo info : deps) {
+                PackageParser.Package depPackage = null;
+                synchronized (mPackages) {
+                    depPackage = mPackages.get(info.getPackageName());
+                }
+                if (depPackage != null) {
+                    // TODO: Analyze and investigate if we (should) profile libraries.
+                    pdo.performDexOpt(depPackage, instructionSets,
+                            getOrCreateCompilerPackageStats(depPackage),
+                            mDexManager.getPackageUseInfoOrDefault(depPackage.packageName),
+                            libraryOptions);
+                } else {
+                    pdo.performDexOpt(info, instructionSets, libraryOptions);
+                }
             }
         }
         return pdo.performDexOpt(p, instructionSets,
@@ -9461,63 +9470,48 @@
         }
     }
 
-    List<PackageParser.Package> findSharedNonSystemLibraries(PackageParser.Package p) {
-        if (p.usesLibraries != null || p.usesOptionalLibraries != null
-                || p.usesStaticLibraries != null) {
-            ArrayList<PackageParser.Package> retValue = new ArrayList<>();
+    private static List<SharedLibraryInfo> findSharedLibraries(PackageParser.Package p) {
+        if (p.usesLibraryInfos != null) {
+            ArrayList<SharedLibraryInfo> retValue = new ArrayList<>();
             Set<String> collectedNames = new HashSet<>();
-            findSharedNonSystemLibrariesRecursive(p, retValue, collectedNames);
-
-            retValue.remove(p);
-
+            for (SharedLibraryInfo info : p.usesLibraryInfos) {
+                findSharedLibrariesRecursive(info, retValue, collectedNames);
+            }
             return retValue;
         } else {
             return Collections.emptyList();
         }
     }
 
-    private void findSharedNonSystemLibrariesRecursive(PackageParser.Package p,
-            ArrayList<PackageParser.Package> collected, Set<String> collectedNames) {
-        if (!collectedNames.contains(p.packageName)) {
-            collectedNames.add(p.packageName);
-            collected.add(p);
+    private static void findSharedLibrariesRecursive(SharedLibraryInfo info,
+            ArrayList<SharedLibraryInfo> collected, Set<String> collectedNames) {
+        if (!collectedNames.contains(info.getName())) {
+            collectedNames.add(info.getName());
+            collected.add(info);
 
-            if (p.usesLibraries != null) {
-                findSharedNonSystemLibrariesRecursive(p.usesLibraries,
-                        null, collected, collectedNames);
-            }
-            if (p.usesOptionalLibraries != null) {
-                findSharedNonSystemLibrariesRecursive(p.usesOptionalLibraries,
-                        null, collected, collectedNames);
-            }
-            if (p.usesStaticLibraries != null) {
-                findSharedNonSystemLibrariesRecursive(p.usesStaticLibraries,
-                        p.usesStaticLibrariesVersions, collected, collectedNames);
+            if (info.getDependencies() != null) {
+                for (SharedLibraryInfo dep : info.getDependencies()) {
+                    findSharedLibrariesRecursive(dep, collected, collectedNames);
+                }
             }
         }
     }
 
-    private void findSharedNonSystemLibrariesRecursive(ArrayList<String> libs, long[] versions,
-            ArrayList<PackageParser.Package> collected, Set<String> collectedNames) {
-        final int libNameCount = libs.size();
-        for (int i = 0; i < libNameCount; i++) {
-            String libName = libs.get(i);
-            long version = (versions != null && versions.length == libNameCount)
-                    ? versions[i] : PackageManager.VERSION_CODE_HIGHEST;
-            PackageParser.Package libPkg = findSharedNonSystemLibrary(libName, version);
-            if (libPkg != null) {
-                findSharedNonSystemLibrariesRecursive(libPkg, collected, collectedNames);
+    List<PackageParser.Package> findSharedNonSystemLibraries(PackageParser.Package pkg) {
+        List<SharedLibraryInfo> deps = findSharedLibraries(pkg);
+        if (!deps.isEmpty()) {
+            ArrayList<PackageParser.Package> retValue = new ArrayList<>();
+            synchronized (mPackages) {
+                for (SharedLibraryInfo info : deps) {
+                    PackageParser.Package depPackage = mPackages.get(info.getPackageName());
+                    if (depPackage != null) {
+                        retValue.add(depPackage);
+                    }
+                }
             }
-        }
-    }
-
-    private PackageParser.Package findSharedNonSystemLibrary(String name, long version) {
-        synchronized (mPackages) {
-            SharedLibraryInfo libraryInfo = getSharedLibraryInfoLPr(name, version);
-            if (libraryInfo != null) {
-                return mPackages.get(libraryInfo.getPackageName());
-            }
-            return null;
+            return retValue;
+        } else {
+            return Collections.emptyList();
         }
     }
 
@@ -13687,6 +13681,23 @@
         return true;
     }
 
+    private void setDefaultBrowserAsyncLPw(@Nullable String packageName, @UserIdInt int userId) {
+        if (userId == UserHandle.USER_ALL) {
+            return;
+        }
+        if (mDefaultBrowserProvider == null) {
+            Slog.e(TAG, "mDefaultBrowserProvider is null");
+            return;
+        }
+        mDefaultBrowserProvider.setDefaultBrowserAsync(packageName, userId);
+        if (packageName != null) {
+            synchronized (mPackages) {
+                mDefaultPermissionPolicy.grantDefaultPermissionsToDefaultBrowser(packageName,
+                        userId);
+            }
+        }
+    }
+
     @Override
     public String getDefaultBrowserPackageName(int userId) {
         if (UserHandle.getCallingUserId() != userId) {
@@ -14346,27 +14357,8 @@
                 }
 
                 if (dataOwnerPkg != null) {
-                    // If installed, the package will get access to data left on the device by its
-                    // predecessor. As a security measure, this is permited only if this is not a
-                    // version downgrade or if the predecessor package is marked as debuggable and
-                    // a downgrade is explicitly requested.
-                    //
-                    // On debuggable platform builds, downgrades are permitted even for
-                    // non-debuggable packages to make testing easier. Debuggable platform builds do
-                    // not offer security guarantees and thus it's OK to disable some security
-                    // mechanisms to make debugging/testing easier on those builds. However, even on
-                    // debuggable builds downgrades of packages are permitted only if requested via
-                    // installFlags. This is because we aim to keep the behavior of debuggable
-                    // platform builds as close as possible to the behavior of non-debuggable
-                    // platform builds.
-                    final boolean downgradeRequested =
-                            (installFlags & PackageManager.INSTALL_ALLOW_DOWNGRADE) != 0;
-                    final boolean packageDebuggable =
-                                (dataOwnerPkg.applicationInfo.flags
-                                        & ApplicationInfo.FLAG_DEBUGGABLE) != 0;
-                    final boolean downgradePermitted =
-                            (downgradeRequested) && ((Build.IS_DEBUGGABLE) || (packageDebuggable));
-                    if (!downgradePermitted) {
+                    if (!PackageManagerServiceUtils.isDowngradePermitted(installFlags,
+                            dataOwnerPkg.applicationInfo.flags)) {
                         try {
                             checkDowngrade(dataOwnerPkg, pkgLite);
                         } catch (PackageManagerException e) {
@@ -14706,13 +14698,12 @@
                                 @Override
                                 public void onReceive(Context context, Intent intent) {
                                     // the duration to wait for rollback to be enabled, in millis
-                                    long rollbackTimeout = DEFAULT_ENABLE_ROLLBACK_TIMEOUT;
-                                    try {
-                                        rollbackTimeout = Long.valueOf(
-                                            DeviceConfig.getProperty(
-                                                DeviceConfig.Rollback.NAMESPACE,
-                                                DeviceConfig.Rollback.ENABLE_ROLLBACK_TIMEOUT));
-                                    } catch (NumberFormatException ignore) {
+                                    long rollbackTimeout = DeviceConfig.getLong(
+                                            DeviceConfig.Rollback.NAMESPACE,
+                                            DeviceConfig.Rollback.ENABLE_ROLLBACK_TIMEOUT,
+                                            DEFAULT_ENABLE_ROLLBACK_TIMEOUT);
+                                    if (rollbackTimeout < 0) {
+                                        rollbackTimeout = DEFAULT_ENABLE_ROLLBACK_TIMEOUT;
                                     }
                                     final Message msg = mHandler.obtainMessage(
                                             ENABLE_ROLLBACK_TIMEOUT);
@@ -20697,8 +20688,8 @@
         // try optimizing this.
         synchronized (mPackages) {
             mPermissionManager.updateAllPermissions(
-                    StorageManager.UUID_PRIVATE_INTERNAL, false, mPackages.values(),
-                    mPermissionCallback);
+                    StorageManager.UUID_PRIVATE_INTERNAL, false, mIsPreQUpgrade,
+                    mPackages.values(), mPermissionCallback);
         }
 
         // Watch for external volumes that come and go over time
@@ -21688,8 +21679,8 @@
                 logCriticalInfo(Log.INFO, "Platform changed from " + ver.sdkVersion + " to "
                         + mSdkVersion + "; regranting permissions for " + volumeUuid);
             }
-            mPermissionManager.updateAllPermissions(volumeUuid, sdkUpdated, mPackages.values(),
-                    mPermissionCallback);
+            mPermissionManager.updateAllPermissions(volumeUuid, sdkUpdated, false,
+                    mPackages.values(), mPermissionCallback);
 
             // Yay, everything is now upgraded
             ver.forceCurrent();
@@ -22688,7 +22679,7 @@
         synchronized(mPackages) {
             // NOTE: This adds UPDATE_PERMISSIONS_REPLACE_PKG
             mPermissionManager.updateAllPermissions(
-                    StorageManager.UUID_PRIVATE_INTERNAL, true, mPackages.values(),
+                    StorageManager.UUID_PRIVATE_INTERNAL, true, false, mPackages.values(),
                     mPermissionCallback);
         }
     }
@@ -23119,6 +23110,18 @@
             }
             return 0;
         }
+
+        @Override
+        public boolean[] isAudioPlaybackCaptureAllowed(String[] packageNames)
+                throws RemoteException {
+            int callingUser = UserHandle.getUserId(Binder.getCallingUid());
+            boolean[] results = new boolean[packageNames.length];
+            for (int i = results.length - 1; i >= 0; --i) {
+                ApplicationInfo appInfo = getApplicationInfo(packageNames[i], 0, callingUser);
+                results[i] = appInfo == null ? false : appInfo.isAudioPlaybackCaptureAllowed();
+            }
+            return results;
+        }
     }
 
     private class PackageManagerInternalImpl extends PackageManagerInternal {
diff --git a/services/core/java/com/android/server/pm/PackageManagerServiceUtils.java b/services/core/java/com/android/server/pm/PackageManagerServiceUtils.java
index 6134d30..a12005b 100644
--- a/services/core/java/com/android/server/pm/PackageManagerServiceUtils.java
+++ b/services/core/java/com/android/server/pm/PackageManagerServiceUtils.java
@@ -32,6 +32,7 @@
 import android.app.AppGlobals;
 import android.content.Context;
 import android.content.Intent;
+import android.content.pm.ApplicationInfo;
 import android.content.pm.PackageInfoLite;
 import android.content.pm.PackageManager;
 import android.content.pm.PackageParser;
@@ -796,6 +797,45 @@
     }
 
     /**
+     * Checks whenever downgrade of an app is permitted.
+     *
+     * @param installFlags flags of the current install.
+     * @param applicationFlags flags of the currently installed version of the app.
+     * @return {@code true} if downgrade is permitted according to the {@code installFlags} and
+     *         {@code applicationFlags}.
+     */
+    public static boolean isDowngradePermitted(int installFlags, int applicationFlags) {
+        // If installed, the package will get access to data left on the device by its
+        // predecessor. As a security measure, this is permitted only if this is not a
+        // version downgrade or if the predecessor package is marked as debuggable and
+        // a downgrade is explicitly requested.
+        //
+        // On debuggable platform builds, downgrades are permitted even for
+        // non-debuggable packages to make testing easier. Debuggable platform builds do
+        // not offer security guarantees and thus it's OK to disable some security
+        // mechanisms to make debugging/testing easier on those builds. However, even on
+        // debuggable builds downgrades of packages are permitted only if requested via
+        // installFlags. This is because we aim to keep the behavior of debuggable
+        // platform builds as close as possible to the behavior of non-debuggable
+        // platform builds.
+        //
+        // In case of user builds, downgrade is permitted only for the system server initiated
+        // sessions. This is enforced by INSTALL_ALLOW_DOWNGRADE flag parameter.
+        final boolean downgradeRequested =
+                (installFlags & PackageManager.INSTALL_REQUEST_DOWNGRADE) != 0;
+        if (!downgradeRequested) {
+            return false;
+        }
+        final boolean isDebuggable =
+                Build.IS_DEBUGGABLE || ((applicationFlags
+                        & ApplicationInfo.FLAG_DEBUGGABLE) != 0);
+        if (isDebuggable) {
+            return true;
+        }
+        return (installFlags & PackageManager.INSTALL_ALLOW_DOWNGRADE) != 0;
+    }
+
+    /**
      * Copy package to the target location.
      *
      * @param packagePath absolute path to the package to be copied. Can be
diff --git a/services/core/java/com/android/server/pm/PackageManagerShellCommand.java b/services/core/java/com/android/server/pm/PackageManagerShellCommand.java
index 114810d..912a50e 100644
--- a/services/core/java/com/android/server/pm/PackageManagerShellCommand.java
+++ b/services/core/java/com/android/server/pm/PackageManagerShellCommand.java
@@ -2337,7 +2337,7 @@
                     sessionParams.installFlags |= PackageManager.INSTALL_INTERNAL;
                     break;
                 case "-d":
-                    sessionParams.installFlags |= PackageManager.INSTALL_ALLOW_DOWNGRADE;
+                    sessionParams.installFlags |= PackageManager.INSTALL_REQUEST_DOWNGRADE;
                     break;
                 case "-g":
                     sessionParams.installFlags |= PackageManager.INSTALL_GRANT_RUNTIME_PERMISSIONS;
diff --git a/services/core/java/com/android/server/pm/Settings.java b/services/core/java/com/android/server/pm/Settings.java
index 92fe377..aced1a2 100644
--- a/services/core/java/com/android/server/pm/Settings.java
+++ b/services/core/java/com/android/server/pm/Settings.java
@@ -979,7 +979,7 @@
             // Try to revoke as an install permission which is for all users.
             // The package is gone - no need to keep flags for applying policy.
             permissionsState.updatePermissionFlags(bp, userId,
-                    PackageManager.MASK_PERMISSION_FLAGS, 0);
+                    PackageManager.MASK_PERMISSION_FLAGS_ALL, 0);
 
             if (permissionsState.revokeInstallPermission(bp) ==
                     PermissionsState.PERMISSION_OPERATION_SUCCESS_GIDS_CHANGED) {
@@ -2165,7 +2165,7 @@
                         XmlUtils.skipCurrentTag(parser);
                     } else {
                         permissionsState.updatePermissionFlags(bp, UserHandle.USER_ALL,
-                                PackageManager.MASK_PERMISSION_FLAGS, flags);
+                                PackageManager.MASK_PERMISSION_FLAGS_ALL, flags);
                     }
                 } else {
                     if (permissionsState.revokeInstallPermission(bp) ==
@@ -2174,7 +2174,7 @@
                         XmlUtils.skipCurrentTag(parser);
                     } else {
                         permissionsState.updatePermissionFlags(bp, UserHandle.USER_ALL,
-                                PackageManager.MASK_PERMISSION_FLAGS, flags);
+                                PackageManager.MASK_PERMISSION_FLAGS_ALL, flags);
                     }
                 }
             } else {
@@ -4372,6 +4372,7 @@
             ApplicationInfo.PRIVATE_FLAG_ACTIVITIES_RESIZE_MODE_RESIZEABLE, "PRIVATE_FLAG_ACTIVITIES_RESIZE_MODE_RESIZEABLE",
             ApplicationInfo.PRIVATE_FLAG_ACTIVITIES_RESIZE_MODE_RESIZEABLE_VIA_SDK_VERSION, "PRIVATE_FLAG_ACTIVITIES_RESIZE_MODE_RESIZEABLE_VIA_SDK_VERSION",
             ApplicationInfo.PRIVATE_FLAG_ACTIVITIES_RESIZE_MODE_UNRESIZEABLE, "PRIVATE_FLAG_ACTIVITIES_RESIZE_MODE_UNRESIZEABLE",
+            ApplicationInfo.PRIVATE_FLAG_ALLOW_AUDIO_PLAYBACK_CAPTURE, "ALLOW_AUDIO_PLAYBACK_CAPTURE",
             ApplicationInfo.PRIVATE_FLAG_BACKUP_IN_FOREGROUND, "BACKUP_IN_FOREGROUND",
             ApplicationInfo.PRIVATE_FLAG_CANT_SAVE_STATE, "CANT_SAVE_STATE",
             ApplicationInfo.PRIVATE_FLAG_DEFAULT_TO_DEVICE_PROTECTED_STORAGE, "DEFAULT_TO_DEVICE_PROTECTED_STORAGE",
@@ -5239,7 +5240,7 @@
                 if (bp != null) {
                     permissionsState.revokeRuntimePermission(bp, userId);
                     permissionsState.updatePermissionFlags(bp, userId,
-                            PackageManager.MASK_PERMISSION_FLAGS, 0);
+                            PackageManager.MASK_PERMISSION_FLAGS_ALL, 0);
                 }
             }
         }
@@ -5353,10 +5354,10 @@
                         if (granted) {
                             permissionsState.grantRuntimePermission(bp, userId);
                             permissionsState.updatePermissionFlags(bp, userId,
-                                        PackageManager.MASK_PERMISSION_FLAGS, flags);
+                                        PackageManager.MASK_PERMISSION_FLAGS_ALL, flags);
                         } else {
                             permissionsState.updatePermissionFlags(bp, userId,
-                                    PackageManager.MASK_PERMISSION_FLAGS, flags);
+                                    PackageManager.MASK_PERMISSION_FLAGS_ALL, flags);
                         }
 
                     } break;
diff --git a/services/core/java/com/android/server/pm/ShortcutPackage.java b/services/core/java/com/android/server/pm/ShortcutPackage.java
index d9a5eb9..eced165 100644
--- a/services/core/java/com/android/server/pm/ShortcutPackage.java
+++ b/services/core/java/com/android/server/pm/ShortcutPackage.java
@@ -22,6 +22,7 @@
 import android.content.ComponentName;
 import android.content.Intent;
 import android.content.IntentFilter;
+import android.content.LocusId;
 import android.content.pm.PackageInfo;
 import android.content.pm.ShortcutInfo;
 import android.content.pm.ShortcutManager;
@@ -1702,15 +1703,17 @@
             flags |= ShortcutInfo.FLAG_SHADOW;
         }
 
+        LocusId locusId = null; // LocusId is not  set on XML.
+
         return new ShortcutInfo(
-                userId, id, packageName, activityComponent, /* icon =*/ null,
+                userId, id, packageName, activityComponent, /* icon= */ null,
                 title, titleResId, titleResName, text, textResId, textResName,
                 disabledMessage, disabledMessageResId, disabledMessageResName,
                 categories,
                 intents.toArray(new Intent[intents.size()]),
                 rank, extras, lastChangedTimestamp, flags,
                 iconResId, iconResName, bitmapPath, disabledReason,
-                persons.toArray(new Person[persons.size()]));
+                persons.toArray(new Person[persons.size()]), locusId);
     }
 
     private static Intent parseIntent(XmlPullParser parser)
diff --git a/services/core/java/com/android/server/pm/ShortcutParser.java b/services/core/java/com/android/server/pm/ShortcutParser.java
index 668fc88..f9c0db0 100644
--- a/services/core/java/com/android/server/pm/ShortcutParser.java
+++ b/services/core/java/com/android/server/pm/ShortcutParser.java
@@ -450,7 +450,8 @@
                 null, // icon res name
                 null, // bitmap path
                 disabledReason,
-                null /* persons */);
+                null /* persons */,
+                null /* locusId */);
     }
 
     private static String parseCategory(ShortcutService service, AttributeSet attrs) {
diff --git a/services/core/java/com/android/server/pm/StagingManager.java b/services/core/java/com/android/server/pm/StagingManager.java
index fac3839..4ee6eaf 100644
--- a/services/core/java/com/android/server/pm/StagingManager.java
+++ b/services/core/java/com/android/server/pm/StagingManager.java
@@ -35,6 +35,7 @@
 import android.content.pm.ParceledListSlice;
 import android.content.pm.Signature;
 import android.content.rollback.IRollbackManager;
+import android.os.Build;
 import android.os.Bundle;
 import android.os.Handler;
 import android.os.IBinder;
@@ -117,9 +118,11 @@
         final PackageInfo packageInfo = mApexManager.getActivePackage(packageName);
 
         if (packageInfo == null) {
-            // TODO: What is the right thing to do here ? This implies there's no active package
-            // with the given name. This should never be the case in production (where we only
-            // accept updates to existing APEXes) but may be required for testing.
+            // Only allow installing new apexes if on a debuggable build.
+            if (!Build.IS_DEBUGGABLE) {
+                Slog.w(TAG, "Attempted to install new apex " + packageName + " on user build");
+                return false;
+            }
             return true;
         }
 
@@ -144,12 +147,40 @@
     private boolean submitSessionToApexService(@NonNull PackageInstallerSession session,
                                                List<PackageInstallerSession> childSessions,
                                                ApexInfoList apexInfoList) {
-        return mApexManager.submitStagedSession(
+        boolean submittedToApexd = mApexManager.submitStagedSession(
                 session.sessionId,
                 childSessions != null
                         ? childSessions.stream().mapToInt(s -> s.sessionId).toArray() :
                         new int[]{},
                 apexInfoList);
+        if (!submittedToApexd) {
+            session.setStagedSessionFailed(
+                    SessionInfo.STAGED_SESSION_VERIFICATION_FAILED,
+                    "APEX staging failed, check logcat messages from apexd for more details.");
+            return false;
+        }
+        for (ApexInfo newPackage : apexInfoList.apexInfos) {
+            PackageInfo activePackage = mApexManager.getActivePackage(newPackage.packageName);
+            if (activePackage == null) {
+                continue;
+            }
+            long activeVersion = activePackage.applicationInfo.longVersionCode;
+            boolean allowsDowngrade = PackageManagerServiceUtils.isDowngradePermitted(
+                    session.params.installFlags, activePackage.applicationInfo.flags);
+            if (activeVersion > newPackage.versionCode && !allowsDowngrade) {
+                session.setStagedSessionFailed(
+                        SessionInfo.STAGED_SESSION_VERIFICATION_FAILED,
+                        "Downgrade of APEX package " + newPackage.packageName
+                                + " is not allowed. Active version: " + activeVersion
+                                + " attempted: " + newPackage.versionCode);
+
+                if (!mApexManager.abortActiveSession()) {
+                    Slog.e(TAG, "Failed to abort apex session " + session.sessionId);
+                }
+                return false;
+            }
+        }
+        return true;
     }
 
     private static boolean isApexSession(@NonNull PackageInstallerSession session) {
@@ -184,9 +215,7 @@
         }
 
         if (!success) {
-            session.setStagedSessionFailed(
-                    SessionInfo.STAGED_SESSION_VERIFICATION_FAILED,
-                    "APEX staging failed, check logcat messages from apexd for more details.");
+            // submitSessionToApexService will populate error.
             return;
         }
 
@@ -472,27 +501,31 @@
             Slog.w(TAG, "Cannot abort applied session!");
             return;
         }
-        if (isStagedSessionFinalized(session.sessionId)) {
-            Slog.w(TAG, "Cannot abort session because it is not active or APEXD is not reachable");
-            return;
-        }
-
-        mApexManager.abortActiveSession();
-
         abortSession(session);
+
+        boolean hasApex = sessionContainsApex(session);
+        if (hasApex) {
+            ApexSessionInfo apexSession = mApexManager.getStagedSessionInfo(session.sessionId);
+            if (apexSession == null || isApexSessionFinalized(apexSession)) {
+                Slog.w(TAG,
+                        "Cannot abort session because it is not active or APEXD is not reachable");
+                return;
+            }
+            mApexManager.abortActiveSession();
+        }
     }
 
-    private boolean isStagedSessionFinalized(int sessionId) {
-        ApexSessionInfo session = mApexManager.getStagedSessionInfo(sessionId);
-
+    private boolean isApexSessionFinalized(ApexSessionInfo session) {
         /* checking if the session is in a final state, i.e., not active anymore */
         return session.isUnknown || session.isActivationFailed || session.isSuccess
                 || session.isRolledBack;
     }
 
     private static boolean isApexSessionFailed(ApexSessionInfo apexSessionInfo) {
+        // isRollbackInProgress is included to cover the scenario, when a device is rebooted in
+        // during the rollback, and apexd fails to resume the rollback after reboot.
         return apexSessionInfo.isActivationFailed || apexSessionInfo.isUnknown
-                || apexSessionInfo.isRolledBack;
+                || apexSessionInfo.isRolledBack || apexSessionInfo.isRollbackInProgress;
     }
 
     @GuardedBy("mStagedSessions")
diff --git a/services/core/java/com/android/server/pm/dex/DexoptUtils.java b/services/core/java/com/android/server/pm/dex/DexoptUtils.java
index 91ad11e..5a473c1 100644
--- a/services/core/java/com/android/server/pm/dex/DexoptUtils.java
+++ b/services/core/java/com/android/server/pm/dex/DexoptUtils.java
@@ -174,6 +174,18 @@
     }
 
     /**
+     * Creates the class loader context for the given shared library.
+     */
+    public static String getClassLoaderContext(SharedLibraryInfo info) {
+        String sharedLibrariesContext = "";
+        if (info.getDependencies() != null) {
+            sharedLibrariesContext = encodeSharedLibraries(info.getDependencies());
+        }
+        return encodeClassLoader(
+                "", SHARED_LIBRARY_LOADER_TYPE, sharedLibrariesContext);
+    }
+
+    /**
      * Recursive method to generate the class loader context dependencies for the split with the
      * given index. {@param classLoaderContexts} acts as an accumulator. Upton return
      * {@code classLoaderContexts[index]} will contain the split dependency.
diff --git a/services/core/java/com/android/server/pm/permission/DefaultPermissionGrantPolicy.java b/services/core/java/com/android/server/pm/permission/DefaultPermissionGrantPolicy.java
index 447234e..b877fe7 100644
--- a/services/core/java/com/android/server/pm/permission/DefaultPermissionGrantPolicy.java
+++ b/services/core/java/com/android/server/pm/permission/DefaultPermissionGrantPolicy.java
@@ -657,13 +657,13 @@
                         PHONE_PERMISSIONS, SMS_PERMISSIONS, CAMERA_PERMISSIONS,
                         SENSORS_PERMISSIONS, STORAGE_PERMISSIONS, MEDIA_AURAL_PERMISSIONS);
                 grantSystemFixedPermissionsToSystemPackage(packageName, userId,
-                        LOCATION_PERMISSIONS, ACTIVITY_RECOGNITION_PERMISSIONS);
+                        ALWAYS_LOCATION_PERMISSIONS, ACTIVITY_RECOGNITION_PERMISSIONS);
             }
         }
         if (locationExtraPackageNames != null) {
             // Also grant location permission to location extra packages.
             for (String packageName : locationExtraPackageNames) {
-                grantPermissionsToSystemPackage(packageName, userId, LOCATION_PERMISSIONS);
+                grantPermissionsToSystemPackage(packageName, userId, ALWAYS_LOCATION_PERMISSIONS);
             }
         }
 
@@ -1473,6 +1473,13 @@
                 if (packageExceptions == null) {
                     // The package must be on the system image
                     PackageInfo packageInfo = getSystemPackageInfo(packageName);
+
+                    if (packageInfo == null) {
+                        Log.w(TAG, "No such package:" + packageName);
+                        XmlUtils.skipCurrentTag(parser);
+                        continue;
+                    }
+
                     if (!isSystemPackage(packageInfo)) {
                         Log.w(TAG, "Unknown system package:" + packageName);
                         XmlUtils.skipCurrentTag(parser);
diff --git a/services/core/java/com/android/server/pm/permission/PermissionManagerService.java b/services/core/java/com/android/server/pm/permission/PermissionManagerService.java
index 03da962..f7d8e0e 100644
--- a/services/core/java/com/android/server/pm/permission/PermissionManagerService.java
+++ b/services/core/java/com/android/server/pm/permission/PermissionManagerService.java
@@ -16,14 +16,11 @@
 
 package com.android.server.pm.permission;
 
-import static android.Manifest.permission.ACCESS_BACKGROUND_LOCATION;
 import static android.Manifest.permission.READ_EXTERNAL_STORAGE;
 import static android.Manifest.permission.WRITE_EXTERNAL_STORAGE;
 import static android.app.AppOpsManager.MODE_ALLOWED;
-import static android.app.AppOpsManager.MODE_DEFAULT;
 import static android.app.AppOpsManager.MODE_ERRORED;
 import static android.app.AppOpsManager.MODE_FOREGROUND;
-import static android.app.AppOpsManager.MODE_IGNORED;
 import static android.app.AppOpsManager.OP_NONE;
 import static android.app.AppOpsManager.permissionToOp;
 import static android.app.AppOpsManager.permissionToOpCode;
@@ -35,7 +32,7 @@
 import static android.content.pm.PackageManager.FLAG_PERMISSION_SYSTEM_FIXED;
 import static android.content.pm.PackageManager.FLAG_PERMISSION_USER_FIXED;
 import static android.content.pm.PackageManager.FLAG_PERMISSION_USER_SET;
-import static android.content.pm.PackageManager.MASK_PERMISSION_FLAGS;
+import static android.content.pm.PackageManager.MASK_PERMISSION_FLAGS_ALL;
 import static android.os.Trace.TRACE_TAG_PACKAGE_MANAGER;
 import static android.os.UserHandle.getAppId;
 import static android.os.UserHandle.getUid;
@@ -77,6 +74,7 @@
 import android.permission.PermissionControllerManager;
 import android.permission.PermissionManager;
 import android.permission.PermissionManagerInternal;
+import android.provider.Settings;
 import android.text.TextUtils;
 import android.util.ArrayMap;
 import android.util.ArraySet;
@@ -140,6 +138,18 @@
     /** Empty array to avoid allocations */
     private static final int[] EMPTY_INT_ARRAY = new int[0];
 
+    /**
+     * When these flags are set, the system should not automatically modify the permission grant
+     * state.
+     */
+    private static final int BLOCKING_PERMISSION_FLAGS = FLAG_PERMISSION_SYSTEM_FIXED
+            | FLAG_PERMISSION_POLICY_FIXED
+            | FLAG_PERMISSION_GRANTED_BY_DEFAULT;
+
+    /** Permission flags set by the user */
+    private static final int USER_PERMISSION_FLAGS = FLAG_PERMISSION_USER_SET
+            | FLAG_PERMISSION_USER_FIXED;
+
     /** If the permission of the value is granted, so is the key */
     private static final Map<String, String> FULLER_PERMISSION_MAP = new HashMap<>();
 
@@ -970,7 +980,7 @@
                                     // Revoke the runtime permission and clear the flags.
                                     origPermissions.revokeRuntimePermission(bp, userId);
                                     origPermissions.updatePermissionFlags(bp, userId,
-                                          PackageManager.MASK_PERMISSION_FLAGS, 0);
+                                            PackageManager.MASK_PERMISSION_FLAGS_ALL, 0);
                                     // If we revoked a permission permission, we have to write.
                                     updatedUserIds = ArrayUtils.appendInt(
                                             updatedUserIds, userId);
@@ -1033,7 +1043,7 @@
                                 }
 
                                 permissionsState.updatePermissionFlags(bp, userId,
-                                        MASK_PERMISSION_FLAGS, flags);
+                                        MASK_PERMISSION_FLAGS_ALL, flags);
                             }
                         } break;
 
@@ -1048,7 +1058,7 @@
                             if (origPermissions.revokeInstallPermission(bp)
                                     != PERMISSION_OPERATION_FAILURE) {
                                 origPermissions.updatePermissionFlags(bp, UserHandle.USER_ALL,
-                                        PackageManager.MASK_PERMISSION_FLAGS, 0);
+                                        MASK_PERMISSION_FLAGS_ALL, 0);
                                 changedInstallPermission = true;
                             }
 
@@ -1084,7 +1094,7 @@
                                 }
 
                                 permissionsState.updatePermissionFlags(bp, userId,
-                                        MASK_PERMISSION_FLAGS, flags);
+                                        MASK_PERMISSION_FLAGS_ALL, flags);
                             }
                         } break;
 
@@ -1104,7 +1114,7 @@
                             PERMISSION_OPERATION_FAILURE) {
                         // Also drop the permission flags.
                         permissionsState.updatePermissionFlags(bp, UserHandle.USER_ALL,
-                                PackageManager.MASK_PERMISSION_FLAGS, 0);
+                                MASK_PERMISSION_FLAGS_ALL, 0);
                         changedInstallPermission = true;
                         Slog.i(TAG, "Un-granting permission " + perm
                                 + " from package " + pkg.packageName
@@ -1203,9 +1213,8 @@
 
                             int flagsToRemove = FLAG_PERMISSION_REVOKE_WHEN_REQUESTED;
 
-                            if ((flags & (FLAG_PERMISSION_GRANTED_BY_DEFAULT
-                                    | FLAG_PERMISSION_POLICY_FIXED | FLAG_PERMISSION_SYSTEM_FIXED))
-                                    == 0 && supportsRuntimePermissions) {
+                            if ((flags & BLOCKING_PERMISSION_FLAGS) == 0
+                                    && supportsRuntimePermissions) {
                                 int revokeResult = ps.revokeRuntimePermission(bp, userId);
                                 if (revokeResult != PERMISSION_OPERATION_FAILURE) {
                                     if (DEBUG_PERMISSIONS) {
@@ -1215,8 +1224,7 @@
                                     }
                                 }
 
-                                flagsToRemove |=
-                                        FLAG_PERMISSION_USER_FIXED | FLAG_PERMISSION_USER_SET;
+                                flagsToRemove |= USER_PERMISSION_FLAGS;
 
                                 List<String> fgPerms = mBackgroundPermissions.get(permission);
                                 if (fgPerms != null) {
@@ -1271,6 +1279,7 @@
         if (pkg.applicationInfo.targetSdkVersion < Build.VERSION_CODES.M) {
             if (permissionToOp(newPerm) != null) {
                 int mostLenientSourceMode = MODE_ERRORED;
+                int flags = 0;
 
                 // Find most lenient source permission state.
                 int numSourcePerms = sourcePerms.size();
@@ -1284,20 +1293,19 @@
                             int mode = appOpsManager.unsafeCheckOpRaw(sourceOp,
                                     getUid(userId, getAppId(pkg.applicationInfo.uid)), pkgName);
 
-                            if (mode == MODE_FOREGROUND) {
-                                throw new IllegalArgumentException("split permission" + sourcePerm
-                                        + " has app-op state " + AppOpsManager.MODE_NAMES[mode]);
+                            if (mode == MODE_FOREGROUND || mode == MODE_ERRORED) {
+                                Log.wtf(TAG, "split permission" + sourcePerm + " has app-op state "
+                                        + AppOpsManager.MODE_NAMES[mode]);
+
+                                continue;
                             }
 
-                            // Leniency order: allowed > ignored > default
-                            if (mode == MODE_ALLOWED) {
-                                mostLenientSourceMode = MODE_ALLOWED;
-                                break;
-                            } else if (mode == MODE_IGNORED) {
-                                mostLenientSourceMode = MODE_IGNORED;
-                            } else if (mode == MODE_DEFAULT
-                                    && mostLenientSourceMode != MODE_IGNORED) {
-                                mostLenientSourceMode = MODE_DEFAULT;
+                            // Leniency order: allowed < ignored < default
+                            if (mode < mostLenientSourceMode) {
+                                mostLenientSourceMode = mode;
+                                flags = ps.getPermissionFlags(sourcePerm, userId);
+                            } else if (mode == mostLenientSourceMode) {
+                                flags |= ps.getPermissionFlags(sourcePerm, userId);
                             }
                         }
                     }
@@ -1310,21 +1318,31 @@
                     }
 
                     setAppOpMode(newPerm, pkg, userId, mostLenientSourceMode);
+
+                    // Add permission flags
+                    ps.updatePermissionFlags(mSettings.getPermission(newPerm), userId, flags,
+                            flags);
                 }
             }
         } else {
             boolean isGranted = false;
+            int flags = 0;
 
             int numSourcePerm = sourcePerms.size();
             for (int i = 0; i < numSourcePerm; i++) {
                 String sourcePerm = sourcePerms.valueAt(i);
-                if (ps.hasRuntimePermission(sourcePerm, userId)
-                        && ps.getRuntimePermissionState(sourcePerm, userId).isGranted()) {
+                if ((ps.hasRuntimePermission(sourcePerm, userId))
+                        || ps.hasInstallPermission(sourcePerm)) {
+                    if (!isGranted) {
+                        flags = 0;
+                    }
+
                     isGranted = true;
-                    break;
-                } else if (ps.hasInstallPermission(sourcePerm)) {
-                    isGranted = true;
-                    break;
+                    flags |= ps.getPermissionFlags(sourcePerm, userId);
+                } else {
+                    if (!isGranted) {
+                        flags |= ps.getPermissionFlags(sourcePerm, userId);
+                    }
                 }
             }
 
@@ -1336,6 +1354,9 @@
 
                 ps.grantRuntimePermission(mSettings.getPermissionLocked(newPerm), userId);
             }
+
+            // Add permission flags
+            ps.updatePermissionFlags(mSettings.getPermission(newPerm), userId, flags, flags);
         }
     }
 
@@ -1353,8 +1374,6 @@
             @NonNull PermissionsState origPs,
             @NonNull PermissionsState ps, @NonNull PackageParser.Package pkg,
             @NonNull int[] updatedUserIds) {
-        AppOpsManager appOpsManager = mContext.getSystemService(AppOpsManager.class);
-
         String pkgName = pkg.packageName;
         ArraySet<String> newImplicitPermissions = new ArraySet<>();
 
@@ -1417,49 +1436,29 @@
                                 FLAG_PERMISSION_REVOKE_WHEN_REQUESTED);
                         updatedUserIds = ArrayUtils.appendInt(updatedUserIds, userId);
 
-                        // SPECIAL BEHAVIOR for background location. Foreground only by default.
-                        if (newPerm.equals(ACCESS_BACKGROUND_LOCATION)) {
-                            int numSourcePerms = sourcePerms.size();
-                            for (int sourcePermNum = 0; sourcePermNum < numSourcePerms;
-                                    sourcePermNum++) {
-                                String sourcePerm = sourcePerms.valueAt(sourcePermNum);
-
-                                if (ps.hasRuntimePermission(sourcePerm, userId)
-                                        && ps.getRuntimePermissionState(sourcePerm, userId)
-                                        .isGranted()
-                                        && appOpsManager.unsafeCheckOpNoThrow(
-                                                permissionToOp(sourcePerm), getUid(userId,
-                                                getAppId(pkg.applicationInfo.uid)), pkgName)
-                                        == MODE_ALLOWED) {
-                                    setAppOpMode(sourcePerm, pkg, userId, MODE_FOREGROUND);
-                                }
-                            }
-                        } else {
-                            boolean inheritsFromInstallPerm = false;
-                            for (int sourcePermNum = 0; sourcePermNum < sourcePerms.size();
-                                    sourcePermNum++) {
-                                if (ps.hasInstallPermission(sourcePerms.valueAt(sourcePermNum))) {
-                                    inheritsFromInstallPerm = true;
-                                    break;
-                                }
-                            }
-
-                            if (!origPs.hasRequestedPermission(sourcePerms)
-                                    && !inheritsFromInstallPerm) {
-                                // Both permissions are new so nothing to inherit.
-                                if (DEBUG_PERMISSIONS) {
-                                    Slog.i(TAG, newPerm + " does not inherit from " + sourcePerms
-                                            + " for " + pkgName
-                                            + " as split permission is also new");
-                                }
-
+                        boolean inheritsFromInstallPerm = false;
+                        for (int sourcePermNum = 0; sourcePermNum < sourcePerms.size();
+                                sourcePermNum++) {
+                            if (ps.hasInstallPermission(sourcePerms.valueAt(sourcePermNum))) {
+                                inheritsFromInstallPerm = true;
                                 break;
-                            } else {
-                                // Inherit from new install or existing runtime permissions
-                                inheritPermissionStateToNewImplicitPermissionLocked(sourcePerms,
-                                        newPerm, ps, pkg, userId);
                             }
                         }
+
+                        if (!origPs.hasRequestedPermission(sourcePerms)
+                                && !inheritsFromInstallPerm) {
+                            // Both permissions are new so nothing to inherit.
+                            if (DEBUG_PERMISSIONS) {
+                                Slog.i(TAG, newPerm + " does not inherit from " + sourcePerms
+                                        + " for " + pkgName + " as split permission is also new");
+                            }
+
+                            break;
+                        } else {
+                            // Inherit from new install or existing runtime permissions
+                            inheritPermissionStateToNewImplicitPermissionLocked(sourcePerms,
+                                    newPerm, ps, pkg, userId);
+                        }
                     }
                 }
             }
@@ -2181,7 +2180,7 @@
                 if (bp != null) {
                     permissionsState.revokeInstallPermission(bp);
                     permissionsState.updatePermissionFlags(bp, UserHandle.USER_ALL,
-                            PackageManager.MASK_PERMISSION_FLAGS, 0);
+                            MASK_PERMISSION_FLAGS_ALL, 0);
                 }
             }
         }
@@ -2200,7 +2199,7 @@
                     if (bp != null) {
                         permissionsState.revokeRuntimePermission(bp, userId);
                         permissionsState.updatePermissionFlags(bp, userId,
-                                PackageManager.MASK_PERMISSION_FLAGS, 0);
+                                MASK_PERMISSION_FLAGS_ALL, 0);
                         runtimePermissionChangedUserIds = ArrayUtils.appendInt(
                                 runtimePermissionChangedUserIds, userId);
                     }
@@ -2230,7 +2229,7 @@
             return 0;
         }
 
-        enforceGrantRevokeRuntimePermissionPermissions("getPermissionFlags");
+        enforceGrantRevokeGetRuntimePermissionPermissions("getPermissionFlags");
 
         enforceCrossUserPermission(callingUid, userId,
                 true,  // requireFullPermission
@@ -2275,12 +2274,62 @@
     }
 
     private void updateAllPermissions(String volumeUuid, boolean sdkUpdated,
-            Collection<PackageParser.Package> allPackages, PermissionCallback callback) {
+            boolean updatePermissionsOnPreQUpdate, Collection<PackageParser.Package> allPackages,
+            PermissionCallback callback) {
         final int flags = UPDATE_PERMISSIONS_ALL |
                 (sdkUpdated
                         ? UPDATE_PERMISSIONS_REPLACE_PKG | UPDATE_PERMISSIONS_REPLACE_ALL
                         : 0);
         updatePermissions(null, null, volumeUuid, flags, allPackages, callback);
+
+        if (updatePermissionsOnPreQUpdate) {
+            final int[] userIds = UserManagerService.getInstance().getUserIds();
+
+            for (PackageParser.Package pkg : allPackages) {
+                final PackageSetting ps = (PackageSetting) pkg.mExtras;
+                if (ps == null) {
+                    return;
+                }
+
+                final boolean appSupportsRuntimePermissions =
+                        pkg.applicationInfo.targetSdkVersion >= Build.VERSION_CODES.M;
+                final PermissionsState permsState = ps.getPermissionsState();
+
+                for (String permName : new String[]{Manifest.permission.ACCESS_FINE_LOCATION,
+                        Manifest.permission.ACCESS_COARSE_LOCATION,
+                        Manifest.permission.ACCESS_BACKGROUND_LOCATION}) {
+                    final BasePermission bp = mSettings.getPermissionLocked(permName);
+
+                    for (int userId : userIds) {
+                        if (Settings.Secure.getIntForUser(mContext.getContentResolver(),
+                                Settings.Secure.LOCATION_PERMISSIONS_UPGRADE_TO_Q_MODE, 0, userId)
+                                != 0) {
+                            continue;
+                        }
+
+                        final PermissionState permState = permsState.getRuntimePermissionState(
+                                permName, userId);
+
+                        if (permState != null
+                                && (permState.getFlags() & BLOCKING_PERMISSION_FLAGS) == 0) {
+                            if (permState.isGranted()) {
+                                permsState.updatePermissionFlags(bp, userId,
+                                        USER_PERMISSION_FLAGS, 0);
+                            }
+
+                            if (appSupportsRuntimePermissions) {
+                                permsState.revokeRuntimePermission(bp, userId);
+                            } else {
+                                // Force a review even for apps that were already installed
+                                permsState.updatePermissionFlags(bp, userId,
+                                        FLAG_PERMISSION_REVIEW_REQUIRED,
+                                        FLAG_PERMISSION_REVIEW_REQUIRED);
+                            }
+                        }
+                    }
+                }
+            }
+        }
     }
 
     private void updatePermissions(String changingPkgName, PackageParser.Package changingPkg,
@@ -2547,6 +2596,20 @@
         }
     }
 
+    private void enforceGrantRevokeGetRuntimePermissionPermissions(@NonNull String message) {
+        if (mContext.checkCallingOrSelfPermission(Manifest.permission.GET_RUNTIME_PERMISSIONS)
+                != PackageManager.PERMISSION_GRANTED
+            && mContext.checkCallingOrSelfPermission(Manifest.permission.GRANT_RUNTIME_PERMISSIONS)
+                != PackageManager.PERMISSION_GRANTED
+            && mContext.checkCallingOrSelfPermission(Manifest.permission.REVOKE_RUNTIME_PERMISSIONS)
+                != PackageManager.PERMISSION_GRANTED) {
+            throw new SecurityException(message + " requires "
+                    + Manifest.permission.GRANT_RUNTIME_PERMISSIONS + " or "
+                    + Manifest.permission.REVOKE_RUNTIME_PERMISSIONS + " or "
+                    + Manifest.permission.GET_RUNTIME_PERMISSIONS);
+        }
+    }
+
     /**
      * Checks if the request is from the system or an app that has INTERACT_ACROSS_USERS
      * or INTERACT_ACROSS_USERS_FULL permissions, if the userid is not for the caller.
@@ -2735,9 +2798,10 @@
         }
         @Override
         public void updateAllPermissions(String volumeUuid, boolean sdkUpdated,
-                Collection<PackageParser.Package> allPackages, PermissionCallback callback) {
+                boolean updatePermissionsOnPreQUpdate, Collection<PackageParser.Package> allPackages,
+                PermissionCallback callback) {
             PermissionManagerService.this.updateAllPermissions(
-                    volumeUuid, sdkUpdated, allPackages, callback);
+                    volumeUuid, sdkUpdated, updatePermissionsOnPreQUpdate, allPackages, callback);
         }
         @Override
         public String[] getAppOpPermissionPackages(String permName) {
diff --git a/services/core/java/com/android/server/pm/permission/PermissionManagerServiceInternal.java b/services/core/java/com/android/server/pm/permission/PermissionManagerServiceInternal.java
index 305f165..6c09fa0 100644
--- a/services/core/java/com/android/server/pm/permission/PermissionManagerServiceInternal.java
+++ b/services/core/java/com/android/server/pm/permission/PermissionManagerServiceInternal.java
@@ -83,7 +83,8 @@
     public abstract void updatePermissions(@Nullable String packageName,
             @Nullable PackageParser.Package pkg, boolean replaceGrant,
             @NonNull Collection<PackageParser.Package> allPacakges, PermissionCallback callback);
-    public abstract void updateAllPermissions(@Nullable String volumeUuid, boolean sdkUpdated,
+    public abstract void updateAllPermissions(@Nullable String volumeUuid, boolean sdkUpdate,
+            boolean updatePermissionsOnPreQUpdate,
             @NonNull Collection<PackageParser.Package> allPacakges, PermissionCallback callback);
 
     /**
diff --git a/services/core/java/com/android/server/power/AttentionDetector.java b/services/core/java/com/android/server/power/AttentionDetector.java
index 8740256..406cbc1 100644
--- a/services/core/java/com/android/server/power/AttentionDetector.java
+++ b/services/core/java/com/android/server/power/AttentionDetector.java
@@ -19,9 +19,13 @@
 import android.attention.AttentionManagerInternal;
 import android.attention.AttentionManagerInternal.AttentionCallbackInternal;
 import android.content.Context;
+import android.database.ContentObserver;
+import android.os.Handler;
 import android.os.PowerManager;
 import android.os.PowerManagerInternal;
 import android.os.SystemClock;
+import android.os.UserHandle;
+import android.provider.Settings;
 import android.service.attention.AttentionService;
 import android.util.Slog;
 import android.util.StatsLog;
@@ -44,6 +48,8 @@
     private static final String TAG = "AttentionDetector";
     private static final boolean DEBUG = false;
 
+    private boolean mIsSettingEnabled;
+
     /**
      * Invoked whenever user attention is detected.
      */
@@ -128,15 +134,35 @@
         mWakefulness = PowerManagerInternal.WAKEFULNESS_AWAKE;
     }
 
+    @VisibleForTesting
+    void updateEnabledFromSettings(Context context) {
+        mIsSettingEnabled = Settings.System.getIntForUser(context.getContentResolver(),
+                Settings.System.ADAPTIVE_SLEEP, 0, UserHandle.USER_CURRENT) == 1;
+    }
+
     public void systemReady(Context context) {
+        updateEnabledFromSettings(context);
         mAttentionManager = LocalServices.getService(AttentionManagerInternal.class);
         mMaximumExtensionMillis = context.getResources().getInteger(
                 com.android.internal.R.integer.config_attentionMaximumExtension);
         mMaxAttentionApiTimeoutMillis = context.getResources().getInteger(
                 com.android.internal.R.integer.config_attentionApiTimeout);
+
+        context.getContentResolver().registerContentObserver(Settings.System.getUriFor(
+                Settings.System.ADAPTIVE_SLEEP),
+                false, new ContentObserver(new Handler()) {
+                    @Override
+                    public void onChange(boolean selfChange) {
+                        updateEnabledFromSettings(context);
+                    }
+                }, UserHandle.USER_ALL);
     }
 
     public long updateUserActivity(long nextScreenDimming) {
+        if (!mIsSettingEnabled) {
+            return nextScreenDimming;
+        }
+
         if (!isAttentionServiceSupported()) {
             return nextScreenDimming;
         }
@@ -182,7 +208,7 @@
      * the activity happened.
      *
      * @param eventTime Activity time, in uptime millis.
-     * @param event Activity type as defined in {@link PowerManager}.
+     * @param event     Activity type as defined in {@link PowerManager}.
      * @return 0 when activity was ignored, 1 when handled, -1 when invalid.
      */
     public int onUserActivity(long eventTime, int event) {
diff --git a/services/core/java/com/android/server/power/PowerManagerService.java b/services/core/java/com/android/server/power/PowerManagerService.java
index 89d24b1..bb23bc0 100644
--- a/services/core/java/com/android/server/power/PowerManagerService.java
+++ b/services/core/java/com/android/server/power/PowerManagerService.java
@@ -715,6 +715,15 @@
         NativeWrapper createNativeWrapper() {
             return new NativeWrapper();
         }
+
+        WirelessChargerDetector createWirelessChargerDetector(
+                SensorManager sensorManager, SuspendBlocker suspendBlocker, Handler handler) {
+            return new WirelessChargerDetector(sensorManager, suspendBlocker, handler);
+        }
+
+        AmbientDisplayConfiguration createAmbientDisplayConfiguration(Context context) {
+            return new AmbientDisplayConfiguration(context);
+        }
     }
 
     final Constants mConstants;
@@ -747,7 +756,7 @@
         mHandlerThread.start();
         mHandler = new PowerManagerHandler(mHandlerThread.getLooper());
         mConstants = new Constants(mHandler);
-        mAmbientDisplayConfiguration = new AmbientDisplayConfiguration(mContext);
+        mAmbientDisplayConfiguration = mInjector.createAmbientDisplayConfiguration(context);
         mAttentionDetector = new AttentionDetector(this::onUserAttention, mLock);
 
         mBatterySavingStats = new BatterySavingStats(mLock);
@@ -833,7 +842,7 @@
                     mInjector.createSuspendBlocker(this, "PowerManagerService.Broadcasts"),
                     mPolicy);
 
-            mWirelessChargerDetector = new WirelessChargerDetector(sensorManager,
+            mWirelessChargerDetector = mInjector.createWirelessChargerDetector(sensorManager,
                     mInjector.createSuspendBlocker(
                             this, "PowerManagerService.WirelessChargerDetector"),
                     mHandler);
@@ -932,7 +941,8 @@
         mContext.registerReceiver(new DockReceiver(), filter, null, mHandler);
     }
 
-    private void readConfigurationLocked() {
+    @VisibleForTesting
+    void readConfigurationLocked() {
         final Resources resources = mContext.getResources();
 
         mDecoupleHalAutoSuspendModeFromDisplayConfig = resources.getBoolean(
@@ -3865,7 +3875,8 @@
         return workSource != null ? new WorkSource(workSource) : null;
     }
 
-    private final class BatteryReceiver extends BroadcastReceiver {
+    @VisibleForTesting
+    final class BatteryReceiver extends BroadcastReceiver {
         @Override
         public void onReceive(Context context, Intent intent) {
             synchronized (mLock) {
@@ -3883,7 +3894,8 @@
         }
     }
 
-    private final class UserSwitchedReceiver extends BroadcastReceiver {
+    @VisibleForTesting
+    final class UserSwitchedReceiver extends BroadcastReceiver {
         @Override
         public void onReceive(Context context, Intent intent) {
             synchronized (mLock) {
diff --git a/services/core/java/com/android/server/power/WirelessChargerDetector.java b/services/core/java/com/android/server/power/WirelessChargerDetector.java
index 18e5ce4..e8e9c67 100644
--- a/services/core/java/com/android/server/power/WirelessChargerDetector.java
+++ b/services/core/java/com/android/server/power/WirelessChargerDetector.java
@@ -28,6 +28,8 @@
 import android.util.TimeUtils;
 import android.util.proto.ProtoOutputStream;
 
+import com.android.internal.annotations.VisibleForTesting;
+
 import java.io.PrintWriter;
 
 /**
@@ -70,7 +72,8 @@
  * sensor to detect this case.
  * </p>
  */
-final class WirelessChargerDetector {
+@VisibleForTesting
+public class WirelessChargerDetector {
     private static final String TAG = "WirelessChargerDetector";
     private static final boolean DEBUG = false;
 
diff --git a/services/core/java/com/android/server/power/batterysaver/BatterySaverController.java b/services/core/java/com/android/server/power/batterysaver/BatterySaverController.java
index 94bb3ea..5adcf35 100644
--- a/services/core/java/com/android/server/power/batterysaver/BatterySaverController.java
+++ b/services/core/java/com/android/server/power/batterysaver/BatterySaverController.java
@@ -384,7 +384,7 @@
      * - When battery saver is on and the battery saver policy changes.
      * - When adaptive battery saver becomes activated.
      * - When adaptive battery saver becomes deactivated.
-     * - When adaptive battery saver policy changes.
+     * - When adaptive battery saver is active (and full is off) and the policy changes.
      */
     void handleBatterySaverStateChanged(boolean sendBroadcast, int reason) {
         final LowPowerModeListener[] listeners;
diff --git a/services/core/java/com/android/server/power/batterysaver/BatterySaverPolicy.java b/services/core/java/com/android/server/power/batterysaver/BatterySaverPolicy.java
index fac95f9..f23b68e 100644
--- a/services/core/java/com/android/server/power/batterysaver/BatterySaverPolicy.java
+++ b/services/core/java/com/android/server/power/batterysaver/BatterySaverPolicy.java
@@ -728,8 +728,8 @@
                     !defaultPolicy.enableDataSaver);
             boolean enableFirewall = !parser.getBoolean(KEY_ACTIVATE_FIREWALL_DISABLED,
                     !defaultPolicy.enableFirewall);
-            boolean enableNightMode = !parser.getBoolean(KEY_ENABLE_NIGHT_MODE,
-                    !defaultPolicy.enableNightMode);
+            boolean enableNightMode = parser.getBoolean(KEY_ENABLE_NIGHT_MODE,
+                    defaultPolicy.enableNightMode);
             boolean enableQuickDoze = parser.getBoolean(KEY_QUICK_DOZE_ENABLED,
                     defaultPolicy.enableQuickDoze);
             boolean forceAllAppsStandby = parser.getBoolean(KEY_FORCE_ALL_APPS_STANDBY,
diff --git a/services/core/java/com/android/server/role/RemoteRoleControllerService.java b/services/core/java/com/android/server/role/RemoteRoleControllerService.java
deleted file mode 100644
index 4fb40db..0000000
--- a/services/core/java/com/android/server/role/RemoteRoleControllerService.java
+++ /dev/null
@@ -1,336 +0,0 @@
-/*
- * Copyright (C) 2018 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 com.android.server.role;
-
-import android.annotation.NonNull;
-import android.annotation.Nullable;
-import android.annotation.UserIdInt;
-import android.annotation.WorkerThread;
-import android.app.role.IRoleManagerCallback;
-import android.app.role.RoleManager;
-import android.app.role.RoleManagerCallback;
-import android.content.ComponentName;
-import android.content.Context;
-import android.content.Intent;
-import android.content.ServiceConnection;
-import android.os.Handler;
-import android.os.IBinder;
-import android.os.RemoteException;
-import android.os.UserHandle;
-import android.rolecontrollerservice.IRoleControllerService;
-import android.rolecontrollerservice.RoleControllerService;
-import android.util.Log;
-import android.util.Slog;
-
-import com.android.internal.util.function.pooled.PooledLambda;
-import com.android.server.FgThread;
-
-import java.util.ArrayDeque;
-import java.util.Arrays;
-import java.util.Queue;
-
-/**
- * Handles connection with {@link RoleControllerService}.
- */
-public class RemoteRoleControllerService {
-
-    static final boolean DEBUG = false;
-    private static final String LOG_TAG = RemoteRoleControllerService.class.getSimpleName();
-
-    @NonNull
-    private final Connection mConnection;
-
-    public RemoteRoleControllerService(@UserIdInt int userId, @NonNull Context context) {
-        mConnection = new Connection(userId, context);
-    }
-
-    /**
-     * Add a specific application to the holders of a role. If the role is exclusive, the previous
-     * holder will be replaced.
-     *
-     * @see RoleControllerService#onAddRoleHolder(String, String, int, RoleManagerCallback)
-     */
-    public void onAddRoleHolder(@NonNull String roleName, @NonNull String packageName,
-            @RoleManager.ManageHoldersFlags int flags, @NonNull IRoleManagerCallback callback) {
-        mConnection.enqueueCall(new Connection.Call((service, callbackDelegate) ->
-                service.onAddRoleHolder(roleName, packageName, flags, callbackDelegate), callback));
-    }
-
-    /**
-     * Remove a specific application from the holders of a role.
-     *
-     * @see RoleControllerService#onRemoveRoleHolder(String, String, int, RoleManagerCallback)
-     */
-    public void onRemoveRoleHolder(@NonNull String roleName, @NonNull String packageName,
-            @RoleManager.ManageHoldersFlags int flags, @NonNull IRoleManagerCallback callback) {
-        mConnection.enqueueCall(new Connection.Call((service, callbackDelegate) ->
-                service.onRemoveRoleHolder(roleName, packageName, flags, callbackDelegate),
-                callback));
-    }
-
-    /**
-     * Remove all holders of a role.
-     *
-     * @see RoleControllerService#onClearRoleHolders(String, int, RoleManagerCallback)
-     */
-    public void onClearRoleHolders(@NonNull String roleName,
-            @RoleManager.ManageHoldersFlags int flags, @NonNull IRoleManagerCallback callback) {
-        mConnection.enqueueCall(new Connection.Call((service, callbackDelegate) ->
-                service.onClearRoleHolders(roleName, flags, callbackDelegate), callback));
-    }
-
-    /**
-     * Performs granting of default roles and permissions and appops
-     *
-     * @see RoleControllerService#onGrantDefaultRoles(RoleManagerCallback)
-     */
-    public void onGrantDefaultRoles(@NonNull IRoleManagerCallback callback) {
-        mConnection.enqueueCall(new Connection.Call(IRoleControllerService::onGrantDefaultRoles,
-                callback));
-    }
-
-    /**
-     * @see RoleControllerService#onSmsKillSwitchToggled(boolean)
-     */
-    public void onSmsKillSwitchToggled(boolean smsRestrictionEnabled) {
-        mConnection.enqueueCall(new Connection.Call(
-                (s, cb) -> s.onSmsKillSwitchToggled(smsRestrictionEnabled),
-                new IRoleManagerCallback.Default() {
-                    @Override
-                    public void onFailure() {
-                        Slog.e(LOG_TAG, "Failed onSmsKillSwitchToggled");
-                    }
-                }));
-    }
-
-    private static final class Connection implements ServiceConnection {
-
-        private static final long UNBIND_DELAY_MILLIS = 15 * 1000;
-
-        @UserIdInt
-        private final int mUserId;
-
-        @NonNull
-        private final Context mContext;
-
-        @NonNull
-        private final Handler mHandler = FgThread.getHandler();
-
-        private boolean mBound;
-
-        @Nullable
-        private IRoleControllerService mService;
-
-        @NonNull
-        private final Queue<Call> mPendingCalls = new ArrayDeque<>();
-
-        @NonNull
-        private final Runnable mUnbindRunnable = this::unbind;
-
-        Connection(@UserIdInt int userId, @NonNull Context context) {
-            mUserId = userId;
-            mContext = context;
-        }
-
-        @Override
-        @WorkerThread
-        public void onServiceConnected(@NonNull ComponentName name, @NonNull IBinder service) {
-            mService = IRoleControllerService.Stub.asInterface(service);
-            executePendingCalls();
-        }
-
-        @WorkerThread
-        private void executePendingCalls() {
-            while (!mPendingCalls.isEmpty()) {
-                Call call = mPendingCalls.poll();
-                call.execute(mService);
-            }
-            scheduleUnbind();
-        }
-
-        @Override
-        @WorkerThread
-        public void onServiceDisconnected(@NonNull ComponentName name) {
-            mService = null;
-        }
-
-        @Override
-        @WorkerThread
-        public void onBindingDied(@NonNull ComponentName name) {
-            unbind();
-        }
-
-        public void enqueueCall(@NonNull Call call) {
-            if (DEBUG) {
-                Slog.i(LOG_TAG, "Enqueue " + call);
-            }
-            mHandler.executeOrSendMessage(PooledLambda.obtainMessage(Connection::executeCall, this,
-                    call));
-        }
-
-        @WorkerThread
-        private void executeCall(@NonNull Call call) {
-            ensureBound();
-            if (mService == null) {
-                if (DEBUG) {
-                    Slog.i(LOG_TAG, "Delaying until service connected: " + call);
-                }
-                mPendingCalls.offer(call);
-                return;
-            }
-            call.execute(mService);
-            scheduleUnbind();
-        }
-
-        @WorkerThread
-        private void ensureBound() {
-            mHandler.removeCallbacks(mUnbindRunnable);
-            if (!mBound) {
-                Intent intent = new Intent(RoleControllerService.SERVICE_INTERFACE);
-                intent.setPackage(mContext.getPackageManager()
-                        .getPermissionControllerPackageName());
-                // Use direct handler to ensure onServiceConnected callback happens in the same
-                // call frame, as required by onGrantDefaultRoles
-                //
-                // Note that as a result, onServiceConnected may happen not on main thread!
-                mBound = mContext.bindServiceAsUser(intent, this, Context.BIND_AUTO_CREATE,
-                        mHandler, UserHandle.of(mUserId));
-            }
-        }
-
-        private void scheduleUnbind() {
-            mHandler.removeCallbacks(mUnbindRunnable);
-            mHandler.postDelayed(mUnbindRunnable, UNBIND_DELAY_MILLIS);
-        }
-
-        @WorkerThread
-        private void unbind() {
-            if (mBound) {
-                mService = null;
-                mContext.unbindService(this);
-                mBound = false;
-            }
-        }
-
-        public static class Call {
-
-            private static final int TIMEOUT_MILLIS = 15 * 1000;
-
-            @NonNull
-            private final CallExecutor mCallExecutor;
-
-            @NonNull
-            private final IRoleManagerCallback mCallback;
-
-            @NonNull
-            private final Handler mHandler = FgThread.getHandler();
-
-            @NonNull
-            private final Runnable mTimeoutRunnable = this::notifyTimeout;
-
-            private boolean mCallbackNotified;
-
-            @Nullable
-            private final String mDebugName;
-
-            private Call(@NonNull CallExecutor callExecutor,
-                    @NonNull IRoleManagerCallback callback) {
-                mCallExecutor = callExecutor;
-                mCallback = callback;
-                mDebugName = DEBUG
-                        ? Arrays.stream(Thread.currentThread().getStackTrace())
-                                .filter(s -> s.getClassName().equals(
-                                        RemoteRoleControllerService.class.getName()))
-                                .findFirst()
-                                .get()
-                                .getMethodName()
-                        : null;
-            }
-
-            @WorkerThread
-            public void execute(IRoleControllerService service) {
-                if (DEBUG) {
-                    Slog.i(LOG_TAG, "Executing " + this);
-                }
-                try {
-                    mHandler.postDelayed(mTimeoutRunnable, TIMEOUT_MILLIS);
-                    mCallExecutor.execute(service, new CallbackDelegate());
-                } catch (RemoteException e) {
-                    Slog.e(LOG_TAG, "Error calling RoleControllerService", e);
-                    notifyCallback(false);
-                }
-            }
-
-            @WorkerThread
-            private void notifyTimeout() {
-                Slog.e(LOG_TAG, "Call timed out, calling onFailure()");
-                notifyCallback(false);
-            }
-
-            @WorkerThread
-            private void notifyCallback(boolean success) {
-                if (DEBUG) {
-                    Log.i(LOG_TAG, "notifyCallback(" + this
-                            + ", success = " + success + ")");
-                }
-                if (mCallbackNotified) {
-                    return;
-                }
-                mCallbackNotified = true;
-                mHandler.removeCallbacks(mTimeoutRunnable);
-                try {
-                    if (success) {
-                        mCallback.onSuccess();
-                    } else {
-                        mCallback.onFailure();
-                    }
-                } catch (RemoteException e) {
-                    Slog.e(LOG_TAG, "Error calling " + (success ? "onSuccess()" : "onFailure()")
-                            + " callback", e);
-                }
-            }
-
-            @Override
-            public String toString() {
-                return DEBUG ? mDebugName : "Call with callback: " + mCallback;
-            }
-
-            @FunctionalInterface
-            public interface CallExecutor {
-
-                @WorkerThread
-                void execute(IRoleControllerService service, IRoleManagerCallback callbackDelegate)
-                        throws RemoteException;
-            }
-
-            private class CallbackDelegate extends IRoleManagerCallback.Stub {
-
-                @Override
-                public void onSuccess() throws RemoteException {
-                    mHandler.sendMessage(PooledLambda.obtainMessage(Call::notifyCallback, Call.this,
-                            true));
-                }
-
-                @Override
-                public void onFailure() throws RemoteException {
-                    mHandler.sendMessage(PooledLambda.obtainMessage(Call::notifyCallback, Call.this,
-                            false));
-                }
-            }
-        }
-    }
-}
diff --git a/services/core/java/com/android/server/role/RoleManagerService.java b/services/core/java/com/android/server/role/RoleManagerService.java
index 17d3066..f4e10ed 100644
--- a/services/core/java/com/android/server/role/RoleManagerService.java
+++ b/services/core/java/com/android/server/role/RoleManagerService.java
@@ -27,7 +27,7 @@
 import android.app.AppOpsManager;
 import android.app.role.IOnRoleHoldersChangedListener;
 import android.app.role.IRoleManager;
-import android.app.role.IRoleManagerCallback;
+import android.app.role.RoleControllerManager;
 import android.app.role.RoleManager;
 import android.content.BroadcastReceiver;
 import android.content.Context;
@@ -97,6 +97,8 @@
 
     private static final String LOG_TAG = RoleManagerService.class.getSimpleName();
 
+    private static final boolean DEBUG = false;
+
     @NonNull
     private final UserManagerInternal mUserManagerInternal;
     @NonNull
@@ -123,12 +125,11 @@
     private final SparseArray<RoleUserState> mUserStates = new SparseArray<>();
 
     /**
-     * Maps user id to its controller service.
+     * Maps user id to its controller.
      */
     @GuardedBy("mLock")
     @NonNull
-    private final SparseArray<RemoteRoleControllerService> mControllerServices =
-            new SparseArray<>();
+    private final SparseArray<RoleControllerManager> mControllers = new SparseArray<>();
 
     /**
      * Maps user id to its list of listeners.
@@ -190,9 +191,9 @@
             @Override
             public void onReceive(Context context, Intent intent) {
                 int userId = UserHandle.getUserId(intent.getIntExtra(Intent.EXTRA_UID, -1));
-                if (RemoteRoleControllerService.DEBUG) {
-                    Slog.i(LOG_TAG,
-                            "Packages changed - re-running initial grants for user " + userId);
+                if (DEBUG) {
+                    Slog.i(LOG_TAG, "Packages changed - re-running initial grants for user "
+                            + userId);
                 }
                 performInitialGrantsIfNecessary(userId);
             }
@@ -243,24 +244,21 @@
             // Run grants again
             Slog.i(LOG_TAG, "Granting default permissions...");
             CompletableFuture<Void> result = new CompletableFuture<>();
-            getOrCreateControllerService(userId).onGrantDefaultRoles(
-                    new IRoleManagerCallback.Stub() {
-                        @Override
-                        public void onSuccess() {
+            getOrCreateControllerService(userId).grantDefaultRoles(FgThread.getExecutor(),
+                    successful -> {
+                        if (successful) {
                             result.complete(null);
-                        }
-                        @Override
-                        public void onFailure() {
+                        } else {
                             result.completeExceptionally(new RuntimeException());
                         }
                     });
             try {
-                result.get(5, TimeUnit.SECONDS);
+                result.get(30, TimeUnit.SECONDS);
                 userState.setPackagesHash(packagesHash);
             } catch (InterruptedException | ExecutionException | TimeoutException e) {
                 Slog.e(LOG_TAG, "Failed to grant defaults for user " + userId, e);
             }
-        } else if (RemoteRoleControllerService.DEBUG) {
+        } else if (DEBUG) {
             Slog.i(LOG_TAG, "Already ran grants for package state " + packagesHash);
         }
     }
@@ -326,14 +324,22 @@
     }
 
     @NonNull
-    private RemoteRoleControllerService getOrCreateControllerService(@UserIdInt int userId) {
+    private RoleControllerManager getOrCreateControllerService(@UserIdInt int userId) {
         synchronized (mLock) {
-            RemoteRoleControllerService controllerService = mControllerServices.get(userId);
-            if (controllerService == null) {
-                controllerService = new RemoteRoleControllerService(userId, getContext());
-                mControllerServices.put(userId, controllerService);
+            RoleControllerManager controller = mControllers.get(userId);
+            if (controller == null) {
+                Context systemContext = getContext();
+                Context context;
+                try {
+                    context = systemContext.createPackageContextAsUser(
+                            systemContext.getPackageName(), 0, UserHandle.of(userId));
+                } catch (NameNotFoundException e) {
+                    throw new RuntimeException(e);
+                }
+                controller = new RoleControllerManager(context, FgThread.getHandler());
+                mControllers.put(userId, controller);
             }
-            return controllerService;
+            return controller;
         }
     }
 
@@ -362,7 +368,7 @@
         RoleUserState userState;
         synchronized (mLock) {
             listeners = mListeners.removeReturnOld(userId);
-            mControllerServices.remove(userId);
+            mControllers.remove(userId);
             userState = mUserStates.removeReturnOld(userId);
         }
         if (listeners != null) {
@@ -424,11 +430,12 @@
 
         @Override
         public boolean isRoleHeld(@NonNull String roleName, @NonNull String packageName) {
-            Preconditions.checkStringNotEmpty(roleName, "roleName cannot be null or empty");
-            Preconditions.checkStringNotEmpty(packageName, "packageName cannot be null or empty");
             int callingUid = getCallingUid();
             mAppOpsManager.checkPackage(callingUid, packageName);
 
+            Preconditions.checkStringNotEmpty(roleName, "roleName cannot be null or empty");
+            Preconditions.checkStringNotEmpty(packageName, "packageName cannot be null or empty");
+
             int userId = UserHandle.getUserId(callingUid);
             ArraySet<String> roleHolders = getOrCreateUserState(userId).getRoleHolders(roleName);
             if (roleHolders == null) {
@@ -440,7 +447,6 @@
         @NonNull
         @Override
         public List<String> getRoleHoldersAsUser(@NonNull String roleName, @UserIdInt int userId) {
-            Preconditions.checkStringNotEmpty(roleName, "roleName cannot be null or empty");
             if (!mUserManagerInternal.exists(userId)) {
                 Slog.e(LOG_TAG, "user " + userId + " does not exist");
                 return Collections.emptyList();
@@ -449,6 +455,8 @@
             getContext().enforceCallingOrSelfPermission(Manifest.permission.MANAGE_ROLE_HOLDERS,
                     "getRoleHoldersAsUser");
 
+            Preconditions.checkStringNotEmpty(roleName, "roleName cannot be null or empty");
+
             ArraySet<String> roleHolders = getOrCreateUserState(userId).getRoleHolders(roleName);
             if (roleHolders == null) {
                 return Collections.emptyList();
@@ -459,10 +467,7 @@
         @Override
         public void addRoleHolderAsUser(@NonNull String roleName, @NonNull String packageName,
                 @RoleManager.ManageHoldersFlags int flags, @UserIdInt int userId,
-                @NonNull IRoleManagerCallback callback) {
-            Preconditions.checkStringNotEmpty(roleName, "roleName cannot be null or empty");
-            Preconditions.checkStringNotEmpty(packageName, "packageName cannot be null or empty");
-            Preconditions.checkNotNull(callback, "callback cannot be null");
+                @NonNull RemoteCallback callback) {
             if (!mUserManagerInternal.exists(userId)) {
                 Slog.e(LOG_TAG, "user " + userId + " does not exist");
                 return;
@@ -471,6 +476,10 @@
             getContext().enforceCallingOrSelfPermission(Manifest.permission.MANAGE_ROLE_HOLDERS,
                     "addRoleHolderAsUser");
 
+            Preconditions.checkStringNotEmpty(roleName, "roleName cannot be null or empty");
+            Preconditions.checkStringNotEmpty(packageName, "packageName cannot be null or empty");
+            Preconditions.checkNotNull(callback, "callback cannot be null");
+
             getOrCreateControllerService(userId).onAddRoleHolder(roleName, packageName, flags,
                     callback);
         }
@@ -478,10 +487,7 @@
         @Override
         public void removeRoleHolderAsUser(@NonNull String roleName, @NonNull String packageName,
                 @RoleManager.ManageHoldersFlags int flags, @UserIdInt int userId,
-                @NonNull IRoleManagerCallback callback) {
-            Preconditions.checkStringNotEmpty(roleName, "roleName cannot be null or empty");
-            Preconditions.checkStringNotEmpty(packageName, "packageName cannot be null or empty");
-            Preconditions.checkNotNull(callback, "callback cannot be null");
+                @NonNull RemoteCallback callback) {
             if (!mUserManagerInternal.exists(userId)) {
                 Slog.e(LOG_TAG, "user " + userId + " does not exist");
                 return;
@@ -490,6 +496,10 @@
             getContext().enforceCallingOrSelfPermission(Manifest.permission.MANAGE_ROLE_HOLDERS,
                     "removeRoleHolderAsUser");
 
+            Preconditions.checkStringNotEmpty(roleName, "roleName cannot be null or empty");
+            Preconditions.checkStringNotEmpty(packageName, "packageName cannot be null or empty");
+            Preconditions.checkNotNull(callback, "callback cannot be null");
+
             getOrCreateControllerService(userId).onRemoveRoleHolder(roleName, packageName, flags,
                     callback);
         }
@@ -497,9 +507,7 @@
         @Override
         public void clearRoleHoldersAsUser(@NonNull String roleName,
                 @RoleManager.ManageHoldersFlags int flags, @UserIdInt int userId,
-                @NonNull IRoleManagerCallback callback) {
-            Preconditions.checkStringNotEmpty(roleName, "roleName cannot be null or empty");
-            Preconditions.checkNotNull(callback, "callback cannot be null");
+                @NonNull RemoteCallback callback) {
             if (!mUserManagerInternal.exists(userId)) {
                 Slog.e(LOG_TAG, "user " + userId + " does not exist");
                 return;
@@ -508,13 +516,15 @@
             getContext().enforceCallingOrSelfPermission(Manifest.permission.MANAGE_ROLE_HOLDERS,
                     "clearRoleHoldersAsUser");
 
+            Preconditions.checkStringNotEmpty(roleName, "roleName cannot be null or empty");
+            Preconditions.checkNotNull(callback, "callback cannot be null");
+
             getOrCreateControllerService(userId).onClearRoleHolders(roleName, flags, callback);
         }
 
         @Override
         public void addOnRoleHoldersChangedListenerAsUser(
                 @NonNull IOnRoleHoldersChangedListener listener, @UserIdInt int userId) {
-            Preconditions.checkNotNull(listener, "listener cannot be null");
             if (userId != UserHandle.USER_ALL && !mUserManagerInternal.exists(userId)) {
                 Slog.e(LOG_TAG, "user " + userId + " does not exist");
                 return;
@@ -523,6 +533,8 @@
             getContext().enforceCallingOrSelfPermission(Manifest.permission.OBSERVE_ROLE_HOLDERS,
                     "addOnRoleHoldersChangedListenerAsUser");
 
+            Preconditions.checkNotNull(listener, "listener cannot be null");
+
             RemoteCallbackList<IOnRoleHoldersChangedListener> listeners = getOrCreateListeners(
                     userId);
             listeners.register(listener);
@@ -531,7 +543,6 @@
         @Override
         public void removeOnRoleHoldersChangedListenerAsUser(
                 @NonNull IOnRoleHoldersChangedListener listener, @UserIdInt int userId) {
-            Preconditions.checkNotNull(listener, "listener cannot be null");
             if (userId != UserHandle.USER_ALL && !mUserManagerInternal.exists(userId)) {
                 Slog.e(LOG_TAG, "user " + userId + " does not exist");
                 return;
@@ -540,6 +551,8 @@
             getContext().enforceCallingOrSelfPermission(Manifest.permission.OBSERVE_ROLE_HOLDERS,
                     "removeOnRoleHoldersChangedListenerAsUser");
 
+            Preconditions.checkNotNull(listener, "listener cannot be null");
+
             RemoteCallbackList<IOnRoleHoldersChangedListener> listeners = getListeners(userId);
             if (listener == null) {
                 return;
@@ -549,11 +562,12 @@
 
         @Override
         public void setRoleNamesFromController(@NonNull List<String> roleNames) {
-            Preconditions.checkNotNull(roleNames, "roleNames cannot be null");
             getContext().enforceCallingOrSelfPermission(
                     RoleManager.PERMISSION_MANAGE_ROLES_FROM_CONTROLLER,
                     "setRoleNamesFromController");
 
+            Preconditions.checkNotNull(roleNames, "roleNames cannot be null");
+
             int userId = UserHandle.getCallingUserId();
             getOrCreateUserState(userId).setRoleNames(roleNames);
         }
@@ -561,12 +575,13 @@
         @Override
         public boolean addRoleHolderFromController(@NonNull String roleName,
                 @NonNull String packageName) {
-            Preconditions.checkStringNotEmpty(roleName, "roleName cannot be null or empty");
-            Preconditions.checkStringNotEmpty(packageName, "packageName cannot be null or empty");
             getContext().enforceCallingOrSelfPermission(
                     RoleManager.PERMISSION_MANAGE_ROLES_FROM_CONTROLLER,
                     "addRoleHolderFromController");
 
+            Preconditions.checkStringNotEmpty(roleName, "roleName cannot be null or empty");
+            Preconditions.checkStringNotEmpty(packageName, "packageName cannot be null or empty");
+
             int userId = UserHandle.getCallingUserId();
             return getOrCreateUserState(userId).addRoleHolder(roleName, packageName);
         }
@@ -574,23 +589,25 @@
         @Override
         public boolean removeRoleHolderFromController(@NonNull String roleName,
                 @NonNull String packageName) {
-            Preconditions.checkStringNotEmpty(roleName, "roleName cannot be null or empty");
-            Preconditions.checkStringNotEmpty(packageName, "packageName cannot be null or empty");
             getContext().enforceCallingOrSelfPermission(
                     RoleManager.PERMISSION_MANAGE_ROLES_FROM_CONTROLLER,
                     "removeRoleHolderFromController");
 
+            Preconditions.checkStringNotEmpty(roleName, "roleName cannot be null or empty");
+            Preconditions.checkStringNotEmpty(packageName, "packageName cannot be null or empty");
+
             int userId = UserHandle.getCallingUserId();
             return getOrCreateUserState(userId).removeRoleHolder(roleName, packageName);
         }
 
         @Override
         public List<String> getHeldRolesFromController(@NonNull String packageName) {
-            Preconditions.checkStringNotEmpty(packageName, "packageName cannot be null or empty");
             getContext().enforceCallingOrSelfPermission(
                     RoleManager.PERMISSION_MANAGE_ROLES_FROM_CONTROLLER,
                     "getRolesHeldFromController");
 
+            Preconditions.checkStringNotEmpty(packageName, "packageName cannot be null or empty");
+
             int userId = UserHandle.getCallingUserId();
             return getOrCreateUserState(userId).getHeldRoles(packageName);
         }
@@ -718,16 +735,14 @@
         @Override
         public boolean setDefaultBrowser(@Nullable String packageName, @UserIdInt int userId) {
             CompletableFuture<Void> future = new CompletableFuture<>();
-            IRoleManagerCallback callback = new IRoleManagerCallback.Stub() {
-                @Override
-                public void onSuccess() {
+            RemoteCallback callback = new RemoteCallback(result -> {
+                boolean successful = result != null;
+                if (successful) {
                     future.complete(null);
-                }
-                @Override
-                public void onFailure() {
+                } else {
                     future.completeExceptionally(new RuntimeException());
                 }
-            };
+            });
             if (packageName != null) {
                 getOrCreateControllerService(userId).onAddRoleHolder(RoleManager.ROLE_BROWSER,
                         packageName, 0, callback);
@@ -743,6 +758,23 @@
                 return false;
             }
         }
+
+        @Override
+        public void setDefaultBrowserAsync(@Nullable String packageName, @UserIdInt int userId) {
+            RemoteCallback callback = new RemoteCallback(result -> {
+                boolean successful = result != null;
+                if (!successful) {
+                    Slog.e(LOG_TAG, "Failed to set default browser: " + packageName);
+                }
+            });
+            if (packageName != null) {
+                getOrCreateControllerService(userId).onAddRoleHolder(RoleManager.ROLE_BROWSER,
+                        packageName, 0, callback);
+            } else {
+                getOrCreateControllerService(userId).onClearRoleHolders(RoleManager.ROLE_BROWSER, 0,
+                        callback);
+            }
+        }
     }
 
     private class DefaultHomeProvider implements PackageManagerInternal.DefaultHomeProvider {
@@ -756,14 +788,12 @@
 
         @Override
         public void setDefaultHomeAsync(@Nullable String packageName, @UserIdInt int userId) {
-            IRoleManagerCallback callback = new IRoleManagerCallback.Stub() {
-                @Override
-                public void onSuccess() {}
-                @Override
-                public void onFailure() {
+            RemoteCallback callback = new RemoteCallback(result -> {
+                boolean successful = result != null;
+                if (!successful) {
                     Slog.e(LOG_TAG, "Failed to set default home: " + packageName);
                 }
-            };
+            });
             if (packageName != null) {
                 getOrCreateControllerService(userId).onAddRoleHolder(RoleManager.ROLE_HOME,
                         packageName, 0, callback);
diff --git a/services/core/java/com/android/server/role/RoleManagerShellCommand.java b/services/core/java/com/android/server/role/RoleManagerShellCommand.java
index 00021d7..b26a070 100644
--- a/services/core/java/com/android/server/role/RoleManagerShellCommand.java
+++ b/services/core/java/com/android/server/role/RoleManagerShellCommand.java
@@ -19,7 +19,7 @@
 import android.annotation.NonNull;
 import android.annotation.Nullable;
 import android.app.role.IRoleManager;
-import android.app.role.IRoleManagerCallback;
+import android.os.RemoteCallback;
 import android.os.RemoteException;
 import android.os.ShellCommand;
 import android.os.UserHandle;
@@ -38,14 +38,23 @@
         mRoleManager = roleManager;
     }
 
-    private class Callback extends IRoleManagerCallback.Stub {
+    private class CallbackFuture extends CompletableFuture<Void> {
 
         @NonNull
-        private final CompletableFuture<Void> mResult = new CompletableFuture<>();
+        public RemoteCallback createCallback() {
+            return new RemoteCallback(result -> {
+                boolean successful = result != null;
+                if (successful) {
+                    complete(null);
+                } else {
+                    completeExceptionally(new RuntimeException("Failed"));
+                }
+            });
+        }
 
         public int waitForResult() {
             try {
-                mResult.get(5, TimeUnit.SECONDS);
+                get(5, TimeUnit.SECONDS);
                 return 0;
             } catch (Exception e) {
                 getErrPrintWriter().println("Error: see logcat for details.\n"
@@ -53,16 +62,6 @@
                 return -1;
             }
         }
-
-        @Override
-        public void onSuccess() {
-            mResult.complete(null);
-        }
-
-        @Override
-        public void onFailure() {
-            mResult.completeExceptionally(new RuntimeException("Failed"));
-        }
     }
 
     @Override
@@ -112,9 +111,10 @@
         String packageName = getNextArgRequired();
         int flags = getFlagsMaybe();
 
-        Callback callback = new Callback();
-        mRoleManager.addRoleHolderAsUser(roleName, packageName, flags, userId, callback);
-        return callback.waitForResult();
+        CallbackFuture future = new CallbackFuture();
+        mRoleManager.addRoleHolderAsUser(roleName, packageName, flags, userId,
+                future.createCallback());
+        return future.waitForResult();
     }
 
     private int runRemoveRoleHolder() throws RemoteException {
@@ -123,9 +123,10 @@
         String packageName = getNextArgRequired();
         int flags = getFlagsMaybe();
 
-        Callback callback = new Callback();
-        mRoleManager.removeRoleHolderAsUser(roleName, packageName, flags, userId, callback);
-        return callback.waitForResult();
+        CallbackFuture future = new CallbackFuture();
+        mRoleManager.removeRoleHolderAsUser(roleName, packageName, flags, userId,
+                future.createCallback());
+        return future.waitForResult();
     }
 
     private int runClearRoleHolders() throws RemoteException {
@@ -133,9 +134,9 @@
         String roleName = getNextArgRequired();
         int flags = getFlagsMaybe();
 
-        Callback callback = new Callback();
-        mRoleManager.clearRoleHoldersAsUser(roleName, flags, userId, callback);
-        return callback.waitForResult();
+        CallbackFuture future = new CallbackFuture();
+        mRoleManager.clearRoleHoldersAsUser(roleName, flags, userId, future.createCallback());
+        return future.waitForResult();
     }
 
     @Override
diff --git a/services/core/java/com/android/server/rollback/AppDataRollbackHelper.java b/services/core/java/com/android/server/rollback/AppDataRollbackHelper.java
index e9ccea54..56e1d08 100644
--- a/services/core/java/com/android/server/rollback/AppDataRollbackHelper.java
+++ b/services/core/java/com/android/server/rollback/AppDataRollbackHelper.java
@@ -18,7 +18,6 @@
 
 import android.content.rollback.PackageRollbackInfo;
 import android.content.rollback.PackageRollbackInfo.RestoreInfo;
-import android.content.rollback.RollbackInfo;
 import android.os.storage.StorageManager;
 import android.util.IntArray;
 import android.util.Log;
@@ -30,9 +29,11 @@
 
 import java.util.ArrayList;
 import java.util.HashMap;
+import java.util.HashSet;
 import java.util.Iterator;
 import java.util.List;
 import java.util.Map;
+import java.util.Set;
 
 /**
  * Encapsulates the logic for initiating userdata snapshots and rollbacks via installd.
@@ -153,7 +154,7 @@
     }
 
     /**
-     * Computes the list of pending backups for {@code userId} given lists of available rollbacks.
+     * Computes the list of pending backups for {@code userId} given lists of rollbacks.
      * Packages pending backup for the given user are added to {@code pendingBackupPackages} along
      * with their corresponding {@code PackageRollbackInfo}.
      *
@@ -162,11 +163,11 @@
      */
     private static List<RollbackData> computePendingBackups(int userId,
             Map<String, PackageRollbackInfo> pendingBackupPackages,
-            List<RollbackData> availableRollbacks) {
+            List<RollbackData> rollbacks) {
         List<RollbackData> rd = new ArrayList<>();
 
-        for (RollbackData data : availableRollbacks) {
-            for (PackageRollbackInfo info : data.packages) {
+        for (RollbackData data : rollbacks) {
+            for (PackageRollbackInfo info : data.info.getPackages()) {
                 final IntArray pendingBackupUsers = info.getPendingBackups();
                 if (pendingBackupUsers != null) {
                     final int idx = pendingBackupUsers.indexOf(userId);
@@ -183,20 +184,20 @@
     }
 
     /**
-     * Computes the list of pending restores for {@code userId} given lists of recent rollbacks.
+     * Computes the list of pending restores for {@code userId} given lists of rollbacks.
      * Packages pending restore are added to {@code pendingRestores} along with their corresponding
      * {@code PackageRollbackInfo}.
      *
-     * @return the list of {@code RollbackInfo} that has pending restores. Note that some of the
+     * @return the list of {@code RollbackData} that has pending restores. Note that some of the
      *         restores won't be performed, because they might be counteracted by pending backups.
      */
-    private static List<RollbackInfo> computePendingRestores(int userId,
+    private static List<RollbackData> computePendingRestores(int userId,
             Map<String, PackageRollbackInfo> pendingRestorePackages,
-            List<RollbackInfo> recentRollbacks) {
-        List<RollbackInfo> rd = new ArrayList<>();
+            List<RollbackData> rollbacks) {
+        List<RollbackData> rd = new ArrayList<>();
 
-        for (RollbackInfo data : recentRollbacks) {
-            for (PackageRollbackInfo info : data.getPackages()) {
+        for (RollbackData data : rollbacks) {
+            for (PackageRollbackInfo info : data.info.getPackages()) {
                 final RestoreInfo ri = info.getRestoreInfo(userId);
                 if (ri != null) {
                     pendingRestorePackages.put(info.getPackageName(), info);
@@ -215,18 +216,18 @@
      * backups updates corresponding {@code changedRollbackData} with a mapping from {@code userId}
      * to a inode of theirs CE user data snapshot.
      *
-     * @return a list {@code RollbackData} that have been changed and should be stored on disk.
+     * @return the set of {@code RollbackData} that have been changed and should be stored on disk.
      */
-    public List<RollbackData> commitPendingBackupAndRestoreForUser(int userId,
-            List<RollbackData> availableRollbacks, List<RollbackInfo> recentlyExecutedRollbacks) {
+    public Set<RollbackData> commitPendingBackupAndRestoreForUser(int userId,
+            List<RollbackData> rollbacks) {
 
         final Map<String, PackageRollbackInfo> pendingBackupPackages = new HashMap<>();
         final List<RollbackData> pendingBackups = computePendingBackups(userId,
-                pendingBackupPackages, availableRollbacks);
+                pendingBackupPackages, rollbacks);
 
         final Map<String, PackageRollbackInfo> pendingRestorePackages = new HashMap<>();
-        final List<RollbackInfo> pendingRestores = computePendingRestores(userId,
-                pendingRestorePackages, recentlyExecutedRollbacks);
+        final List<RollbackData> pendingRestores = computePendingRestores(userId,
+                pendingRestorePackages, rollbacks);
 
         // First remove unnecessary backups, i.e. when user did not unlock their phone between the
         // request to backup data and the request to restore it.
@@ -246,13 +247,13 @@
 
         if (!pendingBackupPackages.isEmpty()) {
             for (RollbackData data : pendingBackups) {
-                for (PackageRollbackInfo info : data.packages) {
+                for (PackageRollbackInfo info : data.info.getPackages()) {
                     final IntArray pendingBackupUsers = info.getPendingBackups();
                     final int idx = pendingBackupUsers.indexOf(userId);
                     if (idx != -1) {
                         try {
                             long ceSnapshotInode = mInstaller.snapshotAppData(info.getPackageName(),
-                                    userId, data.rollbackId, Installer.FLAG_STORAGE_CE);
+                                    userId, data.info.getRollbackId(), Installer.FLAG_STORAGE_CE);
                             info.putCeSnapshotInode(userId, ceSnapshotInode);
                             pendingBackupUsers.remove(idx);
                         } catch (InstallerException ie) {
@@ -266,13 +267,13 @@
         }
 
         if (!pendingRestorePackages.isEmpty()) {
-            for (RollbackInfo data : pendingRestores) {
-                for (PackageRollbackInfo info : data.getPackages()) {
+            for (RollbackData data : pendingRestores) {
+                for (PackageRollbackInfo info : data.info.getPackages()) {
                     final RestoreInfo ri = info.getRestoreInfo(userId);
                     if (ri != null) {
                         try {
                             mInstaller.restoreAppDataSnapshot(info.getPackageName(), ri.appId,
-                                    ri.seInfo, userId, data.getRollbackId(),
+                                    ri.seInfo, userId, data.info.getRollbackId(),
                                     Installer.FLAG_STORAGE_CE);
                             info.removeRestoreInfo(ri);
                         } catch (InstallerException ie) {
@@ -284,7 +285,9 @@
             }
         }
 
-        return pendingBackups;
+        final Set<RollbackData> changed = new HashSet<>(pendingBackups);
+        changed.addAll(pendingRestores);
+        return changed;
     }
 
     /**
diff --git a/services/core/java/com/android/server/rollback/RollbackData.java b/services/core/java/com/android/server/rollback/RollbackData.java
index fcd5297..8a95877 100644
--- a/services/core/java/com/android/server/rollback/RollbackData.java
+++ b/services/core/java/com/android/server/rollback/RollbackData.java
@@ -16,27 +16,49 @@
 
 package com.android.server.rollback;
 
-import android.content.rollback.PackageRollbackInfo;
+import android.annotation.IntDef;
+import android.annotation.NonNull;
+import android.content.rollback.RollbackInfo;
 
 import java.io.File;
+import java.lang.annotation.Retention;
+import java.lang.annotation.RetentionPolicy;
 import java.time.Instant;
 import java.util.ArrayList;
-import java.util.List;
 
 /**
  * Information about a rollback available for a set of atomically installed
  * packages.
  */
 class RollbackData {
-    /**
-     * A unique identifier for this rollback.
-     */
-    public final int rollbackId;
+    @IntDef(flag = true, prefix = { "ROLLBACK_STATE_" }, value = {
+            ROLLBACK_STATE_ENABLING,
+            ROLLBACK_STATE_AVAILABLE,
+            ROLLBACK_STATE_COMMITTED,
+    })
+    @Retention(RetentionPolicy.SOURCE)
+    @interface RollbackState {}
 
     /**
-     * The per-package rollback information.
+     * The rollback is in the process of being enabled. It is not yet
+     * available for use.
      */
-    public final List<PackageRollbackInfo> packages = new ArrayList<>();
+    static final int ROLLBACK_STATE_ENABLING = 0;
+
+    /**
+     * The rollback is currently available.
+     */
+    static final int ROLLBACK_STATE_AVAILABLE = 1;
+
+    /**
+     * The rollback has been committed.
+     */
+    static final int ROLLBACK_STATE_COMMITTED = 3;
+
+    /**
+     * The rollback info for this rollback.
+     */
+    public final RollbackInfo info;
 
     /**
      * The directory where the rollback data is stored.
@@ -46,22 +68,23 @@
     /**
      * The time when the upgrade occurred, for purposes of expiring
      * rollback data.
+     *
+     * The timestamp is not applicable for all rollback states, but we make
+     * sure to keep it non-null to avoid potential errors there.
      */
-    public Instant timestamp;
+    public @NonNull Instant timestamp;
 
     /**
      * The session ID for the staged session if this rollback data represents a staged session,
      * {@code -1} otherwise.
      */
-    public int stagedSessionId;
+    public final int stagedSessionId;
 
     /**
-     * A flag to indicate whether the rollback should be considered available
-     * for use. This will always be true for rollbacks of non-staged sessions.
-     * For rollbacks of staged sessions, this is not set to true until after
-     * the staged session has been applied.
+     * The current state of the rollback.
+     * ENABLING, AVAILABLE, or COMMITTED.
      */
-    public boolean isAvailable;
+    public @RollbackState int state;
 
     /**
      * The id of the post-reboot apk session for a staged install, if any.
@@ -69,24 +92,50 @@
     public int apkSessionId = -1;
 
     /**
-     * Whether this Rollback is currently in progress. This field is true from the point
-     * we commit a {@code PackageInstaller} session containing these packages to the point the
-     * {@code PackageInstaller} calls into the {@code onFinished} callback.
+     * True if we are expecting the package manager to call restoreUserData
+     * for this rollback because it has just been committed but the rollback
+     * has not yet been fully applied.
      */
     // NOTE: All accesses to this field are from the RollbackManager handler thread.
-    public boolean inProgress = false;
+    public boolean restoreUserDataInProgress = false;
 
-    RollbackData(int rollbackId, File backupDir, int stagedSessionId, boolean isAvailable) {
-        this.rollbackId = rollbackId;
+    /**
+     * Constructs a new, empty RollbackData instance.
+     *
+     * @param rollbackId the id of the rollback.
+     * @param backupDir the directory where the rollback data is stored.
+     * @param stagedSessionId the session id if this is a staged rollback, -1 otherwise.
+     */
+    RollbackData(int rollbackId, File backupDir, int stagedSessionId) {
+        this.info = new RollbackInfo(rollbackId,
+                /* packages */ new ArrayList<>(),
+                /* isStaged */ stagedSessionId != -1,
+                /* causePackages */ new ArrayList<>(),
+                /* committedSessionId */ -1);
         this.backupDir = backupDir;
         this.stagedSessionId = stagedSessionId;
-        this.isAvailable = isAvailable;
+        this.state = ROLLBACK_STATE_ENABLING;
+        this.timestamp = Instant.now();
+    }
+
+    /**
+     * Constructs a RollbackData instance with full rollback data information.
+     */
+    RollbackData(RollbackInfo info, File backupDir, Instant timestamp, int stagedSessionId,
+            @RollbackState int state, int apkSessionId, boolean restoreUserDataInProgress) {
+        this.info = info;
+        this.backupDir = backupDir;
+        this.timestamp = timestamp;
+        this.stagedSessionId = stagedSessionId;
+        this.state = state;
+        this.apkSessionId = apkSessionId;
+        this.restoreUserDataInProgress = restoreUserDataInProgress;
     }
 
     /**
      * Whether the rollback is for rollback of a staged install.
      */
     public boolean isStaged() {
-        return stagedSessionId != -1;
+        return info.isStaged();
     }
 }
diff --git a/services/core/java/com/android/server/rollback/RollbackManagerServiceImpl.java b/services/core/java/com/android/server/rollback/RollbackManagerServiceImpl.java
index 88a5fb4..871f9f8 100644
--- a/services/core/java/com/android/server/rollback/RollbackManagerServiceImpl.java
+++ b/services/core/java/com/android/server/rollback/RollbackManagerServiceImpl.java
@@ -64,6 +64,7 @@
 import java.util.List;
 import java.util.Map;
 import java.util.Random;
+import java.util.Set;
 import java.util.concurrent.LinkedBlockingQueue;
 import java.util.concurrent.TimeUnit;
 
@@ -75,7 +76,6 @@
     private static final String TAG = "RollbackManager";
 
     // Rollbacks expire after 48 hours.
-    // TODO: How to test rollback expiration works properly?
     private static final long DEFAULT_ROLLBACK_LIFETIME_DURATION_MILLIS =
             TimeUnit.HOURS.toMillis(48);
 
@@ -106,15 +106,10 @@
     @GuardedBy("mLock")
     private final Map<Integer, Integer> mChildSessions = new HashMap<>();
 
-    // Package rollback data available to be used for rolling back a package.
+    // The list of all rollbacks, including available and committed rollbacks.
     // This list is null until the rollback data has been loaded.
     @GuardedBy("mLock")
-    private List<RollbackData> mAvailableRollbacks;
-
-    // The list of recently executed rollbacks.
-    // This list is null until the rollback data has been loaded.
-    @GuardedBy("mLock")
-    private List<RollbackInfo> mRecentlyExecutedRollbacks;
+    private List<RollbackData> mRollbacks;
 
     private final RollbackStore mRollbackStore;
 
@@ -176,17 +171,6 @@
             }
         }, filter, null, getHandler());
 
-        // NOTE: A new intent filter is being created here because this broadcast
-        // doesn't use a data scheme ("package") like above.
-        IntentFilter sessionUpdatedFilter = new IntentFilter();
-        sessionUpdatedFilter.addAction(PackageInstaller.ACTION_SESSION_UPDATED);
-        mContext.registerReceiver(new BroadcastReceiver() {
-            @Override
-            public void onReceive(Context context, Intent intent) {
-                onStagedSessionUpdated(intent);
-            }
-        }, sessionUpdatedFilter, null, getHandler());
-
         IntentFilter enableRollbackFilter = new IntentFilter();
         enableRollbackFilter.addAction(Intent.ACTION_PACKAGE_ENABLE_ROLLBACK);
         try {
@@ -240,11 +224,10 @@
         synchronized (mLock) {
             ensureRollbackDataLoadedLocked();
             List<RollbackInfo> rollbacks = new ArrayList<>();
-            for (int i = 0; i < mAvailableRollbacks.size(); ++i) {
-                RollbackData data = mAvailableRollbacks.get(i);
-                if (data.isAvailable) {
-                    rollbacks.add(new RollbackInfo(data.rollbackId,
-                                data.packages, data.isStaged()));
+            for (int i = 0; i < mRollbacks.size(); ++i) {
+                RollbackData data = mRollbacks.get(i);
+                if (data.state == RollbackData.ROLLBACK_STATE_AVAILABLE) {
+                    rollbacks.add(data.info);
                 }
             }
             return new ParceledListSlice<>(rollbacks);
@@ -259,7 +242,13 @@
 
         synchronized (mLock) {
             ensureRollbackDataLoadedLocked();
-            List<RollbackInfo> rollbacks = new ArrayList<>(mRecentlyExecutedRollbacks);
+            List<RollbackInfo> rollbacks = new ArrayList<>();
+            for (int i = 0; i < mRollbacks.size(); ++i) {
+                RollbackData data = mRollbacks.get(i);
+                if (data.state == RollbackData.ROLLBACK_STATE_COMMITTED) {
+                    rollbacks.add(data.info);
+                }
+            }
             return new ParceledListSlice<>(rollbacks);
         }
     }
@@ -291,21 +280,12 @@
                 synchronized (mLock) {
                     ensureRollbackDataLoadedLocked();
 
-                    Iterator<RollbackData> iter = mAvailableRollbacks.iterator();
+                    Iterator<RollbackData> iter = mRollbacks.iterator();
                     while (iter.hasNext()) {
                         RollbackData data = iter.next();
-
                         data.timestamp = data.timestamp.plusMillis(timeDifference);
-                        try {
-                            mRollbackStore.saveAvailableRollback(data);
-                        } catch (IOException ioe) {
-                            // TODO: figure out the right way to deal with this, especially if
-                            //  it fails for some data and succeeds for others.
-                            Log.e(TAG, "Unable to save rollback info for : " + data.rollbackId,
-                                    ioe);
-                        }
+                        saveRollbackData(data);
                     }
-
                 }
             }
         };
@@ -329,18 +309,12 @@
         Log.i(TAG, "Initiating rollback");
 
         RollbackData data = getRollbackForId(rollbackId);
-        if (data == null) {
+        if (data == null || data.state != RollbackData.ROLLBACK_STATE_AVAILABLE) {
             sendFailure(statusReceiver, RollbackManager.STATUS_FAILURE_ROLLBACK_UNAVAILABLE,
                     "Rollback unavailable");
             return;
         }
 
-        if (data.inProgress) {
-            sendFailure(statusReceiver, RollbackManager.STATUS_FAILURE_ROLLBACK_UNAVAILABLE,
-                    "Rollback for package is already in progress.");
-            return;
-        }
-
         // Verify the RollbackData is up to date with what's installed on
         // device.
         // TODO: We assume that between now and the time we commit the
@@ -349,7 +323,7 @@
         // rollback racing with a roll-forward fix of a buggy package.
         // Figure out how to ensure we don't commit the rollback if
         // roll forward happens at the same time.
-        for (PackageRollbackInfo info : data.packages) {
+        for (PackageRollbackInfo info : data.info.getPackages()) {
             VersionedPackage installedVersion = getInstalledPackageVersion(info.getPackageName());
             if (installedVersion == null) {
                 // TODO: Test this case
@@ -382,7 +356,7 @@
             PackageInstaller packageInstaller = pm.getPackageInstaller();
             PackageInstaller.SessionParams parentParams = new PackageInstaller.SessionParams(
                     PackageInstaller.SessionParams.MODE_FULL_INSTALL);
-            parentParams.setAllowDowngrade(true);
+            parentParams.setRequestDowngrade(true);
             parentParams.setMultiPackage();
             if (data.isStaged()) {
                 parentParams.setStaged();
@@ -391,7 +365,7 @@
             int parentSessionId = packageInstaller.createSession(parentParams);
             PackageInstaller.Session parentSession = packageInstaller.openSession(parentSessionId);
 
-            for (PackageRollbackInfo info : data.packages) {
+            for (PackageRollbackInfo info : data.info.getPackages()) {
                 PackageInstaller.SessionParams params = new PackageInstaller.SessionParams(
                         PackageInstaller.SessionParams.MODE_FULL_INSTALL);
                 // TODO: We can't get the installerPackageName for apex
@@ -403,7 +377,7 @@
                         params.setInstallerPackageName(installerPackageName);
                     }
                 }
-                params.setAllowDowngrade(true);
+                params.setRequestDowngrade(true);
                 if (data.isStaged()) {
                     params.setStaged();
                 }
@@ -439,13 +413,25 @@
             final LocalIntentReceiver receiver = new LocalIntentReceiver(
                     (Intent result) -> {
                         getHandler().post(() -> {
-                            // We've now completed the rollback, so we mark it as no longer in
-                            // progress.
-                            data.inProgress = false;
 
                             int status = result.getIntExtra(PackageInstaller.EXTRA_STATUS,
                                     PackageInstaller.STATUS_FAILURE);
                             if (status != PackageInstaller.STATUS_SUCCESS) {
+                                // Committing the rollback failed, but we
+                                // still have all the info we need to try
+                                // rolling back again, so restore the rollback
+                                // state to how it was before we tried
+                                // committing.
+                                // TODO: Should we just kill this rollback if
+                                // commit failed? Why would we expect commit
+                                // not to fail again?
+                                synchronized (mLock) {
+                                    // TODO: Could this cause a rollback to be
+                                    // resurrected if it should otherwise have
+                                    // expired by now?
+                                    data.state = RollbackData.ROLLBACK_STATE_AVAILABLE;
+                                    data.restoreUserDataInProgress = false;
+                                }
                                 sendFailure(statusReceiver, RollbackManager.STATUS_FAILURE_INSTALL,
                                         "Rollback downgrade install failed: "
                                         + result.getStringExtra(
@@ -453,9 +439,19 @@
                                 return;
                             }
 
-                            addRecentlyExecutedRollback(new RollbackInfo(
-                                        data.rollbackId, data.packages, data.isStaged(),
-                                        causePackages, parentSessionId));
+                            synchronized (mLock) {
+                                if (!data.isStaged()) {
+                                    // All calls to restoreUserData should have
+                                    // completed by now for a non-staged install.
+                                    data.restoreUserDataInProgress = false;
+                                }
+
+                                data.info.setCommittedSessionId(parentSessionId);
+                                data.info.getCausePackages().addAll(causePackages);
+                            }
+                            mRollbackStore.deletePackageCodePaths(data);
+                            saveRollbackData(data);
+
                             sendSuccess(statusReceiver);
 
                             Intent broadcast = new Intent(Intent.ACTION_ROLLBACK_COMMITTED);
@@ -469,7 +465,10 @@
                     }
             );
 
-            data.inProgress = true;
+            synchronized (mLock) {
+                data.state = RollbackData.ROLLBACK_STATE_COMMITTED;
+                data.restoreUserDataInProgress = true;
+            }
             parentSession.commit(receiver.getIntentSender());
         } catch (IOException e) {
             Log.e(TAG, "Rollback failed", e);
@@ -486,8 +485,7 @@
                 "reloadPersistedData");
 
         synchronized (mLock) {
-            mAvailableRollbacks = null;
-            mRecentlyExecutedRollbacks = null;
+            mRollbacks = null;
         }
         getHandler().post(() -> {
             updateRollbackLifetimeDurationInMillis();
@@ -500,17 +498,12 @@
         mContext.enforceCallingOrSelfPermission(
                 android.Manifest.permission.MANAGE_ROLLBACKS,
                 "expireRollbackForPackage");
-
-        // TODO: Should this take a package version number in addition to
-        // package name? For now, just remove all rollbacks matching the
-        // package name. This method is only currently used to facilitate
-        // testing anyway.
         synchronized (mLock) {
             ensureRollbackDataLoadedLocked();
-            Iterator<RollbackData> iter = mAvailableRollbacks.iterator();
+            Iterator<RollbackData> iter = mRollbacks.iterator();
             while (iter.hasNext()) {
                 RollbackData data = iter.next();
-                for (PackageRollbackInfo info : data.packages) {
+                for (PackageRollbackInfo info : data.info.getPackages()) {
                     if (info.getPackageName().equals(packageName)) {
                         iter.remove();
                         deleteRollback(data);
@@ -523,42 +516,26 @@
 
     void onUnlockUser(int userId) {
         getHandler().post(() -> {
-            final List<RollbackData> availableRollbacks;
-            final List<RollbackInfo> recentlyExecutedRollbacks;
+            final List<RollbackData> rollbacks;
             synchronized (mLock) {
-                ensureRollbackDataLoadedLocked();
-                availableRollbacks = new ArrayList<>(mAvailableRollbacks);
-                recentlyExecutedRollbacks = new ArrayList<>(mRecentlyExecutedRollbacks);
+                rollbacks = new ArrayList<>(mRollbacks);
             }
 
-            final List<RollbackData> changed =
-                    mAppDataRollbackHelper.commitPendingBackupAndRestoreForUser(userId,
-                            availableRollbacks, recentlyExecutedRollbacks);
+            final Set<RollbackData> changed =
+                    mAppDataRollbackHelper.commitPendingBackupAndRestoreForUser(userId, rollbacks);
 
             for (RollbackData rd : changed) {
-                try {
-                    mRollbackStore.saveAvailableRollback(rd);
-                } catch (IOException ioe) {
-                    Log.e(TAG, "Unable to save rollback info for : " + rd.rollbackId, ioe);
-                }
-            }
-
-            synchronized (mLock) {
-                mRollbackStore.saveRecentlyExecutedRollbacks(mRecentlyExecutedRollbacks);
+                saveRollbackData(rd);
             }
         });
     }
 
     private void updateRollbackLifetimeDurationInMillis() {
-        String strRollbackLifetimeInMillis = DeviceConfig.getProperty(
+        mRollbackLifetimeDurationInMillis = DeviceConfig.getLong(
                 DeviceConfig.Rollback.BOOT_NAMESPACE,
-                DeviceConfig.Rollback.ROLLBACK_LIFETIME_IN_MILLIS);
-
-        try {
-            mRollbackLifetimeDurationInMillis = (strRollbackLifetimeInMillis == null)
-                    ? DEFAULT_ROLLBACK_LIFETIME_DURATION_MILLIS
-                    : Long.parseLong(strRollbackLifetimeInMillis);
-        } catch (NumberFormatException e) {
+                DeviceConfig.Rollback.ROLLBACK_LIFETIME_IN_MILLIS,
+                DEFAULT_ROLLBACK_LIFETIME_DURATION_MILLIS);
+        if (mRollbackLifetimeDurationInMillis < 0) {
             mRollbackLifetimeDurationInMillis = DEFAULT_ROLLBACK_LIFETIME_DURATION_MILLIS;
         }
     }
@@ -569,42 +546,57 @@
         scheduleExpiration(0);
 
         getHandler().post(() -> {
-            // Check to see if any staged sessions with rollback enabled have
-            // been applied.
-            List<RollbackData> staged = new ArrayList<>();
+            // Check to see if any rollback-enabled staged sessions or staged
+            // rollback sessions been applied.
+            List<RollbackData> enabling = new ArrayList<>();
+            List<RollbackData> restoreInProgress = new ArrayList<>();
             synchronized (mLock) {
                 ensureRollbackDataLoadedLocked();
-                for (RollbackData data : mAvailableRollbacks) {
-                    if (data.stagedSessionId != -1) {
-                        staged.add(data);
+                for (RollbackData data : mRollbacks) {
+                    if (data.isStaged()) {
+                        if (data.state == RollbackData.ROLLBACK_STATE_ENABLING) {
+                            enabling.add(data);
+                        } else if (data.restoreUserDataInProgress) {
+                            restoreInProgress.add(data);
+                        }
                     }
                 }
             }
 
-            for (RollbackData data : staged) {
+            for (RollbackData data : enabling) {
                 PackageInstaller installer = mContext.getPackageManager().getPackageInstaller();
                 PackageInstaller.SessionInfo session = installer.getSessionInfo(
                         data.stagedSessionId);
+                // TODO: What if session is null?
                 if (session != null) {
                     if (session.isStagedSessionApplied()) {
-                        synchronized (mLock) {
-                            data.isAvailable = true;
-                        }
-                        try {
-                            mRollbackStore.saveAvailableRollback(data);
-                        } catch (IOException ioe) {
-                            Log.e(TAG, "Unable to save rollback info for : "
-                                    + data.rollbackId, ioe);
-                        }
+                        makeRollbackAvailable(data);
                     } else if (session.isStagedSessionFailed()) {
                         // TODO: Do we need to remove this from
-                        // mAvailableRollbacks, or is it okay to leave as
+                        // mRollbacks, or is it okay to leave as
                         // unavailable until the next reboot when it will go
                         // away on its own?
                         deleteRollback(data);
                     }
                 }
             }
+
+            for (RollbackData data : restoreInProgress) {
+                PackageInstaller installer = mContext.getPackageManager().getPackageInstaller();
+                PackageInstaller.SessionInfo session = installer.getSessionInfo(
+                        data.stagedSessionId);
+                // TODO: What if session is null?
+                if (session != null) {
+                    if (session.isStagedSessionApplied() || session.isStagedSessionFailed()) {
+                        synchronized (mLock) {
+                            data.restoreUserDataInProgress = false;
+                        }
+                        saveRollbackData(data);
+                    }
+                }
+            }
+
+            mPackageHealthObserver.onBootCompleted();
         });
     }
 
@@ -621,12 +613,11 @@
 
     /**
      * Load rollback data from storage if it has not already been loaded.
-     * After calling this function, mAvailableRollbacks and
-     * mRecentlyExecutedRollbacks will be non-null.
+     * After calling this function, mRollbacks will be non-null.
      */
     @GuardedBy("mLock")
     private void ensureRollbackDataLoadedLocked() {
-        if (mAvailableRollbacks == null) {
+        if (mRollbacks == null) {
             loadAllRollbackDataLocked();
         }
     }
@@ -639,14 +630,9 @@
      */
     @GuardedBy("mLock")
     private void loadAllRollbackDataLocked() {
-        mAvailableRollbacks = mRollbackStore.loadAvailableRollbacks();
-        for (RollbackData data : mAvailableRollbacks) {
-            mAllocatedRollbackIds.put(data.rollbackId, true);
-        }
-
-        mRecentlyExecutedRollbacks = mRollbackStore.loadRecentlyExecutedRollbacks();
-        for (RollbackInfo info : mRecentlyExecutedRollbacks) {
-            mAllocatedRollbackIds.put(info.getRollbackId(), true);
+        mRollbacks = mRollbackStore.loadAllRollbackData();
+        for (RollbackData data : mRollbacks) {
+            mAllocatedRollbackIds.put(data.info.getRollbackId(), true);
         }
     }
 
@@ -662,17 +648,21 @@
 
         synchronized (mLock) {
             ensureRollbackDataLoadedLocked();
-            Iterator<RollbackData> iter = mAvailableRollbacks.iterator();
+            Iterator<RollbackData> iter = mRollbacks.iterator();
             while (iter.hasNext()) {
                 RollbackData data = iter.next();
-                for (PackageRollbackInfo info : data.packages) {
-                    if (info.getPackageName().equals(packageName)
-                            && !packageVersionsEqual(
-                                        info.getVersionRolledBackFrom(),
-                                        installedVersion)) {
-                        iter.remove();
-                        deleteRollback(data);
-                        break;
+                // TODO: Should we remove rollbacks in the ENABLING state here?
+                if (data.state == RollbackData.ROLLBACK_STATE_AVAILABLE
+                        || data.state == RollbackData.ROLLBACK_STATE_ENABLING) {
+                    for (PackageRollbackInfo info : data.info.getPackages()) {
+                        if (info.getPackageName().equals(packageName)
+                                && !packageVersionsEqual(
+                                    info.getVersionRolledBackFrom(),
+                                    installedVersion)) {
+                            iter.remove();
+                            deleteRollback(data);
+                            break;
+                        }
                     }
                 }
             }
@@ -685,53 +675,6 @@
      */
     private void onPackageFullyRemoved(String packageName) {
         expireRollbackForPackage(packageName);
-
-        synchronized (mLock) {
-            ensureRollbackDataLoadedLocked();
-            Iterator<RollbackInfo> iter = mRecentlyExecutedRollbacks.iterator();
-            boolean changed = false;
-            while (iter.hasNext()) {
-                RollbackInfo rollback = iter.next();
-                for (PackageRollbackInfo info : rollback.getPackages()) {
-                    if (packageName.equals(info.getPackageName())) {
-                        iter.remove();
-                        changed = true;
-                        break;
-                    }
-                }
-            }
-
-            if (changed) {
-                mRollbackStore.saveRecentlyExecutedRollbacks(mRecentlyExecutedRollbacks);
-            }
-        }
-    }
-
-    /**
-     * Records that the given package has been recently rolled back.
-     */
-    private void addRecentlyExecutedRollback(RollbackInfo rollback) {
-        // TODO: if the list of rollbacks gets too big, trim it to only those
-        // that are necessary to keep track of.
-        synchronized (mLock) {
-            ensureRollbackDataLoadedLocked();
-
-            // This should never happen because we can't have any pending backups left after
-            // a rollback has been executed. See AppDataRollbackHelper#restoreAppData where we
-            // clear all pending backups at the point of restore because they're guaranteed to be
-            // no-ops.
-            //
-            // We may, however, have one or more pending restores left to handle.
-            for (PackageRollbackInfo target : rollback.getPackages()) {
-                if (target.getPendingBackups().size() > 0) {
-                    Log.e(TAG, "No backups allowed to be pending for: " + target);
-                    target.getPendingBackups().clear();
-                }
-            }
-
-            mRecentlyExecutedRollbacks.add(rollback);
-            mRollbackStore.saveRecentlyExecutedRollbacks(mRecentlyExecutedRollbacks);
-        }
     }
 
     /**
@@ -768,17 +711,16 @@
 
     // Check to see if anything needs expiration, and if so, expire it.
     // Schedules future expiration as appropriate.
-    // TODO: Handle cases where the user changes time on the device.
     private void runExpiration() {
         Instant now = Instant.now();
         Instant oldest = null;
         synchronized (mLock) {
             ensureRollbackDataLoadedLocked();
 
-            Iterator<RollbackData> iter = mAvailableRollbacks.iterator();
+            Iterator<RollbackData> iter = mRollbacks.iterator();
             while (iter.hasNext()) {
                 RollbackData data = iter.next();
-                if (!data.isAvailable) {
+                if (data.state != RollbackData.ROLLBACK_STATE_AVAILABLE) {
                     continue;
                 }
                 if (!now.isBefore(data.timestamp.plusMillis(mRollbackLifetimeDurationInMillis))) {
@@ -876,8 +818,8 @@
         RollbackData rd = null;
         synchronized (mLock) {
             ensureRollbackDataLoadedLocked();
-            for (int i = 0; i < mAvailableRollbacks.size(); ++i) {
-                RollbackData data = mAvailableRollbacks.get(i);
+            for (int i = 0; i < mRollbacks.size(); ++i) {
+                RollbackData data = mRollbacks.get(i);
                 if (data.apkSessionId == parentSessionId) {
                     rd = data;
                     break;
@@ -897,19 +839,11 @@
                 return false;
             }
             String packageName = newPackage.packageName;
-            for (PackageRollbackInfo info : rd.packages) {
+            for (PackageRollbackInfo info : rd.info.getPackages()) {
                 if (info.getPackageName().equals(packageName)) {
                     info.getInstalledUsers().addAll(IntArray.wrap(installedUsers));
-                    mAppDataRollbackHelper.snapshotAppData(rd.rollbackId, info);
-                    try {
-                        mRollbackStore.saveAvailableRollback(rd);
-                    } catch (IOException ioe) {
-                        // TODO: Hopefully this is okay because we will try
-                        // again to save the rollback when the staged session
-                        // is applied. Just so long as the device doesn't
-                        // reboot before then.
-                        Log.e(TAG, "Unable to save rollback info for : " + rd.rollbackId, ioe);
-                    }
+                    mAppDataRollbackHelper.snapshotAppData(rd.info.getRollbackId(), info);
+                    saveRollbackData(rd);
                     return true;
                 }
             }
@@ -989,14 +923,13 @@
                 if (data == null) {
                     int rollbackId = allocateRollbackIdLocked();
                     if (session.isStaged()) {
-                        data = mRollbackStore.createPendingStagedRollback(rollbackId,
-                            parentSessionId);
+                        data = mRollbackStore.createStagedRollback(rollbackId, parentSessionId);
                     } else {
-                        data = mRollbackStore.createAvailableRollback(rollbackId);
+                        data = mRollbackStore.createNonStagedRollback(rollbackId);
                     }
                     mPendingRollbacks.put(parentSessionId, data);
                 }
-                data.packages.add(info);
+                data.info.getPackages().add(info);
             }
         } catch (IOException e) {
             Log.e(TAG, "Unable to create rollback for " + packageName, e);
@@ -1004,7 +937,7 @@
         }
 
         if (snapshotUserData && !isApex) {
-            mAppDataRollbackHelper.snapshotAppData(data.rollbackId, info);
+            mAppDataRollbackHelper.snapshotAppData(data.info.getRollbackId(), info);
         }
 
         try {
@@ -1039,32 +972,33 @@
 
     private void restoreUserDataInternal(String packageName, int[] userIds, int appId,
             long ceDataInode, String seInfo, int token) {
-        final RollbackData rollbackData = getRollbackForPackage(packageName);
+        PackageRollbackInfo info = null;
+        RollbackData rollbackData = null;
+        synchronized (mLock) {
+            ensureRollbackDataLoadedLocked();
+            for (int i = 0; i < mRollbacks.size(); ++i) {
+                RollbackData data = mRollbacks.get(i);
+                if (data.restoreUserDataInProgress) {
+                    info = getPackageRollbackInfo(data, packageName);
+                    if (info != null) {
+                        rollbackData = data;
+                        break;
+                    }
+                }
+            }
+        }
+
         if (rollbackData == null) {
             return;
         }
 
-        if (!rollbackData.inProgress) {
-            Log.e(TAG, "Request to restore userData for: " + packageName
-                    + ", but no rollback in progress.");
-            return;
-        }
-
         for (int userId : userIds) {
-            final PackageRollbackInfo info = getPackageRollbackInfo(rollbackData, packageName);
             final boolean changedRollbackData = mAppDataRollbackHelper.restoreAppData(
-                    rollbackData.rollbackId, info, userId, appId, seInfo);
+                    rollbackData.info.getRollbackId(), info, userId, appId, seInfo);
 
             // We've updated metadata about this rollback, so save it to flash.
             if (changedRollbackData) {
-                try {
-                    mRollbackStore.saveAvailableRollback(rollbackData);
-                } catch (IOException ioe) {
-                    // TODO(narayan): What is the right thing to do here ? This isn't a fatal
-                    // error, since it will only result in us trying to restore data again,
-                    // which will be a no-op if there's no data available.
-                    Log.e(TAG, "Unable to save available rollback: " + packageName, ioe);
-                }
+                saveRollbackData(rollbackData);
             }
         }
     }
@@ -1108,6 +1042,7 @@
                 }
             }
 
+            completeEnableRollback(sessionId, true);
             result.offer(true);
         });
 
@@ -1125,8 +1060,8 @@
             RollbackData rd = null;
             synchronized (mLock) {
                 ensureRollbackDataLoadedLocked();
-                for (int i = 0; i < mAvailableRollbacks.size(); ++i) {
-                    RollbackData data = mAvailableRollbacks.get(i);
+                for (int i = 0; i < mRollbacks.size(); ++i) {
+                    RollbackData data = mRollbacks.get(i);
                     if (data.stagedSessionId == originalSessionId) {
                         data.apkSessionId = apkSessionId;
                         rd = data;
@@ -1136,11 +1071,7 @@
             }
 
             if (rd != null) {
-                try {
-                    mRollbackStore.saveAvailableRollback(rd);
-                } catch (IOException ioe) {
-                    Log.e(TAG, "Unable to save rollback info for : " + rd.rollbackId, ioe);
-                }
+                saveRollbackData(rd);
             }
         });
     }
@@ -1182,21 +1113,21 @@
 
         @Override
         public void onFinished(int sessionId, boolean success) {
-            // If sessionId refers to a staged session, we can't deal with it here since the
-            // session might take an unbounded amount of time to become "ready" after the package
-            // installer session is committed. In those cases, we respond to it in response to
-            // a session ready broadcast.
-            PackageInstaller packageInstaller = mContext.getPackageManager().getPackageInstaller();
-            PackageInstaller.SessionInfo si = packageInstaller.getSessionInfo(sessionId);
-            if (si != null && si.isStaged()) {
-                return;
+            RollbackData rollback = completeEnableRollback(sessionId, success);
+            if (rollback != null && !rollback.isStaged()) {
+                makeRollbackAvailable(rollback);
             }
-
-            completeEnableRollback(sessionId, success);
         }
     }
 
-    private void completeEnableRollback(int sessionId, boolean success) {
+    /**
+     * Add a rollback to the list of rollbacks.
+     * This should be called after rollback has been enabled for all packages
+     * in the rollback. It does not make the rollback available yet.
+     *
+     * @return the rollback data for a successfully enable-completed rollback.
+     */
+    private RollbackData completeEnableRollback(int sessionId, boolean success) {
         RollbackData data = null;
         synchronized (mLock) {
             Integer parentSessionId = mChildSessions.remove(sessionId);
@@ -1207,107 +1138,71 @@
             data = mPendingRollbacks.remove(sessionId);
         }
 
-        if (data != null) {
-            if (success) {
-                try {
-                    data.timestamp = Instant.now();
-
-                    mRollbackStore.saveAvailableRollback(data);
-                    synchronized (mLock) {
-                        // Note: There is a small window of time between when
-                        // the session has been committed by the package
-                        // manager and when we make the rollback available
-                        // here. Presumably the window is small enough that
-                        // nobody will want to roll back the newly installed
-                        // package before we make the rollback available.
-                        // TODO: We'll lose the rollback data if the
-                        // device reboots between when the session is
-                        // committed and this point. Revisit this after
-                        // adding support for rollback of staged installs.
-                        ensureRollbackDataLoadedLocked();
-                        mAvailableRollbacks.add(data);
-                    }
-                    // TODO(zezeozue): Provide API to explicitly start observing instead
-                    // of doing this for all rollbacks. If we do this for all rollbacks,
-                    // should document in PackageInstaller.SessionParams#setEnableRollback
-                    // After enabling and commiting any rollback, observe packages and
-                    // prepare to rollback if packages crashes too frequently.
-                    List<String> packages = new ArrayList<>();
-                    for (int i = 0; i < data.packages.size(); i++) {
-                        packages.add(data.packages.get(i).getPackageName());
-                    }
-                    mPackageHealthObserver.startObservingHealth(packages,
-                            mRollbackLifetimeDurationInMillis);
-                    scheduleExpiration(mRollbackLifetimeDurationInMillis);
-                } catch (IOException e) {
-                    Log.e(TAG, "Unable to enable rollback", e);
-                    deleteRollback(data);
-                }
-            } else {
-                // The install session was aborted, clean up the pending
-                // install.
-                deleteRollback(data);
-            }
-        }
-    }
-
-    private void onStagedSessionUpdated(Intent intent) {
-        PackageInstaller.SessionInfo pi = intent.getParcelableExtra(PackageInstaller.EXTRA_SESSION);
-        if (pi == null) {
-            Log.e(TAG, "Missing intent extra: " + PackageInstaller.EXTRA_SESSION);
-            return;
+        if (data == null) {
+            return null;
         }
 
-        if (pi.isStaged()) {
-            if (!pi.isStagedSessionFailed()) {
-                // TODO: The session really isn't "enabled" at this point, since more work might
-                // be required post reboot.
-                // TODO: We need to make this case consistent with the call from onFinished.
-                //  Ideally, we'd call completeEnableRollback excatly once per multi-package session
-                //  with the parentSessionId only.
-                completeEnableRollback(pi.sessionId, pi.isStagedSessionReady());
-            } else {
-                // TODO: Clean up the saved rollback when the session fails. This may need to be
-                // unified with the case where things fail post reboot.
-            }
-        } else {
-            Log.e(TAG, "Received onStagedSessionUpdated for: " + pi.sessionId
-                    + ", which isn't staged");
+        if (!success) {
+            // The install session was aborted, clean up the pending install.
+            deleteRollback(data);
+            return null;
         }
-    }
 
-    /*
-     * Returns the RollbackData, if any, for an available rollback that would
-     * roll back the given package. Note: This assumes we have at most one
-     * available rollback for a given package at any one time.
-     */
-    private RollbackData getRollbackForPackage(String packageName) {
+        saveRollbackData(data);
         synchronized (mLock) {
-            // TODO: Have ensureRollbackDataLoadedLocked return the list of
-            // available rollbacks, to hopefully avoid forgetting to call it?
+            // Note: There is a small window of time between when
+            // the session has been committed by the package
+            // manager and when we make the rollback available
+            // here. Presumably the window is small enough that
+            // nobody will want to roll back the newly installed
+            // package before we make the rollback available.
+            // TODO: We'll lose the rollback data if the
+            // device reboots between when the session is
+            // committed and this point. Revisit this after
+            // adding support for rollback of staged installs.
             ensureRollbackDataLoadedLocked();
-            for (int i = 0; i < mAvailableRollbacks.size(); ++i) {
-                RollbackData data = mAvailableRollbacks.get(i);
-                if (data.isAvailable && getPackageRollbackInfo(data, packageName) != null) {
-                    return data;
-                }
-            }
+            mRollbacks.add(data);
         }
-        return null;
+
+        return data;
+    }
+
+    private void makeRollbackAvailable(RollbackData data) {
+        // TODO: What if the rollback has since been expired, for example due
+        // to a new package being installed. Won't this revive an expired
+        // rollback? Consider adding a ROLLBACK_STATE_EXPIRED to address this.
+        synchronized (mLock) {
+            data.state = RollbackData.ROLLBACK_STATE_AVAILABLE;
+            data.timestamp = Instant.now();
+        }
+        saveRollbackData(data);
+
+        // TODO(zezeozue): Provide API to explicitly start observing instead
+        // of doing this for all rollbacks. If we do this for all rollbacks,
+        // should document in PackageInstaller.SessionParams#setEnableRollback
+        // After enabling and commiting any rollback, observe packages and
+        // prepare to rollback if packages crashes too frequently.
+        List<String> packages = new ArrayList<>();
+        for (int i = 0; i < data.info.getPackages().size(); i++) {
+            packages.add(data.info.getPackages().get(i).getPackageName());
+        }
+        mPackageHealthObserver.startObservingHealth(packages,
+                mRollbackLifetimeDurationInMillis);
+        scheduleExpiration(mRollbackLifetimeDurationInMillis);
     }
 
     /*
-     * Returns the RollbackData, if any, for an available rollback with the
-     * given rollbackId.
+     * Returns the RollbackData, if any, for a rollback with the given
+     * rollbackId.
      */
     private RollbackData getRollbackForId(int rollbackId) {
         synchronized (mLock) {
             // TODO: Have ensureRollbackDataLoadedLocked return the list of
             // available rollbacks, to hopefully avoid forgetting to call it?
             ensureRollbackDataLoadedLocked();
-            for (int i = 0; i < mAvailableRollbacks.size(); ++i) {
-                RollbackData data = mAvailableRollbacks.get(i);
-                if (data.isAvailable && data.rollbackId == rollbackId) {
+            for (int i = 0; i < mRollbacks.size(); ++i) {
+                RollbackData data = mRollbacks.get(i);
+                if (data.info.getRollbackId() == rollbackId) {
                     return data;
                 }
             }
@@ -1322,7 +1217,7 @@
      */
     private static PackageRollbackInfo getPackageRollbackInfo(RollbackData data,
             String packageName) {
-        for (PackageRollbackInfo info : data.packages) {
+        for (PackageRollbackInfo info : data.info.getPackages()) {
             if (info.getPackageName().equals(packageName)) {
                 return info;
             }
@@ -1347,14 +1242,29 @@
     }
 
     private void deleteRollback(RollbackData rollbackData) {
-        for (PackageRollbackInfo info : rollbackData.packages) {
+        for (PackageRollbackInfo info : rollbackData.info.getPackages()) {
             IntArray installedUsers = info.getInstalledUsers();
             for (int i = 0; i < installedUsers.size(); i++) {
                 int userId = installedUsers.get(i);
-                mAppDataRollbackHelper.destroyAppDataSnapshot(rollbackData.rollbackId, info,
-                        userId);
+                mAppDataRollbackHelper.destroyAppDataSnapshot(rollbackData.info.getRollbackId(),
+                        info, userId);
             }
         }
-        mRollbackStore.deleteAvailableRollback(rollbackData);
+        mRollbackStore.deleteRollbackData(rollbackData);
+    }
+
+    /**
+     * Saves rollback data, swallowing any IOExceptions.
+     * For those times when it's not obvious what to do about the IOException.
+     * TODO: Double check we can't do a better job handling the IOException in
+     * a cases where this method is called.
+     */
+    private void saveRollbackData(RollbackData rollbackData) {
+        try {
+            mRollbackStore.saveRollbackData(rollbackData);
+        } catch (IOException ioe) {
+            Log.e(TAG, "Unable to save rollback info for: "
+                    + rollbackData.info.getRollbackId(), ioe);
+        }
     }
 }
diff --git a/services/core/java/com/android/server/rollback/RollbackPackageHealthObserver.java b/services/core/java/com/android/server/rollback/RollbackPackageHealthObserver.java
index d24f217..9348806 100644
--- a/services/core/java/com/android/server/rollback/RollbackPackageHealthObserver.java
+++ b/services/core/java/com/android/server/rollback/RollbackPackageHealthObserver.java
@@ -26,6 +26,8 @@
 import android.content.rollback.PackageRollbackInfo;
 import android.content.rollback.RollbackInfo;
 import android.content.rollback.RollbackManager;
+import android.os.Environment;
+import android.os.FileUtils;
 import android.os.Handler;
 import android.os.HandlerThread;
 import android.os.PowerManager;
@@ -39,6 +41,12 @@
 import com.android.server.PackageWatchdog.PackageHealthObserver;
 import com.android.server.PackageWatchdog.PackageHealthObserverImpact;
 
+import libcore.io.IoUtils;
+
+import java.io.File;
+import java.io.FileOutputStream;
+import java.io.IOException;
+import java.io.PrintWriter;
 import java.util.Collections;
 import java.util.List;
 
@@ -50,14 +58,19 @@
 public final class RollbackPackageHealthObserver implements PackageHealthObserver {
     private static final String TAG = "RollbackPackageHealthObserver";
     private static final String NAME = "rollback-observer";
-    private Context mContext;
-    private Handler mHandler;
+    private static final int INVALID_ROLLBACK_ID = -1;
+    private final Context mContext;
+    private final Handler mHandler;
+    private final File mLastStagedRollbackIdFile;
 
     RollbackPackageHealthObserver(Context context) {
         mContext = context;
         HandlerThread handlerThread = new HandlerThread("RollbackPackageHealthObserver");
         handlerThread.start();
         mHandler = handlerThread.getThreadHandler();
+        File dataDir = new File(Environment.getDataDirectory(), "rollback-observer");
+        dataDir.mkdirs();
+        mLastStagedRollbackIdFile = new File(dataDir, "last-staged-rollback-id");
         PackageWatchdog.getInstance(mContext).registerHealthObserver(this);
     }
 
@@ -112,15 +125,19 @@
                 int status = result.getIntExtra(RollbackManager.EXTRA_STATUS,
                         RollbackManager.STATUS_FAILURE);
                 if (status == RollbackManager.STATUS_SUCCESS) {
-                    StatsLog.write(StatsLog.WATCHDOG_ROLLBACK_OCCURRED,
-                            StatsLog.WATCHDOG_ROLLBACK_OCCURRED__ROLLBACK_TYPE__ROLLBACK_SUCCESS,
-                            moduleMetadataPackage.getPackageName(),
-                            moduleMetadataPackage.getVersionCode());
                     if (rollback.isStaged()) {
                         int rollbackId = rollback.getRollbackId();
                         BroadcastReceiver listener =
-                                listenForStagedSessionReady(rollbackManager, rollbackId);
-                        handleStagedSessionChange(rollbackManager, rollbackId, listener);
+                                listenForStagedSessionReady(rollbackManager, rollbackId,
+                                        moduleMetadataPackage);
+                        handleStagedSessionChange(rollbackManager, rollbackId, listener,
+                                moduleMetadataPackage);
+                    } else {
+                        StatsLog.write(StatsLog.WATCHDOG_ROLLBACK_OCCURRED,
+                                StatsLog
+                                .WATCHDOG_ROLLBACK_OCCURRED__ROLLBACK_TYPE__ROLLBACK_SUCCESS,
+                                moduleMetadataPackage.getPackageName(),
+                                moduleMetadataPackage.getVersionCode());
                     }
                 } else {
                     StatsLog.write(StatsLog.WATCHDOG_ROLLBACK_OCCURRED,
@@ -149,7 +166,73 @@
      * This may cause {@code packages} to be rolled back if they crash too freqeuntly.
      */
     public void startObservingHealth(List<String> packages, long durationMs) {
-        PackageWatchdog.getInstance(mContext).startObservingHealth(this, packages, durationMs);
+        PackageWatchdog.getInstance(mContext).startObservingHealth(this, packages, durationMs,
+                false /* withExplicitHealthCheck */);
+    }
+
+    /** Verifies the rollback state after a reboot. */
+    public void onBootCompleted() {
+        int rollbackId = popLastStagedRollbackId();
+        if (rollbackId == INVALID_ROLLBACK_ID) {
+            // No staged rollback before reboot
+            return;
+        }
+
+        RollbackManager rollbackManager = mContext.getSystemService(RollbackManager.class);
+        PackageInstaller packageInstaller = mContext.getPackageManager().getPackageInstaller();
+        RollbackInfo rollback = null;
+        for (RollbackInfo info : rollbackManager.getRecentlyCommittedRollbacks()) {
+            if (rollbackId == info.getRollbackId()) {
+                rollback = info;
+                break;
+            }
+        }
+
+        if (rollback == null) {
+            Slog.e(TAG, "rollback info not found for last staged rollback: " + rollbackId);
+            return;
+        }
+
+        String moduleMetadataPackageName = getModuleMetadataPackageName();
+        if (moduleMetadataPackageName == null) {
+            // Only log mainline staged rollbacks
+            return;
+        }
+
+        // Use the version of the metadata package that was installed before
+        // we rolled back for logging purposes.
+        VersionedPackage moduleMetadataPackage = null;
+        for (PackageRollbackInfo packageRollback : rollback.getPackages()) {
+            if (moduleMetadataPackageName.equals(packageRollback.getPackageName())) {
+                moduleMetadataPackage = packageRollback.getVersionRolledBackFrom();
+                break;
+            }
+        }
+
+        if (moduleMetadataPackage == null) {
+            // Only log mainline staged rollbacks
+            return;
+        }
+
+        int sessionId = rollback.getCommittedSessionId();
+        PackageInstaller.SessionInfo sessionInfo = packageInstaller.getSessionInfo(sessionId);
+        if (sessionInfo == null) {
+            Slog.e(TAG, "On boot completed, could not load session id " + sessionId);
+            return;
+        }
+        if (sessionInfo.isStagedSessionApplied()) {
+            StatsLog.write(StatsLog.WATCHDOG_ROLLBACK_OCCURRED,
+                    StatsLog.WATCHDOG_ROLLBACK_OCCURRED__ROLLBACK_TYPE__ROLLBACK_SUCCESS,
+                    moduleMetadataPackage.getPackageName(),
+                    moduleMetadataPackage.getVersionCode());
+        } else if (sessionInfo.isStagedSessionReady()) {
+            // TODO: What do for staged session ready but not applied
+        } else {
+            StatsLog.write(StatsLog.WATCHDOG_ROLLBACK_OCCURRED,
+                    StatsLog.WATCHDOG_ROLLBACK_OCCURRED__ROLLBACK_TYPE__ROLLBACK_FAILURE,
+                    moduleMetadataPackage.getPackageName(),
+                    moduleMetadataPackage.getVersionCode());
+        }
     }
 
     private Pair<RollbackInfo, Boolean> getAvailableRollback(RollbackManager rollbackManager,
@@ -174,12 +257,20 @@
         return null;
     }
 
-    private VersionedPackage getModuleMetadataPackage() {
+    private String getModuleMetadataPackageName() {
         String packageName = mContext.getResources().getString(
                 R.string.config_defaultModuleMetadataProvider);
         if (TextUtils.isEmpty(packageName)) {
             return null;
         }
+        return packageName;
+    }
+
+    private VersionedPackage getModuleMetadataPackage() {
+        String packageName = getModuleMetadataPackageName();
+        if (packageName == null) {
+            return null;
+        }
 
         try {
             return new VersionedPackage(packageName, mContext.getPackageManager().getPackageInfo(
@@ -191,12 +282,12 @@
     }
 
     private BroadcastReceiver listenForStagedSessionReady(RollbackManager rollbackManager,
-            int rollbackId) {
+            int rollbackId, VersionedPackage moduleMetadataPackage) {
         BroadcastReceiver sessionUpdatedReceiver = new BroadcastReceiver() {
             @Override
             public void onReceive(Context context, Intent intent) {
                 handleStagedSessionChange(rollbackManager,
-                        rollbackId, this /* BroadcastReceiver */);
+                        rollbackId, this /* BroadcastReceiver */, moduleMetadataPackage);
             }
         };
         IntentFilter sessionUpdatedFilter =
@@ -206,7 +297,7 @@
     }
 
     private void handleStagedSessionChange(RollbackManager rollbackManager, int rollbackId,
-            BroadcastReceiver listener) {
+            BroadcastReceiver listener, VersionedPackage moduleMetadataPackage) {
         PackageInstaller packageInstaller =
                 mContext.getPackageManager().getPackageInstaller();
         List<RollbackInfo> recentRollbacks =
@@ -220,11 +311,52 @@
                         packageInstaller.getSessionInfo(sessionId);
                 if (sessionInfo.isStagedSessionReady()) {
                     mContext.unregisterReceiver(listener);
+                    saveLastStagedRollbackId(rollbackId);
+                    StatsLog.write(StatsLog.WATCHDOG_ROLLBACK_OCCURRED,
+                            StatsLog
+                            .WATCHDOG_ROLLBACK_OCCURRED__ROLLBACK_TYPE__ROLLBACK_BOOT_TRIGGERED,
+                            moduleMetadataPackage.getPackageName(),
+                            moduleMetadataPackage.getVersionCode());
                     mContext.getSystemService(PowerManager.class).reboot("Rollback staged install");
                 } else if (sessionInfo.isStagedSessionFailed()) {
+                    StatsLog.write(StatsLog.WATCHDOG_ROLLBACK_OCCURRED,
+                            StatsLog
+                            .WATCHDOG_ROLLBACK_OCCURRED__ROLLBACK_TYPE__ROLLBACK_FAILURE,
+                            moduleMetadataPackage.getPackageName(),
+                            moduleMetadataPackage.getVersionCode());
                     mContext.unregisterReceiver(listener);
                 }
             }
         }
     }
+
+    private void saveLastStagedRollbackId(int stagedRollbackId) {
+        try {
+            FileOutputStream fos = new FileOutputStream(mLastStagedRollbackIdFile);
+            PrintWriter pw = new PrintWriter(fos);
+            pw.println(stagedRollbackId);
+            pw.flush();
+            FileUtils.sync(fos);
+            pw.close();
+        } catch (IOException e) {
+            Slog.e(TAG, "Failed to save last staged rollback id", e);
+            mLastStagedRollbackIdFile.delete();
+        }
+    }
+
+    private int popLastStagedRollbackId() {
+        int rollbackId = INVALID_ROLLBACK_ID;
+        if (!mLastStagedRollbackIdFile.exists()) {
+            return rollbackId;
+        }
+
+        try {
+            rollbackId = Integer.parseInt(
+                    IoUtils.readFileAsString(mLastStagedRollbackIdFile.getAbsolutePath()).trim());
+        } catch (IOException | NumberFormatException e) {
+            Slog.e(TAG, "Failed to retrieve last staged rollback id", e);
+        }
+        mLastStagedRollbackIdFile.delete();
+        return rollbackId;
+    }
 }
diff --git a/services/core/java/com/android/server/rollback/RollbackStore.java b/services/core/java/com/android/server/rollback/RollbackStore.java
index bb4e89e..4f8f685 100644
--- a/services/core/java/com/android/server/rollback/RollbackStore.java
+++ b/services/core/java/com/android/server/rollback/RollbackStore.java
@@ -35,6 +35,7 @@
 import java.io.IOException;
 import java.io.PrintWriter;
 import java.nio.file.Files;
+import java.text.ParseException;
 import java.time.Instant;
 import java.time.format.DateTimeParseException;
 import java.util.ArrayList;
@@ -47,60 +48,44 @@
     private static final String TAG = "RollbackManager";
 
     // Assuming the rollback data directory is /data/rollback, we use the
-    // following directory structure to store persisted data for available and
-    // recently executed rollbacks:
+    // following directory structure to store persisted data for rollbacks:
     //   /data/rollback/
-    //      available/
-    //          XXX/
-    //              rollback.json
-    //              com.package.A/
-    //                  base.apk
-    //              com.package.B/
-    //                  base.apk
-    //          YYY/
-    //              rollback.json
-    //              com.package.C/
-    //                  base.apk
-    //      recently_executed.json
+    //       XXX/
+    //           rollback.json
+    //           com.package.A/
+    //               base.apk
+    //           com.package.B/
+    //               base.apk
+    //       YYY/
+    //           rollback.json
     //
     // * XXX, YYY are the rollbackIds for the corresponding rollbacks.
-    // * rollback.json contains all relevant metadata for the rollback. This
-    //   file is not written until the rollback is made available.
+    // * rollback.json contains all relevant metadata for the rollback.
     //
     // TODO: Use AtomicFile for all the .json files?
     private final File mRollbackDataDir;
-    private final File mAvailableRollbacksDir;
-    private final File mRecentlyExecutedRollbacksFile;
 
     RollbackStore(File rollbackDataDir) {
         mRollbackDataDir = rollbackDataDir;
-        mAvailableRollbacksDir = new File(mRollbackDataDir, "available");
-        mRecentlyExecutedRollbacksFile = new File(mRollbackDataDir, "recently_executed.json");
     }
 
     /**
-     * Reads the list of available rollbacks from persistent storage.
+     * Reads the rollback data from persistent storage.
      */
-    List<RollbackData> loadAvailableRollbacks() {
-        List<RollbackData> availableRollbacks = new ArrayList<>();
-        mAvailableRollbacksDir.mkdirs();
-        for (File rollbackDir : mAvailableRollbacksDir.listFiles()) {
+    List<RollbackData> loadAllRollbackData() {
+        List<RollbackData> rollbacks = new ArrayList<>();
+        mRollbackDataDir.mkdirs();
+        for (File rollbackDir : mRollbackDataDir.listFiles()) {
             if (rollbackDir.isDirectory()) {
                 try {
-                    RollbackData data = loadRollbackData(rollbackDir);
-                    availableRollbacks.add(data);
+                    rollbacks.add(loadRollbackData(rollbackDir));
                 } catch (IOException e) {
-                    // Note: Deleting the rollbackDir here will cause pending
-                    // rollbacks to be deleted. This should only ever happen
-                    // if reloadPersistedData is called while there are
-                    // pending rollbacks. The reloadPersistedData method is
-                    // currently only for testing, so that should be okay.
                     Log.e(TAG, "Unable to read rollback data at " + rollbackDir, e);
                     removeFile(rollbackDir);
                 }
             }
         }
-        return availableRollbacks;
+        return rollbacks;
     }
 
     /**
@@ -183,54 +168,42 @@
         return ceSnapshotInodes;
     }
 
-    /**
-     * Reads the list of recently executed rollbacks from persistent storage.
-     */
-    List<RollbackInfo> loadRecentlyExecutedRollbacks() {
-        List<RollbackInfo> recentlyExecutedRollbacks = new ArrayList<>();
-        if (mRecentlyExecutedRollbacksFile.exists()) {
-            try {
-                // TODO: How to cope with changes to the format of this file from
-                // when RollbackStore is updated in the future?
-                String jsonString = IoUtils.readFileAsString(
-                        mRecentlyExecutedRollbacksFile.getAbsolutePath());
-                JSONObject object = new JSONObject(jsonString);
-                JSONArray array = object.getJSONArray("recentlyExecuted");
-                for (int i = 0; i < array.length(); ++i) {
-                    JSONObject element = array.getJSONObject(i);
-                    int rollbackId = element.getInt("rollbackId");
-                    List<PackageRollbackInfo> packages = packageRollbackInfosFromJson(
-                            element.getJSONArray("packages"));
-                    boolean isStaged = element.getBoolean("isStaged");
-                    List<VersionedPackage> causePackages = versionedPackagesFromJson(
-                            element.getJSONArray("causePackages"));
-                    int committedSessionId = element.getInt("committedSessionId");
-                    RollbackInfo rollback = new RollbackInfo(rollbackId, packages, isStaged,
-                            causePackages, committedSessionId);
-                    recentlyExecutedRollbacks.add(rollback);
-                }
-            } catch (IOException | JSONException e) {
-                // TODO: What to do here? Surely we shouldn't just forget about
-                // everything after the point of exception?
-                Log.e(TAG, "Failed to read recently executed rollbacks", e);
-            }
-        }
+    private static JSONObject rollbackInfoToJson(RollbackInfo rollback) throws JSONException {
+        JSONObject json = new JSONObject();
+        json.put("rollbackId", rollback.getRollbackId());
+        json.put("packages", toJson(rollback.getPackages()));
+        json.put("isStaged", rollback.isStaged());
+        json.put("causePackages", versionedPackagesToJson(rollback.getCausePackages()));
+        json.put("committedSessionId", rollback.getCommittedSessionId());
+        return json;
+    }
 
-        return recentlyExecutedRollbacks;
+    private static RollbackInfo rollbackInfoFromJson(JSONObject json) throws JSONException {
+        return new RollbackInfo(
+                json.getInt("rollbackId"),
+                packageRollbackInfosFromJson(json.getJSONArray("packages")),
+                json.getBoolean("isStaged"),
+                versionedPackagesFromJson(json.getJSONArray("causePackages")),
+                json.getInt("committedSessionId"));
     }
 
     /**
-     * Creates a new RollbackData instance with backupDir assigned.
+     * Creates a new RollbackData instance for a non-staged rollback with
+     * backupDir assigned.
      */
-    RollbackData createAvailableRollback(int rollbackId) throws IOException {
-        File backupDir = new File(mAvailableRollbacksDir, Integer.toString(rollbackId));
-        return new RollbackData(rollbackId, backupDir, -1, true);
+    RollbackData createNonStagedRollback(int rollbackId) throws IOException {
+        File backupDir = new File(mRollbackDataDir, Integer.toString(rollbackId));
+        return new RollbackData(rollbackId, backupDir, -1);
     }
 
-    RollbackData createPendingStagedRollback(int rollbackId, int stagedSessionId)
+    /**
+     * Creates a new RollbackData instance for a staged rollback with
+     * backupDir assigned.
+     */
+    RollbackData createStagedRollback(int rollbackId, int stagedSessionId)
             throws IOException {
-        File backupDir = new File(mAvailableRollbacksDir, Integer.toString(rollbackId));
-        return new RollbackData(rollbackId, backupDir, stagedSessionId, false);
+        File backupDir = new File(mRollbackDataDir, Integer.toString(rollbackId));
+        return new RollbackData(rollbackId, backupDir, stagedSessionId);
     }
 
     /**
@@ -263,17 +236,28 @@
     }
 
     /**
-     * Writes the metadata for an available rollback to persistent storage.
+     * Deletes all backed up apks and apex files associated with the given
+     * rollback.
      */
-    void saveAvailableRollback(RollbackData data) throws IOException {
+    static void deletePackageCodePaths(RollbackData data) {
+        for (PackageRollbackInfo info : data.info.getPackages()) {
+            File targetDir = new File(data.backupDir, info.getPackageName());
+            removeFile(targetDir);
+        }
+    }
+
+    /**
+     * Saves the rollback data to persistent storage.
+     */
+    void saveRollbackData(RollbackData data) throws IOException {
         try {
             JSONObject dataJson = new JSONObject();
-            dataJson.put("rollbackId", data.rollbackId);
-            dataJson.put("packages", toJson(data.packages));
+            dataJson.put("info", rollbackInfoToJson(data.info));
             dataJson.put("timestamp", data.timestamp.toString());
             dataJson.put("stagedSessionId", data.stagedSessionId);
-            dataJson.put("isAvailable", data.isAvailable);
+            dataJson.put("state", rollbackStateToString(data.state));
             dataJson.put("apkSessionId", data.apkSessionId);
+            dataJson.put("restoreUserDataInProgress", data.restoreUserDataInProgress);
 
             PrintWriter pw = new PrintWriter(new File(data.backupDir, "rollback.json"));
             pw.println(dataJson.toString());
@@ -284,80 +268,49 @@
     }
 
     /**
-     * Removes all persistant storage associated with the given available
-     * rollback.
+     * Removes all persistant storage associated with the given rollback data.
      */
-    void deleteAvailableRollback(RollbackData data) {
+    void deleteRollbackData(RollbackData data) {
         removeFile(data.backupDir);
     }
 
     /**
-     * Writes the list of recently executed rollbacks to storage.
-     */
-    void saveRecentlyExecutedRollbacks(List<RollbackInfo> recentlyExecutedRollbacks) {
-        try {
-            JSONObject json = new JSONObject();
-            JSONArray array = new JSONArray();
-            json.put("recentlyExecuted", array);
-
-            for (int i = 0; i < recentlyExecutedRollbacks.size(); ++i) {
-                RollbackInfo rollback = recentlyExecutedRollbacks.get(i);
-                JSONObject element = new JSONObject();
-                element.put("rollbackId", rollback.getRollbackId());
-                element.put("packages", toJson(rollback.getPackages()));
-                element.put("isStaged", rollback.isStaged());
-                element.put("causePackages", versionedPackagesToJson(rollback.getCausePackages()));
-                element.put("committedSessionId", rollback.getCommittedSessionId());
-                array.put(element);
-            }
-
-            PrintWriter pw = new PrintWriter(mRecentlyExecutedRollbacksFile);
-            pw.println(json.toString());
-            pw.close();
-        } catch (IOException | JSONException e) {
-            // TODO: What to do here?
-            Log.e(TAG, "Failed to save recently executed rollbacks", e);
-        }
-    }
-
-    /**
      * Reads the metadata for a rollback from the given directory.
      * @throws IOException in case of error reading the data.
      */
-    private RollbackData loadRollbackData(File backupDir) throws IOException {
+    private static RollbackData loadRollbackData(File backupDir) throws IOException {
         try {
             File rollbackJsonFile = new File(backupDir, "rollback.json");
             JSONObject dataJson = new JSONObject(
                     IoUtils.readFileAsString(rollbackJsonFile.getAbsolutePath()));
 
-            int rollbackId = dataJson.getInt("rollbackId");
-            int stagedSessionId = dataJson.getInt("stagedSessionId");
-            boolean isAvailable = dataJson.getBoolean("isAvailable");
-            RollbackData data = new RollbackData(rollbackId, backupDir,
-                    stagedSessionId, isAvailable);
-            data.packages.addAll(packageRollbackInfosFromJson(dataJson.getJSONArray("packages")));
-            data.timestamp = Instant.parse(dataJson.getString("timestamp"));
-            data.apkSessionId = dataJson.getInt("apkSessionId");
-            return data;
-        } catch (JSONException | DateTimeParseException e) {
+            return new RollbackData(
+                    rollbackInfoFromJson(dataJson.getJSONObject("info")),
+                    backupDir,
+                    Instant.parse(dataJson.getString("timestamp")),
+                    dataJson.getInt("stagedSessionId"),
+                    rollbackStateFromString(dataJson.getString("state")),
+                    dataJson.getInt("apkSessionId"),
+                    dataJson.getBoolean("restoreUserDataInProgress"));
+        } catch (JSONException | DateTimeParseException | ParseException e) {
             throw new IOException(e);
         }
     }
 
-    private JSONObject toJson(VersionedPackage pkg) throws JSONException {
+    private static JSONObject toJson(VersionedPackage pkg) throws JSONException {
         JSONObject json = new JSONObject();
         json.put("packageName", pkg.getPackageName());
         json.put("longVersionCode", pkg.getLongVersionCode());
         return json;
     }
 
-    private VersionedPackage versionedPackageFromJson(JSONObject json) throws JSONException {
+    private static VersionedPackage versionedPackageFromJson(JSONObject json) throws JSONException {
         String packageName = json.getString("packageName");
         long longVersionCode = json.getLong("longVersionCode");
         return new VersionedPackage(packageName, longVersionCode);
     }
 
-    private JSONObject toJson(PackageRollbackInfo info) throws JSONException {
+    private static JSONObject toJson(PackageRollbackInfo info) throws JSONException {
         JSONObject json = new JSONObject();
         json.put("versionRolledBackFrom", toJson(info.getVersionRolledBackFrom()));
         json.put("versionRolledBackTo", toJson(info.getVersionRolledBackTo()));
@@ -376,7 +329,8 @@
         return json;
     }
 
-    private PackageRollbackInfo packageRollbackInfoFromJson(JSONObject json) throws JSONException {
+    private static PackageRollbackInfo packageRollbackInfoFromJson(JSONObject json)
+            throws JSONException {
         VersionedPackage versionRolledBackFrom = versionedPackageFromJson(
                 json.getJSONObject("versionRolledBackFrom"));
         VersionedPackage versionRolledBackTo = versionedPackageFromJson(
@@ -397,7 +351,7 @@
                 pendingBackups, pendingRestores, isApex, installedUsers, ceSnapshotInodes);
     }
 
-    private JSONArray versionedPackagesToJson(List<VersionedPackage> packages)
+    private static JSONArray versionedPackagesToJson(List<VersionedPackage> packages)
             throws JSONException {
         JSONArray json = new JSONArray();
         for (VersionedPackage pkg : packages) {
@@ -406,7 +360,8 @@
         return json;
     }
 
-    private List<VersionedPackage> versionedPackagesFromJson(JSONArray json) throws JSONException {
+    private static List<VersionedPackage> versionedPackagesFromJson(JSONArray json)
+            throws JSONException {
         List<VersionedPackage> packages = new ArrayList<>();
         for (int i = 0; i < json.length(); ++i) {
             packages.add(versionedPackageFromJson(json.getJSONObject(i)));
@@ -414,7 +369,7 @@
         return packages;
     }
 
-    private JSONArray toJson(List<PackageRollbackInfo> infos) throws JSONException {
+    private static JSONArray toJson(List<PackageRollbackInfo> infos) throws JSONException {
         JSONArray json = new JSONArray();
         for (PackageRollbackInfo info : infos) {
             json.put(toJson(info));
@@ -422,7 +377,7 @@
         return json;
     }
 
-    private List<PackageRollbackInfo> packageRollbackInfosFromJson(JSONArray json)
+    private static List<PackageRollbackInfo> packageRollbackInfosFromJson(JSONArray json)
             throws JSONException {
         List<PackageRollbackInfo> infos = new ArrayList<>();
         for (int i = 0; i < json.length(); ++i) {
@@ -436,7 +391,7 @@
      * If the file is a directory, its contents are deleted as well.
      * Has no effect if the directory does not exist.
      */
-    private void removeFile(File file) {
+    private static void removeFile(File file) {
         if (file.isDirectory()) {
             for (File child : file.listFiles()) {
                 removeFile(child);
@@ -446,4 +401,23 @@
             file.delete();
         }
     }
+
+    private static String rollbackStateToString(@RollbackData.RollbackState int state) {
+        switch (state) {
+            case RollbackData.ROLLBACK_STATE_ENABLING: return "enabling";
+            case RollbackData.ROLLBACK_STATE_AVAILABLE: return "available";
+            case RollbackData.ROLLBACK_STATE_COMMITTED: return "committed";
+        }
+        throw new AssertionError("Invalid rollback state: " + state);
+    }
+
+    private static @RollbackData.RollbackState int rollbackStateFromString(String state)
+            throws ParseException {
+        switch (state) {
+            case "enabling": return RollbackData.ROLLBACK_STATE_ENABLING;
+            case "available": return RollbackData.ROLLBACK_STATE_AVAILABLE;
+            case "committed": return RollbackData.ROLLBACK_STATE_COMMITTED;
+        }
+        throw new ParseException("Invalid rollback state: " + state, 0);
+    }
 }
diff --git a/services/core/java/com/android/server/rollback/TEST_MAPPING b/services/core/java/com/android/server/rollback/TEST_MAPPING
index 6be93a0..921b754 100644
--- a/services/core/java/com/android/server/rollback/TEST_MAPPING
+++ b/services/core/java/com/android/server/rollback/TEST_MAPPING
@@ -5,6 +5,14 @@
     },
     {
       "name": "StagedRollbackTest"
+    },
+    {
+      "name": "FrameworksServicesTests",
+      "options": [
+        {
+          "include-filter": "com.android.server.rollback"
+        }
+      ]
     }
   ]
 }
diff --git a/services/core/java/com/android/server/signedconfig/TEST_MAPPING b/services/core/java/com/android/server/signedconfig/TEST_MAPPING
new file mode 100644
index 0000000..88e068f
--- /dev/null
+++ b/services/core/java/com/android/server/signedconfig/TEST_MAPPING
@@ -0,0 +1,7 @@
+{
+  "presubmit": [
+    {
+      "name": "CtsSignedConfigHostTestCases"
+    }
+  ]
+}
diff --git a/services/core/java/com/android/server/textclassifier/TextClassificationManagerService.java b/services/core/java/com/android/server/textclassifier/TextClassificationManagerService.java
index ef77140..a5d291f 100644
--- a/services/core/java/com/android/server/textclassifier/TextClassificationManagerService.java
+++ b/services/core/java/com/android/server/textclassifier/TextClassificationManagerService.java
@@ -27,12 +27,8 @@
 import android.os.IBinder;
 import android.os.RemoteException;
 import android.os.UserHandle;
-import android.service.textclassifier.IConversationActionsCallback;
-import android.service.textclassifier.ITextClassificationCallback;
+import android.service.textclassifier.ITextClassifierCallback;
 import android.service.textclassifier.ITextClassifierService;
-import android.service.textclassifier.ITextLanguageCallback;
-import android.service.textclassifier.ITextLinksCallback;
-import android.service.textclassifier.ITextSelectionCallback;
 import android.service.textclassifier.TextClassifierService;
 import android.util.Slog;
 import android.util.SparseArray;
@@ -132,7 +128,7 @@
     @Override
     public void onSuggestSelection(
             TextClassificationSessionId sessionId,
-            TextSelection.Request request, ITextSelectionCallback callback)
+            TextSelection.Request request, ITextClassifierCallback callback)
             throws RemoteException {
         Preconditions.checkNotNull(request);
         Preconditions.checkNotNull(callback);
@@ -155,7 +151,7 @@
     @Override
     public void onClassifyText(
             TextClassificationSessionId sessionId,
-            TextClassification.Request request, ITextClassificationCallback callback)
+            TextClassification.Request request, ITextClassifierCallback callback)
             throws RemoteException {
         Preconditions.checkNotNull(request);
         Preconditions.checkNotNull(callback);
@@ -178,7 +174,7 @@
     @Override
     public void onGenerateLinks(
             TextClassificationSessionId sessionId,
-            TextLinks.Request request, ITextLinksCallback callback)
+            TextLinks.Request request, ITextClassifierCallback callback)
             throws RemoteException {
         Preconditions.checkNotNull(request);
         Preconditions.checkNotNull(callback);
@@ -241,7 +237,7 @@
     public void onDetectLanguage(
             TextClassificationSessionId sessionId,
             TextLanguage.Request request,
-            ITextLanguageCallback callback) throws RemoteException {
+            ITextClassifierCallback callback) throws RemoteException {
         Preconditions.checkNotNull(request);
         Preconditions.checkNotNull(callback);
         validateInput(mContext, request.getCallingPackageName());
@@ -264,7 +260,7 @@
     public void onSuggestConversationActions(
             TextClassificationSessionId sessionId,
             ConversationActions.Request request,
-            IConversationActionsCallback callback) throws RemoteException {
+            ITextClassifierCallback callback) throws RemoteException {
         Preconditions.checkNotNull(request);
         Preconditions.checkNotNull(callback);
         validateInput(mContext, request.getCallingPackageName());
diff --git a/services/core/java/com/android/server/trust/TrustAgentWrapper.java b/services/core/java/com/android/server/trust/TrustAgentWrapper.java
index 28fee4e..4614355 100644
--- a/services/core/java/com/android/server/trust/TrustAgentWrapper.java
+++ b/services/core/java/com/android/server/trust/TrustAgentWrapper.java
@@ -43,8 +43,6 @@
 import android.util.Log;
 import android.util.Slog;
 
-import com.android.internal.policy.IKeyguardDismissCallback;
-
 import java.util.Collections;
 import java.util.List;
 
@@ -495,6 +493,21 @@
         }
     }
 
+    /**
+     * @see android.service.trust.TrustAgentService#onTokenStateReceived()
+     *
+     */
+    public void onEscrowTokenActivated(long handle, int userId) {
+        if (DEBUG) Slog.d(TAG, "onEscrowTokenActivated: " + handle + " user: " + userId);
+        if (mTrustAgentService != null) {
+            try {
+                mTrustAgentService.onTokenStateReceived(handle,
+                        TrustAgentService.TOKEN_STATE_ACTIVE);
+            } catch (RemoteException e) {
+                onError(e);
+            }
+        }
+    }
     private void setCallback(ITrustAgentServiceCallback callback) {
         try {
             if (mTrustAgentService != null) {
diff --git a/services/core/java/com/android/server/trust/TrustManagerService.java b/services/core/java/com/android/server/trust/TrustManagerService.java
index c7044a1..3a39053 100644
--- a/services/core/java/com/android/server/trust/TrustManagerService.java
+++ b/services/core/java/com/android/server/trust/TrustManagerService.java
@@ -409,7 +409,10 @@
     }
 
     public long addEscrowToken(byte[] token, int userId) {
-        return mLockPatternUtils.addEscrowToken(token, userId);
+        return mLockPatternUtils.addEscrowToken(token, userId,
+                (long handle, int userid) -> {
+                    dispatchEscrowTokenActivatedLocked(handle, userid);
+                });
     }
 
     public boolean removeEscrowToken(long handle, int userId) {
@@ -662,6 +665,15 @@
         }
     }
 
+    private void dispatchEscrowTokenActivatedLocked(long handle, int userId) {
+        for (int i = 0; i < mActiveAgents.size(); i++) {
+            AgentInfo agent = mActiveAgents.valueAt(i);
+            if (agent.userId == userId) {
+                agent.agent.onEscrowTokenActivated(handle, userId);
+            }
+        }
+    }
+
     void updateDevicePolicyFeatures() {
         boolean changed = false;
         for (int i = 0; i < mActiveAgents.size(); i++) {
diff --git a/services/core/java/com/android/server/utils/FlagNamespaceUtils.java b/services/core/java/com/android/server/utils/FlagNamespaceUtils.java
index f26121e..f8c7447 100644
--- a/services/core/java/com/android/server/utils/FlagNamespaceUtils.java
+++ b/services/core/java/com/android/server/utils/FlagNamespaceUtils.java
@@ -19,6 +19,7 @@
 import android.annotation.Nullable;
 import android.provider.DeviceConfig;
 
+import com.android.internal.annotations.VisibleForTesting;
 import com.android.server.RescueParty;
 
 import java.util.ArrayList;
@@ -41,20 +42,23 @@
     /**
      * Name of the special namespace in DeviceConfig table used for communicating resets.
      */
-    private static final String NAMESPACE_RESCUE_PARTY = "rescue_party_namespace";
+    @VisibleForTesting
+    public static final String NAMESPACE_RESCUE_PARTY = "rescue_party_namespace";
     /**
      * Flag in the {@link DeviceConfig} in {@link #NAMESPACE_RESCUE_PARTY}, holding all known {@link
      * DeviceConfig} namespaces, as a {@link #DELIMITER} separated String. It's updated after the
      * first time flags are written to the new namespace in the {@link DeviceConfig}.
      */
-    private static final String ALL_KNOWN_NAMESPACES_FLAG = "all_known_namespaces";
+    @VisibleForTesting
+    public static final String ALL_KNOWN_NAMESPACES_FLAG = "all_known_namespaces";
     /**
      * Flag in the {@link DeviceConfig} in {@link #NAMESPACE_RESCUE_PARTY} with integer counter
      * suffix added to it, holding {@link DeviceConfig} namespace value whose flags were recently
      * reset by the {@link RescueParty}. It's updated by {@link RescueParty} every time given
      * namespace flags are reset.
      */
-    private static final String RESET_PLATFORM_PACKAGE_FLAG = "reset_platform_package";
+    @VisibleForTesting
+    public static final String RESET_PLATFORM_PACKAGE_FLAG = "reset_platform_package";
     private static final String DELIMITER = ":";
     /**
      * Maximum value of the counter used in combination with {@link #RESET_PLATFORM_PACKAGE_FLAG}
@@ -97,11 +101,25 @@
      * Reset all namespaces in DeviceConfig with consumed resetMode.
      */
     public static void resetDeviceConfig(int resetMode) {
-        List<String> allKnownNamespaces = getAllKnownDeviceConfigNamespacesList();
-        for (String namespace : allKnownNamespaces) {
+        resetDeviceConfig(resetMode, getAllKnownDeviceConfigNamespacesList());
+    }
+
+    /**
+     * Reset all consumed namespaces in DeviceConfig with consumed resetMode.
+     */
+    public static void resetDeviceConfig(int resetMode, List<String> namespacesList) {
+        for (String namespace : namespacesList) {
             DeviceConfig.resetToDefaults(resetMode, namespace);
         }
-        addToKnownResetNamespaces(allKnownNamespaces);
+        addToKnownResetNamespaces(namespacesList);
+    }
+
+    /**
+     * Resets known reset namespaces flag counter for tests only.
+     */
+    @VisibleForTesting
+    public static void resetKnownResetNamespacesFlagCounterForTest() {
+        sKnownResetNamespacesFlagCounter = -1;
     }
 
     /**
diff --git a/services/core/java/com/android/server/wallpaper/WallpaperManagerInternal.java b/services/core/java/com/android/server/wallpaper/WallpaperManagerInternal.java
new file mode 100644
index 0000000..584fbdd
--- /dev/null
+++ b/services/core/java/com/android/server/wallpaper/WallpaperManagerInternal.java
@@ -0,0 +1,30 @@
+/*
+ * Copyright (C) 2019 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 com.android.server.wallpaper;
+
+/**
+ * Wallpaper manager local system service interface.
+ *
+ * @hide Only for use within the system server.
+ */
+public abstract class WallpaperManagerInternal {
+
+    /**
+     * Notifies the display is ready for adding wallpaper on it.
+     */
+    public abstract void onDisplayReady(int displayId);
+}
diff --git a/services/core/java/com/android/server/wallpaper/WallpaperManagerService.java b/services/core/java/com/android/server/wallpaper/WallpaperManagerService.java
index 4aeba153..e53fde9 100644
--- a/services/core/java/com/android/server/wallpaper/WallpaperManagerService.java
+++ b/services/core/java/com/android/server/wallpaper/WallpaperManagerService.java
@@ -100,7 +100,9 @@
 import com.android.internal.util.JournaledFile;
 import com.android.server.EventLogTags;
 import com.android.server.FgThread;
+import com.android.server.LocalServices;
 import com.android.server.SystemService;
+import com.android.server.wm.WindowManagerInternal;
 
 import libcore.io.IoUtils;
 
@@ -472,7 +474,13 @@
         int wallpaperId;
 
         if (wallpaper.equals(mFallbackWallpaper)) {
-            extractDefaultImageWallpaperColors();
+            synchronized (mLock) {
+                if (mFallbackWallpaper.primaryColors != null) return;
+            }
+            final WallpaperColors colors = extractDefaultImageWallpaperColors();
+            synchronized (mLock) {
+                mFallbackWallpaper.primaryColors = colors;
+            }
             return;
         }
 
@@ -497,23 +505,7 @@
             }
         } else if (defaultImageWallpaper) {
             // There is no crop and source file because this is default image wallpaper.
-            try (final InputStream is =
-                         WallpaperManager.openDefaultWallpaper(mContext, FLAG_SYSTEM)) {
-                if (is != null) {
-                    try {
-                        final BitmapFactory.Options options = new BitmapFactory.Options();
-                        final Bitmap bitmap = BitmapFactory.decodeStream(is, null, options);
-                        if (bitmap != null) {
-                            colors = WallpaperColors.fromBitmap(bitmap);
-                            bitmap.recycle();
-                        }
-                    } catch (OutOfMemoryError e) {
-                        Slog.w(TAG, "Can't decode default wallpaper stream", e);
-                    }
-                }
-            } catch (IOException e) {
-                Slog.w(TAG, "Can't close default wallpaper stream", e);
-            }
+            colors = extractDefaultImageWallpaperColors();
         }
 
         if (colors == null) {
@@ -533,37 +525,41 @@
         }
     }
 
-    private void extractDefaultImageWallpaperColors() {
+    private WallpaperColors extractDefaultImageWallpaperColors() {
+        if (DEBUG) Slog.d(TAG, "Extract default image wallpaper colors");
+
         synchronized (mLock) {
-            if (mFallbackWallpaper.primaryColors != null) return;
+            if (mCacheDefaultImageWallpaperColors != null) return mCacheDefaultImageWallpaperColors;
         }
 
-        if (DEBUG) Slog.d(TAG, "Extract default image wallpaper colors");
         WallpaperColors colors = null;
-        final InputStream is = WallpaperManager.openDefaultWallpaper(mContext, FLAG_SYSTEM);
-        if (is != null) {
-            try {
-                final BitmapFactory.Options options = new BitmapFactory.Options();
-                final Bitmap bitmap = BitmapFactory.decodeStream(is, null, options);
-                if (bitmap != null) {
-                    colors = WallpaperColors.fromBitmap(bitmap);
-                    bitmap.recycle();
-                }
-            } catch (OutOfMemoryError e) {
-                Slog.w(TAG, "Can't decode default wallpaper stream", e);
-            } finally {
-                IoUtils.closeQuietly(is);
+        try (InputStream is = WallpaperManager.openDefaultWallpaper(mContext, FLAG_SYSTEM)) {
+            if (is == null) {
+                Slog.w(TAG, "Can't open default wallpaper stream");
+                return null;
             }
+
+            final BitmapFactory.Options options = new BitmapFactory.Options();
+            final Bitmap bitmap = BitmapFactory.decodeStream(is, null, options);
+            if (bitmap != null) {
+                colors = WallpaperColors.fromBitmap(bitmap);
+                bitmap.recycle();
+            }
+        } catch (OutOfMemoryError e) {
+            Slog.w(TAG, "Can't decode default wallpaper stream", e);
+        } catch (IOException e) {
+            Slog.w(TAG, "Can't close default wallpaper stream", e);
         }
 
         if (colors == null) {
             Slog.e(TAG, "Extract default image wallpaper colors failed");
-            return;
+        } else {
+            synchronized (mLock) {
+                mCacheDefaultImageWallpaperColors = colors;
+            }
         }
 
-        synchronized (mLock) {
-            mFallbackWallpaper.primaryColors = colors;
-        }
+        return colors;
     }
 
     /**
@@ -743,6 +739,7 @@
 
     private final Context mContext;
     private final IWindowManager mIWindowManager;
+    private final WindowManagerInternal mWindowManagerInternal;
     private final IPackageManager mIPackageManager;
     private final MyPackageMonitor mMonitor;
     private final AppOpsManager mAppOpsManager;
@@ -753,27 +750,6 @@
 
         @Override
         public void onDisplayAdded(int displayId) {
-            synchronized (mLock) {
-                if (mLastWallpaper != null) {
-                    if (supportsMultiDisplay(mLastWallpaper.connection)) {
-                        final WallpaperConnection.DisplayConnector connector =
-                                mLastWallpaper.connection.getDisplayConnectorOrCreate(displayId);
-                        if (connector == null) return;
-                        connector.connectLocked(mLastWallpaper.connection, mLastWallpaper);
-                        return;
-                    }
-                    // System wallpaper does not support multiple displays, attach this display to
-                    // the fallback wallpaper.
-                    if (mFallbackWallpaper != null) {
-                        final WallpaperConnection.DisplayConnector connector = mFallbackWallpaper
-                                .connection.getDisplayConnectorOrCreate(displayId);
-                        if (connector == null) return;
-                        connector.connectLocked(mFallbackWallpaper.connection, mFallbackWallpaper);
-                    } else {
-                        Slog.w(TAG, "No wallpaper can be added to the new display");
-                    }
-                }
-            }
         }
 
         @Override
@@ -833,6 +809,12 @@
     private final ComponentName mImageWallpaper;
 
     /**
+     * Default image wallpaper shall never changed after system service started, caching it when we
+     * first read the image file.
+     */
+    private WallpaperColors mCacheDefaultImageWallpaperColors;
+
+    /**
      * Name of the default wallpaper component; might be different from mImageWallpaper
      */
     private final ComponentName mDefaultWallpaperComponent;
@@ -1185,9 +1167,12 @@
         }
 
         private boolean isUsableDisplay(Display display) {
-            return display != null &&  display.hasAccess(mClientUid)
-                    && (display.supportsSystemDecorations()
-                            || display.getDisplayId() == DEFAULT_DISPLAY);
+            if (display == null || !display.hasAccess(mClientUid)) {
+                return false;
+            }
+            final int displayId = display.getDisplayId();
+            return displayId == DEFAULT_DISPLAY
+                    || mWindowManagerInternal.shouldShowSystemDecorOnDisplay(displayId);
         }
 
         void forEachDisplayConnector(Consumer<DisplayConnector> action) {
@@ -1577,12 +1562,22 @@
         mDefaultWallpaperComponent = WallpaperManager.getDefaultWallpaperComponent(context);
         mIWindowManager = IWindowManager.Stub.asInterface(
                 ServiceManager.getService(Context.WINDOW_SERVICE));
+        mWindowManagerInternal = LocalServices.getService(WindowManagerInternal.class);
         mIPackageManager = AppGlobals.getPackageManager();
         mAppOpsManager = (AppOpsManager) mContext.getSystemService(Context.APP_OPS_SERVICE);
         mDisplayManager = mContext.getSystemService(DisplayManager.class);
         mDisplayManager.registerDisplayListener(mDisplayListener, null /* handler */);
         mMonitor = new MyPackageMonitor();
         mColorsChangedListeners = new SparseArray<>();
+
+        LocalServices.addService(WallpaperManagerInternal.class, new LocalService());
+    }
+
+    private final class LocalService extends WallpaperManagerInternal {
+        @Override
+        public void onDisplayReady(int displayId) {
+            onDisplayReadyInternal(displayId);
+        }
     }
 
     void initialize() {
@@ -2768,6 +2763,31 @@
         return (wallpaper != null) ? wallpaper.allowBackup : false;
     }
 
+    private void onDisplayReadyInternal(int displayId) {
+        synchronized (mLock) {
+            if (mLastWallpaper == null) {
+                return;
+            }
+            if (supportsMultiDisplay(mLastWallpaper.connection)) {
+                final WallpaperConnection.DisplayConnector connector =
+                        mLastWallpaper.connection.getDisplayConnectorOrCreate(displayId);
+                if (connector == null) return;
+                connector.connectLocked(mLastWallpaper.connection, mLastWallpaper);
+                return;
+            }
+            // System wallpaper does not support multiple displays, attach this display to
+            // the fallback wallpaper.
+            if (mFallbackWallpaper != null) {
+                final WallpaperConnection.DisplayConnector connector = mFallbackWallpaper
+                        .connection.getDisplayConnectorOrCreate(displayId);
+                if (connector == null) return;
+                connector.connectLocked(mFallbackWallpaper.connection, mFallbackWallpaper);
+            } else {
+                Slog.w(TAG, "No wallpaper can be added to the new display");
+            }
+        }
+    }
+
     private static JournaledFile makeJournaledFile(int userId) {
         final String base = new File(getWallpaperDir(userId), WALLPAPER_INFO).getAbsolutePath();
         return new JournaledFile(new File(base), new File(base + ".tmp"));
diff --git a/services/core/java/com/android/server/wm/ActivityDisplay.java b/services/core/java/com/android/server/wm/ActivityDisplay.java
index f882fde..a33b454d 100644
--- a/services/core/java/com/android/server/wm/ActivityDisplay.java
+++ b/services/core/java/com/android/server/wm/ActivityDisplay.java
@@ -126,6 +126,13 @@
     private boolean mSingleTaskInstance;
 
     /**
+     * Non-null if the last size compatibility mode activity is using non-native screen
+     * configuration. The activity is not able to put in multi-window mode, so it exists only one
+     * per display.
+     */
+    private ActivityRecord mLastCompatModeActivity;
+
+    /**
      * A focusable stack that is purposely to be positioned at the top. Although the stack may not
      * have the topmost index, it is used as a preferred candidate to prevent being unable to resume
      * target stack properly when there are other focusable always-on-top stacks.
@@ -1032,6 +1039,28 @@
         mSplitScreenPrimaryStack = null;
     }
 
+    /** Checks whether the given activity is in size compatibility mode and notifies the change. */
+    void handleActivitySizeCompatModeIfNeeded(ActivityRecord r) {
+        if (!r.isState(RESUMED) || r.getWindowingMode() != WINDOWING_MODE_FULLSCREEN) {
+            // The callback is only interested in the foreground changes of fullscreen activity.
+            return;
+        }
+        if (!r.inSizeCompatMode()) {
+            if (mLastCompatModeActivity != null) {
+                mService.getTaskChangeNotificationController()
+                        .notifySizeCompatModeActivityChanged(mDisplayId, null /* activityToken */);
+            }
+            mLastCompatModeActivity = null;
+            return;
+        }
+        if (mLastCompatModeActivity == r) {
+            return;
+        }
+        mLastCompatModeActivity = r;
+        mService.getTaskChangeNotificationController()
+                .notifySizeCompatModeActivityChanged(mDisplayId, r.appToken);
+    }
+
     ActivityStack getSplitScreenPrimaryStack() {
         return mSplitScreenPrimaryStack;
     }
diff --git a/services/core/java/com/android/server/wm/ActivityRecord.java b/services/core/java/com/android/server/wm/ActivityRecord.java
index e976975..4706930 100644
--- a/services/core/java/com/android/server/wm/ActivityRecord.java
+++ b/services/core/java/com/android/server/wm/ActivityRecord.java
@@ -101,6 +101,7 @@
 import static com.android.server.wm.ActivityStack.ActivityState.INITIALIZING;
 import static com.android.server.wm.ActivityStack.ActivityState.PAUSED;
 import static com.android.server.wm.ActivityStack.ActivityState.PAUSING;
+import static com.android.server.wm.ActivityStack.ActivityState.RESTARTING_PROCESS;
 import static com.android.server.wm.ActivityStack.ActivityState.RESUMED;
 import static com.android.server.wm.ActivityStack.ActivityState.STOPPED;
 import static com.android.server.wm.ActivityStack.ActivityState.STOPPING;
@@ -160,6 +161,7 @@
 import android.app.servertransaction.PauseActivityItem;
 import android.app.servertransaction.PipModeChangeItem;
 import android.app.servertransaction.ResumeActivityItem;
+import android.app.servertransaction.StopActivityItem;
 import android.app.servertransaction.TopResumedActivityChangeItem;
 import android.app.servertransaction.WindowVisibilityItem;
 import android.app.usage.UsageEvents.Event;
@@ -289,10 +291,11 @@
     private int windowFlags;        // custom window flags for preview window.
     private TaskRecord task;        // the task this is in.
     private long createTime = System.currentTimeMillis();
-    long lastVisibleTime;   // last time this activity became visible
-    long cpuTimeAtResume;   // the cpu time of host process at the time of resuming activity
-    long pauseTime;         // last time we started pausing the activity
-    long launchTickTime;    // base time for launch tick messages
+    long lastVisibleTime;         // last time this activity became visible
+    long cpuTimeAtResume;         // the cpu time of host process at the time of resuming activity
+    long pauseTime;               // last time we started pausing the activity
+    long launchTickTime;          // base time for launch tick messages
+    long topResumedStateLossTime; // last time we reported top resumed state loss to an activity
     // Last configuration reported to the activity in the client process.
     private MergedConfiguration mLastReportedConfiguration;
     private int mLastReportedDisplayId;
@@ -563,11 +566,8 @@
             pw.print("requestedVrComponent=");
             pw.println(requestedVrComponent);
         }
-        final boolean waitingVisible =
-                mStackSupervisor.mActivitiesWaitingForVisibleActivity.contains(this);
-        if (lastVisibleTime != 0 || waitingVisible || nowVisible) {
-            pw.print(prefix); pw.print("waitingVisible="); pw.print(waitingVisible);
-                    pw.print(" nowVisible="); pw.print(nowVisible);
+        if (lastVisibleTime != 0 || nowVisible) {
+            pw.print(prefix); pw.print(" nowVisible="); pw.print(nowVisible);
                     pw.print(" lastVisibleTime=");
                     if (lastVisibleTime == 0) pw.print("0");
                     else TimeUtils.formatDuration(lastVisibleTime, now, pw);
@@ -694,14 +694,14 @@
 
     void scheduleTopResumedActivityChanged(boolean onTop) {
         if (!attachedToProcess()) {
-            if (DEBUG_CONFIGURATION) {
+            if (DEBUG_STATES) {
                 Slog.w(TAG, "Can't report activity position update - client not running"
                                 + ", activityRecord=" + this);
             }
             return;
         }
         try {
-            if (DEBUG_CONFIGURATION) {
+            if (DEBUG_STATES) {
                 Slog.v(TAG, "Sending position change to " + this + ", onTop: " + onTop);
             }
 
@@ -2130,6 +2130,11 @@
             r.icicle = null;
             r.haveState = false;
         }
+
+        final ActivityDisplay display = r.getDisplay();
+        if (display != null) {
+            display.handleActivitySizeCompatModeIfNeeded(r);
+        }
     }
 
     /**
@@ -2191,7 +2196,8 @@
     final void activityStoppedLocked(Bundle newIcicle, PersistableBundle newPersistentState,
             CharSequence description) {
         final ActivityStack stack = getActivityStack();
-        if (mState != STOPPING) {
+        final boolean isStopping = mState == STOPPING;
+        if (!isStopping && mState != RESTARTING_PROCESS) {
             Slog.i(TAG, "Activity reported stop, but no longer stopping: " + this);
             stack.mHandler.removeMessages(STOP_TIMEOUT_MSG, this);
             return;
@@ -2214,7 +2220,9 @@
             if (DEBUG_STATES) Slog.v(TAG_STATES, "Moving to STOPPED: " + this + " (stop complete)");
             stack.mHandler.removeMessages(STOP_TIMEOUT_MSG, this);
             stopped = true;
-            setState(STOPPED, "activityStoppedLocked");
+            if (isStopping) {
+                setState(STOPPED, "activityStoppedLocked");
+            }
 
             if (mAppWindowToken != null) {
                 mAppWindowToken.notifyAppStopped();
@@ -2357,27 +2365,6 @@
             if (!nowVisible) {
                 nowVisible = true;
                 lastVisibleTime = SystemClock.uptimeMillis();
-                if (idle || mStackSupervisor.isStoppingNoHistoryActivity()) {
-                    // If this activity was already idle or there is an activity that must be
-                    // stopped immediately after visible, then we now need to make sure we perform
-                    // the full stop of any activities that are waiting to do so. This is because
-                    // we won't do that while they are still waiting for this one to become visible.
-                    final int size = mStackSupervisor.mActivitiesWaitingForVisibleActivity.size();
-                    if (size > 0) {
-                        for (int i = 0; i < size; i++) {
-                            final ActivityRecord r =
-                                    mStackSupervisor.mActivitiesWaitingForVisibleActivity.get(i);
-                            if (DEBUG_SWITCH) Log.v(TAG_SWITCH, "Was waiting for visible: " + r);
-                        }
-                        mStackSupervisor.mActivitiesWaitingForVisibleActivity.clear();
-                        mStackSupervisor.scheduleIdleLocked();
-                    }
-                } else {
-                    // Instead of doing the full stop routine here, let's just hide any activities
-                    // we now can, and let them stop when the normal idle happens.
-                    mStackSupervisor.processStoppingActivitiesLocked(null /* idleActivity */,
-                            false /* remove */, true /* processPausingActivities */);
-                }
                 mAtmService.scheduleAppGcsLocked();
             }
         }
@@ -2391,6 +2378,24 @@
         }
     }
 
+    void onAnimationFinished() {
+        if (mRootActivityContainer.allResumedActivitiesIdle()
+                || mStackSupervisor.isStoppingNoHistoryActivity()) {
+            // If all activities are already idle or there is an activity that must be
+            // stopped immediately after visible, then we now need to make sure we perform
+            // the full stop of this activity. This is because we won't do that while they are still
+            // waiting for the animation to finish.
+            if (mStackSupervisor.mStoppingActivities.contains(this)) {
+                mStackSupervisor.scheduleIdleLocked();
+            }
+        } else {
+            // Instead of doing the full stop routine here, let's just hide any activities
+            // we now can, and let them stop when the normal idle happens.
+            mStackSupervisor.processStoppingActivitiesLocked(null /* idleActivity */,
+                    false /* remove */, true /* processPausingActivities */);
+        }
+    }
+
     /**
      * Called when the key dispatching to a window associated with the app window container
      * timed-out.
@@ -2423,10 +2428,9 @@
     }
 
     private ActivityRecord getWaitingHistoryRecordLocked() {
-        // First find the real culprit...  if this activity is waiting for
-        // another activity to start or has stopped, then the key dispatching
+        // First find the real culprit...  if this activity has stopped, then the key dispatching
         // timeout should not be caused by this.
-        if (mStackSupervisor.mActivitiesWaitingForVisibleActivity.contains(this) || stopped) {
+        if (stopped) {
             final ActivityStack stack = mRootActivityContainer.getTopDisplayFocusedStack();
             // Try to use the one which is closest to top.
             ActivityRecord r = stack.getResumedActivity();
@@ -2699,13 +2703,39 @@
     }
 
     /**
+     * @return {@code true} if this activity is in size compatibility mode that uses the different
+     *         density or bounds from its parent.
+     */
+    boolean inSizeCompatMode() {
+        if (!shouldUseSizeCompatMode()) {
+            return false;
+        }
+        final Configuration parentConfig = getParent().getConfiguration();
+        final Configuration resolvedConfig = getResolvedOverrideConfiguration();
+        // Although colorMode, screenLayout, smallestScreenWidthDp are also fixed, generally these
+        // fields should be changed with density and bounds, so here only compares the most
+        // significant field.
+        if (parentConfig.densityDpi != resolvedConfig.densityDpi) {
+            return true;
+        }
+        final Rect parentAppBounds = parentConfig.windowConfiguration.getAppBounds();
+        final Rect parentBounds = parentAppBounds != null
+                ? parentAppBounds : parentConfig.windowConfiguration.getBounds();
+        final Rect overrideBounds = resolvedConfig.windowConfiguration.getBounds();
+        // If the width or height is the same as parent, it is already the best fit of the override
+        // bounds, therefore this condition is considered as not size compatibility mode.
+        return parentBounds.width() != overrideBounds.width()
+                && parentBounds.height() != overrideBounds.height();
+    }
+
+    /**
      * Indicates the activity will keep the bounds and screen configuration when it was first
      * launched, no matter how its parent changes.
      *
      * @return {@code true} if this activity is declared as non-resizable and fixed orientation or
      *         aspect ratio.
      */
-    private boolean inSizeCompatMode() {
+    private boolean shouldUseSizeCompatMode() {
         return !isResizeable() && (info.isFixedOrientation() || info.hasFixedAspectRatio())
                 // The configuration of non-standard type should be enforced by system.
                 && isActivityTypeStandard()
@@ -2714,8 +2744,8 @@
 
     // TODO(b/36505427): Consider moving this method and similar ones to ConfigurationContainer.
     private void updateOverrideConfiguration() {
-        final boolean inSizeCompatMode = inSizeCompatMode();
-        if (inSizeCompatMode) {
+        final boolean shouldUseSizeCompatMode = shouldUseSizeCompatMode();
+        if (shouldUseSizeCompatMode) {
             if (!matchParentBounds()) {
                 // The override configuration is set only once in size compatible mode.
                 return;
@@ -2730,7 +2760,7 @@
 
         computeBounds(mTmpBounds);
 
-        if (inSizeCompatMode && mTmpBounds.isEmpty()) {
+        if (shouldUseSizeCompatMode && mTmpBounds.isEmpty()) {
             mTmpBounds.set(task.getWindowConfiguration().getBounds());
         }
         if (mTmpBounds.equals(getRequestedOverrideBounds())) {
@@ -2742,7 +2772,7 @@
         overrideConfig.unset();
         if (!mTmpBounds.isEmpty()) {
             overrideConfig.windowConfiguration.setBounds(mTmpBounds);
-            if (inSizeCompatMode) {
+            if (shouldUseSizeCompatMode) {
                 // Ensure the screen related fields are set. It is used to prevent activity relaunch
                 // when moving between displays. For screenWidthDp and screenWidthDp, because they
                 // are relative to bounds and density, they will be calculated in
@@ -2777,7 +2807,7 @@
         }
 
         final Configuration resolvedConfig = getResolvedOverrideConfiguration();
-        if (!inSizeCompatMode()) {
+        if (!shouldUseSizeCompatMode()) {
             computeConfigResourceOverrides(resolvedConfig, newParentConfiguration,
                     ORIENTATION_UNDEFINED, true /* insideParentBounds */);
             return;
@@ -2857,6 +2887,11 @@
                     getResolvedOverrideConfiguration().seq;
             mAppWindowToken.onMergedOverrideConfigurationChanged();
         }
+
+        final ActivityDisplay display = getDisplay();
+        if (display != null) {
+            display.handleActivitySizeCompatModeIfNeeded(this);
+        }
     }
 
     /** Returns true if the configuration is compatible with this activity. */
@@ -2991,7 +3026,7 @@
      *                        state. This is useful for the case where we know the activity will be
      *                        visible soon and we want to ensure its configuration before we make it
      *                        visible.
-     * @return True if the activity was relaunched and false if it wasn't relaunched because we
+     * @return False if the activity was relaunched and true if it wasn't relaunched because we
      *         can't or the app handles the specific configuration that is changing.
      */
     boolean ensureActivityConfiguration(int globalChanges, boolean preserveWindow,
@@ -3285,7 +3320,7 @@
             transaction.addCallback(callbackItem);
             transaction.setLifecycleStateRequest(lifecycleItem);
             mAtmService.getLifecycleManager().scheduleTransaction(transaction);
-            mRootActivityContainer.updateTopResumedActivityIfNeeded();
+            mStackSupervisor.updateTopResumedActivityIfNeeded();
             // Note: don't need to call pauseIfSleepingLocked() here, because the caller will only
             // request resume if this activity is currently resumed, which implies we aren't
             // sleeping.
@@ -3313,6 +3348,54 @@
         preserveWindowOnDeferredRelaunch = false;
     }
 
+    /**
+     * Request the process of the activity to restart with its saved state (from
+     * {@link android.app.Activity#onSaveInstanceState}) if possible. It also forces to recompute
+     * the override configuration. Note if the activity is in background, the process will be killed
+     * directly with keeping its record.
+     */
+    void restartProcessIfVisible() {
+        Slog.i(TAG, "Request to restart process of " + this);
+
+        // Reset the existing override configuration to the latest configuration.
+        getRequestedOverrideConfiguration().setToDefaults();
+        getResolvedOverrideConfiguration().setToDefaults();
+        if (visible) {
+            // Configuration will be ensured when becoming visible, so if it is already visible,
+            // then the manual update is needed.
+            updateOverrideConfiguration();
+        }
+
+        if (!attachedToProcess()) {
+            return;
+        }
+
+        // The restarting state avoids removing this record when process is died.
+        setState(RESTARTING_PROCESS, "restartActivityProcess");
+
+        if (!visible || haveState) {
+            // Kill its process immediately because the activity should be in background.
+            // The activity state will be update to {@link #DESTROYED} in
+            // {@link ActivityStack#cleanUpActivityLocked} when handling process died.
+            mAtmService.mH.post(() -> mAtmService.mAmInternal.killProcess(
+                    app.mName, app.mUid, "restartActivityProcess"));
+            return;
+        }
+
+        if (mAppWindowToken != null) {
+            mAppWindowToken.startFreezingScreen();
+        }
+        // The process will be killed until the activity reports stopped with saved state (see
+        // {@link ActivityTaskManagerService.activityStopped}).
+        try {
+            mAtmService.getLifecycleManager().scheduleTransaction(app.getThread(), appToken,
+                    StopActivityItem.obtain(false /* showWindow */, 0 /* configChanges */));
+        } catch (RemoteException e) {
+            Slog.w(TAG, "Exception thrown during restart " + this, e);
+        }
+        mStackSupervisor.scheduleRestartTimeout(this);
+    }
+
     private boolean isProcessRunning() {
         WindowProcessController proc = app;
         if (proc == null) {
diff --git a/services/core/java/com/android/server/wm/ActivityStack.java b/services/core/java/com/android/server/wm/ActivityStack.java
index a4457e2..ad98970 100644
--- a/services/core/java/com/android/server/wm/ActivityStack.java
+++ b/services/core/java/com/android/server/wm/ActivityStack.java
@@ -297,7 +297,8 @@
         STOPPED,
         FINISHING,
         DESTROYING,
-        DESTROYED
+        DESTROYED,
+        RESTARTING_PROCESS
     }
 
     @VisibleForTesting
@@ -701,6 +702,14 @@
      */
     void setWindowingMode(int preferredWindowingMode, boolean animate, boolean showRecents,
             boolean enteringSplitScreenMode, boolean deferEnsuringVisibility, boolean creating) {
+        mWindowManager.inSurfaceTransaction(() -> setWindowingModeInSurfaceTransaction(
+                preferredWindowingMode, animate, showRecents, enteringSplitScreenMode,
+                deferEnsuringVisibility, creating));
+    }
+
+    private void setWindowingModeInSurfaceTransaction(int preferredWindowingMode, boolean animate,
+            boolean showRecents, boolean enteringSplitScreenMode, boolean deferEnsuringVisibility,
+            boolean creating) {
         final int currentMode = getWindowingMode();
         final int currentOverrideMode = getRequestedOverrideWindowingMode();
         final ActivityDisplay display = getDisplay();
@@ -744,7 +753,7 @@
                 // warning toast about it.
                 mService.getTaskChangeNotificationController().notifyActivityDismissingDockedStack();
                 final ActivityStack primarySplitStack = display.getSplitScreenPrimaryStack();
-                primarySplitStack.setWindowingMode(WINDOWING_MODE_UNDEFINED,
+                primarySplitStack.setWindowingModeInSurfaceTransaction(WINDOWING_MODE_UNDEFINED,
                         false /* animate */, false /* showRecents */,
                         false /* enteringSplitScreenMode */, true /* deferEnsuringVisibility */,
                         primarySplitStack == this ? creating : false);
@@ -1491,6 +1500,7 @@
                 + " callers=" + Debug.getCallers(5));
         r.setState(RESUMED, "minimalResumeActivityLocked");
         r.completeResumeLocked();
+        mStackSupervisor.updateTopResumedActivityIfNeeded();
         if (DEBUG_SAVED_STATE) Slog.i(TAG_SAVED_STATE,
                 "Launch completed; removing icicle of " + r.icicle);
     }
@@ -1798,10 +1808,6 @@
             } else if (prev.hasProcess()) {
                 if (DEBUG_PAUSE) Slog.v(TAG_PAUSE, "Enqueue pending stop if needed: " + prev
                         + " wasStopping=" + wasStopping + " visible=" + prev.visible);
-                if (mStackSupervisor.mActivitiesWaitingForVisibleActivity.remove(prev)) {
-                    if (DEBUG_SWITCH || DEBUG_PAUSE) Slog.v(TAG_PAUSE,
-                            "Complete pause, no longer waiting: " + prev);
-                }
                 if (prev.deferRelaunchUntilPaused) {
                     // Complete the deferred relaunch that was waiting for pause to complete.
                     if (DEBUG_PAUSE) Slog.v(TAG_PAUSE, "Re-launching after pause: " + prev);
@@ -1881,16 +1887,6 @@
     private void addToStopping(ActivityRecord r, boolean scheduleIdle, boolean idleDelayed) {
         if (!mStackSupervisor.mStoppingActivities.contains(r)) {
             mStackSupervisor.mStoppingActivities.add(r);
-
-            // Some activity is waiting for another activity to become visible before it's being
-            // stopped, which means that we also want to wait with stopping this one to avoid
-            // flickers.
-            if (!mStackSupervisor.mActivitiesWaitingForVisibleActivity.isEmpty()
-                    && !mStackSupervisor.mActivitiesWaitingForVisibleActivity.contains(r)) {
-                if (DEBUG_SWITCH) Slog.i(TAG_SWITCH, "adding to waiting visible activity=" + r
-                        + " existing=" + mStackSupervisor.mActivitiesWaitingForVisibleActivity);
-                mStackSupervisor.mActivitiesWaitingForVisibleActivity.add(r);
-            }
         }
 
         // If we already have a few activities waiting to stop, then give up
@@ -2575,7 +2571,7 @@
             // Protect against recursion.
             mInResumeTopActivity = true;
             result = resumeTopActivityInnerLocked(prev, options);
-            mRootActivityContainer.updateTopResumedActivityIfNeeded();
+            mStackSupervisor.updateTopResumedActivityIfNeeded();
 
             // When resuming the top activity, it may be necessary to pause the top activity (for
             // example, returning to the lock screen. We suppress the normal pause logic in
@@ -2706,7 +2702,6 @@
         mStackSupervisor.mStoppingActivities.remove(next);
         mStackSupervisor.mGoingToSleepActivities.remove(next);
         next.sleeping = false;
-        mStackSupervisor.mActivitiesWaitingForVisibleActivity.remove(next);
 
         if (DEBUG_SWITCH) Slog.v(TAG_SWITCH, "Resuming " + next);
 
@@ -2715,11 +2710,6 @@
             if (DEBUG_SWITCH || DEBUG_PAUSE || DEBUG_STATES) Slog.v(TAG_PAUSE,
                     "resumeTopActivityLocked: Skip resume: some activity pausing.");
 
-            // Adding previous activity to the waiting visible list, or it would be stopped
-            // before top activity being visible.
-            if (prev != null && !next.nowVisible) {
-                mStackSupervisor.mActivitiesWaitingForVisibleActivity.add(prev);
-            }
             return false;
         }
 
@@ -2795,35 +2785,27 @@
             mLastNoHistoryActivity = null;
         }
 
-        if (prev != null && prev != next) {
-            if (!mStackSupervisor.mActivitiesWaitingForVisibleActivity.contains(prev)
-                    && !next.nowVisible) {
-                mStackSupervisor.mActivitiesWaitingForVisibleActivity.add(prev);
+        if (prev != null && prev != next && next.nowVisible) {
+
+            // The next activity is already visible, so hide the previous
+            // activity's windows right now so we can show the new one ASAP.
+            // We only do this if the previous is finishing, which should mean
+            // it is on top of the one being resumed so hiding it quickly
+            // is good.  Otherwise, we want to do the normal route of allowing
+            // the resumed activity to be shown so we can decide if the
+            // previous should actually be hidden depending on whether the
+            // new one is found to be full-screen or not.
+            if (prev.finishing) {
+                prev.setVisibility(false);
                 if (DEBUG_SWITCH) Slog.v(TAG_SWITCH,
-                        "Resuming top, waiting visible to hide: " + prev);
+                        "Not waiting for visible to hide: " + prev
+                        + ", nowVisible=" + next.nowVisible);
             } else {
-                // The next activity is already visible, so hide the previous
-                // activity's windows right now so we can show the new one ASAP.
-                // We only do this if the previous is finishing, which should mean
-                // it is on top of the one being resumed so hiding it quickly
-                // is good.  Otherwise, we want to do the normal route of allowing
-                // the resumed activity to be shown so we can decide if the
-                // previous should actually be hidden depending on whether the
-                // new one is found to be full-screen or not.
-                if (prev.finishing) {
-                    prev.setVisibility(false);
-                    if (DEBUG_SWITCH) Slog.v(TAG_SWITCH,
-                            "Not waiting for visible to hide: " + prev + ", waitingVisible="
-                            + mStackSupervisor.mActivitiesWaitingForVisibleActivity.contains(prev)
-                            + ", nowVisible=" + next.nowVisible);
-                } else {
-                    if (DEBUG_SWITCH) Slog.v(TAG_SWITCH,
-                            "Previous already visible but still waiting to hide: " + prev
-                            + ", waitingVisible="
-                            + mStackSupervisor.mActivitiesWaitingForVisibleActivity.contains(prev)
-                            + ", nowVisible=" + next.nowVisible);
-                }
+                if (DEBUG_SWITCH) Slog.v(TAG_SWITCH,
+                        "Previous already visible but still waiting to hide: " + prev
+                        + ", nowVisible=" + next.nowVisible);
             }
+
         }
 
         // Launching this app's activity, make sure the app is no longer
@@ -4080,9 +4062,6 @@
         dc.prepareAppTransition(transit, false);
         r.setVisibility(false);
         dc.executeAppTransition();
-        if (!mStackSupervisor.mActivitiesWaitingForVisibleActivity.contains(r)) {
-            mStackSupervisor.mActivitiesWaitingForVisibleActivity.add(r);
-        }
     }
 
     static final int FINISH_IMMEDIATELY = 0;
@@ -4118,7 +4097,6 @@
         // make sure the record is cleaned out of other places.
         mStackSupervisor.mStoppingActivities.remove(r);
         mStackSupervisor.mGoingToSleepActivities.remove(r);
-        mStackSupervisor.mActivitiesWaitingForVisibleActivity.remove(r);
         final ActivityState prevState = r.getState();
         if (DEBUG_STATES) Slog.v(TAG_STATES, "Moving to FINISHING: " + r);
 
@@ -4724,8 +4702,6 @@
                 "mStoppingActivities");
         removeHistoryRecordsForAppLocked(mStackSupervisor.mGoingToSleepActivities, app,
                 "mGoingToSleepActivities");
-        removeHistoryRecordsForAppLocked(mStackSupervisor.mActivitiesWaitingForVisibleActivity, app,
-                "mActivitiesWaitingForVisibleActivity");
         removeHistoryRecordsForAppLocked(mStackSupervisor.mFinishingActivities, app,
                 "mFinishingActivities");
 
@@ -4766,7 +4742,8 @@
                         // it has failed more than twice. Skip activities that's already finishing
                         // cleanly by itself.
                         remove = false;
-                    } else if ((!r.haveState && !r.stateNotNeeded) || r.finishing) {
+                    } else if ((!r.haveState && !r.stateNotNeeded
+                            && !r.isState(ActivityState.RESTARTING_PROCESS)) || r.finishing) {
                         // Don't currently have state for the activity, or
                         // it is finishing -- always remove it.
                         remove = true;
diff --git a/services/core/java/com/android/server/wm/ActivityStackSupervisor.java b/services/core/java/com/android/server/wm/ActivityStackSupervisor.java
index df76030..9a5ec2a 100644
--- a/services/core/java/com/android/server/wm/ActivityStackSupervisor.java
+++ b/services/core/java/com/android/server/wm/ActivityStackSupervisor.java
@@ -170,15 +170,20 @@
     // How long we can hold the launch wake lock before giving up.
     static final int LAUNCH_TIMEOUT = 10 * 1000;
 
+    /** How long we wait until giving up on the activity telling us it released the top state. */
+    static final int TOP_RESUMED_STATE_LOSS_TIMEOUT = 500;
+
     static final int IDLE_TIMEOUT_MSG = FIRST_SUPERVISOR_STACK_MSG;
     static final int IDLE_NOW_MSG = FIRST_SUPERVISOR_STACK_MSG + 1;
     static final int RESUME_TOP_ACTIVITY_MSG = FIRST_SUPERVISOR_STACK_MSG + 2;
     static final int SLEEP_TIMEOUT_MSG = FIRST_SUPERVISOR_STACK_MSG + 3;
     static final int LAUNCH_TIMEOUT_MSG = FIRST_SUPERVISOR_STACK_MSG + 4;
     static final int LAUNCH_TASK_BEHIND_COMPLETE = FIRST_SUPERVISOR_STACK_MSG + 12;
+    static final int RESTART_ACTIVITY_PROCESS_TIMEOUT_MSG = FIRST_SUPERVISOR_STACK_MSG + 13;
     static final int REPORT_MULTI_WINDOW_MODE_CHANGED_MSG = FIRST_SUPERVISOR_STACK_MSG + 14;
     static final int REPORT_PIP_MODE_CHANGED_MSG = FIRST_SUPERVISOR_STACK_MSG + 15;
     static final int REPORT_HOME_CHANGED_MSG = FIRST_SUPERVISOR_STACK_MSG + 16;
+    static final int TOP_RESUMED_STATE_LOSS_TIMEOUT_MSG = FIRST_SUPERVISOR_STACK_MSG + 17;
 
     // Used to indicate that windows of activities should be preserved during the resize.
     static final boolean PRESERVE_WINDOWS = true;
@@ -263,12 +268,6 @@
      */
     private final SparseIntArray mCurTaskIdForUser = new SparseIntArray(20);
 
-    /** List of activities that are waiting for a new activity to become visible before completing
-     * whatever operation they are supposed to do. */
-    // TODO: Remove mActivitiesWaitingForVisibleActivity list and just remove activity from
-    // mStoppingActivities when something else comes up.
-    final ArrayList<ActivityRecord> mActivitiesWaitingForVisibleActivity = new ArrayList<>();
-
     /** List of processes waiting to find out when a specific activity becomes visible. */
     private final ArrayList<WaitInfo> mWaitingForActivityVisible = new ArrayList<>();
 
@@ -300,6 +299,18 @@
      */
     final ArrayList<ActivityRecord> mNoAnimActivities = new ArrayList<>();
 
+    /**
+     * Cached value of the topmost resumed activity in the system. Updated when new activity is
+     * resumed.
+     */
+    private ActivityRecord mTopResumedActivity;
+
+    /**
+     * Flag indicating whether we're currently waiting for the previous top activity to handle the
+     * loss of the state and report back before making new activity top resumed.
+     */
+    private boolean mTopResumedActivityWaitingForPrev;
+
     /** The target stack bounds for the picture-in-picture mode changed that we need to report to
      * the application */
     Rect mPipModeChangedTargetStackBounds;
@@ -439,10 +450,17 @@
     }
 
     void onSystemReady() {
-        mPersisterQueue.startPersisting();
         mLaunchParamsPersister.onSystemReady();
     }
 
+    void onUserUnlocked(int userId) {
+        // Only start persisting when the first user is unlocked. The method call is
+        // idempotent so there is no side effect to call it again when the second user is
+        // unlocked.
+        mPersisterQueue.startPersisting();
+        mLaunchParamsPersister.onUnlockUser(userId);
+    }
+
     public ActivityMetricsLogger getActivityMetricsLogger() {
         return mActivityMetricsLogger;
     }
@@ -534,7 +552,6 @@
         // This could happen, for example, if we are trimming activities
         // down to the max limit while they are still waiting to finish.
         mFinishingActivities.remove(r);
-        mActivitiesWaitingForVisibleActivity.remove(r);
 
         for (int i = mWaitingForActivityVisible.size() - 1; i >= 0; --i) {
             if (mWaitingForActivityVisible.get(i).matches(r.mActivityComponent)) {
@@ -844,7 +861,7 @@
 
                 // Schedule transaction.
                 mService.getLifecycleManager().scheduleTransaction(clientTransaction);
-                mRootActivityContainer.updateTopResumedActivityIfNeeded();
+                updateTopResumedActivityIfNeeded();
 
                 if ((proc.mInfo.privateFlags & ApplicationInfo.PRIVATE_FLAG_CANT_SAVE_STATE) != 0
                         && mService.mHasHeavyWeightFeature) {
@@ -2126,28 +2143,27 @@
         final boolean nowVisible = mRootActivityContainer.allResumedActivitiesVisible();
         for (int activityNdx = mStoppingActivities.size() - 1; activityNdx >= 0; --activityNdx) {
             ActivityRecord s = mStoppingActivities.get(activityNdx);
-            boolean waitingVisible = mActivitiesWaitingForVisibleActivity.contains(s);
+
+            final boolean animating = s.mAppWindowToken.isSelfAnimating();
+
             if (DEBUG_STATES) Slog.v(TAG, "Stopping " + s + ": nowVisible=" + nowVisible
-                    + " waitingVisible=" + waitingVisible + " finishing=" + s.finishing);
-            if (waitingVisible && nowVisible) {
-                mActivitiesWaitingForVisibleActivity.remove(s);
-                waitingVisible = false;
-                if (s.finishing) {
-                    // If this activity is finishing, it is sitting on top of
-                    // everyone else but we now know it is no longer needed...
-                    // so get rid of it.  Otherwise, we need to go through the
-                    // normal flow and hide it once we determine that it is
-                    // hidden by the activities in front of it.
-                    if (DEBUG_STATES) Slog.v(TAG, "Before stopping, can hide: " + s);
-                    s.setVisibility(false);
-                }
+                    + " animating=" + animating + " finishing=" + s.finishing);
+            if (nowVisible && s.finishing) {
+
+                // If this activity is finishing, it is sitting on top of
+                // everyone else but we now know it is no longer needed...
+                // so get rid of it.  Otherwise, we need to go through the
+                // normal flow and hide it once we determine that it is
+                // hidden by the activities in front of it.
+                if (DEBUG_STATES) Slog.v(TAG, "Before stopping, can hide: " + s);
+                s.setVisibility(false);
             }
             if (remove) {
                 final ActivityStack stack = s.getActivityStack();
                 final boolean shouldSleepOrShutDown = stack != null
                         ? stack.shouldSleepOrShutDownActivities()
                         : mService.isSleepingOrShuttingDownLocked();
-                if (!waitingVisible || shouldSleepOrShutDown) {
+                if (!animating || shouldSleepOrShutDown) {
                     if (!processPausingActivities && s.isState(PAUSING)) {
                         // Defer processing pausing activities in this iteration and reschedule
                         // a delayed idle to reprocess it again
@@ -2162,9 +2178,6 @@
                     }
                     stops.add(s);
 
-                    // Make sure to remove it in all cases in case we entered this block with
-                    // shouldSleepOrShutDown
-                    mActivitiesWaitingForVisibleActivity.remove(s);
                     mStoppingActivities.remove(activityNdx);
                 }
             }
@@ -2296,6 +2309,73 @@
         mHandler.sendEmptyMessage(IDLE_NOW_MSG);
     }
 
+    /**
+     * Updates the record of top resumed activity when it changes and handles reporting of the
+     * state changes to previous and new top activities. It will immediately dispatch top resumed
+     * state loss message to previous top activity (if haven't done it already). After the previous
+     * activity releases the top state and reports back, message about acquiring top state will be
+     * sent to the new top resumed activity.
+     */
+    void updateTopResumedActivityIfNeeded() {
+        final ActivityRecord prevTopActivity = mTopResumedActivity;
+        final ActivityStack topStack = mRootActivityContainer.getTopDisplayFocusedStack();
+        if (topStack == null || topStack.mResumedActivity == prevTopActivity) {
+            return;
+        }
+
+        // Ask previous activity to release the top state.
+        final boolean prevActivityReceivedTopState =
+                prevTopActivity != null && !mTopResumedActivityWaitingForPrev;
+        // mTopResumedActivityWaitingForPrev == true at this point would mean that an activity
+        // before the prevTopActivity one hasn't reported back yet. So server never sent the top
+        // resumed state change message to prevTopActivity.
+        if (prevActivityReceivedTopState) {
+            prevTopActivity.scheduleTopResumedActivityChanged(false /* onTop */);
+            scheduleTopResumedStateLossTimeout(prevTopActivity);
+            mTopResumedActivityWaitingForPrev = true;
+        }
+
+        // Update the current top activity.
+        mTopResumedActivity = topStack.mResumedActivity;
+        scheduleTopResumedActivityStateIfNeeded();
+    }
+
+    /** Schedule top resumed state change if previous top activity already reported back. */
+    private void scheduleTopResumedActivityStateIfNeeded() {
+        if (mTopResumedActivity != null && !mTopResumedActivityWaitingForPrev) {
+            mTopResumedActivity.scheduleTopResumedActivityChanged(true /* onTop */);
+        }
+    }
+
+    /**
+     * Limit the time given to the app to report handling of the state loss.
+     */
+    private void scheduleTopResumedStateLossTimeout(ActivityRecord r) {
+        final Message msg = mHandler.obtainMessage(TOP_RESUMED_STATE_LOSS_TIMEOUT_MSG);
+        msg.obj = r;
+        r.topResumedStateLossTime = SystemClock.uptimeMillis();
+        mHandler.sendMessageDelayed(msg, TOP_RESUMED_STATE_LOSS_TIMEOUT);
+        if (DEBUG_STATES) Slog.v(TAG_STATES, "Waiting for top state to be released by " + r);
+    }
+
+    /**
+     * Handle a loss of top resumed state by an activity - update internal state and inform next top
+     * activity if needed.
+     */
+    void handleTopResumedStateReleased(boolean timeout) {
+        if (DEBUG_STATES) {
+            Slog.v(TAG_STATES, "Top resumed state released "
+                    + (timeout ? " (due to timeout)" : " (transition complete)"));
+        }
+        mHandler.removeMessages(TOP_RESUMED_STATE_LOSS_TIMEOUT_MSG);
+        if (!mTopResumedActivityWaitingForPrev) {
+            // Top resumed activity state loss already handled.
+            return;
+        }
+        mTopResumedActivityWaitingForPrev = false;
+        scheduleTopResumedActivityStateIfNeeded();
+    }
+
     void removeTimeoutsForActivityLocked(ActivityRecord r) {
         if (DEBUG_IDLE) Slog.d(TAG_IDLE, "removeTimeoutsForActivity: Callers="
                 + Debug.getCallers(4));
@@ -2317,6 +2397,16 @@
         mHandler.sendEmptyMessageDelayed(SLEEP_TIMEOUT_MSG, SLEEP_TIMEOUT);
     }
 
+    void removeRestartTimeouts(ActivityRecord r) {
+        mHandler.removeMessages(RESTART_ACTIVITY_PROCESS_TIMEOUT_MSG, r);
+    }
+
+    final void scheduleRestartTimeout(ActivityRecord r) {
+        removeRestartTimeouts(r);
+        mHandler.sendMessageDelayed(mHandler.obtainMessage(RESTART_ACTIVITY_PROCESS_TIMEOUT_MSG, r),
+                WindowManagerService.WINDOW_FREEZE_TIMEOUT_DURATION);
+    }
+
     void handleNonResizableTaskIfNeeded(TaskRecord task, int preferredWindowingMode,
             int preferredDisplayId, ActivityStack actualStack) {
         handleNonResizableTaskIfNeeded(task, preferredWindowingMode, preferredDisplayId,
@@ -2347,14 +2437,17 @@
             final boolean singleTaskInstance = preferredDisplay != null
                     && preferredDisplay.isSingleTaskInstance();
 
-            if (singleTaskInstance) {
+            if (preferredDisplayId != actualDisplayId) {
                 // Suppress the warning toast if the preferredDisplay was set to singleTask.
                 // The singleTaskInstance displays will only contain one task and any attempt to
                 // launch new task will re-route to the default display.
-                return;
-            }
+                if (singleTaskInstance) {
+                    mService.getTaskChangeNotificationController()
+                            .notifyActivityLaunchOnSecondaryDisplayRerouted(task.getTaskInfo(),
+                                    preferredDisplayId);
+                    return;
+                }
 
-            if (preferredDisplayId != actualDisplayId) {
                 Slog.w(TAG, "Failed to put " + task + " on display " + preferredDisplayId);
                 // Display a warning toast that we failed to put a task on a secondary display.
                 mService.getTaskChangeNotificationController()
@@ -2580,6 +2673,22 @@
                         }
                     }
                 } break;
+                case RESTART_ACTIVITY_PROCESS_TIMEOUT_MSG: {
+                    final ActivityRecord r = (ActivityRecord) msg.obj;
+                    String processName = null;
+                    int uid = 0;
+                    synchronized (mService.mGlobalLock) {
+                        if (r.attachedToProcess()
+                                && r.isState(ActivityStack.ActivityState.RESTARTING_PROCESS)) {
+                            processName = r.app.mName;
+                            uid = r.app.mUid;
+                        }
+                    }
+                    if (processName != null) {
+                        mService.mAmInternal.killProcess(processName, uid,
+                                "restartActivityProcessTimeout");
+                    }
+                } break;
                 case REPORT_HOME_CHANGED_MSG: {
                     synchronized (mService.mGlobalLock) {
                         mHandler.removeMessages(REPORT_HOME_CHANGED_MSG);
@@ -2587,8 +2696,18 @@
                         // Start home activities on displays with no activities.
                         mRootActivityContainer.startHomeOnEmptyDisplays("homeChanged");
                     }
-                }
-                break;
+                } break;
+                case TOP_RESUMED_STATE_LOSS_TIMEOUT_MSG: {
+                    ActivityRecord r = (ActivityRecord) msg.obj;
+                    Slog.w(TAG, "Activity top resumed state loss timeout for " + r);
+                    synchronized (mService.mGlobalLock) {
+                        if (r.hasProcess()) {
+                            mService.logAppTooSlow(r.app, r.topResumedStateLossTime,
+                                    "top state loss for " + r);
+                        }
+                    }
+                    handleTopResumedStateReleased(true /* timeout */);
+                } break;
             }
         }
     }
diff --git a/services/core/java/com/android/server/wm/ActivityStarter.java b/services/core/java/com/android/server/wm/ActivityStarter.java
index 9f04166..2b23ff0 100644
--- a/services/core/java/com/android/server/wm/ActivityStarter.java
+++ b/services/core/java/com/android/server/wm/ActivityStarter.java
@@ -27,6 +27,8 @@
 import static android.app.ActivityManager.START_RETURN_LOCK_TASK_MODE_VIOLATION;
 import static android.app.ActivityManager.START_SUCCESS;
 import static android.app.ActivityManager.START_TASK_TO_FRONT;
+import static android.app.WaitResult.LAUNCH_STATE_COLD;
+import static android.app.WaitResult.LAUNCH_STATE_HOT;
 import static android.app.WindowConfiguration.WINDOWING_MODE_FREEFORM;
 import static android.app.WindowConfiguration.WINDOWING_MODE_FULLSCREEN;
 import static android.app.WindowConfiguration.WINDOWING_MODE_PINNED;
@@ -1009,6 +1011,12 @@
         if (mService.isDeviceOwner(callingPackage)) {
             return false;
         }
+        // don't abort if the callingPackage is temporarily whitelisted
+        if (mService.isPackageNameWhitelistedForBgActivityStarts(callingPackage)) {
+            Slog.w(TAG, "Background activity start for " + callingPackage
+                    + " temporarily whitelisted. This will not be supported in future Q builds.");
+            return false;
+        }
         // anything that has fallen through would currently be aborted
         Slog.w(TAG, "Background activity start [callingPackage: " + callingPackage
                 + "; callingUid: " + callingUid
@@ -1305,6 +1313,8 @@
                         break;
                     }
                     case START_TASK_TO_FRONT: {
+                        outResult.launchState =
+                                r.attachedToProcess() ? LAUNCH_STATE_HOT : LAUNCH_STATE_COLD;
                         // ActivityRecord may represent a different activity, but it should not be
                         // in the resumed state.
                         if (r.nowVisible && r.isState(RESUMED)) {
@@ -1799,7 +1809,7 @@
             }
         }
 
-        mNotTop = (mLaunchFlags & FLAG_ACTIVITY_PREVIOUS_IS_TOP) != 0 ? r : null;
+        mNotTop = (mLaunchFlags & FLAG_ACTIVITY_PREVIOUS_IS_TOP) != 0 ? sourceRecord : null;
 
         mInTask = inTask;
         // In some flows in to this function, we retrieve the task record and hold on to it
diff --git a/services/core/java/com/android/server/wm/ActivityTaskManagerService.java b/services/core/java/com/android/server/wm/ActivityTaskManagerService.java
index 486a4ea..794a4b8 100644
--- a/services/core/java/com/android/server/wm/ActivityTaskManagerService.java
+++ b/services/core/java/com/android/server/wm/ActivityTaskManagerService.java
@@ -776,6 +776,12 @@
         return mGlobalLock;
     }
 
+    /** For test purpose only. */
+    @VisibleForTesting
+    public ActivityTaskManagerInternal getAtmInternal() {
+        return mInternal;
+    }
+
     public void initialize(IntentFirewall intentFirewall, PendingIntentController intentController,
             Looper looper) {
         mH = new H(looper);
@@ -948,7 +954,7 @@
         @Override
         public void onUnlockUser(int userId) {
             synchronized (mService.getGlobalLock()) {
-                mService.mStackSupervisor.mLaunchParamsPersister.onUnlockUser(userId);
+                mService.mStackSupervisor.onUserUnlocked(userId);
             }
         }
 
@@ -1634,6 +1640,15 @@
     }
 
     @Override
+    public final void activityTopResumedStateLost() {
+        final long origId = Binder.clearCallingIdentity();
+        synchronized (mGlobalLock) {
+            mStackSupervisor.handleTopResumedStateReleased(false /* timeout */);
+        }
+        Binder.restoreCallingIdentity(origId);
+    }
+
+    @Override
     public final void activityPaused(IBinder token) {
         final long origId = Binder.clearCallingIdentity();
         synchronized (mGlobalLock) {
@@ -1657,13 +1672,32 @@
 
         final long origId = Binder.clearCallingIdentity();
 
+        String restartingName = null;
+        int restartingUid = 0;
+        final ActivityRecord r;
         synchronized (mGlobalLock) {
-            final ActivityRecord r = ActivityRecord.isInStackLocked(token);
+            r = ActivityRecord.isInStackLocked(token);
             if (r != null) {
+                if (r.attachedToProcess()
+                        && r.isState(ActivityStack.ActivityState.RESTARTING_PROCESS)) {
+                    // The activity was requested to restart from
+                    // {@link #restartActivityProcessIfVisible}.
+                    restartingName = r.app.mName;
+                    restartingUid = r.app.mUid;
+                }
                 r.activityStoppedLocked(icicle, persistentState, description);
             }
         }
 
+        if (restartingName != null) {
+            // In order to let the foreground activity can be restarted with its saved state from
+            // {@link android.app.Activity#onSaveInstanceState}, the kill operation is postponed
+            // until the activity reports stopped with the state. And the activity record will be
+            // kept because the record state is restarting, then the activity will be restarted
+            // immediately if it is still the top one.
+            mStackSupervisor.removeRestartTimeouts(r);
+            mAmInternal.killProcess(restartingName, restartingUid, "restartActivityProcess");
+        }
         mAmInternal.trimApplications();
 
         Binder.restoreCallingIdentity(origId);
@@ -2005,6 +2039,23 @@
     }
 
     @Override
+    public void restartActivityProcessIfVisible(IBinder activityToken) {
+        mAmInternal.enforceCallingPermission(MANAGE_ACTIVITY_STACKS, "restartActivityProcess()");
+        final long callingId = Binder.clearCallingIdentity();
+        try {
+            synchronized (mGlobalLock) {
+                final ActivityRecord r = ActivityRecord.isInStackLocked(activityToken);
+                if (r == null) {
+                    return;
+                }
+                r.restartProcessIfVisible();
+            }
+        } finally {
+            Binder.restoreCallingIdentity(callingId);
+        }
+    }
+
+    @Override
     public boolean removeTask(int taskId) {
         enforceCallerIsRecentsOrHasPermission(REMOVE_TASKS, "removeTask()");
         synchronized (mGlobalLock) {
@@ -5201,6 +5252,10 @@
         return mAmInternal.isBackgroundActivityStartsEnabled();
     }
 
+    boolean isPackageNameWhitelistedForBgActivityStarts(String packageName) {
+        return mAmInternal.isPackageNameWhitelistedForBgActivityStarts(packageName);
+    }
+
     void enableScreenAfterBoot(boolean booted) {
         EventLog.writeEvent(EventLogTags.BOOT_PROGRESS_ENABLE_SCREEN,
                 SystemClock.uptimeMillis());
diff --git a/services/core/java/com/android/server/wm/AppTransition.java b/services/core/java/com/android/server/wm/AppTransition.java
index 19ff438..bb5a221 100644
--- a/services/core/java/com/android/server/wm/AppTransition.java
+++ b/services/core/java/com/android/server/wm/AppTransition.java
@@ -86,6 +86,7 @@
 import android.content.res.Configuration;
 import android.content.res.ResourceId;
 import android.content.res.Resources;
+import android.content.res.Resources.NotFoundException;
 import android.graphics.Bitmap;
 import android.graphics.Canvas;
 import android.graphics.Color;
@@ -123,6 +124,7 @@
 import android.view.animation.TranslateAnimation;
 
 import com.android.internal.R;
+import com.android.internal.annotations.VisibleForTesting;
 import com.android.internal.util.DumpUtils.Dump;
 import com.android.internal.util.function.pooled.PooledLambda;
 import com.android.server.AttributeCache;
@@ -558,19 +560,19 @@
         }
         resId = updateToTranslucentAnimIfNeeded(resId, transit);
         if (ResourceId.isValid(resId)) {
-            return AnimationUtils.loadAnimation(context, resId);
+            return loadAnimationSafely(context, resId);
         }
         return null;
     }
 
-    Animation loadAnimationRes(LayoutParams lp, int resId) {
+    private Animation loadAnimationRes(LayoutParams lp, int resId) {
         Context context = mContext;
         if (ResourceId.isValid(resId)) {
             AttributeCache.Entry ent = getCachedAnimations(lp);
             if (ent != null) {
                 context = ent.context;
             }
-            return AnimationUtils.loadAnimation(context, resId);
+            return loadAnimationSafely(context, resId);
         }
         return null;
     }
@@ -579,12 +581,22 @@
         if (ResourceId.isValid(resId)) {
             AttributeCache.Entry ent = getCachedAnimations(packageName, resId);
             if (ent != null) {
-                return AnimationUtils.loadAnimation(ent.context, resId);
+                return loadAnimationSafely(ent.context, resId);
             }
         }
         return null;
     }
 
+    @VisibleForTesting
+    Animation loadAnimationSafely(Context context, int resId) {
+        try {
+            return AnimationUtils.loadAnimation(context, resId);
+        } catch (NotFoundException e) {
+            Slog.w(TAG, "Unable to load animation resource", e);
+            return null;
+        }
+    }
+
     private int updateToTranslucentAnimIfNeeded(int anim, int transit) {
         if (transit == TRANSIT_TRANSLUCENT_ACTIVITY_OPEN && anim == R.anim.activity_open_enter) {
             return R.anim.activity_translucent_open_enter;
diff --git a/services/core/java/com/android/server/wm/AppWindowThumbnail.java b/services/core/java/com/android/server/wm/AppWindowThumbnail.java
index 5519729..bbbf11d 100644
--- a/services/core/java/com/android/server/wm/AppWindowThumbnail.java
+++ b/services/core/java/com/android/server/wm/AppWindowThumbnail.java
@@ -118,7 +118,8 @@
         anim.scaleCurrentDuration(mAppToken.mWmService.getTransitionAnimationScaleLocked());
         mSurfaceAnimator.startAnimation(t, new LocalAnimationAdapter(
                 new WindowAnimationSpec(anim, position,
-                        mAppToken.getDisplayContent().mAppTransition.canSkipFirstFrame()),
+                        mAppToken.getDisplayContent().mAppTransition.canSkipFirstFrame(),
+                        mAppToken.mWmService.mWindowCornerRadius),
                 mAppToken.mWmService.mSurfaceAnimationRunner), false /* hidden */);
     }
 
diff --git a/services/core/java/com/android/server/wm/AppWindowToken.java b/services/core/java/com/android/server/wm/AppWindowToken.java
index 88c8b95..220370c 100644
--- a/services/core/java/com/android/server/wm/AppWindowToken.java
+++ b/services/core/java/com/android/server/wm/AppWindowToken.java
@@ -118,7 +118,7 @@
 import com.android.internal.util.ToBooleanFunction;
 import com.android.server.AttributeCache;
 import com.android.server.LocalServices;
-import com.android.server.display.ColorDisplayService;
+import com.android.server.display.color.ColorDisplayService;
 import com.android.server.policy.WindowManagerPolicy;
 import com.android.server.policy.WindowManagerPolicy.StartingSurface;
 import com.android.server.wm.RemoteAnimationController.RemoteAnimationRecord;
@@ -582,6 +582,8 @@
                     }
                 }
             }
+            // Changes in opening apps and closing apps may cause orientation change.
+            reportDescendantOrientationChangeIfNeeded();
             return;
         }
 
@@ -729,11 +731,31 @@
                 }
                 SurfaceControl.closeTransaction();
             }
+
+            // Visibility changes may cause orientation request change.
+            reportDescendantOrientationChangeIfNeeded();
         }
 
         return delayed;
     }
 
+    private void reportDescendantOrientationChangeIfNeeded() {
+        // Orientation request is exposed only when we're visible. Therefore visibility change
+        // will change requested orientation. Notify upward the hierarchy ladder to adjust
+        // configuration. This is important to cases where activities with incompatible
+        // orientations launch, or user goes back from an activity of bi-orientation to an
+        // activity with specified orientation.
+        if (mActivityRecord.getRequestedConfigurationOrientation() == getConfiguration().orientation
+                || getOrientationIgnoreVisibility() == SCREEN_ORIENTATION_UNSET) {
+            return;
+        }
+
+        final IBinder freezeToken =
+                mActivityRecord.mayFreezeScreenLocked(mActivityRecord.app)
+                        ? mActivityRecord.appToken : null;
+        onDescendantOrientationChanged(freezeToken, mActivityRecord);
+    }
+
     /**
      * @return The to top most child window for which {@link LayoutParams#isFullscreen()} returns
      *         true.
@@ -2526,7 +2548,8 @@
                             new WindowAnimationSpec(a, mTmpPoint, mTmpRect,
                                     getDisplayContent().mAppTransition.canSkipFirstFrame(),
                                     appStackClipMode,
-                                    true /* isAppAnimation */),
+                                    true /* isAppAnimation */,
+                                    mWmService.mWindowCornerRadius),
                             mWmService.mSurfaceAnimationRunner);
                     if (a.getZAdjustment() == Animation.ZORDER_TOP) {
                         mNeedsZBoost = true;
@@ -2761,6 +2784,8 @@
 
         getDisplayContent().mAppTransition.notifyAppTransitionFinishedLocked(token);
         scheduleAnimation();
+
+        mActivityRecord.onAnimationFinished();
     }
 
     @Override
diff --git a/services/core/java/com/android/server/wm/DisplayContent.java b/services/core/java/com/android/server/wm/DisplayContent.java
index ae76740..db59030 100644
--- a/services/core/java/com/android/server/wm/DisplayContent.java
+++ b/services/core/java/com/android/server/wm/DisplayContent.java
@@ -30,6 +30,7 @@
 import static android.content.res.Configuration.ORIENTATION_PORTRAIT;
 import static android.view.Display.DEFAULT_DISPLAY;
 import static android.view.Display.FLAG_PRIVATE;
+import static android.view.Display.FLAG_SHOULD_SHOW_SYSTEM_DECORATIONS;
 import static android.view.Display.INVALID_DISPLAY;
 import static android.view.InsetsState.TYPE_IME;
 import static android.view.Surface.ROTATION_0;
@@ -391,7 +392,8 @@
     final ArrayList<WindowToken> mExitingTokens = new ArrayList<>();
 
     /** Detect user tapping outside of current focused task bounds .*/
-    TaskTapPointerEventListener mTapDetector;
+    @VisibleForTesting
+    final TaskTapPointerEventListener mTapDetector;
 
     /** Detect user tapping outside of current focused stack bounds .*/
     private Region mTouchExcludeRegion = new Region();
@@ -875,14 +877,17 @@
         mBoundsAnimationController = new BoundsAnimationController(service.mContext,
                 mAppTransition, AnimationThread.getHandler(), animationHandler);
 
-        if (mWmService.mInputManager != null) {
-            final InputChannel inputChannel = mWmService.mInputManager.monitorInput("Display "
-                    + mDisplayId, mDisplayId);
-            mPointerEventDispatcher = inputChannel != null
-                    ? new PointerEventDispatcher(inputChannel) : null;
-        } else {
-            mPointerEventDispatcher = null;
-        }
+        final InputChannel inputChannel = mWmService.mInputManager.monitorInput(
+                "PointerEventDispatcher" + mDisplayId, mDisplayId);
+        mPointerEventDispatcher = new PointerEventDispatcher(inputChannel);
+
+        // Tap Listeners are supported for:
+        // 1. All physical displays (multi-display).
+        // 2. VirtualDisplays on VR, AA (and everything else).
+        mTapDetector = new TaskTapPointerEventListener(mWmService, this);
+        registerPointerEventListener(mTapDetector);
+        registerPointerEventListener(mWmService.mMousePositionTracker);
+
         mDisplayPolicy = new DisplayPolicy(service, this);
         mDisplayRotation = new DisplayRotation(service, this);
         if (isDefaultDisplay) {
@@ -1510,19 +1515,6 @@
 
         mDisplayFrames.onDisplayInfoUpdated(mDisplayInfo,
                 calculateDisplayCutoutForRotation(mDisplayInfo.rotation));
-
-        // Tap Listeners are supported for:
-        // 1. All physical displays (multi-display).
-        // 2. VirtualDisplays on VR, AA (and everything else).
-        if (mPointerEventDispatcher != null && mTapDetector == null) {
-            if (DEBUG_DISPLAY) {
-                Slog.d(TAG,
-                        "Registering PointerEventListener for DisplayId: " + mDisplayId);
-            }
-            mTapDetector = new TaskTapPointerEventListener(mWmService, this);
-            registerPointerEventListener(mTapDetector);
-            registerPointerEventListener(mWmService.mMousePositionTracker);
-        }
     }
 
     /**
@@ -2449,9 +2441,7 @@
             mTmpRegion.set(mTmpRect);
             mTouchExcludeRegion.op(mTmpRegion, Op.UNION);
         }
-        if (mTapDetector != null) {
-            mTapDetector.setTouchExcludeRegion(mTouchExcludeRegion);
-        }
+        mTapDetector.setTouchExcludeRegion(mTouchExcludeRegion);
     }
 
     /**
@@ -2501,11 +2491,7 @@
             mWmService.stopFreezingDisplayLocked();
             super.removeImmediately();
             if (DEBUG_DISPLAY) Slog.v(TAG_WM, "Removing display=" + this);
-            if (mPointerEventDispatcher != null && mTapDetector != null) {
-                unregisterPointerEventListener(mTapDetector);
-                unregisterPointerEventListener(mWmService.mMousePositionTracker);
-                mTapDetector = null;
-            }
+            mPointerEventDispatcher.dispose();
             mWmService.mAnimator.removeDisplayLocked(mDisplayId);
             mWindowingLayer.release();
             mOverlayLayer.release();
@@ -2515,7 +2501,6 @@
             mRemovingDisplay = false;
         }
 
-        mDisplayPolicy.onDisplayRemoved();
         mWmService.mWindowPlacerLocked.requestTraversal();
     }
 
@@ -4824,15 +4809,11 @@
     }
 
     void registerPointerEventListener(@NonNull PointerEventListener listener) {
-        if (mPointerEventDispatcher != null) {
-            mPointerEventDispatcher.registerInputEventListener(listener);
-        }
+        mPointerEventDispatcher.registerInputEventListener(listener);
     }
 
     void unregisterPointerEventListener(@NonNull PointerEventListener listener) {
-        if (mPointerEventDispatcher != null) {
-            mPointerEventDispatcher.unregisterInputEventListener(listener);
-        }
+        mPointerEventDispatcher.unregisterInputEventListener(listener);
     }
 
     void prepareAppTransition(@WindowManager.TransitionType int transit,
@@ -4904,10 +4885,10 @@
      * @see Display#FLAG_SHOULD_SHOW_SYSTEM_DECORATIONS
      */
     boolean supportsSystemDecorations() {
-        // TODO(b/114338689): Read the setting from DisplaySettings.
-        return mDisplay.supportsSystemDecorations()
+        return mWmService.mDisplayWindowSettings.shouldShowSystemDecorsLocked(this)
+                || (mDisplay.getFlags() & FLAG_SHOULD_SHOW_SYSTEM_DECORATIONS) != 0
                 // TODO (b/111363427): Remove this and set the new FLAG_SHOULD_SHOW_LAUNCHER flag
-                // (b/114338689) whenever vr 2d display id is set.
+                // whenever vr 2d display id is set.
                 || mDisplayId == mWmService.mVr2dDisplayId
                 || mWmService.mForceDesktopModeOnExternalDisplays;
     }
diff --git a/services/core/java/com/android/server/wm/DisplayPolicy.java b/services/core/java/com/android/server/wm/DisplayPolicy.java
index b028569..e48361f 100644
--- a/services/core/java/com/android/server/wm/DisplayPolicy.java
+++ b/services/core/java/com/android/server/wm/DisplayPolicy.java
@@ -158,6 +158,7 @@
 import com.android.server.policy.WindowManagerPolicy.WindowManagerFuncs;
 import com.android.server.policy.WindowOrientationListener;
 import com.android.server.statusbar.StatusBarManagerInternal;
+import com.android.server.wallpaper.WallpaperManagerInternal;
 import com.android.server.wm.utils.InsetUtils;
 
 import java.io.PrintWriter;
@@ -220,7 +221,6 @@
         }
     }
 
-    @VisibleForTesting
     private final SystemGesturesPointerEventListener mSystemGestures;
 
     private volatile int mLidState = LID_ABSENT;
@@ -535,7 +535,7 @@
             }
         } else {
             mHasStatusBar = false;
-            mHasNavigationBar = mDisplayContent.getDisplay().supportsSystemDecorations();
+            mHasNavigationBar = mDisplayContent.supportsSystemDecorations();
         }
     }
 
@@ -547,10 +547,6 @@
         return mDisplayContent.getDisplayId();
     }
 
-    void onDisplayRemoved() {
-        mDisplayContent.unregisterPointerEventListener(mSystemGestures);
-    }
-
     void configure(int width, int height, int shortSizeDp) {
         // Allow the navigation bar to move on non-square small devices (phones).
         mNavigationBarCanMove = width != height && shortSizeDp < 600;
@@ -1944,10 +1940,6 @@
                     } else {
                         vf.set(cf);
                     }
-
-                    // EXPERIMENT TODO(b/113952590): Remove once experiment in bug is completed
-                    mExperiments.offsetWindowFramesForNavBar(mNavigationBarPosition, win);
-                    // EXPERIMENT END
                 }
             } else if (layoutInScreen || (sysUiFl
                     & (View.SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN
@@ -2605,7 +2597,11 @@
     }
 
     void notifyDisplayReady() {
-        mHandler.post(() -> getStatusBarManagerInternal().onDisplayReady(getDisplayId()));
+        mHandler.post(() -> {
+            final int displayId = getDisplayId();
+            getStatusBarManagerInternal().onDisplayReady(displayId);
+            LocalServices.getService(WallpaperManagerInternal.class).onDisplayReady(displayId);
+        });
     }
 
     /**
diff --git a/services/core/java/com/android/server/wm/KeyguardController.java b/services/core/java/com/android/server/wm/KeyguardController.java
index feb711a..8c8b05f 100644
--- a/services/core/java/com/android/server/wm/KeyguardController.java
+++ b/services/core/java/com/android/server/wm/KeyguardController.java
@@ -29,6 +29,7 @@
 import static android.view.WindowManagerPolicyConstants.KEYGUARD_GOING_AWAY_FLAG_TO_SHADE;
 import static android.view.WindowManagerPolicyConstants.KEYGUARD_GOING_AWAY_FLAG_WITH_WALLPAPER;
 
+import static com.android.server.am.KeyguardControllerProto.AOD_SHOWING;
 import static com.android.server.am.KeyguardControllerProto.KEYGUARD_OCCLUDED_STATES;
 import static com.android.server.am.KeyguardControllerProto.KEYGUARD_SHOWING;
 import static com.android.server.am.KeyguardOccludedProto.DISPLAY_ID;
@@ -86,7 +87,7 @@
 
     /**
      * @return true if either Keyguard or AOD are showing, not going away, and not being occluded
-     *         on the given display, false otherwise
+     *         on the given display, false otherwise.
      */
     boolean isKeyguardOrAodShowing(int displayId) {
         return (mKeyguardShowing || mAodShowing) && !mKeyguardGoingAway
@@ -94,6 +95,16 @@
     }
 
     /**
+     * @return {@code true} if 1) Keyguard is showing, not going away, and not being occluded on the
+     *         given display, or 2) AOD is showing, {@code false} otherwise.
+     * TODO(b/125198167): Replace isKeyguardOrAodShowing() by this logic.
+     */
+    boolean isKeyguardUnoccludedOrAodShowing(int displayId) {
+        return (mKeyguardShowing && !mKeyguardGoingAway && !isDisplayOccluded(displayId))
+                || mAodShowing;
+    }
+
+    /**
      * @return true if Keyguard is showing, not going away, and not being occluded on the given
      *         display, false otherwise
      */
@@ -380,10 +391,11 @@
         for (int displayNdx = mRootActivityContainer.getChildCount() - 1;
              displayNdx >= 0; displayNdx--) {
             final ActivityDisplay display = mRootActivityContainer.getChildAt(displayNdx);
-            final KeyguardDisplayState state = getDisplay(display.mDisplayId);
-            if (isKeyguardOrAodShowing(display.mDisplayId) && state.mSleepToken == null) {
+            final int displayId = display.mDisplayId;
+            final KeyguardDisplayState state = getDisplay(displayId);
+            if (isKeyguardUnoccludedOrAodShowing(displayId) && state.mSleepToken == null) {
                 state.acquiredSleepToken();
-            } else if (!isKeyguardOrAodShowing(display.mDisplayId) && state.mSleepToken != null) {
+            } else if (!isKeyguardUnoccludedOrAodShowing(displayId) && state.mSleepToken != null) {
                 state.releaseSleepToken();
             }
         }
@@ -528,6 +540,7 @@
 
     void writeToProto(ProtoOutputStream proto, long fieldId) {
         final long token = proto.start(fieldId);
+        proto.write(AOD_SHOWING, mAodShowing);
         proto.write(KEYGUARD_SHOWING, mKeyguardShowing);
         writeDisplayStatesToProto(proto, KEYGUARD_OCCLUDED_STATES);
         proto.end(token);
diff --git a/services/core/java/com/android/server/wm/Letterbox.java b/services/core/java/com/android/server/wm/Letterbox.java
index f8f693c..3110fb9 100644
--- a/services/core/java/com/android/server/wm/Letterbox.java
+++ b/services/core/java/com/android/server/wm/Letterbox.java
@@ -236,6 +236,7 @@
                     .setFlags(HIDDEN).setColorLayer().build();
             mSurface.setLayer(-1);
             mSurface.setColor(new float[]{0, 0, 0});
+            mSurface.setColorSpaceAgnostic(true);
         }
 
         void attachInput(WindowState win) {
diff --git a/services/core/java/com/android/server/wm/PersisterQueue.java b/services/core/java/com/android/server/wm/PersisterQueue.java
index a17ee65..9dc3d6a 100644
--- a/services/core/java/com/android/server/wm/PersisterQueue.java
+++ b/services/core/java/com/android/server/wm/PersisterQueue.java
@@ -131,10 +131,8 @@
     }
 
     /**
-     *
-     * @param item
-     * @param flush
-     * @param <T>
+     * Updates the last item found in the queue that matches the given item, or adds it to the end
+     * of the queue if no such item is found.
      */
     synchronized <T extends WriteQueueItem> void updateLastOrAddItem(T item, boolean flush) {
         final T itemToUpdate = findLastItem(item::matches, (Class<T>) item.getClass());
@@ -149,10 +147,6 @@
 
     /**
      * Removes all items with which given predicate returns {@code true}.
-     *
-     * @param predicate the predicate
-     * @param clazz
-     * @param <T>
      */
     synchronized <T extends WriteQueueItem> void removeItems(Predicate<T> predicate,
             Class<T> clazz) {
diff --git a/services/core/java/com/android/server/wm/PointerEventDispatcher.java b/services/core/java/com/android/server/wm/PointerEventDispatcher.java
index f815fa0..8d08aa3 100644
--- a/services/core/java/com/android/server/wm/PointerEventDispatcher.java
+++ b/services/core/java/com/android/server/wm/PointerEventDispatcher.java
@@ -28,11 +28,13 @@
 import java.util.ArrayList;
 
 public class PointerEventDispatcher extends InputEventReceiver {
-    ArrayList<PointerEventListener> mListeners = new ArrayList<PointerEventListener>();
-    PointerEventListener[] mListenersArray = new PointerEventListener[0];
+    private final InputChannel mInputChannel;
+    private final ArrayList<PointerEventListener> mListeners = new ArrayList<>();
+    private PointerEventListener[] mListenersArray = new PointerEventListener[0];
 
     public PointerEventDispatcher(InputChannel inputChannel) {
         super(inputChannel, UiThread.getHandler().getLooper());
+        mInputChannel = inputChannel;
     }
 
     @Override
@@ -87,4 +89,15 @@
             mListenersArray = null;
         }
     }
+
+    /** Dispose the associated input channel and clean up the listeners. */
+    @Override
+    public void dispose() {
+        super.dispose();
+        mInputChannel.dispose();
+        synchronized (mListeners) {
+            mListeners.clear();
+            mListenersArray = null;
+        }
+    }
 }
diff --git a/services/core/java/com/android/server/wm/RootActivityContainer.java b/services/core/java/com/android/server/wm/RootActivityContainer.java
index 6988357..f964b57 100644
--- a/services/core/java/com/android/server/wm/RootActivityContainer.java
+++ b/services/core/java/com/android/server/wm/RootActivityContainer.java
@@ -175,12 +175,6 @@
     private ActivityDisplay mDefaultDisplay;
     private final SparseArray<IntArray> mDisplayAccessUIDs = new SparseArray<>();
 
-    /**
-     * Cached value of the topmost resumed activity in the system. Updated when new activity is
-     * resumed.
-     */
-    private ActivityRecord mTopResumedActivity;
-
     /** The current user */
     int mCurrentUser;
     /** Stack id of the front stack when user switched, indexed by userId. */
@@ -368,6 +362,8 @@
         if (displayId == DEFAULT_DISPLAY) {
             homeIntent = mService.getHomeIntent();
             aInfo = resolveHomeActivity(userId, homeIntent);
+        } else if (!mService.mSupportsMultiDisplay) {
+            return false;
         } else {
             Pair<ActivityInfo, Intent> info = resolveSecondaryHomeActivity(userId, displayId);
             aInfo = info.first;
@@ -550,6 +546,11 @@
             return true;
         }
 
+        if (displayId != DEFAULT_DISPLAY && !mService.mSupportsMultiDisplay) {
+            // Can't launch home on secondary display if device not support multi-display.
+            return false;
+        }
+
         final boolean deviceProvisioned = Settings.Global.getInt(
                 mService.mContext.getContentResolver(),
                 Settings.Global.DEVICE_PROVISIONED, 0) != 0;
@@ -1155,23 +1156,6 @@
         return result;
     }
 
-    void updateTopResumedActivityIfNeeded() {
-        final ActivityRecord prevTopActivity = mTopResumedActivity;
-        final ActivityStack topStack = getTopDisplayFocusedStack();
-        if (topStack == null || topStack.mResumedActivity == prevTopActivity) {
-            return;
-        }
-        // Clear previous top state
-        if (prevTopActivity != null) {
-            prevTopActivity.scheduleTopResumedActivityChanged(false /* onTop */);
-        }
-        // Update the current top activity
-        mTopResumedActivity = topStack.mResumedActivity;
-        if (mTopResumedActivity != null) {
-            mTopResumedActivity.scheduleTopResumedActivityChanged(true /* onTop */);
-        }
-    }
-
     void applySleepTokens(boolean applyToStacks) {
         for (int displayNdx = mActivityDisplays.size() - 1; displayNdx >= 0; --displayNdx) {
             // Set the sleeping state of the display.
@@ -1434,7 +1418,7 @@
             mActivityDisplays.remove(display);
             mActivityDisplays.add(position, display);
         }
-        updateTopResumedActivityIfNeeded();
+        mStackSupervisor.updateTopResumedActivityIfNeeded();
     }
 
     @VisibleForTesting
@@ -2039,8 +2023,7 @@
                 final ActivityStack stack = display.getChildAt(stackNdx);
                 final ActivityRecord r = stack.getResumedActivity();
                 if (r != null) {
-                    if (!r.nowVisible
-                            || mStackSupervisor.mActivitiesWaitingForVisibleActivity.contains(r)) {
+                    if (!r.nowVisible) {
                         return false;
                     }
                     foundResumed = true;
@@ -2368,10 +2351,6 @@
         printed |= dumpHistoryList(fd, pw, mStackSupervisor.mStoppingActivities, "  ",
                 "Stop", false, !dumpAll,
                 false, dumpPackage, true, "  Activities waiting to stop:", null);
-        printed |= dumpHistoryList(fd, pw,
-                mStackSupervisor.mActivitiesWaitingForVisibleActivity, "  ", "Wait",
-                false, !dumpAll, false, dumpPackage, true,
-                "  Activities waiting for another to become visible:", null);
         printed |= dumpHistoryList(fd, pw, mStackSupervisor.mGoingToSleepActivities,
                 "  ", "Sleep", false, !dumpAll,
                 false, dumpPackage, true, "  Activities waiting to sleep:", null);
diff --git a/services/core/java/com/android/server/wm/Task.java b/services/core/java/com/android/server/wm/Task.java
index 888d741..499cbaf 100644
--- a/services/core/java/com/android/server/wm/Task.java
+++ b/services/core/java/com/android/server/wm/Task.java
@@ -330,7 +330,7 @@
         // No one in higher hierarchy handles this request, let's adjust our bounds to fulfill
         // it if possible.
         // TODO: Move to TaskRecord after unification is done.
-        if (mTaskRecord != null) {
+        if (mTaskRecord != null && mTaskRecord.getParent() != null) {
             mTaskRecord.onConfigurationChanged(mTaskRecord.getParent().getConfiguration());
             return true;
         }
diff --git a/services/core/java/com/android/server/wm/TaskChangeNotificationController.java b/services/core/java/com/android/server/wm/TaskChangeNotificationController.java
index 789f987..3d57219 100644
--- a/services/core/java/com/android/server/wm/TaskChangeNotificationController.java
+++ b/services/core/java/com/android/server/wm/TaskChangeNotificationController.java
@@ -24,6 +24,7 @@
 import android.content.ComponentName;
 import android.os.Binder;
 import android.os.Handler;
+import android.os.IBinder;
 import android.os.Looper;
 import android.os.Message;
 import android.os.RemoteCallbackList;
@@ -50,6 +51,8 @@
     private static final int NOTIFY_PINNED_STACK_ANIMATION_STARTED_LISTENERS_MSG = 16;
     private static final int NOTIFY_ACTIVITY_UNPINNED_LISTENERS_MSG = 17;
     private static final int NOTIFY_ACTIVITY_LAUNCH_ON_SECONDARY_DISPLAY_FAILED_MSG = 18;
+    private static final int NOTIFY_ACTIVITY_LAUNCH_ON_SECONDARY_DISPLAY_REROUTED_MSG = 19;
+    private static final int NOTIFY_SIZE_COMPAT_MODE_ACTIVITY_CHANGED_MSG = 20;
 
     // Delay in notifying task stack change listeners (in millis)
     private static final int NOTIFY_TASK_STACK_CHANGE_LISTENERS_DELAY = 100;
@@ -130,6 +133,10 @@
         l.onActivityLaunchOnSecondaryDisplayFailed((RunningTaskInfo) m.obj, m.arg1);
     };
 
+    private final TaskStackConsumer mNotifyActivityLaunchOnSecondaryDisplayRerouted = (l, m) -> {
+        l.onActivityLaunchOnSecondaryDisplayRerouted((RunningTaskInfo) m.obj, m.arg1);
+    };
+
     private final TaskStackConsumer mNotifyTaskProfileLocked = (l, m) -> {
         l.onTaskProfileLocked(m.arg1, m.arg2);
     };
@@ -138,6 +145,10 @@
         l.onTaskSnapshotChanged(m.arg1, (TaskSnapshot) m.obj);
     };
 
+    private final TaskStackConsumer mOnSizeCompatModeActivityChanged = (l, m) -> {
+        l.onSizeCompatModeActivityChanged(m.arg1, (IBinder) m.obj);
+    };
+
     @FunctionalInterface
     public interface TaskStackConsumer {
         void accept(ITaskStackListener t, Message m) throws RemoteException;
@@ -202,12 +213,18 @@
                 case NOTIFY_ACTIVITY_LAUNCH_ON_SECONDARY_DISPLAY_FAILED_MSG:
                     forAllRemoteListeners(mNotifyActivityLaunchOnSecondaryDisplayFailed, msg);
                     break;
+                case NOTIFY_ACTIVITY_LAUNCH_ON_SECONDARY_DISPLAY_REROUTED_MSG:
+                    forAllRemoteListeners(mNotifyActivityLaunchOnSecondaryDisplayRerouted, msg);
+                    break;
                 case NOTIFY_TASK_PROFILE_LOCKED_LISTENERS_MSG:
                     forAllRemoteListeners(mNotifyTaskProfileLocked, msg);
                     break;
                 case NOTIFY_TASK_SNAPSHOT_CHANGED_LISTENERS_MSG:
                     forAllRemoteListeners(mNotifyTaskSnapshotChanged, msg);
                     break;
+                case NOTIFY_SIZE_COMPAT_MODE_ACTIVITY_CHANGED_MSG:
+                    forAllRemoteListeners(mOnSizeCompatModeActivityChanged, msg);
+                    break;
             }
         }
     }
@@ -355,6 +372,15 @@
         msg.sendToTarget();
     }
 
+    void notifyActivityLaunchOnSecondaryDisplayRerouted(TaskInfo ti, int requestedDisplayId) {
+        mHandler.removeMessages(NOTIFY_ACTIVITY_LAUNCH_ON_SECONDARY_DISPLAY_REROUTED_MSG);
+        final Message msg = mHandler.obtainMessage(
+                NOTIFY_ACTIVITY_LAUNCH_ON_SECONDARY_DISPLAY_REROUTED_MSG, requestedDisplayId,
+                0 /* unused */, ti);
+        forAllLocalListeners(mNotifyActivityLaunchOnSecondaryDisplayRerouted, msg);
+        msg.sendToTarget();
+    }
+
     void notifyTaskCreated(int taskId, ComponentName componentName) {
         final Message msg = mHandler.obtainMessage(NOTIFY_TASK_ADDED_LISTENERS_MSG,
                 taskId, 0 /* unused */, componentName);
@@ -421,4 +447,15 @@
         forAllLocalListeners(mNotifyTaskSnapshotChanged, msg);
         msg.sendToTarget();
     }
+
+    /**
+     * Notify listeners that whether a size compatibility mode activity is using the override
+     * bounds which is not fit its parent.
+     */
+    void notifySizeCompatModeActivityChanged(int displayId, IBinder activityToken) {
+        final Message msg = mHandler.obtainMessage(NOTIFY_SIZE_COMPAT_MODE_ACTIVITY_CHANGED_MSG,
+                displayId, 0 /* unused */, activityToken);
+        forAllLocalListeners(mOnSizeCompatModeActivityChanged, msg);
+        msg.sendToTarget();
+    }
 }
diff --git a/services/core/java/com/android/server/wm/TaskLaunchParamsModifier.java b/services/core/java/com/android/server/wm/TaskLaunchParamsModifier.java
index f3050a9..904c503 100644
--- a/services/core/java/com/android/server/wm/TaskLaunchParamsModifier.java
+++ b/services/core/java/com/android/server/wm/TaskLaunchParamsModifier.java
@@ -235,8 +235,7 @@
         // STEP 2.3: Adjust launch parameters as needed for freeform display. We enforce the policy
         // that legacy (pre-D) apps and those apps that can't handle multiple screen density well
         // are forced to be maximized. The rest of this step is to define the default policy when
-        // there is no initial bounds or a fully resolved current params from callers. Right now we
-        // launch all possible tasks/activities that can handle freeform into freeform mode.
+        // there is no initial bounds or a fully resolved current params from callers.
         if (display.inFreeformWindowingMode()) {
             if (launchMode == WINDOWING_MODE_PINNED) {
                 if (DEBUG) appendLog("picture-in-picture");
@@ -247,17 +246,6 @@
                 launchMode = WINDOWING_MODE_FULLSCREEN;
                 outParams.mBounds.setEmpty();
                 if (DEBUG) appendLog("forced-maximize");
-            } else if (fullyResolvedCurrentParam) {
-                // Don't adjust launch mode if that's inherited, except when we're launching an
-                // activity that should be forced to maximize.
-                if (DEBUG) appendLog("skip-adjustment-fully-resolved-params");
-            } else if (launchMode != WINDOWING_MODE_FREEFORM
-                    && (isNOrGreater(root) || isPreNResizeable(root))) {
-                // We're launching a pre-N and post-D activity that supports resizing, or a post-N
-                // activity. They can handle freeform nicely so launch them in freeform.
-                // Use undefined because we know we're in a freeform display.
-                launchMode = WINDOWING_MODE_UNDEFINED;
-                if (DEBUG) appendLog("should-be-freeform");
             }
         } else {
             if (DEBUG) appendLog("non-freeform-display");
@@ -441,10 +429,6 @@
         return !root.isResizeable();
     }
 
-    private boolean isNOrGreater(@NonNull ActivityRecord root) {
-        return root.appInfo.targetSdkVersion >= Build.VERSION_CODES.N;
-    }
-
     /**
      * Resolves activity requested orientation to 4 categories:
      * 1) {@link ActivityInfo#SCREEN_ORIENTATION_LOCKED} indicating app wants to lock down
@@ -485,10 +469,6 @@
         return orientation;
     }
 
-    private boolean isPreNResizeable(ActivityRecord root) {
-        return root.appInfo.targetSdkVersion < Build.VERSION_CODES.N && root.isResizeable();
-    }
-
     private void cascadeBounds(@NonNull Rect srcBounds, @NonNull ActivityDisplay display,
             @NonNull Rect outBounds) {
         outBounds.set(srcBounds);
diff --git a/services/core/java/com/android/server/wm/TaskPersister.java b/services/core/java/com/android/server/wm/TaskPersister.java
index d50af38..06bdcc0 100644
--- a/services/core/java/com/android/server/wm/TaskPersister.java
+++ b/services/core/java/com/android/server/wm/TaskPersister.java
@@ -492,16 +492,8 @@
         return new File(userTaskIdsDir, PERSISTED_TASK_IDS_FILENAME);
     }
 
-    static File getUserTasksDir(int userId) {
-        File userTasksDir = new File(Environment.getDataSystemCeDirectory(userId), TASKS_DIRNAME);
-
-        if (!userTasksDir.exists()) {
-            if (!userTasksDir.mkdir()) {
-                Slog.e(TAG, "Failure creating tasks directory for user " + userId + ": "
-                        + userTasksDir);
-            }
-        }
-        return userTasksDir;
+    private static File getUserTasksDir(int userId) {
+        return new File(Environment.getDataSystemCeDirectory(userId), TASKS_DIRNAME);
     }
 
     static File getUserImagesDir(int userId) {
@@ -568,8 +560,13 @@
                 FileOutputStream file = null;
                 AtomicFile atomicFile = null;
                 try {
-                    atomicFile = new AtomicFile(new File(
-                            getUserTasksDir(task.userId),
+                    File userTasksDir = getUserTasksDir(task.userId);
+                    if (!userTasksDir.isDirectory() && !userTasksDir.mkdirs()) {
+                        Slog.e(TAG, "Failure creating tasks directory for user " + task.userId
+                                + ": " + userTasksDir + " Dropping persistence for task " + task);
+                        return;
+                    }
+                    atomicFile = new AtomicFile(new File(userTasksDir,
                             String.valueOf(task.taskId) + TASK_FILENAME_SUFFIX));
                     file = atomicFile.startWrite();
                     file.write(stringWriter.toString().getBytes());
diff --git a/services/core/java/com/android/server/wm/TaskPositioner.java b/services/core/java/com/android/server/wm/TaskPositioner.java
index b88e581..4a0831e 100644
--- a/services/core/java/com/android/server/wm/TaskPositioner.java
+++ b/services/core/java/com/android/server/wm/TaskPositioner.java
@@ -43,16 +43,15 @@
 import android.view.BatchedInputEventReceiver;
 import android.view.Choreographer;
 import android.view.Display;
+import android.view.InputApplicationHandle;
 import android.view.InputChannel;
 import android.view.InputDevice;
 import android.view.InputEvent;
+import android.view.InputWindowHandle;
 import android.view.MotionEvent;
 import android.view.WindowManager;
 
 import com.android.internal.annotations.VisibleForTesting;
-import android.view.InputApplicationHandle;
-import android.view.InputWindowHandle;
-import com.android.server.wm.WindowManagerService.H;
 
 import java.lang.annotation.Retention;
 import java.lang.annotation.RetentionPolicy;
@@ -356,12 +355,10 @@
                     + startY + "}");
         }
         mTask = win.getTask();
-        // Use the dim bounds, not the original task bounds. The cursor
-        // movement should be calculated relative to the visible bounds.
-        // Also, use the dim bounds of the task which accounts for
+        // Use the bounds of the task which accounts for
         // multiple app windows. Don't use any bounds from win itself as it
         // may not be the same size as the task.
-        mTask.getDimBounds(mTmpRect);
+        mTask.getBounds(mTmpRect);
         startDrag(resize, preserveOrientation, startX, startY, mTmpRect);
     }
 
diff --git a/services/core/java/com/android/server/wm/TaskRecord.java b/services/core/java/com/android/server/wm/TaskRecord.java
index 1392762..4fd8489 100644
--- a/services/core/java/com/android/server/wm/TaskRecord.java
+++ b/services/core/java/com/android/server/wm/TaskRecord.java
@@ -202,13 +202,6 @@
     // Do not move the stack as a part of reparenting
     static final int REPARENT_LEAVE_STACK_IN_PLACE = 2;
 
-    // The height/width divide used when fitting a task within a bounds with method
-    // {@link #fitWithinBounds}.
-    // We always want the task to to be visible in the bounds without affecting its size when
-    // fitting. To make sure this is the case, we don't adjust the task left or top side pass
-    // the input bounds right or bottom side minus the width or height divided by this value.
-    private static final int FIT_WITHIN_BOUNDS_DIVIDER = 3;
-
     /**
      * The factory used to create {@link TaskRecord}. This allows OEM subclass {@link TaskRecord}.
      */
@@ -1932,35 +1925,33 @@
      *
      * @param bounds Bounds to be adjusted.
      * @param stackBounds Bounds within which the other bounds should remain.
+     * @param overlapPxX The amount of px required to be visible in the X dimension.
+     * @param overlapPxY The amount of px required to be visible in the Y dimension.
      */
-    private static void fitWithinBounds(Rect bounds, Rect stackBounds) {
+    private static void fitWithinBounds(Rect bounds, Rect stackBounds, int overlapPxX,
+            int overlapPxY) {
         if (stackBounds == null || stackBounds.isEmpty() || stackBounds.contains(bounds)) {
             return;
         }
 
-        if (bounds.left < stackBounds.left || bounds.right > stackBounds.right) {
-            final int maxRight = stackBounds.right
-                    - (stackBounds.width() / FIT_WITHIN_BOUNDS_DIVIDER);
-            int horizontalDiff = stackBounds.left - bounds.left;
-            if ((horizontalDiff < 0 && bounds.left >= maxRight)
-                    || (bounds.left + horizontalDiff >= maxRight)) {
-                horizontalDiff = maxRight - bounds.left;
-            }
-            bounds.left += horizontalDiff;
-            bounds.right += horizontalDiff;
+        // For each side of the parent (eg. left), check if the opposing side of the window (eg.
+        // right) is at least overlap pixels away. If less, offset the window by that difference.
+        int horizontalDiff = 0;
+        // If window is smaller than overlap, use it's smallest dimension instead
+        int overlapLR = Math.min(overlapPxX, bounds.width());
+        if (bounds.right < (stackBounds.left + overlapLR)) {
+            horizontalDiff = overlapLR - (bounds.right - stackBounds.left);
+        } else if (bounds.left > (stackBounds.right - overlapLR)) {
+            horizontalDiff = -(overlapLR - (stackBounds.right - bounds.left));
         }
-
-        if (bounds.top < stackBounds.top || bounds.bottom > stackBounds.bottom) {
-            final int maxBottom = stackBounds.bottom
-                    - (stackBounds.height() / FIT_WITHIN_BOUNDS_DIVIDER);
-            int verticalDiff = stackBounds.top - bounds.top;
-            if ((verticalDiff < 0 && bounds.top >= maxBottom)
-                    || (bounds.top + verticalDiff >= maxBottom)) {
-                verticalDiff = maxBottom - bounds.top;
-            }
-            bounds.top += verticalDiff;
-            bounds.bottom += verticalDiff;
+        int verticalDiff = 0;
+        int overlapTB = Math.min(overlapPxY, bounds.width());
+        if (bounds.bottom < (stackBounds.top + overlapTB)) {
+            verticalDiff = overlapTB - (bounds.bottom - stackBounds.top);
+        } else if (bounds.top > (stackBounds.bottom - overlapTB)) {
+            verticalDiff = -(overlapTB - (stackBounds.bottom - bounds.top));
         }
+        bounds.offset(horizontalDiff, verticalDiff);
     }
 
     /**
@@ -2230,7 +2221,11 @@
         adjustForMinimalTaskDimensions(outOverrideBounds, mTmpBounds);
         if (windowingMode == WINDOWING_MODE_FREEFORM) {
             // by policy, make sure the window remains within parent somewhere
-            fitWithinBounds(outOverrideBounds, newParentConfig.windowConfiguration.getBounds());
+            final float density =
+                    ((float) newParentConfig.densityDpi) / DisplayMetrics.DENSITY_DEFAULT;
+            fitWithinBounds(outOverrideBounds, newParentConfig.windowConfiguration.getBounds(),
+                    (int) (density * WindowState.MINIMUM_VISIBLE_WIDTH_IN_DP),
+                    (int) (density * WindowState.MINIMUM_VISIBLE_HEIGHT_IN_DP));
         }
         computeConfigResourceOverrides(getResolvedOverrideConfiguration(), newParentConfig);
     }
diff --git a/services/core/java/com/android/server/wm/WindowAnimationSpec.java b/services/core/java/com/android/server/wm/WindowAnimationSpec.java
index 98c77ac..57311e1 100644
--- a/services/core/java/com/android/server/wm/WindowAnimationSpec.java
+++ b/services/core/java/com/android/server/wm/WindowAnimationSpec.java
@@ -17,10 +17,10 @@
 package com.android.server.wm;
 
 import static com.android.server.wm.AnimationAdapter.STATUS_BAR_TRANSITION_DURATION;
-import static com.android.server.wm.WindowStateAnimator.STACK_CLIP_AFTER_ANIM;
-import static com.android.server.wm.WindowStateAnimator.STACK_CLIP_NONE;
 import static com.android.server.wm.AnimationSpecProto.WINDOW;
 import static com.android.server.wm.WindowAnimationSpecProto.ANIMATION;
+import static com.android.server.wm.WindowStateAnimator.STACK_CLIP_AFTER_ANIM;
+import static com.android.server.wm.WindowStateAnimator.STACK_CLIP_NONE;
 
 import android.graphics.Point;
 import android.graphics.Rect;
@@ -51,18 +51,22 @@
     private final Rect mStackBounds = new Rect();
     private int mStackClipMode;
     private final Rect mTmpRect = new Rect();
+    private final float mWindowCornerRadius;
 
-    public WindowAnimationSpec(Animation animation, Point position, boolean canSkipFirstFrame)  {
+    public WindowAnimationSpec(Animation animation, Point position, boolean canSkipFirstFrame,
+            float windowCornerRadius)  {
         this(animation, position, null /* stackBounds */, canSkipFirstFrame, STACK_CLIP_NONE,
-                false /* isAppAnimation */);
+                false /* isAppAnimation */, windowCornerRadius);
     }
 
     public WindowAnimationSpec(Animation animation, Point position, Rect stackBounds,
-            boolean canSkipFirstFrame, int stackClipMode, boolean isAppAnimation) {
+            boolean canSkipFirstFrame, int stackClipMode, boolean isAppAnimation,
+            float windowCornerRadius) {
         mAnimation = animation;
         if (position != null) {
             mPosition.set(position.x, position.y);
         }
+        mWindowCornerRadius = windowCornerRadius;
         mCanSkipFirstFrame = canSkipFirstFrame;
         mIsAppAnimation = isAppAnimation;
         mStackClipMode = stackClipMode;
@@ -101,6 +105,9 @@
             mTmpRect.intersect(tmp.transformation.getClipRect());
             t.setWindowCrop(leash, mTmpRect);
         }
+        if (mAnimation.hasRoundedCorners() && mWindowCornerRadius > 0) {
+            t.setCornerRadius(leash, mWindowCornerRadius);
+        }
     }
 
     @Override
diff --git a/services/core/java/com/android/server/wm/WindowContainer.java b/services/core/java/com/android/server/wm/WindowContainer.java
index 76f080b..05d4760 100644
--- a/services/core/java/com/android/server/wm/WindowContainer.java
+++ b/services/core/java/com/android/server/wm/WindowContainer.java
@@ -1292,6 +1292,7 @@
      * Called when an animation has finished running.
      */
     protected void onAnimationFinished() {
+        mWmService.onAnimationFinished();
     }
 
     /**
diff --git a/services/core/java/com/android/server/wm/WindowManagerInternal.java b/services/core/java/com/android/server/wm/WindowManagerInternal.java
index 33e46f4..d3f3711 100644
--- a/services/core/java/com/android/server/wm/WindowManagerInternal.java
+++ b/services/core/java/com/android/server/wm/WindowManagerInternal.java
@@ -474,4 +474,9 @@
      * Return the display Id for given window.
      */
     public abstract int getDisplayIdForWindow(IBinder windowToken);
+
+    /**
+     * Checks whether this display should support showing system decorations.
+     */
+    public abstract boolean shouldShowSystemDecorOnDisplay(int displayId);
 }
diff --git a/services/core/java/com/android/server/wm/WindowManagerService.java b/services/core/java/com/android/server/wm/WindowManagerService.java
index e19c7c6..e3a8be5 100644
--- a/services/core/java/com/android/server/wm/WindowManagerService.java
+++ b/services/core/java/com/android/server/wm/WindowManagerService.java
@@ -145,6 +145,7 @@
 import android.hardware.display.DisplayManager;
 import android.hardware.display.DisplayManagerInternal;
 import android.hardware.input.InputManager;
+import android.hardware.input.InputManagerInternal;
 import android.net.Uri;
 import android.os.Binder;
 import android.os.Build;
@@ -231,9 +232,11 @@
 
 import com.android.internal.R;
 import com.android.internal.annotations.VisibleForTesting;
+import com.android.internal.os.BackgroundThread;
 import com.android.internal.os.IResultReceiver;
 import com.android.internal.policy.IKeyguardDismissCallback;
 import com.android.internal.policy.IShortcutService;
+import com.android.internal.policy.ScreenDecorationsUtils;
 import com.android.internal.util.DumpUtils;
 import com.android.internal.util.FastPrintWriter;
 import com.android.internal.util.LatencyTracker;
@@ -372,6 +375,8 @@
     private static final int TRANSITION_ANIMATION_SCALE = 1;
     private static final int ANIMATION_DURATION_SCALE = 2;
 
+    private static final int ANIMATION_COMPLETED_TIMEOUT_MS = 5000;
+
     final WindowTracing mWindowTracing;
 
     final private KeyguardDisableHandler mKeyguardDisableHandler;
@@ -410,6 +415,14 @@
         @Override
         public void dumpCritical(FileDescriptor fd, PrintWriter pw, String[] args,
                 boolean asProto) {
+            // Bugreport dumps the trace 2x, 1x as proto and 1x as text. Save file to disk only 1x.
+            if (asProto && mWindowTracing.isEnabled()) {
+                mWindowTracing.stopTrace(null, false /* writeToFile */);
+                BackgroundThread.getHandler().post(() -> {
+                    mWindowTracing.writeTraceToFile();
+                    mWindowTracing.startTrace(null);
+                });
+            }
             doDump(fd, pw, new String[] {"-a"}, asProto);
         }
 
@@ -751,24 +764,27 @@
     final DisplayManager mDisplayManager;
     final ActivityTaskManagerService mAtmService;
 
-    // Indicates whether this device supports wide color gamut / HDR rendering
+    /** Corner radius that windows should have in order to match the display. */
+    final float mWindowCornerRadius;
+
+    /** Indicates whether this device supports wide color gamut / HDR rendering */
     private boolean mHasWideColorGamutSupport;
     private boolean mHasHdrSupport;
 
-    // Who is holding the screen on.
+    /** Who is holding the screen on. */
     private Session mHoldingScreenOn;
     private PowerManager.WakeLock mHoldingScreenWakeLock;
 
-    // Whether or not a layout can cause a wake up when theater mode is enabled.
+    /** Whether or not a layout can cause a wake up when theater mode is enabled. */
     boolean mAllowTheaterModeWakeFromLayout;
 
     final TaskPositioningController mTaskPositioningController;
     final DragDropController mDragDropController;
 
-    // For frozen screen animations.
+    /** For frozen screen animations. */
     private int mExitAnimId, mEnterAnimId;
 
-    // The display that the rotation animation is applying to.
+    /** The display that the rotation animation is applying to. */
     private int mFrozenDisplayId;
 
     /** Skip repeated AppWindowTokens initialization. Note that AppWindowsToken's version of this
@@ -975,7 +991,7 @@
         mInputManager = inputManager; // Must be before createDisplayContentLocked.
         mDisplayManagerInternal = LocalServices.getService(DisplayManagerInternal.class);
         mDisplayWindowSettings = new DisplayWindowSettings(this);
-
+        mWindowCornerRadius = ScreenDecorationsUtils.getWindowCornerRadius(context.getResources());
 
         mTransactionFactory = transactionFactory;
         mTransaction = mTransactionFactory.make();
@@ -1172,8 +1188,7 @@
                         + displayId + ".  Aborting.");
                 return WindowManagerGlobal.ADD_INVALID_DISPLAY;
             }
-            if (!displayContent.hasAccess(session.mUid)
-                    && !mDisplayManagerInternal.isUidPresentOnDisplay(session.mUid, displayId)) {
+            if (!displayContent.hasAccess(session.mUid)) {
                 Slog.w(TAG_WM, "Attempted to add window to a display for which the application "
                         + "does not have access: " + displayId + ".  Aborting.");
                 return WindowManagerGlobal.ADD_INVALID_DISPLAY;
@@ -1979,6 +1994,10 @@
                     updateNonSystemOverlayWindowsVisibilityIfNeeded(
                             win, win.mWinAnimator.getShown());
                 }
+                if ((attrChanges & (WindowManager.LayoutParams.PRIVATE_FLAGS_CHANGED)) != 0) {
+                    winAnimator.setColorSpaceAgnosticLocked((win.mAttrs.privateFlags
+                            & WindowManager.LayoutParams.PRIVATE_FLAG_COLOR_SPACE_AGNOSTIC) != 0);
+                }
             }
 
             if (DEBUG_LAYOUT) Slog.v(TAG_WM, "Relayout " + win + ": viewVisibility=" + viewVisibility
@@ -6176,9 +6195,6 @@
                 return;
             } else if ("trace".equals(cmd)) {
                 dumpTraceStatus(pw);
-                synchronized (mGlobalLock) {
-                    mWindowTracing.writeTraceToFile();
-                }
                 return;
             } else {
                 // Dumping a single name?
@@ -6769,7 +6785,7 @@
                         + "not exist: " + displayId);
                 return false;
             }
-            return mDisplayWindowSettings.shouldShowSystemDecorsLocked(displayContent);
+            return displayContent.supportsSystemDecorations();
         }
     }
 
@@ -7238,6 +7254,13 @@
                 return Display.INVALID_DISPLAY;
             }
         }
+
+        @Override
+        public boolean shouldShowSystemDecorOnDisplay(int displayId) {
+            synchronized (mGlobalLock) {
+                return WindowManagerService.this.shouldShowSystemDecors(displayId);
+            }
+        }
     }
 
     void registerAppFreezeListener(AppFreezeListener listener) {
@@ -7424,13 +7447,38 @@
 
     @Override
     public boolean injectInputAfterTransactionsApplied(InputEvent ev, int mode) {
+        waitForAnimationsToComplete();
+
         synchronized (mGlobalLock) {
             mWindowPlacerLocked.performSurfacePlacementIfScheduled();
-            new SurfaceControl.Transaction()
-                    .syncInputWindows()
-                    .apply(true);
         }
 
-        return mInputManager.injectInputEvent(ev, mode);
+        new SurfaceControl.Transaction().syncInputWindows().apply(true);
+
+        return LocalServices.getService(InputManagerInternal.class).injectInputEvent(ev, mode);
+    }
+
+    private void waitForAnimationsToComplete() {
+        synchronized (mGlobalLock) {
+            long timeoutRemaining = ANIMATION_COMPLETED_TIMEOUT_MS;
+            while (mRoot.isSelfOrChildAnimating() && timeoutRemaining > 0) {
+                long startTime = System.currentTimeMillis();
+                try {
+                    mGlobalLock.wait(timeoutRemaining);
+                } catch (InterruptedException e) {
+                }
+                timeoutRemaining -= (System.currentTimeMillis() - startTime);
+            }
+
+            if (mRoot.isSelfOrChildAnimating()) {
+                Log.w(TAG, "Timed out waiting for animations to complete.");
+            }
+        }
+    }
+
+    void onAnimationFinished() {
+        synchronized (mGlobalLock) {
+            mGlobalLock.notifyAll();
+        }
     }
 }
diff --git a/services/core/java/com/android/server/wm/WindowState.java b/services/core/java/com/android/server/wm/WindowState.java
index 706901b..20cca66 100644
--- a/services/core/java/com/android/server/wm/WindowState.java
+++ b/services/core/java/com/android/server/wm/WindowState.java
@@ -842,6 +842,9 @@
         // The offset from the layout containing frame to the actual containing frame.
         final int layoutXDiff;
         final int layoutYDiff;
+        final WindowState imeWin = mWmService.mRoot.getCurrentInputMethodWindow();
+        final boolean isImeTarget =
+                imeWin != null && imeWin.isVisibleNow() && isInputMethodTarget();
         if (inFullscreenContainer || layoutInParentFrame()) {
             // We use the parent frame as the containing frame for fullscreen and child windows
             mWindowFrames.mContainingFrame.set(mWindowFrames.mParentFrame);
@@ -861,15 +864,19 @@
                 mWindowFrames.mContainingFrame.bottom =
                         mWindowFrames.mContainingFrame.top + frozen.height();
             }
-            final WindowState imeWin = mWmService.mRoot.getCurrentInputMethodWindow();
             // IME is up and obscuring this window. Adjust the window position so it is visible.
-            if (imeWin != null && imeWin.isVisibleNow() && isInputMethodTarget()) {
-                if (inFreeformWindowingMode() && mWindowFrames.mContainingFrame.bottom
-                        > mWindowFrames.mContentFrame.bottom) {
-                    // In freeform we want to move the top up directly.
-                    // TODO: Investigate why this is contentFrame not parentFrame.
-                    mWindowFrames.mContainingFrame.top -= mWindowFrames.mContainingFrame.bottom
-                            - mWindowFrames.mContentFrame.bottom;
+            if (isImeTarget) {
+                if (inFreeformWindowingMode()) {
+                    // Push the freeform window up to make room for the IME. However, don't push
+                    // it up past the top of the screen.
+                    final int bottomOverlap = mWindowFrames.mContainingFrame.bottom
+                            - mWindowFrames.mVisibleFrame.bottom;
+                    if (bottomOverlap > 0) {
+                        final int distanceToTop = Math.max(mWindowFrames.mContainingFrame.top
+                                - mWindowFrames.mDisplayFrame.top, 0);
+                        int offs = Math.min(bottomOverlap, distanceToTop);
+                        mWindowFrames.mContainingFrame.top -= offs;
+                    }
                 } else if (!inPinnedWindowingMode() && mWindowFrames.mContainingFrame.bottom
                         > mWindowFrames.mParentFrame.bottom) {
                     // But in docked we want to behave like fullscreen and behave as if the task
@@ -935,29 +942,21 @@
         // Make sure the content and visible frames are inside of the
         // final window frame.
         if (windowsAreFloating && !mWindowFrames.mFrame.isEmpty()) {
-            // For pinned workspace the frame isn't limited in any particular
-            // way since SystemUI controls the bounds. For freeform however
-            // we want to keep things inside the content frame.
-            final Rect limitFrame = task.inPinnedWindowingMode() ? mWindowFrames.mFrame
-                    : mWindowFrames.mContentFrame;
-            // Keep the frame out of the blocked system area, limit it in size to the content area
-            // and make sure that there is always a minimum visible so that the user can drag it
-            // into a usable area..
-            final int height = Math.min(mWindowFrames.mFrame.height(), limitFrame.height());
-            final int width = Math.min(limitFrame.width(), mWindowFrames.mFrame.width());
-            final DisplayMetrics displayMetrics = getDisplayContent().getDisplayMetrics();
-            final int minVisibleHeight = Math.min(height, WindowManagerService.dipToPixel(
-                    MINIMUM_VISIBLE_HEIGHT_IN_DP, displayMetrics));
-            final int minVisibleWidth = Math.min(width, WindowManagerService.dipToPixel(
-                    MINIMUM_VISIBLE_WIDTH_IN_DP, displayMetrics));
-            final int top = Math.max(limitFrame.top,
-                    Math.min( mWindowFrames.mFrame.top, limitFrame.bottom - minVisibleHeight));
-            final int left = Math.max(limitFrame.left + minVisibleWidth - width,
-                    Math.min( mWindowFrames.mFrame.left, limitFrame.right - minVisibleWidth));
-            mWindowFrames.mFrame.set(left, top, left + width, top + height);
-            mWindowFrames.mContentFrame.set( mWindowFrames.mFrame);
+            final int visBottom = mWindowFrames.mVisibleFrame.bottom;
+            final int contentBottom = mWindowFrames.mContentFrame.bottom;
+            mWindowFrames.mContentFrame.set(mWindowFrames.mFrame);
             mWindowFrames.mVisibleFrame.set(mWindowFrames.mContentFrame);
             mWindowFrames.mStableFrame.set(mWindowFrames.mContentFrame);
+            if (isImeTarget && inFreeformWindowingMode()) {
+                // After displacing a freeform window to make room for the ime, any part of
+                // the window still covered by IME should be inset.
+                if (contentBottom + layoutYDiff < mWindowFrames.mContentFrame.bottom) {
+                    mWindowFrames.mContentFrame.bottom = contentBottom + layoutYDiff;
+                }
+                if (visBottom + layoutYDiff < mWindowFrames.mVisibleFrame.bottom) {
+                    mWindowFrames.mVisibleFrame.bottom = visBottom + layoutYDiff;
+                }
+            }
         } else if (mAttrs.type == TYPE_DOCK_DIVIDER) {
             dc.getDockedDividerController().positionDockedStackedDivider(mWindowFrames.mFrame);
             mWindowFrames.mContentFrame.set(mWindowFrames.mFrame);
@@ -4458,7 +4457,8 @@
         anim.restrictDuration(MAX_ANIMATION_DURATION);
         anim.scaleCurrentDuration(mWmService.getWindowAnimationScaleLocked());
         final AnimationAdapter adapter = new LocalAnimationAdapter(
-                new WindowAnimationSpec(anim, mSurfacePosition, false /* canSkipFirstFrame */),
+                new WindowAnimationSpec(anim, mSurfacePosition, false /* canSkipFirstFrame */,
+                        mWmService.mWindowCornerRadius),
                 mWmService.mSurfaceAnimationRunner);
         startAnimation(mPendingTransaction, adapter);
         commitPendingTransaction();
@@ -4489,6 +4489,7 @@
 
     @Override
     protected void onAnimationFinished() {
+        super.onAnimationFinished();
         mWinAnimator.onAnimationFinished();
     }
 
diff --git a/services/core/java/com/android/server/wm/WindowStateAnimator.java b/services/core/java/com/android/server/wm/WindowStateAnimator.java
index 969ced4..92bb082 100644
--- a/services/core/java/com/android/server/wm/WindowStateAnimator.java
+++ b/services/core/java/com/android/server/wm/WindowStateAnimator.java
@@ -487,6 +487,8 @@
             mSurfaceController = new WindowSurfaceController(mSession.mSurfaceSession,
                     attrs.getTitle().toString(), width, height, format, flags, this,
                     windowType, ownerUid);
+            mSurfaceController.setColorSpaceAgnostic((attrs.privateFlags
+                    & WindowManager.LayoutParams.PRIVATE_FLAG_COLOR_SPACE_AGNOSTIC) != 0);
 
             setOffsetPositionForStackResize(false);
             mSurfaceFormat = format;
@@ -1258,6 +1260,13 @@
         mSurfaceController.setSecure(isSecure);
     }
 
+    void setColorSpaceAgnosticLocked(boolean agnostic) {
+        if (mSurfaceController == null) {
+            return;
+        }
+        mSurfaceController.setColorSpaceAgnostic(agnostic);
+    }
+
     /**
      * Have the surface flinger show a surface, robustly dealing with
      * error conditions.  In particular, if there is not enough memory
diff --git a/services/core/java/com/android/server/wm/WindowSurfaceController.java b/services/core/java/com/android/server/wm/WindowSurfaceController.java
index e796b99..acb9823 100644
--- a/services/core/java/com/android/server/wm/WindowSurfaceController.java
+++ b/services/core/java/com/android/server/wm/WindowSurfaceController.java
@@ -399,6 +399,28 @@
         }
     }
 
+    void setColorSpaceAgnostic(boolean agnostic) {
+        if (SHOW_TRANSACTIONS) {
+            logSurface("isColorSpaceAgnostic=" + agnostic, null);
+        }
+
+        if (mSurfaceControl == null) {
+            return;
+        }
+        if (SHOW_LIGHT_TRANSACTIONS) {
+            Slog.i(TAG, ">>> OPEN TRANSACTION setColorSpaceAgnosticLocked");
+        }
+        mService.openSurfaceTransaction();
+        try {
+            mSurfaceControl.setColorSpaceAgnostic(agnostic);
+        } finally {
+            mService.closeSurfaceTransaction("setColorSpaceAgnostic");
+            if (SHOW_LIGHT_TRANSACTIONS) {
+                Slog.i(TAG, "<<< CLOSE TRANSACTION setColorSpaceAgnosticLocked");
+            }
+        }
+    }
+
     void getContainerRect(Rect rect) {
         mAnimator.getContainerRect(rect);
     }
diff --git a/services/core/java/com/android/server/wm/WindowTracing.java b/services/core/java/com/android/server/wm/WindowTracing.java
index 48b9340..765e347 100644
--- a/services/core/java/com/android/server/wm/WindowTracing.java
+++ b/services/core/java/com/android/server/wm/WindowTracing.java
@@ -98,9 +98,23 @@
             mBuffer.resetBuffer();
             mEnabled = mEnabledLockFree = true;
         }
+        log("trace.enable");
     }
 
+    /**
+     * Stops the trace and write the current buffer to disk
+     * @param pw Print writer
+     */
     void stopTrace(@Nullable PrintWriter pw) {
+        stopTrace(pw, true /* writeToFile */);
+    }
+
+    /**
+     * Stops the trace
+     * @param pw Print writer
+     * @param writeToFile If the current buffer should be written to disk or not
+     */
+    void stopTrace(@Nullable PrintWriter pw, boolean writeToFile) {
         if (IS_USER) {
             logAndPrintln(pw, "Error: Tracing is not supported on user builds.");
             return;
@@ -113,8 +127,10 @@
                 logAndPrintln(pw, "ERROR: tracing was re-enabled while waiting for flush.");
                 throw new IllegalStateException("tracing enabled while waiting for flush.");
             }
-            writeTraceToFileLocked();
-            logAndPrintln(pw, "Trace written to " + mTraceFile + ".");
+            if (writeToFile) {
+                writeTraceToFileLocked();
+                logAndPrintln(pw, "Trace written to " + mTraceFile + ".");
+            }
         }
     }
 
diff --git a/services/core/jni/Android.bp b/services/core/jni/Android.bp
index 5c7b287..050a079 100644
--- a/services/core/jni/Android.bp
+++ b/services/core/jni/Android.bp
@@ -38,6 +38,7 @@
         "com_android_server_SerialService.cpp",
         "com_android_server_storage_AppFuseBridge.cpp",
         "com_android_server_SystemServer.cpp",
+        "com_android_server_TestNetworkService.cpp",
         "com_android_server_tv_TvUinputBridge.cpp",
         "com_android_server_tv_TvInputHal.cpp",
         "com_android_server_vr_VrManagerService.cpp",
diff --git a/services/core/jni/com_android_server_TestNetworkService.cpp b/services/core/jni/com_android_server_TestNetworkService.cpp
new file mode 100644
index 0000000..b90ff23
--- /dev/null
+++ b/services/core/jni/com_android_server_TestNetworkService.cpp
@@ -0,0 +1,107 @@
+/*
+ * Copyright (C) 2018 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_NDEBUG 0
+
+#define LOG_TAG "TestNetworkServiceJni"
+
+#include <arpa/inet.h>
+#include <errno.h>
+#include <fcntl.h>
+#include <linux/if.h>
+#include <linux/if_tun.h>
+#include <linux/ipv6_route.h>
+#include <linux/route.h>
+#include <netinet/in.h>
+#include <stdio.h>
+#include <string.h>
+#include <sys/ioctl.h>
+#include <sys/socket.h>
+#include <sys/stat.h>
+#include <sys/types.h>
+
+#include <log/log.h>
+
+#include "netutils/ifc.h"
+
+#include "jni.h"
+#include <android-base/stringprintf.h>
+#include <android-base/unique_fd.h>
+#include <nativehelper/JNIHelp.h>
+#include <nativehelper/ScopedUtfChars.h>
+
+namespace android {
+
+//------------------------------------------------------------------------------
+
+static void throwException(JNIEnv* env, int error, const char* action, const char* iface) {
+    const std::string& msg =
+        android::base::StringPrintf("Error %s %s: %s", action, iface, strerror(error));
+
+    jniThrowException(env, "java/lang/IllegalStateException", msg.c_str());
+}
+
+static int createTunInterface(JNIEnv* env, const char* iface) {
+    base::unique_fd tun(open("/dev/tun", O_RDWR | O_NONBLOCK));
+    ifreq ifr{};
+
+    // Allocate interface.
+    ifr.ifr_flags = IFF_TUN | IFF_NO_PI;
+    strlcpy(ifr.ifr_name, iface, IFNAMSIZ);
+    if (ioctl(tun.get(), TUNSETIFF, &ifr)) {
+        throwException(env, errno, "allocating", ifr.ifr_name);
+        return -1;
+    }
+
+    // Activate interface using an unconnected datagram socket.
+    base::unique_fd inet6CtrlSock(socket(AF_INET6, SOCK_DGRAM, 0));
+    ifr.ifr_flags = IFF_UP;
+
+    if (ioctl(inet6CtrlSock.get(), SIOCSIFFLAGS, &ifr)) {
+        throwException(env, errno, "activating", ifr.ifr_name);
+        return -1;
+    }
+
+    return tun.release();
+}
+
+//------------------------------------------------------------------------------
+
+static jint create(JNIEnv* env, jobject /* thiz */, jstring jIface) {
+    ScopedUtfChars iface(env, jIface);
+    if (!iface.c_str()) {
+        jniThrowNullPointerException(env, "iface");
+        return -1;
+    }
+
+    int tun = createTunInterface(env, iface.c_str());
+
+    // Any exceptions will be thrown from the createTunInterface call
+    return tun;
+}
+
+//------------------------------------------------------------------------------
+
+static const JNINativeMethod gMethods[] = {
+    {"jniCreateTun", "(Ljava/lang/String;)I", (void*)create},
+};
+
+int register_android_server_TestNetworkService(JNIEnv* env) {
+    return jniRegisterNativeMethods(env, "com/android/server/TestNetworkService", gMethods,
+                                    NELEM(gMethods));
+}
+
+}; // namespace android
diff --git a/services/core/jni/com_android_server_location_GnssLocationProvider.cpp b/services/core/jni/com_android_server_location_GnssLocationProvider.cpp
index 03240c0..bce3e98 100644
--- a/services/core/jni/com_android_server_location_GnssLocationProvider.cpp
+++ b/services/core/jni/com_android_server_location_GnssLocationProvider.cpp
@@ -160,6 +160,8 @@
 
 using IMeasurementCorrections =
     android::hardware::gnss::measurement_corrections::V1_0::IMeasurementCorrections;
+using GnssSingleSatCorrectionFlags =
+    android::hardware::gnss::measurement_corrections::V1_0::GnssSingleSatCorrectionFlags;
 
 using android::hardware::gnss::visibility_control::V1_0::IGnssVisibilityControl;
 using android::hardware::gnss::visibility_control::V1_0::IGnssVisibilityControlCallback;
@@ -199,9 +201,7 @@
 sp<IGnssMeasurement_V2_0> gnssMeasurementIface_V2_0 = nullptr;
 sp<IGnssNavigationMessage> gnssNavigationMessageIface = nullptr;
 sp<IMeasurementCorrections> gnssCorrectionsIface = nullptr;
-// This boolean is needed to ensure that Gnsss Measurement Corrections related method are only
-// initalized when needed which will be few devices initially
-bool firstGnssMeasurementCorrectionInjected = false;
+
 sp<IGnssVisibilityControl> gnssVisibilityControlIface = nullptr;
 
 #define WAKE_LOCK_NAME  "GPS"
@@ -491,6 +491,10 @@
         SET(ElapsedRealtimeNanos, location.elapsedRealtime.timestampNs);
     }
 
+    if (flags & ElapsedRealtimeFlags::HAS_TIME_UNCERTAINTY_NS) {
+        SET(ElapsedRealtimeUncertaintyNanos, location.elapsedRealtime.timeUncertaintyNs);
+    }
+
     return object.get();
 }
 
@@ -521,7 +525,8 @@
         jdouble altitudeMeters, jfloat speedMetersPerSec, jfloat bearingDegrees,
         jfloat horizontalAccuracyMeters, jfloat verticalAccuracyMeters,
         jfloat speedAccuracyMetersPerSecond, jfloat bearingAccuracyDegrees,
-        jlong timestamp, jint elapsedRealtimeFlags, jlong elapsedRealtimeNanos) {
+        jlong timestamp, jint elapsedRealtimeFlags, jlong elapsedRealtimeNanos,
+        jlong elapsedRealtimeUncertaintyNanos) {
     GnssLocation_V2_0 location;
     location.v1_0 = createGnssLocation_V1_0(
             gnssLocationFlags, latitudeDegrees, longitudeDegrees, altitudeMeters,
@@ -531,6 +536,7 @@
 
     location.elapsedRealtime.flags = static_cast<uint16_t>(elapsedRealtimeFlags);
     location.elapsedRealtime.timestampNs = static_cast<uint64_t>(elapsedRealtimeNanos);
+    location.elapsedRealtime.timeUncertaintyNs = static_cast<uint64_t>(elapsedRealtimeUncertaintyNanos);
 
     return location;
 }
@@ -548,12 +554,15 @@
     Return<void> gnssReleaseWakelockCb() override;
     Return<void> gnssRequestTimeCb() override;
     Return<void> gnssRequestLocationCb(const bool independentFromGnss) override;
+
     Return<void> gnssSetSystemInfoCb(const IGnssCallback::GnssSystemInfo& info) override;
 
     // New in 1.1
     Return<void> gnssNameCb(const android::hardware::hidl_string& name) override;
 
     // New in 2.0
+    Return<void> gnssRequestLocationCb_2_0(const bool independentFromGnss, const bool isUserEmergency)
+            override;
     Return<void> gnssSetCapabilitiesCb_2_0(uint32_t capabilities) override;
     Return<void> gnssLocationCb_2_0(const GnssLocation_V2_0& location) override;
 
@@ -713,8 +722,15 @@
 }
 
 Return<void> GnssCallback::gnssRequestLocationCb(const bool independentFromGnss) {
+    return GnssCallback::gnssRequestLocationCb_2_0(independentFromGnss, /* isUserEmergency= */
+            false);
+}
+
+Return<void> GnssCallback::gnssRequestLocationCb_2_0(const bool independentFromGnss, const bool
+        isUserEmergency) {
     JNIEnv* env = getJniEnv();
-    env->CallVoidMethod(mCallbacksObj, method_requestLocation, boolToJbool(independentFromGnss));
+    env->CallVoidMethod(mCallbacksObj, method_requestLocation, boolToJbool(independentFromGnss),
+            boolToJbool(isUserEmergency));
     checkAndClearExceptionFromCallback(env, __FUNCTION__);
     return Void();
 }
@@ -1422,7 +1438,7 @@
     method_xtraDownloadRequest = env->GetMethodID(clazz, "xtraDownloadRequest", "()V");
     method_reportNiNotification = env->GetMethodID(clazz, "reportNiNotification",
             "(IIIIILjava/lang/String;Ljava/lang/String;II)V");
-    method_requestLocation = env->GetMethodID(clazz, "requestLocation", "(Z)V");
+    method_requestLocation = env->GetMethodID(clazz, "requestLocation", "(ZZ)V");
     method_requestRefLocation = env->GetMethodID(clazz, "requestRefLocation", "()V");
     method_requestSetID = env->GetMethodID(clazz, "requestSetID", "(I)V");
     method_requestUtcTime = env->GetMethodID(clazz, "requestUtcTime", "()V");
@@ -1455,6 +1471,51 @@
             "(Ljava/lang/String;BLjava/lang/String;BLjava/lang/String;BZZ)V");
     method_isInEmergencySession = env->GetMethodID(clazz, "isInEmergencySession", "()Z");
 
+    jclass measCorrClass = env->FindClass("android/location/GnssMeasurementCorrections");
+    method_correctionsGetLatitudeDegrees = env->GetMethodID(
+            measCorrClass,"getLatitudeDegrees", "()D");
+    method_correctionsGetLongitudeDegrees = env->GetMethodID(
+            measCorrClass, "getLongitudeDegrees", "()D");
+    method_correctionsGetAltitudeMeters = env->GetMethodID(
+            measCorrClass, "getAltitudeMeters", "()D");
+    method_correctionsGetHorPosUncMeters = env->GetMethodID(
+            measCorrClass, "getHorizontalPositionUncertaintyMeters", "()D");
+    method_correctionsGetVerPosUncMeters = env->GetMethodID(
+            measCorrClass, "getVerticalPositionUncertaintyMeters", "()D");
+    method_correctionsGetToaGpsNanosecondsOfWeek = env->GetMethodID(
+            measCorrClass, "getToaGpsNanosecondsOfWeek", "()J");
+
+    method_correctionsGetSingleSatCorrectionList = env->GetMethodID(
+            measCorrClass, "getSingleSatelliteCorrectionList", "()Ljava/util/List;");
+
+    jclass corrListClass = env->FindClass("java/util/List");
+    method_listSize = env->GetMethodID(corrListClass, "size", "()I");
+    method_correctionListGet = env->GetMethodID(corrListClass, "get", "(I)Ljava/lang/Object;");
+
+    jclass singleSatCorrClass = env->FindClass("android/location/GnssSingleSatCorrection");
+    method_correctionSatFlags = env->GetMethodID(
+            singleSatCorrClass, "getSingleSatelliteCorrectionFlags", "()I");
+    method_correctionSatConstType = env->GetMethodID(
+            singleSatCorrClass, "getConstellationType", "()I");
+    method_correctionSatId= env->GetMethodID(
+            singleSatCorrClass, "getSatelliteId", "()I");
+    method_correctionSatCarrierFreq = env->GetMethodID(
+            singleSatCorrClass, "getCarrierFrequencyHz", "()F");
+    method_correctionSatIsLosProb = env->GetMethodID(
+            singleSatCorrClass,"getProbabilityLineOfSight", "()F");
+    method_correctionSatEpl = env->GetMethodID(
+            singleSatCorrClass, "getExcessPathLengthMeters", "()F");
+    method_correctionSatEplUnc = env->GetMethodID(
+            singleSatCorrClass, "getExcessPathLengthUncertaintyMeters", "()F");
+    method_correctionSatRefPlane = env->GetMethodID(
+            singleSatCorrClass, "getReflectingPlane", "()Landroid/location/GnssReflectingPlane;");
+
+    jclass refPlaneClass = env->FindClass("android/location/GnssReflectingPlane");
+    method_correctionPlaneLatDeg = env->GetMethodID(refPlaneClass, "getLatitudeDegrees", "()D");
+    method_correctionPlaneLngDeg = env->GetMethodID(refPlaneClass, "getLongitudeDegrees", "()D");
+    method_correctionPlaneAltDeg = env->GetMethodID(refPlaneClass, "getAltitudeMeters", "()D");
+    method_correctionPlaneAzimDeg = env->GetMethodID(refPlaneClass, "getAzimuthDegrees", "()D");
+
     /*
      * Save a pointer to JVM.
      */
@@ -1877,7 +1938,8 @@
         jfloat bearingAccuracyDegrees,
         jlong timestamp,
         jint elapsedRealtimeFlags,
-        jlong elapsedRealtimeNanos) {
+        jlong elapsedRealtimeNanos,
+        jlong elapsedRealtimeUncertaintyNanos) {
     if (gnssHal_V2_0 != nullptr) {
         GnssLocation_V2_0 location = createGnssLocation_V2_0(
                 gnssLocationFlags,
@@ -1892,7 +1954,8 @@
                 bearingAccuracyDegrees,
                 timestamp,
                 elapsedRealtimeFlags,
-                elapsedRealtimeNanos);
+                elapsedRealtimeNanos,
+                elapsedRealtimeUncertaintyNanos);
         auto result = gnssHal_V2_0->injectBestLocation_2_0(location);
 
         if (!result.isOk() || !result) {
@@ -2323,29 +2386,6 @@
         ALOGW("Trying to inject GNSS corrections on a chipset that does not support them.");
         return JNI_FALSE;
     }
-    if (firstGnssMeasurementCorrectionInjected == false) {
-        jclass measCorrClass = env->GetObjectClass(correctionsObj);
-        method_correctionsGetLatitudeDegrees = env->GetMethodID(
-            measCorrClass,"getLatitudeDegrees", "()D");
-
-        method_correctionsGetLongitudeDegrees = env->GetMethodID(
-            measCorrClass, "getLongitudeDegrees", "()D");
-
-        method_correctionsGetAltitudeMeters = env->GetMethodID(
-            measCorrClass, "getAltitudeMeters", "()D");
-
-        method_correctionsGetHorPosUncMeters = env->GetMethodID(
-            measCorrClass, "getHorizontalPositionUncertaintyMeters", "()D");
-
-        method_correctionsGetVerPosUncMeters = env->GetMethodID(
-            measCorrClass, "getVerticalPositionUncertaintyMeters", "()D");
-
-        method_correctionsGetToaGpsNanosecondsOfWeek = env->GetMethodID(
-            measCorrClass, "getToaGpsNanosecondsOfWeek", "()J");
-
-        method_correctionsGetSingleSatCorrectionList = env->GetMethodID(
-            measCorrClass, "getSingleSatelliteCorrectionList", "()Ljava.util.List;");
-    }
 
     jdouble latitudeDegreesCorr = env->CallDoubleMethod(
         correctionsObj, method_correctionsGetLatitudeDegrees);
@@ -2362,42 +2402,18 @@
     jobject singleSatCorrectionList = env->CallObjectMethod(correctionsObj,
         method_correctionsGetSingleSatCorrectionList);
 
-    if (firstGnssMeasurementCorrectionInjected == false) {
-        jclass corrListClass = env->GetObjectClass(singleSatCorrectionList);
-        method_listSize = env->GetMethodID(corrListClass, "size", "()I");
-        method_correctionListGet = env->GetMethodID(
-            corrListClass, "get", "(I)Landroid/location/GnssSingleSatCorrection;");
-    }
-
     auto len = (singleSatCorrectionList == nullptr)
         ? 0
         : env->CallIntMethod(singleSatCorrectionList, method_listSize);
+    if (len == 0) {
+        ALOGI("Empty correction list injected....Returning with no HAL injection");
+        return JNI_TRUE;
+    }
     hidl_vec<SingleSatCorrection> list(len);
 
     for (uint16_t i = 0; i < len; ++i) {
         jobject singleSatCorrectionObj = env->CallObjectMethod(
-        singleSatCorrectionList, method_correctionListGet, i);
-
-        if (firstGnssMeasurementCorrectionInjected == false) {
-            jclass singleSatCorrClass = env->GetObjectClass(singleSatCorrectionObj);
-            method_correctionSatFlags = env->GetMethodID(
-                singleSatCorrClass, "getSingleSatelliteCorrectionFlags", "()I");
-            method_correctionSatConstType = env->GetMethodID(
-                singleSatCorrClass, "getConstellationType", "()I");
-            method_correctionSatId= env->GetMethodID(
-                singleSatCorrClass, "getSatelliteId", "()I");
-            method_correctionSatCarrierFreq = env->GetMethodID(
-                singleSatCorrClass, "getCarrierFrequencyHz", "()F");
-            method_correctionSatIsLosProb = env->GetMethodID(
-                singleSatCorrClass,"getProbabilityLineOfSight", "()F");
-            method_correctionSatEpl = env->GetMethodID(
-                singleSatCorrClass, "getExcessPathLengthMeters", "()F");
-            method_correctionSatEplUnc = env->GetMethodID(
-                singleSatCorrClass, "getExcessPathLengthUncertaintyMeters", "()F");
-            method_correctionSatRefPlane = env->GetMethodID(
-                singleSatCorrClass, "getReflectingPlane",
-                "()Landroid/location/GnssReflectingPlane;");
-        }
+            singleSatCorrectionList, method_correctionListGet, i);
 
         jint correctionFlags =
             env->CallIntMethod(singleSatCorrectionObj, method_correctionSatFlags);
@@ -2413,38 +2429,34 @@
             env->CallFloatMethod(singleSatCorrectionObj, method_correctionSatEpl);
         jfloat eplUncMeters = env->CallFloatMethod(singleSatCorrectionObj,
             method_correctionSatEplUnc);
-        jobject reflectingPlaneObj = env->CallObjectMethod(
-            singleSatCorrectionObj, method_correctionSatRefPlane);
-
-        if (firstGnssMeasurementCorrectionInjected == false) {
-            jclass refPlaneClass = env->GetObjectClass(reflectingPlaneObj);
-            method_correctionPlaneLatDeg = env->GetMethodID(
-                refPlaneClass, "getLatitudeDegrees", "()D");
-            method_correctionPlaneLngDeg = env->GetMethodID(
-                refPlaneClass, "getLongitudeDegrees", "()D");
-            method_correctionPlaneAltDeg = env->GetMethodID(
-                refPlaneClass, "getAltitudeMeters", "()D");
-            method_correctionPlaneAzimDeg = env->GetMethodID(
-                refPlaneClass, "getAzimuthDegrees", "()D");
+        uint16_t corrFlags = static_cast<uint16_t>(correctionFlags);
+        jobject reflectingPlaneObj;
+        bool has_ref_plane = (corrFlags & GnssSingleSatCorrectionFlags::HAS_REFLECTING_PLANE) != 0;
+        if (has_ref_plane) {
+            reflectingPlaneObj = env->CallObjectMethod(
+                singleSatCorrectionObj, method_correctionSatRefPlane);
         }
 
-        jdouble latitudeDegreesRefPlane = env->CallDoubleMethod(
-            reflectingPlaneObj, method_correctionPlaneLatDeg);
-        jdouble longitudeDegreesRefPlane = env->CallDoubleMethod(
-            reflectingPlaneObj, method_correctionPlaneLngDeg);
-        jdouble altitudeDegreesRefPlane = env->CallDoubleMethod(
-            reflectingPlaneObj, method_correctionPlaneAltDeg);
-        jdouble azimuthDegreeRefPlane = env->CallDoubleMethod(
-            reflectingPlaneObj, method_correctionPlaneAzimDeg);
-        ReflectingPlane reflectingPlane = {
-            .latitudeDegrees = latitudeDegreesRefPlane,
-            .longitudeDegrees = longitudeDegreesRefPlane,
-            .altitudeMeters = altitudeDegreesRefPlane,
-            .azimuthDegrees = azimuthDegreeRefPlane,
-        };
+        ReflectingPlane reflectingPlane;
+        if (has_ref_plane) {
+            jdouble latitudeDegreesRefPlane = env->CallDoubleMethod(
+                reflectingPlaneObj, method_correctionPlaneLatDeg);
+            jdouble longitudeDegreesRefPlane = env->CallDoubleMethod(
+                reflectingPlaneObj, method_correctionPlaneLngDeg);
+            jdouble altitudeDegreesRefPlane = env->CallDoubleMethod(
+                reflectingPlaneObj, method_correctionPlaneAltDeg);
+            jdouble azimuthDegreeRefPlane = env->CallDoubleMethod(
+                reflectingPlaneObj, method_correctionPlaneAzimDeg);
+            reflectingPlane = {
+                .latitudeDegrees = latitudeDegreesRefPlane,
+                .longitudeDegrees = longitudeDegreesRefPlane,
+                .altitudeMeters = altitudeDegreesRefPlane,
+                .azimuthDegrees = azimuthDegreeRefPlane,
+            };
+        }
 
         SingleSatCorrection singleSatCorrection = {
-            .singleSatCorrectionFlags = static_cast<uint16_t>(correctionFlags),
+            .singleSatCorrectionFlags = corrFlags,
             .constellation = static_cast<GnssConstellationType>(constType),
             .svid = static_cast<uint16_t>(satId),
             .carrierFrequencyHz = carrierFreqHz,
@@ -2466,7 +2478,6 @@
     };
 
     gnssCorrectionsIface->setCorrections(measurementCorrections);
-    firstGnssMeasurementCorrectionInjected = true;
     return JNI_TRUE;
 }
 
@@ -2803,7 +2814,7 @@
             android_location_GnssLocationProvider_read_nmea)},
     {"native_inject_time", "(JJI)V", reinterpret_cast<void *>(
             android_location_GnssLocationProvider_inject_time)},
-    {"native_inject_best_location", "(IDDDFFFFFFJIJ)V", reinterpret_cast<void *>(
+    {"native_inject_best_location", "(IDDDFFFFFFJIJJ)V", reinterpret_cast<void *>(
             android_location_GnssLocationProvider_inject_best_location)},
     {"native_inject_location", "(DDF)V", reinterpret_cast<void *>(
             android_location_GnssLocationProvider_inject_location)},
diff --git a/services/core/jni/onload.cpp b/services/core/jni/onload.cpp
index 6e31aed..5ffed03 100644
--- a/services/core/jni/onload.cpp
+++ b/services/core/jni/onload.cpp
@@ -41,6 +41,7 @@
 int register_android_server_location_GnssLocationProvider(JNIEnv* env);
 int register_android_server_connectivity_Vpn(JNIEnv* env);
 int register_android_server_connectivity_tethering_OffloadHardwareInterface(JNIEnv*);
+int register_android_server_TestNetworkService(JNIEnv* env);
 int register_android_server_devicepolicy_CryptoTestHelper(JNIEnv*);
 int register_android_server_hdmi_HdmiCecController(JNIEnv* env);
 int register_android_server_tv_TvUinputBridge(JNIEnv* env);
@@ -85,6 +86,7 @@
     register_android_server_location_GnssLocationProvider(env);
     register_android_server_connectivity_Vpn(env);
     register_android_server_connectivity_tethering_OffloadHardwareInterface(env);
+    register_android_server_TestNetworkService(env);
     register_android_server_devicepolicy_CryptoTestHelper(env);
     register_android_server_ConsumerIrService(env);
     register_android_server_BatteryStatsService(env);
diff --git a/services/core/xsd/Android.bp b/services/core/xsd/Android.bp
new file mode 100644
index 0000000..5e1ea89
--- /dev/null
+++ b/services/core/xsd/Android.bp
@@ -0,0 +1,6 @@
+xsd_config {
+    name: "default-permissions",
+    srcs: ["default-permissions.xsd"],
+    api_dir: "schema",
+    package_name: "com.android.server.pm.permission",
+}
diff --git a/services/core/xsd/default-permissions.xsd b/services/core/xsd/default-permissions.xsd
new file mode 100644
index 0000000..d800a26
--- /dev/null
+++ b/services/core/xsd/default-permissions.xsd
@@ -0,0 +1,40 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!-- Copyright (C) 2019 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.
+-->
+<!-- TODO: define a targetNamespace. Note that it will break retrocompatibility -->
+<xs:schema version="2.0"
+           elementFormDefault="qualified"
+           attributeFormDefault="unqualified"
+           xmlns:xs="http://www.w3.org/2001/XMLSchema">
+    <xs:element name="exceptions">
+        <xs:complexType>
+            <xs:sequence>
+                <xs:element name="exception" type="exception" maxOccurs="unbounded"/>
+            </xs:sequence>
+        </xs:complexType>
+    </xs:element>
+    <xs:complexType name="exception">
+        <xs:sequence>
+            <xs:element name="permission" type="permission"/>
+        </xs:sequence>
+        <xs:attribute name="package" type="xs:string"/>
+        <xs:attribute name="sha256-cert-digest" type="xs:string"/>
+        <xs:attribute name="brand" type="xs:string"/>
+    </xs:complexType>
+    <xs:complexType name="permission">
+        <xs:attribute name="name" type="xs:string"/>
+        <xs:attribute name="fixed" type="xs:boolean"/>
+    </xs:complexType>
+</xs:schema>
diff --git a/services/core/xsd/schema/README.md b/services/core/xsd/schema/README.md
new file mode 100644
index 0000000..f52d93d
--- /dev/null
+++ b/services/core/xsd/schema/README.md
@@ -0,0 +1 @@
+Please see the [README](https://android.googlesource.com/platform/system/tools/xsdc/+/refs/heads/master/README.md) for details regarding the Configfile as API.
diff --git a/services/core/xsd/schema/current.txt b/services/core/xsd/schema/current.txt
new file mode 100644
index 0000000..4e67e5c
--- /dev/null
+++ b/services/core/xsd/schema/current.txt
@@ -0,0 +1,37 @@
+// Signature format: 2.0
+package com.android.server.pm.permission {
+
+  public class Exception {
+    ctor public Exception();
+    method public String getBrand();
+    method public com.android.server.pm.permission.Permission getPermission();
+    method public String getSha256CertDigest();
+    method public String get_package();
+    method public void setBrand(String);
+    method public void setPermission(com.android.server.pm.permission.Permission);
+    method public void setSha256CertDigest(String);
+    method public void set_package(String);
+  }
+
+  public class Exceptions {
+    ctor public Exceptions();
+    method public java.util.List<com.android.server.pm.permission.Exception> getException();
+  }
+
+  public class Permission {
+    ctor public Permission();
+    method public boolean getFixed();
+    method public String getName();
+    method public void setFixed(boolean);
+    method public void setName(String);
+  }
+
+  public class XmlParser {
+    ctor public XmlParser();
+    method public static com.android.server.pm.permission.Exceptions read(java.io.InputStream) throws javax.xml.datatype.DatatypeConfigurationException, java.io.IOException, org.xmlpull.v1.XmlPullParserException;
+    method public static String readText(org.xmlpull.v1.XmlPullParser) throws java.io.IOException, org.xmlpull.v1.XmlPullParserException;
+    method public static void skip(org.xmlpull.v1.XmlPullParser) throws java.io.IOException, org.xmlpull.v1.XmlPullParserException;
+  }
+
+}
+
diff --git a/services/core/xsd/schema/last_current.txt b/services/core/xsd/schema/last_current.txt
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/services/core/xsd/schema/last_current.txt
diff --git a/services/core/xsd/schema/last_removed.txt b/services/core/xsd/schema/last_removed.txt
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/services/core/xsd/schema/last_removed.txt
diff --git a/services/core/xsd/schema/removed.txt b/services/core/xsd/schema/removed.txt
new file mode 100644
index 0000000..d802177
--- /dev/null
+++ b/services/core/xsd/schema/removed.txt
@@ -0,0 +1 @@
+// Signature format: 2.0
diff --git a/services/devicepolicy/java/com/android/server/devicepolicy/DevicePolicyManagerService.java b/services/devicepolicy/java/com/android/server/devicepolicy/DevicePolicyManagerService.java
index f496e81..d7922b15 100644
--- a/services/devicepolicy/java/com/android/server/devicepolicy/DevicePolicyManagerService.java
+++ b/services/devicepolicy/java/com/android/server/devicepolicy/DevicePolicyManagerService.java
@@ -172,7 +172,6 @@
 import android.os.IBinder;
 import android.os.Looper;
 import android.os.ParcelFileDescriptor;
-import android.os.ParcelableException;
 import android.os.PersistableBundle;
 import android.os.PowerManager;
 import android.os.PowerManagerInternal;
@@ -5338,9 +5337,14 @@
      */
     @Override
     public long getRequiredStrongAuthTimeout(ComponentName who, int userId, boolean parent) {
-        if (!mHasFeature || !mLockPatternUtils.hasSecureLockScreen()) {
+        if (!mHasFeature) {
             return DevicePolicyManager.DEFAULT_STRONG_AUTH_TIMEOUT_MS;
         }
+        if (!mLockPatternUtils.hasSecureLockScreen()) {
+            // No strong auth timeout on devices not supporting the
+            // {@link PackageManager#FEATURE_SECURE_LOCK_SCREEN} feature
+            return 0;
+        }
         enforceFullCrossUsersPermission(userId);
         synchronized (getLockObject()) {
             if (who != null) {
@@ -13348,8 +13352,8 @@
                 if (policy.mPasswordTokenHandle != 0) {
                     mLockPatternUtils.removeEscrowToken(policy.mPasswordTokenHandle, userHandle);
                 }
-
-                policy.mPasswordTokenHandle = mLockPatternUtils.addEscrowToken(token, userHandle);
+                policy.mPasswordTokenHandle = mLockPatternUtils.addEscrowToken(token,
+                        userHandle, /*EscrowTokenStateChangeCallback*/ null);
                 saveSettingsLocked(userHandle);
                 return policy.mPasswordTokenHandle != 0;
             } finally {
diff --git a/services/java/com/android/server/SystemServer.java b/services/java/com/android/server/SystemServer.java
index 8d88c5a..e733830 100644
--- a/services/java/com/android/server/SystemServer.java
+++ b/services/java/com/android/server/SystemServer.java
@@ -87,10 +87,11 @@
 import com.android.server.camera.CameraServiceProxy;
 import com.android.server.clipboard.ClipboardService;
 import com.android.server.connectivity.IpConnectivityMetrics;
+import com.android.server.contentcapture.ContentCaptureManagerInternal;
 import com.android.server.coverage.CoverageService;
 import com.android.server.devicepolicy.DevicePolicyManagerService;
-import com.android.server.display.ColorDisplayService;
 import com.android.server.display.DisplayManagerService;
+import com.android.server.display.color.ColorDisplayService;
 import com.android.server.dreams.DreamManagerService;
 import com.android.server.emergency.EmergencyAffordanceService;
 import com.android.server.gpu.GpuService;
@@ -1366,7 +1367,6 @@
                 ServiceManager.addService(Context.CONNECTIVITY_SERVICE, connectivity,
                         /* allowIsolated= */ false,
                         DUMP_FLAG_PRIORITY_HIGH | DUMP_FLAG_PRIORITY_NORMAL);
-                networkStats.bindConnectivityManager(connectivity);
                 networkPolicy.bindConnectivityManager(connectivity);
             } catch (Throwable e) {
                 reportWtf("starting Connectivity Service", e);
@@ -1882,19 +1882,6 @@
         mSystemServiceManager.startService(IncidentCompanionService.class);
         traceEnd();
 
-        if (safeMode) {
-            traceBeginAndSlog("EnterSafeModeAndDisableJitCompilation");
-            mActivityManagerService.enterSafeMode();
-            // Disable the JIT for the system_server process
-            VMRuntime.getRuntime().disableJitCompilation();
-            traceEnd();
-        } else {
-            // Enable the JIT for the system_server process
-            traceBeginAndSlog("StartJitCompilation");
-            VMRuntime.getRuntime().startJitCompilation();
-            traceEnd();
-        }
-
         // MMS service broker
         traceBeginAndSlog("StartMmsService");
         mmsService = mSystemServiceManager.startService(MmsServiceBroker.class);
@@ -2264,6 +2251,13 @@
 
         traceBeginAndSlog("StartContentCaptureService");
         mSystemServiceManager.startService(CONTENT_CAPTURE_MANAGER_SERVICE_CLASS);
+
+        ContentCaptureManagerInternal ccmi =
+                LocalServices.getService(ContentCaptureManagerInternal.class);
+        if (ccmi != null && mActivityManagerService != null) {
+            mActivityManagerService.setContentCaptureManager(ccmi);
+        }
+
         traceEnd();
     }
 
diff --git a/services/net/OWNERS b/services/net/OWNERS
index 7311eee..d3836d4 100644
--- a/services/net/OWNERS
+++ b/services/net/OWNERS
@@ -1,8 +1,8 @@
 set noparent
 
 codewiz@google.com
-ek@google.com
 jchalard@google.com
+junyulai@google.com
 lorenzo@google.com
 reminv@google.com
 satk@google.com
diff --git a/services/net/java/android/net/NetworkStackClient.java b/services/net/java/android/net/NetworkStackClient.java
index 830dbbe..eed01ae 100644
--- a/services/net/java/android/net/NetworkStackClient.java
+++ b/services/net/java/android/net/NetworkStackClient.java
@@ -289,7 +289,8 @@
     private void requestConnector(@NonNull NetworkStackCallback request) {
         // TODO: PID check.
         final int caller = Binder.getCallingUid();
-        if (caller != Process.SYSTEM_UID && !UserHandle.isSameApp(caller, Process.BLUETOOTH_UID)) {
+        if (caller != Process.SYSTEM_UID && !UserHandle.isSameApp(caller, Process.BLUETOOTH_UID)
+                && !UserHandle.isSameApp(caller, Process.PHONE_UID)) {
             // Don't even attempt to obtain the connector and give a nice error message
             throw new SecurityException(
                     "Only the system server should try to bind to the network stack.");
diff --git a/services/net/java/android/net/ip/IpServer.java b/services/net/java/android/net/ip/IpServer.java
index 34fc735..0e44f88 100644
--- a/services/net/java/android/net/ip/IpServer.java
+++ b/services/net/java/android/net/ip/IpServer.java
@@ -87,7 +87,6 @@
         return "UNKNOWN: " + state;
     }
 
-    private static final IpPrefix LINK_LOCAL_PREFIX = new IpPrefix("fe80::/64");
     private static final byte DOUG_ADAMS = (byte) 42;
 
     private static final String USB_NEAR_IFACE_ADDR = "192.168.42.129";
@@ -557,16 +556,6 @@
                 addedPrefixes.removeAll(mLastRaParams.prefixes);
             }
 
-            if (mLastRaParams == null || mLastRaParams.prefixes.isEmpty()) {
-                // We need to be able to send unicast RAs, and clients might
-                // like to ping the default router's link-local address.  Note
-                // that we never remove the link-local route from the network
-                // until Tethering disables tethering on the interface. We
-                // only need to add the link-local prefix once, but in the
-                // event we add it more than once netd silently ignores EEXIST.
-                addedPrefixes.add(LINK_LOCAL_PREFIX);
-            }
-
             if (!addedPrefixes.isEmpty()) {
                 final ArrayList<RouteInfo> toBeAdded =
                         getLocalRoutesFor(mIfaceName, addedPrefixes);
diff --git a/services/net/java/android/net/netlink/NetlinkSocket.java b/services/net/java/android/net/netlink/NetlinkSocket.java
index 16f72bd..4240d24 100644
--- a/services/net/java/android/net/netlink/NetlinkSocket.java
+++ b/services/net/java/android/net/netlink/NetlinkSocket.java
@@ -109,7 +109,7 @@
     }
 
     public static void connectToKernel(FileDescriptor fd) throws ErrnoException, SocketException {
-        SocketUtils.connectSocket(fd, makeNetlinkSocketAddress(0, 0));
+        Os.connect(fd, makeNetlinkSocketAddress(0, 0));
     }
 
     private static void checkTimeout(long timeoutMs) {
diff --git a/services/tests/mockingservicestests/src/com/android/server/AppStateTrackerTest.java b/services/tests/mockingservicestests/src/com/android/server/AppStateTrackerTest.java
index c8e6782..d0158e0 100644
--- a/services/tests/mockingservicestests/src/com/android/server/AppStateTrackerTest.java
+++ b/services/tests/mockingservicestests/src/com/android/server/AppStateTrackerTest.java
@@ -685,10 +685,10 @@
         List<OpEntry> entries = new ArrayList<>();
         entries.add(new OpEntry(
                 AppOpsManager.OP_ACCESS_NOTIFICATIONS,
-                AppOpsManager.MODE_IGNORED, 0, 0, 0, 0, null));
+                AppOpsManager.MODE_IGNORED));
         entries.add(new OpEntry(
                 AppStateTracker.TARGET_OP,
-                AppOpsManager.MODE_IGNORED, 0, 0, 0, 0, null));
+                AppOpsManager.MODE_IGNORED));
 
         ops.add(new PackageOps(PACKAGE_1, UID_1, entries));
 
@@ -696,7 +696,7 @@
         entries = new ArrayList<>();
         entries.add(new OpEntry(
                 AppStateTracker.TARGET_OP,
-                AppOpsManager.MODE_IGNORED, 0, 0, 0, 0, null));
+                AppOpsManager.MODE_IGNORED));
 
         ops.add(new PackageOps(PACKAGE_2, UID_2, entries));
 
@@ -704,7 +704,7 @@
         entries = new ArrayList<>();
         entries.add(new OpEntry(
                 AppStateTracker.TARGET_OP,
-                AppOpsManager.MODE_ALLOWED, 0, 0, 0, 0, null));
+                AppOpsManager.MODE_ALLOWED));
 
         ops.add(new PackageOps(PACKAGE_1, UID_10_1, entries));
 
@@ -712,10 +712,10 @@
         entries = new ArrayList<>();
         entries.add(new OpEntry(
                 AppStateTracker.TARGET_OP,
-                AppOpsManager.MODE_IGNORED, 0, 0, 0, 0, null));
+                AppOpsManager.MODE_IGNORED));
         entries.add(new OpEntry(
                 AppOpsManager.OP_ACCESS_NOTIFICATIONS,
-                AppOpsManager.MODE_IGNORED, 0, 0, 0, 0, null));
+                AppOpsManager.MODE_IGNORED));
 
         ops.add(new PackageOps(PACKAGE_3, UID_10_3, entries));
 
diff --git a/services/tests/mockingservicestests/src/com/android/server/RescuePartyTest.java b/services/tests/mockingservicestests/src/com/android/server/RescuePartyTest.java
index b13735c..0d6020c 100644
--- a/services/tests/mockingservicestests/src/com/android/server/RescuePartyTest.java
+++ b/services/tests/mockingservicestests/src/com/android/server/RescuePartyTest.java
@@ -35,9 +35,12 @@
 import android.os.RecoverySystem;
 import android.os.SystemProperties;
 import android.os.UserHandle;
+import android.provider.DeviceConfig;
 import android.provider.Settings;
 
 import com.android.dx.mockito.inline.extended.ExtendedMockito;
+import com.android.server.am.SettingsToPropertiesMapper;
+import com.android.server.utils.FlagNamespaceUtils;
 
 import org.junit.After;
 import org.junit.Before;
@@ -56,6 +59,10 @@
 public class RescuePartyTest {
     private static final int PERSISTENT_APP_UID = 12;
     private static final long CURRENT_NETWORK_TIME_MILLIS = 0L;
+    private static final String FAKE_NATIVE_NAMESPACE1 = "native1";
+    private static final String FAKE_NATIVE_NAMESPACE2 = "native2";
+    private static final String[] FAKE_RESET_NATIVE_NAMESPACES =
+            {FAKE_NATIVE_NAMESPACE1, FAKE_NATIVE_NAMESPACE2};
 
     private MockitoSession mSession;
 
@@ -73,9 +80,11 @@
                 ExtendedMockito.mockitoSession().initMocks(
                         this)
                         .strictness(Strictness.LENIENT)
+                        .spyStatic(DeviceConfig.class)
                         .spyStatic(SystemProperties.class)
                         .spyStatic(Settings.Global.class)
                         .spyStatic(Settings.Secure.class)
+                        .spyStatic(SettingsToPropertiesMapper.class)
                         .spyStatic(RecoverySystem.class)
                         .spyStatic(RescueParty.class)
                         .startMocking();
@@ -121,8 +130,17 @@
                 }
         ).when(() -> SystemProperties.getLong(anyString(), anyLong()));
 
+        // Mock DeviceConfig
+        doAnswer((Answer<Boolean>) invocationOnMock -> true)
+                .when(() -> DeviceConfig.setProperty(anyString(), anyString(), anyString(),
+                        anyBoolean()));
+        doAnswer((Answer<Void>) invocationOnMock -> null)
+                .when(() -> DeviceConfig.resetToDefaults(anyInt(), anyString()));
+
+
         doReturn(CURRENT_NETWORK_TIME_MILLIS).when(() -> RescueParty.getElapsedRealtime());
         RescueParty.resetAllThresholds();
+        FlagNamespaceUtils.resetKnownResetNamespacesFlagCounterForTest();
 
         SystemProperties.set(RescueParty.PROP_RESCUE_LEVEL,
                 Integer.toString(RescueParty.LEVEL_NONE));
@@ -278,10 +296,32 @@
                 SystemProperties.getInt(RescueParty.PROP_RESCUE_LEVEL, RescueParty.LEVEL_NONE));
     }
 
+    @Test
+    public void testNativeRescuePartyResets() {
+        doReturn(true).when(() -> SettingsToPropertiesMapper.isNativeFlagsResetPerformed());
+        doReturn(FAKE_RESET_NATIVE_NAMESPACES).when(
+                () -> SettingsToPropertiesMapper.getResetNativeCategories());
+
+        RescueParty.onSettingsProviderPublished(mMockContext);
+
+        verify(() -> DeviceConfig.resetToDefaults(Settings.RESET_MODE_TRUSTED_DEFAULTS,
+                FAKE_NATIVE_NAMESPACE1));
+        verify(() -> DeviceConfig.resetToDefaults(Settings.RESET_MODE_TRUSTED_DEFAULTS,
+                FAKE_NATIVE_NAMESPACE2));
+
+        ExtendedMockito.verify(
+                () -> DeviceConfig.setProperty(FlagNamespaceUtils.NAMESPACE_RESCUE_PARTY,
+                        FlagNamespaceUtils.RESET_PLATFORM_PACKAGE_FLAG + 0,
+                        FAKE_NATIVE_NAMESPACE1, /*makeDefault=*/true));
+        ExtendedMockito.verify(
+                () -> DeviceConfig.setProperty(FlagNamespaceUtils.NAMESPACE_RESCUE_PARTY,
+                        FlagNamespaceUtils.RESET_PLATFORM_PACKAGE_FLAG + 1,
+                        FAKE_NATIVE_NAMESPACE2, /*makeDefault=*/true));
+    }
+
     private void verifySettingsResets(int resetMode) {
         verify(() -> Settings.Global.resetToDefaultsAsUser(mMockContentResolver, null,
-                resetMode,
-                UserHandle.USER_SYSTEM));
+                resetMode, UserHandle.USER_SYSTEM));
         verify(() -> Settings.Secure.resetToDefaultsAsUser(eq(mMockContentResolver), isNull(),
                 eq(resetMode), anyInt()));
     }
@@ -294,7 +334,7 @@
 
     private void notePersistentAppCrash(int numTimes) {
         for (int i = 0; i < numTimes; i++) {
-            RescueParty.notePersistentAppCrash(mMockContext, PERSISTENT_APP_UID);
+            RescueParty.noteAppCrash(mMockContext, PERSISTENT_APP_UID);
         }
     }
 }
diff --git a/services/tests/mockingservicestests/src/com/android/server/am/AppCompactorTest.java b/services/tests/mockingservicestests/src/com/android/server/am/AppCompactorTest.java
index d32f1f7..e100d16 100644
--- a/services/tests/mockingservicestests/src/com/android/server/am/AppCompactorTest.java
+++ b/services/tests/mockingservicestests/src/com/android/server/am/AppCompactorTest.java
@@ -16,15 +16,6 @@
 
 package com.android.server.am;
 
-import static android.provider.DeviceConfig.ActivityManager.KEY_COMPACT_ACTION_1;
-import static android.provider.DeviceConfig.ActivityManager.KEY_COMPACT_ACTION_2;
-import static android.provider.DeviceConfig.ActivityManager.KEY_COMPACT_STATSD_SAMPLE_RATE;
-import static android.provider.DeviceConfig.ActivityManager.KEY_COMPACT_THROTTLE_1;
-import static android.provider.DeviceConfig.ActivityManager.KEY_COMPACT_THROTTLE_2;
-import static android.provider.DeviceConfig.ActivityManager.KEY_COMPACT_THROTTLE_3;
-import static android.provider.DeviceConfig.ActivityManager.KEY_COMPACT_THROTTLE_4;
-import static android.provider.DeviceConfig.ActivityManager.KEY_USE_COMPACTION;
-
 import static com.android.server.am.ActivityManagerService.Injector;
 import static com.android.server.am.AppCompactor.compactActionIntToString;
 
@@ -117,28 +108,28 @@
         // When the DeviceConfig already has a flag value stored (note this test will need to
         // change if the default value changes from false).
         assertThat(AppCompactor.DEFAULT_USE_COMPACTION).isFalse();
-        DeviceConfig.setProperty(DeviceConfig.ActivityManager.NAMESPACE,
-                KEY_USE_COMPACTION, "true", false);
-        DeviceConfig.setProperty(DeviceConfig.ActivityManager.NAMESPACE,
-                KEY_COMPACT_ACTION_1,
+        DeviceConfig.setProperty(DeviceConfig.NAMESPACE_ACTIVITY_MANAGER,
+                AppCompactor.KEY_USE_COMPACTION, "true", false);
+        DeviceConfig.setProperty(DeviceConfig.NAMESPACE_ACTIVITY_MANAGER,
+                AppCompactor.KEY_COMPACT_ACTION_1,
                 Integer.toString((AppCompactor.DEFAULT_COMPACT_ACTION_1 + 1 % 4) + 1), false);
-        DeviceConfig.setProperty(DeviceConfig.ActivityManager.NAMESPACE,
-                KEY_COMPACT_ACTION_2,
+        DeviceConfig.setProperty(DeviceConfig.NAMESPACE_ACTIVITY_MANAGER,
+                AppCompactor.KEY_COMPACT_ACTION_2,
                 Integer.toString((AppCompactor.DEFAULT_COMPACT_ACTION_2 + 1 % 4) + 1), false);
-        DeviceConfig.setProperty(DeviceConfig.ActivityManager.NAMESPACE,
-                KEY_COMPACT_THROTTLE_1,
+        DeviceConfig.setProperty(DeviceConfig.NAMESPACE_ACTIVITY_MANAGER,
+                AppCompactor.KEY_COMPACT_THROTTLE_1,
                 Long.toString(AppCompactor.DEFAULT_COMPACT_THROTTLE_1 + 1), false);
-        DeviceConfig.setProperty(DeviceConfig.ActivityManager.NAMESPACE,
-                KEY_COMPACT_THROTTLE_2,
+        DeviceConfig.setProperty(DeviceConfig.NAMESPACE_ACTIVITY_MANAGER,
+                AppCompactor.KEY_COMPACT_THROTTLE_2,
                 Long.toString(AppCompactor.DEFAULT_COMPACT_THROTTLE_2 + 1), false);
-        DeviceConfig.setProperty(DeviceConfig.ActivityManager.NAMESPACE,
-                KEY_COMPACT_THROTTLE_3,
+        DeviceConfig.setProperty(DeviceConfig.NAMESPACE_ACTIVITY_MANAGER,
+                AppCompactor.KEY_COMPACT_THROTTLE_3,
                 Long.toString(AppCompactor.DEFAULT_COMPACT_THROTTLE_3 + 1), false);
-        DeviceConfig.setProperty(DeviceConfig.ActivityManager.NAMESPACE,
-                KEY_COMPACT_THROTTLE_4,
+        DeviceConfig.setProperty(DeviceConfig.NAMESPACE_ACTIVITY_MANAGER,
+                AppCompactor.KEY_COMPACT_THROTTLE_4,
                 Long.toString(AppCompactor.DEFAULT_COMPACT_THROTTLE_4 + 1), false);
-        DeviceConfig.setProperty(DeviceConfig.ActivityManager.NAMESPACE,
-                KEY_COMPACT_STATSD_SAMPLE_RATE,
+        DeviceConfig.setProperty(DeviceConfig.NAMESPACE_ACTIVITY_MANAGER,
+                AppCompactor.KEY_COMPACT_STATSD_SAMPLE_RATE,
                 Float.toString(AppCompactor.DEFAULT_STATSD_SAMPLE_RATE + 0.1f), false);
 
         // Then calling init will read and set that flag.
@@ -169,8 +160,8 @@
         // When we call init and change some the flag value...
         mCompactorUnderTest.init();
         mCountDown = new CountDownLatch(1);
-        DeviceConfig.setProperty(DeviceConfig.ActivityManager.NAMESPACE,
-                KEY_USE_COMPACTION, "true", false);
+        DeviceConfig.setProperty(DeviceConfig.NAMESPACE_ACTIVITY_MANAGER,
+                AppCompactor.KEY_USE_COMPACTION, "true", false);
         assertThat(mCountDown.await(5, TimeUnit.SECONDS)).isTrue();
 
         // Then that new flag value is updated in the implementation.
@@ -179,8 +170,8 @@
 
         // And again, setting the flag the other way.
         mCountDown = new CountDownLatch(1);
-        DeviceConfig.setProperty(DeviceConfig.ActivityManager.NAMESPACE,
-                KEY_USE_COMPACTION, "false", false);
+        DeviceConfig.setProperty(DeviceConfig.NAMESPACE_ACTIVITY_MANAGER,
+                AppCompactor.KEY_USE_COMPACTION, "false", false);
         assertThat(mCountDown.await(5, TimeUnit.SECONDS)).isTrue();
         assertThat(mCompactorUnderTest.useCompaction()).isFalse();
     }
@@ -193,8 +184,8 @@
 
         // When we push an invalid flag value...
         mCountDown = new CountDownLatch(1);
-        DeviceConfig.setProperty(DeviceConfig.ActivityManager.NAMESPACE,
-                KEY_USE_COMPACTION, "foobar", false);
+        DeviceConfig.setProperty(DeviceConfig.NAMESPACE_ACTIVITY_MANAGER,
+                AppCompactor.KEY_USE_COMPACTION, "foobar", false);
         assertThat(mCountDown.await(5, TimeUnit.SECONDS)).isTrue();
 
         // Then we set the default.
@@ -212,11 +203,11 @@
         for (int i = 1; i < 5; i++) {
             mCountDown = new CountDownLatch(2);
             int expectedSome = (AppCompactor.DEFAULT_COMPACT_ACTION_1 + i) % 4 + 1;
-            DeviceConfig.setProperty(DeviceConfig.ActivityManager.NAMESPACE,
-                    KEY_COMPACT_ACTION_1, Integer.toString(expectedSome), false);
+            DeviceConfig.setProperty(DeviceConfig.NAMESPACE_ACTIVITY_MANAGER,
+                    AppCompactor.KEY_COMPACT_ACTION_1, Integer.toString(expectedSome), false);
             int expectedFull = (AppCompactor.DEFAULT_COMPACT_ACTION_2 + i) % 4 + 1;
-            DeviceConfig.setProperty(DeviceConfig.ActivityManager.NAMESPACE,
-                    KEY_COMPACT_ACTION_2, Integer.toString(expectedFull), false);
+            DeviceConfig.setProperty(DeviceConfig.NAMESPACE_ACTIVITY_MANAGER,
+                    AppCompactor.KEY_COMPACT_ACTION_2, Integer.toString(expectedFull), false);
             assertThat(mCountDown.await(5, TimeUnit.SECONDS)).isTrue();
 
             // Then the updates are reflected in the flags.
@@ -233,10 +224,10 @@
 
         // When we override new values for the compaction action with bad values ...
         mCountDown = new CountDownLatch(2);
-        DeviceConfig.setProperty(DeviceConfig.ActivityManager.NAMESPACE,
-                KEY_COMPACT_ACTION_1, "foo", false);
-        DeviceConfig.setProperty(DeviceConfig.ActivityManager.NAMESPACE,
-                KEY_COMPACT_ACTION_2, "foo", false);
+        DeviceConfig.setProperty(DeviceConfig.NAMESPACE_ACTIVITY_MANAGER,
+                AppCompactor.KEY_COMPACT_ACTION_1, "foo", false);
+        DeviceConfig.setProperty(DeviceConfig.NAMESPACE_ACTIVITY_MANAGER,
+                AppCompactor.KEY_COMPACT_ACTION_2, "foo", false);
         assertThat(mCountDown.await(5, TimeUnit.SECONDS)).isTrue();
 
         // Then the default values are reflected in the flag
@@ -246,10 +237,10 @@
                 compactActionIntToString(AppCompactor.DEFAULT_COMPACT_ACTION_2));
 
         mCountDown = new CountDownLatch(2);
-        DeviceConfig.setProperty(DeviceConfig.ActivityManager.NAMESPACE,
-                KEY_COMPACT_ACTION_1, "", false);
-        DeviceConfig.setProperty(DeviceConfig.ActivityManager.NAMESPACE,
-                KEY_COMPACT_ACTION_2, "", false);
+        DeviceConfig.setProperty(DeviceConfig.NAMESPACE_ACTIVITY_MANAGER,
+                AppCompactor.KEY_COMPACT_ACTION_1, "", false);
+        DeviceConfig.setProperty(DeviceConfig.NAMESPACE_ACTIVITY_MANAGER,
+                AppCompactor.KEY_COMPACT_ACTION_2, "", false);
         assertThat(mCountDown.await(5, TimeUnit.SECONDS)).isTrue();
 
         assertThat(mCompactorUnderTest.mCompactActionSome).isEqualTo(
@@ -264,17 +255,17 @@
 
         // When we override new reasonable throttle values after init...
         mCountDown = new CountDownLatch(4);
-        DeviceConfig.setProperty(DeviceConfig.ActivityManager.NAMESPACE,
-                KEY_COMPACT_THROTTLE_1,
+        DeviceConfig.setProperty(DeviceConfig.NAMESPACE_ACTIVITY_MANAGER,
+                AppCompactor.KEY_COMPACT_THROTTLE_1,
                 Long.toString(AppCompactor.DEFAULT_COMPACT_THROTTLE_1 + 1), false);
-        DeviceConfig.setProperty(DeviceConfig.ActivityManager.NAMESPACE,
-                KEY_COMPACT_THROTTLE_2,
+        DeviceConfig.setProperty(DeviceConfig.NAMESPACE_ACTIVITY_MANAGER,
+                AppCompactor.KEY_COMPACT_THROTTLE_2,
                 Long.toString(AppCompactor.DEFAULT_COMPACT_THROTTLE_2 + 1), false);
-        DeviceConfig.setProperty(DeviceConfig.ActivityManager.NAMESPACE,
-                KEY_COMPACT_THROTTLE_3,
+        DeviceConfig.setProperty(DeviceConfig.NAMESPACE_ACTIVITY_MANAGER,
+                AppCompactor.KEY_COMPACT_THROTTLE_3,
                 Long.toString(AppCompactor.DEFAULT_COMPACT_THROTTLE_3 + 1), false);
-        DeviceConfig.setProperty(DeviceConfig.ActivityManager.NAMESPACE,
-                KEY_COMPACT_THROTTLE_4,
+        DeviceConfig.setProperty(DeviceConfig.NAMESPACE_ACTIVITY_MANAGER,
+                AppCompactor.KEY_COMPACT_THROTTLE_4,
                 Long.toString(AppCompactor.DEFAULT_COMPACT_THROTTLE_4 + 1), false);
         assertThat(mCountDown.await(5, TimeUnit.SECONDS)).isTrue();
 
@@ -296,8 +287,8 @@
 
         // When one of the throttles is overridden with a bad value...
         mCountDown = new CountDownLatch(1);
-        DeviceConfig.setProperty(DeviceConfig.ActivityManager.NAMESPACE,
-                KEY_COMPACT_THROTTLE_1, "foo", false);
+        DeviceConfig.setProperty(DeviceConfig.NAMESPACE_ACTIVITY_MANAGER,
+                AppCompactor.KEY_COMPACT_THROTTLE_1, "foo", false);
         // Then all the throttles have the defaults set.
         assertThat(mCountDown.await(5, TimeUnit.SECONDS)).isTrue();
         assertThat(mCompactorUnderTest.mCompactThrottleSomeSome).isEqualTo(
@@ -311,8 +302,8 @@
 
         // Repeat for each of the throttle keys.
         mCountDown = new CountDownLatch(1);
-        DeviceConfig.setProperty(DeviceConfig.ActivityManager.NAMESPACE,
-                KEY_COMPACT_THROTTLE_2, "foo", false);
+        DeviceConfig.setProperty(DeviceConfig.NAMESPACE_ACTIVITY_MANAGER,
+                AppCompactor.KEY_COMPACT_THROTTLE_2, "foo", false);
         assertThat(mCountDown.await(5, TimeUnit.SECONDS)).isTrue();
         assertThat(mCompactorUnderTest.mCompactThrottleSomeSome).isEqualTo(
                 AppCompactor.DEFAULT_COMPACT_THROTTLE_1);
@@ -324,8 +315,8 @@
                 AppCompactor.DEFAULT_COMPACT_THROTTLE_4);
 
         mCountDown = new CountDownLatch(1);
-        DeviceConfig.setProperty(DeviceConfig.ActivityManager.NAMESPACE,
-                KEY_COMPACT_THROTTLE_3, "foo", false);
+        DeviceConfig.setProperty(DeviceConfig.NAMESPACE_ACTIVITY_MANAGER,
+                AppCompactor.KEY_COMPACT_THROTTLE_3, "foo", false);
         assertThat(mCountDown.await(5, TimeUnit.SECONDS)).isTrue();
         assertThat(mCompactorUnderTest.mCompactThrottleSomeSome).isEqualTo(
                 AppCompactor.DEFAULT_COMPACT_THROTTLE_1);
@@ -337,8 +328,8 @@
                 AppCompactor.DEFAULT_COMPACT_THROTTLE_4);
 
         mCountDown = new CountDownLatch(1);
-        DeviceConfig.setProperty(DeviceConfig.ActivityManager.NAMESPACE,
-                KEY_COMPACT_THROTTLE_4, "foo", false);
+        DeviceConfig.setProperty(DeviceConfig.NAMESPACE_ACTIVITY_MANAGER,
+                AppCompactor.KEY_COMPACT_THROTTLE_4, "foo", false);
         assertThat(mCountDown.await(5, TimeUnit.SECONDS)).isTrue();
         assertThat(mCompactorUnderTest.mCompactThrottleSomeSome).isEqualTo(
                 AppCompactor.DEFAULT_COMPACT_THROTTLE_1);
@@ -356,8 +347,8 @@
 
         // When we override mStatsdSampleRate with a reasonable values ...
         mCountDown = new CountDownLatch(1);
-        DeviceConfig.setProperty(DeviceConfig.ActivityManager.NAMESPACE,
-                KEY_COMPACT_STATSD_SAMPLE_RATE,
+        DeviceConfig.setProperty(DeviceConfig.NAMESPACE_ACTIVITY_MANAGER,
+                AppCompactor.KEY_COMPACT_STATSD_SAMPLE_RATE,
                 Float.toString(AppCompactor.DEFAULT_STATSD_SAMPLE_RATE + 0.1f), false);
         assertThat(mCountDown.await(5, TimeUnit.SECONDS)).isTrue();
 
@@ -373,8 +364,8 @@
 
         // When we override mStatsdSampleRate with a reasonable values ...
         mCountDown = new CountDownLatch(1);
-        DeviceConfig.setProperty(DeviceConfig.ActivityManager.NAMESPACE,
-                KEY_COMPACT_STATSD_SAMPLE_RATE, "foo", false);
+        DeviceConfig.setProperty(DeviceConfig.NAMESPACE_ACTIVITY_MANAGER,
+                AppCompactor.KEY_COMPACT_STATSD_SAMPLE_RATE, "foo", false);
         assertThat(mCountDown.await(5, TimeUnit.SECONDS)).isTrue();
 
         // Then that override is reflected in the compactor.
@@ -389,8 +380,8 @@
 
         // When we override mStatsdSampleRate with an value outside of [0..1]...
         mCountDown = new CountDownLatch(1);
-        DeviceConfig.setProperty(DeviceConfig.ActivityManager.NAMESPACE,
-                KEY_COMPACT_STATSD_SAMPLE_RATE,
+        DeviceConfig.setProperty(DeviceConfig.NAMESPACE_ACTIVITY_MANAGER,
+                AppCompactor.KEY_COMPACT_STATSD_SAMPLE_RATE,
                 Float.toString(-1.0f), false);
         assertThat(mCountDown.await(5, TimeUnit.SECONDS)).isTrue();
 
@@ -398,8 +389,8 @@
         assertThat(mCompactorUnderTest.mStatsdSampleRate).isEqualTo(0.0f);
 
         mCountDown = new CountDownLatch(1);
-        DeviceConfig.setProperty(DeviceConfig.ActivityManager.NAMESPACE,
-                KEY_COMPACT_STATSD_SAMPLE_RATE,
+        DeviceConfig.setProperty(DeviceConfig.NAMESPACE_ACTIVITY_MANAGER,
+                AppCompactor.KEY_COMPACT_STATSD_SAMPLE_RATE,
                 Float.toString(1.01f), false);
         assertThat(mCountDown.await(5, TimeUnit.SECONDS)).isTrue();
 
diff --git a/services/tests/runtests.py b/services/tests/runtests.py
index f19cc5d..4c8b4ba 100755
--- a/services/tests/runtests.py
+++ b/services/tests/runtests.py
@@ -19,7 +19,7 @@
 import sys
 
 INSTRUMENTED_PACKAGE_RUNNER = ('com.android.frameworks.servicestests/'
-                               'android.support.test.runner.AndroidJUnitRunner')
+                               'androidx.test.runner.AndroidJUnitRunner')
 
 PACKAGE_WHITELIST = (
     "com.android.server",
diff --git a/services/tests/servicestests/src/com/android/server/am/ProcessRecordTests.java b/services/tests/servicestests/src/com/android/server/am/ProcessRecordTests.java
new file mode 100644
index 0000000..5b85980
--- /dev/null
+++ b/services/tests/servicestests/src/com/android/server/am/ProcessRecordTests.java
@@ -0,0 +1,160 @@
+/*
+ * Copyright (C) 2019 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 com.android.server.am;
+
+import static android.testing.DexmakerShareClassLoaderRule.runWithDexmakerShareClassLoader;
+
+import static androidx.test.platform.app.InstrumentationRegistry.getInstrumentation;
+
+import static org.junit.Assert.assertFalse;
+import static org.junit.Assert.assertTrue;
+import static org.mockito.Mockito.doNothing;
+import static org.mockito.Mockito.doReturn;
+import static org.mockito.Mockito.mock;
+import static org.mockito.Mockito.spy;
+
+import android.content.Context;
+import android.platform.test.annotations.Presubmit;
+
+import androidx.test.filters.FlakyTest;
+
+import com.android.server.wm.ActivityTaskManagerService;
+
+import org.junit.Before;
+import org.junit.BeforeClass;
+import org.junit.Test;
+
+import java.util.Collections;
+
+/**
+ * Build/Install/Run:
+ *  atest FrameworksServicesTests:ProcessRecordTests
+ */
+@Presubmit
+@FlakyTest(detail = "Promote to presubmit when shown to be stable.")
+public class ProcessRecordTests {
+    private static Context sContext;
+    private static ActivityManagerService sService;
+
+    private ProcessRecord mProcessRecord;
+
+    @BeforeClass
+    public static void setUpOnce() throws Exception {
+        sContext = getInstrumentation().getTargetContext();
+
+        // We need to run with dexmaker share class loader to make use of ActivityTaskManagerService
+        // from wm package.
+        runWithDexmakerShareClassLoader(() -> {
+            sService = mock(ActivityManagerService.class);
+            sService.mActivityTaskManager = new ActivityTaskManagerService(sContext);
+            sService.mActivityTaskManager.initialize(null, null, sContext.getMainLooper());
+            sService.mAtmInternal = sService.mActivityTaskManager.getAtmInternal();
+        });
+    }
+
+    @Before
+    public void setUpProcess() throws Exception {
+        // Need to run with dexmaker share class loader to mock package private class.
+        runWithDexmakerShareClassLoader(() -> {
+            mProcessRecord = spy(new ProcessRecord(sService, sContext.getApplicationInfo(),
+                    "name", 12345));
+            doNothing().when(mProcessRecord).startAppProblemLocked();
+            doReturn(false).when(mProcessRecord).isSilentAnr();
+            doReturn(false).when(mProcessRecord).isMonitorCpuUsage();
+            doReturn(Collections.emptyList()).when(mProcessRecord).getLruProcessList();
+        });
+    }
+
+
+    /**
+     * This test verifies the process default status. If this doesn't pass, none of the other tests
+     * should be able to pass.
+     */
+    @Test
+    public void testProcessDefaultAnrRelatedStatus() {
+        assertFalse(mProcessRecord.isNotResponding());
+        assertFalse(mProcessRecord.isCrashing());
+        assertFalse(mProcessRecord.killedByAm);
+        assertFalse(mProcessRecord.killed);
+    }
+
+    /**
+     * This test verifies that if the process is crashing, Anr will do nothing.
+     */
+    @Test
+    public void testAnrWhenCrash() {
+        mProcessRecord.setCrashing(true);
+        assertTrue(mProcessRecord.isCrashing());
+        mProcessRecord.appNotResponding(null, null, null, null, false, "Test ANR when crash");
+        assertFalse(mProcessRecord.isNotResponding());
+        assertFalse(mProcessRecord.killedByAm);
+        assertFalse(mProcessRecord.killed);
+    }
+
+    /**
+     * This test verifies that if the process is killed by AM, Anr will do nothing.
+     */
+    @Test
+    public void testAnrWhenKilledByAm() {
+        mProcessRecord.killedByAm = true;
+        mProcessRecord.appNotResponding(null, null, null, null, false,
+                "Test ANR when killed by AM");
+        assertFalse(mProcessRecord.isNotResponding());
+        assertFalse(mProcessRecord.isCrashing());
+        assertFalse(mProcessRecord.killed);
+    }
+
+    /**
+     * This test verifies that if the process is killed, Anr will do nothing.
+     */
+    @Test
+    public void testAnrWhenKilled() {
+        mProcessRecord.killed = true;
+        mProcessRecord.appNotResponding(null, null, null, null, false, "Test ANR when killed");
+        assertFalse(mProcessRecord.isNotResponding());
+        assertFalse(mProcessRecord.isCrashing());
+        assertFalse(mProcessRecord.killedByAm);
+    }
+
+    /**
+     * This test verifies that non-silent ANR can run through successfully and the corresponding
+     * flags can be set correctly.
+     */
+    @Test
+    public void testNonSilentAnr() {
+        mProcessRecord.appNotResponding(null, null, null, null, false, "Test non-silent ANR");
+        assertTrue(mProcessRecord.isNotResponding());
+        assertFalse(mProcessRecord.isCrashing());
+        assertFalse(mProcessRecord.killedByAm);
+        assertFalse(mProcessRecord.killed);
+    }
+
+    /**
+     * This test verifies that silent ANR can run through successfully and the corresponding flags
+     * can be set correctly.
+     */
+    @Test
+    public void testSilentAnr() {
+        // Silent Anr will run through even without a parent process, and directly killed by AM.
+        doReturn(true).when(mProcessRecord).isSilentAnr();
+        mProcessRecord.appNotResponding(null, null, null, null, false, "Test silent ANR");
+        assertTrue(mProcessRecord.isNotResponding());
+        assertFalse(mProcessRecord.isCrashing());
+        assertTrue(mProcessRecord.killedByAm);
+        assertTrue(mProcessRecord.killed);
+    }
+}
diff --git a/services/tests/servicestests/src/com/android/server/appop/AppOpsNotedWatcherTest.java b/services/tests/servicestests/src/com/android/server/appop/AppOpsNotedWatcherTest.java
index edd89f9..96f329b 100644
--- a/services/tests/servicestests/src/com/android/server/appop/AppOpsNotedWatcherTest.java
+++ b/services/tests/servicestests/src/com/android/server/appop/AppOpsNotedWatcherTest.java
@@ -45,21 +45,6 @@
 
     private static final long NOTIFICATION_TIMEOUT_MILLIS = 5000;
 
-    public void testWatchNotedOpsRequiresPermission() {
-        // Create a mock listener
-        final OnOpNotedListener listener = mock(OnOpNotedListener.class);
-
-        // Try to start watching noted ops
-        final AppOpsManager appOpsManager = getContext().getSystemService(AppOpsManager.class);
-        try {
-            appOpsManager.startWatchingNoted(new int[]{AppOpsManager.OP_FINE_LOCATION,
-                    AppOpsManager.OP_RECORD_AUDIO}, listener);
-            fail("Watching noted ops shoudl require " + Manifest.permission.WATCH_APPOPS);
-        } catch (SecurityException expected) {
-            /*ignored*/
-        }
-    }
-
     @Test
     public void testWatchNotedOps() {
         // Create a mock listener
diff --git a/services/tests/servicestests/src/com/android/server/appop/AppOpsUpgradeTest.java b/services/tests/servicestests/src/com/android/server/appop/AppOpsUpgradeTest.java
index eb0c627..66d2bab 100644
--- a/services/tests/servicestests/src/com/android/server/appop/AppOpsUpgradeTest.java
+++ b/services/tests/servicestests/src/com/android/server/appop/AppOpsUpgradeTest.java
@@ -107,8 +107,8 @@
                 }
                 final AppOpsService.Op _op1 = ops.get(op1);
                 final AppOpsService.Op _op2 = ops.get(op2);
-                final int mode1 = (_op1 == null) ? defaultModeOp1 : _op1.mode;
-                final int mode2 = (_op2 == null) ? defaultModeOp2 : _op2.mode;
+                final int mode1 = (_op1 == null) ? defaultModeOp1 : _op1.getMode();
+                final int mode2 = (_op2 == null) ? defaultModeOp2 : _op2.getMode();
                 assertEquals(mode1, mode2);
                 if (mode1 != defaultModeOp1) {
                     numberOfNonDefaultOps++;
diff --git a/services/tests/servicestests/src/com/android/server/devicepolicy/DevicePolicyManagerTest.java b/services/tests/servicestests/src/com/android/server/devicepolicy/DevicePolicyManagerTest.java
index 4293247..039a4b7 100644
--- a/services/tests/servicestests/src/com/android/server/devicepolicy/DevicePolicyManagerTest.java
+++ b/services/tests/servicestests/src/com/android/server/devicepolicy/DevicePolicyManagerTest.java
@@ -29,6 +29,7 @@
 import static android.os.UserManagerInternal.CAMERA_DISABLED_LOCALLY;
 import static android.os.UserManagerInternal.CAMERA_NOT_DISABLED;
 
+import static com.android.internal.widget.LockPatternUtils.EscrowTokenStateChangeCallback;
 import static com.android.server.testutils.TestUtils.assertExpectException;
 
 import static org.mockito.Matchers.any;
@@ -4157,8 +4158,9 @@
         final byte[] token = new byte[32];
         final long handle = 123456;
         final String password = "password";
-        when(getServices().lockPatternUtils.addEscrowToken(eq(token), eq(UserHandle.USER_SYSTEM)))
-            .thenReturn(handle);
+        when(getServices().lockPatternUtils.addEscrowToken(eq(token), eq(UserHandle.USER_SYSTEM),
+                nullable(EscrowTokenStateChangeCallback.class)))
+                .thenReturn(handle);
         assertTrue(dpm.setResetPasswordToken(admin1, token));
 
         // test password activation
diff --git a/services/tests/servicestests/src/com/android/server/display/AppSaturationControllerTest.java b/services/tests/servicestests/src/com/android/server/display/color/AppSaturationControllerTest.java
similarity index 95%
rename from services/tests/servicestests/src/com/android/server/display/AppSaturationControllerTest.java
rename to services/tests/servicestests/src/com/android/server/display/color/AppSaturationControllerTest.java
index e518844..7c9a81d 100644
--- a/services/tests/servicestests/src/com/android/server/display/AppSaturationControllerTest.java
+++ b/services/tests/servicestests/src/com/android/server/display/color/AppSaturationControllerTest.java
@@ -14,9 +14,9 @@
  * limitations under the License.
  */
 
-package com.android.server.display;
+package com.android.server.display.color;
 
-import static com.android.server.display.AppSaturationController.TRANSLATION_VECTOR;
+import static com.android.server.display.color.AppSaturationController.TRANSLATION_VECTOR;
 
 import static org.mockito.ArgumentMatchers.any;
 import static org.mockito.ArgumentMatchers.eq;
@@ -29,7 +29,7 @@
 
 import androidx.test.runner.AndroidJUnit4;
 
-import com.android.server.display.ColorDisplayService.ColorTransformController;
+import com.android.server.display.color.ColorDisplayService.ColorTransformController;
 
 import org.junit.After;
 import org.junit.Before;
diff --git a/services/tests/servicestests/src/com/android/server/display/ColorDisplayServiceTest.java b/services/tests/servicestests/src/com/android/server/display/color/ColorDisplayServiceTest.java
similarity index 95%
rename from services/tests/servicestests/src/com/android/server/display/ColorDisplayServiceTest.java
rename to services/tests/servicestests/src/com/android/server/display/color/ColorDisplayServiceTest.java
index 01759d2..2f427b0 100644
--- a/services/tests/servicestests/src/com/android/server/display/ColorDisplayServiceTest.java
+++ b/services/tests/servicestests/src/com/android/server/display/color/ColorDisplayServiceTest.java
@@ -14,7 +14,7 @@
  * limitations under the License.
  */
 
-package com.android.server.display;
+package com.android.server.display.color;
 
 import static com.google.common.truth.Truth.assertWithMessage;
 
@@ -70,7 +70,7 @@
 
     private MockTwilightManager mTwilightManager;
 
-    private ColorDisplayService mColorDisplayService;
+    private ColorDisplayService mCds;
     private ColorDisplayService.BinderService mBinderService;
 
     @BeforeClass
@@ -96,17 +96,17 @@
         mTwilightManager = new MockTwilightManager();
         LocalServices.addService(TwilightManager.class, mTwilightManager);
 
-        mColorDisplayService = new ColorDisplayService(mContext);
-        mBinderService = mColorDisplayService.new BinderService();
+        mCds = new ColorDisplayService(mContext);
+        mBinderService = mCds.new BinderService();
         LocalServices.addService(ColorDisplayService.ColorDisplayServiceInternal.class,
-                        mColorDisplayService.new ColorDisplayServiceInternal());
+                mCds.new ColorDisplayServiceInternal());
     }
 
     @After
     public void tearDown() {
         LocalServices.removeServiceForTest(TwilightManager.class);
 
-        mColorDisplayService = null;
+        mCds = null;
 
         mTwilightManager = null;
 
@@ -1003,7 +1003,7 @@
 
         /* Since we are using FakeSettingsProvider which could not trigger observer change,
          * force an update here.*/
-        mColorDisplayService.updateDisplayWhiteBalanceStatus();
+        mCds.updateDisplayWhiteBalanceStatus();
         assertDwbActive(false);
     }
 
@@ -1015,12 +1015,12 @@
         setAutoModeTwilight(-120 /* sunsetOffset */, -60 /* sunriseOffset */);
         setActivated(true /* activated */, -30 /* lastActivatedTimeOffset */);
 
-        mColorDisplayService.updateDisplayWhiteBalanceStatus();
+        mCds.updateDisplayWhiteBalanceStatus();
         assertDwbActive(false);
 
         /* Disable nightlight */
         setActivated(false /* activated */, -30 /* lastActivatedTimeOffset */);
-        mColorDisplayService.updateDisplayWhiteBalanceStatus();
+        mCds.updateDisplayWhiteBalanceStatus();
         assertDwbActive(true);
     }
 
@@ -1031,48 +1031,48 @@
         startService();
         mBinderService.setColorMode(ColorDisplayManager.COLOR_MODE_NATURAL);
 
-        mColorDisplayService.updateDisplayWhiteBalanceStatus();
+        mCds.updateDisplayWhiteBalanceStatus();
         assertDwbActive(true);
     }
 
     @Test
     public void displayWhiteBalance_setTemperatureOverMax() {
-        int max = mColorDisplayService.mDisplayWhiteBalanceTintController.mTemperatureMax;
+        int max = mCds.mDisplayWhiteBalanceTintController.mTemperatureMax;
 
         ColorDisplayService.ColorDisplayServiceInternal cdsInternal = LocalServices.getService(
-                        ColorDisplayService.ColorDisplayServiceInternal.class);
-        cdsInternal.setDisplayWhiteBalanceColorTemperature(max+1);
+                ColorDisplayService.ColorDisplayServiceInternal.class);
+        cdsInternal.setDisplayWhiteBalanceColorTemperature(max + 1);
 
         assertWithMessage("Unexpected temperature set")
-                .that(mColorDisplayService.mDisplayWhiteBalanceTintController.mCurrentColorTemperature)
+                .that(mCds.mDisplayWhiteBalanceTintController.mCurrentColorTemperature)
                 .isEqualTo(max);
     }
 
     @Test
     public void displayWhiteBalance_setTemperatureBelowMin() {
-        int min = mColorDisplayService.mDisplayWhiteBalanceTintController.mTemperatureMin;
+        int min = mCds.mDisplayWhiteBalanceTintController.mTemperatureMin;
 
         ColorDisplayService.ColorDisplayServiceInternal cdsInternal = LocalServices.getService(
-                        ColorDisplayService.ColorDisplayServiceInternal.class);
+                ColorDisplayService.ColorDisplayServiceInternal.class);
         cdsInternal.setDisplayWhiteBalanceColorTemperature(min - 1);
 
         assertWithMessage("Unexpected temperature set")
-                .that(mColorDisplayService.mDisplayWhiteBalanceTintController.mCurrentColorTemperature)
+                .that(mCds.mDisplayWhiteBalanceTintController.mCurrentColorTemperature)
                 .isEqualTo(min);
     }
 
     @Test
     public void displayWhiteBalance_setValidTemperature() {
-        int min = mColorDisplayService.mDisplayWhiteBalanceTintController.mTemperatureMin;
-        int max = mColorDisplayService.mDisplayWhiteBalanceTintController.mTemperatureMax;
+        int min = mCds.mDisplayWhiteBalanceTintController.mTemperatureMin;
+        int max = mCds.mDisplayWhiteBalanceTintController.mTemperatureMax;
         int valToSet = (min + max) / 2;
 
         ColorDisplayService.ColorDisplayServiceInternal cdsInternal = LocalServices.getService(
-                        ColorDisplayService.ColorDisplayServiceInternal.class);
+                ColorDisplayService.ColorDisplayServiceInternal.class);
         cdsInternal.setDisplayWhiteBalanceColorTemperature(valToSet);
 
         assertWithMessage("Unexpected temperature set")
-                .that(mColorDisplayService.mDisplayWhiteBalanceTintController.mCurrentColorTemperature)
+                .that(mCds.mDisplayWhiteBalanceTintController.mCurrentColorTemperature)
                 .isEqualTo(valToSet);
     }
 
@@ -1171,14 +1171,14 @@
     }
 
     /**
-     * Convenience method to start {@link #mColorDisplayService}.
+     * Convenience method to start {@link #mCds}.
      */
     private void startService() {
         Secure.putIntForUser(mContext.getContentResolver(), Secure.USER_SETUP_COMPLETE, 1, mUserId);
 
         InstrumentationRegistry.getInstrumentation().runOnMainSync(() -> {
-            mColorDisplayService.onBootPhase(SystemService.PHASE_BOOT_COMPLETED);
-            mColorDisplayService.onStartUser(mUserId);
+            mCds.onBootPhase(SystemService.PHASE_BOOT_COMPLETED);
+            mCds.onStartUser(mUserId);
         });
     }
 
@@ -1224,7 +1224,7 @@
      */
     private void assertDwbActive(boolean enabled) {
         assertWithMessage("Incorrect Display White Balance state")
-                .that(mColorDisplayService.mDisplayWhiteBalanceTintController.isActivated())
+                .that(mCds.mDisplayWhiteBalanceTintController.isActivated())
                 .isEqualTo(enabled);
     }
 
diff --git a/services/tests/servicestests/src/com/android/server/locksettings/BaseLockSettingsServiceTests.java b/services/tests/servicestests/src/com/android/server/locksettings/BaseLockSettingsServiceTests.java
index aadf924..3d02576 100644
--- a/services/tests/servicestests/src/com/android/server/locksettings/BaseLockSettingsServiceTests.java
+++ b/services/tests/servicestests/src/com/android/server/locksettings/BaseLockSettingsServiceTests.java
@@ -88,6 +88,7 @@
     IAuthSecret mAuthSecretService;
     WindowManagerInternal mMockWindowManager;
     FakeGsiService mGsiService;
+    PasswordSlotManagerTestable mPasswordSlotManager;
     protected boolean mHasSecureLockScreen;
 
     @Override
@@ -103,6 +104,7 @@
         mDevicePolicyManagerInternal = mock(DevicePolicyManagerInternal.class);
         mMockWindowManager = mock(WindowManagerInternal.class);
         mGsiService = new FakeGsiService();
+        mPasswordSlotManager = new PasswordSlotManagerTestable();
 
         LocalServices.removeServiceForTest(LockSettingsInternal.class);
         LocalServices.removeServiceForTest(DevicePolicyManagerInternal.class);
@@ -135,7 +137,7 @@
             }
         };
         mSpManager = new MockSyntheticPasswordManager(mContext, mStorage, mGateKeeperService,
-                mUserManager);
+                mUserManager, mPasswordSlotManager);
         mAuthSecretService = mock(IAuthSecret.class);
         mService = new LockSettingsServiceTestable(mContext, mLockPatternUtils, mStorage,
                 mGateKeeperService, mKeyStore, setUpStorageManagerMock(), mActivityManager,
@@ -223,6 +225,8 @@
 
         File storageDir = mStorage.mStorageDir;
         assertTrue(FileUtils.deleteContents(storageDir));
+
+        mPasswordSlotManager.cleanup();
     }
 
     protected void assertNotEquals(long expected, long actual) {
diff --git a/services/tests/servicestests/src/com/android/server/locksettings/MockSyntheticPasswordManager.java b/services/tests/servicestests/src/com/android/server/locksettings/MockSyntheticPasswordManager.java
index b9cb730..5a3f12c 100644
--- a/services/tests/servicestests/src/com/android/server/locksettings/MockSyntheticPasswordManager.java
+++ b/services/tests/servicestests/src/com/android/server/locksettings/MockSyntheticPasswordManager.java
@@ -35,10 +35,12 @@
 
     private FakeGateKeeperService mGateKeeper;
     private IWeaver mWeaverService;
+    private PasswordSlotManagerTestable mPasswordSlotManager;
 
     public MockSyntheticPasswordManager(Context context, LockSettingsStorage storage,
-            FakeGateKeeperService gatekeeper, UserManager userManager) {
-        super(context, storage, userManager);
+            FakeGateKeeperService gatekeeper, UserManager userManager,
+            PasswordSlotManager passwordSlotManager) {
+        super(context, storage, userManager, passwordSlotManager);
         mGateKeeper = gatekeeper;
     }
 
@@ -117,5 +119,4 @@
         mWeaverService = new MockWeaverService();
         initWeaverService();
     }
-
 }
diff --git a/services/tests/servicestests/src/com/android/server/locksettings/PasswordSlotManagerTestable.java b/services/tests/servicestests/src/com/android/server/locksettings/PasswordSlotManagerTestable.java
new file mode 100644
index 0000000..1e855a9
--- /dev/null
+++ b/services/tests/servicestests/src/com/android/server/locksettings/PasswordSlotManagerTestable.java
@@ -0,0 +1,61 @@
+/*
+ * Copyright (C) 2019 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 com.android.server.locksettings;
+
+import androidx.test.InstrumentationRegistry;
+
+import java.io.File;
+import java.nio.file.Files;
+import java.nio.file.Paths;
+
+public class PasswordSlotManagerTestable extends PasswordSlotManager {
+
+    private int mGsiImageNumber;
+    private String mSlotMapDir;
+
+    public PasswordSlotManagerTestable() {
+        mGsiImageNumber = 0;
+    }
+
+    @Override
+    protected int getGsiImageNumber() {
+        return mGsiImageNumber;
+    }
+
+    @Override
+    protected String getSlotMapDir() {
+        if (mSlotMapDir == null) {
+            final File testDir = InstrumentationRegistry.getContext().getFilesDir();
+            if (!testDir.exists()) {
+                testDir.mkdirs();
+            }
+
+            mSlotMapDir = testDir.getPath();
+        }
+        return mSlotMapDir;
+    }
+
+    void setGsiImageNumber(int gsiImageNumber) {
+        mGsiImageNumber = gsiImageNumber;
+    }
+
+    void cleanup() {
+        try {
+            Files.delete(Paths.get(getSlotMapDir(), "slot_map"));
+        } catch (Exception e) {
+        }
+    }
+};
diff --git a/services/tests/servicestests/src/com/android/server/locksettings/PasswordSlotManagerTests.java b/services/tests/servicestests/src/com/android/server/locksettings/PasswordSlotManagerTests.java
new file mode 100644
index 0000000..1d5a99b
--- /dev/null
+++ b/services/tests/servicestests/src/com/android/server/locksettings/PasswordSlotManagerTests.java
@@ -0,0 +1,122 @@
+/*
+ * Copyright (C) 2019 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 com.android.server.locksettings;
+
+import android.test.AndroidTestCase;
+
+import java.io.ByteArrayInputStream;
+import java.io.ByteArrayOutputStream;
+import java.util.HashMap;
+import java.util.HashSet;
+import java.util.Map;
+import java.util.Set;
+
+public class PasswordSlotManagerTests extends AndroidTestCase {
+
+    PasswordSlotManagerTestable mManager;
+
+    @Override
+    protected void setUp() throws Exception {
+        super.setUp();
+
+        mManager = new PasswordSlotManagerTestable();
+    }
+
+    @Override
+    protected void tearDown() throws Exception {
+        super.tearDown();
+
+        mManager.cleanup();
+    }
+
+    public void testBasicSlotUse() throws Exception {
+        mManager.markSlotInUse(0);
+        mManager.markSlotInUse(1);
+
+        Set<Integer> expected = new HashSet<Integer>();
+        expected.add(0);
+        expected.add(1);
+        assertEquals(expected, mManager.getUsedSlots());
+
+        mManager.markSlotDeleted(1);
+
+        expected = new HashSet<Integer>();
+        expected.add(0);
+        assertEquals(expected, mManager.getUsedSlots());
+    }
+
+    public void testMergeSlots() throws Exception {
+        // Add some slots from a different OS image.
+        mManager.setGsiImageNumber(1);
+        mManager.markSlotInUse(4);
+        mManager.markSlotInUse(6);
+
+        // Switch back to the host image.
+        mManager.setGsiImageNumber(0);
+        mManager.markSlotInUse(0);
+        mManager.markSlotInUse(3);
+        mManager.markSlotInUse(5);
+
+        // Correct slot information for the host image.
+        Set<Integer> actual = new HashSet<Integer>();
+        actual.add(1);
+        actual.add(3);
+        mManager.refreshActiveSlots(actual);
+
+        Set<Integer> expected = new HashSet<Integer>();
+        expected.add(1);
+        expected.add(3);
+        expected.add(4);
+        expected.add(6);
+        assertEquals(expected, mManager.getUsedSlots());
+    }
+
+    public void testSerialization() throws Exception {
+        mManager.markSlotInUse(0);
+        mManager.markSlotInUse(1);
+        mManager.setGsiImageNumber(1);
+        mManager.markSlotInUse(4);
+
+        final ByteArrayOutputStream saved = new ByteArrayOutputStream();
+        mManager.saveSlotMap(saved);
+
+        final HashMap<Integer, String> expected = new HashMap<Integer, String>();
+        expected.put(0, "host");
+        expected.put(1, "host");
+        expected.put(4, "gsi1");
+
+        final Map<Integer, String> map = mManager.loadSlotMap(
+                new ByteArrayInputStream(saved.toByteArray()));
+        assertEquals(expected, map);
+    }
+
+    public void testSaving() throws Exception {
+        mManager.markSlotInUse(0);
+        mManager.markSlotInUse(1);
+        mManager.setGsiImageNumber(1);
+        mManager.markSlotInUse(4);
+
+        // Make a new one. It should load the previous map.
+        mManager = new PasswordSlotManagerTestable();
+
+        Set<Integer> expected = new HashSet<Integer>();
+        expected.add(0);
+        expected.add(1);
+        expected.add(4);
+        assertEquals(expected, mManager.getUsedSlots());
+    }
+}
diff --git a/services/tests/servicestests/src/com/android/server/locksettings/SyntheticPasswordTests.java b/services/tests/servicestests/src/com/android/server/locksettings/SyntheticPasswordTests.java
index e6e020d..77515258 100644
--- a/services/tests/servicestests/src/com/android/server/locksettings/SyntheticPasswordTests.java
+++ b/services/tests/servicestests/src/com/android/server/locksettings/SyntheticPasswordTests.java
@@ -68,7 +68,7 @@
         final byte[] password = "user-password".getBytes();
         final byte[] badPassword = "bad-password".getBytes();
         MockSyntheticPasswordManager manager = new MockSyntheticPasswordManager(mContext, mStorage,
-                mGateKeeperService, mUserManager);
+                mGateKeeperService, mUserManager, mPasswordSlotManager);
         AuthenticationToken authToken = manager.newSyntheticPasswordAndSid(mGateKeeperService, null,
                 null, USER_ID);
         long handle = manager.createPasswordBasedSyntheticPassword(mGateKeeperService,
@@ -338,7 +338,7 @@
         initializeCredentialUnderSP(password, PRIMARY_USER_ID);
         final byte[] storageKey = mStorageManager.getUserUnlockToken(PRIMARY_USER_ID);
 
-        long handle = mLocalService.addEscrowToken(token, PRIMARY_USER_ID);
+        long handle = mLocalService.addEscrowToken(token, PRIMARY_USER_ID, null);
         assertFalse(mLocalService.isEscrowTokenActive(handle, PRIMARY_USER_ID));
 
         mService.verifyCredential(password, LockPatternUtils.CREDENTIAL_TYPE_PASSWORD, 0,
@@ -367,7 +367,7 @@
         initializeCredentialUnderSP(password, PRIMARY_USER_ID);
         final byte[] storageKey = mStorageManager.getUserUnlockToken(PRIMARY_USER_ID);
 
-        long handle = mLocalService.addEscrowToken(token, PRIMARY_USER_ID);
+        long handle = mLocalService.addEscrowToken(token, PRIMARY_USER_ID, null);
         assertFalse(mLocalService.isEscrowTokenActive(handle, PRIMARY_USER_ID));
 
         mService.verifyCredential(password, LockPatternUtils.CREDENTIAL_TYPE_PASSWORD,
@@ -393,7 +393,7 @@
         initializeCredentialUnderSP(password, PRIMARY_USER_ID);
         final byte[] storageKey = mStorageManager.getUserUnlockToken(PRIMARY_USER_ID);
 
-        long handle = mLocalService.addEscrowToken(token, PRIMARY_USER_ID);
+        long handle = mLocalService.addEscrowToken(token, PRIMARY_USER_ID, null);
         assertFalse(mLocalService.isEscrowTokenActive(handle, PRIMARY_USER_ID));
 
         mService.verifyCredential(password, LockPatternUtils.CREDENTIAL_TYPE_PASSWORD,
@@ -417,7 +417,7 @@
             throws RemoteException {
         final String token = "some-high-entropy-secure-token";
         enableSyntheticPassword();
-        long handle = mLocalService.addEscrowToken(token.getBytes(), PRIMARY_USER_ID);
+        long handle = mLocalService.addEscrowToken(token.getBytes(), PRIMARY_USER_ID, null);
         assertTrue(mLocalService.isEscrowTokenActive(handle, PRIMARY_USER_ID));
         assertEquals(0, mGateKeeperService.getSecureUserId(PRIMARY_USER_ID));
         assertTrue(hasSyntheticPassword(PRIMARY_USER_ID));
@@ -427,7 +427,7 @@
             throws RemoteException {
         final String token = "some-high-entropy-secure-token";
         initializeCredentialUnderSP(null, PRIMARY_USER_ID);
-        long handle = mLocalService.addEscrowToken(token.getBytes(), PRIMARY_USER_ID);
+        long handle = mLocalService.addEscrowToken(token.getBytes(), PRIMARY_USER_ID, null);
         assertTrue(mLocalService.isEscrowTokenActive(handle, PRIMARY_USER_ID));
         assertEquals(0, mGateKeeperService.getSecureUserId(PRIMARY_USER_ID));
         assertTrue(hasSyntheticPassword(PRIMARY_USER_ID));
@@ -443,7 +443,7 @@
                 PASSWORD_QUALITY_ALPHABETIC, PRIMARY_USER_ID);
         enableSyntheticPassword();
 
-        long handle = mLocalService.addEscrowToken(token, PRIMARY_USER_ID);
+        long handle = mLocalService.addEscrowToken(token, PRIMARY_USER_ID, null);
         // Token not activated immediately since user password exists
         assertFalse(mLocalService.isEscrowTokenActive(handle, PRIMARY_USER_ID));
         // Activate token (password gets migrated to SP at the same time)
@@ -461,7 +461,7 @@
 
         mHasSecureLockScreen = false;
         enableSyntheticPassword();
-        long handle = mLocalService.addEscrowToken(token, PRIMARY_USER_ID);
+        long handle = mLocalService.addEscrowToken(token, PRIMARY_USER_ID, null);
         assertTrue(mLocalService.isEscrowTokenActive(handle, PRIMARY_USER_ID));
 
         try {
diff --git a/services/tests/servicestests/src/com/android/server/locksettings/recoverablekeystore/RecoverableKeyStoreManagerTest.java b/services/tests/servicestests/src/com/android/server/locksettings/recoverablekeystore/RecoverableKeyStoreManagerTest.java
index c78b96d..5bab65c 100644
--- a/services/tests/servicestests/src/com/android/server/locksettings/recoverablekeystore/RecoverableKeyStoreManagerTest.java
+++ b/services/tests/servicestests/src/com/android/server/locksettings/recoverablekeystore/RecoverableKeyStoreManagerTest.java
@@ -59,6 +59,7 @@
 import androidx.test.runner.AndroidJUnit4;
 
 import com.android.server.locksettings.recoverablekeystore.storage.ApplicationKeyStorage;
+import com.android.server.locksettings.recoverablekeystore.storage.CleanupManager;
 import com.android.server.locksettings.recoverablekeystore.storage.RecoverableKeyStoreDb;
 import com.android.server.locksettings.recoverablekeystore.storage.RecoverySessionStorage;
 import com.android.server.locksettings.recoverablekeystore.storage.RecoverySnapshotStorage;
@@ -154,6 +155,7 @@
     @Mock private KeyguardManager mKeyguardManager;
     @Mock private PlatformKeyManager mPlatformKeyManager;
     @Mock private ApplicationKeyStorage mApplicationKeyStorage;
+    @Mock private CleanupManager mCleanupManager;
     @Spy private TestOnlyInsecureCertificateHelper mTestOnlyInsecureCertificateHelper;
 
     private RecoverableKeyStoreDb mRecoverableKeyStoreDb;
@@ -191,7 +193,8 @@
                 mMockListenersStorage,
                 mPlatformKeyManager,
                 mApplicationKeyStorage,
-                mTestOnlyInsecureCertificateHelper);
+                mTestOnlyInsecureCertificateHelper,
+                mCleanupManager);
     }
 
     @After
diff --git a/services/tests/servicestests/src/com/android/server/locksettings/recoverablekeystore/storage/CleanupManagerTest.java b/services/tests/servicestests/src/com/android/server/locksettings/recoverablekeystore/storage/CleanupManagerTest.java
new file mode 100644
index 0000000..0b15a12
--- /dev/null
+++ b/services/tests/servicestests/src/com/android/server/locksettings/recoverablekeystore/storage/CleanupManagerTest.java
@@ -0,0 +1,116 @@
+/*
+ * Copyright (C) 2019 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 com.android.server.locksettings.recoverablekeystore.storage;
+
+import static org.mockito.ArgumentMatchers.eq;
+import static org.mockito.Mockito.times;
+import static org.mockito.Mockito.verify;
+import static org.mockito.Mockito.when;
+
+import android.content.Context;
+import android.os.UserHandle;
+import android.os.UserManager;
+
+import androidx.test.InstrumentationRegistry;
+import androidx.test.filters.SmallTest;
+import androidx.test.runner.AndroidJUnit4;
+
+import org.junit.Before;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+import org.mockito.Mock;
+import org.mockito.MockitoAnnotations;
+
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+
+@SmallTest
+@RunWith(AndroidJUnit4.class)
+public class CleanupManagerTest {
+    private static final int USER_ID = 10;
+    private static final int USER_ID_2 = 20;
+    private static final int UID = 1234;
+    private static final long USER_SERIAL_NUMBER = 101L;
+    private static final long USER_SERIAL_NUMBER_2 = 202L;
+
+    private Context mContext;
+    private CleanupManager mManager;
+
+    @Mock private RecoverableKeyStoreDb mDatabase;
+    @Mock private RecoverySnapshotStorage mRecoverySnapshotStorage;
+    @Mock private UserManager mUserManager;
+    @Mock private ApplicationKeyStorage mApplicationKeyStorage;
+
+    @Before
+    public void setUp() throws Exception {
+        MockitoAnnotations.initMocks(this);
+        mContext = InstrumentationRegistry.getTargetContext();
+        mManager = new CleanupManager(mContext, mRecoverySnapshotStorage, mDatabase, mUserManager,
+                mApplicationKeyStorage);
+    }
+
+    @Test
+    public void registerRecoveryAgent_unknownUser_storesInDb() throws Exception {
+        when(mDatabase.getUserSerialNumbers()).thenReturn(new HashMap<>());
+        when(mUserManager.getSerialNumberForUser(eq(UserHandle.of(USER_ID))))
+                .thenReturn(USER_SERIAL_NUMBER);
+        when(mUserManager.getSerialNumberForUser(eq(UserHandle.of(USER_ID_2))))
+                .thenReturn(USER_SERIAL_NUMBER_2);
+
+        mManager.registerRecoveryAgent(USER_ID, UID);
+        mManager.registerRecoveryAgent(USER_ID_2, UID);
+
+        verify(mDatabase).setUserSerialNumber(USER_ID, USER_SERIAL_NUMBER);
+        verify(mDatabase).setUserSerialNumber(USER_ID_2, USER_SERIAL_NUMBER_2);
+
+    }
+
+    @Test
+    public void registerRecoveryAgent_registersSameUser_doesntChangeDb() throws Exception {
+        when(mDatabase.getUserSerialNumbers()).thenReturn(new HashMap<>());
+        when(mUserManager.getSerialNumberForUser(eq(UserHandle.of(USER_ID))))
+                .thenReturn(USER_SERIAL_NUMBER);
+
+        mManager.registerRecoveryAgent(USER_ID, UID);
+        mManager.registerRecoveryAgent(USER_ID, UID); // ignored.
+
+        verify(mDatabase, times(1)).setUserSerialNumber(USER_ID, USER_SERIAL_NUMBER);
+    }
+
+    @Test
+    public void verifyKnownUsers_newSerialNumber_deletesData() throws Exception {
+        Map knownSerialNumbers = new HashMap<>();
+        knownSerialNumbers.put(USER_ID, USER_SERIAL_NUMBER);
+        when(mDatabase.getUserSerialNumbers()).thenReturn(knownSerialNumbers);
+        List<Integer> recoveryAgents = new ArrayList<>();
+        recoveryAgents.add(UID);
+        when(mDatabase.getRecoveryAgents(USER_ID)).thenReturn(recoveryAgents);
+
+        when(mUserManager.getSerialNumberForUser(eq(UserHandle.of(USER_ID))))
+                .thenReturn(USER_SERIAL_NUMBER_2); // new value
+
+
+        mManager.verifyKnownUsers();
+
+        verify(mDatabase).removeUserFromAllTables(USER_ID);
+        verify(mDatabase).setUserSerialNumber(USER_ID, USER_SERIAL_NUMBER_2);
+        verify(mRecoverySnapshotStorage).remove(UID);
+    }
+}
+
diff --git a/services/tests/servicestests/src/com/android/server/locksettings/recoverablekeystore/storage/RecoverableKeyStoreDbHelperTest.java b/services/tests/servicestests/src/com/android/server/locksettings/recoverablekeystore/storage/RecoverableKeyStoreDbHelperTest.java
index 35215c3..2658af6 100644
--- a/services/tests/servicestests/src/com/android/server/locksettings/recoverablekeystore/storage/RecoverableKeyStoreDbHelperTest.java
+++ b/services/tests/servicestests/src/com/android/server/locksettings/recoverablekeystore/storage/RecoverableKeyStoreDbHelperTest.java
@@ -51,6 +51,7 @@
     private static final long TEST_LAST_SYNCED_AT = 1517990732000L;
     private static final int TEST_RECOVERY_STATUS = 3;
     private static final int TEST_PLATFORM_KEY_GENERATION_ID = 11;
+    private static final int TEST_USER_SERIAL_NUMBER = 15;
     private static final int TEST_SNAPSHOT_VERSION = 31;
     private static final int TEST_SHOULD_CREATE_SNAPSHOT = 1;
     private static final byte[] TEST_PUBLIC_KEY = "test-public-key".getBytes(UTF_8);
@@ -234,5 +235,14 @@
 
         assertThat(mDatabase.replace(KeysEntry.TABLE_NAME, /*nullColumnHack=*/ null, values))
                 .isGreaterThan(-1L);
+
+        // User serial number column was added when upgrading from v5 to v6
+        values = new ContentValues();
+        values.put(UserMetadataEntry.COLUMN_NAME_USER_ID, TEST_USER_ID);
+        values.put(UserMetadataEntry.COLUMN_NAME_USER_SERIAL_NUMBER, TEST_USER_SERIAL_NUMBER);
+        assertThat(
+                mDatabase.replace(UserMetadataEntry.TABLE_NAME, /*nullColumnHack=*/ null, values))
+                .isGreaterThan(-1L);
     }
+
 }
diff --git a/services/tests/servicestests/src/com/android/server/locksettings/recoverablekeystore/storage/RecoverableKeyStoreDbTest.java b/services/tests/servicestests/src/com/android/server/locksettings/recoverablekeystore/storage/RecoverableKeyStoreDbTest.java
index 7de9ffc..932a769 100644
--- a/services/tests/servicestests/src/com/android/server/locksettings/recoverablekeystore/storage/RecoverableKeyStoreDbTest.java
+++ b/services/tests/servicestests/src/com/android/server/locksettings/recoverablekeystore/storage/RecoverableKeyStoreDbTest.java
@@ -279,6 +279,55 @@
     }
 
     @Test
+    public void getUserSerialNumbers_returnsSerialNumbers() {
+        int userId = 42;
+        int userId2 = 44;
+        Long serialNumber = 24L;
+        Long serialNumber2 = 25L;
+        mRecoverableKeyStoreDb.setUserSerialNumber(userId, serialNumber);
+        mRecoverableKeyStoreDb.setUserSerialNumber(userId2, serialNumber2);
+
+        assertEquals(2, mRecoverableKeyStoreDb.getUserSerialNumbers().size());
+        assertEquals(serialNumber, mRecoverableKeyStoreDb.getUserSerialNumbers().get(userId));
+        assertEquals(serialNumber2, mRecoverableKeyStoreDb.getUserSerialNumbers().get(userId2));
+    }
+
+    @Test
+    public void getUserSerialNumbers_returnsMinusOneIfNoEntry() {
+        int userId = 42;
+        int generationId = 24;
+        Long serialNumber = -1L;
+        // Don't set serial number
+        mRecoverableKeyStoreDb.setPlatformKeyGenerationId(userId, generationId);
+
+        assertEquals(1, mRecoverableKeyStoreDb.getUserSerialNumbers().size());
+        assertEquals(serialNumber, mRecoverableKeyStoreDb.getUserSerialNumbers().get(userId));
+    }
+
+    @Test
+    public void removeUserFromAllTables_removesData() throws Exception {
+        int userId = 12;
+        int generationId = 24;
+        int[] types = new int[]{1};
+        int uid = 10009;
+        mRecoverableKeyStoreDb.setRecoveryServiceCertSerial(userId, uid,
+                TEST_ROOT_CERT_ALIAS, 1234L);
+        mRecoverableKeyStoreDb.setPlatformKeyGenerationId(userId, generationId);
+        mRecoverableKeyStoreDb.setActiveRootOfTrust(userId, uid, "root");
+        mRecoverableKeyStoreDb.setRecoverySecretTypes(userId, uid, types);
+
+        mRecoverableKeyStoreDb.removeUserFromAllTables(userId);
+
+        // RootOfTrust
+        assertThat(mRecoverableKeyStoreDb.getRecoveryServiceCertSerial(userId, uid,
+                TEST_ROOT_CERT_ALIAS)).isNull();
+        // UserMetadata
+        assertThat(mRecoverableKeyStoreDb.getPlatformKeyGenerationId(userId)).isEqualTo(-1);
+        // RecoveryServiceMetadata
+        assertThat(mRecoverableKeyStoreDb.getRecoverySecretTypes(userId, uid)).isEmpty();
+    }
+
+    @Test
     public void setRecoveryStatus_withSingleKey() {
         int userId = 12;
         int uid = 1009;
diff --git a/services/tests/servicestests/src/com/android/server/pm/PackageParserTest.java b/services/tests/servicestests/src/com/android/server/pm/PackageParserTest.java
index 72357ce..3c3721c 100644
--- a/services/tests/servicestests/src/com/android/server/pm/PackageParserTest.java
+++ b/services/tests/servicestests/src/com/android/server/pm/PackageParserTest.java
@@ -15,6 +15,8 @@
  */
 package com.android.server.pm;
 
+import static android.content.res.Resources.ID_NULL;
+
 import static org.junit.Assert.assertEquals;
 import static org.junit.Assert.assertNotNull;
 import static org.junit.Assert.assertSame;
@@ -453,8 +455,8 @@
         pkg.splitPrivateFlags = new int[] { 100 };
         pkg.applicationInfo = new ApplicationInfo();
 
-        pkg.permissions.add(new PackageParser.Permission(pkg));
-        pkg.permissionGroups.add(new PackageParser.PermissionGroup(pkg));
+        pkg.permissions.add(new PackageParser.Permission(pkg, (String) null));
+        pkg.permissionGroups.add(new PackageParser.PermissionGroup(pkg, ID_NULL, ID_NULL, ID_NULL));
 
         final PackageParser.ParseComponentArgs dummy = new PackageParser.ParseComponentArgs(
                 pkg, new String[1], 0, 0, 0, 0, 0, 0, null, 0, 0, 0);
diff --git a/services/tests/servicestests/src/com/android/server/pm/dex/DexoptUtilsTest.java b/services/tests/servicestests/src/com/android/server/pm/dex/DexoptUtilsTest.java
index d9faaa4..3a55c22 100644
--- a/services/tests/servicestests/src/com/android/server/pm/dex/DexoptUtilsTest.java
+++ b/services/tests/servicestests/src/com/android/server/pm/dex/DexoptUtilsTest.java
@@ -333,6 +333,20 @@
     }
 
     @Test
+    public void testSharedLibraryContext() {
+        SharedLibraryInfo sharedLibrary =
+                createMockSharedLibrary(new String[] {"a.dex", "b.dex"}).get(0);
+        String context = DexoptUtils.getClassLoaderContext(sharedLibrary);
+        assertEquals("PCL[]", context);
+
+        SharedLibraryInfo otherSharedLibrary =
+                createMockSharedLibrary(new String[] {"c.dex"}).get(0);
+        otherSharedLibrary.addDependency(sharedLibrary);
+        context = DexoptUtils.getClassLoaderContext(otherSharedLibrary);
+        assertEquals("PCL[]{PCL[a.dex:b.dex]}", context);
+    }
+
+    @Test
     public void testProcessContextForDexLoad() {
         List<String> classLoaders = Arrays.asList(
                 DELEGATE_LAST_CLASS_LOADER_NAME,
diff --git a/services/tests/servicestests/src/com/android/server/power/AttentionDetectorTest.java b/services/tests/servicestests/src/com/android/server/power/AttentionDetectorTest.java
index 6a937fa..a2f1f01 100644
--- a/services/tests/servicestests/src/com/android/server/power/AttentionDetectorTest.java
+++ b/services/tests/servicestests/src/com/android/server/power/AttentionDetectorTest.java
@@ -32,10 +32,13 @@
 import android.os.PowerManager;
 import android.os.PowerManagerInternal;
 import android.os.SystemClock;
+import android.os.UserHandle;
+import android.provider.Settings;
 import android.service.attention.AttentionService;
 import android.test.AndroidTestCase;
 import android.test.suitebuilder.annotation.SmallTest;
 
+import org.junit.After;
 import org.junit.Before;
 import org.junit.Test;
 import org.mockito.Mock;
@@ -49,6 +52,7 @@
     private TestableAttentionDetector mAttentionDetector;
     private long mAttentionTimeout;
     private long mNextDimming;
+    private int mIsSettingEnabled;
 
     @Before
     public void setUp() {
@@ -59,6 +63,20 @@
         mAttentionDetector.onWakefulnessChangeStarted(PowerManagerInternal.WAKEFULNESS_AWAKE);
         mAttentionDetector.setAttentionServiceSupported(true);
         mNextDimming = SystemClock.uptimeMillis() + 3000L;
+
+        // Save the existing state.
+        mIsSettingEnabled = Settings.System.getIntForUser(getContext().getContentResolver(),
+                Settings.System.ADAPTIVE_SLEEP, 0, UserHandle.USER_CURRENT);
+
+        Settings.System.putIntForUser(getContext().getContentResolver(),
+                Settings.System.ADAPTIVE_SLEEP, 1, UserHandle.USER_CURRENT);
+        mAttentionDetector.updateEnabledFromSettings(getContext());
+    }
+
+    @After
+    public void tearDown() {
+        Settings.System.putIntForUser(getContext().getContentResolver(),
+                Settings.System.ADAPTIVE_SLEEP, mIsSettingEnabled, UserHandle.USER_CURRENT);
     }
 
     @Test
@@ -69,6 +87,16 @@
     }
 
     @Test
+    public void testOnUserActivity_doesntCheckIfNotEnabled() {
+        Settings.System.putIntForUser(getContext().getContentResolver(),
+                Settings.System.ADAPTIVE_SLEEP, 0, UserHandle.USER_CURRENT);
+        mAttentionDetector.updateEnabledFromSettings(getContext());
+        long when = registerAttention();
+        verify(mAttentionManagerInternal, never()).checkAttention(anyInt(), anyLong(), any());
+        assertThat(mNextDimming).isEqualTo(when);
+    }
+
+    @Test
     public void testOnUserActivity_doesntCheckIfNotSupported() {
         mAttentionDetector.setAttentionServiceSupported(false);
         long when = registerAttention();
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 911c4a2..1bda412 100644
--- a/services/tests/servicestests/src/com/android/server/power/PowerManagerServiceTest.java
+++ b/services/tests/servicestests/src/com/android/server/power/PowerManagerServiceTest.java
@@ -18,44 +18,67 @@
 
 import static android.os.PowerManagerInternal.WAKEFULNESS_ASLEEP;
 import static android.os.PowerManagerInternal.WAKEFULNESS_AWAKE;
+import static android.os.PowerManagerInternal.WAKEFULNESS_DOZING;
+import static android.os.PowerManagerInternal.WAKEFULNESS_DREAMING;
 
 import static com.google.common.truth.Truth.assertThat;
 
 import static org.mockito.ArgumentMatchers.any;
 import static org.mockito.ArgumentMatchers.anyInt;
 import static org.mockito.ArgumentMatchers.anyString;
+import static org.mockito.ArgumentMatchers.argThat;
 import static org.mockito.ArgumentMatchers.eq;
+import static org.mockito.ArgumentMatchers.isA;
+import static org.mockito.ArgumentMatchers.isNull;
 import static org.mockito.Mockito.doAnswer;
 import static org.mockito.Mockito.mock;
+import static org.mockito.Mockito.spy;
+import static org.mockito.Mockito.verify;
 import static org.mockito.Mockito.when;
 
 import android.app.ActivityManagerInternal;
 import android.attention.AttentionManagerInternal;
 import android.content.Context;
+import android.content.ContextWrapper;
+import android.content.Intent;
+import android.content.IntentFilter;
+import android.content.res.Resources;
+import android.hardware.SensorManager;
+import android.hardware.display.AmbientDisplayConfiguration;
 import android.hardware.display.DisplayManagerInternal;
 import android.hardware.display.DisplayManagerInternal.DisplayPowerRequest;
+import android.os.BatteryManager;
 import android.os.BatteryManagerInternal;
 import android.os.Binder;
+import android.os.Handler;
+import android.os.IBinder;
 import android.os.Looper;
 import android.os.PowerManager;
 import android.os.PowerSaveState;
 import android.os.SystemClock;
 import android.os.SystemProperties;
-import android.test.AndroidTestCase;
-import android.test.suitebuilder.annotation.MediumTest;
-import android.test.suitebuilder.annotation.SmallTest;
+import android.os.UserHandle;
+import android.provider.Settings;
+
+import androidx.test.InstrumentationRegistry;
 
 import com.android.internal.app.IBatteryStats;
 import com.android.server.LocalServices;
 import com.android.server.SystemService;
 import com.android.server.lights.LightsManager;
 import com.android.server.policy.WindowManagerPolicy;
+import com.android.server.power.PowerManagerService.BatteryReceiver;
 import com.android.server.power.PowerManagerService.Injector;
 import com.android.server.power.PowerManagerService.NativeWrapper;
+import com.android.server.power.PowerManagerService.UserSwitchedReceiver;
 import com.android.server.power.batterysaver.BatterySaverPolicy;
 import com.android.server.power.batterysaver.BatterySavingStats;
 
-import org.junit.Rule;
+import org.junit.After;
+import org.junit.Before;
+import org.junit.Test;
+import org.mockito.ArgumentCaptor;
+import org.mockito.ArgumentMatcher;
 import org.mockito.Mock;
 import org.mockito.MockitoAnnotations;
 
@@ -65,29 +88,54 @@
 /**
  * Tests for {@link com.android.server.power.PowerManagerService}
  */
-public class PowerManagerServiceTest extends AndroidTestCase {
+public class PowerManagerServiceTest {
     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 TEST_LAST_REBOOT_PROPERTY = "test.sys.boot.reason";
 
-    private @Mock BatterySaverPolicy mBatterySaverPolicyMock;
-    private @Mock LightsManager mLightsManagerMock;
-    private @Mock DisplayManagerInternal mDisplayManagerInternalMock;
-    private @Mock BatteryManagerInternal mBatteryManagerInternalMock;
-    private @Mock ActivityManagerInternal mActivityManagerInternalMock;
-    private @Mock AttentionManagerInternal mAttentionManagerInternalMock;
-    private @Mock PowerManagerService.NativeWrapper mNativeWrapperMock;
-    private @Mock Notifier mNotifierMock;
+    @Mock private BatterySaverPolicy mBatterySaverPolicyMock;
+    @Mock private LightsManager mLightsManagerMock;
+    @Mock private DisplayManagerInternal mDisplayManagerInternalMock;
+    @Mock private BatteryManagerInternal mBatteryManagerInternalMock;
+    @Mock private ActivityManagerInternal mActivityManagerInternalMock;
+    @Mock private AttentionManagerInternal mAttentionManagerInternalMock;
+    @Mock private PowerManagerService.NativeWrapper mNativeWrapperMock;
+    @Mock private Notifier mNotifierMock;
+    @Mock private WirelessChargerDetector mWirelessChargerDetectorMock;
+    @Mock private AmbientDisplayConfiguration mAmbientDisplayConfigurationMock;
+
     private PowerManagerService mService;
     private PowerSaveState mPowerSaveState;
     private DisplayPowerRequest mDisplayPowerRequest;
+    private ContextWrapper mContextSpy;
+    private BatteryReceiver mBatteryReceiver;
+    private UserSwitchedReceiver mUserSwitchedReceiver;
+    private Resources mResourcesSpy;
 
+    private class IntentFilterMatcher implements ArgumentMatcher<IntentFilter> {
+        private final IntentFilter mFilter;
 
+        IntentFilterMatcher(IntentFilter filter) {
+            mFilter = filter;
+        }
 
-    @Rule
+        @Override
+        public boolean matches(IntentFilter other) {
+            if (other.countActions() != mFilter.countActions()) {
+                return false;
+            }
+            for (int i = 0; i < mFilter.countActions(); i++) {
+                if (!mFilter.getAction(i).equals(other.getAction(i))) {
+                    return false;
+                }
+            }
+            return true;
+        }
+    }
+
+    @Before
     public void setUp() throws Exception {
-        super.setUp();
         MockitoAnnotations.initMocks(this);
 
         mPowerSaveState = new PowerSaveState.Builder()
@@ -105,33 +153,54 @@
         addLocalServiceMock(ActivityManagerInternal.class, mActivityManagerInternalMock);
         addLocalServiceMock(AttentionManagerInternal.class, mAttentionManagerInternalMock);
 
-        mService = new PowerManagerService(getContext(), new Injector() {
+        mContextSpy = spy(new ContextWrapper(InstrumentationRegistry.getContext()));
+        mResourcesSpy = spy(mContextSpy.getResources());
+        when(mContextSpy.getResources()).thenReturn(mResourcesSpy);
+
+        mService = new PowerManagerService(mContextSpy, new Injector() {
+            @Override
             Notifier createNotifier(Looper looper, Context context, IBatteryStats batteryStats,
                     SuspendBlocker suspendBlocker, WindowManagerPolicy policy) {
                 return mNotifierMock;
             }
 
+            @Override
             SuspendBlocker createSuspendBlocker(PowerManagerService service, String name) {
                 return mock(SuspendBlocker.class);
             }
 
+            @Override
             BatterySaverPolicy createBatterySaverPolicy(
                     Object lock, Context context, BatterySavingStats batterySavingStats) {
                 return mBatterySaverPolicyMock;
             }
 
+            @Override
             NativeWrapper createNativeWrapper() {
                 return mNativeWrapperMock;
             }
+
+            @Override
+            WirelessChargerDetector createWirelessChargerDetector(
+                    SensorManager sensorManager, SuspendBlocker suspendBlocker, Handler handler) {
+                return mWirelessChargerDetectorMock;
+            }
+
+            @Override
+            AmbientDisplayConfiguration createAmbientDisplayConfiguration(Context context) {
+                return mAmbientDisplayConfigurationMock;
+            }
         });
     }
 
-    @Override
+    @After
     public void tearDown() throws Exception {
         LocalServices.removeServiceForTest(LightsManager.class);
         LocalServices.removeServiceForTest(DisplayManagerInternal.class);
         LocalServices.removeServiceForTest(BatteryManagerInternal.class);
         LocalServices.removeServiceForTest(ActivityManagerInternal.class);
+        Settings.Global.putInt(
+                mContextSpy.getContentResolver(), Settings.Global.THEATER_MODE_ON, 0);
     }
 
     /**
@@ -142,7 +211,56 @@
         LocalServices.addService(clazz, mock);
     }
 
-    @SmallTest
+    private void startSystem() throws Exception {
+        mService.systemReady(null);
+
+        // Grab the BatteryReceiver
+        ArgumentCaptor<BatteryReceiver> batCaptor = ArgumentCaptor.forClass(BatteryReceiver.class);
+        IntentFilter batFilter = new IntentFilter(Intent.ACTION_BATTERY_CHANGED);
+        batFilter.setPriority(IntentFilter.SYSTEM_HIGH_PRIORITY);
+        verify(mContextSpy).registerReceiver(batCaptor.capture(),
+                argThat(new IntentFilterMatcher(batFilter)), isNull(), isA(Handler.class));
+        mBatteryReceiver = batCaptor.getValue();
+
+        // Grab the UserSwitchedReceiver
+        ArgumentCaptor<UserSwitchedReceiver> userSwitchedCaptor =
+                ArgumentCaptor.forClass(UserSwitchedReceiver.class);
+        IntentFilter usFilter = new IntentFilter(Intent.ACTION_USER_SWITCHED);
+        verify(mContextSpy).registerReceiver(userSwitchedCaptor.capture(),
+                argThat(new IntentFilterMatcher(usFilter)), isNull(), isA(Handler.class));
+        mUserSwitchedReceiver = userSwitchedCaptor.getValue();
+
+        mService.onBootPhase(SystemService.PHASE_BOOT_COMPLETED);
+    }
+
+    private void forceSleep() {
+        mService.getBinderServiceInstance().goToSleep(SystemClock.uptimeMillis(),
+                PowerManager.GO_TO_SLEEP_REASON_APPLICATION, PowerManager.GO_TO_SLEEP_FLAG_NO_DOZE);
+    }
+
+    private void forceDream() {
+        mService.getBinderServiceInstance().nap(SystemClock.uptimeMillis());
+    }
+
+    private void forceAwake() {
+        mService.getBinderServiceInstance().wakeUp(SystemClock.uptimeMillis(),
+                PowerManager.WAKE_REASON_UNKNOWN, "testing IPowerManager.wakeUp()", "pkg.name");
+    }
+
+    private void forceDozing() {
+        mService.getBinderServiceInstance().goToSleep(SystemClock.uptimeMillis(),
+                PowerManager.GO_TO_SLEEP_REASON_APPLICATION, 0);
+    }
+
+    private void setPluggedIn(boolean isPluggedIn) {
+        // Set the callback to return the new state
+        when(mBatteryManagerInternalMock.isPowered(BatteryManager.BATTERY_PLUGGED_ANY))
+                .thenReturn(isPluggedIn);
+        // Trigger PowerManager to reread the plug-in state
+        mBatteryReceiver.onReceive(mContextSpy, new Intent(Intent.ACTION_BATTERY_CHANGED));
+    }
+
+    @Test
     public void testUpdatePowerScreenPolicy_UpdateDisplayPowerRequest() {
         mService.updatePowerRequestFromBatterySaverPolicy(mDisplayPowerRequest);
         assertThat(mDisplayPowerRequest.lowPowerMode).isEqualTo(BATTERY_SAVER_ENABLED);
@@ -150,7 +268,7 @@
                 .isWithin(PRECISION).of(BRIGHTNESS_FACTOR);
     }
 
-    @SmallTest
+    @Test
     public void testGetLastShutdownReasonInternal() {
         SystemProperties.set(TEST_LAST_REBOOT_PROPERTY, "shutdown,thermal");
         int reason = mService.getLastShutdownReasonInternal(TEST_LAST_REBOOT_PROPERTY);
@@ -158,7 +276,7 @@
         assertThat(reason).isEqualTo(PowerManager.SHUTDOWN_REASON_THERMAL_SHUTDOWN);
     }
 
-    @SmallTest
+    @Test
     public void testGetDesiredScreenPolicy_WithVR() throws Exception {
         // Brighten up the screen
         mService.setWakefulnessLocked(WAKEFULNESS_AWAKE, PowerManager.WAKE_REASON_UNKNOWN, 0);
@@ -187,42 +305,171 @@
                 DisplayPowerRequest.POLICY_BRIGHT);
     }
 
-    @SmallTest
+    @Test
     public void testWakefulnessAwake_InitialValue() throws Exception {
         assertThat(mService.getWakefulness()).isEqualTo(WAKEFULNESS_AWAKE);
     }
 
-    @SmallTest
+    @Test
     public void testWakefulnessSleep_NoDozeSleepFlag() throws Exception {
         // Start with AWAKE state
+        startSystem();
         assertThat(mService.getWakefulness()).isEqualTo(WAKEFULNESS_AWAKE);
 
-        mService.systemReady(null);
-        mService.onBootPhase(SystemService.PHASE_BOOT_COMPLETED);
-
-        // Take a nap with a flag.
+        // Take a nap and verify.
         mService.getBinderServiceInstance().goToSleep(SystemClock.uptimeMillis(),
-            PowerManager.GO_TO_SLEEP_REASON_APPLICATION, PowerManager.GO_TO_SLEEP_FLAG_NO_DOZE);
-
+                PowerManager.GO_TO_SLEEP_REASON_APPLICATION, PowerManager.GO_TO_SLEEP_FLAG_NO_DOZE);
         assertThat(mService.getWakefulness()).isEqualTo(WAKEFULNESS_ASLEEP);
     }
 
-    @MediumTest
+    @Test
+    public void testWakefulnessAwake_AcquireCausesWakeup() throws Exception {
+        startSystem();
+        forceSleep();
+
+        IBinder token = new Binder();
+        String tag = "acq_causes_wakeup";
+        String packageName = "pkg.name";
+
+        // First, ensure that a normal full wake lock does not cause a wakeup
+        int flags = PowerManager.FULL_WAKE_LOCK;
+        mService.getBinderServiceInstance().acquireWakeLock(token, flags, tag, packageName,
+                null /* workSource */, null /* historyTag */);
+        assertThat(mService.getWakefulness()).isEqualTo(WAKEFULNESS_ASLEEP);
+        mService.getBinderServiceInstance().releaseWakeLock(token, 0 /* flags */);
+
+        // Ensure that the flag does *NOT* work with a partial wake lock.
+        flags = PowerManager.PARTIAL_WAKE_LOCK | PowerManager.ACQUIRE_CAUSES_WAKEUP;
+        mService.getBinderServiceInstance().acquireWakeLock(token, flags, tag, packageName,
+                null /* workSource */, null /* historyTag */);
+        assertThat(mService.getWakefulness()).isEqualTo(WAKEFULNESS_ASLEEP);
+        mService.getBinderServiceInstance().releaseWakeLock(token, 0 /* flags */);
+
+        // Verify that flag forces a wakeup when paired to a FULL_WAKE_LOCK
+        flags = PowerManager.FULL_WAKE_LOCK | PowerManager.ACQUIRE_CAUSES_WAKEUP;
+        mService.getBinderServiceInstance().acquireWakeLock(token, flags, tag, packageName,
+                null /* workSource */, null /* historyTag */);
+        assertThat(mService.getWakefulness()).isEqualTo(WAKEFULNESS_AWAKE);
+        mService.getBinderServiceInstance().releaseWakeLock(token, 0 /* flags */);
+    }
+
+    @Test
+    public void testWakefulnessAwake_IPowerManagerWakeUp() throws Exception {
+        startSystem();
+        forceSleep();
+        mService.getBinderServiceInstance().wakeUp(SystemClock.uptimeMillis(),
+                PowerManager.WAKE_REASON_UNKNOWN, "testing IPowerManager.wakeUp()", "pkg.name");
+        assertThat(mService.getWakefulness()).isEqualTo(WAKEFULNESS_AWAKE);
+    }
+
+    /**
+     * Tests a series of variants that control whether a device wakes-up when it is plugged in
+     * or docked.
+     */
+    @Test
+    public void testWakefulnessAwake_ShouldWakeUpWhenPluggedIn() throws Exception {
+        boolean powerState;
+        startSystem();
+        forceSleep();
+
+        // Test 1:
+        // Set config to prevent it wake up, test, verify, reset config value.
+        when(mResourcesSpy.getBoolean(com.android.internal.R.bool.config_unplugTurnsOnScreen))
+                .thenReturn(false);
+        mService.readConfigurationLocked();
+        setPluggedIn(true);
+        assertThat(mService.getWakefulness()).isEqualTo(WAKEFULNESS_ASLEEP);
+        when(mResourcesSpy.getBoolean(com.android.internal.R.bool.config_unplugTurnsOnScreen))
+                .thenReturn(true);
+        mService.readConfigurationLocked();
+
+        // Test 2:
+        // Turn the power off, sleep, then plug into a wireless charger.
+        // Verify that we do not wake up if the phone is being plugged into a wireless charger.
+        setPluggedIn(false);
+        forceSleep();
+        when(mBatteryManagerInternalMock.getPlugType())
+                .thenReturn(BatteryManager.BATTERY_PLUGGED_WIRELESS);
+        when(mWirelessChargerDetectorMock.update(true /* isPowered */,
+                BatteryManager.BATTERY_PLUGGED_WIRELESS)).thenReturn(false);
+        setPluggedIn(true);
+        assertThat(mService.getWakefulness()).isEqualTo(WAKEFULNESS_ASLEEP);
+
+        // Test 3:
+        // Do not wake up if the phone is being REMOVED from a wireless charger
+        when(mBatteryManagerInternalMock.getPlugType()).thenReturn(0);
+        setPluggedIn(false);
+        assertThat(mService.getWakefulness()).isEqualTo(WAKEFULNESS_ASLEEP);
+
+        // Test 4:
+        // Do not wake if we are dreaming.
+        forceAwake();  // Needs to be awake first before it can dream.
+        forceDream();
+        setPluggedIn(true);
+        assertThat(mService.getWakefulness()).isEqualTo(WAKEFULNESS_DREAMING);
+        forceSleep();
+
+        // Test 5:
+        // Don't wake if the device is configured not to wake up in theater mode (and theater
+        // mode is enabled).
+        Settings.Global.putInt(
+                mContextSpy.getContentResolver(), Settings.Global.THEATER_MODE_ON, 1);
+        mUserSwitchedReceiver.onReceive(mContextSpy, new Intent(Intent.ACTION_USER_SWITCHED));
+        when(mResourcesSpy.getBoolean(
+                com.android.internal.R.bool.config_allowTheaterModeWakeFromUnplug))
+                .thenReturn(false);
+        setPluggedIn(false);
+        assertThat(mService.getWakefulness()).isEqualTo(WAKEFULNESS_ASLEEP);
+        Settings.Global.putInt(
+                mContextSpy.getContentResolver(), Settings.Global.THEATER_MODE_ON, 0);
+        mUserSwitchedReceiver.onReceive(mContextSpy, new Intent(Intent.ACTION_USER_SWITCHED));
+
+        // Test 6:
+        // Don't wake up if we are Dozing away and always-on is enabled.
+        when(mAmbientDisplayConfigurationMock.alwaysOnEnabled(UserHandle.USER_CURRENT))
+                .thenReturn(true);
+        mUserSwitchedReceiver.onReceive(mContextSpy, new Intent(Intent.ACTION_USER_SWITCHED));
+        forceAwake();
+        forceDozing();
+        setPluggedIn(true);
+        assertThat(mService.getWakefulness()).isEqualTo(WAKEFULNESS_DOZING);
+
+        // Test 7:
+        // Finally, take away all the factors above and ensure the device wakes up!
+        forceAwake();
+        forceSleep();
+        setPluggedIn(false);
+        assertThat(mService.getWakefulness()).isEqualTo(WAKEFULNESS_AWAKE);
+    }
+
+    @Test
+    public void testWakefulnessDoze_goToSleep() throws Exception {
+        // Start with AWAKE state
+        startSystem();
+        assertThat(mService.getWakefulness()).isEqualTo(WAKEFULNESS_AWAKE);
+
+        // Take a nap and verify.
+        mService.getBinderServiceInstance().goToSleep(SystemClock.uptimeMillis(),
+                PowerManager.GO_TO_SLEEP_REASON_APPLICATION, 0);
+        assertThat(mService.getWakefulness()).isEqualTo(WAKEFULNESS_DOZING);
+    }
+
+    @Test
     public void testWasDeviceIdleFor_true() {
         int interval = 1000;
         mService.onUserActivity();
-        SystemClock.sleep(interval);
+        SystemClock.sleep(interval + 1 /* just a little more */);
         assertThat(mService.wasDeviceIdleForInternal(interval)).isTrue();
     }
 
-    @SmallTest
+    @Test
     public void testWasDeviceIdleFor_false() {
         int interval = 1000;
         mService.onUserActivity();
         assertThat(mService.wasDeviceIdleForInternal(interval)).isFalse();
     }
 
-    @SmallTest
+    @Test
     public void testForceSuspend_putsDeviceToSleep() {
         mService.systemReady(null);
         mService.onBootPhase(SystemService.PHASE_BOOT_COMPLETED);
@@ -244,11 +491,11 @@
         assertThat(mService.getWakefulness()).isEqualTo(WAKEFULNESS_ASLEEP);
     }
 
-    @SmallTest
+    @Test
     public void testForceSuspend_pakeLocksDisabled() {
         final String tag = "TestWakelockTag_098213";
         final int flags = PowerManager.PARTIAL_WAKE_LOCK;
-        final String pkg = getContext().getOpPackageName();
+        final String pkg = mContextSpy.getOpPackageName();
 
         // Set up the Notification mock to keep track of the wakelocks that are currently
         // active or disabled. We'll use this to verify that wakelocks are disabled when
@@ -292,7 +539,7 @@
 
     }
 
-    @SmallTest
+    @Test
     public void testForceSuspend_forceSuspendFailurePropogated() {
         when(mNativeWrapperMock.nativeForceSuspend()).thenReturn(false);
         assertThat(mService.getBinderServiceInstance().forceSuspend()).isFalse();
diff --git a/services/tests/servicestests/src/com/android/server/power/batterysaver/BatterySaverPolicyTest.java b/services/tests/servicestests/src/com/android/server/power/batterysaver/BatterySaverPolicyTest.java
index 5c0a1c8..98cfc41 100644
--- a/services/tests/servicestests/src/com/android/server/power/batterysaver/BatterySaverPolicyTest.java
+++ b/services/tests/servicestests/src/com/android/server/power/batterysaver/BatterySaverPolicyTest.java
@@ -58,6 +58,7 @@
             + "fullbackup_deferred=true,"
             + "keyvaluebackup_deferred=false,"
             + "gps_mode=0," // LOCATION_MODE_NO_CHANGE
+            + "enable_night_mode=false,"
             + "quick_doze_enabled=true";
     private static final String BATTERY_SAVER_INCORRECT_CONSTANTS = "vi*,!=,,true";
 
@@ -234,6 +235,10 @@
         final PowerSaveState quickDozeState = mBatterySaverPolicy.getBatterySaverPolicy(
                 ServiceType.QUICK_DOZE);
         assertThat(quickDozeState.batterySaverEnabled).isTrue();
+
+        final PowerSaveState nightModeState = mBatterySaverPolicy.getBatterySaverPolicy(
+                ServiceType.NIGHT_MODE);
+        assertThat(nightModeState.batterySaverEnabled).isFalse();
     }
 
     @SmallTest
diff --git a/services/tests/servicestests/src/com/android/server/rollback/AppDataRollbackHelperTest.java b/services/tests/servicestests/src/com/android/server/rollback/AppDataRollbackHelperTest.java
index d848b2d..7986055 100644
--- a/services/tests/servicestests/src/com/android/server/rollback/AppDataRollbackHelperTest.java
+++ b/services/tests/servicestests/src/com/android/server/rollback/AppDataRollbackHelperTest.java
@@ -31,7 +31,6 @@
 import android.content.pm.VersionedPackage;
 import android.content.rollback.PackageRollbackInfo;
 import android.content.rollback.PackageRollbackInfo.RestoreInfo;
-import android.content.rollback.RollbackInfo;
 import android.util.IntArray;
 import android.util.SparseLongArray;
 
@@ -46,8 +45,7 @@
 import java.io.File;
 import java.util.ArrayList;
 import java.util.Arrays;
-import java.util.Collections;
-import java.util.List;
+import java.util.Set;
 
 @RunWith(JUnit4.class)
 public class AppDataRollbackHelperTest {
@@ -236,24 +234,24 @@
         wasRecentlyRestored.getPendingRestores().add(
                 new RestoreInfo(73 /* userId */, 239 /* appId*/, "seInfo"));
 
-        RollbackData dataWithPendingBackup = new RollbackData(101, new File("/does/not/exist"), -1,
-                true);
-        dataWithPendingBackup.packages.add(pendingBackup);
+        RollbackData dataWithPendingBackup = new RollbackData(101, new File("/does/not/exist"), -1);
+        dataWithPendingBackup.info.getPackages().add(pendingBackup);
 
         RollbackData dataWithRecentRestore = new RollbackData(17239, new File("/does/not/exist"),
-                -1, true);
-        dataWithRecentRestore.packages.add(wasRecentlyRestored);
+                -1);
+        dataWithRecentRestore.info.getPackages().add(wasRecentlyRestored);
 
         RollbackData dataForDifferentUser = new RollbackData(17239, new File("/does/not/exist"),
-                -1, true);
-        dataForDifferentUser.packages.add(ignoredInfo);
+                -1);
+        dataForDifferentUser.info.getPackages().add(ignoredInfo);
 
-        RollbackInfo rollbackInfo = new RollbackInfo(17239,
-                Arrays.asList(pendingRestore, wasRecentlyRestored), false);
+        RollbackData dataForRestore = new RollbackData(17239, new File("/does/not/exist"), -1);
+        dataForRestore.info.getPackages().add(pendingRestore);
+        dataForRestore.info.getPackages().add(wasRecentlyRestored);
 
-        List<RollbackData> changed = helper.commitPendingBackupAndRestoreForUser(37,
-                Arrays.asList(dataWithPendingBackup, dataWithRecentRestore, dataForDifferentUser),
-                Collections.singletonList(rollbackInfo));
+        Set<RollbackData> changed = helper.commitPendingBackupAndRestoreForUser(37,
+                Arrays.asList(dataWithPendingBackup, dataWithRecentRestore, dataForDifferentUser,
+                    dataForRestore));
         InOrder inOrder = Mockito.inOrder(installer);
 
         // Check that pending backup and restore for the same package mutually destroyed each other.
@@ -267,9 +265,10 @@
         assertEquals(53, pendingBackup.getCeSnapshotInodes().get(37));
 
         // Check that changed returns correct RollbackData.
-        assertEquals(2, changed.size());
-        assertEquals(dataWithPendingBackup, changed.get(0));
-        assertEquals(dataWithRecentRestore, changed.get(1));
+        assertEquals(3, changed.size());
+        assertTrue(changed.contains(dataWithPendingBackup));
+        assertTrue(changed.contains(dataWithRecentRestore));
+        assertTrue(changed.contains(dataForRestore));
 
         // Check that restore was performed.
         inOrder.verify(installer).restoreAppDataSnapshot(
diff --git a/services/tests/servicestests/src/com/android/server/usage/AppStandbyControllerTests.java b/services/tests/servicestests/src/com/android/server/usage/AppStandbyControllerTests.java
index 8171469..6ec864c 100644
--- a/services/tests/servicestests/src/com/android/server/usage/AppStandbyControllerTests.java
+++ b/services/tests/servicestests/src/com/android/server/usage/AppStandbyControllerTests.java
@@ -61,7 +61,6 @@
 import android.view.Display;
 
 import androidx.test.InstrumentationRegistry;
-import androidx.test.filters.FlakyTest;
 import androidx.test.filters.SmallTest;
 import androidx.test.runner.AndroidJUnit4;
 
@@ -323,6 +322,8 @@
         private boolean mOnParole = false;
         private CountDownLatch mLatch;
         private long mLastParoleChangeTime;
+        private boolean mIsExpecting = false;
+        private boolean mExpectedParoleState;
 
         public boolean getParoleState() {
             synchronized (this) {
@@ -333,6 +334,15 @@
         public void rearmLatch() {
             synchronized (this) {
                 mLatch = new CountDownLatch(1);
+                mIsExpecting = false;
+            }
+        }
+
+        public void rearmLatch(boolean expectedParoleState) {
+            synchronized (this) {
+                mLatch = new CountDownLatch(1);
+                mIsExpecting = true;
+                mExpectedParoleState = expectedParoleState;
             }
         }
 
@@ -358,7 +368,9 @@
                 if (mLatch != null && mLatch.getCount() > 0) {
                     mOnParole = isParoleOn;
                     mLastParoleChangeTime = getCurrentTime();
-                    mLatch.countDown();
+                    if (!mIsExpecting || isParoleOn == mExpectedParoleState) {
+                        mLatch.countDown();
+                    }
                 }
             }
         }
@@ -417,17 +429,23 @@
     }
 
     @Test
-    @FlakyTest(bugId = 119774928)
     public void testEnabledState() throws Exception {
         TestParoleListener paroleListener = new TestParoleListener();
+        paroleListener.rearmLatch(true);
         mController.addListener(paroleListener);
         long lastUpdateTime;
 
         // Test that listeners are notified if enabled changes when the device is not in parole.
         setChargingState(mController, false);
 
-        // Start off not enabled. Device is effectively on permanent parole.
+        // Start off not enabled. Device is effectively in permanent parole.
         setAppIdleEnabled(mController, false);
+        // Since AppStandbyController uses a handler to notify listeners of a state change, there is
+        // some inherent latency between changing the state and getting the notification. We need to
+        // wait until the paroleListener has been notified that parole is on before continuing with
+        // the test.
+        paroleListener.awaitOnLatch(STABLE_CHARGING_THRESHOLD * 3 / 2);
+        assertTrue(paroleListener.mOnParole);
 
         // Enable controller
         paroleListener.rearmLatch();
diff --git a/services/tests/servicestests/src/com/android/server/usage/AppTimeLimitControllerTests.java b/services/tests/servicestests/src/com/android/server/usage/AppTimeLimitControllerTests.java
index 8caa39d..1f86171 100644
--- a/services/tests/servicestests/src/com/android/server/usage/AppTimeLimitControllerTests.java
+++ b/services/tests/servicestests/src/com/android/server/usage/AppTimeLimitControllerTests.java
@@ -175,9 +175,9 @@
     /** Verify app usage limit observer is added */
     @Test
     public void testAppUsageLimitObserver_AddObserver() {
-        addAppUsageLimitObserver(OBS_ID1, GROUP1, TIME_30_MIN);
+        addAppUsageLimitObserver(OBS_ID1, GROUP1, TIME_30_MIN, TIME_30_MIN);
         assertTrue("Observer wasn't added", hasAppUsageLimitObserver(UID, OBS_ID1));
-        addAppUsageLimitObserver(OBS_ID2, GROUP_GAME, TIME_30_MIN);
+        addAppUsageLimitObserver(OBS_ID2, GROUP_GAME, TIME_30_MIN, TIME_30_MIN);
         assertTrue("Observer wasn't added", hasAppUsageLimitObserver(UID, OBS_ID2));
         assertTrue("Observer wasn't added", hasAppUsageLimitObserver(UID, OBS_ID1));
     }
@@ -203,7 +203,7 @@
     /** Verify app usage limit observer is removed */
     @Test
     public void testAppUsageLimitObserver_RemoveObserver() {
-        addAppUsageLimitObserver(OBS_ID1, GROUP1, TIME_30_MIN);
+        addAppUsageLimitObserver(OBS_ID1, GROUP1, TIME_30_MIN, TIME_30_MIN);
         assertTrue("Observer wasn't added", hasAppUsageLimitObserver(UID, OBS_ID1));
         mController.removeAppUsageLimitObserver(UID, OBS_ID1, USER_ID);
         assertFalse("Observer wasn't removed", hasAppUsageLimitObserver(UID, OBS_ID1));
@@ -290,9 +290,9 @@
     /** Re-adding an observer should result in only one copy */
     @Test
     public void testAppUsageLimitObserver_ObserverReAdd() {
-        addAppUsageLimitObserver(OBS_ID1, GROUP1, TIME_30_MIN);
+        addAppUsageLimitObserver(OBS_ID1, GROUP1, TIME_30_MIN, TIME_30_MIN);
         assertTrue("Observer wasn't added", hasAppUsageLimitObserver(UID, OBS_ID1));
-        addAppUsageLimitObserver(OBS_ID1, GROUP1, TIME_10_MIN);
+        addAppUsageLimitObserver(OBS_ID1, GROUP1, TIME_10_MIN, TIME_10_MIN);
         assertTrue("Observer wasn't added",
                 getAppUsageLimitObserver(UID, OBS_ID1).getTimeLimitMs() == TIME_10_MIN);
         mController.removeAppUsageLimitObserver(UID, OBS_ID1, USER_ID);
@@ -304,7 +304,7 @@
     public void testAllObservers_ExclusiveObserverIds() {
         addAppUsageObserver(OBS_ID1, GROUP1, TIME_10_MIN);
         addUsageSessionObserver(OBS_ID1, GROUP1, TIME_30_MIN, TIME_1_MIN);
-        addAppUsageLimitObserver(OBS_ID1, GROUP1, TIME_10_MIN);
+        addAppUsageLimitObserver(OBS_ID1, GROUP1, TIME_10_MIN, TIME_10_MIN);
         assertTrue("Observer wasn't added", hasAppUsageObserver(UID, OBS_ID1));
         assertTrue("Observer wasn't added", hasUsageSessionObserver(UID, OBS_ID1));
         assertTrue("Observer wasn't added", hasAppUsageLimitObserver(UID, OBS_ID1));
@@ -396,7 +396,7 @@
     @Test
     public void testAppUsageLimitObserver_Accumulation() throws Exception {
         setTime(0L);
-        addAppUsageLimitObserver(OBS_ID1, GROUP1, TIME_30_MIN);
+        addAppUsageLimitObserver(OBS_ID1, GROUP1, TIME_30_MIN, TIME_30_MIN);
         startUsage(PKG_SOC1);
         // Add 10 mins
         setTime(TIME_10_MIN);
@@ -456,7 +456,7 @@
     @Test
     public void testAppUsageLimitObserver_TimeoutOtherApp() throws Exception {
         setTime(0L);
-        addAppUsageLimitObserver(OBS_ID1, GROUP1, 4_000L);
+        addAppUsageLimitObserver(OBS_ID1, GROUP1, 4_000L, 4_000L);
         startUsage(PKG_SOC2);
         assertFalse(mLimitReachedLatch.await(6_000L, TimeUnit.MILLISECONDS));
         setTime(6_000L);
@@ -498,7 +498,7 @@
     @Test
     public void testAppUsageLimitObserver_Timeout() throws Exception {
         setTime(0L);
-        addAppUsageLimitObserver(OBS_ID1, GROUP1, 4_000L);
+        addAppUsageLimitObserver(OBS_ID1, GROUP1, 4_000L, 4_000L);
         startUsage(PKG_SOC1);
         setTime(6_000L);
         assertTrue(mLimitReachedLatch.await(6_000L, TimeUnit.MILLISECONDS));
@@ -551,7 +551,7 @@
         setTime(TIME_10_MIN);
         startUsage(PKG_GAME1);
         setTime(TIME_30_MIN);
-        addAppUsageLimitObserver(OBS_ID2, GROUP_GAME, TIME_30_MIN);
+        addAppUsageLimitObserver(OBS_ID2, GROUP_GAME, TIME_30_MIN, TIME_30_MIN);
         setTime(TIME_30_MIN + TIME_10_MIN);
         stopUsage(PKG_GAME1);
         assertFalse(mLimitReachedLatch.await(1_000L, TimeUnit.MILLISECONDS));
@@ -612,7 +612,7 @@
         startUsage(PKG_SOC1);
         setTime(TIME_10_MIN);
         // 10 second time limit
-        addAppUsageLimitObserver(OBS_ID1, GROUP_SOC, 10_000L);
+        addAppUsageLimitObserver(OBS_ID1, GROUP_SOC, 10_000L, 10_000L);
         setTime(TIME_10_MIN + 5_000L);
         // Shouldn't call back in 6 seconds
         assertFalse(mLimitReachedLatch.await(6_000L, TimeUnit.MILLISECONDS));
@@ -692,23 +692,23 @@
     public void testAppUsageLimitObserver_MaxObserverLimit() throws Exception {
         boolean receivedException = false;
         int ANOTHER_UID = UID + 1;
-        addAppUsageLimitObserver(OBS_ID1, GROUP1, TIME_30_MIN);
-        addAppUsageLimitObserver(OBS_ID2, GROUP1, TIME_30_MIN);
-        addAppUsageLimitObserver(OBS_ID3, GROUP1, TIME_30_MIN);
-        addAppUsageLimitObserver(OBS_ID4, GROUP1, TIME_30_MIN);
-        addAppUsageLimitObserver(OBS_ID5, GROUP1, TIME_30_MIN);
-        addAppUsageLimitObserver(OBS_ID6, GROUP1, TIME_30_MIN);
-        addAppUsageLimitObserver(OBS_ID7, GROUP1, TIME_30_MIN);
-        addAppUsageLimitObserver(OBS_ID8, GROUP1, TIME_30_MIN);
-        addAppUsageLimitObserver(OBS_ID9, GROUP1, TIME_30_MIN);
-        addAppUsageLimitObserver(OBS_ID10, GROUP1, TIME_30_MIN);
+        addAppUsageLimitObserver(OBS_ID1, GROUP1, TIME_30_MIN, TIME_30_MIN);
+        addAppUsageLimitObserver(OBS_ID2, GROUP1, TIME_30_MIN, TIME_30_MIN);
+        addAppUsageLimitObserver(OBS_ID3, GROUP1, TIME_30_MIN, TIME_30_MIN);
+        addAppUsageLimitObserver(OBS_ID4, GROUP1, TIME_30_MIN, TIME_30_MIN);
+        addAppUsageLimitObserver(OBS_ID5, GROUP1, TIME_30_MIN, TIME_30_MIN);
+        addAppUsageLimitObserver(OBS_ID6, GROUP1, TIME_30_MIN, TIME_30_MIN);
+        addAppUsageLimitObserver(OBS_ID7, GROUP1, TIME_30_MIN, TIME_30_MIN);
+        addAppUsageLimitObserver(OBS_ID8, GROUP1, TIME_30_MIN, TIME_30_MIN);
+        addAppUsageLimitObserver(OBS_ID9, GROUP1, TIME_30_MIN, TIME_30_MIN);
+        addAppUsageLimitObserver(OBS_ID10, GROUP1, TIME_30_MIN, TIME_30_MIN);
         // Readding an observer should not cause an IllegalStateException
-        addAppUsageLimitObserver(OBS_ID5, GROUP1, TIME_30_MIN);
+        addAppUsageLimitObserver(OBS_ID5, GROUP1, TIME_30_MIN, TIME_30_MIN);
         // Adding an observer for a different uid shouldn't cause an IllegalStateException
         mController.addAppUsageLimitObserver(
-                ANOTHER_UID, OBS_ID11, GROUP1, TIME_30_MIN, null, USER_ID);
+                ANOTHER_UID, OBS_ID11, GROUP1, TIME_30_MIN, TIME_30_MIN, null, USER_ID);
         try {
-            addAppUsageLimitObserver(OBS_ID11, GROUP1, TIME_30_MIN);
+            addAppUsageLimitObserver(OBS_ID11, GROUP1, TIME_30_MIN, TIME_30_MIN);
         } catch (IllegalStateException ise) {
             receivedException = true;
         }
@@ -748,9 +748,9 @@
     public void testAppUsageLimitObserver_MinimumTimeLimit() throws Exception {
         boolean receivedException = false;
         // adding an observer with a one minute time limit should not cause an exception
-        addAppUsageLimitObserver(OBS_ID1, GROUP1, MIN_TIME_LIMIT);
+        addAppUsageLimitObserver(OBS_ID1, GROUP1, MIN_TIME_LIMIT, MIN_TIME_LIMIT);
         try {
-            addAppUsageLimitObserver(OBS_ID1, GROUP1, MIN_TIME_LIMIT - 1);
+            addAppUsageLimitObserver(OBS_ID1, GROUP1, MIN_TIME_LIMIT - 1, MIN_TIME_LIMIT - 1);
         } catch (IllegalArgumentException iae) {
             receivedException = true;
         }
@@ -807,7 +807,7 @@
     @Test
     public void testAppUsageLimitObserver_ConcurrentUsage() throws Exception {
         setTime(0L);
-        addAppUsageLimitObserver(OBS_ID1, GROUP1, TIME_30_MIN);
+        addAppUsageLimitObserver(OBS_ID1, GROUP1, TIME_30_MIN, TIME_30_MIN);
         AppTimeLimitController.UsageGroup group = getAppUsageLimitObserver(UID, OBS_ID1);
         startUsage(PKG_SOC1);
         // Add 10 mins
@@ -967,7 +967,7 @@
     /** Verify app usage limit observer added correctly reports its total usage limit */
     @Test
     public void testAppUsageLimitObserver_GetTotalUsageLimit() {
-        addAppUsageLimitObserver(OBS_ID1, GROUP1, TIME_30_MIN);
+        addAppUsageLimitObserver(OBS_ID1, GROUP1, TIME_30_MIN, TIME_30_MIN);
         AppTimeLimitController.AppUsageLimitGroup group = getAppUsageLimitObserver(UID, OBS_ID1);
         assertNotNull("Observer wasn't added", group);
         assertEquals("Observer didn't correctly report total usage limit",
@@ -978,7 +978,7 @@
     @Test
     public void testAppUsageLimitObserver_GetUsageRemaining() {
         setTime(0L);
-        addAppUsageLimitObserver(OBS_ID1, GROUP1, TIME_30_MIN);
+        addAppUsageLimitObserver(OBS_ID1, GROUP1, TIME_30_MIN, TIME_30_MIN);
         startUsage(PKG_SOC1);
         setTime(TIME_10_MIN);
         stopUsage(PKG_SOC1);
@@ -993,8 +993,8 @@
      */
     @Test
     public void testAppUsageLimitObserver_GetAppUsageLimit() {
-        addAppUsageLimitObserver(OBS_ID1, GROUP1, TIME_30_MIN);
-        addAppUsageLimitObserver(OBS_ID2, GROUP_SOC, TIME_10_MIN);
+        addAppUsageLimitObserver(OBS_ID1, GROUP1, TIME_30_MIN, TIME_30_MIN);
+        addAppUsageLimitObserver(OBS_ID2, GROUP_SOC, TIME_10_MIN, TIME_10_MIN);
         UsageStatsManagerInternal.AppUsageLimitData group = getAppUsageLimit(PKG_SOC1);
         assertEquals("Observer with the smallest usage limit remaining wasn't returned",
                 TIME_10_MIN, group.getTotalUsageLimit());
@@ -1006,8 +1006,8 @@
     @Test
     public void testAppUsageLimitObserver_GetAppUsageLimitUsed() {
         setTime(0L);
-        addAppUsageLimitObserver(OBS_ID1, GROUP1, TIME_30_MIN);
-        addAppUsageLimitObserver(OBS_ID2, GROUP_SOC, TIME_10_MIN);
+        addAppUsageLimitObserver(OBS_ID1, GROUP1, TIME_30_MIN, TIME_30_MIN);
+        addAppUsageLimitObserver(OBS_ID2, GROUP_SOC, TIME_10_MIN, TIME_10_MIN);
         startUsage(PKG_GAME1);
         setTime(TIME_10_MIN * 2 + TIME_1_MIN);
         stopUsage(PKG_GAME1);
@@ -1024,8 +1024,8 @@
     @Test
     public void testAppUsageLimitObserver_GetAppUsageLimitAllUsed() {
         setTime(0L);
-        addAppUsageLimitObserver(OBS_ID1, GROUP1, TIME_30_MIN);
-        addAppUsageLimitObserver(OBS_ID2, GROUP_SOC, TIME_10_MIN);
+        addAppUsageLimitObserver(OBS_ID1, GROUP1, TIME_30_MIN, TIME_30_MIN);
+        addAppUsageLimitObserver(OBS_ID2, GROUP_SOC, TIME_10_MIN, TIME_10_MIN);
         startUsage(PKG_SOC1);
         setTime(TIME_10_MIN);
         stopUsage(PKG_SOC1);
@@ -1035,10 +1035,21 @@
                 0L, group.getUsageRemaining());
     }
 
+    /** Verify that a limit of 0 is not allowed. */
+    @Test
+    public void testAppUsageLimitObserver_ZeroTimeLimitIsNotAllowed() {
+        try {
+            addAppUsageLimitObserver(OBS_ID1, GROUP1, 0, 0);
+            fail("timeLimit of 0 should not be allowed.");
+        } catch (IllegalArgumentException expected) {
+            // Exception expected.
+        }
+    }
+
     /** Verify that a limit of 0 is allowed for the special case of re-registering an observer. */
     @Test
-    public void testAppUsageLimitObserver_ZeroTimeLimitIsAllowed() {
-        addAppUsageLimitObserver(OBS_ID1, GROUP1, 0);
+    public void testAppUsageLimitObserver_ZeroTimeRemainingIsAllowed() {
+        addAppUsageLimitObserver(OBS_ID1, GROUP1, TIME_1_MIN, 0);
         AppTimeLimitController.AppUsageLimitGroup group = getAppUsageLimitObserver(UID, OBS_ID1);
         assertNotNull("Observer wasn't added", group);
         assertEquals("Usage remaining was not 0.", 0, group.getUsageRemaining());
@@ -1066,8 +1077,10 @@
                 null, null, USER_ID);
     }
 
-    private void addAppUsageLimitObserver(int observerId, String[] packages, long timeLimit) {
-        mController.addAppUsageLimitObserver(UID, observerId, packages, timeLimit, null, USER_ID);
+    private void addAppUsageLimitObserver(int observerId, String[] packages, long timeLimit,
+            long timeRemaining) {
+        mController.addAppUsageLimitObserver(UID, observerId, packages, timeLimit, timeRemaining,
+                null, USER_ID);
     }
 
     /** Is there still an app usage observer by that id */
diff --git a/services/tests/shortcutmanagerutils/src/com/android/server/pm/shortcutmanagertest/ShortcutManagerTestUtils.java b/services/tests/shortcutmanagerutils/src/com/android/server/pm/shortcutmanagertest/ShortcutManagerTestUtils.java
index e36586e..2077ecb 100644
--- a/services/tests/shortcutmanagerutils/src/com/android/server/pm/shortcutmanagertest/ShortcutManagerTestUtils.java
+++ b/services/tests/shortcutmanagerutils/src/com/android/server/pm/shortcutmanagertest/ShortcutManagerTestUtils.java
@@ -36,6 +36,7 @@
 import android.app.Instrumentation;
 import android.content.ComponentName;
 import android.content.Context;
+import android.content.LocusId;
 import android.content.pm.LauncherApps;
 import android.content.pm.LauncherApps.Callback;
 import android.content.pm.ShortcutInfo;
@@ -369,6 +370,10 @@
         return ret;
     }
 
+    public static LocusId locusId(String id) {
+        return new LocusId(id);
+    }
+
     public static void resetAll(Collection<?> mocks) {
         for (Object o : mocks) {
             reset(o);
diff --git a/services/tests/uiservicestests/Android.bp b/services/tests/uiservicestests/Android.bp
index f4443fe..92198fa 100644
--- a/services/tests/uiservicestests/Android.bp
+++ b/services/tests/uiservicestests/Android.bp
@@ -17,11 +17,12 @@
         "services.net",
         "services.usage",
         "guava",
-        "android-support-test",
+        "androidx.test.rules", "hamcrest-library",
         "mockito-target-inline-minus-junit4",
         "platform-test-annotations",
         "hamcrest-library",
         "testables",
+        "truth-prebuilt",
     ],
 
     libs: [
diff --git a/services/tests/uiservicestests/src/com/android/server/UiServiceTestCase.java b/services/tests/uiservicestests/src/com/android/server/UiServiceTestCase.java
index 56d3a20..a1d48cc 100644
--- a/services/tests/uiservicestests/src/com/android/server/UiServiceTestCase.java
+++ b/services/tests/uiservicestests/src/com/android/server/UiServiceTestCase.java
@@ -16,15 +16,15 @@
 import static org.mockito.ArgumentMatchers.any;
 import static org.mockito.ArgumentMatchers.anyInt;
 import static org.mockito.ArgumentMatchers.anyString;
-import static org.mockito.Mockito.doNothing;
 import static org.mockito.Mockito.when;
 
 import android.content.pm.PackageManagerInternal;
 import android.net.Uri;
 import android.os.Build;
-import android.support.test.InstrumentationRegistry;
 import android.testing.TestableContext;
 
+import androidx.test.InstrumentationRegistry;
+
 import com.android.server.uri.UriGrantsManagerInternal;
 
 import org.junit.Before;
diff --git a/services/tests/uiservicestests/src/com/android/server/notification/AlertRateLimiterTest.java b/services/tests/uiservicestests/src/com/android/server/notification/AlertRateLimiterTest.java
index d4c41e0..dc7f118 100644
--- a/services/tests/uiservicestests/src/com/android/server/notification/AlertRateLimiterTest.java
+++ b/services/tests/uiservicestests/src/com/android/server/notification/AlertRateLimiterTest.java
@@ -20,9 +20,10 @@
 import static junit.framework.Assert.assertFalse;
 import static junit.framework.Assert.assertTrue;
 
-import android.support.test.runner.AndroidJUnit4;
 import android.test.suitebuilder.annotation.SmallTest;
 
+import androidx.test.runner.AndroidJUnit4;
+
 import com.android.server.UiServiceTestCase;
 
 import org.junit.Before;
diff --git a/services/tests/uiservicestests/src/com/android/server/notification/BadgeExtractorTest.java b/services/tests/uiservicestests/src/com/android/server/notification/BadgeExtractorTest.java
index cfc7430..e1f3913 100644
--- a/services/tests/uiservicestests/src/com/android/server/notification/BadgeExtractorTest.java
+++ b/services/tests/uiservicestests/src/com/android/server/notification/BadgeExtractorTest.java
@@ -15,26 +15,26 @@
  */
 package com.android.server.notification;
 
-import static junit.framework.Assert.assertFalse;
-import static junit.framework.Assert.assertTrue;
-
-import static org.mockito.Mockito.mock;
-import static org.mockito.Mockito.when;
-
 import static android.app.NotificationManager.IMPORTANCE_HIGH;
 import static android.app.NotificationManager.IMPORTANCE_UNSPECIFIED;
 import static android.app.NotificationManager.Policy.SUPPRESSED_EFFECT_BADGE;
 import static android.app.NotificationManager.Policy.SUPPRESSED_EFFECT_LIGHTS;
 
+import static junit.framework.Assert.assertFalse;
+import static junit.framework.Assert.assertTrue;
+
+import static org.mockito.Mockito.when;
+
 import android.app.ActivityManager;
 import android.app.Notification;
 import android.app.Notification.Builder;
 import android.app.NotificationChannel;
 import android.os.UserHandle;
 import android.service.notification.StatusBarNotification;
-import android.support.test.runner.AndroidJUnit4;
 import android.test.suitebuilder.annotation.SmallTest;
 
+import androidx.test.runner.AndroidJUnit4;
+
 import com.android.server.UiServiceTestCase;
 
 import org.junit.Before;
diff --git a/services/tests/uiservicestests/src/com/android/server/notification/BubbleExtractorTest.java b/services/tests/uiservicestests/src/com/android/server/notification/BubbleExtractorTest.java
index 3e01fb5..273a9e6 100644
--- a/services/tests/uiservicestests/src/com/android/server/notification/BubbleExtractorTest.java
+++ b/services/tests/uiservicestests/src/com/android/server/notification/BubbleExtractorTest.java
@@ -17,8 +17,6 @@
 
 import static android.app.NotificationManager.IMPORTANCE_HIGH;
 import static android.app.NotificationManager.IMPORTANCE_UNSPECIFIED;
-import static android.app.NotificationManager.Policy.SUPPRESSED_EFFECT_BADGE;
-import static android.app.NotificationManager.Policy.SUPPRESSED_EFFECT_LIGHTS;
 
 import static junit.framework.Assert.assertFalse;
 import static junit.framework.Assert.assertTrue;
@@ -31,9 +29,10 @@
 import android.app.NotificationChannel;
 import android.os.UserHandle;
 import android.service.notification.StatusBarNotification;
-import android.support.test.runner.AndroidJUnit4;
 import android.test.suitebuilder.annotation.SmallTest;
 
+import androidx.test.runner.AndroidJUnit4;
+
 import com.android.server.UiServiceTestCase;
 
 import org.junit.Before;
diff --git a/services/tests/uiservicestests/src/com/android/server/notification/BuzzBeepBlinkTest.java b/services/tests/uiservicestests/src/com/android/server/notification/BuzzBeepBlinkTest.java
index 20c5f5d..6be2c2e 100644
--- a/services/tests/uiservicestests/src/com/android/server/notification/BuzzBeepBlinkTest.java
+++ b/services/tests/uiservicestests/src/com/android/server/notification/BuzzBeepBlinkTest.java
@@ -62,13 +62,14 @@
 import android.provider.Settings;
 import android.service.notification.NotificationListenerService;
 import android.service.notification.StatusBarNotification;
-import android.support.test.runner.AndroidJUnit4;
 import android.test.suitebuilder.annotation.SmallTest;
 import android.view.accessibility.AccessibilityEvent;
 import android.view.accessibility.AccessibilityManager;
 import android.view.accessibility.IAccessibilityManager;
 import android.view.accessibility.IAccessibilityManagerClient;
 
+import androidx.test.runner.AndroidJUnit4;
+
 import com.android.internal.util.IntPair;
 import com.android.server.UiServiceTestCase;
 import com.android.server.lights.Light;
diff --git a/services/tests/uiservicestests/src/com/android/server/notification/GlobalSortKeyComparatorTest.java b/services/tests/uiservicestests/src/com/android/server/notification/GlobalSortKeyComparatorTest.java
index 97f2104..5041779 100644
--- a/services/tests/uiservicestests/src/com/android/server/notification/GlobalSortKeyComparatorTest.java
+++ b/services/tests/uiservicestests/src/com/android/server/notification/GlobalSortKeyComparatorTest.java
@@ -16,18 +16,16 @@
 package com.android.server.notification;
 
 import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertFalse;
-import static org.junit.Assert.assertTrue;
-import static org.mockito.Matchers.eq;
 
 import android.app.Notification;
 import android.app.NotificationChannel;
 import android.app.NotificationManager;
 import android.os.UserHandle;
 import android.service.notification.StatusBarNotification;
-import android.support.test.runner.AndroidJUnit4;
 import android.test.suitebuilder.annotation.SmallTest;
 
+import androidx.test.runner.AndroidJUnit4;
+
 import com.android.server.UiServiceTestCase;
 
 import org.junit.Test;
diff --git a/services/tests/uiservicestests/src/com/android/server/notification/GroupHelperTest.java b/services/tests/uiservicestests/src/com/android/server/notification/GroupHelperTest.java
index 84ef0c9..f652c5a 100644
--- a/services/tests/uiservicestests/src/com/android/server/notification/GroupHelperTest.java
+++ b/services/tests/uiservicestests/src/com/android/server/notification/GroupHelperTest.java
@@ -25,6 +25,15 @@
 import static org.mockito.Mockito.times;
 import static org.mockito.Mockito.verify;
 
+import android.app.Notification;
+import android.os.UserHandle;
+import android.service.notification.StatusBarNotification;
+import android.test.suitebuilder.annotation.SmallTest;
+
+import androidx.test.runner.AndroidJUnit4;
+
+import com.android.server.UiServiceTestCase;
+
 import org.junit.Before;
 import org.junit.Test;
 import org.junit.runner.RunWith;
@@ -32,14 +41,6 @@
 import org.mockito.Mockito;
 import org.mockito.MockitoAnnotations;
 
-import android.app.Notification;
-import android.os.UserHandle;
-import android.service.notification.StatusBarNotification;
-import android.support.test.runner.AndroidJUnit4;
-import android.test.suitebuilder.annotation.SmallTest;
-
-import com.android.server.UiServiceTestCase;
-
 import java.util.ArrayList;
 import java.util.LinkedHashSet;
 import java.util.List;
diff --git a/services/tests/uiservicestests/src/com/android/server/notification/ImportanceExtractorTest.java b/services/tests/uiservicestests/src/com/android/server/notification/ImportanceExtractorTest.java
index abc6e3c..e9515fa 100644
--- a/services/tests/uiservicestests/src/com/android/server/notification/ImportanceExtractorTest.java
+++ b/services/tests/uiservicestests/src/com/android/server/notification/ImportanceExtractorTest.java
@@ -15,31 +15,30 @@
  */
 package com.android.server.notification;
 
-import org.junit.Before;
-import org.junit.Test;
-import org.junit.runner.RunWith;
-
-import android.app.ActivityManager;
-import android.app.Notification;
-import android.app.Notification.Builder;
-import android.app.NotificationManager;
-import android.app.NotificationChannel;
-import android.os.UserHandle;
-import android.service.notification.StatusBarNotification;
-import android.support.test.runner.AndroidJUnit4;
-import android.test.suitebuilder.annotation.SmallTest;
-
-import org.mockito.Mock;
-import org.mockito.MockitoAnnotations;
-
+import static org.junit.Assert.assertEquals;
 import static org.mockito.Matchers.anyInt;
 import static org.mockito.Matchers.anyString;
 import static org.mockito.Mockito.when;
 
-import static org.junit.Assert.assertEquals;
+import android.app.ActivityManager;
+import android.app.Notification;
+import android.app.Notification.Builder;
+import android.app.NotificationChannel;
+import android.app.NotificationManager;
+import android.os.UserHandle;
+import android.service.notification.StatusBarNotification;
+import android.test.suitebuilder.annotation.SmallTest;
+
+import androidx.test.runner.AndroidJUnit4;
 
 import com.android.server.UiServiceTestCase;
 
+import org.junit.Before;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+import org.mockito.Mock;
+import org.mockito.MockitoAnnotations;
+
 @SmallTest
 @RunWith(AndroidJUnit4.class)
 public class ImportanceExtractorTest extends UiServiceTestCase {
diff --git a/services/tests/uiservicestests/src/com/android/server/notification/ManagedServicesTest.java b/services/tests/uiservicestests/src/com/android/server/notification/ManagedServicesTest.java
index 7a530df..43fe674 100644
--- a/services/tests/uiservicestests/src/com/android/server/notification/ManagedServicesTest.java
+++ b/services/tests/uiservicestests/src/com/android/server/notification/ManagedServicesTest.java
@@ -1228,5 +1228,10 @@
         protected void onServiceAdded(ManagedServiceInfo info) {
 
         }
+
+        @Override
+        protected String getRequiredPermission() {
+            return null;
+        }
     }
 }
diff --git a/services/tests/uiservicestests/src/com/android/server/notification/NotificationAssistantsTest.java b/services/tests/uiservicestests/src/com/android/server/notification/NotificationAssistantsTest.java
index 19b567f..88186cd 100644
--- a/services/tests/uiservicestests/src/com/android/server/notification/NotificationAssistantsTest.java
+++ b/services/tests/uiservicestests/src/com/android/server/notification/NotificationAssistantsTest.java
@@ -114,10 +114,10 @@
 
     @Test
     public void testXmlUpgrade() {
-        mAssistants.ensureAssistant();
+        mAssistants.resetDefaultAssistantsIfNecessary();
 
         //once per user
-        verify(mNm, times(mUm.getUsers().size())).readDefaultAssistant(anyInt());
+        verify(mNm, times(mUm.getUsers().size())).setDefaultAssistantForUser(anyInt());
     }
 
     @Test
@@ -132,7 +132,7 @@
         parser.nextTag();
         mAssistants.readXml(parser, null, false, UserHandle.USER_ALL);
 
-        verify(mNm, never()).readDefaultAssistant(anyInt());
+        verify(mNm, never()).setDefaultAssistantForUser(anyInt());
         verify(mAssistants, times(1)).addApprovedList(
                 new ComponentName("b", "b").flattenToString(),10, true);
     }
@@ -143,13 +143,13 @@
         ComponentName component2 = ComponentName.unflattenFromString("package/Component2");
         mAssistants.setPackageOrComponentEnabled(component1.flattenToString(), mZero.id, true,
                 true);
-        verify(mINm, never()).setNotificationAssistantAccessGrantedForUser(any(ComponentName.class),
-                eq(mZero.id), anyBoolean());
+        verify(mNm, never()).setNotificationAssistantAccessGrantedForUserInternal(
+                any(ComponentName.class), eq(mZero.id), anyBoolean());
 
         mAssistants.setPackageOrComponentEnabled(component2.flattenToString(), mZero.id, true,
                 true);
-        verify(mINm, times(1)).setNotificationAssistantAccessGrantedForUser(component1, mZero.id,
-                false);
+        verify(mNm, times(1)).setNotificationAssistantAccessGrantedForUserInternal(
+                component1, mZero.id, false);
     }
 
     @Test
@@ -159,7 +159,7 @@
                 true);
         mAssistants.setPackageOrComponentEnabled(component1.flattenToString(), mZero.id, true,
                 true);
-        verify(mINm, never()).setNotificationAssistantAccessGrantedForUser(any(ComponentName.class),
-                eq(mZero.id), anyBoolean());
+        verify(mNm, never()).setNotificationAssistantAccessGrantedForUserInternal(
+                any(ComponentName.class), eq(mZero.id), anyBoolean());
     }
 }
diff --git a/services/tests/uiservicestests/src/com/android/server/notification/NotificationChannelTest.java b/services/tests/uiservicestests/src/com/android/server/notification/NotificationChannelTest.java
index ca473c6..1408749 100644
--- a/services/tests/uiservicestests/src/com/android/server/notification/NotificationChannelTest.java
+++ b/services/tests/uiservicestests/src/com/android/server/notification/NotificationChannelTest.java
@@ -24,10 +24,11 @@
 import android.app.NotificationChannel;
 import android.net.Uri;
 import android.os.Parcel;
-import android.support.test.runner.AndroidJUnit4;
 import android.test.suitebuilder.annotation.SmallTest;
 import android.util.Xml;
 
+import androidx.test.runner.AndroidJUnit4;
+
 import com.android.internal.util.FastXmlSerializer;
 import com.android.server.UiServiceTestCase;
 
diff --git a/services/tests/uiservicestests/src/com/android/server/notification/NotificationComparatorTest.java b/services/tests/uiservicestests/src/com/android/server/notification/NotificationComparatorTest.java
index 0681295..e15af3d 100644
--- a/services/tests/uiservicestests/src/com/android/server/notification/NotificationComparatorTest.java
+++ b/services/tests/uiservicestests/src/com/android/server/notification/NotificationComparatorTest.java
@@ -35,10 +35,11 @@
 import android.os.UserHandle;
 import android.provider.Settings;
 import android.service.notification.StatusBarNotification;
-import android.support.test.runner.AndroidJUnit4;
 import android.telecom.TelecomManager;
 import android.test.suitebuilder.annotation.SmallTest;
 
+import androidx.test.runner.AndroidJUnit4;
+
 import com.android.server.UiServiceTestCase;
 
 import org.junit.Before;
diff --git a/services/tests/uiservicestests/src/com/android/server/notification/NotificationListenerServiceTest.java b/services/tests/uiservicestests/src/com/android/server/notification/NotificationListenerServiceTest.java
index 2162f28..52c199a3 100644
--- a/services/tests/uiservicestests/src/com/android/server/notification/NotificationListenerServiceTest.java
+++ b/services/tests/uiservicestests/src/com/android/server/notification/NotificationListenerServiceTest.java
@@ -39,9 +39,10 @@
 import android.service.notification.NotificationListenerService.Ranking;
 import android.service.notification.NotificationRankingUpdate;
 import android.service.notification.SnoozeCriterion;
-import android.support.test.runner.AndroidJUnit4;
 import android.test.suitebuilder.annotation.SmallTest;
 
+import androidx.test.runner.AndroidJUnit4;
+
 import com.android.server.UiServiceTestCase;
 
 import org.junit.Test;
diff --git a/services/tests/uiservicestests/src/com/android/server/notification/NotificationManagerServiceTest.java b/services/tests/uiservicestests/src/com/android/server/notification/NotificationManagerServiceTest.java
index 31788ae..7df52b2 100644
--- a/services/tests/uiservicestests/src/com/android/server/notification/NotificationManagerServiceTest.java
+++ b/services/tests/uiservicestests/src/com/android/server/notification/NotificationManagerServiceTest.java
@@ -98,7 +98,9 @@
 import android.os.Process;
 import android.os.RemoteException;
 import android.os.UserHandle;
+import android.provider.DeviceConfig;
 import android.provider.MediaStore;
+import android.provider.Settings;
 import android.service.notification.Adjustment;
 import android.service.notification.NotificationListenerService;
 import android.service.notification.NotificationStats;
@@ -111,9 +113,13 @@
 import android.testing.TestableLooper.RunWithLooper;
 import android.text.Html;
 import android.util.ArrayMap;
+import android.util.ArraySet;
 import android.util.AtomicFile;
 
+import androidx.annotation.Nullable;
+
 import com.android.internal.R;
+import com.android.internal.config.sysui.SystemUiDeviceConfigFlags;
 import com.android.internal.statusbar.NotificationVisibility;
 import com.android.server.LocalServices;
 import com.android.server.SystemService;
@@ -142,6 +148,7 @@
 import java.io.FileOutputStream;
 import java.util.ArrayList;
 import java.util.Arrays;
+import java.util.Collections;
 import java.util.HashSet;
 import java.util.List;
 import java.util.Map;
@@ -153,6 +160,13 @@
 @RunWithLooper
 public class NotificationManagerServiceTest extends UiServiceTestCase {
     private static final String TEST_CHANNEL_ID = "NotificationManagerServiceTestChannelId";
+    private static final String CLEAR_DEVICE_CONFIG_KEY_CMD =
+            "device_config delete " + DeviceConfig.NAMESPACE_SYSTEMUI + " "
+                    + SystemUiDeviceConfigFlags.NAS_DEFAULT_SERVICE;
+    private static final String SET_DEFAULT_ASSISTANT_DEVICE_CONFIG_CMD =
+            "device_config put " + DeviceConfig.NAMESPACE_SYSTEMUI + " "
+                    + SystemUiDeviceConfigFlags.NAS_DEFAULT_SERVICE;
+
     private final int mUid = Binder.getCallingUid();
     private TestableNotificationManagerService mService;
     private INotificationManager mBinderService;
@@ -208,6 +222,9 @@
     AppOpsManager mAppOpsManager;
     @Mock
     private UserManagerService mUserMangerService;
+    @Mock
+    private TestableNotificationManagerService.NotificationAssistantAccessGrantedCallback
+            mNotificationAssistantAccessGrantedCallback;
 
     // Use a Testable subclass so we can simulate calls from the system without failing.
     private static class TestableNotificationManagerService extends NotificationManagerService {
@@ -215,6 +232,8 @@
         boolean isSystemUid = true;
         int countLogSmartSuggestionsVisible = 0;
         UserManagerService mUserManagerService;
+        @Nullable
+        NotificationAssistantAccessGrantedCallback mNotificationAssistantAccessGrantedCallback;
 
         TestableNotificationManagerService(Context context, UserManagerService userManagerService) {
             super(context);
@@ -258,6 +277,26 @@
         UserManagerService getUserManagerService() {
             return mUserManagerService;
         }
+
+        @Override
+        protected void setNotificationAssistantAccessGrantedForUserInternal(
+                ComponentName assistant, int userId, boolean granted) {
+            if (mNotificationAssistantAccessGrantedCallback != null) {
+                mNotificationAssistantAccessGrantedCallback.onGranted(assistant, userId, granted);
+                return;
+            }
+            super.setNotificationAssistantAccessGrantedForUserInternal(assistant, userId, granted);
+        }
+
+        private void setNotificationAssistantAccessGrantedCallback(
+                @Nullable NotificationAssistantAccessGrantedCallback callback) {
+            this.mNotificationAssistantAccessGrantedCallback = callback;
+        }
+
+        interface NotificationAssistantAccessGrantedCallback {
+            void onGranted(ComponentName assistant, int userId, boolean granted);
+        }
+
     }
 
     private class TestableToastCallback extends ITransientNotification.Stub {
@@ -352,6 +391,7 @@
     @After
     public void tearDown() throws Exception {
         mFile.delete();
+        clearDeviceConfig();
     }
 
     public void waitForIdle() {
@@ -2029,6 +2069,7 @@
         verify(mContext, times(1)).sendBroadcastAsUser(any(), eq(user), any());
         verify(mAssistants, times(1)).setPackageOrComponentEnabled(
                 c.flattenToString(), user.getIdentifier(), true, true);
+        verify(mAssistants).setUserSet(10, true);
         verify(mConditionProviders, times(1)).setPackageOrComponentEnabled(
                 c.flattenToString(), user.getIdentifier(), false, true);
         verify(mListeners, never()).setPackageOrComponentEnabled(
@@ -2518,7 +2559,7 @@
         verify(mListeners, times(1)).migrateToXml();
         verify(mConditionProviders, times(1)).migrateToXml();
         verify(mAssistants, times(1)).migrateToXml();
-        verify(mAssistants, never()).ensureAssistant();
+        verify(mAssistants, times(2)).resetDefaultAssistantsIfNecessary();
     }
 
     @Test
@@ -2538,7 +2579,7 @@
         verify(mListeners, times(2)).migrateToXml();
         verify(mConditionProviders, times(2)).migrateToXml();
         verify(mAssistants, times(2)).migrateToXml();
-        verify(mAssistants, never()).ensureAssistant();
+        verify(mAssistants, times(2)).resetDefaultAssistantsIfNecessary();
     }
 
     @Test
@@ -3619,7 +3660,7 @@
                 .thenReturn(new String[] {"a", "b", "c"});
         when(mContext.getResources()).thenReturn(mResources);
 
-        assertEquals(false, mService.canUseManagedServices(null));
+        assertEquals(false, mService.canUseManagedServices(null, 0, null));
     }
 
     @Test
@@ -3630,7 +3671,7 @@
                 .thenReturn(new String[] {"a", "b", "c"});
         when(mContext.getResources()).thenReturn(mResources);
 
-        assertEquals(true, mService.canUseManagedServices("b"));
+        assertEquals(true, mService.canUseManagedServices("b", 0, null));
     }
 
     @Test
@@ -3641,7 +3682,7 @@
                 .thenReturn(new String[] {"a", "b", "c"});
         when(mContext.getResources()).thenReturn(mResources);
 
-        assertEquals(false, mService.canUseManagedServices("d"));
+        assertEquals(false, mService.canUseManagedServices("d", 0, null));
     }
 
     @Test
@@ -3652,7 +3693,7 @@
                 .thenReturn(new String[] {"a", "b", "c"});
         when(mContext.getResources()).thenReturn(mResources);
 
-        assertEquals(true, mService.canUseManagedServices("d"));
+        assertEquals(true, mService.canUseManagedServices("d", 0, null));
     }
 
     @Test
@@ -3663,7 +3704,7 @@
                 .thenReturn(new String[] {"a", "b", "c"});
         when(mContext.getResources()).thenReturn(mResources);
 
-        assertEquals(true, mService.canUseManagedServices("d"));
+        assertEquals(true, mService.canUseManagedServices("d", 0 , null));
     }
 
     @Test
@@ -3674,7 +3715,28 @@
                 .thenReturn(new String[] {"a", "b", "c"});
         when(mContext.getResources()).thenReturn(mResources);
 
-        assertEquals(true, mService.canUseManagedServices("d"));
+        assertEquals(true, mService.canUseManagedServices("d", 0, null));
+    }
+
+    @Test
+    public void testCanUseManagedServices_hasPermission() throws Exception {
+        when(mPackageManager.checkPermission("perm", "pkg", 0))
+                .thenReturn(PackageManager.PERMISSION_GRANTED);
+
+        assertEquals(true, mService.canUseManagedServices("pkg", 0, "perm"));
+    }
+
+    @Test
+    public void testCanUseManagedServices_noPermission() throws Exception {
+        when(mPackageManager.checkPermission("perm", "pkg", 0))
+                .thenReturn(PackageManager.PERMISSION_DENIED);
+
+        assertEquals(false, mService.canUseManagedServices("pkg", 0, "perm"));
+    }
+
+    @Test
+    public void testCanUseManagedServices_permDoesNotMatter() {
+        assertEquals(true, mService.canUseManagedServices("pkg", 0, null));
     }
 
     @Test
@@ -4101,4 +4163,78 @@
         verify(mListeners).notifyRemovedLocked(any(), anyInt(), captor.capture());
         assertNotNull(captor.getValue());
     }
+
+    @Test
+    public void setDefaultAssistantForUser_fromConfigXml() {
+        clearDeviceConfig();
+        ComponentName xmlConfig = new ComponentName("config", "xml");
+        when(mResources
+                .getString(
+                        com.android.internal.R.string.config_defaultAssistantAccessComponent))
+                .thenReturn(xmlConfig.flattenToString());
+        when(mContext.getResources()).thenReturn(mResources);
+        when(mAssistants.queryPackageForServices(eq(null), anyInt(), eq(0)))
+                .thenReturn(Collections.singleton(xmlConfig));
+        mService.setNotificationAssistantAccessGrantedCallback(
+                mNotificationAssistantAccessGrantedCallback);
+
+        mService.setDefaultAssistantForUser(0);
+
+        verify(mNotificationAssistantAccessGrantedCallback)
+                .onGranted(eq(xmlConfig), eq(0), eq(true));
+    }
+
+    @Test
+    public void setDefaultAssistantForUser_fromDeviceConfig() {
+        ComponentName xmlConfig = new ComponentName("xml", "config");
+        ComponentName deviceConfig = new ComponentName("device", "config");
+        setDefaultAssistantInDeviceConfig(deviceConfig.flattenToString());
+        when(mResources
+                .getString(com.android.internal.R.string.config_defaultAssistantAccessComponent))
+                .thenReturn(xmlConfig.flattenToString());
+        when(mContext.getResources()).thenReturn(mResources);
+        when(mAssistants.queryPackageForServices(eq(null), anyInt(), eq(0)))
+                .thenReturn(new ArraySet<>(Arrays.asList(xmlConfig, deviceConfig)));
+        mService.setNotificationAssistantAccessGrantedCallback(
+                mNotificationAssistantAccessGrantedCallback);
+
+        mService.setDefaultAssistantForUser(0);
+
+        verify(mNotificationAssistantAccessGrantedCallback)
+                .onGranted(eq(deviceConfig), eq(0), eq(true));
+    }
+
+    @Test
+    public void setDefaultAssistantForUser_deviceConfigInvalid() {
+        ComponentName xmlConfig = new ComponentName("xml", "config");
+        ComponentName deviceConfig = new ComponentName("device", "config");
+        setDefaultAssistantInDeviceConfig(deviceConfig.flattenToString());
+        when(mResources
+                .getString(com.android.internal.R.string.config_defaultAssistantAccessComponent))
+                .thenReturn(xmlConfig.flattenToString());
+        when(mContext.getResources()).thenReturn(mResources);
+        // Only xmlConfig is valid, deviceConfig is not.
+        when(mAssistants.queryPackageForServices(eq(null), anyInt(), eq(0)))
+                .thenReturn(Collections.singleton(xmlConfig));
+        mService.setNotificationAssistantAccessGrantedCallback(
+                mNotificationAssistantAccessGrantedCallback);
+
+        mService.setDefaultAssistantForUser(0);
+
+        verify(mNotificationAssistantAccessGrantedCallback)
+                .onGranted(eq(xmlConfig), eq(0), eq(true));
+    }
+
+    private void clearDeviceConfig() {
+        DeviceConfig.resetToDefaults(
+                Settings.RESET_MODE_PACKAGE_DEFAULTS, DeviceConfig.NAMESPACE_SYSTEMUI);
+    }
+
+    private void setDefaultAssistantInDeviceConfig(String componentName) {
+        DeviceConfig.setProperty(
+                DeviceConfig.NAMESPACE_SYSTEMUI,
+                SystemUiDeviceConfigFlags.NAS_DEFAULT_SERVICE,
+                componentName,
+                false);
+    }
 }
diff --git a/services/tests/uiservicestests/src/com/android/server/notification/NotificationRecordTest.java b/services/tests/uiservicestests/src/com/android/server/notification/NotificationRecordTest.java
index b9ae7d5..9f11472 100644
--- a/services/tests/uiservicestests/src/com/android/server/notification/NotificationRecordTest.java
+++ b/services/tests/uiservicestests/src/com/android/server/notification/NotificationRecordTest.java
@@ -56,8 +56,9 @@
 import android.provider.Settings;
 import android.service.notification.Adjustment;
 import android.service.notification.StatusBarNotification;
-import android.support.test.filters.SmallTest;
-import android.support.test.runner.AndroidJUnit4;
+
+import androidx.test.filters.SmallTest;
+import androidx.test.runner.AndroidJUnit4;
 
 import com.android.internal.R;
 import com.android.internal.logging.nano.MetricsProto.MetricsEvent;
diff --git a/services/tests/uiservicestests/src/com/android/server/notification/NotificationStatsTest.java b/services/tests/uiservicestests/src/com/android/server/notification/NotificationStatsTest.java
index bae8564..20d7a2a 100644
--- a/services/tests/uiservicestests/src/com/android/server/notification/NotificationStatsTest.java
+++ b/services/tests/uiservicestests/src/com/android/server/notification/NotificationStatsTest.java
@@ -17,7 +17,6 @@
 
 import static android.service.notification.NotificationStats.DISMISSAL_PEEK;
 import static android.service.notification.NotificationStats.DISMISS_SENTIMENT_NEGATIVE;
-import static android.service.notification.NotificationStats.DISMISS_SENTIMENT_POSITIVE;
 
 import static junit.framework.Assert.assertEquals;
 import static junit.framework.Assert.assertFalse;
@@ -25,9 +24,10 @@
 
 import android.os.Parcel;
 import android.service.notification.NotificationStats;
-import android.support.test.runner.AndroidJUnit4;
 import android.test.suitebuilder.annotation.SmallTest;
 
+import androidx.test.runner.AndroidJUnit4;
+
 import com.android.server.UiServiceTestCase;
 
 import org.junit.Test;
diff --git a/services/tests/uiservicestests/src/com/android/server/notification/NotificationTest.java b/services/tests/uiservicestests/src/com/android/server/notification/NotificationTest.java
index 55c16b3..0ea53fa 100644
--- a/services/tests/uiservicestests/src/com/android/server/notification/NotificationTest.java
+++ b/services/tests/uiservicestests/src/com/android/server/notification/NotificationTest.java
@@ -22,20 +22,18 @@
 
 import static org.junit.Assert.assertFalse;
 import static org.junit.Assert.assertTrue;
+import static org.mockito.Matchers.anyInt;
 import static org.mockito.Mockito.mock;
 import static org.mockito.Mockito.spy;
 import static org.mockito.Mockito.when;
-import static org.mockito.Matchers.any;
-import static org.mockito.Matchers.anyInt;
 
 import android.app.ActivityManager;
 import android.app.Notification;
-import android.app.Person;
 import android.app.PendingIntent;
+import android.app.Person;
 import android.app.RemoteInput;
 import android.content.Context;
 import android.content.pm.ApplicationInfo;
-import android.content.pm.PackageManager;
 import android.content.res.Resources;
 import android.graphics.Bitmap;
 import android.graphics.Color;
@@ -43,14 +41,15 @@
 import android.graphics.drawable.Icon;
 import android.net.Uri;
 import android.os.Build;
-import android.support.test.filters.SmallTest;
-import android.support.test.runner.AndroidJUnit4;
 import android.text.SpannableStringBuilder;
 import android.text.Spanned;
 import android.text.style.StyleSpan;
 import android.util.Pair;
 import android.widget.RemoteViews;
 
+import androidx.test.filters.SmallTest;
+import androidx.test.runner.AndroidJUnit4;
+
 import com.android.server.UiServiceTestCase;
 
 import org.junit.Before;
diff --git a/services/tests/uiservicestests/src/com/android/server/notification/NotifyingAppTest.java b/services/tests/uiservicestests/src/com/android/server/notification/NotifyingAppTest.java
index fbb8c33..25e10d0 100644
--- a/services/tests/uiservicestests/src/com/android/server/notification/NotifyingAppTest.java
+++ b/services/tests/uiservicestests/src/com/android/server/notification/NotifyingAppTest.java
@@ -20,9 +20,10 @@
 
 import android.os.Parcel;
 import android.service.notification.NotifyingApp;
-import android.support.test.runner.AndroidJUnit4;
 import android.test.suitebuilder.annotation.SmallTest;
 
+import androidx.test.runner.AndroidJUnit4;
+
 import com.android.server.UiServiceTestCase;
 
 import org.junit.Test;
diff --git a/services/tests/uiservicestests/src/com/android/server/notification/PreferencesHelperTest.java b/services/tests/uiservicestests/src/com/android/server/notification/PreferencesHelperTest.java
index 05bb307..39e47ec 100644
--- a/services/tests/uiservicestests/src/com/android/server/notification/PreferencesHelperTest.java
+++ b/services/tests/uiservicestests/src/com/android/server/notification/PreferencesHelperTest.java
@@ -59,13 +59,14 @@
 import android.os.UserHandle;
 import android.provider.Settings;
 import android.provider.Settings.Secure;
-import android.support.test.InstrumentationRegistry;
-import android.support.test.runner.AndroidJUnit4;
 import android.test.suitebuilder.annotation.SmallTest;
 import android.testing.TestableContentResolver;
 import android.util.ArrayMap;
 import android.util.Xml;
 
+import androidx.test.InstrumentationRegistry;
+import androidx.test.runner.AndroidJUnit4;
+
 import com.android.internal.util.FastXmlSerializer;
 import com.android.server.UiServiceTestCase;
 
diff --git a/services/tests/uiservicestests/src/com/android/server/notification/RankingHelperTest.java b/services/tests/uiservicestests/src/com/android/server/notification/RankingHelperTest.java
index b322887..2abd340 100644
--- a/services/tests/uiservicestests/src/com/android/server/notification/RankingHelperTest.java
+++ b/services/tests/uiservicestests/src/com/android/server/notification/RankingHelperTest.java
@@ -41,13 +41,13 @@
 import android.net.Uri;
 import android.os.Build;
 import android.os.UserHandle;
-import android.provider.Settings.Secure;
 import android.service.notification.StatusBarNotification;
-import android.support.test.InstrumentationRegistry;
-import android.support.test.runner.AndroidJUnit4;
 import android.test.suitebuilder.annotation.SmallTest;
 import android.testing.TestableContentResolver;
 
+import androidx.test.InstrumentationRegistry;
+import androidx.test.runner.AndroidJUnit4;
+
 import com.android.server.UiServiceTestCase;
 
 import org.junit.Before;
diff --git a/services/tests/uiservicestests/src/com/android/server/notification/RateEstimatorTest.java b/services/tests/uiservicestests/src/com/android/server/notification/RateEstimatorTest.java
index 5d8d48f1..68aa1dc 100644
--- a/services/tests/uiservicestests/src/com/android/server/notification/RateEstimatorTest.java
+++ b/services/tests/uiservicestests/src/com/android/server/notification/RateEstimatorTest.java
@@ -15,17 +15,19 @@
  */
 package com.android.server.notification;
 
-import android.support.test.runner.AndroidJUnit4;
+import static org.junit.Assert.assertFalse;
+import static org.junit.Assert.assertTrue;
+
 import android.test.suitebuilder.annotation.SmallTest;
+
+import androidx.test.runner.AndroidJUnit4;
+
+import com.android.server.UiServiceTestCase;
+
 import org.junit.Before;
 import org.junit.Test;
 import org.junit.runner.RunWith;
 
-import static org.junit.Assert.assertTrue;
-import static org.junit.Assert.assertFalse;
-
-import com.android.server.UiServiceTestCase;
-
 @SmallTest
 @RunWith(AndroidJUnit4.class)
 public class RateEstimatorTest extends UiServiceTestCase {
diff --git a/services/tests/uiservicestests/src/com/android/server/notification/ScheduleCalendarTest.java b/services/tests/uiservicestests/src/com/android/server/notification/ScheduleCalendarTest.java
index 110e3fe..042c9d9 100644
--- a/services/tests/uiservicestests/src/com/android/server/notification/ScheduleCalendarTest.java
+++ b/services/tests/uiservicestests/src/com/android/server/notification/ScheduleCalendarTest.java
@@ -23,14 +23,14 @@
 
 import android.service.notification.ScheduleCalendar;
 import android.service.notification.ZenModeConfig;
-import android.support.test.filters.FlakyTest;
-import android.support.test.runner.AndroidJUnit4;
 import android.test.suitebuilder.annotation.SmallTest;
 
+import androidx.test.filters.FlakyTest;
+import androidx.test.runner.AndroidJUnit4;
+
 import com.android.server.UiServiceTestCase;
 
 import org.junit.Before;
-import org.junit.Ignore;
 import org.junit.Test;
 import org.junit.runner.RunWith;
 
diff --git a/services/tests/uiservicestests/src/com/android/server/notification/ScheduleConditionProviderTest.java b/services/tests/uiservicestests/src/com/android/server/notification/ScheduleConditionProviderTest.java
index efa70e7..551e186 100644
--- a/services/tests/uiservicestests/src/com/android/server/notification/ScheduleConditionProviderTest.java
+++ b/services/tests/uiservicestests/src/com/android/server/notification/ScheduleConditionProviderTest.java
@@ -10,11 +10,11 @@
 import android.service.notification.Condition;
 import android.service.notification.ScheduleCalendar;
 import android.service.notification.ZenModeConfig;
-import android.support.test.filters.SmallTest;
-import android.support.test.runner.AndroidJUnit4;
 import android.testing.AndroidTestingRunner;
 import android.testing.TestableLooper.RunWithLooper;
 
+import androidx.test.filters.SmallTest;
+
 import com.android.server.UiServiceTestCase;
 
 import org.junit.Before;
diff --git a/services/tests/uiservicestests/src/com/android/server/notification/SnoozeHelperTest.java b/services/tests/uiservicestests/src/com/android/server/notification/SnoozeHelperTest.java
index 174c5fa..1e64543 100644
--- a/services/tests/uiservicestests/src/com/android/server/notification/SnoozeHelperTest.java
+++ b/services/tests/uiservicestests/src/com/android/server/notification/SnoozeHelperTest.java
@@ -15,12 +15,17 @@
  */
 package com.android.server.notification;
 
-import org.junit.Before;
-import org.junit.Test;
-import org.junit.runner.RunWith;
-import org.mockito.ArgumentCaptor;
-import org.mockito.Mock;
-import org.mockito.MockitoAnnotations;
+import static junit.framework.Assert.assertEquals;
+import static junit.framework.Assert.assertFalse;
+import static junit.framework.Assert.assertTrue;
+
+import static org.mockito.Matchers.any;
+import static org.mockito.Matchers.anyInt;
+import static org.mockito.Matchers.anyLong;
+import static org.mockito.Mockito.never;
+import static org.mockito.Mockito.times;
+import static org.mockito.Mockito.verify;
+import static org.mockito.Mockito.when;
 
 import android.app.AlarmManager;
 import android.app.Notification;
@@ -30,24 +35,19 @@
 import android.os.SystemClock;
 import android.os.UserHandle;
 import android.service.notification.StatusBarNotification;
-import android.support.test.runner.AndroidJUnit4;
 import android.test.suitebuilder.annotation.SmallTest;
 import android.util.IntArray;
 
-import static junit.framework.Assert.assertEquals;
-import static junit.framework.Assert.assertFalse;
-import static junit.framework.Assert.assertTrue;
-import static org.mockito.Matchers.any;
-import static org.mockito.Matchers.anyInt;
-import static org.mockito.Matchers.anyLong;
-import static org.mockito.Matchers.eq;
-import static org.mockito.Mockito.never;
-import static org.mockito.Mockito.times;
-import static org.mockito.Mockito.verify;
-import static org.mockito.Mockito.when;
+import androidx.test.runner.AndroidJUnit4;
 
 import com.android.server.UiServiceTestCase;
 
+import org.junit.Before;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+import org.mockito.ArgumentCaptor;
+import org.mockito.Mock;
+import org.mockito.MockitoAnnotations;
 
 @SmallTest
 @RunWith(AndroidJUnit4.class)
diff --git a/services/tests/uiservicestests/src/com/android/server/notification/ValidateNotificationPeopleTest.java b/services/tests/uiservicestests/src/com/android/server/notification/ValidateNotificationPeopleTest.java
index 025b11a..b1ee120 100644
--- a/services/tests/uiservicestests/src/com/android/server/notification/ValidateNotificationPeopleTest.java
+++ b/services/tests/uiservicestests/src/com/android/server/notification/ValidateNotificationPeopleTest.java
@@ -15,23 +15,24 @@
  */
 package com.android.server.notification;
 
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertNull;
+
 import android.app.Notification;
 import android.app.Person;
 import android.os.Bundle;
-import android.support.test.runner.AndroidJUnit4;
 import android.test.suitebuilder.annotation.SmallTest;
 import android.text.SpannableString;
 
-import java.util.ArrayList;
-import java.util.Arrays;
+import androidx.test.runner.AndroidJUnit4;
+
+import com.android.server.UiServiceTestCase;
 
 import org.junit.Test;
 import org.junit.runner.RunWith;
 
-import static org.junit.Assert.assertNull;
-import static org.junit.Assert.assertEquals;
-
-import com.android.server.UiServiceTestCase;
+import java.util.ArrayList;
+import java.util.Arrays;
 
 @SmallTest
 @RunWith(AndroidJUnit4.class)
diff --git a/services/tests/uiservicestests/src/com/android/server/notification/ZenModeConfigTest.java b/services/tests/uiservicestests/src/com/android/server/notification/ZenModeConfigTest.java
index 9c7e028..dcab78e 100644
--- a/services/tests/uiservicestests/src/com/android/server/notification/ZenModeConfigTest.java
+++ b/services/tests/uiservicestests/src/com/android/server/notification/ZenModeConfigTest.java
@@ -28,10 +28,11 @@
 import android.service.notification.ZenModeConfig;
 import android.service.notification.ZenModeConfig.EventInfo;
 import android.service.notification.ZenPolicy;
-import android.support.test.runner.AndroidJUnit4;
 import android.test.suitebuilder.annotation.SmallTest;
 import android.util.Xml;
 
+import androidx.test.runner.AndroidJUnit4;
+
 import com.android.internal.util.FastXmlSerializer;
 import com.android.server.UiServiceTestCase;
 
diff --git a/services/tests/uiservicestests/src/com/android/server/notification/ZenPolicyTest.java b/services/tests/uiservicestests/src/com/android/server/notification/ZenPolicyTest.java
index 7c6b1c1..a0ee417 100644
--- a/services/tests/uiservicestests/src/com/android/server/notification/ZenPolicyTest.java
+++ b/services/tests/uiservicestests/src/com/android/server/notification/ZenPolicyTest.java
@@ -19,14 +19,14 @@
 import static junit.framework.Assert.assertEquals;
 
 import android.service.notification.ZenPolicy;
-import android.support.test.runner.AndroidJUnit4;
 import android.test.suitebuilder.annotation.SmallTest;
 
+import androidx.test.runner.AndroidJUnit4;
+
 import com.android.server.UiServiceTestCase;
 
 import org.junit.Test;
 import org.junit.runner.RunWith;
-import org.mockito.Mock;
 
 @SmallTest
 @RunWith(AndroidJUnit4.class)
diff --git a/services/tests/uiservicestests/src/com/android/server/slice/PackageMatchingCacheTest.java b/services/tests/uiservicestests/src/com/android/server/slice/PackageMatchingCacheTest.java
index c6aea88..f6c854e 100644
--- a/services/tests/uiservicestests/src/com/android/server/slice/PackageMatchingCacheTest.java
+++ b/services/tests/uiservicestests/src/com/android/server/slice/PackageMatchingCacheTest.java
@@ -21,10 +21,11 @@
 import static org.mockito.Mockito.verify;
 import static org.mockito.Mockito.when;
 
-import android.support.test.filters.SmallTest;
 import android.testing.AndroidTestingRunner;
 import android.testing.TestableLooper.RunWithLooper;
 
+import androidx.test.filters.SmallTest;
+
 import com.android.server.UiServiceTestCase;
 import com.android.server.slice.SliceManagerService.PackageMatchingCache;
 
diff --git a/services/tests/uiservicestests/src/com/android/server/slice/PinnedSliceStateTest.java b/services/tests/uiservicestests/src/com/android/server/slice/PinnedSliceStateTest.java
index a71aca5..4c2822a 100644
--- a/services/tests/uiservicestests/src/com/android/server/slice/PinnedSliceStateTest.java
+++ b/services/tests/uiservicestests/src/com/android/server/slice/PinnedSliceStateTest.java
@@ -26,11 +26,12 @@
 import android.os.IBinder;
 import android.os.IBinder.DeathRecipient;
 import android.os.RemoteException;
-import android.support.test.filters.SmallTest;
 import android.testing.AndroidTestingRunner;
 import android.testing.TestableLooper;
 import android.testing.TestableLooper.RunWithLooper;
 
+import androidx.test.filters.SmallTest;
+
 import com.android.server.UiServiceTestCase;
 
 import org.junit.Before;
diff --git a/services/tests/uiservicestests/src/com/android/server/slice/SliceClientPermissionsTest.java b/services/tests/uiservicestests/src/com/android/server/slice/SliceClientPermissionsTest.java
index 1efa415..ff2236d 100644
--- a/services/tests/uiservicestests/src/com/android/server/slice/SliceClientPermissionsTest.java
+++ b/services/tests/uiservicestests/src/com/android/server/slice/SliceClientPermissionsTest.java
@@ -24,14 +24,15 @@
 
 import android.content.ContentResolver;
 import android.net.Uri;
-import android.support.test.filters.SmallTest;
 import android.testing.AndroidTestingRunner;
 import android.testing.TestableLooper.RunWithLooper;
 import android.util.Xml.Encoding;
 
+import androidx.test.filters.SmallTest;
+
 import com.android.server.UiServiceTestCase;
-import com.android.server.slice.SlicePermissionManager.PkgUser;
 import com.android.server.slice.SliceClientPermissions.SliceAuthority;
+import com.android.server.slice.SlicePermissionManager.PkgUser;
 
 import org.junit.Test;
 import org.junit.runner.RunWith;
diff --git a/services/tests/uiservicestests/src/com/android/server/slice/SliceFullAccessListTest.java b/services/tests/uiservicestests/src/com/android/server/slice/SliceFullAccessListTest.java
index bc28150..d942c5a 100644
--- a/services/tests/uiservicestests/src/com/android/server/slice/SliceFullAccessListTest.java
+++ b/services/tests/uiservicestests/src/com/android/server/slice/SliceFullAccessListTest.java
@@ -19,9 +19,10 @@
 import static org.junit.Assert.assertTrue;
 
 import android.os.UserHandle;
-import android.support.test.filters.SmallTest;
 import android.util.Xml.Encoding;
 
+import androidx.test.filters.SmallTest;
+
 import com.android.server.UiServiceTestCase;
 
 import org.junit.Before;
diff --git a/services/tests/uiservicestests/src/com/android/server/slice/SliceManagerServiceTest.java b/services/tests/uiservicestests/src/com/android/server/slice/SliceManagerServiceTest.java
index 6d4f5f8..7182f0f 100644
--- a/services/tests/uiservicestests/src/com/android/server/slice/SliceManagerServiceTest.java
+++ b/services/tests/uiservicestests/src/com/android/server/slice/SliceManagerServiceTest.java
@@ -34,18 +34,18 @@
 import android.app.AppOpsManager;
 import android.app.slice.SliceSpec;
 import android.app.usage.UsageStatsManagerInternal;
-import android.content.pm.PackageManagerInternal;
 import android.net.Uri;
 import android.os.Binder;
 import android.os.IBinder;
 import android.os.Process;
 import android.os.RemoteException;
-import android.support.test.filters.SmallTest;
 import android.testing.AndroidTestingRunner;
 import android.testing.TestableContext;
 import android.testing.TestableLooper;
 import android.testing.TestableLooper.RunWithLooper;
 
+import androidx.test.filters.SmallTest;
+
 import com.android.server.LocalServices;
 import com.android.server.UiServiceTestCase;
 
diff --git a/services/tests/uiservicestests/src/com/android/server/slice/SlicePermissionManagerTest.java b/services/tests/uiservicestests/src/com/android/server/slice/SlicePermissionManagerTest.java
index efefee1..1872530b 100644
--- a/services/tests/uiservicestests/src/com/android/server/slice/SlicePermissionManagerTest.java
+++ b/services/tests/uiservicestests/src/com/android/server/slice/SlicePermissionManagerTest.java
@@ -23,13 +23,14 @@
 import android.net.Uri;
 import android.net.Uri.Builder;
 import android.os.FileUtils;
-import android.support.test.filters.SmallTest;
 import android.testing.AndroidTestingRunner;
 import android.testing.TestableLooper;
 import android.testing.TestableLooper.RunWithLooper;
 import android.util.Log;
 import android.util.Xml.Encoding;
 
+import androidx.test.filters.SmallTest;
+
 import com.android.server.UiServiceTestCase;
 
 import org.junit.Test;
diff --git a/services/tests/uiservicestests/src/com/android/server/slice/SliceProviderPermissionsTest.java b/services/tests/uiservicestests/src/com/android/server/slice/SliceProviderPermissionsTest.java
index 5775991..8e61d21 100644
--- a/services/tests/uiservicestests/src/com/android/server/slice/SliceProviderPermissionsTest.java
+++ b/services/tests/uiservicestests/src/com/android/server/slice/SliceProviderPermissionsTest.java
@@ -20,11 +20,12 @@
 import static org.mockito.Mockito.mock;
 import static org.mockito.Mockito.verify;
 
-import android.support.test.filters.SmallTest;
 import android.testing.AndroidTestingRunner;
 import android.testing.TestableLooper.RunWithLooper;
 import android.util.Xml.Encoding;
 
+import androidx.test.filters.SmallTest;
+
 import com.android.server.UiServiceTestCase;
 import com.android.server.slice.SlicePermissionManager.PkgUser;
 import com.android.server.slice.SliceProviderPermissions.SliceAuthority;
diff --git a/services/tests/wmtests/src/com/android/server/wm/ActivityDisplayTests.java b/services/tests/wmtests/src/com/android/server/wm/ActivityDisplayTests.java
index 56f4a85..85e8a14 100644
--- a/services/tests/wmtests/src/com/android/server/wm/ActivityDisplayTests.java
+++ b/services/tests/wmtests/src/com/android/server/wm/ActivityDisplayTests.java
@@ -40,13 +40,19 @@
 import static org.mockito.ArgumentMatchers.eq;
 import static org.mockito.Mockito.doAnswer;
 
+import android.app.TaskStackListener;
+import android.content.pm.ActivityInfo;
+import android.os.IBinder;
 import android.platform.test.annotations.Presubmit;
 
 import androidx.test.filters.SmallTest;
 
-import org.junit.Before;
 import org.junit.Test;
 
+import java.util.ArrayList;
+import java.util.concurrent.CompletableFuture;
+import java.util.concurrent.TimeUnit;
+
 /**
  * Tests for the {@link ActivityDisplay} class.
  *
@@ -331,4 +337,45 @@
         verify(mSupervisor).removeTaskByIdLocked(eq(task1.taskId), anyBoolean(), anyBoolean(),
                 any());
     }
+
+    /**
+     * Ensures that {@link TaskStackListener} can receive callback about the activity in size
+     * compatibility mode.
+     */
+    @Test
+    public void testHandleActivitySizeCompatMode() throws Exception {
+        final ActivityDisplay display = mRootActivityContainer.getDefaultDisplay();
+        final ActivityRecord activity = createFullscreenStackWithSimpleActivityAt(
+                display).topRunningActivityLocked();
+        activity.setState(ActivityStack.ActivityState.RESUMED, "testHandleActivitySizeCompatMode");
+        activity.info.resizeMode = ActivityInfo.RESIZE_MODE_UNRESIZEABLE;
+        activity.info.screenOrientation = ActivityInfo.SCREEN_ORIENTATION_PORTRAIT;
+        activity.getTaskRecord().getConfiguration().windowConfiguration.getBounds().set(
+                0, 0, 1000, 2000);
+
+        final ArrayList<CompletableFuture<IBinder>> resultWrapper = new ArrayList<>();
+        mService.getTaskChangeNotificationController().registerTaskStackListener(
+                new TaskStackListener() {
+                    @Override
+                    public void onSizeCompatModeActivityChanged(int displayId,
+                            IBinder activityToken) {
+                        resultWrapper.get(0).complete(activityToken);
+                    }
+                });
+
+        // Expect the exact component name when the activity is in size compatible mode.
+        activity.getResolvedOverrideConfiguration().windowConfiguration.getBounds().set(
+                0, 0, 800, 1600);
+        resultWrapper.add(new CompletableFuture<>());
+        display.handleActivitySizeCompatModeIfNeeded(activity);
+
+        assertEquals(activity.appToken, resultWrapper.get(0).get(2, TimeUnit.SECONDS));
+
+        // Expect null component name when switching to non-size-compat mode activity.
+        activity.info.resizeMode = ActivityInfo.RESIZE_MODE_RESIZEABLE;
+        resultWrapper.set(0, new CompletableFuture<>());
+        display.handleActivitySizeCompatModeIfNeeded(activity);
+
+        assertNull(resultWrapper.get(0).get(2, TimeUnit.SECONDS));
+    }
 }
diff --git a/services/tests/wmtests/src/com/android/server/wm/ActivityRecordTests.java b/services/tests/wmtests/src/com/android/server/wm/ActivityRecordTests.java
index 1319bad..457d9c0 100644
--- a/services/tests/wmtests/src/com/android/server/wm/ActivityRecordTests.java
+++ b/services/tests/wmtests/src/com/android/server/wm/ActivityRecordTests.java
@@ -21,6 +21,7 @@
 import static com.android.dx.mockito.inline.extended.ExtendedMockito.any;
 import static com.android.dx.mockito.inline.extended.ExtendedMockito.anyInt;
 import static com.android.dx.mockito.inline.extended.ExtendedMockito.doAnswer;
+import static com.android.dx.mockito.inline.extended.ExtendedMockito.doNothing;
 import static com.android.dx.mockito.inline.extended.ExtendedMockito.doReturn;
 import static com.android.dx.mockito.inline.extended.ExtendedMockito.eq;
 import static com.android.dx.mockito.inline.extended.ExtendedMockito.mock;
@@ -38,6 +39,7 @@
 
 import static org.junit.Assert.assertEquals;
 import static org.junit.Assert.assertFalse;
+import static org.junit.Assert.assertNotEquals;
 import static org.junit.Assert.assertNotNull;
 import static org.junit.Assert.assertNull;
 import static org.junit.Assert.assertTrue;
@@ -171,6 +173,24 @@
     }
 
     @Test
+    public void testRestartProcessIfVisible() {
+        doNothing().when(mSupervisor).scheduleRestartTimeout(mActivity);
+        mActivity.getParent().getWindowConfiguration().setAppBounds(0, 0, 500, 1000);
+        mActivity.visible = true;
+        mActivity.haveState = false;
+        mActivity.info.resizeMode = ActivityInfo.RESIZE_MODE_UNRESIZEABLE;
+        mActivity.info.maxAspectRatio = 1.5f;
+        mActivity.setState(ActivityStack.ActivityState.RESUMED, "testRestart");
+        final Rect originalOverrideBounds = new Rect(0, 0, 400, 600);
+        mActivity.setBounds(originalOverrideBounds);
+
+        mService.restartActivityProcessIfVisible(mActivity.appToken);
+
+        assertEquals(ActivityStack.ActivityState.RESTARTING_PROCESS, mActivity.getState());
+        assertNotEquals(originalOverrideBounds, mActivity.getBounds());
+    }
+
+    @Test
     public void testsApplyOptionsLocked() {
         ActivityOptions activityOptions = ActivityOptions.makeBasic();
 
diff --git a/services/tests/wmtests/src/com/android/server/wm/ActivityStarterTests.java b/services/tests/wmtests/src/com/android/server/wm/ActivityStarterTests.java
index 606ab31..d02db7b 100644
--- a/services/tests/wmtests/src/com/android/server/wm/ActivityStarterTests.java
+++ b/services/tests/wmtests/src/com/android/server/wm/ActivityStarterTests.java
@@ -561,7 +561,7 @@
         runAndVerifyBackgroundActivityStartsSubtest("allowed_noStartsAborted", false,
                 UNIMPORTANT_UID, false, PROCESS_STATE_TOP + 1,
                 UNIMPORTANT_UID2, false, PROCESS_STATE_TOP + 1,
-                false, false, false, false, false);
+                false, false, false, false, false, false);
     }
 
     /**
@@ -576,7 +576,7 @@
                 "disallowed_unsupportedUsecase_aborted", true,
                 UNIMPORTANT_UID, false, PROCESS_STATE_TOP + 1,
                 UNIMPORTANT_UID2, false, PROCESS_STATE_TOP + 1,
-                false, false, false, false, false);
+                false, false, false, false, false, false);
     }
 
     /**
@@ -591,61 +591,66 @@
         runAndVerifyBackgroundActivityStartsSubtest("disallowed_rootUid_notAborted", false,
                 Process.ROOT_UID, false, PROCESS_STATE_TOP + 1,
                 UNIMPORTANT_UID2, false, PROCESS_STATE_TOP + 1,
-                false, false, false, false, false);
+                false, false, false, false, false, false);
         runAndVerifyBackgroundActivityStartsSubtest("disallowed_systemUid_notAborted", false,
                 Process.SYSTEM_UID, false, PROCESS_STATE_TOP + 1,
                 UNIMPORTANT_UID2, false, PROCESS_STATE_TOP + 1,
-                false, false, false, false, false);
+                false, false, false, false, false, false);
         runAndVerifyBackgroundActivityStartsSubtest("disallowed_nfcUid_notAborted", false,
                 Process.NFC_UID, false, PROCESS_STATE_TOP + 1,
                 UNIMPORTANT_UID2, false, PROCESS_STATE_TOP + 1,
-                false, false, false, false, false);
+                false, false, false, false, false, false);
         runAndVerifyBackgroundActivityStartsSubtest(
                 "disallowed_callingUidHasVisibleWindow_notAborted", false,
                 UNIMPORTANT_UID, true, PROCESS_STATE_TOP + 1,
                 UNIMPORTANT_UID2, false, PROCESS_STATE_TOP + 1,
-                false, false, false, false, false);
+                false, false, false, false, false, false);
         runAndVerifyBackgroundActivityStartsSubtest(
                 "disallowed_callingUidProcessStateTop_notAborted", false,
                 UNIMPORTANT_UID, false, PROCESS_STATE_TOP,
                 UNIMPORTANT_UID2, false, PROCESS_STATE_TOP + 1,
-                false, false, false, false, false);
+                false, false, false, false, false, false);
         runAndVerifyBackgroundActivityStartsSubtest(
                 "disallowed_realCallingUidHasVisibleWindow_notAborted", false,
                 UNIMPORTANT_UID, false, PROCESS_STATE_TOP + 1,
                 UNIMPORTANT_UID2, true, PROCESS_STATE_TOP + 1,
-                false, false, false, false, false);
+                false, false, false, false, false, false);
         runAndVerifyBackgroundActivityStartsSubtest(
                 "disallowed_realCallingUidProcessStateTop_notAborted", false,
                 UNIMPORTANT_UID, false, PROCESS_STATE_TOP + 1,
                 UNIMPORTANT_UID2, false, PROCESS_STATE_TOP,
-                false, false, false, false, false);
+                false, false, false, false, false, false);
         runAndVerifyBackgroundActivityStartsSubtest(
                 "disallowed_hasForegroundActivities_notAborted", false,
                 UNIMPORTANT_UID, false, PROCESS_STATE_TOP + 1,
                 UNIMPORTANT_UID2, false, PROCESS_STATE_TOP + 1,
-                true, false, false, false, false);
+                true, false, false, false, false, false);
         runAndVerifyBackgroundActivityStartsSubtest(
                 "disallowed_callerIsRecents_notAborted", false,
                 UNIMPORTANT_UID, false, PROCESS_STATE_TOP + 1,
                 UNIMPORTANT_UID2, false, PROCESS_STATE_TOP + 1,
-                false, true, false, false, false);
+                false, true, false, false, false, false);
         runAndVerifyBackgroundActivityStartsSubtest(
                 "disallowed_callerIsWhitelisted_notAborted", false,
                 UNIMPORTANT_UID, false, PROCESS_STATE_TOP + 1,
                 UNIMPORTANT_UID2, false, PROCESS_STATE_TOP + 1,
-                false, false, true, false, false);
+                false, false, true, false, false, false);
         runAndVerifyBackgroundActivityStartsSubtest(
                 "disallowed_callerIsInstrumentingWithBackgroundActivityStartPrivileges_notAborted",
                 false,
                 UNIMPORTANT_UID, false, PROCESS_STATE_TOP + 1,
                 UNIMPORTANT_UID2, false, PROCESS_STATE_TOP + 1,
-                false, false, false, true, false);
+                false, false, false, true, false, false);
         runAndVerifyBackgroundActivityStartsSubtest(
                 "disallowed_callingPackageNameIsDeviceOwner_notAborted", false,
                 UNIMPORTANT_UID, false, PROCESS_STATE_TOP + 1,
                 UNIMPORTANT_UID2, false, PROCESS_STATE_TOP + 1,
-                false, false, false, false, true);
+                false, false, false, false, true, false);
+        runAndVerifyBackgroundActivityStartsSubtest(
+                "disallowed_callingPackageNameIsTempWhitelisted_notAborted", false,
+                UNIMPORTANT_UID, false, PROCESS_STATE_TOP + 1,
+                UNIMPORTANT_UID2, false, PROCESS_STATE_TOP + 1,
+                false, false, false, false, false, true);
     }
 
     private void runAndVerifyBackgroundActivityStartsSubtest(String name, boolean shouldHaveAborted,
@@ -654,7 +659,7 @@
             boolean hasForegroundActivities, boolean callerIsRecents,
             boolean callerIsTempWhitelisted,
             boolean callerIsInstrumentingWithBackgroundActivityStartPrivileges,
-            boolean isCallingPackageNameDeviceOwner) {
+            boolean isCallingPackageNameDeviceOwner, boolean isCallingPackageTempWhitelisted) {
         // window visibility
         doReturn(callingUidHasVisibleWindow).when(mService.mWindowManager.mRoot)
                 .isAnyNonToastWindowVisibleForUid(callingUid);
@@ -680,11 +685,15 @@
         // caller is instrumenting with background activity starts privileges
         callerApp.setInstrumenting(callerIsInstrumentingWithBackgroundActivityStartPrivileges,
                 callerIsInstrumentingWithBackgroundActivityStartPrivileges);
-        // calling package name is whitelisted
+        // calling package name is the device owner
         doReturn(isCallingPackageNameDeviceOwner).when(mService).isDeviceOwner(any());
+        // calling package name is temporarily whitelisted
+        doReturn(isCallingPackageTempWhitelisted).when(mService)
+                .isPackageNameWhitelistedForBgActivityStarts("com.whatever.dude");
 
         final ActivityOptions options = spy(ActivityOptions.makeBasic());
         ActivityStarter starter = prepareStarter(FLAG_ACTIVITY_NEW_TASK)
+                .setCallingPackage("com.whatever.dude")
                 .setCaller(caller)
                 .setCallingUid(callingUid)
                 .setRealCallingUid(realCallingUid)
diff --git a/services/tests/wmtests/src/com/android/server/wm/AppTransitionTests.java b/services/tests/wmtests/src/com/android/server/wm/AppTransitionTests.java
index b91f3ec..6e09167 100644
--- a/services/tests/wmtests/src/com/android/server/wm/AppTransitionTests.java
+++ b/services/tests/wmtests/src/com/android/server/wm/AppTransitionTests.java
@@ -23,29 +23,29 @@
 import static android.view.WindowManager.TRANSIT_CRASHING_ACTIVITY_CLOSE;
 import static android.view.WindowManager.TRANSIT_KEYGUARD_GOING_AWAY;
 import static android.view.WindowManager.TRANSIT_KEYGUARD_UNOCCLUDE;
-
+import static androidx.test.platform.app.InstrumentationRegistry.getInstrumentation;
 import static com.android.dx.mockito.inline.extended.ExtendedMockito.anyBoolean;
 import static com.android.dx.mockito.inline.extended.ExtendedMockito.doNothing;
 import static com.android.dx.mockito.inline.extended.ExtendedMockito.spyOn;
-
 import static org.junit.Assert.assertEquals;
 import static org.junit.Assert.assertFalse;
+import static org.junit.Assert.assertNull;
 import static org.junit.Assert.assertTrue;
 
 import android.graphics.Rect;
 import android.platform.test.annotations.Presubmit;
 import android.view.Display;
 
-import androidx.test.filters.SmallTest;
-
 import org.junit.Before;
 import org.junit.Test;
 
+import androidx.test.filters.SmallTest;
+
 /**
  * Test class for {@link AppTransition}.
  *
  * Build/Install/Run:
- *  atest FrameworksServicesTests:AppTransitionTests
+ *  atest WmTests:AppTransitionTests
  */
 @SmallTest
 @Presubmit
@@ -167,4 +167,11 @@
         assertFalse(dc1.mOpeningApps.contains(token1));
     }
 
+    @Test
+    public void testLoadAnimationSafely() {
+        DisplayContent dc = createNewDisplay(Display.STATE_ON);
+        assertNull(dc.mAppTransition.loadAnimationSafely(
+                getInstrumentation().getTargetContext(), -1));
+    }
+
 }
diff --git a/services/tests/wmtests/src/com/android/server/wm/AppWindowTokenTests.java b/services/tests/wmtests/src/com/android/server/wm/AppWindowTokenTests.java
index 2c575f5..68b40b9 100644
--- a/services/tests/wmtests/src/com/android/server/wm/AppWindowTokenTests.java
+++ b/services/tests/wmtests/src/com/android/server/wm/AppWindowTokenTests.java
@@ -18,11 +18,11 @@
 
 import static android.app.WindowConfiguration.WINDOWING_MODE_FREEFORM;
 import static android.app.WindowConfiguration.WINDOWING_MODE_SPLIT_SCREEN_SECONDARY;
-import static android.content.ActivityInfoProto.SCREEN_ORIENTATION_UNSPECIFIED;
 import static android.content.pm.ActivityInfo.SCREEN_ORIENTATION_BEHIND;
 import static android.content.pm.ActivityInfo.SCREEN_ORIENTATION_LANDSCAPE;
 import static android.content.pm.ActivityInfo.SCREEN_ORIENTATION_REVERSE_LANDSCAPE;
 import static android.content.pm.ActivityInfo.SCREEN_ORIENTATION_UNSET;
+import static android.content.pm.ActivityInfo.SCREEN_ORIENTATION_UNSPECIFIED;
 import static android.view.WindowManager.LayoutParams.FIRST_APPLICATION_WINDOW;
 import static android.view.WindowManager.LayoutParams.FIRST_SUB_WINDOW;
 import static android.view.WindowManager.LayoutParams.FLAG_DISMISS_KEYGUARD;
@@ -42,12 +42,16 @@
 import static org.junit.Assert.assertNotNull;
 import static org.junit.Assert.assertNull;
 import static org.junit.Assert.assertTrue;
+import static org.mockito.ArgumentMatchers.any;
 import static org.mockito.ArgumentMatchers.anyInt;
+import static org.mockito.Mockito.RETURNS_DEEP_STUBS;
+import static org.mockito.Mockito.verify;
 
 import android.content.res.Configuration;
 import android.graphics.Point;
 import android.graphics.Rect;
 import android.platform.test.annotations.Presubmit;
+import android.view.Display;
 import android.view.Surface;
 import android.view.WindowManager;
 
@@ -55,6 +59,7 @@
 
 import org.junit.Before;
 import org.junit.Test;
+import org.mockito.Mockito;
 
 /**
  * Tests for the {@link AppWindowToken} class.
@@ -332,6 +337,46 @@
     }
 
     @Test
+    public void testReportOrientationChangeOnVisibilityChange() {
+        synchronized (mWm.mGlobalLock) {
+            mToken.setOrientation(SCREEN_ORIENTATION_LANDSCAPE);
+
+            mDisplayContent.getDisplayRotation().setFixedToUserRotation(
+                    DisplayRotation.FIXED_TO_USER_ROTATION_ENABLED);
+
+            doReturn(Configuration.ORIENTATION_LANDSCAPE).when(mToken.mActivityRecord)
+                    .getRequestedConfigurationOrientation();
+
+            mTask.mTaskRecord = Mockito.mock(TaskRecord.class, RETURNS_DEEP_STUBS);
+            mToken.commitVisibility(null, false /* visible */, TRANSIT_UNSET,
+                    true /* performLayout */, false /* isVoiceInteraction */);
+        }
+
+        verify(mTask.mTaskRecord).onConfigurationChanged(any(Configuration.class));
+    }
+
+    @Test
+    public void testReportOrientationChangeOnOpeningClosingAppChange() {
+        synchronized (mWm.mGlobalLock) {
+            mToken.setOrientation(SCREEN_ORIENTATION_LANDSCAPE);
+
+            mDisplayContent.getDisplayRotation().setFixedToUserRotation(
+                    DisplayRotation.FIXED_TO_USER_ROTATION_ENABLED);
+            mDisplayContent.getDisplayInfo().state = Display.STATE_ON;
+            mDisplayContent.prepareAppTransition(WindowManager.TRANSIT_ACTIVITY_CLOSE,
+                    false /* alwaysKeepCurrent */, 0 /* flags */, true /* forceOverride */);
+
+            doReturn(Configuration.ORIENTATION_LANDSCAPE).when(mToken.mActivityRecord)
+                    .getRequestedConfigurationOrientation();
+
+            mTask.mTaskRecord = Mockito.mock(TaskRecord.class, RETURNS_DEEP_STUBS);
+            mToken.setVisibility(false, false);
+        }
+
+        verify(mTask.mTaskRecord).onConfigurationChanged(any(Configuration.class));
+    }
+
+    @Test
     public void testCreateRemoveStartingWindow() {
         mToken.addStartingWindow(mPackageName,
                 android.R.style.Theme, null, "Test", 0, 0, 0, 0, null, true, true, false, true,
diff --git a/services/tests/wmtests/src/com/android/server/wm/RecentsAnimationControllerTest.java b/services/tests/wmtests/src/com/android/server/wm/RecentsAnimationControllerTest.java
index 763ea62..a03d28b 100644
--- a/services/tests/wmtests/src/com/android/server/wm/RecentsAnimationControllerTest.java
+++ b/services/tests/wmtests/src/com/android/server/wm/RecentsAnimationControllerTest.java
@@ -40,7 +40,6 @@
 import android.view.IRecentsAnimationRunner;
 import android.view.SurfaceControl;
 
-import androidx.test.filters.FlakyTest;
 import androidx.test.filters.SmallTest;
 
 import com.android.server.wm.SurfaceAnimator.OnAnimationFinishedCallback;
@@ -113,7 +112,6 @@
     }
 
     @Test
-    @FlakyTest(bugId = 117117823)
     public void testIncludedApps_expectTargetAndVisible() {
         mWm.setRecentsAnimationController(mController);
         final AppWindowToken homeAppWindow = createAppWindowToken(mDisplayContent,
diff --git a/services/tests/wmtests/src/com/android/server/wm/SurfaceAnimationRunnerTest.java b/services/tests/wmtests/src/com/android/server/wm/SurfaceAnimationRunnerTest.java
index 6cce9f0..c483489 100644
--- a/services/tests/wmtests/src/com/android/server/wm/SurfaceAnimationRunnerTest.java
+++ b/services/tests/wmtests/src/com/android/server/wm/SurfaceAnimationRunnerTest.java
@@ -213,7 +213,8 @@
         final Animation a = new TranslateAnimation(-10, 10, 0, 0);
         a.initialize(0, 0, 0, 0);
         a.setDuration(50);
-        return new WindowAnimationSpec(a, new Point(0, 0), false /* canSkipFirstFrame */);
+        return new WindowAnimationSpec(a, new Point(0, 0), false /* canSkipFirstFrame */,
+                0 /* windowCornerRadius */);
     }
 
     /**
diff --git a/services/tests/wmtests/src/com/android/server/wm/TaskLaunchParamsModifierTests.java b/services/tests/wmtests/src/com/android/server/wm/TaskLaunchParamsModifierTests.java
index ace179a..cdbb121 100644
--- a/services/tests/wmtests/src/com/android/server/wm/TaskLaunchParamsModifierTests.java
+++ b/services/tests/wmtests/src/com/android/server/wm/TaskLaunchParamsModifierTests.java
@@ -29,13 +29,11 @@
 import static android.util.DisplayMetrics.DENSITY_DEFAULT;
 import static android.view.Display.DEFAULT_DISPLAY;
 
-import static com.android.dx.mockito.inline.extended.ExtendedMockito.when;
 import static com.android.server.wm.LaunchParamsController.LaunchParamsModifier.RESULT_CONTINUE;
 import static com.android.server.wm.LaunchParamsController.LaunchParamsModifier.RESULT_SKIP;
 
 import static org.junit.Assert.assertEquals;
 import static org.junit.Assert.assertTrue;
-import static org.mockito.ArgumentMatchers.any;
 
 import android.app.ActivityOptions;
 import android.content.pm.ActivityInfo;
@@ -474,6 +472,22 @@
     }
 
     @Test
+    public void testUsesFullscreenWhenRequestedOnFreeformDisplay() {
+        final TestActivityDisplay freeformDisplay = createNewActivityDisplay(
+                WINDOWING_MODE_FREEFORM);
+
+        final ActivityOptions options = ActivityOptions.makeBasic();
+        options.setLaunchDisplayId(freeformDisplay.mDisplayId);
+        options.setLaunchWindowingMode(WINDOWING_MODE_FULLSCREEN);
+
+        assertEquals(RESULT_CONTINUE, mTarget.onCalculate(/* task */ null, /* layout */ null,
+                mActivity, /* source */ null, options, mCurrent, mResult));
+
+        assertEquivalentWindowingMode(WINDOWING_MODE_FULLSCREEN, mResult.mWindowingMode,
+                WINDOWING_MODE_FREEFORM);
+    }
+
+    @Test
     public void testUsesFreeformByDefaultForPostNApp() {
         final TestActivityDisplay freeformDisplay = createNewActivityDisplay(
                 WINDOWING_MODE_FREEFORM);
diff --git a/services/tests/wmtests/src/com/android/server/wm/TaskRecordTests.java b/services/tests/wmtests/src/com/android/server/wm/TaskRecordTests.java
index 5d07888..dc307b5 100644
--- a/services/tests/wmtests/src/com/android/server/wm/TaskRecordTests.java
+++ b/services/tests/wmtests/src/com/android/server/wm/TaskRecordTests.java
@@ -47,6 +47,7 @@
 import android.graphics.Rect;
 import android.platform.test.annotations.Presubmit;
 import android.service.voice.IVoiceInteractionSession;
+import android.util.DisplayMetrics;
 import android.util.Xml;
 import android.view.DisplayInfo;
 
@@ -166,6 +167,44 @@
                 WINDOWING_MODE_FREEFORM, mParentBounds, insetBounds, insetBounds);
     }
 
+    @Test
+    public void testFitWithinBounds() {
+        final Rect parentBounds = new Rect(10, 10, 200, 200);
+        ActivityDisplay display = mService.mRootActivityContainer.getDefaultDisplay();
+        ActivityStack stack = display.createStack(WINDOWING_MODE_FREEFORM, ACTIVITY_TYPE_STANDARD,
+                true /* onTop */);
+        TaskRecord task = new TaskBuilder(mSupervisor).setStack(stack).build();
+        final Configuration parentConfig = stack.getConfiguration();
+        parentConfig.windowConfiguration.setBounds(parentBounds);
+        parentConfig.densityDpi = DisplayMetrics.DENSITY_DEFAULT;
+
+        // check top and left
+        Rect reqBounds = new Rect(-190, -190, 0, 0);
+        task.setBounds(reqBounds);
+        // Make sure part of it is exposed
+        assertTrue(task.getBounds().right > parentBounds.left);
+        assertTrue(task.getBounds().bottom > parentBounds.top);
+        // Should still be more-or-less in that corner
+        assertTrue(task.getBounds().left <= parentBounds.left);
+        assertTrue(task.getBounds().top <= parentBounds.top);
+
+        assertEquals(reqBounds.width(), task.getBounds().width());
+        assertEquals(reqBounds.height(), task.getBounds().height());
+
+        // check bottom and right
+        reqBounds = new Rect(210, 210, 400, 400);
+        task.setBounds(reqBounds);
+        // Make sure part of it is exposed
+        assertTrue(task.getBounds().left < parentBounds.right);
+        assertTrue(task.getBounds().top < parentBounds.bottom);
+        // Should still be more-or-less in that corner
+        assertTrue(task.getBounds().right >= parentBounds.right);
+        assertTrue(task.getBounds().bottom >= parentBounds.bottom);
+
+        assertEquals(reqBounds.width(), task.getBounds().width());
+        assertEquals(reqBounds.height(), task.getBounds().height());
+    }
+
     /** Tests that the task bounds adjust properly to changes between FULLSCREEN and FREEFORM */
     @Test
     public void testBoundsOnModeChangeFreeformToFullscreen() {
diff --git a/services/tests/wmtests/src/com/android/server/wm/TaskStackChangedListenerTest.java b/services/tests/wmtests/src/com/android/server/wm/TaskStackChangedListenerTest.java
index 42a205a..b140da5 100644
--- a/services/tests/wmtests/src/com/android/server/wm/TaskStackChangedListenerTest.java
+++ b/services/tests/wmtests/src/com/android/server/wm/TaskStackChangedListenerTest.java
@@ -100,7 +100,6 @@
     }
 
     @Test
-    @FlakyTest(detail = "Promote to presubmit when shown to be stable.")
     public void testTaskDescriptionChanged() throws Exception {
         final Object[] params = new Object[2];
         final CountDownLatch latch = new CountDownLatch(1);
@@ -133,7 +132,6 @@
     }
 
     @Test
-    @FlakyTest(detail = "Promote to presubmit when shown to be stable.")
     public void testActivityRequestedOrientationChanged() throws Exception {
         final int[] params = new int[2];
         final CountDownLatch latch = new CountDownLatch(1);
@@ -214,6 +212,7 @@
 
         // Test for onTaskRemovalStarted.
         assertEquals(1, taskRemovalStartedLatch.getCount());
+        assertEquals(1, taskRemovedLatch.getCount());
         activity.finishAndRemoveTask();
         waitForCallback(taskRemovalStartedLatch);
         // onTaskRemovalStarted happens before the activity's window is removed.
@@ -221,7 +220,6 @@
         assertEquals(id, params[0]);
 
         // Test for onTaskRemoved.
-        assertEquals(1, taskRemovedLatch.getCount());
         waitForCallback(taskRemovedLatch);
         assertEquals(id, params[0]);
         waitForCallback(onDetachedFromWindowLatch);
diff --git a/services/tests/wmtests/src/com/android/server/wm/WindowAnimationSpecTest.java b/services/tests/wmtests/src/com/android/server/wm/WindowAnimationSpecTest.java
index 9a825e0..897f0a2 100644
--- a/services/tests/wmtests/src/com/android/server/wm/WindowAnimationSpecTest.java
+++ b/services/tests/wmtests/src/com/android/server/wm/WindowAnimationSpecTest.java
@@ -24,6 +24,8 @@
 
 import static org.mockito.ArgumentMatchers.argThat;
 import static org.mockito.ArgumentMatchers.eq;
+import static org.mockito.Mockito.never;
+import static org.mockito.Mockito.when;
 
 import android.graphics.Point;
 import android.graphics.Rect;
@@ -56,7 +58,7 @@
         Animation a = createClipRectAnimation(windowCrop, windowCrop);
         WindowAnimationSpec windowAnimationSpec = new WindowAnimationSpec(a, null,
                 mStackBounds, false /* canSkipFirstFrame */, STACK_CLIP_NONE,
-                true /* isAppAnimation */);
+                true /* isAppAnimation */, 0 /* windowCornerRadius */);
         windowAnimationSpec.apply(mTransaction, mSurfaceControl, 0);
         verify(mTransaction).setWindowCrop(eq(mSurfaceControl),
                 argThat(rect -> rect.equals(windowCrop)));
@@ -66,7 +68,7 @@
     public void testApply_clipAfter() {
         WindowAnimationSpec windowAnimationSpec = new WindowAnimationSpec(mAnimation, null,
                 mStackBounds, false /* canSkipFirstFrame */, STACK_CLIP_AFTER_ANIM,
-                true /* isAppAnimation */);
+                true /* isAppAnimation */, 0 /* windowCornerRadius */);
         windowAnimationSpec.apply(mTransaction, mSurfaceControl, 0);
         verify(mTransaction).setWindowCrop(eq(mSurfaceControl), argThat(Rect::isEmpty));
     }
@@ -76,8 +78,7 @@
         // Stack bounds is (0, 0, 10, 10) position is (20, 40)
         WindowAnimationSpec windowAnimationSpec = new WindowAnimationSpec(mAnimation,
                 new Point(20, 40), mStackBounds, false /* canSkipFirstFrame */,
-                STACK_CLIP_AFTER_ANIM,
-                true /* isAppAnimation */);
+                STACK_CLIP_AFTER_ANIM, true /* isAppAnimation */, 0 /* windowCornerRadius */);
         windowAnimationSpec.apply(mTransaction, mSurfaceControl, 0);
         verify(mTransaction).setWindowCrop(eq(mSurfaceControl), argThat(Rect::isEmpty));
     }
@@ -87,7 +88,7 @@
         // Stack bounds is (0, 0, 10, 10) animation clip is (0, 0, 0, 0)
         WindowAnimationSpec windowAnimationSpec = new WindowAnimationSpec(mAnimation, null,
                 mStackBounds, false /* canSkipFirstFrame */, STACK_CLIP_BEFORE_ANIM,
-                true /* isAppAnimation */);
+                true /* isAppAnimation */, 0 /* windowCornerRadius */);
         windowAnimationSpec.apply(mTransaction, mSurfaceControl, 0);
         verify(mTransaction).setWindowCrop(eq(mSurfaceControl),
                 argThat(rect -> rect.equals(mStackBounds)));
@@ -101,19 +102,32 @@
         a.initialize(0, 0, 0, 0);
         WindowAnimationSpec windowAnimationSpec = new WindowAnimationSpec(a, null,
                 null, false /* canSkipFirstFrame */, STACK_CLIP_BEFORE_ANIM,
-                true /* isAppAnimation */);
+                true /* isAppAnimation */, 0 /* windowCornerRadius */);
         windowAnimationSpec.apply(mTransaction, mSurfaceControl, 0);
         verify(mTransaction).setWindowCrop(eq(mSurfaceControl), argThat(Rect::isEmpty));
     }
 
     @Test
+    public void testApply_setCornerRadius() {
+        final float windowCornerRadius = 30f;
+        WindowAnimationSpec windowAnimationSpec = new WindowAnimationSpec(mAnimation, null,
+                mStackBounds, false /* canSkipFirstFrame */, STACK_CLIP_BEFORE_ANIM,
+                true /* isAppAnimation */, windowCornerRadius);
+        windowAnimationSpec.apply(mTransaction, mSurfaceControl, 0);
+        verify(mTransaction, never()).setCornerRadius(eq(mSurfaceControl), eq(windowCornerRadius));
+        when(mAnimation.hasRoundedCorners()).thenReturn(true);
+        windowAnimationSpec.apply(mTransaction, mSurfaceControl, 0);
+        verify(mTransaction).setCornerRadius(eq(mSurfaceControl), eq(windowCornerRadius));
+    }
+
+    @Test
     public void testApply_clipBeforeSmallerAnimationClip() {
         // Stack bounds is (0, 0, 10, 10) animation clip is (0, 0, 5, 5)
         Rect windowCrop = new Rect(0, 0, 5, 5);
         Animation a = createClipRectAnimation(windowCrop, windowCrop);
         WindowAnimationSpec windowAnimationSpec = new WindowAnimationSpec(a, null,
                 mStackBounds, false /* canSkipFirstFrame */, STACK_CLIP_BEFORE_ANIM,
-                true /* isAppAnimation */);
+                true /* isAppAnimation */, 0 /* windowCornerRadius */);
         windowAnimationSpec.apply(mTransaction, mSurfaceControl, 0);
         verify(mTransaction).setWindowCrop(eq(mSurfaceControl),
                 argThat(rect -> rect.equals(windowCrop)));
@@ -126,7 +140,7 @@
         Animation a = createClipRectAnimation(windowCrop, windowCrop);
         WindowAnimationSpec windowAnimationSpec = new WindowAnimationSpec(a, null,
                 mStackBounds, false /* canSkipFirstFrame */, STACK_CLIP_BEFORE_ANIM,
-                true /* isAppAnimation */);
+                true /* isAppAnimation */, 0 /* windowCornerRadius */);
         windowAnimationSpec.apply(mTransaction, mSurfaceControl, 0);
         verify(mTransaction).setWindowCrop(eq(mSurfaceControl),
                 argThat(rect -> rect.equals(mStackBounds)));
diff --git a/services/tests/wmtests/src/com/android/server/wm/WindowFrameTests.java b/services/tests/wmtests/src/com/android/server/wm/WindowFrameTests.java
index 61c1d39..2ccdb9e 100644
--- a/services/tests/wmtests/src/com/android/server/wm/WindowFrameTests.java
+++ b/services/tests/wmtests/src/com/android/server/wm/WindowFrameTests.java
@@ -17,6 +17,7 @@
 package com.android.server.wm;
 
 import static android.app.WindowConfiguration.ACTIVITY_TYPE_STANDARD;
+import static android.app.WindowConfiguration.WINDOWING_MODE_FREEFORM;
 import static android.app.WindowConfiguration.WINDOWING_MODE_FULLSCREEN;
 import static android.view.DisplayCutout.BOUNDS_POSITION_TOP;
 import static android.view.DisplayCutout.fromBoundingRect;
@@ -41,6 +42,7 @@
 
 import org.junit.Before;
 import org.junit.Test;
+import org.mockito.Mockito;
 
 /**
  * Tests for the {@link WindowState#computeFrameLw} method and other window frame machinery.
@@ -78,17 +80,22 @@
     }
 
     private static class TaskWithBounds extends Task {
-        final Rect mBounds;
+        Rect mBounds;
         final Rect mOverrideDisplayedBounds = new Rect();
         boolean mFullscreenForTest = true;
 
         TaskWithBounds(TaskStack stack, WindowManagerService wm, Rect bounds) {
             super(0, stack, 0, wm, 0, false, new TaskDescription(), null);
-            mBounds = bounds;
             setBounds(bounds);
         }
 
         @Override
+        public int setBounds(Rect bounds) {
+            mBounds = bounds;
+            return super.setBounds(bounds);
+        }
+
+        @Override
         public Rect getBounds() {
             return mBounds;
         }
@@ -513,6 +520,66 @@
         assertEquals(w.getWmDisplayCutout().getDisplayCutout().getSafeInsetRight(), 0);
     }
 
+    @Test
+    public void testFreeformContentInsets() {
+        // fullscreen task doesn't use bounds for computeFrame
+        final Task task = new TaskWithBounds(mStubStack, mWm, null);
+        WindowState w = createWindow(task, MATCH_PARENT, MATCH_PARENT);
+        w.mAttrs.gravity = Gravity.LEFT | Gravity.TOP;
+        task.setWindowingMode(WINDOWING_MODE_FREEFORM);
+        ((TaskWithBounds) task).mFullscreenForTest = false;
+        w.setWindowingMode(WINDOWING_MODE_FREEFORM);
+
+        DisplayContent dc = mWm.getDefaultDisplayContentLocked();
+        dc.mInputMethodTarget = w;
+        WindowState mockIme = mock(WindowState.class);
+        Mockito.doReturn(true).when(mockIme).isVisibleNow();
+        dc.mInputMethodWindow = mockIme;
+
+        // With no insets or system decor all the frames incoming from PhoneWindowManager
+        // are identical.
+        final Rect pf = new Rect(0, 0, 1000, 800);
+        final Rect df = pf;
+        final Rect of = df;
+        final Rect cf = new Rect(pf);
+        cf.bottom -= 400;
+        final Rect vf = new Rect(cf);
+        final Rect sf = new Rect(pf);
+        final Rect dcf = pf;
+
+        // First check that it only gets moved up enough to show window.
+        final Rect winRect = new Rect(200, 200, 300, 500);
+
+        task.setBounds(winRect);
+        w.setBounds(winRect);
+        w.getWindowFrames().setFrames(pf, df, of, cf, vf, dcf, sf, mEmptyRect);
+        w.computeFrameLw();
+
+        final Rect expected = new Rect(winRect.left, cf.bottom - winRect.height(),
+                winRect.right, cf.bottom);
+        assertEquals(expected, w.getFrameLw());
+        assertEquals(expected, w.getContentFrameLw());
+        assertEquals(expected, w.getVisibleFrameLw());
+
+        // Now check that it won't get moved beyond the top and then has appropriate insets
+        winRect.bottom = 600;
+        task.setBounds(winRect);
+        w.setBounds(winRect);
+        w.getWindowFrames().setFrames(pf, df, of, cf, vf, dcf, sf, mEmptyRect);
+        w.computeFrameLw();
+
+        assertFrame(w, winRect.left, 0, winRect.right, winRect.height());
+        expected.top = 0;
+        expected.bottom = cf.bottom;
+        assertContentFrame(w, expected);
+        assertVisibleFrame(w, expected);
+
+        // Check that it's moved back without ime insets
+        w.getWindowFrames().setFrames(pf, df, of, pf, pf, dcf, sf, mEmptyRect);
+        w.computeFrameLw();
+        assertEquals(winRect, w.getFrameLw());
+    }
+
     private WindowStateWithTask createWindow(Task task, int width, int height) {
         final WindowManager.LayoutParams attrs = new WindowManager.LayoutParams(TYPE_APPLICATION);
         attrs.width = width;
diff --git a/services/tests/wmtests/src/com/android/server/wm/WindowTestUtils.java b/services/tests/wmtests/src/com/android/server/wm/WindowTestUtils.java
index da1defa..0dec8ee 100644
--- a/services/tests/wmtests/src/com/android/server/wm/WindowTestUtils.java
+++ b/services/tests/wmtests/src/com/android/server/wm/WindowTestUtils.java
@@ -82,6 +82,8 @@
             }, new ComponentName("", ""), false, dc, true /* fillsParent */);
             mTargetSdk = Build.VERSION_CODES.CUR_DEVELOPMENT;
             mSkipOnParentChanged = skipOnParentChanged;
+            mActivityRecord = mock(ActivityRecord.class);
+            mActivityRecord.app = mock(WindowProcessController.class);
         }
 
         int getWindowsCount() {
diff --git a/services/tests/wmtests/src/com/android/server/wm/WindowTestsBase.java b/services/tests/wmtests/src/com/android/server/wm/WindowTestsBase.java
index d202e16..032eba1 100644
--- a/services/tests/wmtests/src/com/android/server/wm/WindowTestsBase.java
+++ b/services/tests/wmtests/src/com/android/server/wm/WindowTestsBase.java
@@ -270,7 +270,7 @@
     WindowTestUtils.TestAppWindowToken createTestAppWindowToken(DisplayContent dc, int
             windowingMode, int activityType) {
         return createTestAppWindowToken(dc, windowingMode, activityType,
-                true /*skipOnParentChanged */);
+                false /*skipOnParentChanged */);
     }
 
     WindowTestUtils.TestAppWindowToken createTestAppWindowToken(DisplayContent dc, int
diff --git a/services/tests/wmtests/src/com/android/server/wm/WindowTracingTest.java b/services/tests/wmtests/src/com/android/server/wm/WindowTracingTest.java
index 8358fdd..e3691c6 100644
--- a/services/tests/wmtests/src/com/android/server/wm/WindowTracingTest.java
+++ b/services/tests/wmtests/src/com/android/server/wm/WindowTracingTest.java
@@ -20,6 +20,7 @@
 
 import static com.android.dx.mockito.inline.extended.ExtendedMockito.doAnswer;
 import static com.android.dx.mockito.inline.extended.ExtendedMockito.mock;
+import static com.android.dx.mockito.inline.extended.ExtendedMockito.times;
 import static com.android.dx.mockito.inline.extended.ExtendedMockito.verify;
 import static com.android.dx.mockito.inline.extended.ExtendedMockito.verifyZeroInteractions;
 
@@ -124,7 +125,7 @@
     public void trace_dumpsWindowManagerState_whenTracing() throws Exception {
         mWindowTracing.startTrace(mock(PrintWriter.class));
         mWindowTracing.logState("where");
-        verify(mWmMock).writeToProtoLocked(any(), eq(WindowTraceLogLevel.TRIM));
+        verify(mWmMock, times(2)).writeToProtoLocked(any(), eq(WindowTraceLogLevel.TRIM));
     }
 
     @Test
diff --git a/services/tests/wmtests/src/com/android/server/wm/ZOrderingTests.java b/services/tests/wmtests/src/com/android/server/wm/ZOrderingTests.java
index 2907021..2fc6efa 100644
--- a/services/tests/wmtests/src/com/android/server/wm/ZOrderingTests.java
+++ b/services/tests/wmtests/src/com/android/server/wm/ZOrderingTests.java
@@ -74,7 +74,7 @@
         public SurfaceControl.Transaction setLayer(SurfaceControl sc, int layer) {
             mRelativeLayersForControl.remove(sc);
             mLayersForControl.put(sc, layer);
-            return super.setLayer(sc, layer);
+            return this;
         }
 
         @Override
@@ -83,7 +83,7 @@
                 int layer) {
             mRelativeLayersForControl.put(sc, relativeTo);
             mLayersForControl.put(sc, layer);
-            return super.setRelativeLayer(sc, relativeTo, layer);
+            return this;
         }
 
         private int getLayer(SurfaceControl sc) {
diff --git a/services/usage/java/com/android/server/usage/AppIdleHistory.java b/services/usage/java/com/android/server/usage/AppIdleHistory.java
index bc54a5d..1e4861a 100644
--- a/services/usage/java/com/android/server/usage/AppIdleHistory.java
+++ b/services/usage/java/com/android/server/usage/AppIdleHistory.java
@@ -508,6 +508,16 @@
                 Integer.toString(userId)), APP_IDLE_FILENAME);
     }
 
+
+    /**
+     * Check if App Idle File exists on disk
+     * @param userId
+     * @return true if file exists
+     */
+    public boolean userFileExists(int userId) {
+        return getUserFile(userId).exists();
+    }
+
     private void readAppIdleTimes(int userId, ArrayMap<String, AppUsageHistory> userHistory) {
         FileInputStream fis = null;
         try {
diff --git a/services/usage/java/com/android/server/usage/AppStandbyController.java b/services/usage/java/com/android/server/usage/AppStandbyController.java
index 65ed85d..4b33e16 100644
--- a/services/usage/java/com/android/server/usage/AppStandbyController.java
+++ b/services/usage/java/com/android/server/usage/AppStandbyController.java
@@ -35,6 +35,7 @@
 import static android.app.usage.UsageStatsManager.REASON_SUB_USAGE_SYNC_ADAPTER;
 import static android.app.usage.UsageStatsManager.REASON_SUB_USAGE_SYSTEM_INTERACTION;
 import static android.app.usage.UsageStatsManager.REASON_SUB_USAGE_SYSTEM_UPDATE;
+import static android.app.usage.UsageStatsManager.REASON_SUB_USAGE_UNEXEMPTED_SYNC_SCHEDULED;
 import static android.app.usage.UsageStatsManager.REASON_SUB_USAGE_USER_INTERACTION;
 import static android.app.usage.UsageStatsManager.STANDBY_BUCKET_ACTIVE;
 import static android.app.usage.UsageStatsManager.STANDBY_BUCKET_EXEMPTED;
@@ -197,7 +198,7 @@
     static final int MSG_ONE_TIME_CHECK_IDLE_STATES = 10;
     /** Check the state of one app: arg1 = userId, arg2 = uid, obj = (String) packageName */
     static final int MSG_CHECK_PACKAGE_IDLE_STATE = 11;
-    static final int MSG_REPORT_EXEMPTED_SYNC_SCHEDULED = 12;
+    static final int MSG_REPORT_SYNC_SCHEDULED = 12;
     static final int MSG_REPORT_EXEMPTED_SYNC_START = 13;
     static final int MSG_UPDATE_STABLE_CHARGING= 14;
 
@@ -231,6 +232,10 @@
      * Maximum time an exempted sync should keep the buckets elevated, when sync is started.
      */
     long mExemptedSyncStartTimeoutMillis;
+    /**
+     * Maximum time an unexempted sync should keep the buckets elevated, when sync is scheduled
+     */
+    long mUnexemptedSyncScheduledTimeoutMillis;
     /** Maximum time a system interaction should keep the buckets elevated. */
     long mSystemInteractionTimeoutMillis;
     /** The length of time phone must be charging before considered stable enough to run jobs  */
@@ -372,7 +377,12 @@
 
             mSystemServicesReady = true;
 
-            if (mPendingInitializeDefaults) {
+            boolean userFileExists;
+            synchronized (mAppIdleLock) {
+                userFileExists = mAppIdleHistory.userFileExists(UserHandle.USER_SYSTEM);
+            }
+
+            if (mPendingInitializeDefaults || !userFileExists) {
                 initializeDefaultsForSystemApps(UserHandle.USER_SYSTEM);
             }
 
@@ -447,6 +457,25 @@
         }
     }
 
+    void reportUnexemptedSyncScheduled(String packageName, int userId) {
+        if (!mAppIdleEnabled) return;
+
+        final long elapsedRealtime = mInjector.elapsedRealtime();
+        synchronized (mAppIdleLock) {
+            final int currentBucket =
+                    mAppIdleHistory.getAppStandbyBucket(packageName, userId, elapsedRealtime);
+            if (currentBucket == STANDBY_BUCKET_NEVER) {
+                // Bring the app out of the never bucket
+                AppUsageHistory appUsage = mAppIdleHistory.reportUsage(packageName, userId,
+                        STANDBY_BUCKET_WORKING_SET, REASON_SUB_USAGE_UNEXEMPTED_SYNC_SCHEDULED,
+                        0,
+                        elapsedRealtime + mUnexemptedSyncScheduledTimeoutMillis);
+                maybeInformListeners(packageName, userId, elapsedRealtime,
+                        appUsage.currentBucket, appUsage.bucketingReason, false);
+            }
+        }
+    }
+
     void reportExemptedSyncStart(String packageName, int userId) {
         if (!mAppIdleEnabled) return;
 
@@ -1411,6 +1440,8 @@
                             elapsedRealtime + mSystemUpdateUsageTimeoutMillis);
                 }
             }
+            // Immediately persist defaults to disk
+            mAppIdleHistory.writeAppIdleTimes(userId);
         }
     }
 
@@ -1423,8 +1454,8 @@
                 .sendToTarget();
     }
 
-    void postReportExemptedSyncScheduled(String packageName, int userId) {
-        mHandler.obtainMessage(MSG_REPORT_EXEMPTED_SYNC_SCHEDULED, userId, 0, packageName)
+    void postReportSyncScheduled(String packageName, int userId, boolean exempted) {
+        mHandler.obtainMessage(MSG_REPORT_SYNC_SCHEDULED, userId, exempted ? 1 : 0, packageName)
                 .sendToTarget();
     }
 
@@ -1492,6 +1523,9 @@
         pw.print("  mExemptedSyncStartTimeoutMillis=");
         TimeUtils.formatDuration(mExemptedSyncStartTimeoutMillis, pw);
         pw.println();
+        pw.print("  mUnexemptedSyncScheduledTimeoutMillis=");
+        TimeUtils.formatDuration(mUnexemptedSyncScheduledTimeoutMillis, pw);
+        pw.println();
 
         pw.print("  mSystemUpdateUsageTimeoutMillis=");
         TimeUtils.formatDuration(mSystemUpdateUsageTimeoutMillis, pw);
@@ -1706,8 +1740,13 @@
                             mInjector.elapsedRealtime());
                     break;
 
-                case MSG_REPORT_EXEMPTED_SYNC_SCHEDULED:
-                    reportExemptedSyncScheduled((String) msg.obj, msg.arg1);
+                case MSG_REPORT_SYNC_SCHEDULED:
+                    final boolean exempted = msg.arg1 > 0 ? true : false;
+                    if (exempted) {
+                        reportExemptedSyncScheduled((String) msg.obj, msg.arg1);
+                    } else {
+                        reportUnexemptedSyncScheduled((String) msg.obj, msg.arg1);
+                    }
                     break;
 
                 case MSG_REPORT_EXEMPTED_SYNC_START:
@@ -1799,12 +1838,14 @@
                 "system_update_usage_duration";
         private static final String KEY_PREDICTION_TIMEOUT = "prediction_timeout";
         private static final String KEY_SYNC_ADAPTER_HOLD_DURATION = "sync_adapter_duration";
-        private static final String KEY_EXEMPTED_SYNC_SCHEDULED_NON_DOZE_HOLD_DURATION
-                = "exempted_sync_scheduled_nd_duration";
-        private static final String KEY_EXEMPTED_SYNC_SCHEDULED_DOZE_HOLD_DURATION
-                = "exempted_sync_scheduled_d_duration";
-        private static final String KEY_EXEMPTED_SYNC_START_HOLD_DURATION
-                = "exempted_sync_start_duration";
+        private static final String KEY_EXEMPTED_SYNC_SCHEDULED_NON_DOZE_HOLD_DURATION =
+                "exempted_sync_scheduled_nd_duration";
+        private static final String KEY_EXEMPTED_SYNC_SCHEDULED_DOZE_HOLD_DURATION =
+                "exempted_sync_scheduled_d_duration";
+        private static final String KEY_EXEMPTED_SYNC_START_HOLD_DURATION =
+                "exempted_sync_start_duration";
+        private static final String KEY_UNEXEMPTED_SYNC_SCHEDULED_HOLD_DURATION =
+                "unexempted_sync_scheduled_duration";
         private static final String KEY_SYSTEM_INTERACTION_HOLD_DURATION =
                 "system_interaction_duration";
         private static final String KEY_STABLE_CHARGING_THRESHOLD = "stable_charging_threshold";
@@ -1816,6 +1857,7 @@
         public static final long DEFAULT_EXEMPTED_SYNC_SCHEDULED_NON_DOZE_TIMEOUT = 10 * ONE_MINUTE;
         public static final long DEFAULT_EXEMPTED_SYNC_SCHEDULED_DOZE_TIMEOUT = 4 * ONE_HOUR;
         public static final long DEFAULT_EXEMPTED_SYNC_START_TIMEOUT = 10 * ONE_MINUTE;
+        public static final long DEFAULT_UNEXEMPTED_SYNC_SCHEDULED_TIMEOUT = 10 * ONE_MINUTE;
         public static final long DEFAULT_STABLE_CHARGING_THRESHOLD = 10 * ONE_MINUTE;
 
         private final KeyValueListParser mParser = new KeyValueListParser(',');
@@ -1883,42 +1925,47 @@
                         ELAPSED_TIME_THRESHOLDS);
                 mCheckIdleIntervalMillis = Math.min(mAppStandbyElapsedThresholds[1] / 4,
                         COMPRESS_TIME ? ONE_MINUTE : 4 * 60 * ONE_MINUTE); // 4 hours
-                mStrongUsageTimeoutMillis = mParser.getDurationMillis
-                        (KEY_STRONG_USAGE_HOLD_DURATION,
+                mStrongUsageTimeoutMillis = mParser.getDurationMillis(
+                        KEY_STRONG_USAGE_HOLD_DURATION,
                                 COMPRESS_TIME ? ONE_MINUTE : DEFAULT_STRONG_USAGE_TIMEOUT);
-                mNotificationSeenTimeoutMillis = mParser.getDurationMillis
-                        (KEY_NOTIFICATION_SEEN_HOLD_DURATION,
+                mNotificationSeenTimeoutMillis = mParser.getDurationMillis(
+                        KEY_NOTIFICATION_SEEN_HOLD_DURATION,
                                 COMPRESS_TIME ? 12 * ONE_MINUTE : DEFAULT_NOTIFICATION_TIMEOUT);
-                mSystemUpdateUsageTimeoutMillis = mParser.getDurationMillis
-                        (KEY_SYSTEM_UPDATE_HOLD_DURATION,
+                mSystemUpdateUsageTimeoutMillis = mParser.getDurationMillis(
+                        KEY_SYSTEM_UPDATE_HOLD_DURATION,
                                 COMPRESS_TIME ? 2 * ONE_MINUTE : DEFAULT_SYSTEM_UPDATE_TIMEOUT);
-                mPredictionTimeoutMillis = mParser.getDurationMillis
-                        (KEY_PREDICTION_TIMEOUT,
+                mPredictionTimeoutMillis = mParser.getDurationMillis(
+                        KEY_PREDICTION_TIMEOUT,
                                 COMPRESS_TIME ? 10 * ONE_MINUTE : DEFAULT_PREDICTION_TIMEOUT);
-                mSyncAdapterTimeoutMillis = mParser.getDurationMillis
-                        (KEY_SYNC_ADAPTER_HOLD_DURATION,
+                mSyncAdapterTimeoutMillis = mParser.getDurationMillis(
+                        KEY_SYNC_ADAPTER_HOLD_DURATION,
                                 COMPRESS_TIME ? ONE_MINUTE : DEFAULT_SYNC_ADAPTER_TIMEOUT);
 
-                mExemptedSyncScheduledNonDozeTimeoutMillis = mParser.getDurationMillis
-                        (KEY_EXEMPTED_SYNC_SCHEDULED_NON_DOZE_HOLD_DURATION,
+                mExemptedSyncScheduledNonDozeTimeoutMillis = mParser.getDurationMillis(
+                        KEY_EXEMPTED_SYNC_SCHEDULED_NON_DOZE_HOLD_DURATION,
                                 COMPRESS_TIME ? (ONE_MINUTE / 2)
                                         : DEFAULT_EXEMPTED_SYNC_SCHEDULED_NON_DOZE_TIMEOUT);
 
-                mExemptedSyncScheduledDozeTimeoutMillis = mParser.getDurationMillis
-                        (KEY_EXEMPTED_SYNC_SCHEDULED_DOZE_HOLD_DURATION,
+                mExemptedSyncScheduledDozeTimeoutMillis = mParser.getDurationMillis(
+                        KEY_EXEMPTED_SYNC_SCHEDULED_DOZE_HOLD_DURATION,
                                 COMPRESS_TIME ? ONE_MINUTE
                                         : DEFAULT_EXEMPTED_SYNC_SCHEDULED_DOZE_TIMEOUT);
 
-                mExemptedSyncStartTimeoutMillis = mParser.getDurationMillis
-                        (KEY_EXEMPTED_SYNC_START_HOLD_DURATION,
+                mExemptedSyncStartTimeoutMillis = mParser.getDurationMillis(
+                        KEY_EXEMPTED_SYNC_START_HOLD_DURATION,
                                 COMPRESS_TIME ? ONE_MINUTE
                                         : DEFAULT_EXEMPTED_SYNC_START_TIMEOUT);
 
-                mSystemInteractionTimeoutMillis = mParser.getDurationMillis
-                        (KEY_SYSTEM_INTERACTION_HOLD_DURATION,
+                mUnexemptedSyncScheduledTimeoutMillis = mParser.getDurationMillis(
+                        KEY_EXEMPTED_SYNC_SCHEDULED_DOZE_HOLD_DURATION,
+                                COMPRESS_TIME ? ONE_MINUTE
+                                        : DEFAULT_UNEXEMPTED_SYNC_SCHEDULED_TIMEOUT); // TODO
+
+                mSystemInteractionTimeoutMillis = mParser.getDurationMillis(
+                        KEY_SYSTEM_INTERACTION_HOLD_DURATION,
                                 COMPRESS_TIME ? ONE_MINUTE : DEFAULT_SYSTEM_INTERACTION_TIMEOUT);
-                mStableChargingThresholdMillis = mParser.getDurationMillis
-                        (KEY_STABLE_CHARGING_THRESHOLD,
+                mStableChargingThresholdMillis = mParser.getDurationMillis(
+                        KEY_STABLE_CHARGING_THRESHOLD,
                                 COMPRESS_TIME ? ONE_MINUTE : DEFAULT_STABLE_CHARGING_THRESHOLD);
             }
 
diff --git a/services/usage/java/com/android/server/usage/AppTimeLimitController.java b/services/usage/java/com/android/server/usage/AppTimeLimitController.java
index 731cbf4..f3d6387 100644
--- a/services/usage/java/com/android/server/usage/AppTimeLimitController.java
+++ b/services/usage/java/com/android/server/usage/AppTimeLimitController.java
@@ -511,8 +511,10 @@
 
     class AppUsageLimitGroup extends UsageGroup {
         public AppUsageLimitGroup(UserData user, ObserverAppData observerApp, int observerId,
-                String[] observed, long timeLimitMs, PendingIntent limitReachedCallback) {
+                String[] observed, long timeLimitMs, long timeRemainingMs,
+                PendingIntent limitReachedCallback) {
             super(user, observerApp, observerId, observed, timeLimitMs, limitReachedCallback);
+            mUsageTimeMs = timeLimitMs - timeRemainingMs;
         }
 
         @Override
@@ -839,9 +841,9 @@
      * Existing app usage limit observer with the same observerId will be removed.
      */
     public void addAppUsageLimitObserver(int requestingUid, int observerId, String[] observed,
-            long timeLimit, PendingIntent callbackIntent, @UserIdInt int userId) {
-        // Allow the special case of the limit being 0, but with no callback.
-        if (timeLimit != 0L && timeLimit < getMinTimeLimit()) {
+            long timeLimit, long timeRemaining, PendingIntent callbackIntent,
+            @UserIdInt int userId) {
+        if (timeLimit < getMinTimeLimit()) {
             throw new IllegalArgumentException("Time limit must be >= " + getMinTimeLimit());
         }
         synchronized (mLock) {
@@ -859,7 +861,7 @@
                         "Too many app usage observers added by uid " + requestingUid);
             }
             group = new AppUsageLimitGroup(user, observerApp, observerId, observed, timeLimit,
-                    timeLimit == 0L ? null : callbackIntent);
+                    timeRemaining, timeRemaining == 0L ? null : callbackIntent);
             observerApp.appUsageLimitGroups.append(observerId, group);
 
             if (DEBUG) {
diff --git a/services/usage/java/com/android/server/usage/UsageStatsDatabase.java b/services/usage/java/com/android/server/usage/UsageStatsDatabase.java
index 4756fb4..485a79d 100644
--- a/services/usage/java/com/android/server/usage/UsageStatsDatabase.java
+++ b/services/usage/java/com/android/server/usage/UsageStatsDatabase.java
@@ -27,6 +27,7 @@
 import android.util.TimeUtils;
 
 import com.android.internal.annotations.VisibleForTesting;
+import com.android.internal.util.IndentingPrintWriter;
 
 import libcore.io.IoUtils;
 
@@ -1246,4 +1247,36 @@
         }
         directory.delete();
     }
+
+    /**
+     * print total number and list of stats files for each interval type.
+     * @param pw
+     */
+    public void dump(IndentingPrintWriter pw, boolean compact) {
+        synchronized (mLock) {
+            pw.println("UsageStatsDatabase:");
+            pw.increaseIndent();
+            for (int i = 0; i < mSortedStatFiles.length; i++) {
+                final TimeSparseArray<AtomicFile> files = mSortedStatFiles[i];
+                final int size = files.size();
+                pw.print(UserUsageStatsService.intervalToString(i));
+                pw.print(" stats files: ");
+                pw.print(size);
+                pw.println(", sorted list of files:");
+                pw.increaseIndent();
+                for (int f = 0; f < size; f++) {
+                    final long fileName = files.keyAt(f);
+                    if (compact) {
+                        pw.print(UserUsageStatsService.formatDateTime(fileName, false));
+                    } else {
+                        pw.printPair(Long.toString(fileName),
+                                UserUsageStatsService.formatDateTime(fileName, true));
+                    }
+                    pw.println();
+                }
+                pw.decreaseIndent();
+            }
+            pw.decreaseIndent();
+        }
+    }
 }
diff --git a/services/usage/java/com/android/server/usage/UsageStatsService.java b/services/usage/java/com/android/server/usage/UsageStatsService.java
index ebb0210..27fdbcb 100644
--- a/services/usage/java/com/android/server/usage/UsageStatsService.java
+++ b/services/usage/java/com/android/server/usage/UsageStatsService.java
@@ -1399,7 +1399,8 @@
 
         @Override
         public void registerAppUsageLimitObserver(int observerId, String[] packages,
-                long timeLimitMs, PendingIntent callbackIntent, String callingPackage) {
+                long timeLimitMs, long timeRemainingMs, PendingIntent callbackIntent,
+                String callingPackage) {
             if (!hasPermissions(callingPackage,
                     Manifest.permission.SUSPEND_APPS, Manifest.permission.OBSERVE_APP_USAGE)) {
                 throw new SecurityException("Caller doesn't have both SUSPEND_APPS and "
@@ -1409,7 +1410,11 @@
             if (packages == null || packages.length == 0) {
                 throw new IllegalArgumentException("Must specify at least one package");
             }
-            if (callbackIntent == null && timeLimitMs != 0L) {
+            if (timeRemainingMs > timeLimitMs) {
+                throw new IllegalArgumentException(
+                        "Remaining time can't be greater than total time.");
+            }
+            if (callbackIntent == null && timeRemainingMs != 0L) {
                 throw new NullPointerException("callbackIntent can't be null");
             }
             final int callingUid = Binder.getCallingUid();
@@ -1417,7 +1422,7 @@
             final long token = Binder.clearCallingIdentity();
             try {
                 UsageStatsService.this.registerAppUsageLimitObserver(callingUid, observerId,
-                        packages, timeLimitMs, callbackIntent, userId);
+                        packages, timeLimitMs, timeRemainingMs, callbackIntent, userId);
             } finally {
                 Binder.restoreCallingIdentity(token);
             }
@@ -1545,9 +1550,9 @@
     }
 
     void registerAppUsageLimitObserver(int callingUid, int observerId, String[] packages,
-            long timeLimitMs, PendingIntent callbackIntent, int userId) {
-        mAppTimeLimit.addAppUsageLimitObserver(callingUid, observerId, packages, timeLimitMs,
-                callbackIntent, userId);
+            long timeLimitMs, long timeRemainingMs, PendingIntent callbackIntent, int userId) {
+        mAppTimeLimit.addAppUsageLimitObserver(callingUid, observerId, packages,
+                timeLimitMs, timeRemainingMs, callbackIntent, userId);
     }
 
     void unregisterAppUsageLimitObserver(int callingUid, int observerId, int userId) {
@@ -1751,8 +1756,8 @@
         }
 
         @Override
-        public void reportExemptedSyncScheduled(String packageName, int userId) {
-            mAppStandby.postReportExemptedSyncScheduled(packageName, userId);
+        public void reportSyncScheduled(String packageName, int userId, boolean exempted) {
+            mAppStandby.postReportSyncScheduled(packageName, userId, exempted);
         }
 
         @Override
diff --git a/services/usage/java/com/android/server/usage/UserUsageStatsService.java b/services/usage/java/com/android/server/usage/UserUsageStatsService.java
index ebd8e36..9498e16 100644
--- a/services/usage/java/com/android/server/usage/UserUsageStatsService.java
+++ b/services/usage/java/com/android/server/usage/UserUsageStatsService.java
@@ -17,6 +17,7 @@
 package com.android.server.usage;
 
 import static android.app.usage.UsageEvents.Event.DEVICE_SHUTDOWN;
+import static android.app.usage.UsageEvents.Event.DEVICE_STARTUP;
 import static android.app.usage.UsageStatsManager.INTERVAL_BEST;
 import static android.app.usage.UsageStatsManager.INTERVAL_COUNT;
 import static android.app.usage.UsageStatsManager.INTERVAL_DAILY;
@@ -137,15 +138,18 @@
 
         // During system reboot, add a DEVICE_SHUTDOWN event to the end of event list, the timestamp
         // is last time UsageStatsDatabase is persisted to disk.
+        // Also add a DEVICE_STARTUP event with current system timestamp.
         final IntervalStats currentDailyStats = mCurrentStats[INTERVAL_DAILY];
         if (currentDailyStats != null) {
-            final int size = currentDailyStats.events.size();
-            if (size == 0 || currentDailyStats.events.get(size - 1).mEventType != DEVICE_SHUTDOWN) {
-                // The last event in event list is not DEVICE_SHUTDOWN, then we insert one.
-                final Event event = new Event(DEVICE_SHUTDOWN, currentDailyStats.lastTimeSaved);
-                event.mPackage = Event.DEVICE_EVENT_PACKAGE_NAME;
-                currentDailyStats.addEvent(event);
-            }
+            // File system timestamp only has precision of 1 second, add 1000ms to make up
+            // for the loss of round up.
+            final Event shutdownEvent =
+                    new Event(DEVICE_SHUTDOWN, currentDailyStats.lastTimeSaved + 1000);
+            shutdownEvent.mPackage = Event.DEVICE_EVENT_PACKAGE_NAME;
+            currentDailyStats.addEvent(shutdownEvent);
+            final Event startupEvent = new Event(DEVICE_STARTUP, currentTimeMillis);
+            startupEvent.mPackage = Event.DEVICE_EVENT_PACKAGE_NAME;
+            currentDailyStats.addEvent(startupEvent);
         }
 
         if (mDatabase.isNewUpdate()) {
@@ -658,9 +662,10 @@
             pw.println(" stats");
             printIntervalStats(pw, mCurrentStats[interval], !compact, true, pkg);
         }
+        mDatabase.dump(pw, compact);
     }
 
-    private String formatDateTime(long dateTime, boolean pretty) {
+    static String formatDateTime(long dateTime, boolean pretty) {
         if (pretty) {
             return "\"" + sDateFormat.format(dateTime)+ "\"";
         }
@@ -888,7 +893,7 @@
         pw.decreaseIndent();
     }
 
-    private static String intervalToString(int interval) {
+    public static String intervalToString(int interval) {
         switch (interval) {
             case INTERVAL_DAILY:
                 return "daily";
@@ -955,6 +960,8 @@
                 return "KEYGUARD_HIDDEN";
             case Event.DEVICE_SHUTDOWN:
                 return "DEVICE_SHUTDOWN";
+            case Event.DEVICE_STARTUP:
+                return "DEVICE_STARTUP";
             default:
                 return "UNKNOWN_TYPE_" + eventType;
         }
diff --git a/services/voiceinteraction/java/com/android/server/voiceinteraction/VoiceInteractionManagerService.java b/services/voiceinteraction/java/com/android/server/voiceinteraction/VoiceInteractionManagerService.java
index b9440eb..ad1e3ef 100644
--- a/services/voiceinteraction/java/com/android/server/voiceinteraction/VoiceInteractionManagerService.java
+++ b/services/voiceinteraction/java/com/android/server/voiceinteraction/VoiceInteractionManagerService.java
@@ -1389,6 +1389,16 @@
                         resetCurAssistant(userHandle);
                         initForUser(userHandle);
                         switchImplementationIfNeededLocked(true);
+
+                        Context context = getContext();
+                        context.getSystemService(RoleManager.class).clearRoleHoldersAsUser(
+                                RoleManager.ROLE_ASSISTANT, 0, UserHandle.of(userHandle),
+                                context.getMainExecutor(), successful -> {
+                                    if (!successful) {
+                                        Slog.e(TAG,
+                                                "Failed to clear default assistant for force stop");
+                                    }
+                                });
                     }
                 } else if (hitRec && doit) {
                     // We are just force-stopping the current recognizer, which is not
diff --git a/services/voiceinteraction/java/com/android/server/voiceinteraction/VoiceInteractionSessionConnection.java b/services/voiceinteraction/java/com/android/server/voiceinteraction/VoiceInteractionSessionConnection.java
index 57729b5..1bf0723 100644
--- a/services/voiceinteraction/java/com/android/server/voiceinteraction/VoiceInteractionSessionConnection.java
+++ b/services/voiceinteraction/java/com/android/server/voiceinteraction/VoiceInteractionSessionConnection.java
@@ -16,9 +16,6 @@
 
 package com.android.server.voiceinteraction;
 
-import static com.android.server.wm.ActivityTaskManagerInternal.ASSIST_KEY_CONTENT;
-import static com.android.server.wm.ActivityTaskManagerInternal.ASSIST_KEY_DATA;
-import static com.android.server.wm.ActivityTaskManagerInternal.ASSIST_KEY_STRUCTURE;
 import static android.app.AppOpsManager.OP_ASSIST_SCREENSHOT;
 import static android.app.AppOpsManager.OP_ASSIST_STRUCTURE;
 import static android.content.Intent.FLAG_GRANT_READ_URI_PERMISSION;
@@ -26,6 +23,10 @@
 import static android.view.Display.DEFAULT_DISPLAY;
 import static android.view.WindowManager.LayoutParams.TYPE_VOICE_INTERACTION;
 
+import static com.android.server.wm.ActivityTaskManagerInternal.ASSIST_KEY_CONTENT;
+import static com.android.server.wm.ActivityTaskManagerInternal.ASSIST_KEY_DATA;
+import static com.android.server.wm.ActivityTaskManagerInternal.ASSIST_KEY_STRUCTURE;
+
 import android.app.ActivityManager;
 import android.app.ActivityTaskManager;
 import android.app.AppOpsManager;
@@ -256,7 +257,10 @@
             final Bundle assistData = data.getBundle(ASSIST_KEY_DATA);
             final AssistStructure structure = data.getParcelable(ASSIST_KEY_STRUCTURE);
             final AssistContent content = data.getParcelable(ASSIST_KEY_CONTENT);
-            final int uid = data.getInt(Intent.EXTRA_ASSIST_UID, -1);
+            int uid = -1;
+            if (assistData != null) {
+                uid = assistData.getInt(Intent.EXTRA_ASSIST_UID, -1);
+            }
             if (uid >= 0 && content != null) {
                 Intent intent = content.getIntent();
                 if (intent != null) {
diff --git a/startop/iorap/tests/Android.bp b/startop/iorap/tests/Android.bp
index 5ac4a46..4359978 100644
--- a/startop/iorap/tests/Android.bp
+++ b/startop/iorap/tests/Android.bp
@@ -29,7 +29,7 @@
 
       // test android dependencies
       "platform-test-annotations",
-      "android-support-test",
+      "androidx.test.rules",
       // test framework dependencies
       "mockito-target-inline-minus-junit4",
       // "mockito-target-minus-junit4",
diff --git a/startop/iorap/tests/AndroidManifest.xml b/startop/iorap/tests/AndroidManifest.xml
index 99f4add..b967e72 100644
--- a/startop/iorap/tests/AndroidManifest.xml
+++ b/startop/iorap/tests/AndroidManifest.xml
@@ -22,7 +22,7 @@
 
     <!--suppress AndroidDomInspection -->
     <instrumentation
-        android:name="android.support.test.runner.AndroidJUnitRunner"
+        android:name="androidx.test.runner.AndroidJUnitRunner"
         android:targetPackage="com.google.android.startop.iorap.tests" />
 
       <!--
diff --git a/startop/iorap/tests/AndroidTest.xml b/startop/iorap/tests/AndroidTest.xml
index 919154d..bcd1103 100644
--- a/startop/iorap/tests/AndroidTest.xml
+++ b/startop/iorap/tests/AndroidTest.xml
@@ -44,7 +44,7 @@
 
     <test class="com.android.tradefed.testtype.AndroidJUnitTest" >
         <option name="package" value="com.google.android.startop.iorap.tests" />
-        <option name="runner" value="android.support.test.runner.AndroidJUnitRunner" />
+        <option name="runner" value="androidx.test.runner.AndroidJUnitRunner" />
     </test>
 </configuration>
 
diff --git a/startop/iorap/tests/src/com/google/android/startop/iorap/IIorapIntegrationTest.kt b/startop/iorap/tests/src/com/google/android/startop/iorap/IIorapIntegrationTest.kt
index 16dcbe2..b1e6194 100644
--- a/startop/iorap/tests/src/com/google/android/startop/iorap/IIorapIntegrationTest.kt
+++ b/startop/iorap/tests/src/com/google/android/startop/iorap/IIorapIntegrationTest.kt
@@ -14,12 +14,14 @@
 
 package com.google.android.startop.iorap
 
-import android.net.Uri
 import android.os.ServiceManager
-import android.support.test.filters.MediumTest
+import androidx.test.filters.MediumTest
 import org.junit.Test
-import org.junit.Ignore
-import org.mockito.Mockito.*
+import org.mockito.Mockito.argThat
+import org.mockito.Mockito.eq
+import org.mockito.Mockito.inOrder
+import org.mockito.Mockito.spy
+import org.mockito.Mockito.timeout
 
 // @Ignore("Test is disabled until iorapd is added to init and there's selinux policies for it")
 @MediumTest
@@ -27,7 +29,7 @@
     /**
      * @throws ServiceManager.ServiceNotFoundException if iorapd service could not be found
      */
-    private val iorapService : IIorap by lazy {
+    private val iorapService: IIorap by lazy {
         // TODO: connect to 'iorapd.stub' which doesn't actually do any work other than reply.
         IIorap.Stub.asInterface(ServiceManager.getServiceOrThrow("iorapd"))
 
@@ -39,7 +41,7 @@
 
     // A dummy binder stub implementation is required to use with mockito#spy.
     // Mockito overrides the methods at runtime and tracks how methods were invoked.
-    open class DummyTaskListener : ITaskListener.Stub()  {
+    open class DummyTaskListener : ITaskListener.Stub() {
         // Note: make parameters nullable to avoid the kotlin IllegalStateExceptions
         // from using the mockito matchers (eq, argThat, etc).
         override fun onProgress(requestId: RequestId?, result: TaskResult?) {
@@ -49,7 +51,7 @@
         }
     }
 
-    private fun testAnyMethod(func : (RequestId) -> Unit) {
+    private fun testAnyMethod(func: (RequestId) -> Unit) {
         val taskListener = spy(DummyTaskListener())!!
 
         try {
@@ -68,14 +70,13 @@
 
             // The "stub" behavior of iorapd is that every request immediately gets a response of
             //   BEGAN,ONGOING,COMPLETED
-            inOrder.verify(taskListener, timeout(100)).
-                  onProgress(eq(requestId), argThat { it!!.state == TaskResult.STATE_BEGAN })
-            inOrder.verify(taskListener, timeout(100)).
-                  onProgress(eq(requestId), argThat { it!!.state == TaskResult.STATE_ONGOING })
-            inOrder.verify(taskListener, timeout(100)).
-                  onComplete(eq(requestId), argThat { it!!.state == TaskResult.STATE_COMPLETED })
+            inOrder.verify(taskListener, timeout(100))
+                .onProgress(eq(requestId), argThat { it!!.state == TaskResult.STATE_BEGAN })
+            inOrder.verify(taskListener, timeout(100))
+                .onProgress(eq(requestId), argThat { it!!.state == TaskResult.STATE_ONGOING })
+            inOrder.verify(taskListener, timeout(100))
+                .onComplete(eq(requestId), argThat { it!!.state == TaskResult.STATE_COMPLETED })
             inOrder.verifyNoMoreInteractions()
-
         } finally {
             // iorapService.setTaskListener(null)
             // FIXME: null is broken, C++ side sees a non-null object.
@@ -96,7 +97,7 @@
 
     @Test
     fun testOnAppIntentEvent() {
-        testAnyMethod { requestId : RequestId ->
+        testAnyMethod { requestId: RequestId ->
             iorapService.onAppIntentEvent(requestId, AppIntentEvent.createDefaultIntentChanged(
                     ActivityInfo("dont care", "dont care"),
                     ActivityInfo("dont care 2", "dont care 2")))
@@ -105,7 +106,7 @@
 
     @Test
     fun testOnSystemServiceEvent() {
-        testAnyMethod { requestId : RequestId ->
+        testAnyMethod { requestId: RequestId ->
             iorapService.onSystemServiceEvent(requestId,
                     SystemServiceEvent(SystemServiceEvent.TYPE_START))
         }
@@ -113,9 +114,9 @@
 
     @Test
     fun testOnSystemServiceUserEvent() {
-        testAnyMethod { requestId : RequestId ->
+        testAnyMethod { requestId: RequestId ->
             iorapService.onSystemServiceUserEvent(requestId,
-                    SystemServiceUserEvent(SystemServiceUserEvent.TYPE_START_USER,0))
+                    SystemServiceUserEvent(SystemServiceUserEvent.TYPE_START_USER, 0))
         }
     }
 }
diff --git a/startop/iorap/tests/src/com/google/android/startop/iorap/ParcelablesTest.kt b/startop/iorap/tests/src/com/google/android/startop/iorap/ParcelablesTest.kt
index 4abbb3e..8fa0cde 100644
--- a/startop/iorap/tests/src/com/google/android/startop/iorap/ParcelablesTest.kt
+++ b/startop/iorap/tests/src/com/google/android/startop/iorap/ParcelablesTest.kt
@@ -17,7 +17,7 @@
 import android.net.Uri
 import android.os.Parcel
 import android.os.Parcelable
-import android.support.test.filters.SmallTest
+import androidx.test.filters.SmallTest
 import org.junit.Test
 import org.junit.runner.RunWith
 import com.google.common.truth.Truth.assertThat
@@ -29,7 +29,7 @@
  */
 @SmallTest
 @RunWith(Parameterized::class)
-class ParcelablesTest<T : Parcelable>(private val inputData : InputData<T>) {
+class ParcelablesTest<T : Parcelable>(private val inputData: InputData<T>) {
     companion object {
         private val initialRequestId = RequestId.nextValueForSequence()!!
 
@@ -73,19 +73,19 @@
                         TaskResult(TaskResult.STATE_ONGOING))
         )
 
-        private fun newActivityInfo() : ActivityInfo {
+        private fun newActivityInfo(): ActivityInfo {
             return ActivityInfo("some package", "some activity")
         }
 
-        private fun newActivityInfoOther() : ActivityInfo {
+        private fun newActivityInfoOther(): ActivityInfo {
             return ActivityInfo("some package 2", "some activity 2")
         }
 
-        private fun newUri() : Uri {
+        private fun newUri(): Uri {
             return Uri.parse("https://www.google.com")
         }
 
-        private fun cloneRequestId(requestId: RequestId) : RequestId {
+        private fun cloneRequestId(requestId: RequestId): RequestId {
             val constructor = requestId::class.java.declaredConstructors[0]
             constructor.isAccessible = true
             return constructor.newInstance(requestId.requestId) as RequestId
@@ -108,7 +108,7 @@
     @Test
     fun testParcelRoundTrip() {
         // calling writeToParcel and then T::CREATOR.createFromParcel would return the same data.
-        val assertParcels = { it : T, data : InputData<T> ->
+        val assertParcels = { it: T, data: InputData<T> ->
             val parcel = Parcel.obtain()
             it.writeToParcel(parcel, 0)
             parcel.setDataPosition(0) // future reads will see all previous writes.
@@ -121,7 +121,7 @@
         assertParcels(inputData.validOther, inputData)
     }
 
-    data class InputData<T : Parcelable>(val valid : T, val validCopy : T, val validOther : T) {
+    data class InputData<T : Parcelable>(val valid: T, val validCopy: T, val validOther: T) {
         val kls = valid.javaClass
         init {
             assertThat(valid).isNotSameAs(validCopy)
@@ -130,8 +130,8 @@
             assertThat(validOther.javaClass).isEqualTo(valid.javaClass)
         }
 
-        fun createFromParcel(parcel : Parcel) : T {
-            val field  = kls.getDeclaredField("CREATOR")
+        fun createFromParcel(parcel: Parcel): T {
+            val field = kls.getDeclaredField("CREATOR")
             val creator = field.get(null) as Parcelable.Creator<T>
 
             return creator.createFromParcel(parcel)
diff --git a/startop/view_compiler/dex_builder_test/Android.bp b/startop/view_compiler/dex_builder_test/Android.bp
index ac60e96..22a3cfa 100644
--- a/startop/view_compiler/dex_builder_test/Android.bp
+++ b/startop/view_compiler/dex_builder_test/Android.bp
@@ -43,7 +43,7 @@
     sdk_version: "current",
     data: [":generate_dex_testcases", ":generate_compiled_layout1", ":generate_compiled_layout2"],
     static_libs: [
-        "android-support-test",
+        "androidx.test.rules",
         "guava",
     ],
     manifest: "AndroidManifest.xml",
diff --git a/startop/view_compiler/dex_builder_test/AndroidManifest.xml b/startop/view_compiler/dex_builder_test/AndroidManifest.xml
index 6ac5fc5..b335663 100644
--- a/startop/view_compiler/dex_builder_test/AndroidManifest.xml
+++ b/startop/view_compiler/dex_builder_test/AndroidManifest.xml
@@ -22,7 +22,7 @@
         <uses-library android:name="android.test.runner" />
     </application>
 
-    <instrumentation android:name="android.support.test.runner.AndroidJUnitRunner"
+    <instrumentation android:name="androidx.test.runner.AndroidJUnitRunner"
                      android:targetPackage="android.startop.test"
                      android:label="DexBuilder Tests"/>
 
diff --git a/startop/view_compiler/dex_builder_test/AndroidTest.xml b/startop/view_compiler/dex_builder_test/AndroidTest.xml
index 92e2a71..82509b9 100644
--- a/startop/view_compiler/dex_builder_test/AndroidTest.xml
+++ b/startop/view_compiler/dex_builder_test/AndroidTest.xml
@@ -31,6 +31,6 @@
 
     <test class="com.android.tradefed.testtype.AndroidJUnitTest" >
         <option name="package" value="android.startop.test" />
-        <option name="runner" value="android.support.test.runner.AndroidJUnitRunner" />
+        <option name="runner" value="androidx.test.runner.AndroidJUnitRunner" />
     </test>
 </configuration>
diff --git a/startop/view_compiler/dex_builder_test/src/android/startop/test/DexBuilderTest.java b/startop/view_compiler/dex_builder_test/src/android/startop/test/DexBuilderTest.java
index 42d4161..f7b1674 100644
--- a/startop/view_compiler/dex_builder_test/src/android/startop/test/DexBuilderTest.java
+++ b/startop/view_compiler/dex_builder_test/src/android/startop/test/DexBuilderTest.java
@@ -14,18 +14,14 @@
 
 package android.startop.test;
 
-import android.content.Context;
-import android.support.test.InstrumentationRegistry;
-import com.google.common.io.ByteStreams;
-import dalvik.system.InMemoryDexClassLoader;
 import dalvik.system.PathClassLoader;
-import java.io.InputStream;
-import java.lang.reflect.InvocationTargetException;
-import java.lang.reflect.Method;
-import java.nio.ByteBuffer;
+
 import org.junit.Assert;
 import org.junit.Test;
 
+import java.lang.reflect.InvocationTargetException;
+import java.lang.reflect.Method;
+
 // Adding tests here requires changes in several other places. See README.md in
 // the view_compiler directory for more information.
 public class DexBuilderTest {
diff --git a/startop/view_compiler/dex_builder_test/src/android/startop/test/LayoutCompilerTest.java b/startop/view_compiler/dex_builder_test/src/android/startop/test/LayoutCompilerTest.java
index a3b1b6c..3dfb20c 100644
--- a/startop/view_compiler/dex_builder_test/src/android/startop/test/LayoutCompilerTest.java
+++ b/startop/view_compiler/dex_builder_test/src/android/startop/test/LayoutCompilerTest.java
@@ -15,18 +15,15 @@
 package android.startop.test;
 
 import android.content.Context;
-import android.support.test.InstrumentationRegistry;
-import android.view.View;
-import com.google.common.io.ByteStreams;
-import dalvik.system.InMemoryDexClassLoader;
+
+import androidx.test.InstrumentationRegistry;
+
 import dalvik.system.PathClassLoader;
-import java.io.InputStream;
-import java.lang.reflect.InvocationTargetException;
-import java.lang.reflect.Method;
-import java.nio.ByteBuffer;
-import org.junit.Assert;
+
 import org.junit.Test;
 
+import java.lang.reflect.Method;
+
 // Adding tests here requires changes in several other places. See README.md in
 // the view_compiler directory for more information.
 public class LayoutCompilerTest {
diff --git a/telecomm/java/android/telecom/AudioState.java b/telecomm/java/android/telecom/AudioState.java
index eb202a7..4e74395 100644
--- a/telecomm/java/android/telecom/AudioState.java
+++ b/telecomm/java/android/telecom/AudioState.java
@@ -133,7 +133,7 @@
     /**
      * Responsible for creating AudioState objects for deserialized Parcels.
      */
-    public static final Parcelable.Creator<AudioState> CREATOR =
+    public static final @android.annotation.NonNull Parcelable.Creator<AudioState> CREATOR =
             new Parcelable.Creator<AudioState> () {
 
         @Override
diff --git a/telecomm/java/android/telecom/CallAudioState.java b/telecomm/java/android/telecom/CallAudioState.java
index e33ba7e..4b90985 100644
--- a/telecomm/java/android/telecom/CallAudioState.java
+++ b/telecomm/java/android/telecom/CallAudioState.java
@@ -239,7 +239,7 @@
     /**
      * Responsible for creating AudioState objects for deserialized Parcels.
      */
-    public static final Parcelable.Creator<CallAudioState> CREATOR =
+    public static final @android.annotation.NonNull Parcelable.Creator<CallAudioState> CREATOR =
             new Parcelable.Creator<CallAudioState> () {
 
         @Override
diff --git a/telecomm/java/android/telecom/CallIdentification.java b/telecomm/java/android/telecom/CallIdentification.java
index cde7f60..745affd 100644
--- a/telecomm/java/android/telecom/CallIdentification.java
+++ b/telecomm/java/android/telecom/CallIdentification.java
@@ -44,7 +44,7 @@
      * A {@link CallScreeningService} uses this class to create new instances of
      * {@link CallIdentification} for a screened call.
      */
-    public static class Builder {
+    public final static class Builder {
         private CharSequence mName;
         private CharSequence mDescription;
         private CharSequence mDetails;
@@ -67,7 +67,7 @@
          * @param callIdAppName The app name.
          * @hide
          */
-        public Builder(String callIdPackageName, CharSequence callIdAppName) {
+        public Builder(@NonNull String callIdPackageName, @NonNull CharSequence callIdAppName) {
             mPackageName = callIdPackageName;
             mAppName = callIdAppName;
         }
@@ -80,7 +80,7 @@
          * @param name The name associated with the call, or {@code null} if none is provided.
          * @return Builder instance.
          */
-        public Builder setName(@Nullable CharSequence name) {
+        public @NonNull Builder setName(@Nullable CharSequence name) {
             mName = name;
             return this;
         }
@@ -97,7 +97,7 @@
          * @param description The call description, or {@code null} if none is provided.
          * @return Builder instance.
          */
-        public Builder setDescription(@Nullable CharSequence description) {
+        public @NonNull Builder setDescription(@Nullable CharSequence description) {
             mDescription = description;
             return this;
         }
@@ -114,7 +114,8 @@
          * @param details The call details, or {@code null} if none is provided.
          * @return Builder instance.
          */
-        public Builder setDetails(@Nullable CharSequence details) {
+
+        public @NonNull Builder setDetails(@Nullable CharSequence details) {
             mDetails = details;
             return this;
         }
@@ -127,7 +128,7 @@
          * @param photo The photo associated with the call, or {@code null} if none was provided.
          * @return Builder instance.
          */
-        public Builder setPhoto(@Nullable Icon photo) {
+        public @NonNull Builder setPhoto(@Nullable Icon photo) {
             mPhoto = photo;
             return this;
         }
@@ -141,7 +142,7 @@
          * @param nuisanceConfidence The nuisance confidence.
          * @return The builder.
          */
-        public Builder setNuisanceConfidence(@NuisanceConfidence int nuisanceConfidence) {
+        public @NonNull Builder setNuisanceConfidence(@NuisanceConfidence int nuisanceConfidence) {
             mNuisanceConfidence = nuisanceConfidence;
             return this;
         }
@@ -152,7 +153,7 @@
          *
          * @return {@link CallIdentification} instance.
          */
-        public CallIdentification build() {
+        public @NonNull CallIdentification build() {
             return new CallIdentification(mName, mDescription, mDetails, mPhoto,
                     mNuisanceConfidence, mPackageName, mAppName);
         }
@@ -281,7 +282,7 @@
     /**
      * Responsible for creating CallIdentification objects for deserialized Parcels.
      */
-    public static final Parcelable.Creator<CallIdentification> CREATOR =
+    public static final @android.annotation.NonNull Parcelable.Creator<CallIdentification> CREATOR =
             new Parcelable.Creator<CallIdentification> () {
 
                 @Override
diff --git a/telecomm/java/android/telecom/ConferenceParticipant.java b/telecomm/java/android/telecom/ConferenceParticipant.java
index 6317770..2f1505c 100644
--- a/telecomm/java/android/telecom/ConferenceParticipant.java
+++ b/telecomm/java/android/telecom/ConferenceParticipant.java
@@ -86,7 +86,7 @@
     /**
      * Responsible for creating {@code ConferenceParticipant} objects for deserialized Parcels.
      */
-    public static final Parcelable.Creator<ConferenceParticipant> CREATOR =
+    public static final @android.annotation.NonNull Parcelable.Creator<ConferenceParticipant> CREATOR =
             new Parcelable.Creator<ConferenceParticipant>() {
 
                 @Override
diff --git a/telecomm/java/android/telecom/ConnectionRequest.java b/telecomm/java/android/telecom/ConnectionRequest.java
index b6e6b0e..b428530 100644
--- a/telecomm/java/android/telecom/ConnectionRequest.java
+++ b/telecomm/java/android/telecom/ConnectionRequest.java
@@ -337,10 +337,34 @@
                 mAddress == null
                         ? Uri.EMPTY
                         : Connection.toLogSafePhoneNumber(mAddress.toString()),
-                mExtras == null ? "" : mExtras);
+                bundleToString(mExtras));
     }
 
-    public static final Creator<ConnectionRequest> CREATOR = new Creator<ConnectionRequest> () {
+    private static String bundleToString(Bundle extras){
+        if (extras == null) {
+            return "";
+        }
+        StringBuilder sb = new StringBuilder();
+        sb.append("Bundle[");
+        for (String key : extras.keySet()) {
+            sb.append(key);
+            sb.append("=");
+            switch (key) {
+                case TelecomManager.EXTRA_INCOMING_CALL_ADDRESS:
+                case TelecomManager.EXTRA_UNKNOWN_CALL_HANDLE:
+                    sb.append(Log.pii(extras.get(key)));
+                    break;
+                default:
+                    sb.append(extras.get(key));
+                    break;
+            }
+            sb.append(", ");
+        }
+        sb.append("]");
+        return sb.toString();
+    }
+
+    public static final @android.annotation.NonNull Creator<ConnectionRequest> CREATOR = new Creator<ConnectionRequest> () {
         @Override
         public ConnectionRequest createFromParcel(Parcel source) {
             return new ConnectionRequest(source);
diff --git a/telecomm/java/android/telecom/DefaultDialerManager.java b/telecomm/java/android/telecom/DefaultDialerManager.java
index e43b2b7..5b806a6 100644
--- a/telecomm/java/android/telecom/DefaultDialerManager.java
+++ b/telecomm/java/android/telecom/DefaultDialerManager.java
@@ -16,7 +16,6 @@
 
 import android.app.ActivityManager;
 import android.app.role.RoleManager;
-import android.app.role.RoleManagerCallback;
 import android.content.Context;
 import android.content.Intent;
 import android.content.pm.ActivityInfo;
@@ -34,9 +33,11 @@
 
 import java.util.ArrayList;
 import java.util.List;
+import java.util.concurrent.CompletableFuture;
 import java.util.concurrent.ExecutionException;
 import java.util.concurrent.TimeUnit;
 import java.util.concurrent.TimeoutException;
+import java.util.function.Consumer;
 
 /**
  * Class for managing the default dialer application that will receive incoming calls, and be
@@ -75,11 +76,18 @@
             int user) {
         long identity = Binder.clearCallingIdentity();
         try {
-            RoleManagerCallback.Future cb = new RoleManagerCallback.Future();
+            CompletableFuture<Void> future = new CompletableFuture<>();
+            Consumer<Boolean> callback = successful -> {
+                if (successful) {
+                    future.complete(null);
+                } else {
+                    future.completeExceptionally(new RuntimeException());
+                }
+            };
             context.getSystemService(RoleManager.class).addRoleHolderAsUser(
                     RoleManager.ROLE_DIALER, packageName, 0, UserHandle.of(user),
-                    AsyncTask.THREAD_POOL_EXECUTOR, cb);
-            cb.get(5, TimeUnit.SECONDS);
+                    AsyncTask.THREAD_POOL_EXECUTOR, callback);
+            future.get(5, TimeUnit.SECONDS);
             return true;
         } catch (InterruptedException | ExecutionException | TimeoutException e) {
             Slog.e(TAG, "Failed to set default dialer to " + packageName + " for user " + user, e);
diff --git a/telecomm/java/android/telecom/DisconnectCause.java b/telecomm/java/android/telecom/DisconnectCause.java
index 5a97c94..ae92464 100644
--- a/telecomm/java/android/telecom/DisconnectCause.java
+++ b/telecomm/java/android/telecom/DisconnectCause.java
@@ -207,7 +207,7 @@
         return mToneToPlay;
     }
 
-    public static final Creator<DisconnectCause> CREATOR = new Creator<DisconnectCause>() {
+    public static final @android.annotation.NonNull Creator<DisconnectCause> CREATOR = new Creator<DisconnectCause>() {
         @Override
         public DisconnectCause createFromParcel(Parcel source) {
             int code = source.readInt();
diff --git a/telecomm/java/android/telecom/GatewayInfo.java b/telecomm/java/android/telecom/GatewayInfo.java
index 928570e..0faa4fd 100644
--- a/telecomm/java/android/telecom/GatewayInfo.java
+++ b/telecomm/java/android/telecom/GatewayInfo.java
@@ -80,7 +80,7 @@
     /**
      * The Parcelable interface.
      * */
-    public static final Parcelable.Creator<GatewayInfo> CREATOR =
+    public static final @android.annotation.NonNull Parcelable.Creator<GatewayInfo> CREATOR =
             new Parcelable.Creator<GatewayInfo> () {
 
         @Override
diff --git a/telecomm/java/android/telecom/Logging/Session.java b/telecomm/java/android/telecom/Logging/Session.java
index c45bd6b..50c3cd9 100644
--- a/telecomm/java/android/telecom/Logging/Session.java
+++ b/telecomm/java/android/telecom/Logging/Session.java
@@ -69,7 +69,7 @@
         }
 
         /** Responsible for creating Info objects for deserialized Parcels. */
-        public static final Parcelable.Creator<Info> CREATOR =
+        public static final @android.annotation.NonNull Parcelable.Creator<Info> CREATOR =
                 new Parcelable.Creator<Info> () {
                     @Override
                     public Info createFromParcel(Parcel source) {
diff --git a/telecomm/java/android/telecom/ParcelableCall.java b/telecomm/java/android/telecom/ParcelableCall.java
index f7dec83..345707e 100644
--- a/telecomm/java/android/telecom/ParcelableCall.java
+++ b/telecomm/java/android/telecom/ParcelableCall.java
@@ -331,7 +331,7 @@
 
     /** Responsible for creating ParcelableCall objects for deserialized Parcels. */
     @UnsupportedAppUsage(maxTargetSdk = Build.VERSION_CODES.P, trackingBug = 115609023)
-    public static final Parcelable.Creator<ParcelableCall> CREATOR =
+    public static final @android.annotation.NonNull Parcelable.Creator<ParcelableCall> CREATOR =
             new Parcelable.Creator<ParcelableCall> () {
         @Override
         public ParcelableCall createFromParcel(Parcel source) {
diff --git a/telecomm/java/android/telecom/ParcelableCallAnalytics.java b/telecomm/java/android/telecom/ParcelableCallAnalytics.java
index bb066ad..2b9213b 100644
--- a/telecomm/java/android/telecom/ParcelableCallAnalytics.java
+++ b/telecomm/java/android/telecom/ParcelableCallAnalytics.java
@@ -36,7 +36,7 @@
         public static final int RECEIVE_REMOTE_SESSION_MODIFY_REQUEST = 2;
         public static final int RECEIVE_REMOTE_SESSION_MODIFY_RESPONSE = 3;
 
-        public static final Parcelable.Creator<VideoEvent> CREATOR =
+        public static final @android.annotation.NonNull Parcelable.Creator<VideoEvent> CREATOR =
                 new Parcelable.Creator<VideoEvent> () {
 
                     @Override
@@ -135,7 +135,7 @@
         public static final int REQUEST_PULL = 500;
 
 
-        public static final Parcelable.Creator<AnalyticsEvent> CREATOR =
+        public static final @android.annotation.NonNull Parcelable.Creator<AnalyticsEvent> CREATOR =
                 new Parcelable.Creator<AnalyticsEvent> () {
 
                     @Override
@@ -200,7 +200,7 @@
 
         public static final int INVALID = 999999;
 
-        public static final Parcelable.Creator<EventTiming> CREATOR =
+        public static final @android.annotation.NonNull Parcelable.Creator<EventTiming> CREATOR =
                 new Parcelable.Creator<EventTiming> () {
 
                     @Override
@@ -284,7 +284,7 @@
 
     public static final int STILL_CONNECTED = -1;
 
-    public static final Parcelable.Creator<ParcelableCallAnalytics> CREATOR =
+    public static final @android.annotation.NonNull Parcelable.Creator<ParcelableCallAnalytics> CREATOR =
             new Parcelable.Creator<ParcelableCallAnalytics> () {
 
                 @Override
diff --git a/telecomm/java/android/telecom/ParcelableConference.java b/telecomm/java/android/telecom/ParcelableConference.java
index a6221d4..636e4b2 100644
--- a/telecomm/java/android/telecom/ParcelableConference.java
+++ b/telecomm/java/android/telecom/ParcelableConference.java
@@ -134,7 +134,7 @@
         return mExtras;
     }
 
-    public static final Parcelable.Creator<ParcelableConference> CREATOR =
+    public static final @android.annotation.NonNull Parcelable.Creator<ParcelableConference> CREATOR =
             new Parcelable.Creator<ParcelableConference> () {
         @Override
         public ParcelableConference createFromParcel(Parcel source) {
diff --git a/telecomm/java/android/telecom/ParcelableConnection.java b/telecomm/java/android/telecom/ParcelableConnection.java
index 61d5a12..dab1c6e 100644
--- a/telecomm/java/android/telecom/ParcelableConnection.java
+++ b/telecomm/java/android/telecom/ParcelableConnection.java
@@ -237,7 +237,7 @@
                 .toString();
     }
 
-    public static final Parcelable.Creator<ParcelableConnection> CREATOR =
+    public static final @android.annotation.NonNull Parcelable.Creator<ParcelableConnection> CREATOR =
             new Parcelable.Creator<ParcelableConnection> () {
         @Override
         public ParcelableConnection createFromParcel(Parcel source) {
diff --git a/telecomm/java/android/telecom/ParcelableRttCall.java b/telecomm/java/android/telecom/ParcelableRttCall.java
index 763e48b..fbcf486 100644
--- a/telecomm/java/android/telecom/ParcelableRttCall.java
+++ b/telecomm/java/android/telecom/ParcelableRttCall.java
@@ -50,7 +50,7 @@
         mReceiveStream = in.readParcelable(ParcelFileDescriptor.class.getClassLoader());
     }
 
-    public static final Creator<ParcelableRttCall> CREATOR = new Creator<ParcelableRttCall>() {
+    public static final @android.annotation.NonNull Creator<ParcelableRttCall> CREATOR = new Creator<ParcelableRttCall>() {
         @Override
         public ParcelableRttCall createFromParcel(Parcel in) {
             return new ParcelableRttCall(in);
diff --git a/telecomm/java/android/telecom/PhoneAccount.java b/telecomm/java/android/telecom/PhoneAccount.java
index 2ffad03..5e13400 100644
--- a/telecomm/java/android/telecom/PhoneAccount.java
+++ b/telecomm/java/android/telecom/PhoneAccount.java
@@ -914,7 +914,7 @@
         out.writeInt(mSupportedAudioRoutes);
     }
 
-    public static final Creator<PhoneAccount> CREATOR
+    public static final @android.annotation.NonNull Creator<PhoneAccount> CREATOR
             = new Creator<PhoneAccount>() {
         @Override
         public PhoneAccount createFromParcel(Parcel in) {
diff --git a/telecomm/java/android/telecom/PhoneAccountHandle.java b/telecomm/java/android/telecom/PhoneAccountHandle.java
index 5dedb04..a84ce55 100644
--- a/telecomm/java/android/telecom/PhoneAccountHandle.java
+++ b/telecomm/java/android/telecom/PhoneAccountHandle.java
@@ -156,7 +156,7 @@
         }
     }
 
-    public static final Creator<PhoneAccountHandle> CREATOR = new Creator<PhoneAccountHandle>() {
+    public static final @android.annotation.NonNull Creator<PhoneAccountHandle> CREATOR = new Creator<PhoneAccountHandle>() {
         @Override
         public PhoneAccountHandle createFromParcel(Parcel in) {
             return new PhoneAccountHandle(in);
diff --git a/telecomm/java/android/telecom/PhoneAccountSuggestion.java b/telecomm/java/android/telecom/PhoneAccountSuggestion.java
index b401bcf..2589d95 100644
--- a/telecomm/java/android/telecom/PhoneAccountSuggestion.java
+++ b/telecomm/java/android/telecom/PhoneAccountSuggestion.java
@@ -17,8 +17,7 @@
 package android.telecom;
 
 import android.annotation.IntDef;
-import android.annotation.SystemApi;
-import android.annotation.TestApi;
+import android.annotation.NonNull;
 import android.os.Parcel;
 import android.os.Parcelable;
 
@@ -68,11 +67,16 @@
     private boolean mShouldAutoSelect;
 
     /**
-     * @hide
+     * Creates a new instance of {@link PhoneAccountSuggestion}. This constructor is intended for
+     * use by apps implementing a {@link PhoneAccountSuggestionService}, and generally should not be
+     * used by dialer apps other than for testing purposes.
+     *
+     * @param handle The {@link PhoneAccountHandle} for this suggestion.
+     * @param reason The reason for this suggestion
+     * @param shouldAutoSelect Whether the dialer should automatically place the call using this
+     *                         account. See {@link #shouldAutoSelect()}.
      */
-    @SystemApi
-    @TestApi
-    public PhoneAccountSuggestion(PhoneAccountHandle handle, @SuggestionReason int reason,
+    public PhoneAccountSuggestion(@NonNull PhoneAccountHandle handle, @SuggestionReason int reason,
             boolean shouldAutoSelect) {
         this.mHandle = handle;
         this.mReason = reason;
@@ -85,7 +89,7 @@
         mShouldAutoSelect = in.readByte() != 0;
     }
 
-    public static final Creator<PhoneAccountSuggestion> CREATOR =
+    public static final @android.annotation.NonNull Creator<PhoneAccountSuggestion> CREATOR =
             new Creator<PhoneAccountSuggestion>() {
                 @Override
                 public PhoneAccountSuggestion createFromParcel(Parcel in) {
@@ -101,7 +105,7 @@
     /**
      * @return The {@link PhoneAccountHandle} for this suggestion.
      */
-    public PhoneAccountHandle getPhoneAccountHandle() {
+    @NonNull public PhoneAccountHandle getPhoneAccountHandle() {
         return mHandle;
     }
 
diff --git a/telecomm/java/android/telecom/StatusHints.java b/telecomm/java/android/telecom/StatusHints.java
index 453f408..762c93a 100644
--- a/telecomm/java/android/telecom/StatusHints.java
+++ b/telecomm/java/android/telecom/StatusHints.java
@@ -119,7 +119,7 @@
         out.writeParcelable(mExtras, 0);
     }
 
-    public static final Creator<StatusHints> CREATOR
+    public static final @android.annotation.NonNull Creator<StatusHints> CREATOR
             = new Creator<StatusHints>() {
         public StatusHints createFromParcel(Parcel in) {
             return new StatusHints(in);
diff --git a/telecomm/java/android/telecom/TelecomAnalytics.java b/telecomm/java/android/telecom/TelecomAnalytics.java
index 6e0d02c..e88ad77 100644
--- a/telecomm/java/android/telecom/TelecomAnalytics.java
+++ b/telecomm/java/android/telecom/TelecomAnalytics.java
@@ -28,7 +28,7 @@
  */
 @SystemApi
 public final class TelecomAnalytics implements Parcelable {
-    public static final Parcelable.Creator<TelecomAnalytics> CREATOR =
+    public static final @android.annotation.NonNull Parcelable.Creator<TelecomAnalytics> CREATOR =
             new Parcelable.Creator<TelecomAnalytics> () {
 
                 @Override
@@ -43,7 +43,7 @@
             };
 
     public static final class SessionTiming extends TimedEvent<Integer> implements Parcelable {
-        public static final Parcelable.Creator<SessionTiming> CREATOR =
+        public static final @android.annotation.NonNull Parcelable.Creator<SessionTiming> CREATOR =
                 new Parcelable.Creator<SessionTiming> () {
 
                     @Override
diff --git a/telecomm/java/android/telecom/TelecomManager.java b/telecomm/java/android/telecom/TelecomManager.java
index d509168..52c5425 100644
--- a/telecomm/java/android/telecom/TelecomManager.java
+++ b/telecomm/java/android/telecom/TelecomManager.java
@@ -17,6 +17,7 @@
 import android.Manifest;
 import android.annotation.IntDef;
 import android.annotation.NonNull;
+import android.annotation.Nullable;
 import android.annotation.RequiresPermission;
 import android.annotation.SuppressAutoDoc;
 import android.annotation.SuppressLint;
@@ -24,7 +25,6 @@
 import android.annotation.SystemService;
 import android.annotation.TestApi;
 import android.annotation.UnsupportedAppUsage;
-import android.app.role.RoleManagerCallback;
 import android.content.ComponentName;
 import android.content.Context;
 import android.content.Intent;
@@ -477,12 +477,6 @@
             "android.telecom.extra.START_CALL_WITH_RTT";
 
     /**
-     * A boolean extra set to indicate whether an app is eligible to be bound to when there are
-     * ongoing calls on the device.
-     */
-    public static final String EXTRA_IS_ENABLED = "android.telecom.extra.IS_ENABLED";
-
-    /**
      * A boolean meta-data value indicating whether an {@link InCallService} implements an
      * in-call user interface. Dialer implementations (see {@link #getDefaultDialerPackage()}) which
      * would also like to replace the in-call interface should set this meta-data to {@code true} in
@@ -814,10 +808,11 @@
      * <p>
      * The default dialer has access to use this method.
      *
-     * @return The user outgoing phone account selected by the user.
+     * @return The user outgoing phone account selected by the user, or {@code null} if there is no
+     * user selected outgoing {@link PhoneAccountHandle}.
      */
     @RequiresPermission(android.Manifest.permission.READ_PHONE_STATE)
-    public PhoneAccountHandle getUserSelectedOutgoingPhoneAccount() {
+    public @Nullable PhoneAccountHandle getUserSelectedOutgoingPhoneAccount() {
         try {
             if (isServiceConnected()) {
                 return getTelecomService().getUserSelectedOutgoingPhoneAccount(
@@ -833,13 +828,14 @@
      * Sets the user-chosen default {@link PhoneAccountHandle} for making outgoing phone calls.
      *
      * @param accountHandle The {@link PhoneAccountHandle} which will be used by default for making
-     *                      outgoing voice calls.
+     *                      outgoing voice calls, or {@code null} if no default is specified (the
+     *                      user will be asked each time a call is placed in this case).
      * @hide
      */
     @RequiresPermission(android.Manifest.permission.MODIFY_PHONE_STATE)
     @TestApi
     @SystemApi
-    public void setUserSelectedOutgoingPhoneAccount(PhoneAccountHandle accountHandle) {
+    public void setUserSelectedOutgoingPhoneAccount(@Nullable PhoneAccountHandle accountHandle) {
         try {
             if (isServiceConnected()) {
                 getTelecomService().setUserSelectedOutgoingPhoneAccount(accountHandle);
@@ -1206,7 +1202,8 @@
     /**
      * Used to set the default dialer package.
      *
-     * @param packageName to set the default dialer to.
+     * @param packageName to set the default dialer to, or {@code null} if the system provided
+     *                    dialer should be used instead.
      *
      * @result {@code true} if the default dialer was successfully changed, {@code false} if
      *         the specified package does not correspond to an installed dialer, or is already
@@ -1217,15 +1214,15 @@
      *
      * @hide
      * @deprecated Use
-     * {@link android.app.role.RoleManager#addRoleHolderAsUser(String, String, UserHandle, Executor,
-     * RoleManagerCallback)} instead.
+     * {@link android.app.role.RoleManager#addRoleHolderAsUser(String, String, int, UserHandle,
+     * Executor, java.util.function.Consumer)} instead.
      */
     @SystemApi
     @Deprecated
     @RequiresPermission(allOf = {
             android.Manifest.permission.MODIFY_PHONE_STATE,
             android.Manifest.permission.WRITE_SECURE_SETTINGS})
-    public boolean setDefaultDialer(String packageName) {
+    public boolean setDefaultDialer(@Nullable String packageName) {
         try {
             if (isServiceConnected()) {
                 return getTelecomService().setDefaultDialer(packageName);
@@ -1239,9 +1236,10 @@
     /**
      * Determines the package name of the system-provided default phone app.
      *
-     * @return package name for the system dialer package or null if no system dialer is preloaded.
+     * @return package name for the system dialer package or {@code null} if no system dialer is
+     *         preloaded.
      */
-    public String getSystemDialerPackage() {
+    public @Nullable String getSystemDialerPackage() {
         try {
             if (isServiceConnected()) {
                 return getTelecomService().getSystemDialerPackage();
diff --git a/telecomm/java/android/telecom/VideoProfile.java b/telecomm/java/android/telecom/VideoProfile.java
index 157f12c..64e6ca3 100644
--- a/telecomm/java/android/telecom/VideoProfile.java
+++ b/telecomm/java/android/telecom/VideoProfile.java
@@ -170,7 +170,7 @@
     /**
      * Responsible for creating VideoProfile objects from deserialized Parcels.
      **/
-    public static final Parcelable.Creator<VideoProfile> CREATOR =
+    public static final @android.annotation.NonNull Parcelable.Creator<VideoProfile> CREATOR =
             new Parcelable.Creator<VideoProfile> () {
                 /**
                  * Creates a MediaProfile instances from a parcel.
@@ -389,7 +389,7 @@
         /**
          * Responsible for creating CallCameraCapabilities objects from deserialized Parcels.
          **/
-        public static final Parcelable.Creator<CameraCapabilities> CREATOR =
+        public static final @android.annotation.NonNull Parcelable.Creator<CameraCapabilities> CREATOR =
                 new Parcelable.Creator<CameraCapabilities> () {
                     /**
                      * Creates a CallCameraCapabilities instances from a parcel.
diff --git a/telecomm/java/android/telecom/Voicemail.java b/telecomm/java/android/telecom/Voicemail.java
index ca235bf..60a8a94 100644
--- a/telecomm/java/android/telecom/Voicemail.java
+++ b/telecomm/java/android/telecom/Voicemail.java
@@ -283,7 +283,7 @@
         dest.writeCharSequence(mTranscription);
     }
 
-    public static final Creator<Voicemail> CREATOR
+    public static final @android.annotation.NonNull Creator<Voicemail> CREATOR
             = new Creator<Voicemail>() {
         @Override
         public Voicemail createFromParcel(Parcel in) {
diff --git a/telecomm/java/com/android/internal/telecom/ITelecomService.aidl b/telecomm/java/com/android/internal/telecom/ITelecomService.aidl
index 5030f90..93eea56 100644
--- a/telecomm/java/com/android/internal/telecom/ITelecomService.aidl
+++ b/telecomm/java/com/android/internal/telecom/ITelecomService.aidl
@@ -182,6 +182,7 @@
     /**
      * @see TelecomServiceImpl#getCallState
      */
+    @UnsupportedAppUsage
     int getCallState();
 
     /**
diff --git a/telephony/java/android/provider/Telephony.java b/telephony/java/android/provider/Telephony.java
index fecdb08..3106e40 100644
--- a/telephony/java/android/provider/Telephony.java
+++ b/telephony/java/android/provider/Telephony.java
@@ -17,6 +17,7 @@
 package android.provider;
 
 import android.annotation.IntDef;
+import android.annotation.NonNull;
 import android.annotation.RequiresPermission;
 import android.annotation.SdkConstant;
 import android.annotation.SdkConstant.SdkConstantType;
@@ -1190,8 +1191,8 @@
              * Broadcast Action: A debug code has been entered in the dialer. This intent is
              * broadcast by the system and OEM telephony apps may need to receive these broadcasts.
              * These "secret codes" are used to activate developer menus by dialing certain codes.
-             * And they are of the form {@code *#*#&lt;code&gt;#*#*}. The intent will have the data
-             * URI: {@code android_secret_code://&lt;code&gt;}. It is possible that a manifest
+             * And they are of the form {@code *#*#<code>#*#*}. The intent will have the data
+             * URI: {@code android_secret_code://<code>}. It is possible that a manifest
              * receiver would be woken up even if it is not currently running.
              *
              * <p>Requires {@code android.Manifest.permission#CONTROL_INCALL_EXPERIENCE} to
@@ -3828,6 +3829,42 @@
          */
         public static final String CARRIER_ID = "carrier_id";
 
+        /**
+         * The skip 464xlat flag. Flag works as follows.
+         * {@link #SKIP_464XLAT_DEFAULT}: the APN will skip only APN is IMS and no internet.
+         * {@link #SKIP_464XLAT_DISABLE}: the APN will NOT skip 464xlat
+         * {@link #SKIP_464XLAT_ENABLE}: the APN will skip 464xlat
+         * <p>Type: INTEGER</p>
+         *
+         * @hide
+         */
+        public static final String SKIP_464XLAT = "skip_464xlat";
+
+        /**
+         * Possible value for the {@link #SKIP_464XLAT} field.
+         * <p>Type: INTEGER</p>
+         *
+         * @hide
+         */
+        public static final int SKIP_464XLAT_DEFAULT = -1;
+
+        /**
+         * Possible value for the {@link #SKIP_464XLAT} field.
+         * <p>Type: INTEGER</p>
+         *
+         * @hide
+         */
+        public static final int SKIP_464XLAT_DISABLE = 0;
+
+        /**
+         * Possible value for the {@link #SKIP_464XLAT} field.
+         * <p>Type: INTEGER</p>
+         *
+         * @hide
+         */
+        public static final int SKIP_464XLAT_ENABLE = 1;
+
+
         /** @hide */
         @IntDef({
                 UNEDITED,
@@ -3838,6 +3875,16 @@
         })
         @Retention(RetentionPolicy.SOURCE)
         public @interface EditStatus {}
+
+        /** @hide */
+        @IntDef({
+                SKIP_464XLAT_DEFAULT,
+                SKIP_464XLAT_DISABLE,
+                SKIP_464XLAT_ENABLE,
+        })
+        @Retention(RetentionPolicy.SOURCE)
+        public @interface Skip464XlatStatus {}
+
     }
 
     /**
@@ -4325,23 +4372,24 @@
         }
 
         /**
-         * Generates a content {@link Uri} used to receive updates on precise carrier identity
+         * Generates a content {@link Uri} used to receive updates on specific carrier identity
          * change on the given subscriptionId returned by
-         * {@link TelephonyManager#getSimPreciseCarrierId()}.
-         * @see TelephonyManager#ACTION_SUBSCRIPTION_PRECISE_CARRIER_IDENTITY_CHANGED
+         * {@link TelephonyManager#getSimSpecificCarrierId()}.
+         * @see TelephonyManager#ACTION_SUBSCRIPTION_SPECIFIC_CARRIER_IDENTITY_CHANGED
          * <p>
          * Use this {@link Uri} with a {@link ContentObserver} to be notified of changes to the
-         * precise carrier identity {@link TelephonyManager#getSimPreciseCarrierId()}
+         * specific carrier identity {@link TelephonyManager#getSimSpecificCarrierId()}
          * while your app is running. You can also use a {@link JobService} to ensure your app
          * is notified of changes to the {@link Uri} even when it is not running.
          * Note, however, that using a {@link JobService} does not guarantee timely delivery of
          * updates to the {@link Uri}.
          *
          * @param subscriptionId the subscriptionId to receive updates on
-         * @return the Uri used to observe precise carrier identity changes
+         * @return the Uri used to observe specific carrier identity changes
          */
-        public static Uri getPreciseCarrierIdUriForSubscriptionId(int subscriptionId) {
-            return Uri.withAppendedPath(Uri.withAppendedPath(CONTENT_URI, "precise"),
+        @NonNull
+        public static Uri getSpecificCarrierIdUriForSubscriptionId(int subscriptionId) {
+            return Uri.withAppendedPath(Uri.withAppendedPath(CONTENT_URI, "specific"),
                     String.valueOf(subscriptionId));
         }
 
@@ -4361,26 +4409,30 @@
 
         /**
          * A fine-grained carrier id.
-         * @see TelephonyManager#getSimPreciseCarrierId()
+         * The specific carrier ID would be used for configuration purposes, but apps wishing to
+         * know about the carrier itself should use the regular carrier ID returned by
+         * {@link TelephonyManager#getSimCarrierId()}.
+         *
+         * @see TelephonyManager#getSimSpecificCarrierId()
          * This is not a database column, only used to notify content observers for
-         * {@link #getPreciseCarrierIdUriForSubscriptionId(int)}
+         * {@link #getSpecificCarrierIdUriForSubscriptionId(int)}
          */
-        public static final String PRECISE_CARRIER_ID = "precise_carrier_id";
+        public static final String SPECIFIC_CARRIER_ID = "specific_carrier_id";
 
         /**
-         * A user facing carrier name for precise carrier id {@link #PRECISE_CARRIER_ID}.
-         * @see TelephonyManager#getSimPreciseCarrierIdName()
+         * A user facing carrier name for specific carrier id {@link #SPECIFIC_CARRIER_ID}.
+         * @see TelephonyManager#getSimSpecificCarrierIdName()
          * This is not a database column, only used to notify content observers for
-         * {@link #getPreciseCarrierIdUriForSubscriptionId(int)}
+         * {@link #getSpecificCarrierIdUriForSubscriptionId(int)}
          */
-        public static final String PRECISE_CARRIER_ID_NAME = "precise_carrier_id_name";
+        public static final String SPECIFIC_CARRIER_ID_NAME = "specific_carrier_id_name";
 
         /**
          * A unique parent carrier id. The parent-child
          * relationship can be used to further differentiate a single carrier by different networks,
-         * by prepaid v.s. postpaid or even by 4G v.s. 3G plan. It's an optional field.
-         * A carrier id with a valid parent_carrier_id is considered fine-grained carrier id, will
-         * not be returned as {@link #CARRIER_ID} but {@link #PRECISE_CARRIER_ID}.
+         * by prepaid v.s. postpaid. It's an optional field.
+         * A carrier id with a valid parent_carrier_id is considered fine-grained specific carrier
+         * ID, will not be returned as {@link #CARRIER_ID} but {@link #SPECIFIC_CARRIER_ID}.
          * <P>Type: INTEGER </P>
          * @hide
          */
diff --git a/telephony/java/android/telephony/AvailableNetworkInfo.java b/telephony/java/android/telephony/AvailableNetworkInfo.java
index b407b2a..a15f959 100644
--- a/telephony/java/android/telephony/AvailableNetworkInfo.java
+++ b/telephony/java/android/telephony/AvailableNetworkInfo.java
@@ -16,6 +16,7 @@
 
 package android.telephony;
 
+import android.annotation.NonNull;
 import android.os.Parcel;
 import android.os.Parcelable;
 
@@ -62,11 +63,22 @@
     /**
      * Describes the List of PLMN ids (MCC-MNC) associated with mSubId.
      * If this entry is left empty, then the platform software will not scan the network
-     * to revalidate the input.
+     * to revalidate the input else platform will scan and verify specified PLMNs are available.
      */
     private ArrayList<String> mMccMncs;
 
     /**
+     * Returns the frequency bands associated with the {@link #getMccMncs() MCC/MNCs}.
+     * Opportunistic network service will use these bands to scan.
+     *
+     * When no specific bands are specified (empty array or null) CBRS band (B48) will be
+     * used for network scan.
+     *
+     * See {@link AccessNetworkConstants} for details.
+     */
+    private ArrayList<Integer> mBands;
+
+    /**
      * Return subscription Id of the available network.
      * This value must be one of the entry retrieved from
      * {@link SubscriptionManager#getOpportunisticSubscriptions}
@@ -91,10 +103,20 @@
      * to revalidate the input.
      * @return list of PLMN ids
      */
-    public List<String> getMccMncs() {
+    public @NonNull List<String> getMccMncs() {
         return (List<String>) mMccMncs.clone();
     }
 
+    /**
+     * Returns the frequency bands that need to be scanned by opportunistic network service
+     *
+     * The returned value is defined in either of {@link AccessNetworkConstants.GeranBand},
+     * {@link AccessNetworkConstants.UtranBand} and {@link AccessNetworkConstants.EutranBand}
+     */
+    public @NonNull List<Integer> getBands() {
+        return (List<Integer>) mBands.clone();
+    }
+
     @Override
     public int describeContents() {
         return 0;
@@ -105,6 +127,7 @@
         dest.writeInt(mSubId);
         dest.writeInt(mPriority);
         dest.writeStringList(mMccMncs);
+        dest.writeList(mBands);
     }
 
     private AvailableNetworkInfo(Parcel in) {
@@ -112,12 +135,16 @@
         mPriority = in.readInt();
         mMccMncs = new ArrayList<>();
         in.readStringList(mMccMncs);
+        mBands = new ArrayList<>();
+        in.readList(mBands, Integer.class.getClassLoader());
     }
 
-    public AvailableNetworkInfo(int subId, int priority, List<String> mccMncs) {
+    public AvailableNetworkInfo(int subId, int priority, @NonNull List<String> mccMncs,
+            @NonNull List<Integer> bands) {
         mSubId = subId;
         mPriority = priority;
         mMccMncs = new ArrayList<String>(mccMncs);
+        mBands = new ArrayList<Integer>(bands);
     }
 
     @Override
@@ -135,17 +162,18 @@
         }
 
         return (mSubId == ani.mSubId
-                && mPriority == ani.mPriority
-                && (((mMccMncs != null)
-                && mMccMncs.equals(ani.mMccMncs))));
+            && mPriority == ani.mPriority
+            && (((mMccMncs != null)
+            && mMccMncs.equals(ani.mMccMncs)))
+            && mBands.equals(ani.mBands));
     }
 
     @Override
     public int hashCode() {
-        return Objects.hash(mSubId, mPriority, mMccMncs);
+        return Objects.hash(mSubId, mPriority, mMccMncs, mBands);
     }
 
-    public static final Parcelable.Creator<AvailableNetworkInfo> CREATOR =
+    public static final @android.annotation.NonNull Parcelable.Creator<AvailableNetworkInfo> CREATOR =
             new Creator<AvailableNetworkInfo>() {
                 @Override
                 public AvailableNetworkInfo createFromParcel(Parcel in) {
@@ -161,9 +189,9 @@
     @Override
     public String toString() {
         return ("AvailableNetworkInfo:"
-                + " mSubId: " + mSubId
-                + " mPriority: " + mPriority
-                + " mMccMncs: " + Arrays.toString(mMccMncs.toArray()));
+            + " mSubId: " + mSubId
+            + " mPriority: " + mPriority
+            + " mMccMncs: " + Arrays.toString(mMccMncs.toArray())
+            + " mBands: " + Arrays.toString(mBands.toArray()));
     }
 }
-
diff --git a/telephony/java/android/telephony/CallAttributes.java b/telephony/java/android/telephony/CallAttributes.java
index 0d4f09f..3a34005 100644
--- a/telephony/java/android/telephony/CallAttributes.java
+++ b/telephony/java/android/telephony/CallAttributes.java
@@ -16,6 +16,7 @@
 
 package android.telephony;
 
+import android.annotation.NonNull;
 import android.annotation.SystemApi;
 import android.os.Parcel;
 import android.os.Parcelable;
@@ -29,15 +30,15 @@
  * @hide
  */
 @SystemApi
-public class CallAttributes implements Parcelable {
+public final class CallAttributes implements Parcelable {
     private PreciseCallState mPreciseCallState;
     @NetworkType
     private int mNetworkType; // TelephonyManager.NETWORK_TYPE_* ints
     private CallQuality mCallQuality;
 
 
-    public CallAttributes(PreciseCallState state, @NetworkType int networkType,
-            CallQuality callQuality) {
+    public CallAttributes(@NonNull PreciseCallState state, @NetworkType int networkType,
+            @NonNull CallQuality callQuality) {
         this.mPreciseCallState = state;
         this.mNetworkType = networkType;
         this.mCallQuality = callQuality;
@@ -59,6 +60,7 @@
     /**
      * Returns the {@link PreciseCallState} of the call.
      */
+    @NonNull
     public PreciseCallState getPreciseCallState() {
         return mPreciseCallState;
     }
@@ -96,6 +98,7 @@
     /**
      * Returns the {#link CallQuality} of the call.
      */
+    @NonNull
     public CallQuality getCallQuality() {
         return mCallQuality;
     }
@@ -138,7 +141,7 @@
         dest.writeParcelable(mCallQuality, flags);
     }
 
-    public static final Parcelable.Creator<CallAttributes> CREATOR = new Parcelable.Creator() {
+    public static final @android.annotation.NonNull Parcelable.Creator<CallAttributes> CREATOR = new Parcelable.Creator() {
         public CallAttributes createFromParcel(Parcel in) {
             return new CallAttributes(in);
         }
diff --git a/telephony/java/android/telephony/CallQuality.java b/telephony/java/android/telephony/CallQuality.java
index cbe62284..10a04a9 100644
--- a/telephony/java/android/telephony/CallQuality.java
+++ b/telephony/java/android/telephony/CallQuality.java
@@ -333,7 +333,7 @@
         dest.writeInt(mCodecType);
     }
 
-    public static final Parcelable.Creator<CallQuality> CREATOR = new Parcelable.Creator() {
+    public static final @android.annotation.NonNull Parcelable.Creator<CallQuality> CREATOR = new Parcelable.Creator() {
         public CallQuality createFromParcel(Parcel in) {
             return new CallQuality(in);
         }
diff --git a/telephony/java/android/telephony/CarrierConfigManager.java b/telephony/java/android/telephony/CarrierConfigManager.java
old mode 100644
new mode 100755
index c0444bb..d79a168
--- a/telephony/java/android/telephony/CarrierConfigManager.java
+++ b/telephony/java/android/telephony/CarrierConfigManager.java
@@ -31,6 +31,7 @@
 import android.os.RemoteException;
 import android.os.ServiceManager;
 import android.service.carrier.CarrierService;
+import android.telecom.TelecomManager;
 import android.telephony.ims.ImsReasonInfo;
 
 import com.android.internal.telephony.ICarrierConfigLoader;
@@ -71,10 +72,10 @@
      * one is available for the slot index. An optional int extra
      * {@link TelephonyManager#EXTRA_CARRIER_ID} is included to indicate the carrier id for the
      * changed carrier configuration. An optional int extra
-     * {@link TelephonyManager#EXTRA_PRECISE_CARRIER_ID} is included to indicate the precise
+     * {@link TelephonyManager#EXTRA_SPECIFIC_CARRIER_ID} is included to indicate the precise
      * carrier id for the changed carrier configuration.
      * @see TelephonyManager#getSimCarrierId()
-     * @see TelephonyManager#getSimPreciseCarrierId()
+     * @see TelephonyManager#getSimSpecificCarrierId()
      */
     public static final String
             ACTION_CARRIER_CONFIG_CHANGED = "android.telephony.action.CARRIER_CONFIG_CHANGED";
@@ -1812,17 +1813,32 @@
 
     /**
      * Determine whether user can change Wi-Fi Calling preference in roaming.
-     * {@code false} - roaming preference {@link KEY_CARRIER_DEFAULT_WFC_IMS_ROAMING_MODE_INT} is
-     *                 the same as home preference {@link KEY_CARRIER_DEFAULT_WFC_IMS_MODE_INT}
-     *                 and cannot be changed.
-     * {@code true}  - roaming preference can be changed by user independently.
-     *
+     * {@code false} - roaming preference cannot be changed by user independently. If
+     *                 {@link #KEY_USE_WFC_HOME_NETWORK_MODE_IN_ROAMING_NETWORK_BOOL} is false,
+     *                 {@link #KEY_CARRIER_DEFAULT_WFC_IMS_ROAMING_MODE_INT} is used as the default
+     *                 value. If {@link #KEY_USE_WFC_HOME_NETWORK_MODE_IN_ROAMING_NETWORK_BOOL} is
+     *                 true, roaming preference is the same as home preference and
+     *                 {@link #KEY_CARRIER_DEFAULT_WFC_IMS_MODE_INT} is used as the default value.
+     * {@code true}  - roaming preference can be changed by user independently if
+     *                 {@link #KEY_USE_WFC_HOME_NETWORK_MODE_IN_ROAMING_NETWORK_BOOL} is false. If
+     *                 {@link #KEY_USE_WFC_HOME_NETWORK_MODE_IN_ROAMING_NETWORK_BOOL} is true, this
+     *                 configuration is ignored and roaming preference cannot be changed.
      * @hide
      */
     public static final String KEY_EDITABLE_WFC_ROAMING_MODE_BOOL =
             "editable_wfc_roaming_mode_bool";
 
     /**
+     * Flag specifying whether the carrier will use the WFC home network mode in roaming network.
+     * {@code false} - roaming preference can be selected separately from the home preference.
+     * {@code true}  - roaming preference is the same as home preference and
+     *                 {@link #KEY_CARRIER_DEFAULT_WFC_IMS_MODE_INT} is used as the default value.
+     * @hide
+     */
+    public static final String KEY_USE_WFC_HOME_NETWORK_MODE_IN_ROAMING_NETWORK_BOOL =
+            "use_wfc_home_network_mode_in_roaming_network_bool";
+
+    /**
      * Carrier specified WiFi networks.
      * @hide
      */
@@ -2099,6 +2115,18 @@
     public static final String KEY_RTT_SUPPORTED_BOOL = "rtt_supported_bool";
 
     /**
+     * Boolean flag indicating whether the carrier supports TTY.
+     * <p>
+     * Note that {@link #KEY_CARRIER_VOLTE_TTY_SUPPORTED_BOOL} controls availability of TTY over
+     * VoLTE; if {@link #KEY_TTY_SUPPORTED_BOOL} is disabled, then
+     * {@link #KEY_CARRIER_VOLTE_TTY_SUPPORTED_BOOL} is also implicitly disabled.
+     * <p>
+     * {@link TelecomManager#isTtySupported()} should be used to determine if a device supports TTY,
+     * and this carrier config key should be used to see if the current carrier supports it.
+     */
+    public static final String KEY_TTY_SUPPORTED_BOOL = "tty_supported_bool";
+
+    /**
      * Indicates if the carrier supports auto-upgrading a call to RTT when receiving a call from a
      * RTT-supported device.
      * @hide
@@ -2618,6 +2646,25 @@
     public static final String KEY_CDMA_ENHANCED_ROAMING_INDICATOR_FOR_HOME_NETWORK_INT_ARRAY =
             "cdma_enhanced_roaming_indicator_for_home_network_int_array";
 
+    /**
+     * Indicates use 3GPP application to replace 3GPP2 application even if it's a CDMA/CDMA-LTE
+     * phone, becasue some carriers's CSIM application is present but not supported.
+     * @hide
+     */
+    public static final String KEY_USE_USIM_BOOL = "use_usim_bool";
+
+    /**
+     * Determines whether the carrier wants to cancel the cs reject notification automatically
+     * when the voice registration state changes.
+     * If true, the notification will be automatically removed
+     *          when the voice registration state changes.
+     * If false, the notification will persist until the user dismisses it,
+     *           the SIM is removed, or the device is rebooted.
+     * @hide
+     */
+    public static final String KEY_AUTO_CANCEL_CS_REJECT_NOTIFICATION =
+            "carrier_auto_cancel_cs_notification";
+
     /** The default value for every variable. */
     private final static PersistableBundle sDefaults;
 
@@ -2911,6 +2958,7 @@
         sDefaults.putBoolean(KEY_NOTIFY_VT_HANDOVER_TO_WIFI_FAILURE_BOOL, false);
         sDefaults.putStringArray(KEY_FILTERED_CNAP_NAMES_STRING_ARRAY, null);
         sDefaults.putBoolean(KEY_EDITABLE_WFC_ROAMING_MODE_BOOL, false);
+        sDefaults.putBoolean(KEY_USE_WFC_HOME_NETWORK_MODE_IN_ROAMING_NETWORK_BOOL, false);
         sDefaults.putBoolean(KEY_STK_DISABLE_LAUNCH_BROWSER_BOOL, false);
         sDefaults.putStringArray(KEY_CARRIER_WIFI_STRING_ARRAY, null);
         sDefaults.putInt(KEY_PREF_NETWORK_NOTIFICATION_DELAY_INT, -1);
@@ -2936,6 +2984,7 @@
         sDefaults.putStringArray(KEY_ROAMING_OPERATOR_STRING_ARRAY, null);
         sDefaults.putBoolean(KEY_SHOW_IMS_REGISTRATION_STATUS_BOOL, false);
         sDefaults.putBoolean(KEY_RTT_SUPPORTED_BOOL, false);
+        sDefaults.putBoolean(KEY_TTY_SUPPORTED_BOOL, true);
         sDefaults.putBoolean(KEY_DISABLE_CHARGE_INDICATION_BOOL, false);
         sDefaults.putBoolean(KEY_SUPPORT_NO_REPLY_TIMER_FOR_CFNRY_BOOL, true);
         sDefaults.putStringArray(KEY_FEATURE_ACCESS_CODES_STRING_ARRAY, null);
@@ -3001,6 +3050,8 @@
                         1 /* Roaming Indicator Off */
                 });
         sDefaults.putStringArray(KEY_EMERGENCY_NUMBER_PREFIX_STRING_ARRAY, new String[0]);
+        sDefaults.putBoolean(KEY_USE_USIM_BOOL, false);
+        sDefaults.putBoolean(KEY_AUTO_CANCEL_CS_REJECT_NOTIFICATION, false);
     }
 
     /**
diff --git a/telephony/java/android/telephony/CarrierRestrictionRules.java b/telephony/java/android/telephony/CarrierRestrictionRules.java
index d47b55c..78623e7 100644
--- a/telephony/java/android/telephony/CarrierRestrictionRules.java
+++ b/telephony/java/android/telephony/CarrierRestrictionRules.java
@@ -177,7 +177,8 @@
      * @return a list of boolean with the same size as input, indicating if each
      * {@link CarrierIdentifier} is allowed or not.
      */
-    public List<Boolean> isCarrierIdentifiersAllowed(@NonNull List<CarrierIdentifier> carrierIds) {
+    public @NonNull List<Boolean> areCarrierIdentifiersAllowed(
+            @NonNull List<CarrierIdentifier> carrierIds) {
         ArrayList<Boolean> result = new ArrayList<>(carrierIds.size());
 
         // First calculate the result for each slot independently
@@ -309,7 +310,7 @@
     /**
      * {@link Parcelable.Creator}
      */
-    public static final Creator<CarrierRestrictionRules> CREATOR =
+    public static final @android.annotation.NonNull Creator<CarrierRestrictionRules> CREATOR =
             new Creator<CarrierRestrictionRules>() {
         @Override
         public CarrierRestrictionRules createFromParcel(Parcel in) {
@@ -332,7 +333,7 @@
     /**
      * Builder for a {@link CarrierRestrictionRules}.
      */
-    public static class Builder {
+    public static final class Builder {
         private final CarrierRestrictionRules mRules;
 
         /** {@hide} */
@@ -341,14 +342,14 @@
         }
 
         /** build command */
-        public CarrierRestrictionRules build() {
+        public @NonNull CarrierRestrictionRules build() {
             return mRules;
         }
 
         /**
          * Indicate that all carriers are allowed.
          */
-        public Builder setAllCarriersAllowed() {
+        public @NonNull Builder setAllCarriersAllowed() {
             mRules.mAllowedCarriers.clear();
             mRules.mExcludedCarriers.clear();
             mRules.mCarrierRestrictionDefault = CARRIER_RESTRICTION_DEFAULT_ALLOWED;
@@ -360,7 +361,8 @@
          *
          * @param allowedCarriers list of allowed carriers
          */
-        public Builder setAllowedCarriers(List<CarrierIdentifier> allowedCarriers) {
+        public @NonNull Builder setAllowedCarriers(
+                @NonNull List<CarrierIdentifier> allowedCarriers) {
             mRules.mAllowedCarriers = new ArrayList<CarrierIdentifier>(allowedCarriers);
             return this;
         }
@@ -370,7 +372,8 @@
          *
          * @param excludedCarriers list of excluded carriers
          */
-        public Builder setExcludedCarriers(List<CarrierIdentifier> excludedCarriers) {
+        public @NonNull Builder setExcludedCarriers(
+                @NonNull List<CarrierIdentifier> excludedCarriers) {
             mRules.mExcludedCarriers = new ArrayList<CarrierIdentifier>(excludedCarriers);
             return this;
         }
@@ -380,7 +383,7 @@
          *
          * @param carrierRestrictionDefault prioritized carrier list
          */
-        public Builder setDefaultCarrierRestriction(
+        public @NonNull Builder setDefaultCarrierRestriction(
                 @CarrierRestrictionDefault int carrierRestrictionDefault) {
             mRules.mCarrierRestrictionDefault = carrierRestrictionDefault;
             return this;
@@ -391,7 +394,7 @@
          *
          * @param multiSimPolicy multi SIM policy
          */
-        public Builder setMultiSimPolicy(@MultiSimPolicy int multiSimPolicy) {
+        public @NonNull Builder setMultiSimPolicy(@MultiSimPolicy int multiSimPolicy) {
             mRules.mMultiSimPolicy = multiSimPolicy;
             return this;
         }
diff --git a/telephony/java/android/telephony/CellConfigLte.java b/telephony/java/android/telephony/CellConfigLte.java
index eafbfbc..4b57d71 100644
--- a/telephony/java/android/telephony/CellConfigLte.java
+++ b/telephony/java/android/telephony/CellConfigLte.java
@@ -96,7 +96,7 @@
         mIsEndcAvailable = in.readBoolean();
     }
 
-    public static final Creator<CellConfigLte> CREATOR = new Creator<CellConfigLte>() {
+    public static final @android.annotation.NonNull Creator<CellConfigLte> CREATOR = new Creator<CellConfigLte>() {
         @Override
         public CellConfigLte createFromParcel(Parcel in) {
             return new CellConfigLte(in);
diff --git a/telephony/java/android/telephony/CellIdentity.java b/telephony/java/android/telephony/CellIdentity.java
index 7655834..6c835dc 100644
--- a/telephony/java/android/telephony/CellIdentity.java
+++ b/telephony/java/android/telephony/CellIdentity.java
@@ -186,7 +186,7 @@
     }
 
     /** Implement the Parcelable interface */
-    public static final Creator<CellIdentity> CREATOR =
+    public static final @android.annotation.NonNull Creator<CellIdentity> CREATOR =
             new Creator<CellIdentity>() {
                 @Override
                 public CellIdentity createFromParcel(Parcel in) {
diff --git a/telephony/java/android/telephony/CellIdentityCdma.java b/telephony/java/android/telephony/CellIdentityCdma.java
index fa19867..daf80f5 100644
--- a/telephony/java/android/telephony/CellIdentityCdma.java
+++ b/telephony/java/android/telephony/CellIdentityCdma.java
@@ -244,7 +244,7 @@
 
     /** Implement the Parcelable interface */
     @SuppressWarnings("hiding")
-    public static final Creator<CellIdentityCdma> CREATOR =
+    public static final @android.annotation.NonNull Creator<CellIdentityCdma> CREATOR =
             new Creator<CellIdentityCdma>() {
         @Override
         public CellIdentityCdma createFromParcel(Parcel in) {
diff --git a/telephony/java/android/telephony/CellIdentityGsm.java b/telephony/java/android/telephony/CellIdentityGsm.java
index 9a24e47..6328afc 100644
--- a/telephony/java/android/telephony/CellIdentityGsm.java
+++ b/telephony/java/android/telephony/CellIdentityGsm.java
@@ -260,7 +260,7 @@
 
     /** Implement the Parcelable interface */
     @SuppressWarnings("hiding")
-    public static final Creator<CellIdentityGsm> CREATOR =
+    public static final @android.annotation.NonNull Creator<CellIdentityGsm> CREATOR =
             new Creator<CellIdentityGsm>() {
                 @Override
                 public CellIdentityGsm createFromParcel(Parcel in) {
diff --git a/telephony/java/android/telephony/CellIdentityLte.java b/telephony/java/android/telephony/CellIdentityLte.java
index 51393b9..e112004 100644
--- a/telephony/java/android/telephony/CellIdentityLte.java
+++ b/telephony/java/android/telephony/CellIdentityLte.java
@@ -294,7 +294,7 @@
 
     /** Implement the Parcelable interface */
     @SuppressWarnings("hiding")
-    public static final Creator<CellIdentityLte> CREATOR =
+    public static final @android.annotation.NonNull Creator<CellIdentityLte> CREATOR =
             new Creator<CellIdentityLte>() {
                 @Override
                 public CellIdentityLte createFromParcel(Parcel in) {
diff --git a/telephony/java/android/telephony/CellIdentityNr.java b/telephony/java/android/telephony/CellIdentityNr.java
index 856f081..5a89ae8 100644
--- a/telephony/java/android/telephony/CellIdentityNr.java
+++ b/telephony/java/android/telephony/CellIdentityNr.java
@@ -81,18 +81,22 @@
     /**
      * Get the NR Cell Identity.
      *
-     * @return The NR Cell Identity in range [0, 68719476735] or Long.MAX_VALUE if unknown.
+     * @return The 36-bit NR Cell Identity in range [0, 68719476735] or
+     *         {@link CellInfo#UNAVAILABLE_LONG} if unknown.
      */
     public long getNci() {
         return mNci;
     }
 
     /**
-     * Get the Absolute Radio Frequency Channel Number.
+     * Get the New Radio Absolute Radio Frequency Channel Number.
+     *
+     * Reference: 3GPP TS 38.101-1 section 5.4.2.1 NR-ARFCN and channel raster.
+     * Reference: 3GPP TS 38.101-2 section 5.4.2.1 NR-ARFCN and channel raster.
+     *
      * @return Integer value in range [0, 3279165] or {@link CellInfo#UNAVAILABLE} if unknown.
      */
-    @Override
-    public int getChannelNumber() {
+    public int getNrarfcn() {
         return mNrArfcn;
     }
 
@@ -160,7 +164,7 @@
     }
 
     /** Implement the Parcelable interface */
-    public static final Creator<CellIdentityNr> CREATOR =
+    public static final @android.annotation.NonNull Creator<CellIdentityNr> CREATOR =
             new Creator<CellIdentityNr>() {
                 @Override
                 public CellIdentityNr createFromParcel(Parcel in) {
diff --git a/telephony/java/android/telephony/CellIdentityTdscdma.java b/telephony/java/android/telephony/CellIdentityTdscdma.java
index dba437a..10ffb80 100644
--- a/telephony/java/android/telephony/CellIdentityTdscdma.java
+++ b/telephony/java/android/telephony/CellIdentityTdscdma.java
@@ -226,7 +226,7 @@
 
     /** Implement the Parcelable interface */
     @SuppressWarnings("hiding")
-    public static final Creator<CellIdentityTdscdma> CREATOR =
+    public static final @android.annotation.NonNull Creator<CellIdentityTdscdma> CREATOR =
             new Creator<CellIdentityTdscdma>() {
                 @Override
                 public CellIdentityTdscdma createFromParcel(Parcel in) {
diff --git a/telephony/java/android/telephony/CellIdentityWcdma.java b/telephony/java/android/telephony/CellIdentityWcdma.java
index 6e09784..b1944af 100644
--- a/telephony/java/android/telephony/CellIdentityWcdma.java
+++ b/telephony/java/android/telephony/CellIdentityWcdma.java
@@ -251,7 +251,7 @@
 
     /** Implement the Parcelable interface */
     @SuppressWarnings("hiding")
-    public static final Creator<CellIdentityWcdma> CREATOR =
+    public static final @android.annotation.NonNull Creator<CellIdentityWcdma> CREATOR =
             new Creator<CellIdentityWcdma>() {
                 @Override
                 public CellIdentityWcdma createFromParcel(Parcel in) {
diff --git a/telephony/java/android/telephony/CellInfo.java b/telephony/java/android/telephony/CellInfo.java
index 8ce5c54..1796034 100644
--- a/telephony/java/android/telephony/CellInfo.java
+++ b/telephony/java/android/telephony/CellInfo.java
@@ -22,7 +22,6 @@
 import android.hardware.radio.V1_4.CellInfo.Info;
 import android.os.Parcel;
 import android.os.Parcelable;
-import android.os.SystemClock;
 
 import com.android.internal.annotations.VisibleForTesting;
 
@@ -40,6 +39,11 @@
     public static final int UNAVAILABLE = Integer.MAX_VALUE;
 
     /**
+     * This value indicates that the long field is unreported.
+     */
+    public static final long UNAVAILABLE_LONG = Long.MAX_VALUE;
+
+    /**
      * Cell identity type
      * @hide
      */
@@ -284,7 +288,7 @@
     }
 
     /** Implement the Parcelable interface */
-    public static final Creator<CellInfo> CREATOR = new Creator<CellInfo>() {
+    public static final @android.annotation.NonNull Creator<CellInfo> CREATOR = new Creator<CellInfo>() {
         @Override
         public CellInfo createFromParcel(Parcel in) {
                 int type = in.readInt();
@@ -320,9 +324,9 @@
     }
 
     /** @hide */
-    protected CellInfo(android.hardware.radio.V1_4.CellInfo ci) {
+    protected CellInfo(android.hardware.radio.V1_4.CellInfo ci, long timeStamp) {
         this.mRegistered = ci.isRegistered;
-        this.mTimeStamp = SystemClock.elapsedRealtimeNanos();
+        this.mTimeStamp = timeStamp;
         this.mCellConnectionStatus = ci.connectionStatus;
     }
 
@@ -353,14 +357,14 @@
     }
 
     /** @hide */
-    public static CellInfo create(android.hardware.radio.V1_4.CellInfo ci) {
+    public static CellInfo create(android.hardware.radio.V1_4.CellInfo ci, long timeStamp) {
         if (ci == null) return null;
         switch (ci.info.getDiscriminator()) {
-            case Info.hidl_discriminator.gsm: return new CellInfoGsm(ci);
-            case Info.hidl_discriminator.cdma: return new CellInfoCdma(ci);
-            case Info.hidl_discriminator.lte: return new CellInfoLte(ci);
-            case Info.hidl_discriminator.wcdma: return new CellInfoWcdma(ci);
-            case Info.hidl_discriminator.tdscdma: return new CellInfoTdscdma(ci);
+            case Info.hidl_discriminator.gsm: return new CellInfoGsm(ci, timeStamp);
+            case Info.hidl_discriminator.cdma: return new CellInfoCdma(ci, timeStamp);
+            case Info.hidl_discriminator.lte: return new CellInfoLte(ci, timeStamp);
+            case Info.hidl_discriminator.wcdma: return new CellInfoWcdma(ci, timeStamp);
+            case Info.hidl_discriminator.tdscdma: return new CellInfoTdscdma(ci, timeStamp);
             default: return null;
         }
     }
diff --git a/telephony/java/android/telephony/CellInfoCdma.java b/telephony/java/android/telephony/CellInfoCdma.java
index 4440108..82bb3961 100644
--- a/telephony/java/android/telephony/CellInfoCdma.java
+++ b/telephony/java/android/telephony/CellInfoCdma.java
@@ -68,8 +68,8 @@
     }
 
     /** @hide */
-    public CellInfoCdma(android.hardware.radio.V1_4.CellInfo ci) {
-        super(ci);
+    public CellInfoCdma(android.hardware.radio.V1_4.CellInfo ci, long timeStamp) {
+        super(ci, timeStamp);
         final android.hardware.radio.V1_2.CellInfoCdma cic = ci.info.cdma();
         mCellIdentityCdma = new CellIdentityCdma(cic.cellIdentityCdma);
         mCellSignalStrengthCdma =
@@ -156,7 +156,7 @@
     }
 
     /** Implement the Parcelable interface */
-    public static final Creator<CellInfoCdma> CREATOR = new Creator<CellInfoCdma>() {
+    public static final @android.annotation.NonNull Creator<CellInfoCdma> CREATOR = new Creator<CellInfoCdma>() {
         @Override
         public CellInfoCdma createFromParcel(Parcel in) {
             in.readInt(); // Skip past token, we know what it is
diff --git a/telephony/java/android/telephony/CellInfoGsm.java b/telephony/java/android/telephony/CellInfoGsm.java
index 248adfc..59fcd1e 100644
--- a/telephony/java/android/telephony/CellInfoGsm.java
+++ b/telephony/java/android/telephony/CellInfoGsm.java
@@ -64,8 +64,8 @@
     }
 
     /** @hide */
-    public CellInfoGsm(android.hardware.radio.V1_4.CellInfo ci) {
-        super(ci);
+    public CellInfoGsm(android.hardware.radio.V1_4.CellInfo ci, long timeStamp) {
+        super(ci, timeStamp);
         final android.hardware.radio.V1_2.CellInfoGsm cig = ci.info.gsm();
         mCellIdentityGsm = new CellIdentityGsm(cig.cellIdentityGsm);
         mCellSignalStrengthGsm = new CellSignalStrengthGsm(cig.signalStrengthGsm);
@@ -149,7 +149,7 @@
     }
 
     /** Implement the Parcelable interface */
-    public static final Creator<CellInfoGsm> CREATOR = new Creator<CellInfoGsm>() {
+    public static final @android.annotation.NonNull Creator<CellInfoGsm> CREATOR = new Creator<CellInfoGsm>() {
         @Override
         public CellInfoGsm createFromParcel(Parcel in) {
             in.readInt(); // Skip past token, we know what it is
diff --git a/telephony/java/android/telephony/CellInfoLte.java b/telephony/java/android/telephony/CellInfoLte.java
index 8e8ce8a..08dafe1 100644
--- a/telephony/java/android/telephony/CellInfoLte.java
+++ b/telephony/java/android/telephony/CellInfoLte.java
@@ -71,8 +71,8 @@
     }
 
     /** @hide */
-    public CellInfoLte(android.hardware.radio.V1_4.CellInfo ci) {
-        super(ci);
+    public CellInfoLte(android.hardware.radio.V1_4.CellInfo ci, long timeStamp) {
+        super(ci, timeStamp);
         final android.hardware.radio.V1_4.CellInfoLte cil = ci.info.lte();
         mCellIdentityLte = new CellIdentityLte(cil.base.cellIdentityLte);
         mCellSignalStrengthLte = new CellSignalStrengthLte(cil.base.signalStrengthLte);
@@ -179,7 +179,7 @@
     }
 
     /** Implement the Parcelable interface */
-    public static final Creator<CellInfoLte> CREATOR = new Creator<CellInfoLte>() {
+    public static final @android.annotation.NonNull Creator<CellInfoLte> CREATOR = new Creator<CellInfoLte>() {
         @Override
         public CellInfoLte createFromParcel(Parcel in) {
             in.readInt(); // Skip past token, we know what it is
diff --git a/telephony/java/android/telephony/CellInfoNr.java b/telephony/java/android/telephony/CellInfoNr.java
index 11857a6..fb147ce 100644
--- a/telephony/java/android/telephony/CellInfoNr.java
+++ b/telephony/java/android/telephony/CellInfoNr.java
@@ -79,7 +79,7 @@
         mCellSignalStrength.writeToParcel(dest, flags);
     }
 
-    public static final Creator<CellInfoNr> CREATOR = new Creator<CellInfoNr>() {
+    public static final @android.annotation.NonNull Creator<CellInfoNr> CREATOR = new Creator<CellInfoNr>() {
         @Override
         public CellInfoNr createFromParcel(Parcel in) {
             // Skip the type info.
diff --git a/telephony/java/android/telephony/CellInfoTdscdma.java b/telephony/java/android/telephony/CellInfoTdscdma.java
index 2ab38fb..93baabf 100644
--- a/telephony/java/android/telephony/CellInfoTdscdma.java
+++ b/telephony/java/android/telephony/CellInfoTdscdma.java
@@ -65,8 +65,8 @@
     }
 
     /** @hide */
-    public CellInfoTdscdma(android.hardware.radio.V1_4.CellInfo ci) {
-        super(ci);
+    public CellInfoTdscdma(android.hardware.radio.V1_4.CellInfo ci, long timeStamp) {
+        super(ci, timeStamp);
         final android.hardware.radio.V1_2.CellInfoTdscdma cit = ci.info.tdscdma();
         mCellIdentityTdscdma = new CellIdentityTdscdma(cit.cellIdentityTdscdma);
         mCellSignalStrengthTdscdma = new CellSignalStrengthTdscdma(cit.signalStrengthTdscdma);
@@ -149,7 +149,7 @@
     }
 
     /** Implement the Parcelable interface */
-    public static final Creator<CellInfoTdscdma> CREATOR = new Creator<CellInfoTdscdma>() {
+    public static final @android.annotation.NonNull Creator<CellInfoTdscdma> CREATOR = new Creator<CellInfoTdscdma>() {
         @Override
         public CellInfoTdscdma createFromParcel(Parcel in) {
             in.readInt(); // Skip past token, we know what it is
diff --git a/telephony/java/android/telephony/CellInfoWcdma.java b/telephony/java/android/telephony/CellInfoWcdma.java
index 65e0470..02dbb1a 100644
--- a/telephony/java/android/telephony/CellInfoWcdma.java
+++ b/telephony/java/android/telephony/CellInfoWcdma.java
@@ -64,8 +64,8 @@
     }
 
     /** @hide */
-    public CellInfoWcdma(android.hardware.radio.V1_4.CellInfo ci) {
-        super(ci);
+    public CellInfoWcdma(android.hardware.radio.V1_4.CellInfo ci, long timeStamp) {
+        super(ci, timeStamp);
         final android.hardware.radio.V1_2.CellInfoWcdma ciw = ci.info.wcdma();
         mCellIdentityWcdma = new CellIdentityWcdma(ciw.cellIdentityWcdma);
         mCellSignalStrengthWcdma = new CellSignalStrengthWcdma(ciw.signalStrengthWcdma);
@@ -149,7 +149,7 @@
     }
 
     /** Implement the Parcelable interface */
-    public static final Creator<CellInfoWcdma> CREATOR = new Creator<CellInfoWcdma>() {
+    public static final @android.annotation.NonNull Creator<CellInfoWcdma> CREATOR = new Creator<CellInfoWcdma>() {
         @Override
         public CellInfoWcdma createFromParcel(Parcel in) {
             in.readInt(); // Skip past token, we know what it is
diff --git a/telephony/java/android/telephony/CellSignalStrengthCdma.java b/telephony/java/android/telephony/CellSignalStrengthCdma.java
index 47faf1e..5b19599 100644
--- a/telephony/java/android/telephony/CellSignalStrengthCdma.java
+++ b/telephony/java/android/telephony/CellSignalStrengthCdma.java
@@ -464,7 +464,7 @@
 
     /** Implement the Parcelable interface */
     @SuppressWarnings("hiding")
-    public static final Parcelable.Creator<CellSignalStrengthCdma> CREATOR =
+    public static final @android.annotation.NonNull Parcelable.Creator<CellSignalStrengthCdma> CREATOR =
             new Parcelable.Creator<CellSignalStrengthCdma>() {
         @Override
         public CellSignalStrengthCdma createFromParcel(Parcel in) {
diff --git a/telephony/java/android/telephony/CellSignalStrengthGsm.java b/telephony/java/android/telephony/CellSignalStrengthGsm.java
index a4207c9..0aeb0f6 100644
--- a/telephony/java/android/telephony/CellSignalStrengthGsm.java
+++ b/telephony/java/android/telephony/CellSignalStrengthGsm.java
@@ -151,6 +151,17 @@
     }
 
     /**
+     * Return the Received Signal Strength Indicator
+     *
+     * @return the RSSI in dBm (-113, -51) or
+     *         {@link android.telephony.CellInfo#UNAVAILABLE UNAVAILABLE}.
+     * @hide
+     */
+    public int getRssi() {
+        return mRssi;
+    }
+
+    /**
      * Return the Bit Error Rate
      *
      * @return the bit error rate (0-7, 99) as defined in TS 27.007 8.5 or
@@ -226,7 +237,7 @@
 
     /** Implement the Parcelable interface */
     @SuppressWarnings("hiding")
-    public static final Parcelable.Creator<CellSignalStrengthGsm> CREATOR =
+    public static final @android.annotation.NonNull Parcelable.Creator<CellSignalStrengthGsm> CREATOR =
             new Parcelable.Creator<CellSignalStrengthGsm>() {
         @Override
         public CellSignalStrengthGsm createFromParcel(Parcel in) {
diff --git a/telephony/java/android/telephony/CellSignalStrengthLte.java b/telephony/java/android/telephony/CellSignalStrengthLte.java
index 61c6b48..5687ada 100644
--- a/telephony/java/android/telephony/CellSignalStrengthLte.java
+++ b/telephony/java/android/telephony/CellSignalStrengthLte.java
@@ -432,7 +432,7 @@
 
     /** Implement the Parcelable interface */
     @SuppressWarnings("hiding")
-    public static final Parcelable.Creator<CellSignalStrengthLte> CREATOR =
+    public static final @android.annotation.NonNull Parcelable.Creator<CellSignalStrengthLte> CREATOR =
             new Parcelable.Creator<CellSignalStrengthLte>() {
         @Override
         public CellSignalStrengthLte createFromParcel(Parcel in) {
diff --git a/telephony/java/android/telephony/CellSignalStrengthNr.java b/telephony/java/android/telephony/CellSignalStrengthNr.java
index 6f84ec5..fff3adf 100644
--- a/telephony/java/android/telephony/CellSignalStrengthNr.java
+++ b/telephony/java/android/telephony/CellSignalStrengthNr.java
@@ -289,7 +289,7 @@
     }
 
     /** Implement the Parcelable interface */
-    public static final Parcelable.Creator<CellSignalStrengthNr> CREATOR =
+    public static final @android.annotation.NonNull Parcelable.Creator<CellSignalStrengthNr> CREATOR =
             new Parcelable.Creator<CellSignalStrengthNr>() {
         @Override
         public CellSignalStrengthNr createFromParcel(Parcel in) {
diff --git a/telephony/java/android/telephony/CellSignalStrengthTdscdma.java b/telephony/java/android/telephony/CellSignalStrengthTdscdma.java
index 5ae89b0..e79643f 100644
--- a/telephony/java/android/telephony/CellSignalStrengthTdscdma.java
+++ b/telephony/java/android/telephony/CellSignalStrengthTdscdma.java
@@ -237,7 +237,7 @@
 
     /** Implement the Parcelable interface */
     @SuppressWarnings("hiding")
-    public static final Parcelable.Creator<CellSignalStrengthTdscdma> CREATOR =
+    public static final @android.annotation.NonNull Parcelable.Creator<CellSignalStrengthTdscdma> CREATOR =
             new Parcelable.Creator<CellSignalStrengthTdscdma>() {
         @Override
         public CellSignalStrengthTdscdma createFromParcel(Parcel in) {
diff --git a/telephony/java/android/telephony/CellSignalStrengthWcdma.java b/telephony/java/android/telephony/CellSignalStrengthWcdma.java
index efa3647..d9fd7f3 100644
--- a/telephony/java/android/telephony/CellSignalStrengthWcdma.java
+++ b/telephony/java/android/telephony/CellSignalStrengthWcdma.java
@@ -333,7 +333,7 @@
 
     /** Implement the Parcelable interface */
     @SuppressWarnings("hiding")
-    public static final Parcelable.Creator<CellSignalStrengthWcdma> CREATOR =
+    public static final @android.annotation.NonNull Parcelable.Creator<CellSignalStrengthWcdma> CREATOR =
             new Parcelable.Creator<CellSignalStrengthWcdma>() {
         @Override
         public CellSignalStrengthWcdma createFromParcel(Parcel in) {
diff --git a/telephony/java/android/telephony/ClientRequestStats.java b/telephony/java/android/telephony/ClientRequestStats.java
index 381c847..c787893 100644
--- a/telephony/java/android/telephony/ClientRequestStats.java
+++ b/telephony/java/android/telephony/ClientRequestStats.java
@@ -29,7 +29,7 @@
  * @hide
  */
 public final class ClientRequestStats implements Parcelable {
-    public static final Parcelable.Creator<ClientRequestStats> CREATOR =
+    public static final @android.annotation.NonNull Parcelable.Creator<ClientRequestStats> CREATOR =
             new Parcelable.Creator<ClientRequestStats>() {
 
                 public ClientRequestStats createFromParcel(Parcel in) {
diff --git a/telephony/java/android/telephony/DataConnectionRealTimeInfo.java b/telephony/java/android/telephony/DataConnectionRealTimeInfo.java
index fc4e17a..8106f5f 100644
--- a/telephony/java/android/telephony/DataConnectionRealTimeInfo.java
+++ b/telephony/java/android/telephony/DataConnectionRealTimeInfo.java
@@ -92,7 +92,7 @@
         out.writeInt(mDcPowerState);
     }
 
-    public static final Parcelable.Creator<DataConnectionRealTimeInfo> CREATOR
+    public static final @android.annotation.NonNull Parcelable.Creator<DataConnectionRealTimeInfo> CREATOR
             = new Parcelable.Creator<DataConnectionRealTimeInfo>() {
 
         @Override
diff --git a/telephony/java/android/telephony/DataSpecificRegistrationStates.java b/telephony/java/android/telephony/DataSpecificRegistrationStates.java
index d6a8065..8eb345a 100644
--- a/telephony/java/android/telephony/DataSpecificRegistrationStates.java
+++ b/telephony/java/android/telephony/DataSpecificRegistrationStates.java
@@ -1,5 +1,7 @@
 package android.telephony;
 
+import android.annotation.NonNull;
+import android.annotation.SystemApi;
 import android.os.Parcel;
 import android.os.Parcelable;
 
@@ -10,14 +12,17 @@
  * Class that stores information specific to data network registration.
  * @hide
  */
-public class DataSpecificRegistrationStates implements Parcelable{
+@SystemApi
+public final class DataSpecificRegistrationStates implements Parcelable{
     /**
+     * @hide
      * The maximum number of simultaneous Data Calls that
      * must be established using setupDataCall().
      */
     public final int maxDataCalls;
 
     /**
+     * @hide
      * Indicates if the use of dual connectivity with NR is restricted.
      * Reference: 3GPP TS 24.301 v15.03 section 9.3.3.12A.
      */
@@ -25,7 +30,7 @@
 
     /**
      * Indicates if NR is supported by the selected PLMN.
-     *
+     * @hide
      * {@code true} if the bit N is in the PLMN-InfoList-r15 is true and the selected PLMN is
      * present in plmn-IdentityList at position N.
      * Reference: 3GPP TS 36.331 v15.2.2 section 6.3.1 PLMN-InfoList-r15.
@@ -34,6 +39,7 @@
     public final boolean isNrAvailable;
 
     /**
+     * @hide
      * Indicates that if E-UTRA-NR Dual Connectivity (EN-DC) is supported by the primary serving
      * cell.
      *
@@ -47,8 +53,11 @@
     /**
      * Provides network support info for LTE VoPS and LTE Emergency bearer support
      */
-    public final LteVopsSupportInfo lteVopsSupportInfo;
+    private final LteVopsSupportInfo lteVopsSupportInfo;
 
+    /**
+     * @hide
+     */
     DataSpecificRegistrationStates(
             int maxDataCalls, boolean isDcNrRestricted, boolean isNrAvailable,
             boolean isEnDcAvailable, LteVopsSupportInfo lteVops) {
@@ -114,7 +123,7 @@
                 && this.lteVopsSupportInfo.equals(other.lteVopsSupportInfo);
     }
 
-    public static final Parcelable.Creator<DataSpecificRegistrationStates> CREATOR =
+    public static final @android.annotation.NonNull Parcelable.Creator<DataSpecificRegistrationStates> CREATOR =
             new Parcelable.Creator<DataSpecificRegistrationStates>() {
                 @Override
                 public DataSpecificRegistrationStates createFromParcel(Parcel source) {
@@ -126,4 +135,12 @@
                     return new DataSpecificRegistrationStates[size];
                 }
             };
+
+    /**
+     * @return LteVopsSupportInfo
+     */
+    @NonNull
+    public LteVopsSupportInfo getLteVopsSupportInfo() {
+        return lteVopsSupportInfo;
+    }
 }
diff --git a/telephony/java/android/telephony/IccOpenLogicalChannelResponse.java b/telephony/java/android/telephony/IccOpenLogicalChannelResponse.java
index 4621f91..44ba70c 100644
--- a/telephony/java/android/telephony/IccOpenLogicalChannelResponse.java
+++ b/telephony/java/android/telephony/IccOpenLogicalChannelResponse.java
@@ -110,7 +110,7 @@
         }
     }
 
-    public static final Parcelable.Creator<IccOpenLogicalChannelResponse> CREATOR
+    public static final @android.annotation.NonNull Parcelable.Creator<IccOpenLogicalChannelResponse> CREATOR
              = new Parcelable.Creator<IccOpenLogicalChannelResponse>() {
 
         @Override
diff --git a/telephony/java/android/telephony/ImsiEncryptionInfo.java b/telephony/java/android/telephony/ImsiEncryptionInfo.java
index d2680ad..ef2f121 100644
--- a/telephony/java/android/telephony/ImsiEncryptionInfo.java
+++ b/telephony/java/android/telephony/ImsiEncryptionInfo.java
@@ -115,7 +115,7 @@
         return 0;
     }
 
-    public static final Parcelable.Creator<ImsiEncryptionInfo> CREATOR =
+    public static final @android.annotation.NonNull Parcelable.Creator<ImsiEncryptionInfo> CREATOR =
             new Parcelable.Creator<ImsiEncryptionInfo>() {
                 @Override
                 public ImsiEncryptionInfo createFromParcel(Parcel in) {
diff --git a/telephony/java/android/telephony/LocationAccessPolicy.java b/telephony/java/android/telephony/LocationAccessPolicy.java
index d98f37d..b9d8eb6 100644
--- a/telephony/java/android/telephony/LocationAccessPolicy.java
+++ b/telephony/java/android/telephony/LocationAccessPolicy.java
@@ -174,22 +174,22 @@
         boolean hasManifestPermission = checkManifestPermission(context, query.callingPid,
                 query.callingUid, permissionToCheck);
 
-        int appOpMode = context.getSystemService(AppOpsManager.class)
-                .noteOpNoThrow(AppOpsManager.permissionToOpCode(permissionToCheck),
-                        query.callingUid, query.callingPackage);
-
-        if (hasManifestPermission && appOpMode == AppOpsManager.MODE_ALLOWED) {
-            // If the app did everything right, return without logging.
-            return LocationPermissionResult.ALLOWED;
-        }
-
-        // If the app has the manifest permission but not the app-op permission, it means that
-        // it's aware of the requirement and the user denied permission explicitly. If we see
-        // this, don't let any of the overrides happen.
         if (hasManifestPermission) {
-            Log.i(TAG, query.callingPackage + " is aware of " + locationTypeForLog + " but the"
-                    + " app-ops permission is specifically denied.");
-            return appOpsModeToPermissionResult(appOpMode);
+            // Only check the app op if the app has the permission.
+            int appOpMode = context.getSystemService(AppOpsManager.class)
+                    .noteOpNoThrow(AppOpsManager.permissionToOpCode(permissionToCheck),
+                            query.callingUid, query.callingPackage);
+            if (appOpMode == AppOpsManager.MODE_ALLOWED) {
+                // If the app did everything right, return without logging.
+                return LocationPermissionResult.ALLOWED;
+            } else {
+                // If the app has the manifest permission but not the app-op permission, it means
+                // that it's aware of the requirement and the user denied permission explicitly.
+                // If we see this, don't let any of the overrides happen.
+                Log.i(TAG, query.callingPackage + " is aware of " + locationTypeForLog + " but the"
+                        + " app-ops permission is specifically denied.");
+                return appOpsModeToPermissionResult(appOpMode);
+            }
         }
 
         int minSdkVersion = Manifest.permission.ACCESS_FINE_LOCATION.equals(permissionToCheck)
diff --git a/telephony/java/android/telephony/LteVopsSupportInfo.java b/telephony/java/android/telephony/LteVopsSupportInfo.java
index 0ae85c0..ee45f07 100644
--- a/telephony/java/android/telephony/LteVopsSupportInfo.java
+++ b/telephony/java/android/telephony/LteVopsSupportInfo.java
@@ -117,7 +117,7 @@
                 + " mEmcBearerSupport = " + mEmcBearerSupport);
     }
 
-    public static final Creator<LteVopsSupportInfo> CREATOR =
+    public static final @android.annotation.NonNull Creator<LteVopsSupportInfo> CREATOR =
             new Creator<LteVopsSupportInfo>() {
         @Override
         public LteVopsSupportInfo createFromParcel(Parcel in) {
diff --git a/telephony/java/android/telephony/MbmsGroupCallSession.java b/telephony/java/android/telephony/MbmsGroupCallSession.java
index 269cda1..f1be31f 100644
--- a/telephony/java/android/telephony/MbmsGroupCallSession.java
+++ b/telephony/java/android/telephony/MbmsGroupCallSession.java
@@ -141,7 +141,7 @@
      * Create a new {@link MbmsGroupCallSession} using the system default data subscription ID.
      * See {@link #create(Context, int, Executor, MbmsGroupCallSessionCallback)}.
      */
-    public static MbmsGroupCallSession create(@NonNull Context context,
+    public static @Nullable MbmsGroupCallSession create(@NonNull Context context,
             @NonNull Executor executor, @NonNull MbmsGroupCallSessionCallback callback) {
         return create(context, SubscriptionManager.getDefaultSubscriptionId(), executor, callback);
     }
diff --git a/telephony/java/android/telephony/ModemActivityInfo.java b/telephony/java/android/telephony/ModemActivityInfo.java
index 521adef..a0af392 100644
--- a/telephony/java/android/telephony/ModemActivityInfo.java
+++ b/telephony/java/android/telephony/ModemActivityInfo.java
@@ -71,7 +71,7 @@
         return 0;
     }
 
-    public static final Parcelable.Creator<ModemActivityInfo> CREATOR =
+    public static final @android.annotation.NonNull Parcelable.Creator<ModemActivityInfo> CREATOR =
             new Parcelable.Creator<ModemActivityInfo>() {
         public ModemActivityInfo createFromParcel(Parcel in) {
             long timestamp = in.readLong();
diff --git a/telephony/java/android/telephony/ModemInfo.java b/telephony/java/android/telephony/ModemInfo.java
index 27a5121..c0833af 100644
--- a/telephony/java/android/telephony/ModemInfo.java
+++ b/telephony/java/android/telephony/ModemInfo.java
@@ -97,7 +97,7 @@
         dest.writeBoolean(isDataSupported);
     }
 
-    public static final Parcelable.Creator<ModemInfo> CREATOR = new Parcelable.Creator() {
+    public static final @android.annotation.NonNull Parcelable.Creator<ModemInfo> CREATOR = new Parcelable.Creator() {
         public ModemInfo createFromParcel(Parcel in) {
             return new ModemInfo(in);
         }
diff --git a/telephony/java/android/telephony/NeighboringCellInfo.java b/telephony/java/android/telephony/NeighboringCellInfo.java
index 1c615ab..023ed30 100644
--- a/telephony/java/android/telephony/NeighboringCellInfo.java
+++ b/telephony/java/android/telephony/NeighboringCellInfo.java
@@ -331,7 +331,7 @@
         dest.writeInt(mNetworkType);
     }
 
-    public static final Parcelable.Creator<NeighboringCellInfo> CREATOR
+    public static final @android.annotation.NonNull Parcelable.Creator<NeighboringCellInfo> CREATOR
     = new Parcelable.Creator<NeighboringCellInfo>() {
         public NeighboringCellInfo createFromParcel(Parcel in) {
             return new NeighboringCellInfo(in);
diff --git a/telephony/java/android/telephony/NetworkRegistrationState.java b/telephony/java/android/telephony/NetworkRegistrationState.java
index 6e6d59e..a6c81db 100644
--- a/telephony/java/android/telephony/NetworkRegistrationState.java
+++ b/telephony/java/android/telephony/NetworkRegistrationState.java
@@ -17,11 +17,13 @@
 package android.telephony;
 
 import android.annotation.IntDef;
+import android.annotation.NonNull;
 import android.annotation.Nullable;
 import android.annotation.SystemApi;
 import android.os.Parcel;
 import android.os.Parcelable;
 import android.telephony.AccessNetworkConstants.TransportType;
+import android.telephony.TelephonyManager.NetworkType;
 
 import java.lang.annotation.Retention;
 import java.lang.annotation.RetentionPolicy;
@@ -140,6 +142,7 @@
     @ServiceState.RoamingType
     private int mRoamingType;
 
+    @NetworkType
     private int mAccessNetworkTechnology;
 
     @NRStatus
@@ -149,6 +152,7 @@
 
     private final boolean mEmergencyOnly;
 
+    @ServiceType
     private final int[] mAvailableServices;
 
     @Nullable
@@ -167,9 +171,8 @@
      * @param regState Network registration state. Must be one of the {@link RegState}. For
      * {@link TransportType#WLAN} transport, only {@link #REG_STATE_HOME} and
      * {@link #REG_STATE_NOT_REG_NOT_SEARCHING} are valid states.
-     * @param accessNetworkTechnology Access network technology. Must be one of TelephonyManager
-     * NETWORK_TYPE_XXXX. For {@link TransportType#WLAN} transport, set to
-     * {@link TelephonyManager#NETWORK_TYPE_IWLAN}.
+     * @param accessNetworkTechnology Access network technology.For {@link TransportType#WLAN}
+     * transport, set to {@link TelephonyManager#NETWORK_TYPE_IWLAN}.
      * @param rejectCause Reason for denial if the registration state is {@link #REG_STATE_DENIED}.
      * Depending on {@code accessNetworkTechnology}, the values are defined in 3GPP TS 24.008
      * 10.5.3.6 for UMTS, 3GPP TS 24.301 9.9.3.9 for LTE, and 3GPP2 A.S0001 6.2.2.44 for CDMA. If
@@ -182,8 +185,9 @@
      * information is not available.
      */
     public NetworkRegistrationState(@Domain int domain, int transportType, @RegState int regState,
-                                    int accessNetworkTechnology, int rejectCause,
-                                    boolean emergencyOnly, int[] availableServices,
+                                    @NetworkType int accessNetworkTechnology, int rejectCause,
+                                    boolean emergencyOnly,
+                                    @NonNull @ServiceType int[] availableServices,
                                     @Nullable CellIdentity cellIdentity) {
         mDomain = domain;
         mTransportType = transportType;
@@ -230,7 +234,7 @@
         updateNrStatus(mDataSpecificStates);
     }
 
-    protected NetworkRegistrationState(Parcel source) {
+    private NetworkRegistrationState(Parcel source) {
         mDomain = source.readInt();
         mTransportType = source.readInt();
         mRegState = source.readInt();
@@ -285,6 +289,14 @@
     }
 
     /**
+     * @hide
+     * @return {@code true} if in service.
+     */
+    public boolean isInService() {
+        return mRegState == REG_STATE_HOME || mRegState == REG_STATE_ROAMING;
+    }
+
+    /**
      * Set {@link ServiceState.RoamingType roaming type}. This could override
      * roaming type based on resource overlay or carrier config.
      * @hide
@@ -309,25 +321,29 @@
     /**
      * @return List of available service types.
      */
+    @NonNull
+    @ServiceType
     public int[] getAvailableServices() { return mAvailableServices; }
 
     /**
-     * @return The access network technology {@link TelephonyManager.NetworkType}.
+     * @return The access network technology {@link NetworkType}.
      */
-    public @TelephonyManager.NetworkType int getAccessNetworkTechnology() {
+    public @NetworkType int getAccessNetworkTechnology() {
         return mAccessNetworkTechnology;
     }
 
     /**
-     * override the access network technology {@link TelephonyManager.NetworkType} e.g, rat ratchet.
+     * override the access network technology {@link NetworkType} e.g, rat ratchet.
      * @hide
      */
-    public void setAccessNetworkTechnology(@TelephonyManager.NetworkType int tech) {
+    public void setAccessNetworkTechnology(@NetworkType int tech) {
         mAccessNetworkTechnology = tech;
     }
 
     /**
-     * @return Network reject cause
+     * @return Reason for denial if the registration state is {@link #REG_STATE_DENIED}.
+     * Depending on {@code accessNetworkTechnology}, the values are defined in 3GPP TS 24.008
+     * 10.5.3.6 for UMTS, 3GPP TS 24.301 9.9.3.9 for LTE, and 3GPP2 A.S0001 6.2.2.44 for CDMA
      */
     public int getRejectCause() {
         return mRejectCause;
@@ -336,6 +352,7 @@
     /**
      * @return The cell information.
      */
+    @Nullable
     public CellIdentity getCellIdentity() {
         return mCellIdentity;
     }
@@ -349,7 +366,7 @@
     }
 
     /**
-     * @hide
+     * @return Data registration related info
      */
     @Nullable
     public DataSpecificRegistrationStates getDataSpecificStates() {
@@ -509,7 +526,7 @@
         }
     }
 
-    public static final Parcelable.Creator<NetworkRegistrationState> CREATOR =
+    public static final @android.annotation.NonNull Parcelable.Creator<NetworkRegistrationState> CREATOR =
             new Parcelable.Creator<NetworkRegistrationState>() {
         @Override
         public NetworkRegistrationState createFromParcel(Parcel source) {
@@ -539,4 +556,192 @@
         p.recycle();
         return result;
     }
+
+    /**
+     * Provides a convenient way to set the fields of a {@link NetworkRegistrationState} when
+     * creating a new instance.
+     *
+     * <p>The example below shows how you might create a new {@code NetworkRegistrationState}:
+     *
+     * <pre><code>
+     *
+     * NetworkRegistrationState nrs = new NetworkRegistrationState.Builder()
+     *     .setApnTypeBitmask(ApnSetting.TYPE_DEFAULT | ApnSetting.TYPE_MMS)
+     *     .setApnName("apn.example.com")
+     *     .setEntryName("Example Carrier APN")
+     *     .setMmsc(Uri.parse("http://mms.example.com:8002"))
+     *     .setMmsProxyAddress(mmsProxy)
+     *     .setMmsProxyPort(8799)
+     *     .build();
+     * </code></pre>
+     */
+    public static class Builder{
+        @Domain
+        private int mDomain;
+
+        private int mTransportType;
+
+        @RegState
+        private int mRegState;
+
+        @ServiceState.RoamingType
+        private int mRoamingType;
+
+        @NetworkType
+        private int mAccessNetworkTechnology;
+
+        @NRStatus
+        private int mNrStatus;
+
+        private int mRejectCause;
+
+        private boolean mEmergencyOnly;
+
+        @ServiceType
+        private int[] mAvailableServices;
+
+        @Nullable
+        private CellIdentity mCellIdentity;
+
+        /**
+         * Default constructor for Builder.
+         */
+        public Builder() {}
+
+        /**
+         * Set the network domain.
+         *
+         * @param domain Network domain.
+         *
+         * @return The same instance of the builder.
+         */
+        public @NonNull Builder setDomain(@Domain int domain) {
+            mDomain = domain;
+            return this;
+        }
+
+        /**
+         * Set the transport type.
+         *
+         * @param transportType Transport type.
+         *
+         * @return The same instance of the builder.
+         */
+        public @NonNull Builder setTransportType(int transportType) {
+            mTransportType = transportType;
+            return this;
+        }
+
+        /**
+         * Set the registration state.
+         *
+         * @param regState The registration state.
+         *
+         * @return The same instance of the builder.
+         */
+        public @NonNull Builder setRegState(@RegState int regState) {
+            mRegState = regState;
+            return this;
+        }
+
+        /**
+         * Set the roaming type.
+         *
+         * @param roamingType Roaming type.
+         *
+         * @return The same instance of the builder.
+         */
+        public @NonNull Builder setRoamingType(@ServiceState.RoamingType int roamingType) {
+            mRoamingType = roamingType;
+            return this;
+        }
+
+        /**
+         * Set tne access network technology.
+         *
+         * @return The same instance of the builder.
+         *
+         * @param accessNetworkTechnology The access network technology
+         */
+        public @NonNull Builder setAccessNetworkTechnology(
+                @NetworkType int accessNetworkTechnology) {
+            mAccessNetworkTechnology = accessNetworkTechnology;
+            return this;
+        }
+
+        /**
+         * Set the 5G NR connection status.
+         *
+         * @param nrStatus 5G NR connection status.
+         *
+         * @return The same instance of the builder.
+         */
+        public @NonNull Builder setNrStatus(@NRStatus int nrStatus) {
+            mNrStatus = nrStatus;
+            return this;
+        }
+
+        /**
+         * Set the network reject cause.
+         *
+         * @param rejectCause Reason for denial if the registration state is
+         * {@link #REG_STATE_DENIED}.Depending on {@code accessNetworkTechnology}, the values are
+         * defined in 3GPP TS 24.008 10.5.3.6 for UMTS, 3GPP TS 24.301 9.9.3.9 for LTE, and 3GPP2
+         * A.S0001 6.2.2.44 for CDMA. If the reject cause is not supported or unknown, set it to 0.
+         *
+         * @return The same instance of the builder.
+         */
+        public @NonNull Builder setRejectCause(int rejectCause) {
+            mRejectCause = rejectCause;
+            return this;
+        }
+
+        /**
+         * Set emergency only.
+         *
+         * @param emergencyOnly True if this network registration is for emergency use only.
+         *
+         * @return The same instance of the builder.
+         */
+        public @NonNull Builder setEmergencyOnly(boolean emergencyOnly) {
+            mEmergencyOnly = emergencyOnly;
+            return this;
+        }
+
+        /**
+         * Set the available services.
+         *
+         * @param availableServices Available services.
+         *
+         * @return The same instance of the builder.
+         */
+        public @NonNull Builder setAvailableServices(
+                @NonNull @ServiceType int[] availableServices) {
+            mAvailableServices = availableServices;
+            return this;
+        }
+
+        /**
+         * Set the cell identity.
+         *
+         * @param cellIdentity The cell identity.
+         *
+         * @return The same instance of the builder.
+         */
+        public @NonNull Builder setCellIdentity(@Nullable CellIdentity cellIdentity) {
+            mCellIdentity = cellIdentity;
+            return this;
+        }
+
+        /**
+         * Build the NetworkRegistrationState.
+         *
+         * @return the NetworkRegistrationState object.
+         */
+        public @NonNull NetworkRegistrationState build() {
+            return new NetworkRegistrationState(mDomain, mTransportType, mRegState,
+                    mAccessNetworkTechnology, mRejectCause, mEmergencyOnly, mAvailableServices,
+                    mCellIdentity);
+        }
+    }
 }
diff --git a/telephony/java/android/telephony/NetworkScanRequest.java b/telephony/java/android/telephony/NetworkScanRequest.java
index 38678a3..465b6aa 100644
--- a/telephony/java/android/telephony/NetworkScanRequest.java
+++ b/telephony/java/android/telephony/NetworkScanRequest.java
@@ -267,7 +267,7 @@
                 + (mMccMncs.hashCode() * 59));
     }
 
-    public static final Creator<NetworkScanRequest> CREATOR =
+    public static final @android.annotation.NonNull Creator<NetworkScanRequest> CREATOR =
             new Creator<NetworkScanRequest>() {
                 @Override
                 public NetworkScanRequest createFromParcel(Parcel in) {
diff --git a/telephony/java/android/telephony/NetworkService.java b/telephony/java/android/telephony/NetworkService.java
index 6c45cc4..f1240e9 100644
--- a/telephony/java/android/telephony/NetworkService.java
+++ b/telephony/java/android/telephony/NetworkService.java
@@ -17,6 +17,7 @@
 package android.telephony;
 
 import android.annotation.NonNull;
+import android.annotation.Nullable;
 import android.annotation.SystemApi;
 import android.app.Service;
 import android.content.Intent;
@@ -26,6 +27,7 @@
 import android.os.Looper;
 import android.os.Message;
 import android.os.RemoteException;
+import android.telephony.NetworkRegistrationState.Domain;
 import android.util.SparseArray;
 
 import com.android.internal.annotations.VisibleForTesting;
@@ -81,36 +83,43 @@
      * service is associated with one physical SIM slot.
      */
     public abstract class NetworkServiceProvider implements AutoCloseable {
-        private final int mSlotId;
+        private final int mSlotIndex;
 
         private final List<INetworkServiceCallback>
                 mNetworkRegistrationStateChangedCallbacks = new ArrayList<>();
 
-        public NetworkServiceProvider(int slotId) {
-            mSlotId = slotId;
+        /**
+         * Constructor
+         * @param slotIndex SIM slot id the data service provider associated with.
+         */
+        public NetworkServiceProvider(int slotIndex) {
+            mSlotIndex = slotIndex;
         }
 
         /**
-         * @return SIM slot id the network service associated with.
+         * @return SIM slot index the network service associated with.
          */
-        public final int getSlotId() {
-            return mSlotId;
+        public final int getSlotIndex() {
+            return mSlotIndex;
         }
 
         /**
          * API to get network registration state. The result will be passed to the callback.
-         * @param domain
-         * @param callback
-         * @return SIM slot id the network service associated with.
+         * @param domain Network domain
+         * @param callback The callback for reporting network registration state
          */
-        public void getNetworkRegistrationState(int domain, NetworkServiceCallback callback) {
+        public void getNetworkRegistrationState(@Domain int domain,
+                                                @NonNull NetworkServiceCallback callback) {
             callback.onGetNetworkRegistrationStateComplete(
                     NetworkServiceCallback.RESULT_ERROR_UNSUPPORTED, null);
         }
 
+        /**
+         * Notify the system that network registration state is changed.
+         */
         public final void notifyNetworkRegistrationStateChanged() {
             mHandler.obtainMessage(NETWORK_SERVICE_INDICATION_NETWORK_STATE_CHANGED,
-                    mSlotId, 0, null).sendToTarget();
+                    mSlotIndex, 0, null).sendToTarget();
         }
 
         private void registerForStateChanged(@NonNull INetworkServiceCallback callback) {
@@ -152,23 +161,23 @@
 
         @Override
         public void handleMessage(Message message) {
-            final int slotId = message.arg1;
+            final int slotIndex = message.arg1;
             final INetworkServiceCallback callback = (INetworkServiceCallback) message.obj;
 
-            NetworkServiceProvider serviceProvider = mServiceMap.get(slotId);
+            NetworkServiceProvider serviceProvider = mServiceMap.get(slotIndex);
 
             switch (message.what) {
                 case NETWORK_SERVICE_CREATE_NETWORK_SERVICE_PROVIDER:
                     // If the service provider doesn't exist yet, we try to create it.
                     if (serviceProvider == null) {
-                        mServiceMap.put(slotId, createNetworkServiceProvider(slotId));
+                        mServiceMap.put(slotIndex, onCreateNetworkServiceProvider(slotIndex));
                     }
                     break;
                 case NETWORK_SERVICE_REMOVE_NETWORK_SERVICE_PROVIDER:
                     // If the service provider doesn't exist yet, we try to create it.
                     if (serviceProvider != null) {
                         serviceProvider.close();
-                        mServiceMap.remove(slotId);
+                        mServiceMap.remove(slotIndex);
                     }
                     break;
                 case NETWORK_SERVICE_REMOVE_ALL_NETWORK_SERVICE_PROVIDERS:
@@ -221,12 +230,12 @@
      * this method to facilitate the creation of {@link NetworkServiceProvider} instances. The system
      * will call this method after binding the network service for each active SIM slot id.
      *
-     * @param slotId SIM slot id the network service associated with.
+     * @param slotIndex SIM slot id the network service associated with.
      * @return Network service object
      */
-    protected abstract NetworkServiceProvider createNetworkServiceProvider(int slotId);
+    @Nullable
+    public abstract NetworkServiceProvider onCreateNetworkServiceProvider(int slotIndex);
 
-    /** @hide */
     @Override
     public IBinder onBind(Intent intent) {
         if (intent == null || !NETWORK_SERVICE_INTERFACE.equals(intent.getAction())) {
@@ -237,7 +246,6 @@
         return mBinder;
     }
 
-    /** @hide */
     @Override
     public boolean onUnbind(Intent intent) {
         mHandler.obtainMessage(NETWORK_SERVICE_REMOVE_ALL_NETWORK_SERVICE_PROVIDERS, 0,
@@ -250,6 +258,7 @@
     @Override
     public void onDestroy() {
         mHandlerThread.quit();
+        super.onDestroy();
     }
 
     /**
@@ -259,35 +268,35 @@
     private class INetworkServiceWrapper extends INetworkService.Stub {
 
         @Override
-        public void createNetworkServiceProvider(int slotId) {
-            mHandler.obtainMessage(NETWORK_SERVICE_CREATE_NETWORK_SERVICE_PROVIDER, slotId,
+        public void createNetworkServiceProvider(int slotIndex) {
+            mHandler.obtainMessage(NETWORK_SERVICE_CREATE_NETWORK_SERVICE_PROVIDER, slotIndex,
                     0, null).sendToTarget();
         }
 
         @Override
-        public void removeNetworkServiceProvider(int slotId) {
-            mHandler.obtainMessage(NETWORK_SERVICE_REMOVE_NETWORK_SERVICE_PROVIDER, slotId,
+        public void removeNetworkServiceProvider(int slotIndex) {
+            mHandler.obtainMessage(NETWORK_SERVICE_REMOVE_NETWORK_SERVICE_PROVIDER, slotIndex,
                     0, null).sendToTarget();
         }
 
         @Override
         public void getNetworkRegistrationState(
-                int slotId, int domain, INetworkServiceCallback callback) {
-            mHandler.obtainMessage(NETWORK_SERVICE_GET_REGISTRATION_STATE, slotId,
+                int slotIndex, int domain, INetworkServiceCallback callback) {
+            mHandler.obtainMessage(NETWORK_SERVICE_GET_REGISTRATION_STATE, slotIndex,
                     domain, callback).sendToTarget();
         }
 
         @Override
         public void registerForNetworkRegistrationStateChanged(
-                int slotId, INetworkServiceCallback callback) {
-            mHandler.obtainMessage(NETWORK_SERVICE_REGISTER_FOR_STATE_CHANGE, slotId,
+                int slotIndex, INetworkServiceCallback callback) {
+            mHandler.obtainMessage(NETWORK_SERVICE_REGISTER_FOR_STATE_CHANGE, slotIndex,
                     0, callback).sendToTarget();
         }
 
         @Override
         public void unregisterForNetworkRegistrationStateChanged(
-                int slotId,INetworkServiceCallback callback) {
-            mHandler.obtainMessage(NETWORK_SERVICE_UNREGISTER_FOR_STATE_CHANGE, slotId,
+                int slotIndex, INetworkServiceCallback callback) {
+            mHandler.obtainMessage(NETWORK_SERVICE_UNREGISTER_FOR_STATE_CHANGE, slotIndex,
                     0, callback).sendToTarget();
         }
     }
diff --git a/telephony/java/android/telephony/NetworkServiceCallback.java b/telephony/java/android/telephony/NetworkServiceCallback.java
index dbad02f..c2fcfb7 100644
--- a/telephony/java/android/telephony/NetworkServiceCallback.java
+++ b/telephony/java/android/telephony/NetworkServiceCallback.java
@@ -17,6 +17,7 @@
 package android.telephony;
 
 import android.annotation.IntDef;
+import android.annotation.Nullable;
 import android.annotation.SystemApi;
 import android.os.RemoteException;
 import android.telephony.NetworkService.NetworkServiceProvider;
@@ -75,7 +76,8 @@
      *                {@link NetworkServiceCallback#RESULT_ERROR_UNSUPPORTED}
      * @param state The state information to be returned to callback.
      */
-    public void onGetNetworkRegistrationStateComplete(int result, NetworkRegistrationState state) {
+    public void onGetNetworkRegistrationStateComplete(int result,
+                                                      @Nullable NetworkRegistrationState state) {
         INetworkServiceCallback callback = mCallback.get();
         if (callback != null) {
             try {
diff --git a/telephony/java/android/telephony/PcoData.java b/telephony/java/android/telephony/PcoData.java
index 3e735e7..bcfbcf8b 100644
--- a/telephony/java/android/telephony/PcoData.java
+++ b/telephony/java/android/telephony/PcoData.java
@@ -69,7 +69,7 @@
      *
      * @hide
      */
-    public static final Parcelable.Creator<PcoData> CREATOR = new Parcelable.Creator() {
+    public static final @android.annotation.NonNull Parcelable.Creator<PcoData> CREATOR = new Parcelable.Creator() {
         public PcoData createFromParcel(Parcel in) {
             return new PcoData(in);
         }
diff --git a/telephony/java/android/telephony/PhoneCapability.java b/telephony/java/android/telephony/PhoneCapability.java
index 21dad77..119f587 100644
--- a/telephony/java/android/telephony/PhoneCapability.java
+++ b/telephony/java/android/telephony/PhoneCapability.java
@@ -105,7 +105,7 @@
         dest.writeList(logicalModemList);
     }
 
-    public static final Parcelable.Creator<PhoneCapability> CREATOR = new Parcelable.Creator() {
+    public static final @android.annotation.NonNull Parcelable.Creator<PhoneCapability> CREATOR = new Parcelable.Creator() {
         public PhoneCapability createFromParcel(Parcel in) {
             return new PhoneCapability(in);
         }
diff --git a/telephony/java/android/telephony/PhoneNumberRange.java b/telephony/java/android/telephony/PhoneNumberRange.java
index dba803b..c35a485 100644
--- a/telephony/java/android/telephony/PhoneNumberRange.java
+++ b/telephony/java/android/telephony/PhoneNumberRange.java
@@ -43,7 +43,7 @@
  */
 @SystemApi
 public final class PhoneNumberRange implements Parcelable {
-    public static final Creator<PhoneNumberRange> CREATOR = new Creator<PhoneNumberRange>() {
+    public static final @android.annotation.NonNull Creator<PhoneNumberRange> CREATOR = new Creator<PhoneNumberRange>() {
         @Override
         public PhoneNumberRange createFromParcel(Parcel in) {
             return new PhoneNumberRange(in);
@@ -149,7 +149,7 @@
      * @param number A phone number, with or without separators or a country code.
      * @return {@code true} if the number matches, {@code false} otherwise.
      */
-    public boolean matches(String number) {
+    public boolean matches(@NonNull String number) {
         // Check the prefix, make sure it matches either with or without the country code.
         String normalizedNumber = number.replaceAll("[^0-9]", "");
         String prefixWithCountryCode = mCountryCode + mPrefix;
diff --git a/telephony/java/android/telephony/PhoneNumberUtils.java b/telephony/java/android/telephony/PhoneNumberUtils.java
index 4dcb410..549c044 100644
--- a/telephony/java/android/telephony/PhoneNumberUtils.java
+++ b/telephony/java/android/telephony/PhoneNumberUtils.java
@@ -25,12 +25,11 @@
 import android.annotation.UnsupportedAppUsage;
 import android.content.Context;
 import android.content.Intent;
-import android.content.res.Resources;
 import android.database.Cursor;
 import android.location.CountryDetector;
 import android.net.Uri;
-import android.os.SystemProperties;
 import android.os.PersistableBundle;
+import android.os.SystemProperties;
 import android.provider.Contacts;
 import android.provider.ContactsContract;
 import android.telecom.PhoneAccount;
@@ -1738,7 +1737,7 @@
      * @return true if the number is in the list of emergency numbers
      *         listed in the RIL / SIM, otherwise return false.
      *
-     * @deprecated Please use {@link TelephonyManager#isCurrentEmergencyNumber(String)} instead.
+     * @deprecated Please use {@link TelephonyManager#isEmergencyNumber(String)} instead.
      */
     @Deprecated
     public static boolean isEmergencyNumber(String number) {
@@ -1754,7 +1753,7 @@
      * @return true if the number is in the list of emergency numbers
      *         listed in the RIL / SIM, otherwise return false.
      *
-     * @deprecated Please use {@link TelephonyManager#isCurrentEmergencyNumber(String)}
+     * @deprecated Please use {@link TelephonyManager#isEmergencyNumber(String)}
      *             instead.
      *
      * @hide
@@ -1785,7 +1784,7 @@
      *         listed in the RIL / SIM, *or* if the number starts with the
      *         same digits as any of those emergency numbers.
      *
-     * @deprecated Please use {@link TelephonyManager#isCurrentPotentialEmergencyNumber(String)}
+     * @deprecated Please use {@link TelephonyManager#isPotentialEmergencyNumber(String)}
      *             instead.
      *
      * @hide
@@ -1814,7 +1813,7 @@
      *         listed in the RIL / SIM, *or* if the number starts with the
      *         same digits as any of those emergency numbers.
      *
-     * @deprecated Please use {@link TelephonyManager#isCurrentPotentialEmergencyNumber(String)}
+     * @deprecated Please use {@link TelephonyManager#isPotentialEmergencyNumber(String)}
      *             instead.
      *
      * @hide
@@ -1883,7 +1882,7 @@
      * @return if the number is an emergency number for the specific country, then return true,
      * otherwise false
      *
-     * @deprecated Please use {@link TelephonyManager#isCurrentEmergencyNumber(String)}
+     * @deprecated Please use {@link TelephonyManager#isEmergencyNumber(String)}
      *             instead.
      *
      * @hide
@@ -1903,7 +1902,7 @@
      * @return if the number is an emergency number for the specific country, then return true,
      * otherwise false
      *
-     * @deprecated Please use {@link TelephonyManager#isCurrentEmergencyNumber(String)}
+     * @deprecated Please use {@link TelephonyManager#isEmergencyNumber(String)}
      *             instead.
      *
      * @hide
@@ -1934,7 +1933,7 @@
      *         country, *or* if the number starts with the same digits as
      *         any of those emergency numbers.
      *
-     * @deprecated Please use {@link TelephonyManager#isCurrentPotentialEmergencyNumber(String)}
+     * @deprecated Please use {@link TelephonyManager#isPotentialEmergencyNumber(String)}
      *             instead.
      *
      * @hide
@@ -1964,7 +1963,7 @@
      *         country, *or* if the number starts with the same digits as
      *         any of those emergency numbers.
      *
-     * @deprecated Please use {@link TelephonyManager#isCurrentPotentialEmergencyNumber(String)}
+     * @deprecated Please use {@link TelephonyManager#isPotentialEmergencyNumber(String)}
      *             instead.
      *
      * @hide
@@ -2017,7 +2016,7 @@
     private static boolean isEmergencyNumberInternal(int subId, String number,
                                                      String defaultCountryIso,
                                                      boolean useExactMatch) {
-        return TelephonyManager.getDefault().isCurrentEmergencyNumber(number);
+        return TelephonyManager.getDefault().isEmergencyNumber(number);
     }
 
     /**
@@ -2028,7 +2027,7 @@
      * @return true if the specified number is an emergency number for the country the user
      * is currently in.
      *
-     * @deprecated Please use {@link TelephonyManager#isCurrentEmergencyNumber(String)}
+     * @deprecated Please use {@link TelephonyManager#isEmergencyNumber(String)}
      *             instead.
      */
     @Deprecated
@@ -2045,7 +2044,7 @@
      * @return true if the specified number is an emergency number for the country the user
      * is currently in.
      *
-     * @deprecated Please use {@link TelephonyManager#isCurrentEmergencyNumber(String)}
+     * @deprecated Please use {@link TelephonyManager#isEmergencyNumber(String)}
      *             instead.
      *
      * @hide
@@ -2079,7 +2078,7 @@
      *
      * @see android.location.CountryDetector
      *
-     * @deprecated Please use {@link TelephonyManager#isCurrentPotentialEmergencyNumber(String)}
+     * @deprecated Please use {@link TelephonyManager#isPotentialEmergencyNumber(String)}
      *             instead.
      *
      * @hide
@@ -2110,7 +2109,7 @@
      * @return true if the specified number is an emergency number for a local country, based on the
      *              CountryDetector.
      *
-     * @deprecated Please use {@link TelephonyManager#isCurrentPotentialEmergencyNumber(String)}
+     * @deprecated Please use {@link TelephonyManager#isPotentialEmergencyNumber(String)}
      *             instead.
      *
      * @hide
diff --git a/telephony/java/android/telephony/PhoneStateListener.java b/telephony/java/android/telephony/PhoneStateListener.java
index bb0673f..918bf60 100644
--- a/telephony/java/android/telephony/PhoneStateListener.java
+++ b/telephony/java/android/telephony/PhoneStateListener.java
@@ -292,17 +292,16 @@
     public static final int LISTEN_PHONE_CAPABILITY_CHANGE                 = 0x00200000;
 
     /**
-     *  Listen for changes to active data subId. Active data subscription
-     *  is whichever is being used for Internet data. For most of the case, it's
-     *  default data subscription but it could be others. For example, when data is
-     *  switched to opportunistic subscription, that becomes the active data sub.
+     *  Listen for changes to active data subId. Active data subscription is
+     *  the current subscription used to setup Cellular Internet data. For example,
+     *  it could be the current active opportunistic subscription in use, or the
+     *  subscription user selected as default data subscription in DSDS mode.
      *
      *  Requires Permission: {@link android.Manifest.permission#READ_PHONE_STATE
      *  READ_PHONE_STATE}
-     *  @see #onActiveDataSubIdChanged
-     *  @hide
+     *  @see #onActiveDataSubscriptionIdChanged
      */
-    public static final int LISTEN_ACTIVE_DATA_SUBID_CHANGE               = 0x00400000;
+    public static final int LISTEN_ACTIVE_DATA_SUBSCRIPTION_ID_CHANGE = 0x00400000;
 
     /**
      *  Listen for changes to the radio power state.
@@ -609,7 +608,7 @@
     @RequiresPermission((android.Manifest.permission.READ_PRECISE_PHONE_STATE))
     @SystemApi
     public void onPreciseDataConnectionStateChanged(
-            PreciseDataConnectionState dataConnectionState) {
+            @NonNull PreciseDataConnectionState dataConnectionState) {
         // default implementation empty
     }
 
@@ -709,12 +708,11 @@
     /**
      * Callback invoked when active data subId changes. Requires
      * the READ_PHONE_STATE permission.
-     * @param subId current data subId used for Internet data. It will be default data subscription
-     *              most cases. And it could be other subscriptions for example opportunistic
-     *              subscription if data is switched onto it.
-     * @hide
+     * @param subId current subscription used to setup Cellular Internet data.
+     *              For example, it could be the current active opportunistic subscription in use,
+     *              or the subscription user selected as default data subscription in DSDS mode.
      */
-    public void onActiveDataSubIdChanged(int subId) {
+    public void onActiveDataSubscriptionIdChanged(int subId) {
         // default implementation empty
     }
 
@@ -1003,7 +1001,7 @@
             if (psl == null) return;
 
             Binder.withCleanCallingIdentity(
-                    () -> mExecutor.execute(() -> psl.onActiveDataSubIdChanged(subId)));
+                    () -> mExecutor.execute(() -> psl.onActiveDataSubscriptionIdChanged(subId)));
         }
 
         public void onImsCallDisconnectCauseChanged(ImsReasonInfo disconnectCause) {
diff --git a/telephony/java/android/telephony/PhysicalChannelConfig.java b/telephony/java/android/telephony/PhysicalChannelConfig.java
index 22ddb4a..e1763ab 100644
--- a/telephony/java/android/telephony/PhysicalChannelConfig.java
+++ b/telephony/java/android/telephony/PhysicalChannelConfig.java
@@ -222,7 +222,7 @@
                 mChannelNumber, mPhysicalCellId, mContextIds);
     }
 
-    public static final Parcelable.Creator<PhysicalChannelConfig> CREATOR =
+    public static final @android.annotation.NonNull Parcelable.Creator<PhysicalChannelConfig> CREATOR =
         new Parcelable.Creator<PhysicalChannelConfig>() {
             public PhysicalChannelConfig createFromParcel(Parcel in) {
                 return new PhysicalChannelConfig(in);
diff --git a/telephony/java/android/telephony/PreciseCallState.java b/telephony/java/android/telephony/PreciseCallState.java
index 19e1931..5fb9bac 100644
--- a/telephony/java/android/telephony/PreciseCallState.java
+++ b/telephony/java/android/telephony/PreciseCallState.java
@@ -257,7 +257,7 @@
         out.writeInt(mPreciseDisconnectCause);
     }
 
-    public static final Parcelable.Creator<PreciseCallState> CREATOR
+    public static final @android.annotation.NonNull Parcelable.Creator<PreciseCallState> CREATOR
             = new Parcelable.Creator<PreciseCallState>() {
 
         public PreciseCallState createFromParcel(Parcel in) {
diff --git a/telephony/java/android/telephony/PreciseDataConnectionState.java b/telephony/java/android/telephony/PreciseDataConnectionState.java
index 57a1826..cd4fbac 100644
--- a/telephony/java/android/telephony/PreciseDataConnectionState.java
+++ b/telephony/java/android/telephony/PreciseDataConnectionState.java
@@ -16,6 +16,8 @@
 
 package android.telephony;
 
+import android.annotation.NonNull;
+import android.annotation.Nullable;
 import android.annotation.SystemApi;
 import android.annotation.UnsupportedAppUsage;
 import android.net.LinkProperties;
@@ -25,6 +27,7 @@
 
 import java.util.Objects;
 
+
 /**
  * Contains precise data connection state.
  *
@@ -119,6 +122,7 @@
     /**
      * Returns APN {@link ApnSetting} of this data connection.
      */
+    @Nullable
     public String getDataConnectionApn() {
         return mAPN;
     }
@@ -154,7 +158,7 @@
         out.writeInt(mFailCause);
     }
 
-    public static final Parcelable.Creator<PreciseDataConnectionState> CREATOR
+    public static final @android.annotation.NonNull Parcelable.Creator<PreciseDataConnectionState> CREATOR
             = new Parcelable.Creator<PreciseDataConnectionState>() {
 
         public PreciseDataConnectionState createFromParcel(Parcel in) {
diff --git a/telephony/java/android/telephony/RadioAccessFamily.java b/telephony/java/android/telephony/RadioAccessFamily.java
index c1786be..48c07e8 100644
--- a/telephony/java/android/telephony/RadioAccessFamily.java
+++ b/telephony/java/android/telephony/RadioAccessFamily.java
@@ -22,6 +22,7 @@
 import android.os.Build;
 import android.os.Parcel;
 import android.os.Parcelable;
+import android.telephony.TelephonyManager.PrefNetworkMode;
 
 import com.android.internal.telephony.RILConstants;
 
@@ -152,7 +153,7 @@
     /**
      * Implement the Parcelable interface.
      */
-    public static final Creator<android.telephony.RadioAccessFamily> CREATOR =
+    public static final @android.annotation.NonNull Creator<android.telephony.RadioAccessFamily> CREATOR =
             new Creator<android.telephony.RadioAccessFamily>() {
 
         @Override
@@ -170,7 +171,8 @@
     };
 
     @UnsupportedAppUsage
-    public static int getRafFromNetworkType(int type) {
+    @TelephonyManager.NetworkTypeBitMask
+    public static int getRafFromNetworkType(@PrefNetworkMode int type) {
         switch (type) {
             case RILConstants.NETWORK_MODE_WCDMA_PREF:
                 return GSM | WCDMA;
@@ -279,6 +281,7 @@
     }
 
     @UnsupportedAppUsage(maxTargetSdk = Build.VERSION_CODES.P, trackingBug = 115609023)
+    @PrefNetworkMode
     public static int getNetworkTypeFromRaf(int raf) {
         raf = getAdjustedRaf(raf);
 
diff --git a/telephony/java/android/telephony/RadioAccessSpecifier.java b/telephony/java/android/telephony/RadioAccessSpecifier.java
index 81e7ed0..690e44a 100644
--- a/telephony/java/android/telephony/RadioAccessSpecifier.java
+++ b/telephony/java/android/telephony/RadioAccessSpecifier.java
@@ -109,7 +109,7 @@
         return mChannels == null ? null : mChannels.clone();
     }
 
-    public static final Parcelable.Creator<RadioAccessSpecifier> CREATOR =
+    public static final @android.annotation.NonNull Parcelable.Creator<RadioAccessSpecifier> CREATOR =
             new Parcelable.Creator<RadioAccessSpecifier> (){
                 @Override
                 public RadioAccessSpecifier createFromParcel(Parcel in) {
diff --git a/telephony/java/android/telephony/ServiceState.java b/telephony/java/android/telephony/ServiceState.java
index 3dc1199..bddf978 100644
--- a/telephony/java/android/telephony/ServiceState.java
+++ b/telephony/java/android/telephony/ServiceState.java
@@ -17,6 +17,8 @@
 package android.telephony;
 
 import android.annotation.IntDef;
+import android.annotation.NonNull;
+import android.annotation.Nullable;
 import android.annotation.SystemApi;
 import android.annotation.TestApi;
 import android.annotation.UnsupportedAppUsage;
@@ -436,7 +438,11 @@
 
     /**
      * Construct a ServiceState object from the given parcel.
+     *
+     * @deprecated The constructor takes parcel should not be public at the beginning. Use
+     * {@link #ServiceState()} instead.
      */
+    @Deprecated
     public ServiceState(Parcel in) {
         mVoiceRegState = in.readInt();
         mDataRegState = in.readInt();
@@ -498,7 +504,7 @@
         return 0;
     }
 
-    public static final Parcelable.Creator<ServiceState> CREATOR =
+    public static final @android.annotation.NonNull Parcelable.Creator<ServiceState> CREATOR =
             new Parcelable.Creator<ServiceState>() {
         public ServiceState createFromParcel(Parcel in) {
             return new ServiceState(in);
@@ -1760,6 +1766,7 @@
      * @return List of {@link NetworkRegistrationState}
      * @hide
      */
+    @NonNull
     @SystemApi
     public List<NetworkRegistrationState> getNetworkRegistrationStates() {
         synchronized (mNetworkRegistrationStates) {
@@ -1776,6 +1783,7 @@
      *
      * @deprecated Use {@link #getNetworkRegistrationStatesFromTransportType(int)}
      */
+    @NonNull
     @Deprecated
     @SystemApi
     public List<NetworkRegistrationState> getNetworkRegistrationStates(int transportType) {
@@ -1789,6 +1797,7 @@
      * @return List of {@link NetworkRegistrationState}
      * @hide
      */
+    @NonNull
     @SystemApi
     public List<NetworkRegistrationState> getNetworkRegistrationStatesForTransportType(
             int transportType) {
@@ -1812,6 +1821,7 @@
      * @return List of {@link NetworkRegistrationState}
      * @hide
      */
+    @NonNull
     @SystemApi
     public List<NetworkRegistrationState> getNetworkRegistrationStatesForDomain(
             @Domain int domain) {
@@ -1838,6 +1848,7 @@
      *
      * @deprecated Use {@link #getNetworkRegistrationState(int, int)}
      */
+    @Nullable
     @Deprecated
     @SystemApi
     public NetworkRegistrationState getNetworkRegistrationStates(@Domain int domain,
@@ -1854,6 +1865,7 @@
      * @hide
      *
      */
+    @Nullable
     @SystemApi
     public NetworkRegistrationState getNetworkRegistrationState(@Domain int domain,
                                                                 int transportType) {
diff --git a/telephony/java/android/telephony/SignalStrength.java b/telephony/java/android/telephony/SignalStrength.java
index d461bd0..480c9d9 100644
--- a/telephony/java/android/telephony/SignalStrength.java
+++ b/telephony/java/android/telephony/SignalStrength.java
@@ -214,7 +214,7 @@
      * @see android.telephony#CellSignalStrengthCdma
      * @see android.telephony#CellSignalStrengthGsm
      */
-    public @NonNull List<CellSignalStrength> getCellSignalStrengths() {
+    @NonNull public List<CellSignalStrength> getCellSignalStrengths() {
         return getCellSignalStrengths(CellSignalStrength.class);
     }
 
@@ -240,7 +240,7 @@
      * @see android.telephony#CellSignalStrengthCdma
      * @see android.telephony#CellSignalStrengthGsm
      */
-    public <T extends CellSignalStrength> @NonNull List<T> getCellSignalStrengths(
+    @NonNull public <T extends CellSignalStrength> List<T> getCellSignalStrengths(
             @NonNull Class<T> clazz) {
         List<T> cssList = new ArrayList<>(2); // Usually have 2 or fewer elems
         if (mLte.isValid() && clazz.isAssignableFrom(CellSignalStrengthLte.class)) {
@@ -341,7 +341,7 @@
      * @hide
      */
     @UnsupportedAppUsage
-    public static final Parcelable.Creator<SignalStrength> CREATOR = new Parcelable.Creator() {
+    public static final @android.annotation.NonNull Parcelable.Creator<SignalStrength> CREATOR = new Parcelable.Creator() {
         public SignalStrength createFromParcel(Parcel in) {
             return new SignalStrength(in);
         }
diff --git a/telephony/java/android/telephony/SmsManager.java b/telephony/java/android/telephony/SmsManager.java
index fae7920..07ffaac 100644
--- a/telephony/java/android/telephony/SmsManager.java
+++ b/telephony/java/android/telephony/SmsManager.java
@@ -322,6 +322,7 @@
      *  <code>RESULT_ERROR_GENERIC_FAILURE</code><br>
      *  <code>RESULT_ERROR_RADIO_OFF</code><br>
      *  <code>RESULT_ERROR_NULL_PDU</code><br>
+     *  <code>RESULT_ERROR_NO_SERVICE</code><br>
      *  For <code>RESULT_ERROR_GENERIC_FAILURE</code> the sentIntent may include
      *  the extra "errorCode" containing a radio technology specific value,
      *  generally only useful for troubleshooting.<br>
@@ -371,19 +372,12 @@
         if (DBG) {
             Log.d(TAG, "for subId: " + subId + ", subscription-info: " + info);
         }
-        if (info == null) {
-            // There is no subscription for the given subId. That can only mean one thing:
-            // the caller is using a SmsManager instance with an obsolete subscription id.
-            // That is most probably because caller didn't invalidate SmsManager instance
-            // for an already deleted subscription id.
-            Log.e(TAG, "subId: " + subId + " for this SmsManager instance is obsolete.");
-            sendErrorInPendingIntent(sentIntent, SmsManager.RESULT_ERROR_NO_SERVICE);
-        }
 
         /* If the Subscription associated with this SmsManager instance belongs to a remote-sim,
          * then send the message thru the remote-sim subscription.
          */
-        if (info.getSubscriptionType() == SubscriptionManager.SUBSCRIPTION_TYPE_REMOTE_SIM) {
+        if (info != null
+                && info.getSubscriptionType() == SubscriptionManager.SUBSCRIPTION_TYPE_REMOTE_SIM) {
             if (DBG) Log.d(TAG, "sending message thru bluetooth");
             sendTextMessageBluetooth(destinationAddress, scAddress, text, sentIntent,
                     deliveryIntent, info);
@@ -391,8 +385,10 @@
         }
 
         try {
+            // If the subscription is invalid or default, we will use the default phone to send the
+            // SMS and possibly fail later in the SMS sending process.
             ISms iccISms = getISmsServiceOrThrow();
-            iccISms.sendTextForSubscriber(getSubscriptionId(), ActivityThread.currentPackageName(),
+            iccISms.sendTextForSubscriber(subId, ActivityThread.currentPackageName(),
                     destinationAddress,
                     scAddress, text, sentIntent, deliveryIntent,
                     persistMessage);
@@ -465,6 +461,9 @@
     }
 
     private void sendErrorInPendingIntent(PendingIntent intent, int errorCode) {
+        if (intent == null) {
+            return;
+        }
         try {
             intent.send(errorCode);
         } catch (PendingIntent.CanceledException e) {
diff --git a/telephony/java/android/telephony/SubscriptionInfo.java b/telephony/java/android/telephony/SubscriptionInfo.java
index 17acf2b..245f5b3 100644
--- a/telephony/java/android/telephony/SubscriptionInfo.java
+++ b/telephony/java/android/telephony/SubscriptionInfo.java
@@ -425,14 +425,14 @@
     /**
      * @return The MCC, as a string.
      */
-    public String getMccString() {
+    public @Nullable String getMccString() {
         return this.mMcc;
     }
 
     /**
      * @return The MNC, as a string.
      */
-    public String getMncString() {
+    public @Nullable String getMncString() {
         return this.mMnc;
     }
 
@@ -467,7 +467,7 @@
      * @return group UUID a String of group UUID if it belongs to a group. Otherwise
      * it will return null.
      */
-    public String getGroupUuid() {
+    public @Nullable String getGroupUuid() {
         return mGroupUUID;
     }
 
@@ -602,7 +602,7 @@
         return mIsGroupDisabled;
     }
 
-    public static final Parcelable.Creator<SubscriptionInfo> CREATOR = new Parcelable.Creator<SubscriptionInfo>() {
+    public static final @android.annotation.NonNull Parcelable.Creator<SubscriptionInfo> CREATOR = new Parcelable.Creator<SubscriptionInfo>() {
         @Override
         public SubscriptionInfo createFromParcel(Parcel source) {
             int id = source.readInt();
diff --git a/telephony/java/android/telephony/SubscriptionManager.java b/telephony/java/android/telephony/SubscriptionManager.java
index c28d1fb..d9a37c6 100644
--- a/telephony/java/android/telephony/SubscriptionManager.java
+++ b/telephony/java/android/telephony/SubscriptionManager.java
@@ -63,14 +63,17 @@
 import com.android.internal.telephony.ISub;
 import com.android.internal.telephony.ITelephonyRegistry;
 import com.android.internal.telephony.PhoneConstants;
+import com.android.internal.util.Preconditions;
 
 import java.lang.annotation.Retention;
 import java.lang.annotation.RetentionPolicy;
 import java.util.ArrayList;
 import java.util.Arrays;
 import java.util.Collections;
+import java.util.HashMap;
 import java.util.List;
 import java.util.Locale;
+import java.util.Map;
 import java.util.concurrent.Executor;
 import java.util.concurrent.TimeUnit;
 import java.util.function.Consumer;
@@ -151,6 +154,7 @@
      * {@link Uri#withAppendedPath(Uri, String)}.
      * @hide
      */
+    @NonNull
     @SystemApi
     public static final Uri WFC_ENABLED_CONTENT_URI = Uri.withAppendedPath(CONTENT_URI, "wfc");
 
@@ -169,6 +173,7 @@
      * {@link Uri#withAppendedPath(Uri, String)}.
      * @hide
      */
+    @NonNull
     @SystemApi
     public static final Uri ADVANCED_CALLING_ENABLED_CONTENT_URI = Uri.withAppendedPath(
             CONTENT_URI, "advanced_calling");
@@ -186,6 +191,7 @@
      * {@link Uri#withAppendedPath(Uri, String)}.
      * @hide
      */
+    @NonNull
     @SystemApi
     public static final Uri WFC_MODE_CONTENT_URI = Uri.withAppendedPath(CONTENT_URI, "wfc_mode");
 
@@ -202,6 +208,7 @@
      * {@link Uri#withAppendedPath(Uri, String)}.
      * @hide
      */
+    @NonNull
     @SystemApi
     public static final Uri WFC_ROAMING_MODE_CONTENT_URI = Uri.withAppendedPath(
             CONTENT_URI, "wfc_roaming_mode");
@@ -220,6 +227,7 @@
      * {@link Uri#withAppendedPath(Uri, String)}.
      * @hide
      */
+    @NonNull
     @SystemApi
     public static final Uri VT_ENABLED_CONTENT_URI = Uri.withAppendedPath(
             CONTENT_URI, "vt_enabled");
@@ -237,6 +245,7 @@
      * {@link Uri#withAppendedPath(Uri, String)}.
      * @hide
      */
+    @NonNull
     @SystemApi
     public static final Uri WFC_ROAMING_ENABLED_CONTENT_URI = Uri.withAppendedPath(
             CONTENT_URI, "wfc_roaming_enabled");
@@ -1066,7 +1075,8 @@
      * @param listener that is to be unregistered.
      */
     public void removeOnOpportunisticSubscriptionsChangedListener(
-            OnOpportunisticSubscriptionsChangedListener listener) {
+            @NonNull OnOpportunisticSubscriptionsChangedListener listener) {
+        Preconditions.checkNotNull(listener, "listener cannot be null");
         String pkgForDebug = mContext != null ? mContext.getOpPackageName() : "<unknown>";
         if (DBG) {
             logd("unregister OnOpportunisticSubscriptionsChangedListener pkgForDebug="
@@ -1260,7 +1270,7 @@
         if (!userVisibleOnly || activeList == null) {
             return activeList;
         } else {
-            return activeList.stream().filter(subInfo -> !shouldHideSubscription(subInfo))
+            return activeList.stream().filter(subInfo -> isSubscriptionVisible(subInfo))
                     .collect(Collectors.toList());
         }
     }
@@ -2590,7 +2600,7 @@
     @SystemApi
     @RequiresPermission(android.Manifest.permission.MODIFY_PHONE_STATE)
     public void setPreferredDataSubscriptionId(int subId, boolean needValidation,
-            @NonNull @CallbackExecutor Executor executor, Consumer<Integer> callback) {
+            @Nullable @CallbackExecutor Executor executor, @Nullable  Consumer<Integer> callback) {
         if (VDBG) logd("[setPreferredDataSubscriptionId]+ subId:" + subId);
         try {
             ISub iSub = ISub.Stub.asInterface(ServiceManager.getService("isub"));
@@ -2599,10 +2609,11 @@
             ISetOpportunisticDataCallback callbackStub = new ISetOpportunisticDataCallback.Stub() {
                 @Override
                 public void onComplete(int result) {
+                    if (executor == null || callback == null) {
+                        return;
+                    }
                     Binder.withCleanCallingIdentity(() -> executor.execute(() -> {
-                        if (callback != null) {
-                            callback.accept(result);
-                        }
+                        callback.accept(result);
                     }));
                 }
             };
@@ -2682,7 +2693,8 @@
      *  @param callbackIntent pending intent that will be sent after operation is done.
      */
     @RequiresPermission(android.Manifest.permission.WRITE_EMBEDDED_SUBSCRIPTIONS)
-    public void switchToSubscription(int subId, PendingIntent callbackIntent) {
+    public void switchToSubscription(int subId, @NonNull PendingIntent callbackIntent) {
+        Preconditions.checkNotNull(callbackIntent, "callbackIntent cannot be null");
         EuiccManager euiccManager = new EuiccManager(mContext);
         euiccManager.switchToSubscription(subId, callbackIntent);
     }
@@ -2694,7 +2706,8 @@
      *  1) Even if it's active, it will be dormant most of the time. The modem will not try
      *     to scan or camp until it knows an available network is nearby to save power.
      *  2) Telephony relies on system app or carrier input to notify nearby available networks.
-     *     See {@link TelephonyManager#updateAvailableNetworks(List)} for more information.
+     *     See {@link TelephonyManager#updateAvailableNetworks(List, Executor, Consumer)}
+     *     for more information.
      *  3) In multi-SIM devices, when the network is nearby and camped, system may automatically
      *     switch internet data between it and default data subscription, based on carrier
      *     recommendation and its signal strength and metered-ness, etc.
@@ -2856,32 +2869,27 @@
     }
 
     /**
-     * Whether system UI should hide a subscription. If it's a bundled opportunistic
-     * subscription, it shouldn't show up in anywhere in Settings app, dialer app,
-     * or status bar. Exception is if caller is carrier app, in which case they will
+     * Whether a subscription is visible to API caller. If it's a bundled opportunistic
+     * subscription, it should be hidden anywhere in Settings, dialer, status bar etc.
+     * Exception is if caller owns carrier privilege, in which case they will
      * want to see their own hidden subscriptions.
      *
      * @param info the subscriptionInfo to check against.
-     * @return true if this subscription should be hidden.
+     * @return true if this subscription should be visible to the API caller.
      *
-     * @hide
      */
-    public boolean shouldHideSubscription(SubscriptionInfo info) {
+    private boolean isSubscriptionVisible(SubscriptionInfo info) {
         if (info == null) return false;
 
-        // If hasCarrierPrivileges or canManageSubscription returns true, it means caller
-        // has carrier privilege.
-        boolean hasCarrierPrivilegePermission = (info.isEmbedded() && canManageSubscription(info))
-                || TelephonyManager.from(mContext).hasCarrierPrivileges(info.getSubscriptionId());
+        // If subscription is NOT grouped opportunistic subscription, it's visible.
+        if (TextUtils.isEmpty(info.getGroupUuid()) || !info.isOpportunistic()) return true;
 
-        return isInvisibleSubscription(info) && !hasCarrierPrivilegePermission;
-    }
-
-    /**
-     * @hide
-     */
-    public static boolean isInvisibleSubscription(SubscriptionInfo info) {
-        return info != null && !TextUtils.isEmpty(info.getGroupUuid()) && info.isOpportunistic();
+        // If the caller is the carrier app and owns the subscription, it should be visible
+        // to the caller.
+        boolean hasCarrierPrivilegePermission = TelephonyManager.from(mContext)
+                .hasCarrierPrivileges(info.getSubscriptionId())
+                || (info.isEmbedded() && canManageSubscription(info));
+        return hasCarrierPrivilegePermission;
     }
 
     /**
@@ -2900,13 +2908,38 @@
         if (availableList == null) {
             return null;
         } else {
-            return availableList.stream().filter(subInfo -> !shouldHideSubscription(subInfo))
-                    .collect(Collectors.toList());
+            // Multiple subscriptions in a group should only have one representative.
+            // It should be the current active primary subscription if any, or any
+            // primary subscription.
+            List<SubscriptionInfo> selectableList = new ArrayList<>();
+            Map<String, SubscriptionInfo> groupMap = new HashMap<>();
+
+            for (SubscriptionInfo info : availableList) {
+                // Opportunistic subscriptions are considered invisible
+                // to users so they should never be returned.
+                if (!isSubscriptionVisible(info)) continue;
+
+                String groupUuid = info.getGroupUuid();
+                if (groupUuid == null) {
+                    // Doesn't belong to any group. Add in the list.
+                    selectableList.add(info);
+                } else if (!groupMap.containsKey(groupUuid)
+                        || (groupMap.get(groupUuid).getSimSlotIndex() == INVALID_SIM_SLOT_INDEX
+                        && info.getSimSlotIndex() != INVALID_SIM_SLOT_INDEX)) {
+                    // If it belongs to a group that has never been recorded or it's the current
+                    // active subscription, add it in the list.
+                    selectableList.remove(groupMap.get(groupUuid));
+                    selectableList.add(info);
+                    groupMap.put(groupUuid, info);
+                }
+
+            }
+            return selectableList;
         }
     }
 
     /**
-     * Enabled or disable a subscription. This is currently used in the settings page.
+     * Enables or disables a subscription. This is currently used in the settings page.
      *
      * <p>
      * Permissions android.Manifest.permission.MODIFY_PHONE_STATE is required
diff --git a/telephony/java/android/telephony/SubscriptionPlan.java b/telephony/java/android/telephony/SubscriptionPlan.java
index d67169c..e0838b3 100644
--- a/telephony/java/android/telephony/SubscriptionPlan.java
+++ b/telephony/java/android/telephony/SubscriptionPlan.java
@@ -145,7 +145,7 @@
         return false;
     }
 
-    public static final Parcelable.Creator<SubscriptionPlan> CREATOR = new Parcelable.Creator<SubscriptionPlan>() {
+    public static final @android.annotation.NonNull Parcelable.Creator<SubscriptionPlan> CREATOR = new Parcelable.Creator<SubscriptionPlan>() {
         @Override
         public SubscriptionPlan createFromParcel(Parcel source) {
             return new SubscriptionPlan(source);
diff --git a/telephony/java/android/telephony/TelephonyHistogram.java b/telephony/java/android/telephony/TelephonyHistogram.java
index e1c3d7b..63bdac5 100644
--- a/telephony/java/android/telephony/TelephonyHistogram.java
+++ b/telephony/java/android/telephony/TelephonyHistogram.java
@@ -256,7 +256,7 @@
         }
     }
 
-    public static final Parcelable.Creator<TelephonyHistogram> CREATOR =
+    public static final @android.annotation.NonNull Parcelable.Creator<TelephonyHistogram> CREATOR =
             new Parcelable.Creator<TelephonyHistogram> () {
 
                 @Override
diff --git a/telephony/java/android/telephony/TelephonyManager.java b/telephony/java/android/telephony/TelephonyManager.java
index c1d1440..16dafd6 100644
--- a/telephony/java/android/telephony/TelephonyManager.java
+++ b/telephony/java/android/telephony/TelephonyManager.java
@@ -81,8 +81,10 @@
 import com.android.internal.telephony.INumberVerificationCallback;
 import com.android.internal.telephony.IOns;
 import com.android.internal.telephony.IPhoneSubInfo;
+import com.android.internal.telephony.ISetOpportunisticDataCallback;
 import com.android.internal.telephony.ITelephony;
 import com.android.internal.telephony.ITelephonyRegistry;
+import com.android.internal.telephony.IUpdateAvailableNetworksCallback;
 import com.android.internal.telephony.OperatorInfo;
 import com.android.internal.telephony.PhoneConstants;
 import com.android.internal.telephony.RILConstants;
@@ -94,10 +96,12 @@
 import java.lang.annotation.RetentionPolicy;
 import java.util.ArrayList;
 import java.util.Collections;
+import java.util.HashMap;
 import java.util.List;
 import java.util.Locale;
 import java.util.Map;
 import java.util.concurrent.Executor;
+import java.util.function.Consumer;
 import java.util.regex.Matcher;
 import java.util.regex.Pattern;
 
@@ -1246,30 +1250,34 @@
     public static final String EXTRA_CARRIER_NAME = "android.telephony.extra.CARRIER_NAME";
 
     /**
-     * Broadcast Action: The subscription precise carrier identity has changed.
-     * The precise carrier id can be used to further differentiate a carrier by different
-     * networks, by prepaid v.s.postpaid or even by 4G v.s.3G plan. Each carrier has a unique
-     * carrier id returned by {@link #getSimCarrierId()} but could have multiple precise carrier id.
-     * e.g, {@link #getSimCarrierId()} will always return Tracfone (id 2022) for a Tracfone SIM,
-     * while {@link #getSimPreciseCarrierId()} can return Tracfone AT&T or Tracfone T-Mobile based
-     * on the current subscription IMSI. For carriers without any fine-grained ids, precise carrier
-     * id is same as carrier id.
+     * Broadcast Action: The subscription specific carrier identity has changed.
+     *
+     * A specific carrier ID returns the fine-grained carrier ID of the current subscription.
+     * It can represent the fact that a carrier may be in effect an aggregation of other carriers
+     * (ie in an MVNO type scenario) where each of these specific carriers which are used to make
+     * up the actual carrier service may have different carrier configurations.
+     * A specific carrier ID could also be used, for example, in a scenario where a carrier requires
+     * different carrier configuration for different service offering such as a prepaid plan.
+     *
+     * the specific carrier ID would be used for configuration purposes, but apps wishing to know
+     * about the carrier itself should use the regular carrier ID returned by
+     * {@link #getSimCarrierId()}.
      *
      * <p>Similar like {@link #ACTION_SUBSCRIPTION_CARRIER_IDENTITY_CHANGED}, this intent will be
      * sent on the event of {@link #ACTION_SUBSCRIPTION_CARRIER_IDENTITY_CHANGED} while its also
      * possible to be sent without {@link #ACTION_SUBSCRIPTION_CARRIER_IDENTITY_CHANGED} when
-     * precise carrier id changes with the same carrier id.
+     * specific carrier ID changes while carrier ID remains the same.
      * e.g, the same subscription switches to different IMSI could potentially change its
-     * precise carrier id while carrier id remains the same.
-     * @see #getSimPreciseCarrierId()
+     * specific carrier ID while carrier id remains the same.
+     * @see #getSimSpecificCarrierId()
      * @see #getSimCarrierId()
      *
      * The intent will have the following extra values:
      * <ul>
-     *   <li>{@link #EXTRA_PRECISE_CARRIER_ID} The up-to-date precise carrier id of the
+     *   <li>{@link #EXTRA_SPECIFIC_CARRIER_ID} The up-to-date specific carrier id of the
      *   current subscription.
      *   </li>
-     *   <li>{@link #EXTRA_PRECISE_CARRIER_NAME} The up-to-date name of the precise carrier id.
+     *   <li>{@link #EXTRA_SPECIFIC_CARRIER_NAME} The up-to-date name of the specific carrier id.
      *   </li>
      *   <li>{@link #EXTRA_SUBSCRIPTION_ID} The subscription id associated with the changed carrier
      *   identity.
@@ -1278,30 +1286,30 @@
      * <p class="note">This is a protected intent that can only be sent by the system.
      */
     @SdkConstant(SdkConstantType.BROADCAST_INTENT_ACTION)
-    public static final String ACTION_SUBSCRIPTION_PRECISE_CARRIER_IDENTITY_CHANGED =
-            "android.telephony.action.SUBSCRIPTION_PRECISE_CARRIER_IDENTITY_CHANGED";
+    public static final String ACTION_SUBSCRIPTION_SPECIFIC_CARRIER_IDENTITY_CHANGED =
+            "android.telephony.action.SUBSCRIPTION_SPECIFIC_CARRIER_IDENTITY_CHANGED";
 
     /**
-     * An int extra used with {@link #ACTION_SUBSCRIPTION_PRECISE_CARRIER_IDENTITY_CHANGED} which
-     * indicates the updated precise carrier id returned by
-     * {@link TelephonyManager#getSimPreciseCarrierId()}. Note, its possible precise carrier id
+     * An int extra used with {@link #ACTION_SUBSCRIPTION_SPECIFIC_CARRIER_IDENTITY_CHANGED} which
+     * indicates the updated specific carrier id returned by
+     * {@link TelephonyManager#getSimSpecificCarrierId()}. Note, its possible specific carrier id
      * changes while {@link #ACTION_SUBSCRIPTION_CARRIER_IDENTITY_CHANGED} remains the same
      * e.g, when subscription switch to different IMSIs.
      * <p>Will be {@link TelephonyManager#UNKNOWN_CARRIER_ID} if the subscription is unavailable or
      * the carrier cannot be identified.
      */
-    public static final String EXTRA_PRECISE_CARRIER_ID =
-            "android.telephony.extra.PRECISE_CARRIER_ID";
+    public static final String EXTRA_SPECIFIC_CARRIER_ID =
+            "android.telephony.extra.SPECIFIC_CARRIER_ID";
 
     /**
-     * An string extra used with {@link #ACTION_SUBSCRIPTION_PRECISE_CARRIER_IDENTITY_CHANGED} which
-     * indicates the updated precise carrier name returned by
-     * {@link TelephonyManager#getSimPreciseCarrierIdName()}.
-     * <p>it's a user-facing name of the precise carrier id {@link #EXTRA_PRECISE_CARRIER_ID}, e.g,
-     * Tracfone-AT&T.
+     * An string extra used with {@link #ACTION_SUBSCRIPTION_SPECIFIC_CARRIER_IDENTITY_CHANGED}
+     * which indicates the updated specific carrier name returned by
+     * {@link TelephonyManager#getSimSpecificCarrierIdName()}.
+     * <p>it's a user-facing name of the specific carrier id {@link #EXTRA_SPECIFIC_CARRIER_ID}
+     * e.g, Tracfone-AT&T
      */
-    public static final String EXTRA_PRECISE_CARRIER_NAME =
-            "android.telephony.extra.PRECISE_CARRIER_NAME";
+    public static final String EXTRA_SPECIFIC_CARRIER_NAME =
+            "android.telephony.extra.SPECIFIC_CARRIER_NAME";
 
     /**
      * An int extra used with {@link #ACTION_SUBSCRIPTION_CARRIER_IDENTITY_CHANGED} to indicate the
@@ -1355,17 +1363,32 @@
      */
     public static final String EXTRA_RECOVERY_ACTION = "recoveryAction";
 
-    /**
-     * The max value for the timeout passed in {@link #requestNumberVerification}.
-     * @hide
-     */
-    @SystemApi
-    public static final long MAX_NUMBER_VERIFICATION_TIMEOUT_MILLIS = 60000;
+    private static final long MAX_NUMBER_VERIFICATION_TIMEOUT_MILLIS = 60000;
 
     /**
      * Intent sent when an error occurs that debug tools should log and possibly take further
      * action such as capturing vendor-specific logs.
      *
+     * A privileged application that reads these events should take appropriate vendor-specific
+     * action to record the event and collect further information to assist in analysis, debugging,
+     * and resolution of any associated issue.
+     *
+     * <p>This event should not be used for generic logging or diagnostic monitoring purposes and
+     * should generally be sent at a low rate. Instead, this mechanism should be used for the
+     * framework to notify a debugging application that an event (such as a bug) has occured
+     * within the framework if that event should trigger the collection and preservation of other
+     * more detailed device state for debugging.
+     *
+     * <p>At most one application can receive these events and should register a receiver in
+     * in the application manifest. For performance reasons, if no application to receive these
+     * events is detected at boot, then these events will not be sent.
+     *
+     * <p>Each event will include an {@link EXTRA_DEBUG_EVENT_ID} that will uniquely identify the
+     * event that has occurred. Each event will be sent to the diagnostic monitor only once per
+     * boot cycle (as another optimization).
+     *
+     * @see #EXTRA_DEBUG_EVENT_ID
+     * @see #EXTRA_DEBUG_EVENT_DESCRIPTION
      * @hide
      */
     @SystemApi
@@ -1373,21 +1396,23 @@
     public static final String ACTION_DEBUG_EVENT = "android.telephony.action.DEBUG_EVENT";
 
     /**
-     * An arbitrary ParcelUuid which should be consistent for each occurrence of the same event.
+     * An arbitrary ParcelUuid which should be consistent for each occurrence of a DebugEvent.
      *
-     * This field must be included in all events.
+     * This field must be included in all {@link ACTION_DEBUG_EVENT} events.
      *
+     * @see #ACTION_DEBUG_EVENT
      * @hide
      */
     @SystemApi
     public static final String EXTRA_DEBUG_EVENT_ID = "android.telephony.extra.DEBUG_EVENT_ID";
 
     /**
-     * A freeform string description of the event.
+     * A freeform string description of the DebugEvent.
      *
-     * This field is optional for all events and as a guideline should not exceed 80 characters
-     * and should be as short as possible to convey the essence of the event.
+     * This field is optional for all {@link ACTION_DEBUG_EVENT}s, as a guideline should not
+     * exceed 80 characters, and should be as short as possible to convey the essence of the event.
      *
+     * @see #ACTION_DEBUG_EVENT
      * @hide
      */
     @SystemApi
@@ -1549,6 +1574,7 @@
      * Returns the Type Allocation Code from the IMEI. Return null if Type Allocation Code is not
      * available.
      */
+    @Nullable
     public String getTypeAllocationCode() {
         return getTypeAllocationCode(getSlotIndex());
     }
@@ -1559,6 +1585,7 @@
      *
      * @param slotIndex of which Type Allocation Code is returned
      */
+    @Nullable
     public String getTypeAllocationCode(int slotIndex) {
         ITelephony telephony = getITelephony();
         if (telephony == null) return null;
@@ -1619,6 +1646,7 @@
      * Returns the Manufacturer Code from the MEID. Return null if Manufacturer Code is not
      * available.
      */
+    @Nullable
     public String getManufacturerCode() {
         return getManufacturerCode(getSlotIndex());
     }
@@ -1629,6 +1657,7 @@
      *
      * @param slotIndex of which Type Allocation Code is returned
      */
+    @Nullable
     public String getManufacturerCode(int slotIndex) {
         ITelephony telephony = getITelephony();
         if (telephony == null) return null;
@@ -2005,6 +2034,15 @@
         return cmdline;
     }
 
+    /**
+     * @return The max value for the timeout passed in {@link #requestNumberVerification}.
+     * @hide
+     */
+    @SystemApi
+    public static long getMaxNumberVerificationTimeoutMillis() {
+        return MAX_NUMBER_VERIFICATION_TIMEOUT_MILLIS;
+    }
+
     /** Kernel command line */
     private static final String sKernelCmdLine = getProcCmdLine();
 
@@ -2771,8 +2809,8 @@
      * (see {@link #hasCarrierPrivileges}).
      * <p>
      * These "secret codes" are used to activate developer menus by dialing certain codes.
-     * And they are of the form {@code *#*#&lt;code&gt;#*#*}. The intent will have the data
-     * URI: {@code android_secret_code://&lt;code&gt;}. It is possible that a manifest
+     * And they are of the form {@code *#*#<code>#*#*}. The intent will have the data
+     * URI: {@code android_secret_code://<code>}. It is possible that a manifest
      * receiver would be woken up even if it is not currently running.
      * <p>
      * It is supposed to replace {@link android.provider.Telephony.Sms.Intents#SECRET_CODE_ACTION}
@@ -3227,6 +3265,7 @@
      * the caller does not have adequate permissions for that card.
      */
     @RequiresPermission(android.Manifest.permission.READ_PRIVILEGED_PHONE_STATE)
+    @NonNull
     public List<UiccCardInfo> getUiccCardsInfo() {
         try {
             ITelephony telephony = getITelephony();
@@ -4472,6 +4511,7 @@
      * {@link android.Manifest.permission#READ_PRIVILEGED_PHONE_STATE READ_PRIVILEGED_PHONE_STATE}
      * @hide
      */
+    @Nullable
     @SystemApi
     @RequiresPermission(android.Manifest.permission.READ_PRIVILEGED_PHONE_STATE)
     public String getIsimDomain() {
@@ -5720,8 +5760,8 @@
      *
      * @hide
      * @param range The range of phone numbers the caller expects a phone call from.
-     * @param timeoutMillis The amount of time to wait for such a call, or
-     *                      {@link #MAX_NUMBER_VERIFICATION_TIMEOUT_MILLIS}, whichever is lesser.
+     * @param timeoutMillis The amount of time to wait for such a call, or the value of
+     *                      {@link #getMaxNumberVerificationTimeoutMillis()}, whichever is lesser.
      * @param executor The {@link Executor} that callbacks should be executed on.
      * @param callback The callback to use for delivering results.
      */
@@ -5977,6 +6017,7 @@
      * @return IMS Service Table or null if not present or not loaded
      * @hide
      */
+    @Nullable
     @SystemApi
     @RequiresPermission(Manifest.permission.READ_PRIVILEGED_PHONE_STATE)
     public String getIsimIst() {
@@ -6828,12 +6869,12 @@
      * app has carrier privileges (see {@link #hasCarrierPrivileges}).
      *
      * @param subId the id of the subscription to set the preferred network type for.
-     * @param networkType the preferred network type, defined in RILConstants.java.
+     * @param networkType the preferred network type
      * @return true on success; false on any failure.
      * @hide
      */
     @UnsupportedAppUsage
-    public boolean setPreferredNetworkType(int subId, int networkType) {
+    public boolean setPreferredNetworkType(int subId, @PrefNetworkMode int networkType) {
         try {
             ITelephony telephony = getITelephony();
             if (telephony != null) {
@@ -6903,14 +6944,12 @@
     }
 
     /**
-     * Check TETHER_DUN_REQUIRED and TETHER_DUN_APN settings, net.tethering.noprovisioning
-     * SystemProperty to decide whether DUN APN is required for
-     * tethering.
+     * Check whether DUN APN is required for tethering.
      *
-     * @return 0: Not required. 1: required. 2: Not set.
+     * @return {@code true} if DUN APN is required for tethering.
      * @hide
      */
-    public int getTetherApnRequired() {
+    public boolean getTetherApnRequired() {
         try {
             ITelephony telephony = getITelephony();
             if (telephony != null)
@@ -6920,7 +6959,7 @@
         } catch (NullPointerException ex) {
             Rlog.e(TAG, "hasMatchedTetherApnSetting NPE", ex);
         }
-        return 2;
+        return false;
     }
 
 
@@ -8907,17 +8946,23 @@
     }
 
     /**
-     * Returns fine-grained carrier id of the current subscription.
+     * Returns fine-grained carrier ID of the current subscription.
      *
-     * <p>The precise carrier id can be used to further differentiate a carrier by different
-     * networks, by prepaid v.s.postpaid or even by 4G v.s.3G plan. Each carrier has a unique
-     * carrier id returned by {@link #getSimCarrierId()} but could have multiple precise carrier id.
-     * e.g, {@link #getSimCarrierId()} will always return Tracfone (id 2022) for a Tracfone SIM,
-     * while {@link #getSimPreciseCarrierId()} can return Tracfone AT&T or Tracfone T-Mobile based
-     * on the current subscription IMSI.
+     * A specific carrier ID can represent the fact that a carrier may be in effect an aggregation
+     * of other carriers (ie in an MVNO type scenario) where each of these specific carriers which
+     * are used to make up the actual carrier service may have different carrier configurations.
+     * A specific carrier ID could also be used, for example, in a scenario where a carrier requires
+     * different carrier configuration for different service offering such as a prepaid plan.
      *
-     * <p>For carriers without any fine-grained carrier ids, return {@link #getSimCarrierId()}
-     * <p>Precise carrier ids are defined in the same way as carrier id
+     * the specific carrier ID would be used for configuration purposes, but apps wishing to know
+     * about the carrier itself should use the regular carrier ID returned by
+     * {@link #getSimCarrierId()}.
+     *
+     * e.g, Tracfone SIMs could return different specific carrier ID based on IMSI from current
+     * subscription while carrier ID remains the same.
+     *
+     * <p>For carriers without fine-grained specific carrier ids, return {@link #getSimCarrierId()}
+     * <p>Specific carrier ids are defined in the same way as carrier id
      * <a href="https://android.googlesource.com/platform/packages/providers/TelephonyProvider/+/master/assets/carrier_list.textpb">here</a>
      * except each with a "parent" id linking to its top-level carrier id.
      *
@@ -8925,11 +8970,11 @@
      * Return {@link #UNKNOWN_CARRIER_ID} if the subscription is unavailable or the carrier cannot
      * be identified.
      */
-    public int getSimPreciseCarrierId() {
+    public int getSimSpecificCarrierId() {
         try {
             ITelephony service = getITelephony();
             if (service != null) {
-                return service.getSubscriptionPreciseCarrierId(getSubId());
+                return service.getSubscriptionSpecificCarrierId(getSubId());
             }
         } catch (RemoteException ex) {
             // This could happen if binder process crashes.
@@ -8939,18 +8984,22 @@
 
     /**
      * Similar like {@link #getSimCarrierIdName()}, returns user-facing name of the
-     * precise carrier id returned by {@link #getSimPreciseCarrierId()}.
+     * specific carrier id returned by {@link #getSimSpecificCarrierId()}.
+     *
+     * The specific carrier ID would be used for configuration purposes, but apps wishing to know
+     * about the carrier itself should use the regular carrier ID returned by
+     * {@link #getSimCarrierIdName()}.
      *
      * <p>The returned name is unlocalized.
      *
-     * @return user-facing name of the subscription precise carrier id. Return {@code null} if the
+     * @return user-facing name of the subscription specific carrier id. Return {@code null} if the
      * subscription is unavailable or the carrier cannot be identified.
      */
-    public @Nullable CharSequence getSimPreciseCarrierIdName() {
+    public @Nullable CharSequence getSimSpecificCarrierIdName() {
         try {
             ITelephony service = getITelephony();
             if (service != null) {
-                return service.getSubscriptionPreciseCarrierName(getSubId());
+                return service.getSubscriptionSpecificCarrierName(getSubId());
             }
         } catch (RemoteException ex) {
             // This could happen if binder process crashes.
@@ -9048,6 +9097,7 @@
      * @return Application ID for specified app type or {@code null} if no uicc or error.
      * @hide
      */
+    @Nullable
     @SystemApi
     @RequiresPermission(android.Manifest.permission.READ_PRIVILEGED_PHONE_STATE)
     public String getAidForAppType(@UiccAppType int appType) {
@@ -9714,7 +9764,7 @@
             ITelephony telephony = getITelephony();
             if (telephony != null) {
                 return telephony.getNumberOfModemsWithSimultaneousDataConnections(
-                        getSubId(), mContext.getOpPackageName());
+                        getSubId(), getOpPackageName());
             }
         } catch (RemoteException ex) {
             // This could happen if binder process crashes.
@@ -9981,18 +10031,21 @@
      * a SecurityException if the caller does not have the permission.
      */
     @RequiresPermission(android.Manifest.permission.READ_PHONE_STATE)
-    @Nullable
-    public Map<Integer, List<EmergencyNumber>> getCurrentEmergencyNumberList() {
+    @NonNull
+    public Map<Integer, List<EmergencyNumber>> getEmergencyNumberList() {
+        Map<Integer, List<EmergencyNumber>> emergencyNumberList = new HashMap<>();
         try {
             ITelephony telephony = getITelephony();
-            if (telephony == null) {
-                return null;
+            if (telephony != null) {
+                return telephony.getEmergencyNumberList(mContext.getOpPackageName());
+            } else {
+                throw new IllegalStateException("telephony service is null.");
             }
-            return telephony.getCurrentEmergencyNumberList(mContext.getOpPackageName());
         } catch (RemoteException ex) {
-            Log.e(TAG, "getCurrentEmergencyNumberList RemoteException", ex);
+            Log.e(TAG, "getEmergencyNumberList RemoteException", ex);
+            ex.rethrowAsRuntimeException();
         }
-        return null;
+        return emergencyNumberList;
     }
 
     /**
@@ -10031,31 +10084,34 @@
      * a SecurityException if the caller does not have the permission.
      */
     @RequiresPermission(android.Manifest.permission.READ_PHONE_STATE)
-    @Nullable
-    public Map<Integer, List<EmergencyNumber>> getCurrentEmergencyNumberList(
+    @NonNull
+    public Map<Integer, List<EmergencyNumber>> getEmergencyNumberList(
             @EmergencyServiceCategories int categories) {
+        Map<Integer, List<EmergencyNumber>> emergencyNumberList = new HashMap<>();
         try {
             ITelephony telephony = getITelephony();
-            if (telephony == null) {
-                return null;
-            }
-            Map<Integer, List<EmergencyNumber>> numberMap = telephony
-                    .getCurrentEmergencyNumberList(mContext.getOpPackageName());
-            if (numberMap != null) {
-                for (Integer subscriptionId : numberMap.keySet()) {
-                    List<EmergencyNumber> numberList = numberMap.get(subscriptionId);
-                    for (EmergencyNumber number : numberList) {
-                        if (!number.isInEmergencyServiceCategories(categories)) {
-                            numberList.remove(number);
+            if (telephony != null) {
+                emergencyNumberList = telephony.getEmergencyNumberList(
+                        mContext.getOpPackageName());
+                if (emergencyNumberList != null) {
+                    for (Integer subscriptionId : emergencyNumberList.keySet()) {
+                        List<EmergencyNumber> numberList = emergencyNumberList.get(subscriptionId);
+                        for (EmergencyNumber number : numberList) {
+                            if (!number.isInEmergencyServiceCategories(categories)) {
+                                numberList.remove(number);
+                            }
                         }
                     }
                 }
+                return emergencyNumberList;
+            } else {
+                throw new IllegalStateException("telephony service is null.");
             }
-            return numberMap;
         } catch (RemoteException ex) {
-            Log.e(TAG, "getCurrentEmergencyNumberList with Categories RemoteException", ex);
+            Log.e(TAG, "getEmergencyNumberList with Categories RemoteException", ex);
+            ex.rethrowAsRuntimeException();
         }
-        return null;
+        return emergencyNumberList;
     }
 
     /**
@@ -10069,15 +10125,17 @@
      * @return {@code true} if the given number is an emergency number based on current locale,
      * sim, modem and network; {@code false} otherwise.
      */
-    public boolean isCurrentEmergencyNumber(@NonNull String number) {
+    public boolean isEmergencyNumber(@NonNull String number) {
         try {
             ITelephony telephony = getITelephony();
-            if (telephony == null) {
-                return false;
+            if (telephony != null) {
+                return telephony.isEmergencyNumber(number, true);
+            } else {
+                throw new IllegalStateException("telephony service is null.");
             }
-            return telephony.isCurrentEmergencyNumber(number, true);
         } catch (RemoteException ex) {
-            Log.e(TAG, "isCurrentEmergencyNumber RemoteException", ex);
+            Log.e(TAG, "isEmergencyNumber RemoteException", ex);
+            ex.rethrowAsRuntimeException();
         }
         return false;
     }
@@ -10106,15 +10164,17 @@
      */
     @SystemApi
     @RequiresPermission(android.Manifest.permission.READ_PRIVILEGED_PHONE_STATE)
-    public boolean isCurrentPotentialEmergencyNumber(@NonNull String number) {
+    public boolean isPotentialEmergencyNumber(@NonNull String number) {
         try {
             ITelephony telephony = getITelephony();
-            if (telephony == null) {
-                return false;
+            if (telephony != null) {
+                return telephony.isEmergencyNumber(number, false);
+            } else {
+                throw new IllegalStateException("telephony service is null.");
             }
-            return telephony.isCurrentEmergencyNumber(number, false);
         } catch (RemoteException ex) {
-            Log.e(TAG, "isCurrentEmergencyNumber RemoteException", ex);
+            Log.e(TAG, "isEmergencyNumber RemoteException", ex);
+            ex.rethrowAsRuntimeException();
         }
         return false;
     }
@@ -10142,6 +10202,41 @@
      */
     public static final int SET_OPPORTUNISTIC_SUB_INVALID_PARAMETER = 2;
 
+    /** @hide */
+    @Retention(RetentionPolicy.SOURCE)
+    @IntDef(prefix = {"UPDATE_AVAILABLE_NETWORKS"}, value = {
+            UPDATE_AVAILABLE_NETWORKS_SUCCESS,
+            UPDATE_AVAILABLE_NETWORKS_UNKNOWN_FAILURE,
+            UPDATE_AVAILABLE_NETWORKS_ABORTED,
+            UPDATE_AVAILABLE_NETWORKS_INVALID_ARGUMENTS,
+            UPDATE_AVAILABLE_NETWORKS_NO_CARRIER_PRIVILEGE})
+    public @interface UpdateAvailableNetworksResult {}
+
+    /**
+     * No error. Operation succeeded.
+     */
+    public static final int UPDATE_AVAILABLE_NETWORKS_SUCCESS = 0;
+
+    /**
+     * There is a unknown failure happened.
+     */
+    public static final int UPDATE_AVAILABLE_NETWORKS_UNKNOWN_FAILURE = 1;
+
+    /**
+     * The request is aborted.
+     */
+    public static final int UPDATE_AVAILABLE_NETWORKS_ABORTED = 2;
+
+    /**
+     * The parameter passed in is invalid.
+     */
+    public static final int UPDATE_AVAILABLE_NETWORKS_INVALID_ARGUMENTS = 3;
+
+    /**
+     * No carrier privilege.
+     */
+    public static final int UPDATE_AVAILABLE_NETWORKS_NO_CARRIER_PRIVILEGE = 4;
+
     /**
      * Set preferred opportunistic data subscription id.
      *
@@ -10153,21 +10248,40 @@
      * @param subId which opportunistic subscription
      * {@link SubscriptionManager#getOpportunisticSubscriptions} is preferred for cellular data.
      * Pass {@link SubscriptionManager#DEFAULT_SUBSCRIPTION_ID} to unset the preference
-     * @return true if request is accepted, else false.
+     * @param needValidation whether validation is needed before switch happens.
+     * @param executor The executor of where the callback will execute.
+     * @param callback Callback will be triggered once it succeeds or failed.
+     *                 See {@link TelephonyManager.SetOpportunisticSubscriptionResult}
+     *                 for more details. Pass null if don't care about the result.
      *
      */
-    public boolean setPreferredOpportunisticDataSubscription(int subId) {
+    public void setPreferredOpportunisticDataSubscription(int subId, boolean needValidation,
+            @Nullable @CallbackExecutor Executor executor, @Nullable Consumer<Integer> callback) {
         String pkgForDebug = mContext != null ? mContext.getOpPackageName() : "<unknown>";
         try {
             IOns iOpportunisticNetworkService = getIOns();
-            if (iOpportunisticNetworkService != null) {
-                return iOpportunisticNetworkService
-                        .setPreferredDataSubscriptionId(subId, pkgForDebug);
+            if (iOpportunisticNetworkService == null) {
+                return;
             }
+            ISetOpportunisticDataCallback callbackStub = new ISetOpportunisticDataCallback.Stub() {
+                @Override
+                public void onComplete(int result) {
+                    if (executor == null || callback == null) {
+                        return;
+                    }
+                    Binder.withCleanCallingIdentity(() -> executor.execute(() -> {
+                        callback.accept(result);
+                    }));
+                }
+            };
+
+            iOpportunisticNetworkService
+                    .setPreferredDataSubscriptionId(subId, needValidation, callbackStub,
+                            pkgForDebug);
         } catch (RemoteException ex) {
             Rlog.e(TAG, "setPreferredDataSubscriptionId RemoteException", ex);
         }
-        return false;
+        return;
     }
 
     /**
@@ -10205,28 +10319,46 @@
      * This api should be called to inform OpportunisticNetwork Service about the availability
      * of a network at the current location. This information will be used by OpportunisticNetwork
      * service to decide to attach to the network opportunistically. If an empty list is passed,
-     * it is assumed that no network is available.
+     * it is assumed that no network is available and will result in disabling the modem stack
+     * to save power.
      * Requires that the calling app has carrier privileges on both primary and
      * secondary subscriptions (see {@link #hasCarrierPrivileges}), or has permission
      * {@link android.Manifest.permission#MODIFY_PHONE_STATE MODIFY_PHONE_STATE}.
      * @param availableNetworks is a list of available network information.
-     * @return true if request is accepted
+     * @param executor The executor of where the callback will execute.
+     * @param callback Callback will be triggered once it succeeds or failed.
      *
      */
     @SuppressAutoDoc // Blocked by b/72967236 - no support for carrier privileges
-    public boolean updateAvailableNetworks(List<AvailableNetworkInfo> availableNetworks) {
+    public void updateAvailableNetworks(@NonNull List<AvailableNetworkInfo> availableNetworks,
+            @Nullable @CallbackExecutor Executor executor,
+            @UpdateAvailableNetworksResult @Nullable Consumer<Integer> callback) {
         String pkgForDebug = mContext != null ? mContext.getOpPackageName() : "<unknown>";
-        boolean ret = false;
         try {
             IOns iOpportunisticNetworkService = getIOns();
-            if (iOpportunisticNetworkService != null && availableNetworks != null) {
-                ret = iOpportunisticNetworkService.updateAvailableNetworks(availableNetworks,
-                        pkgForDebug);
+            if (iOpportunisticNetworkService == null || availableNetworks == null) {
+                Binder.withCleanCallingIdentity(() -> executor.execute(() -> {
+                    callback.accept(UPDATE_AVAILABLE_NETWORKS_INVALID_ARGUMENTS);
+                }));
+                return;
             }
+            IUpdateAvailableNetworksCallback callbackStub =
+                    new IUpdateAvailableNetworksCallback.Stub() {
+                        @Override
+                        public void onComplete(int result) {
+                            if (executor == null || callback == null) {
+                                return;
+                            }
+                            Binder.withCleanCallingIdentity(() -> executor.execute(() -> {
+                                callback.accept(result);
+                            }));
+                        }
+                    };
+            iOpportunisticNetworkService.updateAvailableNetworks(availableNetworks, callbackStub,
+                    pkgForDebug);
         } catch (RemoteException ex) {
             Rlog.e(TAG, "updateAvailableNetworks RemoteException", ex);
         }
-        return ret;
     }
 
     /**
@@ -10334,18 +10466,16 @@
      * <p>Requires Permission:
      * {@link android.Manifest.permission#MODIFY_PHONE_STATE MODIFY_PHONE_STATE} or that the
      * calling app has carrier privileges (see {@link #hasCarrierPrivileges}).
+     *
+     * Note: with only carrier privileges, it is not allowed to switch from multi-sim
+     * to single-sim
+     *
      * @param numOfSims number of live SIMs we want to switch to
      * @throws android.os.RemoteException
      */
     @SuppressAutoDoc // Blocked by b/72967236 - no support for carrier privileges
     @RequiresPermission(android.Manifest.permission.MODIFY_PHONE_STATE)
     public void switchMultiSimConfig(int numOfSims) {
-        //only proceed if multi-sim is not restricted
-        if (!isMultisimSupported()) {
-            Rlog.e(TAG, "switchMultiSimConfig not possible. It is restricted or not supported.");
-            return;
-        }
-
         try {
             ITelephony telephony = getITelephony();
             if (telephony != null) {
diff --git a/telephony/java/android/telephony/UiccAccessRule.java b/telephony/java/android/telephony/UiccAccessRule.java
index d8836dc..37a4491 100644
--- a/telephony/java/android/telephony/UiccAccessRule.java
+++ b/telephony/java/android/telephony/UiccAccessRule.java
@@ -47,7 +47,7 @@
 
     private static final int ENCODING_VERSION = 1;
 
-    public static final Creator<UiccAccessRule> CREATOR = new Creator<UiccAccessRule>() {
+    public static final @android.annotation.NonNull Creator<UiccAccessRule> CREATOR = new Creator<UiccAccessRule>() {
         @Override
         public UiccAccessRule createFromParcel(Parcel in) {
             return new UiccAccessRule(in);
diff --git a/telephony/java/android/telephony/UiccCardInfo.java b/telephony/java/android/telephony/UiccCardInfo.java
index 0192ffb..2c98c4d 100644
--- a/telephony/java/android/telephony/UiccCardInfo.java
+++ b/telephony/java/android/telephony/UiccCardInfo.java
@@ -15,6 +15,8 @@
  */
 package android.telephony;
 
+import android.annotation.NonNull;
+import android.annotation.Nullable;
 import android.os.Parcel;
 import android.os.Parcelable;
 
@@ -32,7 +34,7 @@
     private final int mSlotIndex;
     private final boolean mIsRemovable;
 
-    public static final Creator<UiccCardInfo> CREATOR = new Creator<UiccCardInfo>() {
+    public static final @android.annotation.NonNull Creator<UiccCardInfo> CREATOR = new Creator<UiccCardInfo>() {
         @Override
         public UiccCardInfo createFromParcel(Parcel in) {
             return new UiccCardInfo(in);
@@ -104,6 +106,7 @@
      * Note that this field may be omitted if the caller does not have the correct permissions
      * (see {@link TelephonyManager#getUiccCardsInfo()}).
      */
+    @Nullable
     public String getEid() {
         if (!mIsEuicc) {
             return null;
@@ -117,6 +120,7 @@
      * Note that this field may be omitted if the caller does not have the correct permissions
      * (see {@link TelephonyManager#getUiccCardsInfo()}).
      */
+    @Nullable
     public String getIccId() {
         return mIccId;
     }
@@ -129,11 +133,12 @@
     }
 
     /**
-     * Returns a copy of the UiccCardinfo with the clears the EID and ICCID set to null. These
-     * values are generally private and require carrier privileges to view.
+     * Returns a copy of the UiccCardinfo with the EID and ICCID set to null. These values are
+     * generally private and require carrier privileges to view.
      *
      * @hide
      */
+    @NonNull
     public UiccCardInfo getUnprivileged() {
         return new UiccCardInfo(mIsEuicc, mCardId, null, null, mSlotIndex, mIsRemovable);
     }
diff --git a/telephony/java/android/telephony/UiccSlotInfo.java b/telephony/java/android/telephony/UiccSlotInfo.java
index 93a7da0..785d7ae 100644
--- a/telephony/java/android/telephony/UiccSlotInfo.java
+++ b/telephony/java/android/telephony/UiccSlotInfo.java
@@ -63,7 +63,7 @@
     private final boolean mIsExtendedApduSupported;
     private final boolean mIsRemovable;
 
-    public static final Creator<UiccSlotInfo> CREATOR = new Creator<UiccSlotInfo>() {
+    public static final @android.annotation.NonNull Creator<UiccSlotInfo> CREATOR = new Creator<UiccSlotInfo>() {
         @Override
         public UiccSlotInfo createFromParcel(Parcel in) {
             return new UiccSlotInfo(in);
diff --git a/telephony/java/android/telephony/UssdResponse.java b/telephony/java/android/telephony/UssdResponse.java
index 5df681d..19756b5 100644
--- a/telephony/java/android/telephony/UssdResponse.java
+++ b/telephony/java/android/telephony/UssdResponse.java
@@ -63,7 +63,7 @@
         mReturnMessage = returnMessage;
     }
 
-    public static final Parcelable.Creator<UssdResponse> CREATOR = new Creator<UssdResponse>() {
+    public static final @android.annotation.NonNull Parcelable.Creator<UssdResponse> CREATOR = new Creator<UssdResponse>() {
 
         @Override
         public UssdResponse createFromParcel(Parcel in) {
diff --git a/telephony/java/android/telephony/VisualVoicemailSms.java b/telephony/java/android/telephony/VisualVoicemailSms.java
index 1e6ea4b..085f882 100644
--- a/telephony/java/android/telephony/VisualVoicemailSms.java
+++ b/telephony/java/android/telephony/VisualVoicemailSms.java
@@ -116,7 +116,7 @@
     }
 
 
-    public static final Creator<VisualVoicemailSms> CREATOR =
+    public static final @android.annotation.NonNull Creator<VisualVoicemailSms> CREATOR =
             new Creator<VisualVoicemailSms>() {
                 @Override
                 public VisualVoicemailSms createFromParcel(Parcel in) {
diff --git a/telephony/java/android/telephony/VisualVoicemailSmsFilterSettings.java b/telephony/java/android/telephony/VisualVoicemailSmsFilterSettings.java
index 7eeb1ce..e8f3f1e 100644
--- a/telephony/java/android/telephony/VisualVoicemailSmsFilterSettings.java
+++ b/telephony/java/android/telephony/VisualVoicemailSmsFilterSettings.java
@@ -162,7 +162,7 @@
         packageName = builder.mPackageName;
     }
 
-    public static final Creator<VisualVoicemailSmsFilterSettings> CREATOR =
+    public static final @android.annotation.NonNull Creator<VisualVoicemailSmsFilterSettings> CREATOR =
             new Creator<VisualVoicemailSmsFilterSettings>() {
                 @Override
                 public VisualVoicemailSmsFilterSettings createFromParcel(Parcel in) {
diff --git a/telephony/java/android/telephony/VoLteServiceState.java b/telephony/java/android/telephony/VoLteServiceState.java
index d0b7519..f65c7b0 100644
--- a/telephony/java/android/telephony/VoLteServiceState.java
+++ b/telephony/java/android/telephony/VoLteServiceState.java
@@ -145,7 +145,7 @@
      *
      * @hide
      */
-    public static final Parcelable.Creator<VoLteServiceState> CREATOR = new Parcelable.Creator() {
+    public static final @android.annotation.NonNull Parcelable.Creator<VoLteServiceState> CREATOR = new Parcelable.Creator() {
         public VoLteServiceState createFromParcel(Parcel in) {
             return new VoLteServiceState(in);
         }
diff --git a/telephony/java/android/telephony/VoiceSpecificRegistrationStates.java b/telephony/java/android/telephony/VoiceSpecificRegistrationStates.java
index 871ee4d..d8ce5b4 100644
--- a/telephony/java/android/telephony/VoiceSpecificRegistrationStates.java
+++ b/telephony/java/android/telephony/VoiceSpecificRegistrationStates.java
@@ -99,7 +99,7 @@
     }
 
 
-    public static final Parcelable.Creator<VoiceSpecificRegistrationStates> CREATOR =
+    public static final @android.annotation.NonNull Parcelable.Creator<VoiceSpecificRegistrationStates> CREATOR =
             new Parcelable.Creator<VoiceSpecificRegistrationStates>() {
                 @Override
                 public VoiceSpecificRegistrationStates createFromParcel(Parcel source) {
diff --git a/telephony/java/android/telephony/data/ApnSetting.java b/telephony/java/android/telephony/data/ApnSetting.java
index 0e69530..0b1d1fb 100644
--- a/telephony/java/android/telephony/data/ApnSetting.java
+++ b/telephony/java/android/telephony/data/ApnSetting.java
@@ -19,7 +19,7 @@
 import android.annotation.NonNull;
 import android.content.ContentValues;
 import android.database.Cursor;
-import android.hardware.radio.V1_0.ApnTypes;
+import android.hardware.radio.V1_4.ApnTypes;
 import android.net.Uri;
 import android.os.Parcel;
 import android.os.Parcelable;
@@ -61,6 +61,7 @@
     private static final String V4_FORMAT_REGEX = "^\\[ApnSettingV4\\]\\s*";
     private static final String V5_FORMAT_REGEX = "^\\[ApnSettingV5\\]\\s*";
     private static final String V6_FORMAT_REGEX = "^\\[ApnSettingV6\\]\\s*";
+    private static final String V7_FORMAT_REGEX = "^\\[ApnSettingV7\\]\\s*";
 
     /**
      * Default value for mtu if it's not set. Moved from PhoneConstants.
@@ -79,7 +80,7 @@
      * APN type for all APNs.
      * @hide
      */
-    public static final int TYPE_ALL = ApnTypes.ALL;
+    public static final int TYPE_ALL = ApnTypes.ALL | ApnTypes.MCX;
     /** APN type for default data traffic. */
     public static final int TYPE_DEFAULT = ApnTypes.DEFAULT | ApnTypes.HIPRI;
     /** APN type for MMS traffic. */
@@ -103,6 +104,8 @@
      * for access to carrier services in an emergency call situation.
      */
     public static final int TYPE_EMERGENCY = ApnTypes.EMERGENCY;
+    /** APN type for MCX (Mission Critical Service) where X can be PTT/Video/Data */
+    public static final int TYPE_MCX = ApnTypes.MCX;
 
     /** @hide */
     @IntDef(flag = true, prefix = { "TYPE_" }, value = {
@@ -115,7 +118,8 @@
         TYPE_IMS,
         TYPE_CBS,
         TYPE_IA,
-        TYPE_EMERGENCY
+        TYPE_EMERGENCY,
+        TYPE_MCX
     })
     @Retention(RetentionPolicy.SOURCE)
     public @interface ApnType {}
@@ -206,6 +210,7 @@
         APN_TYPE_STRING_MAP.put("cbs", TYPE_CBS);
         APN_TYPE_STRING_MAP.put("ia", TYPE_IA);
         APN_TYPE_STRING_MAP.put("emergency", TYPE_EMERGENCY);
+        APN_TYPE_STRING_MAP.put("mcx", TYPE_MCX);
         APN_TYPE_INT_MAP = new ArrayMap<Integer, String>();
         APN_TYPE_INT_MAP.put(TYPE_DEFAULT, "default");
         APN_TYPE_INT_MAP.put(TYPE_MMS, "mms");
@@ -217,6 +222,7 @@
         APN_TYPE_INT_MAP.put(TYPE_CBS, "cbs");
         APN_TYPE_INT_MAP.put(TYPE_IA, "ia");
         APN_TYPE_INT_MAP.put(TYPE_EMERGENCY, "emergency");
+        APN_TYPE_INT_MAP.put(TYPE_MCX, "mcx");
 
         PROTOCOL_STRING_MAP = new ArrayMap<String, Integer>();
         PROTOCOL_STRING_MAP.put("IP", PROTOCOL_IP);
@@ -281,6 +287,8 @@
     private boolean mPermanentFailed = false;
     private final int mCarrierId;
 
+    private final int mSkip464Xlat;
+
     /**
      * Returns the MTU size of the mobile interface to which the APN connected.
      *
@@ -618,6 +626,17 @@
         return mCarrierId;
     }
 
+    /**
+     * Returns the skip464xlat flag for this APN.
+     *
+     * @return SKIP_464XLAT_DEFAULT, SKIP_464XLAT_DISABLE or SKIP_464XLAT_ENABLE
+     * @hide
+     */
+    @Carriers.Skip464XlatStatus
+    public int getSkip464Xlat() {
+        return mSkip464Xlat;
+    }
+
     private ApnSetting(Builder builder) {
         this.mEntryName = builder.mEntryName;
         this.mApnName = builder.mApnName;
@@ -646,6 +665,7 @@
         this.mMvnoMatchData = builder.mMvnoMatchData;
         this.mApnSetId = builder.mApnSetId;
         this.mCarrierId = builder.mCarrierId;
+        this.mSkip464Xlat = builder.mSkip464Xlat;
     }
 
     /**
@@ -657,7 +677,7 @@
             int authType, int mApnTypeBitmask, int protocol, int roamingProtocol,
             boolean carrierEnabled, int networkTypeBitmask, int profileId,
             boolean modemCognitive, int maxConns, int waitTime, int maxConnsTime, int mtu,
-            int mvnoType, String mvnoMatchData, int apnSetId, int carrierId) {
+            int mvnoType, String mvnoMatchData, int apnSetId, int carrierId, int skip464xlat) {
         return new Builder()
             .setId(id)
             .setOperatorNumeric(operatorNumeric)
@@ -686,6 +706,7 @@
             .setMvnoMatchData(mvnoMatchData)
             .setApnSetId(apnSetId)
             .setCarrierId(carrierId)
+            .setSkip464Xlat(skip464xlat)
             .buildWithoutCheck();
     }
 
@@ -703,7 +724,8 @@
             mmsc, mmsProxyAddress, mmsProxyPort, user, password, authType, mApnTypeBitmask,
             protocol, roamingProtocol, carrierEnabled, networkTypeBitmask, profileId,
             modemCognitive, maxConns, waitTime, maxConnsTime, mtu, mvnoType, mvnoMatchData,
-            Carriers.NO_APN_SET_ID, TelephonyManager.UNKNOWN_CARRIER_ID);
+            Carriers.NO_APN_SET_ID, TelephonyManager.UNKNOWN_CARRIER_ID,
+            Carriers.SKIP_464XLAT_DEFAULT);
     }
 
     /**
@@ -762,7 +784,8 @@
             cursor.getString(cursor.getColumnIndexOrThrow(
                 Telephony.Carriers.MVNO_MATCH_DATA)),
             cursor.getInt(cursor.getColumnIndexOrThrow(Telephony.Carriers.APN_SET_ID)),
-            cursor.getInt(cursor.getColumnIndexOrThrow(Telephony.Carriers.CARRIER_ID)));
+            cursor.getInt(cursor.getColumnIndexOrThrow(Telephony.Carriers.CARRIER_ID)),
+            cursor.getInt(cursor.getColumnIndexOrThrow(Carriers.SKIP_464XLAT)));
     }
 
     /**
@@ -775,7 +798,7 @@
             apn.mProtocol, apn.mRoamingProtocol, apn.mCarrierEnabled, apn.mNetworkTypeBitmask,
             apn.mProfileId, apn.mPersistent, apn.mMaxConns, apn.mWaitTime,
             apn.mMaxConnsTime, apn.mMtu, apn.mMvnoType, apn.mMvnoMatchData, apn.mApnSetId,
-            apn.mCarrierId);
+            apn.mCarrierId, apn.mSkip464Xlat);
     }
 
     /**
@@ -824,6 +847,13 @@
      *   <profileId>, <modemCognitive>, <maxConns>, <waitTime>, <maxConnsTime>, <mtu>,
      *   <mvnoType>, <mvnoMatchData>, <networkTypeBitmask>, <apnSetId>, <carrierId>
      *
+     * v7 format:
+     *   [ApnSettingV7] <carrier>, <apn>, <proxy>, <port>, <user>, <password>, <server>,
+     *   <mmsc>, <mmsproxy>, <mmsport>, <mcc>, <mnc>, <authtype>,
+     *   <type>[| <type>...], <protocol>, <roaming_protocol>, <carrierEnabled>, <bearerBitmask>,
+     *   <profileId>, <modemCognitive>, <maxConns>, <waitTime>, <maxConnsTime>, <mtu>,
+     *   <mvnoType>, <mvnoMatchData>, <networkTypeBitmask>, <apnSetId>, <carrierId>, <skip464xlat>
+     *
      * Note that the strings generated by {@link #toString()} do not contain the username
      * and password and thus cannot be read by this method.
      *
@@ -836,7 +866,10 @@
 
         int version;
         // matches() operates on the whole string, so append .* to the regex.
-        if (data.matches(V6_FORMAT_REGEX + ".*")) {
+        if (data.matches(V7_FORMAT_REGEX + ".*")) {
+            version = 7;
+            data = data.replaceFirst(V7_FORMAT_REGEX, "");
+        } else if (data.matches(V6_FORMAT_REGEX + ".*")) {
             version = 6;
             data = data.replaceFirst(V6_FORMAT_REGEX, "");
         } else if (data.matches(V5_FORMAT_REGEX + ".*")) {
@@ -882,6 +915,7 @@
         String mvnoMatchData = "";
         int apnSetId = Carriers.NO_APN_SET_ID;
         int carrierId = TelephonyManager.UNKNOWN_CARRIER_ID;
+        int skip464xlat = Carriers.SKIP_464XLAT_DEFAULT;
         if (version == 1) {
             typeArray = new String[a.length - 13];
             System.arraycopy(a, 13, typeArray, 0, a.length - 13);
@@ -928,6 +962,12 @@
             if (a.length > 28) {
                 carrierId = Integer.parseInt(a[28]);
             }
+            if (a.length > 29) {
+                try {
+                    skip464xlat = Integer.parseInt(a[29]);
+                } catch (NumberFormatException e) {
+                }
+            }
         }
 
         // If both bearerBitmask and networkTypeBitmask were specified, bearerBitmask would be
@@ -943,7 +983,7 @@
             getProtocolIntFromString(protocol), getProtocolIntFromString(roamingProtocol),
             carrierEnabled, networkTypeBitmask, profileId, modemCognitive, maxConns, waitTime,
             maxConnsTime, mtu, getMvnoTypeIntFromString(mvnoType), mvnoMatchData, apnSetId,
-            carrierId);
+            carrierId, skip464xlat);
     }
 
     /**
@@ -979,7 +1019,7 @@
      */
     public String toString() {
         StringBuilder sb = new StringBuilder();
-        sb.append("[ApnSettingV6] ")
+        sb.append("[ApnSettingV7] ")
                 .append(mEntryName)
                 .append(", ").append(mId)
                 .append(", ").append(mOperatorNumeric)
@@ -1007,6 +1047,7 @@
         sb.append(", ").append(mNetworkTypeBitmask);
         sb.append(", ").append(mApnSetId);
         sb.append(", ").append(mCarrierId);
+        sb.append(", ").append(mSkip464Xlat);
         return sb.toString();
     }
 
@@ -1100,7 +1141,8 @@
             && Objects.equals(mMvnoMatchData, other.mMvnoMatchData)
             && Objects.equals(mNetworkTypeBitmask, other.mNetworkTypeBitmask)
             && Objects.equals(mApnSetId, other.mApnSetId)
-            && Objects.equals(mCarrierId, other.mCarrierId);
+            && Objects.equals(mCarrierId, other.mCarrierId)
+            && Objects.equals(mSkip464Xlat, other.mSkip464Xlat);
     }
 
     /**
@@ -1146,7 +1188,8 @@
             && Objects.equals(mMvnoType, other.mMvnoType)
             && Objects.equals(mMvnoMatchData, other.mMvnoMatchData)
             && Objects.equals(mApnSetId, other.mApnSetId)
-            && Objects.equals(mCarrierId, other.mCarrierId);
+            && Objects.equals(mCarrierId, other.mCarrierId)
+            && Objects.equals(mSkip464Xlat, other.mSkip464Xlat);
     }
 
     /**
@@ -1174,7 +1217,8 @@
             && xorEqualsInt(this.mMmsProxyPort, other.mMmsProxyPort))
             && Objects.equals(this.mNetworkTypeBitmask, other.mNetworkTypeBitmask)
             && Objects.equals(mApnSetId, other.mApnSetId)
-            && Objects.equals(mCarrierId, other.mCarrierId);
+            && Objects.equals(mCarrierId, other.mCarrierId)
+            && Objects.equals(mSkip464Xlat, other.mSkip464Xlat);
     }
 
     // Equal or one is null.
@@ -1221,6 +1265,7 @@
         apnValue.put(Telephony.Carriers.MVNO_TYPE, getMvnoTypeStringFromInt(mMvnoType));
         apnValue.put(Telephony.Carriers.NETWORK_TYPE_BITMASK, mNetworkTypeBitmask);
         apnValue.put(Telephony.Carriers.CARRIER_ID, mCarrierId);
+        apnValue.put(Telephony.Carriers.SKIP_464XLAT, mSkip464Xlat);
 
         return apnValue;
     }
@@ -1380,6 +1425,7 @@
         dest.writeInt(mNetworkTypeBitmask);
         dest.writeInt(mApnSetId);
         dest.writeInt(mCarrierId);
+        dest.writeInt(mSkip464Xlat);
     }
 
     private static ApnSetting readFromParcel(Parcel in) {
@@ -1403,14 +1449,15 @@
         final int networkTypeBitmask = in.readInt();
         final int apnSetId = in.readInt();
         final int carrierId = in.readInt();
+        final int skip464xlat = in.readInt();
 
         return makeApnSetting(id, operatorNumeric, entryName, apnName,
-            proxy, port, mmsc, mmsProxy, mmsPort, user, password, authType, apnTypesBitmask,
-            protocol, roamingProtocol, carrierEnabled, networkTypeBitmask, 0, false,
-            0, 0, 0, 0, mvnoType, null, apnSetId, carrierId);
+                proxy, port, mmsc, mmsProxy, mmsPort, user, password, authType, apnTypesBitmask,
+                protocol, roamingProtocol, carrierEnabled, networkTypeBitmask, 0, false,
+                0, 0, 0, 0, mvnoType, null, apnSetId, carrierId, skip464xlat);
     }
 
-    public static final Parcelable.Creator<ApnSetting> CREATOR =
+    public static final @android.annotation.NonNull Parcelable.Creator<ApnSetting> CREATOR =
             new Parcelable.Creator<ApnSetting>() {
                 @Override
                 public ApnSetting createFromParcel(Parcel in) {
@@ -1484,6 +1531,7 @@
         private String mMvnoMatchData;
         private int mApnSetId;
         private int mCarrierId = TelephonyManager.UNKNOWN_CARRIER_ID;
+        private int mSkip464Xlat = Carriers.SKIP_464XLAT_DEFAULT;
 
         /**
          * Default constructor for Builder.
@@ -1820,12 +1868,24 @@
          *
          * @param carrierId the carrier id to set for this APN
          */
+        @NonNull
         public Builder setCarrierId(int carrierId) {
             this.mCarrierId = carrierId;
             return this;
         }
 
         /**
+         * Sets skip464xlat flag for this APN.
+         *
+         * @param skip464xlat skip464xlat for this APN
+         * @hide
+         */
+        public Builder setSkip464Xlat(@Carriers.Skip464XlatStatus int skip464xlat) {
+            this.mSkip464Xlat = skip464xlat;
+            return this;
+        }
+
+        /**
          * Builds {@link ApnSetting} from this builder.
          *
          * @return {@code null} if {@link #setApnName(String)} or {@link #setEntryName(String)}
@@ -1833,7 +1893,7 @@
          * {@link ApnSetting} built from this builder otherwise.
          */
         public ApnSetting build() {
-            if ((mApnTypeBitmask & ApnTypes.ALL) == 0 || TextUtils.isEmpty(mApnName)
+            if ((mApnTypeBitmask & TYPE_ALL) == 0 || TextUtils.isEmpty(mApnName)
                 || TextUtils.isEmpty(mEntryName)) {
                 return null;
             }
diff --git a/telephony/java/android/telephony/data/DataCallResponse.java b/telephony/java/android/telephony/data/DataCallResponse.java
index 3d2fe5f..0622cdd 100644
--- a/telephony/java/android/telephony/data/DataCallResponse.java
+++ b/telephony/java/android/telephony/data/DataCallResponse.java
@@ -25,6 +25,8 @@
 import android.os.Parcelable;
 import android.telephony.data.ApnSetting.ProtocolType;
 
+import com.android.internal.annotations.VisibleForTesting;
+
 import java.net.InetAddress;
 import java.util.ArrayList;
 import java.util.List;
@@ -90,6 +92,8 @@
         mMtu = mtu;
     }
 
+    /** @hide */
+    @VisibleForTesting
     public DataCallResponse(Parcel source) {
         mStatus = source.readInt();
         mSuggestedRetryTime = source.readInt();
@@ -244,7 +248,7 @@
         dest.writeInt(mMtu);
     }
 
-    public static final Parcelable.Creator<DataCallResponse> CREATOR =
+    public static final @android.annotation.NonNull Parcelable.Creator<DataCallResponse> CREATOR =
             new Parcelable.Creator<DataCallResponse>() {
                 @Override
                 public DataCallResponse createFromParcel(Parcel source) {
diff --git a/telephony/java/android/telephony/data/DataProfile.java b/telephony/java/android/telephony/data/DataProfile.java
index 1d196f9..bcb47f7 100644
--- a/telephony/java/android/telephony/data/DataProfile.java
+++ b/telephony/java/android/telephony/data/DataProfile.java
@@ -19,6 +19,8 @@
 import static android.telephony.data.ApnSetting.ProtocolType;
 
 import android.annotation.IntDef;
+import android.annotation.NonNull;
+import android.annotation.Nullable;
 import android.annotation.SystemApi;
 import android.os.Build;
 import android.os.Parcel;
@@ -158,6 +160,7 @@
     /**
      * @return The APN to establish data connection.
      */
+    @NonNull
     public String getApn() { return mApn; }
 
     /**
@@ -173,11 +176,13 @@
     /**
      * @return The username for APN. Can be null.
      */
+    @Nullable
     public String getUserName() { return mUserName; }
 
     /**
      * @return The password for APN. Can be null.
      */
+    @Nullable
     public String getPassword() { return mPassword; }
 
     /**
@@ -238,7 +243,6 @@
      */
     public boolean isPreferred() { return  mPreferred; }
 
-    /** @hide */
     @Override
     public int describeContents() {
         return 0;
@@ -261,7 +265,6 @@
         return (o == this || toString().equals(o.toString()));
     }
 
-    /** @hide */
     @Override
     public void writeToParcel(Parcel dest, int flags) {
         dest.writeInt(mProfileId);
@@ -283,8 +286,7 @@
         dest.writeBoolean(mPreferred);
     }
 
-    /** @hide */
-    public static final Parcelable.Creator<DataProfile> CREATOR =
+    public static final @android.annotation.NonNull Parcelable.Creator<DataProfile> CREATOR =
             new Parcelable.Creator<DataProfile>() {
         @Override
         public DataProfile createFromParcel(Parcel source) {
diff --git a/telephony/java/android/telephony/data/DataService.java b/telephony/java/android/telephony/data/DataService.java
index 79572b9..59d1e1e 100644
--- a/telephony/java/android/telephony/data/DataService.java
+++ b/telephony/java/android/telephony/data/DataService.java
@@ -116,23 +116,23 @@
      */
     public abstract class DataServiceProvider implements AutoCloseable {
 
-        private final int mSlotId;
+        private final int mSlotIndex;
 
         private final List<IDataServiceCallback> mDataCallListChangedCallbacks = new ArrayList<>();
 
         /**
          * Constructor
-         * @param slotId SIM slot id the data service provider associated with.
+         * @param slotIndex SIM slot index the data service provider associated with.
          */
-        public DataServiceProvider(int slotId) {
-            mSlotId = slotId;
+        public DataServiceProvider(int slotIndex) {
+            mSlotIndex = slotIndex;
         }
 
         /**
-         * @return SIM slot id the data service provider associated with.
+         * @return SIM slot index the data service provider associated with.
          */
-        public final int getSlotId() {
-            return mSlotId;
+        public final int getSlotIndex() {
+            return mSlotIndex;
         }
 
         /**
@@ -152,8 +152,9 @@
          * @param callback The result callback for this request. Null if the client does not care
          *        about the result.
          */
-        public void setupDataCall(int accessNetworkType, DataProfile dataProfile, boolean isRoaming,
-                                  boolean allowRoaming, @SetupDataReason int reason,
+        public void setupDataCall(int accessNetworkType, @NonNull DataProfile dataProfile,
+                                  boolean isRoaming, boolean allowRoaming,
+                                  @SetupDataReason int reason,
                                   @Nullable LinkProperties linkProperties,
                                   @Nullable DataServiceCallback callback) {
             // The default implementation is to return unsupported.
@@ -192,7 +193,7 @@
          * @param callback The result callback for this request. Null if the client does not care
          *        about the result.
          */
-        public void setInitialAttachApn(DataProfile dataProfile, boolean isRoaming,
+        public void setInitialAttachApn(@NonNull DataProfile dataProfile, boolean isRoaming,
                                         @Nullable DataServiceCallback callback) {
             // The default implementation is to return unsupported.
             if (callback != null) {
@@ -211,7 +212,7 @@
          * @param callback The result callback for this request. Null if the client does not care
          *        about the result.
          */
-        public void setDataProfile(List<DataProfile> dps, boolean isRoaming,
+        public void setDataProfile(@NonNull List<DataProfile> dps, boolean isRoaming,
                                    @Nullable DataServiceCallback callback) {
             // The default implementation is to return unsupported.
             if (callback != null) {
@@ -250,9 +251,9 @@
         public final void notifyDataCallListChanged(List<DataCallResponse> dataCallList) {
             synchronized (mDataCallListChangedCallbacks) {
                 for (IDataServiceCallback callback : mDataCallListChangedCallbacks) {
-                    mHandler.obtainMessage(DATA_SERVICE_INDICATION_DATA_CALL_LIST_CHANGED, mSlotId,
-                            0, new DataCallListChangedIndication(dataCallList, callback))
-                            .sendToTarget();
+                    mHandler.obtainMessage(DATA_SERVICE_INDICATION_DATA_CALL_LIST_CHANGED,
+                            mSlotIndex, 0, new DataCallListChangedIndication(dataCallList,
+                                    callback)).sendToTarget();
                 }
             }
         }
@@ -341,20 +342,20 @@
         @Override
         public void handleMessage(Message message) {
             IDataServiceCallback callback;
-            final int slotId = message.arg1;
-            DataServiceProvider serviceProvider = mServiceMap.get(slotId);
+            final int slotIndex = message.arg1;
+            DataServiceProvider serviceProvider = mServiceMap.get(slotIndex);
 
             switch (message.what) {
                 case DATA_SERVICE_CREATE_DATA_SERVICE_PROVIDER:
-                    serviceProvider = createDataServiceProvider(message.arg1);
+                    serviceProvider = onCreateDataServiceProvider(message.arg1);
                     if (serviceProvider != null) {
-                        mServiceMap.put(slotId, serviceProvider);
+                        mServiceMap.put(slotIndex, serviceProvider);
                     }
                     break;
                 case DATA_SERVICE_REMOVE_DATA_SERVICE_PROVIDER:
                     if (serviceProvider != null) {
                         serviceProvider.close();
-                        mServiceMap.remove(slotId);
+                        mServiceMap.remove(slotIndex);
                     }
                     break;
                 case DATA_SERVICE_REMOVE_ALL_DATA_SERVICE_PROVIDERS:
@@ -453,12 +454,12 @@
      * this method to facilitate the creation of {@link DataServiceProvider} instances. The system
      * will call this method after binding the data service for each active SIM slot id.
      *
-     * @param slotId SIM slot id the data service associated with.
+     * @param slotIndex SIM slot id the data service associated with.
      * @return Data service object
      */
-    public abstract DataServiceProvider createDataServiceProvider(int slotId);
+    @Nullable
+    public abstract DataServiceProvider onCreateDataServiceProvider(int slotIndex);
 
-    /** @hide */
     @Override
     public IBinder onBind(Intent intent) {
         if (intent == null || !DATA_SERVICE_INTERFACE.equals(intent.getAction())) {
@@ -468,17 +469,16 @@
         return mBinder;
     }
 
-    /** @hide */
     @Override
     public boolean onUnbind(Intent intent) {
         mHandler.obtainMessage(DATA_SERVICE_REMOVE_ALL_DATA_SERVICE_PROVIDERS).sendToTarget();
         return false;
     }
 
-    /** @hide */
     @Override
     public void onDestroy() {
         mHandlerThread.quit();
+        super.onDestroy();
     }
 
     /**
@@ -486,78 +486,78 @@
      */
     private class IDataServiceWrapper extends IDataService.Stub {
         @Override
-        public void createDataServiceProvider(int slotId) {
-            mHandler.obtainMessage(DATA_SERVICE_CREATE_DATA_SERVICE_PROVIDER, slotId, 0)
+        public void createDataServiceProvider(int slotIndex) {
+            mHandler.obtainMessage(DATA_SERVICE_CREATE_DATA_SERVICE_PROVIDER, slotIndex, 0)
                     .sendToTarget();
         }
 
         @Override
-        public void removeDataServiceProvider(int slotId) {
-            mHandler.obtainMessage(DATA_SERVICE_REMOVE_DATA_SERVICE_PROVIDER, slotId, 0)
+        public void removeDataServiceProvider(int slotIndex) {
+            mHandler.obtainMessage(DATA_SERVICE_REMOVE_DATA_SERVICE_PROVIDER, slotIndex, 0)
                     .sendToTarget();
         }
 
         @Override
-        public void setupDataCall(int slotId, int accessNetworkType, DataProfile dataProfile,
+        public void setupDataCall(int slotIndex, int accessNetworkType, DataProfile dataProfile,
                                   boolean isRoaming, boolean allowRoaming, int reason,
                                   LinkProperties linkProperties, IDataServiceCallback callback) {
-            mHandler.obtainMessage(DATA_SERVICE_REQUEST_SETUP_DATA_CALL, slotId, 0,
+            mHandler.obtainMessage(DATA_SERVICE_REQUEST_SETUP_DATA_CALL, slotIndex, 0,
                     new SetupDataCallRequest(accessNetworkType, dataProfile, isRoaming,
                             allowRoaming, reason, linkProperties, callback))
                     .sendToTarget();
         }
 
         @Override
-        public void deactivateDataCall(int slotId, int cid, int reason,
+        public void deactivateDataCall(int slotIndex, int cid, int reason,
                                        IDataServiceCallback callback) {
-            mHandler.obtainMessage(DATA_SERVICE_REQUEST_DEACTIVATE_DATA_CALL, slotId, 0,
+            mHandler.obtainMessage(DATA_SERVICE_REQUEST_DEACTIVATE_DATA_CALL, slotIndex, 0,
                     new DeactivateDataCallRequest(cid, reason, callback))
                     .sendToTarget();
         }
 
         @Override
-        public void setInitialAttachApn(int slotId, DataProfile dataProfile, boolean isRoaming,
+        public void setInitialAttachApn(int slotIndex, DataProfile dataProfile, boolean isRoaming,
                                         IDataServiceCallback callback) {
-            mHandler.obtainMessage(DATA_SERVICE_REQUEST_SET_INITIAL_ATTACH_APN, slotId, 0,
+            mHandler.obtainMessage(DATA_SERVICE_REQUEST_SET_INITIAL_ATTACH_APN, slotIndex, 0,
                     new SetInitialAttachApnRequest(dataProfile, isRoaming, callback))
                     .sendToTarget();
         }
 
         @Override
-        public void setDataProfile(int slotId, List<DataProfile> dps, boolean isRoaming,
+        public void setDataProfile(int slotIndex, List<DataProfile> dps, boolean isRoaming,
                                    IDataServiceCallback callback) {
-            mHandler.obtainMessage(DATA_SERVICE_REQUEST_SET_DATA_PROFILE, slotId, 0,
+            mHandler.obtainMessage(DATA_SERVICE_REQUEST_SET_DATA_PROFILE, slotIndex, 0,
                     new SetDataProfileRequest(dps, isRoaming, callback)).sendToTarget();
         }
 
         @Override
-        public void getDataCallList(int slotId, IDataServiceCallback callback) {
+        public void getDataCallList(int slotIndex, IDataServiceCallback callback) {
             if (callback == null) {
                 loge("getDataCallList: callback is null");
                 return;
             }
-            mHandler.obtainMessage(DATA_SERVICE_REQUEST_GET_DATA_CALL_LIST, slotId, 0,
+            mHandler.obtainMessage(DATA_SERVICE_REQUEST_GET_DATA_CALL_LIST, slotIndex, 0,
                     callback).sendToTarget();
         }
 
         @Override
-        public void registerForDataCallListChanged(int slotId, IDataServiceCallback callback) {
+        public void registerForDataCallListChanged(int slotIndex, IDataServiceCallback callback) {
             if (callback == null) {
                 loge("registerForDataCallListChanged: callback is null");
                 return;
             }
-            mHandler.obtainMessage(DATA_SERVICE_REQUEST_REGISTER_DATA_CALL_LIST_CHANGED, slotId,
+            mHandler.obtainMessage(DATA_SERVICE_REQUEST_REGISTER_DATA_CALL_LIST_CHANGED, slotIndex,
                     0, callback).sendToTarget();
         }
 
         @Override
-        public void unregisterForDataCallListChanged(int slotId, IDataServiceCallback callback) {
+        public void unregisterForDataCallListChanged(int slotIndex, IDataServiceCallback callback) {
             if (callback == null) {
                 loge("unregisterForDataCallListChanged: callback is null");
                 return;
             }
-            mHandler.obtainMessage(DATA_SERVICE_REQUEST_UNREGISTER_DATA_CALL_LIST_CHANGED, slotId,
-                    0, callback).sendToTarget();
+            mHandler.obtainMessage(DATA_SERVICE_REQUEST_UNREGISTER_DATA_CALL_LIST_CHANGED,
+                    slotIndex, 0, callback).sendToTarget();
         }
     }
 
diff --git a/telephony/java/android/telephony/data/DataServiceCallback.java b/telephony/java/android/telephony/data/DataServiceCallback.java
index bef1142..2d0cfe8 100644
--- a/telephony/java/android/telephony/data/DataServiceCallback.java
+++ b/telephony/java/android/telephony/data/DataServiceCallback.java
@@ -17,6 +17,8 @@
 package android.telephony.data;
 
 import android.annotation.IntDef;
+import android.annotation.NonNull;
+import android.annotation.Nullable;
 import android.annotation.SystemApi;
 import android.net.LinkProperties;
 import android.os.RemoteException;
@@ -74,7 +76,8 @@
      * @param result The result code. Must be one of the {@link ResultCode}.
      * @param response Setup data call response.
      */
-    public void onSetupDataCallComplete(@ResultCode int result, DataCallResponse response) {
+    public void onSetupDataCallComplete(@ResultCode int result,
+                                        @Nullable DataCallResponse response) {
         IDataServiceCallback callback = mCallback.get();
         if (callback != null) {
             try {
@@ -141,10 +144,11 @@
      * DataServiceCallback)}.
      *
      * @param result The result code. Must be one of the {@link ResultCode}.
-     * @param dataCallList List of the current active data connection.
+     * @param dataCallList List of the current active data connection. If no data call is presented,
+     * set it to an empty list.
      */
     public void onGetDataCallListComplete(@ResultCode int result,
-                                          List<DataCallResponse> dataCallList) {
+                                          @NonNull List<DataCallResponse> dataCallList) {
         IDataServiceCallback callback = mCallback.get();
         if (callback != null) {
             try {
@@ -156,11 +160,12 @@
     }
 
     /**
-     * Called to indicate that data connection list changed.
+     * Called to indicate that data connection list changed. If no data call is presented, set it to
+     * an empty list.
      *
      * @param dataCallList List of the current active data connection.
      */
-    public void onDataCallListChanged(List<DataCallResponse> dataCallList) {
+    public void onDataCallListChanged(@NonNull List<DataCallResponse> dataCallList) {
         IDataServiceCallback callback = mCallback.get();
         if (callback != null) {
             try {
diff --git a/telephony/java/android/telephony/data/QualifiedNetworksService.java b/telephony/java/android/telephony/data/QualifiedNetworksService.java
index 45b4849..c38f278 100644
--- a/telephony/java/android/telephony/data/QualifiedNetworksService.java
+++ b/telephony/java/android/telephony/data/QualifiedNetworksService.java
@@ -16,6 +16,8 @@
 
 package android.telephony.data;
 
+import android.annotation.NonNull;
+import android.annotation.Nullable;
 import android.annotation.SystemApi;
 import android.app.Service;
 import android.content.Intent;
@@ -132,7 +134,7 @@
          * for data setup.
          */
         public final void updateQualifiedNetworkTypes(@ApnType int apnTypes,
-                                                      int[] qualifiedNetworkTypes) {
+                                                      @Nullable int[] qualifiedNetworkTypes) {
             mHandler.obtainMessage(QNS_UPDATE_QUALIFIED_NETWORKS, mSlotIndex, apnTypes,
                     qualifiedNetworkTypes).sendToTarget();
         }
@@ -233,6 +235,7 @@
      * @param slotIndex SIM slot index the qualified networks service associated with.
      * @return Qualified networks service instance
      */
+    @NonNull
     public abstract NetworkAvailabilityUpdater createNetworkAvailabilityUpdater(int slotIndex);
 
     /** @hide */
diff --git a/telephony/java/android/telephony/emergency/EmergencyNumber.java b/telephony/java/android/telephony/emergency/EmergencyNumber.java
index e68256d..173f4ed 100644
--- a/telephony/java/android/telephony/emergency/EmergencyNumber.java
+++ b/telephony/java/android/telephony/emergency/EmergencyNumber.java
@@ -281,7 +281,7 @@
         dest.writeInt(mEmergencyCallRouting);
     }
 
-    public static final Parcelable.Creator<EmergencyNumber> CREATOR =
+    public static final @android.annotation.NonNull Parcelable.Creator<EmergencyNumber> CREATOR =
             new Parcelable.Creator<EmergencyNumber>() {
                 @Override
                 public EmergencyNumber createFromParcel(Parcel in) {
@@ -302,7 +302,7 @@
      *
      * @return the dialing number.
      */
-    public String getNumber() {
+    public @NonNull String getNumber() {
         return mNumber;
     }
 
@@ -311,7 +311,7 @@
      *
      * @return the country code string (lowercase character) in ISO 3166 format.
      */
-    public String getCountryIso() {
+    public @NonNull String getCountryIso() {
         return mCountryIso;
     }
 
@@ -320,7 +320,7 @@
      *
      * @return the Mobile Network Code of the emergency number.
      */
-    public String getMnc() {
+    public @NonNull String getMnc() {
         return mMnc;
     }
 
@@ -328,6 +328,8 @@
      * Returns the bitmask of emergency service categories of the emergency number.
      *
      * @return bitmask of the emergency service categories
+     *
+     * @hide
      */
     public @EmergencyServiceCategories int getEmergencyServiceCategoryBitmask() {
         return mEmergencyServiceCategoryBitmask;
@@ -357,7 +359,7 @@
      *
      * @return a list of the emergency service categories
      */
-    public List<Integer> getEmergencyServiceCategories() {
+    public @NonNull List<Integer> getEmergencyServiceCategories() {
         List<Integer> categories = new ArrayList<>();
         if (serviceUnspecified()) {
             categories.add(EMERGENCY_SERVICE_CATEGORY_UNSPECIFIED);
@@ -384,7 +386,7 @@
      *         number does not have a specified emergency Uniform Resource Name.
      */
     public @NonNull List<String> getEmergencyUrns() {
-        return mEmergencyUrns;
+        return Collections.unmodifiableList(mEmergencyUrns);
     }
 
     /**
@@ -421,6 +423,8 @@
      * Returns the bitmask of the sources of the emergency number.
      *
      * @return bitmask of the emergency number sources
+     *
+     * @hide
      */
     public @EmergencyNumberSources int getEmergencyNumberSourceBitmask() {
         return mEmergencyNumberSourceBitmask;
@@ -431,7 +435,7 @@
      *
      * @return a list of emergency number sources
      */
-    public List<Integer> getEmergencyNumberSources() {
+    public @NonNull List<Integer> getEmergencyNumberSources() {
         List<Integer> sources = new ArrayList<>();
         for (Integer source : EMERGENCY_NUMBER_SOURCE_SET) {
             if ((mEmergencyNumberSourceBitmask & source) == source) {
diff --git a/telephony/java/android/telephony/euicc/DownloadableSubscription.java b/telephony/java/android/telephony/euicc/DownloadableSubscription.java
index f1d5bdd..cb27f64 100644
--- a/telephony/java/android/telephony/euicc/DownloadableSubscription.java
+++ b/telephony/java/android/telephony/euicc/DownloadableSubscription.java
@@ -38,7 +38,7 @@
  */
 public final class DownloadableSubscription implements Parcelable {
 
-    public static final Creator<DownloadableSubscription> CREATOR =
+    public static final @android.annotation.NonNull Creator<DownloadableSubscription> CREATOR =
             new Creator<DownloadableSubscription>() {
                 @Override
                 public DownloadableSubscription createFromParcel(Parcel in) {
diff --git a/telephony/java/android/telephony/euicc/EuiccInfo.java b/telephony/java/android/telephony/euicc/EuiccInfo.java
index 28855b2..91ebb6c 100644
--- a/telephony/java/android/telephony/euicc/EuiccInfo.java
+++ b/telephony/java/android/telephony/euicc/EuiccInfo.java
@@ -30,7 +30,7 @@
 // own APIs guarded with appropriate permission checks.
 public final class EuiccInfo implements Parcelable {
 
-    public static final Creator<EuiccInfo> CREATOR =
+    public static final @android.annotation.NonNull Creator<EuiccInfo> CREATOR =
             new Creator<EuiccInfo>() {
                 @Override
                 public EuiccInfo createFromParcel(Parcel in) {
diff --git a/telephony/java/android/telephony/euicc/EuiccManager.java b/telephony/java/android/telephony/euicc/EuiccManager.java
index ad34349..afbf46d 100644
--- a/telephony/java/android/telephony/euicc/EuiccManager.java
+++ b/telephony/java/android/telephony/euicc/EuiccManager.java
@@ -17,6 +17,7 @@
 
 import android.Manifest;
 import android.annotation.IntDef;
+import android.annotation.NonNull;
 import android.annotation.Nullable;
 import android.annotation.RequiresPermission;
 import android.annotation.SdkConstant;
@@ -429,6 +430,7 @@
      *
      * @return an EuiccManager that uses the given card ID for all calls.
      */
+    @NonNull
     public EuiccManager createForCardId(int cardId) {
         return new EuiccManager(mContext, cardId);
     }
diff --git a/telephony/java/android/telephony/euicc/EuiccNotification.java b/telephony/java/android/telephony/euicc/EuiccNotification.java
index 43a7707..b27f775 100644
--- a/telephony/java/android/telephony/euicc/EuiccNotification.java
+++ b/telephony/java/android/telephony/euicc/EuiccNotification.java
@@ -165,7 +165,7 @@
         mData = source.createByteArray();
     }
 
-    public static final Creator<EuiccNotification> CREATOR =
+    public static final @android.annotation.NonNull Creator<EuiccNotification> CREATOR =
             new Creator<EuiccNotification>() {
                 @Override
                 public EuiccNotification createFromParcel(Parcel source) {
diff --git a/telephony/java/android/telephony/euicc/EuiccRulesAuthTable.java b/telephony/java/android/telephony/euicc/EuiccRulesAuthTable.java
index 67ae983..89842ae 100644
--- a/telephony/java/android/telephony/euicc/EuiccRulesAuthTable.java
+++ b/telephony/java/android/telephony/euicc/EuiccRulesAuthTable.java
@@ -249,7 +249,7 @@
         mPolicyRuleFlags = source.createIntArray();
     }
 
-    public static final Creator<EuiccRulesAuthTable> CREATOR =
+    public static final @android.annotation.NonNull Creator<EuiccRulesAuthTable> CREATOR =
             new Creator<EuiccRulesAuthTable>() {
                 @Override
                 public EuiccRulesAuthTable createFromParcel(Parcel source) {
diff --git a/telephony/java/android/telephony/ims/ImsCallForwardInfo.java b/telephony/java/android/telephony/ims/ImsCallForwardInfo.java
index 70daa8b..9b72d58 100644
--- a/telephony/java/android/telephony/ims/ImsCallForwardInfo.java
+++ b/telephony/java/android/telephony/ims/ImsCallForwardInfo.java
@@ -204,7 +204,7 @@
         mServiceClass = in.readInt();
     }
 
-    public static final Creator<ImsCallForwardInfo> CREATOR =
+    public static final @android.annotation.NonNull Creator<ImsCallForwardInfo> CREATOR =
             new Creator<ImsCallForwardInfo>() {
         @Override
         public ImsCallForwardInfo createFromParcel(Parcel in) {
diff --git a/telephony/java/android/telephony/ims/ImsCallProfile.java b/telephony/java/android/telephony/ims/ImsCallProfile.java
index 47c8de5..751ce9d 100644
--- a/telephony/java/android/telephony/ims/ImsCallProfile.java
+++ b/telephony/java/android/telephony/ims/ImsCallProfile.java
@@ -17,6 +17,7 @@
 package android.telephony.ims;
 
 import android.annotation.IntDef;
+import android.annotation.NonNull;
 import android.annotation.SystemApi;
 import android.annotation.UnsupportedAppUsage;
 import android.os.Bundle;
@@ -583,7 +584,7 @@
         mHasKnownUserIntentEmergency = in.readBoolean();
     }
 
-    public static final Creator<ImsCallProfile> CREATOR = new Creator<ImsCallProfile>() {
+    public static final @android.annotation.NonNull Creator<ImsCallProfile> CREATOR = new Creator<ImsCallProfile>() {
         @Override
         public ImsCallProfile createFromParcel(Parcel in) {
             return new ImsCallProfile(in);
@@ -842,7 +843,7 @@
      *            3gpp 22.101, Section 10 - Emergency Calls.
      */
     @VisibleForTesting
-    public void setEmergencyUrns(List<String> emergencyUrns) {
+    public void setEmergencyUrns(@NonNull List<String> emergencyUrns) {
         mEmergencyUrns = emergencyUrns;
     }
 
@@ -916,7 +917,7 @@
      * Reference: 3gpp 24.503, Section 5.1.6.8.1 - General;
      *            3gpp 22.101, Section 10 - Emergency Calls.
      */
-    public List<String> getEmergencyUrns() {
+    public @NonNull List<String> getEmergencyUrns() {
         return mEmergencyUrns;
     }
 
diff --git a/telephony/java/android/telephony/ims/ImsCallSessionListener.java b/telephony/java/android/telephony/ims/ImsCallSessionListener.java
index 337375a..a09844d 100644
--- a/telephony/java/android/telephony/ims/ImsCallSessionListener.java
+++ b/telephony/java/android/telephony/ims/ImsCallSessionListener.java
@@ -16,6 +16,7 @@
 
 package android.telephony.ims;
 
+import android.annotation.NonNull;
 import android.annotation.SystemApi;
 import android.os.RemoteException;
 import android.telephony.CallQuality;
@@ -606,7 +607,7 @@
      *
      * @param profile updated ImsStreamMediaProfile
      */
-    public void callSessionRttAudioIndicatorChanged(ImsStreamMediaProfile profile) {
+    public void callSessionRttAudioIndicatorChanged(@NonNull ImsStreamMediaProfile profile) {
         try {
             mListener.callSessionRttAudioIndicatorChanged(profile);
         } catch (RemoteException e) {
@@ -619,7 +620,7 @@
      *
      * @param callQuality The new call quality
      */
-    public void callQualityChanged(CallQuality callQuality) {
+    public void callQualityChanged(@NonNull CallQuality callQuality) {
         try {
             mListener.callQualityChanged(callQuality);
         } catch (RemoteException e) {
diff --git a/telephony/java/android/telephony/ims/ImsConferenceState.java b/telephony/java/android/telephony/ims/ImsConferenceState.java
index 66d2f8d..44595b5 100644
--- a/telephony/java/android/telephony/ims/ImsConferenceState.java
+++ b/telephony/java/android/telephony/ims/ImsConferenceState.java
@@ -16,17 +16,18 @@
 
 package android.telephony.ims;
 
-import java.util.HashMap;
-import java.util.Iterator;
-import java.util.Map.Entry;
-import java.util.Set;
-
 import android.annotation.SystemApi;
 import android.os.Bundle;
 import android.os.Parcel;
 import android.os.Parcelable;
 import android.telecom.Call;
 import android.telecom.Connection;
+import android.telecom.Log;
+
+import java.util.HashMap;
+import java.util.Iterator;
+import java.util.Map.Entry;
+import java.util.Set;
 
 /**
  * Provides the conference information (defined in RFC 4575) for IMS conference call.
@@ -134,7 +135,7 @@
         }
     }
 
-    public static final Creator<ImsConferenceState> CREATOR =
+    public static final @android.annotation.NonNull Creator<ImsConferenceState> CREATOR =
             new Creator<ImsConferenceState>() {
         @Override
         public ImsConferenceState createFromParcel(Parcel in) {
@@ -189,7 +190,7 @@
                 sb.append("<");
                 while (iterator.hasNext()) {
                     Entry<String, Bundle> entry = iterator.next();
-                    sb.append(entry.getKey());
+                    sb.append(Log.pii(entry.getKey()));
                     sb.append(": ");
                     Bundle participantData = entry.getValue();
 
@@ -197,7 +198,7 @@
                         sb.append(key);
                         sb.append("=");
                         if (ENDPOINT.equals(key) || USER.equals(key)) {
-                            sb.append(android.telecom.Log.pii(participantData.get(key)));
+                            sb.append(Log.pii(participantData.get(key)));
                         } else {
                             sb.append(participantData.get(key));
                         }
diff --git a/telephony/java/android/telephony/ims/ImsException.java b/telephony/java/android/telephony/ims/ImsException.java
index ac4d17a..bdaad5b 100644
--- a/telephony/java/android/telephony/ims/ImsException.java
+++ b/telephony/java/android/telephony/ims/ImsException.java
@@ -86,7 +86,8 @@
      * @param message an optional message to detail the error condition more specifically.
      * @param cause the {@link Throwable} that caused this {@link ImsException} to be created.
      */
-    public ImsException(@Nullable String message, @ImsErrorCode  int code, Throwable cause) {
+    public ImsException(@Nullable String message, @ImsErrorCode  int code,
+            @Nullable Throwable cause) {
         super(getMessage(message, code), cause);
         mCode = code;
     }
diff --git a/telephony/java/android/telephony/ims/ImsExternalCallState.java b/telephony/java/android/telephony/ims/ImsExternalCallState.java
index f2d0cbf..37b11ed 100644
--- a/telephony/java/android/telephony/ims/ImsExternalCallState.java
+++ b/telephony/java/android/telephony/ims/ImsExternalCallState.java
@@ -17,6 +17,8 @@
 package android.telephony.ims;
 
 import android.annotation.IntDef;
+import android.annotation.NonNull;
+import android.annotation.Nullable;
 import android.annotation.SystemApi;
 import android.net.Uri;
 import android.os.Parcel;
@@ -124,9 +126,9 @@
      * @param callType The type of external call.
      * @param isCallheld A flag determining if the external connection is currently held.
      */
-    public ImsExternalCallState(String callId, Uri address, Uri localAddress,
-            boolean isPullable, @ExternalCallState int callState, @ExternalCallType int callType,
-            boolean isCallheld) {
+    public ImsExternalCallState(@NonNull String callId, @NonNull Uri address,
+            @Nullable Uri localAddress, boolean isPullable, @ExternalCallState int callState,
+            @ExternalCallType int callType, boolean isCallheld) {
         mCallId = getIdForString(callId);
         mAddress = address;
         mLocalAddress = localAddress;
@@ -167,7 +169,7 @@
         Rlog.d(TAG, "ImsExternalCallState writeToParcel = " + out.toString());
     }
 
-    public static final Parcelable.Creator<ImsExternalCallState> CREATOR =
+    public static final @android.annotation.NonNull Parcelable.Creator<ImsExternalCallState> CREATOR =
             new Parcelable.Creator<ImsExternalCallState>() {
         @Override
         public ImsExternalCallState createFromParcel(Parcel in) {
@@ -184,14 +186,14 @@
         return mCallId;
     }
 
-    public Uri getAddress() {
+    public @NonNull Uri getAddress() {
         return mAddress;
     }
 
     /**
      * @return A {@link Uri} containing the local address from the Multiendpoint Dialog Information.
      */
-    public Uri getLocalAddress() {
+    public @Nullable Uri getLocalAddress() {
         return mLocalAddress;
     }
 
diff --git a/telephony/java/android/telephony/ims/ImsMmTelManager.java b/telephony/java/android/telephony/ims/ImsMmTelManager.java
index eb99d5d..58ddf21 100644
--- a/telephony/java/android/telephony/ims/ImsMmTelManager.java
+++ b/telephony/java/android/telephony/ims/ImsMmTelManager.java
@@ -21,6 +21,7 @@
 import android.annotation.CallbackExecutor;
 import android.annotation.IntDef;
 import android.annotation.NonNull;
+import android.annotation.Nullable;
 import android.annotation.RequiresPermission;
 import android.annotation.SystemApi;
 import android.content.Context;
@@ -139,7 +140,7 @@
                 if (mLocalCallback == null) return;
 
                 Binder.withCleanCallingIdentity(() ->
-                        mExecutor.execute(() -> mLocalCallback.onDeregistered(info)));
+                        mExecutor.execute(() -> mLocalCallback.onUnregistered(info)));
             }
 
             @Override
@@ -199,7 +200,7 @@
          *
          * @param info the {@link ImsReasonInfo} associated with why registration was disconnected.
          */
-        public void onDeregistered(ImsReasonInfo info) {
+        public void onUnregistered(@Nullable ImsReasonInfo info) {
         }
 
         /**
@@ -211,7 +212,7 @@
          *         transport type that has failed to handover registration to.
          * @param info A {@link ImsReasonInfo} that identifies the reason for failure.
          */
-        public void onTechnologyChangeFailed(int imsTransportType, ImsReasonInfo info) {
+        public void onTechnologyChangeFailed(int imsTransportType, @Nullable ImsReasonInfo info) {
         }
 
         /**
@@ -223,7 +224,7 @@
          *         subscription.
          * @hide
          */
-        public void onSubscriberAssociatedUriChanged(Uri[] uris) {
+        public void onSubscriberAssociatedUriChanged(@Nullable Uri[] uris) {
         }
 
         /**@hide*/
@@ -294,7 +295,7 @@
          * @param capabilities The new availability of the capabilities.
          */
         public void onCapabilitiesStatusChanged(
-                MmTelFeature.MmTelCapabilities capabilities) {
+                @NonNull MmTelFeature.MmTelCapabilities capabilities) {
         }
 
         /**@hide*/
@@ -319,7 +320,7 @@
      * @see android.telephony.SubscriptionManager#getActiveSubscriptionInfoList()
      * @throws IllegalArgumentException if the subscription is invalid.
      */
-    public static ImsMmTelManager createForSubscriptionId(int subId) {
+    public static @NonNull ImsMmTelManager createForSubscriptionId(int subId) {
         if (!SubscriptionManager.isValidSubscriptionId(subId)) {
             throw new IllegalArgumentException("Invalid subscription ID");
         }
@@ -357,7 +358,7 @@
      * reason.
      */
     @RequiresPermission(Manifest.permission.READ_PRIVILEGED_PHONE_STATE)
-    public void registerImsRegistrationCallback(@CallbackExecutor Executor executor,
+    public void registerImsRegistrationCallback(@NonNull @CallbackExecutor Executor executor,
             @NonNull RegistrationCallback c) throws ImsException {
         if (c == null) {
             throw new IllegalArgumentException("Must include a non-null RegistrationCallback.");
@@ -485,7 +486,7 @@
      * @see android.telephony.CarrierConfigManager#KEY_HIDE_ENHANCED_4G_LTE_BOOL
      * @see android.telephony.CarrierConfigManager#KEY_ENHANCED_4G_LTE_ON_BY_DEFAULT_BOOL
      * @see android.telephony.CarrierConfigManager#KEY_CARRIER_VOLTE_AVAILABLE_BOOL
-     * @see #setAdvancedCallingSetting(boolean)
+     * @see #setAdvancedCallingSettingEnabled(boolean)
      * @return true if the user's setting for advanced calling is enabled, false otherwise.
      */
     @RequiresPermission(Manifest.permission.READ_PRIVILEGED_PHONE_STATE)
@@ -519,9 +520,9 @@
      * @see #isAdvancedCallingSettingEnabled()
      */
     @RequiresPermission(Manifest.permission.MODIFY_PHONE_STATE)
-    public void setAdvancedCallingSetting(boolean isEnabled) {
+    public void setAdvancedCallingSettingEnabled(boolean isEnabled) {
         try {
-            getITelephony().setAdvancedCallingSetting(mSubId, isEnabled);
+            getITelephony().setAdvancedCallingSettingEnabled(mSubId, isEnabled);
             return;
         } catch (RemoteException e) {
             throw e.rethrowAsRuntimeException();
@@ -589,7 +590,7 @@
     /**
      * The user's setting for whether or not they have enabled the "Video Calling" setting.
      * @return true if the user’s “Video Calling” setting is currently enabled.
-     * @see #setVtSetting(boolean)
+     * @see #setVtSettingEnabled(boolean)
      */
     @RequiresPermission(Manifest.permission.READ_PRIVILEGED_PHONE_STATE)
     public boolean isVtSettingEnabled() {
@@ -605,9 +606,9 @@
      * @see #isVtSettingEnabled()
      */
     @RequiresPermission(Manifest.permission.MODIFY_PHONE_STATE)
-    public void setVtSetting(boolean isEnabled) {
+    public void setVtSettingEnabled(boolean isEnabled) {
         try {
-            getITelephony().setVtSetting(mSubId, isEnabled);
+            getITelephony().setVtSettingEnabled(mSubId, isEnabled);
             return;
         } catch (RemoteException e) {
             throw e.rethrowAsRuntimeException();
@@ -616,7 +617,7 @@
 
     /**
      * @return true if the user's setting for Voice over WiFi is enabled and false if it is not.
-     * @see #setVoWiFiSetting(boolean)
+     * @see #setVoWiFiSettingEnabled(boolean)
      */
     @RequiresPermission(Manifest.permission.READ_PRIVILEGED_PHONE_STATE)
     public boolean isVoWiFiSettingEnabled() {
@@ -633,9 +634,9 @@
      * @see #isVoWiFiSettingEnabled()
      */
     @RequiresPermission(Manifest.permission.MODIFY_PHONE_STATE)
-    public void setVoWiFiSetting(boolean isEnabled) {
+    public void setVoWiFiSettingEnabled(boolean isEnabled) {
         try {
-            getITelephony().setVoWiFiSetting(mSubId, isEnabled);
+            getITelephony().setVoWiFiSettingEnabled(mSubId, isEnabled);
             return;
         } catch (RemoteException e) {
             throw e.rethrowAsRuntimeException();
@@ -645,7 +646,7 @@
     /**
      * @return true if the user's setting for Voice over WiFi while roaming is enabled, false
      * if disabled.
-     * @see #setVoWiFiRoamingSetting(boolean)
+     * @see #setVoWiFiRoamingSettingEnabled(boolean)
      */
     @RequiresPermission(Manifest.permission.READ_PRIVILEGED_PHONE_STATE)
     public boolean isVoWiFiRoamingSettingEnabled() {
@@ -663,9 +664,9 @@
      * @see #isVoWiFiRoamingSettingEnabled()
      */
     @RequiresPermission(Manifest.permission.MODIFY_PHONE_STATE)
-    public void setVoWiFiRoamingSetting(boolean isEnabled) {
+    public void setVoWiFiRoamingSettingEnabled(boolean isEnabled) {
         try {
-            getITelephony().setVoWiFiRoamingSetting(mSubId, isEnabled);
+            getITelephony().setVoWiFiRoamingSettingEnabled(mSubId, isEnabled);
             return;
         } catch (RemoteException e) {
             throw e.rethrowAsRuntimeException();
@@ -682,7 +683,7 @@
      * - {@link #WIFI_MODE_WIFI_ONLY}
      * - {@link #WIFI_MODE_CELLULAR_PREFERRED}
      * - {@link #WIFI_MODE_WIFI_PREFERRED}
-     * @see #setVoWiFiSetting(boolean)
+     * @see #setVoWiFiSettingEnabled(boolean)
      */
     @RequiresPermission(Manifest.permission.MODIFY_PHONE_STATE)
     public void setVoWiFiNonPersistent(boolean isCapable, int mode) {
@@ -700,7 +701,7 @@
      * - {@link #WIFI_MODE_WIFI_ONLY}
      * - {@link #WIFI_MODE_CELLULAR_PREFERRED}
      * - {@link #WIFI_MODE_WIFI_PREFERRED}
-     * @see #setVoWiFiSetting(boolean)
+     * @see #setVoWiFiSettingEnabled(boolean)
      */
     @RequiresPermission(Manifest.permission.READ_PRIVILEGED_PHONE_STATE)
     public @WiFiCallingMode int getVoWiFiModeSetting() {
@@ -739,7 +740,7 @@
      *     - {@link #WIFI_MODE_WIFI_ONLY}
      *     - {@link #WIFI_MODE_CELLULAR_PREFERRED}
      *     - {@link #WIFI_MODE_WIFI_PREFERRED}
-     * @see #setVoWiFiRoamingSetting(boolean)
+     * @see #setVoWiFiRoamingSettingEnabled(boolean)
      */
     @RequiresPermission(Manifest.permission.READ_PRIVILEGED_PHONE_STATE)
     public @WiFiCallingMode int getVoWiFiRoamingModeSetting() {
diff --git a/telephony/java/android/telephony/ims/ImsReasonInfo.java b/telephony/java/android/telephony/ims/ImsReasonInfo.java
index d8d2d9e..b018491 100644
--- a/telephony/java/android/telephony/ims/ImsReasonInfo.java
+++ b/telephony/java/android/telephony/ims/ImsReasonInfo.java
@@ -1181,7 +1181,7 @@
         out.writeString(mExtraMessage);
     }
 
-    public static final Creator<ImsReasonInfo> CREATOR = new Creator<ImsReasonInfo>() {
+    public static final @android.annotation.NonNull Creator<ImsReasonInfo> CREATOR = new Creator<ImsReasonInfo>() {
         @Override
         public ImsReasonInfo createFromParcel(Parcel in) {
             return new ImsReasonInfo(in);
diff --git a/telephony/java/android/telephony/ims/ImsSsData.java b/telephony/java/android/telephony/ims/ImsSsData.java
index 3a82517..464db34 100644
--- a/telephony/java/android/telephony/ims/ImsSsData.java
+++ b/telephony/java/android/telephony/ims/ImsSsData.java
@@ -17,6 +17,7 @@
 
 import android.annotation.IntDef;
 import android.annotation.NonNull;
+import android.annotation.Nullable;
 import android.annotation.SystemApi;
 import android.os.Parcel;
 import android.os.Parcelable;
@@ -24,6 +25,9 @@
 
 import java.lang.annotation.Retention;
 import java.lang.annotation.RetentionPolicy;
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.List;
 
 /**
  * Provides STK Call Control Supplementary Service information.
@@ -260,13 +264,13 @@
     public final int result;
 
     private int[] mSsInfo;
-    private ImsCallForwardInfo[] mCfInfo;
-    private ImsSsInfo[] mImsSsInfo;
+    private List<ImsCallForwardInfo> mCfInfo;
+    private List<ImsSsInfo> mImsSsInfo;
 
     /**
      * Builder for optional ImsSsData parameters.
      */
-    public static class Builder {
+    public static final class Builder {
         private ImsSsData mImsSsData;
 
         /**
@@ -301,7 +305,7 @@
          * Set the array of {@link ImsSsInfo}s that are associated with this supplementary service
          * data.
          */
-        public @NonNull Builder setSuppServiceInfo(@NonNull ImsSsInfo[] imsSsInfos) {
+        public @NonNull Builder setSuppServiceInfo(@NonNull List<ImsSsInfo> imsSsInfos) {
             mImsSsData.mImsSsInfo = imsSsInfos;
             return this;
         }
@@ -311,7 +315,7 @@
          * service data.
          */
         public @NonNull Builder setCallForwardingInfo(
-                @NonNull ImsCallForwardInfo[] imsCallForwardInfos) {
+                @NonNull List<ImsCallForwardInfo> imsCallForwardInfos) {
             mImsSsData.mCfInfo = imsCallForwardInfos;
             return this;
         }
@@ -360,11 +364,11 @@
         serviceClass = in.readInt();
         result = in.readInt();
         mSsInfo = in.createIntArray();
-        mCfInfo = (ImsCallForwardInfo[])in.readParcelableArray(this.getClass().getClassLoader());
-        mImsSsInfo = (ImsSsInfo[])in.readParcelableArray(this.getClass().getClassLoader());
+        mCfInfo = in.readParcelableList(new ArrayList<>(), this.getClass().getClassLoader());
+        mImsSsInfo = in.readParcelableList(new ArrayList<>(), this.getClass().getClassLoader());
     }
 
-    public static final Creator<ImsSsData> CREATOR = new Creator<ImsSsData>() {
+    public static final @android.annotation.NonNull Creator<ImsSsData> CREATOR = new Creator<ImsSsData>() {
         @Override
         public ImsSsData createFromParcel(Parcel in) {
             return new ImsSsData(in);
@@ -384,8 +388,8 @@
         out.writeInt(getServiceClass());
         out.writeInt(getResult());
         out.writeIntArray(mSsInfo);
-        out.writeParcelableArray(mCfInfo, 0);
-        out.writeParcelableArray(mImsSsInfo, 0);
+        out.writeParcelableList(mCfInfo, 0);
+        out.writeParcelableList(mImsSsInfo, 0);
     }
 
     @Override
@@ -500,12 +504,12 @@
 
     /** @hide */
     public void setImsSpecificSuppServiceInfo(ImsSsInfo[] imsSsInfo) {
-        mImsSsInfo = imsSsInfo;
+        mImsSsInfo = Arrays.asList(imsSsInfo);
     }
 
     /** @hide */
     public void setCallForwardingInfo(ImsCallForwardInfo[] cfInfo) {
-        mCfInfo = cfInfo;
+        mCfInfo = Arrays.asList(cfInfo);
     }
 
     /**
@@ -524,7 +528,7 @@
 
 
         int[] result = new int[2];
-        if (mImsSsInfo == null || mImsSsInfo.length == 0) {
+        if (mImsSsInfo == null || mImsSsInfo.size() == 0) {
             Rlog.e(TAG, "getSuppServiceInfoCompat: Could not parse mImsSsInfo, returning empty "
                     + "int[]");
             return result;
@@ -535,26 +539,26 @@
         if (isTypeClir()) {
             // Assume there will only be one ImsSsInfo.
             // contains {"n","m"} parameters
-            result[0] = mImsSsInfo[0].getClirOutgoingState();
-            result[1] = mImsSsInfo[0].getClirInterrogationStatus();
+            result[0] = mImsSsInfo.get(0).getClirOutgoingState();
+            result[1] = mImsSsInfo.get(0).getClirInterrogationStatus();
             return result;
         }
         // COLR 7.31
         if (isTypeColr()) {
-            result[0] = mImsSsInfo[0].getProvisionStatus();
+            result[0] = mImsSsInfo.get(0).getProvisionStatus();
         }
         // Facility Lock CLCK 7.4 (for call barring), CLIP 7.6, COLP 7.8, as well as any
         // other result, just return the status for the "n" parameter and provisioning status for
         // "m" as the default.
-        result[0] = mImsSsInfo[0].getStatus();
-        result[1] = mImsSsInfo[0].getProvisionStatus();
+        result[0] = mImsSsInfo.get(0).getStatus();
+        result[1] = mImsSsInfo.get(0).getProvisionStatus();
         return result;
     }
 
     /**
      * @return an array of {@link ImsSsInfo}s associated with this supplementary service data.
      */
-    public @NonNull ImsSsInfo[] getSuppServiceInfo() {
+    public @NonNull List<ImsSsInfo> getSuppServiceInfo() {
         return mImsSsInfo;
     }
 
@@ -562,7 +566,7 @@
      * @return an array of {@link ImsCallForwardInfo}s associated with this supplementary service
      * data.
      **/
-    public ImsCallForwardInfo[] getCallForwardInfo() {
+    public @Nullable List<ImsCallForwardInfo> getCallForwardInfo() {
         return mCfInfo;
     }
 
diff --git a/telephony/java/android/telephony/ims/ImsSsInfo.java b/telephony/java/android/telephony/ims/ImsSsInfo.java
index 031f9e1..18e7530 100644
--- a/telephony/java/android/telephony/ims/ImsSsInfo.java
+++ b/telephony/java/android/telephony/ims/ImsSsInfo.java
@@ -173,7 +173,7 @@
     /**
      * Builds {@link ImsSsInfo} instances, which may include optional parameters.
      */
-    public static class Builder {
+    public static final class Builder {
 
         private final ImsSsInfo mImsSsInfo;
 
@@ -275,7 +275,7 @@
         mProvisionStatus = in.readInt();
     }
 
-    public static final Creator<ImsSsInfo> CREATOR =
+    public static final @android.annotation.NonNull Creator<ImsSsInfo> CREATOR =
             new Creator<ImsSsInfo>() {
         @Override
         public ImsSsInfo createFromParcel(Parcel in) {
@@ -304,7 +304,7 @@
     /**
      * @return The Incoming Communication Barring (ICB) number.
      */
-    public String getIncomingCommunicationBarringNumber() {
+    public @Nullable String getIncomingCommunicationBarringNumber() {
         return mIcbNum;
     }
 
diff --git a/telephony/java/android/telephony/ims/ImsStreamMediaProfile.java b/telephony/java/android/telephony/ims/ImsStreamMediaProfile.java
index d11a0de..fd75a6b 100644
--- a/telephony/java/android/telephony/ims/ImsStreamMediaProfile.java
+++ b/telephony/java/android/telephony/ims/ImsStreamMediaProfile.java
@@ -228,7 +228,7 @@
         mIsReceivingRttAudio = in.readBoolean();
     }
 
-    public static final Creator<ImsStreamMediaProfile> CREATOR =
+    public static final @android.annotation.NonNull Creator<ImsStreamMediaProfile> CREATOR =
             new Creator<ImsStreamMediaProfile>() {
         @Override
         public ImsStreamMediaProfile createFromParcel(Parcel in) {
diff --git a/telephony/java/android/telephony/ims/ImsSuppServiceNotification.java b/telephony/java/android/telephony/ims/ImsSuppServiceNotification.java
index efaade8..2e4288d 100644
--- a/telephony/java/android/telephony/ims/ImsSuppServiceNotification.java
+++ b/telephony/java/android/telephony/ims/ImsSuppServiceNotification.java
@@ -93,7 +93,7 @@
         out.writeStringArray(history);
     }
 
-    public static final Creator<ImsSuppServiceNotification> CREATOR =
+    public static final @android.annotation.NonNull Creator<ImsSuppServiceNotification> CREATOR =
             new Creator<ImsSuppServiceNotification>() {
         @Override
         public ImsSuppServiceNotification createFromParcel(Parcel in) {
diff --git a/telephony/java/android/telephony/ims/ProvisioningManager.java b/telephony/java/android/telephony/ims/ProvisioningManager.java
index 6e98a0a..d12cda8 100644
--- a/telephony/java/android/telephony/ims/ProvisioningManager.java
+++ b/telephony/java/android/telephony/ims/ProvisioningManager.java
@@ -19,6 +19,7 @@
 import android.Manifest;
 import android.annotation.CallbackExecutor;
 import android.annotation.NonNull;
+import android.annotation.Nullable;
 import android.annotation.RequiresPermission;
 import android.annotation.SystemApi;
 import android.annotation.WorkerThread;
@@ -153,7 +154,7 @@
          * @param item the IMS provisioning key constant, as defined by the OEM.
          * @param value the new String value of the IMS configuration constant.
          */
-        public void onProvisioningStringChanged(int item, String value) {
+        public void onProvisioningStringChanged(int item, @NonNull String value) {
             // Base Implementation
         }
 
@@ -177,7 +178,7 @@
      * @see android.telephony.SubscriptionManager#getActiveSubscriptionInfoList()
      * @throws IllegalArgumentException if the subscription is invalid.
      */
-    public static ProvisioningManager createForSubscriptionId(int subId) {
+    public static @NonNull ProvisioningManager createForSubscriptionId(int subId) {
         if (!SubscriptionManager.isValidSubscriptionId(subId)) {
             throw new IllegalArgumentException("Invalid subscription ID");
         }
@@ -206,7 +207,7 @@
      * reason.
      */
     @RequiresPermission(Manifest.permission.READ_PRIVILEGED_PHONE_STATE)
-    public void registerProvisioningChangedCallback(@CallbackExecutor Executor executor,
+    public void registerProvisioningChangedCallback(@NonNull @CallbackExecutor Executor executor,
             @NonNull Callback callback) throws ImsException {
         callback.setExecutor(executor);
         try {
@@ -271,7 +272,7 @@
      */
     @WorkerThread
     @RequiresPermission(Manifest.permission.READ_PRIVILEGED_PHONE_STATE)
-    public String getProvisioningStringValue(int key) {
+    public @Nullable String getProvisioningStringValue(int key) {
         try {
             return getITelephony().getImsProvisioningString(mSubId, key);
         } catch (RemoteException e) {
@@ -313,7 +314,7 @@
     @WorkerThread
     @RequiresPermission(Manifest.permission.MODIFY_PHONE_STATE)
     public @ImsConfigImplBase.SetConfigResult int setProvisioningStringValue(int key,
-            String value) {
+            @NonNull String value) {
         try {
             return getITelephony().setImsProvisioningString(mSubId, key, value);
         } catch (RemoteException e) {
diff --git a/telephony/java/android/telephony/ims/RcsEventQueryParams.java b/telephony/java/android/telephony/ims/RcsEventQueryParams.java
index 5f8fa80..0024cf7 100644
--- a/telephony/java/android/telephony/ims/RcsEventQueryParams.java
+++ b/telephony/java/android/telephony/ims/RcsEventQueryParams.java
@@ -292,7 +292,7 @@
         mLimit = in.readInt();
     }
 
-    public static final Creator<RcsEventQueryParams> CREATOR =
+    public static final @android.annotation.NonNull Creator<RcsEventQueryParams> CREATOR =
             new Creator<RcsEventQueryParams>() {
                 @Override
                 public RcsEventQueryParams createFromParcel(Parcel in) {
diff --git a/telephony/java/android/telephony/ims/RcsEventQueryResultDescriptor.java b/telephony/java/android/telephony/ims/RcsEventQueryResultDescriptor.java
index bba56d3..e30745b7 100644
--- a/telephony/java/android/telephony/ims/RcsEventQueryResultDescriptor.java
+++ b/telephony/java/android/telephony/ims/RcsEventQueryResultDescriptor.java
@@ -53,7 +53,7 @@
         in.readList(mEvents, null);
     }
 
-    public static final Creator<RcsEventQueryResultDescriptor> CREATOR =
+    public static final @android.annotation.NonNull Creator<RcsEventQueryResultDescriptor> CREATOR =
             new Creator<RcsEventQueryResultDescriptor>() {
         @Override
         public RcsEventQueryResultDescriptor createFromParcel(Parcel in) {
diff --git a/telephony/java/android/telephony/ims/RcsFileTransferCreationParams.java b/telephony/java/android/telephony/ims/RcsFileTransferCreationParams.java
index 4742ba2..e43552d 100644
--- a/telephony/java/android/telephony/ims/RcsFileTransferCreationParams.java
+++ b/telephony/java/android/telephony/ims/RcsFileTransferCreationParams.java
@@ -325,7 +325,7 @@
         mFileTransferStatus = in.readInt();
     }
 
-    public static final Creator<RcsFileTransferCreationParams> CREATOR =
+    public static final @android.annotation.NonNull Creator<RcsFileTransferCreationParams> CREATOR =
             new Creator<RcsFileTransferCreationParams>() {
                 @Override
                 public RcsFileTransferCreationParams createFromParcel(Parcel in) {
diff --git a/telephony/java/android/telephony/ims/RcsGroupThreadIconChangedEventDescriptor.java b/telephony/java/android/telephony/ims/RcsGroupThreadIconChangedEventDescriptor.java
index b7fe4b2..1fb8798 100644
--- a/telephony/java/android/telephony/ims/RcsGroupThreadIconChangedEventDescriptor.java
+++ b/telephony/java/android/telephony/ims/RcsGroupThreadIconChangedEventDescriptor.java
@@ -42,7 +42,7 @@
                 new RcsParticipant(mOriginatingParticipantId), mNewIcon);
     }
 
-    public static final Creator<RcsGroupThreadIconChangedEventDescriptor> CREATOR =
+    public static final @android.annotation.NonNull Creator<RcsGroupThreadIconChangedEventDescriptor> CREATOR =
             new Creator<RcsGroupThreadIconChangedEventDescriptor>() {
                 @Override
                 public RcsGroupThreadIconChangedEventDescriptor createFromParcel(Parcel in) {
diff --git a/telephony/java/android/telephony/ims/RcsGroupThreadNameChangedEventDescriptor.java b/telephony/java/android/telephony/ims/RcsGroupThreadNameChangedEventDescriptor.java
index 4ec641f..980aba2 100644
--- a/telephony/java/android/telephony/ims/RcsGroupThreadNameChangedEventDescriptor.java
+++ b/telephony/java/android/telephony/ims/RcsGroupThreadNameChangedEventDescriptor.java
@@ -44,7 +44,7 @@
                 mNewName);
     }
 
-    public static final Creator<RcsGroupThreadNameChangedEventDescriptor> CREATOR =
+    public static final @android.annotation.NonNull Creator<RcsGroupThreadNameChangedEventDescriptor> CREATOR =
             new Creator<RcsGroupThreadNameChangedEventDescriptor>() {
                 @Override
                 public RcsGroupThreadNameChangedEventDescriptor createFromParcel(Parcel in) {
diff --git a/telephony/java/android/telephony/ims/RcsGroupThreadParticipantJoinedEventDescriptor.java b/telephony/java/android/telephony/ims/RcsGroupThreadParticipantJoinedEventDescriptor.java
index a4218c2..e899e1c 100644
--- a/telephony/java/android/telephony/ims/RcsGroupThreadParticipantJoinedEventDescriptor.java
+++ b/telephony/java/android/telephony/ims/RcsGroupThreadParticipantJoinedEventDescriptor.java
@@ -43,7 +43,7 @@
                 new RcsParticipant(mJoinedParticipantId));
     }
 
-    public static final Creator<RcsGroupThreadParticipantJoinedEventDescriptor> CREATOR =
+    public static final @android.annotation.NonNull Creator<RcsGroupThreadParticipantJoinedEventDescriptor> CREATOR =
             new Creator<RcsGroupThreadParticipantJoinedEventDescriptor>() {
                 @Override
                 public RcsGroupThreadParticipantJoinedEventDescriptor createFromParcel(Parcel in) {
diff --git a/telephony/java/android/telephony/ims/RcsGroupThreadParticipantLeftEventDescriptor.java b/telephony/java/android/telephony/ims/RcsGroupThreadParticipantLeftEventDescriptor.java
index 8e91dda..8eefb4b 100644
--- a/telephony/java/android/telephony/ims/RcsGroupThreadParticipantLeftEventDescriptor.java
+++ b/telephony/java/android/telephony/ims/RcsGroupThreadParticipantLeftEventDescriptor.java
@@ -44,7 +44,7 @@
                 new RcsParticipant(mLeavingParticipantId));
     }
 
-    public static final Parcelable.Creator<RcsGroupThreadParticipantLeftEventDescriptor> CREATOR =
+    public static final @android.annotation.NonNull Parcelable.Creator<RcsGroupThreadParticipantLeftEventDescriptor> CREATOR =
             new Creator<RcsGroupThreadParticipantLeftEventDescriptor>() {
                 @Override
                 public RcsGroupThreadParticipantLeftEventDescriptor createFromParcel(Parcel in) {
diff --git a/telephony/java/android/telephony/ims/RcsIncomingMessageCreationParams.java b/telephony/java/android/telephony/ims/RcsIncomingMessageCreationParams.java
index 58dc1bc..955f263 100644
--- a/telephony/java/android/telephony/ims/RcsIncomingMessageCreationParams.java
+++ b/telephony/java/android/telephony/ims/RcsIncomingMessageCreationParams.java
@@ -152,7 +152,7 @@
         return mSenderParticipantId;
     }
 
-    public static final Creator<RcsIncomingMessageCreationParams> CREATOR =
+    public static final @android.annotation.NonNull Creator<RcsIncomingMessageCreationParams> CREATOR =
             new Creator<RcsIncomingMessageCreationParams>() {
                 @Override
                 public RcsIncomingMessageCreationParams createFromParcel(Parcel in) {
diff --git a/telephony/java/android/telephony/ims/RcsMessageQueryParams.java b/telephony/java/android/telephony/ims/RcsMessageQueryParams.java
index 6491ac9..9f9eafb 100644
--- a/telephony/java/android/telephony/ims/RcsMessageQueryParams.java
+++ b/telephony/java/android/telephony/ims/RcsMessageQueryParams.java
@@ -330,7 +330,7 @@
         mThreadId = in.readInt();
     }
 
-    public static final Creator<RcsMessageQueryParams> CREATOR =
+    public static final @android.annotation.NonNull Creator<RcsMessageQueryParams> CREATOR =
             new Creator<RcsMessageQueryParams>() {
                 @Override
                 public RcsMessageQueryParams createFromParcel(Parcel in) {
diff --git a/telephony/java/android/telephony/ims/RcsMessageQueryResult.java b/telephony/java/android/telephony/ims/RcsMessageQueryResult.java
index e4020c1..5df929b 100644
--- a/telephony/java/android/telephony/ims/RcsMessageQueryResult.java
+++ b/telephony/java/android/telephony/ims/RcsMessageQueryResult.java
@@ -89,7 +89,7 @@
         in.readTypedList(mMessageTypeIdPairs, RcsTypeIdPair.CREATOR);
     }
 
-    public static final Creator<RcsMessageQueryResult> CREATOR =
+    public static final @android.annotation.NonNull Creator<RcsMessageQueryResult> CREATOR =
             new Creator<RcsMessageQueryResult>() {
                 @Override
                 public RcsMessageQueryResult createFromParcel(Parcel in) {
diff --git a/telephony/java/android/telephony/ims/RcsMessageSnippet.java b/telephony/java/android/telephony/ims/RcsMessageSnippet.java
index 9064251..8103160 100644
--- a/telephony/java/android/telephony/ims/RcsMessageSnippet.java
+++ b/telephony/java/android/telephony/ims/RcsMessageSnippet.java
@@ -71,7 +71,7 @@
         mTimestamp = in.readLong();
     }
 
-    public static final Creator<RcsMessageSnippet> CREATOR =
+    public static final @android.annotation.NonNull Creator<RcsMessageSnippet> CREATOR =
             new Creator<RcsMessageSnippet>() {
                 @Override
                 public RcsMessageSnippet createFromParcel(Parcel in) {
diff --git a/telephony/java/android/telephony/ims/RcsOutgoingMessageCreationParams.java b/telephony/java/android/telephony/ims/RcsOutgoingMessageCreationParams.java
index 81e3244..22fd8a5 100644
--- a/telephony/java/android/telephony/ims/RcsOutgoingMessageCreationParams.java
+++ b/telephony/java/android/telephony/ims/RcsOutgoingMessageCreationParams.java
@@ -64,7 +64,7 @@
         super(in);
     }
 
-    public static final Creator<RcsOutgoingMessageCreationParams> CREATOR =
+    public static final @android.annotation.NonNull Creator<RcsOutgoingMessageCreationParams> CREATOR =
             new Creator<RcsOutgoingMessageCreationParams>() {
                 @Override
                 public RcsOutgoingMessageCreationParams createFromParcel(Parcel in) {
diff --git a/telephony/java/android/telephony/ims/RcsParticipantAliasChangedEventDescriptor.java b/telephony/java/android/telephony/ims/RcsParticipantAliasChangedEventDescriptor.java
index a32e552..aad9fb3 100644
--- a/telephony/java/android/telephony/ims/RcsParticipantAliasChangedEventDescriptor.java
+++ b/telephony/java/android/telephony/ims/RcsParticipantAliasChangedEventDescriptor.java
@@ -45,7 +45,7 @@
                 mTimestamp, new RcsParticipant(mParticipantId), mNewAlias);
     }
 
-    public static final Creator<RcsParticipantAliasChangedEventDescriptor> CREATOR =
+    public static final @android.annotation.NonNull Creator<RcsParticipantAliasChangedEventDescriptor> CREATOR =
             new Creator<RcsParticipantAliasChangedEventDescriptor>() {
                 @Override
                 public RcsParticipantAliasChangedEventDescriptor createFromParcel(Parcel in) {
diff --git a/telephony/java/android/telephony/ims/RcsParticipantQueryParams.java b/telephony/java/android/telephony/ims/RcsParticipantQueryParams.java
index ada9b8a..21107a2 100644
--- a/telephony/java/android/telephony/ims/RcsParticipantQueryParams.java
+++ b/telephony/java/android/telephony/ims/RcsParticipantQueryParams.java
@@ -279,7 +279,7 @@
         mThreadId = in.readInt();
     }
 
-    public static final Creator<RcsParticipantQueryParams> CREATOR =
+    public static final @android.annotation.NonNull Creator<RcsParticipantQueryParams> CREATOR =
             new Creator<RcsParticipantQueryParams>() {
                 @Override
                 public RcsParticipantQueryParams createFromParcel(Parcel in) {
diff --git a/telephony/java/android/telephony/ims/RcsParticipantQueryResult.java b/telephony/java/android/telephony/ims/RcsParticipantQueryResult.java
index 92e2fa78..3e5c231 100644
--- a/telephony/java/android/telephony/ims/RcsParticipantQueryResult.java
+++ b/telephony/java/android/telephony/ims/RcsParticipantQueryResult.java
@@ -80,7 +80,7 @@
                 RcsQueryContinuationToken.class.getClassLoader());
     }
 
-    public static final Creator<RcsParticipantQueryResult> CREATOR =
+    public static final @android.annotation.NonNull Creator<RcsParticipantQueryResult> CREATOR =
             new Creator<RcsParticipantQueryResult>() {
                 @Override
                 public RcsParticipantQueryResult createFromParcel(Parcel in) {
diff --git a/telephony/java/android/telephony/ims/RcsQueryContinuationToken.java b/telephony/java/android/telephony/ims/RcsQueryContinuationToken.java
index 970c110..982263a 100644
--- a/telephony/java/android/telephony/ims/RcsQueryContinuationToken.java
+++ b/telephony/java/android/telephony/ims/RcsQueryContinuationToken.java
@@ -129,7 +129,7 @@
         mOffset = in.readInt();
     }
 
-    public static final Creator<RcsQueryContinuationToken> CREATOR =
+    public static final @android.annotation.NonNull Creator<RcsQueryContinuationToken> CREATOR =
             new Creator<RcsQueryContinuationToken>() {
                 @Override
                 public RcsQueryContinuationToken createFromParcel(Parcel in) {
diff --git a/telephony/java/android/telephony/ims/RcsThreadQueryParams.java b/telephony/java/android/telephony/ims/RcsThreadQueryParams.java
index 81eee40..da7cdb0 100644
--- a/telephony/java/android/telephony/ims/RcsThreadQueryParams.java
+++ b/telephony/java/android/telephony/ims/RcsThreadQueryParams.java
@@ -276,7 +276,7 @@
         mIsAscending = in.readByte() == 1;
     }
 
-    public static final Creator<RcsThreadQueryParams> CREATOR =
+    public static final @android.annotation.NonNull Creator<RcsThreadQueryParams> CREATOR =
             new Creator<RcsThreadQueryParams>() {
                 @Override
                 public RcsThreadQueryParams createFromParcel(Parcel in) {
diff --git a/telephony/java/android/telephony/ims/RcsThreadQueryResult.java b/telephony/java/android/telephony/ims/RcsThreadQueryResult.java
index 9f2fba5..c2c2d3a 100644
--- a/telephony/java/android/telephony/ims/RcsThreadQueryResult.java
+++ b/telephony/java/android/telephony/ims/RcsThreadQueryResult.java
@@ -91,7 +91,7 @@
         in.readList(mRcsThreadIds, Integer.class.getClassLoader());
     }
 
-    public static final Creator<RcsThreadQueryResult> CREATOR =
+    public static final @android.annotation.NonNull Creator<RcsThreadQueryResult> CREATOR =
             new Creator<RcsThreadQueryResult>() {
                 @Override
                 public RcsThreadQueryResult createFromParcel(Parcel in) {
diff --git a/telephony/java/android/telephony/ims/feature/CapabilityChangeRequest.java b/telephony/java/android/telephony/ims/feature/CapabilityChangeRequest.java
index 1ee8563..80fc09e 100644
--- a/telephony/java/android/telephony/ims/feature/CapabilityChangeRequest.java
+++ b/telephony/java/android/telephony/ims/feature/CapabilityChangeRequest.java
@@ -187,7 +187,7 @@
         }
     }
 
-    public static final Creator<CapabilityChangeRequest> CREATOR =
+    public static final @android.annotation.NonNull Creator<CapabilityChangeRequest> CREATOR =
             new Creator<CapabilityChangeRequest>() {
                 @Override
                 public CapabilityChangeRequest createFromParcel(Parcel in) {
diff --git a/telephony/java/android/telephony/ims/stub/ImsFeatureConfiguration.java b/telephony/java/android/telephony/ims/stub/ImsFeatureConfiguration.java
index dfb6e2c..6ab9465 100644
--- a/telephony/java/android/telephony/ims/stub/ImsFeatureConfiguration.java
+++ b/telephony/java/android/telephony/ims/stub/ImsFeatureConfiguration.java
@@ -165,7 +165,7 @@
         }
     }
 
-    public static final Creator<ImsFeatureConfiguration> CREATOR
+    public static final @android.annotation.NonNull Creator<ImsFeatureConfiguration> CREATOR
             = new Creator<ImsFeatureConfiguration>() {
         @Override
         public ImsFeatureConfiguration createFromParcel(Parcel in) {
diff --git a/telephony/java/android/telephony/mbms/DownloadRequest.java b/telephony/java/android/telephony/mbms/DownloadRequest.java
index 9e3302b..52b51d2 100644
--- a/telephony/java/android/telephony/mbms/DownloadRequest.java
+++ b/telephony/java/android/telephony/mbms/DownloadRequest.java
@@ -330,7 +330,7 @@
         return version;
     }
 
-    public static final Parcelable.Creator<DownloadRequest> CREATOR =
+    public static final @android.annotation.NonNull Parcelable.Creator<DownloadRequest> CREATOR =
             new Parcelable.Creator<DownloadRequest>() {
         public DownloadRequest createFromParcel(Parcel in) {
             return new DownloadRequest(in);
diff --git a/telephony/java/android/telephony/mbms/FileInfo.java b/telephony/java/android/telephony/mbms/FileInfo.java
index e064adb..ada2872 100644
--- a/telephony/java/android/telephony/mbms/FileInfo.java
+++ b/telephony/java/android/telephony/mbms/FileInfo.java
@@ -33,7 +33,7 @@
 
     private final String mimeType;
 
-    public static final Parcelable.Creator<FileInfo> CREATOR =
+    public static final @android.annotation.NonNull Parcelable.Creator<FileInfo> CREATOR =
             new Parcelable.Creator<FileInfo>() {
         @Override
         public FileInfo createFromParcel(Parcel source) {
diff --git a/telephony/java/android/telephony/mbms/FileServiceInfo.java b/telephony/java/android/telephony/mbms/FileServiceInfo.java
index b30a3af..8c79ab6 100644
--- a/telephony/java/android/telephony/mbms/FileServiceInfo.java
+++ b/telephony/java/android/telephony/mbms/FileServiceInfo.java
@@ -44,7 +44,7 @@
         files = new ArrayList<>(newFiles);
     }
 
-    public static final Parcelable.Creator<FileServiceInfo> CREATOR =
+    public static final @android.annotation.NonNull Parcelable.Creator<FileServiceInfo> CREATOR =
             new Parcelable.Creator<FileServiceInfo>() {
         @Override
         public FileServiceInfo createFromParcel(Parcel source) {
diff --git a/telephony/java/android/telephony/mbms/StreamingServiceInfo.java b/telephony/java/android/telephony/mbms/StreamingServiceInfo.java
index ef2a14a..8ad1d89 100644
--- a/telephony/java/android/telephony/mbms/StreamingServiceInfo.java
+++ b/telephony/java/android/telephony/mbms/StreamingServiceInfo.java
@@ -48,7 +48,7 @@
         super(names, className, locales, serviceId, start, end);
     }
 
-    public static final Parcelable.Creator<StreamingServiceInfo> CREATOR =
+    public static final @android.annotation.NonNull Parcelable.Creator<StreamingServiceInfo> CREATOR =
             new Parcelable.Creator<StreamingServiceInfo>() {
         @Override
         public StreamingServiceInfo createFromParcel(Parcel source) {
diff --git a/telephony/java/android/telephony/mbms/UriPathPair.java b/telephony/java/android/telephony/mbms/UriPathPair.java
index dd20a69..f53d7e0 100644
--- a/telephony/java/android/telephony/mbms/UriPathPair.java
+++ b/telephony/java/android/telephony/mbms/UriPathPair.java
@@ -54,7 +54,7 @@
         mContentUri = in.readParcelable(Uri.class.getClassLoader());
     }
 
-    public static final Creator<UriPathPair> CREATOR = new Creator<UriPathPair>() {
+    public static final @android.annotation.NonNull Creator<UriPathPair> CREATOR = new Creator<UriPathPair>() {
         @Override
         public UriPathPair createFromParcel(Parcel in) {
             return new UriPathPair(in);
diff --git a/telephony/java/android/telephony/mbms/vendor/IMbmsStreamingService.aidl b/telephony/java/android/telephony/mbms/vendor/IMbmsStreamingService.aidl
index c90ffc7..c1401272 100755
--- a/telephony/java/android/telephony/mbms/vendor/IMbmsStreamingService.aidl
+++ b/telephony/java/android/telephony/mbms/vendor/IMbmsStreamingService.aidl
@@ -26,13 +26,17 @@
  */
 interface IMbmsStreamingService
 {
+    @UnsupportedAppUsage
     int initialize(IMbmsStreamingSessionCallback callback, int subId);
 
+    @UnsupportedAppUsage
     int requestUpdateStreamingServices(int subId, in List<String> serviceClasses);
 
+    @UnsupportedAppUsage
     int startStreaming(int subId, String serviceId,
             IStreamingServiceCallback callback);
 
+    @UnsupportedAppUsage
     Uri getPlaybackUri(int subId, String serviceId);
 
     void stopStreaming(int subId, String serviceId);
diff --git a/telephony/java/android/telephony/mbms/vendor/MbmsGroupCallServiceBase.java b/telephony/java/android/telephony/mbms/vendor/MbmsGroupCallServiceBase.java
index e86a47d..1335b52 100644
--- a/telephony/java/android/telephony/mbms/vendor/MbmsGroupCallServiceBase.java
+++ b/telephony/java/android/telephony/mbms/vendor/MbmsGroupCallServiceBase.java
@@ -16,6 +16,7 @@
 
 package android.telephony.mbms.vendor;
 
+import android.annotation.NonNull;
 import android.annotation.SystemApi;
 import android.annotation.TestApi;
 import android.app.Service;
@@ -187,7 +188,7 @@
      *
      * May throw an {@link IllegalArgumentException} or a {@link SecurityException}, which
      * will be intercepted and passed to the app as
-     * {@link MbmsErrors.InitializationErrors#ERROR_UNABLE_TO_INITIALIZE}
+     * {@link MbmsErrors.InitializationErrtrors#ERROR_UNABLE_TO_INITIALIZE}
      *
      * May return any value from {@link MbmsErrors.InitializationErrors}
      * or {@link MbmsErrors#SUCCESS}. Non-successful error codes will be passed to the app via
@@ -196,7 +197,7 @@
      * @param callback The callback to use to communicate with the app.
      * @param subscriptionId The subscription ID to use.
      */
-    public int initialize(MbmsGroupCallSessionCallback callback, int subscriptionId)
+    public int initialize(@NonNull MbmsGroupCallSessionCallback callback, int subscriptionId)
             throws RemoteException {
         throw new UnsupportedOperationException("Not implemented");
     }
@@ -215,8 +216,8 @@
      * @param callback The callback object on which the app wishes to receive updates.
      * @return Any error in {@link MbmsErrors.GeneralErrors}
      */
-    public int startGroupCall(int subscriptionId, long tmgi, List<Integer> saiList,
-            List<Integer> frequencyList, GroupCallCallback callback) {
+    public int startGroupCall(int subscriptionId, long tmgi, @NonNull List<Integer> saiList,
+            @NonNull List<Integer> frequencyList, @NonNull GroupCallCallback callback) {
         throw new UnsupportedOperationException("Not implemented");
     }
 
@@ -241,8 +242,8 @@
      * @param saiList New list of SAIs that the call is available on.
      * @param frequencyList New list of frequencies that the call is available on.
      */
-    public void updateGroupCall(int subscriptionId, long tmgi, List<Integer> saiList,
-            List<Integer> frequencyList) {
+    public void updateGroupCall(int subscriptionId, long tmgi, @NonNull List<Integer> saiList,
+            @NonNull List<Integer> frequencyList) {
         throw new UnsupportedOperationException("Not implemented");
     }
 
diff --git a/telephony/java/com/android/ims/ImsConfigListener.aidl b/telephony/java/com/android/ims/ImsConfigListener.aidl
index 64a5015..4f229df 100644
--- a/telephony/java/com/android/ims/ImsConfigListener.aidl
+++ b/telephony/java/com/android/ims/ImsConfigListener.aidl
@@ -47,6 +47,7 @@
      *
      * @return void.
      */
+    @UnsupportedAppUsage
     void onSetFeatureResponse(int feature, int network, int value, int status);
 
     /**
diff --git a/telephony/java/com/android/ims/internal/IImsCallSessionListener.aidl b/telephony/java/com/android/ims/internal/IImsCallSessionListener.aidl
index 579369f..b33a9f1 100644
--- a/telephony/java/com/android/ims/internal/IImsCallSessionListener.aidl
+++ b/telephony/java/com/android/ims/internal/IImsCallSessionListener.aidl
@@ -34,33 +34,47 @@
     /**
      * Notifies the result of the basic session operation (setup / terminate).
      */
+    @UnsupportedAppUsage
     void callSessionProgressing(in IImsCallSession session, in ImsStreamMediaProfile profile);
+    @UnsupportedAppUsage
     void callSessionStarted(in IImsCallSession session, in ImsCallProfile profile);
+    @UnsupportedAppUsage
     void callSessionStartFailed(in IImsCallSession session, in ImsReasonInfo reasonInfo);
+    @UnsupportedAppUsage
     void callSessionTerminated(in IImsCallSession session, in ImsReasonInfo reasonInfo);
 
     /**
      * Notifies the result of the call hold/resume operation.
      */
+    @UnsupportedAppUsage
     void callSessionHeld(in IImsCallSession session, in ImsCallProfile profile);
+    @UnsupportedAppUsage
     void callSessionHoldFailed(in IImsCallSession session, in ImsReasonInfo reasonInfo);
+    @UnsupportedAppUsage
     void callSessionHoldReceived(in IImsCallSession session, in ImsCallProfile profile);
+    @UnsupportedAppUsage
     void callSessionResumed(in IImsCallSession session, in ImsCallProfile profile);
+    @UnsupportedAppUsage
     void callSessionResumeFailed(in IImsCallSession session, in ImsReasonInfo reasonInfo);
+    @UnsupportedAppUsage
     void callSessionResumeReceived(in IImsCallSession session, in ImsCallProfile profile);
 
     /**
      * Notifies the result of call merge operation.
      */
+    @UnsupportedAppUsage
     void callSessionMergeStarted(in IImsCallSession session,
             in IImsCallSession newSession, in ImsCallProfile profile);
+    @UnsupportedAppUsage
     void callSessionMergeComplete(in IImsCallSession session);
+    @UnsupportedAppUsage
     void callSessionMergeFailed(in IImsCallSession session,
             in ImsReasonInfo reasonInfo);
 
     /**
      * Notifies the result of call upgrade / downgrade or any other call updates.
      */
+    @UnsupportedAppUsage
     void callSessionUpdated(in IImsCallSession session,
             in ImsCallProfile profile);
     void callSessionUpdateFailed(in IImsCallSession session,
@@ -81,7 +95,9 @@
     /**
      * Notifies the result of the participant invitation / removal to/from the conference session.
      */
+    @UnsupportedAppUsage
     void callSessionInviteParticipantsRequestDelivered(in IImsCallSession session);
+    @UnsupportedAppUsage
     void callSessionInviteParticipantsRequestFailed(in IImsCallSession session,
             in ImsReasonInfo reasonInfo);
     void callSessionRemoveParticipantsRequestDelivered(in IImsCallSession session);
@@ -91,6 +107,7 @@
     /**
      * Notifies the changes of the conference info. in the conference session.
      */
+    @UnsupportedAppUsage
     void callSessionConferenceStateUpdated(in IImsCallSession session,
             in ImsConferenceState state);
 
@@ -103,8 +120,10 @@
     /**
      * Notifies of handover information for this call
      */
+    @UnsupportedAppUsage
     void callSessionHandover(in IImsCallSession session,
             in int srcAccessTech, in int targetAccessTech, in ImsReasonInfo reasonInfo);
+    @UnsupportedAppUsage
     void callSessionHandoverFailed(in IImsCallSession session,
             in int srcAccessTech, in int targetAccessTech, in ImsReasonInfo reasonInfo);
     void callSessionMayHandover(in IImsCallSession session,
@@ -118,6 +137,7 @@
      * - {@link com.android.internal.telephony.Phone#TTY_MODE_HCO}
      * - {@link com.android.internal.telephony.Phone#TTY_MODE_VCO}
      */
+    @UnsupportedAppUsage
     void callSessionTtyModeReceived(in IImsCallSession session, in int mode);
 
     /**
@@ -126,11 +146,13 @@
      * @param session The call session.
      * @param isMultiParty {@code true} if the session became multiparty, {@code false} otherwise.
      */
+    @UnsupportedAppUsage
     void callSessionMultipartyStateChanged(in IImsCallSession session, in boolean isMultiParty);
 
     /**
      * Notifies the supplementary service information for the current session.
      */
+    @UnsupportedAppUsage
     void callSessionSuppServiceReceived(in IImsCallSession session,
          in ImsSuppServiceNotification suppSrvNotification);
 
diff --git a/telephony/java/com/android/ims/internal/IImsRegistrationListener.aidl b/telephony/java/com/android/ims/internal/IImsRegistrationListener.aidl
index 2212109..a7a62a6 100644
--- a/telephony/java/com/android/ims/internal/IImsRegistrationListener.aidl
+++ b/telephony/java/com/android/ims/internal/IImsRegistrationListener.aidl
@@ -32,6 +32,7 @@
      *
      * @deprecated see {@link registrationConnectedWithRadioTech}
      */
+    @UnsupportedAppUsage
     void registrationConnected();
 
     /**
@@ -47,6 +48,7 @@
      * @param imsRadioTech the radio access technology. Valid values are {@code
      * RIL_RADIO_TECHNOLOGY_*} defined in {@link ServiceState}.
      */
+    @UnsupportedAppUsage
     void registrationConnectedWithRadioTech(int imsRadioTech);
 
     /**
@@ -55,12 +57,14 @@
      * @param imsRadioTech the radio access technology. Valid values are {@code
      * RIL_RADIO_TECHNOLOGY_*} defined in {@link ServiceState}.
      */
+    @UnsupportedAppUsage
     void registrationProgressingWithRadioTech(int imsRadioTech);
 
 
     /**
      * Notifies the application when the device is disconnected from the IMS network.
      */
+    @UnsupportedAppUsage
     void registrationDisconnected(in ImsReasonInfo imsReasonInfo);
 
     /**
@@ -94,6 +98,7 @@
      * @param enabledFeatures features enabled as defined in com.android.ims.ImsConfig#FeatureConstants.
      * @param disabledFeatures features disabled as defined in com.android.ims.ImsConfig#FeatureConstants.
      */
+    @UnsupportedAppUsage
     void registrationFeatureCapabilityChanged(int serviceClass,
             in int[] enabledFeatures, in int[] disabledFeatures);
 
@@ -101,11 +106,13 @@
      * Updates the application with the waiting voice message count.
      * @param count The number of waiting voice messages.
      */
+    @UnsupportedAppUsage
     void voiceMessageCountUpdate(int count);
 
     /**
      * Notifies the application when the list of URIs associated with IMS client is updated.
      */
+    @UnsupportedAppUsage
     void registrationAssociatedUriChanged(in Uri[] uris);
 
     /**
@@ -116,5 +123,6 @@
      *         attempted.
      * @param imsReasonInfo Reason for the failure.
      */
+    @UnsupportedAppUsage
     void registrationChangeFailed(in int targetAccessTech, in ImsReasonInfo imsReasonInfo);
 }
diff --git a/telephony/java/com/android/ims/internal/IImsUtListener.aidl b/telephony/java/com/android/ims/internal/IImsUtListener.aidl
index a603cd3..fcb9fb1 100644
--- a/telephony/java/com/android/ims/internal/IImsUtListener.aidl
+++ b/telephony/java/com/android/ims/internal/IImsUtListener.aidl
@@ -31,30 +31,37 @@
     /**
      * Notifies the result of the supplementary service configuration udpate.
      */
+    @UnsupportedAppUsage
     void utConfigurationUpdated(in IImsUt ut, int id);
+    @UnsupportedAppUsage
     void utConfigurationUpdateFailed(in IImsUt ut, int id, in ImsReasonInfo error);
 
     /**
      * Notifies the result of the supplementary service configuration query.
      */
+    @UnsupportedAppUsage
     void utConfigurationQueried(in IImsUt ut, int id, in Bundle ssInfo);
+    @UnsupportedAppUsage
     void utConfigurationQueryFailed(in IImsUt ut, int id, in ImsReasonInfo error);
 
     /**
      * Notifies the status of the call barring supplementary service.
      */
+    @UnsupportedAppUsage
     void utConfigurationCallBarringQueried(in IImsUt ut,
             int id, in ImsSsInfo[] cbInfo);
 
     /**
      * Notifies the status of the call forwarding supplementary service.
      */
+    @UnsupportedAppUsage
     void utConfigurationCallForwardQueried(in IImsUt ut,
             int id, in ImsCallForwardInfo[] cfInfo);
 
     /**
      * Notifies the status of the call waiting supplementary service.
      */
+    @UnsupportedAppUsage
     void utConfigurationCallWaitingQueried(in IImsUt ut,
             int id, in ImsSsInfo[] cwInfo);
 
diff --git a/telephony/java/com/android/ims/internal/IImsVideoCallCallback.aidl b/telephony/java/com/android/ims/internal/IImsVideoCallCallback.aidl
index 9499c9f..cf8d637 100644
--- a/telephony/java/com/android/ims/internal/IImsVideoCallCallback.aidl
+++ b/telephony/java/com/android/ims/internal/IImsVideoCallCallback.aidl
@@ -31,18 +31,25 @@
  * {@hide}
  */
 oneway interface IImsVideoCallCallback {
+    @UnsupportedAppUsage
     void receiveSessionModifyRequest(in VideoProfile videoProfile);
 
+    @UnsupportedAppUsage
     void receiveSessionModifyResponse(int status, in VideoProfile requestedProfile,
         in VideoProfile responseProfile);
 
+    @UnsupportedAppUsage
     void handleCallSessionEvent(int event);
 
+    @UnsupportedAppUsage
     void changePeerDimensions(int width, int height);
 
+    @UnsupportedAppUsage
     void changeCallDataUsage(long dataUsage);
 
+    @UnsupportedAppUsage
     void changeCameraCapabilities(in VideoProfile.CameraCapabilities cameraCapabilities);
 
+    @UnsupportedAppUsage
     void changeVideoQuality(int videoQuality);
 }
diff --git a/telephony/java/com/android/ims/internal/IImsVideoCallProvider.aidl b/telephony/java/com/android/ims/internal/IImsVideoCallProvider.aidl
index 0da27e1..4d20bd6 100644
--- a/telephony/java/com/android/ims/internal/IImsVideoCallProvider.aidl
+++ b/telephony/java/com/android/ims/internal/IImsVideoCallProvider.aidl
@@ -41,6 +41,7 @@
  * @hide
  */
 oneway interface IImsVideoCallProvider {
+    @UnsupportedAppUsage
     void setCallback(IImsVideoCallCallback callback);
 
     void setCamera(String cameraId, int uid);
diff --git a/telephony/java/com/android/ims/internal/uce/options/IOptionsListener.aidl b/telephony/java/com/android/ims/internal/uce/options/IOptionsListener.aidl
index 8cb1153..c69d5a9 100644
--- a/telephony/java/com/android/ims/internal/uce/options/IOptionsListener.aidl
+++ b/telephony/java/com/android/ims/internal/uce/options/IOptionsListener.aidl
@@ -29,6 +29,7 @@
      * @param version, version information of the service.
      * @hide
      */
+    @UnsupportedAppUsage
     void getVersionCb(in String version );
 
     /**
@@ -37,6 +38,7 @@
      * @param statusCode, UCE_SUCCESS as service availability.
      * @hide
      */
+    @UnsupportedAppUsage
     void serviceAvailable(in StatusCode statusCode);
 
     /**
@@ -45,6 +47,7 @@
      * @param statusCode, UCE_SUCCESS as service unavailability.
      * @hide
      */
+    @UnsupportedAppUsage
     void serviceUnavailable(in StatusCode statusCode);
 
     /**
@@ -55,6 +58,7 @@
      * @param capInfo, capabilities of the remote entity received.
      * @hide
      */
+    @UnsupportedAppUsage
     void sipResponseReceived( String uri,
                                 in OptionsSipResponse sipResponse, in OptionsCapInfo capInfo);
 
@@ -63,6 +67,7 @@
      * @param cmdStatus, command status of the request placed.
      * @hide
      */
+    @UnsupportedAppUsage
     void cmdStatus(in OptionsCmdStatus cmdStatus);
 
     /**
@@ -73,6 +78,7 @@
      * @param tID, transation of the request received from network.
      * @hide
      */
+    @UnsupportedAppUsage
     void incomingOptions( String uri, in OptionsCapInfo capInfo,
                                             in int tID);
 }
diff --git a/telephony/java/com/android/ims/internal/uce/options/IOptionsService.aidl b/telephony/java/com/android/ims/internal/uce/options/IOptionsService.aidl
index 839bb55..2e49082 100644
--- a/telephony/java/com/android/ims/internal/uce/options/IOptionsService.aidl
+++ b/telephony/java/com/android/ims/internal/uce/options/IOptionsService.aidl
@@ -33,6 +33,7 @@
      * @return StatusCode, status of the request placed.
      * @hide
      */
+    @UnsupportedAppUsage
     StatusCode getVersion(int optionsServiceHandle);
 
     /**
@@ -44,6 +45,7 @@
      * The service will fill UceLong.mUceLong with optionsServiceListenerHdl
      * @return StatusCode, status of the request placed.
      */
+    @UnsupportedAppUsage
     StatusCode addListener(int optionsServiceHandle, IOptionsListener optionsListener,
                            inout UceLong optionsServiceListenerHdl);
 
@@ -54,6 +56,7 @@
      * @param optionsServiceListenerHdl provided in createOptionsService() or Addlistener().
      * @return StatusCode, status of the request placed.
      */
+    @UnsupportedAppUsage
     StatusCode removeListener(int optionsServiceHandle, in UceLong optionsServiceListenerHdl);
 
     /**
@@ -66,6 +69,7 @@
      *                  with original request.
      * @return StatusCode, status of the request placed.
      */
+    @UnsupportedAppUsage
     StatusCode setMyInfo(int optionsServiceHandle , in CapInfo capInfo, int reqUserData);
 
 
@@ -78,6 +82,7 @@
      *                  with original request.
      * @return StatusCode, status of the request placed.
      */
+    @UnsupportedAppUsage
     StatusCode getMyInfo(int optionsServiceHandle , int reqUserdata);
 
     /**
@@ -90,6 +95,7 @@
      *                  with original request.
      * @return StatusCode, status of the request placed.
      */
+    @UnsupportedAppUsage
     StatusCode getContactCap(int optionsServiceHandle , String remoteURI, int reqUserData);
 
 
@@ -103,6 +109,7 @@
      *                  with original request.
      * @return StatusCode, status of the request placed.
      */
+    @UnsupportedAppUsage
     StatusCode getContactListCap(int optionsServiceHandle, in String[] remoteURIList,
                                  int reqUserData);
 
@@ -119,6 +126,7 @@
      * @param bContactInBL, true if the contact is blacklisted, else false.
      * @return StatusCode, status of the request placed.
      */
+    @UnsupportedAppUsage
     StatusCode responseIncomingOptions(int optionsServiceHandle,  int tId, int sipResponseCode,
                                        String reasonPhrase, in OptionsCapInfo capInfo,
                                        in boolean bContactInBL);
diff --git a/telephony/java/com/android/ims/internal/uce/presence/IPresenceListener.aidl b/telephony/java/com/android/ims/internal/uce/presence/IPresenceListener.aidl
index 2ae424f..65e7fc9 100644
--- a/telephony/java/com/android/ims/internal/uce/presence/IPresenceListener.aidl
+++ b/telephony/java/com/android/ims/internal/uce/presence/IPresenceListener.aidl
@@ -36,6 +36,7 @@
      * Gets the version of the presence listener implementation.
      * @param version, version information.
      */
+    @UnsupportedAppUsage
     void getVersionCb(in String version );
 
     /**
@@ -43,6 +44,7 @@
      * availability.
      * @param statusCode, UCE_SUCCESS as service availability.
      */
+    @UnsupportedAppUsage
     void serviceAvailable(in StatusCode statusCode);
 
     /**
@@ -50,6 +52,7 @@
      * unavailability.
      * @param statusCode, UCE_SUCCESS as service unAvailability.
      */
+    @UnsupportedAppUsage
     void serviceUnAvailable(in StatusCode statusCode);
 
     /**
@@ -57,12 +60,14 @@
      * publish request.
      * @param publishTrigger, Publish trigger for the network being supported.
      */
+    @UnsupportedAppUsage
     void publishTriggering(in PresPublishTriggerType publishTrigger);
 
     /**
      * Callback function to be invoked to inform the client of the status of an asynchronous call.
      * @param cmdStatus, command status of the request placed.
      */
+    @UnsupportedAppUsage
     void cmdStatus( in PresCmdStatus cmdStatus);
 
     /**
@@ -70,6 +75,7 @@
      * such as PUBLISH or SUBSCRIBE, has been received.
      * @param sipResponse, network response received for the request placed.
      */
+    @UnsupportedAppUsage
     void sipResponseReceived(in PresSipResponse sipResponse);
 
     /**
@@ -78,6 +84,7 @@
      * @param presentityURI, URI of the remote entity the request was placed.
      * @param tupleInfo, array of capability information remote entity supports.
      */
+    @UnsupportedAppUsage
     void capInfoReceived(in String presentityURI,
                          in PresTupleInfo [] tupleInfo);
 
@@ -87,6 +94,7 @@
      * @param rlmiInfo, resource infomation received from network.
      * @param resInfo, array of capabilities received from network for the list of  remore URI.
      */
+    @UnsupportedAppUsage
     void listCapInfoReceived(in PresRlmiInfo rlmiInfo,
                              in PresResInfo [] resInfo);
 
@@ -94,6 +102,7 @@
      * Callback function to be invoked to inform the client when Unpublish message
      * is sent to network.
      */
+    @UnsupportedAppUsage
     void unpublishMessageSent();
 
 }
\ No newline at end of file
diff --git a/telephony/java/com/android/ims/internal/uce/presence/IPresenceService.aidl b/telephony/java/com/android/ims/internal/uce/presence/IPresenceService.aidl
index fdea6d3..26a3e83 100644
--- a/telephony/java/com/android/ims/internal/uce/presence/IPresenceService.aidl
+++ b/telephony/java/com/android/ims/internal/uce/presence/IPresenceService.aidl
@@ -33,6 +33,7 @@
      * @param presenceServiceHdl returned in createPresenceService().
      * @return StatusCode, status of the request placed.
      */
+    @UnsupportedAppUsage
     StatusCode getVersion(int presenceServiceHdl);
 
     /**
@@ -45,6 +46,7 @@
      *
      * @return StatusCode, status of the request placed
      */
+    @UnsupportedAppUsage
     StatusCode addListener(int presenceServiceHdl, IPresenceListener presenceServiceListener,
                            inout UceLong presenceServiceListenerHdl);
 
@@ -54,6 +56,7 @@
      * @param presenceServiceListenerHdl provided in createPresenceService() or Addlistener().
      * @return StatusCode, status of the request placed.
      */
+    @UnsupportedAppUsage
     StatusCode removeListener(int presenceServiceHdl, in UceLong presenceServiceListenerHdl);
 
     /**
@@ -69,6 +72,7 @@
      *                  with original request.
      * @return StatusCode, status of the request placed.
      */
+    @UnsupportedAppUsage
     StatusCode reenableService(int presenceServiceHdl, int userData);
 
     /**
@@ -81,6 +85,7 @@
      *                  with original request.
      * @return StatusCode, status of the request placed.
      */
+    @UnsupportedAppUsage
     StatusCode publishMyCap(int presenceServiceHdl, in PresCapInfo myCapInfo , int userData);
 
     /**
@@ -94,6 +99,7 @@
      *                  with original request.
      * @return StatusCode, status of the request placed.
      */
+    @UnsupportedAppUsage
     StatusCode getContactCap(int presenceServiceHdl , String remoteUri, int userData);
 
     /**
@@ -107,6 +113,7 @@
      *                  with original request.
      * @return StatusCode, status of the request placed.
      */
+    @UnsupportedAppUsage
     StatusCode getContactListCap(int presenceServiceHdl, in String[] remoteUriList, int userData);
 
     /**
@@ -122,6 +129,7 @@
      *                  with original request.
      * @return StatusCode, status of the request placed.
      */
+    @UnsupportedAppUsage
     StatusCode  setNewFeatureTag(int presenceServiceHdl, String featureTag,
                                  in PresServiceInfo serviceInfo, int userData);
 
diff --git a/telephony/java/com/android/ims/internal/uce/uceservice/IUceListener.aidl b/telephony/java/com/android/ims/internal/uce/uceservice/IUceListener.aidl
index 13707a1..41abf7d 100644
--- a/telephony/java/com/android/ims/internal/uce/uceservice/IUceListener.aidl
+++ b/telephony/java/com/android/ims/internal/uce/uceservice/IUceListener.aidl
@@ -25,5 +25,6 @@
      * @param serviceStatusValue defined in ImsUceManager
      * @hide
      */
+    @UnsupportedAppUsage
     void setStatus(int serviceStatusValue);
 }
diff --git a/telephony/java/com/android/ims/internal/uce/uceservice/IUceService.aidl b/telephony/java/com/android/ims/internal/uce/uceservice/IUceService.aidl
index 1fb8513..ec45371 100644
--- a/telephony/java/com/android/ims/internal/uce/uceservice/IUceService.aidl
+++ b/telephony/java/com/android/ims/internal/uce/uceservice/IUceService.aidl
@@ -38,6 +38,7 @@
      * Service status is returned in setStatus callback in IUceListener.
      * @hide
      */
+    @UnsupportedAppUsage
     boolean startService(IUceListener uceListener);
 
     /**
@@ -45,6 +46,7 @@
      * @return boolean true if the service stop request is processed successfully, FALSE otherwise.
      * @hide
      */
+    @UnsupportedAppUsage
     boolean stopService();
 
 
@@ -54,6 +56,7 @@
      * @return boolean true if service started else false.
      * @hide
      */
+    @UnsupportedAppUsage
     boolean isServiceStarted();
 
     /**
@@ -71,6 +74,7 @@
      *
      * @deprecated This is replaced with new API createOptionsServiceForSubscription()
      */
+    @UnsupportedAppUsage
     int createOptionsService(IOptionsListener optionsListener,
                              inout UceLong optionsServiceListenerHdl);
     /**
@@ -97,6 +101,7 @@
      *        in IOptionsListener
      * @hide
      */
+    @UnsupportedAppUsage
     void destroyOptionsService(int optionsServiceHandle);
 
     /**
@@ -114,6 +119,7 @@
      *
      * @deprecated This is replaced with new API createPresenceServiceForSubscription()
      */
+    @UnsupportedAppUsage
     int createPresenceService(IPresenceListener presenceServiceListener,
                               inout UceLong presenceServiceListenerHdl);
     /**
@@ -141,6 +147,7 @@
      *
      * @hide
      */
+    @UnsupportedAppUsage
     void destroyPresenceService(int presenceServiceHdl);
 
 
@@ -152,6 +159,7 @@
      *
      * @hide
      */
+    @UnsupportedAppUsage
     boolean getServiceStatus();
 
     /**
@@ -163,6 +171,7 @@
      *
      * @deprecated use API getPresenceServiceForSubscription()
      */
+    @UnsupportedAppUsage
     IPresenceService getPresenceService();
 
     /**
@@ -185,6 +194,7 @@
      *
      * @hide
      */
+    @UnsupportedAppUsage
     IOptionsService getOptionsService();
 
     /**
diff --git a/telephony/java/com/android/internal/telephony/ICarrierConfigLoader.aidl b/telephony/java/com/android/internal/telephony/ICarrierConfigLoader.aidl
index 5cd67d9..8e50a8f 100644
--- a/telephony/java/com/android/internal/telephony/ICarrierConfigLoader.aidl
+++ b/telephony/java/com/android/internal/telephony/ICarrierConfigLoader.aidl
@@ -23,6 +23,7 @@
  */
 interface ICarrierConfigLoader {
 
+    @UnsupportedAppUsage
     PersistableBundle getConfigForSubId(int subId, String callingPackage);
 
     void overrideConfig(int subId, in PersistableBundle overrides);
diff --git a/telephony/java/com/android/internal/telephony/IOns.aidl b/telephony/java/com/android/internal/telephony/IOns.aidl
index 0e3d12b..2c48b65 100755
--- a/telephony/java/com/android/internal/telephony/IOns.aidl
+++ b/telephony/java/com/android/internal/telephony/IOns.aidl
@@ -18,6 +18,9 @@
 
 import android.telephony.AvailableNetworkInfo;
 
+import com.android.internal.telephony.ISetOpportunisticDataCallback;
+import com.android.internal.telephony.IUpdateAvailableNetworksCallback;
+
 interface IOns {
 
     /**
@@ -62,11 +65,13 @@
      * @param subId which opportunistic subscription
      * {@link SubscriptionManager#getOpportunisticSubscriptions} is preferred for cellular data.
      * Pass {@link SubscriptionManager#DEFAULT_SUBSCRIPTION_ID} to unset the preference
+     * @param needValidation whether validation is needed before switch happens.
+     * @param callback callback upon request completion.
      * @param callingPackage caller's package name
-     * @return true if request is accepted, else false.
      *
      */
-    boolean setPreferredDataSubscriptionId(int subId, String callingPackage);
+    void setPreferredDataSubscriptionId(int subId, boolean needValidation,
+            ISetOpportunisticDataCallback callbackStub, String callingPackage);
 
     /**
      * Get preferred opportunistic data subscription Id
@@ -93,9 +98,9 @@
      * {@link android.Manifest.permission#MODIFY_PHONE_STATE MODIFY_PHONE_STATE}.
      *  @param availableNetworks is a list of available network information.
      *  @param callingPackage caller's package name
-     *  @return true if request is accepted
+     *  @param callback callback upon request completion.
      *
      */
-    boolean updateAvailableNetworks(in List<AvailableNetworkInfo> availableNetworks,
-            String callingPackage);
+    void updateAvailableNetworks(in List<AvailableNetworkInfo> availableNetworks,
+            IUpdateAvailableNetworksCallback callbackStub, String callingPackage);
 }
diff --git a/telephony/java/com/android/internal/telephony/IPhoneSubInfo.aidl b/telephony/java/com/android/internal/telephony/IPhoneSubInfo.aidl
index abcb15a..5b509b7 100644
--- a/telephony/java/com/android/internal/telephony/IPhoneSubInfo.aidl
+++ b/telephony/java/com/android/internal/telephony/IPhoneSubInfo.aidl
@@ -60,6 +60,7 @@
     /**
      * Retrieves the unique sbuscriber ID, e.g., IMSI for GSM phones.
      */
+    @UnsupportedAppUsage
     String getSubscriberId(String callingPackage);
 
     /**
@@ -75,6 +76,7 @@
     /**
      * Retrieves the serial number of the ICC, if applicable.
      */
+    @UnsupportedAppUsage
     String getIccSerialNumber(String callingPackage);
 
     /**
diff --git a/telephony/java/com/android/internal/telephony/ITelephony.aidl b/telephony/java/com/android/internal/telephony/ITelephony.aidl
index d183837..122747a65 100644
--- a/telephony/java/com/android/internal/telephony/ITelephony.aidl
+++ b/telephony/java/com/android/internal/telephony/ITelephony.aidl
@@ -76,6 +76,7 @@
      * @param number the number to be dialed. If null, this
      * would display the Dialer screen with no number pre-filled.
      */
+    @UnsupportedAppUsage
     void dial(String number);
 
     /**
@@ -83,6 +84,7 @@
      * @param callingPackage The package making the call.
      * @param number the number to be called.
      */
+    @UnsupportedAppUsage
     void call(String callingPackage, String number);
 
     /**
@@ -98,6 +100,7 @@
      * @param callingPackage the name of the package making the call.
      * @return returns true if the radio is on.
      */
+    @UnsupportedAppUsage
     boolean isRadioOnForSubscriber(int subId, String callingPackage);
 
     /**
@@ -105,6 +108,7 @@
      * @param pin The pin to check.
      * @return whether the operation was a success.
      */
+    @UnsupportedAppUsage
     boolean supplyPin(String pin);
 
     /**
@@ -182,6 +186,7 @@
      * @param dialString the MMI command to be executed.
      * @return true if MMI command is executed.
      */
+    @UnsupportedAppUsage
     boolean handlePinMmi(String dialString);
 
 
@@ -202,11 +207,13 @@
      * @param subId user preferred subId.
      * @return true if MMI command is executed.
      */
+    @UnsupportedAppUsage
     boolean handlePinMmiForSubscriber(int subId, String dialString);
 
     /**
      * Toggles the radio on or off.
      */
+    @UnsupportedAppUsage
     void toggleRadioOnOff();
 
     /**
@@ -218,6 +225,7 @@
     /**
      * Set the radio to on or off
      */
+    @UnsupportedAppUsage
     boolean setRadio(boolean turnOn);
 
     /**
@@ -234,6 +242,7 @@
     /**
      * Request to update location information in service state
      */
+    @UnsupportedAppUsage
     void updateServiceLocation();
 
     /**
@@ -245,6 +254,7 @@
     /**
      * Enable location update notifications.
      */
+    @UnsupportedAppUsage
     void enableLocationUpdates();
 
     /**
@@ -256,6 +266,7 @@
     /**
      * Disable location update notifications.
      */
+    @UnsupportedAppUsage
     void disableLocationUpdates();
 
     /**
@@ -267,11 +278,13 @@
     /**
      * Allow mobile data connections.
      */
+    @UnsupportedAppUsage
     boolean enableDataConnectivity();
 
     /**
      * Disallow mobile data connections.
      */
+    @UnsupportedAppUsage
     boolean disableDataConnectivity();
 
     /**
@@ -293,6 +306,7 @@
      */
     List<NeighboringCellInfo> getNeighboringCellInfo(String callingPkg);
 
+     @UnsupportedAppUsage
      int getCallState();
 
     /**
@@ -300,7 +314,9 @@
      */
      int getCallStateForSlot(int slotIndex);
 
+     @UnsupportedAppUsage
      int getDataActivity();
+     @UnsupportedAppUsage
      int getDataState();
 
     /**
@@ -308,6 +324,7 @@
      * Returns TelephonyManager.PHONE_TYPE_CDMA if RILConstants.CDMA_PHONE
      * and TelephonyManager.PHONE_TYPE_GSM if RILConstants.GSM_PHONE
      */
+    @UnsupportedAppUsage
     int getActivePhoneType();
 
     /**
@@ -444,6 +461,7 @@
      * Returns the network type for data transmission
      * Legacy call, permission-free
      */
+    @UnsupportedAppUsage
     int getNetworkType();
 
     /**
@@ -477,6 +495,7 @@
     /**
      * Return true if an ICC card is present
      */
+    @UnsupportedAppUsage
     boolean hasIccCard();
 
     /**
@@ -557,6 +576,7 @@
      *            successful iccOpenLogicalChannel.
      * @return true if the channel was closed successfully.
      */
+    @UnsupportedAppUsage
     boolean iccCloseLogicalChannel(int subId, int channel);
 
     /**
@@ -577,6 +597,7 @@
      * @return The APDU response from the ICC card with the status appended at
      *            the end.
      */
+    @UnsupportedAppUsage
     String iccTransmitApduLogicalChannel(int subId, int channel, int cla, int instruction,
             int p1, int p2, int p3, String data);
 
@@ -700,13 +721,12 @@
     int getPreferredNetworkType(int subId);
 
     /**
-     * Check TETHER_DUN_REQUIRED and TETHER_DUN_APN settings, net.tethering.noprovisioning
-     * SystemProperty to decide whether DUN APN is required for
-     * tethering.
+     * Check whether DUN APN is required for tethering.
      *
-     * @return 0: Not required. 1: required. 2: Not set.
+     * @return {@code true} if DUN APN is required for tethering.
+     * @hide
      */
-    int getTetherApnRequired();
+    boolean getTetherApnRequired();
 
     /**
     * Enables framework IMS and triggers IMS Registration.
@@ -829,6 +849,7 @@
      *
      * @return true on enabled
      */
+    @UnsupportedAppUsage
     boolean getDataEnabled(int subId);
 
     /**
@@ -1348,7 +1369,7 @@
     /**
      * Returns fine-grained carrier id of the current subscription.
      *
-     * <p>The precise carrier id can be used to further differentiate a carrier by different
+     * <p>The specific carrier id can be used to further differentiate a carrier by different
      * networks, by prepaid v.s.postpaid or even by 4G v.s.3G plan. Each carrier has a unique
      * carrier id {@link #getSimCarrierId()} but can have multiple precise carrier id. e.g,
      * {@link #getSimCarrierId()} will always return Tracfone (id 2022) for a Tracfone SIM, while
@@ -1362,19 +1383,19 @@
      * be identified.
      * @hide
      */
-    int getSubscriptionPreciseCarrierId(int subId);
+    int getSubscriptionSpecificCarrierId(int subId);
 
     /**
      * Similar like {@link #getSimCarrierIdName()}, returns user-facing name of the
-     * precise carrier id {@link #getSimPreciseCarrierId()}
+     * specific carrier id {@link #getSimSpecificCarrierId()}
      *
      * <p>The returned name is unlocalized.
      *
-     * @return user-facing name of the subscription precise carrier id. Return {@code null} if the
+     * @return user-facing name of the subscription specific carrier id. Return {@code null} if the
      * subscription is unavailable or the carrier cannot be identified.
      * @hide
      */
-    String getSubscriptionPreciseCarrierName(int subId);
+    String getSubscriptionSpecificCarrierName(int subId);
 
     /**
      * Returns carrier id based on MCCMNC only. This will return a MNO carrier id used for fallback
@@ -1679,7 +1700,7 @@
     /**
      * Modify the user's setting for whether or not 4G LTE is enabled.
      */
-    void setAdvancedCallingSetting(int subId, boolean isEnabled);
+    void setAdvancedCallingSettingEnabled(int subId, boolean isEnabled);
 
     /**
      * return true if the user's setting for VT is enabled for the subscription.
@@ -1689,7 +1710,7 @@
     /**
      * Modify the user's setting for whether or not VT is available for the subscrption specified.
      */
-    void setVtSetting(int subId, boolean isEnabled);
+    void setVtSettingEnabled(int subId, boolean isEnabled);
 
     /**
      * return true if the user's setting for whether or not Voice over WiFi is currently enabled.
@@ -1699,7 +1720,7 @@
     /**
      * sets the user's setting for Voice over WiFi enabled state.
      */
-    void setVoWiFiSetting(int subId, boolean isEnabled);
+    void setVoWiFiSettingEnabled(int subId, boolean isEnabled);
 
     /**
      * return true if the user's setting for Voice over WiFi while roaming is enabled.
@@ -1710,7 +1731,7 @@
      * Sets the user's preference for whether or not Voice over WiFi is enabled for the current
      * subscription while roaming.
      */
-    void setVoWiFiRoamingSetting(int subId, boolean isEnabled);
+    void setVoWiFiRoamingSettingEnabled(int subId, boolean isEnabled);
 
     /**
      * Set the Voice over WiFi enabled state, but do not persist the setting.
@@ -1752,12 +1773,12 @@
     /**
      * Return the emergency number list from all the active subscriptions.
      */
-    Map getCurrentEmergencyNumberList(String callingPackage);
+    Map getEmergencyNumberList(String callingPackage);
 
     /**
      * Identify if the number is emergency number, based on all the active subscriptions.
      */
-    boolean isCurrentEmergencyNumber(String number, boolean exactMatch);
+    boolean isEmergencyNumber(String number, boolean exactMatch);
 
     /**
      * Return a list of certs in hex string from loaded carrier privileges access rules.
diff --git a/telephony/java/com/android/internal/telephony/ITelephonyRegistry.aidl b/telephony/java/com/android/internal/telephony/ITelephonyRegistry.aidl
index 6de608e..0610c5d 100644
--- a/telephony/java/com/android/internal/telephony/ITelephonyRegistry.aidl
+++ b/telephony/java/com/android/internal/telephony/ITelephonyRegistry.aidl
@@ -38,9 +38,11 @@
             IOnSubscriptionsChangedListener callback);
     void removeOnSubscriptionsChangedListener(String pkg,
             IOnSubscriptionsChangedListener callback);
+    @UnsupportedAppUsage
     void listen(String pkg, IPhoneStateListener callback, int events, boolean notifyNow);
     void listenForSubscriber(in int subId, String pkg, IPhoneStateListener callback, int events,
             boolean notifyNow);
+    @UnsupportedAppUsage
     void notifyCallState(int state, String incomingNumber);
     void notifyCallStateForPhoneId(in int phoneId, in int subId, int state, String incomingNumber);
     void notifyServiceStateForPhoneId(in int phoneId, in int subId, in ServiceState state);
@@ -57,11 +59,13 @@
     void notifyDataConnectionForSubscriber(int subId, int state, boolean isDataConnectivityPossible,
             String apn, String apnType, in LinkProperties linkProperties,
             in NetworkCapabilities networkCapabilities, int networkType, boolean roaming);
+    @UnsupportedAppUsage
     void notifyDataConnectionFailed(String apnType);
     void notifyDataConnectionFailedForSubscriber(int subId, String apnType);
     void notifyCellLocation(in Bundle cellLocation);
     void notifyCellLocationForSubscriber(in int subId, in Bundle cellLocation);
     void notifyOtaspChanged(in int otaspMode);
+    @UnsupportedAppUsage
     void notifyCellInfo(in List<CellInfo> cellInfo);
     void notifyPhysicalChannelConfiguration(in List<PhysicalChannelConfig> configs);
     void notifyPhysicalChannelConfigurationForSubscriber(in int subId,
diff --git a/core/java/android/app/role/IRoleManagerCallback.aidl b/telephony/java/com/android/internal/telephony/IUpdateAvailableNetworksCallback.aidl
similarity index 69%
copy from core/java/android/app/role/IRoleManagerCallback.aidl
copy to telephony/java/com/android/internal/telephony/IUpdateAvailableNetworksCallback.aidl
index c0f8eea..8fe086ce 100644
--- a/core/java/android/app/role/IRoleManagerCallback.aidl
+++ b/telephony/java/com/android/internal/telephony/IUpdateAvailableNetworksCallback.aidl
@@ -1,5 +1,5 @@
 /*
- * Copyright (C) 2018 The Android Open Source Project
+ * Copyright 2019 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.
@@ -14,14 +14,12 @@
  * limitations under the License.
  */
 
-package android.app.role;
+package com.android.internal.telephony;
 
 /**
+ * Callback to provide asynchronous result of updateAvailableNetworks.
  * @hide
  */
-oneway interface IRoleManagerCallback {
-
-    void onSuccess();
-
-    void onFailure();
+oneway interface IUpdateAvailableNetworksCallback {
+    void onComplete(int result);
 }
diff --git a/telephony/java/com/android/internal/telephony/IWapPushManager.aidl b/telephony/java/com/android/internal/telephony/IWapPushManager.aidl
index d5ecb94..1c3df65 100644
--- a/telephony/java/com/android/internal/telephony/IWapPushManager.aidl
+++ b/telephony/java/com/android/internal/telephony/IWapPushManager.aidl
@@ -30,6 +30,7 @@
      * Returns true if inserting the information is successfull. Inserting the duplicated
      * record in the application ID table is not allowed. Use update/delete method.
      */
+    @UnsupportedAppUsage
     boolean addPackage(String x_app_id, String content_type,
             String package_name, String class_name,
             int app_type, boolean need_signature, boolean further_processing);
@@ -38,6 +39,7 @@
      * Updates receiver application that is last added.
      * Returns true if updating the information is successfull.
      */
+    @UnsupportedAppUsage
     boolean updatePackage(String x_app_id, String content_type,
             String package_name, String class_name,
             int app_type, boolean need_signature, boolean further_processing);
@@ -46,6 +48,7 @@
      * Delites receiver application information.
      * Returns true if deleting is successfull.
      */
+    @UnsupportedAppUsage
     boolean deletePackage(String x_app_id, String content_type,
                             String package_name, String class_name);
 }
diff --git a/telephony/java/com/android/internal/telephony/PhoneConstants.java b/telephony/java/com/android/internal/telephony/PhoneConstants.java
index e87d28c..d5061a3 100644
--- a/telephony/java/com/android/internal/telephony/PhoneConstants.java
+++ b/telephony/java/com/android/internal/telephony/PhoneConstants.java
@@ -141,6 +141,8 @@
     /** APN type for Emergency PDN. This is not an IA apn, but is used
      * for access to carrier services in an emergency call situation. */
     public static final String APN_TYPE_EMERGENCY = "emergency";
+    /** APN type for Mission Critical Services */
+    public static final String APN_TYPE_MCX = "mcx";
     /** Array of all APN types */
     public static final String[] APN_TYPES = {APN_TYPE_DEFAULT,
             APN_TYPE_MMS,
@@ -151,7 +153,8 @@
             APN_TYPE_IMS,
             APN_TYPE_CBS,
             APN_TYPE_IA,
-            APN_TYPE_EMERGENCY
+            APN_TYPE_EMERGENCY,
+            APN_TYPE_MCX
     };
 
     public static final int RIL_CARD_MAX_APPS    = 8;
diff --git a/telephony/java/com/android/internal/telephony/RILConstants.java b/telephony/java/com/android/internal/telephony/RILConstants.java
index 77b7979..5205973 100644
--- a/telephony/java/com/android/internal/telephony/RILConstants.java
+++ b/telephony/java/com/android/internal/telephony/RILConstants.java
@@ -470,6 +470,7 @@
     int RIL_REQUEST_START_KEEPALIVE = 144;
     int RIL_REQUEST_STOP_KEEPALIVE = 145;
     int RIL_REQUEST_ENABLE_MODEM = 146;
+    int RIL_REQUEST_GET_MODEM_STATUS = 147;
 
     /* The following requests are not defined in RIL.h */
     int RIL_REQUEST_HAL_NON_RIL_BASE = 200;
diff --git a/telephony/java/com/android/internal/telephony/SmsApplication.java b/telephony/java/com/android/internal/telephony/SmsApplication.java
index 7478a00..ef7c605 100644
--- a/telephony/java/com/android/internal/telephony/SmsApplication.java
+++ b/telephony/java/com/android/internal/telephony/SmsApplication.java
@@ -19,7 +19,6 @@
 import android.Manifest.permission;
 import android.app.AppOpsManager;
 import android.app.role.RoleManager;
-import android.app.role.RoleManagerCallback;
 import android.content.ComponentName;
 import android.content.Context;
 import android.content.Intent;
@@ -51,9 +50,11 @@
 import java.util.Collection;
 import java.util.HashMap;
 import java.util.List;
+import java.util.concurrent.CompletableFuture;
 import java.util.concurrent.ExecutionException;
 import java.util.concurrent.TimeUnit;
 import java.util.concurrent.TimeoutException;
+import java.util.function.Consumer;
 
 /**
  * Class for managing the primary application that we will deliver SMS/MMS messages to
@@ -634,12 +635,19 @@
             }
 
             // Update the setting.
-            RoleManagerCallback.Future res = new RoleManagerCallback.Future();
+            CompletableFuture<Void> future = new CompletableFuture<>();
+            Consumer<Boolean> callback = successful -> {
+                if (successful) {
+                    future.complete(null);
+                } else {
+                    future.completeExceptionally(new RuntimeException());
+                }
+            };
             context.getSystemService(RoleManager.class).addRoleHolderAsUser(
                     RoleManager.ROLE_SMS, applicationData.mPackageName, 0, UserHandle.of(userId),
-                    AsyncTask.THREAD_POOL_EXECUTOR, res);
+                    AsyncTask.THREAD_POOL_EXECUTOR, callback);
             try {
-                res.get(5, TimeUnit.SECONDS);
+                future.get(5, TimeUnit.SECONDS);
             } catch (InterruptedException | ExecutionException | TimeoutException e) {
                 Log.e(LOG_TAG, "Exception while adding sms role holder " + applicationData, e);
                 return;
diff --git a/test-base/hiddenapi/Android.bp b/test-base/hiddenapi/Android.bp
new file mode 100644
index 0000000..c4e0fab
--- /dev/null
+++ b/test-base/hiddenapi/Android.bp
@@ -0,0 +1,29 @@
+//
+// Copyright (C) 2019 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.
+//
+
+// Provided solely to contribute information about which hidden parts of the android.test.base
+// library are used by apps. The source files are stubs of the actual files in ../src which use the
+// UnsupportedAppUsage annotation to tag those methods that are accessible via the hiddenapi.
+// Relies on the convention that modules with name <x>-hiddenapi provide hiddenapi information for
+// module <x> that is on the bootclasspath.
+java_library {
+    name: "android.test.base-hiddenapi",
+    compile_dex: true,
+
+    srcs: ["src/**/*.java"],
+
+    libs: ["android.test.base"],
+}
diff --git a/test-base/hiddenapi/src/android/test/AndroidTestCase.java b/test-base/hiddenapi/src/android/test/AndroidTestCase.java
new file mode 100644
index 0000000..2b9beb1
--- /dev/null
+++ b/test-base/hiddenapi/src/android/test/AndroidTestCase.java
@@ -0,0 +1,46 @@
+/*
+ * Copyright (C) 2019 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.test;
+
+import android.annotation.UnsupportedAppUsage;
+import android.content.Context;
+
+import junit.framework.TestCase;
+
+/**
+ * @deprecated Stub only
+ */
+@SuppressWarnings({ "unchecked", "deprecation", "all" })
+@Deprecated
+public class AndroidTestCase extends TestCase {
+
+    /**
+     * Stub only
+     */
+    @UnsupportedAppUsage
+    public void setTestContext(Context context) {
+        throw new RuntimeException("Stub!");
+    }
+
+    /**
+     * Stub only
+     */
+    @UnsupportedAppUsage
+    public Context getTestContext() {
+        throw new RuntimeException("Stub!");
+    }
+}
diff --git a/test-base/hiddenapi/src/android/test/InstrumentationTestCase.java b/test-base/hiddenapi/src/android/test/InstrumentationTestCase.java
new file mode 100644
index 0000000..139cd18
--- /dev/null
+++ b/test-base/hiddenapi/src/android/test/InstrumentationTestCase.java
@@ -0,0 +1,39 @@
+/*
+ * Copyright (C) 2019 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.test;
+
+import android.annotation.UnsupportedAppUsage;
+
+import junit.framework.TestCase;
+
+import java.lang.reflect.Method;
+
+/**
+ * @deprecated Stub only
+ */
+@SuppressWarnings({ "unchecked", "deprecation", "all" })
+@Deprecated
+public class InstrumentationTestCase extends TestCase {
+
+    /**
+     * Stub only
+     */
+    @UnsupportedAppUsage
+    private void runMethod(Method runMethod, int tolerance) throws Throwable {
+        throw new RuntimeException("Stub!");
+    }
+}
diff --git a/test-base/hiddenapi/src/junit/framework/TestCase.java b/test-base/hiddenapi/src/junit/framework/TestCase.java
new file mode 100644
index 0000000..5a54861
--- /dev/null
+++ b/test-base/hiddenapi/src/junit/framework/TestCase.java
@@ -0,0 +1,46 @@
+/*
+ * Copyright (C) 2019 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 junit.framework;
+
+import android.annotation.UnsupportedAppUsage;
+
+/**
+ * Stub only
+ */
+@SuppressWarnings({ "unchecked", "deprecation", "all" })
+public abstract class TestCase extends Assert implements Test {
+
+    /**
+     * the name of the test case
+     */
+    @UnsupportedAppUsage
+    private String fName;
+
+    /**
+     * Stub only
+     */
+    public int countTestCases() {
+        throw new RuntimeException("Stub!");
+    }
+
+    /**
+     * Stub only
+     */
+    public void run(TestResult result) {
+        throw new RuntimeException("Stub!");
+    }
+}
diff --git a/test-base/hiddenapi/src/junit/framework/TestSuite.java b/test-base/hiddenapi/src/junit/framework/TestSuite.java
new file mode 100644
index 0000000..368c661
--- /dev/null
+++ b/test-base/hiddenapi/src/junit/framework/TestSuite.java
@@ -0,0 +1,58 @@
+/*
+ * Copyright (C) 2019 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 junit.framework;
+
+import android.annotation.UnsupportedAppUsage;
+
+import java.lang.reflect.Method;
+
+/**
+ * Stub only
+ */
+@SuppressWarnings({ "unchecked", "deprecation", "all" })
+public class TestSuite implements Test {
+
+    /**
+     * Stub only
+     */
+    @UnsupportedAppUsage
+    private boolean isPublicTestMethod(Method m) {
+        throw new RuntimeException("Stub!");
+    }
+
+    /**
+     * Stub only
+     */
+    @UnsupportedAppUsage
+    private boolean isTestMethod(Method m) {
+        throw new RuntimeException("Stub!");
+    }
+
+    /**
+     * Stub only
+     */
+    public int countTestCases() {
+        throw new RuntimeException("Stub!");
+    }
+
+    /**
+     * Stub only
+     */
+    public void run(TestResult result) {
+        throw new RuntimeException("Stub!");
+    }
+}
diff --git a/test-mock/src/android/test/mock/MockContext.java b/test-mock/src/android/test/mock/MockContext.java
index ae6cd29..a95b6f1 100644
--- a/test-mock/src/android/test/mock/MockContext.java
+++ b/test-mock/src/android/test/mock/MockContext.java
@@ -577,9 +577,14 @@
     }
 
     @Override
-    public boolean bindIsolatedService(Intent service,
-            ServiceConnection conn, int flags,
-            String instanceName) {
+    public boolean bindService(Intent service, int flags, Executor executor,
+            ServiceConnection conn) {
+        throw new UnsupportedOperationException();
+    }
+
+    @Override
+    public boolean bindIsolatedService(Intent service, int flags, String instanceName,
+            Executor executor, ServiceConnection conn) {
         throw new UnsupportedOperationException();
     }
 
diff --git a/test-runner/src/android/test/IsolatedContext.java b/test-runner/src/android/test/IsolatedContext.java
index 73db451..dd4a9a3 100644
--- a/test-runner/src/android/test/IsolatedContext.java
+++ b/test-runner/src/android/test/IsolatedContext.java
@@ -17,13 +17,13 @@
 package android.test;
 
 import android.accounts.AccountManager;
-import android.content.ContextWrapper;
-import android.content.ContentResolver;
-import android.content.Intent;
-import android.content.Context;
-import android.content.ServiceConnection;
 import android.content.BroadcastReceiver;
+import android.content.ContentResolver;
+import android.content.Context;
+import android.content.ContextWrapper;
+import android.content.Intent;
 import android.content.IntentFilter;
+import android.content.ServiceConnection;
 import android.content.pm.PackageManager;
 import android.net.Uri;
 import android.test.mock.MockAccountManager;
@@ -31,6 +31,7 @@
 import java.io.File;
 import java.util.ArrayList;
 import java.util.List;
+import java.util.concurrent.Executor;
 
 
 /**
@@ -75,8 +76,14 @@
     }
 
     @Override
-    public boolean bindIsolatedService(Intent service, ServiceConnection conn, int flags,
-            String instanceName) {
+    public boolean bindService(Intent service, int flags, Executor executor,
+            ServiceConnection conn) {
+        return false;
+    }
+
+    @Override
+    public boolean bindIsolatedService(Intent service, int flags, String instanceName,
+            Executor executor, ServiceConnection conn) {
         return false;
     }
 
diff --git a/tests/AccessibilityEventsLogger/Android.bp b/tests/AccessibilityEventsLogger/Android.bp
new file mode 100644
index 0000000..ead1656
--- /dev/null
+++ b/tests/AccessibilityEventsLogger/Android.bp
@@ -0,0 +1,9 @@
+android_test {
+    name: "AccessibilityEventsLogger",
+    srcs: ["**/*.java"],
+    sdk_version: "current",
+    certificate: "platform",
+    optimize: {
+        enabled: false,
+    },
+}
diff --git a/tests/AccessibilityEventsLogger/Android.mk b/tests/AccessibilityEventsLogger/Android.mk
deleted file mode 100644
index 4224017..0000000
--- a/tests/AccessibilityEventsLogger/Android.mk
+++ /dev/null
@@ -1,14 +0,0 @@
-LOCAL_PATH:= $(call my-dir)
-include $(CLEAR_VARS)
-
-LOCAL_MODULE_TAGS := tests
-
-LOCAL_SRC_FILES := $(call all-subdir-java-files)
-
-LOCAL_PACKAGE_NAME := AccessibilityEventsLogger
-LOCAL_SDK_VERSION := current
-LOCAL_CERTIFICATE := platform
-
-LOCAL_PROGUARD_ENABLED := disabled
-
-include $(BUILD_PACKAGE)
diff --git a/tests/AccessoryDisplay/Android.mk b/tests/AccessoryDisplay/Android.mk
deleted file mode 100644
index 85cb309..0000000
--- a/tests/AccessoryDisplay/Android.mk
+++ /dev/null
@@ -1,17 +0,0 @@
-# Copyright (C) 2013 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.
-
-LOCAL_PATH := $(call my-dir)
-
-include $(call all-makefiles-under,$(LOCAL_PATH))
diff --git a/tests/AccessoryDisplay/common/Android.bp b/tests/AccessoryDisplay/common/Android.bp
new file mode 100644
index 0000000..3ce4c57
--- /dev/null
+++ b/tests/AccessoryDisplay/common/Android.bp
@@ -0,0 +1,20 @@
+// Copyright (C) 2013 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.
+
+// Build the application.
+java_library_static {
+    name: "AccessoryDisplayCommon",
+    sdk_version: "current",
+    srcs: ["src/**/*.java"],
+}
diff --git a/tests/AccessoryDisplay/common/Android.mk b/tests/AccessoryDisplay/common/Android.mk
deleted file mode 100644
index 2d4de15..0000000
--- a/tests/AccessoryDisplay/common/Android.mk
+++ /dev/null
@@ -1,23 +0,0 @@
-# Copyright (C) 2013 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.
-
-LOCAL_PATH := $(call my-dir)
-
-# Build the application.
-include $(CLEAR_VARS)
-LOCAL_MODULE := AccessoryDisplayCommon
-LOCAL_MODULE_TAGS := tests
-LOCAL_SDK_VERSION := current
-LOCAL_SRC_FILES := $(call all-java-files-under, src)
-include $(BUILD_STATIC_JAVA_LIBRARY)
diff --git a/tests/AccessoryDisplay/sink/Android.bp b/tests/AccessoryDisplay/sink/Android.bp
new file mode 100644
index 0000000..4e50a81
--- /dev/null
+++ b/tests/AccessoryDisplay/sink/Android.bp
@@ -0,0 +1,22 @@
+// Copyright (C) 2013 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.
+
+// Build the application.
+android_test {
+    name: "AccessoryDisplaySink",
+    sdk_version: "current",
+    srcs: ["src/**/*.java"],
+    resource_dirs: ["res"],
+    static_libs: ["AccessoryDisplayCommon"],
+}
diff --git a/tests/AccessoryDisplay/sink/Android.mk b/tests/AccessoryDisplay/sink/Android.mk
deleted file mode 100644
index 772ce0c..0000000
--- a/tests/AccessoryDisplay/sink/Android.mk
+++ /dev/null
@@ -1,25 +0,0 @@
-# Copyright (C) 2013 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.
-
-LOCAL_PATH := $(call my-dir)
-
-# Build the application.
-include $(CLEAR_VARS)
-LOCAL_PACKAGE_NAME := AccessoryDisplaySink
-LOCAL_MODULE_TAGS := tests
-LOCAL_SDK_VERSION := current
-LOCAL_SRC_FILES := $(call all-java-files-under, src)
-LOCAL_RESOURCE_DIR = $(LOCAL_PATH)/res
-LOCAL_STATIC_JAVA_LIBRARIES := AccessoryDisplayCommon
-include $(BUILD_PACKAGE)
diff --git a/tests/AccessoryDisplay/source/Android.bp b/tests/AccessoryDisplay/source/Android.bp
new file mode 100644
index 0000000..6d8087f
--- /dev/null
+++ b/tests/AccessoryDisplay/source/Android.bp
@@ -0,0 +1,22 @@
+// Copyright (C) 2013 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.
+
+// Build the application.
+android_test {
+    name: "AccessoryDisplaySource",
+    sdk_version: "current",
+    srcs: ["src/**/*.java"],
+    resource_dirs: ["res"],
+    static_libs: ["AccessoryDisplayCommon"],
+}
diff --git a/tests/AccessoryDisplay/source/Android.mk b/tests/AccessoryDisplay/source/Android.mk
deleted file mode 100644
index 5d1085d..0000000
--- a/tests/AccessoryDisplay/source/Android.mk
+++ /dev/null
@@ -1,25 +0,0 @@
-# Copyright (C) 2013 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.
-
-LOCAL_PATH := $(call my-dir)
-
-# Build the application.
-include $(CLEAR_VARS)
-LOCAL_PACKAGE_NAME := AccessoryDisplaySource
-LOCAL_MODULE_TAGS := tests
-LOCAL_SDK_VERSION := current
-LOCAL_SRC_FILES := $(call all-java-files-under, src)
-LOCAL_RESOURCE_DIR = $(LOCAL_PATH)/res
-LOCAL_STATIC_JAVA_LIBRARIES := AccessoryDisplayCommon
-include $(BUILD_PACKAGE)
diff --git a/tests/ActivityManagerPerfTests/tests/Android.mk b/tests/ActivityManagerPerfTests/tests/Android.mk
index f23a665..e1f56b8 100644
--- a/tests/ActivityManagerPerfTests/tests/Android.mk
+++ b/tests/ActivityManagerPerfTests/tests/Android.mk
@@ -21,7 +21,7 @@
     $(call all-java-files-under, src)
 
 LOCAL_STATIC_JAVA_LIBRARIES := \
-    android-support-test \
+    androidx.test.rules \
     apct-perftests-utils \
     ActivityManagerPerfTestsUtils
 
diff --git a/tests/ActivityManagerPerfTests/tests/AndroidManifest.xml b/tests/ActivityManagerPerfTests/tests/AndroidManifest.xml
index a1ab33a..04aef47 100644
--- a/tests/ActivityManagerPerfTests/tests/AndroidManifest.xml
+++ b/tests/ActivityManagerPerfTests/tests/AndroidManifest.xml
@@ -25,6 +25,6 @@
         <uses-library android:name="android.test.runner" />
     </application>
 
-    <instrumentation android:name="android.support.test.runner.AndroidJUnitRunner"
+    <instrumentation android:name="androidx.test.runner.AndroidJUnitRunner"
                      android:targetPackage="com.android.frameworks.perftests.amtests"/>
 </manifest>
diff --git a/tests/ActivityManagerPerfTests/tests/AndroidTest.xml b/tests/ActivityManagerPerfTests/tests/AndroidTest.xml
index ffb5404..76c40b2 100644
--- a/tests/ActivityManagerPerfTests/tests/AndroidTest.xml
+++ b/tests/ActivityManagerPerfTests/tests/AndroidTest.xml
@@ -24,6 +24,6 @@
     <option name="test-tag" value="ActivityManagerPerfTests"/>
     <test class="com.android.tradefed.testtype.AndroidJUnitTest">
         <option name="package" value="com.android.frameworks.perftests.amtests"/>
-        <option name="runner" value="android.support.test.runner.AndroidJUnitRunner"/>
+        <option name="runner" value="androidx.test.runner.AndroidJUnitRunner"/>
     </test>
 </configuration>
\ No newline at end of file
diff --git a/tests/ActivityManagerPerfTests/tests/src/com/android/frameworks/perftests/am/tests/BasePerfTest.java b/tests/ActivityManagerPerfTests/tests/src/com/android/frameworks/perftests/am/tests/BasePerfTest.java
index 58fb136..daff76f 100644
--- a/tests/ActivityManagerPerfTests/tests/src/com/android/frameworks/perftests/am/tests/BasePerfTest.java
+++ b/tests/ActivityManagerPerfTests/tests/src/com/android/frameworks/perftests/am/tests/BasePerfTest.java
@@ -21,7 +21,8 @@
 import android.content.ServiceConnection;
 import android.perftests.utils.ManualBenchmarkState;
 import android.perftests.utils.PerfManualStatusReporter;
-import android.support.test.InstrumentationRegistry;
+
+import androidx.test.InstrumentationRegistry;
 
 import com.android.frameworks.perftests.am.util.TargetPackageUtils;
 import com.android.frameworks.perftests.am.util.TimeReceiver;
diff --git a/tests/ActivityManagerPerfTests/tests/src/com/android/frameworks/perftests/am/tests/BroadcastPerfTest.java b/tests/ActivityManagerPerfTests/tests/src/com/android/frameworks/perftests/am/tests/BroadcastPerfTest.java
index f7dab03..bc528d4 100644
--- a/tests/ActivityManagerPerfTests/tests/src/com/android/frameworks/perftests/am/tests/BroadcastPerfTest.java
+++ b/tests/ActivityManagerPerfTests/tests/src/com/android/frameworks/perftests/am/tests/BroadcastPerfTest.java
@@ -17,8 +17,9 @@
 package com.android.frameworks.perftests.am.tests;
 
 import android.content.Intent;
-import android.support.test.filters.LargeTest;
-import android.support.test.runner.AndroidJUnit4;
+
+import androidx.test.filters.LargeTest;
+import androidx.test.runner.AndroidJUnit4;
 
 import com.android.frameworks.perftests.am.util.Constants;
 
diff --git a/tests/ActivityManagerPerfTests/tests/src/com/android/frameworks/perftests/am/tests/ContentProviderPerfTest.java b/tests/ActivityManagerPerfTests/tests/src/com/android/frameworks/perftests/am/tests/ContentProviderPerfTest.java
index 3bf56ce..8e82219 100644
--- a/tests/ActivityManagerPerfTests/tests/src/com/android/frameworks/perftests/am/tests/ContentProviderPerfTest.java
+++ b/tests/ActivityManagerPerfTests/tests/src/com/android/frameworks/perftests/am/tests/ContentProviderPerfTest.java
@@ -17,8 +17,9 @@
 package com.android.frameworks.perftests.am.tests;
 
 import android.content.ContentProviderClient;
-import android.support.test.filters.LargeTest;
-import android.support.test.runner.AndroidJUnit4;
+
+import androidx.test.filters.LargeTest;
+import androidx.test.runner.AndroidJUnit4;
 
 import com.android.frameworks.perftests.am.util.TargetPackageUtils;
 
diff --git a/tests/ActivityManagerPerfTests/tests/src/com/android/frameworks/perftests/am/tests/ServiceBindPerfTest.java b/tests/ActivityManagerPerfTests/tests/src/com/android/frameworks/perftests/am/tests/ServiceBindPerfTest.java
index e1263db..996c5a5 100644
--- a/tests/ActivityManagerPerfTests/tests/src/com/android/frameworks/perftests/am/tests/ServiceBindPerfTest.java
+++ b/tests/ActivityManagerPerfTests/tests/src/com/android/frameworks/perftests/am/tests/ServiceBindPerfTest.java
@@ -21,8 +21,9 @@
 import android.content.Intent;
 import android.content.ServiceConnection;
 import android.os.IBinder;
-import android.support.test.filters.LargeTest;
-import android.support.test.runner.AndroidJUnit4;
+
+import androidx.test.filters.LargeTest;
+import androidx.test.runner.AndroidJUnit4;
 
 import com.android.frameworks.perftests.am.util.Constants;
 import com.android.frameworks.perftests.am.util.TargetPackageUtils;
diff --git a/tests/ActivityManagerPerfTests/tests/src/com/android/frameworks/perftests/am/tests/ServiceStartPerfTest.java b/tests/ActivityManagerPerfTests/tests/src/com/android/frameworks/perftests/am/tests/ServiceStartPerfTest.java
index f05f323..ba20640 100644
--- a/tests/ActivityManagerPerfTests/tests/src/com/android/frameworks/perftests/am/tests/ServiceStartPerfTest.java
+++ b/tests/ActivityManagerPerfTests/tests/src/com/android/frameworks/perftests/am/tests/ServiceStartPerfTest.java
@@ -19,8 +19,9 @@
 import android.content.ComponentName;
 import android.content.Intent;
 import android.content.ServiceConnection;
-import android.support.test.filters.LargeTest;
-import android.support.test.runner.AndroidJUnit4;
+
+import androidx.test.filters.LargeTest;
+import androidx.test.runner.AndroidJUnit4;
 
 import com.android.frameworks.perftests.am.util.Constants;
 import com.android.frameworks.perftests.am.util.TargetPackageUtils;
diff --git a/tests/ActivityManagerPerfTests/utils/Android.mk b/tests/ActivityManagerPerfTests/utils/Android.mk
index 60c9423..7a7471d 100644
--- a/tests/ActivityManagerPerfTests/utils/Android.mk
+++ b/tests/ActivityManagerPerfTests/utils/Android.mk
@@ -23,7 +23,7 @@
     src/com/android/frameworks/perftests/am/util/ITimeReceiverCallback.aidl
 
 LOCAL_STATIC_JAVA_LIBRARIES := \
-    android-support-test \
+    androidx.test.rules \
     junit \
     ub-uiautomator
 
diff --git a/tests/ActivityManagerPerfTests/utils/src/com/android/frameworks/perftests/am/util/Utils.java b/tests/ActivityManagerPerfTests/utils/src/com/android/frameworks/perftests/am/util/Utils.java
index 67071d2..fc787ba 100644
--- a/tests/ActivityManagerPerfTests/utils/src/com/android/frameworks/perftests/am/util/Utils.java
+++ b/tests/ActivityManagerPerfTests/utils/src/com/android/frameworks/perftests/am/util/Utils.java
@@ -19,10 +19,11 @@
 import android.content.Intent;
 import android.os.RemoteException;
 import android.os.ResultReceiver;
-import android.support.test.InstrumentationRegistry;
 import android.support.test.uiautomator.UiDevice;
 import android.util.Log;
 
+import androidx.test.InstrumentationRegistry;
+
 import java.io.IOException;
 
 public class Utils {
diff --git a/tests/ActivityTests/Android.bp b/tests/ActivityTests/Android.bp
new file mode 100644
index 0000000..0182862
--- /dev/null
+++ b/tests/ActivityTests/Android.bp
@@ -0,0 +1,6 @@
+android_test {
+    name: "ActivityTest",
+    srcs: ["**/*.java"],
+    platform_apis: true,
+    certificate: "platform",
+}
diff --git a/tests/ActivityTests/Android.mk b/tests/ActivityTests/Android.mk
deleted file mode 100644
index 94294f6..0000000
--- a/tests/ActivityTests/Android.mk
+++ /dev/null
@@ -1,14 +0,0 @@
-LOCAL_PATH:= $(call my-dir)
-include $(CLEAR_VARS)
-
-LOCAL_SRC_FILES := $(call all-subdir-java-files)
-
-LOCAL_PACKAGE_NAME := ActivityTest
-LOCAL_PRIVATE_PLATFORM_APIS := true
-
-LOCAL_MODULE_TAGS := tests
-LOCAL_CERTIFICATE := platform
-
-LOCAL_USE_AAPT2 := true
-
-include $(BUILD_PACKAGE)
diff --git a/tests/AmSlam/Android.bp b/tests/AmSlam/Android.bp
new file mode 100644
index 0000000..a8e575a
--- /dev/null
+++ b/tests/AmSlam/Android.bp
@@ -0,0 +1,23 @@
+//
+// Copyright (C) 2016 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.
+//
+
+android_test {
+    name: "AmSlam",
+    srcs: ["**/*.java"],
+    sdk_version: "current",
+    min_sdk_version: "21",
+    java_version: "1.8",
+}
diff --git a/tests/AmSlam/Android.mk b/tests/AmSlam/Android.mk
deleted file mode 100644
index 934bae0..0000000
--- a/tests/AmSlam/Android.mk
+++ /dev/null
@@ -1,30 +0,0 @@
-#
-# Copyright (C) 2016 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.
-#
-
-LOCAL_PATH:= $(call my-dir)
-include $(CLEAR_VARS)
-
-LOCAL_SRC_FILES := $(call all-subdir-java-files)
-
-LOCAL_PACKAGE_NAME := AmSlam
-
-LOCAL_SDK_VERSION := current
-LOCAL_MIN_SDK_VERSION := 21
-LOCAL_JAVA_LANGUAGE_VERSION := 1.8
-
-LOCAL_MODULE_TAGS := tests
-
-include $(BUILD_PACKAGE)
diff --git a/tests/AppLaunch/Android.mk b/tests/AppLaunch/Android.mk
index 1fb548b..f50bca5 100644
--- a/tests/AppLaunch/Android.mk
+++ b/tests/AppLaunch/Android.mk
@@ -12,7 +12,7 @@
 LOCAL_CERTIFICATE := platform
 LOCAL_JAVA_LIBRARIES := android.test.base android.test.runner
 
-LOCAL_STATIC_JAVA_LIBRARIES := android-support-test
+LOCAL_STATIC_JAVA_LIBRARIES := androidx.test.rules
 
 LOCAL_COMPATIBILITY_SUITE := device-tests
 
diff --git a/tests/AppLaunch/src/com/android/tests/applaunch/AppLaunch.java b/tests/AppLaunch/src/com/android/tests/applaunch/AppLaunch.java
index 5ea8ff1..9d7319f 100644
--- a/tests/AppLaunch/src/com/android/tests/applaunch/AppLaunch.java
+++ b/tests/AppLaunch/src/com/android/tests/applaunch/AppLaunch.java
@@ -30,11 +30,12 @@
 import android.os.ParcelFileDescriptor;
 import android.os.RemoteException;
 import android.os.UserHandle;
-import android.support.test.rule.logging.AtraceLogger;
 import android.test.InstrumentationTestCase;
 import android.test.InstrumentationTestRunner;
 import android.util.Log;
 
+import androidx.test.rule.logging.AtraceLogger;
+
 import java.io.BufferedReader;
 import java.io.BufferedWriter;
 import java.io.File;
@@ -51,6 +52,7 @@
 import java.util.List;
 import java.util.Map;
 import java.util.Set;
+
 /**
  * This test is intended to measure the time it takes for the apps to start.
  * Names of the applications are passed in command line, and the
diff --git a/tests/AppLaunchWear/Android.mk b/tests/AppLaunchWear/Android.mk
index 6d08366..332b680 100644
--- a/tests/AppLaunchWear/Android.mk
+++ b/tests/AppLaunchWear/Android.mk
@@ -12,7 +12,7 @@
 LOCAL_CERTIFICATE := platform
 LOCAL_JAVA_LIBRARIES := android.test.base android.test.runner
 
-LOCAL_STATIC_JAVA_LIBRARIES := android-support-test
+LOCAL_STATIC_JAVA_LIBRARIES := androidx.test.rules
 
 LOCAL_COMPATIBILITY_SUITE := device-tests
 
diff --git a/tests/AppLaunchWear/src/com/android/tests/applaunch/AppLaunch.java b/tests/AppLaunchWear/src/com/android/tests/applaunch/AppLaunch.java
index d36d84e..97701c6 100644
--- a/tests/AppLaunchWear/src/com/android/tests/applaunch/AppLaunch.java
+++ b/tests/AppLaunchWear/src/com/android/tests/applaunch/AppLaunch.java
@@ -30,16 +30,16 @@
 import android.os.ParcelFileDescriptor;
 import android.os.RemoteException;
 import android.os.UserHandle;
-import android.support.test.rule.logging.AtraceLogger;
 import android.test.InstrumentationTestCase;
 import android.test.InstrumentationTestRunner;
 import android.util.Log;
 
+import androidx.test.rule.logging.AtraceLogger;
+
 import java.io.BufferedReader;
 import java.io.BufferedWriter;
 import java.io.File;
 import java.io.FileInputStream;
-import java.io.FileNotFoundException;
 import java.io.FileOutputStream;
 import java.io.IOException;
 import java.io.InputStream;
@@ -52,6 +52,7 @@
 import java.util.List;
 import java.util.Map;
 import java.util.Set;
+
 /**
  * This test is intended to measure the time it takes for the apps to start.
  * Names of the applications are passed in command line, and the
diff --git a/tests/Assist/Android.bp b/tests/Assist/Android.bp
new file mode 100644
index 0000000..216e751
--- /dev/null
+++ b/tests/Assist/Android.bp
@@ -0,0 +1,5 @@
+android_test {
+    name: "Assist",
+    srcs: ["**/*.java"],
+    platform_apis: true,
+}
diff --git a/tests/Assist/Android.mk b/tests/Assist/Android.mk
deleted file mode 100644
index d0d3eca..0000000
--- a/tests/Assist/Android.mk
+++ /dev/null
@@ -1,11 +0,0 @@
-LOCAL_PATH:= $(call my-dir)
-include $(CLEAR_VARS)
-
-LOCAL_MODULE_TAGS := tests
-
-LOCAL_SRC_FILES := $(call all-subdir-java-files)
-
-LOCAL_PACKAGE_NAME := Assist
-LOCAL_PRIVATE_PLATFORM_APIS := true
-
-include $(BUILD_PACKAGE)
diff --git a/tests/BackgroundDexOptServiceIntegrationTests/Android.mk b/tests/BackgroundDexOptServiceIntegrationTests/Android.mk
index b10305d..f47cf96 100644
--- a/tests/BackgroundDexOptServiceIntegrationTests/Android.mk
+++ b/tests/BackgroundDexOptServiceIntegrationTests/Android.mk
@@ -24,7 +24,7 @@
 LOCAL_SRC_FILES := $(call all-java-files-under, src)
 
 LOCAL_STATIC_JAVA_LIBRARIES := \
-    android-support-test \
+    androidx.test.rules \
 
 LOCAL_PACKAGE_NAME := BackgroundDexOptServiceIntegrationTests
 LOCAL_PRIVATE_PLATFORM_APIS := true
diff --git a/tests/BackgroundDexOptServiceIntegrationTests/AndroidManifest.xml b/tests/BackgroundDexOptServiceIntegrationTests/AndroidManifest.xml
index afae155..aec9f77 100644
--- a/tests/BackgroundDexOptServiceIntegrationTests/AndroidManifest.xml
+++ b/tests/BackgroundDexOptServiceIntegrationTests/AndroidManifest.xml
@@ -34,7 +34,7 @@
     </application>
 
     <instrumentation
-        android:name="android.support.test.runner.AndroidJUnitRunner"
+        android:name="androidx.test.runner.AndroidJUnitRunner"
         android:targetPackage="com.android.frameworks.bgdexopttest"
         android:label="Integration test for BackgroundDexOptService" />
 </manifest>
diff --git a/tests/BackgroundDexOptServiceIntegrationTests/AndroidTest.xml b/tests/BackgroundDexOptServiceIntegrationTests/AndroidTest.xml
index 9bb1e28..a532422 100644
--- a/tests/BackgroundDexOptServiceIntegrationTests/AndroidTest.xml
+++ b/tests/BackgroundDexOptServiceIntegrationTests/AndroidTest.xml
@@ -50,6 +50,6 @@
     <option name="test-tag" value="BackgroundDexOptServiceIntegrationTests"/>
     <test class="com.android.tradefed.testtype.AndroidJUnitTest">
         <option name="package" value="com.android.frameworks.bgdexopttest"/>
-        <option name="runner" value="android.support.test.runner.AndroidJUnitRunner"/>
+        <option name="runner" value="androidx.test.runner.AndroidJUnitRunner"/>
     </test>
 </configuration>
diff --git a/tests/BackgroundDexOptServiceIntegrationTests/src/com/android/server/pm/BackgroundDexOptServiceIntegrationTests.java b/tests/BackgroundDexOptServiceIntegrationTests/src/com/android/server/pm/BackgroundDexOptServiceIntegrationTests.java
index fd20f4a..7d826f7 100644
--- a/tests/BackgroundDexOptServiceIntegrationTests/src/com/android/server/pm/BackgroundDexOptServiceIntegrationTests.java
+++ b/tests/BackgroundDexOptServiceIntegrationTests/src/com/android/server/pm/BackgroundDexOptServiceIntegrationTests.java
@@ -17,17 +17,16 @@
 package com.android.server.pm;
 
 import android.app.AlarmManager;
-import android.app.UiAutomation;
 import android.content.Context;
 import android.os.Environment;
 import android.os.ParcelFileDescriptor;
 import android.os.SystemProperties;
 import android.os.storage.StorageManager;
-import android.support.test.InstrumentationRegistry;
 import android.util.Log;
 
+import androidx.test.InstrumentationRegistry;
+
 import org.junit.After;
-import org.junit.AfterClass;
 import org.junit.Assert;
 import org.junit.Before;
 import org.junit.BeforeClass;
diff --git a/tests/BandwidthTests/Android.bp b/tests/BandwidthTests/Android.bp
new file mode 100644
index 0000000..523f522
--- /dev/null
+++ b/tests/BandwidthTests/Android.bp
@@ -0,0 +1,21 @@
+//
+// Copyright (C) 2011 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.
+//
+
+android_test {
+    name: "BandwidthEnforcementTest",
+    platform_apis: true,
+    srcs: ["src/**/*.java"],
+}
diff --git a/tests/BandwidthTests/Android.mk b/tests/BandwidthTests/Android.mk
deleted file mode 100644
index d00fdc6..0000000
--- a/tests/BandwidthTests/Android.mk
+++ /dev/null
@@ -1,25 +0,0 @@
-#
-# Copyright (C) 2011 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.
-#
-LOCAL_PATH := $(call my-dir)
-include $(CLEAR_VARS)
-
-LOCAL_MODULE_TAGS := tests
-
-LOCAL_PACKAGE_NAME := BandwidthEnforcementTest
-LOCAL_PRIVATE_PLATFORM_APIS := true
-LOCAL_SRC_FILES := $(call all-java-files-under, src)
-
-include $(BUILD_PACKAGE)
diff --git a/tests/BatteryWaster/Android.bp b/tests/BatteryWaster/Android.bp
new file mode 100644
index 0000000..4698910
--- /dev/null
+++ b/tests/BatteryWaster/Android.bp
@@ -0,0 +1,6 @@
+android_test {
+    name: "BatteryWaster",
+    srcs: ["**/*.java"],
+    sdk_version: "current",
+    certificate: "platform",
+}
diff --git a/tests/BatteryWaster/Android.mk b/tests/BatteryWaster/Android.mk
deleted file mode 100644
index fb244a8..0000000
--- a/tests/BatteryWaster/Android.mk
+++ /dev/null
@@ -1,12 +0,0 @@
-LOCAL_PATH:= $(call my-dir)
-include $(CLEAR_VARS)
-
-LOCAL_MODULE_TAGS := tests
-
-LOCAL_SRC_FILES := $(call all-subdir-java-files)
-
-LOCAL_PACKAGE_NAME := BatteryWaster
-LOCAL_SDK_VERSION := current
-LOCAL_CERTIFICATE := platform
-
-include $(BUILD_PACKAGE)
diff --git a/tests/BiDiTests/Android.bp b/tests/BiDiTests/Android.bp
new file mode 100644
index 0000000..c659e8c
--- /dev/null
+++ b/tests/BiDiTests/Android.bp
@@ -0,0 +1,23 @@
+// Copyright (C) 2011 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.
+
+android_test {
+    name: "BiDiTests",
+    // Only compile source java files in this apk.
+    srcs: ["src/**/*.java"],
+    sdk_version: "current",
+    optimize: {
+        proguard_flags_files: ["proguard.flags"],
+    },
+}
diff --git a/tests/BiDiTests/Android.mk b/tests/BiDiTests/Android.mk
deleted file mode 100644
index 78cf4be..0000000
--- a/tests/BiDiTests/Android.mk
+++ /dev/null
@@ -1,28 +0,0 @@
-# Copyright (C) 2011 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.
-
-LOCAL_PATH:= $(call my-dir)
-include $(CLEAR_VARS)
-
-LOCAL_MODULE_TAGS := tests
-
-# Only compile source java files in this apk.
-LOCAL_SRC_FILES := $(call all-java-files-under, src)
-
-LOCAL_PACKAGE_NAME := BiDiTests
-LOCAL_SDK_VERSION := current
-
-LOCAL_PROGUARD_FLAG_FILES := proguard.flags
-
-include $(BUILD_PACKAGE)
\ No newline at end of file
diff --git a/tests/BrowserPowerTest/Android.bp b/tests/BrowserPowerTest/Android.bp
new file mode 100644
index 0000000..1d358cb
--- /dev/null
+++ b/tests/BrowserPowerTest/Android.bp
@@ -0,0 +1,26 @@
+// Copyright 2008, 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.
+
+android_test {
+    name: "BrowserPowerTests",
+    libs: [
+        "android.test.runner",
+        "android.test.base",
+    ],
+    static_libs: ["junit"],
+    // Include all test java files.
+    srcs: ["src/**/*.java"],
+    platform_apis: true,
+    //LOCAL_INSTRUMENTATION_FOR := browserpowertest
+}
diff --git a/tests/BrowserPowerTest/Android.mk b/tests/BrowserPowerTest/Android.mk
deleted file mode 100644
index 0934889..0000000
--- a/tests/BrowserPowerTest/Android.mk
+++ /dev/null
@@ -1,32 +0,0 @@
-# Copyright 2008, 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.
-
-LOCAL_PATH:= $(call my-dir)
-include $(CLEAR_VARS)
-
-# We only want this apk build for tests.
-LOCAL_MODULE_TAGS := tests
-
-LOCAL_JAVA_LIBRARIES := android.test.runner android.test.base
-LOCAL_STATIC_JAVA_LIBRARIES := junit
-
-# Include all test java files.
-LOCAL_SRC_FILES := $(call all-java-files-under, src)
-
-LOCAL_PACKAGE_NAME := BrowserPowerTests
-LOCAL_PRIVATE_PLATFORM_APIS := true
-
-#LOCAL_INSTRUMENTATION_FOR := browserpowertest
-
-include $(BUILD_PACKAGE)
diff --git a/tests/Camera2Tests/Android.mk b/tests/Camera2Tests/Android.mk
deleted file mode 100644
index 5053e7d..0000000
--- a/tests/Camera2Tests/Android.mk
+++ /dev/null
@@ -1 +0,0 @@
-include $(call all-subdir-makefiles)
diff --git a/tests/Camera2Tests/CameraToo/tests/Android.mk b/tests/Camera2Tests/CameraToo/tests/Android.mk
index eb8f6c3..fe4dc42 100644
--- a/tests/Camera2Tests/CameraToo/tests/Android.mk
+++ b/tests/Camera2Tests/CameraToo/tests/Android.mk
@@ -20,6 +20,6 @@
 LOCAL_INSTRUMENTATION_FOR := CameraToo
 LOCAL_SDK_VERSION := current
 LOCAL_SRC_FILES := $(call all-java-files-under,src)
-LOCAL_STATIC_JAVA_LIBRARIES := android-support-test mockito-target-minus-junit4
+LOCAL_STATIC_JAVA_LIBRARIES := androidx.test.rules mockito-target-minus-junit4
 
 include $(BUILD_PACKAGE)
diff --git a/tests/Camera2Tests/CameraToo/tests/AndroidManifest.xml b/tests/Camera2Tests/CameraToo/tests/AndroidManifest.xml
index 30210ba..8d35749 100644
--- a/tests/Camera2Tests/CameraToo/tests/AndroidManifest.xml
+++ b/tests/Camera2Tests/CameraToo/tests/AndroidManifest.xml
@@ -23,7 +23,7 @@
     <application android:label="CameraToo">
         <uses-library android:name="android.test.runner" />
     </application>
-    <instrumentation android:name="android.support.test.runner.AndroidJUnitRunner"
+    <instrumentation android:name="androidx.test.runner.AndroidJUnitRunner"
         android:targetPackage="com.example.android.camera2.cameratoo"
         android:label="CameraToo tests" />
 </manifest>
diff --git a/tests/Camera2Tests/SmartCamera/Android.mk b/tests/Camera2Tests/SmartCamera/Android.mk
deleted file mode 100644
index 3fa8f54..0000000
--- a/tests/Camera2Tests/SmartCamera/Android.mk
+++ /dev/null
@@ -1,14 +0,0 @@
-# Copyright 2013 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.
-include $(call all-subdir-makefiles)
diff --git a/tests/Camera2Tests/SmartCamera/SimpleCamera/jni/Android.bp b/tests/Camera2Tests/SmartCamera/SimpleCamera/jni/Android.bp
index 0b16b0e..a23ac38 100644
--- a/tests/Camera2Tests/SmartCamera/SimpleCamera/jni/Android.bp
+++ b/tests/Camera2Tests/SmartCamera/SimpleCamera/jni/Android.bp
@@ -15,9 +15,7 @@
 
 cc_test_library {
     name: "libsmartcamera_jni",
-
     sdk_version: "14",
-
     srcs: [
         "contrast.cpp",
         "brightness.cpp",
@@ -29,13 +27,11 @@
         "sobeloperator.cpp",
         "stats_scorer.cpp",
     ],
-
     cflags: [
         "-Wall",
         "-Wextra",
         "-Werror",
         "-Wno-unused-parameter",
     ],
-
     stl: "c++_static",
 }
diff --git a/tests/CameraPrewarmTest/Android.bp b/tests/CameraPrewarmTest/Android.bp
new file mode 100644
index 0000000..eaf453b
--- /dev/null
+++ b/tests/CameraPrewarmTest/Android.bp
@@ -0,0 +1,6 @@
+android_test {
+    name: "CameraPrewarmTest",
+    srcs: ["**/*.java"],
+    sdk_version: "current",
+    certificate: "platform",
+}
diff --git a/tests/CameraPrewarmTest/Android.mk b/tests/CameraPrewarmTest/Android.mk
deleted file mode 100644
index e128504..0000000
--- a/tests/CameraPrewarmTest/Android.mk
+++ /dev/null
@@ -1,12 +0,0 @@
-LOCAL_PATH:= $(call my-dir)
-include $(CLEAR_VARS)
-
-LOCAL_SRC_FILES := $(call all-subdir-java-files)
-
-LOCAL_PACKAGE_NAME := CameraPrewarmTest
-LOCAL_SDK_VERSION := current
-
-LOCAL_MODULE_TAGS := tests
-LOCAL_CERTIFICATE := platform
-
-include $(BUILD_PACKAGE)
diff --git a/tests/Compatibility/Android.mk b/tests/Compatibility/Android.mk
index 9c47a26..643f9eb 100644
--- a/tests/Compatibility/Android.mk
+++ b/tests/Compatibility/Android.mk
@@ -17,7 +17,7 @@
 
 # We only want this apk build for tests.
 LOCAL_MODULE_TAGS := tests
-LOCAL_STATIC_JAVA_LIBRARIES := android-support-test
+LOCAL_STATIC_JAVA_LIBRARIES := androidx.test.rules
 # Include all test java files.
 LOCAL_SRC_FILES := \
 	$(call all-java-files-under, src)
diff --git a/tests/Compatibility/src/com/android/compatibilitytest/AppCompatibility.java b/tests/Compatibility/src/com/android/compatibilitytest/AppCompatibility.java
index 95eb5c9..d683ec7 100644
--- a/tests/Compatibility/src/com/android/compatibilitytest/AppCompatibility.java
+++ b/tests/Compatibility/src/com/android/compatibilitytest/AppCompatibility.java
@@ -33,10 +33,11 @@
 import android.os.DropBoxManager;
 import android.os.RemoteException;
 import android.os.ServiceManager;
-import android.support.test.InstrumentationRegistry;
-import android.support.test.runner.AndroidJUnit4;
 import android.util.Log;
 
+import androidx.test.InstrumentationRegistry;
+import androidx.test.runner.AndroidJUnit4;
+
 import org.junit.After;
 import org.junit.Assert;
 import org.junit.Before;
diff --git a/tests/Compatibility/src/com/android/compatibilitytest/AppCompatibilityRunner.java b/tests/Compatibility/src/com/android/compatibilitytest/AppCompatibilityRunner.java
index b61ec34..960ea49 100644
--- a/tests/Compatibility/src/com/android/compatibilitytest/AppCompatibilityRunner.java
+++ b/tests/Compatibility/src/com/android/compatibilitytest/AppCompatibilityRunner.java
@@ -16,7 +16,7 @@
 
 package com.android.compatibilitytest;
 
-import android.support.test.runner.AndroidJUnitRunner;
+import androidx.test.runner.AndroidJUnitRunner;
 
 // empty subclass to maintain backwards compatibility on host-side harness
 public class AppCompatibilityRunner extends AndroidJUnitRunner {}
diff --git a/tests/CoreTests/Android.mk b/tests/CoreTests/Android.mk
deleted file mode 100644
index 8338432..0000000
--- a/tests/CoreTests/Android.mk
+++ /dev/null
@@ -1,2 +0,0 @@
-include $(call all-subdir-makefiles)
-
diff --git a/tests/CoreTests/android/Android.bp b/tests/CoreTests/android/Android.bp
new file mode 100644
index 0000000..24134e8
--- /dev/null
+++ b/tests/CoreTests/android/Android.bp
@@ -0,0 +1,11 @@
+android_test {
+    name: "LegacyCoreTests",
+    srcs: ["**/*.java"],
+    libs: [
+        "android.test.runner.stubs",
+        "org.apache.http.legacy",
+        "android.test.base.stubs",
+    ],
+    sdk_version: "current",
+    static_libs: ["junit"],
+}
diff --git a/tests/CoreTests/android/Android.mk b/tests/CoreTests/android/Android.mk
deleted file mode 100644
index 04f6739..0000000
--- a/tests/CoreTests/android/Android.mk
+++ /dev/null
@@ -1,20 +0,0 @@
-LOCAL_PATH:= $(call my-dir)
-include $(CLEAR_VARS)
-
-LOCAL_MODULE_TAGS := tests
-
-LOCAL_SRC_FILES := \
-	$(call all-subdir-java-files)
-
-LOCAL_JAVA_LIBRARIES := \
-    android.test.runner.stubs \
-    org.apache.http.legacy \
-    android.test.base.stubs \
-
-LOCAL_SDK_VERSION := current
-
-LOCAL_STATIC_JAVA_LIBRARIES := junit
-
-LOCAL_PACKAGE_NAME := LegacyCoreTests
-
-include $(BUILD_PACKAGE)
diff --git a/tests/DataIdleTest/Android.bp b/tests/DataIdleTest/Android.bp
new file mode 100644
index 0000000..19656ce
--- /dev/null
+++ b/tests/DataIdleTest/Android.bp
@@ -0,0 +1,28 @@
+//
+// Copyright (C) 2011 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.
+//
+
+android_test {
+    name: "DataIdleTest",
+    platform_apis: true,
+    libs: [
+        "android.test.runner",
+        "android.test.base",
+    ],
+    static_libs: ["junit"],
+    srcs: ["src/**/*.java"],
+    // We need to sign it to get access to the network usage history.
+    certificate: "platform",
+}
diff --git a/tests/DataIdleTest/Android.mk b/tests/DataIdleTest/Android.mk
deleted file mode 100644
index bcf3599..0000000
--- a/tests/DataIdleTest/Android.mk
+++ /dev/null
@@ -1,31 +0,0 @@
-#
-# Copyright (C) 2011 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.
-#
-LOCAL_PATH := $(call my-dir)
-include $(CLEAR_VARS)
-
-# We only want this apk build for tests.
-LOCAL_MODULE_TAGS := tests
-
-LOCAL_PACKAGE_NAME := DataIdleTest
-LOCAL_PRIVATE_PLATFORM_APIS := true
-LOCAL_JAVA_LIBRARIES := android.test.runner android.test.base
-LOCAL_STATIC_JAVA_LIBRARIES := junit
-LOCAL_SRC_FILES := $(call all-java-files-under, src)
-
-# We need to sign it to get access to the network usage history.
-LOCAL_CERTIFICATE := platform
-
-include $(BUILD_PACKAGE)
diff --git a/tests/DozeTest/Android.bp b/tests/DozeTest/Android.bp
new file mode 100644
index 0000000..f1be029
--- /dev/null
+++ b/tests/DozeTest/Android.bp
@@ -0,0 +1,6 @@
+android_app {
+    name: "DozeTest",
+    // Only compile source java files in this apk.
+    srcs: ["src/**/*.java"],
+    platform_apis: true,
+}
diff --git a/tests/DozeTest/Android.mk b/tests/DozeTest/Android.mk
deleted file mode 100644
index ec250ff..0000000
--- a/tests/DozeTest/Android.mk
+++ /dev/null
@@ -1,15 +0,0 @@
-LOCAL_PATH:= $(call my-dir)
-include $(CLEAR_VARS)
-
-LOCAL_MODULE_TAGS := optional
-
-# Only compile source java files in this apk.
-LOCAL_SRC_FILES := $(call all-java-files-under, src)
-
-LOCAL_PACKAGE_NAME := DozeTest
-LOCAL_PRIVATE_PLATFORM_APIS := true
-
-include $(BUILD_PACKAGE)
-
-# Use the following include to make our test apk.
-include $(call all-makefiles-under,$(LOCAL_PATH))
diff --git a/tests/DpiTest/Android.bp b/tests/DpiTest/Android.bp
new file mode 100644
index 0000000..7d6a78b
--- /dev/null
+++ b/tests/DpiTest/Android.bp
@@ -0,0 +1,9 @@
+android_test {
+    name: "DensityTest",
+    srcs: ["**/*.java"],
+    platform_apis: true,
+    aaptflags: [
+        "-c",
+        "120dpi,240dpi,160dpi,nodpi",
+    ],
+}
diff --git a/tests/DpiTest/Android.mk b/tests/DpiTest/Android.mk
deleted file mode 100644
index e69d082..0000000
--- a/tests/DpiTest/Android.mk
+++ /dev/null
@@ -1,13 +0,0 @@
-LOCAL_PATH:= $(call my-dir)
-include $(CLEAR_VARS)
-
-LOCAL_SRC_FILES := $(call all-subdir-java-files)
-
-LOCAL_PACKAGE_NAME := DensityTest
-LOCAL_PRIVATE_PLATFORM_APIS := true
-
-LOCAL_MODULE_TAGS := tests
-
-LOCAL_AAPT_FLAGS = -c 120dpi,240dpi,160dpi,nodpi
-
-include $(BUILD_PACKAGE)
diff --git a/tests/DynamicCodeLoggerIntegrationTests/Android.mk b/tests/DynamicCodeLoggerIntegrationTests/Android.mk
index f324eb1..62c1ba8 100644
--- a/tests/DynamicCodeLoggerIntegrationTests/Android.mk
+++ b/tests/DynamicCodeLoggerIntegrationTests/Android.mk
@@ -67,7 +67,7 @@
 LOCAL_SRC_FILES := $(call all-java-files-under, src/com/android/server/pm)
 
 LOCAL_STATIC_JAVA_LIBRARIES := \
-    android-support-test \
+    androidx.test.rules \
     truth-prebuilt \
 
 # Include both versions of the .so if we have 2 arch
diff --git a/tests/DynamicCodeLoggerIntegrationTests/AndroidManifest.xml b/tests/DynamicCodeLoggerIntegrationTests/AndroidManifest.xml
index 4327da2..08fac30 100644
--- a/tests/DynamicCodeLoggerIntegrationTests/AndroidManifest.xml
+++ b/tests/DynamicCodeLoggerIntegrationTests/AndroidManifest.xml
@@ -29,7 +29,7 @@
     </application>
 
     <instrumentation
-        android:name="android.support.test.runner.AndroidJUnitRunner"
+        android:name="androidx.test.runner.AndroidJUnitRunner"
         android:targetPackage="com.android.frameworks.dynamiccodeloggertest"
         android:label="Integration test for DynamicCodeLogger" />
 </manifest>
diff --git a/tests/DynamicCodeLoggerIntegrationTests/AndroidTest.xml b/tests/DynamicCodeLoggerIntegrationTests/AndroidTest.xml
index f70b9c8..f8a1ec9 100644
--- a/tests/DynamicCodeLoggerIntegrationTests/AndroidTest.xml
+++ b/tests/DynamicCodeLoggerIntegrationTests/AndroidTest.xml
@@ -24,7 +24,7 @@
 
     <test class="com.android.tradefed.testtype.AndroidJUnitTest">
         <option name="package" value="com.android.frameworks.dynamiccodeloggertest"/>
-        <option name="runner" value="android.support.test.runner.AndroidJUnitRunner"/>
+        <option name="runner" value="androidx.test.runner.AndroidJUnitRunner"/>
         <option name="hidden-api-checks" value="false"/>
     </test>
 </configuration>
diff --git a/tests/DynamicCodeLoggerIntegrationTests/src/com/android/server/pm/dex/DynamicCodeLoggerIntegrationTests.java b/tests/DynamicCodeLoggerIntegrationTests/src/com/android/server/pm/dex/DynamicCodeLoggerIntegrationTests.java
index 8ef15d8..db2f659 100644
--- a/tests/DynamicCodeLoggerIntegrationTests/src/com/android/server/pm/dex/DynamicCodeLoggerIntegrationTests.java
+++ b/tests/DynamicCodeLoggerIntegrationTests/src/com/android/server/pm/dex/DynamicCodeLoggerIntegrationTests.java
@@ -24,11 +24,12 @@
 import android.os.Build;
 import android.os.ParcelFileDescriptor;
 import android.os.SystemClock;
-import android.support.test.InstrumentationRegistry;
-import android.support.test.filters.LargeTest;
 import android.util.EventLog;
 import android.util.EventLog.Event;
 
+import androidx.test.InstrumentationRegistry;
+import androidx.test.filters.LargeTest;
+
 import dalvik.system.DexClassLoader;
 
 import org.junit.Before;
@@ -235,6 +236,34 @@
     }
 
     @Test
+    public void testGeneratesEvents_spoofed_validFile_untrustedApp() throws Exception {
+        File privateCopyFile = privateFile("spoofed2");
+
+        String expectedContentHash = copyAndHashResource(
+                "/DynamicCodeLoggerNativeExecutable", privateCopyFile);
+
+        EventLog.writeEvent(EventLog.getTagCode("auditd"),
+                "type=1400 avc: granted { execute_no_trans } "
+                        + "path=\"" + privateCopyFile + "\" "
+                        + "scontext=u:r:untrusted_app: "
+                        + "tcontext=u:object_r:app_data_file: "
+                        + "tclass=file ");
+
+        String expectedNameHash =
+                "3E57AA59249154C391316FDCF07C1D499C26A564E4D305833CCD9A98ED895AC9";
+
+        // Run the job to scan generated audit log entries
+        runDynamicCodeLoggingJob(AUDIT_WATCHING_JOB_ID);
+
+        // And then make sure we log events about it
+        long previousEventNanos = mostRecentEventTimeNanos();
+        runDynamicCodeLoggingJob(IDLE_LOGGING_JOB_ID);
+
+        assertDclLoggedSince(previousEventNanos, DCL_NATIVE_SUBTAG,
+                expectedNameHash, expectedContentHash);
+    }
+
+    @Test
     public void testGeneratesEvents_spoofed_pathTraversal() throws Exception {
         File privateDir = privateFile("x").getParentFile();
 
diff --git a/tests/FeatureSplit/base/Android.bp b/tests/FeatureSplit/base/Android.bp
new file mode 100644
index 0000000..ab25464
--- /dev/null
+++ b/tests/FeatureSplit/base/Android.bp
@@ -0,0 +1,22 @@
+//
+// Copyright (C) 2014 The Android Open Source Project
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+//      http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+//
+
+android_test_helper_app {
+    name: "FeatureSplitBase",
+    srcs: ["**/*.java"],
+    sdk_version: "current",
+    export_package_resources: true,
+}
diff --git a/tests/FeatureSplit/base/Android.mk b/tests/FeatureSplit/base/Android.mk
deleted file mode 100644
index 8646460..0000000
--- a/tests/FeatureSplit/base/Android.mk
+++ /dev/null
@@ -1,28 +0,0 @@
-#
-# Copyright (C) 2014 The Android Open Source Project
-#
-# Licensed under the Apache License, Version 2.0 (the "License");
-# you may not use this file except in compliance with the License.
-# You may obtain a copy of the License at
-#
-#      http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS,
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-# See the License for the specific language governing permissions and
-# limitations under the License.
-#
-
-LOCAL_PATH:= $(call my-dir)
-include $(CLEAR_VARS)
-
-LOCAL_USE_AAPT2 := true
-LOCAL_SRC_FILES := $(call all-subdir-java-files)
-LOCAL_PACKAGE_NAME := FeatureSplitBase
-LOCAL_SDK_VERSION := current
-LOCAL_EXPORT_PACKAGE_RESOURCES := true
-
-LOCAL_MODULE_TAGS := tests
-
-include $(BUILD_PACKAGE)
diff --git a/tests/FeatureSplit/feature1/Android.bp b/tests/FeatureSplit/feature1/Android.bp
new file mode 100644
index 0000000..1a93e84
--- /dev/null
+++ b/tests/FeatureSplit/feature1/Android.bp
@@ -0,0 +1,29 @@
+//
+// Copyright (C) 2014 The Android Open Source Project
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+//      http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+//
+
+android_test {
+    name: "FeatureSplit1",
+    srcs: ["**/*.java"],
+    sdk_version: "current",
+    libs: ["FeatureSplitBase"],
+    aaptflags: [
+        "--package-id",
+        "0x80",
+    ] + [
+        "--custom-package",
+        "com.android.test.split.feature.one",
+    ],
+}
diff --git a/tests/FeatureSplit/feature1/Android.mk b/tests/FeatureSplit/feature1/Android.mk
deleted file mode 100644
index d4d2589..0000000
--- a/tests/FeatureSplit/feature1/Android.mk
+++ /dev/null
@@ -1,32 +0,0 @@
-#
-# Copyright (C) 2014 The Android Open Source Project
-#
-# Licensed under the Apache License, Version 2.0 (the "License");
-# you may not use this file except in compliance with the License.
-# You may obtain a copy of the License at
-#
-#      http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS,
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-# See the License for the specific language governing permissions and
-# limitations under the License.
-#
-
-LOCAL_PATH:= $(call my-dir)
-include $(CLEAR_VARS)
-
-LOCAL_USE_AAPT2 := true
-LOCAL_SRC_FILES := $(call all-subdir-java-files)
-LOCAL_PACKAGE_NAME := FeatureSplit1
-LOCAL_SDK_VERSION := current
-LOCAL_MODULE_TAGS := tests
-
-LOCAL_APK_LIBRARIES := FeatureSplitBase
-LOCAL_RES_LIBRARIES := FeatureSplitBase
-
-LOCAL_AAPT_FLAGS += --package-id 0x80
-LOCAL_AAPT_FLAGS += --custom-package com.android.test.split.feature.one
-
-include $(BUILD_PACKAGE)
diff --git a/tests/FeatureSplit/feature2/Android.bp b/tests/FeatureSplit/feature2/Android.bp
new file mode 100644
index 0000000..a363482
--- /dev/null
+++ b/tests/FeatureSplit/feature2/Android.bp
@@ -0,0 +1,28 @@
+//
+// Copyright (C) 2014 The Android Open Source Project
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+//      http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+//
+
+android_test {
+    name: "FeatureSplit2",
+    srcs: ["**/*.java"],
+    sdk_version: "current",
+    libs: ["FeatureSplitBase"],
+    aaptflags: [
+        "--package-id",
+        "0x81",
+        "--custom-package",
+        "com.android.test.split.feature.two",
+    ],
+}
diff --git a/tests/FeatureSplit/feature2/Android.mk b/tests/FeatureSplit/feature2/Android.mk
deleted file mode 100644
index 5e5e78b..0000000
--- a/tests/FeatureSplit/feature2/Android.mk
+++ /dev/null
@@ -1,32 +0,0 @@
-#
-# Copyright (C) 2014 The Android Open Source Project
-#
-# Licensed under the Apache License, Version 2.0 (the "License");
-# you may not use this file except in compliance with the License.
-# You may obtain a copy of the License at
-#
-#      http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS,
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-# See the License for the specific language governing permissions and
-# limitations under the License.
-#
-
-LOCAL_PATH:= $(call my-dir)
-include $(CLEAR_VARS)
-
-LOCAL_USE_AAPT2 := true
-LOCAL_SRC_FILES := $(call all-subdir-java-files)
-LOCAL_PACKAGE_NAME := FeatureSplit2
-LOCAL_SDK_VERSION := current
-LOCAL_MODULE_TAGS := tests
-
-LOCAL_APK_LIBRARIES := FeatureSplitBase
-LOCAL_RES_LIBRARIES := FeatureSplitBase
-
-LOCAL_AAPT_FLAGS += --package-id 0x81
-LOCAL_AAPT_FLAGS += --custom-package com.android.test.split.feature.two
-
-include $(BUILD_PACKAGE)
diff --git a/tests/FixVibrateSetting/Android.bp b/tests/FixVibrateSetting/Android.bp
new file mode 100644
index 0000000..5608a2b
--- /dev/null
+++ b/tests/FixVibrateSetting/Android.bp
@@ -0,0 +1,6 @@
+android_app {
+    name: "FixVibrateSetting",
+    srcs: ["**/*.java"],
+    sdk_version: "current",
+    certificate: "platform",
+}
diff --git a/tests/FixVibrateSetting/Android.mk b/tests/FixVibrateSetting/Android.mk
deleted file mode 100644
index 86db09e..0000000
--- a/tests/FixVibrateSetting/Android.mk
+++ /dev/null
@@ -1,12 +0,0 @@
-LOCAL_PATH:= $(call my-dir)
-include $(CLEAR_VARS)
-
-LOCAL_MODULE_TAGS := optional
-
-LOCAL_SRC_FILES := $(call all-subdir-java-files)
-
-LOCAL_PACKAGE_NAME := FixVibrateSetting
-LOCAL_SDK_VERSION := current
-LOCAL_CERTIFICATE := platform
-
-include $(BUILD_PACKAGE)
diff --git a/tests/FlickerTests/AndroidManifest.xml b/tests/FlickerTests/AndroidManifest.xml
index ba63940..5b1a36b 100644
--- a/tests/FlickerTests/AndroidManifest.xml
+++ b/tests/FlickerTests/AndroidManifest.xml
@@ -29,7 +29,7 @@
         <uses-library android:name="android.test.runner"/>
     </application>
 
-    <instrumentation android:name="android.support.test.runner.AndroidJUnitRunner"
+    <instrumentation android:name="androidx.test.runner.AndroidJUnitRunner"
                      android:targetPackage="com.android.server.wm.flicker"
                      android:label="WindowManager Flicker Tests">
     </instrumentation>
diff --git a/tests/FlickerTests/lib/Android.mk b/tests/FlickerTests/lib/Android.mk
index 6a8dfe8..e438822 100644
--- a/tests/FlickerTests/lib/Android.mk
+++ b/tests/FlickerTests/lib/Android.mk
@@ -24,7 +24,7 @@
 LOCAL_PRIVATE_PLATFORM_APIS := true
 LOCAL_SRC_FILES := $(call all-java-files-under, src)
 LOCAL_STATIC_JAVA_LIBRARIES := \
-   ub-janktesthelper \
+   androidx.test.janktesthelper \
    cts-amwm-util \
    platformprotosnano \
    layersprotosnano \
@@ -41,7 +41,7 @@
     src/com/android/server/wm/flicker/WindowUtils.java
 LOCAL_STATIC_JAVA_LIBRARIES := sysui-helper \
     launcher-helper-lib \
-    compatibility-device-util
+    compatibility-device-util-axt
 
 include $(BUILD_STATIC_JAVA_LIBRARY)
 
diff --git a/tests/FlickerTests/lib/src/com/android/server/wm/flicker/AutomationUtils.java b/tests/FlickerTests/lib/src/com/android/server/wm/flicker/AutomationUtils.java
index 6306f0e..e00a247 100644
--- a/tests/FlickerTests/lib/src/com/android/server/wm/flicker/AutomationUtils.java
+++ b/tests/FlickerTests/lib/src/com/android/server/wm/flicker/AutomationUtils.java
@@ -30,7 +30,6 @@
 import android.graphics.Point;
 import android.graphics.Rect;
 import android.os.RemoteException;
-import android.support.test.InstrumentationRegistry;
 import android.support.test.launcherhelper.LauncherStrategyFactory;
 import android.support.test.uiautomator.By;
 import android.support.test.uiautomator.BySelector;
@@ -43,6 +42,8 @@
 import android.view.View;
 import android.view.ViewConfiguration;
 
+import androidx.test.InstrumentationRegistry;
+
 /**
  * Collection of UI Automation helper functions.
  */
diff --git a/tests/FlickerTests/lib/src/com/android/server/wm/flicker/TransitionRunner.java b/tests/FlickerTests/lib/src/com/android/server/wm/flicker/TransitionRunner.java
index f6e8192..0a3fe3c 100644
--- a/tests/FlickerTests/lib/src/com/android/server/wm/flicker/TransitionRunner.java
+++ b/tests/FlickerTests/lib/src/com/android/server/wm/flicker/TransitionRunner.java
@@ -18,9 +18,10 @@
 
 import android.annotation.Nullable;
 import android.support.annotation.VisibleForTesting;
-import android.support.test.InstrumentationRegistry;
 import android.util.Log;
 
+import androidx.test.InstrumentationRegistry;
+
 import com.android.server.wm.flicker.monitor.ITransitionMonitor;
 import com.android.server.wm.flicker.monitor.LayersTraceMonitor;
 import com.android.server.wm.flicker.monitor.ScreenRecorder;
diff --git a/tests/FlickerTests/lib/src/com/android/server/wm/flicker/WindowUtils.java b/tests/FlickerTests/lib/src/com/android/server/wm/flicker/WindowUtils.java
index 0da8761..c54396f 100644
--- a/tests/FlickerTests/lib/src/com/android/server/wm/flicker/WindowUtils.java
+++ b/tests/FlickerTests/lib/src/com/android/server/wm/flicker/WindowUtils.java
@@ -20,10 +20,11 @@
 import android.content.res.Resources;
 import android.graphics.Point;
 import android.graphics.Rect;
-import android.support.test.InstrumentationRegistry;
 import android.view.Surface;
 import android.view.WindowManager;
 
+import androidx.test.InstrumentationRegistry;
+
 /**
  * Helper functions to retrieve system window sizes and positions.
  */
diff --git a/tests/FlickerTests/lib/src/com/android/server/wm/flicker/monitor/WindowAnimationFrameStatsMonitor.java b/tests/FlickerTests/lib/src/com/android/server/wm/flicker/monitor/WindowAnimationFrameStatsMonitor.java
index 717d187..3f86f0d 100644
--- a/tests/FlickerTests/lib/src/com/android/server/wm/flicker/monitor/WindowAnimationFrameStatsMonitor.java
+++ b/tests/FlickerTests/lib/src/com/android/server/wm/flicker/monitor/WindowAnimationFrameStatsMonitor.java
@@ -25,7 +25,7 @@
 /**
  * Monitors {@link android.view.WindowAnimationFrameStats} to detect janky frames.
  *
- * Adapted from {@link android.support.test.jank.internal.WindowAnimationFrameStatsMonitorImpl}
+ * Adapted from {@link androidx.test.jank.internal.WindowAnimationFrameStatsMonitorImpl}
  * using the same threshold to determine jank.
  */
 public class WindowAnimationFrameStatsMonitor implements ITransitionMonitor {
diff --git a/tests/FlickerTests/lib/test/Android.mk b/tests/FlickerTests/lib/test/Android.mk
index 0e3f58d..5be89ba 100644
--- a/tests/FlickerTests/lib/test/Android.mk
+++ b/tests/FlickerTests/lib/test/Android.mk
@@ -25,7 +25,7 @@
 LOCAL_SRC_FILES := $(call all-java-files-under, src)
 LOCAL_JAVA_LIBRARIES := android.test.runner
 LOCAL_STATIC_JAVA_LIBRARIES := \
-    android-support-test \
+    androidx.test.rules \
     platform-test-annotations \
     truth-prebuilt \
     platformprotosnano \
diff --git a/tests/FlickerTests/lib/test/AndroidManifest.xml b/tests/FlickerTests/lib/test/AndroidManifest.xml
index d30172d..6451a57 100644
--- a/tests/FlickerTests/lib/test/AndroidManifest.xml
+++ b/tests/FlickerTests/lib/test/AndroidManifest.xml
@@ -18,7 +18,7 @@
         <uses-library android:name="android.test.runner"/>
     </application>
 
-    <instrumentation android:name="android.support.test.runner.AndroidJUnitRunner"
+    <instrumentation android:name="androidx.test.runner.AndroidJUnitRunner"
                      android:targetPackage="com.android.server.wm.flicker"
                      android:label="WindowManager Flicker Lib Test">
     </instrumentation>
diff --git a/tests/FlickerTests/lib/test/src/com/android/server/wm/flicker/LayersTraceTest.java b/tests/FlickerTests/lib/test/src/com/android/server/wm/flicker/LayersTraceTest.java
index 42b2aca..7d77126 100644
--- a/tests/FlickerTests/lib/test/src/com/android/server/wm/flicker/LayersTraceTest.java
+++ b/tests/FlickerTests/lib/test/src/com/android/server/wm/flicker/LayersTraceTest.java
@@ -26,9 +26,10 @@
 import android.content.Context;
 import android.graphics.Point;
 import android.graphics.Rect;
-import android.support.test.InstrumentationRegistry;
 import android.view.WindowManager;
 
+import androidx.test.InstrumentationRegistry;
+
 import org.junit.Test;
 
 import java.util.List;
diff --git a/tests/FlickerTests/lib/test/src/com/android/server/wm/flicker/TestFileUtils.java b/tests/FlickerTests/lib/test/src/com/android/server/wm/flicker/TestFileUtils.java
index 5a24e6d..c46175c 100644
--- a/tests/FlickerTests/lib/test/src/com/android/server/wm/flicker/TestFileUtils.java
+++ b/tests/FlickerTests/lib/test/src/com/android/server/wm/flicker/TestFileUtils.java
@@ -17,7 +17,8 @@
 package com.android.server.wm.flicker;
 
 import android.content.Context;
-import android.support.test.InstrumentationRegistry;
+
+import androidx.test.InstrumentationRegistry;
 
 import com.google.common.io.ByteStreams;
 
diff --git a/tests/FlickerTests/lib/test/src/com/android/server/wm/flicker/monitor/WindowAnimationFrameStatsMonitorTest.java b/tests/FlickerTests/lib/test/src/com/android/server/wm/flicker/monitor/WindowAnimationFrameStatsMonitorTest.java
index f7fa0d5..dd6fed0 100644
--- a/tests/FlickerTests/lib/test/src/com/android/server/wm/flicker/monitor/WindowAnimationFrameStatsMonitorTest.java
+++ b/tests/FlickerTests/lib/test/src/com/android/server/wm/flicker/monitor/WindowAnimationFrameStatsMonitorTest.java
@@ -18,9 +18,7 @@
 
 import static com.android.server.wm.flicker.AutomationUtils.wakeUpAndGoToHomeScreen;
 
-import static com.google.common.truth.Truth.assertThat;
-
-import android.support.test.InstrumentationRegistry;
+import androidx.test.InstrumentationRegistry;
 
 import org.junit.Before;
 import org.junit.Ignore;
diff --git a/tests/FlickerTests/src/com/android/server/wm/flicker/ChangeAppRotationTest.java b/tests/FlickerTests/src/com/android/server/wm/flicker/ChangeAppRotationTest.java
index 34f4ebb..b6860cb 100644
--- a/tests/FlickerTests/src/com/android/server/wm/flicker/ChangeAppRotationTest.java
+++ b/tests/FlickerTests/src/com/android/server/wm/flicker/ChangeAppRotationTest.java
@@ -25,11 +25,12 @@
 import static com.android.server.wm.flicker.WmTraceSubject.assertThat;
 
 import android.graphics.Rect;
-import android.support.test.InstrumentationRegistry;
-import android.support.test.filters.LargeTest;
 import android.util.Log;
 import android.view.Surface;
 
+import androidx.test.InstrumentationRegistry;
+import androidx.test.filters.LargeTest;
+
 import org.junit.Before;
 import org.junit.Test;
 import org.junit.runner.RunWith;
diff --git a/tests/FlickerTests/src/com/android/server/wm/flicker/CloseImeWindowToAppTest.java b/tests/FlickerTests/src/com/android/server/wm/flicker/CloseImeWindowToAppTest.java
index 2b62fcf..6590b86 100644
--- a/tests/FlickerTests/src/com/android/server/wm/flicker/CloseImeWindowToAppTest.java
+++ b/tests/FlickerTests/src/com/android/server/wm/flicker/CloseImeWindowToAppTest.java
@@ -20,9 +20,10 @@
 import static com.android.server.wm.flicker.WindowUtils.getDisplayBounds;
 
 import android.platform.helpers.IAppHelper;
-import android.support.test.InstrumentationRegistry;
-import android.support.test.filters.LargeTest;
-import android.support.test.runner.AndroidJUnit4;
+
+import androidx.test.InstrumentationRegistry;
+import androidx.test.filters.LargeTest;
+import androidx.test.runner.AndroidJUnit4;
 
 import org.junit.Before;
 import org.junit.Test;
diff --git a/tests/FlickerTests/src/com/android/server/wm/flicker/CloseImeWindowToHomeTest.java b/tests/FlickerTests/src/com/android/server/wm/flicker/CloseImeWindowToHomeTest.java
index 42b161f..4771b02 100644
--- a/tests/FlickerTests/src/com/android/server/wm/flicker/CloseImeWindowToHomeTest.java
+++ b/tests/FlickerTests/src/com/android/server/wm/flicker/CloseImeWindowToHomeTest.java
@@ -20,9 +20,10 @@
 import static com.android.server.wm.flicker.WindowUtils.getDisplayBounds;
 
 import android.platform.helpers.IAppHelper;
-import android.support.test.InstrumentationRegistry;
-import android.support.test.filters.LargeTest;
-import android.support.test.runner.AndroidJUnit4;
+
+import androidx.test.InstrumentationRegistry;
+import androidx.test.filters.LargeTest;
+import androidx.test.runner.AndroidJUnit4;
 
 import org.junit.Before;
 import org.junit.Test;
diff --git a/tests/FlickerTests/src/com/android/server/wm/flicker/CommonTransitions.java b/tests/FlickerTests/src/com/android/server/wm/flicker/CommonTransitions.java
index 92bb1ea..65888ac 100644
--- a/tests/FlickerTests/src/com/android/server/wm/flicker/CommonTransitions.java
+++ b/tests/FlickerTests/src/com/android/server/wm/flicker/CommonTransitions.java
@@ -30,7 +30,6 @@
 import android.content.Intent;
 import android.os.RemoteException;
 import android.platform.helpers.IAppHelper;
-import android.support.test.InstrumentationRegistry;
 import android.support.test.uiautomator.By;
 import android.support.test.uiautomator.UiDevice;
 import android.support.test.uiautomator.UiObject2;
@@ -38,6 +37,8 @@
 import android.util.Rational;
 import android.view.Surface;
 
+import androidx.test.InstrumentationRegistry;
+
 import com.android.server.wm.flicker.TransitionRunner.TransitionBuilder;
 
 /**
diff --git a/tests/FlickerTests/src/com/android/server/wm/flicker/DebugTest.java b/tests/FlickerTests/src/com/android/server/wm/flicker/DebugTest.java
index fec248c..61cca0d 100644
--- a/tests/FlickerTests/src/com/android/server/wm/flicker/DebugTest.java
+++ b/tests/FlickerTests/src/com/android/server/wm/flicker/DebugTest.java
@@ -17,12 +17,13 @@
 package com.android.server.wm.flicker;
 
 import android.platform.helpers.IAppHelper;
-import android.support.test.InstrumentationRegistry;
-import android.support.test.runner.AndroidJUnit4;
 import android.support.test.uiautomator.UiDevice;
 import android.util.Rational;
 import android.view.Surface;
 
+import androidx.test.InstrumentationRegistry;
+import androidx.test.runner.AndroidJUnit4;
+
 import org.junit.Ignore;
 import org.junit.Test;
 import org.junit.runner.RunWith;
diff --git a/tests/FlickerTests/src/com/android/server/wm/flicker/FlickerTestBase.java b/tests/FlickerTests/src/com/android/server/wm/flicker/FlickerTestBase.java
index 7061b23..00e11c0 100644
--- a/tests/FlickerTests/src/com/android/server/wm/flicker/FlickerTestBase.java
+++ b/tests/FlickerTests/src/com/android/server/wm/flicker/FlickerTestBase.java
@@ -21,10 +21,11 @@
 import static com.google.common.truth.Truth.assertWithMessage;
 
 import android.platform.helpers.IAppHelper;
-import android.support.test.InstrumentationRegistry;
 import android.support.test.uiautomator.UiDevice;
 import android.util.Log;
 
+import androidx.test.InstrumentationRegistry;
+
 import com.android.server.wm.flicker.TransitionRunner.TransitionResult;
 
 import org.junit.After;
diff --git a/tests/FlickerTests/src/com/android/server/wm/flicker/OpenAppColdTest.java b/tests/FlickerTests/src/com/android/server/wm/flicker/OpenAppColdTest.java
index 7e71369..7818c4e 100644
--- a/tests/FlickerTests/src/com/android/server/wm/flicker/OpenAppColdTest.java
+++ b/tests/FlickerTests/src/com/android/server/wm/flicker/OpenAppColdTest.java
@@ -20,9 +20,9 @@
 import static com.android.server.wm.flicker.WindowUtils.getDisplayBounds;
 import static com.android.server.wm.flicker.WmTraceSubject.assertThat;
 
-import android.support.test.InstrumentationRegistry;
-import android.support.test.filters.LargeTest;
-import android.support.test.runner.AndroidJUnit4;
+import androidx.test.InstrumentationRegistry;
+import androidx.test.filters.LargeTest;
+import androidx.test.runner.AndroidJUnit4;
 
 import org.junit.Before;
 import org.junit.Test;
diff --git a/tests/FlickerTests/src/com/android/server/wm/flicker/OpenAppToSplitScreenTest.java b/tests/FlickerTests/src/com/android/server/wm/flicker/OpenAppToSplitScreenTest.java
index 745569a..63018ec 100644
--- a/tests/FlickerTests/src/com/android/server/wm/flicker/OpenAppToSplitScreenTest.java
+++ b/tests/FlickerTests/src/com/android/server/wm/flicker/OpenAppToSplitScreenTest.java
@@ -19,9 +19,9 @@
 import static com.android.server.wm.flicker.CommonTransitions.appToSplitScreen;
 import static com.android.server.wm.flicker.WindowUtils.getDisplayBounds;
 
-import android.support.test.InstrumentationRegistry;
-import android.support.test.filters.LargeTest;
-import android.support.test.runner.AndroidJUnit4;
+import androidx.test.InstrumentationRegistry;
+import androidx.test.filters.LargeTest;
+import androidx.test.runner.AndroidJUnit4;
 
 import org.junit.Before;
 import org.junit.Test;
diff --git a/tests/FlickerTests/src/com/android/server/wm/flicker/OpenAppWarmTest.java b/tests/FlickerTests/src/com/android/server/wm/flicker/OpenAppWarmTest.java
index de7639d..1aba930 100644
--- a/tests/FlickerTests/src/com/android/server/wm/flicker/OpenAppWarmTest.java
+++ b/tests/FlickerTests/src/com/android/server/wm/flicker/OpenAppWarmTest.java
@@ -20,9 +20,9 @@
 import static com.android.server.wm.flicker.WindowUtils.getDisplayBounds;
 import static com.android.server.wm.flicker.WmTraceSubject.assertThat;
 
-import android.support.test.InstrumentationRegistry;
-import android.support.test.filters.LargeTest;
-import android.support.test.runner.AndroidJUnit4;
+import androidx.test.InstrumentationRegistry;
+import androidx.test.filters.LargeTest;
+import androidx.test.runner.AndroidJUnit4;
 
 import org.junit.Before;
 import org.junit.Test;
diff --git a/tests/FlickerTests/src/com/android/server/wm/flicker/OpenImeWindowTest.java b/tests/FlickerTests/src/com/android/server/wm/flicker/OpenImeWindowTest.java
index 1bd519c..a81fa8e 100644
--- a/tests/FlickerTests/src/com/android/server/wm/flicker/OpenImeWindowTest.java
+++ b/tests/FlickerTests/src/com/android/server/wm/flicker/OpenImeWindowTest.java
@@ -19,8 +19,8 @@
 import static com.android.server.wm.flicker.CommonTransitions.editTextSetFocus;
 import static com.android.server.wm.flicker.WindowUtils.getDisplayBounds;
 
-import android.support.test.filters.LargeTest;
-import android.support.test.runner.AndroidJUnit4;
+import androidx.test.filters.LargeTest;
+import androidx.test.runner.AndroidJUnit4;
 
 import org.junit.Before;
 import org.junit.Test;
diff --git a/tests/FlickerTests/src/com/android/server/wm/flicker/ResizeSplitScreenTest.java b/tests/FlickerTests/src/com/android/server/wm/flicker/ResizeSplitScreenTest.java
index 8a15cbd..50dba81 100644
--- a/tests/FlickerTests/src/com/android/server/wm/flicker/ResizeSplitScreenTest.java
+++ b/tests/FlickerTests/src/com/android/server/wm/flicker/ResizeSplitScreenTest.java
@@ -25,11 +25,12 @@
 
 import android.graphics.Rect;
 import android.platform.helpers.IAppHelper;
-import android.support.test.InstrumentationRegistry;
-import android.support.test.filters.LargeTest;
-import android.support.test.runner.AndroidJUnit4;
 import android.util.Rational;
 
+import androidx.test.InstrumentationRegistry;
+import androidx.test.filters.LargeTest;
+import androidx.test.runner.AndroidJUnit4;
+
 import org.junit.Before;
 import org.junit.Test;
 import org.junit.runner.RunWith;
diff --git a/tests/FlickerTests/src/com/android/server/wm/flicker/SeamlessAppRotationTest.java b/tests/FlickerTests/src/com/android/server/wm/flicker/SeamlessAppRotationTest.java
index 3eab68d..117ac5a 100644
--- a/tests/FlickerTests/src/com/android/server/wm/flicker/SeamlessAppRotationTest.java
+++ b/tests/FlickerTests/src/com/android/server/wm/flicker/SeamlessAppRotationTest.java
@@ -27,10 +27,11 @@
 
 import android.content.Intent;
 import android.graphics.Rect;
-import android.support.test.InstrumentationRegistry;
-import android.support.test.filters.LargeTest;
 import android.view.Surface;
 
+import androidx.test.InstrumentationRegistry;
+import androidx.test.filters.LargeTest;
+
 import org.junit.Before;
 import org.junit.Test;
 import org.junit.runner.RunWith;
diff --git a/tests/FlickerTests/src/com/android/server/wm/flicker/SplitScreenToLauncherTest.java b/tests/FlickerTests/src/com/android/server/wm/flicker/SplitScreenToLauncherTest.java
index 40bd4e9..1d30df9 100644
--- a/tests/FlickerTests/src/com/android/server/wm/flicker/SplitScreenToLauncherTest.java
+++ b/tests/FlickerTests/src/com/android/server/wm/flicker/SplitScreenToLauncherTest.java
@@ -19,10 +19,10 @@
 import static com.android.server.wm.flicker.CommonTransitions.splitScreenToLauncher;
 import static com.android.server.wm.flicker.WindowUtils.getDisplayBounds;
 
-import android.support.test.InstrumentationRegistry;
-import android.support.test.filters.FlakyTest;
-import android.support.test.filters.LargeTest;
-import android.support.test.runner.AndroidJUnit4;
+import androidx.test.InstrumentationRegistry;
+import androidx.test.filters.FlakyTest;
+import androidx.test.filters.LargeTest;
+import androidx.test.runner.AndroidJUnit4;
 
 import org.junit.Before;
 import org.junit.Test;
diff --git a/tests/FrameworkPerf/Android.bp b/tests/FrameworkPerf/Android.bp
new file mode 100644
index 0000000..a259ebd
--- /dev/null
+++ b/tests/FrameworkPerf/Android.bp
@@ -0,0 +1,14 @@
+android_test {
+    name: "FrameworkPerf",
+    srcs: ["**/*.java"],
+    platform_apis: true,
+    libs: [
+        "android.test.runner",
+        "android.test.base",
+    ],
+    static_libs: ["junit"],
+    aaptflags: [
+        "-c",
+        "120dpi,240dpi,160dpi,161dpi,320dpi,nodpi",
+    ],
+}
diff --git a/tests/FrameworkPerf/Android.mk b/tests/FrameworkPerf/Android.mk
deleted file mode 100644
index 0664d4d..0000000
--- a/tests/FrameworkPerf/Android.mk
+++ /dev/null
@@ -1,16 +0,0 @@
-LOCAL_PATH:= $(call my-dir)
-include $(CLEAR_VARS)
-
-LOCAL_MODULE_TAGS := tests
-
-LOCAL_SRC_FILES := $(call all-subdir-java-files)
-
-LOCAL_PACKAGE_NAME := FrameworkPerf
-LOCAL_PRIVATE_PLATFORM_APIS := true
-
-LOCAL_JAVA_LIBRARIES := android.test.runner android.test.base
-LOCAL_STATIC_JAVA_LIBRARIES := junit
-
-LOCAL_AAPT_FLAGS = -c 120dpi,240dpi,160dpi,161dpi,320dpi,nodpi
-
-include $(BUILD_PACKAGE)
diff --git a/tests/GridLayoutTest/Android.bp b/tests/GridLayoutTest/Android.bp
new file mode 100644
index 0000000..b4b5ba5
--- /dev/null
+++ b/tests/GridLayoutTest/Android.bp
@@ -0,0 +1,21 @@
+//
+// Copyright (C) 2010 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.
+//
+
+android_test {
+    name: "GridLayoutTest",
+    srcs: ["**/*.java"],
+    sdk_version: "current",
+}
diff --git a/tests/GridLayoutTest/Android.mk b/tests/GridLayoutTest/Android.mk
deleted file mode 100644
index e7e3ccd..0000000
--- a/tests/GridLayoutTest/Android.mk
+++ /dev/null
@@ -1,27 +0,0 @@
-#
-# Copyright (C) 2010 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.
-#
-
-LOCAL_PATH:= $(call my-dir)
-include $(CLEAR_VARS)
-
-LOCAL_SRC_FILES := $(call all-subdir-java-files)
-
-LOCAL_PACKAGE_NAME := GridLayoutTest
-LOCAL_SDK_VERSION := current
-
-LOCAL_MODULE_TAGS := tests
-
-include $(BUILD_PACKAGE)
diff --git a/tests/HierarchyViewerTest/Android.bp b/tests/HierarchyViewerTest/Android.bp
new file mode 100644
index 0000000..814c883
--- /dev/null
+++ b/tests/HierarchyViewerTest/Android.bp
@@ -0,0 +1,10 @@
+android_test {
+    name: "HierarchyViewerTest",
+    srcs: ["**/*.java"],
+    sdk_version: "current",
+    libs: [
+        "android.test.runner.stubs",
+        "android.test.base.stubs",
+    ],
+    static_libs: ["junit"],
+}
diff --git a/tests/HierarchyViewerTest/Android.mk b/tests/HierarchyViewerTest/Android.mk
deleted file mode 100644
index cf1a512..0000000
--- a/tests/HierarchyViewerTest/Android.mk
+++ /dev/null
@@ -1,14 +0,0 @@
-LOCAL_PATH:= $(call my-dir)
-include $(CLEAR_VARS)
-
-LOCAL_MODULE_TAGS := tests
-
-LOCAL_SRC_FILES := $(call all-subdir-java-files)
-
-LOCAL_PACKAGE_NAME := HierarchyViewerTest
-LOCAL_SDK_VERSION := current
-
-LOCAL_JAVA_LIBRARIES := android.test.runner.stubs android.test.base.stubs
-LOCAL_STATIC_JAVA_LIBRARIES := junit
-
-include $(BUILD_PACKAGE)
diff --git a/tests/HugeBackup/Android.bp b/tests/HugeBackup/Android.bp
new file mode 100644
index 0000000..b44c457
--- /dev/null
+++ b/tests/HugeBackup/Android.bp
@@ -0,0 +1,9 @@
+android_test {
+    name: "HugeBackup",
+    // Only compile source java files in this apk.
+    srcs: ["src/**/*.java"],
+    sdk_version: "current",
+    optimize: {
+        proguard_flags_files: ["proguard.flags"],
+    },
+}
diff --git a/tests/HugeBackup/Android.mk b/tests/HugeBackup/Android.mk
deleted file mode 100644
index 4789bc8..0000000
--- a/tests/HugeBackup/Android.mk
+++ /dev/null
@@ -1,15 +0,0 @@
-LOCAL_PATH:= $(call my-dir)
-include $(CLEAR_VARS)
-
-LOCAL_MODULE_TAGS := tests
-
-# Only compile source java files in this apk.
-LOCAL_SRC_FILES := $(call all-java-files-under, src)
-
-LOCAL_PACKAGE_NAME := HugeBackup
-
-LOCAL_SDK_VERSION := current
-
-LOCAL_PROGUARD_FLAG_FILES := proguard.flags
-
-include $(BUILD_PACKAGE)
diff --git a/tests/HwAccelerationTest/src/com/android/test/hwui/CustomRenderer.java b/tests/HwAccelerationTest/src/com/android/test/hwui/CustomRenderer.java
index fece8ba..5ad7fb9 100644
--- a/tests/HwAccelerationTest/src/com/android/test/hwui/CustomRenderer.java
+++ b/tests/HwAccelerationTest/src/com/android/test/hwui/CustomRenderer.java
@@ -16,6 +16,7 @@
 
 package com.android.test.hwui;
 
+import android.animation.ObjectAnimator;
 import android.app.Activity;
 import android.graphics.Color;
 import android.graphics.HardwareRenderer;
@@ -23,12 +24,15 @@
 import android.graphics.RecordingCanvas;
 import android.graphics.RenderNode;
 import android.os.Bundle;
-import android.util.Log;
+import android.os.Handler;
 import android.view.SurfaceHolder;
 
 public class CustomRenderer extends Activity {
-    private RenderNode mContent = new RenderNode("CustomRenderer");
+    private RenderNode mRootNode = new RenderNode("CustomRenderer");
+    private RenderNode mChildNode = new RenderNode("RedBox");
     private HardwareRenderer mRenderer = new HardwareRenderer();
+    private ObjectAnimator mAnimator;
+    private Handler mRedrawHandler = new Handler(true);
 
     @Override
     protected void onCreate(Bundle savedInstanceState) {
@@ -36,6 +40,64 @@
         getWindow().takeSurface(mSurfaceCallbacks);
     }
 
+    @Override
+    protected void onStart() {
+        super.onStart();
+        mAnimator = ObjectAnimator.ofFloat(mChildNode, "translationY", 0, 300);
+        mAnimator.setRepeatMode(ObjectAnimator.REVERSE);
+        mAnimator.setRepeatCount(ObjectAnimator.INFINITE);
+        final Runnable redraw = this::draw;
+        mAnimator.addUpdateListener(animation -> {
+            mRedrawHandler.post(redraw);
+        });
+    }
+
+    @Override
+    protected void onStop() {
+        super.onStop();
+        mAnimator.end();
+        mAnimator = null;
+    }
+
+    private void setupRoot(int width, int height) {
+        mRootNode.setPosition(0, 0, width, height);
+
+        RecordingCanvas canvas = mRootNode.beginRecording();
+        canvas.drawColor(Color.WHITE);
+        Paint paint = new Paint(Paint.ANTI_ALIAS_FLAG);
+        paint.setColor(Color.BLACK);
+        paint.setTextAlign(Paint.Align.CENTER);
+        float textSize = Math.min(width, height) * .05f;
+        paint.setTextSize(textSize);
+        canvas.drawText("Hello custom renderer!", width / 2, textSize * 2, paint);
+
+        canvas.translate(0, height / 4);
+        canvas.drawRenderNode(mChildNode);
+        canvas.translate(width / 2, 0);
+        canvas.drawRenderNode(mChildNode);
+        mRootNode.endRecording();
+
+        setupChild(width / 2, height / 2);
+    }
+
+    private void setupChild(int width, int height) {
+        mChildNode.setPosition(0, 0, width, height);
+        mChildNode.setScaleX(.5f);
+        mChildNode.setScaleY(.5f);
+
+        RecordingCanvas canvas = mChildNode.beginRecording();
+        canvas.drawColor(Color.RED);
+        mChildNode.endRecording();
+    }
+
+    private void draw() {
+        // Since we are constantly pumping frames between onStart & onStop we don't really
+        // care about any errors that may happen. They will self-correct.
+        mRenderer.createRenderRequest()
+                .setVsyncTime(System.nanoTime())
+                .syncAndDraw();
+    }
+
     private SurfaceHolder.Callback2 mSurfaceCallbacks = new SurfaceHolder.Callback2() {
 
         @Override
@@ -48,24 +110,14 @@
 
         @Override
         public void surfaceChanged(SurfaceHolder holder, int format, int width, int height) {
-            mContent.setLeftTopRightBottom(0, 0, width, height);
-            RecordingCanvas canvas = mContent.beginRecording();
-            canvas.drawColor(Color.WHITE);
-            Paint paint = new Paint(Paint.ANTI_ALIAS_FLAG);
-            paint.setColor(Color.BLACK);
-            paint.setTextAlign(Paint.Align.CENTER);
-            paint.setTextSize(Math.min(width, height) * .05f);
-            canvas.drawText("Hello custom renderer!", width / 2, height / 2, paint);
-            mContent.endRecording();
+            setupRoot(width, height);
 
-            mRenderer.setContentRoot(mContent);
+            mRenderer.setContentRoot(mRootNode);
             mRenderer.setSurface(holder.getSurface());
-            mRenderer.createRenderRequest()
-                    .setVsyncTime(System.nanoTime())
-                    .setFrameCommitCallback(Runnable::run, () -> {
-                        Log.d("CustomRenderer", "Frame committed!");
-                    })
-                    .syncAndDraw();
+            draw();
+            if (!mAnimator.isStarted()) {
+                mAnimator.start();
+            }
         }
 
         @Override
diff --git a/tests/HwAccelerationTest/src/com/android/test/hwui/PositionListenerActivity.java b/tests/HwAccelerationTest/src/com/android/test/hwui/PositionListenerActivity.java
index 316aad3..818d899 100644
--- a/tests/HwAccelerationTest/src/com/android/test/hwui/PositionListenerActivity.java
+++ b/tests/HwAccelerationTest/src/com/android/test/hwui/PositionListenerActivity.java
@@ -53,7 +53,7 @@
         MyPositionReporter(Context c) {
             super(c);
             mNode = new RenderNode("positionListener");
-            mNode.requestPositionUpdates(this);
+            mNode.addPositionUpdateListener(this);
             setTextAlignment(TEXT_ALIGNMENT_VIEW_START);
         }
 
diff --git a/tests/Internal/Android.mk b/tests/Internal/Android.mk
index da56696..2e26ef1 100644
--- a/tests/Internal/Android.mk
+++ b/tests/Internal/Android.mk
@@ -11,7 +11,7 @@
 
 LOCAL_JAVA_LIBRARIES := android.test.runner
 LOCAL_STATIC_JAVA_LIBRARIES := junit \
-    android-support-test \
+    androidx.test.rules \
     mockito-target-minus-junit4
 
 LOCAL_JAVA_RESOURCE_DIRS := res
diff --git a/tests/Internal/AndroidManifest.xml b/tests/Internal/AndroidManifest.xml
index e5a5694..c85c3b1 100644
--- a/tests/Internal/AndroidManifest.xml
+++ b/tests/Internal/AndroidManifest.xml
@@ -38,7 +38,7 @@
         </service>
     </application>
 
-    <instrumentation android:name="android.support.test.runner.AndroidJUnitRunner"
+    <instrumentation android:name="androidx.test.runner.AndroidJUnitRunner"
                      android:targetPackage="com.android.internal.tests"
                      android:label="Internal Tests" />
 </manifest>
diff --git a/tests/Internal/AndroidTest.xml b/tests/Internal/AndroidTest.xml
index 6531c93..7b67e9e 100644
--- a/tests/Internal/AndroidTest.xml
+++ b/tests/Internal/AndroidTest.xml
@@ -24,6 +24,6 @@
     <option name="test-tag" value="InternalTests" />
     <test class="com.android.tradefed.testtype.AndroidJUnitTest" >
         <option name="package" value="com.android.internal.tests" />
-        <option name="runner" value="android.support.test.runner.AndroidJUnitRunner" />
+        <option name="runner" value="androidx.test.runner.AndroidJUnitRunner" />
     </test>
 </configuration>
\ No newline at end of file
diff --git a/tests/Internal/src/android/app/WallpaperColorsTest.java b/tests/Internal/src/android/app/WallpaperColorsTest.java
index 881f628..65ff6eb 100644
--- a/tests/Internal/src/android/app/WallpaperColorsTest.java
+++ b/tests/Internal/src/android/app/WallpaperColorsTest.java
@@ -20,8 +20,9 @@
 import android.graphics.Canvas;
 import android.graphics.Color;
 import android.graphics.Paint;
-import android.support.test.filters.SmallTest;
-import android.support.test.runner.AndroidJUnit4;
+
+import androidx.test.filters.SmallTest;
+import androidx.test.runner.AndroidJUnit4;
 
 import org.junit.Assert;
 import org.junit.Test;
diff --git a/tests/Internal/src/android/app/WallpaperInfoTest.java b/tests/Internal/src/android/app/WallpaperInfoTest.java
index 7f06f2c..476b991 100644
--- a/tests/Internal/src/android/app/WallpaperInfoTest.java
+++ b/tests/Internal/src/android/app/WallpaperInfoTest.java
@@ -26,9 +26,10 @@
 import android.net.Uri;
 import android.os.Parcel;
 import android.service.wallpaper.WallpaperService;
-import android.support.test.InstrumentationRegistry;
-import android.support.test.filters.SmallTest;
-import android.support.test.runner.AndroidJUnit4;
+
+import androidx.test.InstrumentationRegistry;
+import androidx.test.filters.SmallTest;
+import androidx.test.runner.AndroidJUnit4;
 
 import org.junit.Test;
 import org.junit.runner.RunWith;
diff --git a/tests/Internal/src/android/service/wallpaper/WallpaperServiceTest.java b/tests/Internal/src/android/service/wallpaper/WallpaperServiceTest.java
index b9e282e..592aa3a 100644
--- a/tests/Internal/src/android/service/wallpaper/WallpaperServiceTest.java
+++ b/tests/Internal/src/android/service/wallpaper/WallpaperServiceTest.java
@@ -20,7 +20,7 @@
 import static org.junit.Assert.assertFalse;
 import static org.junit.Assert.assertTrue;
 
-import android.support.test.filters.SmallTest;
+import androidx.test.filters.SmallTest;
 
 import org.junit.Test;
 import org.junit.runner.RunWith;
diff --git a/tests/Internal/src/com/android/internal/colorextraction/ColorExtractorTest.java b/tests/Internal/src/com/android/internal/colorextraction/ColorExtractorTest.java
index 39608a4..17fa931 100644
--- a/tests/Internal/src/com/android/internal/colorextraction/ColorExtractorTest.java
+++ b/tests/Internal/src/com/android/internal/colorextraction/ColorExtractorTest.java
@@ -27,9 +27,10 @@
 import android.app.WallpaperManager;
 import android.content.Context;
 import android.graphics.Color;
-import android.support.test.InstrumentationRegistry;
-import android.support.test.filters.SmallTest;
-import android.support.test.runner.AndroidJUnit4;
+
+import androidx.test.InstrumentationRegistry;
+import androidx.test.filters.SmallTest;
+import androidx.test.runner.AndroidJUnit4;
 
 import com.android.internal.colorextraction.ColorExtractor.GradientColors;
 import com.android.internal.colorextraction.types.ExtractionType;
diff --git a/tests/Internal/src/com/android/internal/colorextraction/types/TonalTest.java b/tests/Internal/src/com/android/internal/colorextraction/types/TonalTest.java
index a7d5ae8..300182d 100644
--- a/tests/Internal/src/com/android/internal/colorextraction/types/TonalTest.java
+++ b/tests/Internal/src/com/android/internal/colorextraction/types/TonalTest.java
@@ -20,13 +20,13 @@
 
 import android.app.WallpaperColors;
 import android.graphics.Color;
-import android.support.test.InstrumentationRegistry;
-import android.support.test.filters.SmallTest;
-import android.support.test.runner.AndroidJUnit4;
 import android.util.Range;
 
+import androidx.test.InstrumentationRegistry;
+import androidx.test.filters.SmallTest;
+import androidx.test.runner.AndroidJUnit4;
+
 import com.android.internal.colorextraction.ColorExtractor.GradientColors;
-import com.android.internal.graphics.ColorUtils;
 
 import org.junit.Test;
 import org.junit.runner.RunWith;
@@ -95,7 +95,6 @@
         Tonal.ConfigParser config = new Tonal.ConfigParser(InstrumentationRegistry.getContext());
         // 1 to avoid regression where only first item would be parsed.
         assertTrue("Tonal palettes are empty", config.getTonalPalettes().size() > 1);
-        assertTrue("Blacklisted colors are empty", config.getBlacklistedColors().size() > 1);
     }
 
     @Test
@@ -112,41 +111,4 @@
             assertTrue("L should be <= to 1.", palette.l[1] <= 1);
         }
     }
-
-    @Test
-    public void tonal_blacklistTest() {
-        // Make sure that palette generation will fail.
-        final Tonal tonal = new Tonal(InstrumentationRegistry.getContext());
-
-        // Creating a WallpaperColors object that contains *only* blacklisted colors.
-        final float[] hsl = tonal.getBlacklistedColors().get(0).getCenter();
-        final int blacklistedColor = ColorUtils.HSLToColor(hsl);
-        WallpaperColors colorsFromBitmap = new WallpaperColors(Color.valueOf(blacklistedColor),
-                null, null, WallpaperColors.HINT_FROM_BITMAP);
-
-        // Make sure that palette generation will fail
-        final GradientColors normal = new GradientColors();
-        tonal.extractInto(colorsFromBitmap, normal, new GradientColors(),
-                new GradientColors());
-        assertTrue("Cannot generate a tonal palette from blacklisted colors.",
-                normal.getMainColor() == Tonal.MAIN_COLOR_DARK);
-    }
-
-    @Test
-    public void tonal_ignoreBlacklistTest() {
-        final Tonal tonal = new Tonal(InstrumentationRegistry.getContext());
-
-        // Creating a WallpaperColors object that contains *only* blacklisted colors.
-        final float[] hsl = tonal.getBlacklistedColors().get(0).getCenter();
-        final int blacklistedColor = ColorUtils.HSLToColor(hsl);
-        WallpaperColors colors = new WallpaperColors(Color.valueOf(blacklistedColor),
-                null, null);
-
-        // Blacklist should be ignored when HINT_FROM_BITMAP isn't present.
-        final GradientColors normal = new GradientColors();
-        tonal.extractInto(colors, normal, new GradientColors(),
-                new GradientColors());
-        assertTrue("Blacklist should never be used on WallpaperColors generated using "
-                + "default constructor.", normal.getMainColor() == blacklistedColor);
-    }
 }
diff --git a/tests/Internal/src/com/android/internal/graphics/ColorUtilsTest.java b/tests/Internal/src/com/android/internal/graphics/ColorUtilsTest.java
index 73df9a0..d0bb8e3 100644
--- a/tests/Internal/src/com/android/internal/graphics/ColorUtilsTest.java
+++ b/tests/Internal/src/com/android/internal/graphics/ColorUtilsTest.java
@@ -16,13 +16,14 @@
 
 package com.android.internal.graphics;
 
+import static org.junit.Assert.assertTrue;
+
 import android.graphics.Color;
-import android.support.test.filters.SmallTest;
+
+import androidx.test.filters.SmallTest;
 
 import org.junit.Test;
 
-import static org.junit.Assert.assertTrue;
-
 @SmallTest
 public class ColorUtilsTest {
 
diff --git a/tests/Internal/src/com/android/internal/ml/clustering/KMeansTest.java b/tests/Internal/src/com/android/internal/ml/clustering/KMeansTest.java
index a64f8a6..540a1ec 100644
--- a/tests/Internal/src/com/android/internal/ml/clustering/KMeansTest.java
+++ b/tests/Internal/src/com/android/internal/ml/clustering/KMeansTest.java
@@ -20,8 +20,9 @@
 import static org.junit.Assert.assertTrue;
 
 import android.annotation.SuppressLint;
-import android.support.test.filters.SmallTest;
-import android.support.test.runner.AndroidJUnit4;
+
+import androidx.test.filters.SmallTest;
+import androidx.test.runner.AndroidJUnit4;
 
 import org.junit.Assert;
 import org.junit.Before;
diff --git a/tests/JobSchedulerTestApp/Android.bp b/tests/JobSchedulerTestApp/Android.bp
new file mode 100644
index 0000000..bac0220
--- /dev/null
+++ b/tests/JobSchedulerTestApp/Android.bp
@@ -0,0 +1,9 @@
+android_app {
+    name: "JobSchedulerTestApp",
+    srcs: ["src/**/*.java"],
+    resource_dirs: ["res"],
+    sdk_version: "current",
+    optimize: {
+        enabled: false,
+    },
+}
diff --git a/tests/JobSchedulerTestApp/Android.mk b/tests/JobSchedulerTestApp/Android.mk
deleted file mode 100644
index 48ee1f6..0000000
--- a/tests/JobSchedulerTestApp/Android.mk
+++ /dev/null
@@ -1,16 +0,0 @@
-LOCAL_PATH:= $(call my-dir)
-include $(CLEAR_VARS)
-
-LOCAL_MODULE_TAGS := optional
-
-LOCAL_SRC_FILES := $(call all-java-files-under, src)
-
-LOCAL_RESOURCE_DIR := $(LOCAL_PATH)/res
-
-LOCAL_PACKAGE_NAME := JobSchedulerTestApp
-LOCAL_SDK_VERSION := current
-
-LOCAL_PROGUARD_ENABLED := disabled
-
-include $(BUILD_PACKAGE)
-
diff --git a/tests/LargeAssetTest/Android.bp b/tests/LargeAssetTest/Android.bp
new file mode 100644
index 0000000..499e6a0
--- /dev/null
+++ b/tests/LargeAssetTest/Android.bp
@@ -0,0 +1,6 @@
+android_app {
+    name: "LargeAssetTest",
+    srcs: ["**/*.java"],
+    sdk_version: "current",
+    certificate: "platform",
+}
diff --git a/tests/LargeAssetTest/Android.mk b/tests/LargeAssetTest/Android.mk
deleted file mode 100644
index f6d98bf..0000000
--- a/tests/LargeAssetTest/Android.mk
+++ /dev/null
@@ -1,12 +0,0 @@
-LOCAL_PATH:= $(call my-dir)
-include $(CLEAR_VARS)
-
-LOCAL_MODULE_TAGS := optional
-
-LOCAL_SRC_FILES := $(call all-subdir-java-files)
-
-LOCAL_PACKAGE_NAME := LargeAssetTest
-LOCAL_SDK_VERSION := current
-LOCAL_CERTIFICATE := platform
-
-include $(BUILD_PACKAGE)
diff --git a/tests/LegacyAssistant/Android.bp b/tests/LegacyAssistant/Android.bp
new file mode 100644
index 0000000..fef924d
--- /dev/null
+++ b/tests/LegacyAssistant/Android.bp
@@ -0,0 +1,6 @@
+android_test {
+    name: "LegacyAssistant",
+    srcs: ["**/*.java"],
+    sdk_version: "current",
+    certificate: "platform",
+}
diff --git a/tests/LegacyAssistant/Android.mk b/tests/LegacyAssistant/Android.mk
deleted file mode 100644
index a583369..0000000
--- a/tests/LegacyAssistant/Android.mk
+++ /dev/null
@@ -1,12 +0,0 @@
-LOCAL_PATH:= $(call my-dir)
-include $(CLEAR_VARS)
-
-LOCAL_SRC_FILES := $(call all-subdir-java-files)
-
-LOCAL_PACKAGE_NAME := LegacyAssistant
-LOCAL_SDK_VERSION := current
-
-LOCAL_MODULE_TAGS := tests
-LOCAL_CERTIFICATE := platform
-
-include $(BUILD_PACKAGE)
diff --git a/tests/LocationTracker/Android.bp b/tests/LocationTracker/Android.bp
new file mode 100644
index 0000000..f0075a9
--- /dev/null
+++ b/tests/LocationTracker/Android.bp
@@ -0,0 +1,5 @@
+android_test {
+    name: "LocationTracker",
+    srcs: ["**/*.java"],
+    sdk_version: "current",
+}
diff --git a/tests/LocationTracker/Android.mk b/tests/LocationTracker/Android.mk
deleted file mode 100644
index 0d51b3b..0000000
--- a/tests/LocationTracker/Android.mk
+++ /dev/null
@@ -1,11 +0,0 @@
-LOCAL_PATH:= $(call my-dir)
-include $(CLEAR_VARS)
-
-LOCAL_SRC_FILES := $(call all-subdir-java-files)
-
-LOCAL_PACKAGE_NAME := LocationTracker
-LOCAL_SDK_VERSION := current
-
-LOCAL_MODULE_TAGS := tests
-
-include $(BUILD_PACKAGE)
diff --git a/tests/LotsOfApps/Android.bp b/tests/LotsOfApps/Android.bp
new file mode 100644
index 0000000..68b9f88
--- /dev/null
+++ b/tests/LotsOfApps/Android.bp
@@ -0,0 +1,9 @@
+android_app {
+    name: "LotsOfApps",
+    srcs: ["**/*.java"],
+    sdk_version: "current",
+    certificate: "platform",
+    optimize: {
+        enabled: false,
+    },
+}
diff --git a/tests/LotsOfApps/Android.mk b/tests/LotsOfApps/Android.mk
deleted file mode 100644
index bee3bcc..0000000
--- a/tests/LotsOfApps/Android.mk
+++ /dev/null
@@ -1,14 +0,0 @@
-LOCAL_PATH:= $(call my-dir)
-include $(CLEAR_VARS)
-
-LOCAL_MODULE_TAGS := optional
-
-LOCAL_SRC_FILES := $(call all-subdir-java-files)
-
-LOCAL_PACKAGE_NAME := LotsOfApps
-LOCAL_SDK_VERSION := current
-LOCAL_CERTIFICATE := platform
-
-LOCAL_PROGUARD_ENABLED := disabled
-
-include $(BUILD_PACKAGE)
diff --git a/tests/LowStorageTest/Android.bp b/tests/LowStorageTest/Android.bp
new file mode 100644
index 0000000..e72e4a5
--- /dev/null
+++ b/tests/LowStorageTest/Android.bp
@@ -0,0 +1,20 @@
+// Copyright (C) 2009 The Android Open Source Project
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+//      http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+
+android_test {
+    name: "lowstoragetest",
+    certificate: "platform",
+    srcs: ["**/*.java"],
+    sdk_version: "current",
+}
diff --git a/tests/MemoryUsage/Android.bp b/tests/MemoryUsage/Android.bp
new file mode 100644
index 0000000..aeb5338
--- /dev/null
+++ b/tests/MemoryUsage/Android.bp
@@ -0,0 +1,12 @@
+android_test {
+    name: "MemoryUsage",
+    // Only compile source java files in this apk.
+    srcs: ["src/**/*.java"],
+    platform_apis: true,
+    certificate: "platform",
+    libs: [
+        "android.test.runner",
+        "android.test.base",
+    ],
+    static_libs: ["junit"],
+}
diff --git a/tests/MemoryUsage/Android.mk b/tests/MemoryUsage/Android.mk
deleted file mode 100644
index 5040d5a..0000000
--- a/tests/MemoryUsage/Android.mk
+++ /dev/null
@@ -1,19 +0,0 @@
-LOCAL_PATH:= $(call my-dir)
-include $(CLEAR_VARS)
-
-LOCAL_MODULE_TAGS := tests
-
-# Only compile source java files in this apk.
-LOCAL_SRC_FILES := $(call all-java-files-under, src)
-
-LOCAL_PACKAGE_NAME := MemoryUsage
-LOCAL_PRIVATE_PLATFORM_APIS := true
-
-LOCAL_CERTIFICATE := platform
-LOCAL_JAVA_LIBRARIES := android.test.runner android.test.base
-LOCAL_STATIC_JAVA_LIBRARIES := junit
-
-include $(BUILD_PACKAGE)
-
-# Use the following include to make our test apk.
-include $(call all-makefiles-under,$(LOCAL_PATH))
diff --git a/tests/NetworkSecurityConfigTest/Android.bp b/tests/NetworkSecurityConfigTest/Android.bp
new file mode 100644
index 0000000..cf8ca57
--- /dev/null
+++ b/tests/NetworkSecurityConfigTest/Android.bp
@@ -0,0 +1,12 @@
+android_test {
+    name: "NetworkSecurityConfigTests",
+    certificate: "platform",
+    libs: [
+        "android.test.runner",
+        "android.test.base",
+    ],
+    static_libs: ["junit"],
+    // Include all test java files.
+    srcs: ["src/**/*.java"],
+    platform_apis: true,
+}
diff --git a/tests/NetworkSecurityConfigTest/Android.mk b/tests/NetworkSecurityConfigTest/Android.mk
deleted file mode 100644
index a6c21db..0000000
--- a/tests/NetworkSecurityConfigTest/Android.mk
+++ /dev/null
@@ -1,20 +0,0 @@
-LOCAL_PATH:= $(call my-dir)
-include $(CLEAR_VARS)
-
-# We only want this apk build for tests.
-LOCAL_MODULE_TAGS := tests
-LOCAL_CERTIFICATE := platform
-
-LOCAL_JAVA_LIBRARIES := \
-    android.test.runner \
-    android.test.base \
-
-LOCAL_STATIC_JAVA_LIBRARIES := junit
-
-# Include all test java files.
-LOCAL_SRC_FILES := $(call all-java-files-under, src)
-
-LOCAL_PACKAGE_NAME := NetworkSecurityConfigTests
-LOCAL_PRIVATE_PLATFORM_APIS := true
-
-include $(BUILD_PACKAGE)
diff --git a/tests/OdmApps/Android.bp b/tests/OdmApps/Android.bp
new file mode 100644
index 0000000..d86f9cc
--- /dev/null
+++ b/tests/OdmApps/Android.bp
@@ -0,0 +1,20 @@
+// Copyright (C) 2018 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.
+
+java_test_host {
+    name: "OdmAppsTest",
+    srcs: ["src/**/*.java"],
+    libs: ["tradefed"],
+    test_suites: ["device-tests"],
+}
diff --git a/tests/OdmApps/Android.mk b/tests/OdmApps/Android.mk
deleted file mode 100644
index 64fa653..0000000
--- a/tests/OdmApps/Android.mk
+++ /dev/null
@@ -1,26 +0,0 @@
-# Copyright (C) 2018 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.
-
-LOCAL_PATH := $(call my-dir)
-
-include $(CLEAR_VARS)
-
-LOCAL_MODULE := OdmAppsTest
-LOCAL_MODULE_TAGS := tests
-LOCAL_SRC_FILES := $(call all-java-files-under, src)
-LOCAL_JAVA_LIBRARIES := tradefed
-LOCAL_COMPATIBILITY_SUITE := device-tests
-include $(BUILD_HOST_JAVA_LIBRARY)
-
-include $(call all-makefiles-under,$(LOCAL_PATH))
diff --git a/tests/OdmApps/app/Android.bp b/tests/OdmApps/app/Android.bp
new file mode 100644
index 0000000..5eb8590
--- /dev/null
+++ b/tests/OdmApps/app/Android.bp
@@ -0,0 +1,19 @@
+// Copyright (C) 2018 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.
+
+android_test {
+    name: "TestOdmApp",
+    test_suites: ["device-tests"],
+    sdk_version: "current",
+}
diff --git a/tests/OdmApps/app/Android.mk b/tests/OdmApps/app/Android.mk
deleted file mode 100644
index 9eec0cc..0000000
--- a/tests/OdmApps/app/Android.mk
+++ /dev/null
@@ -1,22 +0,0 @@
-# Copyright (C) 2018 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.
-
-LOCAL_PATH:= $(call my-dir)
-
-include $(CLEAR_VARS)
-LOCAL_PACKAGE_NAME := TestOdmApp
-LOCAL_MODULE_TAGS := tests
-LOCAL_COMPATIBILITY_SUITE := device-tests
-LOCAL_SDK_VERSION := current
-include $(BUILD_PACKAGE)
diff --git a/tests/OdmApps/priv-app/Android.bp b/tests/OdmApps/priv-app/Android.bp
new file mode 100644
index 0000000..9dd477cf
--- /dev/null
+++ b/tests/OdmApps/priv-app/Android.bp
@@ -0,0 +1,19 @@
+// Copyright (C) 2018 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.
+
+android_test {
+    name: "TestOdmPrivApp",
+    test_suites: ["device-tests"],
+    sdk_version: "current",
+}
diff --git a/tests/OdmApps/priv-app/Android.mk b/tests/OdmApps/priv-app/Android.mk
deleted file mode 100644
index d423133..0000000
--- a/tests/OdmApps/priv-app/Android.mk
+++ /dev/null
@@ -1,22 +0,0 @@
-# Copyright (C) 2018 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.
-
-LOCAL_PATH:= $(call my-dir)
-
-include $(CLEAR_VARS)
-LOCAL_PACKAGE_NAME := TestOdmPrivApp
-LOCAL_MODULE_TAGS := tests
-LOCAL_COMPATIBILITY_SUITE := device-tests
-LOCAL_SDK_VERSION := current
-include $(BUILD_PACKAGE)
diff --git a/tests/OneMedia/Android.bp b/tests/OneMedia/Android.bp
new file mode 100644
index 0000000..11e12f35
--- /dev/null
+++ b/tests/OneMedia/Android.bp
@@ -0,0 +1,13 @@
+android_app {
+    name: "OneMedia",
+    srcs: [
+        "**/*.java",
+        "src/**/I*.aidl",
+    ],
+    platform_apis: true,
+    certificate: "platform",
+    libs: ["org.apache.http.legacy"],
+    optimize: {
+        enabled: false,
+    },
+}
diff --git a/tests/OneMedia/Android.mk b/tests/OneMedia/Android.mk
deleted file mode 100644
index 41f3f64..0000000
--- a/tests/OneMedia/Android.mk
+++ /dev/null
@@ -1,17 +0,0 @@
-LOCAL_PATH:= $(call my-dir)
-include $(CLEAR_VARS)
-
-LOCAL_MODULE_TAGS := optional
-
-LOCAL_SRC_FILES := $(call all-subdir-java-files) \
-        $(call all-Iaidl-files-under, src)
-
-LOCAL_PACKAGE_NAME := OneMedia
-LOCAL_PRIVATE_PLATFORM_APIS := true
-LOCAL_CERTIFICATE := platform
-
-LOCAL_JAVA_LIBRARIES += org.apache.http.legacy
-
-LOCAL_PROGUARD_ENABLED := disabled
-
-include $(BUILD_PACKAGE)
diff --git a/tests/PackageWatchdog/Android.mk b/tests/PackageWatchdog/Android.mk
index 1c1c2a4..1e4aacc 100644
--- a/tests/PackageWatchdog/Android.mk
+++ b/tests/PackageWatchdog/Android.mk
@@ -22,7 +22,7 @@
 LOCAL_STATIC_JAVA_LIBRARIES := \
     junit \
     frameworks-base-testutils \
-    android-support-test \
+    androidx.test.rules \
     services.core
 
 LOCAL_JAVA_LIBRARIES := \
diff --git a/tests/PackageWatchdog/AndroidManifest.xml b/tests/PackageWatchdog/AndroidManifest.xml
index fa89528..540edb4 100644
--- a/tests/PackageWatchdog/AndroidManifest.xml
+++ b/tests/PackageWatchdog/AndroidManifest.xml
@@ -22,7 +22,7 @@
     </application>
 
 
-    <instrumentation android:name="android.support.test.runner.AndroidJUnitRunner"
+    <instrumentation android:name="androidx.test.runner.AndroidJUnitRunner"
                      android:targetPackage="com.android.tests.packagewatchdog"
                      android:label="PackageWatchdog Test"/>
 </manifest>
diff --git a/tests/PackageWatchdog/src/com/android/server/PackageWatchdogTest.java b/tests/PackageWatchdog/src/com/android/server/PackageWatchdogTest.java
index 77cd62e..d0c2612 100644
--- a/tests/PackageWatchdog/src/com/android/server/PackageWatchdogTest.java
+++ b/tests/PackageWatchdog/src/com/android/server/PackageWatchdogTest.java
@@ -24,7 +24,8 @@
 
 import android.content.pm.VersionedPackage;
 import android.os.test.TestLooper;
-import android.support.test.InstrumentationRegistry;
+
+import androidx.test.InstrumentationRegistry;
 
 import com.android.server.PackageWatchdog.PackageHealthObserver;
 import com.android.server.PackageWatchdog.PackageHealthObserverImpact;
@@ -76,11 +77,12 @@
         TestObserver observer3 = new TestObserver(OBSERVER_NAME_3);
 
         // Start observing for observer1 which will be unregistered
-        watchdog.startObservingHealth(observer1, Arrays.asList(APP_A), SHORT_DURATION);
+        watchdog.startObservingHealth(observer1, Arrays.asList(APP_A), SHORT_DURATION, false);
         // Start observing for observer2 which will expire
-        watchdog.startObservingHealth(observer2, Arrays.asList(APP_A, APP_B), SHORT_DURATION);
+        watchdog.startObservingHealth(observer2, Arrays.asList(APP_A, APP_B), SHORT_DURATION,
+                false);
         // Start observing for observer3 which will have expiry duration reduced
-        watchdog.startObservingHealth(observer3, Arrays.asList(APP_A), LONG_DURATION);
+        watchdog.startObservingHealth(observer3, Arrays.asList(APP_A), LONG_DURATION, false);
 
         // Verify packages observed at start
         // 1
@@ -143,8 +145,9 @@
         TestObserver observer1 = new TestObserver(OBSERVER_NAME_1);
         TestObserver observer2 = new TestObserver(OBSERVER_NAME_2);
 
-        watchdog1.startObservingHealth(observer1, Arrays.asList(APP_A), SHORT_DURATION);
-        watchdog1.startObservingHealth(observer2, Arrays.asList(APP_A, APP_B), SHORT_DURATION);
+        watchdog1.startObservingHealth(observer1, Arrays.asList(APP_A), SHORT_DURATION, false);
+        watchdog1.startObservingHealth(observer2, Arrays.asList(APP_A, APP_B), SHORT_DURATION,
+                false);
 
         // Verify 2 observers are registered and saved internally
         // 1
@@ -190,8 +193,8 @@
         TestObserver observer1 = new TestObserver(OBSERVER_NAME_1);
         TestObserver observer2 = new TestObserver(OBSERVER_NAME_2);
 
-        watchdog.startObservingHealth(observer2, Arrays.asList(APP_A), SHORT_DURATION);
-        watchdog.startObservingHealth(observer1, Arrays.asList(APP_A), SHORT_DURATION);
+        watchdog.startObservingHealth(observer2, Arrays.asList(APP_A), SHORT_DURATION, false);
+        watchdog.startObservingHealth(observer1, Arrays.asList(APP_A), SHORT_DURATION, false);
 
         // Then fail APP_A below the threshold
         for (int i = 0; i < TRIGGER_FAILURE_COUNT - 1; i++) {
@@ -217,8 +220,8 @@
         TestObserver observer2 = new TestObserver(OBSERVER_NAME_2);
 
 
-        watchdog.startObservingHealth(observer2, Arrays.asList(APP_A), SHORT_DURATION);
-        watchdog.startObservingHealth(observer1, Arrays.asList(APP_B), SHORT_DURATION);
+        watchdog.startObservingHealth(observer2, Arrays.asList(APP_A), SHORT_DURATION, false);
+        watchdog.startObservingHealth(observer1, Arrays.asList(APP_B), SHORT_DURATION, false);
 
         // Then fail APP_C (not observed) above the threshold
         for (int i = 0; i < TRIGGER_FAILURE_COUNT; i++) {
@@ -252,7 +255,7 @@
                 }
             };
 
-        watchdog.startObservingHealth(observer, Arrays.asList(APP_A), SHORT_DURATION);
+        watchdog.startObservingHealth(observer, Arrays.asList(APP_A), SHORT_DURATION, false);
 
         // Then fail APP_A (different version) above the threshold
         for (int i = 0; i < TRIGGER_FAILURE_COUNT; i++) {
@@ -285,13 +288,13 @@
 
         // Start observing for all impact observers
         watchdog.startObservingHealth(observerNone, Arrays.asList(APP_A, APP_B, APP_C, APP_D),
-                SHORT_DURATION);
+                SHORT_DURATION, false);
         watchdog.startObservingHealth(observerHigh, Arrays.asList(APP_A, APP_B, APP_C),
-                SHORT_DURATION);
+                SHORT_DURATION, false);
         watchdog.startObservingHealth(observerMid, Arrays.asList(APP_A, APP_B),
-                SHORT_DURATION);
+                SHORT_DURATION, false);
         watchdog.startObservingHealth(observerLow, Arrays.asList(APP_A),
-                SHORT_DURATION);
+                SHORT_DURATION, false);
 
         // Then fail all apps above the threshold
         for (int i = 0; i < TRIGGER_FAILURE_COUNT; i++) {
@@ -343,8 +346,8 @@
                 PackageHealthObserverImpact.USER_IMPACT_MEDIUM);
 
         // Start observing for observerFirst and observerSecond with failure handling
-        watchdog.startObservingHealth(observerFirst, Arrays.asList(APP_A), LONG_DURATION);
-        watchdog.startObservingHealth(observerSecond, Arrays.asList(APP_A), LONG_DURATION);
+        watchdog.startObservingHealth(observerFirst, Arrays.asList(APP_A), LONG_DURATION, false);
+        watchdog.startObservingHealth(observerSecond, Arrays.asList(APP_A), LONG_DURATION, false);
 
         // Then fail APP_A above the threshold
         for (int i = 0; i < TRIGGER_FAILURE_COUNT; i++) {
@@ -421,8 +424,8 @@
                 PackageHealthObserverImpact.USER_IMPACT_HIGH);
 
         // Start observing for observer1 and observer2 with failure handling
-        watchdog.startObservingHealth(observer2, Arrays.asList(APP_A), SHORT_DURATION);
-        watchdog.startObservingHealth(observer1, Arrays.asList(APP_A), SHORT_DURATION);
+        watchdog.startObservingHealth(observer2, Arrays.asList(APP_A), SHORT_DURATION, false);
+        watchdog.startObservingHealth(observer1, Arrays.asList(APP_A), SHORT_DURATION, false);
 
         // Then fail APP_A above the threshold
         for (int i = 0; i < TRIGGER_FAILURE_COUNT; i++) {
@@ -438,6 +441,49 @@
         assertEquals(0, observer2.mFailedPackages.size());
     }
 
+    /**
+     * Test explicit health check status determines package failure or success on expiry
+     */
+    @Test
+    public void testPackageFailureExplicitHealthCheck() throws Exception {
+        PackageWatchdog watchdog = createWatchdog();
+        TestObserver observer1 = new TestObserver(OBSERVER_NAME_1,
+                PackageHealthObserverImpact.USER_IMPACT_HIGH);
+        TestObserver observer2 = new TestObserver(OBSERVER_NAME_2,
+                PackageHealthObserverImpact.USER_IMPACT_HIGH);
+        TestObserver observer3 = new TestObserver(OBSERVER_NAME_3,
+                PackageHealthObserverImpact.USER_IMPACT_HIGH);
+
+
+        // Start observing with explicit health checks for APP_A and APP_B respectively
+        // with observer1 and observer2
+        watchdog.startObservingHealth(observer1, Arrays.asList(APP_A), SHORT_DURATION, true);
+        watchdog.startObservingHealth(observer2, Arrays.asList(APP_B), SHORT_DURATION, true);
+        // Explicit health check passed for APP_A (observer1 is aware)
+        watchdog.onExplicitHealthCheckPassed(APP_A);
+        // Start observing APP_A with explicit health checks for observer3.
+        // Observer3 didn't exist when we got the explicit health check above, so
+        // it starts out with a non-passing explicit health check and has to wait for a pass
+        // otherwise it would be notified of APP_A failure on expiry
+        watchdog.startObservingHealth(observer3, Arrays.asList(APP_A), SHORT_DURATION, true);
+
+        // Then expire observers
+        Thread.sleep(SHORT_DURATION);
+        // Run handler so package failures are dispatched to observers
+        mTestLooper.dispatchAll();
+
+        // Verify observer1 is not notified
+        assertEquals(0, observer1.mFailedPackages.size());
+
+        // Verify observer2 is notifed because health checks for APP_B never passed
+        assertEquals(1, observer2.mFailedPackages.size());
+        assertEquals(APP_B, observer2.mFailedPackages.get(0));
+
+        // Verify observer3 is notifed because health checks for APP_A did not pass before expiry
+        assertEquals(1, observer3.mFailedPackages.size());
+        assertEquals(APP_A, observer3.mFailedPackages.get(0));
+    }
+
     private PackageWatchdog createWatchdog() {
         return new PackageWatchdog(InstrumentationRegistry.getContext(),
                 mTestLooper.getLooper());
diff --git a/tests/RcsTests/Android.mk b/tests/RcsTests/Android.mk
index 7b348d7..a276584 100644
--- a/tests/RcsTests/Android.mk
+++ b/tests/RcsTests/Android.mk
@@ -11,7 +11,7 @@
 
 LOCAL_CERTIFICATE := platform
 LOCAL_JAVA_LIBRARIES := android.test.runner android.test.base
-LOCAL_STATIC_JAVA_LIBRARIES := junit android-support-test mockito-target-minus-junit4 truth-prebuilt
+LOCAL_STATIC_JAVA_LIBRARIES := junit androidx.test.rules mockito-target-minus-junit4 truth-prebuilt
 
 include $(BUILD_PACKAGE)
 
diff --git a/tests/RcsTests/AndroidManifest.xml b/tests/RcsTests/AndroidManifest.xml
index a7e7d47..b1706a0 100644
--- a/tests/RcsTests/AndroidManifest.xml
+++ b/tests/RcsTests/AndroidManifest.xml
@@ -6,6 +6,6 @@
         <uses-library android:name="android.test.runner" />
     </application>
 
-    <instrumentation android:name="android.support.test.runner.AndroidJUnitRunner"
+    <instrumentation android:name="androidx.test.runner.AndroidJUnitRunner"
                      android:targetPackage="com.android.tests.rcs"/>
 </manifest>
diff --git a/tests/RcsTests/src/com/android/tests/ims/RcsGroupThreadIconChangedEventTest.java b/tests/RcsTests/src/com/android/tests/ims/RcsGroupThreadIconChangedEventTest.java
index 89d32ab..e898942 100644
--- a/tests/RcsTests/src/com/android/tests/ims/RcsGroupThreadIconChangedEventTest.java
+++ b/tests/RcsTests/src/com/android/tests/ims/RcsGroupThreadIconChangedEventTest.java
@@ -19,10 +19,11 @@
 
 import android.net.Uri;
 import android.os.Parcel;
-import android.support.test.runner.AndroidJUnit4;
 import android.telephony.ims.RcsGroupThreadIconChangedEvent;
 import android.telephony.ims.RcsGroupThreadIconChangedEventDescriptor;
 
+import androidx.test.runner.AndroidJUnit4;
+
 import org.junit.Test;
 import org.junit.runner.RunWith;
 
diff --git a/tests/RcsTests/src/com/android/tests/ims/RcsGroupThreadNameChangedEventTest.java b/tests/RcsTests/src/com/android/tests/ims/RcsGroupThreadNameChangedEventTest.java
index 726b9cd..356688d 100644
--- a/tests/RcsTests/src/com/android/tests/ims/RcsGroupThreadNameChangedEventTest.java
+++ b/tests/RcsTests/src/com/android/tests/ims/RcsGroupThreadNameChangedEventTest.java
@@ -18,10 +18,11 @@
 import static com.google.common.truth.Truth.assertThat;
 
 import android.os.Parcel;
-import android.support.test.runner.AndroidJUnit4;
 import android.telephony.ims.RcsGroupThreadNameChangedEvent;
 import android.telephony.ims.RcsGroupThreadNameChangedEventDescriptor;
 
+import androidx.test.runner.AndroidJUnit4;
+
 import org.junit.Test;
 import org.junit.runner.RunWith;
 
diff --git a/tests/RcsTests/src/com/android/tests/ims/RcsGroupThreadParticipantJoinedEventTest.java b/tests/RcsTests/src/com/android/tests/ims/RcsGroupThreadParticipantJoinedEventTest.java
index a109310..572fcb8 100644
--- a/tests/RcsTests/src/com/android/tests/ims/RcsGroupThreadParticipantJoinedEventTest.java
+++ b/tests/RcsTests/src/com/android/tests/ims/RcsGroupThreadParticipantJoinedEventTest.java
@@ -18,10 +18,11 @@
 import static com.google.common.truth.Truth.assertThat;
 
 import android.os.Parcel;
-import android.support.test.runner.AndroidJUnit4;
 import android.telephony.ims.RcsGroupThreadParticipantJoinedEvent;
 import android.telephony.ims.RcsGroupThreadParticipantJoinedEventDescriptor;
 
+import androidx.test.runner.AndroidJUnit4;
+
 import org.junit.Test;
 import org.junit.runner.RunWith;
 
diff --git a/tests/RcsTests/src/com/android/tests/ims/RcsGroupThreadParticipantLeftEventTest.java b/tests/RcsTests/src/com/android/tests/ims/RcsGroupThreadParticipantLeftEventTest.java
index de2688c..038b2e8 100644
--- a/tests/RcsTests/src/com/android/tests/ims/RcsGroupThreadParticipantLeftEventTest.java
+++ b/tests/RcsTests/src/com/android/tests/ims/RcsGroupThreadParticipantLeftEventTest.java
@@ -18,10 +18,11 @@
 import static com.google.common.truth.Truth.assertThat;
 
 import android.os.Parcel;
-import android.support.test.runner.AndroidJUnit4;
 import android.telephony.ims.RcsGroupThreadParticipantLeftEvent;
 import android.telephony.ims.RcsGroupThreadParticipantLeftEventDescriptor;
 
+import androidx.test.runner.AndroidJUnit4;
+
 import org.junit.Test;
 import org.junit.runner.RunWith;
 
diff --git a/tests/RcsTests/src/com/android/tests/ims/RcsParticipantAliasChangedEventTest.java b/tests/RcsTests/src/com/android/tests/ims/RcsParticipantAliasChangedEventTest.java
index 5724054..283c71b 100644
--- a/tests/RcsTests/src/com/android/tests/ims/RcsParticipantAliasChangedEventTest.java
+++ b/tests/RcsTests/src/com/android/tests/ims/RcsParticipantAliasChangedEventTest.java
@@ -18,10 +18,11 @@
 import static com.google.common.truth.Truth.assertThat;
 
 import android.os.Parcel;
-import android.support.test.runner.AndroidJUnit4;
 import android.telephony.ims.RcsParticipantAliasChangedEvent;
 import android.telephony.ims.RcsParticipantAliasChangedEventDescriptor;
 
+import androidx.test.runner.AndroidJUnit4;
+
 import org.junit.Test;
 import org.junit.runner.RunWith;
 
diff --git a/tests/RcsTests/src/com/android/tests/ims/RcsParticipantQueryParamsTest.java b/tests/RcsTests/src/com/android/tests/ims/RcsParticipantQueryParamsTest.java
index 6361a39..2d95513 100644
--- a/tests/RcsTests/src/com/android/tests/ims/RcsParticipantQueryParamsTest.java
+++ b/tests/RcsTests/src/com/android/tests/ims/RcsParticipantQueryParamsTest.java
@@ -18,9 +18,10 @@
 import static com.google.common.truth.Truth.assertThat;
 
 import android.os.Parcel;
-import android.support.test.runner.AndroidJUnit4;
 import android.telephony.ims.RcsParticipantQueryParams;
 
+import androidx.test.runner.AndroidJUnit4;
+
 import org.junit.Test;
 import org.junit.runner.RunWith;
 
diff --git a/tests/RcsTests/src/com/android/tests/ims/RcsThreadQueryParamsTest.java b/tests/RcsTests/src/com/android/tests/ims/RcsThreadQueryParamsTest.java
index beb4f8a..fb51bda 100644
--- a/tests/RcsTests/src/com/android/tests/ims/RcsThreadQueryParamsTest.java
+++ b/tests/RcsTests/src/com/android/tests/ims/RcsThreadQueryParamsTest.java
@@ -21,10 +21,11 @@
 import static com.google.common.truth.Truth.assertThat;
 
 import android.os.Parcel;
-import android.support.test.runner.AndroidJUnit4;
 import android.telephony.ims.RcsParticipant;
 import android.telephony.ims.RcsThreadQueryParams;
 
+import androidx.test.runner.AndroidJUnit4;
+
 import org.junit.Test;
 import org.junit.runner.RunWith;
 
diff --git a/tests/RemoteDisplayProvider/Android.bp b/tests/RemoteDisplayProvider/Android.bp
new file mode 100644
index 0000000..6c7798f
--- /dev/null
+++ b/tests/RemoteDisplayProvider/Android.bp
@@ -0,0 +1,23 @@
+// Copyright (C) 2013 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.
+
+// Build the application.
+android_test {
+    name: "RemoteDisplayProviderTest",
+    sdk_version: "system_current",
+    srcs: ["src/**/*.java"],
+    resource_dirs: ["res"],
+    libs: ["com.android.media.remotedisplay"],
+    certificate: "platform",
+}
diff --git a/tests/RemoteDisplayProvider/Android.mk b/tests/RemoteDisplayProvider/Android.mk
deleted file mode 100644
index 43bf024..0000000
--- a/tests/RemoteDisplayProvider/Android.mk
+++ /dev/null
@@ -1,26 +0,0 @@
-# Copyright (C) 2013 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.
-
-LOCAL_PATH := $(call my-dir)
-
-# Build the application.
-include $(CLEAR_VARS)
-LOCAL_PACKAGE_NAME := RemoteDisplayProviderTest
-LOCAL_MODULE_TAGS := tests
-LOCAL_SDK_VERSION := system_current
-LOCAL_SRC_FILES := $(call all-java-files-under, src)
-LOCAL_RESOURCE_DIR = $(LOCAL_PATH)/res
-LOCAL_JAVA_LIBRARIES := com.android.media.remotedisplay
-LOCAL_CERTIFICATE := platform
-include $(BUILD_PACKAGE)
diff --git a/tests/RenderThreadTest/Android.bp b/tests/RenderThreadTest/Android.bp
new file mode 100644
index 0000000..1659776
--- /dev/null
+++ b/tests/RenderThreadTest/Android.bp
@@ -0,0 +1,10 @@
+android_test {
+    name: "RenderThreadTest",
+    // Only compile source java files in this apk.
+    srcs: ["src/**/*.java"],
+    platform_apis: true,
+    static_libs: ["android-common"],
+    optimize: {
+        enabled: false,
+    },
+}
diff --git a/tests/RenderThreadTest/Android.mk b/tests/RenderThreadTest/Android.mk
deleted file mode 100644
index 4e5f35b..0000000
--- a/tests/RenderThreadTest/Android.mk
+++ /dev/null
@@ -1,19 +0,0 @@
-LOCAL_PATH:= $(call my-dir)
-include $(CLEAR_VARS)
-
-LOCAL_MODULE_TAGS := tests
-
-# Only compile source java files in this apk.
-LOCAL_SRC_FILES := $(call all-java-files-under, src)
-
-LOCAL_PACKAGE_NAME := RenderThreadTest
-LOCAL_PRIVATE_PLATFORM_APIS := true
-
-LOCAL_STATIC_JAVA_LIBRARIES += android-common
-
-LOCAL_PROGUARD_ENABLED := disabled
-
-include $(BUILD_PACKAGE)
-
-# Use the following include to make our test apk.
-include $(call all-makefiles-under,$(LOCAL_PATH))
diff --git a/tests/RollbackTest/Android.bp b/tests/RollbackTest/Android.bp
new file mode 100644
index 0000000..8be721a
--- /dev/null
+++ b/tests/RollbackTest/Android.bp
@@ -0,0 +1,130 @@
+// Copyright (C) 2019 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.
+
+android_test_helper_app {
+    name: "RollbackTestAppAv1",
+    manifest: "TestApp/Av1.xml",
+    sdk_version: "current",
+    srcs: ["TestApp/src/**/*.java"],
+    resource_dirs: ["TestApp/res_v1"],
+}
+
+android_test_helper_app {
+    name: "RollbackTestAppAv2",
+    manifest: "TestApp/Av2.xml",
+    sdk_version: "current",
+    srcs: ["TestApp/src/**/*.java"],
+    resource_dirs: ["TestApp/res_v2"],
+}
+
+android_test_helper_app {
+    name: "RollbackTestAppACrashingV2",
+    manifest: "TestApp/ACrashingV2.xml",
+    sdk_version: "current",
+    srcs: ["TestApp/src/**/*.java"],
+    resource_dirs: ["TestApp/res_v2"],
+}
+
+android_test_helper_app {
+    name: "RollbackTestAppBv1",
+    manifest: "TestApp/Bv1.xml",
+    sdk_version: "current",
+    srcs: ["TestApp/src/**/*.java"],
+    resource_dirs: ["TestApp/res_v1"],
+}
+
+android_test_helper_app {
+    name: "RollbackTestAppBv2",
+    manifest: "TestApp/Bv2.xml",
+    sdk_version: "current",
+    srcs: ["TestApp/src/**/*.java"],
+    resource_dirs: ["TestApp/res_v2"],
+}
+
+android_test_helper_app {
+    name: "RollbackTestAppASplitV1",
+    manifest: "TestApp/Av1.xml",
+    sdk_version: "current",
+    srcs: ["TestApp/src/**/*.java"],
+    resource_dirs: ["TestApp/res_v1"],
+    package_splits: ["anydpi"],
+}
+
+android_test_helper_app {
+    name: "RollbackTestAppASplitV2",
+    manifest: "TestApp/Av2.xml",
+    sdk_version: "current",
+    srcs: ["TestApp/src/**/*.java"],
+    resource_dirs: ["TestApp/res_v2"],
+    package_splits: ["anydpi"],
+}
+
+apex {
+    name: "com.android.tests.rollback.testapex.RollbackTestApexV1",
+    manifest: "TestApex/RollbackTestApexV1.json",
+    file_contexts: "apex.test",
+    prebuilts: ["RollbackTestApex.prebuilt.txt"],
+    key: "RollbackTestApex.key",
+    installable: false,
+}
+
+apex {
+    name: "com.android.tests.rollback.testapex.RollbackTestApexV2",
+    manifest: "TestApex/RollbackTestApexV2.json",
+    file_contexts: "apex.test",
+    prebuilts: ["RollbackTestApex.prebuilt.txt"],
+    key: "RollbackTestApex.key",
+    installable: false,
+}
+
+apex_key {
+    name: "RollbackTestApex.key",
+    public_key: "TestApex/com.android.tests.rollback.testapex.avbpubkey",
+    private_key: "TestApex/com.android.tests.rollback.testapex.pem",
+    installable: false,
+}
+
+prebuilt_etc {
+    name: "RollbackTestApex.prebuilt.txt",
+    src: "TestApex/RollbackTestApex.prebuilt.txt",
+}
+
+android_test {
+    name: "RollbackTest",
+    manifest: "RollbackTest/AndroidManifest.xml",
+    srcs: ["RollbackTest/src/**/*.java"],
+    static_libs: ["androidx.test.rules"],
+    test_suites: ["general-tests"],
+    java_resources: [
+        ":RollbackTestAppAv1",
+        ":RollbackTestAppAv2",
+        ":RollbackTestAppACrashingV2",
+        ":RollbackTestAppBv1",
+        ":RollbackTestAppBv2",
+        ":RollbackTestAppASplitV1",
+        ":RollbackTestAppASplitV2",
+        ":com.android.tests.rollback.testapex.RollbackTestApexV1",
+        ":com.android.tests.rollback.testapex.RollbackTestApexV2",
+    ],
+    test_config: "RollbackTest.xml",
+    sdk_version: "system_current",
+}
+
+java_test_host {
+    name: "StagedRollbackTest",
+    srcs: ["StagedRollbackTest/src/**/*.java"],
+    libs: ["tradefed"],
+    test_suites: ["general-tests"],
+    test_config: "StagedRollbackTest.xml",
+}
diff --git a/tests/RollbackTest/Android.mk b/tests/RollbackTest/Android.mk
deleted file mode 100644
index db9376b..0000000
--- a/tests/RollbackTest/Android.mk
+++ /dev/null
@@ -1,148 +0,0 @@
-# Copyright (C) 2018 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.
-
-LOCAL_PATH:= $(call my-dir)
-
-# RollbackTestAppAv1.apk
-include $(CLEAR_VARS)
-LOCAL_MODULE_TAGS := optional
-LOCAL_MODULE_PATH := $(TARGET_OUT_DATA_APPS)
-LOCAL_SDK_VERSION := current
-LOCAL_SRC_FILES := $(call all-java-files-under, TestApp/src)
-LOCAL_MANIFEST_FILE := TestApp/Av1.xml
-LOCAL_RESOURCE_DIR := $(LOCAL_PATH)/TestApp/res_v1
-LOCAL_PACKAGE_NAME := RollbackTestAppAv1
-include $(BUILD_PACKAGE)
-ROLLBACK_TEST_APP_AV1 := $(LOCAL_INSTALLED_MODULE)
-
-# RollbackTestAppAv2.apk
-include $(CLEAR_VARS)
-LOCAL_MODULE_TAGS := optional
-LOCAL_MODULE_PATH := $(TARGET_OUT_DATA_APPS)
-LOCAL_SDK_VERSION := current
-LOCAL_SRC_FILES := $(call all-java-files-under, TestApp/src)
-LOCAL_MANIFEST_FILE := TestApp/Av2.xml
-LOCAL_RESOURCE_DIR := $(LOCAL_PATH)/TestApp/res_v2
-LOCAL_PACKAGE_NAME := RollbackTestAppAv2
-include $(BUILD_PACKAGE)
-ROLLBACK_TEST_APP_AV2 := $(LOCAL_INSTALLED_MODULE)
-
-# RollbackTestAppACrashingV2.apk
-include $(CLEAR_VARS)
-LOCAL_MODULE_TAGS := optional
-LOCAL_MODULE_PATH := $(TARGET_OUT_DATA_APPS)
-LOCAL_SDK_VERSION := current
-LOCAL_SRC_FILES := $(call all-java-files-under, TestApp/src)
-LOCAL_MANIFEST_FILE := TestApp/ACrashingV2.xml
-LOCAL_RESOURCE_DIR := $(LOCAL_PATH)/TestApp/res_v2
-LOCAL_PACKAGE_NAME := RollbackTestAppACrashingV2
-include $(BUILD_PACKAGE)
-ROLLBACK_TEST_APP_A_CRASHING_V2 := $(LOCAL_INSTALLED_MODULE)
-
-# RollbackTestAppBv1.apk
-include $(CLEAR_VARS)
-LOCAL_MODULE_TAGS := optional
-LOCAL_MODULE_PATH := $(TARGET_OUT_DATA_APPS)
-LOCAL_SDK_VERSION := current
-LOCAL_SRC_FILES := $(call all-java-files-under, TestApp/src)
-LOCAL_MANIFEST_FILE := TestApp/Bv1.xml
-LOCAL_RESOURCE_DIR := $(LOCAL_PATH)/TestApp/res_v1
-LOCAL_PACKAGE_NAME := RollbackTestAppBv1
-include $(BUILD_PACKAGE)
-ROLLBACK_TEST_APP_BV1 := $(LOCAL_INSTALLED_MODULE)
-
-# RollbackTestAppBv2.apk
-include $(CLEAR_VARS)
-LOCAL_MODULE_TAGS := optional
-LOCAL_MODULE_PATH := $(TARGET_OUT_DATA_APPS)
-LOCAL_SDK_VERSION := current
-LOCAL_SRC_FILES := $(call all-java-files-under, TestApp/src)
-LOCAL_MANIFEST_FILE := TestApp/Bv2.xml
-LOCAL_RESOURCE_DIR := $(LOCAL_PATH)/TestApp/res_v2
-LOCAL_PACKAGE_NAME := RollbackTestAppBv2
-include $(BUILD_PACKAGE)
-ROLLBACK_TEST_APP_BV2 := $(LOCAL_INSTALLED_MODULE)
-
-# RollbackTestAppASplitV1.apk
-include $(CLEAR_VARS)
-LOCAL_MODULE_TAGS := optional
-LOCAL_MODULE_PATH := $(TARGET_OUT_DATA_APPS)
-LOCAL_SDK_VERSION := current
-LOCAL_SRC_FILES := $(call all-java-files-under, TestApp/src)
-LOCAL_MANIFEST_FILE := TestApp/Av1.xml
-LOCAL_RESOURCE_DIR := $(LOCAL_PATH)/TestApp/res_v1
-LOCAL_PACKAGE_NAME := RollbackTestAppASplitV1
-LOCAL_PACKAGE_SPLITS := anydpi
-include $(BUILD_PACKAGE)
-ROLLBACK_TEST_APP_A_SPLIT_V1 := $(LOCAL_INSTALLED_MODULE)
-ROLLBACK_TEST_APP_A_SPLIT_V1_SPLIT := $(installed_apk_splits)
-
-# RollbackTestAppASplitV2.apk
-include $(CLEAR_VARS)
-LOCAL_MODULE_TAGS := optional
-LOCAL_MODULE_PATH := $(TARGET_OUT_DATA_APPS)
-LOCAL_SDK_VERSION := current
-LOCAL_SRC_FILES := $(call all-java-files-under, TestApp/src)
-LOCAL_MANIFEST_FILE := TestApp/Av2.xml
-LOCAL_RESOURCE_DIR := $(LOCAL_PATH)/TestApp/res_v2
-LOCAL_PACKAGE_NAME := RollbackTestAppASplitV2
-LOCAL_PACKAGE_SPLITS := anydpi
-include $(BUILD_PACKAGE)
-ROLLBACK_TEST_APP_A_SPLIT_V2 := $(LOCAL_INSTALLED_MODULE)
-ROLLBACK_TEST_APP_A_SPLIT_V2_SPLIT := $(installed_apk_splits)
-
-# RollbackTest
-include $(CLEAR_VARS)
-LOCAL_SRC_FILES := $(call all-java-files-under, RollbackTest/src)
-LOCAL_PACKAGE_NAME := RollbackTest
-LOCAL_MODULE_TAGS := tests
-LOCAL_STATIC_JAVA_LIBRARIES := android-support-test
-LOCAL_COMPATIBILITY_SUITE := general-tests
-LOCAL_JAVA_RESOURCE_FILES := \
-  $(ROLLBACK_TEST_APP_AV1) \
-  $(ROLLBACK_TEST_APP_AV2) \
-  $(ROLLBACK_TEST_APP_A_CRASHING_V2) \
-  $(ROLLBACK_TEST_APP_BV1) \
-  $(ROLLBACK_TEST_APP_BV2) \
-  $(ROLLBACK_TEST_APP_A_SPLIT_V1) \
-  $(ROLLBACK_TEST_APP_A_SPLIT_V1_SPLIT) \
-  $(ROLLBACK_TEST_APP_A_SPLIT_V2) \
-  $(ROLLBACK_TEST_APP_A_SPLIT_V2_SPLIT) \
-  $(ROLLBACK_TEST_APEX_V1) \
-  $(ROLLBACK_TEST_APEX_V2)
-LOCAL_MANIFEST_FILE := RollbackTest/AndroidManifest.xml
-LOCAL_SDK_VERSION := system_current
-LOCAL_TEST_CONFIG := RollbackTest.xml
-include $(BUILD_PACKAGE)
-
-# StagedRollbackTest
-include $(CLEAR_VARS)
-LOCAL_SRC_FILES := $(call all-java-files-under, StagedRollbackTest/src)
-LOCAL_MODULE := StagedRollbackTest
-LOCAL_MODULE_TAGS := tests
-LOCAL_JAVA_LIBRARIES := tradefed
-LOCAL_COMPATIBILITY_SUITE := general-tests
-LOCAL_TEST_CONFIG := StagedRollbackTest.xml
-include $(BUILD_HOST_JAVA_LIBRARY)
-
-# Clean up local variables
-ROLLBACK_TEST_APP_AV1 :=
-ROLLBACK_TEST_APP_AV2 :=
-ROLLBACK_TEST_APP_A_CRASHING_V2 :=
-ROLLBACK_TEST_APP_A_SPLIT_V1 :=
-ROLLBACK_TEST_APP_A_SPLIT_V1_SPLIT :=
-ROLLBACK_TEST_APP_A_SPLIT_V2 :=
-ROLLBACK_TEST_APP_A_SPLIT_V2_SPLIT :=
-ROLLBACK_TEST_APP_BV1 :=
-ROLLBACK_TEST_APP_BV2 :=
diff --git a/tests/RollbackTest/RollbackTest.xml b/tests/RollbackTest/RollbackTest.xml
index ac39f85..70cd867 100644
--- a/tests/RollbackTest/RollbackTest.xml
+++ b/tests/RollbackTest/RollbackTest.xml
@@ -20,7 +20,7 @@
     </target_preparer>
     <test class="com.android.tradefed.testtype.AndroidJUnitTest" >
         <option name="package" value="com.android.tests.rollback" />
-        <option name="runner" value="android.support.test.runner.AndroidJUnitRunner" />
+        <option name="runner" value="androidx.test.runner.AndroidJUnitRunner" />
 
         <!-- Exclude the StagedRollbackTest tests, which needs to be specially
              driven from the StagedRollbackTest host test -->
diff --git a/tests/RollbackTest/RollbackTest/AndroidManifest.xml b/tests/RollbackTest/RollbackTest/AndroidManifest.xml
index e57a768..5380dc9 100644
--- a/tests/RollbackTest/RollbackTest/AndroidManifest.xml
+++ b/tests/RollbackTest/RollbackTest/AndroidManifest.xml
@@ -24,7 +24,7 @@
     </application>
 
 
-    <instrumentation android:name="android.support.test.runner.AndroidJUnitRunner"
+    <instrumentation android:name="androidx.test.runner.AndroidJUnitRunner"
                      android:targetPackage="com.android.tests.rollback"
                      android:label="Rollback Test"/>
 
diff --git a/tests/RollbackTest/RollbackTest/src/com/android/tests/rollback/LocalIntentSender.java b/tests/RollbackTest/RollbackTest/src/com/android/tests/rollback/LocalIntentSender.java
index ddcf1da..267ef73 100644
--- a/tests/RollbackTest/RollbackTest/src/com/android/tests/rollback/LocalIntentSender.java
+++ b/tests/RollbackTest/RollbackTest/src/com/android/tests/rollback/LocalIntentSender.java
@@ -21,7 +21,8 @@
 import android.content.Context;
 import android.content.Intent;
 import android.content.IntentSender;
-import android.support.test.InstrumentationRegistry;
+
+import androidx.test.InstrumentationRegistry;
 
 import java.util.concurrent.BlockingQueue;
 import java.util.concurrent.LinkedBlockingQueue;
diff --git a/tests/RollbackTest/RollbackTest/src/com/android/tests/rollback/RollbackBroadcastReceiver.java b/tests/RollbackTest/RollbackTest/src/com/android/tests/rollback/RollbackBroadcastReceiver.java
index e10f866..8a925b9 100644
--- a/tests/RollbackTest/RollbackTest/src/com/android/tests/rollback/RollbackBroadcastReceiver.java
+++ b/tests/RollbackTest/RollbackTest/src/com/android/tests/rollback/RollbackBroadcastReceiver.java
@@ -20,9 +20,10 @@
 import android.content.Context;
 import android.content.Intent;
 import android.content.IntentFilter;
-import android.support.test.InstrumentationRegistry;
 import android.util.Log;
 
+import androidx.test.InstrumentationRegistry;
+
 import java.util.concurrent.BlockingQueue;
 import java.util.concurrent.LinkedBlockingQueue;
 import java.util.concurrent.TimeUnit;
diff --git a/tests/RollbackTest/RollbackTest/src/com/android/tests/rollback/RollbackTest.java b/tests/RollbackTest/RollbackTest/src/com/android/tests/rollback/RollbackTest.java
index 7be83ed..7505230 100644
--- a/tests/RollbackTest/RollbackTest/src/com/android/tests/rollback/RollbackTest.java
+++ b/tests/RollbackTest/RollbackTest/src/com/android/tests/rollback/RollbackTest.java
@@ -19,35 +19,34 @@
 import static com.android.tests.rollback.RollbackTestUtils.assertPackageRollbackInfoEquals;
 import static com.android.tests.rollback.RollbackTestUtils.assertRollbackInfoEquals;
 import static com.android.tests.rollback.RollbackTestUtils.getUniqueRollbackInfoForPackage;
-
-import android.Manifest;
-import android.app.ActivityManager;
-import android.content.BroadcastReceiver;
-import android.content.ComponentName;
-import android.content.Context;
-import android.content.Intent;
-import android.content.IntentFilter;
-import android.content.pm.VersionedPackage;
-import android.content.rollback.RollbackInfo;
-import android.content.rollback.RollbackManager;
-import android.os.Handler;
-import android.os.HandlerThread;
-import android.provider.DeviceConfig;
-import android.support.test.InstrumentationRegistry;
-import android.util.Log;
+import static com.android.tests.rollback.RollbackTestUtils.processUserData;
 
 import static org.junit.Assert.assertEquals;
 import static org.junit.Assert.assertNotNull;
 import static org.junit.Assert.assertNull;
 import static org.junit.Assert.fail;
 
+import android.Manifest;
+import android.app.ActivityManager;
+import android.content.BroadcastReceiver;
+import android.content.Context;
+import android.content.Intent;
+import android.content.IntentFilter;
+import android.content.pm.VersionedPackage;
+import android.content.rollback.RollbackInfo;
+import android.content.rollback.RollbackManager;
+import android.provider.DeviceConfig;
+import android.util.Log;
+
+import androidx.test.InstrumentationRegistry;
+
+import org.junit.Ignore;
 import org.junit.Test;
 import org.junit.runner.RunWith;
 import org.junit.runners.JUnit4;
 
 import java.util.Collections;
 import java.util.concurrent.BlockingQueue;
-import java.util.concurrent.LinkedBlockingQueue;
 import java.util.concurrent.SynchronousQueue;
 import java.util.concurrent.TimeUnit;
 
@@ -381,6 +380,83 @@
             // Check that the data has expired after the expiration time (with a buffer of 1 second)
             Thread.sleep(expirationTime / 2);
             assertNull(getUniqueRollbackInfoForPackage(rm.getAvailableRollbacks(), TEST_APP_A));
+
+        } finally {
+            DeviceConfig.setProperty(DeviceConfig.Rollback.BOOT_NAMESPACE,
+                    DeviceConfig.Rollback.ROLLBACK_LIFETIME_IN_MILLIS,
+                    Long.toString(defaultExpirationTime), false /* makeDefault*/);
+            RollbackTestUtils.dropShellPermissionIdentity();
+        }
+    }
+
+    /**
+     * Test that changing time on device does not affect the duration of time that we keep
+     * rollback available
+     */
+    @Test
+    public void testTimeChangeDoesNotAffectLifetime() throws Exception {
+        long expirationTime = TimeUnit.SECONDS.toMillis(30);
+        long defaultExpirationTime = TimeUnit.HOURS.toMillis(48);
+        RollbackManager rm = RollbackTestUtils.getRollbackManager();
+
+        try {
+            RollbackTestUtils.adoptShellPermissionIdentity(
+                    Manifest.permission.INSTALL_PACKAGES,
+                    Manifest.permission.DELETE_PACKAGES,
+                    Manifest.permission.MANAGE_ROLLBACKS,
+                    Manifest.permission.WRITE_DEVICE_CONFIG,
+                    Manifest.permission.SET_TIME);
+
+            DeviceConfig.setProperty(DeviceConfig.Rollback.BOOT_NAMESPACE,
+                    DeviceConfig.Rollback.ROLLBACK_LIFETIME_IN_MILLIS,
+                    Long.toString(expirationTime), false /* makeDefault*/);
+
+            // Pull the new expiration time from DeviceConfig
+            rm.reloadPersistedData();
+
+            // Install app A with rollback enabled
+            RollbackTestUtils.uninstall(TEST_APP_A);
+            RollbackTestUtils.install("RollbackTestAppAv1.apk", false);
+            RollbackTestUtils.install("RollbackTestAppAv2.apk", true);
+            assertEquals(2, RollbackTestUtils.getInstalledVersion(TEST_APP_A));
+
+            Thread.sleep(expirationTime / 2);
+
+            // Install app B with rollback enabled
+            RollbackTestUtils.uninstall(TEST_APP_B);
+            RollbackTestUtils.install("RollbackTestAppBv1.apk", false);
+            RollbackTestUtils.install("RollbackTestAppBv2.apk", true);
+            assertEquals(2, RollbackTestUtils.getInstalledVersion(TEST_APP_B));
+            // 1 second buffer
+            Thread.sleep(1000);
+
+            try {
+                // Change the time
+                RollbackTestUtils.forwardTimeBy(expirationTime);
+
+                // 1 second buffer to allow Rollback Manager to handle time change before loading
+                // persisted data
+                Thread.sleep(1000);
+
+                // Load timestamps from storage
+                rm.reloadPersistedData();
+
+                // Wait until rollback for app A has expired
+                // This will trigger an expiration run that should expire app A but not B
+                Thread.sleep(expirationTime / 2);
+                assertNull(getUniqueRollbackInfoForPackage(rm.getAvailableRollbacks(), TEST_APP_A));
+
+                // Rollback for app B should not be expired
+                RollbackInfo rollback = getUniqueRollbackInfoForPackage(
+                        rm.getAvailableRollbacks(), TEST_APP_B);
+                assertRollbackInfoEquals(TEST_APP_B, 2, 1, rollback);
+
+                // Wait until rollback for app B has expired
+                Thread.sleep(expirationTime / 2);
+                assertNull(getUniqueRollbackInfoForPackage(rm.getAvailableRollbacks(), TEST_APP_B));
+            } finally {
+                RollbackTestUtils.forwardTimeBy(-expirationTime);
+            }
         } finally {
             DeviceConfig.setProperty(DeviceConfig.Rollback.BOOT_NAMESPACE,
                     DeviceConfig.Rollback.ROLLBACK_LIFETIME_IN_MILLIS,
@@ -427,52 +503,6 @@
         }
     }
 
-    private static final String NO_RESPONSE = "NO RESPONSE";
-
-    // Calls into the test app to process user data.
-    // Asserts if the user data could not be processed or was version
-    // incompatible with the previously processed user data.
-    private void processUserData(String packageName) throws Exception {
-        Intent intent = new Intent();
-        intent.setComponent(new ComponentName(packageName,
-                    "com.android.tests.rollback.testapp.ProcessUserData"));
-        Context context = InstrumentationRegistry.getContext();
-
-        HandlerThread handlerThread = new HandlerThread("RollbackTestHandlerThread");
-        handlerThread.start();
-
-        // It can sometimes take a while after rollback before the app will
-        // receive this broadcast, so try a few times in a loop.
-        String result = NO_RESPONSE;
-        for (int i = 0; result.equals(NO_RESPONSE) && i < 5; ++i) {
-            BlockingQueue<String> resultQueue = new LinkedBlockingQueue<>();
-            context.sendOrderedBroadcast(intent, null, new BroadcastReceiver() {
-                @Override
-                public void onReceive(Context context, Intent intent) {
-                    if (getResultCode() == 1) {
-                        resultQueue.add("OK");
-                    } else {
-                        // If the test app doesn't receive the broadcast or
-                        // fails to set the result data, then getResultData
-                        // here returns the initial NO_RESPONSE data passed to
-                        // the sendOrderedBroadcast call.
-                        resultQueue.add(getResultData());
-                    }
-                }
-            }, new Handler(handlerThread.getLooper()), 0, NO_RESPONSE, null);
-
-            result = resultQueue.poll(10, TimeUnit.SECONDS);
-            if (result == null) {
-                result = "ProcessUserData broadcast timed out";
-            }
-        }
-
-        handlerThread.quit();
-        if (!"OK".equals(result)) {
-            fail(result);
-        }
-    }
-
     /**
      * Test that app user data is rolled back.
      */
@@ -503,6 +533,7 @@
     /**
      * Test rollback of apks involving splits.
      */
+    @Ignore("b/127520966 build issues with splits need to be sorted out")
     @Test
     public void testRollbackWithSplits() throws Exception {
         try {
diff --git a/tests/RollbackTest/RollbackTest/src/com/android/tests/rollback/RollbackTestUtils.java b/tests/RollbackTest/RollbackTest/src/com/android/tests/rollback/RollbackTestUtils.java
index f28714c..a03fae0 100644
--- a/tests/RollbackTest/RollbackTest/src/com/android/tests/rollback/RollbackTestUtils.java
+++ b/tests/RollbackTest/RollbackTest/src/com/android/tests/rollback/RollbackTestUtils.java
@@ -16,7 +16,14 @@
 
 package com.android.tests.rollback;
 
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertNotNull;
+import static org.junit.Assert.assertNull;
+import static org.junit.Assert.fail;
+
+import android.app.AlarmManager;
 import android.content.BroadcastReceiver;
+import android.content.ComponentName;
 import android.content.Context;
 import android.content.Intent;
 import android.content.IntentFilter;
@@ -27,12 +34,11 @@
 import android.content.rollback.PackageRollbackInfo;
 import android.content.rollback.RollbackInfo;
 import android.content.rollback.RollbackManager;
-import android.support.test.InstrumentationRegistry;
+import android.os.Handler;
+import android.os.HandlerThread;
 import android.util.Log;
 
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertNotNull;
-import static org.junit.Assert.assertNull;
+import androidx.test.InstrumentationRegistry;
 
 import java.io.IOException;
 import java.io.InputStream;
@@ -58,6 +64,17 @@
         return rm;
     }
 
+    private static void setTime(long millis) {
+        Context context = InstrumentationRegistry.getContext();
+        AlarmManager am = (AlarmManager) context.getSystemService(Context.ALARM_SERVICE);
+        am.setTime(millis);
+    }
+
+    static void forwardTimeBy(long offsetMillis) {
+        setTime(System.currentTimeMillis() + offsetMillis);
+        Log.i(TAG, "Forwarded time on device by " + offsetMillis + " millis");
+    }
+
     /**
      * Returns the version of the given package installed on device.
      * Returns -1 if the package is not currently installed.
@@ -148,9 +165,7 @@
         PackageInstaller packageInstaller = context.getPackageManager().getPackageInstaller();
         PackageInstaller.SessionParams params = new PackageInstaller.SessionParams(
                 PackageInstaller.SessionParams.MODE_FULL_INSTALL);
-        if (enableRollback) {
-            params.setEnableRollback();
-        }
+        params.setEnableRollback(enableRollback);
         int sessionId = packageInstaller.createSession(params);
         session = packageInstaller.openSession(sessionId);
 
@@ -207,11 +222,9 @@
         if (staged) {
             multiPackageParams.setStaged();
         }
-        if (enableRollback) {
-            // TODO: Do we set this on the parent params, the child params, or
-            // both?
-            multiPackageParams.setEnableRollback();
-        }
+        // TODO: Do we set this on the parent params, the child params, or
+        // both?
+        multiPackageParams.setEnableRollback(enableRollback);
         int multiPackageId = packageInstaller.createSession(multiPackageParams);
         PackageInstaller.Session multiPackage = packageInstaller.openSession(multiPackageId);
 
@@ -225,9 +238,7 @@
             if (resourceName.endsWith(".apex")) {
                 params.setInstallAsApex();
             }
-            if (enableRollback) {
-                params.setEnableRollback();
-            }
+            params.setEnableRollback(enableRollback);
             int sessionId = packageInstaller.createSession(params);
             session = packageInstaller.openSession(sessionId);
 
@@ -393,4 +404,53 @@
             throw new AssertionError(e);
         }
     }
+
+    private static final String NO_RESPONSE = "NO RESPONSE";
+
+    /**
+     * Calls into the test app to process user data.
+     * Asserts if the user data could not be processed or was version
+     * incompatible with the previously processed user data.
+     */
+    static void processUserData(String packageName) {
+        Intent intent = new Intent();
+        intent.setComponent(new ComponentName(packageName,
+                    "com.android.tests.rollback.testapp.ProcessUserData"));
+        Context context = InstrumentationRegistry.getContext();
+
+        HandlerThread handlerThread = new HandlerThread("RollbackTestHandlerThread");
+        handlerThread.start();
+
+        // It can sometimes take a while after rollback before the app will
+        // receive this broadcast, so try a few times in a loop.
+        String result = NO_RESPONSE;
+        for (int i = 0; result.equals(NO_RESPONSE) && i < 5; ++i) {
+            BlockingQueue<String> resultQueue = new LinkedBlockingQueue<>();
+            context.sendOrderedBroadcast(intent, null, new BroadcastReceiver() {
+                @Override
+                public void onReceive(Context context, Intent intent) {
+                    if (getResultCode() == 1) {
+                        resultQueue.add("OK");
+                    } else {
+                        // If the test app doesn't receive the broadcast or
+                        // fails to set the result data, then getResultData
+                        // here returns the initial NO_RESPONSE data passed to
+                        // the sendOrderedBroadcast call.
+                        resultQueue.add(getResultData());
+                    }
+                }
+            }, new Handler(handlerThread.getLooper()), 0, NO_RESPONSE, null);
+
+            try {
+                result = resultQueue.take();
+            } catch (InterruptedException e) {
+                throw new AssertionError(e);
+            }
+        }
+
+        handlerThread.quit();
+        if (!"OK".equals(result)) {
+            fail(result);
+        }
+    }
 }
diff --git a/tests/RollbackTest/RollbackTest/src/com/android/tests/rollback/StagedRollbackTest.java b/tests/RollbackTest/RollbackTest/src/com/android/tests/rollback/StagedRollbackTest.java
index b65917b..59ae8d9 100644
--- a/tests/RollbackTest/RollbackTest/src/com/android/tests/rollback/StagedRollbackTest.java
+++ b/tests/RollbackTest/RollbackTest/src/com/android/tests/rollback/StagedRollbackTest.java
@@ -84,6 +84,7 @@
 
         RollbackTestUtils.install("RollbackTestAppAv1.apk", false);
         assertEquals(1, RollbackTestUtils.getInstalledVersion(TEST_APP_A));
+        RollbackTestUtils.processUserData(TEST_APP_A);
 
         RollbackTestUtils.installStaged(true, "RollbackTestAppAv2.apk");
 
@@ -98,6 +99,7 @@
     @Test
     public void testApkOnlyCommitRollback() throws Exception {
         assertEquals(2, RollbackTestUtils.getInstalledVersion(TEST_APP_A));
+        RollbackTestUtils.processUserData(TEST_APP_A);
 
         RollbackManager rm = RollbackTestUtils.getRollbackManager();
         RollbackInfo rollback = getUniqueRollbackInfoForPackage(
@@ -129,6 +131,7 @@
     @Test
     public void testApkOnlyConfirmRollback() throws Exception {
         assertEquals(1, RollbackTestUtils.getInstalledVersion(TEST_APP_A));
+        RollbackTestUtils.processUserData(TEST_APP_A);
 
         RollbackManager rm = RollbackTestUtils.getRollbackManager();
         RollbackInfo rollback = getUniqueRollbackInfoForPackage(
diff --git a/tests/RollbackTest/TestApex/Android.bp b/tests/RollbackTest/TestApex/Android.bp
deleted file mode 100644
index a2a8e17..0000000
--- a/tests/RollbackTest/TestApex/Android.bp
+++ /dev/null
@@ -1,56 +0,0 @@
-// Copyright (C) 2019 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.
-
-apex {
-    name: "com.android.tests.rollback.testapex.RollbackTestApexV1",
-    manifest: "RollbackTestApexV1.json",
-    file_contexts: "apex.test",
-    prebuilts: ["RollbackTestApex.prebuilt.txt"],
-    key: "RollbackTestApex.key",
-    installable: false,
-}
-
-apex {
-    name: "com.android.tests.rollback.testapex.RollbackTestApexV2",
-    manifest: "RollbackTestApexV2.json",
-    file_contexts: "apex.test",
-    prebuilts: ["RollbackTestApex.prebuilt.txt"],
-    key: "RollbackTestApex.key",
-    installable: false,
-}
-
-apex_key {
-    name: "RollbackTestApex.key",
-    public_key: "com.android.tests.rollback.testapex.avbpubkey",
-    private_key: "com.android.tests.rollback.testapex.pem",
-    installable: false,
-}
-
-prebuilt_etc {
-    name: "RollbackTestApex.prebuilt.txt",
-    src: "RollbackTestApex.prebuilt.txt",
-}
-
-filegroup {
-    name: "RollbackTestApexV1_filegroup",
-    srcs: [":com.android.tests.rollback.testapex.RollbackTestApexV1"],
-    export_to_make_var: "ROLLBACK_TEST_APEX_V1",
-}
-
-filegroup {
-    name: "RollbackTestApexV2_filegroup",
-    srcs: [":com.android.tests.rollback.testapex.RollbackTestApexV2"],
-    export_to_make_var: "ROLLBACK_TEST_APEX_V2",
-}
-
diff --git a/tests/SerialChat/Android.bp b/tests/SerialChat/Android.bp
new file mode 100644
index 0000000..3c18035
--- /dev/null
+++ b/tests/SerialChat/Android.bp
@@ -0,0 +1,21 @@
+//
+// Copyright (C) 2011 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.
+//
+
+android_test {
+    name: "SerialChat",
+    srcs: ["**/*.java"],
+    platform_apis: true,
+}
diff --git a/tests/SerialChat/Android.mk b/tests/SerialChat/Android.mk
deleted file mode 100644
index ed6ca999..0000000
--- a/tests/SerialChat/Android.mk
+++ /dev/null
@@ -1,27 +0,0 @@
-#
-# Copyright (C) 2011 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.
-#
-
-LOCAL_PATH:= $(call my-dir)
-include $(CLEAR_VARS)
-
-LOCAL_MODULE_TAGS := tests
-
-LOCAL_SRC_FILES := $(call all-subdir-java-files)
-
-LOCAL_PACKAGE_NAME := SerialChat
-LOCAL_PRIVATE_PLATFORM_APIS := true
-
-include $(BUILD_PACKAGE)
diff --git a/tests/ServiceCrashTest/Android.mk b/tests/ServiceCrashTest/Android.mk
index d1f6450..617ee7c 100644
--- a/tests/ServiceCrashTest/Android.mk
+++ b/tests/ServiceCrashTest/Android.mk
@@ -12,7 +12,7 @@
 LOCAL_CERTIFICATE := platform
 LOCAL_JAVA_LIBRARIES := android.test.base
 
-LOCAL_STATIC_JAVA_LIBRARIES := compatibility-device-util android-support-test
+LOCAL_STATIC_JAVA_LIBRARIES := compatibility-device-util-axt androidx.test.rules
 
 include $(BUILD_PACKAGE)
 
diff --git a/tests/SharedLibrary/client/Android.bp b/tests/SharedLibrary/client/Android.bp
new file mode 100644
index 0000000..dbf6dc9
--- /dev/null
+++ b/tests/SharedLibrary/client/Android.bp
@@ -0,0 +1,6 @@
+android_test {
+    name: "SharedLibraryClient",
+    srcs: ["**/*.java"],
+    libs: ["SharedLibrary"],
+    sdk_version: "current",
+}
diff --git a/tests/SharedLibrary/client/Android.mk b/tests/SharedLibrary/client/Android.mk
deleted file mode 100644
index 9e76c40..0000000
--- a/tests/SharedLibrary/client/Android.mk
+++ /dev/null
@@ -1,14 +0,0 @@
-LOCAL_PATH:= $(call my-dir)
-include $(CLEAR_VARS)
-
-LOCAL_USE_AAPT2 := true
-LOCAL_SRC_FILES := $(call all-subdir-java-files)
-
-LOCAL_RES_LIBRARIES := SharedLibrary
-
-LOCAL_PACKAGE_NAME := SharedLibraryClient
-LOCAL_SDK_VERSION := current
-
-LOCAL_MODULE_TAGS := tests
-
-include $(BUILD_PACKAGE)
diff --git a/tests/SharedLibrary/lib/Android.bp b/tests/SharedLibrary/lib/Android.bp
new file mode 100644
index 0000000..f69d388
--- /dev/null
+++ b/tests/SharedLibrary/lib/Android.bp
@@ -0,0 +1,11 @@
+android_app {
+    name: "SharedLibrary",
+    srcs: ["**/*.java"],
+    aaptflags: ["--shared-lib"],
+    sdk_version: "current",
+    export_package_resources: true,
+    privileged: true,
+    optimize: {
+        proguard_flags_files: ["proguard.proguard"],
+    },
+}
diff --git a/tests/SharedLibrary/lib/Android.mk b/tests/SharedLibrary/lib/Android.mk
deleted file mode 100644
index 3c1ca87..0000000
--- a/tests/SharedLibrary/lib/Android.mk
+++ /dev/null
@@ -1,17 +0,0 @@
-LOCAL_PATH:= $(call my-dir)
-include $(CLEAR_VARS)
-LOCAL_USE_AAPT2 := true
-
-LOCAL_SRC_FILES := $(call all-subdir-java-files)
-
-LOCAL_AAPT_FLAGS := --shared-lib
-LOCAL_PACKAGE_NAME := SharedLibrary
-LOCAL_SDK_VERSION := current
-
-LOCAL_EXPORT_PACKAGE_RESOURCES := true
-LOCAL_PRIVILEGED_MODULE := true
-LOCAL_MODULE_TAGS := optional
-
-LOCAL_PROGUARD_FLAG_FILES := proguard.proguard
-
-include $(BUILD_PACKAGE)
diff --git a/tests/ShowWhenLockedApp/Android.bp b/tests/ShowWhenLockedApp/Android.bp
new file mode 100644
index 0000000..dba564c
--- /dev/null
+++ b/tests/ShowWhenLockedApp/Android.bp
@@ -0,0 +1,5 @@
+android_test {
+    name: "ShowWhenLocked",
+    srcs: ["**/*.java"],
+    sdk_version: "current",
+}
diff --git a/tests/ShowWhenLockedApp/Android.mk b/tests/ShowWhenLockedApp/Android.mk
deleted file mode 100644
index 41e0ac4..0000000
--- a/tests/ShowWhenLockedApp/Android.mk
+++ /dev/null
@@ -1,11 +0,0 @@
-LOCAL_PATH:= $(call my-dir)
-include $(CLEAR_VARS)
-
-LOCAL_SRC_FILES := $(call all-subdir-java-files)
-
-LOCAL_PACKAGE_NAME := ShowWhenLocked
-LOCAL_SDK_VERSION := current
-
-LOCAL_MODULE_TAGS := tests
-
-include $(BUILD_PACKAGE)
\ No newline at end of file
diff --git a/tests/SmokeTest/Android.bp b/tests/SmokeTest/Android.bp
new file mode 100644
index 0000000..bc45ee6
--- /dev/null
+++ b/tests/SmokeTest/Android.bp
@@ -0,0 +1,6 @@
+android_test {
+    name: "SmokeTestApp",
+    // This builds "SmokeTestApp"
+    srcs: ["src/**/*.java"],
+    sdk_version: "8",
+}
diff --git a/tests/SmokeTest/Android.mk b/tests/SmokeTest/Android.mk
deleted file mode 100644
index 591a84e..0000000
--- a/tests/SmokeTest/Android.mk
+++ /dev/null
@@ -1,16 +0,0 @@
-LOCAL_PATH:= $(call my-dir)
-include $(CLEAR_VARS)
-
-LOCAL_MODULE_TAGS := tests
-
-# This builds "SmokeTestApp"
-LOCAL_SRC_FILES := $(call all-java-files-under, src)
-
-LOCAL_PACKAGE_NAME := SmokeTestApp
-
-LOCAL_SDK_VERSION := 8
-
-include $(BUILD_PACKAGE)
-
-# This builds "SmokeTest"
-include $(call all-makefiles-under,$(LOCAL_PATH))
diff --git a/tests/SmokeTest/tests/Android.bp b/tests/SmokeTest/tests/Android.bp
new file mode 100644
index 0000000..ceb2d19
--- /dev/null
+++ b/tests/SmokeTest/tests/Android.bp
@@ -0,0 +1,10 @@
+android_test {
+    name: "SmokeTest",
+    // Include all test java files.
+    srcs: ["src/**/*.java"],
+    // Notice that we don't have to include the src files of SmokeTestApp because, by
+    // running the tests using an instrumentation targeting SmokeTestApp, we
+    // automatically get all of its classes loaded into our environment.
+    instrumentation_for: "SmokeTestApp",
+    sdk_version: "8",
+}
diff --git a/tests/SmokeTest/tests/Android.mk b/tests/SmokeTest/tests/Android.mk
deleted file mode 100644
index 18e682e..0000000
--- a/tests/SmokeTest/tests/Android.mk
+++ /dev/null
@@ -1,21 +0,0 @@
-LOCAL_PATH:= $(call my-dir)
-include $(CLEAR_VARS)
-
-# We only want this apk build for tests.
-LOCAL_MODULE_TAGS := tests
-
-# Include all test java files.
-LOCAL_SRC_FILES := $(call all-java-files-under, src)
-
-# Notice that we don't have to include the src files of SmokeTestApp because, by
-# running the tests using an instrumentation targeting SmokeTestApp, we
-# automatically get all of its classes loaded into our environment.
-
-LOCAL_PACKAGE_NAME := SmokeTest
-
-LOCAL_INSTRUMENTATION_FOR := SmokeTestApp
-
-LOCAL_SDK_VERSION := 8
-
-include $(BUILD_PACKAGE)
-
diff --git a/tests/SmokeTestApps/Android.bp b/tests/SmokeTestApps/Android.bp
new file mode 100644
index 0000000..0feb0004
--- /dev/null
+++ b/tests/SmokeTestApps/Android.bp
@@ -0,0 +1,5 @@
+android_test {
+    name: "SmokeTestTriggerApps",
+    srcs: ["src/**/*.java"],
+    sdk_version: "current",
+}
diff --git a/tests/SmokeTestApps/Android.mk b/tests/SmokeTestApps/Android.mk
deleted file mode 100644
index 1f564e0..0000000
--- a/tests/SmokeTestApps/Android.mk
+++ /dev/null
@@ -1,13 +0,0 @@
-LOCAL_PATH:= $(call my-dir)
-include $(CLEAR_VARS)
-
-LOCAL_MODULE_TAGS := tests
-
-LOCAL_SRC_FILES := $(call all-java-files-under, src)
-
-LOCAL_PACKAGE_NAME := SmokeTestTriggerApps
-LOCAL_SDK_VERSION := current
-
-include $(BUILD_PACKAGE)
-
-include $(call all-makefiles-under,$(LOCAL_PATH))
diff --git a/tests/SoundTriggerTestApp/Android.bp b/tests/SoundTriggerTestApp/Android.bp
new file mode 100644
index 0000000..d3a1300
--- /dev/null
+++ b/tests/SoundTriggerTestApp/Android.bp
@@ -0,0 +1,7 @@
+android_app {
+    name: "SoundTriggerTestApp",
+    srcs: ["**/*.java"],
+    platform_apis: true,
+    privileged: true,
+    certificate: "platform",
+}
diff --git a/tests/SoundTriggerTestApp/Android.mk b/tests/SoundTriggerTestApp/Android.mk
deleted file mode 100644
index 73fb5e8..0000000
--- a/tests/SoundTriggerTestApp/Android.mk
+++ /dev/null
@@ -1,14 +0,0 @@
-LOCAL_PATH:= $(call my-dir)
-include $(CLEAR_VARS)
-
-LOCAL_SRC_FILES := $(call all-subdir-java-files)
-
-LOCAL_PACKAGE_NAME := SoundTriggerTestApp
-LOCAL_PRIVATE_PLATFORM_APIS := true
-
-LOCAL_MODULE_TAGS := optional
-
-LOCAL_PRIVILEGED_MODULE := true
-LOCAL_CERTIFICATE := platform
-
-include $(BUILD_PACKAGE)
diff --git a/tests/Split/Android.bp b/tests/Split/Android.bp
new file mode 100644
index 0000000..d8c89ba
--- /dev/null
+++ b/tests/Split/Android.bp
@@ -0,0 +1,27 @@
+//
+// Copyright (C) 2014 The Android Open Source Project
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+//      http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+//
+
+android_test {
+    name: "Split",
+    srcs: ["**/*.java"],
+    sdk_version: "current",
+    package_splits: [
+        "mdpi-v4",
+        "hdpi-v4",
+        "xhdpi-v4",
+        "xxhdpi-v4",
+    ],
+}
diff --git a/tests/Split/Android.mk b/tests/Split/Android.mk
deleted file mode 100644
index 4d15b2d..0000000
--- a/tests/Split/Android.mk
+++ /dev/null
@@ -1,28 +0,0 @@
-#
-# Copyright (C) 2014 The Android Open Source Project
-#
-# Licensed under the Apache License, Version 2.0 (the "License");
-# you may not use this file except in compliance with the License.
-# You may obtain a copy of the License at
-#
-#      http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS,
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-# See the License for the specific language governing permissions and
-# limitations under the License.
-#
-
-LOCAL_PATH:= $(call my-dir)
-include $(CLEAR_VARS)
-
-LOCAL_SRC_FILES := $(call all-subdir-java-files)
-LOCAL_PACKAGE_NAME := Split
-LOCAL_SDK_VERSION := current
-
-LOCAL_PACKAGE_SPLITS := mdpi-v4 hdpi-v4 xhdpi-v4 xxhdpi-v4
-
-LOCAL_MODULE_TAGS := tests
-
-include $(BUILD_PACKAGE)
diff --git a/tests/StatusBar/Android.bp b/tests/StatusBar/Android.bp
new file mode 100644
index 0000000..0b650ed
--- /dev/null
+++ b/tests/StatusBar/Android.bp
@@ -0,0 +1,9 @@
+android_test {
+    name: "StatusBarTest",
+    srcs: ["**/*.java"],
+    platform_apis: true,
+    certificate: "platform",
+    optimize: {
+        enabled: false,
+    },
+}
diff --git a/tests/StatusBar/Android.mk b/tests/StatusBar/Android.mk
deleted file mode 100644
index e845335..0000000
--- a/tests/StatusBar/Android.mk
+++ /dev/null
@@ -1,14 +0,0 @@
-LOCAL_PATH:= $(call my-dir)
-include $(CLEAR_VARS)
-
-LOCAL_MODULE_TAGS := tests
-
-LOCAL_SRC_FILES := $(call all-subdir-java-files)
-
-LOCAL_PACKAGE_NAME := StatusBarTest
-LOCAL_PRIVATE_PLATFORM_APIS := true
-LOCAL_CERTIFICATE := platform
-
-LOCAL_PROGUARD_ENABLED := disabled
-
-include $(BUILD_PACKAGE)
diff --git a/tests/SystemUIDemoModeController/Android.bp b/tests/SystemUIDemoModeController/Android.bp
new file mode 100644
index 0000000..1e4c437
--- /dev/null
+++ b/tests/SystemUIDemoModeController/Android.bp
@@ -0,0 +1,5 @@
+android_test {
+    name: "DemoModeController",
+    srcs: ["**/*.java"],
+    sdk_version: "current",
+}
diff --git a/tests/SystemUIDemoModeController/Android.mk b/tests/SystemUIDemoModeController/Android.mk
deleted file mode 100644
index cc6fa8d..0000000
--- a/tests/SystemUIDemoModeController/Android.mk
+++ /dev/null
@@ -1,11 +0,0 @@
-LOCAL_PATH:= $(call my-dir)
-include $(CLEAR_VARS)
-
-LOCAL_MODULE_TAGS := tests
-
-LOCAL_SRC_FILES := $(call all-subdir-java-files)
-
-LOCAL_PACKAGE_NAME := DemoModeController
-LOCAL_SDK_VERSION := current
-
-include $(BUILD_PACKAGE)
diff --git a/tests/TouchLatency/Android.bp b/tests/TouchLatency/Android.bp
new file mode 100644
index 0000000..1174bcb0
--- /dev/null
+++ b/tests/TouchLatency/Android.bp
@@ -0,0 +1,10 @@
+android_test {
+    name: "TouchLatency",
+    manifest: "app/src/main/AndroidManifest.xml",
+    // omit gradle 'build' dir
+    srcs: ["app/src/main/java/**/*.java"],
+    resource_dirs: ["app/src/main/res"],
+    aaptflags: ["--auto-add-overlay"],
+    sdk_version: "current",
+    test_suites: ["device-tests"],
+}
diff --git a/tests/TouchLatency/Android.mk b/tests/TouchLatency/Android.mk
deleted file mode 100644
index 2334bd8..0000000
--- a/tests/TouchLatency/Android.mk
+++ /dev/null
@@ -1,22 +0,0 @@
-LOCAL_PATH:= $(call my-dir)
-include $(CLEAR_VARS)
-
-LOCAL_MODULE_TAGS := tests
-
-LOCAL_MANIFEST_FILE := app/src/main/AndroidManifest.xml
-
-# omit gradle 'build' dir
-LOCAL_SRC_FILES := $(call all-java-files-under,app/src/main/java)
-
-LOCAL_RESOURCE_DIR := \
-    $(LOCAL_PATH)/app/src/main/res
-
-LOCAL_AAPT_FLAGS := \
-    --auto-add-overlay
-
-LOCAL_PACKAGE_NAME := TouchLatency
-LOCAL_SDK_VERSION := current
-
-LOCAL_COMPATIBILITY_SUITE := device-tests
-
-include $(BUILD_PACKAGE)
diff --git a/tests/TransformTest/Android.bp b/tests/TransformTest/Android.bp
new file mode 100644
index 0000000..fd7aaeb
--- /dev/null
+++ b/tests/TransformTest/Android.bp
@@ -0,0 +1,5 @@
+android_test {
+    name: "TransformTest",
+    srcs: ["**/*.java"],
+    sdk_version: "current",
+}
diff --git a/tests/TransformTest/Android.mk b/tests/TransformTest/Android.mk
deleted file mode 100644
index 5340cdd..0000000
--- a/tests/TransformTest/Android.mk
+++ /dev/null
@@ -1,11 +0,0 @@
-LOCAL_PATH:= $(call my-dir)
-include $(CLEAR_VARS)
-
-LOCAL_SRC_FILES := $(call all-subdir-java-files)
-
-LOCAL_PACKAGE_NAME := TransformTest
-LOCAL_SDK_VERSION := current
-
-LOCAL_MODULE_TAGS := tests
-
-include $(BUILD_PACKAGE)
diff --git a/tests/TransitionTests/Android.bp b/tests/TransitionTests/Android.bp
new file mode 100644
index 0000000..57f19e3
--- /dev/null
+++ b/tests/TransitionTests/Android.bp
@@ -0,0 +1,10 @@
+android_app {
+    name: "TransitionTests",
+    // Only compile source java files in this apk.
+    srcs: ["src/**/*.java"],
+    platform_apis: true,
+    static_libs: ["android-common"],
+    optimize: {
+        enabled: false,
+    },
+}
diff --git a/tests/TransitionTests/Android.mk b/tests/TransitionTests/Android.mk
deleted file mode 100644
index a696156..0000000
--- a/tests/TransitionTests/Android.mk
+++ /dev/null
@@ -1,19 +0,0 @@
-LOCAL_PATH:= $(call my-dir)
-include $(CLEAR_VARS)
-
-LOCAL_MODULE_TAGS := optional
-
-# Only compile source java files in this apk.
-LOCAL_SRC_FILES := $(call all-java-files-under, src)
-
-LOCAL_PACKAGE_NAME := TransitionTests
-LOCAL_PRIVATE_PLATFORM_APIS := true
-
-LOCAL_STATIC_JAVA_LIBRARIES += android-common
-
-LOCAL_PROGUARD_ENABLED := disabled
-
-include $(BUILD_PACKAGE)
-
-# Use the following include to make our test apk.
-include $(call all-makefiles-under,$(LOCAL_PATH))
diff --git a/tests/TtsTests/Android.bp b/tests/TtsTests/Android.bp
new file mode 100644
index 0000000..b137523
--- /dev/null
+++ b/tests/TtsTests/Android.bp
@@ -0,0 +1,26 @@
+//
+// Copyright (C) 2011 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.
+//
+
+android_test {
+    name: "TtsTests",
+    srcs: ["**/*.java"],
+    static_libs: ["mockito-target"],
+    libs: [
+        "android.test.runner",
+        "android.test.base",
+    ],
+    platform_apis: true,
+}
diff --git a/tests/TtsTests/Android.mk b/tests/TtsTests/Android.mk
deleted file mode 100644
index 116cc0a..0000000
--- a/tests/TtsTests/Android.mk
+++ /dev/null
@@ -1,29 +0,0 @@
-#
-# Copyright (C) 2011 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.
-#
-LOCAL_PATH:= $(call my-dir)
-include $(CLEAR_VARS)
-
-LOCAL_MODULE_TAGS := tests
-
-LOCAL_SRC_FILES := $(call all-subdir-java-files)
-
-LOCAL_STATIC_JAVA_LIBRARIES := mockito-target
-LOCAL_JAVA_LIBRARIES := android.test.runner android.test.base
-
-LOCAL_PACKAGE_NAME := TtsTests
-LOCAL_PRIVATE_PLATFORM_APIS := true
-
-include $(BUILD_PACKAGE)
diff --git a/tests/UsageStatsPerfTests/Android.mk b/tests/UsageStatsPerfTests/Android.mk
index cd29b51..4304fb0 100644
--- a/tests/UsageStatsPerfTests/Android.mk
+++ b/tests/UsageStatsPerfTests/Android.mk
@@ -21,7 +21,7 @@
     $(call all-java-files-under, src)
 
 LOCAL_STATIC_JAVA_LIBRARIES := \
-    android-support-test \
+    androidx.test.rules \
     apct-perftests-utils \
     services.usage
 
diff --git a/tests/UsageStatsPerfTests/AndroidManifest.xml b/tests/UsageStatsPerfTests/AndroidManifest.xml
index 596a79c..9891548 100644
--- a/tests/UsageStatsPerfTests/AndroidManifest.xml
+++ b/tests/UsageStatsPerfTests/AndroidManifest.xml
@@ -24,6 +24,6 @@
         <uses-library android:name="android.test.runner" />
     </application>
 
-    <instrumentation android:name="android.support.test.runner.AndroidJUnitRunner"
+    <instrumentation android:name="androidx.test.runner.AndroidJUnitRunner"
                      android:targetPackage="com.android.frameworks.perftests.usage"/>
 </manifest>
diff --git a/tests/UsageStatsPerfTests/AndroidTest.xml b/tests/UsageStatsPerfTests/AndroidTest.xml
index c9b51dc..b8892eb 100644
--- a/tests/UsageStatsPerfTests/AndroidTest.xml
+++ b/tests/UsageStatsPerfTests/AndroidTest.xml
@@ -23,6 +23,6 @@
     <option name="test-tag" value="UsageStatsPerfTests"/>
     <test class="com.android.tradefed.testtype.AndroidJUnitTest">
         <option name="package" value="com.android.frameworks.perftests.usage"/>
-        <option name="runner" value="android.support.test.runner.AndroidJUnitRunner"/>
+        <option name="runner" value="androidx.test.runner.AndroidJUnitRunner"/>
     </test>
 </configuration>
\ No newline at end of file
diff --git a/tests/UsageStatsPerfTests/src/com/android/frameworks/perftests/usage/tests/UsageStatsDatabasePerfTest.java b/tests/UsageStatsPerfTests/src/com/android/frameworks/perftests/usage/tests/UsageStatsDatabasePerfTest.java
index e2a4c26..7d9d0d5 100644
--- a/tests/UsageStatsPerfTests/src/com/android/frameworks/perftests/usage/tests/UsageStatsDatabasePerfTest.java
+++ b/tests/UsageStatsPerfTests/src/com/android/frameworks/perftests/usage/tests/UsageStatsDatabasePerfTest.java
@@ -24,9 +24,10 @@
 import android.os.SystemClock;
 import android.perftests.utils.ManualBenchmarkState;
 import android.perftests.utils.PerfManualStatusReporter;
-import android.support.test.InstrumentationRegistry;
-import android.support.test.filters.LargeTest;
-import android.support.test.runner.AndroidJUnit4;
+
+import androidx.test.InstrumentationRegistry;
+import androidx.test.filters.LargeTest;
+import androidx.test.runner.AndroidJUnit4;
 
 import com.android.server.usage.IntervalStats;
 import com.android.server.usage.UsageStatsDatabase;
diff --git a/tests/UsageStatsTest/src/com/android/tests/usagestats/UsageStatsActivity.java b/tests/UsageStatsTest/src/com/android/tests/usagestats/UsageStatsActivity.java
index 0105893..adcd11a 100644
--- a/tests/UsageStatsTest/src/com/android/tests/usagestats/UsageStatsActivity.java
+++ b/tests/UsageStatsTest/src/com/android/tests/usagestats/UsageStatsActivity.java
@@ -41,6 +41,7 @@
 import android.widget.TextView;
 import android.widget.Toast;
 
+import java.time.Duration;
 import java.util.ArrayList;
 import java.util.Collections;
 import java.util.Comparator;
@@ -196,8 +197,8 @@
                     intent.setPackage(getPackageName());
                     intent.putExtra(EXTRA_KEY_TIMEOUT, true);
                     mUsageStatsManager.registerAppUsageLimitObserver(1, packages,
-                            60, TimeUnit.SECONDS, PendingIntent.getActivity(UsageStatsActivity.this,
-                                    1, intent, 0));
+                            Duration.ofSeconds(60), Duration.ofSeconds(60),
+                            PendingIntent.getActivity(UsageStatsActivity.this, 1, intent, 0));
                 }
             }
         });
diff --git a/tests/UsbTests/Android.mk b/tests/UsbTests/Android.mk
index 4e215cc..aef993b 100644
--- a/tests/UsbTests/Android.mk
+++ b/tests/UsbTests/Android.mk
@@ -24,7 +24,7 @@
 
 LOCAL_STATIC_JAVA_LIBRARIES := \
     frameworks-base-testutils \
-    android-support-test \
+    androidx.test.rules \
     mockito-target-inline-minus-junit4 \
     platform-test-annotations \
     services.core \
diff --git a/tests/UsbTests/AndroidManifest.xml b/tests/UsbTests/AndroidManifest.xml
index 5d60695..03d1a3e 100644
--- a/tests/UsbTests/AndroidManifest.xml
+++ b/tests/UsbTests/AndroidManifest.xml
@@ -24,7 +24,7 @@
         <uses-library android:name="android.test.runner" />
     </application>
 
-    <instrumentation android:name="android.support.test.runner.AndroidJUnitRunner"
+    <instrumentation android:name="androidx.test.runner.AndroidJUnitRunner"
                      android:targetPackage="com.android.server.usb"
                      android:label="UsbTests"/>
 </manifest>
diff --git a/tests/UsbTests/AndroidTest.xml b/tests/UsbTests/AndroidTest.xml
index 4affad3..e55bc98 100644
--- a/tests/UsbTests/AndroidTest.xml
+++ b/tests/UsbTests/AndroidTest.xml
@@ -24,7 +24,7 @@
 
     <test class="com.android.tradefed.testtype.AndroidJUnitTest">
         <option name="package" value="com.android.server.usb"/>
-        <option name="runner" value="android.support.test.runner.AndroidJUnitRunner"/>
+        <option name="runner" value="androidx.test.runner.AndroidJUnitRunner"/>
         <option name="hidden-api-checks" value="false"/>
     </test>
 </configuration>
diff --git a/tests/UsbTests/src/com/android/server/usb/UsbDescriptorParserTests.java b/tests/UsbTests/src/com/android/server/usb/UsbDescriptorParserTests.java
index ea027d7..89dc79c 100644
--- a/tests/UsbTests/src/com/android/server/usb/UsbDescriptorParserTests.java
+++ b/tests/UsbTests/src/com/android/server/usb/UsbDescriptorParserTests.java
@@ -16,29 +16,29 @@
 
 package com.android.server.usb;
 
-import static org.junit.Assert.assertTrue;
-import static org.junit.Assert.assertFalse;
 import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertFalse;
+import static org.junit.Assert.assertTrue;
 import static org.junit.Assert.fail;
 
 import android.content.Context;
 import android.content.res.Resources;
 import android.content.res.Resources.NotFoundException;
-import android.support.test.InstrumentationRegistry;
-import android.support.test.filters.SmallTest;
-import android.support.test.runner.AndroidJUnit4;
+
+import androidx.test.InstrumentationRegistry;
+import androidx.test.filters.SmallTest;
+import androidx.test.runner.AndroidJUnit4;
 
 import com.android.server.usb.descriptors.UsbDescriptorParser;
-import com.android.server.usb.descriptors.UsbDeviceDescriptor;
-import com.google.common.io.ByteStreams;
 
-import java.io.InputStream;
-import java.io.IOException;
-import java.lang.Exception;
+import com.google.common.io.ByteStreams;
 
 import org.junit.Test;
 import org.junit.runner.RunWith;
 
+import java.io.IOException;
+import java.io.InputStream;
+
 /**
  * Tests for {@link com.android.server.usb.descriptors.UsbDescriptorParser}
  */
diff --git a/tests/UsbTests/src/com/android/server/usb/UsbHandlerTest.java b/tests/UsbTests/src/com/android/server/usb/UsbHandlerTest.java
index 4b93ca3..ca1eb70 100644
--- a/tests/UsbTests/src/com/android/server/usb/UsbHandlerTest.java
+++ b/tests/UsbTests/src/com/android/server/usb/UsbHandlerTest.java
@@ -31,11 +31,11 @@
 import android.os.Handler;
 import android.os.Looper;
 import android.os.Message;
-import android.os.UserHandle;
 import android.provider.Settings;
-import android.support.test.InstrumentationRegistry;
-import android.support.test.filters.SmallTest;
-import android.support.test.runner.AndroidJUnit4;
+
+import androidx.test.InstrumentationRegistry;
+import androidx.test.filters.SmallTest;
+import androidx.test.runner.AndroidJUnit4;
 
 import com.android.server.FgThread;
 
diff --git a/tests/UsesFeature2Test/Android.bp b/tests/UsesFeature2Test/Android.bp
new file mode 100644
index 0000000..a1b77d0
--- /dev/null
+++ b/tests/UsesFeature2Test/Android.bp
@@ -0,0 +1,21 @@
+//
+// Copyright (C) 2014 The Android Open Source Project
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+//      http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+//
+
+android_test {
+    name: "UsesFeature2Test",
+    srcs: ["**/*.java"],
+    sdk_version: "current",
+}
diff --git a/tests/UsesFeature2Test/Android.mk b/tests/UsesFeature2Test/Android.mk
deleted file mode 100644
index 4cba4ff..0000000
--- a/tests/UsesFeature2Test/Android.mk
+++ /dev/null
@@ -1,26 +0,0 @@
-#
-# Copyright (C) 2014 The Android Open Source Project
-#
-# Licensed under the Apache License, Version 2.0 (the "License");
-# you may not use this file except in compliance with the License.
-# You may obtain a copy of the License at
-#
-#      http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS,
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-# See the License for the specific language governing permissions and
-# limitations under the License.
-#
-
-LOCAL_PATH:= $(call my-dir)
-include $(CLEAR_VARS)
-
-LOCAL_SRC_FILES := $(call all-subdir-java-files)
-LOCAL_PACKAGE_NAME := UsesFeature2Test
-LOCAL_SDK_VERSION := current
-
-LOCAL_MODULE_TAGS := tests
-
-include $(BUILD_PACKAGE)
diff --git a/tests/VectorDrawableTest/Android.bp b/tests/VectorDrawableTest/Android.bp
new file mode 100644
index 0000000..13f318e
--- /dev/null
+++ b/tests/VectorDrawableTest/Android.bp
@@ -0,0 +1,21 @@
+//
+// Copyright (C) 2014 The Android Open Source Project
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+//      http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+//
+
+android_test {
+    name: "VectorDrawableTest",
+    srcs: ["**/*.java"],
+    platform_apis: true,
+}
diff --git a/tests/VectorDrawableTest/Android.mk b/tests/VectorDrawableTest/Android.mk
deleted file mode 100644
index 155b2bc..0000000
--- a/tests/VectorDrawableTest/Android.mk
+++ /dev/null
@@ -1,27 +0,0 @@
-#
-# Copyright (C) 2014 The Android Open Source Project
-#
-# Licensed under the Apache License, Version 2.0 (the "License");
-# you may not use this file except in compliance with the License.
-# You may obtain a copy of the License at
-#
-#      http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS,
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-# See the License for the specific language governing permissions and
-# limitations under the License.
-#
-
-LOCAL_PATH:= $(call my-dir)
-include $(CLEAR_VARS)
-
-LOCAL_SRC_FILES := $(call all-subdir-java-files)
-
-LOCAL_PACKAGE_NAME := VectorDrawableTest
-LOCAL_PRIVATE_PLATFORM_APIS := true
-
-LOCAL_MODULE_TAGS := tests
-
-include $(BUILD_PACKAGE)
diff --git a/tests/VoiceEnrollment/Android.bp b/tests/VoiceEnrollment/Android.bp
new file mode 100644
index 0000000..e43b38c
--- /dev/null
+++ b/tests/VoiceEnrollment/Android.bp
@@ -0,0 +1,6 @@
+android_app {
+    name: "VoiceEnrollment",
+    srcs: ["**/*.java"],
+    platform_apis: true,
+    privileged: true,
+}
diff --git a/tests/VoiceEnrollment/Android.mk b/tests/VoiceEnrollment/Android.mk
deleted file mode 100644
index 725e2bd..0000000
--- a/tests/VoiceEnrollment/Android.mk
+++ /dev/null
@@ -1,13 +0,0 @@
-LOCAL_PATH:= $(call my-dir)
-include $(CLEAR_VARS)
-
-LOCAL_SRC_FILES := $(call all-subdir-java-files)
-
-LOCAL_PACKAGE_NAME := VoiceEnrollment
-LOCAL_PRIVATE_PLATFORM_APIS := true
-
-LOCAL_MODULE_TAGS := optional
-
-LOCAL_PRIVILEGED_MODULE := true
-
-include $(BUILD_PACKAGE)
diff --git a/tests/VoiceInteraction/Android.bp b/tests/VoiceInteraction/Android.bp
new file mode 100644
index 0000000..7059473
--- /dev/null
+++ b/tests/VoiceInteraction/Android.bp
@@ -0,0 +1,5 @@
+android_test {
+    name: "VoiceInteraction",
+    srcs: ["**/*.java"],
+    platform_apis: true,
+}
diff --git a/tests/VoiceInteraction/Android.mk b/tests/VoiceInteraction/Android.mk
deleted file mode 100644
index aa48b42..0000000
--- a/tests/VoiceInteraction/Android.mk
+++ /dev/null
@@ -1,11 +0,0 @@
-LOCAL_PATH:= $(call my-dir)
-include $(CLEAR_VARS)
-
-LOCAL_MODULE_TAGS := tests
-
-LOCAL_SRC_FILES := $(call all-subdir-java-files)
-
-LOCAL_PACKAGE_NAME := VoiceInteraction
-LOCAL_PRIVATE_PLATFORM_APIS := true
-
-include $(BUILD_PACKAGE)
diff --git a/tests/WallpaperTest/Android.bp b/tests/WallpaperTest/Android.bp
new file mode 100644
index 0000000..f68b6ec
--- /dev/null
+++ b/tests/WallpaperTest/Android.bp
@@ -0,0 +1,9 @@
+android_app {
+    name: "WallpaperTest",
+    srcs: ["src/**/*.java"],
+    resource_dirs: ["res"],
+    platform_apis: true,
+    optimize: {
+        enabled: false,
+    },
+}
diff --git a/tests/WallpaperTest/Android.mk b/tests/WallpaperTest/Android.mk
deleted file mode 100644
index 4815500..0000000
--- a/tests/WallpaperTest/Android.mk
+++ /dev/null
@@ -1,16 +0,0 @@
-LOCAL_PATH:= $(call my-dir)
-include $(CLEAR_VARS)
-
-LOCAL_MODULE_TAGS := optional
-
-LOCAL_SRC_FILES := $(call all-java-files-under, src)
-
-LOCAL_RESOURCE_DIR := $(LOCAL_PATH)/res
-
-LOCAL_PACKAGE_NAME := WallpaperTest
-LOCAL_PRIVATE_PLATFORM_APIS := true
-
-LOCAL_PROGUARD_ENABLED := disabled
-
-include $(BUILD_PACKAGE)
-
diff --git a/tests/WindowAnimationJank/Android.mk b/tests/WindowAnimationJank/Android.mk
index 7800a80..1c2d167 100644
--- a/tests/WindowAnimationJank/Android.mk
+++ b/tests/WindowAnimationJank/Android.mk
@@ -26,7 +26,7 @@
 
 LOCAL_STATIC_JAVA_LIBRARIES := \
     ub-uiautomator \
-    ub-janktesthelper \
+    androidx.test.janktesthelper \
     junit
 
 LOCAL_JAVA_LIBRARIES := android.test.base.stubs
diff --git a/tests/WindowAnimationJank/src/android/windowanimationjank/FullscreenRotationTest.java b/tests/WindowAnimationJank/src/android/windowanimationjank/FullscreenRotationTest.java
index 1fb502a..6792a8b 100644
--- a/tests/WindowAnimationJank/src/android/windowanimationjank/FullscreenRotationTest.java
+++ b/tests/WindowAnimationJank/src/android/windowanimationjank/FullscreenRotationTest.java
@@ -17,8 +17,9 @@
 package android.windowanimationjank;
 
 import android.os.Bundle;
-import android.support.test.jank.JankTest;
-import android.support.test.jank.GfxMonitor;
+
+import androidx.test.jank.GfxMonitor;
+import androidx.test.jank.JankTest;
 
 /**
  * Detect janks during screen rotation for full-screen activity. Periodically change
diff --git a/tests/WindowAnimationJank/src/android/windowanimationjank/WindowAnimationJankTestBase.java b/tests/WindowAnimationJank/src/android/windowanimationjank/WindowAnimationJankTestBase.java
index bf739fa..a8ace162 100644
--- a/tests/WindowAnimationJank/src/android/windowanimationjank/WindowAnimationJankTestBase.java
+++ b/tests/WindowAnimationJank/src/android/windowanimationjank/WindowAnimationJankTestBase.java
@@ -16,12 +16,10 @@
 
 package android.windowanimationjank;
 
-import java.io.IOException;
-import java.util.StringTokenizer;
-
-import android.support.test.jank.JankTestBase;
 import android.support.test.uiautomator.UiDevice;
 
+import androidx.test.jank.JankTestBase;
+
 /**
  * This adds additional system level jank monitor and its result is merged with primary monitor
  * used in test.
diff --git a/tests/WindowManagerStressTest/Android.bp b/tests/WindowManagerStressTest/Android.bp
new file mode 100644
index 0000000..98749a7
--- /dev/null
+++ b/tests/WindowManagerStressTest/Android.bp
@@ -0,0 +1,21 @@
+//
+// Copyright (C) 2016 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.
+//
+
+android_test {
+    name: "WindowManagerStressTest",
+    srcs: ["**/*.java"],
+    platform_apis: true,
+}
diff --git a/tests/WindowManagerStressTest/Android.mk b/tests/WindowManagerStressTest/Android.mk
deleted file mode 100644
index 6f4403f..0000000
--- a/tests/WindowManagerStressTest/Android.mk
+++ /dev/null
@@ -1,27 +0,0 @@
-#
-# Copyright (C) 2016 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.
-#
-
-LOCAL_PATH:= $(call my-dir)
-include $(CLEAR_VARS)
-
-LOCAL_SRC_FILES := $(call all-subdir-java-files)
-
-LOCAL_PACKAGE_NAME := WindowManagerStressTest
-LOCAL_PRIVATE_PLATFORM_APIS := true
-
-LOCAL_MODULE_TAGS := tests
-
-include $(BUILD_PACKAGE)
diff --git a/tests/appwidgets/AppWidgetHostTest/Android.bp b/tests/appwidgets/AppWidgetHostTest/Android.bp
new file mode 100644
index 0000000..24b7613
--- /dev/null
+++ b/tests/appwidgets/AppWidgetHostTest/Android.bp
@@ -0,0 +1,6 @@
+android_app {
+    name: "AppWidgetHostTest",
+    srcs: ["**/*.java"],
+    sdk_version: "current",
+    certificate: "platform",
+}
diff --git a/tests/appwidgets/AppWidgetHostTest/Android.mk b/tests/appwidgets/AppWidgetHostTest/Android.mk
deleted file mode 100644
index c9e6c6b..0000000
--- a/tests/appwidgets/AppWidgetHostTest/Android.mk
+++ /dev/null
@@ -1,12 +0,0 @@
-LOCAL_PATH:= $(call my-dir)
-include $(CLEAR_VARS)
-
-LOCAL_MODULE_TAGS := optional
-
-LOCAL_SRC_FILES := $(call all-subdir-java-files)
-
-LOCAL_PACKAGE_NAME := AppWidgetHostTest
-LOCAL_SDK_VERSION := current
-LOCAL_CERTIFICATE := platform
-
-include $(BUILD_PACKAGE)
diff --git a/tests/appwidgets/AppWidgetProviderTest/Android.bp b/tests/appwidgets/AppWidgetProviderTest/Android.bp
new file mode 100644
index 0000000..a1a5991
--- /dev/null
+++ b/tests/appwidgets/AppWidgetProviderTest/Android.bp
@@ -0,0 +1,6 @@
+android_app {
+    name: "AppWidgetProvider",
+    srcs: ["**/*.java"],
+    sdk_version: "current",
+    certificate: "platform",
+}
diff --git a/tests/appwidgets/AppWidgetProviderTest/Android.mk b/tests/appwidgets/AppWidgetProviderTest/Android.mk
deleted file mode 100644
index b26c60b..0000000
--- a/tests/appwidgets/AppWidgetProviderTest/Android.mk
+++ /dev/null
@@ -1,12 +0,0 @@
-LOCAL_PATH:= $(call my-dir)
-include $(CLEAR_VARS)
-
-LOCAL_MODULE_TAGS := optional
-
-LOCAL_SRC_FILES := $(call all-subdir-java-files)
-
-LOCAL_PACKAGE_NAME := AppWidgetProvider
-LOCAL_SDK_VERSION := current
-LOCAL_CERTIFICATE := platform
-
-include $(BUILD_PACKAGE)
diff --git a/tests/net/Android.bp b/tests/net/Android.bp
new file mode 100644
index 0000000..2539c0f
--- /dev/null
+++ b/tests/net/Android.bp
@@ -0,0 +1,27 @@
+//########################################################################
+// Build FrameworksNetTests package
+//########################################################################
+
+android_test {
+    name: "FrameworksNetTests",
+    // Include all test java files.
+    srcs: ["java/**/*.java"],
+    static_libs: [
+        "frameworks-base-testutils",
+        "framework-protos",
+        "androidx.test.rules",
+        "mockito-target-minus-junit4",
+        "platform-test-annotations",
+        "services.core",
+        "services.ipmemorystore",
+        "services.net",
+    ],
+    libs: [
+        "android.test.runner",
+        "android.test.base",
+        "android.test.mock",
+    ],
+    platform_apis: true,
+    test_suites: ["device-tests"],
+    certificate: "platform",
+}
diff --git a/tests/net/Android.mk b/tests/net/Android.mk
deleted file mode 100644
index 7e1b400..0000000
--- a/tests/net/Android.mk
+++ /dev/null
@@ -1,37 +0,0 @@
-#########################################################################
-# Build FrameworksNetTests package
-#########################################################################
-
-LOCAL_PATH:= $(call my-dir)
-include $(CLEAR_VARS)
-
-# We only want this apk build for tests.
-LOCAL_MODULE_TAGS := tests
-
-# Include all test java files.
-LOCAL_SRC_FILES := $(call all-java-files-under, java)
-
-LOCAL_STATIC_JAVA_LIBRARIES := \
-    frameworks-base-testutils \
-    framework-protos \
-    android-support-test \
-    mockito-target-minus-junit4 \
-    platform-test-annotations \
-    services.core \
-    services.ipmemorystore \
-    services.net
-
-LOCAL_JAVA_LIBRARIES := \
-    android.test.runner \
-    android.test.base \
-    android.test.mock
-
-LOCAL_PACKAGE_NAME := FrameworksNetTests
-LOCAL_PRIVATE_PLATFORM_APIS := true
-LOCAL_COMPATIBILITY_SUITE := device-tests
-
-LOCAL_CERTIFICATE := platform
-
-LOCAL_ADDITIONAL_DEPENDENCIES := $(LOCAL_PATH)/Android.mk
-
-include $(BUILD_PACKAGE)
diff --git a/tests/net/AndroidManifest.xml b/tests/net/AndroidManifest.xml
index 6dae3f1..dcacb6d 100644
--- a/tests/net/AndroidManifest.xml
+++ b/tests/net/AndroidManifest.xml
@@ -51,7 +51,7 @@
     </application>
 
     <instrumentation
-        android:name="android.support.test.runner.AndroidJUnitRunner"
+        android:name="androidx.test.runner.AndroidJUnitRunner"
         android:targetPackage="com.android.frameworks.tests.net"
         android:label="Frameworks Networking Tests" />
 </manifest>
diff --git a/tests/net/AndroidTest.xml b/tests/net/AndroidTest.xml
index 6e020a3..939ae49 100644
--- a/tests/net/AndroidTest.xml
+++ b/tests/net/AndroidTest.xml
@@ -22,7 +22,7 @@
     <option name="test-tag" value="FrameworksNetTests" />
     <test class="com.android.tradefed.testtype.AndroidJUnitTest" >
         <option name="package" value="com.android.frameworks.tests.net" />
-        <option name="runner" value="android.support.test.runner.AndroidJUnitRunner" />
+        <option name="runner" value="androidx.test.runner.AndroidJUnitRunner" />
         <option name="hidden-api-checks" value="false"/>
     </test>
 </configuration>
diff --git a/tests/net/OWNERS b/tests/net/OWNERS
index 7311eee..d3836d4 100644
--- a/tests/net/OWNERS
+++ b/tests/net/OWNERS
@@ -1,8 +1,8 @@
 set noparent
 
 codewiz@google.com
-ek@google.com
 jchalard@google.com
+junyulai@google.com
 lorenzo@google.com
 reminv@google.com
 satk@google.com
diff --git a/tests/net/java/android/app/usage/NetworkStatsManagerTest.java b/tests/net/java/android/app/usage/NetworkStatsManagerTest.java
index 25e1474..fd555c1 100644
--- a/tests/net/java/android/app/usage/NetworkStatsManagerTest.java
+++ b/tests/net/java/android/app/usage/NetworkStatsManagerTest.java
@@ -26,7 +26,6 @@
 import static org.mockito.ArgumentMatchers.anyString;
 import static org.mockito.ArgumentMatchers.argThat;
 import static org.mockito.ArgumentMatchers.eq;
-import static org.mockito.Mockito.atLeastOnce;
 import static org.mockito.Mockito.times;
 import static org.mockito.Mockito.verify;
 import static org.mockito.Mockito.when;
@@ -38,9 +37,10 @@
 import android.net.NetworkStatsHistory;
 import android.net.NetworkTemplate;
 import android.os.RemoteException;
-import android.support.test.InstrumentationRegistry;
-import android.support.test.filters.SmallTest;
-import android.support.test.runner.AndroidJUnit4;
+
+import androidx.test.InstrumentationRegistry;
+import androidx.test.filters.SmallTest;
+import androidx.test.runner.AndroidJUnit4;
 
 import org.junit.Before;
 import org.junit.Test;
diff --git a/tests/net/java/android/net/ConnectivityManagerTest.java b/tests/net/java/android/net/ConnectivityManagerTest.java
index 6174c6c..7ede144 100644
--- a/tests/net/java/android/net/ConnectivityManagerTest.java
+++ b/tests/net/java/android/net/ConnectivityManagerTest.java
@@ -34,7 +34,6 @@
 
 import static org.junit.Assert.assertFalse;
 import static org.junit.Assert.assertNotNull;
-import static org.junit.Assert.assertNull;
 import static org.junit.Assert.assertTrue;
 import static org.junit.Assert.fail;
 import static org.mockito.Mockito.any;
@@ -47,19 +46,20 @@
 import static org.mockito.Mockito.when;
 
 import android.app.PendingIntent;
-import android.net.ConnectivityManager;
-import android.net.NetworkCapabilities;
 import android.content.Context;
+import android.content.pm.ApplicationInfo;
+import android.net.ConnectivityManager;
+import android.net.ConnectivityManager.NetworkCallback;
+import android.net.NetworkCapabilities;
+import android.os.Build.VERSION_CODES;
 import android.os.Bundle;
 import android.os.Handler;
 import android.os.Looper;
 import android.os.Message;
 import android.os.Messenger;
-import android.content.pm.ApplicationInfo;
-import android.os.Build.VERSION_CODES;
-import android.net.ConnectivityManager.NetworkCallback;
-import android.support.test.filters.SmallTest;
-import android.support.test.runner.AndroidJUnit4;
+
+import androidx.test.filters.SmallTest;
+import androidx.test.runner.AndroidJUnit4;
 
 import org.junit.Before;
 import org.junit.Test;
diff --git a/tests/net/java/android/net/DnsPacketTest.java b/tests/net/java/android/net/DnsPacketTest.java
index 032e526..9ede2b8 100644
--- a/tests/net/java/android/net/DnsPacketTest.java
+++ b/tests/net/java/android/net/DnsPacketTest.java
@@ -20,8 +20,8 @@
 import static org.junit.Assert.assertTrue;
 import static org.junit.Assert.fail;
 
-import android.support.test.filters.SmallTest;
-import android.support.test.runner.AndroidJUnit4;
+import androidx.test.filters.SmallTest;
+import androidx.test.runner.AndroidJUnit4;
 
 import org.junit.Test;
 import org.junit.runner.RunWith;
@@ -36,19 +36,19 @@
             int qCount, int aCount, int nsCount, int arCount) {
         assertEquals(header.id, id);
         assertEquals(header.flags, flag);
-        assertEquals(header.getSectionCount(DnsPacket.QDSECTION), qCount);
-        assertEquals(header.getSectionCount(DnsPacket.ANSECTION), aCount);
-        assertEquals(header.getSectionCount(DnsPacket.NSSECTION), nsCount);
-        assertEquals(header.getSectionCount(DnsPacket.ARSECTION), arCount);
+        assertEquals(header.getRecordCount(DnsPacket.QDSECTION), qCount);
+        assertEquals(header.getRecordCount(DnsPacket.ANSECTION), aCount);
+        assertEquals(header.getRecordCount(DnsPacket.NSSECTION), nsCount);
+        assertEquals(header.getRecordCount(DnsPacket.ARSECTION), arCount);
     }
 
-    private void assertSectionParses(DnsPacket.DnsSection section, String dname,
+    private void assertRecordParses(DnsPacket.DnsRecord record, String dname,
             int dtype, int dclass, int ttl, byte[] rr) {
-        assertEquals(section.dName, dname);
-        assertEquals(section.nsType, dtype);
-        assertEquals(section.nsClass, dclass);
-        assertEquals(section.ttl, ttl);
-        assertTrue(Arrays.equals(section.getRR(), rr));
+        assertEquals(record.dName, dname);
+        assertEquals(record.nsType, dtype);
+        assertEquals(record.nsClass, dclass);
+        assertEquals(record.ttl, ttl);
+        assertTrue(Arrays.equals(record.getRR(), rr));
     }
 
     class TestDnsPacket extends DnsPacket {
@@ -59,8 +59,8 @@
         public DnsHeader getHeader() {
             return mHeader;
         }
-        public List<DnsSection> getSectionList(int secType) {
-            return mSections[secType];
+        public List<DnsRecord> getRecordList(int secType) {
+            return mRecords[secType];
         }
     }
 
@@ -101,16 +101,16 @@
         // Header part
         assertHeaderParses(packet.getHeader(), 0x5566, 0x8180, 1, 1, 0, 0);
 
-        // Section part
-        List<DnsPacket.DnsSection> qdSectionList =
-                packet.getSectionList(DnsPacket.QDSECTION);
-        assertEquals(qdSectionList.size(), 1);
-        assertSectionParses(qdSectionList.get(0), "www.google.com", 1, 1, 0, null);
+        // Record part
+        List<DnsPacket.DnsRecord> qdRecordList =
+                packet.getRecordList(DnsPacket.QDSECTION);
+        assertEquals(qdRecordList.size(), 1);
+        assertRecordParses(qdRecordList.get(0), "www.google.com", 1, 1, 0, null);
 
-        List<DnsPacket.DnsSection> anSectionList =
-                packet.getSectionList(DnsPacket.ANSECTION);
-        assertEquals(anSectionList.size(), 1);
-        assertSectionParses(anSectionList.get(0), "www.google.com", 1, 1, 0x12b,
+        List<DnsPacket.DnsRecord> anRecordList =
+                packet.getRecordList(DnsPacket.ANSECTION);
+        assertEquals(anRecordList.size(), 1);
+        assertRecordParses(anRecordList.get(0), "www.google.com", 1, 1, 0x12b,
                 new byte[]{ (byte) 0xac, (byte) 0xd9, (byte) 0xa1, (byte) 0x84 });
     }
 
@@ -143,16 +143,16 @@
         // Header part
         assertHeaderParses(packet.getHeader(), 0x7722, 0x8180, 1, 1, 0, 0);
 
-        // Section part
-        List<DnsPacket.DnsSection> qdSectionList =
-                packet.getSectionList(DnsPacket.QDSECTION);
-        assertEquals(qdSectionList.size(), 1);
-        assertSectionParses(qdSectionList.get(0), "www.google.com", 28, 1, 0, null);
+        // Record part
+        List<DnsPacket.DnsRecord> qdRecordList =
+                packet.getRecordList(DnsPacket.QDSECTION);
+        assertEquals(qdRecordList.size(), 1);
+        assertRecordParses(qdRecordList.get(0), "www.google.com", 28, 1, 0, null);
 
-        List<DnsPacket.DnsSection> anSectionList =
-                packet.getSectionList(DnsPacket.ANSECTION);
-        assertEquals(anSectionList.size(), 1);
-        assertSectionParses(anSectionList.get(0), "www.google.com", 28, 1, 0x37,
+        List<DnsPacket.DnsRecord> anRecordList =
+                packet.getRecordList(DnsPacket.ANSECTION);
+        assertEquals(anRecordList.size(), 1);
+        assertRecordParses(anRecordList.get(0), "www.google.com", 28, 1, 0x37,
                 new byte[]{ 0x24, 0x04, 0x68, 0x00, 0x40, 0x05, 0x08, 0x0d,
                     0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x20, 0x04 });
     }
diff --git a/tests/net/java/android/net/IpMemoryStoreTest.java b/tests/net/java/android/net/IpMemoryStoreTest.java
index eae9710..57ecc8f 100644
--- a/tests/net/java/android/net/IpMemoryStoreTest.java
+++ b/tests/net/java/android/net/IpMemoryStoreTest.java
@@ -17,8 +17,9 @@
 package android.net;
 
 import android.content.Context;
-import android.support.test.filters.SmallTest;
-import android.support.test.runner.AndroidJUnit4;
+
+import androidx.test.filters.SmallTest;
+import androidx.test.runner.AndroidJUnit4;
 
 import org.junit.Before;
 import org.junit.Test;
diff --git a/tests/net/java/android/net/IpPrefixTest.java b/tests/net/java/android/net/IpPrefixTest.java
index 1f1ba2e..3cc0e36 100644
--- a/tests/net/java/android/net/IpPrefixTest.java
+++ b/tests/net/java/android/net/IpPrefixTest.java
@@ -25,15 +25,16 @@
 import static org.junit.Assert.fail;
 
 import android.os.Parcel;
-import android.support.test.filters.SmallTest;
-import android.support.test.runner.AndroidJUnit4;
+
+import androidx.test.filters.SmallTest;
+import androidx.test.runner.AndroidJUnit4;
+
+import org.junit.Test;
+import org.junit.runner.RunWith;
 
 import java.net.InetAddress;
 import java.util.Random;
 
-import org.junit.runner.RunWith;
-import org.junit.Test;
-
 @RunWith(AndroidJUnit4.class)
 @SmallTest
 public class IpPrefixTest {
diff --git a/tests/net/java/android/net/IpSecAlgorithmTest.java b/tests/net/java/android/net/IpSecAlgorithmTest.java
index 85e8361..8e9d08c 100644
--- a/tests/net/java/android/net/IpSecAlgorithmTest.java
+++ b/tests/net/java/android/net/IpSecAlgorithmTest.java
@@ -20,17 +20,18 @@
 import static org.junit.Assert.fail;
 
 import android.os.Parcel;
-import android.support.test.filters.SmallTest;
-import android.support.test.runner.AndroidJUnit4;
+
+import androidx.test.filters.SmallTest;
+import androidx.test.runner.AndroidJUnit4;
+
+import org.junit.Test;
+import org.junit.runner.RunWith;
 
 import java.util.AbstractMap.SimpleEntry;
 import java.util.Arrays;
 import java.util.Map.Entry;
 import java.util.Random;
 
-import org.junit.Test;
-import org.junit.runner.RunWith;
-
 /** Unit tests for {@link IpSecAlgorithm}. */
 @SmallTest
 @RunWith(AndroidJUnit4.class)
diff --git a/tests/net/java/android/net/IpSecConfigTest.java b/tests/net/java/android/net/IpSecConfigTest.java
index be1a455..215506c 100644
--- a/tests/net/java/android/net/IpSecConfigTest.java
+++ b/tests/net/java/android/net/IpSecConfigTest.java
@@ -22,7 +22,8 @@
 import static org.junit.Assert.assertTrue;
 
 import android.os.Parcel;
-import android.support.test.filters.SmallTest;
+
+import androidx.test.filters.SmallTest;
 
 import org.junit.Test;
 import org.junit.runner.RunWith;
diff --git a/tests/net/java/android/net/IpSecManagerTest.java b/tests/net/java/android/net/IpSecManagerTest.java
index 8160924..730e2d5 100644
--- a/tests/net/java/android/net/IpSecManagerTest.java
+++ b/tests/net/java/android/net/IpSecManagerTest.java
@@ -19,6 +19,7 @@
 import static android.system.OsConstants.AF_INET;
 import static android.system.OsConstants.IPPROTO_UDP;
 import static android.system.OsConstants.SOCK_DGRAM;
+
 import static org.junit.Assert.assertEquals;
 import static org.junit.Assert.assertNotNull;
 import static org.junit.Assert.fail;
@@ -30,21 +31,22 @@
 import static org.mockito.Mockito.verify;
 import static org.mockito.Mockito.when;
 
-import android.test.mock.MockContext;
-import android.support.test.filters.SmallTest;
-import android.support.test.runner.AndroidJUnit4;
 import android.system.Os;
+import android.test.mock.MockContext;
+
+import androidx.test.filters.SmallTest;
+import androidx.test.runner.AndroidJUnit4;
 
 import com.android.server.IpSecService;
 
-import java.net.InetAddress;
-import java.net.Socket;
-import java.net.UnknownHostException;
-
 import org.junit.Before;
 import org.junit.Test;
 import org.junit.runner.RunWith;
 
+import java.net.InetAddress;
+import java.net.Socket;
+import java.net.UnknownHostException;
+
 /** Unit tests for {@link IpSecManager}. */
 @SmallTest
 @RunWith(AndroidJUnit4.class)
diff --git a/tests/net/java/android/net/IpSecTransformTest.java b/tests/net/java/android/net/IpSecTransformTest.java
index ffd1f06..2308a3c 100644
--- a/tests/net/java/android/net/IpSecTransformTest.java
+++ b/tests/net/java/android/net/IpSecTransformTest.java
@@ -19,7 +19,7 @@
 import static org.junit.Assert.assertFalse;
 import static org.junit.Assert.assertTrue;
 
-import android.support.test.filters.SmallTest;
+import androidx.test.filters.SmallTest;
 
 import org.junit.Test;
 import org.junit.runner.RunWith;
diff --git a/tests/net/java/android/net/LinkAddressTest.java b/tests/net/java/android/net/LinkAddressTest.java
index c1ad946..be7bd1b 100644
--- a/tests/net/java/android/net/LinkAddressTest.java
+++ b/tests/net/java/android/net/LinkAddressTest.java
@@ -26,6 +26,7 @@
 import static android.system.OsConstants.RT_SCOPE_LINK;
 import static android.system.OsConstants.RT_SCOPE_SITE;
 import static android.system.OsConstants.RT_SCOPE_UNIVERSE;
+
 import static org.junit.Assert.assertEquals;
 import static org.junit.Assert.assertFalse;
 import static org.junit.Assert.assertNotEquals;
@@ -33,24 +34,22 @@
 import static org.junit.Assert.assertTrue;
 import static org.junit.Assert.fail;
 
+import android.os.Parcel;
+
+import androidx.test.filters.SmallTest;
+import androidx.test.runner.AndroidJUnit4;
+
+import org.junit.Test;
+import org.junit.runner.RunWith;
+
 import java.net.Inet4Address;
-import java.net.Inet6Address;
 import java.net.InetAddress;
 import java.net.InterfaceAddress;
 import java.net.NetworkInterface;
 import java.net.SocketException;
 import java.util.Arrays;
-import java.util.Collections;
-import java.util.Comparator;
 import java.util.List;
 
-import android.os.Parcel;
-import android.support.test.filters.SmallTest;
-import android.support.test.runner.AndroidJUnit4;
-
-import org.junit.runner.RunWith;
-import org.junit.Test;
-
 @RunWith(AndroidJUnit4.class)
 @SmallTest
 public class LinkAddressTest {
diff --git a/tests/net/java/android/net/LinkPropertiesTest.java b/tests/net/java/android/net/LinkPropertiesTest.java
index bdde096..9a7d487 100644
--- a/tests/net/java/android/net/LinkPropertiesTest.java
+++ b/tests/net/java/android/net/LinkPropertiesTest.java
@@ -24,11 +24,12 @@
 
 import android.net.LinkProperties.CompareResult;
 import android.net.LinkProperties.ProvisioningChange;
-import android.support.test.filters.SmallTest;
-import android.support.test.runner.AndroidJUnit4;
 import android.system.OsConstants;
 import android.util.ArraySet;
 
+import androidx.test.filters.SmallTest;
+import androidx.test.runner.AndroidJUnit4;
+
 import com.android.internal.util.TestUtils;
 
 import org.junit.Test;
diff --git a/tests/net/java/android/net/MacAddressTest.java b/tests/net/java/android/net/MacAddressTest.java
index 17486e0..daf187d 100644
--- a/tests/net/java/android/net/MacAddressTest.java
+++ b/tests/net/java/android/net/MacAddressTest.java
@@ -22,8 +22,8 @@
 import static org.junit.Assert.assertTrue;
 import static org.junit.Assert.fail;
 
-import android.support.test.filters.SmallTest;
-import android.support.test.runner.AndroidJUnit4;
+import androidx.test.filters.SmallTest;
+import androidx.test.runner.AndroidJUnit4;
 
 import org.junit.Test;
 import org.junit.runner.RunWith;
diff --git a/tests/net/java/android/net/NetworkCapabilitiesTest.java b/tests/net/java/android/net/NetworkCapabilitiesTest.java
index 84f7359..4d4915b 100644
--- a/tests/net/java/android/net/NetworkCapabilitiesTest.java
+++ b/tests/net/java/android/net/NetworkCapabilitiesTest.java
@@ -42,10 +42,11 @@
 import static org.junit.Assert.fail;
 
 import android.os.Parcel;
-import android.support.test.runner.AndroidJUnit4;
 import android.test.suitebuilder.annotation.SmallTest;
 import android.util.ArraySet;
 
+import androidx.test.runner.AndroidJUnit4;
+
 import org.junit.Test;
 import org.junit.runner.RunWith;
 
diff --git a/tests/net/java/android/net/NetworkStatsHistoryTest.java b/tests/net/java/android/net/NetworkStatsHistoryTest.java
index 301d04d..13558cd 100644
--- a/tests/net/java/android/net/NetworkStatsHistoryTest.java
+++ b/tests/net/java/android/net/NetworkStatsHistoryTest.java
@@ -16,14 +16,14 @@
 
 package android.net;
 
+import static android.net.NetworkStatsHistory.DataStreamUtils.readVarLong;
+import static android.net.NetworkStatsHistory.DataStreamUtils.writeVarLong;
+import static android.net.NetworkStatsHistory.Entry.UNKNOWN;
 import static android.net.NetworkStatsHistory.FIELD_ALL;
 import static android.net.NetworkStatsHistory.FIELD_OPERATIONS;
 import static android.net.NetworkStatsHistory.FIELD_RX_BYTES;
 import static android.net.NetworkStatsHistory.FIELD_RX_PACKETS;
 import static android.net.NetworkStatsHistory.FIELD_TX_BYTES;
-import static android.net.NetworkStatsHistory.DataStreamUtils.readVarLong;
-import static android.net.NetworkStatsHistory.DataStreamUtils.writeVarLong;
-import static android.net.NetworkStatsHistory.Entry.UNKNOWN;
 import static android.net.TrafficStats.GB_IN_BYTES;
 import static android.net.TrafficStats.MB_IN_BYTES;
 import static android.text.format.DateUtils.DAY_IN_MILLIS;
@@ -32,29 +32,30 @@
 import static android.text.format.DateUtils.SECOND_IN_MILLIS;
 import static android.text.format.DateUtils.WEEK_IN_MILLIS;
 import static android.text.format.DateUtils.YEAR_IN_MILLIS;
+
 import static org.junit.Assert.assertEquals;
 import static org.junit.Assert.assertFalse;
 import static org.junit.Assert.assertTrue;
 
 import android.content.Context;
-import android.support.test.InstrumentationRegistry;
-import android.support.test.filters.SmallTest;
-import android.support.test.runner.AndroidJUnit4;
-import android.test.suitebuilder.annotation.Suppress;
 import android.util.Log;
 
+import androidx.test.InstrumentationRegistry;
+import androidx.test.filters.SmallTest;
+import androidx.test.runner.AndroidJUnit4;
+
 import com.android.frameworks.tests.net.R;
 
+import org.junit.After;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+
 import java.io.ByteArrayInputStream;
 import java.io.ByteArrayOutputStream;
 import java.io.DataInputStream;
 import java.io.DataOutputStream;
 import java.util.Random;
 
-import org.junit.After;
-import org.junit.Test;
-import org.junit.runner.RunWith;
-
 @RunWith(AndroidJUnit4.class)
 @SmallTest
 public class NetworkStatsHistoryTest {
diff --git a/tests/net/java/android/net/NetworkStatsTest.java b/tests/net/java/android/net/NetworkStatsTest.java
index 2c2afd4..b5b0384 100644
--- a/tests/net/java/android/net/NetworkStatsTest.java
+++ b/tests/net/java/android/net/NetworkStatsTest.java
@@ -19,6 +19,7 @@
 import static android.net.NetworkStats.DEFAULT_NETWORK_ALL;
 import static android.net.NetworkStats.DEFAULT_NETWORK_NO;
 import static android.net.NetworkStats.DEFAULT_NETWORK_YES;
+import static android.net.NetworkStats.IFACE_ALL;
 import static android.net.NetworkStats.INTERFACES_ALL;
 import static android.net.NetworkStats.METERED_ALL;
 import static android.net.NetworkStats.METERED_NO;
@@ -26,31 +27,30 @@
 import static android.net.NetworkStats.ROAMING_ALL;
 import static android.net.NetworkStats.ROAMING_NO;
 import static android.net.NetworkStats.ROAMING_YES;
-import static android.net.NetworkStats.SET_DEFAULT;
-import static android.net.NetworkStats.SET_FOREGROUND;
+import static android.net.NetworkStats.SET_ALL;
 import static android.net.NetworkStats.SET_DBG_VPN_IN;
 import static android.net.NetworkStats.SET_DBG_VPN_OUT;
-import static android.net.NetworkStats.SET_ALL;
-import static android.net.NetworkStats.IFACE_ALL;
+import static android.net.NetworkStats.SET_DEFAULT;
+import static android.net.NetworkStats.SET_FOREGROUND;
 import static android.net.NetworkStats.TAG_ALL;
 import static android.net.NetworkStats.TAG_NONE;
 import static android.net.NetworkStats.UID_ALL;
+
 import static org.junit.Assert.assertEquals;
 import static org.junit.Assert.assertTrue;
-import static org.junit.Assert.fail;
 
-import android.net.NetworkStats.Entry;
 import android.os.Process;
-import android.support.test.runner.AndroidJUnit4;
-import android.support.test.filters.SmallTest;
 import android.util.ArrayMap;
 
+import androidx.test.filters.SmallTest;
+import androidx.test.runner.AndroidJUnit4;
+
 import com.google.android.collect.Sets;
 
-import java.util.HashSet;
-
-import org.junit.runner.RunWith;
 import org.junit.Test;
+import org.junit.runner.RunWith;
+
+import java.util.HashSet;
 
 @RunWith(AndroidJUnit4.class)
 @SmallTest
diff --git a/tests/net/java/android/net/NetworkTest.java b/tests/net/java/android/net/NetworkTest.java
index 94d01e9..0bee7cd 100644
--- a/tests/net/java/android/net/NetworkTest.java
+++ b/tests/net/java/android/net/NetworkTest.java
@@ -25,22 +25,22 @@
 import android.net.LocalSocket;
 import android.net.LocalSocketAddress;
 import android.net.Network;
-import android.support.test.filters.SmallTest;
-import android.support.test.runner.AndroidJUnit4;
+
+import androidx.test.filters.SmallTest;
+import androidx.test.runner.AndroidJUnit4;
+
+import org.junit.Test;
+import org.junit.runner.RunWith;
 
 import java.io.File;
 import java.io.FileDescriptor;
 import java.io.FileInputStream;
-import java.io.IOException;
 import java.net.DatagramSocket;
-import java.net.InetAddress;
 import java.net.Inet6Address;
+import java.net.InetAddress;
 import java.net.SocketException;
 import java.util.Objects;
 
-import org.junit.Test;
-import org.junit.runner.RunWith;
-
 @RunWith(AndroidJUnit4.class)
 @SmallTest
 public class NetworkTest {
diff --git a/tests/net/java/android/net/NetworkUtilsTest.java b/tests/net/java/android/net/NetworkUtilsTest.java
index ba6e0f2..7748288 100644
--- a/tests/net/java/android/net/NetworkUtilsTest.java
+++ b/tests/net/java/android/net/NetworkUtilsTest.java
@@ -18,7 +18,7 @@
 
 import static junit.framework.Assert.assertEquals;
 
-import android.support.test.runner.AndroidJUnit4;
+import androidx.test.runner.AndroidJUnit4;
 
 import org.junit.Test;
 import org.junit.runner.RunWith;
@@ -27,7 +27,7 @@
 import java.util.TreeSet;
 
 @RunWith(AndroidJUnit4.class)
-@android.support.test.filters.SmallTest
+@androidx.test.filters.SmallTest
 public class NetworkUtilsTest {
     @Test
     public void testRoutedIPv4AddressCount() {
diff --git a/tests/net/java/android/net/StaticIpConfigurationTest.java b/tests/net/java/android/net/StaticIpConfigurationTest.java
index 2b5ad37..8449ca7 100644
--- a/tests/net/java/android/net/StaticIpConfigurationTest.java
+++ b/tests/net/java/android/net/StaticIpConfigurationTest.java
@@ -23,8 +23,9 @@
 import static org.junit.Assert.assertTrue;
 
 import android.os.Parcel;
-import android.support.test.filters.SmallTest;
-import android.support.test.runner.AndroidJUnit4;
+
+import androidx.test.filters.SmallTest;
+import androidx.test.runner.AndroidJUnit4;
 
 import org.junit.Test;
 import org.junit.runner.RunWith;
diff --git a/tests/net/java/android/net/UidRangeTest.java b/tests/net/java/android/net/UidRangeTest.java
index 860d732..ea1df09 100644
--- a/tests/net/java/android/net/UidRangeTest.java
+++ b/tests/net/java/android/net/UidRangeTest.java
@@ -16,15 +16,13 @@
 
 package android.net;
 
-import static org.junit.Assert.assertArrayEquals;
-import static org.junit.Assert.assertEquals;
 import static org.junit.Assert.fail;
 
-import android.support.test.runner.AndroidJUnit4;
-import android.support.test.filters.SmallTest;
+import androidx.test.filters.SmallTest;
+import androidx.test.runner.AndroidJUnit4;
 
-import org.junit.runner.RunWith;
 import org.junit.Test;
+import org.junit.runner.RunWith;
 
 @RunWith(AndroidJUnit4.class)
 @SmallTest
diff --git a/tests/net/java/android/net/captiveportal/CaptivePortalProbeSpecTest.java b/tests/net/java/android/net/captiveportal/CaptivePortalProbeSpecTest.java
index 40a8b3e..f948086 100644
--- a/tests/net/java/android/net/captiveportal/CaptivePortalProbeSpecTest.java
+++ b/tests/net/java/android/net/captiveportal/CaptivePortalProbeSpecTest.java
@@ -20,14 +20,13 @@
 import static junit.framework.Assert.assertNull;
 import static junit.framework.Assert.assertTrue;
 
-import android.support.test.filters.SmallTest;
-import android.support.test.runner.AndroidJUnit4;
+import androidx.test.filters.SmallTest;
+import androidx.test.runner.AndroidJUnit4;
 
 import org.junit.Test;
 import org.junit.runner.RunWith;
 
 import java.net.MalformedURLException;
-import java.net.URL;
 import java.text.ParseException;
 
 @RunWith(AndroidJUnit4.class)
diff --git a/tests/net/java/android/net/dhcp/DhcpServingParamsParcelExtTest.java b/tests/net/java/android/net/dhcp/DhcpServingParamsParcelExtTest.java
index 4a6f20a..e01ac7f 100644
--- a/tests/net/java/android/net/dhcp/DhcpServingParamsParcelExtTest.java
+++ b/tests/net/java/android/net/dhcp/DhcpServingParamsParcelExtTest.java
@@ -25,8 +25,9 @@
 import static org.junit.Assert.assertTrue;
 
 import android.net.LinkAddress;
-import android.support.test.filters.SmallTest;
-import android.support.test.runner.AndroidJUnit4;
+
+import androidx.test.filters.SmallTest;
+import androidx.test.runner.AndroidJUnit4;
 
 import org.junit.Before;
 import org.junit.Test;
diff --git a/tests/net/java/android/net/ip/InterfaceControllerTest.java b/tests/net/java/android/net/ip/InterfaceControllerTest.java
index d27a4f9..7a56b3a 100644
--- a/tests/net/java/android/net/ip/InterfaceControllerTest.java
+++ b/tests/net/java/android/net/ip/InterfaceControllerTest.java
@@ -28,8 +28,9 @@
 import android.net.InterfaceConfigurationParcel;
 import android.net.LinkAddress;
 import android.net.util.SharedLog;
-import android.support.test.filters.SmallTest;
-import android.support.test.runner.AndroidJUnit4;
+
+import androidx.test.filters.SmallTest;
+import androidx.test.runner.AndroidJUnit4;
 
 import org.junit.Before;
 import org.junit.Test;
diff --git a/tests/net/java/android/net/ip/IpServerTest.java b/tests/net/java/android/net/ip/IpServerTest.java
index f7542a7..05912e8 100644
--- a/tests/net/java/android/net/ip/IpServerTest.java
+++ b/tests/net/java/android/net/ip/IpServerTest.java
@@ -65,10 +65,11 @@
 import android.os.INetworkManagementService;
 import android.os.RemoteException;
 import android.os.test.TestLooper;
-import android.support.test.filters.SmallTest;
-import android.support.test.runner.AndroidJUnit4;
 import android.text.TextUtils;
 
+import androidx.test.filters.SmallTest;
+import androidx.test.runner.AndroidJUnit4;
+
 import org.junit.Before;
 import org.junit.Test;
 import org.junit.runner.RunWith;
diff --git a/tests/net/java/android/net/ipmemorystore/ParcelableTests.java b/tests/net/java/android/net/ipmemorystore/ParcelableTests.java
index 1fc67a8..76cccc9 100644
--- a/tests/net/java/android/net/ipmemorystore/ParcelableTests.java
+++ b/tests/net/java/android/net/ipmemorystore/ParcelableTests.java
@@ -21,8 +21,9 @@
 
 import android.os.Parcel;
 import android.os.Parcelable;
-import android.support.test.filters.SmallTest;
-import android.support.test.runner.AndroidJUnit4;
+
+import androidx.test.filters.SmallTest;
+import androidx.test.runner.AndroidJUnit4;
 
 import org.junit.Test;
 import org.junit.runner.RunWith;
diff --git a/tests/net/java/android/net/netlink/ConntrackMessageTest.java b/tests/net/java/android/net/netlink/ConntrackMessageTest.java
index 3aab942..5c86757 100644
--- a/tests/net/java/android/net/netlink/ConntrackMessageTest.java
+++ b/tests/net/java/android/net/netlink/ConntrackMessageTest.java
@@ -20,19 +20,18 @@
 import static org.junit.Assume.assumeTrue;
 
 import android.system.OsConstants;
+
+import androidx.test.filters.SmallTest;
+import androidx.test.runner.AndroidJUnit4;
+
 import libcore.util.HexEncoding;
 
-import android.support.test.filters.SmallTest;
-import android.support.test.runner.AndroidJUnit4;
-import org.junit.runner.RunWith;
 import org.junit.Test;
+import org.junit.runner.RunWith;
 
 import java.net.Inet4Address;
 import java.net.InetAddress;
-import java.nio.ByteBuffer;
 import java.nio.ByteOrder;
-import java.util.Arrays;
-
 
 @RunWith(AndroidJUnit4.class)
 @SmallTest
diff --git a/tests/net/java/android/net/netlink/InetDiagSocketTest.java b/tests/net/java/android/net/netlink/InetDiagSocketTest.java
index 122edba..b6038ab 100644
--- a/tests/net/java/android/net/netlink/InetDiagSocketTest.java
+++ b/tests/net/java/android/net/netlink/InetDiagSocketTest.java
@@ -25,8 +25,6 @@
 import static android.system.OsConstants.IPPROTO_UDP;
 import static android.system.OsConstants.SOCK_DGRAM;
 import static android.system.OsConstants.SOCK_STREAM;
-import static android.system.OsConstants.SOL_SOCKET;
-import static android.system.OsConstants.SO_RCVTIMEO;
 
 import static org.junit.Assert.assertArrayEquals;
 import static org.junit.Assert.assertEquals;
@@ -38,29 +36,25 @@
 import android.net.ConnectivityManager;
 import android.net.netlink.StructNlMsgHdr;
 import android.os.Process;
-import android.support.test.runner.AndroidJUnit4;
-import android.support.test.filters.SmallTest;
-import android.support.test.InstrumentationRegistry;
 import android.system.Os;
-import android.system.StructTimeval;
-import android.util.Log;
-import java.io.FileDescriptor;
-import java.net.DatagramSocket;
-import java.net.InetAddress;
-import java.net.Inet4Address;
-import java.net.Inet6Address;
-import java.net.InetSocketAddress;
-import java.net.ServerSocket;
-import java.net.Socket;
-import java.net.SocketAddress;
-import java.nio.ByteBuffer;
-import java.nio.ByteOrder;
+
+import androidx.test.InstrumentationRegistry;
+import androidx.test.filters.SmallTest;
+import androidx.test.runner.AndroidJUnit4;
 
 import libcore.util.HexEncoding;
 
 import org.junit.Before;
-import org.junit.runner.RunWith;
 import org.junit.Test;
+import org.junit.runner.RunWith;
+
+import java.io.FileDescriptor;
+import java.net.Inet4Address;
+import java.net.Inet6Address;
+import java.net.InetAddress;
+import java.net.InetSocketAddress;
+import java.nio.ByteBuffer;
+import java.nio.ByteOrder;
 
 @RunWith(AndroidJUnit4.class)
 @SmallTest
diff --git a/tests/net/java/android/net/netlink/NetlinkErrorMessageTest.java b/tests/net/java/android/net/netlink/NetlinkErrorMessageTest.java
index 6647760..44ab605 100644
--- a/tests/net/java/android/net/netlink/NetlinkErrorMessageTest.java
+++ b/tests/net/java/android/net/netlink/NetlinkErrorMessageTest.java
@@ -16,9 +16,10 @@
 
 package android.net.netlink;
 
-import static android.net.netlink.StructNlMsgHdr.NLM_F_REQUEST;
 import static android.net.netlink.StructNlMsgHdr.NLM_F_ACK;
 import static android.net.netlink.StructNlMsgHdr.NLM_F_REPLACE;
+import static android.net.netlink.StructNlMsgHdr.NLM_F_REQUEST;
+
 import static org.junit.Assert.assertEquals;
 import static org.junit.Assert.assertNotNull;
 import static org.junit.Assert.assertTrue;
@@ -27,18 +28,17 @@
 import android.net.netlink.NetlinkErrorMessage;
 import android.net.netlink.NetlinkMessage;
 import android.net.netlink.StructNlMsgErr;
-import android.support.test.runner.AndroidJUnit4;
-import android.support.test.filters.SmallTest;
-import android.util.Log;
 
-import java.nio.ByteBuffer;
-import java.nio.ByteOrder;
-
-import org.junit.runner.RunWith;
-import org.junit.Test;
+import androidx.test.filters.SmallTest;
+import androidx.test.runner.AndroidJUnit4;
 
 import libcore.util.HexEncoding;
 
+import org.junit.Test;
+import org.junit.runner.RunWith;
+
+import java.nio.ByteBuffer;
+import java.nio.ByteOrder;
 
 @RunWith(AndroidJUnit4.class)
 @SmallTest
diff --git a/tests/net/java/android/net/netlink/NetlinkSocketTest.java b/tests/net/java/android/net/netlink/NetlinkSocketTest.java
index 11be40b..3916578 100644
--- a/tests/net/java/android/net/netlink/NetlinkSocketTest.java
+++ b/tests/net/java/android/net/netlink/NetlinkSocketTest.java
@@ -18,31 +18,29 @@
 
 import static android.net.netlink.NetlinkSocket.DEFAULT_RECV_BUFSIZE;
 import static android.system.OsConstants.NETLINK_ROUTE;
+
 import static org.junit.Assert.assertEquals;
 import static org.junit.Assert.assertNotNull;
 import static org.junit.Assert.assertTrue;
 
 import android.net.netlink.NetlinkSocket;
 import android.net.netlink.RtNetlinkNeighborMessage;
-import android.net.netlink.StructNdMsg;
 import android.net.netlink.StructNlMsgHdr;
-import android.support.test.runner.AndroidJUnit4;
-import android.support.test.filters.SmallTest;
-import android.system.ErrnoException;
 import android.system.NetlinkSocketAddress;
 import android.system.Os;
-import android.util.Log;
+
+import androidx.test.filters.SmallTest;
+import androidx.test.runner.AndroidJUnit4;
+
 import libcore.io.IoUtils;
 
-import java.io.InterruptedIOException;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+
 import java.io.FileDescriptor;
 import java.nio.ByteBuffer;
 import java.nio.ByteOrder;
 
-import org.junit.runner.RunWith;
-import org.junit.Test;
-
-
 @RunWith(AndroidJUnit4.class)
 @SmallTest
 public class NetlinkSocketTest {
diff --git a/tests/net/java/android/net/netlink/RtNetlinkNeighborMessageTest.java b/tests/net/java/android/net/netlink/RtNetlinkNeighborMessageTest.java
index c9fd74f..8162522 100644
--- a/tests/net/java/android/net/netlink/RtNetlinkNeighborMessageTest.java
+++ b/tests/net/java/android/net/netlink/RtNetlinkNeighborMessageTest.java
@@ -25,23 +25,22 @@
 import android.net.netlink.RtNetlinkNeighborMessage;
 import android.net.netlink.StructNdMsg;
 import android.net.netlink.StructNlMsgHdr;
-import android.support.test.runner.AndroidJUnit4;
-import android.support.test.filters.SmallTest;
 import android.system.OsConstants;
-import android.util.Log;
+
+import androidx.test.filters.SmallTest;
+import androidx.test.runner.AndroidJUnit4;
+
+import libcore.util.HexEncoding;
+
+import org.junit.Test;
+import org.junit.runner.RunWith;
 
 import java.net.Inet4Address;
 import java.net.InetAddress;
-import java.net.UnknownHostException;
 import java.nio.ByteBuffer;
 import java.nio.ByteOrder;
 import java.util.Arrays;
 
-import org.junit.runner.RunWith;
-import org.junit.Test;
-
-import libcore.util.HexEncoding;
-
 @RunWith(AndroidJUnit4.class)
 @SmallTest
 public class RtNetlinkNeighborMessageTest {
diff --git a/tests/net/java/android/net/nsd/NsdManagerTest.java b/tests/net/java/android/net/nsd/NsdManagerTest.java
index 0a5a6aa..2d2bccb 100644
--- a/tests/net/java/android/net/nsd/NsdManagerTest.java
+++ b/tests/net/java/android/net/nsd/NsdManagerTest.java
@@ -16,29 +16,31 @@
 
 package android.net.nsd;
 
+import static com.android.internal.util.TestUtils.waitForIdleHandler;
+
 import static org.junit.Assert.assertEquals;
 import static org.junit.Assert.assertNotNull;
 import static org.junit.Assert.fail;
 import static org.mockito.Mockito.any;
 import static org.mockito.Mockito.mock;
-import static org.mockito.Mockito.never;
 import static org.mockito.Mockito.reset;
 import static org.mockito.Mockito.spy;
 import static org.mockito.Mockito.timeout;
-import static org.mockito.Mockito.times;
 import static org.mockito.Mockito.verify;
 import static org.mockito.Mockito.when;
-import static com.android.internal.util.TestUtils.waitForIdleHandler;
 
-import android.os.HandlerThread;
-import android.os.Handler;
-import android.os.Looper;
 import android.content.Context;
-import android.support.test.filters.SmallTest;
-import android.support.test.runner.AndroidJUnit4;
+import android.os.Handler;
+import android.os.HandlerThread;
+import android.os.Looper;
 import android.os.Message;
 import android.os.Messenger;
+
+import androidx.test.filters.SmallTest;
+import androidx.test.runner.AndroidJUnit4;
+
 import com.android.internal.util.AsyncChannel;
+
 import org.junit.After;
 import org.junit.Before;
 import org.junit.Test;
@@ -46,8 +48,6 @@
 import org.mockito.Mock;
 import org.mockito.MockitoAnnotations;
 
-import java.util.function.Consumer;
-
 @RunWith(AndroidJUnit4.class)
 @SmallTest
 public class NsdManagerTest {
diff --git a/tests/net/java/android/net/nsd/NsdServiceInfoTest.java b/tests/net/java/android/net/nsd/NsdServiceInfoTest.java
index e48b522..94dfc75 100644
--- a/tests/net/java/android/net/nsd/NsdServiceInfoTest.java
+++ b/tests/net/java/android/net/nsd/NsdServiceInfoTest.java
@@ -24,20 +24,18 @@
 import android.os.Bundle;
 import android.os.Parcel;
 import android.os.StrictMode;
-import android.net.nsd.NsdServiceInfo;
-import android.support.test.filters.SmallTest;
-import android.support.test.runner.AndroidJUnit4;
-import android.util.Log;
 
-import java.util.Arrays;
-import java.util.HashMap;
-import java.util.Map;
-import java.net.InetAddress;
-import java.net.UnknownHostException;
+import androidx.test.filters.SmallTest;
+import androidx.test.runner.AndroidJUnit4;
 
 import org.junit.Test;
 import org.junit.runner.RunWith;
 
+import java.net.InetAddress;
+import java.net.UnknownHostException;
+import java.util.Arrays;
+import java.util.Map;
+
 @RunWith(AndroidJUnit4.class)
 @SmallTest
 public class NsdServiceInfoTest {
diff --git a/tests/net/java/android/net/shared/Inet4AddressUtilsTest.java b/tests/net/java/android/net/shared/Inet4AddressUtilsTest.java
index 6da8514..35f8c79 100644
--- a/tests/net/java/android/net/shared/Inet4AddressUtilsTest.java
+++ b/tests/net/java/android/net/shared/Inet4AddressUtilsTest.java
@@ -32,8 +32,9 @@
 import static org.junit.Assert.fail;
 
 import android.net.InetAddresses;
-import android.support.test.filters.SmallTest;
-import android.support.test.runner.AndroidJUnit4;
+
+import androidx.test.filters.SmallTest;
+import androidx.test.runner.AndroidJUnit4;
 
 import org.junit.Test;
 import org.junit.runner.RunWith;
diff --git a/tests/net/java/android/net/shared/InitialConfigurationTest.java b/tests/net/java/android/net/shared/InitialConfigurationTest.java
index 78792bd..27bc13d 100644
--- a/tests/net/java/android/net/shared/InitialConfigurationTest.java
+++ b/tests/net/java/android/net/shared/InitialConfigurationTest.java
@@ -24,8 +24,9 @@
 
 import android.net.IpPrefix;
 import android.net.LinkAddress;
-import android.support.test.filters.SmallTest;
-import android.support.test.runner.AndroidJUnit4;
+
+import androidx.test.filters.SmallTest;
+import androidx.test.runner.AndroidJUnit4;
 
 import org.junit.Before;
 import org.junit.Test;
diff --git a/tests/net/java/android/net/shared/IpConfigurationParcelableUtilTest.java b/tests/net/java/android/net/shared/IpConfigurationParcelableUtilTest.java
index fb4d43c..3e86e77 100644
--- a/tests/net/java/android/net/shared/IpConfigurationParcelableUtilTest.java
+++ b/tests/net/java/android/net/shared/IpConfigurationParcelableUtilTest.java
@@ -27,8 +27,9 @@
 import android.net.LinkAddress;
 import android.net.StaticIpConfiguration;
 import android.net.apf.ApfCapabilities;
-import android.support.test.filters.SmallTest;
-import android.support.test.runner.AndroidJUnit4;
+
+import androidx.test.filters.SmallTest;
+import androidx.test.runner.AndroidJUnit4;
 
 import org.junit.Before;
 import org.junit.Test;
diff --git a/tests/net/java/android/net/shared/LinkPropertiesParcelableUtilTest.java b/tests/net/java/android/net/shared/LinkPropertiesParcelableUtilTest.java
index b6d01db..2d0e03d 100644
--- a/tests/net/java/android/net/shared/LinkPropertiesParcelableUtilTest.java
+++ b/tests/net/java/android/net/shared/LinkPropertiesParcelableUtilTest.java
@@ -29,8 +29,9 @@
 import android.net.ProxyInfo;
 import android.net.RouteInfo;
 import android.net.Uri;
-import android.support.test.filters.SmallTest;
-import android.support.test.runner.AndroidJUnit4;
+
+import androidx.test.filters.SmallTest;
+import androidx.test.runner.AndroidJUnit4;
 
 import org.junit.Before;
 import org.junit.Test;
diff --git a/tests/net/java/android/net/shared/ProvisioningConfigurationTest.java b/tests/net/java/android/net/shared/ProvisioningConfigurationTest.java
index 6ea47d2..6fad89e 100644
--- a/tests/net/java/android/net/shared/ProvisioningConfigurationTest.java
+++ b/tests/net/java/android/net/shared/ProvisioningConfigurationTest.java
@@ -27,8 +27,9 @@
 import android.net.Network;
 import android.net.StaticIpConfiguration;
 import android.net.apf.ApfCapabilities;
-import android.support.test.filters.SmallTest;
-import android.support.test.runner.AndroidJUnit4;
+
+import androidx.test.filters.SmallTest;
+import androidx.test.runner.AndroidJUnit4;
 
 import org.junit.Before;
 import org.junit.Test;
diff --git a/tests/net/java/android/net/util/InterfaceParamsTest.java b/tests/net/java/android/net/util/InterfaceParamsTest.java
index 21728af..141455c 100644
--- a/tests/net/java/android/net/util/InterfaceParamsTest.java
+++ b/tests/net/java/android/net/util/InterfaceParamsTest.java
@@ -21,13 +21,12 @@
 import static org.junit.Assert.assertNull;
 import static org.junit.Assert.assertTrue;
 
-import android.support.test.filters.SmallTest;
-import android.support.test.runner.AndroidJUnit4;
+import androidx.test.filters.SmallTest;
+import androidx.test.runner.AndroidJUnit4;
 
 import org.junit.Test;
 import org.junit.runner.RunWith;
 
-
 @RunWith(AndroidJUnit4.class)
 @SmallTest
 public class InterfaceParamsTest {
diff --git a/tests/net/java/android/net/util/InterfaceSetTest.java b/tests/net/java/android/net/util/InterfaceSetTest.java
index 8012838..ea084b6 100644
--- a/tests/net/java/android/net/util/InterfaceSetTest.java
+++ b/tests/net/java/android/net/util/InterfaceSetTest.java
@@ -20,8 +20,8 @@
 import static junit.framework.Assert.assertFalse;
 import static junit.framework.Assert.assertTrue;
 
-import android.support.test.filters.SmallTest;
-import android.support.test.runner.AndroidJUnit4;
+import androidx.test.filters.SmallTest;
+import androidx.test.runner.AndroidJUnit4;
 
 import org.junit.Test;
 import org.junit.runner.RunWith;
diff --git a/tests/net/java/android/net/util/IpUtilsTest.java b/tests/net/java/android/net/util/IpUtilsTest.java
index 8903bf9..193d85d 100644
--- a/tests/net/java/android/net/util/IpUtilsTest.java
+++ b/tests/net/java/android/net/util/IpUtilsTest.java
@@ -18,14 +18,14 @@
 
 import static org.junit.Assert.assertEquals;
 
-import android.support.test.runner.AndroidJUnit4;
-import android.support.test.filters.SmallTest;
+import androidx.test.filters.SmallTest;
+import androidx.test.runner.AndroidJUnit4;
+
+import org.junit.Test;
+import org.junit.runner.RunWith;
 
 import java.nio.ByteBuffer;
 
-import org.junit.runner.RunWith;
-import org.junit.Test;
-
 @RunWith(AndroidJUnit4.class)
 @SmallTest
 public class IpUtilsTest {
diff --git a/tests/net/java/android/net/util/SharedLogTest.java b/tests/net/java/android/net/util/SharedLogTest.java
index 8604860..e1dba36 100644
--- a/tests/net/java/android/net/util/SharedLogTest.java
+++ b/tests/net/java/android/net/util/SharedLogTest.java
@@ -19,16 +19,14 @@
 import static org.junit.Assert.assertEquals;
 import static org.junit.Assert.assertTrue;
 
-import android.support.test.filters.SmallTest;
-import android.support.test.runner.AndroidJUnit4;
+import androidx.test.filters.SmallTest;
+import androidx.test.runner.AndroidJUnit4;
 
 import org.junit.Test;
 import org.junit.runner.RunWith;
 
 import java.io.ByteArrayOutputStream;
 import java.io.PrintWriter;
-import java.util.ArrayList;
-import java.util.Vector;
 
 @RunWith(AndroidJUnit4.class)
 @SmallTest
diff --git a/tests/net/java/android/net/util/VersionedBroadcastListenerTest.java b/tests/net/java/android/net/util/VersionedBroadcastListenerTest.java
index 39f59f1..0d27d5b 100644
--- a/tests/net/java/android/net/util/VersionedBroadcastListenerTest.java
+++ b/tests/net/java/android/net/util/VersionedBroadcastListenerTest.java
@@ -26,21 +26,19 @@
 import android.os.Looper;
 import android.os.UserHandle;
 
-import android.support.test.filters.SmallTest;
-import android.support.test.runner.AndroidJUnit4;
+import androidx.test.filters.SmallTest;
+import androidx.test.runner.AndroidJUnit4;
 
 import com.android.internal.util.test.BroadcastInterceptingContext;
 
 import org.junit.After;
 import org.junit.Before;
 import org.junit.BeforeClass;
-import org.junit.runner.RunWith;
 import org.junit.Test;
+import org.junit.runner.RunWith;
 import org.mockito.Mock;
-import org.mockito.Mockito;
 import org.mockito.MockitoAnnotations;
 
-
 @RunWith(AndroidJUnit4.class)
 @SmallTest
 public class VersionedBroadcastListenerTest {
diff --git a/tests/net/java/com/android/internal/net/NetworkStatsFactoryTest.java b/tests/net/java/com/android/internal/net/NetworkStatsFactoryTest.java
index 90bf7b1..4ec4fdd 100644
--- a/tests/net/java/com/android/internal/net/NetworkStatsFactoryTest.java
+++ b/tests/net/java/com/android/internal/net/NetworkStatsFactoryTest.java
@@ -24,33 +24,36 @@
 import static android.net.NetworkStats.SET_FOREGROUND;
 import static android.net.NetworkStats.TAG_NONE;
 import static android.net.NetworkStats.UID_ALL;
+
 import static com.android.server.NetworkManagementSocketTagger.kernelToTag;
+
 import static org.junit.Assert.assertEquals;
 import static org.junit.Assert.fail;
 
 import android.content.res.Resources;
 import android.net.NetworkStats;
 import android.net.TrafficStats;
-import android.support.test.InstrumentationRegistry;
-import android.support.test.filters.SmallTest;
-import android.support.test.runner.AndroidJUnit4;
+
+import androidx.test.InstrumentationRegistry;
+import androidx.test.filters.SmallTest;
+import androidx.test.runner.AndroidJUnit4;
 
 import com.android.frameworks.tests.net.R;
 
+import libcore.io.IoUtils;
+import libcore.io.Streams;
+
+import org.junit.After;
+import org.junit.Before;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+
 import java.io.File;
 import java.io.FileOutputStream;
 import java.io.FileWriter;
 import java.io.InputStream;
 import java.io.OutputStream;
 
-import libcore.io.IoUtils;
-import libcore.io.Streams;
-
-import org.junit.runner.RunWith;
-import org.junit.After;
-import org.junit.Before;
-import org.junit.Test;
-
 /**
  * Tests for {@link NetworkStatsFactory}.
  */
diff --git a/tests/net/java/com/android/internal/util/BitUtilsTest.java b/tests/net/java/com/android/internal/util/BitUtilsTest.java
index f4dc12a..01fb0df 100644
--- a/tests/net/java/com/android/internal/util/BitUtilsTest.java
+++ b/tests/net/java/com/android/internal/util/BitUtilsTest.java
@@ -16,14 +16,24 @@
 
 package com.android.internal.util;
 
-import android.support.test.filters.SmallTest;
-import android.support.test.runner.AndroidJUnit4;
-import java.nio.ByteBuffer;
+import static com.android.internal.util.BitUtils.bytesToBEInt;
+import static com.android.internal.util.BitUtils.bytesToLEInt;
+import static com.android.internal.util.BitUtils.getUint16;
+import static com.android.internal.util.BitUtils.getUint32;
+import static com.android.internal.util.BitUtils.getUint8;
+import static com.android.internal.util.BitUtils.uint16;
+import static com.android.internal.util.BitUtils.uint32;
+import static com.android.internal.util.BitUtils.uint8;
+
+import static org.junit.Assert.assertEquals;
+
+import androidx.test.filters.SmallTest;
+import androidx.test.runner.AndroidJUnit4;
+
 import org.junit.Test;
 import org.junit.runner.RunWith;
 
-import static org.junit.Assert.assertEquals;
-import static com.android.internal.util.BitUtils.*;
+import java.nio.ByteBuffer;
 
 @SmallTest
 @RunWith(AndroidJUnit4.class)
diff --git a/tests/net/java/com/android/internal/util/RingBufferTest.java b/tests/net/java/com/android/internal/util/RingBufferTest.java
index 90a373a..eff334f 100644
--- a/tests/net/java/com/android/internal/util/RingBufferTest.java
+++ b/tests/net/java/com/android/internal/util/RingBufferTest.java
@@ -16,19 +16,18 @@
 
 package com.android.internal.util;
 
-import static org.junit.Assert.assertEquals;
 import static org.junit.Assert.assertNull;
 import static org.junit.Assert.fail;
 
-import android.support.test.filters.SmallTest;
-import android.support.test.runner.AndroidJUnit4;
+import androidx.test.filters.SmallTest;
+import androidx.test.runner.AndroidJUnit4;
 
 import org.junit.Test;
 import org.junit.runner.RunWith;
+
 import java.util.Arrays;
 import java.util.Objects;
 
-
 @SmallTest
 @RunWith(AndroidJUnit4.class)
 public class RingBufferTest {
diff --git a/tests/net/java/com/android/server/ConnectivityServiceTest.java b/tests/net/java/com/android/server/ConnectivityServiceTest.java
index ed524f6..d29234f 100644
--- a/tests/net/java/com/android/server/ConnectivityServiceTest.java
+++ b/tests/net/java/com/android/server/ConnectivityServiceTest.java
@@ -17,10 +17,10 @@
 package com.android.server;
 
 import static android.net.ConnectivityManager.CONNECTIVITY_ACTION;
+import static android.net.ConnectivityManager.NETID_UNSET;
 import static android.net.ConnectivityManager.PRIVATE_DNS_MODE_OFF;
 import static android.net.ConnectivityManager.PRIVATE_DNS_MODE_OPPORTUNISTIC;
 import static android.net.ConnectivityManager.PRIVATE_DNS_MODE_PROVIDER_HOSTNAME;
-import static android.net.ConnectivityManager.NETID_UNSET;
 import static android.net.ConnectivityManager.TYPE_ETHERNET;
 import static android.net.ConnectivityManager.TYPE_MOBILE;
 import static android.net.ConnectivityManager.TYPE_MOBILE_FOTA;
@@ -125,6 +125,7 @@
 import android.net.NetworkRequest;
 import android.net.NetworkSpecifier;
 import android.net.NetworkStackClient;
+import android.net.NetworkState;
 import android.net.NetworkUtils;
 import android.net.ProxyInfo;
 import android.net.RouteInfo;
@@ -147,16 +148,18 @@
 import android.os.SystemClock;
 import android.os.UserHandle;
 import android.provider.Settings;
-import android.support.test.InstrumentationRegistry;
-import android.support.test.filters.SmallTest;
-import android.support.test.runner.AndroidJUnit4;
 import android.test.mock.MockContentResolver;
 import android.text.TextUtils;
 import android.util.ArraySet;
 import android.util.Log;
 import android.util.SparseArray;
 
+import androidx.test.InstrumentationRegistry;
+import androidx.test.filters.SmallTest;
+import androidx.test.runner.AndroidJUnit4;
+
 import com.android.internal.net.VpnConfig;
+import com.android.internal.net.VpnInfo;
 import com.android.internal.util.ArrayUtils;
 import com.android.internal.util.WakeupMessage;
 import com.android.internal.util.test.BroadcastInterceptingContext;
@@ -203,7 +206,6 @@
 import java.util.concurrent.atomic.AtomicBoolean;
 import java.util.function.Predicate;
 
-
 /**
  * Tests for {@link ConnectivityService}.
  *
@@ -937,11 +939,19 @@
             return mConnected;  // Similar trickery
         }
 
-        public void connect() {
+        private void connect(boolean isAlwaysMetered) {
             mNetworkCapabilities.set(mMockNetworkAgent.getNetworkCapabilities());
             mConnected = true;
             mConfig = new VpnConfig();
-            mConfig.isMetered = false;
+            mConfig.isMetered = isAlwaysMetered;
+        }
+
+        public void connectAsAlwaysMetered() {
+            connect(true /* isAlwaysMetered */);
+        }
+
+        public void connect() {
+            connect(false /* isAlwaysMetered */);
         }
 
         @Override
@@ -1828,6 +1838,12 @@
                     fn.test((NetworkCapabilities) cbi.arg));
         }
 
+        void expectLinkPropertiesLike(Predicate<LinkProperties> fn, MockNetworkAgent agent) {
+            CallbackInfo cbi = expectCallback(CallbackState.LINK_PROPERTIES, agent);
+            assertTrue("Received LinkProperties don't match expectations : " + cbi.arg,
+                    fn.test((LinkProperties) cbi.arg));
+        }
+
         void expectBlockedStatusCallback(boolean expectBlocked, MockNetworkAgent agent) {
             CallbackInfo cbi = expectCallback(CallbackState.BLOCKED_STATUS, agent);
             boolean actualBlocked = (boolean) cbi.arg;
@@ -4356,48 +4372,91 @@
         mCellNetworkAgent = new MockNetworkAgent(TRANSPORT_CELLULAR);
         mWiFiNetworkAgent = new MockNetworkAgent(TRANSPORT_WIFI);
 
-        Network[] onlyCell = new Network[]{mCellNetworkAgent.getNetwork()};
-        Network[] onlyWifi = new Network[]{mWiFiNetworkAgent.getNetwork()};
+        Network[] onlyCell = new Network[] {mCellNetworkAgent.getNetwork()};
+        Network[] onlyWifi = new Network[] {mWiFiNetworkAgent.getNetwork()};
+
+        LinkProperties cellLp = new LinkProperties();
+        cellLp.setInterfaceName(MOBILE_IFNAME);
+        LinkProperties wifiLp = new LinkProperties();
+        wifiLp.setInterfaceName(WIFI_IFNAME);
 
         // Simple connection should have updated ifaces
         mCellNetworkAgent.connect(false);
+        mCellNetworkAgent.sendLinkProperties(cellLp);
         waitForIdle();
-        verify(mStatsService, atLeastOnce()).forceUpdateIfaces(onlyCell);
+        verify(mStatsService, atLeastOnce())
+                .forceUpdateIfaces(
+                        eq(onlyCell),
+                        eq(new VpnInfo[0]),
+                        any(NetworkState[].class),
+                        eq(MOBILE_IFNAME));
         reset(mStatsService);
 
         // Default network switch should update ifaces.
         mWiFiNetworkAgent.connect(false);
+        mWiFiNetworkAgent.sendLinkProperties(wifiLp);
         waitForIdle();
-        verify(mStatsService, atLeastOnce()).forceUpdateIfaces(onlyWifi);
+        assertEquals(wifiLp, mService.getActiveLinkProperties());
+        verify(mStatsService, atLeastOnce())
+                .forceUpdateIfaces(
+                        eq(onlyWifi),
+                        eq(new VpnInfo[0]),
+                        any(NetworkState[].class),
+                        eq(WIFI_IFNAME));
         reset(mStatsService);
 
         // Disconnect should update ifaces.
         mWiFiNetworkAgent.disconnect();
         waitForIdle();
-        verify(mStatsService, atLeastOnce()).forceUpdateIfaces(onlyCell);
+        verify(mStatsService, atLeastOnce())
+                .forceUpdateIfaces(
+                        eq(onlyCell),
+                        eq(new VpnInfo[0]),
+                        any(NetworkState[].class),
+                        eq(MOBILE_IFNAME));
         reset(mStatsService);
 
         // Metered change should update ifaces
         mCellNetworkAgent.addCapability(NetworkCapabilities.NET_CAPABILITY_NOT_METERED);
         waitForIdle();
-        verify(mStatsService, atLeastOnce()).forceUpdateIfaces(onlyCell);
+        verify(mStatsService, atLeastOnce())
+                .forceUpdateIfaces(
+                        eq(onlyCell),
+                        eq(new VpnInfo[0]),
+                        any(NetworkState[].class),
+                        eq(MOBILE_IFNAME));
         reset(mStatsService);
 
         mCellNetworkAgent.removeCapability(NetworkCapabilities.NET_CAPABILITY_NOT_METERED);
         waitForIdle();
-        verify(mStatsService, atLeastOnce()).forceUpdateIfaces(onlyCell);
+        verify(mStatsService, atLeastOnce())
+                .forceUpdateIfaces(
+                        eq(onlyCell),
+                        eq(new VpnInfo[0]),
+                        any(NetworkState[].class),
+                        eq(MOBILE_IFNAME));
         reset(mStatsService);
 
         // Captive portal change shouldn't update ifaces
         mCellNetworkAgent.addCapability(NetworkCapabilities.NET_CAPABILITY_CAPTIVE_PORTAL);
         waitForIdle();
-        verify(mStatsService, never()).forceUpdateIfaces(onlyCell);
+        verify(mStatsService, never())
+                .forceUpdateIfaces(
+                        eq(onlyCell),
+                        eq(new VpnInfo[0]),
+                        any(NetworkState[].class),
+                        eq(MOBILE_IFNAME));
         reset(mStatsService);
 
         // Roaming change should update ifaces
         mCellNetworkAgent.addCapability(NetworkCapabilities.NET_CAPABILITY_NOT_ROAMING);
         waitForIdle();
-        verify(mStatsService, atLeastOnce()).forceUpdateIfaces(onlyCell);
+        verify(mStatsService, atLeastOnce())
+                .forceUpdateIfaces(
+                        eq(onlyCell),
+                        eq(new VpnInfo[0]),
+                        any(NetworkState[].class),
+                        eq(MOBILE_IFNAME));
         reset(mStatsService);
     }
 
@@ -5053,6 +5112,202 @@
     }
 
     @Test
+    public void testIsActiveNetworkMeteredOverWifi() {
+        // Returns true by default when no network is available.
+        assertTrue(mCm.isActiveNetworkMetered());
+        mWiFiNetworkAgent = new MockNetworkAgent(TRANSPORT_WIFI);
+        mWiFiNetworkAgent.addCapability(NET_CAPABILITY_NOT_METERED);
+        mWiFiNetworkAgent.connect(true);
+        waitForIdle();
+
+        assertFalse(mCm.isActiveNetworkMetered());
+    }
+
+    @Test
+    public void testIsActiveNetworkMeteredOverCell() {
+        // Returns true by default when no network is available.
+        assertTrue(mCm.isActiveNetworkMetered());
+        mCellNetworkAgent = new MockNetworkAgent(TRANSPORT_CELLULAR);
+        mCellNetworkAgent.removeCapability(NET_CAPABILITY_NOT_METERED);
+        mCellNetworkAgent.connect(true);
+        waitForIdle();
+
+        assertTrue(mCm.isActiveNetworkMetered());
+    }
+
+    @Test
+    public void testIsActiveNetworkMeteredOverVpnTrackingPlatformDefault() {
+        // Returns true by default when no network is available.
+        assertTrue(mCm.isActiveNetworkMetered());
+        mCellNetworkAgent = new MockNetworkAgent(TRANSPORT_CELLULAR);
+        mCellNetworkAgent.removeCapability(NET_CAPABILITY_NOT_METERED);
+        mCellNetworkAgent.connect(true);
+        waitForIdle();
+        assertTrue(mCm.isActiveNetworkMetered());
+
+        // Connect VPN network. By default it is using current default network (Cell).
+        MockNetworkAgent vpnNetworkAgent = new MockNetworkAgent(TRANSPORT_VPN);
+        final ArraySet<UidRange> ranges = new ArraySet<>();
+        final int uid = Process.myUid();
+        ranges.add(new UidRange(uid, uid));
+        mMockVpn.setNetworkAgent(vpnNetworkAgent);
+        mMockVpn.setUids(ranges);
+        vpnNetworkAgent.connect(true);
+        mMockVpn.connect();
+        waitForIdle();
+        // Ensure VPN is now the active network.
+        assertEquals(vpnNetworkAgent.getNetwork(), mCm.getActiveNetwork());
+
+        // Expect VPN to be metered.
+        assertTrue(mCm.isActiveNetworkMetered());
+
+        // Connect WiFi.
+        mWiFiNetworkAgent = new MockNetworkAgent(TRANSPORT_WIFI);
+        mWiFiNetworkAgent.addCapability(NET_CAPABILITY_NOT_METERED);
+        mWiFiNetworkAgent.connect(true);
+        waitForIdle();
+        // VPN should still be the active network.
+        assertEquals(vpnNetworkAgent.getNetwork(), mCm.getActiveNetwork());
+
+        // Expect VPN to be unmetered as it should now be using WiFi (new default).
+        assertFalse(mCm.isActiveNetworkMetered());
+
+        // Disconnecting Cell should not affect VPN's meteredness.
+        mCellNetworkAgent.disconnect();
+        waitForIdle();
+
+        assertFalse(mCm.isActiveNetworkMetered());
+
+        // Disconnect WiFi; Now there is no platform default network.
+        mWiFiNetworkAgent.disconnect();
+        waitForIdle();
+
+        // VPN without any underlying networks is treated as metered.
+        assertTrue(mCm.isActiveNetworkMetered());
+
+        vpnNetworkAgent.disconnect();
+        mMockVpn.disconnect();
+    }
+
+   @Test
+   public void testIsActiveNetworkMeteredOverVpnSpecifyingUnderlyingNetworks() {
+        // Returns true by default when no network is available.
+        assertTrue(mCm.isActiveNetworkMetered());
+        mCellNetworkAgent = new MockNetworkAgent(TRANSPORT_CELLULAR);
+        mCellNetworkAgent.removeCapability(NET_CAPABILITY_NOT_METERED);
+        mCellNetworkAgent.connect(true);
+        waitForIdle();
+        assertTrue(mCm.isActiveNetworkMetered());
+
+        mWiFiNetworkAgent = new MockNetworkAgent(TRANSPORT_WIFI);
+        mWiFiNetworkAgent.addCapability(NET_CAPABILITY_NOT_METERED);
+        mWiFiNetworkAgent.connect(true);
+        waitForIdle();
+        assertFalse(mCm.isActiveNetworkMetered());
+
+        // Connect VPN network.
+        MockNetworkAgent vpnNetworkAgent = new MockNetworkAgent(TRANSPORT_VPN);
+        final ArraySet<UidRange> ranges = new ArraySet<>();
+        final int uid = Process.myUid();
+        ranges.add(new UidRange(uid, uid));
+        mMockVpn.setNetworkAgent(vpnNetworkAgent);
+        mMockVpn.setUids(ranges);
+        vpnNetworkAgent.connect(true);
+        mMockVpn.connect();
+        waitForIdle();
+        // Ensure VPN is now the active network.
+        assertEquals(vpnNetworkAgent.getNetwork(), mCm.getActiveNetwork());
+        // VPN is using Cell
+        mService.setUnderlyingNetworksForVpn(
+                new Network[] { mCellNetworkAgent.getNetwork() });
+        waitForIdle();
+
+        // Expect VPN to be metered.
+        assertTrue(mCm.isActiveNetworkMetered());
+
+        // VPN is now using WiFi
+        mService.setUnderlyingNetworksForVpn(
+                new Network[] { mWiFiNetworkAgent.getNetwork() });
+        waitForIdle();
+
+        // Expect VPN to be unmetered
+        assertFalse(mCm.isActiveNetworkMetered());
+
+        // VPN is using Cell | WiFi.
+        mService.setUnderlyingNetworksForVpn(
+                new Network[] { mCellNetworkAgent.getNetwork(), mWiFiNetworkAgent.getNetwork() });
+        waitForIdle();
+
+        // Expect VPN to be metered.
+        assertTrue(mCm.isActiveNetworkMetered());
+
+        // VPN is using WiFi | Cell.
+        mService.setUnderlyingNetworksForVpn(
+                new Network[] { mWiFiNetworkAgent.getNetwork(), mCellNetworkAgent.getNetwork() });
+        waitForIdle();
+
+        // Order should not matter and VPN should still be metered.
+        assertTrue(mCm.isActiveNetworkMetered());
+
+        // VPN is not using any underlying networks.
+        mService.setUnderlyingNetworksForVpn(new Network[0]);
+        waitForIdle();
+
+        // VPN without underlying networks is treated as metered.
+        assertTrue(mCm.isActiveNetworkMetered());
+
+        vpnNetworkAgent.disconnect();
+        mMockVpn.disconnect();
+    }
+
+    @Test
+    public void testIsActiveNetworkMeteredOverAlwaysMeteredVpn() {
+        // Returns true by default when no network is available.
+        assertTrue(mCm.isActiveNetworkMetered());
+        mWiFiNetworkAgent = new MockNetworkAgent(TRANSPORT_WIFI);
+        mWiFiNetworkAgent.addCapability(NET_CAPABILITY_NOT_METERED);
+        mWiFiNetworkAgent.connect(true);
+        waitForIdle();
+        assertFalse(mCm.isActiveNetworkMetered());
+
+        // Connect VPN network.
+        MockNetworkAgent vpnNetworkAgent = new MockNetworkAgent(TRANSPORT_VPN);
+        final ArraySet<UidRange> ranges = new ArraySet<>();
+        final int uid = Process.myUid();
+        ranges.add(new UidRange(uid, uid));
+        mMockVpn.setNetworkAgent(vpnNetworkAgent);
+        mMockVpn.setUids(ranges);
+        vpnNetworkAgent.connect(true);
+        mMockVpn.connectAsAlwaysMetered();
+        waitForIdle();
+        assertEquals(vpnNetworkAgent.getNetwork(), mCm.getActiveNetwork());
+
+        // VPN is tracking current platform default (WiFi).
+        mService.setUnderlyingNetworksForVpn(null);
+        waitForIdle();
+
+        // Despite VPN using WiFi (which is unmetered), VPN itself is marked as always metered.
+        assertTrue(mCm.isActiveNetworkMetered());
+
+        // VPN explicitly declares WiFi as its underlying network.
+        mService.setUnderlyingNetworksForVpn(
+                new Network[] { mWiFiNetworkAgent.getNetwork() });
+        waitForIdle();
+
+        // Doesn't really matter whether VPN declares its underlying networks explicitly.
+        assertTrue(mCm.isActiveNetworkMetered());
+
+        // With WiFi lost, VPN is basically without any underlying networks. And in that case it is
+        // anyways suppose to be metered.
+        mWiFiNetworkAgent.disconnect();
+        waitForIdle();
+
+        assertTrue(mCm.isActiveNetworkMetered());
+
+        vpnNetworkAgent.disconnect();
+    }
+
+    @Test
     public void testNetworkBlockedStatus() {
         final TestNetworkCallback cellNetworkCallback = new TestNetworkCallback();
         final NetworkRequest cellRequest = new NetworkRequest.Builder()
@@ -5176,6 +5431,9 @@
     public void testStackedLinkProperties() throws UnknownHostException, RemoteException {
         final LinkAddress myIpv4 = new LinkAddress("1.2.3.4/24");
         final LinkAddress myIpv6 = new LinkAddress("2001:db8:1::1/64");
+        final String kNat64PrefixString = "2001:db8:64:64:64:64::";
+        final IpPrefix kNat64Prefix = new IpPrefix(InetAddress.getByName(kNat64PrefixString), 96);
+
         final NetworkRequest networkRequest = new NetworkRequest.Builder()
                 .addTransportType(TRANSPORT_CELLULAR)
                 .addCapability(NET_CAPABILITY_INTERNET)
@@ -5183,8 +5441,9 @@
         final TestNetworkCallback networkCallback = new TestNetworkCallback();
         mCm.registerNetworkCallback(networkRequest, networkCallback);
 
-        // Prepare ipv6 only link properties and connect.
+        // Prepare ipv6 only link properties.
         mCellNetworkAgent = new MockNetworkAgent(TRANSPORT_CELLULAR);
+        final int cellNetId = mCellNetworkAgent.getNetwork().netId;
         final LinkProperties cellLp = new LinkProperties();
         cellLp.setInterfaceName(MOBILE_IFNAME);
         cellLp.addLinkAddress(myIpv6);
@@ -5194,15 +5453,44 @@
         when(mNetworkManagementService.getInterfaceConfig(CLAT_PREFIX + MOBILE_IFNAME))
                 .thenReturn(getClatInterfaceConfig(myIpv4));
 
-        // Connect with ipv6 link properties, then expect clat setup ipv4 and update link
-        // properties properly.
+        // Connect with ipv6 link properties. Expect prefix discovery to be started.
         mCellNetworkAgent.sendLinkProperties(cellLp);
         mCellNetworkAgent.connect(true);
         networkCallback.expectAvailableThenValidatedCallbacks(mCellNetworkAgent);
-        verify(mMockNetd, times(1)).clatdStart(MOBILE_IFNAME);
-        Nat464Xlat clat = mService.getNat464Xlat(mCellNetworkAgent);
+        verify(mMockNetd, times(1)).resolverStartPrefix64Discovery(cellNetId);
 
-        // Clat iface up, expect stack link updated.
+        // Switching default network updates TCP buffer sizes.
+        verifyTcpBufferSizeChange(ConnectivityService.DEFAULT_TCP_BUFFER_SIZES);
+
+        // Add an IPv4 address. Expect prefix discovery to be stopped. Netd doesn't tell us that
+        // the NAT64 prefix was removed because one was never discovered.
+        cellLp.addLinkAddress(myIpv4);
+        mCellNetworkAgent.sendLinkProperties(cellLp);
+        networkCallback.expectCallback(CallbackState.LINK_PROPERTIES, mCellNetworkAgent);
+        verify(mMockNetd, times(1)).resolverStopPrefix64Discovery(cellNetId);
+
+        verifyNoMoreInteractions(mMockNetd);
+        reset(mMockNetd);
+
+        // Remove IPv4 address. Expect prefix discovery to be started again.
+        cellLp.removeLinkAddress(myIpv4);
+        cellLp.removeRoute(new RouteInfo(myIpv4, null, MOBILE_IFNAME));
+        mCellNetworkAgent.sendLinkProperties(cellLp);
+        networkCallback.expectCallback(CallbackState.LINK_PROPERTIES, mCellNetworkAgent);
+        verify(mMockNetd, times(1)).resolverStartPrefix64Discovery(cellNetId);
+
+        // When NAT64 prefix discovery succeeds, LinkProperties are updated and clatd is started.
+        Nat464Xlat clat = mService.getNat464Xlat(mCellNetworkAgent);
+        assertNull(mCm.getLinkProperties(mCellNetworkAgent.getNetwork()).getNat64Prefix());
+        mService.mNetdEventCallback.onNat64PrefixEvent(cellNetId, true /* added */,
+                kNat64PrefixString, 96);
+        LinkProperties lpBeforeClat = (LinkProperties) networkCallback.expectCallback(
+                CallbackState.LINK_PROPERTIES, mCellNetworkAgent).arg;
+        assertEquals(0, lpBeforeClat.getStackedLinks().size());
+        assertEquals(kNat64Prefix, lpBeforeClat.getNat64Prefix());
+        verify(mMockNetd, times(1)).clatdStart(MOBILE_IFNAME, kNat64Prefix.toString());
+
+        // Clat iface comes up. Expect stacked link to be added.
         clat.interfaceLinkStateChanged(CLAT_PREFIX + MOBILE_IFNAME, true);
         networkCallback.expectCallback(CallbackState.LINK_PROPERTIES, mCellNetworkAgent);
         List<LinkProperties> stackedLps = mCm.getLinkProperties(mCellNetworkAgent.getNetwork())
@@ -5219,20 +5507,66 @@
         assertNotEquals(stackedLpsAfterChange, Collections.EMPTY_LIST);
         assertEquals(makeClatLinkProperties(myIpv4), stackedLpsAfterChange.get(0));
 
-        // Add ipv4 address, expect stacked linkproperties be cleaned up
+        // Add ipv4 address, expect that clatd and prefix discovery are stopped and stacked
+        // linkproperties are cleaned up.
         cellLp.addLinkAddress(myIpv4);
         cellLp.addRoute(new RouteInfo(myIpv4, null, MOBILE_IFNAME));
         mCellNetworkAgent.sendLinkProperties(cellLp);
         networkCallback.expectCallback(CallbackState.LINK_PROPERTIES, mCellNetworkAgent);
         verify(mMockNetd, times(1)).clatdStop(MOBILE_IFNAME);
+        verify(mMockNetd, times(1)).resolverStopPrefix64Discovery(cellNetId);
 
-        // Clat iface removed, expect linkproperties revert to original one
-        clat.interfaceRemoved(CLAT_PREFIX + MOBILE_IFNAME);
+        // As soon as stop is called, the linkproperties lose the stacked interface.
         networkCallback.expectCallback(CallbackState.LINK_PROPERTIES, mCellNetworkAgent);
         LinkProperties actualLpAfterIpv4 = mCm.getLinkProperties(mCellNetworkAgent.getNetwork());
-        assertEquals(cellLp, actualLpAfterIpv4);
+        LinkProperties expected = new LinkProperties(cellLp);
+        expected.setNat64Prefix(kNat64Prefix);
+        assertEquals(expected, actualLpAfterIpv4);
+        assertEquals(0, actualLpAfterIpv4.getStackedLinks().size());
 
-        // Clean up
+        // The interface removed callback happens but has no effect after stop is called.
+        clat.interfaceRemoved(CLAT_PREFIX + MOBILE_IFNAME);
+        networkCallback.assertNoCallback();
+
+        verifyNoMoreInteractions(mMockNetd);
+        reset(mMockNetd);
+
+        // Stopping prefix discovery causes netd to tell us that the NAT64 prefix is gone.
+        mService.mNetdEventCallback.onNat64PrefixEvent(cellNetId, false /* added */,
+                kNat64PrefixString, 96);
+        networkCallback.expectLinkPropertiesLike((lp) -> lp.getNat64Prefix() == null,
+                mCellNetworkAgent);
+
+        // Remove IPv4 address and expect prefix discovery and clatd to be started again.
+        cellLp.removeLinkAddress(myIpv4);
+        cellLp.removeRoute(new RouteInfo(myIpv4, null, MOBILE_IFNAME));
+        cellLp.removeDnsServer(InetAddress.getByName("8.8.8.8"));
+        mCellNetworkAgent.sendLinkProperties(cellLp);
+        networkCallback.expectCallback(CallbackState.LINK_PROPERTIES, mCellNetworkAgent);
+        verify(mMockNetd, times(1)).resolverStartPrefix64Discovery(cellNetId);
+        mService.mNetdEventCallback.onNat64PrefixEvent(cellNetId, true /* added */,
+                kNat64PrefixString, 96);
+        networkCallback.expectCallback(CallbackState.LINK_PROPERTIES, mCellNetworkAgent);
+        verify(mMockNetd, times(1)).clatdStart(MOBILE_IFNAME, kNat64Prefix.toString());
+
+
+        // Clat iface comes up. Expect stacked link to be added.
+        clat.interfaceLinkStateChanged(CLAT_PREFIX + MOBILE_IFNAME, true);
+        networkCallback.expectLinkPropertiesLike(
+                (lp) -> lp.getStackedLinks().size() == 1 && lp.getNat64Prefix() != null,
+                mCellNetworkAgent);
+
+        // NAT64 prefix is removed. Expect that clat is stopped.
+        mService.mNetdEventCallback.onNat64PrefixEvent(cellNetId, false /* added */,
+                kNat64PrefixString, 96);
+        networkCallback.expectLinkPropertiesLike(
+                (lp) -> lp.getStackedLinks().size() == 0 && lp.getNat64Prefix() == null,
+                mCellNetworkAgent);
+        verify(mMockNetd, times(1)).clatdStop(MOBILE_IFNAME);
+        networkCallback.expectLinkPropertiesLike((lp) -> lp.getStackedLinks().size() == 0,
+                mCellNetworkAgent);
+
+        // Clean up.
         mCellNetworkAgent.disconnect();
         networkCallback.expectCallback(CallbackState.LOST, mCellNetworkAgent);
         networkCallback.assertNoCallback();
@@ -5313,30 +5647,34 @@
         mCm.unregisterNetworkCallback(networkCallback);
     }
 
-    private static final String TEST_TCP_BUFFER_SIZES = "1,2,3,4,5,6";
-
-    private void verifyTcpBufferSizeChange(String tcpBufferSizes) throws Exception {
+    private void verifyTcpBufferSizeChange(String tcpBufferSizes) {
         String[] values = tcpBufferSizes.split(",");
         String rmemValues = String.join(" ", values[0], values[1], values[2]);
         String wmemValues = String.join(" ", values[3], values[4], values[5]);
         waitForIdle();
-        verify(mMockNetd, atLeastOnce()).setTcpRWmemorySize(rmemValues, wmemValues);
+        try {
+            verify(mMockNetd, atLeastOnce()).setTcpRWmemorySize(rmemValues, wmemValues);
+        } catch (RemoteException e) {
+            fail("mMockNetd should never throw RemoteException");
+        }
         reset(mMockNetd);
     }
 
     @Test
-    public void testTcpBufferReset() throws Exception {
+    public void testTcpBufferReset() {
+        final String testTcpBufferSizes = "1,2,3,4,5,6";
+
         mCellNetworkAgent = new MockNetworkAgent(TRANSPORT_CELLULAR);
         reset(mMockNetd);
-        // Simple connection should have updated tcp buffer size.
+        // Switching default network updates TCP buffer sizes.
         mCellNetworkAgent.connect(false);
         verifyTcpBufferSizeChange(ConnectivityService.DEFAULT_TCP_BUFFER_SIZES);
 
         // Change link Properties should have updated tcp buffer size.
         LinkProperties lp = new LinkProperties();
-        lp.setTcpBufferSizes(TEST_TCP_BUFFER_SIZES);
+        lp.setTcpBufferSizes(testTcpBufferSizes);
         mCellNetworkAgent.sendLinkProperties(lp);
-        verifyTcpBufferSizeChange(TEST_TCP_BUFFER_SIZES);
+        verifyTcpBufferSizeChange(testTcpBufferSizes);
     }
 
     @Test
diff --git a/tests/net/java/com/android/server/IpSecServiceParameterizedTest.java b/tests/net/java/com/android/server/IpSecServiceParameterizedTest.java
index a844cfe..7c40adf 100644
--- a/tests/net/java/com/android/server/IpSecServiceParameterizedTest.java
+++ b/tests/net/java/com/android/server/IpSecServiceParameterizedTest.java
@@ -18,6 +18,7 @@
 
 import static android.system.OsConstants.AF_INET;
 import static android.system.OsConstants.AF_INET6;
+
 import static org.junit.Assert.assertEquals;
 import static org.junit.Assert.assertNotNull;
 import static org.junit.Assert.fail;
@@ -45,13 +46,10 @@
 import android.net.NetworkUtils;
 import android.os.Binder;
 import android.os.ParcelFileDescriptor;
-import android.support.test.filters.SmallTest;
 import android.system.Os;
 import android.test.mock.MockContext;
 
-import java.net.Socket;
-import java.util.Arrays;
-import java.util.Collection;
+import androidx.test.filters.SmallTest;
 
 import org.junit.Before;
 import org.junit.Ignore;
@@ -59,6 +57,10 @@
 import org.junit.runner.RunWith;
 import org.junit.runners.Parameterized;
 
+import java.net.Socket;
+import java.util.Arrays;
+import java.util.Collection;
+
 /** Unit tests for {@link IpSecService}. */
 @SmallTest
 @RunWith(Parameterized.class)
diff --git a/tests/net/java/com/android/server/IpSecServiceRefcountedResourceTest.java b/tests/net/java/com/android/server/IpSecServiceRefcountedResourceTest.java
index cf8f715..68ff777 100644
--- a/tests/net/java/com/android/server/IpSecServiceRefcountedResourceTest.java
+++ b/tests/net/java/com/android/server/IpSecServiceRefcountedResourceTest.java
@@ -31,22 +31,23 @@
 import android.os.Binder;
 import android.os.IBinder;
 import android.os.RemoteException;
-import android.support.test.filters.SmallTest;
-import android.support.test.runner.AndroidJUnit4;
+
+import androidx.test.filters.SmallTest;
+import androidx.test.runner.AndroidJUnit4;
 
 import com.android.server.IpSecService.IResource;
 import com.android.server.IpSecService.RefcountedResource;
 
+import org.junit.Before;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+
 import java.util.ArrayList;
 import java.util.HashSet;
 import java.util.List;
 import java.util.Set;
 import java.util.concurrent.ThreadLocalRandom;
 
-import org.junit.Before;
-import org.junit.Test;
-import org.junit.runner.RunWith;
-
 /** Unit tests for {@link IpSecService.RefcountedResource}. */
 @SmallTest
 @RunWith(AndroidJUnit4.class)
diff --git a/tests/net/java/com/android/server/IpSecServiceTest.java b/tests/net/java/com/android/server/IpSecServiceTest.java
index 5be7c7b..b5c3e92 100644
--- a/tests/net/java/com/android/server/IpSecServiceTest.java
+++ b/tests/net/java/com/android/server/IpSecServiceTest.java
@@ -20,6 +20,7 @@
 import static android.system.OsConstants.EADDRINUSE;
 import static android.system.OsConstants.IPPROTO_UDP;
 import static android.system.OsConstants.SOCK_DGRAM;
+
 import static org.junit.Assert.assertEquals;
 import static org.junit.Assert.assertNotEquals;
 import static org.junit.Assert.assertNotNull;
@@ -39,19 +40,24 @@
 import android.net.IpSecConfig;
 import android.net.IpSecManager;
 import android.net.IpSecSpiResponse;
-import android.net.IpSecTransform;
 import android.net.IpSecUdpEncapResponse;
 import android.os.Binder;
 import android.os.ParcelFileDescriptor;
 import android.os.Process;
-import android.support.test.filters.SmallTest;
-import android.support.test.runner.AndroidJUnit4;
 import android.system.ErrnoException;
 import android.system.Os;
 import android.system.StructStat;
 
+import androidx.test.filters.SmallTest;
+import androidx.test.runner.AndroidJUnit4;
+
 import dalvik.system.SocketTagger;
 
+import org.junit.Before;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+import org.mockito.ArgumentMatcher;
+
 import java.io.FileDescriptor;
 import java.net.InetAddress;
 import java.net.ServerSocket;
@@ -60,11 +66,6 @@
 import java.util.ArrayList;
 import java.util.List;
 
-import org.junit.Before;
-import org.junit.Test;
-import org.junit.runner.RunWith;
-import org.mockito.ArgumentMatcher;
-
 /** Unit tests for {@link IpSecService}. */
 @SmallTest
 @RunWith(AndroidJUnit4.class)
diff --git a/tests/net/java/com/android/server/NetworkManagementServiceTest.java b/tests/net/java/com/android/server/NetworkManagementServiceTest.java
index 56a075b..6fb3225 100644
--- a/tests/net/java/com/android/server/NetworkManagementServiceTest.java
+++ b/tests/net/java/com/android/server/NetworkManagementServiceTest.java
@@ -26,21 +26,19 @@
 import android.content.Context;
 import android.net.INetd;
 import android.net.LinkAddress;
-import android.net.LocalSocket;
 import android.net.LocalServerSocket;
+import android.net.LocalSocket;
 import android.os.BatteryStats;
 import android.os.Binder;
 import android.os.IBinder;
-import android.support.test.runner.AndroidJUnit4;
 import android.test.suitebuilder.annotation.SmallTest;
 
+import androidx.test.runner.AndroidJUnit4;
+
 import com.android.internal.app.IBatteryStats;
 import com.android.server.NetworkManagementService.SystemServices;
 import com.android.server.net.BaseNetworkObserver;
 
-import java.io.IOException;
-import java.io.OutputStream;
-
 import org.junit.After;
 import org.junit.Before;
 import org.junit.Test;
@@ -48,6 +46,9 @@
 import org.mockito.Mock;
 import org.mockito.MockitoAnnotations;
 
+import java.io.IOException;
+import java.io.OutputStream;
+
 /**
  * Tests for {@link NetworkManagementService}.
  */
diff --git a/tests/net/java/com/android/server/NsdServiceTest.java b/tests/net/java/com/android/server/NsdServiceTest.java
index b88c784..a90fa68 100644
--- a/tests/net/java/com/android/server/NsdServiceTest.java
+++ b/tests/net/java/com/android/server/NsdServiceTest.java
@@ -22,23 +22,25 @@
 import static org.mockito.Mockito.never;
 import static org.mockito.Mockito.reset;
 import static org.mockito.Mockito.timeout;
-import static org.mockito.Mockito.times;
 import static org.mockito.Mockito.verify;
 import static org.mockito.Mockito.when;
 
+import android.content.ContentResolver;
+import android.content.Context;
+import android.net.nsd.NsdManager;
+import android.net.nsd.NsdServiceInfo;
 import android.os.Handler;
 import android.os.HandlerThread;
 import android.os.Looper;
 import android.os.Message;
-import android.content.Context;
-import android.content.ContentResolver;
-import android.net.nsd.NsdManager;
-import android.net.nsd.NsdServiceInfo;
+
+import androidx.test.filters.SmallTest;
+import androidx.test.runner.AndroidJUnit4;
+
 import com.android.server.NsdService.DaemonConnection;
 import com.android.server.NsdService.DaemonConnectionSupplier;
 import com.android.server.NsdService.NativeCallbackReceiver;
-import android.support.test.filters.SmallTest;
-import android.support.test.runner.AndroidJUnit4;
+
 import org.junit.After;
 import org.junit.Before;
 import org.junit.Test;
diff --git a/tests/net/java/com/android/server/connectivity/DnsManagerTest.java b/tests/net/java/com/android/server/connectivity/DnsManagerTest.java
index 38322e9..15ba43d 100644
--- a/tests/net/java/com/android/server/connectivity/DnsManagerTest.java
+++ b/tests/net/java/com/android/server/connectivity/DnsManagerTest.java
@@ -37,10 +37,11 @@
 import android.net.shared.PrivateDnsConfig;
 import android.os.INetworkManagementService;
 import android.provider.Settings;
-import android.support.test.filters.SmallTest;
-import android.support.test.runner.AndroidJUnit4;
 import android.test.mock.MockContentResolver;
 
+import androidx.test.filters.SmallTest;
+import androidx.test.runner.AndroidJUnit4;
+
 import com.android.internal.util.test.FakeSettingsProvider;
 
 import org.junit.Before;
diff --git a/tests/net/java/com/android/server/connectivity/IpConnectivityEventBuilderTest.java b/tests/net/java/com/android/server/connectivity/IpConnectivityEventBuilderTest.java
index 0656c5f..70495cc 100644
--- a/tests/net/java/com/android/server/connectivity/IpConnectivityEventBuilderTest.java
+++ b/tests/net/java/com/android/server/connectivity/IpConnectivityEventBuilderTest.java
@@ -16,52 +16,44 @@
 
 package com.android.server.connectivity;
 
-import static android.net.metrics.INetdEventListener.EVENT_GETADDRINFO;
-import static android.net.metrics.INetdEventListener.EVENT_GETHOSTBYNAME;
-import static com.android.server.connectivity.MetricsTestUtil.aBool;
-import static com.android.server.connectivity.MetricsTestUtil.aByteArray;
 import static com.android.server.connectivity.MetricsTestUtil.aLong;
 import static com.android.server.connectivity.MetricsTestUtil.aString;
 import static com.android.server.connectivity.MetricsTestUtil.aType;
 import static com.android.server.connectivity.MetricsTestUtil.anInt;
-import static com.android.server.connectivity.MetricsTestUtil.anIntArray;
-import static com.android.server.connectivity.MetricsTestUtil.b;
 import static com.android.server.connectivity.MetricsTestUtil.describeIpEvent;
-import static com.android.server.connectivity.metrics.nano.IpConnectivityLogClass.IpConnectivityLog;
 import static com.android.server.connectivity.metrics.nano.IpConnectivityLogClass.BLUETOOTH;
 import static com.android.server.connectivity.metrics.nano.IpConnectivityLogClass.CELLULAR;
-import static com.android.server.connectivity.metrics.nano.IpConnectivityLogClass.ETHERNET;
+import static com.android.server.connectivity.metrics.nano.IpConnectivityLogClass.IpConnectivityLog;
 import static com.android.server.connectivity.metrics.nano.IpConnectivityLogClass.MULTIPLE;
 import static com.android.server.connectivity.metrics.nano.IpConnectivityLogClass.WIFI;
+
 import static org.junit.Assert.assertEquals;
 import static org.junit.Assert.fail;
 
 import android.net.ConnectivityMetricsEvent;
 import android.net.metrics.ApfProgramEvent;
 import android.net.metrics.ApfStats;
-import android.net.metrics.ConnectStats;
 import android.net.metrics.DefaultNetworkEvent;
 import android.net.metrics.DhcpClientEvent;
 import android.net.metrics.DhcpErrorEvent;
-import android.net.metrics.DnsEvent;
-import android.net.metrics.DnsEvent;
 import android.net.metrics.IpManagerEvent;
 import android.net.metrics.IpReachabilityEvent;
 import android.net.metrics.NetworkEvent;
 import android.net.metrics.RaEvent;
 import android.net.metrics.ValidationProbeEvent;
 import android.net.metrics.WakeupStats;
-import android.support.test.runner.AndroidJUnit4;
 import android.test.suitebuilder.annotation.SmallTest;
 
+import androidx.test.runner.AndroidJUnit4;
+
 import com.android.server.connectivity.metrics.nano.IpConnectivityLogClass.IpConnectivityEvent;
 
+import org.junit.Test;
+import org.junit.runner.RunWith;
+
 import java.util.Arrays;
 import java.util.List;
 
-import org.junit.runner.RunWith;
-import org.junit.Test;
-
 // TODO: instead of comparing textpb to textpb, parse textpb and compare proto to proto.
 @RunWith(AndroidJUnit4.class)
 @SmallTest
diff --git a/tests/net/java/com/android/server/connectivity/IpConnectivityMetricsTest.java b/tests/net/java/com/android/server/connectivity/IpConnectivityMetricsTest.java
index 1a0cb74..d5b2c87 100644
--- a/tests/net/java/com/android/server/connectivity/IpConnectivityMetricsTest.java
+++ b/tests/net/java/com/android/server/connectivity/IpConnectivityMetricsTest.java
@@ -47,11 +47,12 @@
 import android.net.metrics.RaEvent;
 import android.net.metrics.ValidationProbeEvent;
 import android.os.Parcelable;
-import android.support.test.runner.AndroidJUnit4;
 import android.system.OsConstants;
 import android.test.suitebuilder.annotation.SmallTest;
 import android.util.Base64;
 
+import androidx.test.runner.AndroidJUnit4;
+
 import com.android.internal.util.BitUtils;
 import com.android.server.connectivity.metrics.nano.IpConnectivityLogClass;
 
diff --git a/tests/net/java/com/android/server/connectivity/LingerMonitorTest.java b/tests/net/java/com/android/server/connectivity/LingerMonitorTest.java
index 5057443..6de4aa1 100644
--- a/tests/net/java/com/android/server/connectivity/LingerMonitorTest.java
+++ b/tests/net/java/com/android/server/connectivity/LingerMonitorTest.java
@@ -39,10 +39,11 @@
 import android.net.NetworkInfo;
 import android.net.NetworkMisc;
 import android.os.INetworkManagementService;
-import android.support.test.filters.SmallTest;
-import android.support.test.runner.AndroidJUnit4;
 import android.text.format.DateUtils;
 
+import androidx.test.filters.SmallTest;
+import androidx.test.runner.AndroidJUnit4;
+
 import com.android.internal.R;
 import com.android.server.ConnectivityService;
 import com.android.server.connectivity.NetworkNotificationManager.NotificationType;
diff --git a/tests/net/java/com/android/server/connectivity/MultipathPolicyTrackerTest.java b/tests/net/java/com/android/server/connectivity/MultipathPolicyTrackerTest.java
index e58811b..b783467 100644
--- a/tests/net/java/com/android/server/connectivity/MultipathPolicyTrackerTest.java
+++ b/tests/net/java/com/android/server/connectivity/MultipathPolicyTrackerTest.java
@@ -28,7 +28,6 @@
 import static com.android.server.net.NetworkPolicyManagerInternal.QUOTA_TYPE_MULTIPATH;
 import static com.android.server.net.NetworkPolicyManagerService.OPPORTUNISTIC_QUOTA_UNKNOWN;
 
-import static junit.framework.TestCase.assertEquals;
 import static junit.framework.TestCase.assertNotNull;
 
 import static org.mockito.ArgumentMatchers.any;
@@ -54,13 +53,14 @@
 import android.net.StringNetworkSpecifier;
 import android.os.Handler;
 import android.provider.Settings;
-import android.support.test.filters.SmallTest;
-import android.support.test.runner.AndroidJUnit4;
 import android.telephony.TelephonyManager;
 import android.test.mock.MockContentResolver;
 import android.util.DataUnit;
 import android.util.RecurrenceRule;
 
+import androidx.test.filters.SmallTest;
+import androidx.test.runner.AndroidJUnit4;
+
 import com.android.internal.R;
 import com.android.internal.util.test.FakeSettingsProvider;
 import com.android.server.LocalServices;
diff --git a/tests/net/java/com/android/server/connectivity/Nat464XlatTest.java b/tests/net/java/com/android/server/connectivity/Nat464XlatTest.java
index 07b1d05..cc09fb7 100644
--- a/tests/net/java/com/android/server/connectivity/Nat464XlatTest.java
+++ b/tests/net/java/com/android/server/connectivity/Nat464XlatTest.java
@@ -16,9 +16,11 @@
 
 package com.android.server.connectivity;
 
+import static org.junit.Assert.assertEquals;
 import static org.junit.Assert.assertFalse;
 import static org.junit.Assert.assertTrue;
 import static org.mockito.Mockito.eq;
+import static org.mockito.Mockito.inOrder;
 import static org.mockito.Mockito.times;
 import static org.mockito.Mockito.verify;
 import static org.mockito.Mockito.verifyNoMoreInteractions;
@@ -27,6 +29,7 @@
 import android.net.ConnectivityManager;
 import android.net.INetd;
 import android.net.InterfaceConfiguration;
+import android.net.IpPrefix;
 import android.net.LinkAddress;
 import android.net.LinkProperties;
 import android.net.NetworkInfo;
@@ -34,8 +37,9 @@
 import android.os.Handler;
 import android.os.INetworkManagementService;
 import android.os.test.TestLooper;
-import android.support.test.filters.SmallTest;
-import android.support.test.runner.AndroidJUnit4;
+
+import androidx.test.filters.SmallTest;
+import androidx.test.runner.AndroidJUnit4;
 
 import com.android.server.ConnectivityService;
 
@@ -43,6 +47,7 @@
 import org.junit.Test;
 import org.junit.runner.RunWith;
 import org.mockito.ArgumentCaptor;
+import org.mockito.InOrder;
 import org.mockito.Mock;
 import org.mockito.MockitoAnnotations;
 
@@ -53,6 +58,8 @@
     static final String BASE_IFACE = "test0";
     static final String STACKED_IFACE = "v4-test0";
     static final LinkAddress ADDR = new LinkAddress("192.0.2.5/29");
+    static final String NAT64_PREFIX = "64:ff9b::/96";
+    static final int NETID = 42;
 
     @Mock ConnectivityService mConnectivity;
     @Mock NetworkMisc mMisc;
@@ -65,7 +72,11 @@
     Handler mHandler;
 
     Nat464Xlat makeNat464Xlat() {
-        return new Nat464Xlat(mNai, mNetd, mNms);
+        return new Nat464Xlat(mNai, mNetd, mNms) {
+            @Override protected int getNetId() {
+                return NETID;
+            }
+        };
     }
 
     @Before
@@ -87,6 +98,24 @@
         when(mConfig.getLinkAddress()).thenReturn(ADDR);
     }
 
+    private void assertRequiresClat(boolean expected, NetworkAgentInfo nai) {
+        String msg = String.format("requiresClat expected %b for type=%d state=%s skip=%b "
+                + "nat64Prefix=%s addresses=%s", expected, nai.networkInfo.getType(),
+                nai.networkInfo.getDetailedState(),
+                mMisc.skip464xlat, nai.linkProperties.getNat64Prefix(),
+                nai.linkProperties.getLinkAddresses());
+        assertEquals(msg, expected, Nat464Xlat.requiresClat(nai));
+    }
+
+    private void assertShouldStartClat(boolean expected, NetworkAgentInfo nai) {
+        String msg = String.format("shouldStartClat expected %b for type=%d state=%s skip=%b "
+                + "nat64Prefix=%s addresses=%s", expected, nai.networkInfo.getType(),
+                nai.networkInfo.getDetailedState(),
+                mMisc.skip464xlat, nai.linkProperties.getNat64Prefix(),
+                nai.linkProperties.getLinkAddresses());
+        assertEquals(msg, expected, Nat464Xlat.shouldStartClat(nai));
+    }
+
     @Test
     public void testRequiresClat() throws Exception {
         final int[] supportedTypes = {
@@ -102,20 +131,45 @@
             NetworkInfo.DetailedState.SUSPENDED,
         };
 
+        LinkProperties oldLp = new LinkProperties(mNai.linkProperties);
         for (int type : supportedTypes) {
             mNai.networkInfo.setType(type);
             for (NetworkInfo.DetailedState state : supportedDetailedStates) {
                 mNai.networkInfo.setDetailedState(state, "reason", "extraInfo");
-                String msg = String.format("requiresClat expected for type=%d state=%s",
-                        type, state);
+
+                mNai.linkProperties.setNat64Prefix(new IpPrefix("2001:db8:0:64::/96"));
+                assertRequiresClat(false, mNai);
+                assertShouldStartClat(false, mNai);
+
+                mNai.linkProperties.addLinkAddress(new LinkAddress("fc00::1/64"));
+                assertRequiresClat(false, mNai);
+                assertShouldStartClat(false, mNai);
+
+                mNai.linkProperties.addLinkAddress(new LinkAddress("2001:db8::1/64"));
+                assertRequiresClat(true, mNai);
+                assertShouldStartClat(true, mNai);
 
                 mMisc.skip464xlat = true;
-                String errorMsg = msg + String.format(" skip464xlat=%b", mMisc.skip464xlat);
-                assertFalse(errorMsg, Nat464Xlat.requiresClat(mNai));
+                assertRequiresClat(false, mNai);
+                assertShouldStartClat(false, mNai);
 
                 mMisc.skip464xlat = false;
-                errorMsg = msg + String.format(" skip464xlat=%b", mMisc.skip464xlat);
-                assertTrue(errorMsg, Nat464Xlat.requiresClat(mNai));
+                assertRequiresClat(true, mNai);
+                assertShouldStartClat(true, mNai);
+
+                mNai.linkProperties.addLinkAddress(new LinkAddress("192.0.2.2/24"));
+                assertRequiresClat(false, mNai);
+                assertShouldStartClat(false, mNai);
+
+                mNai.linkProperties.removeLinkAddress(new LinkAddress("192.0.2.2/24"));
+                assertRequiresClat(true, mNai);
+                assertShouldStartClat(true, mNai);
+
+                mNai.linkProperties.setNat64Prefix(null);
+                assertRequiresClat(true, mNai);
+                assertShouldStartClat(false, mNai);
+
+                mNai.linkProperties = new LinkProperties(oldLp);
             }
         }
     }
@@ -125,11 +179,13 @@
         Nat464Xlat nat = makeNat464Xlat();
         ArgumentCaptor<LinkProperties> c = ArgumentCaptor.forClass(LinkProperties.class);
 
-        // ConnectivityService starts clat.
+        nat.setNat64Prefix(new IpPrefix(NAT64_PREFIX));
+
+        // Start clat.
         nat.start();
 
         verify(mNms).registerObserver(eq(nat));
-        verify(mNetd).clatdStart(eq(BASE_IFACE));
+        verify(mNetd).clatdStart(eq(BASE_IFACE), eq(NAT64_PREFIX));
 
         // Stacked interface up notification arrives.
         nat.interfaceLinkStateChanged(STACKED_IFACE, true);
@@ -141,22 +197,109 @@
         assertTrue(c.getValue().getAllInterfaceNames().contains(STACKED_IFACE));
         assertRunning(nat);
 
-        // ConnectivityService stops clat (Network disconnects, IPv4 addr appears, ...).
+        // Stop clat (Network disconnects, IPv4 addr appears, ...).
         nat.stop();
 
         verify(mNetd).clatdStop(eq(BASE_IFACE));
+        verify(mConnectivity, times(2)).handleUpdateLinkProperties(eq(mNai), c.capture());
+        verify(mNms).unregisterObserver(eq(nat));
+        assertTrue(c.getValue().getStackedLinks().isEmpty());
+        assertFalse(c.getValue().getAllInterfaceNames().contains(STACKED_IFACE));
+        verify(mNetd).resolverStopPrefix64Discovery(eq(NETID));
+        assertIdle(nat);
 
-        // Stacked interface removed notification arrives.
+        // Stacked interface removed notification arrives and is ignored.
         nat.interfaceRemoved(STACKED_IFACE);
         mLooper.dispatchNext();
 
-        verify(mNms).unregisterObserver(eq(nat));
-        verify(mConnectivity, times(2)).handleUpdateLinkProperties(eq(mNai), c.capture());
+        verifyNoMoreInteractions(mNetd, mNms, mConnectivity);
+    }
+
+    private void checkStartStopStart(boolean interfaceRemovedFirst) throws Exception {
+        Nat464Xlat nat = makeNat464Xlat();
+        ArgumentCaptor<LinkProperties> c = ArgumentCaptor.forClass(LinkProperties.class);
+        InOrder inOrder = inOrder(mNetd, mConnectivity);
+
+        nat.setNat64Prefix(new IpPrefix(NAT64_PREFIX));
+
+        nat.start();
+
+        inOrder.verify(mNetd).clatdStart(eq(BASE_IFACE), eq(NAT64_PREFIX));
+
+        // Stacked interface up notification arrives.
+        nat.interfaceLinkStateChanged(STACKED_IFACE, true);
+        mLooper.dispatchNext();
+
+        inOrder.verify(mConnectivity).handleUpdateLinkProperties(eq(mNai), c.capture());
+        assertFalse(c.getValue().getStackedLinks().isEmpty());
+        assertTrue(c.getValue().getAllInterfaceNames().contains(STACKED_IFACE));
+        assertRunning(nat);
+
+        // ConnectivityService stops clat (Network disconnects, IPv4 addr appears, ...).
+        nat.stop();
+
+        inOrder.verify(mNetd).clatdStop(eq(BASE_IFACE));
+
+        inOrder.verify(mConnectivity, times(1)).handleUpdateLinkProperties(eq(mNai), c.capture());
         assertTrue(c.getValue().getStackedLinks().isEmpty());
         assertFalse(c.getValue().getAllInterfaceNames().contains(STACKED_IFACE));
         assertIdle(nat);
 
-        verifyNoMoreInteractions(mNetd, mNms, mConnectivity);
+        if (interfaceRemovedFirst) {
+            // Stacked interface removed notification arrives and is ignored.
+            nat.interfaceRemoved(STACKED_IFACE);
+            mLooper.dispatchNext();
+            nat.interfaceLinkStateChanged(STACKED_IFACE, false);
+            mLooper.dispatchNext();
+        }
+
+        assertTrue(c.getValue().getStackedLinks().isEmpty());
+        assertFalse(c.getValue().getAllInterfaceNames().contains(STACKED_IFACE));
+        assertIdle(nat);
+        inOrder.verifyNoMoreInteractions();
+
+        nat.start();
+
+        inOrder.verify(mNetd).clatdStart(eq(BASE_IFACE), eq(NAT64_PREFIX));
+
+        if (!interfaceRemovedFirst) {
+            // Stacked interface removed notification arrives and is ignored.
+            nat.interfaceRemoved(STACKED_IFACE);
+            mLooper.dispatchNext();
+            nat.interfaceLinkStateChanged(STACKED_IFACE, false);
+            mLooper.dispatchNext();
+        }
+
+        // Stacked interface up notification arrives.
+        nat.interfaceLinkStateChanged(STACKED_IFACE, true);
+        mLooper.dispatchNext();
+
+        inOrder.verify(mConnectivity).handleUpdateLinkProperties(eq(mNai), c.capture());
+        assertFalse(c.getValue().getStackedLinks().isEmpty());
+        assertTrue(c.getValue().getAllInterfaceNames().contains(STACKED_IFACE));
+        assertRunning(nat);
+
+        // ConnectivityService stops clat again.
+        nat.stop();
+
+        inOrder.verify(mNetd).clatdStop(eq(BASE_IFACE));
+
+        inOrder.verify(mConnectivity, times(1)).handleUpdateLinkProperties(eq(mNai), c.capture());
+        assertTrue(c.getValue().getStackedLinks().isEmpty());
+        assertFalse(c.getValue().getAllInterfaceNames().contains(STACKED_IFACE));
+        assertIdle(nat);
+
+        inOrder.verifyNoMoreInteractions();
+    }
+
+    @Test
+    public void testStartStopStart() throws Exception {
+        checkStartStopStart(true);
+    }
+
+    @Test
+    public void testStartStopStartBeforeInterfaceRemoved() throws Exception {
+        checkStartStopStart(false);
     }
 
     @Test
@@ -164,11 +307,12 @@
         Nat464Xlat nat = makeNat464Xlat();
         ArgumentCaptor<LinkProperties> c = ArgumentCaptor.forClass(LinkProperties.class);
 
-        // ConnectivityService starts clat.
+        nat.setNat64Prefix(new IpPrefix(NAT64_PREFIX));
+
         nat.start();
 
         verify(mNms).registerObserver(eq(nat));
-        verify(mNetd).clatdStart(eq(BASE_IFACE));
+        verify(mNetd).clatdStart(eq(BASE_IFACE), eq(NAT64_PREFIX));
 
         // Stacked interface up notification arrives.
         nat.interfaceLinkStateChanged(STACKED_IFACE, true);
@@ -184,9 +328,10 @@
         nat.interfaceRemoved(STACKED_IFACE);
         mLooper.dispatchNext();
 
-        verify(mNms).unregisterObserver(eq(nat));
         verify(mNetd).clatdStop(eq(BASE_IFACE));
         verify(mConnectivity, times(2)).handleUpdateLinkProperties(eq(mNai), c.capture());
+        verify(mNms).unregisterObserver(eq(nat));
+        verify(mNetd).resolverStopPrefix64Discovery(eq(NETID));
         assertTrue(c.getValue().getStackedLinks().isEmpty());
         assertFalse(c.getValue().getAllInterfaceNames().contains(STACKED_IFACE));
         assertIdle(nat);
@@ -201,24 +346,25 @@
     public void testStopBeforeClatdStarts() throws Exception {
         Nat464Xlat nat = makeNat464Xlat();
 
-        // ConnectivityService starts clat.
+        nat.setNat64Prefix(new IpPrefix(NAT64_PREFIX));
+
         nat.start();
 
         verify(mNms).registerObserver(eq(nat));
-        verify(mNetd).clatdStart(eq(BASE_IFACE));
+        verify(mNetd).clatdStart(eq(BASE_IFACE), eq(NAT64_PREFIX));
 
         // ConnectivityService immediately stops clat (Network disconnects, IPv4 addr appears, ...)
         nat.stop();
 
-        verify(mNms).unregisterObserver(eq(nat));
         verify(mNetd).clatdStop(eq(BASE_IFACE));
+        verify(mNms).unregisterObserver(eq(nat));
+        verify(mNetd).resolverStopPrefix64Discovery(eq(NETID));
         assertIdle(nat);
 
         // In-flight interface up notification arrives: no-op
         nat.interfaceLinkStateChanged(STACKED_IFACE, true);
         mLooper.dispatchNext();
 
-
         // Interface removed notification arrives after stopClatd() takes effect: no-op.
         nat.interfaceRemoved(STACKED_IFACE);
         mLooper.dispatchNext();
@@ -232,17 +378,19 @@
     public void testStopAndClatdNeverStarts() throws Exception {
         Nat464Xlat nat = makeNat464Xlat();
 
-        // ConnectivityService starts clat.
+        nat.setNat64Prefix(new IpPrefix(NAT64_PREFIX));
+
         nat.start();
 
         verify(mNms).registerObserver(eq(nat));
-        verify(mNetd).clatdStart(eq(BASE_IFACE));
+        verify(mNetd).clatdStart(eq(BASE_IFACE), eq(NAT64_PREFIX));
 
         // ConnectivityService immediately stops clat (Network disconnects, IPv4 addr appears, ...)
         nat.stop();
 
-        verify(mNms).unregisterObserver(eq(nat));
         verify(mNetd).clatdStop(eq(BASE_IFACE));
+        verify(mNms).unregisterObserver(eq(nat));
+        verify(mNetd).resolverStopPrefix64Discovery(eq(NETID));
         assertIdle(nat);
 
         verifyNoMoreInteractions(mNetd, mNms, mConnectivity);
diff --git a/tests/net/java/com/android/server/connectivity/NetdEventListenerServiceTest.java b/tests/net/java/com/android/server/connectivity/NetdEventListenerServiceTest.java
index 67805c9..e4117b8 100644
--- a/tests/net/java/com/android/server/connectivity/NetdEventListenerServiceTest.java
+++ b/tests/net/java/com/android/server/connectivity/NetdEventListenerServiceTest.java
@@ -18,43 +18,37 @@
 
 import static android.net.metrics.INetdEventListener.EVENT_GETADDRINFO;
 import static android.net.metrics.INetdEventListener.EVENT_GETHOSTBYNAME;
+
 import static org.junit.Assert.assertEquals;
 import static org.junit.Assert.assertTrue;
 import static org.junit.Assert.fail;
-import static org.mockito.Mockito.any;
 import static org.mockito.Mockito.mock;
-import static org.mockito.Mockito.anyInt;
-import static org.mockito.Mockito.eq;
-import static org.mockito.Mockito.timeout;
-import static org.mockito.Mockito.times;
-import static org.mockito.Mockito.verify;
 import static org.mockito.Mockito.when;
 
 import android.content.Context;
 import android.net.ConnectivityManager;
 import android.net.Network;
 import android.net.NetworkCapabilities;
-import android.support.test.runner.AndroidJUnit4;
 import android.system.OsConstants;
 import android.test.suitebuilder.annotation.SmallTest;
 import android.util.Base64;
 
-import com.android.server.connectivity.metrics.nano.IpConnectivityLogClass.DNSLookupBatch;
+import androidx.test.runner.AndroidJUnit4;
+
 import com.android.server.connectivity.metrics.nano.IpConnectivityLogClass.IpConnectivityEvent;
 import com.android.server.connectivity.metrics.nano.IpConnectivityLogClass.IpConnectivityLog;
 
-import java.io.FileOutputStream;
-import java.io.PrintWriter;
-import java.io.StringWriter;
-import java.util.ArrayList;
-import java.util.Arrays;
-import java.util.Comparator;
-import java.util.List;
-
 import org.junit.Before;
 import org.junit.Test;
 import org.junit.runner.RunWith;
 
+import java.io.FileOutputStream;
+import java.io.PrintWriter;
+import java.io.StringWriter;
+import java.util.Arrays;
+import java.util.Comparator;
+import java.util.List;
+
 @RunWith(AndroidJUnit4.class)
 @SmallTest
 public class NetdEventListenerServiceTest {
diff --git a/tests/net/java/com/android/server/connectivity/NetworkNotificationManagerTest.java b/tests/net/java/com/android/server/connectivity/NetworkNotificationManagerTest.java
index 273b8fc..9580763 100644
--- a/tests/net/java/com/android/server/connectivity/NetworkNotificationManagerTest.java
+++ b/tests/net/java/com/android/server/connectivity/NetworkNotificationManagerTest.java
@@ -35,10 +35,11 @@
 import android.content.res.Resources;
 import android.net.NetworkCapabilities;
 import android.net.NetworkInfo;
-import android.support.test.filters.SmallTest;
-import android.support.test.runner.AndroidJUnit4;
 import android.telephony.TelephonyManager;
 
+import androidx.test.filters.SmallTest;
+import androidx.test.runner.AndroidJUnit4;
+
 import com.android.server.connectivity.NetworkNotificationManager.NotificationType;
 
 import org.junit.Before;
diff --git a/tests/net/java/com/android/server/connectivity/PermissionMonitorTest.java b/tests/net/java/com/android/server/connectivity/PermissionMonitorTest.java
index f2bd770..354c08f 100644
--- a/tests/net/java/com/android/server/connectivity/PermissionMonitorTest.java
+++ b/tests/net/java/com/android/server/connectivity/PermissionMonitorTest.java
@@ -50,8 +50,9 @@
 import android.os.Build;
 import android.os.INetworkManagementService;
 import android.os.UserHandle;
-import android.support.test.filters.SmallTest;
-import android.support.test.runner.AndroidJUnit4;
+
+import androidx.test.filters.SmallTest;
+import androidx.test.runner.AndroidJUnit4;
 
 import org.junit.Before;
 import org.junit.Test;
diff --git a/tests/net/java/com/android/server/connectivity/TetheringTest.java b/tests/net/java/com/android/server/connectivity/TetheringTest.java
index 533d7ad..fdba723 100644
--- a/tests/net/java/com/android/server/connectivity/TetheringTest.java
+++ b/tests/net/java/com/android/server/connectivity/TetheringTest.java
@@ -68,6 +68,7 @@
 import android.net.INetd;
 import android.net.INetworkPolicyManager;
 import android.net.INetworkStatsService;
+import android.net.ITetheringEventCallback;
 import android.net.InterfaceConfiguration;
 import android.net.IpPrefix;
 import android.net.LinkAddress;
@@ -98,11 +99,12 @@
 import android.os.UserManager;
 import android.os.test.TestLooper;
 import android.provider.Settings;
-import android.support.test.filters.SmallTest;
-import android.support.test.runner.AndroidJUnit4;
 import android.telephony.CarrierConfigManager;
 import android.test.mock.MockContentResolver;
 
+import androidx.test.filters.SmallTest;
+import androidx.test.runner.AndroidJUnit4;
+
 import com.android.internal.util.ArrayUtils;
 import com.android.internal.util.StateMachine;
 import com.android.internal.util.test.BroadcastInterceptingContext;
@@ -122,6 +124,7 @@
 import java.net.Inet4Address;
 import java.net.Inet6Address;
 import java.util.ArrayList;
+import java.util.Arrays;
 import java.util.Vector;
 
 @RunWith(AndroidJUnit4.class)
@@ -917,6 +920,67 @@
                 expectedInteractionsWithShowNotification);
     }
 
+    private class TestTetheringEventCallback extends ITetheringEventCallback.Stub {
+        private final ArrayList<Network> mActualUpstreams = new ArrayList<>();
+
+        public void expectUpstreamChanged(Network... networks) {
+            final ArrayList<Network> expectedUpstreams =
+                    new ArrayList<Network>(Arrays.asList(networks));
+            for (Network upstream : expectedUpstreams) {
+                // throws OOB if no expectations
+                assertEquals(mActualUpstreams.remove(0), upstream);
+            }
+            assertNoCallback();
+        }
+
+        @Override
+        public void onUpstreamChanged(Network network) {
+            mActualUpstreams.add(network);
+        }
+
+        public void assertNoCallback() {
+            assertTrue(mActualUpstreams.isEmpty());
+        }
+    }
+
+    @Test
+    public void testRegisterTetheringEventCallback() throws Exception {
+        TestTetheringEventCallback callback1 = new TestTetheringEventCallback();
+        TestTetheringEventCallback callback2 = new TestTetheringEventCallback();
+
+        // 1. Register one callback and run usb tethering.
+        mTethering.registerTetheringEventCallback(callback1);
+        mLooper.dispatchAll();
+        callback1.expectUpstreamChanged(new Network[] {null});
+        NetworkState upstreamState = buildMobileDualStackUpstreamState();
+        runUsbTethering(upstreamState);
+        callback1.expectUpstreamChanged(upstreamState.network);
+        // 2. Register second callback.
+        mTethering.registerTetheringEventCallback(callback2);
+        mLooper.dispatchAll();
+        callback2.expectUpstreamChanged(upstreamState.network);
+        // 3. Disable usb tethering.
+        mTethering.stopTethering(TETHERING_USB);
+        mLooper.dispatchAll();
+        sendUsbBroadcast(false, false, false);
+        mLooper.dispatchAll();
+        callback1.expectUpstreamChanged(new Network[] {null});
+        callback2.expectUpstreamChanged(new Network[] {null});
+        // 4. Unregister first callback and run hotspot.
+        mTethering.unregisterTetheringEventCallback(callback1);
+        mLooper.dispatchAll();
+        when(mUpstreamNetworkMonitor.getCurrentPreferredUpstream()).thenReturn(upstreamState);
+        when(mUpstreamNetworkMonitor.selectPreferredUpstreamType(any()))
+                .thenReturn(upstreamState);
+        when(mWifiManager.startSoftAp(any(WifiConfiguration.class))).thenReturn(true);
+        mTethering.startTethering(TETHERING_WIFI, null, false);
+        mLooper.dispatchAll();
+        mTethering.interfaceStatusChanged(TEST_WLAN_IFNAME, true);
+        sendWifiApStateChanged(WIFI_AP_STATE_ENABLED, TEST_WLAN_IFNAME, IFACE_IP_MODE_TETHERED);
+        mLooper.dispatchAll();
+        callback1.assertNoCallback();
+        callback2.expectUpstreamChanged(upstreamState.network);
+    }
 
     // TODO: Test that a request for hotspot mode doesn't interfere with an
     // already operating tethering mode interface.
diff --git a/tests/net/java/com/android/server/connectivity/VpnTest.java b/tests/net/java/com/android/server/connectivity/VpnTest.java
index b5d1ff9..2cae250 100644
--- a/tests/net/java/com/android/server/connectivity/VpnTest.java
+++ b/tests/net/java/com/android/server/connectivity/VpnTest.java
@@ -73,11 +73,12 @@
 import android.os.SystemClock;
 import android.os.UserHandle;
 import android.os.UserManager;
-import android.support.test.filters.SmallTest;
-import android.support.test.runner.AndroidJUnit4;
 import android.util.ArrayMap;
 import android.util.ArraySet;
 
+import androidx.test.filters.SmallTest;
+import androidx.test.runner.AndroidJUnit4;
+
 import com.android.internal.R;
 import com.android.internal.net.VpnConfig;
 
diff --git a/tests/net/java/com/android/server/connectivity/tethering/EntitlementManagerTest.java b/tests/net/java/com/android/server/connectivity/tethering/EntitlementManagerTest.java
index 193f380..3944fad 100644
--- a/tests/net/java/com/android/server/connectivity/tethering/EntitlementManagerTest.java
+++ b/tests/net/java/com/android/server/connectivity/tethering/EntitlementManagerTest.java
@@ -42,11 +42,12 @@
 import android.os.ResultReceiver;
 import android.os.test.TestLooper;
 import android.provider.Settings;
-import android.support.test.filters.SmallTest;
-import android.support.test.runner.AndroidJUnit4;
 import android.telephony.CarrierConfigManager;
 import android.test.mock.MockContentResolver;
 
+import androidx.test.filters.SmallTest;
+import androidx.test.runner.AndroidJUnit4;
+
 import com.android.internal.R;
 import com.android.internal.util.State;
 import com.android.internal.util.StateMachine;
@@ -225,7 +226,7 @@
                 mCallbacklatch.countDown();
             }
         };
-        mEnMgr.getLatestTetheringEntitlementValue(TETHERING_WIFI, receiver, true);
+        mEnMgr.getLatestTetheringEntitlementResult(TETHERING_WIFI, receiver, true);
         callbackTimeoutHelper(mCallbacklatch);
         assertFalse(mEnMgr.everRunUiEntitlement);
 
@@ -241,7 +242,7 @@
                 mCallbacklatch.countDown();
             }
         };
-        mEnMgr.getLatestTetheringEntitlementValue(TETHERING_WIFI, receiver, false);
+        mEnMgr.getLatestTetheringEntitlementResult(TETHERING_WIFI, receiver, false);
         callbackTimeoutHelper(mCallbacklatch);
         assertFalse(mEnMgr.everRunUiEntitlement);
         // 3. No cache value and ui entitlement check is needed.
@@ -254,7 +255,7 @@
                 mCallbacklatch.countDown();
             }
         };
-        mEnMgr.getLatestTetheringEntitlementValue(TETHERING_WIFI, receiver, true);
+        mEnMgr.getLatestTetheringEntitlementResult(TETHERING_WIFI, receiver, true);
         mLooper.dispatchAll();
         callbackTimeoutHelper(mCallbacklatch);
         assertTrue(mEnMgr.everRunUiEntitlement);
@@ -268,7 +269,7 @@
                 mCallbacklatch.countDown();
             }
         };
-        mEnMgr.getLatestTetheringEntitlementValue(TETHERING_WIFI, receiver, false);
+        mEnMgr.getLatestTetheringEntitlementResult(TETHERING_WIFI, receiver, false);
         callbackTimeoutHelper(mCallbacklatch);
         assertFalse(mEnMgr.everRunUiEntitlement);
         // 5. Cache value is TETHER_ERROR_PROVISION_FAILED and ui entitlement check is needed.
@@ -281,7 +282,7 @@
                 mCallbacklatch.countDown();
             }
         };
-        mEnMgr.getLatestTetheringEntitlementValue(TETHERING_WIFI, receiver, true);
+        mEnMgr.getLatestTetheringEntitlementResult(TETHERING_WIFI, receiver, true);
         mLooper.dispatchAll();
         callbackTimeoutHelper(mCallbacklatch);
         assertTrue(mEnMgr.everRunUiEntitlement);
@@ -295,7 +296,7 @@
                 mCallbacklatch.countDown();
             }
         };
-        mEnMgr.getLatestTetheringEntitlementValue(TETHERING_WIFI, receiver, true);
+        mEnMgr.getLatestTetheringEntitlementResult(TETHERING_WIFI, receiver, true);
         callbackTimeoutHelper(mCallbacklatch);
         assertFalse(mEnMgr.everRunUiEntitlement);
         // 7. Test get value for other downstream type.
@@ -307,7 +308,7 @@
                 mCallbacklatch.countDown();
             }
         };
-        mEnMgr.getLatestTetheringEntitlementValue(TETHERING_USB, receiver, false);
+        mEnMgr.getLatestTetheringEntitlementResult(TETHERING_USB, receiver, false);
         callbackTimeoutHelper(mCallbacklatch);
         assertFalse(mEnMgr.everRunUiEntitlement);
     }
diff --git a/tests/net/java/com/android/server/connectivity/tethering/OffloadControllerTest.java b/tests/net/java/com/android/server/connectivity/tethering/OffloadControllerTest.java
index b98f63b..be54b1a 100644
--- a/tests/net/java/com/android/server/connectivity/tethering/OffloadControllerTest.java
+++ b/tests/net/java/com/android/server/connectivity/tethering/OffloadControllerTest.java
@@ -23,7 +23,9 @@
 import static android.net.NetworkStats.UID_ALL;
 import static android.net.TrafficStats.UID_TETHERING;
 import static android.provider.Settings.Global.TETHER_OFFLOAD_DISABLED;
+
 import static com.android.server.connectivity.tethering.OffloadHardwareInterface.ForwardedStats;
+
 import static org.junit.Assert.assertEquals;
 import static org.junit.Assert.assertTrue;
 import static org.junit.Assert.fail;
@@ -35,7 +37,6 @@
 import static org.mockito.Mockito.clearInvocations;
 import static org.mockito.Mockito.inOrder;
 import static org.mockito.Mockito.never;
-import static org.mockito.Mockito.reset;
 import static org.mockito.Mockito.times;
 import static org.mockito.Mockito.verify;
 import static org.mockito.Mockito.verifyNoMoreInteractions;
@@ -52,30 +53,30 @@
 import android.net.util.SharedLog;
 import android.os.ConditionVariable;
 import android.os.Handler;
-import android.os.Looper;
 import android.os.INetworkManagementService;
+import android.os.Looper;
 import android.provider.Settings;
 import android.provider.Settings.SettingNotFoundException;
-
-import android.support.test.filters.SmallTest;
-import android.support.test.runner.AndroidJUnit4;
 import android.test.mock.MockContentResolver;
-import com.android.internal.util.test.FakeSettingsProvider;
 
-import java.net.InetAddress;
-import java.util.ArrayList;
-import java.util.HashSet;
-import java.util.Set;
+import androidx.test.filters.SmallTest;
+import androidx.test.runner.AndroidJUnit4;
+
+import com.android.internal.util.test.FakeSettingsProvider;
 
 import org.junit.After;
 import org.junit.Before;
-import org.junit.runner.RunWith;
 import org.junit.Test;
+import org.junit.runner.RunWith;
 import org.mockito.ArgumentCaptor;
 import org.mockito.InOrder;
 import org.mockito.Mock;
 import org.mockito.MockitoAnnotations;
 
+import java.net.InetAddress;
+import java.util.ArrayList;
+import java.util.HashSet;
+import java.util.Set;
 
 @RunWith(AndroidJUnit4.class)
 @SmallTest
diff --git a/tests/net/java/com/android/server/connectivity/tethering/TetheringConfigurationTest.java b/tests/net/java/com/android/server/connectivity/tethering/TetheringConfigurationTest.java
index 01b904d8..36a1b7c 100644
--- a/tests/net/java/com/android/server/connectivity/tethering/TetheringConfigurationTest.java
+++ b/tests/net/java/com/android/server/connectivity/tethering/TetheringConfigurationTest.java
@@ -24,9 +24,7 @@
 import static android.provider.Settings.Global.TETHER_ENABLE_LEGACY_DHCP_SERVER;
 import static android.telephony.SubscriptionManager.INVALID_SUBSCRIPTION_ID;
 
-import static com.android.server.connectivity.tethering.TetheringConfiguration.DUN_NOT_REQUIRED;
-import static com.android.server.connectivity.tethering.TetheringConfiguration.DUN_REQUIRED;
-import static com.android.server.connectivity.tethering.TetheringConfiguration.DUN_UNSPECIFIED;
+import static com.android.internal.R.array.config_tether_upstream_types;
 
 import static org.junit.Assert.assertEquals;
 import static org.junit.Assert.assertFalse;
@@ -38,11 +36,12 @@
 import android.content.res.Resources;
 import android.net.util.SharedLog;
 import android.provider.Settings;
-import android.support.test.filters.SmallTest;
-import android.support.test.runner.AndroidJUnit4;
 import android.telephony.TelephonyManager;
 import android.test.mock.MockContentResolver;
 
+import androidx.test.filters.SmallTest;
+import androidx.test.runner.AndroidJUnit4;
+
 import com.android.internal.util.test.BroadcastInterceptingContext;
 import com.android.internal.util.test.FakeSettingsProvider;
 
@@ -52,6 +51,7 @@
 import org.mockito.Mock;
 import org.mockito.MockitoAnnotations;
 
+import java.util.Arrays;
 import java.util.Iterator;
 
 @RunWith(AndroidJUnit4.class)
@@ -112,74 +112,103 @@
                 .thenReturn(new String[]{ "test_wlan\\d" });
         when(mResources.getStringArray(com.android.internal.R.array.config_tether_bluetooth_regexs))
                 .thenReturn(new String[0]);
-        when(mResources.getIntArray(com.android.internal.R.array.config_tether_upstream_types))
-                .thenReturn(new int[0]);
+        when(mResources.getIntArray(config_tether_upstream_types)).thenReturn(new int[0]);
         when(mResources.getStringArray(
                 com.android.internal.R.array.config_mobile_hotspot_provision_app))
                 .thenReturn(new String[0]);
         mContentResolver = new MockContentResolver();
         mContentResolver.addProvider(Settings.AUTHORITY, new FakeSettingsProvider());
+        mHasTelephonyManager = true;
         mMockContext = new MockContext(mContext);
     }
 
+    private TetheringConfiguration getTetheringConfiguration(int[] legacyTetherUpstreamTypes) {
+        when(mResources.getIntArray(config_tether_upstream_types)).thenReturn(
+                legacyTetherUpstreamTypes);
+        return new TetheringConfiguration(mMockContext, mLog, INVALID_SUBSCRIPTION_ID);
+    }
+
+    @Test
+    public void testNoTelephonyManagerMeansNoDun() {
+        mHasTelephonyManager = false;
+        final TetheringConfiguration cfg = getTetheringConfiguration(
+                new int[]{TYPE_MOBILE_DUN, TYPE_WIFI});
+        assertFalse(cfg.isDunRequired);
+        assertFalse(cfg.preferredUpstreamIfaceTypes.contains(TYPE_MOBILE_DUN));
+        // Just to prove we haven't clobbered Wi-Fi:
+        assertTrue(cfg.preferredUpstreamIfaceTypes.contains(TYPE_WIFI));
+    }
+
     @Test
     public void testDunFromTelephonyManagerMeansDun() {
-        when(mResources.getIntArray(com.android.internal.R.array.config_tether_upstream_types))
-                .thenReturn(new int[]{TYPE_MOBILE, TYPE_WIFI, TYPE_MOBILE_HIPRI});
-        mHasTelephonyManager = true;
-        when(mTelephonyManager.getTetherApnRequired()).thenReturn(DUN_REQUIRED);
+        when(mTelephonyManager.getTetherApnRequired()).thenReturn(true);
 
-        final TetheringConfiguration cfg = new TetheringConfiguration(
-                mMockContext, mLog, INVALID_SUBSCRIPTION_ID);
-        assertTrue(cfg.isDunRequired);
-        assertTrue(cfg.preferredUpstreamIfaceTypes.contains(TYPE_MOBILE_DUN));
-        assertFalse(cfg.preferredUpstreamIfaceTypes.contains(TYPE_MOBILE));
-        assertFalse(cfg.preferredUpstreamIfaceTypes.contains(TYPE_MOBILE_HIPRI));
-        // Just to prove we haven't clobbered Wi-Fi:
-        assertTrue(cfg.preferredUpstreamIfaceTypes.contains(TYPE_WIFI));
+        final TetheringConfiguration cfgWifi = getTetheringConfiguration(new int[]{TYPE_WIFI});
+        final TetheringConfiguration cfgMobileWifiHipri = getTetheringConfiguration(
+                new int[]{TYPE_MOBILE, TYPE_WIFI, TYPE_MOBILE_HIPRI});
+        final TetheringConfiguration cfgWifiDun = getTetheringConfiguration(
+                new int[]{TYPE_WIFI, TYPE_MOBILE_DUN});
+        final TetheringConfiguration cfgMobileWifiHipriDun = getTetheringConfiguration(
+                new int[]{TYPE_MOBILE, TYPE_WIFI, TYPE_MOBILE_HIPRI, TYPE_MOBILE_DUN});
+
+        for (TetheringConfiguration cfg : Arrays.asList(cfgWifi, cfgMobileWifiHipri,
+                cfgWifiDun, cfgMobileWifiHipriDun)) {
+            String msg = "config=" + cfg.toString();
+            assertTrue(msg, cfg.isDunRequired);
+            assertTrue(msg, cfg.preferredUpstreamIfaceTypes.contains(TYPE_MOBILE_DUN));
+            assertFalse(msg, cfg.preferredUpstreamIfaceTypes.contains(TYPE_MOBILE));
+            assertFalse(msg, cfg.preferredUpstreamIfaceTypes.contains(TYPE_MOBILE_HIPRI));
+            // Just to prove we haven't clobbered Wi-Fi:
+            assertTrue(msg, cfg.preferredUpstreamIfaceTypes.contains(TYPE_WIFI));
+        }
     }
 
     @Test
     public void testDunNotRequiredFromTelephonyManagerMeansNoDun() {
-        when(mResources.getIntArray(com.android.internal.R.array.config_tether_upstream_types))
-                .thenReturn(new int[]{TYPE_MOBILE_DUN, TYPE_WIFI});
-        mHasTelephonyManager = true;
-        when(mTelephonyManager.getTetherApnRequired()).thenReturn(DUN_NOT_REQUIRED);
+        when(mTelephonyManager.getTetherApnRequired()).thenReturn(false);
 
-        final TetheringConfiguration cfg = new TetheringConfiguration(
-                mMockContext, mLog, INVALID_SUBSCRIPTION_ID);
-        assertFalse(cfg.isDunRequired);
-        assertFalse(cfg.preferredUpstreamIfaceTypes.contains(TYPE_MOBILE_DUN));
-        assertTrue(cfg.preferredUpstreamIfaceTypes.contains(TYPE_MOBILE));
-        assertTrue(cfg.preferredUpstreamIfaceTypes.contains(TYPE_MOBILE_HIPRI));
-        // Just to prove we haven't clobbered Wi-Fi:
-        assertTrue(cfg.preferredUpstreamIfaceTypes.contains(TYPE_WIFI));
-    }
+        final TetheringConfiguration cfgWifi = getTetheringConfiguration(new int[]{TYPE_WIFI});
+        final TetheringConfiguration cfgMobileWifiHipri = getTetheringConfiguration(
+                new int[]{TYPE_MOBILE, TYPE_WIFI, TYPE_MOBILE_HIPRI});
+        final TetheringConfiguration cfgWifiDun = getTetheringConfiguration(
+                new int[]{TYPE_WIFI, TYPE_MOBILE_DUN});
+        final TetheringConfiguration cfgWifiMobile = getTetheringConfiguration(
+                new int[]{TYPE_WIFI, TYPE_MOBILE});
+        final TetheringConfiguration cfgWifiHipri = getTetheringConfiguration(
+                new int[]{TYPE_WIFI, TYPE_MOBILE_HIPRI});
+        final TetheringConfiguration cfgMobileWifiHipriDun = getTetheringConfiguration(
+                new int[]{TYPE_MOBILE, TYPE_WIFI, TYPE_MOBILE_HIPRI, TYPE_MOBILE_DUN});
 
-    @Test
-    public void testDunFromUpstreamConfigMeansDun() {
-        when(mResources.getIntArray(com.android.internal.R.array.config_tether_upstream_types))
-                .thenReturn(new int[]{TYPE_MOBILE_DUN, TYPE_WIFI});
-        mHasTelephonyManager = false;
-        when(mTelephonyManager.getTetherApnRequired()).thenReturn(DUN_UNSPECIFIED);
+        String msg;
+        // TYPE_MOBILE_DUN should not be present in all of the combinations.
+        // TYPE_WIFI should not be affected.
+        for (TetheringConfiguration cfg : Arrays.asList(cfgWifi, cfgMobileWifiHipri, cfgWifiDun,
+                cfgWifiMobile, cfgWifiHipri, cfgMobileWifiHipriDun)) {
+            msg = "config=" + cfg.toString();
+            assertFalse(msg, cfg.isDunRequired);
+            assertFalse(msg, cfg.preferredUpstreamIfaceTypes.contains(TYPE_MOBILE_DUN));
+            assertTrue(msg, cfg.preferredUpstreamIfaceTypes.contains(TYPE_WIFI));
+        }
 
-        final TetheringConfiguration cfg = new TetheringConfiguration(
-                mMockContext, mLog, INVALID_SUBSCRIPTION_ID);
-        assertTrue(cfg.isDunRequired);
-        assertTrue(cfg.preferredUpstreamIfaceTypes.contains(TYPE_MOBILE_DUN));
-        // Just to prove we haven't clobbered Wi-Fi:
-        assertTrue(cfg.preferredUpstreamIfaceTypes.contains(TYPE_WIFI));
-        // Check that we have not added new cellular interface types
-        assertFalse(cfg.preferredUpstreamIfaceTypes.contains(TYPE_MOBILE));
-        assertFalse(cfg.preferredUpstreamIfaceTypes.contains(TYPE_MOBILE_HIPRI));
+        for (TetheringConfiguration cfg : Arrays.asList(cfgWifi, cfgMobileWifiHipri, cfgWifiDun,
+                cfgMobileWifiHipriDun)) {
+            msg = "config=" + cfg.toString();
+            assertTrue(msg, cfg.preferredUpstreamIfaceTypes.contains(TYPE_MOBILE));
+            assertTrue(msg, cfg.preferredUpstreamIfaceTypes.contains(TYPE_MOBILE_HIPRI));
+        }
+        msg = "config=" + cfgWifiMobile.toString();
+        assertTrue(msg, cfgWifiMobile.preferredUpstreamIfaceTypes.contains(TYPE_MOBILE));
+        assertFalse(msg, cfgWifiMobile.preferredUpstreamIfaceTypes.contains(TYPE_MOBILE_HIPRI));
+        msg = "config=" + cfgWifiHipri.toString();
+        assertFalse(msg, cfgWifiHipri.preferredUpstreamIfaceTypes.contains(TYPE_MOBILE));
+        assertTrue(msg, cfgWifiHipri.preferredUpstreamIfaceTypes.contains(TYPE_MOBILE_HIPRI));
+
     }
 
     @Test
     public void testNoDefinedUpstreamTypesAddsEthernet() {
-        when(mResources.getIntArray(com.android.internal.R.array.config_tether_upstream_types))
-                .thenReturn(new int[]{});
-        mHasTelephonyManager = false;
-        when(mTelephonyManager.getTetherApnRequired()).thenReturn(DUN_UNSPECIFIED);
+        when(mResources.getIntArray(config_tether_upstream_types)).thenReturn(new int[]{});
+        when(mTelephonyManager.getTetherApnRequired()).thenReturn(false);
 
         final TetheringConfiguration cfg = new TetheringConfiguration(
                 mMockContext, mLog, INVALID_SUBSCRIPTION_ID);
@@ -187,8 +216,10 @@
         assertTrue(upstreamIterator.hasNext());
         assertEquals(TYPE_ETHERNET, upstreamIterator.next().intValue());
         // The following is because the code always adds some kind of mobile
-        // upstream, be it DUN or, in this case where we use DUN_UNSPECIFIED,
-        // both vanilla and hipri mobile types.
+        // upstream, be it DUN or, in this case where DUN is NOT required,
+        // make sure there is at least one of MOBILE or HIPRI. With the empty
+        // list of the configuration in this test, it will always add both
+        // MOBILE and HIPRI, in that order.
         assertTrue(upstreamIterator.hasNext());
         assertEquals(TYPE_MOBILE, upstreamIterator.next().intValue());
         assertTrue(upstreamIterator.hasNext());
@@ -198,10 +229,9 @@
 
     @Test
     public void testDefinedUpstreamTypesSansEthernetAddsEthernet() {
-        when(mResources.getIntArray(com.android.internal.R.array.config_tether_upstream_types))
-                .thenReturn(new int[]{TYPE_WIFI, TYPE_MOBILE_HIPRI});
-        mHasTelephonyManager = false;
-        when(mTelephonyManager.getTetherApnRequired()).thenReturn(DUN_UNSPECIFIED);
+        when(mResources.getIntArray(config_tether_upstream_types)).thenReturn(
+                new int[]{TYPE_WIFI, TYPE_MOBILE_HIPRI});
+        when(mTelephonyManager.getTetherApnRequired()).thenReturn(false);
 
         final TetheringConfiguration cfg = new TetheringConfiguration(
                 mMockContext, mLog, INVALID_SUBSCRIPTION_ID);
@@ -217,10 +247,9 @@
 
     @Test
     public void testDefinedUpstreamTypesWithEthernetDoesNotAddEthernet() {
-        when(mResources.getIntArray(com.android.internal.R.array.config_tether_upstream_types))
+        when(mResources.getIntArray(config_tether_upstream_types))
                 .thenReturn(new int[]{TYPE_WIFI, TYPE_ETHERNET, TYPE_MOBILE_HIPRI});
-        mHasTelephonyManager = false;
-        when(mTelephonyManager.getTetherApnRequired()).thenReturn(DUN_UNSPECIFIED);
+        when(mTelephonyManager.getTetherApnRequired()).thenReturn(false);
 
         final TetheringConfiguration cfg = new TetheringConfiguration(
                 mMockContext, mLog, INVALID_SUBSCRIPTION_ID);
@@ -276,9 +305,7 @@
         when(mResourcesForSubId.getStringArray(
                 com.android.internal.R.array.config_tether_bluetooth_regexs))
                 .thenReturn(new String[0]);
-        when(mResourcesForSubId.getIntArray(
-                com.android.internal.R.array.config_tether_upstream_types))
-                .thenReturn(new int[0]);
+        when(mResourcesForSubId.getIntArray(config_tether_upstream_types)).thenReturn(new int[0]);
         when(mResourcesForSubId.getStringArray(
                 com.android.internal.R.array.config_mobile_hotspot_provision_app))
                 .thenReturn(PROVISIONING_APP_NAME);
diff --git a/tests/net/java/com/android/server/connectivity/tethering/UpstreamNetworkMonitorTest.java b/tests/net/java/com/android/server/connectivity/tethering/UpstreamNetworkMonitorTest.java
index 0afd607..5a1f853 100644
--- a/tests/net/java/com/android/server/connectivity/tethering/UpstreamNetworkMonitorTest.java
+++ b/tests/net/java/com/android/server/connectivity/tethering/UpstreamNetworkMonitorTest.java
@@ -41,8 +41,6 @@
 import static org.mockito.Mockito.when;
 
 import android.content.Context;
-import android.os.Handler;
-import android.os.Message;
 import android.net.ConnectivityManager;
 import android.net.ConnectivityManager.NetworkCallback;
 import android.net.IConnectivityManager;
@@ -54,16 +52,19 @@
 import android.net.NetworkRequest;
 import android.net.NetworkState;
 import android.net.util.SharedLog;
-import android.support.test.filters.SmallTest;
-import android.support.test.runner.AndroidJUnit4;
+import android.os.Handler;
+import android.os.Message;
+
+import androidx.test.filters.SmallTest;
+import androidx.test.runner.AndroidJUnit4;
 
 import com.android.internal.util.State;
 import com.android.internal.util.StateMachine;
 
 import org.junit.After;
 import org.junit.Before;
-import org.junit.runner.RunWith;
 import org.junit.Test;
+import org.junit.runner.RunWith;
 import org.mockito.Mock;
 import org.mockito.MockitoAnnotations;
 
@@ -76,7 +77,6 @@
 import java.util.Objects;
 import java.util.Set;
 
-
 @RunWith(AndroidJUnit4.class)
 @SmallTest
 public class UpstreamNetworkMonitorTest {
diff --git a/tests/net/java/com/android/server/net/NetworkStatsAccessTest.java b/tests/net/java/com/android/server/net/NetworkStatsAccessTest.java
index b870bbd..6e725dd 100644
--- a/tests/net/java/com/android/server/net/NetworkStatsAccessTest.java
+++ b/tests/net/java/com/android/server/net/NetworkStatsAccessTest.java
@@ -26,10 +26,11 @@
 import android.app.admin.DevicePolicyManagerInternal;
 import android.content.Context;
 import android.content.pm.PackageManager;
-import android.support.test.filters.SmallTest;
-import android.support.test.runner.AndroidJUnit4;
 import android.telephony.TelephonyManager;
 
+import androidx.test.filters.SmallTest;
+import androidx.test.runner.AndroidJUnit4;
+
 import com.android.server.LocalServices;
 
 import org.junit.After;
diff --git a/tests/net/java/com/android/server/net/NetworkStatsCollectionTest.java b/tests/net/java/com/android/server/net/NetworkStatsCollectionTest.java
index 6f14332..830c928 100644
--- a/tests/net/java/com/android/server/net/NetworkStatsCollectionTest.java
+++ b/tests/net/java/com/android/server/net/NetworkStatsCollectionTest.java
@@ -26,12 +26,13 @@
 import static android.os.Process.myUid;
 import static android.text.format.DateUtils.HOUR_IN_MILLIS;
 import static android.text.format.DateUtils.MINUTE_IN_MILLIS;
+
+import static com.android.server.net.NetworkStatsCollection.multiplySafe;
+
 import static org.junit.Assert.assertEquals;
 import static org.junit.Assert.assertNotNull;
 import static org.junit.Assert.fail;
 
-import static com.android.server.net.NetworkStatsCollection.multiplySafe;
-
 import android.content.res.Resources;
 import android.net.ConnectivityManager;
 import android.net.NetworkIdentity;
@@ -40,20 +41,26 @@
 import android.net.NetworkTemplate;
 import android.os.Process;
 import android.os.UserHandle;
-import android.support.test.InstrumentationRegistry;
-import android.support.test.filters.SmallTest;
-import android.support.test.runner.AndroidJUnit4;
 import android.telephony.SubscriptionPlan;
 import android.telephony.TelephonyManager;
 import android.test.MoreAsserts;
 import android.text.format.DateUtils;
 import android.util.RecurrenceRule;
 
+import androidx.test.InstrumentationRegistry;
+import androidx.test.filters.SmallTest;
+import androidx.test.runner.AndroidJUnit4;
+
 import com.android.frameworks.tests.net.R;
 
 import libcore.io.IoUtils;
 import libcore.io.Streams;
 
+import org.junit.After;
+import org.junit.Before;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+
 import java.io.ByteArrayInputStream;
 import java.io.ByteArrayOutputStream;
 import java.io.DataOutputStream;
@@ -68,11 +75,6 @@
 import java.util.ArrayList;
 import java.util.List;
 
-import org.junit.After;
-import org.junit.Before;
-import org.junit.Test;
-import org.junit.runner.RunWith;
-
 /**
  * Tests for {@link NetworkStatsCollection}.
  */
diff --git a/tests/net/java/com/android/server/net/NetworkStatsObserversTest.java b/tests/net/java/com/android/server/net/NetworkStatsObserversTest.java
index 185c3eb..43a3803 100644
--- a/tests/net/java/com/android/server/net/NetworkStatsObserversTest.java
+++ b/tests/net/java/com/android/server/net/NetworkStatsObserversTest.java
@@ -17,7 +17,6 @@
 package com.android.server.net;
 
 import static android.net.ConnectivityManager.TYPE_MOBILE;
-import static android.net.ConnectivityManager.TYPE_WIFI;
 import static android.net.NetworkStats.DEFAULT_NETWORK_NO;
 import static android.net.NetworkStats.DEFAULT_NETWORK_YES;
 import static android.net.NetworkStats.METERED_NO;
@@ -33,11 +32,8 @@
 
 import static org.junit.Assert.assertEquals;
 import static org.junit.Assert.assertTrue;
-import static org.junit.Assert.fail;
 import static org.mockito.Matchers.any;
 import static org.mockito.Matchers.anyInt;
-import static org.mockito.Matchers.isA;
-import static org.mockito.Mockito.when;
 
 import android.app.usage.NetworkStatsManager;
 import android.net.DataUsageRequest;
@@ -49,22 +45,17 @@
 import android.os.HandlerThread;
 import android.os.IBinder;
 import android.os.Looper;
-import android.os.Message;
 import android.os.Messenger;
 import android.os.Process;
 import android.os.UserHandle;
-import android.support.test.filters.SmallTest;
-import android.support.test.runner.AndroidJUnit4;
 import android.telephony.TelephonyManager;
 import android.util.ArrayMap;
 
-import com.android.internal.net.VpnInfo;
-import com.android.server.net.NetworkStatsService;
-import com.android.server.net.NetworkStatsServiceTest.LatchedHandler;
+import androidx.test.filters.SmallTest;
+import androidx.test.runner.AndroidJUnit4;
 
-import java.util.ArrayList;
-import java.util.Objects;
-import java.util.List;
+import com.android.internal.net.VpnInfo;
+import com.android.server.net.NetworkStatsServiceTest.LatchedHandler;
 
 import org.junit.Before;
 import org.junit.Test;
@@ -73,6 +64,8 @@
 import org.mockito.Mockito;
 import org.mockito.MockitoAnnotations;
 
+import java.util.Objects;
+
 /**
  * Tests for {@link NetworkStatsObservers}.
  */
diff --git a/tests/net/java/com/android/server/net/NetworkStatsServiceTest.java b/tests/net/java/com/android/server/net/NetworkStatsServiceTest.java
index f89f303..598448b 100644
--- a/tests/net/java/com/android/server/net/NetworkStatsServiceTest.java
+++ b/tests/net/java/com/android/server/net/NetworkStatsServiceTest.java
@@ -70,7 +70,6 @@
 import android.content.Context;
 import android.content.Intent;
 import android.net.DataUsageRequest;
-import android.net.IConnectivityManager;
 import android.net.INetworkManagementEventObserver;
 import android.net.INetworkStatsSession;
 import android.net.LinkProperties;
@@ -92,15 +91,15 @@
 import android.os.Messenger;
 import android.os.PowerManager;
 import android.os.SimpleClock;
-import android.support.test.InstrumentationRegistry;
-import android.support.test.filters.SmallTest;
-import android.support.test.runner.AndroidJUnit4;
 import android.telephony.TelephonyManager;
 
+import androidx.test.InstrumentationRegistry;
+import androidx.test.filters.SmallTest;
+import androidx.test.runner.AndroidJUnit4;
+
 import com.android.internal.net.VpnInfo;
 import com.android.internal.util.ArrayUtils;
 import com.android.internal.util.test.BroadcastInterceptingContext;
-import com.android.server.LocalServices;
 import com.android.server.net.NetworkStatsService.NetworkStatsSettings;
 import com.android.server.net.NetworkStatsService.NetworkStatsSettings.Config;
 
@@ -163,7 +162,6 @@
 
     private @Mock INetworkManagementService mNetManager;
     private @Mock NetworkStatsSettings mSettings;
-    private @Mock IConnectivityManager mConnManager;
     private @Mock IBinder mBinder;
     private @Mock AlarmManager mAlarmManager;
     private HandlerThread mHandlerThread;
@@ -205,7 +203,6 @@
         Handler.Callback callback = new NetworkStatsService.HandlerCallback(mService);
         mHandler = new Handler(mHandlerThread.getLooper(), callback);
         mService.setHandler(mHandler, callback);
-        mService.bindConnectivityManager(mConnManager);
 
         mElapsedRealtime = 0L;
 
@@ -234,7 +231,6 @@
 
         mNetManager = null;
         mSettings = null;
-        mConnManager = null;
 
         mSession.close();
         mService = null;
@@ -245,12 +241,12 @@
         // pretend that wifi network comes online; service should ask about full
         // network state, and poll any existing interfaces before updating.
         expectDefaultSettings();
-        expectNetworkState(buildWifiState());
+        NetworkState[] states = new NetworkState[] {buildWifiState()};
         expectNetworkStatsSummary(buildEmptyStats());
         expectNetworkStatsUidDetail(buildEmptyStats());
         expectBandwidthControlCheck();
 
-        mService.forceUpdateIfaces(NETWORKS_WIFI);
+        mService.forceUpdateIfaces(NETWORKS_WIFI, new VpnInfo[0], states, getActiveIface(states));
 
         // verify service has empty history for wifi
         assertNetworkTotal(sTemplateWifi, 0L, 0L, 0L, 0L, 0);
@@ -289,12 +285,12 @@
         // pretend that wifi network comes online; service should ask about full
         // network state, and poll any existing interfaces before updating.
         expectDefaultSettings();
-        expectNetworkState(buildWifiState());
+        NetworkState[] states = new NetworkState[] {buildWifiState()};
         expectNetworkStatsSummary(buildEmptyStats());
         expectNetworkStatsUidDetail(buildEmptyStats());
         expectBandwidthControlCheck();
 
-        mService.forceUpdateIfaces(NETWORKS_WIFI);
+        mService.forceUpdateIfaces(NETWORKS_WIFI, new VpnInfo[0], states, getActiveIface(states));
 
         // verify service has empty history for wifi
         assertNetworkTotal(sTemplateWifi, 0L, 0L, 0L, 0L, 0);
@@ -363,12 +359,12 @@
         // pretend that wifi network comes online; service should ask about full
         // network state, and poll any existing interfaces before updating.
         expectSettings(0L, HOUR_IN_MILLIS, WEEK_IN_MILLIS);
-        expectNetworkState(buildWifiState());
+        NetworkState[] states = new NetworkState[] {buildWifiState()};
         expectNetworkStatsSummary(buildEmptyStats());
         expectNetworkStatsUidDetail(buildEmptyStats());
         expectBandwidthControlCheck();
 
-        mService.forceUpdateIfaces(NETWORKS_WIFI);
+        mService.forceUpdateIfaces(NETWORKS_WIFI, new VpnInfo[0], states, getActiveIface(states));
 
 
         // modify some number on wifi, and trigger poll event
@@ -405,12 +401,12 @@
     public void testUidStatsAcrossNetworks() throws Exception {
         // pretend first mobile network comes online
         expectDefaultSettings();
-        expectNetworkState(buildMobile3gState(IMSI_1));
+        NetworkState[] states = new NetworkState[] {buildMobile3gState(IMSI_1)};
         expectNetworkStatsSummary(buildEmptyStats());
         expectNetworkStatsUidDetail(buildEmptyStats());
         expectBandwidthControlCheck();
 
-        mService.forceUpdateIfaces(NETWORKS_MOBILE);
+        mService.forceUpdateIfaces(NETWORKS_MOBILE, new VpnInfo[0], states, getActiveIface(states));
 
 
         // create some traffic on first network
@@ -437,7 +433,7 @@
         // disappearing, to verify we don't count backwards.
         incrementCurrentTime(HOUR_IN_MILLIS);
         expectDefaultSettings();
-        expectNetworkState(buildMobile3gState(IMSI_2));
+        states = new NetworkState[] {buildMobile3gState(IMSI_2)};
         expectNetworkStatsSummary(new NetworkStats(getElapsedRealtime(), 1)
                 .addIfaceValues(TEST_IFACE, 2048L, 16L, 512L, 4L));
         expectNetworkStatsUidDetail(new NetworkStats(getElapsedRealtime(), 3)
@@ -446,7 +442,7 @@
                 .addValues(TEST_IFACE, UID_BLUE, SET_DEFAULT, TAG_NONE, 512L, 4L, 0L, 0L, 0L));
         expectBandwidthControlCheck();
 
-        mService.forceUpdateIfaces(NETWORKS_MOBILE);
+        mService.forceUpdateIfaces(NETWORKS_MOBILE, new VpnInfo[0], states, getActiveIface(states));
         forcePollAndWaitForIdle();
 
 
@@ -481,12 +477,12 @@
     public void testUidRemovedIsMoved() throws Exception {
         // pretend that network comes online
         expectDefaultSettings();
-        expectNetworkState(buildWifiState());
+        NetworkState[] states = new NetworkState[] {buildWifiState()};
         expectNetworkStatsSummary(buildEmptyStats());
         expectNetworkStatsUidDetail(buildEmptyStats());
         expectBandwidthControlCheck();
 
-        mService.forceUpdateIfaces(NETWORKS_WIFI);
+        mService.forceUpdateIfaces(NETWORKS_WIFI, new VpnInfo[0], states, getActiveIface(states));
 
 
         // create some traffic
@@ -540,12 +536,12 @@
     public void testUid3g4gCombinedByTemplate() throws Exception {
         // pretend that network comes online
         expectDefaultSettings();
-        expectNetworkState(buildMobile3gState(IMSI_1));
+        NetworkState[] states = new NetworkState[] {buildMobile3gState(IMSI_1)};
         expectNetworkStatsSummary(buildEmptyStats());
         expectNetworkStatsUidDetail(buildEmptyStats());
         expectBandwidthControlCheck();
 
-        mService.forceUpdateIfaces(NETWORKS_MOBILE);
+        mService.forceUpdateIfaces(NETWORKS_MOBILE, new VpnInfo[0], states, getActiveIface(states));
 
 
         // create some traffic
@@ -566,14 +562,14 @@
         // now switch over to 4g network
         incrementCurrentTime(HOUR_IN_MILLIS);
         expectDefaultSettings();
-        expectNetworkState(buildMobile4gState(TEST_IFACE2));
+        states = new NetworkState[] {buildMobile4gState(TEST_IFACE2)};
         expectNetworkStatsSummary(buildEmptyStats());
         expectNetworkStatsUidDetail(new NetworkStats(getElapsedRealtime(), 1)
                 .addValues(TEST_IFACE, UID_RED, SET_DEFAULT, TAG_NONE, 1024L, 8L, 1024L, 8L, 0L)
                 .addValues(TEST_IFACE, UID_RED, SET_DEFAULT, 0xF00D, 512L, 4L, 512L, 4L, 0L));
         expectBandwidthControlCheck();
 
-        mService.forceUpdateIfaces(NETWORKS_MOBILE);
+        mService.forceUpdateIfaces(NETWORKS_MOBILE, new VpnInfo[0], states, getActiveIface(states));
         forcePollAndWaitForIdle();
 
 
@@ -598,12 +594,12 @@
     public void testSummaryForAllUid() throws Exception {
         // pretend that network comes online
         expectDefaultSettings();
-        expectNetworkState(buildWifiState());
+        NetworkState[] states = new NetworkState[] {buildWifiState()};
         expectNetworkStatsSummary(buildEmptyStats());
         expectNetworkStatsUidDetail(buildEmptyStats());
         expectBandwidthControlCheck();
 
-        mService.forceUpdateIfaces(NETWORKS_WIFI);
+        mService.forceUpdateIfaces(NETWORKS_WIFI, new VpnInfo[0], states, getActiveIface(states));
 
 
         // create some traffic for two apps
@@ -657,12 +653,12 @@
     public void testDetailedUidStats() throws Exception {
         // pretend that network comes online
         expectDefaultSettings();
-        expectNetworkState(buildWifiState());
+        NetworkState[] states = new NetworkState[] {buildWifiState()};
         expectNetworkStatsSummary(buildEmptyStats());
         expectNetworkStatsUidDetail(buildEmptyStats());
         expectBandwidthControlCheck();
 
-        mService.forceUpdateIfaces(NETWORKS_WIFI);
+        mService.forceUpdateIfaces(NETWORKS_WIFI, new VpnInfo[0], states, getActiveIface(states));
 
         NetworkStats.Entry entry1 = new NetworkStats.Entry(
                 TEST_IFACE, UID_RED, SET_DEFAULT, TAG_NONE, 50L, 5L, 50L, 5L, 0L);
@@ -700,13 +696,13 @@
         stackedProp.setInterfaceName(stackedIface);
         final NetworkState wifiState = buildWifiState();
         wifiState.linkProperties.addStackedLink(stackedProp);
-        expectNetworkState(wifiState);
+        NetworkState[] states = new NetworkState[] {wifiState};
 
         expectNetworkStatsSummary(buildEmptyStats());
         expectNetworkStatsUidDetail(buildEmptyStats());
         expectBandwidthControlCheck();
 
-        mService.forceUpdateIfaces(NETWORKS_WIFI);
+        mService.forceUpdateIfaces(NETWORKS_WIFI, new VpnInfo[0], states, getActiveIface(states));
 
         NetworkStats.Entry uidStats = new NetworkStats.Entry(
                 TEST_IFACE, UID_BLUE, SET_DEFAULT, 0xF00D, 1024L, 8L, 512L, 4L, 0L);
@@ -745,12 +741,12 @@
     public void testForegroundBackground() throws Exception {
         // pretend that network comes online
         expectDefaultSettings();
-        expectNetworkState(buildWifiState());
+        NetworkState[] states = new NetworkState[] {buildWifiState()};
         expectNetworkStatsSummary(buildEmptyStats());
         expectNetworkStatsUidDetail(buildEmptyStats());
         expectBandwidthControlCheck();
 
-        mService.forceUpdateIfaces(NETWORKS_WIFI);
+        mService.forceUpdateIfaces(NETWORKS_WIFI, new VpnInfo[0], states, getActiveIface(states));
 
 
         // create some initial traffic
@@ -803,12 +799,12 @@
     public void testMetered() throws Exception {
         // pretend that network comes online
         expectDefaultSettings();
-        expectNetworkState(buildWifiState(true /* isMetered */));
+        NetworkState[] states = new NetworkState[] {buildWifiState(true /* isMetered */)};
         expectNetworkStatsSummary(buildEmptyStats());
         expectNetworkStatsUidDetail(buildEmptyStats());
         expectBandwidthControlCheck();
 
-        mService.forceUpdateIfaces(NETWORKS_WIFI);
+        mService.forceUpdateIfaces(NETWORKS_WIFI, new VpnInfo[0], states, getActiveIface(states));
 
 
         // create some initial traffic
@@ -843,12 +839,13 @@
     public void testRoaming() throws Exception {
         // pretend that network comes online
         expectDefaultSettings();
-        expectNetworkState(buildMobile3gState(IMSI_1, true /* isRoaming */));
+        NetworkState[] states =
+            new NetworkState[] {buildMobile3gState(IMSI_1, true /* isRoaming */)};
         expectNetworkStatsSummary(buildEmptyStats());
         expectNetworkStatsUidDetail(buildEmptyStats());
         expectBandwidthControlCheck();
 
-        mService.forceUpdateIfaces(NETWORKS_MOBILE);
+        mService.forceUpdateIfaces(NETWORKS_MOBILE, new VpnInfo[0], states, getActiveIface(states));
 
 
         // Create some traffic
@@ -882,12 +879,12 @@
     public void testTethering() throws Exception {
         // pretend first mobile network comes online
         expectDefaultSettings();
-        expectNetworkState(buildMobile3gState(IMSI_1));
+        NetworkState[] states = new NetworkState[] {buildMobile3gState(IMSI_1)};
         expectNetworkStatsSummary(buildEmptyStats());
         expectNetworkStatsUidDetail(buildEmptyStats());
         expectBandwidthControlCheck();
 
-        mService.forceUpdateIfaces(NETWORKS_MOBILE);
+        mService.forceUpdateIfaces(NETWORKS_MOBILE, new VpnInfo[0], states, getActiveIface(states));
 
 
         // create some tethering traffic
@@ -925,12 +922,12 @@
         // pretend that wifi network comes online; service should ask about full
         // network state, and poll any existing interfaces before updating.
         expectDefaultSettings();
-        expectNetworkState(buildWifiState());
+        NetworkState[] states = new NetworkState[] {buildWifiState()};
         expectNetworkStatsSummary(buildEmptyStats());
         expectNetworkStatsUidDetail(buildEmptyStats());
         expectBandwidthControlCheck();
 
-        mService.forceUpdateIfaces(NETWORKS_WIFI);
+        mService.forceUpdateIfaces(NETWORKS_WIFI, new VpnInfo[0], states, getActiveIface(states));
 
         // verify service has empty history for wifi
         assertNetworkTotal(sTemplateWifi, 0L, 0L, 0L, 0L, 0);
@@ -1077,11 +1074,11 @@
         expectBandwidthControlCheck();
     }
 
-    private void expectNetworkState(NetworkState... state) throws Exception {
-        when(mConnManager.getAllNetworkState()).thenReturn(state);
-
-        final LinkProperties linkProp = state.length > 0 ? state[0].linkProperties : null;
-        when(mConnManager.getActiveLinkProperties()).thenReturn(linkProp);
+    private String getActiveIface(NetworkState... states) throws Exception {
+        if (states == null || states.length == 0 || states[0].linkProperties == null) {
+            return null;
+        }
+        return states[0].linkProperties.getInterfaceName();
     }
 
     private void expectNetworkStatsSummary(NetworkStats summary) throws Exception {
@@ -1090,8 +1087,6 @@
 
     private void expectNetworkStatsSummary(NetworkStats summary, NetworkStats tetherStats)
             throws Exception {
-        when(mConnManager.getAllVpnInfo()).thenReturn(new VpnInfo[0]);
-
         expectNetworkStatsTethering(STATS_PER_IFACE, tetherStats);
         expectNetworkStatsSummaryDev(summary.clone());
         expectNetworkStatsSummaryXt(summary.clone());
diff --git a/tests/net/java/com/android/server/net/ipmemorystore/IpMemoryStoreServiceTest.java b/tests/net/java/com/android/server/net/ipmemorystore/IpMemoryStoreServiceTest.java
index e57433a..be10680 100644
--- a/tests/net/java/com/android/server/net/ipmemorystore/IpMemoryStoreServiceTest.java
+++ b/tests/net/java/com/android/server/net/ipmemorystore/IpMemoryStoreServiceTest.java
@@ -39,9 +39,10 @@
 import android.net.ipmemorystore.StatusParcelable;
 import android.os.IBinder;
 import android.os.RemoteException;
-import android.support.test.InstrumentationRegistry;
-import android.support.test.filters.SmallTest;
-import android.support.test.runner.AndroidJUnit4;
+
+import androidx.test.InstrumentationRegistry;
+import androidx.test.filters.SmallTest;
+import androidx.test.runner.AndroidJUnit4;
 
 import org.junit.After;
 import org.junit.Before;
diff --git a/tests/net/java/com/android/server/net/ipmemorystore/NetworkAttributesTest.java b/tests/net/java/com/android/server/net/ipmemorystore/NetworkAttributesTest.java
index fe19eee..dc20185 100644
--- a/tests/net/java/com/android/server/net/ipmemorystore/NetworkAttributesTest.java
+++ b/tests/net/java/com/android/server/net/ipmemorystore/NetworkAttributesTest.java
@@ -19,8 +19,9 @@
 import static org.junit.Assert.assertEquals;
 
 import android.net.ipmemorystore.NetworkAttributes;
-import android.support.test.filters.SmallTest;
-import android.support.test.runner.AndroidJUnit4;
+
+import androidx.test.filters.SmallTest;
+import androidx.test.runner.AndroidJUnit4;
 
 import org.junit.Test;
 import org.junit.runner.RunWith;
diff --git a/tests/net/java/com/android/server/net/ipmemorystore/RelevanceUtilsTests.java b/tests/net/java/com/android/server/net/ipmemorystore/RelevanceUtilsTests.java
index 8d367e2..7413b91 100644
--- a/tests/net/java/com/android/server/net/ipmemorystore/RelevanceUtilsTests.java
+++ b/tests/net/java/com/android/server/net/ipmemorystore/RelevanceUtilsTests.java
@@ -22,8 +22,8 @@
 import static org.junit.Assert.assertTrue;
 import static org.junit.Assert.fail;
 
-import android.support.test.filters.SmallTest;
-import android.support.test.runner.AndroidJUnit4;
+import androidx.test.filters.SmallTest;
+import androidx.test.runner.AndroidJUnit4;
 
 import org.junit.Test;
 import org.junit.runner.RunWith;
diff --git a/tests/notification/Android.bp b/tests/notification/Android.bp
new file mode 100644
index 0000000..f05edaf
--- /dev/null
+++ b/tests/notification/Android.bp
@@ -0,0 +1,7 @@
+android_test {
+    name: "NotificationTests",
+    // Include all test java files.
+    srcs: ["src/**/*.java"],
+    libs: ["android.test.runner.stubs"],
+    sdk_version: "21",
+}
diff --git a/tests/notification/Android.mk b/tests/notification/Android.mk
deleted file mode 100644
index 255e6e7..0000000
--- a/tests/notification/Android.mk
+++ /dev/null
@@ -1,16 +0,0 @@
-LOCAL_PATH:= $(call my-dir)
-include $(CLEAR_VARS)
-
-# We only want this apk build for tests.
-LOCAL_MODULE_TAGS := tests
-
-# Include all test java files.
-LOCAL_SRC_FILES := $(call all-java-files-under, src)
-
-LOCAL_JAVA_LIBRARIES := android.test.runner.stubs
-LOCAL_PACKAGE_NAME := NotificationTests
-
-LOCAL_SDK_VERSION := 21
-
-include $(BUILD_PACKAGE)
-
diff --git a/tests/permission/Android.bp b/tests/permission/Android.bp
new file mode 100644
index 0000000..bd07009
--- /dev/null
+++ b/tests/permission/Android.bp
@@ -0,0 +1,12 @@
+android_test {
+    name: "FrameworkPermissionTests",
+    // Include all test java files.
+    srcs: ["src/**/*.java"],
+    libs: [
+        "android.test.runner",
+        "telephony-common",
+        "android.test.base",
+    ],
+    static_libs: ["junit"],
+    platform_apis: true,
+}
diff --git a/tests/permission/Android.mk b/tests/permission/Android.mk
deleted file mode 100644
index dd2f3ec..0000000
--- a/tests/permission/Android.mk
+++ /dev/null
@@ -1,16 +0,0 @@
-LOCAL_PATH:= $(call my-dir)
-include $(CLEAR_VARS)
-
-# We only want this apk build for tests.
-LOCAL_MODULE_TAGS := tests
-
-# Include all test java files.
-LOCAL_SRC_FILES := $(call all-java-files-under, src)
-
-LOCAL_JAVA_LIBRARIES := android.test.runner telephony-common android.test.base
-LOCAL_STATIC_JAVA_LIBRARIES := junit
-LOCAL_PACKAGE_NAME := FrameworkPermissionTests
-LOCAL_PRIVATE_PLATFORM_APIS := true
-
-include $(BUILD_PACKAGE)
-
diff --git a/tests/testables/Android.bp b/tests/testables/Android.bp
index f07f09d..eb6811c 100644
--- a/tests/testables/Android.bp
+++ b/tests/testables/Android.bp
@@ -15,18 +15,12 @@
 //
 
 java_library {
-
     name: "testables",
-    // ANDROIDMK TRANSLATION ERROR: unsupported assignment to LOCAL_MODULE_TAG
-    // LOCAL_MODULE_TAG := tests
-
     srcs: ["src/**/*.java"],
-
     libs: [
         "android.test.runner",
         "android.test.mock",
-        "android-support-test",
+        "androidx.test.rules",
         "mockito-target-inline-minus-junit4",
     ],
-
 }
diff --git a/tests/testables/src/android/testing/AndroidTestingRunner.java b/tests/testables/src/android/testing/AndroidTestingRunner.java
index cf5d4cf..0375220 100644
--- a/tests/testables/src/android/testing/AndroidTestingRunner.java
+++ b/tests/testables/src/android/testing/AndroidTestingRunner.java
@@ -14,13 +14,13 @@
 
 package android.testing;
 
-import android.support.test.internal.runner.junit4.statement.RunAfters;
-import android.support.test.internal.runner.junit4.statement.RunBefores;
-import android.support.test.internal.runner.junit4.statement.UiThreadStatement;
-
 import android.testing.TestableLooper.LooperFrameworkMethod;
 import android.testing.TestableLooper.RunWithLooper;
 
+import androidx.test.internal.runner.junit4.statement.RunAfters;
+import androidx.test.internal.runner.junit4.statement.RunBefores;
+import androidx.test.internal.runner.junit4.statement.UiThreadStatement;
+
 import org.junit.After;
 import org.junit.Before;
 import org.junit.Test;
diff --git a/tests/testables/src/android/testing/BaseFragmentTest.java b/tests/testables/src/android/testing/BaseFragmentTest.java
index d18c126..9f60cce 100644
--- a/tests/testables/src/android/testing/BaseFragmentTest.java
+++ b/tests/testables/src/android/testing/BaseFragmentTest.java
@@ -26,13 +26,14 @@
 import android.os.Bundle;
 import android.os.Handler;
 import android.os.Parcelable;
-import android.support.test.InstrumentationRegistry;
 import android.view.LayoutInflater;
 import android.view.View;
 import android.view.WindowManager;
 import android.view.WindowManager.LayoutParams;
 import android.widget.FrameLayout;
 
+import androidx.test.InstrumentationRegistry;
+
 import org.junit.After;
 import org.junit.Before;
 import org.junit.Rule;
diff --git a/tests/testables/src/android/testing/TestableInstrumentation.java b/tests/testables/src/android/testing/TestableInstrumentation.java
index c35dc68..ed867c1 100644
--- a/tests/testables/src/android/testing/TestableInstrumentation.java
+++ b/tests/testables/src/android/testing/TestableInstrumentation.java
@@ -19,9 +19,10 @@
 import android.os.Looper;
 import android.os.Message;
 import android.os.TestLooperManager;
-import android.support.test.runner.AndroidJUnitRunner;
 import android.util.Log;
 
+import androidx.test.runner.AndroidJUnitRunner;
+
 import java.util.ArrayList;
 
 /**
diff --git a/tests/testables/src/android/testing/TestableLooper.java b/tests/testables/src/android/testing/TestableLooper.java
index 8b4cba1..8d99ac7 100644
--- a/tests/testables/src/android/testing/TestableLooper.java
+++ b/tests/testables/src/android/testing/TestableLooper.java
@@ -20,9 +20,10 @@
 import android.os.Message;
 import android.os.MessageQueue;
 import android.os.TestLooperManager;
-import android.support.test.InstrumentationRegistry;
 import android.util.ArrayMap;
 
+import androidx.test.InstrumentationRegistry;
+
 import org.junit.runners.model.FrameworkMethod;
 
 import java.lang.annotation.ElementType;
diff --git a/tests/testables/src/android/testing/ViewUtils.java b/tests/testables/src/android/testing/ViewUtils.java
index 1c6016e..80c2e8d 100644
--- a/tests/testables/src/android/testing/ViewUtils.java
+++ b/tests/testables/src/android/testing/ViewUtils.java
@@ -16,7 +16,6 @@
 
 import android.content.pm.ApplicationInfo;
 import android.graphics.PixelFormat;
-import android.support.test.InstrumentationRegistry;
 import android.view.View;
 import android.view.WindowManager;
 import android.view.WindowManager.LayoutParams;
diff --git a/tests/testables/tests/Android.bp b/tests/testables/tests/Android.bp
new file mode 100644
index 0000000..e1a58be
--- /dev/null
+++ b/tests/testables/tests/Android.bp
@@ -0,0 +1,41 @@
+// 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.
+
+android_test {
+    name: "TestablesTests",
+    platform_apis: true,
+    srcs: [
+        "src/**/*.java",
+        "src/**/I*.aidl",
+    ],
+    resource_dirs: ["res"],
+    static_libs: [
+        "androidx.test.rules",
+        "hamcrest-library",
+        "mockito-target-inline-minus-junit4",
+        "testables",
+    ],
+    compile_multilib: "both",
+    jni_libs: [
+        "libdexmakerjvmtiagent",
+        "libmultiplejvmtiagentsinterferenceagent",
+    ],
+    libs: [
+        "android.test.runner",
+        "android.test.base",
+        "android.test.mock",
+    ],
+    certificate: "platform",
+    test_suites: ["device-tests"],
+}
diff --git a/tests/testables/tests/Android.mk b/tests/testables/tests/Android.mk
deleted file mode 100644
index 79469e3..0000000
--- a/tests/testables/tests/Android.mk
+++ /dev/null
@@ -1,47 +0,0 @@
-# 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.
-
-LOCAL_PATH := $(call my-dir)
-include $(CLEAR_VARS)
-
-LOCAL_USE_AAPT2 := true
-LOCAL_MODULE_TAGS := tests
-
-LOCAL_PACKAGE_NAME := TestablesTests
-LOCAL_PRIVATE_PLATFORM_APIS := true
-
-LOCAL_SRC_FILES := $(call all-java-files-under, src) \
-    $(call all-Iaidl-files-under, src)
-
-LOCAL_RESOURCE_DIR := $(LOCAL_PATH)/res
-
-LOCAL_STATIC_JAVA_LIBRARIES := \
-    android-support-test \
-    mockito-target-inline-minus-junit4 \
-	testables
-
-LOCAL_MULTILIB := both
-
-LOCAL_JNI_SHARED_LIBRARIES := \
-    libdexmakerjvmtiagent \
-    libmultiplejvmtiagentsinterferenceagent
-
-LOCAL_JAVA_LIBRARIES := android.test.runner android.test.base android.test.mock
-
-LOCAL_CERTIFICATE := platform
-
-LOCAL_COMPATIBILITY_SUITE := device-tests
-
-include $(BUILD_PACKAGE)
-
diff --git a/tests/testables/tests/AndroidManifest.xml b/tests/testables/tests/AndroidManifest.xml
index 61f0be6..2bfb04f 100644
--- a/tests/testables/tests/AndroidManifest.xml
+++ b/tests/testables/tests/AndroidManifest.xml
@@ -25,7 +25,7 @@
         <uses-library android:name="android.test.runner" />
     </application>
 
-    <instrumentation android:name="android.support.test.runner.AndroidJUnitRunner"
+    <instrumentation android:name="androidx.test.runner.AndroidJUnitRunner"
         android:targetPackage="com.android.testables"
         android:label="Tests for Testables">
     </instrumentation>
diff --git a/tests/testables/tests/src/android/testing/DexmakerShareClassLoaderRuleTest.java b/tests/testables/tests/src/android/testing/DexmakerShareClassLoaderRuleTest.java
index 2528d09..13addb1 100644
--- a/tests/testables/tests/src/android/testing/DexmakerShareClassLoaderRuleTest.java
+++ b/tests/testables/tests/src/android/testing/DexmakerShareClassLoaderRuleTest.java
@@ -22,8 +22,8 @@
 import static org.junit.Assert.assertThat;
 import static org.junit.Assert.fail;
 
-import android.support.test.filters.SmallTest;
-import android.support.test.runner.AndroidJUnit4;
+import androidx.test.filters.SmallTest;
+import androidx.test.runner.AndroidJUnit4;
 
 import org.junit.Before;
 import org.junit.Test;
diff --git a/tests/testables/tests/src/android/testing/TestableContentResolverTest.java b/tests/testables/tests/src/android/testing/TestableContentResolverTest.java
index 71afda0..f531369 100644
--- a/tests/testables/tests/src/android/testing/TestableContentResolverTest.java
+++ b/tests/testables/tests/src/android/testing/TestableContentResolverTest.java
@@ -2,8 +2,9 @@
 
 import android.content.ContentProvider;
 import android.content.IContentProvider;
-import android.support.test.InstrumentationRegistry;
-import android.support.test.filters.SmallTest;
+
+import androidx.test.InstrumentationRegistry;
+import androidx.test.filters.SmallTest;
 
 import org.junit.Assert;
 import org.junit.Before;
diff --git a/tests/testables/tests/src/android/testing/TestablePermissionsTest.java b/tests/testables/tests/src/android/testing/TestablePermissionsTest.java
index c56146e..4626de7 100644
--- a/tests/testables/tests/src/android/testing/TestablePermissionsTest.java
+++ b/tests/testables/tests/src/android/testing/TestablePermissionsTest.java
@@ -20,11 +20,10 @@
 import static org.junit.Assert.assertEquals;
 
 import android.Manifest.permission;
-import android.content.pm.PackageManager;
 import android.net.Uri;
-import android.support.test.InstrumentationRegistry;
-import android.support.test.filters.SmallTest;
-import android.testing.TestableLooper.RunWithLooper;
+
+import androidx.test.InstrumentationRegistry;
+import androidx.test.filters.SmallTest;
 
 import org.junit.Rule;
 import org.junit.Test;
diff --git a/tests/testables/tests/src/android/testing/TestableResourcesTest.java b/tests/testables/tests/src/android/testing/TestableResourcesTest.java
index dc7cf95..dd4325c 100644
--- a/tests/testables/tests/src/android/testing/TestableResourcesTest.java
+++ b/tests/testables/tests/src/android/testing/TestableResourcesTest.java
@@ -21,9 +21,10 @@
 import static org.junit.Assert.fail;
 
 import android.content.res.Resources;
-import android.support.test.InstrumentationRegistry;
 import android.test.suitebuilder.annotation.SmallTest;
 
+import androidx.test.InstrumentationRegistry;
+
 import com.android.testables.R;
 
 import org.junit.Rule;
diff --git a/tests/testables/tests/src/android/testing/TestableSettingsProviderTest.java b/tests/testables/tests/src/android/testing/TestableSettingsProviderTest.java
index ac61deb..0333d51 100644
--- a/tests/testables/tests/src/android/testing/TestableSettingsProviderTest.java
+++ b/tests/testables/tests/src/android/testing/TestableSettingsProviderTest.java
@@ -14,20 +14,22 @@
 
 package android.testing;
 
+import static org.junit.Assert.*;
+
 import android.content.ContentResolver;
 import android.provider.Settings;
 import android.provider.Settings.Global;
 import android.provider.Settings.Secure;
-import android.support.test.InstrumentationRegistry;
-import android.support.test.runner.AndroidJUnit4;
 import android.test.suitebuilder.annotation.SmallTest;
+
+import androidx.test.InstrumentationRegistry;
+import androidx.test.runner.AndroidJUnit4;
+
 import org.junit.Before;
 import org.junit.Rule;
 import org.junit.Test;
 import org.junit.runner.RunWith;
 
-import static org.junit.Assert.*;
-
 @SmallTest
 @RunWith(AndroidJUnit4.class)
 public class TestableSettingsProviderTest {
diff --git a/tests/touchlag/Android.bp b/tests/touchlag/Android.bp
index 2610cb3..092eea9 100644
--- a/tests/touchlag/Android.bp
+++ b/tests/touchlag/Android.bp
@@ -1,14 +1,11 @@
 cc_test {
     name: "test-touchlag",
     gtest: false,
-
     srcs: ["touchlag.cpp"],
-
     shared_libs: [
         "libcutils",
         "libutils",
     ],
-
     cflags: [
         "-Wall",
         "-Wextra",
diff --git a/tests/utils/Android.mk b/tests/utils/Android.mk
deleted file mode 100644
index c141484..0000000
--- a/tests/utils/Android.mk
+++ /dev/null
@@ -1,17 +0,0 @@
-#
-# Copyright (C) 2012 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.
-#
-
-include $(call all-subdir-makefiles)
diff --git a/tests/utils/DummyIME/Android.bp b/tests/utils/DummyIME/Android.bp
new file mode 100644
index 0000000..4a44b3b
--- /dev/null
+++ b/tests/utils/DummyIME/Android.bp
@@ -0,0 +1,21 @@
+//
+// Copyright (C) 2012 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.
+//
+
+android_test {
+    name: "DummyIME",
+    srcs: ["src/**/*.java"],
+    sdk_version: "current",
+}
diff --git a/tests/utils/DummyIME/Android.mk b/tests/utils/DummyIME/Android.mk
deleted file mode 100644
index 0f6c988..0000000
--- a/tests/utils/DummyIME/Android.mk
+++ /dev/null
@@ -1,27 +0,0 @@
-#
-# Copyright (C) 2012 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.
-#
-
-LOCAL_PATH:= $(call my-dir)
-include $(CLEAR_VARS)
-
-LOCAL_MODULE_TAGS := tests
-
-LOCAL_SRC_FILES := $(call all-java-files-under, src)
-
-LOCAL_PACKAGE_NAME := DummyIME
-LOCAL_SDK_VERSION := current
-
-include $(BUILD_PACKAGE)
diff --git a/tools/aapt2/Android.bp b/tools/aapt2/Android.bp
index bc3a9a1..8bef221 100644
--- a/tools/aapt2/Android.bp
+++ b/tools/aapt2/Android.bp
@@ -141,6 +141,7 @@
         "ResourceValues.cpp",
         "SdkConstants.cpp",
         "StringPool.cpp",
+        "trace/TraceBuffer.cpp",
         "xml/XmlActionExecutor.cpp",
         "xml/XmlDom.cpp",
         "xml/XmlPullParser.cpp",
diff --git a/tools/aapt2/Main.cpp b/tools/aapt2/Main.cpp
index adf85b0..39eb987 100644
--- a/tools/aapt2/Main.cpp
+++ b/tools/aapt2/Main.cpp
@@ -37,6 +37,7 @@
 #include "cmd/Link.h"
 #include "cmd/Optimize.h"
 #include "io/FileStream.h"
+#include "trace/TraceBuffer.h"
 #include "util/Files.h"
 #include "util/Util.h"
 
@@ -107,9 +108,12 @@
       : Command("daemon", "m"), out_(out), diagnostics_(diagnostics) {
     SetDescription("Runs aapt in daemon mode. Each subsequent line is a single parameter to the\n"
         "command. The end of an invocation is signaled by providing an empty line.");
+    AddOptionalFlag("--trace_folder", "Generate systrace json trace fragment to specified folder.",
+                    &trace_folder_);
   }
 
-  int Action(const std::vector<std::string>& /* args */) override {
+  int Action(const std::vector<std::string>& arguments) override {
+    TRACE_FLUSH_ARGS(trace_folder_ ? trace_folder_.value() : "", "daemon", arguments);
     text::Printer printer(out_);
     std::cout << "Ready" << std::endl;
 
@@ -150,6 +154,7 @@
  private:
   io::FileOutputStream* out_;
   IDiagnostics* diagnostics_;
+  Maybe<std::string> trace_folder_;
 };
 
 }  // namespace aapt
diff --git a/tools/aapt2/ResourceParser.cpp b/tools/aapt2/ResourceParser.cpp
index d0237f8..5e8d870 100644
--- a/tools/aapt2/ResourceParser.cpp
+++ b/tools/aapt2/ResourceParser.cpp
@@ -206,15 +206,6 @@
   }
 };
 
-// A chunk of text in the XML string within a CDATA tags.
-class CdataSegmentNode : public SegmentNode {
- public:
-
-  void Build(StringBuilder* builder) const override {
-    builder->AppendText(data, /* preserve_spaces */ true);
-  }
-};
-
 // A tag that will be encoded into the final flattened string. Tags like <b> or <i>.
 class SpanNode : public Node {
  public:
@@ -251,7 +242,6 @@
   std::vector<Node*> node_stack;
   node_stack.push_back(&root);
 
-  bool cdata_block = false;
   bool saw_span_node = false;
   SegmentNode* first_segment = nullptr;
   SegmentNode* last_segment = nullptr;
@@ -262,12 +252,9 @@
 
     // First take care of any SegmentNodes that should be created.
     if (event == xml::XmlPullParser::Event::kStartElement
-        || event == xml::XmlPullParser::Event::kEndElement
-        || event == xml::XmlPullParser::Event::kCdataStart
-        || event == xml::XmlPullParser::Event::kCdataEnd) {
+        || event == xml::XmlPullParser::Event::kEndElement) {
       if (!current_text.empty()) {
-        std::unique_ptr<SegmentNode> segment_node = (cdata_block)
-            ? util::make_unique<CdataSegmentNode>() : util::make_unique<SegmentNode>();
+        auto segment_node = util::make_unique<SegmentNode>();
         segment_node->data = std::move(current_text);
 
         last_segment = node_stack.back()->AddChild(std::move(segment_node));
@@ -345,16 +332,6 @@
         }
       } break;
 
-      case xml::XmlPullParser::Event::kCdataStart: {
-        cdata_block = true;
-        break;
-      }
-
-      case xml::XmlPullParser::Event::kCdataEnd: {
-        cdata_block = false;
-        break;
-      }
-
       default:
         // ignore.
         break;
diff --git a/tools/aapt2/ResourceParser_test.cpp b/tools/aapt2/ResourceParser_test.cpp
index 25b76b0..251ca0c 100644
--- a/tools/aapt2/ResourceParser_test.cpp
+++ b/tools/aapt2/ResourceParser_test.cpp
@@ -1195,27 +1195,26 @@
 }
 
 TEST_F(ResourceParserTest, ParseCData) {
-  std::string input = R"(
-      <string name="foo"><![CDATA[some text and ' apostrophe]]></string>)";
-
+  // Double quotes should still change the state of whitespace processing
+  std::string input = R"(<string name="foo">Hello<![CDATA[ "</string>' ]]>      World</string>)";
   ASSERT_TRUE(TestParse(input));
-  String* output = test::GetValue<String>(&table_, "string/foo");
+  auto output = test::GetValue<String>(&table_, "string/foo");
   ASSERT_THAT(output, NotNull());
-  EXPECT_THAT(*output, StrValueEq("some text and ' apostrophe"));
+  EXPECT_THAT(*output, StrValueEq(std::string("Hello </string>'       World").data()));
 
-  // Double quotes should not change the state of whitespace processing
-  input = R"(<string name="foo2">Hello<![CDATA[ "</string>' ]]>      World</string>)";
+  input = R"(<string name="foo2"><![CDATA[Hello
+                                          World]]></string>)";
   ASSERT_TRUE(TestParse(input));
   output = test::GetValue<String>(&table_, "string/foo2");
   ASSERT_THAT(output, NotNull());
-  EXPECT_THAT(*output, StrValueEq(std::string("Hello \"</string>'  World").data()));
+  EXPECT_THAT(*output, StrValueEq(std::string("Hello World").data()));
 
-  // Cdata blocks should not have their whitespace trimmed
+  // Cdata blocks should have their whitespace trimmed
   input = R"(<string name="foo3">     <![CDATA[ text ]]>     </string>)";
   ASSERT_TRUE(TestParse(input));
   output = test::GetValue<String>(&table_, "string/foo3");
   ASSERT_THAT(output, NotNull());
-  EXPECT_THAT(*output, StrValueEq(std::string(" text ").data()));
+  EXPECT_THAT(*output, StrValueEq(std::string("text").data()));
 
   input = R"(<string name="foo4">     <![CDATA[]]>     </string>)";
   ASSERT_TRUE(TestParse(input));
@@ -1227,7 +1226,11 @@
   ASSERT_TRUE(TestParse(input));
   output = test::GetValue<String>(&table_, "string/foo5");
   ASSERT_THAT(output, NotNull());
-  EXPECT_THAT(*output, StrValueEq(std::string("    ").data()));
+  EXPECT_THAT(*output, StrValueEq(std::string("").data()));
+
+  // Single quotes must still be escaped
+  input = R"(<string name="foo6"><![CDATA[some text and ' apostrophe]]></string>)";
+  ASSERT_FALSE(TestParse(input));
 }
 
 }  // namespace aapt
diff --git a/tools/aapt2/ResourceTable.cpp b/tools/aapt2/ResourceTable.cpp
index dbd0a0c..7c0619f 100644
--- a/tools/aapt2/ResourceTable.cpp
+++ b/tools/aapt2/ResourceTable.cpp
@@ -30,6 +30,7 @@
 #include "NameMangler.h"
 #include "ResourceValues.h"
 #include "ValueVisitor.h"
+#include "trace/TraceBuffer.h"
 #include "text/Unicode.h"
 #include "util/Util.h"
 
@@ -79,6 +80,7 @@
 }
 
 ResourceTablePackage* ResourceTable::CreatePackage(const StringPiece& name, Maybe<uint8_t> id) {
+  TRACE_CALL();
   ResourceTablePackage* package = FindOrCreatePackage(name);
   if (id && !package->id) {
     package->id = id;
diff --git a/tools/aapt2/ResourceUtils.cpp b/tools/aapt2/ResourceUtils.cpp
index ffc1a92..f0e4d9e 100644
--- a/tools/aapt2/ResourceUtils.cpp
+++ b/tools/aapt2/ResourceUtils.cpp
@@ -845,20 +845,16 @@
     : preserve_spaces_(preserve_spaces), quote_(preserve_spaces) {
 }
 
-StringBuilder& StringBuilder::AppendText(const std::string& text, bool preserve_spaces) {
+StringBuilder& StringBuilder::AppendText(const std::string& text) {
   if (!error_.empty()) {
     return *this;
   }
 
-  // Enable preserving spaces if it is enabled for this append or the StringBuilder was constructed
-  // to preserve spaces
-  preserve_spaces = (preserve_spaces) ? preserve_spaces : preserve_spaces_;
-
   const size_t previous_len = xml_string_.text.size();
   Utf8Iterator iter(text);
   while (iter.HasNext()) {
     char32_t codepoint = iter.Next();
-    if (!preserve_spaces && !quote_ && codepoint != kNonBreakingSpace && iswspace(codepoint)) {
+    if (!preserve_spaces_ && !quote_ && codepoint != kNonBreakingSpace && iswspace(codepoint)) {
       if (!last_codepoint_was_space_) {
         // Emit a space if it's the first.
         xml_string_.text += ' ';
@@ -906,11 +902,11 @@
             break;
         }
       }
-    } else if (!preserve_spaces && codepoint == U'"') {
+    } else if (!preserve_spaces_ && codepoint == U'"') {
       // Only toggle the quote state when we are not preserving spaces.
       quote_ = !quote_;
 
-    } else if (!preserve_spaces && !quote_ && codepoint == U'\'') {
+    } else if (!preserve_spaces_ && !quote_ && codepoint == U'\'') {
       // This should be escaped when we are not preserving spaces
       error_ = StringPrintf("unescaped apostrophe in string\n\"%s\"", text.c_str());
       return *this;
diff --git a/tools/aapt2/ResourceUtils.h b/tools/aapt2/ResourceUtils.h
index a8a3120..f77766e 100644
--- a/tools/aapt2/ResourceUtils.h
+++ b/tools/aapt2/ResourceUtils.h
@@ -276,10 +276,8 @@
   // single quotations can be used without escaping them.
   explicit StringBuilder(bool preserve_spaces = false);
 
-  // Appends a chunk of text. If preserve_spaces is true, whitespace removal is not performed, and
-  // single quotations can be used without escaping them for this append. Otherwise, the
-  // StringBuilder will behave as it was constructed.
-  StringBuilder& AppendText(const std::string& text, bool preserve_spaces = false);
+  // Appends a chunk of text.
+  StringBuilder& AppendText(const std::string& text);
 
   // Starts a Span (tag) with the given name. The name is expected to be of the form:
   //  "tag_name;attr1=value;attr2=value;"
diff --git a/tools/aapt2/ResourceUtils_test.cpp b/tools/aapt2/ResourceUtils_test.cpp
index 9018b0f..3b77135 100644
--- a/tools/aapt2/ResourceUtils_test.cpp
+++ b/tools/aapt2/ResourceUtils_test.cpp
@@ -266,29 +266,6 @@
 TEST(ResourceUtilsTest, StringBuilderPreserveSpaces) {
   EXPECT_THAT(ResourceUtils::StringBuilder(true /*preserve_spaces*/).AppendText("\"").to_string(),
               Eq("\""));
-
-  // Single quotes should be able to be used without escaping them when preserving spaces and the
-  // spaces should not be trimmed
-  EXPECT_THAT(ResourceUtils::StringBuilder()
-                  .AppendText("    hey guys ")
-                  .AppendText(" 'this is so cool' ", /* preserve_spaces */ true)
-                  .AppendText(" wow    ")
-                  .to_string(),
-              Eq(" hey guys  'this is so cool'  wow "));
-
-  // Reading a double quote while preserving spaces should not change the quote state
-  EXPECT_THAT(ResourceUtils::StringBuilder()
-                  .AppendText("    hey guys ")
-                  .AppendText(" \"this is so cool' ", /* preserve_spaces */ true)
-                  .AppendText(" wow    ")
-                  .to_string(),
-              Eq(" hey guys  \"this is so cool'  wow "));
-  EXPECT_THAT(ResourceUtils::StringBuilder()
-                  .AppendText("    hey guys\"  ")
-                  .AppendText(" \"this is so cool' ", /* preserve_spaces */ true)
-                  .AppendText(" wow  \"  ")
-                  .to_string(),
-              Eq(" hey guys   \"this is so cool'  wow   "));
 }
 
 }  // namespace aapt
diff --git a/tools/aapt2/cmd/Command.cpp b/tools/aapt2/cmd/Command.cpp
index 4424a35..919b4c9 100644
--- a/tools/aapt2/cmd/Command.cpp
+++ b/tools/aapt2/cmd/Command.cpp
@@ -25,6 +25,7 @@
 #include "android-base/utf8.h"
 #include "androidfw/StringPiece.h"
 
+#include "trace/TraceBuffer.h"
 #include "util/Util.h"
 
 using android::base::StringPrintf;
@@ -178,6 +179,7 @@
 }
 
 int Command::Execute(const std::vector<StringPiece>& args, std::ostream* out_error) {
+  TRACE_NAME_ARGS("Command::Execute", args);
   std::vector<std::string> file_args;
 
   for (size_t i = 0; i < args.size(); i++) {
diff --git a/tools/aapt2/cmd/Compile.cpp b/tools/aapt2/cmd/Compile.cpp
index bec6c69..42dc74c 100644
--- a/tools/aapt2/cmd/Compile.cpp
+++ b/tools/aapt2/cmd/Compile.cpp
@@ -45,6 +45,7 @@
 #include "io/StringStream.h"
 #include "io/Util.h"
 #include "io/ZipArchive.h"
+#include "trace/TraceBuffer.h"
 #include "util/Files.h"
 #include "util/Maybe.h"
 #include "util/Util.h"
@@ -141,6 +142,7 @@
 static bool CompileTable(IAaptContext* context, const CompileOptions& options,
                          const ResourcePathData& path_data, io::IFile* file, IArchiveWriter* writer,
                          const std::string& output_path) {
+  TRACE_CALL();
   ResourceTable table;
   {
     auto fin = file->OpenInputStream();
@@ -286,6 +288,7 @@
 static bool WriteHeaderAndDataToWriter(const StringPiece& output_path, const ResourceFile& file,
                                        io::KnownSizeInputStream* in, IArchiveWriter* writer,
                                        IDiagnostics* diag) {
+  TRACE_CALL();
   // Start the entry so we can write the header.
   if (!writer->StartEntry(output_path, 0)) {
     diag->Error(DiagMessage(output_path) << "failed to open file");
@@ -352,6 +355,7 @@
 static bool CompileXml(IAaptContext* context, const CompileOptions& options,
                        const ResourcePathData& path_data, io::IFile* file, IArchiveWriter* writer,
                        const std::string& output_path) {
+  TRACE_CALL();
   if (context->IsVerbose()) {
     context->GetDiagnostics()->Note(DiagMessage(path_data.source) << "compiling XML");
   }
@@ -451,6 +455,7 @@
 static bool CompilePng(IAaptContext* context, const CompileOptions& options,
                        const ResourcePathData& path_data, io::IFile* file, IArchiveWriter* writer,
                        const std::string& output_path) {
+  TRACE_CALL();
   if (context->IsVerbose()) {
     context->GetDiagnostics()->Note(DiagMessage(path_data.source) << "compiling PNG");
   }
@@ -558,6 +563,7 @@
 static bool CompileFile(IAaptContext* context, const CompileOptions& options,
                         const ResourcePathData& path_data, io::IFile* file, IArchiveWriter* writer,
                         const std::string& output_path) {
+  TRACE_CALL();
   if (context->IsVerbose()) {
     context->GetDiagnostics()->Note(DiagMessage(path_data.source) << "compiling file");
   }
@@ -632,6 +638,7 @@
 
 int Compile(IAaptContext* context, io::IFileCollection* inputs, IArchiveWriter* output_writer,
              CompileOptions& options) {
+  TRACE_CALL();
   bool error = false;
 
   // Iterate over the input files in a stable, platform-independent manner
@@ -707,6 +714,7 @@
 }
 
 int CompileCommand::Action(const std::vector<std::string>& args) {
+  TRACE_FLUSH(trace_folder_? trace_folder_.value() : "", "CompileCommand::Action");
   CompileContext context(diagnostic_);
   context.SetVerbose(options_.verbose);
 
diff --git a/tools/aapt2/cmd/Compile.h b/tools/aapt2/cmd/Compile.h
index 9b32cb3..d3456b2 100644
--- a/tools/aapt2/cmd/Compile.h
+++ b/tools/aapt2/cmd/Compile.h
@@ -60,6 +60,8 @@
         "Sets the visibility of the compiled resources to the specified\n"
             "level. Accepted levels: public, private, default", &visibility_);
     AddOptionalSwitch("-v", "Enables verbose logging", &options_.verbose);
+    AddOptionalFlag("--trace-folder", "Generate systrace json trace fragment to specified folder.",
+                    &trace_folder_);
   }
 
   int Action(const std::vector<std::string>& args) override;
@@ -68,6 +70,7 @@
   IDiagnostics* diagnostic_;
   CompileOptions options_;
   Maybe<std::string> visibility_;
+  Maybe<std::string> trace_folder_;
 };
 
 int Compile(IAaptContext* context, io::IFileCollection* inputs, IArchiveWriter* output_writer,
diff --git a/tools/aapt2/cmd/Link.cpp b/tools/aapt2/cmd/Link.cpp
index a7b8d25..f354bb6 100644
--- a/tools/aapt2/cmd/Link.cpp
+++ b/tools/aapt2/cmd/Link.cpp
@@ -67,6 +67,7 @@
 #include "process/IResourceTableConsumer.h"
 #include "process/SymbolTable.h"
 #include "split/TableSplitter.h"
+#include "trace/TraceBuffer.h"
 #include "util/Files.h"
 #include "xml/XmlDom.h"
 
@@ -213,6 +214,7 @@
 static bool FlattenXml(IAaptContext* context, const xml::XmlResource& xml_res,
                        const StringPiece& path, bool keep_raw_values, bool utf16,
                        OutputFormat format, IArchiveWriter* writer) {
+  TRACE_CALL();
   if (context->IsVerbose()) {
     context->GetDiagnostics()->Note(DiagMessage(path) << "writing to archive (keep_raw_values="
                                                       << (keep_raw_values ? "true" : "false")
@@ -250,6 +252,7 @@
 
 // Inflates an XML file from the source path.
 static std::unique_ptr<xml::XmlResource> LoadXml(const std::string& path, IDiagnostics* diag) {
+  TRACE_CALL();
   FileInputStream fin(path);
   if (fin.HadError()) {
     diag->Error(DiagMessage(path) << "failed to load XML file: " << fin.GetError());
@@ -421,6 +424,7 @@
 
 std::vector<std::unique_ptr<xml::XmlResource>> ResourceFileFlattener::LinkAndVersionXmlFile(
     ResourceTable* table, FileOperation* file_op) {
+  TRACE_CALL();
   xml::XmlResource* doc = file_op->xml_to_flatten.get();
   const Source& src = doc->file.source;
 
@@ -489,6 +493,7 @@
 };
 
 bool ResourceFileFlattener::Flatten(ResourceTable* table, IArchiveWriter* archive_writer) {
+  TRACE_CALL();
   bool error = false;
   std::map<std::pair<ConfigDescription, StringPiece>, FileOperation> config_sorted_files;
 
@@ -806,6 +811,7 @@
   // Creates a SymbolTable that loads symbols from the various APKs.
   // Pre-condition: context_->GetCompilationPackage() needs to be set.
   bool LoadSymbolsFromIncludePaths() {
+    TRACE_NAME("LoadSymbolsFromIncludePaths: #" + std::to_string(options_.include_paths.size()));
     auto asset_source = util::make_unique<AssetManagerSymbolSource>();
     for (const std::string& path : options_.include_paths) {
       if (context_->IsVerbose()) {
@@ -891,6 +897,7 @@
   }
 
   Maybe<AppInfo> ExtractAppInfoFromManifest(xml::XmlResource* xml_res, IDiagnostics* diag) {
+    TRACE_CALL();
     // Make sure the first element is <manifest> with package attribute.
     xml::Element* manifest_el = xml::FindRootElement(xml_res->root.get());
     if (manifest_el == nullptr) {
@@ -1041,6 +1048,7 @@
   }
 
   bool FlattenTable(ResourceTable* table, OutputFormat format, IArchiveWriter* writer) {
+    TRACE_CALL();
     switch (format) {
       case OutputFormat::kApk: {
         BigBuffer buffer(1024);
@@ -1114,6 +1122,7 @@
   }
 
   bool GenerateJavaClasses() {
+    TRACE_CALL();
     // The set of packages whose R class to call in the main classes onResourcesLoaded callback.
     std::vector<std::string> packages_to_callback;
 
@@ -1197,6 +1206,7 @@
   }
 
   bool WriteManifestJavaFile(xml::XmlResource* manifest_xml) {
+    TRACE_CALL();
     if (!options_.generate_java_class_path) {
       return true;
     }
@@ -1254,6 +1264,7 @@
   }
 
   bool WriteProguardFile(const Maybe<std::string>& out, const proguard::KeepSet& keep_set) {
+    TRACE_CALL();
     if (!out) {
       return true;
     }
@@ -1278,6 +1289,7 @@
   }
 
   bool MergeStaticLibrary(const std::string& input, bool override) {
+    TRACE_CALL();
     if (context_->IsVerbose()) {
       context_->GetDiagnostics()->Note(DiagMessage() << "merging static library " << input);
     }
@@ -1328,6 +1340,7 @@
 
   bool MergeExportedSymbols(const Source& source,
                             const std::vector<SourcedResourceName>& exported_symbols) {
+    TRACE_CALL();
     // Add the exports of this file to the table.
     for (const SourcedResourceName& exported_symbol : exported_symbols) {
       ResourceName res_name = exported_symbol.name;
@@ -1353,6 +1366,7 @@
   }
 
   bool MergeCompiledFile(const ResourceFile& compiled_file, io::IFile* file, bool override) {
+    TRACE_CALL();
     if (context_->IsVerbose()) {
       context_->GetDiagnostics()->Note(DiagMessage()
                                        << "merging '" << compiled_file.name
@@ -1371,6 +1385,7 @@
   // An io::IFileCollection is created from the ZIP file and added to the set of
   // io::IFileCollections that are open.
   bool MergeArchive(const std::string& input, bool override) {
+    TRACE_CALL();
     if (context_->IsVerbose()) {
       context_->GetDiagnostics()->Note(DiagMessage() << "merging archive " << input);
     }
@@ -1418,6 +1433,7 @@
   // All other file types are ignored. This is because these files could be coming from a zip,
   // where we could have other files like classes.dex.
   bool MergeFile(io::IFile* file, bool override) {
+    TRACE_CALL();
     const Source& src = file->GetSource();
 
     if (util::EndsWith(src.path, ".xml") || util::EndsWith(src.path, ".png")) {
@@ -1458,6 +1474,7 @@
 
     while ((entry = reader.Next()) != nullptr) {
       if (entry->Type() == ContainerEntryType::kResTable) {
+        TRACE_NAME(std::string("Process ResTable:") + file->GetSource().path);
         pb::ResourceTable pb_table;
         if (!entry->GetResTable(&pb_table)) {
           context_->GetDiagnostics()->Error(DiagMessage(src) << "failed to read resource table: "
@@ -1478,6 +1495,7 @@
           return false;
         }
       } else if (entry->Type() == ContainerEntryType::kResFile) {
+        TRACE_NAME(std::string("Process ResFile") + file->GetSource().path);
         pb::internal::CompiledFile pb_compiled_file;
         off64_t offset;
         size_t len;
@@ -1551,6 +1569,7 @@
   // to the IArchiveWriter.
   bool WriteApk(IArchiveWriter* writer, proguard::KeepSet* keep_set, xml::XmlResource* manifest,
                 ResourceTable* table) {
+    TRACE_CALL();
     const bool keep_raw_values = (context_->GetPackageType() == PackageType::kStaticLib)
                                  || options_.keep_raw_values;
     bool result = FlattenXml(context_, *manifest, kAndroidManifestPath, keep_raw_values,
@@ -1632,6 +1651,7 @@
   }
 
   int Run(const std::vector<std::string>& input_files) {
+    TRACE_CALL();
     // Load the AndroidManifest.xml
     std::unique_ptr<xml::XmlResource> manifest_xml =
         LoadXml(options_.manifest_path, context_->GetDiagnostics());
@@ -1839,6 +1859,7 @@
       std::vector<ConfigDescription> excluded_configs;
 
       for (auto& config_string : options_.exclude_configs_) {
+        TRACE_NAME("ConfigDescription::Parse");
         ConfigDescription config_description;
 
         if (!ConfigDescription::Parse(config_string, &config_description)) {
@@ -2038,6 +2059,7 @@
 };
 
 int LinkCommand::Action(const std::vector<std::string>& args) {
+  TRACE_FLUSH(trace_folder_ ? trace_folder_.value() : "", "LinkCommand::Action");
   LinkContext context(diag_);
 
   // Expand all argument-files passed into the command line. These start with '@'.
diff --git a/tools/aapt2/cmd/Link.h b/tools/aapt2/cmd/Link.h
index 1fc149a..7c58385 100644
--- a/tools/aapt2/cmd/Link.h
+++ b/tools/aapt2/cmd/Link.h
@@ -25,6 +25,7 @@
 #include "split/TableSplitter.h"
 #include "format/binary/TableFlattener.h"
 #include "link/ManifestFixer.h"
+#include "trace/TraceBuffer.h"
 
 namespace aapt {
 
@@ -277,6 +278,8 @@
         "Do not allow overlays with different visibility levels.",
         &options_.strict_visibility);
     AddOptionalSwitch("-v", "Enables verbose logging.", &verbose_);
+    AddOptionalFlag("--trace-folder", "Generate systrace json trace fragment to specified folder.",
+                    &trace_folder_);
   }
 
   int Action(const std::vector<std::string>& args) override;
@@ -300,6 +303,7 @@
   bool proto_format_ = false;
   Maybe<std::string> stable_id_file_path_;
   std::vector<std::string> split_args_;
+  Maybe<std::string> trace_folder_;
 };
 
 }// namespace aapt
diff --git a/tools/aapt2/compile/Png.cpp b/tools/aapt2/compile/Png.cpp
index 33122dc..d396d81 100644
--- a/tools/aapt2/compile/Png.cpp
+++ b/tools/aapt2/compile/Png.cpp
@@ -27,6 +27,7 @@
 #include "androidfw/ResourceTypes.h"
 
 #include "Source.h"
+#include "trace/TraceBuffer.h"
 #include "util/BigBuffer.h"
 #include "util/Util.h"
 
@@ -1233,6 +1234,7 @@
 
 bool Png::process(const Source& source, std::istream* input,
                   BigBuffer* outBuffer, const PngOptions& options) {
+  TRACE_CALL();
   png_byte signature[kPngSignatureSize];
 
   // Read the PNG signature first.
diff --git a/tools/aapt2/compile/PngCrunch.cpp b/tools/aapt2/compile/PngCrunch.cpp
index 0346a19..1f4ea44d 100644
--- a/tools/aapt2/compile/PngCrunch.cpp
+++ b/tools/aapt2/compile/PngCrunch.cpp
@@ -27,6 +27,8 @@
 #include "android-base/logging.h"
 #include "android-base/macros.h"
 
+#include "trace/TraceBuffer.h"
+
 namespace aapt {
 
 // Custom deleter that destroys libpng read and info structs.
@@ -142,6 +144,7 @@
 }
 
 std::unique_ptr<Image> ReadPng(IAaptContext* context, const Source& source, io::InputStream* in) {
+  TRACE_CALL();
   // Create a diagnostics that has the source information encoded.
   SourcePathDiagnostics source_diag(source, context->GetDiagnostics());
 
@@ -480,6 +483,7 @@
 bool WritePng(IAaptContext* context, const Image* image,
               const NinePatch* nine_patch, io::OutputStream* out,
               const PngOptions& options) {
+  TRACE_CALL();
   // Create and initialize the write png_struct with the default error and
   // warning handlers.
   // The header version is also passed in to ensure that this was built against the same
diff --git a/tools/aapt2/compile/XmlIdCollector.cpp b/tools/aapt2/compile/XmlIdCollector.cpp
index 2199d00..5054115 100644
--- a/tools/aapt2/compile/XmlIdCollector.cpp
+++ b/tools/aapt2/compile/XmlIdCollector.cpp
@@ -22,6 +22,7 @@
 #include "ResourceUtils.h"
 #include "ResourceValues.h"
 #include "text/Unicode.h"
+#include "trace/TraceBuffer.h"
 #include "xml/XmlDom.h"
 
 namespace aapt {
@@ -72,6 +73,7 @@
 }  // namespace
 
 bool XmlIdCollector::Consume(IAaptContext* context, xml::XmlResource* xmlRes) {
+  TRACE_CALL();
   xmlRes->file.exported_symbols.clear();
   SourcePathDiagnostics source_diag(xmlRes->file.source, context->GetDiagnostics());
   IdCollector collector(&xmlRes->file.exported_symbols, &source_diag);
diff --git a/tools/aapt2/format/Container.cpp b/tools/aapt2/format/Container.cpp
index d4b4571..f189048 100644
--- a/tools/aapt2/format/Container.cpp
+++ b/tools/aapt2/format/Container.cpp
@@ -19,6 +19,8 @@
 #include "android-base/scopeguard.h"
 #include "android-base/stringprintf.h"
 
+#include "trace/TraceBuffer.h"
+
 using ::android::base::StringPrintf;
 using ::google::protobuf::io::CodedInputStream;
 using ::google::protobuf::io::CodedOutputStream;
@@ -171,6 +173,7 @@
 }
 
 bool ContainerReaderEntry::GetResTable(pb::ResourceTable* out_table) {
+  TRACE_CALL();
   CHECK(type_ == ContainerEntryType::kResTable) << "reading a kResTable when the type is kResFile";
   if (length_ > std::numeric_limits<int>::max()) {
     reader_->error_ = StringPrintf("entry length %zu is too large", length_);
@@ -261,6 +264,7 @@
       total_entry_count_(0u),
       current_entry_count_(0u),
       entry_(this) {
+  TRACE_CALL();
   ::google::protobuf::uint32 magic;
   if (!coded_in_.ReadLittleEndian32(&magic)) {
     std::ostringstream error;
diff --git a/tools/aapt2/format/binary/TableFlattener.cpp b/tools/aapt2/format/binary/TableFlattener.cpp
index d677317..aa578a2 100644
--- a/tools/aapt2/format/binary/TableFlattener.cpp
+++ b/tools/aapt2/format/binary/TableFlattener.cpp
@@ -32,6 +32,7 @@
 #include "ValueVisitor.h"
 #include "format/binary/ChunkWriter.h"
 #include "format/binary/ResourceTypeExtensions.h"
+#include "trace/TraceBuffer.h"
 #include "util/BigBuffer.h"
 
 using namespace android;
@@ -238,6 +239,7 @@
   }
 
   bool FlattenPackage(BigBuffer* buffer) {
+    TRACE_CALL();
     ChunkWriter pkg_writer(buffer);
     ResTable_package* pkg_header = pkg_writer.StartChunk<ResTable_package>(RES_TABLE_PACKAGE_TYPE);
     pkg_header->id = util::HostToDevice32(package_->id.value());
@@ -710,6 +712,7 @@
 }  // namespace
 
 bool TableFlattener::Consume(IAaptContext* context, ResourceTable* table) {
+  TRACE_CALL();
   // We must do this before writing the resources, since the string pool IDs may change.
   table->string_pool.Prune();
   table->string_pool.Sort([](const StringPool::Context& a, const StringPool::Context& b) -> int {
diff --git a/tools/aapt2/format/binary/XmlFlattener.cpp b/tools/aapt2/format/binary/XmlFlattener.cpp
index 2fe2424..afbaae4 100644
--- a/tools/aapt2/format/binary/XmlFlattener.cpp
+++ b/tools/aapt2/format/binary/XmlFlattener.cpp
@@ -99,9 +99,6 @@
     flat_node->lineNumber = util::HostToDevice32(node->line_number);
     flat_node->comment.index = util::HostToDevice32(-1);
 
-    // Process plain strings to make sure they get properly escaped.
-    text = StringBuilder(true /*preserve_spaces*/).AppendText(text).to_string();
-
     ResXMLTree_cdataExt* flat_text = writer.NextBlock<ResXMLTree_cdataExt>();
     AddString(text, kLowPriority, &flat_text->data);
     writer.Finish();
diff --git a/tools/aapt2/format/binary/XmlFlattener_test.cpp b/tools/aapt2/format/binary/XmlFlattener_test.cpp
index 25786b1..1dac493 100644
--- a/tools/aapt2/format/binary/XmlFlattener_test.cpp
+++ b/tools/aapt2/format/binary/XmlFlattener_test.cpp
@@ -118,7 +118,7 @@
   ASSERT_THAT(tree.getAttributeCount(), Eq(0u));
 
   ASSERT_THAT(tree.next(), Eq(android::ResXMLTree::TEXT));
-  EXPECT_THAT(tree.getText(&len), StrEq(u"Some text\\"));
+  EXPECT_THAT(tree.getText(&len), StrEq(u"Some text\\\\"));
 
   ASSERT_THAT(tree.next(), Eq(android::ResXMLTree::END_TAG));
   EXPECT_THAT(tree.getElementNamespace(&len), IsNull());
@@ -283,7 +283,7 @@
   EXPECT_THAT(tree.getAttributeStringValue(idx, &len), StrEq(u"\""));
 
   ASSERT_THAT(tree.next(), Eq(android::ResXMLTree::TEXT));
-  EXPECT_THAT(tree.getText(&len), StrEq(u"\\d{5}"));
+  EXPECT_THAT(tree.getText(&len), StrEq(u"\\\\d{5}"));
 }
 
 TEST_F(XmlFlattenerTest, ProcessQuotes) {
@@ -360,6 +360,7 @@
    J
 
 </item>
+          <item>\t K \n </item>
           <item>
           </item>
       </root>)");
@@ -439,6 +440,12 @@
 
   ASSERT_THAT(tree.next(), Eq(android::ResXMLTree::START_TAG));
   EXPECT_THAT(tree.getElementName(&len), StrEq(u"item"));
+  ASSERT_THAT(tree.next(), Eq(android::ResXMLTree::TEXT));
+  EXPECT_THAT(tree.getText(&len), StrEq(u"\\t K \\n "));
+  ASSERT_THAT(tree.next(), Eq(android::ResXMLTree::END_TAG));
+
+  ASSERT_THAT(tree.next(), Eq(android::ResXMLTree::START_TAG));
+  EXPECT_THAT(tree.getElementName(&len), StrEq(u"item"));
   ASSERT_THAT(tree.next(), Eq(android::ResXMLTree::END_TAG));
   ASSERT_THAT(tree.next(), Eq(android::ResXMLTree::END_TAG));
 
diff --git a/tools/aapt2/io/Util.cpp b/tools/aapt2/io/Util.cpp
index 9751632..ce6d9352 100644
--- a/tools/aapt2/io/Util.cpp
+++ b/tools/aapt2/io/Util.cpp
@@ -18,6 +18,8 @@
 
 #include "google/protobuf/io/zero_copy_stream_impl_lite.h"
 
+#include "trace/TraceBuffer.h"
+
 using ::android::StringPiece;
 using ::google::protobuf::io::ZeroCopyOutputStream;
 
@@ -26,6 +28,7 @@
 
 bool CopyInputStreamToArchive(IAaptContext* context, InputStream* in, const std::string& out_path,
                               uint32_t compression_flags, IArchiveWriter* writer) {
+  TRACE_CALL();
   if (context->IsVerbose()) {
     context->GetDiagnostics()->Note(DiagMessage() << "writing " << out_path << " to archive");
   }
@@ -40,6 +43,7 @@
 
 bool CopyFileToArchive(IAaptContext* context, io::IFile* file, const std::string& out_path,
                        uint32_t compression_flags, IArchiveWriter* writer) {
+  TRACE_CALL();
   std::unique_ptr<io::IData> data = file->OpenAsData();
   if (!data) {
     context->GetDiagnostics()->Error(DiagMessage(file->GetSource()) << "failed to open file");
@@ -57,6 +61,7 @@
 bool CopyProtoToArchive(IAaptContext* context, ::google::protobuf::MessageLite* proto_msg,
                         const std::string& out_path, uint32_t compression_flags,
                         IArchiveWriter* writer) {
+  TRACE_CALL();
   if (context->IsVerbose()) {
     context->GetDiagnostics()->Note(DiagMessage() << "writing " << out_path << " to archive");
   }
@@ -83,6 +88,7 @@
 }
 
 bool Copy(OutputStream* out, InputStream* in) {
+  TRACE_CALL();
   const void* in_buffer;
   size_t in_len;
   while (in->Next(&in_buffer, &in_len)) {
diff --git a/tools/aapt2/io/ZipArchive.cpp b/tools/aapt2/io/ZipArchive.cpp
index 427dc92..f6aaa12 100644
--- a/tools/aapt2/io/ZipArchive.cpp
+++ b/tools/aapt2/io/ZipArchive.cpp
@@ -20,6 +20,7 @@
 #include "ziparchive/zip_archive.h"
 
 #include "Source.h"
+#include "trace/TraceBuffer.h"
 #include "util/Files.h"
 #include "util/Util.h"
 
@@ -93,6 +94,7 @@
 
 std::unique_ptr<ZipFileCollection> ZipFileCollection::Create(
     const StringPiece& path, std::string* out_error) {
+  TRACE_CALL();
   constexpr static const int32_t kEmptyArchive = -6;
 
   std::unique_ptr<ZipFileCollection> collection =
diff --git a/tools/aapt2/java/ProguardRules.cpp b/tools/aapt2/java/ProguardRules.cpp
index 52e168e..05ba8f0 100644
--- a/tools/aapt2/java/ProguardRules.cpp
+++ b/tools/aapt2/java/ProguardRules.cpp
@@ -281,6 +281,15 @@
             AddClass(node->line_number, result.value(), "");
           }
         }
+
+        attr = node->FindAttribute(xml::kSchemaAndroid, "zygotePreloadName");
+        if (attr) {
+          Maybe<std::string> result = util::GetFullyQualifiedClassName(package_, attr->value);
+          if (result) {
+            AddClass(node->line_number, result.value(), "");
+          }
+        }
+
         if (main_dex_only_) {
           xml::Attribute* default_process = node->FindAttribute(xml::kSchemaAndroid, "process");
           if (default_process) {
diff --git a/tools/aapt2/java/ProguardRules_test.cpp b/tools/aapt2/java/ProguardRules_test.cpp
index da24907..559b07a 100644
--- a/tools/aapt2/java/ProguardRules_test.cpp
+++ b/tools/aapt2/java/ProguardRules_test.cpp
@@ -42,6 +42,7 @@
             android:appComponentFactory="com.foo.BarAppComponentFactory"
             android:backupAgent="com.foo.BarBackupAgent"
             android:name="com.foo.BarApplication"
+            android:zygotePreloadName="com.foo.BarZygotePreload"
             >
           <activity android:name="com.foo.BarActivity"/>
           <service android:name="com.foo.BarService"/>
@@ -63,6 +64,7 @@
   EXPECT_THAT(actual, HasSubstr("-keep class com.foo.BarReceiver { <init>(); }"));
   EXPECT_THAT(actual, HasSubstr("-keep class com.foo.BarProvider { <init>(); }"));
   EXPECT_THAT(actual, HasSubstr("-keep class com.foo.BarInstrumentation { <init>(); }"));
+  EXPECT_THAT(actual, HasSubstr("-keep class com.foo.BarZygotePreload { <init>(); }"));
 
   actual = GetKeepSetString(set, /** minimal_rules */ true);
   EXPECT_THAT(actual, HasSubstr("-keep class com.foo.BarAppComponentFactory { <init>(); }"));
@@ -73,6 +75,7 @@
   EXPECT_THAT(actual, HasSubstr("-keep class com.foo.BarReceiver { <init>(); }"));
   EXPECT_THAT(actual, HasSubstr("-keep class com.foo.BarProvider { <init>(); }"));
   EXPECT_THAT(actual, HasSubstr("-keep class com.foo.BarInstrumentation { <init>(); }"));
+  EXPECT_THAT(actual, HasSubstr("-keep class com.foo.BarZygotePreload { <init>(); }"));
 }
 
 TEST(ProguardRulesTest, FragmentNameRuleIsEmitted) {
diff --git a/tools/aapt2/link/AutoVersioner.cpp b/tools/aapt2/link/AutoVersioner.cpp
index 960c7d4..73b9254 100644
--- a/tools/aapt2/link/AutoVersioner.cpp
+++ b/tools/aapt2/link/AutoVersioner.cpp
@@ -23,6 +23,7 @@
 #include "ResourceTable.h"
 #include "SdkConstants.h"
 #include "ValueVisitor.h"
+#include "trace/TraceBuffer.h"
 
 using android::ConfigDescription;
 
@@ -70,6 +71,7 @@
 }
 
 bool AutoVersioner::Consume(IAaptContext* context, ResourceTable* table) {
+  TRACE_NAME("AutoVersioner::Consume");
   for (auto& package : table->packages) {
     for (auto& type : package->types) {
       if (type->type != ResourceType::kStyle) {
diff --git a/tools/aapt2/link/ManifestFixer.cpp b/tools/aapt2/link/ManifestFixer.cpp
index 582a5b8..b0a2055 100644
--- a/tools/aapt2/link/ManifestFixer.cpp
+++ b/tools/aapt2/link/ManifestFixer.cpp
@@ -21,6 +21,7 @@
 #include "android-base/logging.h"
 
 #include "ResourceUtils.h"
+#include "trace/TraceBuffer.h"
 #include "util/Util.h"
 #include "xml/XmlActionExecutor.h"
 #include "xml/XmlDom.h"
@@ -451,6 +452,7 @@
 }
 
 bool ManifestFixer::Consume(IAaptContext* context, xml::XmlResource* doc) {
+  TRACE_CALL();
   xml::Element* root = xml::FindRootElement(doc->root.get());
   if (!root || !root->namespace_uri.empty() || root->name != "manifest") {
     context->GetDiagnostics()->Error(DiagMessage(doc->file.source)
diff --git a/tools/aapt2/link/ProductFilter.cpp b/tools/aapt2/link/ProductFilter.cpp
index c1a95ee..793740a 100644
--- a/tools/aapt2/link/ProductFilter.cpp
+++ b/tools/aapt2/link/ProductFilter.cpp
@@ -17,6 +17,7 @@
 #include "link/Linkers.h"
 
 #include "ResourceTable.h"
+#include "trace/TraceBuffer.h"
 
 namespace aapt {
 
@@ -81,6 +82,7 @@
 }
 
 bool ProductFilter::Consume(IAaptContext* context, ResourceTable* table) {
+  TRACE_NAME("ProductFilter::Consume");
   bool error = false;
   for (auto& pkg : table->packages) {
     for (auto& type : pkg->types) {
diff --git a/tools/aapt2/link/ReferenceLinker.cpp b/tools/aapt2/link/ReferenceLinker.cpp
index c2340ba..28f09aa 100644
--- a/tools/aapt2/link/ReferenceLinker.cpp
+++ b/tools/aapt2/link/ReferenceLinker.cpp
@@ -27,6 +27,7 @@
 #include "link/Linkers.h"
 #include "process/IResourceTableConsumer.h"
 #include "process/SymbolTable.h"
+#include "trace/TraceBuffer.h"
 #include "util/Util.h"
 #include "xml/XmlUtil.h"
 
@@ -353,6 +354,7 @@
 }
 
 bool ReferenceLinker::Consume(IAaptContext* context, ResourceTable* table) {
+  TRACE_NAME("ReferenceLinker::Consume");
   EmptyDeclStack decl_stack;
   bool error = false;
   for (auto& package : table->packages) {
diff --git a/tools/aapt2/link/ResourceExcluder.cpp b/tools/aapt2/link/ResourceExcluder.cpp
index 2555995..b3b9dc4 100644
--- a/tools/aapt2/link/ResourceExcluder.cpp
+++ b/tools/aapt2/link/ResourceExcluder.cpp
@@ -20,6 +20,7 @@
 
 #include "DominatorTree.h"
 #include "ResourceTable.h"
+#include "trace/TraceBuffer.h"
 
 using android::ConfigDescription;
 
@@ -65,6 +66,7 @@
 }  // namespace
 
 bool ResourceExcluder::Consume(IAaptContext* context, ResourceTable* table) {
+  TRACE_NAME("ResourceExcluder::Consume");
   for (auto& package : table->packages) {
     for (auto& type : package->types) {
       for (auto& entry : type->entries) {
diff --git a/tools/aapt2/link/TableMerger.cpp b/tools/aapt2/link/TableMerger.cpp
index cc9fed5..e937517 100644
--- a/tools/aapt2/link/TableMerger.cpp
+++ b/tools/aapt2/link/TableMerger.cpp
@@ -21,6 +21,7 @@
 #include "ResourceTable.h"
 #include "ResourceUtils.h"
 #include "ResourceValues.h"
+#include "trace/TraceBuffer.h"
 #include "ValueVisitor.h"
 #include "util/Util.h"
 
@@ -38,6 +39,7 @@
 }
 
 bool TableMerger::Merge(const Source& src, ResourceTable* table, bool overlay) {
+  TRACE_CALL();
   // We allow adding new resources if this is not an overlay, or if the options allow overlays
   // to add new resources.
   return MergeImpl(src, table, overlay, options_.auto_add_overlay || !overlay /*allow_new*/);
diff --git a/tools/aapt2/link/XmlReferenceLinker.cpp b/tools/aapt2/link/XmlReferenceLinker.cpp
index 160ff92..d68f7dd 100644
--- a/tools/aapt2/link/XmlReferenceLinker.cpp
+++ b/tools/aapt2/link/XmlReferenceLinker.cpp
@@ -25,6 +25,7 @@
 #include "link/ReferenceLinker.h"
 #include "process/IResourceTableConsumer.h"
 #include "process/SymbolTable.h"
+#include "trace/TraceBuffer.h"
 #include "util/Util.h"
 #include "xml/XmlDom.h"
 
@@ -151,6 +152,7 @@
 }  // namespace
 
 bool XmlReferenceLinker::Consume(IAaptContext* context, xml::XmlResource* resource) {
+  TRACE_NAME("XmlReferenceLinker::Consume");
   CallSite callsite{resource->file.name.package};
 
   std::string out_name = resource->file.name.entry;
diff --git a/tools/aapt2/optimize/ResourceDeduper.cpp b/tools/aapt2/optimize/ResourceDeduper.cpp
index ee2dfbc..78ebcb9 100644
--- a/tools/aapt2/optimize/ResourceDeduper.cpp
+++ b/tools/aapt2/optimize/ResourceDeduper.cpp
@@ -20,6 +20,7 @@
 
 #include "DominatorTree.h"
 #include "ResourceTable.h"
+#include "trace/TraceBuffer.h"
 
 using android::ConfigDescription;
 
@@ -110,6 +111,7 @@
 }  // namespace
 
 bool ResourceDeduper::Consume(IAaptContext* context, ResourceTable* table) {
+  TRACE_CALL();
   for (auto& package : table->packages) {
     for (auto& type : package->types) {
       for (auto& entry : type->entries) {
diff --git a/tools/aapt2/optimize/VersionCollapser.cpp b/tools/aapt2/optimize/VersionCollapser.cpp
index f985604..cd791bd 100644
--- a/tools/aapt2/optimize/VersionCollapser.cpp
+++ b/tools/aapt2/optimize/VersionCollapser.cpp
@@ -20,6 +20,7 @@
 #include <vector>
 
 #include "ResourceTable.h"
+#include "trace/TraceBuffer.h"
 
 using android::ConfigDescription;
 
@@ -144,6 +145,7 @@
 }
 
 bool VersionCollapser::Consume(IAaptContext* context, ResourceTable* table) {
+  TRACE_NAME("VersionCollapser::Consume");
   const int min_sdk = context->GetMinSdkVersion();
   for (auto& package : table->packages) {
     for (auto& type : package->types) {
diff --git a/tools/aapt2/process/SymbolTable.cpp b/tools/aapt2/process/SymbolTable.cpp
index 78e0074..61a8fbb 100644
--- a/tools/aapt2/process/SymbolTable.cpp
+++ b/tools/aapt2/process/SymbolTable.cpp
@@ -30,6 +30,7 @@
 #include "Resource.h"
 #include "ResourceUtils.h"
 #include "ValueVisitor.h"
+#include "trace/TraceBuffer.h"
 #include "util/Util.h"
 
 using ::android::ApkAssets;
@@ -217,6 +218,7 @@
 }
 
 bool AssetManagerSymbolSource::AddAssetPath(const StringPiece& path) {
+  TRACE_CALL();
   if (std::unique_ptr<const ApkAssets> apk = ApkAssets::Load(path.data())) {
     apk_assets_.push_back(std::move(apk));
 
@@ -233,6 +235,7 @@
 }
 
 std::map<size_t, std::string> AssetManagerSymbolSource::GetAssignedPackageIds() const {
+  TRACE_CALL();
   std::map<size_t, std::string> package_map;
   asset_manager_.ForEachPackage([&package_map](const std::string& name, uint8_t id) -> bool {
     package_map.insert(std::make_pair(id, name));
diff --git a/tools/aapt2/split/TableSplitter.cpp b/tools/aapt2/split/TableSplitter.cpp
index 24cd5ba..6a67271 100644
--- a/tools/aapt2/split/TableSplitter.cpp
+++ b/tools/aapt2/split/TableSplitter.cpp
@@ -27,6 +27,7 @@
 #include "androidfw/ConfigDescription.h"
 
 #include "ResourceTable.h"
+#include "trace/TraceBuffer.h"
 #include "util/Util.h"
 
 using ::android::ConfigDescription;
@@ -154,6 +155,7 @@
   }
 }
 bool TableSplitter::VerifySplitConstraints(IAaptContext* context) {
+  TRACE_CALL();
   bool error = false;
   for (size_t i = 0; i < split_constraints_.size(); i++) {
     if (split_constraints_[i].configs.size() == 0) {
diff --git a/tools/aapt2/trace/TraceBuffer.cpp b/tools/aapt2/trace/TraceBuffer.cpp
new file mode 100644
index 0000000..b4b31d9
--- /dev/null
+++ b/tools/aapt2/trace/TraceBuffer.cpp
@@ -0,0 +1,151 @@
+/*
+ * Copyright (C) 2019 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.
+ */
+
+#include "TraceBuffer.h"
+
+#include <chrono>
+#include <sstream>
+#include <unistd.h>
+#include <vector>
+
+#include <inttypes.h>
+
+#include "android-base/utf8.h"
+
+#include "util/Files.h"
+
+namespace aapt {
+namespace tracebuffer {
+
+namespace {
+
+constexpr char kBegin = 'B';
+constexpr char kEnd = 'E';
+
+struct TracePoint {
+  pid_t tid;
+  int64_t time;
+  std::string tag;
+  char type;
+};
+
+std::vector<TracePoint> traces;
+
+int64_t GetTime() noexcept {
+  auto now = std::chrono::steady_clock::now();
+  return std::chrono::duration_cast<std::chrono::microseconds>(now.time_since_epoch()).count();
+}
+
+} // namespace anonymous
+
+void AddWithTime(const std::string& tag, char type, int64_t time) noexcept {
+  TracePoint t = {getpid(), time, tag, type};
+  traces.emplace_back(t);
+}
+
+void Add(const std::string& tag, char type) noexcept {
+  AddWithTime(tag, type, GetTime());
+}
+
+
+
+
+void Flush(const std::string& basePath) {
+  TRACE_CALL();
+  if (basePath.empty()) {
+    return;
+  }
+
+  std::stringstream s;
+  s << basePath << aapt::file::sDirSep << "report_aapt2_" << getpid() << ".json";
+  FILE* f = android::base::utf8::fopen(s.str().c_str(), "a");
+  if (f == nullptr) {
+    return;
+  }
+
+  for(const TracePoint& trace : traces) {
+    fprintf(f, "{\"ts\" : \"%" PRIu64 "\", \"ph\" : \"%c\", \"tid\" : \"%d\" , \"pid\" : \"%d\", "
+            "\"name\" : \"%s\" },\n", trace.time, trace.type, 0, trace.tid, trace.tag.c_str());
+  }
+  fclose(f);
+  traces.clear();
+}
+
+} // namespace tracebuffer
+
+void BeginTrace(const std::string& tag) {
+  tracebuffer::Add(tag, tracebuffer::kBegin);
+}
+
+void EndTrace() {
+  tracebuffer::Add("", tracebuffer::kEnd);
+}
+
+Trace::Trace(const std::string& tag) {
+  tracebuffer::Add(tag, tracebuffer::kBegin);
+}
+
+Trace::Trace(const std::string& tag, const std::vector<android::StringPiece>& args) {
+  std::stringstream s;
+  s << tag;
+  s << " ";
+  for (auto& arg : args) {
+    s << arg.to_string();
+    s << " ";
+  }
+  tracebuffer::Add(s.str(), tracebuffer::kBegin);
+}
+
+Trace::~Trace() {
+  tracebuffer::Add("", tracebuffer::kEnd);
+}
+
+FlushTrace::FlushTrace(const std::string& basepath, const std::string& tag)
+    : basepath_(basepath)  {
+  tracebuffer::Add(tag, tracebuffer::kBegin);
+}
+
+FlushTrace::FlushTrace(const std::string& basepath, const std::string& tag,
+    const std::vector<android::StringPiece>& args) : basepath_(basepath) {
+  std::stringstream s;
+  s << tag;
+  s << " ";
+  for (auto& arg : args) {
+    s << arg.to_string();
+    s << " ";
+  }
+  tracebuffer::Add(s.str(), tracebuffer::kBegin);
+}
+
+FlushTrace::FlushTrace(const std::string& basepath, const std::string& tag,
+    const std::vector<std::string>& args) : basepath_(basepath){
+  std::stringstream s;
+  s << tag;
+  s << " ";
+  for (auto& arg : args) {
+    s << arg;
+    s << " ";
+  }
+  tracebuffer::Add(s.str(), tracebuffer::kBegin);
+}
+
+FlushTrace::~FlushTrace() {
+  tracebuffer::Add("", tracebuffer::kEnd);
+  tracebuffer::Flush(basepath_);
+}
+
+} // namespace aapt
+
diff --git a/tools/aapt2/trace/TraceBuffer.h b/tools/aapt2/trace/TraceBuffer.h
new file mode 100644
index 0000000..8618e0e
--- /dev/null
+++ b/tools/aapt2/trace/TraceBuffer.h
@@ -0,0 +1,64 @@
+/*
+ * Copyright (C) 2019 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.
+ */
+
+#ifndef AAPT_TRACEBUFFER_H
+#define AAPT_TRACEBUFFER_H
+
+#include <string>
+#include <vector>
+
+#include <androidfw/StringPiece.h>
+
+namespace aapt {
+
+// Record timestamps for beginning and end of a task and generate systrace json fragments.
+// This is an in-process ftrace which has the advantage of being platform independent.
+// These methods are NOT thread-safe since aapt2 is not multi-threaded.
+
+// Convenience RIAA object to automatically finish an event when object goes out of scope.
+class Trace {
+public:
+  Trace(const std::string& tag);
+  Trace(const std::string& tag, const std::vector<android::StringPiece>& args);
+  ~Trace();
+};
+
+// Manual markers.
+void BeginTrace(const std::string& tag);
+void EndTrace();
+
+// A master trace is required to flush events to disk. Events are formatted in systrace
+// json format.
+class FlushTrace {
+public:
+  explicit FlushTrace(const std::string& basepath, const std::string& tag);
+  explicit FlushTrace(const std::string& basepath, const std::string& tag,
+      const std::vector<android::StringPiece>& args);
+  explicit FlushTrace(const std::string& basepath, const std::string& tag,
+      const std::vector<std::string>& args);
+  ~FlushTrace();
+private:
+  std::string basepath_;
+};
+
+#define TRACE_CALL() Trace __t(__func__)
+#define TRACE_NAME(tag) Trace __t(tag)
+#define TRACE_NAME_ARGS(tag, args) Trace __t(tag, args)
+
+#define TRACE_FLUSH(basename, tag) FlushTrace __t(basename, tag)
+#define TRACE_FLUSH_ARGS(basename, tag, args) FlushTrace __t(basename, tag, args)
+} // namespace aapt
+#endif //AAPT_TRACEBUFFER_H
diff --git a/tools/aapt2/xml/XmlDom.cpp b/tools/aapt2/xml/XmlDom.cpp
index acd07c2..9a725fa 100644
--- a/tools/aapt2/xml/XmlDom.cpp
+++ b/tools/aapt2/xml/XmlDom.cpp
@@ -26,6 +26,7 @@
 #include "android-base/logging.h"
 
 #include "ResourceUtils.h"
+#include "trace/TraceBuffer.h"
 #include "XmlPullParser.h"
 #include "util/Util.h"
 
@@ -264,6 +265,7 @@
 }
 
 std::unique_ptr<XmlResource> Inflate(const void* data, size_t len, std::string* out_error) {
+  TRACE_CALL();
   // We import the android namespace because on Windows NO_ERROR is a macro, not
   // an enum, which causes errors when qualifying it with android::
   using namespace android;
diff --git a/tools/apilint/apilint.py b/tools/apilint/apilint.py
index 4c02d94..f967c2f 100644
--- a/tools/apilint/apilint.py
+++ b/tools/apilint/apilint.py
@@ -79,6 +79,7 @@
                 self.value = raw[3].strip(';"')
             else:
                 self.value = None
+            self.annotations = []
 
         self.ident = "-".join((self.typ, self.name, self.value or ""))
 
@@ -88,6 +89,18 @@
     def __repr__(self):
         return self.raw
 
+
+class Argument(object):
+
+    __slots__ = ["type", "annotations", "name", "default"]
+
+    def __init__(self, type):
+        self.type = type
+        self.annotations = []
+        self.name = None
+        self.default = None
+
+
 class Method():
     def __init__(self, clazz, line, raw, blame, sig_format = 1):
         self.clazz = clazz
@@ -118,21 +131,24 @@
             self.name = raw[1]
 
             # parse args
-            self.args = []
+            self.detailed_args = []
             for arg in re.split(",\s*", raw_args):
                 arg = re.split("\s", arg)
                 # ignore annotations for now
                 arg = [ a for a in arg if not a.startswith("@") ]
                 if len(arg[0]) > 0:
-                    self.args.append(arg[0])
+                    self.detailed_args.append(Argument(arg[0]))
 
             # parse throws
             self.throws = []
             for throw in re.split(",\s*", raw_throws):
                 self.throws.append(throw)
+
+            self.annotations = []
         else:
             raise ValueError("Unknown signature format: " + sig_format)
 
+        self.args = map(lambda a: a.type, self.detailed_args)
         self.ident = "-".join((self.typ, self.name, "-".join(self.args)))
 
     def sig_matches(self, typ, name, args):
@@ -154,6 +170,7 @@
         self.ctors = []
         self.fields = []
         self.methods = []
+        self.annotations = []
 
         if sig_format == 2:
             V2LineParser(raw).parse_into_class(self)
@@ -180,8 +197,10 @@
 
             if "implements" in raw:
                 self.implements = raw[raw.index("implements")+1]
+                self.implements_all = [self.implements]
             else:
                 self.implements = None
+                self.implements_all = []
         else:
             raise ValueError("Unknown signature format: " + sig_format)
 
@@ -208,7 +227,7 @@
 
 
 class Package():
-    NAME = re.compile("package(?: .*)? ([A-Za-z.]+)")
+    NAME = re.compile("package(?: .*)? ([A-Za-z0-9.]+)")
 
     def __init__(self, line, raw, blame):
         self.line = line
@@ -312,10 +331,10 @@
         method.split = []
         kind = self.parse_one_of("ctor", "method")
         method.split.append(kind)
-        annotations = self.parse_annotations()
+        method.annotations = self.parse_annotations()
         method.split.extend(self.parse_modifiers())
         self.parse_matching_paren("<", ">")
-        if "@Deprecated" in annotations:
+        if "@Deprecated" in method.annotations:
             method.split.append("deprecated")
         if kind == "ctor":
             method.typ = "ctor"
@@ -325,7 +344,7 @@
         method.name = self.parse_name()
         method.split.append(method.name)
         self.parse_token("(")
-        method.args = self.parse_args()
+        method.detailed_args = self.parse_args()
         self.parse_token(")")
         method.throws = self.parse_throws()
         if "@interface" in method.clazz.split:
@@ -335,8 +354,8 @@
 
     def parse_into_class(self, clazz):
         clazz.split = []
-        annotations = self.parse_annotations()
-        if "@Deprecated" in annotations:
+        clazz.annotations = self.parse_annotations()
+        if "@Deprecated" in clazz.annotations:
             clazz.split.append("deprecated")
         clazz.split.extend(self.parse_modifiers())
         kind = self.parse_one_of("class", "interface", "@interface", "enum")
@@ -348,20 +367,20 @@
         self.parse_matching_paren("<", ">")
         extends = self.parse_extends()
         clazz.extends = extends[0] if extends else None
-        implements = self.parse_implements()
-        clazz.implements = implements[0] if implements else None
+        clazz.implements_all = self.parse_implements()
         # The checks assume that interfaces are always found in implements, which isn't true for
         # subinterfaces.
-        if not implements and "interface" in clazz.split:
-            clazz.implements = clazz.extends
+        if not clazz.implements_all and "interface" in clazz.split:
+            clazz.implements_all = [clazz.extends]
+        clazz.implements = clazz.implements_all[0] if clazz.implements_all else None
         self.parse_token("{")
         self.parse_eof()
 
     def parse_into_field(self, field):
         kind = self.parse_one_of(*V2LineParser.FIELD_KINDS)
         field.split = [kind]
-        annotations = self.parse_annotations()
-        if "@Deprecated" in annotations:
+        field.annotations = self.parse_annotations()
+        if "@Deprecated" in field.annotations:
             field.split.append("deprecated")
         field.split.extend(self.parse_modifiers())
         field.typ = self.parse_type()
@@ -488,15 +507,16 @@
 
     def parse_arg(self):
         self.parse_if("vararg")  # kotlin vararg
-        self.parse_annotations()
-        type = self.parse_arg_type()
+        annotations = self.parse_annotations()
+        arg = Argument(self.parse_arg_type())
+        arg.annotations = annotations
         l = self.lookahead()
         if l != "," and l != ")":
             if self.lookahead() != '=':
-                self.parse_token()  # kotlin argument name
+                arg.name = self.parse_token()  # kotlin argument name
             if self.parse_if('='): # kotlin default value
-                self.parse_expression()
-        return type
+                arg.default = self.parse_expression()
+        return arg
 
     def parse_expression(self):
         while not self.lookahead() in [')', ',', ';']:
@@ -593,7 +613,7 @@
     blame = None
     sig_format = 1
 
-    re_blame = re.compile("^([a-z0-9]{7,}) \(<([^>]+)>.+?\) (.+?)$")
+    re_blame = re.compile(r"^(\^?[a-z0-9]{7,}) \(<([^>]+)>.+?\) (.+?)$")
 
     field_prefixes = map(lambda kind: "    %s" % (kind,), V2LineParser.FIELD_KINDS)
     def startsWithFieldPrefix(raw):
@@ -608,11 +628,13 @@
         match = re_blame.match(raw)
         if match is not None:
             blame = match.groups()[0:2]
+            if blame[0].startswith("^"):  # Outside of blame range
+              blame = None
             raw = match.groups()[2]
         else:
             blame = None
 
-        if line == 1 and raw.startswith("// Signature format: "):
+        if line == 1 and V2Tokenizer.SIGNATURE_PREFIX in raw:
             sig_format_string = raw[len(V2Tokenizer.SIGNATURE_PREFIX):]
             if sig_format_string in ["2.0", "3.0"]:
                 sig_format = 2
@@ -742,6 +764,14 @@
     noticed[clazz.fullname] = hash(clazz)
 
 
+verifiers = {}
+
+def verifier(f):
+    verifiers[f.__name__] = f
+    return f
+
+
+@verifier
 def verify_constants(clazz):
     """All static final constants must be FOO_NAME style."""
     if re.match("android\.R\.[a-z]+", clazz.fullname): return
@@ -759,13 +789,13 @@
             if f.typ in req and f.value is None:
                 error(clazz, f, None, "All constants must be defined at compile time")
 
-
+@verifier
 def verify_enums(clazz):
     """Enums are bad, mmkay?"""
     if clazz.extends == "java.lang.Enum" or "enum" in clazz.split:
         error(clazz, None, "F5", "Enums are not allowed")
 
-
+@verifier
 def verify_class_names(clazz):
     """Try catching malformed class names like myMtp or MTPUser."""
     if clazz.fullname.startswith("android.opengl"): return
@@ -780,6 +810,7 @@
         error(clazz, None, None, "Don't expose your implementation details")
 
 
+@verifier
 def verify_method_names(clazz):
     """Try catching malformed method names, like Foo() or getMTU()."""
     if clazz.fullname.startswith("android.opengl"): return
@@ -793,9 +824,9 @@
             error(clazz, m, "S1", "Method name must start with lowercase char")
 
 
+@verifier
 def verify_callbacks(clazz):
     """Verify Callback classes.
-    All callback classes must be abstract.
     All methods must follow onFoo() naming style."""
     if clazz.fullname == "android.speech.tts.SynthesisCallback": return
 
@@ -805,14 +836,12 @@
         warn(clazz, None, "L1", "Class should be named FooCallback")
 
     if clazz.name.endswith("Callback"):
-        if "interface" in clazz.split:
-            error(clazz, None, "CL3", "Callbacks must be abstract class to enable extension in future API levels")
-
         for m in clazz.methods:
             if not re.match("on[A-Z][a-z]*", m.name):
                 error(clazz, m, "L1", "Callback method names must be onFoo() style")
 
 
+@verifier
 def verify_listeners(clazz):
     """Verify Listener classes.
     All Listener classes must be interface.
@@ -834,6 +863,7 @@
                 error(clazz, m, "L1", "Single listener method name must match class name")
 
 
+@verifier
 def verify_actions(clazz):
     """Verify intent actions.
     All action names must be named ACTION_FOO.
@@ -865,6 +895,7 @@
                         error(clazz, f, "C4", "Inconsistent action value; expected '%s'" % (expected))
 
 
+@verifier
 def verify_extras(clazz):
     """Verify intent extras.
     All extra names must be named EXTRA_FOO.
@@ -895,6 +926,7 @@
                         error(clazz, f, "C4", "Inconsistent extra value; expected '%s'" % (expected))
 
 
+@verifier
 def verify_equals(clazz):
     """Verify that equals() and hashCode() must be overridden together."""
     eq = False
@@ -907,6 +939,7 @@
         error(clazz, None, "M8", "Must override both equals and hashCode; missing one")
 
 
+@verifier
 def verify_parcelable(clazz):
     """Verify that Parcelable objects aren't hiding required bits."""
     if clazz.implements == "android.os.Parcelable":
@@ -925,6 +958,7 @@
                 error(clazz, c, "FW3", "Parcelable inflation is exposed through CREATOR, not raw constructors")
 
 
+@verifier
 def verify_protected(clazz):
     """Verify that no protected methods or fields are allowed."""
     for m in clazz.methods:
@@ -936,6 +970,7 @@
             error(clazz, f, "M7", "Protected fields not allowed; must be public")
 
 
+@verifier
 def verify_fields(clazz):
     """Verify that all exposed fields are final.
     Exposed fields must follow myName style.
@@ -981,6 +1016,7 @@
                 error(clazz, f, "C2", "Constants must be marked static final")
 
 
+@verifier
 def verify_register(clazz):
     """Verify parity of registration methods.
     Callback objects use register/unregister methods.
@@ -1014,6 +1050,7 @@
                 error(clazz, m, "L3", "Listener methods should be named add/remove")
 
 
+@verifier
 def verify_sync(clazz):
     """Verify synchronized methods aren't exposed."""
     for m in clazz.methods:
@@ -1021,6 +1058,7 @@
             error(clazz, m, "M5", "Internal locks must not be exposed")
 
 
+@verifier
 def verify_intent_builder(clazz):
     """Verify that Intent builders are createFooIntent() style."""
     if clazz.name == "Intent": return
@@ -1033,6 +1071,7 @@
                 warn(clazz, m, "FW1", "Methods creating an Intent should be named createFooIntent()")
 
 
+@verifier
 def verify_helper_classes(clazz):
     """Verify that helper classes are named consistently with what they extend.
     All developer extendable methods should be named onFoo()."""
@@ -1081,6 +1120,7 @@
                     warn(clazz, m, None, "If implemented by developer, should be named onFoo(); otherwise consider marking final")
 
 
+@verifier
 def verify_builder(clazz):
     """Verify builder classes.
     Methods should return the builder to enable chaining."""
@@ -1109,13 +1149,18 @@
     if not has_build:
         warn(clazz, None, None, "Missing build() method")
 
+    if "final" not in clazz.split:
+        error(clazz, None, None, "Builder should be final")
 
+
+@verifier
 def verify_aidl(clazz):
     """Catch people exposing raw AIDL."""
     if clazz.extends == "android.os.Binder" or clazz.implements == "android.os.IInterface":
         error(clazz, None, None, "Raw AIDL interfaces must not be exposed")
 
 
+@verifier
 def verify_internal(clazz):
     """Catch people exposing internal classes."""
     if clazz.pkg.name.startswith("com.android"):
@@ -1150,6 +1195,7 @@
     "android.util"
 ])
 
+@verifier
 def verify_layering(clazz):
     """Catch package layering violations.
     For example, something in android.os depending on android.app."""
@@ -1184,6 +1230,7 @@
                 warn(clazz, m, "FW6", "Method argument type violates package layering")
 
 
+@verifier
 def verify_boolean(clazz):
     """Verifies that boolean accessors are named correctly.
     For example, hasFoo() and setHasFoo()."""
@@ -1224,9 +1271,11 @@
                 error_if_exists(sets, m.name, expected, "has" + target)
 
 
+@verifier
 def verify_collections(clazz):
     """Verifies that collection types are interfaces."""
     if clazz.fullname == "android.os.Bundle": return
+    if clazz.fullname == "android.os.Parcel": return
 
     bad = ["java.util.Vector", "java.util.LinkedList", "java.util.ArrayList", "java.util.Stack",
            "java.util.HashMap", "java.util.HashSet", "android.util.ArraySet", "android.util.ArrayMap"]
@@ -1238,6 +1287,23 @@
                 error(clazz, m, "CL2", "Argument is concrete collection; must be higher-level interface")
 
 
+@verifier
+def verify_uris(clazz):
+    bad = ["java.net.URL", "java.net.URI", "android.net.URL"]
+
+    for f in clazz.fields:
+        if f.typ in bad:
+            error(clazz, f, None, "Field must be android.net.Uri instead of " + f.typ)
+
+    for m in clazz.methods + clazz.ctors:
+        if m.typ in bad:
+            error(clazz, m, None, "Must return android.net.Uri instead of " + m.typ)
+        for arg in m.args:
+            if arg in bad:
+                error(clazz, m, None, "Argument must take android.net.Uri instead of " + arg)
+
+
+@verifier
 def verify_flags(clazz):
     """Verifies that flags are non-overlapping."""
     known = collections.defaultdict(int)
@@ -1254,6 +1320,7 @@
             known[scope] |= val
 
 
+@verifier
 def verify_exception(clazz):
     """Verifies that methods don't throw generic exceptions."""
     for m in clazz.methods:
@@ -1262,17 +1329,19 @@
                 error(clazz, m, "S1", "Methods must not throw generic exceptions")
 
             if t in ["android.os.RemoteException"]:
-                if clazz.name == "android.content.ContentProviderClient": continue
-                if clazz.name == "android.os.Binder": continue
-                if clazz.name == "android.os.IBinder": continue
+                if clazz.fullname == "android.content.ContentProviderClient": continue
+                if clazz.fullname == "android.os.Binder": continue
+                if clazz.fullname == "android.os.IBinder": continue
 
                 error(clazz, m, "FW9", "Methods calling into system server should rethrow RemoteException as RuntimeException")
 
             if len(m.args) == 0 and t in ["java.lang.IllegalArgumentException", "java.lang.NullPointerException"]:
                 warn(clazz, m, "S1", "Methods taking no arguments should throw IllegalStateException")
 
+
 GOOGLE_IGNORECASE = re.compile("google", re.IGNORECASE)
 
+# Not marked as @verifier, because it is only conditionally applied.
 def verify_google(clazz):
     """Verifies that APIs never reference Google."""
 
@@ -1285,6 +1354,7 @@
                 error(clazz, t, None, "Must never reference Google")
 
 
+@verifier
 def verify_bitset(clazz):
     """Verifies that we avoid using heavy BitSet."""
 
@@ -1300,6 +1370,7 @@
                 error(clazz, m, None, "Argument type must not be heavy BitSet")
 
 
+@verifier
 def verify_manager(clazz):
     """Verifies that FooManager is only obtained from Context."""
 
@@ -1313,6 +1384,7 @@
             error(clazz, m, None, "Managers must always be obtained from Context")
 
 
+@verifier
 def verify_boxed(clazz):
     """Verifies that methods avoid boxed primitives."""
 
@@ -1335,6 +1407,7 @@
                 error(clazz, m, "M11", "Must avoid boxed primitives")
 
 
+@verifier
 def verify_static_utils(clazz):
     """Verifies that helper classes can't be constructed."""
     if clazz.fullname.startswith("android.opengl"): return
@@ -1354,6 +1427,7 @@
         error(clazz, None, None, "Fully-static utility classes must not have constructor")
 
 
+# @verifier  # Disabled for now
 def verify_overload_args(clazz):
     """Verifies that method overloads add new arguments at the end."""
     if clazz.fullname.startswith("android.opengl"): return
@@ -1394,6 +1468,7 @@
                 error(clazz, m, "M2", "Expected consistent argument ordering between overloads: %s..." % (", ".join(locked_sig)))
 
 
+@verifier
 def verify_callback_handlers(clazz):
     """Verifies that methods adding listener/callback have overload
     for specifying delivery thread."""
@@ -1445,6 +1520,7 @@
             warn(clazz, f, "L1", "Registration methods should have overload that accepts delivery Executor")
 
 
+@verifier
 def verify_context_first(clazz):
     """Verifies that methods accepting a Context keep it the first argument."""
     examine = clazz.ctors + clazz.methods
@@ -1457,6 +1533,7 @@
                 error(clazz, m, "M3", "ContentResolver is distinct, so it must be the first argument")
 
 
+@verifier
 def verify_listener_last(clazz):
     """Verifies that methods accepting a Listener or Callback keep them as last arguments."""
     examine = clazz.ctors + clazz.methods
@@ -1470,6 +1547,7 @@
                 warn(clazz, m, "M3", "Listeners should always be at end of argument list")
 
 
+@verifier
 def verify_resource_names(clazz):
     """Verifies that resource names have consistent case."""
     if not re.match("android\.R\.[a-z]+", clazz.fullname): return
@@ -1501,6 +1579,7 @@
             error(clazz, f, "C7", "Expected resource name in this class to be FooBar_Baz style")
 
 
+@verifier
 def verify_files(clazz):
     """Verifies that methods accepting File also accept streams."""
 
@@ -1522,6 +1601,7 @@
             warn(clazz, m, "M10", "Methods accepting File should also accept FileDescriptor or streams")
 
 
+@verifier
 def verify_manager_list(clazz):
     """Verifies that managers return List<? extends Parcelable> instead of arrays."""
 
@@ -1532,6 +1612,7 @@
             warn(clazz, m, None, "Methods should return List<? extends Parcelable> instead of Parcelable[] to support ParceledListSlice under the hood")
 
 
+@verifier
 def verify_abstract_inner(clazz):
     """Verifies that abstract inner classes are static."""
 
@@ -1540,6 +1621,7 @@
             warn(clazz, None, None, "Abstract inner classes should be static to improve testability")
 
 
+@verifier
 def verify_runtime_exceptions(clazz):
     """Verifies that runtime exceptions aren't listed in throws."""
 
@@ -1584,6 +1666,7 @@
                 error(clazz, m, None, "Methods must not mention RuntimeException subclasses in throws clauses")
 
 
+@verifier
 def verify_error(clazz):
     """Verifies that we always use Exception instead of Error."""
     if not clazz.extends: return
@@ -1593,6 +1676,7 @@
         error(clazz, None, None, "Exceptions must be named FooException")
 
 
+@verifier
 def verify_units(clazz):
     """Verifies that we use consistent naming for units."""
 
@@ -1629,10 +1713,11 @@
             error(clazz, m, None, "Percentage must use ints")
 
 
+@verifier
 def verify_closable(clazz):
     """Verifies that classes are AutoClosable."""
-    if clazz.implements == "java.lang.AutoCloseable": return
-    if clazz.implements == "java.io.Closeable": return
+    if "java.lang.AutoCloseable" in clazz.implements_all: return
+    if "java.io.Closeable" in clazz.implements_all: return
 
     for m in clazz.methods:
         if len(m.args) > 0: continue
@@ -1641,6 +1726,7 @@
             return
 
 
+@verifier
 def verify_member_name_not_kotlin_keyword(clazz):
     """Prevent method names which are keywords in Kotlin."""
 
@@ -1666,6 +1752,7 @@
             error(clazz, f, None, "Field name must not be a Kotlin keyword")
 
 
+@verifier
 def verify_method_name_not_kotlin_operator(clazz):
     """Warn about method names which become operators in Kotlin."""
 
@@ -1715,6 +1802,7 @@
             unique_binary_op(m, m.name[:-6])  # Remove 'Assign' suffix
 
 
+@verifier
 def verify_collections_over_arrays(clazz):
     """Warn that [] should be Collections."""
 
@@ -1730,6 +1818,7 @@
                 warn(clazz, m, None, "Method argument should be Collection<> (or subclass) instead of raw array")
 
 
+@verifier
 def verify_user_handle(clazz):
     """Methods taking UserHandle should be ForUser or AsUser."""
     if clazz.name.endswith("Listener") or clazz.name.endswith("Callback") or clazz.name.endswith("Callbacks"): return
@@ -1754,6 +1843,7 @@
                  "or 'queryFooForUser'")
 
 
+@verifier
 def verify_params(clazz):
     """Parameter classes should be 'Params'."""
     if clazz.name.endswith("Params"): return
@@ -1769,6 +1859,7 @@
             error(clazz, None, None, "Classes holding a set of parameters should be called 'FooParams'")
 
 
+@verifier
 def verify_services(clazz):
     """Service name should be FOO_BAR_SERVICE = 'foo_bar'."""
     if clazz.fullname != "android.content.Context": return
@@ -1782,6 +1873,7 @@
                 error(clazz, f, "C4", "Inconsistent service value; expected '%s'" % (expected))
 
 
+@verifier
 def verify_tense(clazz):
     """Verify tenses of method names."""
     if clazz.fullname.startswith("android.opengl"): return
@@ -1791,6 +1883,7 @@
             warn(clazz, m, None, "Unexpected tense; probably meant 'enabled'")
 
 
+@verifier
 def verify_icu(clazz):
     """Verifies that richer ICU replacements are used."""
     better = {
@@ -1822,6 +1915,7 @@
                 warn(clazz, m, None, "Type %s should be replaced with richer ICU type %s" % (arg, better[arg]))
 
 
+@verifier
 def verify_clone(clazz):
     """Verify that clone() isn't implemented; see EJ page 61."""
     for m in clazz.methods:
@@ -1829,8 +1923,12 @@
             error(clazz, m, None, "Provide an explicit copy constructor instead of implementing clone()")
 
 
+@verifier
 def verify_pfd(clazz):
     """Verify that android APIs use PFD over FD."""
+    if clazz.fullname == "android.os.FileUtils" or clazz.fullname == "android.system.Os":
+        return
+
     examine = clazz.ctors + clazz.methods
     for m in examine:
         if m.typ == "java.io.FileDescriptor":
@@ -1847,6 +1945,7 @@
             error(clazz, f, "FW11", "Must use ParcelFileDescriptor")
 
 
+@verifier
 def verify_numbers(clazz):
     """Discourage small numbers types like short and byte."""
 
@@ -1869,6 +1968,49 @@
                 warn(clazz, m, "FW12", "Should avoid odd sized primitives; use int instead")
 
 
+PRIMITIVES = {"void", "int", "float", "boolean", "short", "char", "byte", "long", "double"}
+
+@verifier
+def verify_nullability(clazz):
+    """Catches missing nullability annotations"""
+
+    for f in clazz.fields:
+        if f.value is not None and 'static' in f.split and 'final' in f.split:
+            continue  # Nullability of constants can be inferred.
+        if f.typ not in PRIMITIVES and not has_nullability(f.annotations):
+            error(clazz, f, "M12", "Field must be marked either @NonNull or @Nullable")
+
+    for c in clazz.ctors:
+        verify_nullability_args(clazz, c)
+
+    for m in clazz.methods:
+        if m.name == "writeToParcel" or m.name == "onReceive":
+            continue  # Parcelable.writeToParcel() and BroadcastReceiver.onReceive() are not yet annotated
+
+        if m.typ not in PRIMITIVES and not has_nullability(m.annotations):
+            error(clazz, m, "M12", "Return value must be marked either @NonNull or @Nullable")
+        verify_nullability_args(clazz, m)
+
+def verify_nullability_args(clazz, m):
+    for i, arg in enumerate(m.detailed_args):
+        if arg.type not in PRIMITIVES and not has_nullability(arg.annotations):
+            error(clazz, m, "M12", "Argument %d must be marked either @NonNull or @Nullable" % (i+1,))
+
+def has_nullability(annotations):
+    return "@NonNull" in annotations or "@Nullable" in annotations
+
+
+@verifier
+def verify_intdef(clazz):
+    """intdefs must be @hide, because the constant names cannot be stored in
+       the stubs (only the values are, which is not useful)"""
+    if "@interface" not in clazz.split:
+        return
+    if "@IntDef" in clazz.annotations or "@LongDef" in clazz.annotations:
+        error(clazz, None, None, "@IntDef and @LongDef annotations must be @hide")
+
+
+@verifier
 def verify_singleton(clazz):
     """Catch singleton objects with constructors."""
 
@@ -1903,59 +2045,10 @@
 
     if not is_interesting(clazz): return
 
-    verify_constants(clazz)
-    verify_enums(clazz)
-    verify_class_names(clazz)
-    verify_method_names(clazz)
-    verify_callbacks(clazz)
-    verify_listeners(clazz)
-    verify_actions(clazz)
-    verify_extras(clazz)
-    verify_equals(clazz)
-    verify_parcelable(clazz)
-    verify_protected(clazz)
-    verify_fields(clazz)
-    verify_register(clazz)
-    verify_sync(clazz)
-    verify_intent_builder(clazz)
-    verify_helper_classes(clazz)
-    verify_builder(clazz)
-    verify_aidl(clazz)
-    verify_internal(clazz)
-    verify_layering(clazz)
-    verify_boolean(clazz)
-    verify_collections(clazz)
-    verify_flags(clazz)
-    verify_exception(clazz)
+    for v in verifiers.itervalues():
+        v(clazz)
+
     if not ALLOW_GOOGLE: verify_google(clazz)
-    verify_bitset(clazz)
-    verify_manager(clazz)
-    verify_boxed(clazz)
-    verify_static_utils(clazz)
-    # verify_overload_args(clazz)
-    verify_callback_handlers(clazz)
-    verify_context_first(clazz)
-    verify_listener_last(clazz)
-    verify_resource_names(clazz)
-    verify_files(clazz)
-    verify_manager_list(clazz)
-    verify_abstract_inner(clazz)
-    verify_runtime_exceptions(clazz)
-    verify_error(clazz)
-    verify_units(clazz)
-    verify_closable(clazz)
-    verify_member_name_not_kotlin_keyword(clazz)
-    verify_method_name_not_kotlin_operator(clazz)
-    verify_collections_over_arrays(clazz)
-    verify_user_handle(clazz)
-    verify_params(clazz)
-    verify_services(clazz)
-    verify_tense(clazz)
-    verify_icu(clazz)
-    verify_clone(clazz)
-    verify_pfd(clazz)
-    verify_numbers(clazz)
-    verify_singleton(clazz)
 
 
 def examine_stream(stream, base_stream=None, in_classes_with_base=[], out_classes_with_base=None):
diff --git a/tools/apilint/apilint_test.py b/tools/apilint/apilint_test.py
index c10ef15..5cb43db 100644
--- a/tools/apilint/apilint_test.py
+++ b/tools/apilint/apilint_test.py
@@ -88,20 +88,22 @@
 
 
 faulty_current_txt = """
+// Signature format: 2.0
 package android.app {
   public final class Activity {
   }
 
   public final class WallpaperColors implements android.os.Parcelable {
-    ctor public WallpaperColors(android.os.Parcel);
+    ctor public WallpaperColors(@NonNull android.os.Parcel);
     method public int describeContents();
-    method public void writeToParcel(android.os.Parcel, int);
-    field public static final android.os.Parcelable.Creator<android.app.WallpaperColors> CREATOR;
+    method public void writeToParcel(@NonNull android.os.Parcel, int);
+    field @NonNull public static final android.os.Parcelable.Creator<android.app.WallpaperColors> CREATOR;
   }
 }
-""".split('\n')
+""".strip().split('\n')
 
 ok_current_txt = """
+// Signature format: 2.0
 package android.app {
   public final class Activity {
   }
@@ -109,19 +111,20 @@
   public final class WallpaperColors implements android.os.Parcelable {
     ctor public WallpaperColors();
     method public int describeContents();
-    method public void writeToParcel(android.os.Parcel, int);
-    field public static final android.os.Parcelable.Creator<android.app.WallpaperColors> CREATOR;
+    method public void writeToParcel(@NonNull android.os.Parcel, int);
+    field @NonNull public static final android.os.Parcelable.Creator<android.app.WallpaperColors> CREATOR;
   }
 }
-""".split('\n')
+""".strip().split('\n')
 
 system_current_txt = """
+// Signature format: 2.0
 package android.app {
   public final class WallpaperColors implements android.os.Parcelable {
     method public int getSomething();
   }
 }
-""".split('\n')
+""".strip().split('\n')
 
 
 
@@ -239,6 +242,10 @@
         cls = self._cls("class Class {")
         return apilint.Field(cls, 1, raw, '', sig_format=2)
 
+    def test_parse_package(self):
+        pkg = apilint.Package(999, "package wifi.p2p {", None)
+        self.assertEquals("wifi.p2p", pkg.name)
+
     def test_class(self):
         cls = self._cls("@Deprecated @IntRange(from=1, to=2) public static abstract class Some.Name extends Super<Class> implements Interface<Class> {")
         self.assertTrue('deprecated' in cls.split)
diff --git a/tools/bit/main.cpp b/tools/bit/main.cpp
index 860094ae..082ccf3 100644
--- a/tools/bit/main.cpp
+++ b/tools/bit/main.cpp
@@ -33,6 +33,8 @@
 
 using namespace std;
 
+#define NATIVE_TESTS "NATIVE_TESTS"
+
 /**
  * An entry from the command line for something that will be built, installed,
  * and/or tested.
@@ -132,6 +134,32 @@
 {
 }
 
+struct PushedFile
+{
+    TrackedFile file;
+    string dest;
+
+    PushedFile();
+    PushedFile(const PushedFile& that);
+    PushedFile(const string& filename, const string& dest);
+    ~PushedFile() {};
+};
+
+PushedFile::PushedFile()
+{
+}
+
+PushedFile::PushedFile(const PushedFile& that)
+    :file(that.file),
+     dest(that.dest)
+{
+}
+
+PushedFile::PushedFile(const string& f, const string& d)
+    :file(f),
+     dest(d)
+{
+}
 
 /**
  * Record for an test that is going to be launched.
@@ -658,12 +686,14 @@
     }
 
     // Figure out whether we need to sync the system and which apks to install
-    string systemPath = buildOut + "/target/product/" + buildDevice + "/system/";
-    string dataPath = buildOut + "/target/product/" + buildDevice + "/data/";
+    string deviceTargetPath = buildOut + "/target/product/" + buildDevice;
+    string systemPath = deviceTargetPath + "/system/";
+    string dataPath = deviceTargetPath + "/data/";
     bool syncSystem = false;
     bool alwaysSyncSystem = false;
     vector<string> systemFiles;
     vector<InstallApk> installApks;
+    vector<PushedFile> pushedFiles;
     for (size_t i=0; i<targets.size(); i++) {
         Target* target = targets[i];
         if (target->install) {
@@ -687,6 +717,11 @@
                     installApks.push_back(InstallApk(file, !target->build));
                     continue;
                 }
+                // If it's a native test module, push it.
+                if (target->module.HasClass(NATIVE_TESTS) && starts_with(file, dataPath)) {
+                    string installedPath(file.c_str() + deviceTargetPath.length());
+                    pushedFiles.push_back(PushedFile(file, installedPath));
+                }
             }
         }
     }
@@ -701,6 +736,13 @@
             printf("  %s\n", systemFiles[i].c_str());
         }
     }
+    if (pushedFiles.size() > 0){
+        print_info("Files to push:");
+        for (size_t i=0; i<pushedFiles.size(); i++) {
+            printf("  %s\n", pushedFiles[i].file.filename.c_str());
+            printf("    --> %s\n", pushedFiles[i].dest.c_str());
+        }
+    }
     if (installApks.size() > 0){
         print_info("APKs to install:");
         for (size_t i=0; i<installApks.size(); i++) {
@@ -784,6 +826,25 @@
         }
     }
 
+    // Push files
+    if (pushedFiles.size() > 0) {
+        print_status("Pushing files");
+        for (size_t i=0; i<pushedFiles.size(); i++) {
+            const PushedFile& pushed = pushedFiles[i];
+            string dir = dirname(pushed.dest);
+            if (dir.length() == 0 || dir == "/") {
+                // This isn't really a file inside the data directory. Just skip it.
+                continue;
+            }
+            // TODO: if (!apk.file.fileInfo.exists || apk.file.HasChanged())
+            err = run_adb("shell", "mkdir", "-p", dir.c_str(), NULL);
+            check_error(err);
+            err = run_adb("push", pushed.file.filename.c_str(), pushed.dest.c_str());
+            check_error(err);
+            // pushed.installed = true;
+        }
+    }
+
     // Install APKs
     if (installApks.size() > 0) {
         print_status("Installing APKs");
@@ -804,6 +865,74 @@
     // Actions
     //
 
+    // Whether there have been any tests run, so we can print a summary.
+    bool testsRun = false;
+
+    // Run the native tests.
+    // TODO: We don't have a good way of running these and capturing the output of
+    // them live.  It'll take some work.  On the other hand, if they're gtest tests,
+    // the output of gtest is not completely insane like the text output of the
+    // instrumentation tests.  So for now, we'll just live with that.
+    for (size_t i=0; i<targets.size(); i++) {
+        Target* target = targets[i];
+        if (target->test && target->module.HasClass(NATIVE_TESTS)) {
+            // We don't have a clear signal from the build system which of the installed
+            // files is actually the test, so we guess by looking for one with the same
+            // leaf name as the module that is executable.
+            for (size_t j=0; j<target->module.installed.size(); j++) {
+                string filename = target->module.installed[j];
+                if (!starts_with(filename, dataPath)) {
+                    // Native tests go into the data directory.
+                    continue;
+                }
+                if (leafname(filename) != target->module.name) {
+                    // This isn't the test executable.
+                    continue;
+                }
+                if (!is_executable(filename)) {
+                    continue;
+                }
+                string installedPath(filename.c_str() + deviceTargetPath.length());
+                printf("the magic one is: %s\n", filename.c_str());
+                printf("  and it's installed at: %s\n", installedPath.c_str());
+
+                // Convert bit-style actions to gtest test filter arguments
+                if (target->actions.size() > 0) {
+                    testsRun = true;
+                    target->testActionCount++;
+                    bool runAll = false;
+                    string filterArg("--gtest_filter=");
+                    for (size_t k=0; k<target->actions.size(); k++) {
+                        string actionString = target->actions[k];
+                        if (actionString == "*") {
+                            runAll = true;
+                        } else {
+                            filterArg += actionString;
+                            if (k != target->actions.size()-1) {
+                                // We would otherwise have to worry about this condition
+                                // being true, and appending an extra ':', but we know that
+                                // if the extra action is "*", then we'll just run all and
+                                // won't use filterArg anyway, so just keep this condition
+                                // simple.
+                                filterArg += ':';
+                            }
+                        }
+                    }
+                    if (runAll) {
+                        err = run_adb("shell", installedPath.c_str(), NULL);
+                    } else {
+                        err = run_adb("shell", installedPath.c_str(), filterArg.c_str(), NULL);
+                    }
+                    if (err == 0) {
+                        target->testPassCount++;
+                    } else {
+                        target->testFailCount++;
+                    }
+                }
+            }
+        }
+    }
+
     // Inspect the apks, and figure out what is an activity and what needs a test runner
     bool printedInspecting = false;
     vector<TestAction> testActions;
@@ -872,6 +1001,7 @@
     TestResults testResults;
     if (testActions.size() > 0) {
         print_status("Running tests");
+        testsRun = true;
         for (size_t i=0; i<testActions.size(); i++) {
             TestAction& action = testActions[i];
             testResults.SetCurrentAction(&action);
@@ -969,7 +1099,7 @@
 
     // Tests
     bool hasErrors = false;
-    if (testActions.size() > 0) {
+    if (testsRun) {
         printf("%sRan tests:%s\n", g_escapeBold, g_escapeEndColor);
         size_t maxNameLength = 0;
         for (size_t i=0; i<targets.size(); i++) {
diff --git a/tools/bit/make.cpp b/tools/bit/make.cpp
index 6270913..df64a80 100644
--- a/tools/bit/make.cpp
+++ b/tools/bit/make.cpp
@@ -51,6 +51,18 @@
     return filename + "/.bit_cache";
 }
 
+bool
+Module::HasClass(const string& cl)
+{
+    for (vector<string>::const_iterator c = classes.begin(); c != classes.end(); c++) {
+        if (*c == cl) {
+            return true;
+        }
+    }
+    return false;
+}
+
+
 BuildVars::BuildVars(const string& outDir, const string& buildProduct,
         const string& buildVariant, const string& buildType)
     :m_filename(),
diff --git a/tools/bit/make.h b/tools/bit/make.h
index db0b69f..785912a 100644
--- a/tools/bit/make.h
+++ b/tools/bit/make.h
@@ -29,6 +29,8 @@
     vector<string> classes;
     vector<string> paths;
     vector<string> installed;
+
+    bool HasClass(const string& cl);
 };
 
 /**
diff --git a/tools/bit/util.cpp b/tools/bit/util.cpp
index a502a9d..63399d6 100644
--- a/tools/bit/util.cpp
+++ b/tools/bit/util.cpp
@@ -254,4 +254,42 @@
     return result;
 }
 
+bool
+is_executable(const string& filename)
+{
+    int err;
+    struct stat st;
 
+    err = stat(filename.c_str(), &st);
+    if (err != 0) {
+        return false;
+    }
+
+    return (st.st_mode & S_IXUSR) != 0;
+}
+
+string
+dirname(const string& filename)
+{
+    size_t slash = filename.rfind('/');
+    if (slash == string::npos) {
+        return "";
+    } else if (slash == 0) {
+        return "/";
+    } else {
+        return string(filename, 0, slash);
+    }
+}
+
+string
+leafname(const string& filename)
+{
+    size_t slash = filename.rfind('/');
+    if (slash == string::npos) {
+        return filename;
+    } else if (slash == filename.length() - 1) {
+        return "";
+    } else {
+        return string(filename, slash + 1);
+    }
+}
diff --git a/tools/bit/util.h b/tools/bit/util.h
index 718f147..7ccdab1 100644
--- a/tools/bit/util.h
+++ b/tools/bit/util.h
@@ -79,5 +79,10 @@
 
 string read_file(const string& filename);
 
+bool is_executable(const string& filename);
+
+string dirname(const string& filename);
+string leafname(const string& filename);
+
 #endif // UTIL_H
 
diff --git a/tools/hiddenapi/exclude.sh b/tools/hiddenapi/exclude.sh
index 4ffcf68..18c4054 100755
--- a/tools/hiddenapi/exclude.sh
+++ b/tools/hiddenapi/exclude.sh
@@ -9,6 +9,7 @@
 LIBCORE_PACKAGES="\
   android.icu \
   android.system \
+  android.test \
   com.android.bouncycastle \
   com.android.conscrypt \
   com.android.i18n.phonenumbers \
@@ -17,6 +18,7 @@
   dalvik \
   java \
   javax \
+  junit \
   libcore \
   org.apache.harmony \
   org.json \
diff --git a/tools/hiddenapi/generate_hiddenapi_lists.py b/tools/hiddenapi/generate_hiddenapi_lists.py
index 2a8f695..6781eba 100755
--- a/tools/hiddenapi/generate_hiddenapi_lists.py
+++ b/tools/hiddenapi/generate_hiddenapi_lists.py
@@ -29,6 +29,9 @@
 FLAG_GREYLIST_MAX_O = "greylist-max-o"
 FLAG_GREYLIST_MAX_P = "greylist-max-p"
 FLAG_CORE_PLATFORM_API = "core-platform-api"
+FLAG_PUBLIC_API = "public-api"
+FLAG_SYSTEM_API = "system-api"
+FLAG_TEST_API = "test-api"
 
 # List of all known flags.
 FLAGS_API_LIST = [
@@ -38,7 +41,12 @@
     FLAG_GREYLIST_MAX_O,
     FLAG_GREYLIST_MAX_P,
 ]
-ALL_FLAGS = FLAGS_API_LIST + [ FLAG_CORE_PLATFORM_API ]
+ALL_FLAGS = FLAGS_API_LIST + [
+    FLAG_CORE_PLATFORM_API,
+    FLAG_PUBLIC_API,
+    FLAG_SYSTEM_API,
+    FLAG_TEST_API,
+    ]
 
 FLAGS_API_LIST_SET = set(FLAGS_API_LIST)
 ALL_FLAGS_SET = set(ALL_FLAGS)
@@ -203,14 +211,19 @@
 
         # Iterate over all CSV lines, find entry in dict and append flags to it.
         for csv in csv_values:
-            self._dict[csv[0]].update(csv[1:])
+            flags = csv[1:]
+            if (FLAG_PUBLIC_API in flags) or (FLAG_SYSTEM_API in flags):
+                flags.append(FLAG_WHITELIST)
+            elif FLAG_TEST_API in flags:
+                flags.append(FLAG_GREYLIST)
+            self._dict[csv[0]].update(flags)
 
     def assign_flag(self, flag, apis, source="<unknown>"):
         """Assigns a flag to given subset of entries.
 
         Args:
             flag (string): One of ALL_FLAGS.
-            apis (set): Subset of APIs to recieve the flag.
+            apis (set): Subset of APIs to receive the flag.
             source (string): Origin of `entries_subset`. Will be printed in error messages.
 
         Throws:
diff --git a/tools/processors/view_inspector/src/java/android/processor/view/inspector/InspectableClassModel.java b/tools/processors/view_inspector/src/java/android/processor/view/inspector/InspectableClassModel.java
index 6f58893..1ad7ada 100644
--- a/tools/processors/view_inspector/src/java/android/processor/view/inspector/InspectableClassModel.java
+++ b/tools/processors/view_inspector/src/java/android/processor/view/inspector/InspectableClassModel.java
@@ -23,6 +23,7 @@
 import java.util.HashMap;
 import java.util.List;
 import java.util.Map;
+import java.util.NoSuchElementException;
 import java.util.Objects;
 import java.util.Optional;
 
@@ -86,20 +87,98 @@
     }
 
     /**
+     * Represents a way to access a property, either a getter or a field.
+     */
+    public static final class Accessor {
+        private final String mName;
+        private final Type mType;
+
+        /**
+         * Construct an accessor for a field.
+         *
+         * @param name The name of the field
+         * @return The new accessor
+         * @see Type#FIELD
+         */
+        static Accessor ofField(String name) {
+            return new Accessor(name, Type.FIELD);
+        }
+
+        /**
+         * Construct an accessor for a getter.
+         *
+         * @param name The name of the getter
+         * @return The new accessor
+         * @see Type#GETTER
+         */
+        static Accessor ofGetter(String name) {
+            return new Accessor(name, Type.GETTER);
+        }
+
+        public Accessor(String name, Type type) {
+            mName = Objects.requireNonNull(name, "Accessor name must not be null");
+            mType = Objects.requireNonNull(type, "Accessor type must not be null");
+        }
+
+        public String getName() {
+            return mName;
+        }
+
+        public Type getType() {
+            return mType;
+        }
+
+        /**
+         * Get the invocation of this accessor.
+         *
+         * Example: {@code "getValue()"} for a getter or {@code "valueField"} for a field.
+         *
+         * @return A string representing the invocation of this accessor
+         */
+        public String invocation() {
+            switch (mType) {
+                case FIELD:
+                    return mName;
+                case GETTER:
+                    return String.format("%s()", mName);
+                default:
+                    throw new NoSuchElementException(
+                            String.format("No such accessor type %s", mType));
+            }
+        }
+
+        public enum Type {
+            /**
+             * A property accessed by a public field.
+             *
+             * @see #ofField(String)
+             */
+            FIELD,
+
+            /**
+             * A property accessed by a public getter method.
+             *
+             * @see #ofGetter(String)
+             */
+            GETTER
+        }
+    }
+
+    /**
      * Model an inspectable property
      */
     public static final class Property {
         private final String mName;
-        private final String mGetter;
+        private final Accessor mAccessor;
         private final Type mType;
         private boolean mAttributeIdInferrableFromR = true;
         private int mAttributeId = 0;
         private List<IntEnumEntry> mIntEnumEntries;
         private List<IntFlagEntry> mIntFlagEntries;
 
-        public Property(String name, String getter, Type type) {
+        public Property(String name, Accessor accessor, Type type) {
             mName = Objects.requireNonNull(name, "Name must not be null");
-            mGetter = Objects.requireNonNull(getter, "Getter must not be null");
+            mAccessor = Objects.requireNonNull(accessor, "Accessor must not be null");
             mType = Objects.requireNonNull(type, "Type must not be null");
         }
 
@@ -129,8 +208,8 @@
             return mName;
         }
 
-        public String getGetter() {
-            return mGetter;
+        public Accessor getAccessor() {
+            return mAccessor;
         }
 
         public Type getType() {
@@ -229,7 +308,10 @@
              * @see android.view.inspector.IntFlagMapping
              * @see IntFlagEntry
              */
-            INT_FLAG
+            INT_FLAG,
+
+            /** A resource ID */
+            RESOURCE_ID
         }
     }
 
diff --git a/tools/processors/view_inspector/src/java/android/processor/view/inspector/InspectablePropertyProcessor.java b/tools/processors/view_inspector/src/java/android/processor/view/inspector/InspectablePropertyProcessor.java
index 50c79da..20de90d 100644
--- a/tools/processors/view_inspector/src/java/android/processor/view/inspector/InspectablePropertyProcessor.java
+++ b/tools/processors/view_inspector/src/java/android/processor/view/inspector/InspectablePropertyProcessor.java
@@ -16,6 +16,7 @@
 
 package android.processor.view.inspector;
 
+import android.processor.view.inspector.InspectableClassModel.Accessor;
 import android.processor.view.inspector.InspectableClassModel.IntEnumEntry;
 import android.processor.view.inspector.InspectableClassModel.IntFlagEntry;
 import android.processor.view.inspector.InspectableClassModel.Property;
@@ -77,6 +78,54 @@
             "androidx.annotation.ColorLong"};
 
     /**
+     * Set of android and androidx annotation qualified names of resource ID annotations.
+     */
+    private static final String[] RESOURCE_ID_ANNOTATION_NAMES = {
+            "android.annotation.AnimatorRes",
+            "android.annotation.AnimRes",
+            "android.annotation.AnyRes",
+            "android.annotation.ArrayRes",
+            "android.annotation.BoolRes",
+            "android.annotation.DimenRes",
+            "android.annotation.DrawableRes",
+            "android.annotation.FontRes",
+            "android.annotation.IdRes",
+            "android.annotation.IntegerRes",
+            "android.annotation.InterpolatorRes",
+            "android.annotation.LayoutRes",
+            "android.annotation.MenuRes",
+            "android.annotation.NavigationRes",
+            "android.annotation.PluralsRes",
+            "android.annotation.RawRes",
+            "android.annotation.StringRes",
+            "android.annotation.StyleableRes",
+            "android.annotation.StyleRes",
+            "android.annotation.TransitionRes",
+            "android.annotation.XmlRes",
+            "androidx.annotation.AnimatorRes",
+            "androidx.annotation.AnimRes",
+            "androidx.annotation.AnyRes",
+            "androidx.annotation.ArrayRes",
+            "androidx.annotation.BoolRes",
+            "androidx.annotation.DimenRes",
+            "androidx.annotation.DrawableRes",
+            "androidx.annotation.FontRes",
+            "androidx.annotation.IdRes",
+            "androidx.annotation.IntegerRes",
+            "androidx.annotation.InterpolatorRes",
+            "androidx.annotation.LayoutRes",
+            "androidx.annotation.MenuRes",
+            "androidx.annotation.NavigationRes",
+            "androidx.annotation.PluralsRes",
+            "androidx.annotation.RawRes",
+            "androidx.annotation.StringRes",
+            "androidx.annotation.StyleableRes",
+            "androidx.annotation.StyleRes",
+            "androidx.annotation.TransitionRes",
+            "androidx.annotation.XmlRes"
+    };
+
+    /**
      * @param annotationQualifiedName The qualified name of the annotation to process
      * @param processingEnv           The processing environment from the parent processor
      */
@@ -93,16 +142,15 @@
         try {
             final AnnotationMirror annotation =
                     mAnnotationUtils.exactlyOneMirror(mQualifiedName, element);
-            final ExecutableElement getter = ensureGetter(element);
-            final Property property = buildProperty(getter, annotation);
+            final Property property = buildProperty(element, annotation);
 
             model.getProperty(property.getName()).ifPresent(p -> {
                 throw new ProcessingException(
                         String.format(
-                                "Property \"%s\" is already defined on #%s().",
+                                "Property \"%s\" is already defined on #%s.",
                                 p.getName(),
-                                p.getGetter()),
-                        getter,
+                                p.getAccessor().invocation()),
+                        element,
                         annotation);
             });
 
@@ -112,6 +160,95 @@
         }
     }
 
+
+    /**
+     * Build a {@link Property} from a getter and an inspectable property annotation.
+     *
+     * @param accessor An element representing the getter or public field to build from
+     * @param annotation A mirror of an inspectable property-shaped annotation
+     * @return A property for the getter and annotation
+     * @throws ProcessingException If the supplied data is invalid and a property cannot be modeled
+     */
+    private Property buildProperty(Element accessor, AnnotationMirror annotation) {
+        final Property property;
+        final Optional<String> nameFromAnnotation = mAnnotationUtils
+                .typedValueByName("name", String.class, accessor, annotation);
+
+        validateModifiers(accessor);
+
+        switch (accessor.getKind()) {
+            case FIELD:
+                property = new Property(
+                        nameFromAnnotation.orElseGet(() -> accessor.getSimpleName().toString()),
+                        Accessor.ofField(accessor.getSimpleName().toString()),
+                        determinePropertyType(accessor, annotation));
+                break;
+            case METHOD:
+                final ExecutableElement getter = ensureGetter(accessor);
+
+                property = new Property(
+                        nameFromAnnotation.orElseGet(() -> inferPropertyNameFromGetter(getter)),
+                        Accessor.ofGetter(getter.getSimpleName().toString()),
+                        determinePropertyType(getter, annotation));
+                break;
+            default:
+                throw new ProcessingException(
+                        String.format(
+                                "Property must either be a getter method or a field, got %s.",
+                                accessor.getKind()
+                        ),
+                        accessor,
+                        annotation);
+        }
+
+        mAnnotationUtils
+                .typedValueByName("hasAttributeId", Boolean.class, accessor, annotation)
+                .ifPresent(property::setAttributeIdInferrableFromR);
+
+        mAnnotationUtils
+                .typedValueByName("attributeId", Integer.class, accessor, annotation)
+                .ifPresent(property::setAttributeId);
+
+        switch (property.getType()) {
+            case INT_ENUM:
+                property.setIntEnumEntries(processEnumMapping(accessor, annotation));
+                break;
+            case INT_FLAG:
+                property.setIntFlagEntries(processFlagMapping(accessor, annotation));
+                break;
+        }
+
+        return property;
+    }
+
+    /**
+     * Validates that an element is public, concrete, and non-static.
+     *
+     * @param element The element to check
+     * @throws ProcessingException If the element's modifiers are invalid
+     */
+    private void validateModifiers(Element element) {
+        final Set<Modifier> modifiers = element.getModifiers();
+
+        if (!modifiers.contains(Modifier.PUBLIC)) {
+            throw new ProcessingException(
+                    "Property getter methods and fields must be public.",
+                    element);
+        }
+
+        if (modifiers.contains(Modifier.ABSTRACT)) {
+            throw new ProcessingException(
+                    "Property getter methods must not be abstract.",
+                    element);
+        }
+
+        if (modifiers.contains(Modifier.STATIC)) {
+            throw new ProcessingException(
+                    "Property getter methods and fields must not be static.",
+                    element);
+        }
+    }
+
     /**
      * Check that an element is shaped like a getter.
      *
@@ -127,25 +264,7 @@
         }
 
         final ExecutableElement method = (ExecutableElement) element;
-        final Set<Modifier> modifiers = method.getModifiers();
 
-        if (modifiers.contains(Modifier.PRIVATE)) {
-            throw new ProcessingException(
-                    "Property getter methods must not be private.",
-                    element);
-        }
-
-        if (modifiers.contains(Modifier.ABSTRACT)) {
-            throw new ProcessingException(
-                    "Property getter methods must not be abstract.",
-                    element);
-        }
-
-        if (modifiers.contains(Modifier.STATIC)) {
-            throw new ProcessingException(
-                    "Property getter methods must not be static.",
-                    element);
-        }
 
         if (!method.getParameters().isEmpty()) {
             throw new ProcessingException(
@@ -171,77 +290,40 @@
         return method;
     }
 
-    /**
-     * Build a {@link Property} from a getter and an inspectable property annotation.
-     *
-     * @param getter     An element representing the getter to build from
-     * @param annotation A mirror of an inspectable property-shaped annotation
-     * @return A property for the getter and annotation
-     * @throws ProcessingException If the supplied data is invalid and a property cannot be modeled
-     */
-    private Property buildProperty(ExecutableElement getter, AnnotationMirror annotation) {
-        final String name = mAnnotationUtils
-                .typedValueByName("name", String.class, getter, annotation)
-                .orElseGet(() -> inferPropertyNameFromGetter(getter));
-
-        final Property property = new Property(
-                name,
-                getter.getSimpleName().toString(),
-                determinePropertyType(getter, annotation));
-
-        mAnnotationUtils
-                .typedValueByName("hasAttributeId", Boolean.class, getter, annotation)
-                .ifPresent(property::setAttributeIdInferrableFromR);
-
-        mAnnotationUtils
-                .typedValueByName("attributeId", Integer.class, getter, annotation)
-                .ifPresent(property::setAttributeId);
-
-        switch (property.getType()) {
-            case INT_ENUM:
-                property.setIntEnumEntries(processEnumMapping(getter, annotation));
-                break;
-            case INT_FLAG:
-                property.setIntFlagEntries(processFlagMapping(getter, annotation));
-                break;
-        }
-
-        return property;
-    }
 
     /**
      * Determine the property type from the annotation, return type, or context clues.
      *
-     * @param getter     An element representing the getter to build from
+     * @param accessor An element representing the getter or field to determine the type of
      * @param annotation A mirror of an inspectable property-shaped annotation
      * @return The resolved property type
      * @throws ProcessingException If the property type cannot be resolved or is invalid
      * @see android.view.inspector.InspectableProperty#valueType()
      */
     private Property.Type determinePropertyType(
-            ExecutableElement getter,
+            Element accessor,
             AnnotationMirror annotation) {
 
         final String valueType = mAnnotationUtils
-                .untypedValueByName("valueType", getter, annotation)
+                .untypedValueByName("valueType", accessor, annotation)
                 .map(Object::toString)
                 .orElse("INFERRED");
 
-        final Property.Type returnType = convertReturnTypeToPropertyType(getter);
+        final Property.Type accessorType =
+                convertTypeMirrorToPropertyType(extractReturnOrFieldType(accessor), accessor);
 
-        final boolean hasColor = hasColorAnnotation(getter);
         final Optional<AnnotationValue> enumMapping =
                 mAnnotationUtils.valueByName("enumMapping", annotation);
         final Optional<AnnotationValue> flagMapping =
                 mAnnotationUtils.valueByName("flagMapping", annotation);
 
-        if (returnType != Property.Type.INT) {
+        if (accessorType != Property.Type.INT) {
             enumMapping.ifPresent(value -> {
                 throw new ProcessingException(
                         String.format(
                                 "Can only use enumMapping on int types, got %s.",
-                                returnType.toString().toLowerCase()),
-                        getter,
+                                accessorType.toString().toLowerCase()),
+                        accessor,
                         annotation,
                         value);
             });
@@ -249,36 +331,63 @@
                 throw new ProcessingException(
                         String.format(
                                 "Can only use flagMapping on int types, got %s.",
-                                returnType.toString().toLowerCase()),
-                        getter,
+                                accessorType.toString().toLowerCase()),
+                        accessor,
                         annotation,
                         value);
             });
         }
 
+
         switch (valueType) {
             case "INFERRED":
+                final boolean hasColor = hasColorAnnotation(accessor);
+                final boolean hasResourceId = hasResourceIdAnnotation(accessor);
+
                 if (hasColor) {
                     enumMapping.ifPresent(value -> {
                         throw new ProcessingException(
                                 "Cannot use enumMapping on a color type.",
-                                getter,
+                                accessor,
                                 annotation,
                                 value);
                     });
                     flagMapping.ifPresent(value -> {
                         throw new ProcessingException(
                                 "Cannot use flagMapping on a color type.",
-                                getter,
+                                accessor,
                                 annotation,
                                 value);
                     });
+                    if (hasResourceId) {
+                        throw new ProcessingException(
+                                "Cannot infer type, both color and resource ID annotations "
+                                        + "are present.",
+                                accessor,
+                                annotation);
+                    }
                     return Property.Type.COLOR;
+                } else if (hasResourceId) {
+                    enumMapping.ifPresent(value -> {
+                        throw new ProcessingException(
+                                "Cannot use enumMapping on a resource ID type.",
+                                accessor,
+                                annotation,
+                                value);
+                    });
+                    flagMapping.ifPresent(value -> {
+                        throw new ProcessingException(
+                                "Cannot use flagMapping on a resource ID type.",
+                                accessor,
+                                annotation,
+                                value);
+                    });
+                    return Property.Type.RESOURCE_ID;
                 } else if (enumMapping.isPresent()) {
                     flagMapping.ifPresent(value -> {
                         throw new ProcessingException(
                                 "Cannot use flagMapping and enumMapping simultaneously.",
-                                getter,
+                                accessor,
                                 annotation,
                                 value);
                     });
@@ -286,12 +395,12 @@
                 } else if (flagMapping.isPresent()) {
                     return Property.Type.INT_FLAG;
                 } else {
-                    return returnType;
+                    return accessorType;
                 }
             case "NONE":
-                return returnType;
+                return accessorType;
             case "COLOR":
-                switch (returnType) {
+                switch (accessorType) {
                     case COLOR:
                     case INT:
                     case LONG:
@@ -299,37 +408,60 @@
                     default:
                         throw new ProcessingException(
                                 "Color must be a long, integer, or android.graphics.Color",
-                                getter,
+                                accessor,
                                 annotation);
                 }
             case "GRAVITY":
-                requirePackedIntToReturnInt("Gravity", returnType, getter, annotation);
+                requirePackedIntToBeInt("Gravity", accessorType, accessor, annotation);
                 return Property.Type.GRAVITY;
             case "INT_ENUM":
-                requirePackedIntToReturnInt("IntEnum", returnType, getter, annotation);
+                requirePackedIntToBeInt("IntEnum", accessorType, accessor, annotation);
                 return Property.Type.INT_ENUM;
             case "INT_FLAG":
-                requirePackedIntToReturnInt("IntFlag", returnType, getter, annotation);
+                requirePackedIntToBeInt("IntFlag", accessorType, accessor, annotation);
                 return Property.Type.INT_FLAG;
+            case "RESOURCE_ID":
+                return Property.Type.RESOURCE_ID;
             default:
                 throw new ProcessingException(
                         String.format("Unknown value type enumeration value: %s", valueType),
-                        getter,
+                        accessor,
                         annotation);
         }
     }
 
     /**
-     * Get a property type from the return type of a getter.
+     * Get the type of a field or the return type of a method.
      *
-     * @param getter The getter to extract the return type of
+     * @param element The element to extract a {@link TypeMirror} from
+     * @return The return or field type of the element
+     * @throws ProcessingException If the element is not a field or a method
+     */
+    private TypeMirror extractReturnOrFieldType(Element element) {
+        switch (element.getKind()) {
+            case FIELD:
+                return element.asType();
+            case METHOD:
+                return ((ExecutableElement) element).getReturnType();
+            default:
+                throw new ProcessingException(
+                        String.format(
+                                "Unable to determine the type of a %s.",
+                                element.getKind()),
+                        element);
+        }
+    }
+
+    /**
+     * Get a property type from a type mirror
+     *
+     * @param typeMirror The type mirror to convert to a property type
+     * @param element The element to be used for exceptions
      * @return The property type returned by the getter
      * @throws ProcessingException If the return type is not a primitive or an object
      */
-    private Property.Type convertReturnTypeToPropertyType(ExecutableElement getter) {
-        final TypeMirror returnType = getter.getReturnType();
-
-        switch (unboxType(returnType)) {
+    private Property.Type convertTypeMirrorToPropertyType(TypeMirror typeMirror, Element element) {
+        switch (unboxType(typeMirror)) {
             case BOOLEAN:
                 return Property.Type.BOOLEAN;
             case BYTE:
@@ -347,7 +479,7 @@
             case SHORT:
                 return Property.Type.SHORT;
             case DECLARED:
-                if (isColorType(returnType)) {
+                if (isColorType(typeMirror)) {
                     return Property.Type.COLOR;
                 } else {
                     return Property.Type.OBJECT;
@@ -356,24 +488,24 @@
                 return Property.Type.OBJECT;
             default:
                 throw new ProcessingException(
-                        String.format("Unsupported return type %s.", returnType),
-                        getter);
+                        String.format("Unsupported property type %s.", typeMirror),
+                        element);
         }
     }
 
     /**
      * Require that a value type packed into an integer be on a getter that returns an int.
      *
-     * @param typeName   The name of the type to use in the exception
+     * @param typeName The name of the type to use in the exception
      * @param returnType The return type of the getter to check
-     * @param getter     The getter, to use in the exception
+     * @param accessor The getter, to use in the exception
      * @param annotation The annotation, to use in the exception
      * @throws ProcessingException If the return type is not an int
      */
-    private static void requirePackedIntToReturnInt(
+    private static void requirePackedIntToBeInt(
             String typeName,
             Property.Type returnType,
-            ExecutableElement getter,
+            Element accessor,
             AnnotationMirror annotation) {
         if (returnType != Property.Type.INT) {
             throw new ProcessingException(
@@ -381,7 +513,7 @@
                             "%s can only be defined on a method that returns int, got %s.",
                             typeName,
                             returnType.toString().toLowerCase()),
-                    getter,
+                    accessor,
                     annotation);
         }
     }
@@ -393,21 +525,21 @@
      * not considered to be annotated, nor is a {@code long} annotated with
      * {@link android.annotation.ColorInt}.
      *
-     * @param getter The getter to query
+     * @param accessor The getter or field to query
      * @return True if the getter has a color annotation, false otherwise
      */
-    private boolean hasColorAnnotation(ExecutableElement getter) {
-        switch (unboxType(getter.getReturnType())) {
+    private boolean hasColorAnnotation(Element accessor) {
+        switch (unboxType(extractReturnOrFieldType(accessor))) {
             case INT:
                 for (String name : COLOR_INT_ANNOTATION_NAMES) {
-                    if (mAnnotationUtils.hasAnnotation(getter, name)) {
+                    if (mAnnotationUtils.hasAnnotation(accessor, name)) {
                         return true;
                     }
                 }
                 return false;
             case LONG:
                 for (String name : COLOR_LONG_ANNOTATION_NAMES) {
-                    if (mAnnotationUtils.hasAnnotation(getter, name)) {
+                    if (mAnnotationUtils.hasAnnotation(accessor, name)) {
                         return true;
                     }
                 }
@@ -418,6 +550,24 @@
     }
 
     /**
+     * Determine if a getter or a field is annotated with a resource ID annotation.
+     *
+     * @param accessor The getter or field to query
+     * @return True if the accessor is an integer and has a resource ID annotation, false otherwise
+     */
+    private boolean hasResourceIdAnnotation(Element accessor) {
+        if (unboxType(extractReturnOrFieldType(accessor)) == TypeKind.INT) {
+            for (String name : RESOURCE_ID_ANNOTATION_NAMES) {
+                if (mAnnotationUtils.hasAnnotation(accessor, name)) {
+                    return true;
+                }
+            }
+        }
+
+        return false;
+    }
+
+    /**
      * Infer a property name from a getter method.
      *
      * If the method is prefixed with {@code get}, the prefix will be stripped, and the
@@ -452,40 +602,40 @@
      *
      * @see android.view.inspector.IntEnumMapping
      * @see android.view.inspector.InspectableProperty#enumMapping()
-     * @param getter The getter of the property, used for exceptions
+     * @param accessor The accessor of the property, used for exceptions
      * @param annotation The {@link android.view.inspector.InspectableProperty} annotation to
      *                   extract enum mapping values from.
      * @return A list of int enum entries, in the order specified in source
      * @throws ProcessingException if mapping doesn't exist or is invalid
      */
     private List<IntEnumEntry> processEnumMapping(
-            ExecutableElement getter,
+            Element accessor,
             AnnotationMirror annotation) {
         List<AnnotationMirror> enumAnnotations = mAnnotationUtils.typedArrayValuesByName(
-                "enumMapping", AnnotationMirror.class, getter, annotation);
+                "enumMapping", AnnotationMirror.class, accessor, annotation);
         List<IntEnumEntry> enumEntries = new ArrayList<>(enumAnnotations.size());
 
         if (enumAnnotations.isEmpty()) {
             throw new ProcessingException(
-                    "Encountered an empty array for enumMapping", getter, annotation);
+                    "Encountered an empty array for enumMapping", accessor, annotation);
         }
 
         for (AnnotationMirror enumAnnotation : enumAnnotations) {
             final String name = mAnnotationUtils.typedValueByName(
-                    "name", String.class, getter, enumAnnotation)
+                    "name", String.class, accessor, enumAnnotation)
                     .orElseThrow(() -> {
                         throw new ProcessingException(
                                 "Name is required for @EnumMap",
-                                getter,
+                                accessor,
                                 enumAnnotation);
                     });
 
             final int value = mAnnotationUtils.typedValueByName(
-                    "value", Integer.class, getter, enumAnnotation)
+                    "value", Integer.class, accessor, enumAnnotation)
                     .orElseThrow(() -> {
                         throw new ProcessingException(
                                 "Value is required for @EnumMap",
-                                getter,
+                                accessor,
                                 enumAnnotation);
                     });
 
@@ -504,45 +654,45 @@
      *
      * @see android.view.inspector.IntFlagMapping
      * @see android.view.inspector.InspectableProperty#flagMapping()
-     * @param getter The getter of the property, used for exceptions
+     * @param accessor The accessor of the property, used for exceptions
      * @param annotation The {@link android.view.inspector.InspectableProperty} annotation to
      *                   extract flag mapping values from.
      * @return A list of int flags entries, in the order specified in source
      * @throws ProcessingException if mapping doesn't exist or is invalid
      */
     private List<IntFlagEntry> processFlagMapping(
-            ExecutableElement getter,
+            Element accessor,
             AnnotationMirror annotation) {
         List<AnnotationMirror> flagAnnotations = mAnnotationUtils.typedArrayValuesByName(
-                "flagMapping", AnnotationMirror.class, getter, annotation);
+                "flagMapping", AnnotationMirror.class, accessor, annotation);
         List<IntFlagEntry> flagEntries = new ArrayList<>(flagAnnotations.size());
 
         if (flagAnnotations.isEmpty()) {
             throw new ProcessingException(
-                    "Encountered an empty array for flagMapping", getter, annotation);
+                    "Encountered an empty array for flagMapping", accessor, annotation);
         }
 
         for (AnnotationMirror flagAnnotation : flagAnnotations) {
             final String name = mAnnotationUtils.typedValueByName(
-                    "name", String.class, getter, flagAnnotation)
+                    "name", String.class, accessor, flagAnnotation)
                     .orElseThrow(() -> {
                         throw new ProcessingException(
                                 "Name is required for @FlagMap",
-                                getter,
+                                accessor,
                                 flagAnnotation);
                     });
 
             final int target = mAnnotationUtils.typedValueByName(
-                    "target", Integer.class, getter, flagAnnotation)
+                    "target", Integer.class, accessor, flagAnnotation)
                     .orElseThrow(() -> {
                         throw new ProcessingException(
                                 "Target is required for @FlagMap",
-                                getter,
+                                accessor,
                                 flagAnnotation);
                     });
 
             final Optional<Integer> mask = mAnnotationUtils.typedValueByName(
-                    "mask", Integer.class, getter, flagAnnotation);
+                    "mask", Integer.class, accessor, flagAnnotation);
 
             if (mask.isPresent()) {
                 flagEntries.add(new IntFlagEntry(name, target, mask.get()));
diff --git a/tools/processors/view_inspector/src/java/android/processor/view/inspector/InspectionCompanionGenerator.java b/tools/processors/view_inspector/src/java/android/processor/view/inspector/InspectionCompanionGenerator.java
index 7b04645..6f6c1aa 100644
--- a/tools/processors/view_inspector/src/java/android/processor/view/inspector/InspectionCompanionGenerator.java
+++ b/tools/processors/view_inspector/src/java/android/processor/view/inspector/InspectionCompanionGenerator.java
@@ -16,6 +16,7 @@
 
 package android.processor.view.inspector;
 
+
 import android.processor.view.inspector.InspectableClassModel.IntEnumEntry;
 import android.processor.view.inspector.InspectableClassModel.IntFlagEntry;
 import android.processor.view.inspector.InspectableClassModel.Property;
@@ -96,7 +97,7 @@
     /**
      * The suffix of the generated class name after the class's binary name.
      */
-    private static final String GENERATED_CLASS_SUFFIX = "$$InspectionCompanion";
+    private static final String GENERATED_CLASS_SUFFIX = "$InspectionCompanion";
 
     /**
      * The null resource ID, copied to avoid a host dependency on platform code.
@@ -268,10 +269,10 @@
 
         for (PropertyIdField propertyIdField : propertyIdFields) {
             builder.addStatement(
-                    "propertyReader.read$L($N, node.$L())",
+                    "propertyReader.read$L($N, node.$L)",
                     methodSuffixForPropertyType(propertyIdField.mProperty.getType()),
                     propertyIdField.mFieldSpec,
-                    propertyIdField.mProperty.getGetter());
+                    propertyIdField.mProperty.getAccessor().invocation());
         }
 
         return builder.build();
@@ -445,6 +446,8 @@
                 return "IntEnum";
             case INT_FLAG:
                 return "IntFlag";
+            case RESOURCE_ID:
+                return "ResourceId";
             default:
                 throw new NoSuchElementException(String.format("No such property type, %s", type));
         }
diff --git a/tools/processors/view_inspector/src/java/android/processor/view/inspector/PlatformInspectableProcessor.java b/tools/processors/view_inspector/src/java/android/processor/view/inspector/PlatformInspectableProcessor.java
index 01d9430..fd142c6 100644
--- a/tools/processors/view_inspector/src/java/android/processor/view/inspector/PlatformInspectableProcessor.java
+++ b/tools/processors/view_inspector/src/java/android/processor/view/inspector/PlatformInspectableProcessor.java
@@ -34,6 +34,7 @@
 import javax.lang.model.element.ElementKind;
 import javax.lang.model.element.Modifier;
 import javax.lang.model.element.TypeElement;
+import javax.lang.model.util.ElementFilter;
 
 
 /**
@@ -127,13 +128,38 @@
 
             final InspectableClassModel model = modelMap.computeIfAbsent(
                     classElement.get().getQualifiedName().toString(),
-                    k -> new InspectableClassModel(ClassName.get(classElement.get())));
+                    k -> {
+                        if (hasNestedInspectionCompanion(classElement.get())) {
+                            fail(
+                                    String.format(
+                                            "Class %s already has an inspection companion.",
+                                            classElement.get().getQualifiedName().toString()),
+                                    element);
+                        }
+                        return new InspectableClassModel(ClassName.get(classElement.get()));
+                    });
 
             processor.process(element, model);
         }
     }
 
     /**
+     * Determine if a class has a nested class named {@code InspectionCompanion}.
+     *
+     * @param typeElement A type element representing the class to check
+     * @return f the class contains a class named {@code InspectionCompanion}
+     */
+    private static boolean hasNestedInspectionCompanion(TypeElement typeElement) {
+        for (TypeElement nestedClass : ElementFilter.typesIn(typeElement.getEnclosedElements())) {
+            if (nestedClass.getSimpleName().toString().equals("InspectionCompanion")) {
+                return true;
+            }
+        }
+
+        return false;
+    }
+
+    /**
      * Get the nearest enclosing class if there is one.
      *
      * If {@param element} represents a class, it will be returned wrapped in an optional.
diff --git a/tools/processors/view_inspector/test/java/android/processor/view/inspector/InspectionCompanionGeneratorTest.java b/tools/processors/view_inspector/test/java/android/processor/view/inspector/InspectionCompanionGeneratorTest.java
index f6d8bb0..4eed504 100644
--- a/tools/processors/view_inspector/test/java/android/processor/view/inspector/InspectionCompanionGeneratorTest.java
+++ b/tools/processors/view_inspector/test/java/android/processor/view/inspector/InspectionCompanionGeneratorTest.java
@@ -20,6 +20,8 @@
 import static org.junit.Assert.assertNotNull;
 import static org.junit.Assert.fail;
 
+
+import android.processor.view.inspector.InspectableClassModel.Accessor;
 import android.processor.view.inspector.InspectableClassModel.IntEnumEntry;
 import android.processor.view.inspector.InspectableClassModel.IntFlagEntry;
 import android.processor.view.inspector.InspectableClassModel.Property;
@@ -80,13 +82,14 @@
         addProperty("object", "getObject", Property.Type.OBJECT);
         addProperty("color", "getColor", Property.Type.COLOR);
         addProperty("gravity", "getGravity", Property.Type.GRAVITY);
+        addProperty("resourceId", "getResourceId", Property.Type.RESOURCE_ID);
 
         assertGeneratedFileEquals("SimpleProperties");
     }
 
     @Test
     public void testNoAttributeId() {
-        final Property property = new Property(
+        final Property property = addProperty(
                 "noAttributeProperty",
                 "getNoAttributeProperty",
                 Property.Type.INT);
@@ -98,19 +101,18 @@
 
     @Test
     public void testSuppliedAttributeId() {
-        final Property property = new Property(
+        final Property property = addProperty(
                 "suppliedAttributeProperty",
                 "getSuppliedAttributeProperty",
                 Property.Type.INT);
         property.setAttributeId(0xdecafbad);
-        mModel.putProperty(property);
 
         assertGeneratedFileEquals("SuppliedAttributeId");
     }
 
     @Test
     public void testIntEnum() {
-        final Property property = new Property(
+        final Property property = addProperty(
                 "intEnumProperty",
                 "getIntEnumProperty",
                 Property.Type.INT_ENUM);
@@ -127,7 +129,7 @@
 
     @Test
     public void testIntFlag() {
-        final Property property = new Property(
+        final Property property = addProperty(
                 "intFlag",
                 "getIntFlag",
                 Property.Type.INT_FLAG);
@@ -139,13 +141,21 @@
                 new IntFlagEntry("WARP", 0x4)
         ));
 
-        mModel.putProperty(property);
-
         assertGeneratedFileEquals("IntFlag");
     }
 
+    @Test
+    public void testFieldProperty() {
+        mModel.putProperty(new Property(
+                "fieldProperty",
+                Accessor.ofField("fieldProperty"),
+                Property.Type.INT));
+
+        assertGeneratedFileEquals("FieldProperty");
+    }
+
     private Property addProperty(String name, String getter, Property.Type type) {
-        final Property property = new Property(name, getter, type);
+        final Property property = new Property(name, Accessor.ofGetter(getter), type);
         mModel.putProperty(property);
         return property;
     }
diff --git a/tools/processors/view_inspector/test/resources/android/processor/view/inspector/InspectionCompanionGeneratorTest/FieldProperty.java.txt b/tools/processors/view_inspector/test/resources/android/processor/view/inspector/InspectionCompanionGeneratorTest/FieldProperty.java.txt
new file mode 100644
index 0000000..9a0fe5b
--- /dev/null
+++ b/tools/processors/view_inspector/test/resources/android/processor/view/inspector/InspectionCompanionGeneratorTest/FieldProperty.java.txt
@@ -0,0 +1,39 @@
+package com.android.node;
+
+import android.R;
+import android.view.inspector.InspectionCompanion;
+import android.view.inspector.PropertyMapper;
+import android.view.inspector.PropertyReader;
+import java.lang.Override;
+
+/**
+ * Inspection companion for {@link TestNode}.
+ *
+ * Generated by {@link android.processor.view.inspector.InspectionCompanionGenerator}
+ * on behalf of {@link android.processor.view.inspector.InspectionCompanionGeneratorTest}.
+ */
+public final class TestNode$InspectionCompanion implements InspectionCompanion<TestNode> {
+    /**
+     * Set by {@link #mapProperties(PropertyMapper)} once properties have been mapped.
+     */
+    private boolean mPropertiesMapped = false;
+
+    /**
+     * Property ID of {@code fieldProperty}.
+     */
+    private int mFieldPropertyId;
+
+    @Override
+    public void mapProperties(PropertyMapper propertyMapper) {
+        mFieldPropertyId = propertyMapper.mapInt("fieldProperty", R.attr.fieldProperty);
+        mPropertiesMapped = true;
+    }
+
+    @Override
+    public void readProperties(TestNode node, PropertyReader propertyReader) {
+        if (!mPropertiesMapped) {
+            throw new InspectionCompanion.UninitializedPropertyMapException();
+        }
+        propertyReader.readInt(mFieldPropertyId, node.fieldProperty);
+    }
+}
diff --git a/tools/processors/view_inspector/test/resources/android/processor/view/inspector/InspectionCompanionGeneratorTest/IntEnum.java.txt b/tools/processors/view_inspector/test/resources/android/processor/view/inspector/InspectionCompanionGeneratorTest/IntEnum.java.txt
index 764aa8b..b491de1 100644
--- a/tools/processors/view_inspector/test/resources/android/processor/view/inspector/InspectionCompanionGeneratorTest/IntEnum.java.txt
+++ b/tools/processors/view_inspector/test/resources/android/processor/view/inspector/InspectionCompanionGeneratorTest/IntEnum.java.txt
@@ -13,7 +13,7 @@
  * Generated by {@link android.processor.view.inspector.InspectionCompanionGenerator}
  * on behalf of {@link android.processor.view.inspector.InspectionCompanionGeneratorTest}.
  */
-public final class TestNode$$InspectionCompanion implements InspectionCompanion<TestNode> {
+public final class TestNode$InspectionCompanion implements InspectionCompanion<TestNode> {
     /**
      * Set by {@link #mapProperties(PropertyMapper)} once properties have been mapped.
      */
diff --git a/tools/processors/view_inspector/test/resources/android/processor/view/inspector/InspectionCompanionGeneratorTest/IntFlag.java.txt b/tools/processors/view_inspector/test/resources/android/processor/view/inspector/InspectionCompanionGeneratorTest/IntFlag.java.txt
index 75f2813..7d18058 100644
--- a/tools/processors/view_inspector/test/resources/android/processor/view/inspector/InspectionCompanionGeneratorTest/IntFlag.java.txt
+++ b/tools/processors/view_inspector/test/resources/android/processor/view/inspector/InspectionCompanionGeneratorTest/IntFlag.java.txt
@@ -12,7 +12,7 @@
  * Generated by {@link android.processor.view.inspector.InspectionCompanionGenerator}
  * on behalf of {@link android.processor.view.inspector.InspectionCompanionGeneratorTest}.
  */
-public final class TestNode$$InspectionCompanion implements InspectionCompanion<TestNode> {
+public final class TestNode$InspectionCompanion implements InspectionCompanion<TestNode> {
     /**
      * Set by {@link #mapProperties(PropertyMapper)} once properties have been mapped.
      */
diff --git a/tools/processors/view_inspector/test/resources/android/processor/view/inspector/InspectionCompanionGeneratorTest/NestedClass.java.txt b/tools/processors/view_inspector/test/resources/android/processor/view/inspector/InspectionCompanionGeneratorTest/NestedClass.java.txt
index 0cac462..dc27abb 100644
--- a/tools/processors/view_inspector/test/resources/android/processor/view/inspector/InspectionCompanionGeneratorTest/NestedClass.java.txt
+++ b/tools/processors/view_inspector/test/resources/android/processor/view/inspector/InspectionCompanionGeneratorTest/NestedClass.java.txt
@@ -11,7 +11,7 @@
  * Generated by {@link android.processor.view.inspector.InspectionCompanionGenerator}
  * on behalf of {@link android.processor.view.inspector.InspectionCompanionGeneratorTest}.
  */
-public final class Outer$Inner$$InspectionCompanion implements InspectionCompanion<Outer.Inner> {
+public final class Outer$Inner$InspectionCompanion implements InspectionCompanion<Outer.Inner> {
     /**
      * Set by {@link #mapProperties(PropertyMapper)} once properties have been mapped.
      */
diff --git a/tools/processors/view_inspector/test/resources/android/processor/view/inspector/InspectionCompanionGeneratorTest/NoAttributeId.java.txt b/tools/processors/view_inspector/test/resources/android/processor/view/inspector/InspectionCompanionGeneratorTest/NoAttributeId.java.txt
index ce0f867..738bcd3 100644
--- a/tools/processors/view_inspector/test/resources/android/processor/view/inspector/InspectionCompanionGeneratorTest/NoAttributeId.java.txt
+++ b/tools/processors/view_inspector/test/resources/android/processor/view/inspector/InspectionCompanionGeneratorTest/NoAttributeId.java.txt
@@ -11,7 +11,7 @@
  * Generated by {@link android.processor.view.inspector.InspectionCompanionGenerator}
  * on behalf of {@link android.processor.view.inspector.InspectionCompanionGeneratorTest}.
  */
-public final class TestNode$$InspectionCompanion implements InspectionCompanion<TestNode> {
+public final class TestNode$InspectionCompanion implements InspectionCompanion<TestNode> {
     /**
      * Set by {@link #mapProperties(PropertyMapper)} once properties have been mapped.
      */
diff --git a/tools/processors/view_inspector/test/resources/android/processor/view/inspector/InspectionCompanionGeneratorTest/NodeName.java.txt b/tools/processors/view_inspector/test/resources/android/processor/view/inspector/InspectionCompanionGeneratorTest/NodeName.java.txt
index f7357fe..82dd66e 100644
--- a/tools/processors/view_inspector/test/resources/android/processor/view/inspector/InspectionCompanionGeneratorTest/NodeName.java.txt
+++ b/tools/processors/view_inspector/test/resources/android/processor/view/inspector/InspectionCompanionGeneratorTest/NodeName.java.txt
@@ -12,7 +12,7 @@
  * Generated by {@link android.processor.view.inspector.InspectionCompanionGenerator}
  * on behalf of {@link android.processor.view.inspector.InspectionCompanionGeneratorTest}.
  */
-public final class TestNode$$InspectionCompanion implements InspectionCompanion<TestNode> {
+public final class TestNode$InspectionCompanion implements InspectionCompanion<TestNode> {
     /**
      * Set by {@link #mapProperties(PropertyMapper)} once properties have been mapped.
      */
diff --git a/tools/processors/view_inspector/test/resources/android/processor/view/inspector/InspectionCompanionGeneratorTest/SimpleProperties.java.txt b/tools/processors/view_inspector/test/resources/android/processor/view/inspector/InspectionCompanionGeneratorTest/SimpleProperties.java.txt
index dfc1bce..08ea696 100644
--- a/tools/processors/view_inspector/test/resources/android/processor/view/inspector/InspectionCompanionGeneratorTest/SimpleProperties.java.txt
+++ b/tools/processors/view_inspector/test/resources/android/processor/view/inspector/InspectionCompanionGeneratorTest/SimpleProperties.java.txt
@@ -12,7 +12,7 @@
  * Generated by {@link android.processor.view.inspector.InspectionCompanionGenerator}
  * on behalf of {@link android.processor.view.inspector.InspectionCompanionGeneratorTest}.
  */
-public final class TestNode$$InspectionCompanion implements InspectionCompanion<TestNode> {
+public final class TestNode$InspectionCompanion implements InspectionCompanion<TestNode> {
     /**
      * Set by {@link #mapProperties(PropertyMapper)} once properties have been mapped.
      */
@@ -69,6 +69,11 @@
     private int mObjectId;
 
     /**
+     * Property ID of {@code resourceId}.
+     */
+    private int mResourceIdId;
+
+    /**
      * Property ID of {@code short}.
      */
     private int mShortId;
@@ -85,6 +90,7 @@
         mIntId = propertyMapper.mapInt("int", R.attr.int);
         mLongId = propertyMapper.mapLong("long", R.attr.long);
         mObjectId = propertyMapper.mapObject("object", R.attr.object);
+        mResourceIdId = propertyMapper.mapResourceId("resourceId", R.attr.resourceId);
         mShortId = propertyMapper.mapShort("short", R.attr.short);
         mPropertiesMapped = true;
     }
@@ -104,6 +110,7 @@
         propertyReader.readInt(mIntId, node.getInt());
         propertyReader.readLong(mLongId, node.getLong());
         propertyReader.readObject(mObjectId, node.getObject());
+        propertyReader.readResourceId(mResourceIdId, node.getResourceId());
         propertyReader.readShort(mShortId, node.getShort());
     }
 }
diff --git a/tools/processors/view_inspector/test/resources/android/processor/view/inspector/InspectionCompanionGeneratorTest/SuppliedAttributeId.java.txt b/tools/processors/view_inspector/test/resources/android/processor/view/inspector/InspectionCompanionGeneratorTest/SuppliedAttributeId.java.txt
index d72cdd5..3bfa78a 100644
--- a/tools/processors/view_inspector/test/resources/android/processor/view/inspector/InspectionCompanionGeneratorTest/SuppliedAttributeId.java.txt
+++ b/tools/processors/view_inspector/test/resources/android/processor/view/inspector/InspectionCompanionGeneratorTest/SuppliedAttributeId.java.txt
@@ -11,7 +11,7 @@
  * Generated by {@link android.processor.view.inspector.InspectionCompanionGenerator}
  * on behalf of {@link android.processor.view.inspector.InspectionCompanionGeneratorTest}.
  */
-public final class TestNode$$InspectionCompanion implements InspectionCompanion<TestNode> {
+public final class TestNode$InspectionCompanion implements InspectionCompanion<TestNode> {
     /**
      * Set by {@link #mapProperties(PropertyMapper)} once properties have been mapped.
      */
diff --git a/wifi/java/android/net/wifi/BatchedScanResult.java b/wifi/java/android/net/wifi/BatchedScanResult.java
index c06543e..ed8845dd 100644
--- a/wifi/java/android/net/wifi/BatchedScanResult.java
+++ b/wifi/java/android/net/wifi/BatchedScanResult.java
@@ -78,7 +78,7 @@
     }
 
     /** Implement the Parcelable interface {@hide} */
-    public static final Creator<BatchedScanResult> CREATOR =
+    public static final @android.annotation.NonNull Creator<BatchedScanResult> CREATOR =
         new Creator<BatchedScanResult>() {
             public BatchedScanResult createFromParcel(Parcel in) {
                 BatchedScanResult result = new BatchedScanResult();
diff --git a/wifi/java/android/net/wifi/IWifiManager.aidl b/wifi/java/android/net/wifi/IWifiManager.aidl
index d549799..17948e7 100644
--- a/wifi/java/android/net/wifi/IWifiManager.aidl
+++ b/wifi/java/android/net/wifi/IWifiManager.aidl
@@ -147,8 +147,10 @@
 
     void stopWatchLocalOnlyHotspot();
 
+    @UnsupportedAppUsage
     int getWifiApEnabledState();
 
+    @UnsupportedAppUsage
     WifiConfiguration getWifiApConfiguration();
 
     boolean setWifiApConfiguration(in WifiConfiguration wifiConfig, String packageName);
@@ -173,6 +175,7 @@
 
     void factoryReset(String packageName);
 
+    @UnsupportedAppUsage
     Network getCurrentNetwork();
 
     byte[] retrieveBackupData();
diff --git a/wifi/java/android/net/wifi/PasspointManagementObjectDefinition.java b/wifi/java/android/net/wifi/PasspointManagementObjectDefinition.java
index 9fc1706..70577b9 100644
--- a/wifi/java/android/net/wifi/PasspointManagementObjectDefinition.java
+++ b/wifi/java/android/net/wifi/PasspointManagementObjectDefinition.java
@@ -63,7 +63,7 @@
     /**
      * Implement the Parcelable interface {@hide}
      */
-    public static final Creator<PasspointManagementObjectDefinition> CREATOR =
+    public static final @android.annotation.NonNull Creator<PasspointManagementObjectDefinition> CREATOR =
             new Creator<PasspointManagementObjectDefinition>() {
                 public PasspointManagementObjectDefinition createFromParcel(Parcel in) {
                     return new PasspointManagementObjectDefinition(
diff --git a/wifi/java/android/net/wifi/RssiPacketCountInfo.java b/wifi/java/android/net/wifi/RssiPacketCountInfo.java
index 0de2033..4301165 100644
--- a/wifi/java/android/net/wifi/RssiPacketCountInfo.java
+++ b/wifi/java/android/net/wifi/RssiPacketCountInfo.java
@@ -60,7 +60,7 @@
         return 0;
     }
 
-    public static final Parcelable.Creator<RssiPacketCountInfo> CREATOR =
+    public static final @android.annotation.NonNull Parcelable.Creator<RssiPacketCountInfo> CREATOR =
             new Parcelable.Creator<RssiPacketCountInfo>() {
         @Override
         public RssiPacketCountInfo createFromParcel(Parcel in) {
diff --git a/wifi/java/android/net/wifi/RttManager.java b/wifi/java/android/net/wifi/RttManager.java
index 9ab374a..6ce2121 100644
--- a/wifi/java/android/net/wifi/RttManager.java
+++ b/wifi/java/android/net/wifi/RttManager.java
@@ -292,7 +292,7 @@
         }
 
         /** Implement the Parcelable interface {@hide} */
-        public static final Creator<RttCapabilities> CREATOR =
+        public static final @android.annotation.NonNull Creator<RttCapabilities> CREATOR =
             new Creator<RttCapabilities>() {
             @Override
             public RttCapabilities createFromParcel(Parcel in) {
@@ -556,7 +556,7 @@
         }
 
         /** Implement the Parcelable interface {@hide} */
-        public static final Creator<ParcelableRttParams> CREATOR =
+        public static final @android.annotation.NonNull Creator<ParcelableRttParams> CREATOR =
                 new Creator<ParcelableRttParams>() {
                     @Override
                     public ParcelableRttParams createFromParcel(Parcel in) {
@@ -859,7 +859,7 @@
         }
 
         /** Implement the Parcelable interface {@hide} */
-        public static final Creator<ParcelableRttResults> CREATOR =
+        public static final @android.annotation.NonNull Creator<ParcelableRttResults> CREATOR =
                 new Creator<ParcelableRttResults>() {
                     @Override
                     public ParcelableRttResults createFromParcel(Parcel in) {
@@ -1158,7 +1158,7 @@
         }
 
         /** Implement {@link Parcelable} interface */
-        public static final Parcelable.Creator<ResponderConfig> CREATOR =
+        public static final @android.annotation.NonNull Parcelable.Creator<ResponderConfig> CREATOR =
                 new Parcelable.Creator<ResponderConfig>() {
             @Override
             public ResponderConfig createFromParcel(Parcel in) {
diff --git a/wifi/java/android/net/wifi/ScanResult.java b/wifi/java/android/net/wifi/ScanResult.java
index 9b9247d..21fe22e 100644
--- a/wifi/java/android/net/wifi/ScanResult.java
+++ b/wifi/java/android/net/wifi/ScanResult.java
@@ -751,7 +751,7 @@
 
     /** Implement the Parcelable interface {@hide} */
     @UnsupportedAppUsage
-    public static final Creator<ScanResult> CREATOR =
+    public static final @android.annotation.NonNull Creator<ScanResult> CREATOR =
         new Creator<ScanResult>() {
             public ScanResult createFromParcel(Parcel in) {
                 WifiSsid wifiSsid = null;
diff --git a/wifi/java/android/net/wifi/SupplicantState.java b/wifi/java/android/net/wifi/SupplicantState.java
index 369d3a8..de7e2b5 100644
--- a/wifi/java/android/net/wifi/SupplicantState.java
+++ b/wifi/java/android/net/wifi/SupplicantState.java
@@ -251,7 +251,7 @@
     }
 
     /** Implement the Parcelable interface {@hide} */
-    public static final Creator<SupplicantState> CREATOR =
+    public static final @android.annotation.NonNull Creator<SupplicantState> CREATOR =
         new Creator<SupplicantState>() {
             public SupplicantState createFromParcel(Parcel in) {
                 return SupplicantState.valueOf(in.readString());
diff --git a/wifi/java/android/net/wifi/WifiActivityEnergyInfo.java b/wifi/java/android/net/wifi/WifiActivityEnergyInfo.java
index 03c9fbe..0f7fc2d 100644
--- a/wifi/java/android/net/wifi/WifiActivityEnergyInfo.java
+++ b/wifi/java/android/net/wifi/WifiActivityEnergyInfo.java
@@ -100,7 +100,7 @@
             + " }";
     }
 
-    public static final Parcelable.Creator<WifiActivityEnergyInfo> CREATOR =
+    public static final @android.annotation.NonNull Parcelable.Creator<WifiActivityEnergyInfo> CREATOR =
             new Parcelable.Creator<WifiActivityEnergyInfo>() {
         public WifiActivityEnergyInfo createFromParcel(Parcel in) {
             long timestamp = in.readLong();
diff --git a/wifi/java/android/net/wifi/WifiConfiguration.java b/wifi/java/android/net/wifi/WifiConfiguration.java
index 4d6ff48..379819d 100644
--- a/wifi/java/android/net/wifi/WifiConfiguration.java
+++ b/wifi/java/android/net/wifi/WifiConfiguration.java
@@ -561,41 +561,48 @@
      * See {@link KeyMgmt} for descriptions of the values.
      * Defaults to WPA-PSK WPA-EAP.
      */
+    @NonNull
     public BitSet allowedKeyManagement;
     /**
      * The set of security protocols supported by this configuration.
      * See {@link Protocol} for descriptions of the values.
      * Defaults to WPA RSN.
      */
+    @NonNull
     public BitSet allowedProtocols;
     /**
      * The set of authentication protocols supported by this configuration.
      * See {@link AuthAlgorithm} for descriptions of the values.
      * Defaults to automatic selection.
      */
+    @NonNull
     public BitSet allowedAuthAlgorithms;
     /**
      * The set of pairwise ciphers for WPA supported by this configuration.
      * See {@link PairwiseCipher} for descriptions of the values.
      * Defaults to CCMP TKIP.
      */
+    @NonNull
     public BitSet allowedPairwiseCiphers;
     /**
      * The set of group ciphers supported by this configuration.
      * See {@link GroupCipher} for descriptions of the values.
      * Defaults to CCMP TKIP WEP104 WEP40.
      */
+    @NonNull
     public BitSet allowedGroupCiphers;
     /**
      * The set of group management ciphers supported by this configuration.
      * See {@link GroupMgmtCipher} for descriptions of the values.
      */
+    @NonNull
     public BitSet allowedGroupManagementCiphers;
     /**
      * The set of SuiteB ciphers supported by this configuration.
      * To be used for WPA3-Enterprise mode.
      * See {@link SuiteBCipher} for descriptions of the values.
      */
+    @NonNull
     public BitSet allowedSuiteBCiphers;
     /**
      * The enterprise configuration details specifying the EAP method,
@@ -2080,7 +2087,7 @@
      * @hide
      */
     public String getKeyIdForCredentials(WifiConfiguration current) {
-        String keyMgmt = null;
+        String keyMgmt = "";
 
         try {
             // Get current config details for fields that are not initialized
@@ -2089,14 +2096,17 @@
                 allowedKeyManagement = current.allowedKeyManagement;
             }
             if (allowedKeyManagement.get(KeyMgmt.WPA_EAP)) {
-                keyMgmt = KeyMgmt.strings[KeyMgmt.WPA_EAP];
+                keyMgmt += KeyMgmt.strings[KeyMgmt.WPA_EAP];
             }
             if (allowedKeyManagement.get(KeyMgmt.OSEN)) {
-                keyMgmt = KeyMgmt.strings[KeyMgmt.OSEN];
+                keyMgmt += KeyMgmt.strings[KeyMgmt.OSEN];
             }
             if (allowedKeyManagement.get(KeyMgmt.IEEE8021X)) {
                 keyMgmt += KeyMgmt.strings[KeyMgmt.IEEE8021X];
             }
+            if (allowedKeyManagement.get(KeyMgmt.SUITE_B_192)) {
+                keyMgmt += KeyMgmt.strings[KeyMgmt.SUITE_B_192];
+            }
 
             if (TextUtils.isEmpty(keyMgmt)) {
                 throw new IllegalStateException("Not an EAP network");
@@ -2486,7 +2496,7 @@
 
     /** Implement the Parcelable interface {@hide} */
     @UnsupportedAppUsage
-    public static final Creator<WifiConfiguration> CREATOR =
+    public static final @android.annotation.NonNull Creator<WifiConfiguration> CREATOR =
         new Creator<WifiConfiguration>() {
             public WifiConfiguration createFromParcel(Parcel in) {
                 WifiConfiguration config = new WifiConfiguration();
diff --git a/wifi/java/android/net/wifi/WifiEnterpriseConfig.java b/wifi/java/android/net/wifi/WifiEnterpriseConfig.java
index 145e269..7a505a2 100644
--- a/wifi/java/android/net/wifi/WifiEnterpriseConfig.java
+++ b/wifi/java/android/net/wifi/WifiEnterpriseConfig.java
@@ -226,7 +226,7 @@
         ParcelUtil.writeCertificates(dest, mClientCertificateChain);
     }
 
-    public static final Creator<WifiEnterpriseConfig> CREATOR =
+    public static final @android.annotation.NonNull Creator<WifiEnterpriseConfig> CREATOR =
             new Creator<WifiEnterpriseConfig>() {
                 @Override
                 public WifiEnterpriseConfig createFromParcel(Parcel in) {
diff --git a/wifi/java/android/net/wifi/WifiInfo.java b/wifi/java/android/net/wifi/WifiInfo.java
index 089b59a..ee60408 100644
--- a/wifi/java/android/net/wifi/WifiInfo.java
+++ b/wifi/java/android/net/wifi/WifiInfo.java
@@ -16,6 +16,7 @@
 
 package android.net.wifi;
 
+import android.annotation.IntRange;
 import android.annotation.Nullable;
 import android.annotation.SystemApi;
 import android.annotation.UnsupportedAppUsage;
@@ -101,6 +102,11 @@
     private int mLinkSpeed;
 
     /**
+     * Constant for unknown link speed.
+     */
+    public static final int LINK_SPEED_UNKNOWN = -1;
+
+    /**
      * Tx(transmit) Link speed in Mbps
      */
     private int mTxLinkSpeed;
@@ -214,7 +220,7 @@
         mNetworkId = -1;
         mSupplicantState = SupplicantState.UNINITIALIZED;
         mRssi = INVALID_RSSI;
-        mLinkSpeed = -1;
+        mLinkSpeed = LINK_SPEED_UNKNOWN;
         mFrequency = -1;
     }
 
@@ -225,9 +231,9 @@
         setSSID(null);
         setNetworkId(-1);
         setRssi(INVALID_RSSI);
-        setLinkSpeed(-1);
-        setTxLinkSpeedMbps(-1);
-        setRxLinkSpeedMbps(-1);
+        setLinkSpeed(LINK_SPEED_UNKNOWN);
+        setTxLinkSpeedMbps(LINK_SPEED_UNKNOWN);
+        setRxLinkSpeedMbps(LINK_SPEED_UNKNOWN);
         setFrequency(-1);
         setMeteredHint(false);
         setEphemeral(false);
@@ -369,8 +375,9 @@
 
     /**
      * Returns the current link speed in {@link #LINK_SPEED_UNITS}.
-     * @return the link speed or -1 if there is no valid value.
+     * @return the link speed or {@link #LINK_SPEED_UNKNOWN} if link speed is unknown.
      * @see #LINK_SPEED_UNITS
+     * @see #LINK_SPEED_UNKNOWN
      */
     public int getLinkSpeed() {
         return mLinkSpeed;
@@ -384,8 +391,10 @@
 
     /**
      * Returns the current transmit link speed in Mbps.
-     * @return the Tx link speed or -1 if there is no valid value.
+     * @return the Tx link speed or {@link #LINK_SPEED_UNKNOWN} if link speed is unknown.
+     * @see #LINK_SPEED_UNKNOWN
      */
+    @IntRange(from = -1)
     public int getTxLinkSpeedMbps() {
         return mTxLinkSpeed;
     }
@@ -400,8 +409,10 @@
 
     /**
      * Returns the current receive link speed in Mbps.
-     * @return the Rx link speed or -1 if there is no valid value.
+     * @return the Rx link speed or {@link #LINK_SPEED_UNKNOWN} if link speed is unknown.
+     * @see #LINK_SPEED_UNKNOWN
      */
+    @IntRange(from = -1)
     public int getRxLinkSpeedMbps() {
         return mRxLinkSpeed;
     }
@@ -725,7 +736,7 @@
 
     /** Implement the Parcelable interface {@hide} */
     @UnsupportedAppUsage
-    public static final Creator<WifiInfo> CREATOR =
+    public static final @android.annotation.NonNull Creator<WifiInfo> CREATOR =
         new Creator<WifiInfo>() {
             public WifiInfo createFromParcel(Parcel in) {
                 WifiInfo info = new WifiInfo();
diff --git a/wifi/java/android/net/wifi/WifiManager.java b/wifi/java/android/net/wifi/WifiManager.java
index 6c645fc..4fd00f7 100644
--- a/wifi/java/android/net/wifi/WifiManager.java
+++ b/wifi/java/android/net/wifi/WifiManager.java
@@ -1227,6 +1227,7 @@
             android.Manifest.permission.NETWORK_SETTINGS,
             android.Manifest.permission.NETWORK_SETUP_WIZARD
     })
+    @NonNull
     public List<Pair<WifiConfiguration, Map<Integer, List<ScanResult>>>> getAllMatchingWifiConfigs(
             @NonNull List<ScanResult> scanResults) {
         List<Pair<WifiConfiguration, Map<Integer, List<ScanResult>>>> configs = new ArrayList<>();
@@ -1269,6 +1270,7 @@
             android.Manifest.permission.NETWORK_SETTINGS,
             android.Manifest.permission.NETWORK_SETUP_WIZARD
     })
+    @NonNull
     public Map<OsuProvider, List<ScanResult>> getMatchingOsuProviders(
             List<ScanResult> scanResults) {
         try {
@@ -1295,6 +1297,7 @@
             android.Manifest.permission.NETWORK_SETTINGS,
             android.Manifest.permission.NETWORK_SETUP_WIZARD
     })
+    @NonNull
     public Map<OsuProvider, PasspointConfiguration> getMatchingPasspointConfigsForOsuProviders(
             @NonNull Set<OsuProvider> osuProviders) {
         try {
@@ -3601,7 +3604,7 @@
             android.Manifest.permission.NETWORK_SETUP_WIZARD,
             android.Manifest.permission.NETWORK_STACK
     })
-    public void connect(WifiConfiguration config, ActionListener listener) {
+    public void connect(@NonNull WifiConfiguration config, @Nullable ActionListener listener) {
         if (config == null) throw new IllegalArgumentException("config cannot be null");
         // Use INVALID_NETWORK_ID for arg1 when passing a config object
         // arg1 is used to pass network id when the network already exists
@@ -3627,7 +3630,7 @@
             android.Manifest.permission.NETWORK_SETUP_WIZARD,
             android.Manifest.permission.NETWORK_STACK
     })
-    public void connect(int networkId, ActionListener listener) {
+    public void connect(int networkId, @Nullable ActionListener listener) {
         if (networkId < 0) throw new IllegalArgumentException("Network id cannot be negative");
         getChannel().sendMessage(CONNECT_NETWORK, networkId, putListener(listener));
     }
@@ -3658,7 +3661,7 @@
             android.Manifest.permission.NETWORK_SETUP_WIZARD,
             android.Manifest.permission.NETWORK_STACK
     })
-    public void save(WifiConfiguration config, ActionListener listener) {
+    public void save(@NonNull WifiConfiguration config, @Nullable ActionListener listener) {
         if (config == null) throw new IllegalArgumentException("config cannot be null");
         getChannel().sendMessage(SAVE_NETWORK, 0, putListener(listener), config);
     }
@@ -3682,7 +3685,7 @@
             android.Manifest.permission.NETWORK_SETUP_WIZARD,
             android.Manifest.permission.NETWORK_STACK
     })
-    public void forget(int netId, ActionListener listener) {
+    public void forget(int netId, @Nullable ActionListener listener) {
         if (netId < 0) throw new IllegalArgumentException("Network id cannot be negative");
         getChannel().sendMessage(FORGET_NETWORK, netId, putListener(listener));
     }
@@ -3702,7 +3705,7 @@
             android.Manifest.permission.NETWORK_SETUP_WIZARD,
             android.Manifest.permission.NETWORK_STACK
     })
-    public void disable(int netId, ActionListener listener) {
+    public void disable(int netId, @Nullable ActionListener listener) {
         if (netId < 0) throw new IllegalArgumentException("Network id cannot be negative");
         getChannel().sendMessage(DISABLE_NETWORK, netId, putListener(listener));
     }
@@ -4343,7 +4346,9 @@
 
     /**
      * Start subscription provisioning flow
+     *
      * @param provider {@link OsuProvider} to provision with
+     * @param executor the Executor on which to run the callback.
      * @param callback {@link ProvisioningCallback} for updates regarding provisioning flow
      * @hide
      */
@@ -4352,45 +4357,48 @@
             android.Manifest.permission.NETWORK_SETTINGS,
             android.Manifest.permission.NETWORK_SETUP_WIZARD
     })
-    public void startSubscriptionProvisioning(OsuProvider provider, ProvisioningCallback callback,
-            @Nullable Handler handler) {
-        Looper looper = (handler == null) ? Looper.getMainLooper() : handler.getLooper();
+    public void startSubscriptionProvisioning(@NonNull OsuProvider provider,
+            @NonNull @CallbackExecutor Executor executor, @NonNull ProvisioningCallback callback) {
+        // Verify arguments
+        if (executor == null) {
+            throw new IllegalArgumentException("executor must not be null");
+        }
+        if (callback == null) {
+            throw new IllegalArgumentException("callback must not be null");
+        }
         try {
             mService.startSubscriptionProvisioning(provider,
-                    new ProvisioningCallbackProxy(looper, callback));
+                    new ProvisioningCallbackProxy(executor, callback));
         } catch (RemoteException e) {
             throw e.rethrowFromSystemServer();
         }
     }
 
+    /**
+     * Helper class to support OSU Provisioning callbacks
+     */
     private static class ProvisioningCallbackProxy extends IProvisioningCallback.Stub {
-        private final Handler mHandler;
+        private final Executor mExecutor;
         private final ProvisioningCallback mCallback;
 
-        ProvisioningCallbackProxy(Looper looper, ProvisioningCallback callback) {
-            mHandler = new Handler(looper);
+        ProvisioningCallbackProxy(Executor executor, ProvisioningCallback callback) {
+            mExecutor = executor;
             mCallback = callback;
         }
 
         @Override
         public void onProvisioningStatus(int status) {
-            mHandler.post(() -> {
-                mCallback.onProvisioningStatus(status);
-            });
+            mExecutor.execute(() -> mCallback.onProvisioningStatus(status));
         }
 
         @Override
         public void onProvisioningFailure(int status) {
-            mHandler.post(() -> {
-                mCallback.onProvisioningFailure(status);
-            });
+            mExecutor.execute(() -> mCallback.onProvisioningFailure(status));
         }
 
         @Override
         public void onProvisioningComplete() {
-            mHandler.post(() -> {
-                mCallback.onProvisioningComplete();
-            });
+            mExecutor.execute(() -> mCallback.onProvisioningComplete());
         }
     }
 
@@ -4524,7 +4532,7 @@
     /**
      * @return true if this device supports Wi-Fi Enhanced Open (OWE)
      */
-    public boolean isOweSupported() {
+    public boolean isEnhancedOpenSupported() {
         return isFeatureSupported(WIFI_FEATURE_OWE);
     }
 
@@ -4575,7 +4583,8 @@
     public static final int DEVICE_MOBILITY_STATE_UNKNOWN = 0;
 
     /**
-     * High movement device mobility state
+     * High movement device mobility state.
+     * e.g. on a bike, in a motor vehicle
      *
      * @see #setDeviceMobilityState(int)
      *
@@ -4585,7 +4594,8 @@
     public static final int DEVICE_MOBILITY_STATE_HIGH_MVMT = 1;
 
     /**
-     * Low movement device mobility state
+     * Low movement device mobility state.
+     * e.g. walking, running
      *
      * @see #setDeviceMobilityState(int)
      *
@@ -4607,6 +4617,8 @@
     /**
      * Updates the device mobility state. Wifi uses this information to adjust the interval between
      * Wifi scans in order to balance power consumption with scan accuracy.
+     * The default mobility state when the device boots is {@link #DEVICE_MOBILITY_STATE_UNKNOWN}.
+     * This API should be called whenever there is a change in the mobility state.
      * @param state the updated device mobility state
      * @hide
      */
diff --git a/wifi/java/android/net/wifi/WifiNetworkAgentSpecifier.java b/wifi/java/android/net/wifi/WifiNetworkAgentSpecifier.java
index 9d87466..24aa23a 100644
--- a/wifi/java/android/net/wifi/WifiNetworkAgentSpecifier.java
+++ b/wifi/java/android/net/wifi/WifiNetworkAgentSpecifier.java
@@ -74,7 +74,7 @@
     /**
      * @hide
      */
-    public static final Creator<WifiNetworkAgentSpecifier> CREATOR =
+    public static final @android.annotation.NonNull Creator<WifiNetworkAgentSpecifier> CREATOR =
             new Creator<WifiNetworkAgentSpecifier>() {
                 @Override
                 public WifiNetworkAgentSpecifier createFromParcel(@NonNull Parcel in) {
diff --git a/wifi/java/android/net/wifi/WifiNetworkConnectionStatistics.java b/wifi/java/android/net/wifi/WifiNetworkConnectionStatistics.java
index 9b2fdc8..8262a7a 100644
--- a/wifi/java/android/net/wifi/WifiNetworkConnectionStatistics.java
+++ b/wifi/java/android/net/wifi/WifiNetworkConnectionStatistics.java
@@ -68,7 +68,7 @@
     }
 
     /** Implement the Parcelable interface */
-    public static final Creator<WifiNetworkConnectionStatistics> CREATOR =
+    public static final @android.annotation.NonNull Creator<WifiNetworkConnectionStatistics> CREATOR =
         new Creator<WifiNetworkConnectionStatistics>() {
             public WifiNetworkConnectionStatistics createFromParcel(Parcel in) {
                 int numConnection = in.readInt();
diff --git a/wifi/java/android/net/wifi/WifiNetworkSpecifier.java b/wifi/java/android/net/wifi/WifiNetworkSpecifier.java
index c99bd2e..8b56b3f 100644
--- a/wifi/java/android/net/wifi/WifiNetworkSpecifier.java
+++ b/wifi/java/android/net/wifi/WifiNetworkSpecifier.java
@@ -45,7 +45,7 @@
     /**
      * Builder used to create {@link WifiNetworkSpecifier} objects.
      */
-    public static class Builder {
+    public static final class Builder {
         private static final String MATCH_ALL_SSID_PATTERN_PATH = ".*";
         private static final String MATCH_EMPTY_SSID_PATTERN_PATH = "";
         private static final Pair<MacAddress, MacAddress> MATCH_NO_BSSID_PATTERN1 =
@@ -115,7 +115,7 @@
          *                    string pattern to use for matching the network's SSID.
          * @return Instance of {@link Builder} to enable chaining of the builder method.
          */
-        public Builder setSsidPattern(@NonNull PatternMatcher ssidPattern) {
+        public @NonNull Builder setSsidPattern(@NonNull PatternMatcher ssidPattern) {
             checkNotNull(ssidPattern);
             mSsidPatternMatcher = ssidPattern;
             return this;
@@ -133,7 +133,7 @@
          * @return Instance of {@link Builder} to enable chaining of the builder method.
          * @throws IllegalArgumentException if the SSID is not valid unicode.
          */
-        public Builder setSsid(@NonNull String ssid) {
+        public @NonNull Builder setSsid(@NonNull String ssid) {
             checkNotNull(ssid);
             final CharsetEncoder unicodeEncoder = StandardCharsets.UTF_8.newEncoder();
             if (!unicodeEncoder.canEncode(ssid)) {
@@ -155,7 +155,7 @@
          * @param mask Mask for BSSID pattern.
          * @return Instance of {@link Builder} to enable chaining of the builder method.
          */
-        public Builder setBssidPattern(
+        public @NonNull Builder setBssidPattern(
                 @NonNull MacAddress baseAddress, @NonNull MacAddress mask) {
             checkNotNull(baseAddress, mask);
             mBssidPatternMatcher = Pair.create(baseAddress, mask);
@@ -174,7 +174,7 @@
          * @param bssid BSSID of the network.
          * @return Instance of {@link Builder} to enable chaining of the builder method.
          */
-        public Builder setBssid(@NonNull MacAddress bssid) {
+        public @NonNull Builder setBssid(@NonNull MacAddress bssid) {
             checkNotNull(bssid);
             mBssidPatternMatcher = Pair.create(bssid, MATCH_EXACT_BSSID_PATTERN_MASK);
             return this;
@@ -185,7 +185,7 @@
          *
          * @return Instance of {@link Builder} to enable chaining of the builder method.
          */
-        public Builder setIsEnhancedOpen() {
+        public @NonNull Builder setIsEnhancedOpen() {
             mIsEnhancedOpen = true;
             return this;
         }
@@ -198,7 +198,7 @@
          * @return Instance of {@link Builder} to enable chaining of the builder method.
          * @throws IllegalArgumentException if the passphrase is not ASCII encodable.
          */
-        public Builder setWpa2Passphrase(@NonNull String passphrase) {
+        public @NonNull Builder setWpa2Passphrase(@NonNull String passphrase) {
             checkNotNull(passphrase);
             final CharsetEncoder asciiEncoder = StandardCharsets.US_ASCII.newEncoder();
             if (!asciiEncoder.canEncode(passphrase)) {
@@ -216,7 +216,7 @@
          * @return Instance of {@link Builder} to enable chaining of the builder method.
          * @throws IllegalArgumentException if the passphrase is not ASCII encodable.
          */
-        public Builder setWpa3Passphrase(@NonNull String passphrase) {
+        public @NonNull Builder setWpa3Passphrase(@NonNull String passphrase) {
             checkNotNull(passphrase);
             final CharsetEncoder asciiEncoder = StandardCharsets.US_ASCII.newEncoder();
             if (!asciiEncoder.canEncode(passphrase)) {
@@ -233,7 +233,7 @@
          * @param enterpriseConfig Instance of {@link WifiEnterpriseConfig}.
          * @return Instance of {@link Builder} to enable chaining of the builder method.
          */
-        public Builder setWpa2EnterpriseConfig(
+        public @NonNull Builder setWpa2EnterpriseConfig(
                 @NonNull WifiEnterpriseConfig enterpriseConfig) {
             checkNotNull(enterpriseConfig);
             mWpa2EnterpriseConfig = new WifiEnterpriseConfig(enterpriseConfig);
@@ -247,7 +247,7 @@
          * @param enterpriseConfig Instance of {@link WifiEnterpriseConfig}.
          * @return Instance of {@link Builder} to enable chaining of the builder method.
          */
-        public Builder setWpa3EnterpriseConfig(
+        public @NonNull Builder setWpa3EnterpriseConfig(
                 @NonNull WifiEnterpriseConfig enterpriseConfig) {
             checkNotNull(enterpriseConfig);
             mWpa3EnterpriseConfig = new WifiEnterpriseConfig(enterpriseConfig);
@@ -263,12 +263,11 @@
          *
          * @return Instance of {@link Builder} to enable chaining of the builder method.
          */
-        public Builder setIsHiddenSsid() {
+        public @NonNull Builder setIsHiddenSsid() {
             mIsHiddenSSID = true;
             return this;
         }
 
-
         private void setSecurityParamsInWifiConfiguration(
                 @NonNull WifiConfiguration configuration) {
             if (!TextUtils.isEmpty(mWpa2PskPassphrase)) { // WPA-PSK network.
@@ -409,7 +408,7 @@
          * @return Instance of {@link NetworkSpecifier}.
          * @throws IllegalStateException on invalid params set.
          */
-        public NetworkSpecifier build() {
+        public @NonNull WifiNetworkSpecifier build() {
             if (!hasSetAnyPattern()) {
                 throw new IllegalStateException("one of setSsidPattern/setSsid/setBssidPattern/"
                         + "setBssid should be invoked for specifier");
@@ -496,7 +495,7 @@
         this.requestorPackageName = requestorPackageName;
     }
 
-    public static final Creator<WifiNetworkSpecifier> CREATOR =
+    public static final @NonNull Creator<WifiNetworkSpecifier> CREATOR =
             new Creator<WifiNetworkSpecifier>() {
                 @Override
                 public WifiNetworkSpecifier createFromParcel(Parcel in) {
diff --git a/wifi/java/android/net/wifi/WifiNetworkSuggestion.java b/wifi/java/android/net/wifi/WifiNetworkSuggestion.java
index f02404f..3742b83 100644
--- a/wifi/java/android/net/wifi/WifiNetworkSuggestion.java
+++ b/wifi/java/android/net/wifi/WifiNetworkSuggestion.java
@@ -45,7 +45,7 @@
     /**
      * Builder used to create {@link WifiNetworkSuggestion} objects.
      */
-    public static class Builder {
+    public static final class Builder {
         private static final int UNASSIGNED_PRIORITY = -1;
 
         /**
@@ -125,7 +125,7 @@
          * @return Instance of {@link Builder} to enable chaining of the builder method.
          * @throws IllegalArgumentException if the SSID is not valid unicode.
          */
-        public Builder setSsid(@NonNull String ssid) {
+        public @NonNull Builder setSsid(@NonNull String ssid) {
             checkNotNull(ssid);
             final CharsetEncoder unicodeEncoder = StandardCharsets.UTF_8.newEncoder();
             if (!unicodeEncoder.canEncode(ssid)) {
@@ -150,7 +150,7 @@
          * @param bssid BSSID of the network.
          * @return Instance of {@link Builder} to enable chaining of the builder method.
          */
-        public Builder setBssid(@NonNull MacAddress bssid) {
+        public @NonNull Builder setBssid(@NonNull MacAddress bssid) {
             checkNotNull(bssid);
             mBssid = MacAddress.fromBytes(bssid.toByteArray());
             return this;
@@ -161,7 +161,7 @@
          *
          * @return Instance of {@link Builder} to enable chaining of the builder method.
          */
-        public Builder setIsEnhancedOpen() {
+        public @NonNull Builder setIsEnhancedOpen() {
             mIsEnhancedOpen = true;
             return this;
         }
@@ -174,7 +174,7 @@
          * @return Instance of {@link Builder} to enable chaining of the builder method.
          * @throws IllegalArgumentException if the passphrase is not ASCII encodable.
          */
-        public Builder setWpa2Passphrase(@NonNull String passphrase) {
+        public @NonNull Builder setWpa2Passphrase(@NonNull String passphrase) {
             checkNotNull(passphrase);
             final CharsetEncoder asciiEncoder = StandardCharsets.US_ASCII.newEncoder();
             if (!asciiEncoder.canEncode(passphrase)) {
@@ -192,7 +192,7 @@
          * @return Instance of {@link Builder} to enable chaining of the builder method.
          * @throws IllegalArgumentException if the passphrase is not ASCII encodable.
          */
-        public Builder setWpa3Passphrase(@NonNull String passphrase) {
+        public @NonNull Builder setWpa3Passphrase(@NonNull String passphrase) {
             checkNotNull(passphrase);
             final CharsetEncoder asciiEncoder = StandardCharsets.US_ASCII.newEncoder();
             if (!asciiEncoder.canEncode(passphrase)) {
@@ -209,7 +209,7 @@
          * @param enterpriseConfig Instance of {@link WifiEnterpriseConfig}.
          * @return Instance of {@link Builder} to enable chaining of the builder method.
          */
-        public Builder setWpa2EnterpriseConfig(
+        public @NonNull Builder setWpa2EnterpriseConfig(
                 @NonNull WifiEnterpriseConfig enterpriseConfig) {
             checkNotNull(enterpriseConfig);
             mWpa2EnterpriseConfig = new WifiEnterpriseConfig(enterpriseConfig);
@@ -223,7 +223,7 @@
          * @param enterpriseConfig Instance of {@link WifiEnterpriseConfig}.
          * @return Instance of {@link Builder} to enable chaining of the builder method.
          */
-        public Builder setWpa3EnterpriseConfig(
+        public @NonNull Builder setWpa3EnterpriseConfig(
                 @NonNull WifiEnterpriseConfig enterpriseConfig) {
             checkNotNull(enterpriseConfig);
             mWpa3EnterpriseConfig = new WifiEnterpriseConfig(enterpriseConfig);
@@ -237,7 +237,7 @@
          *
          * @return Instance of {@link Builder} to enable chaining of the builder method.
          */
-        public Builder setIsHiddenSsid() {
+        public @NonNull Builder setIsHiddenSsid() {
             mIsHiddenSSID = true;
             return this;
         }
@@ -255,7 +255,7 @@
          *
          * @return Instance of {@link Builder} to enable chaining of the builder method.
          */
-        public Builder setIsAppInteractionRequired() {
+        public @NonNull Builder setIsAppInteractionRequired() {
             mIsAppInteractionRequired = true;
             return this;
         }
@@ -267,7 +267,7 @@
          *
          * @return Instance of {@link Builder} to enable chaining of the builder method.
          */
-        public Builder setIsUserInteractionRequired() {
+        public @NonNull Builder setIsUserInteractionRequired() {
             mIsUserInteractionRequired = true;
             return this;
         }
@@ -283,7 +283,7 @@
          * @return Instance of {@link Builder} to enable chaining of the builder method.
          * @throws IllegalArgumentException if the priority value is negative.
          */
-        public Builder setPriority(int priority) {
+        public @NonNull Builder setPriority(int priority) {
             if (priority < 0) {
                 throw new IllegalArgumentException("Invalid priority value " + priority);
             }
@@ -298,7 +298,7 @@
          *
          * @return Instance of {@link Builder} to enable chaining of the builder method.
          */
-        public Builder setIsMetered() {
+        public @NonNull Builder setIsMetered() {
             mIsMetered = true;
             return this;
         }
@@ -406,7 +406,7 @@
          * @return Instance of {@link WifiNetworkSuggestion}.
          * @throws IllegalStateException on invalid params set.
          */
-        public WifiNetworkSuggestion build() {
+        public @NonNull WifiNetworkSuggestion build() {
             if (mSsid == null) {
                 throw new IllegalStateException("setSsid should be invoked for suggestion");
             }
@@ -483,7 +483,7 @@
         this.suggestorPackageName = suggestorPackageName;
     }
 
-    public static final Creator<WifiNetworkSuggestion> CREATOR =
+    public static final @NonNull Creator<WifiNetworkSuggestion> CREATOR =
             new Creator<WifiNetworkSuggestion>() {
                 @Override
                 public WifiNetworkSuggestion createFromParcel(Parcel in) {
diff --git a/wifi/java/android/net/wifi/WifiScanner.java b/wifi/java/android/net/wifi/WifiScanner.java
index b73551f..66dc992 100644
--- a/wifi/java/android/net/wifi/WifiScanner.java
+++ b/wifi/java/android/net/wifi/WifiScanner.java
@@ -310,7 +310,7 @@
         }
 
         /** Implement the Parcelable interface {@hide} */
-        public static final Creator<ScanSettings> CREATOR =
+        public static final @android.annotation.NonNull Creator<ScanSettings> CREATOR =
                 new Creator<ScanSettings>() {
                     public ScanSettings createFromParcel(Parcel in) {
                         ScanSettings settings = new ScanSettings();
@@ -453,7 +453,7 @@
         }
 
         /** Implement the Parcelable interface {@hide} */
-        public static final Creator<ScanData> CREATOR =
+        public static final @android.annotation.NonNull Creator<ScanData> CREATOR =
                 new Creator<ScanData>() {
                     public ScanData createFromParcel(Parcel in) {
                         int id = in.readInt();
@@ -505,7 +505,7 @@
         }
 
         /** Implement the Parcelable interface {@hide} */
-        public static final Creator<ParcelableScanData> CREATOR =
+        public static final @android.annotation.NonNull Creator<ParcelableScanData> CREATOR =
                 new Creator<ParcelableScanData>() {
                     public ParcelableScanData createFromParcel(Parcel in) {
                         int n = in.readInt();
@@ -553,7 +553,7 @@
         }
 
         /** Implement the Parcelable interface {@hide} */
-        public static final Creator<ParcelableScanResults> CREATOR =
+        public static final @android.annotation.NonNull Creator<ParcelableScanResults> CREATOR =
                 new Creator<ParcelableScanResults>() {
                     public ParcelableScanResults createFromParcel(Parcel in) {
                         int n = in.readInt();
@@ -684,7 +684,7 @@
         }
 
         /** Implement the Parcelable interface {@hide} */
-        public static final Creator<PnoSettings> CREATOR =
+        public static final @android.annotation.NonNull Creator<PnoSettings> CREATOR =
                 new Creator<PnoSettings>() {
                     public PnoSettings createFromParcel(Parcel in) {
                         PnoSettings settings = new PnoSettings();
@@ -1029,7 +1029,7 @@
         }
 
         /** Implement the Parcelable interface {@hide} */
-        public static final Creator<WifiChangeSettings> CREATOR =
+        public static final @android.annotation.NonNull Creator<WifiChangeSettings> CREATOR =
                 new Creator<WifiChangeSettings>() {
                     public WifiChangeSettings createFromParcel(Parcel in) {
                         return new WifiChangeSettings();
@@ -1140,7 +1140,7 @@
         }
 
         /** Implement the Parcelable interface {@hide} */
-        public static final Creator<HotlistSettings> CREATOR =
+        public static final @android.annotation.NonNull Creator<HotlistSettings> CREATOR =
                 new Creator<HotlistSettings>() {
                     public HotlistSettings createFromParcel(Parcel in) {
                         HotlistSettings settings = new HotlistSettings();
@@ -1373,7 +1373,7 @@
         }
 
         /** Implement the Parcelable interface {@hide} */
-        public static final Creator<OperationResult> CREATOR =
+        public static final @android.annotation.NonNull Creator<OperationResult> CREATOR =
                 new Creator<OperationResult>() {
                     public OperationResult createFromParcel(Parcel in) {
                         int reason = in.readInt();
diff --git a/wifi/java/android/net/wifi/WifiSsid.java b/wifi/java/android/net/wifi/WifiSsid.java
index 9acbc14..fd59390 100644
--- a/wifi/java/android/net/wifi/WifiSsid.java
+++ b/wifi/java/android/net/wifi/WifiSsid.java
@@ -252,7 +252,7 @@
 
     /** Implement the Parcelable interface {@hide} */
     @UnsupportedAppUsage
-    public static final Creator<WifiSsid> CREATOR =
+    public static final @android.annotation.NonNull Creator<WifiSsid> CREATOR =
         new Creator<WifiSsid>() {
             public WifiSsid createFromParcel(Parcel in) {
                 WifiSsid ssid = new WifiSsid();
diff --git a/wifi/java/android/net/wifi/WifiUsabilityStatsEntry.java b/wifi/java/android/net/wifi/WifiUsabilityStatsEntry.java
index c43818d..2dee971 100644
--- a/wifi/java/android/net/wifi/WifiUsabilityStatsEntry.java
+++ b/wifi/java/android/net/wifi/WifiUsabilityStatsEntry.java
@@ -167,7 +167,7 @@
     }
 
     /** Implement the Parcelable interface */
-    public static final Creator<WifiUsabilityStatsEntry> CREATOR =
+    public static final @android.annotation.NonNull Creator<WifiUsabilityStatsEntry> CREATOR =
             new Creator<WifiUsabilityStatsEntry>() {
         public WifiUsabilityStatsEntry createFromParcel(Parcel in) {
             return new WifiUsabilityStatsEntry(
diff --git a/wifi/java/android/net/wifi/WpsInfo.java b/wifi/java/android/net/wifi/WpsInfo.java
index ae3104b..00cb243 100644
--- a/wifi/java/android/net/wifi/WpsInfo.java
+++ b/wifi/java/android/net/wifi/WpsInfo.java
@@ -85,7 +85,7 @@
     }
 
     /** Implement the Parcelable interface */
-    public static final Creator<WpsInfo> CREATOR =
+    public static final @android.annotation.NonNull Creator<WpsInfo> CREATOR =
         new Creator<WpsInfo>() {
             public WpsInfo createFromParcel(Parcel in) {
                 WpsInfo config = new WpsInfo();
diff --git a/wifi/java/android/net/wifi/WpsResult.java b/wifi/java/android/net/wifi/WpsResult.java
index d4fd3e2..f2ffb6f 100644
--- a/wifi/java/android/net/wifi/WpsResult.java
+++ b/wifi/java/android/net/wifi/WpsResult.java
@@ -74,7 +74,7 @@
     }
 
     /** Implement the Parcelable interface {@hide} */
-    public static final Creator<WpsResult> CREATOR =
+    public static final @android.annotation.NonNull Creator<WpsResult> CREATOR =
         new Creator<WpsResult>() {
             public WpsResult createFromParcel(Parcel in) {
                 WpsResult result = new WpsResult();
diff --git a/wifi/java/android/net/wifi/aware/Characteristics.java b/wifi/java/android/net/wifi/aware/Characteristics.java
index 70474fd..e2cf4dc 100644
--- a/wifi/java/android/net/wifi/aware/Characteristics.java
+++ b/wifi/java/android/net/wifi/aware/Characteristics.java
@@ -87,7 +87,7 @@
         return 0;
     }
 
-    public static final Creator<Characteristics> CREATOR =
+    public static final @android.annotation.NonNull Creator<Characteristics> CREATOR =
             new Creator<Characteristics>() {
                 @Override
                 public Characteristics createFromParcel(Parcel in) {
diff --git a/wifi/java/android/net/wifi/aware/ConfigRequest.java b/wifi/java/android/net/wifi/aware/ConfigRequest.java
index cc14ab2..1e46d1b 100644
--- a/wifi/java/android/net/wifi/aware/ConfigRequest.java
+++ b/wifi/java/android/net/wifi/aware/ConfigRequest.java
@@ -112,7 +112,7 @@
         dest.writeIntArray(mDiscoveryWindowInterval);
     }
 
-    public static final Creator<ConfigRequest> CREATOR = new Creator<ConfigRequest>() {
+    public static final @android.annotation.NonNull Creator<ConfigRequest> CREATOR = new Creator<ConfigRequest>() {
         @Override
         public ConfigRequest[] newArray(int size) {
             return new ConfigRequest[size];
diff --git a/wifi/java/android/net/wifi/aware/DiscoverySession.java b/wifi/java/android/net/wifi/aware/DiscoverySession.java
index a47e70b..d97f6fb 100644
--- a/wifi/java/android/net/wifi/aware/DiscoverySession.java
+++ b/wifi/java/android/net/wifi/aware/DiscoverySession.java
@@ -36,7 +36,7 @@
  * <ul>
  *      <li>Sending messages: {@link #sendMessage(PeerHandle, int, byte[])} method.
  *      <li>Creating a network-specifier when requesting a Aware connection using
- *      {@link WifiAwareManager.NetworkSpecifierBuilder}.
+ *      {@link WifiAwareNetworkSpecifier.Builder}.
  * </ul>
  * <p>
  * The {@link #close()} method must be called to destroy discovery sessions once they are
@@ -270,7 +270,7 @@
      * <p>
      * To set up an encrypted link use the
      * {@link #createNetworkSpecifierPassphrase(PeerHandle, String)} API.
-     * @deprecated Use the replacement {@link WifiAwareManager.NetworkSpecifierBuilder}.
+     * @deprecated Use the replacement {@link WifiAwareNetworkSpecifier.Builder}.
      *
      * @param peerHandle The peer's handle obtained through
      * {@link DiscoverySessionCallback#onServiceDiscovered(PeerHandle, byte[], java.util.List)}
@@ -320,7 +320,7 @@
      * <p>
      * Note: per the Wi-Fi Aware specification the roles are fixed - a Subscriber is an INITIATOR
      * and a Publisher is a RESPONDER.
-     * @deprecated Use the replacement {@link WifiAwareManager.NetworkSpecifierBuilder}.
+     * @deprecated Use the replacement {@link WifiAwareNetworkSpecifier.Builder}.
      *
      * @param peerHandle The peer's handle obtained through
      * {@link DiscoverySessionCallback#onServiceDiscovered(PeerHandle,
@@ -380,7 +380,7 @@
      * <p>
      * Note: per the Wi-Fi Aware specification the roles are fixed - a Subscriber is an INITIATOR
      * and a Publisher is a RESPONDER.
-     * @deprecated Use the replacement {@link WifiAwareManager.NetworkSpecifierBuilder}.
+     * @deprecated Use the replacement {@link WifiAwareNetworkSpecifier.Builder}.
      *
      * @param peerHandle The peer's handle obtained through
      * {@link DiscoverySessionCallback#onServiceDiscovered(PeerHandle,
diff --git a/wifi/java/android/net/wifi/aware/ParcelablePeerHandle.java b/wifi/java/android/net/wifi/aware/ParcelablePeerHandle.java
index 4ddf872..ca473db 100644
--- a/wifi/java/android/net/wifi/aware/ParcelablePeerHandle.java
+++ b/wifi/java/android/net/wifi/aware/ParcelablePeerHandle.java
@@ -16,6 +16,7 @@
 
 package android.net.wifi.aware;
 
+import android.annotation.NonNull;
 import android.os.Parcel;
 import android.os.Parcelable;
 
@@ -29,7 +30,7 @@
      *
      * @param peerHandle The {@link PeerHandle} to be made parcelable.
      */
-    public ParcelablePeerHandle(PeerHandle peerHandle) {
+    public ParcelablePeerHandle(@NonNull PeerHandle peerHandle) {
         super(peerHandle.peerId);
     }
 
@@ -43,7 +44,7 @@
         dest.writeInt(peerId);
     }
 
-    public static final Creator<ParcelablePeerHandle> CREATOR =
+    public static final @android.annotation.NonNull Creator<ParcelablePeerHandle> CREATOR =
             new Creator<ParcelablePeerHandle>() {
                 @Override
                 public ParcelablePeerHandle[] newArray(int size) {
diff --git a/wifi/java/android/net/wifi/aware/PublishConfig.java b/wifi/java/android/net/wifi/aware/PublishConfig.java
index d43f727..f0c7967 100644
--- a/wifi/java/android/net/wifi/aware/PublishConfig.java
+++ b/wifi/java/android/net/wifi/aware/PublishConfig.java
@@ -129,7 +129,7 @@
         dest.writeInt(mEnableRanging ? 1 : 0);
     }
 
-    public static final Creator<PublishConfig> CREATOR = new Creator<PublishConfig>() {
+    public static final @android.annotation.NonNull Creator<PublishConfig> CREATOR = new Creator<PublishConfig>() {
         @Override
         public PublishConfig[] newArray(int size) {
             return new PublishConfig[size];
diff --git a/wifi/java/android/net/wifi/aware/SubscribeConfig.java b/wifi/java/android/net/wifi/aware/SubscribeConfig.java
index 51353c6..f477490 100644
--- a/wifi/java/android/net/wifi/aware/SubscribeConfig.java
+++ b/wifi/java/android/net/wifi/aware/SubscribeConfig.java
@@ -146,7 +146,7 @@
         dest.writeInt(mMaxDistanceMmSet ? 1 : 0);
     }
 
-    public static final Creator<SubscribeConfig> CREATOR = new Creator<SubscribeConfig>() {
+    public static final @android.annotation.NonNull Creator<SubscribeConfig> CREATOR = new Creator<SubscribeConfig>() {
         @Override
         public SubscribeConfig[] newArray(int size) {
             return new SubscribeConfig[size];
diff --git a/wifi/java/android/net/wifi/aware/WifiAwareAgentNetworkSpecifier.java b/wifi/java/android/net/wifi/aware/WifiAwareAgentNetworkSpecifier.java
index 4bee837..9164d04 100644
--- a/wifi/java/android/net/wifi/aware/WifiAwareAgentNetworkSpecifier.java
+++ b/wifi/java/android/net/wifi/aware/WifiAwareAgentNetworkSpecifier.java
@@ -77,7 +77,7 @@
         dest.writeArray(mNetworkSpecifiers.toArray());
     }
 
-    public static final Creator<WifiAwareAgentNetworkSpecifier> CREATOR =
+    public static final @android.annotation.NonNull Creator<WifiAwareAgentNetworkSpecifier> CREATOR =
             new Creator<WifiAwareAgentNetworkSpecifier>() {
                 @Override
                 public WifiAwareAgentNetworkSpecifier createFromParcel(Parcel in) {
@@ -210,7 +210,7 @@
             dest.writeBlob(mData);
         }
 
-        public static final Creator<ByteArrayWrapper> CREATOR =
+        public static final @android.annotation.NonNull Creator<ByteArrayWrapper> CREATOR =
                 new Creator<ByteArrayWrapper>() {
                     @Override
                     public ByteArrayWrapper createFromParcel(Parcel in) {
diff --git a/wifi/java/android/net/wifi/aware/WifiAwareManager.java b/wifi/java/android/net/wifi/aware/WifiAwareManager.java
index 8aef7a2..c9b0b12 100644
--- a/wifi/java/android/net/wifi/aware/WifiAwareManager.java
+++ b/wifi/java/android/net/wifi/aware/WifiAwareManager.java
@@ -21,7 +21,6 @@
 import android.annotation.Nullable;
 import android.annotation.SdkConstant;
 import android.annotation.SdkConstant.SdkConstantType;
-import android.annotation.SystemApi;
 import android.annotation.SystemService;
 import android.content.Context;
 import android.net.ConnectivityManager;
@@ -35,7 +34,6 @@
 import android.os.Message;
 import android.os.Process;
 import android.os.RemoteException;
-import android.text.TextUtils;
 import android.util.Log;
 
 import libcore.util.HexEncoding;
@@ -59,7 +57,7 @@
  * {@link WifiAwareSession#subscribe(SubscribeConfig, DiscoverySessionCallback, Handler)}.
  * <li>Create a Aware network specifier to be used with
  * {@link ConnectivityManager#requestNetwork(NetworkRequest, ConnectivityManager.NetworkCallback)}
- * to set-up a Aware connection with a peer. Refer to {@link NetworkSpecifierBuilder}.
+ * to set-up a Aware connection with a peer. Refer to {@link WifiAwareNetworkSpecifier.Builder}.
  * </ul>
  * <p>
  *     Aware may not be usable when Wi-Fi is disabled (and other conditions). To validate that
@@ -108,7 +106,7 @@
  *        <li>{@link NetworkRequest.Builder#addTransportType(int)} of
  *        {@link android.net.NetworkCapabilities#TRANSPORT_WIFI_AWARE}.
  *        <li>{@link NetworkRequest.Builder#setNetworkSpecifier(String)} using
- *        {@link NetworkSpecifierBuilder}.
+ *        {@link WifiAwareNetworkSpecifier.Builder}.
  *    </ul>
  */
 @SystemService(Context.WIFI_AWARE_SERVICE)
@@ -408,7 +406,7 @@
 
         if (!WifiAwareUtils.isLegacyVersion(mContext, Build.VERSION_CODES.Q)) {
             throw new UnsupportedOperationException(
-                    "API not deprecated - use WifiAwareManager.NetworkSpecifierBuilder");
+                    "API not deprecated - use WifiAwareNetworkSpecifier.Builder");
         }
 
         if (role != WIFI_AWARE_DATA_PATH_ROLE_INITIATOR
@@ -813,198 +811,4 @@
             mOriginalCallback.onSessionTerminated();
         }
     }
-
-    /**
-     * A builder class for a Wi-Fi Aware network specifier to set up an Aware connection with a
-     * peer.
-     * <p>
-     * Note that all Wi-Fi Aware connection specifier objects must call the
-     * {@link NetworkSpecifierBuilder#setDiscoverySession(DiscoverySession)} to specify the context
-     * within which the connection is created, and
-     * {@link NetworkSpecifierBuilder#setPeerHandle(PeerHandle)} to specify the peer to which the
-     * connection is created.
-     */
-    public static class NetworkSpecifierBuilder {
-        private DiscoverySession mDiscoverySession;
-        private PeerHandle mPeerHandle;
-        private String mPskPassphrase;
-        private byte[] mPmk;
-        private int mPort = 0; // invalid value
-        private int mTransportProtocol = -1; // invalid value
-
-        /**
-         * Configure the {@link PublishDiscoverySession} or {@link SubscribeDiscoverySession}
-         * discovery session in whose context the connection is created.
-         * <p>
-         * Note: this method must be called for any connection request!
-         *
-         * @param discoverySession A Wi-Fi Aware discovery session.
-         * @return the current {@link NetworkSpecifierBuilder} builder, enabling chaining of builder
-         *         methods.
-         */
-        public @NonNull NetworkSpecifierBuilder setDiscoverySession(
-                @NonNull DiscoverySession discoverySession) {
-            if (discoverySession == null) {
-                throw new IllegalArgumentException("Non-null discoverySession required");
-            }
-            mDiscoverySession = discoverySession;
-            return this;
-        }
-
-        /**
-         * Configure the {@link PeerHandle} of the peer to which the Wi-Fi Aware connection is
-         * requested. The peer is discovered through Wi-Fi Aware discovery,
-         * <p>
-         * Note: this method must be called for any connection request!
-         *
-         * @param peerHandle The peer's handle obtained through
-         * {@link DiscoverySessionCallback#onServiceDiscovered(PeerHandle, byte[], java.util.List)}
-         *                   or
-         *                   {@link DiscoverySessionCallback#onMessageReceived(PeerHandle, byte[])}.
-         * @return the current {@link NetworkSpecifierBuilder} builder, enabling chaining of builder
-         *         methods.
-         */
-        public @NonNull NetworkSpecifierBuilder setPeerHandle(@NonNull PeerHandle peerHandle) {
-            if (peerHandle == null) {
-                throw new IllegalArgumentException("Non-null peerHandle required");
-            }
-            mPeerHandle = peerHandle;
-            return this;
-        }
-
-        /**
-         * Configure the PSK Passphrase for the Wi-Fi Aware connection being requested. This method
-         * is optional - if not called, then an Open (unencrypted) connection will be created.
-         *
-         * @param pskPassphrase The (optional) passphrase to be used to encrypt the link.
-         * @return the current {@link NetworkSpecifierBuilder} builder, enabling chaining of builder
-         *         methods.
-         */
-        public @NonNull NetworkSpecifierBuilder setPskPassphrase(@NonNull String pskPassphrase) {
-            if (!WifiAwareUtils.validatePassphrase(pskPassphrase)) {
-                throw new IllegalArgumentException("Passphrase must meet length requirements");
-            }
-            mPskPassphrase = pskPassphrase;
-            return this;
-        }
-
-        /**
-         * Configure the PMK for the Wi-Fi Aware connection being requested. This method
-         * is optional - if not called, then an Open (unencrypted) connection will be created.
-         *
-         * @param pmk A PMK (pairwise master key, see IEEE 802.11i) specifying the key to use for
-         *            encrypting the data-path. Use the {@link #setPskPassphrase(String)} to
-         *            specify a Passphrase.
-         * @return the current {@link NetworkSpecifierBuilder} builder, enabling chaining of builder
-         *         methods.
-         * @hide
-         */
-        @SystemApi
-        public @NonNull NetworkSpecifierBuilder setPmk(@NonNull byte[] pmk) {
-            if (!WifiAwareUtils.validatePmk(pmk)) {
-                throw new IllegalArgumentException("PMK must 32 bytes");
-            }
-            mPmk = pmk;
-            return this;
-        }
-
-        /**
-         * Configure the port number which will be used to create a connection over this link. This
-         * configuration should only be done on the server device, e.g. the device creating the
-         * {@link java.net.ServerSocket}.
-         * <p>Notes:
-         * <ul>
-         *     <li>The server device must be the Publisher device!
-         *     <li>The port information can only be specified on secure links, specified using
-         *     {@link #setPskPassphrase(String)}.
-         * </ul>
-         *
-         * @param port A positive integer indicating the port to be used for communication.
-         * @return the current {@link NetworkSpecifierBuilder} builder, enabling chaining of builder
-         *         methods.
-         */
-        public @NonNull NetworkSpecifierBuilder setPort(int port) {
-            if (port <= 0 || port > 65535) {
-                throw new IllegalArgumentException("The port must be a positive value (0, 65535]");
-            }
-            mPort = port;
-            return this;
-        }
-
-        /**
-         * Configure the transport protocol which will be used to create a connection over this
-         * link. This configuration should only be done on the server device, e.g. the device
-         * creating the {@link java.net.ServerSocket} for TCP.
-         * <p>Notes:
-         * <ul>
-         *     <li>The server device must be the Publisher device!
-         *     <li>The transport protocol information can only be specified on secure links,
-         *     specified using {@link #setPskPassphrase(String)}.
-         * </ul>
-         * The transport protocol number is assigned by the Internet Assigned Numbers Authority
-         * (IANA) https://www.iana.org/assignments/protocol-numbers/protocol-numbers.xhtml.
-         *
-         * @param transportProtocol The transport protocol to be used for communication.
-         * @return the current {@link NetworkSpecifierBuilder} builder, enabling chaining of builder
-         *         methods.
-         */
-        public @NonNull NetworkSpecifierBuilder setTransportProtocol(int transportProtocol) {
-            if (transportProtocol < 0 || transportProtocol > 255) {
-                throw new IllegalArgumentException(
-                        "The transport protocol must be in range [0, 255]");
-            }
-            mTransportProtocol = transportProtocol;
-            return this;
-        }
-
-        /**
-         * Create a {@link android.net.NetworkRequest.Builder#setNetworkSpecifier(NetworkSpecifier)}
-         * for a WiFi Aware connection (link) to the specified peer. The
-         * {@link android.net.NetworkRequest.Builder#addTransportType(int)} should be set to
-         * {@link android.net.NetworkCapabilities#TRANSPORT_WIFI_AWARE}.
-         * <p> The default builder constructor will initialize a NetworkSpecifier which requests an
-         * open (non-encrypted) link. To request an encrypted link use the
-         * {@link #setPskPassphrase(String)} builder method.
-         *
-         * @return A {@link NetworkSpecifier} to be used to construct
-         * {@link android.net.NetworkRequest.Builder#setNetworkSpecifier(NetworkSpecifier)} to pass
-         * to {@link android.net.ConnectivityManager#requestNetwork(android.net.NetworkRequest,
-         * android.net.ConnectivityManager.NetworkCallback)}
-         * [or other varieties of that API].
-         */
-        public @NonNull NetworkSpecifier build() {
-            if (mDiscoverySession == null) {
-                throw new IllegalStateException("Null discovery session!?");
-            }
-            if (mPskPassphrase != null & mPmk != null) {
-                throw new IllegalStateException(
-                        "Can only specify a Passphrase or a PMK - not both!");
-            }
-
-            int role = mDiscoverySession instanceof SubscribeDiscoverySession
-                    ? WifiAwareManager.WIFI_AWARE_DATA_PATH_ROLE_INITIATOR
-                    : WifiAwareManager.WIFI_AWARE_DATA_PATH_ROLE_RESPONDER;
-
-            if (mPort != 0 || mTransportProtocol != -1) {
-                if (role != WifiAwareManager.WIFI_AWARE_DATA_PATH_ROLE_RESPONDER) {
-                    throw new IllegalStateException(
-                            "Port and transport protocol information can only "
-                                    + "be specified on the Publisher device (which is the server");
-                }
-                if (TextUtils.isEmpty(mPskPassphrase) && mPmk == null) {
-                    throw new IllegalStateException("Port and transport protocol information can "
-                            + "only be specified on a secure link");
-                }
-            }
-
-            if (role == WIFI_AWARE_DATA_PATH_ROLE_INITIATOR && mPeerHandle == null) {
-                throw new IllegalStateException("Null peerHandle!?");
-            }
-
-            return new WifiAwareNetworkSpecifier(
-                    WifiAwareNetworkSpecifier.NETWORK_SPECIFIER_TYPE_IB, role,
-                    mDiscoverySession.mClientId, mDiscoverySession.mSessionId, mPeerHandle.peerId,
-                    null, mPmk, mPskPassphrase, mPort, mTransportProtocol, Process.myUid());
-        }
-    }
 }
diff --git a/wifi/java/android/net/wifi/aware/WifiAwareNetworkInfo.java b/wifi/java/android/net/wifi/aware/WifiAwareNetworkInfo.java
index b258906..fd26817b 100644
--- a/wifi/java/android/net/wifi/aware/WifiAwareNetworkInfo.java
+++ b/wifi/java/android/net/wifi/aware/WifiAwareNetworkInfo.java
@@ -75,7 +75,7 @@
     /**
      * Get the port number to be used to create a network connection to the Wi-Fi Aware peer.
      * The port information is provided by the app running on the peer which requested the
-     * connection, using the {@link WifiAwareManager.NetworkSpecifierBuilder#setPort(int)}.
+     * connection, using the {@link WifiAwareNetworkSpecifier.Builder#setPort(int)}.
      *
      * @return A port number on the peer. A value of 0 indicates that no port was specified by the
      *         peer.
@@ -88,7 +88,7 @@
      * Get the transport protocol to be used to communicate over a network connection to the Wi-Fi
      * Aware peer. The transport protocol is provided by the app running on the peer which requested
      * the connection, using the
-     * {@link WifiAwareManager.NetworkSpecifierBuilder#setTransportProtocol(int)}.
+     * {@link WifiAwareNetworkSpecifier.Builder#setTransportProtocol(int)}.
      * <p>
      * The transport protocol number is assigned by the Internet Assigned Numbers Authority
      * (IANA) https://www.iana.org/assignments/protocol-numbers/protocol-numbers.xhtml.
@@ -116,7 +116,7 @@
         dest.writeInt(mTransportProtocol);
     }
 
-    public static final Creator<WifiAwareNetworkInfo> CREATOR =
+    public static final @android.annotation.NonNull Creator<WifiAwareNetworkInfo> CREATOR =
             new Creator<WifiAwareNetworkInfo>() {
                 @Override
                 public WifiAwareNetworkInfo createFromParcel(Parcel in) {
diff --git a/wifi/java/android/net/wifi/aware/WifiAwareNetworkSpecifier.java b/wifi/java/android/net/wifi/aware/WifiAwareNetworkSpecifier.java
index a93a6d5..b225116 100644
--- a/wifi/java/android/net/wifi/aware/WifiAwareNetworkSpecifier.java
+++ b/wifi/java/android/net/wifi/aware/WifiAwareNetworkSpecifier.java
@@ -16,9 +16,15 @@
 
 package android.net.wifi.aware;
 
+import static android.net.wifi.aware.WifiAwareManager.WIFI_AWARE_DATA_PATH_ROLE_INITIATOR;
+
+import android.annotation.NonNull;
+import android.annotation.SystemApi;
 import android.net.NetworkSpecifier;
 import android.os.Parcel;
 import android.os.Parcelable;
+import android.os.Process;
+import android.text.TextUtils;
 
 import java.util.Arrays;
 import java.util.Objects;
@@ -29,8 +35,6 @@
  * {@link WifiAwareSession#createNetworkSpecifierOpen(int, byte[])} or
  * {@link DiscoverySession#createNetworkSpecifierOpen(PeerHandle)} or their secure (Passphrase)
  * versions.
- *
- * @hide
  */
 public final class WifiAwareNetworkSpecifier extends NetworkSpecifier implements Parcelable {
     /**
@@ -138,6 +142,8 @@
      * device they all get the same link. However, the link is only set up on the first request -
      * hence only the first can transmit the port information. But we don't want to expose that
      * information to other apps. Limiting to secure links would (usually) imply single app usage.
+     *
+     * @hide
      */
     public final int transportProtocol;
 
@@ -167,7 +173,7 @@
         this.requestorUid = requestorUid;
     }
 
-    public static final Creator<WifiAwareNetworkSpecifier> CREATOR =
+    public static final @android.annotation.NonNull Creator<WifiAwareNetworkSpecifier> CREATOR =
             new Creator<WifiAwareNetworkSpecifier>() {
                 @Override
                 public WifiAwareNetworkSpecifier createFromParcel(Parcel in) {
@@ -292,4 +298,197 @@
             throw new SecurityException("mismatched UIDs");
         }
     }
+
+    /**
+     * A builder class for a Wi-Fi Aware network specifier to set up an Aware connection with a
+     * peer.
+     * <p>
+     * Note that all Wi-Fi Aware connection specifier objects must call the
+     * {@link Builder#setDiscoverySession(DiscoverySession)} to specify the context
+     * within which the connection is created, and
+     * {@link Builder#setPeerHandle(PeerHandle)} to specify the peer to which the
+     * connection is created.
+     */
+    public static final class Builder {
+        private DiscoverySession mDiscoverySession;
+        private PeerHandle mPeerHandle;
+        private String mPskPassphrase;
+        private byte[] mPmk;
+        private int mPort = 0; // invalid value
+        private int mTransportProtocol = -1; // invalid value
+
+        /**
+         * Configure the {@link PublishDiscoverySession} or {@link SubscribeDiscoverySession}
+         * discovery session in whose context the connection is created.
+         * <p>
+         * Note: this method must be called for any connection request!
+         *
+         * @param discoverySession A Wi-Fi Aware discovery session.
+         * @return the current {@link Builder} builder, enabling chaining of builder
+         *         methods.
+         */
+        public @NonNull Builder setDiscoverySession(@NonNull DiscoverySession discoverySession) {
+            if (discoverySession == null) {
+                throw new IllegalArgumentException("Non-null discoverySession required");
+            }
+            mDiscoverySession = discoverySession;
+            return this;
+        }
+
+        /**
+         * Configure the {@link PeerHandle} of the peer to which the Wi-Fi Aware connection is
+         * requested. The peer is discovered through Wi-Fi Aware discovery,
+         * <p>
+         * Note: this method must be called for any connection request!
+         *
+         * @param peerHandle The peer's handle obtained through
+         * {@link DiscoverySessionCallback#onServiceDiscovered(PeerHandle, byte[], java.util.List)}
+         *                   or
+         *                   {@link DiscoverySessionCallback#onMessageReceived(PeerHandle, byte[])}.
+         * @return the current {@link Builder} builder, enabling chaining of builder
+         *         methods.
+         */
+        public @NonNull Builder setPeerHandle(@NonNull PeerHandle peerHandle) {
+            if (peerHandle == null) {
+                throw new IllegalArgumentException("Non-null peerHandle required");
+            }
+            mPeerHandle = peerHandle;
+            return this;
+        }
+
+        /**
+         * Configure the PSK Passphrase for the Wi-Fi Aware connection being requested. This method
+         * is optional - if not called, then an Open (unencrypted) connection will be created.
+         *
+         * @param pskPassphrase The (optional) passphrase to be used to encrypt the link.
+         * @return the current {@link Builder} builder, enabling chaining of builder
+         *         methods.
+         */
+        public @NonNull Builder setPskPassphrase(@NonNull String pskPassphrase) {
+            if (!WifiAwareUtils.validatePassphrase(pskPassphrase)) {
+                throw new IllegalArgumentException("Passphrase must meet length requirements");
+            }
+            mPskPassphrase = pskPassphrase;
+            return this;
+        }
+
+        /**
+         * Configure the PMK for the Wi-Fi Aware connection being requested. This method
+         * is optional - if not called, then an Open (unencrypted) connection will be created.
+         *
+         * @param pmk A PMK (pairwise master key, see IEEE 802.11i) specifying the key to use for
+         *            encrypting the data-path. Use the {@link #setPskPassphrase(String)} to
+         *            specify a Passphrase.
+         * @return the current {@link Builder} builder, enabling chaining of builder
+         *         methods.
+         * @hide
+         */
+        @SystemApi
+        public @NonNull Builder setPmk(@NonNull byte[] pmk) {
+            if (!WifiAwareUtils.validatePmk(pmk)) {
+                throw new IllegalArgumentException("PMK must 32 bytes");
+            }
+            mPmk = pmk;
+            return this;
+        }
+
+        /**
+         * Configure the port number which will be used to create a connection over this link. This
+         * configuration should only be done on the server device, e.g. the device creating the
+         * {@link java.net.ServerSocket}.
+         * <p>Notes:
+         * <ul>
+         *     <li>The server device must be the Publisher device!
+         *     <li>The port information can only be specified on secure links, specified using
+         *     {@link #setPskPassphrase(String)}.
+         * </ul>
+         *
+         * @param port A positive integer indicating the port to be used for communication.
+         * @return the current {@link Builder} builder, enabling chaining of builder
+         *         methods.
+         */
+        public @NonNull Builder setPort(int port) {
+            if (port <= 0 || port > 65535) {
+                throw new IllegalArgumentException("The port must be a positive value (0, 65535]");
+            }
+            mPort = port;
+            return this;
+        }
+
+        /**
+         * Configure the transport protocol which will be used to create a connection over this
+         * link. This configuration should only be done on the server device, e.g. the device
+         * creating the {@link java.net.ServerSocket} for TCP.
+         * <p>Notes:
+         * <ul>
+         *     <li>The server device must be the Publisher device!
+         *     <li>The transport protocol information can only be specified on secure links,
+         *     specified using {@link #setPskPassphrase(String)}.
+         * </ul>
+         * The transport protocol number is assigned by the Internet Assigned Numbers Authority
+         * (IANA) https://www.iana.org/assignments/protocol-numbers/protocol-numbers.xhtml.
+         *
+         * @param transportProtocol The transport protocol to be used for communication.
+         * @return the current {@link Builder} builder, enabling chaining of builder
+         *         methods.
+         */
+        public @NonNull Builder setTransportProtocol(int transportProtocol) {
+            if (transportProtocol < 0 || transportProtocol > 255) {
+                throw new IllegalArgumentException(
+                        "The transport protocol must be in range [0, 255]");
+            }
+            mTransportProtocol = transportProtocol;
+            return this;
+        }
+
+        /**
+         * Create a {@link android.net.NetworkRequest.Builder#setNetworkSpecifier(NetworkSpecifier)}
+         * for a WiFi Aware connection (link) to the specified peer. The
+         * {@link android.net.NetworkRequest.Builder#addTransportType(int)} should be set to
+         * {@link android.net.NetworkCapabilities#TRANSPORT_WIFI_AWARE}.
+         * <p> The default builder constructor will initialize a NetworkSpecifier which requests an
+         * open (non-encrypted) link. To request an encrypted link use the
+         * {@link #setPskPassphrase(String)} builder method.
+         *
+         * @return A {@link NetworkSpecifier} to be used to construct
+         * {@link android.net.NetworkRequest.Builder#setNetworkSpecifier(NetworkSpecifier)} to pass
+         * to {@link android.net.ConnectivityManager#requestNetwork(android.net.NetworkRequest,
+         * android.net.ConnectivityManager.NetworkCallback)}
+         * [or other varieties of that API].
+         */
+        public @NonNull WifiAwareNetworkSpecifier build() {
+            if (mDiscoverySession == null) {
+                throw new IllegalStateException("Null discovery session!?");
+            }
+            if (mPskPassphrase != null & mPmk != null) {
+                throw new IllegalStateException(
+                        "Can only specify a Passphrase or a PMK - not both!");
+            }
+
+            int role = mDiscoverySession instanceof SubscribeDiscoverySession
+                    ? WIFI_AWARE_DATA_PATH_ROLE_INITIATOR
+                    : WifiAwareManager.WIFI_AWARE_DATA_PATH_ROLE_RESPONDER;
+
+            if (mPort != 0 || mTransportProtocol != -1) {
+                if (role != WifiAwareManager.WIFI_AWARE_DATA_PATH_ROLE_RESPONDER) {
+                    throw new IllegalStateException(
+                            "Port and transport protocol information can only "
+                                    + "be specified on the Publisher device (which is the server");
+                }
+                if (TextUtils.isEmpty(mPskPassphrase) && mPmk == null) {
+                    throw new IllegalStateException("Port and transport protocol information can "
+                            + "only be specified on a secure link");
+                }
+            }
+
+            if (role == WIFI_AWARE_DATA_PATH_ROLE_INITIATOR && mPeerHandle == null) {
+                throw new IllegalStateException("Null peerHandle!?");
+            }
+
+            return new WifiAwareNetworkSpecifier(
+                    WifiAwareNetworkSpecifier.NETWORK_SPECIFIER_TYPE_IB, role,
+                    mDiscoverySession.mClientId, mDiscoverySession.mSessionId, mPeerHandle.peerId,
+                    null, mPmk, mPskPassphrase, mPort, mTransportProtocol, Process.myUid());
+        }
+    }
 }
diff --git a/wifi/java/android/net/wifi/aware/WifiAwareSession.java b/wifi/java/android/net/wifi/aware/WifiAwareSession.java
index 245b304..3c97813 100644
--- a/wifi/java/android/net/wifi/aware/WifiAwareSession.java
+++ b/wifi/java/android/net/wifi/aware/WifiAwareSession.java
@@ -213,7 +213,7 @@
      *     This API is targeted for applications which can obtain the peer MAC address using OOB
      *     (out-of-band) discovery. Aware discovery does not provide the MAC address of the peer -
      *     when using Aware discovery use the alternative network specifier method -
-     *     {@link android.net.wifi.aware.WifiAwareManager.NetworkSpecifierBuilder}.
+     *     {@link android.net.wifi.aware.WifiAwareNetworkSpecifier.Builder}.
      * <p>
      * To set up an encrypted link use the
      * {@link #createNetworkSpecifierPassphrase(int, byte[], String)} API.
@@ -254,7 +254,7 @@
      *     This API is targeted for applications which can obtain the peer MAC address using OOB
      *     (out-of-band) discovery. Aware discovery does not provide the MAC address of the peer -
      *     when using Aware discovery use the alternative network specifier method -
-     *     {@link android.net.wifi.aware.WifiAwareManager.NetworkSpecifierBuilder}.
+     *     {@link android.net.wifi.aware.WifiAwareNetworkSpecifier.Builder}.
      *
      * @param role  The role of this device:
      *              {@link WifiAwareManager#WIFI_AWARE_DATA_PATH_ROLE_INITIATOR} or
@@ -300,7 +300,7 @@
      *     This API is targeted for applications which can obtain the peer MAC address using OOB
      *     (out-of-band) discovery. Aware discovery does not provide the MAC address of the peer -
      *     when using Aware discovery use the alternative network specifier method -
-     *     {@link android.net.wifi.aware.WifiAwareManager.NetworkSpecifierBuilder}.
+     *     {@link android.net.wifi.aware.WifiAwareNetworkSpecifier.Builder}.
      *
      * @param role  The role of this device:
      *              {@link WifiAwareManager#WIFI_AWARE_DATA_PATH_ROLE_INITIATOR} or
diff --git a/wifi/java/android/net/wifi/hotspot2/OsuProvider.java b/wifi/java/android/net/wifi/hotspot2/OsuProvider.java
index f91790f..57dff9d 100644
--- a/wifi/java/android/net/wifi/hotspot2/OsuProvider.java
+++ b/wifi/java/android/net/wifi/hotspot2/OsuProvider.java
@@ -16,6 +16,7 @@
 
 package android.net.wifi.hotspot2;
 
+import android.annotation.Nullable;
 import android.annotation.SystemApi;
 import android.graphics.drawable.Icon;
 import android.net.Uri;
@@ -156,7 +157,7 @@
      *
      * @return String matching the default locale, null otherwise
      */
-    public String getFriendlyName() {
+    public @Nullable String getFriendlyName() {
         if (mFriendlyNames == null || mFriendlyNames.isEmpty()) return null;
         String lang = Locale.getDefault().getLanguage();
         String friendlyName = mFriendlyNames.get(lang);
@@ -180,7 +181,7 @@
         return mServiceDescription;
     }
 
-    public Uri getServerUri() {
+    public @Nullable Uri getServerUri() {
         return mServerUri;
     }
 
@@ -256,7 +257,7 @@
                 + " mIcon=" + mIcon;
     }
 
-    public static final Creator<OsuProvider> CREATOR =
+    public static final @android.annotation.NonNull Creator<OsuProvider> CREATOR =
             new Creator<OsuProvider>() {
                 @Override
                 public OsuProvider createFromParcel(Parcel in) {
diff --git a/wifi/java/android/net/wifi/hotspot2/PasspointConfiguration.java b/wifi/java/android/net/wifi/hotspot2/PasspointConfiguration.java
index f09d864..9095b5d 100644
--- a/wifi/java/android/net/wifi/hotspot2/PasspointConfiguration.java
+++ b/wifi/java/android/net/wifi/hotspot2/PasspointConfiguration.java
@@ -600,7 +600,7 @@
         return true;
     }
 
-    public static final Creator<PasspointConfiguration> CREATOR =
+    public static final @android.annotation.NonNull Creator<PasspointConfiguration> CREATOR =
         new Creator<PasspointConfiguration>() {
             @Override
             public PasspointConfiguration createFromParcel(Parcel in) {
diff --git a/wifi/java/android/net/wifi/hotspot2/pps/Credential.java b/wifi/java/android/net/wifi/hotspot2/pps/Credential.java
index 28165e15..9409c03 100644
--- a/wifi/java/android/net/wifi/hotspot2/pps/Credential.java
+++ b/wifi/java/android/net/wifi/hotspot2/pps/Credential.java
@@ -428,7 +428,7 @@
             return true;
         }
 
-        public static final Creator<UserCredential> CREATOR =
+        public static final @android.annotation.NonNull Creator<UserCredential> CREATOR =
             new Creator<UserCredential>() {
                 @Override
                 public UserCredential createFromParcel(Parcel in) {
@@ -599,7 +599,7 @@
             return true;
         }
 
-        public static final Creator<CertificateCredential> CREATOR =
+        public static final @android.annotation.NonNull Creator<CertificateCredential> CREATOR =
             new Creator<CertificateCredential>() {
                 @Override
                 public CertificateCredential createFromParcel(Parcel in) {
@@ -770,7 +770,7 @@
             return true;
         }
 
-        public static final Creator<SimCredential> CREATOR =
+        public static final @android.annotation.NonNull Creator<SimCredential> CREATOR =
             new Creator<SimCredential>() {
                 @Override
                 public SimCredential createFromParcel(Parcel in) {
@@ -1086,7 +1086,7 @@
         return true;
     }
 
-    public static final Creator<Credential> CREATOR =
+    public static final @android.annotation.NonNull Creator<Credential> CREATOR =
         new Creator<Credential>() {
             @Override
             public Credential createFromParcel(Parcel in) {
diff --git a/wifi/java/android/net/wifi/hotspot2/pps/HomeSp.java b/wifi/java/android/net/wifi/hotspot2/pps/HomeSp.java
index d829ea8..49a76c3 100644
--- a/wifi/java/android/net/wifi/hotspot2/pps/HomeSp.java
+++ b/wifi/java/android/net/wifi/hotspot2/pps/HomeSp.java
@@ -345,7 +345,7 @@
         return true;
     }
 
-    public static final Creator<HomeSp> CREATOR =
+    public static final @android.annotation.NonNull Creator<HomeSp> CREATOR =
         new Creator<HomeSp>() {
             @Override
             public HomeSp createFromParcel(Parcel in) {
diff --git a/wifi/java/android/net/wifi/hotspot2/pps/Policy.java b/wifi/java/android/net/wifi/hotspot2/pps/Policy.java
index ee0894b..b0a2cc3 100644
--- a/wifi/java/android/net/wifi/hotspot2/pps/Policy.java
+++ b/wifi/java/android/net/wifi/hotspot2/pps/Policy.java
@@ -279,7 +279,7 @@
             return true;
         }
 
-        public static final Creator<RoamingPartner> CREATOR =
+        public static final @android.annotation.NonNull Creator<RoamingPartner> CREATOR =
             new Creator<RoamingPartner>() {
                 @Override
                 public RoamingPartner createFromParcel(Parcel in) {
@@ -475,7 +475,7 @@
         return true;
     }
 
-    public static final Creator<Policy> CREATOR =
+    public static final @android.annotation.NonNull Creator<Policy> CREATOR =
         new Creator<Policy>() {
             @Override
             public Policy createFromParcel(Parcel in) {
diff --git a/wifi/java/android/net/wifi/hotspot2/pps/UpdateParameter.java b/wifi/java/android/net/wifi/hotspot2/pps/UpdateParameter.java
index 8d30ff1..4a8aa36 100644
--- a/wifi/java/android/net/wifi/hotspot2/pps/UpdateParameter.java
+++ b/wifi/java/android/net/wifi/hotspot2/pps/UpdateParameter.java
@@ -378,7 +378,7 @@
         return true;
     }
 
-    public static final Creator<UpdateParameter> CREATOR =
+    public static final @android.annotation.NonNull Creator<UpdateParameter> CREATOR =
         new Creator<UpdateParameter>() {
             @Override
             public UpdateParameter createFromParcel(Parcel in) {
diff --git a/wifi/java/android/net/wifi/p2p/WifiP2pConfig.java b/wifi/java/android/net/wifi/p2p/WifiP2pConfig.java
index 479adbc..c3cfb02 100644
--- a/wifi/java/android/net/wifi/p2p/WifiP2pConfig.java
+++ b/wifi/java/android/net/wifi/p2p/WifiP2pConfig.java
@@ -17,6 +17,8 @@
 package android.net.wifi.p2p;
 
 import android.annotation.IntDef;
+import android.annotation.NonNull;
+import android.annotation.Nullable;
 import android.annotation.UnsupportedAppUsage;
 import android.net.MacAddress;
 import android.net.wifi.WpsInfo;
@@ -76,13 +78,19 @@
         GROUP_OWNER_BAND_5GHZ
     })
     @Retention(RetentionPolicy.SOURCE)
-    public @interface GroupOwnerBandType {}
+    public @interface GroupOperatingBandType {}
 
     /**
-     * Recognized Group Owner required band.
+     * Allow the system to pick the operating frequency from all supported bands.
      */
     public static final int GROUP_OWNER_BAND_AUTO = 0;
+    /**
+     * Allow the system to pick the operating frequency from the 2.4 GHz band.
+     */
     public static final int GROUP_OWNER_BAND_2GHZ = 1;
+    /**
+     * Allow the system to pick the operating frequency from the 5 GHz band.
+     */
     public static final int GROUP_OWNER_BAND_5GHZ = 2;
 
     /**
@@ -193,7 +201,7 @@
     }
 
     /** Implement the Parcelable interface */
-    public static final Creator<WifiP2pConfig> CREATOR =
+    public static final @android.annotation.NonNull Creator<WifiP2pConfig> CREATOR =
         new Creator<WifiP2pConfig>() {
             public WifiP2pConfig createFromParcel(Parcel in) {
                 WifiP2pConfig config = new WifiP2pConfig();
@@ -219,7 +227,7 @@
     public static final class Builder {
 
         private static final MacAddress MAC_ANY_ADDRESS =
-                MacAddress.fromString("00:00:00:00:00:00");
+                MacAddress.fromString("02:00:00:00:00:00");
 
         private MacAddress mDeviceAddress = MAC_ANY_ADDRESS;
         private String mNetworkName = "";
@@ -232,15 +240,15 @@
          * Specify the peer's MAC address. If not set, the device will
          * try to find a peer whose SSID matches the network name as
          * specified by {@link #setNetworkName(String)}. Specifying null will
-         * reset the peer's MAC address to "00:00:00:00:00:00".
+         * reset the peer's MAC address to "02:00:00:00:00:00".
          * <p>
-         *     Optional. "00:00:00:00:00:00" by default.
+         *     Optional. "02:00:00:00:00:00" by default.
          *
          * @param deviceAddress the peer's MAC address.
          * @return The builder to facilitate chaining
          *         {@code builder.setXXX(..).setXXX(..)}.
          */
-        public Builder setDeviceAddress(MacAddress deviceAddress) {
+        public @NonNull Builder setDeviceAddress(@Nullable MacAddress deviceAddress) {
             if (deviceAddress == null) {
                 mDeviceAddress = MAC_ANY_ADDRESS;
             } else {
@@ -255,7 +263,9 @@
          * <p>
          * A network name shall begin with "DIRECT-xy". x and y are selected
          * from the following character set: upper case letters, lower case
-         * letters and numbers.
+         * letters and numbers. Any byte values allowed for an SSID according to
+         * IEEE802.11-2012 [1] may be included after the string "DIRECT-xy"
+         * (including none).
          * <p>
          *     Must be called - an empty network name or an network name
          *     not conforming to the P2P Group ID naming rule is not valid.
@@ -264,7 +274,7 @@
          * @return The builder to facilitate chaining
          *         {@code builder.setXXX(..).setXXX(..)}.
          */
-        public Builder setNetworkName(String networkName) {
+        public @NonNull Builder setNetworkName(@NonNull String networkName) {
             if (TextUtils.isEmpty(networkName)) {
                 throw new IllegalArgumentException(
                         "network name must be non-empty.");
@@ -284,17 +294,24 @@
         /**
          * Specify the passphrase for creating or joining a group.
          * <p>
+         * The passphrase must be an ASCII string whose length is between 8
+         * and 63.
+         * <p>
          *     Must be called - an empty passphrase is not valid.
          *
          * @param passphrase the passphrase of a group.
          * @return The builder to facilitate chaining
          *         {@code builder.setXXX(..).setXXX(..)}.
          */
-        public Builder setPassphrase(String passphrase) {
+        public @NonNull Builder setPassphrase(@NonNull String passphrase) {
             if (TextUtils.isEmpty(passphrase)) {
                 throw new IllegalArgumentException(
                         "passphrase must be non-empty.");
             }
+            if (passphrase.length() < 8 || passphrase.length() > 63) {
+                throw new IllegalArgumentException(
+                        "The length of a passphrase must be between 8 and 63.");
+            }
             mPassphrase = passphrase;
             return this;
         }
@@ -331,7 +348,7 @@
          * @return The builder to facilitate chaining
          *         {@code builder.setXXX(..).setXXX(..)}.
          */
-        public Builder setGroupOperatingBand(@GroupOwnerBandType int band) {
+        public @NonNull Builder setGroupOperatingBand(@GroupOperatingBandType int band) {
             switch (band) {
                 case GROUP_OWNER_BAND_AUTO:
                 case GROUP_OWNER_BAND_2GHZ:
@@ -346,7 +363,7 @@
         }
 
         /**
-         * Specify the frequency to use for creating the group or joining the group.
+         * Specify the frequency, in MHz, to use for creating the group or joining the group.
          * <p>
          * When creating a group as Group Owner using {@link WifiP2pManager#createGroup(
          * WifiP2pManager.Channel, WifiP2pConfig, WifiP2pManager.ActionListener)},
@@ -372,7 +389,7 @@
          * @return The builder to facilitate chaining
          *         {@code builder.setXXX(..).setXXX(..)}.
          */
-        public Builder setGroupOperatingFrequency(int frequency) {
+        public @NonNull Builder setGroupOperatingFrequency(int frequency) {
             if (frequency < 0) {
                 throw new IllegalArgumentException(
                     "Invalid group operating frequency!");
@@ -391,7 +408,7 @@
          * @return The builder to facilitate chaining
          *         {@code builder.setXXX(..).setXXX(..)}.
          */
-        public Builder enablePersistentMode(boolean persistent) {
+        public @NonNull Builder enablePersistentMode(boolean persistent) {
             if (persistent) {
                 mNetId = WifiP2pGroup.PERSISTENT_NET_ID;
             } else {
@@ -404,7 +421,7 @@
          * Build {@link WifiP2pConfig} given the current requests made on the builder.
          * @return {@link WifiP2pConfig} constructed based on builder method calls.
          */
-        public WifiP2pConfig build() {
+        public @NonNull WifiP2pConfig build() {
             if (TextUtils.isEmpty(mNetworkName)) {
                 throw new IllegalStateException(
                         "network name must be non-empty.");
diff --git a/wifi/java/android/net/wifi/p2p/WifiP2pDevice.java b/wifi/java/android/net/wifi/p2p/WifiP2pDevice.java
index ab7bb68..c5318a9 100644
--- a/wifi/java/android/net/wifi/p2p/WifiP2pDevice.java
+++ b/wifi/java/android/net/wifi/p2p/WifiP2pDevice.java
@@ -385,7 +385,7 @@
     }
 
     /** Implement the Parcelable interface */
-    public static final Creator<WifiP2pDevice> CREATOR =
+    public static final @android.annotation.NonNull Creator<WifiP2pDevice> CREATOR =
         new Creator<WifiP2pDevice>() {
             @Override
             public WifiP2pDevice createFromParcel(Parcel in) {
diff --git a/wifi/java/android/net/wifi/p2p/WifiP2pDeviceList.java b/wifi/java/android/net/wifi/p2p/WifiP2pDeviceList.java
index 72edd56..acf06fb 100644
--- a/wifi/java/android/net/wifi/p2p/WifiP2pDeviceList.java
+++ b/wifi/java/android/net/wifi/p2p/WifiP2pDeviceList.java
@@ -200,7 +200,7 @@
     }
 
     /** Implement the Parcelable interface */
-    public static final Creator<WifiP2pDeviceList> CREATOR =
+    public static final @android.annotation.NonNull Creator<WifiP2pDeviceList> CREATOR =
         new Creator<WifiP2pDeviceList>() {
             public WifiP2pDeviceList createFromParcel(Parcel in) {
                 WifiP2pDeviceList deviceList = new WifiP2pDeviceList();
diff --git a/wifi/java/android/net/wifi/p2p/WifiP2pGroup.java b/wifi/java/android/net/wifi/p2p/WifiP2pGroup.java
index 8a1b21c..4866bd4 100644
--- a/wifi/java/android/net/wifi/p2p/WifiP2pGroup.java
+++ b/wifi/java/android/net/wifi/p2p/WifiP2pGroup.java
@@ -332,7 +332,7 @@
     }
 
     /** Implement the Parcelable interface */
-    public static final Creator<WifiP2pGroup> CREATOR =
+    public static final @android.annotation.NonNull Creator<WifiP2pGroup> CREATOR =
         new Creator<WifiP2pGroup>() {
             public WifiP2pGroup createFromParcel(Parcel in) {
                 WifiP2pGroup group = new WifiP2pGroup();
diff --git a/wifi/java/android/net/wifi/p2p/WifiP2pGroupList.java b/wifi/java/android/net/wifi/p2p/WifiP2pGroupList.java
index 8d92253..62524d9 100644
--- a/wifi/java/android/net/wifi/p2p/WifiP2pGroupList.java
+++ b/wifi/java/android/net/wifi/p2p/WifiP2pGroupList.java
@@ -231,7 +231,7 @@
     }
 
     /** Implement the Parcelable interface */
-    public static final Creator<WifiP2pGroupList> CREATOR =
+    public static final @android.annotation.NonNull Creator<WifiP2pGroupList> CREATOR =
         new Creator<WifiP2pGroupList>() {
             public WifiP2pGroupList createFromParcel(Parcel in) {
                 WifiP2pGroupList grpList = new WifiP2pGroupList();
diff --git a/wifi/java/android/net/wifi/p2p/WifiP2pInfo.java b/wifi/java/android/net/wifi/p2p/WifiP2pInfo.java
index 8972b7e..33bc37e 100644
--- a/wifi/java/android/net/wifi/p2p/WifiP2pInfo.java
+++ b/wifi/java/android/net/wifi/p2p/WifiP2pInfo.java
@@ -77,7 +77,7 @@
     }
 
     /** Implement the Parcelable interface */
-    public static final Creator<WifiP2pInfo> CREATOR =
+    public static final @android.annotation.NonNull Creator<WifiP2pInfo> CREATOR =
         new Creator<WifiP2pInfo>() {
             public WifiP2pInfo createFromParcel(Parcel in) {
                 WifiP2pInfo info = new WifiP2pInfo();
diff --git a/wifi/java/android/net/wifi/p2p/WifiP2pManager.java b/wifi/java/android/net/wifi/p2p/WifiP2pManager.java
index 63f47e7..a779378 100644
--- a/wifi/java/android/net/wifi/p2p/WifiP2pManager.java
+++ b/wifi/java/android/net/wifi/p2p/WifiP2pManager.java
@@ -793,7 +793,7 @@
          * The requested {@link android.net.NetworkInfo} is available
          * @param networkInfo Wi-Fi p2p {@link android.net.NetworkInfo}
          */
-        void onNetworkInfoAvailable(NetworkInfo networkInfo);
+        void onNetworkInfoAvailable(@NonNull NetworkInfo networkInfo);
     }
 
     /**
@@ -816,7 +816,7 @@
          * The requested {@link android.net.wifi.p2p.WifiP2pDevice} is available.
          * @param wifiP2pDevice Wi-Fi p2p {@link android.net.wifi.p2p.WifiP2pDevice}
          */
-        void onDeviceInfoAvailable(WifiP2pDevice wifiP2pDevice);
+        void onDeviceInfoAvailable(@Nullable WifiP2pDevice wifiP2pDevice);
     }
 
     /**
diff --git a/wifi/java/android/net/wifi/p2p/WifiP2pWfdInfo.java b/wifi/java/android/net/wifi/p2p/WifiP2pWfdInfo.java
index f9ef08f..3caa280 100644
--- a/wifi/java/android/net/wifi/p2p/WifiP2pWfdInfo.java
+++ b/wifi/java/android/net/wifi/p2p/WifiP2pWfdInfo.java
@@ -195,7 +195,7 @@
 
     /** Implement the Parcelable interface */
     @UnsupportedAppUsage
-    public static final Creator<WifiP2pWfdInfo> CREATOR =
+    public static final @android.annotation.NonNull Creator<WifiP2pWfdInfo> CREATOR =
         new Creator<WifiP2pWfdInfo>() {
             public WifiP2pWfdInfo createFromParcel(Parcel in) {
                 WifiP2pWfdInfo device = new WifiP2pWfdInfo();
diff --git a/wifi/java/android/net/wifi/p2p/nsd/WifiP2pServiceInfo.java b/wifi/java/android/net/wifi/p2p/nsd/WifiP2pServiceInfo.java
index e9ee7bb..db0bdb8 100644
--- a/wifi/java/android/net/wifi/p2p/nsd/WifiP2pServiceInfo.java
+++ b/wifi/java/android/net/wifi/p2p/nsd/WifiP2pServiceInfo.java
@@ -171,7 +171,7 @@
 
     /** Implement the Parcelable interface {@hide} */
     @UnsupportedAppUsage
-    public static final Creator<WifiP2pServiceInfo> CREATOR =
+    public static final @android.annotation.NonNull Creator<WifiP2pServiceInfo> CREATOR =
         new Creator<WifiP2pServiceInfo>() {
             public WifiP2pServiceInfo createFromParcel(Parcel in) {
 
diff --git a/wifi/java/android/net/wifi/p2p/nsd/WifiP2pServiceRequest.java b/wifi/java/android/net/wifi/p2p/nsd/WifiP2pServiceRequest.java
index f1f2262..87528c4 100644
--- a/wifi/java/android/net/wifi/p2p/nsd/WifiP2pServiceRequest.java
+++ b/wifi/java/android/net/wifi/p2p/nsd/WifiP2pServiceRequest.java
@@ -266,7 +266,7 @@
 
     /** Implement the Parcelable interface {@hide} */
     @UnsupportedAppUsage
-    public static final Creator<WifiP2pServiceRequest> CREATOR =
+    public static final @android.annotation.NonNull Creator<WifiP2pServiceRequest> CREATOR =
         new Creator<WifiP2pServiceRequest>() {
             public WifiP2pServiceRequest createFromParcel(Parcel in) {
                 int servType = in.readInt();
diff --git a/wifi/java/android/net/wifi/p2p/nsd/WifiP2pServiceResponse.java b/wifi/java/android/net/wifi/p2p/nsd/WifiP2pServiceResponse.java
index 1020fd2..1b9c080 100644
--- a/wifi/java/android/net/wifi/p2p/nsd/WifiP2pServiceResponse.java
+++ b/wifi/java/android/net/wifi/p2p/nsd/WifiP2pServiceResponse.java
@@ -350,7 +350,7 @@
     }
 
     /** Implement the Parcelable interface {@hide} */
-    public static final Creator<WifiP2pServiceResponse> CREATOR =
+    public static final @android.annotation.NonNull Creator<WifiP2pServiceResponse> CREATOR =
         new Creator<WifiP2pServiceResponse>() {
             public WifiP2pServiceResponse createFromParcel(Parcel in) {
 
diff --git a/wifi/java/android/net/wifi/rtt/CivicLocation.java b/wifi/java/android/net/wifi/rtt/CivicLocation.java
index a669d77..1d41177 100644
--- a/wifi/java/android/net/wifi/rtt/CivicLocation.java
+++ b/wifi/java/android/net/wifi/rtt/CivicLocation.java
@@ -91,7 +91,7 @@
         mCivicAddressElements = in.readSparseArray(this.getClass().getClassLoader());
     }
 
-    public static final Creator<CivicLocation> CREATOR = new Creator<CivicLocation>() {
+    public static final @android.annotation.NonNull Creator<CivicLocation> CREATOR = new Creator<CivicLocation>() {
         @Override
         public CivicLocation createFromParcel(Parcel in) {
             return new CivicLocation(in);
@@ -155,6 +155,16 @@
     }
 
     /**
+     * Converts a CivicLocation object to a SparseArray.
+     *
+     * @return the SparseArray<string> representation of the CivicLocation
+     */
+    @Nullable
+    public SparseArray<String> toSparseArray() {
+        return mCivicAddressElements;
+    }
+
+    /**
      * Generates a comma separated string of all the defined elements.
      *
      * @return a compiled string representing all elements
diff --git a/wifi/java/android/net/wifi/rtt/CivicLocationKeys.java b/wifi/java/android/net/wifi/rtt/CivicLocationKeys.java
index 17c3671..b03f4a9 100644
--- a/wifi/java/android/net/wifi/rtt/CivicLocationKeys.java
+++ b/wifi/java/android/net/wifi/rtt/CivicLocationKeys.java
@@ -25,9 +25,8 @@
 /**
  * Civic Address key types used to define address elements.
  *
- * <p>These keys can be used in ResponderLocation look-up the corresponding string values.</p>
- *
- * @hide
+ * <p>These keys can be used with {@code ResponderLocation.toCivicLocationSparseArray()}
+ * to look-up the corresponding string values.</p>
  */
 public class CivicLocationKeys {
 
@@ -69,7 +68,7 @@
     public static final int HNO = 19;
     /** House number suffix key e.g. A, 1/2. */
     public static final int HNS = 20;
-    /** Landmark or vanity address key e.g. Columbia Univ. */
+    /** Landmark or vanity address key e.g. Golden Gate Bridge. */
     public static final int LMK = 21;
     /** Additional Location info key e.g. South Wing. */
     public static final int LOC = 22;
@@ -77,7 +76,7 @@
     public static final int NAM = 23;
     /** Postal or ZIP code key e.g. 10027-1234. */
     public static final int POSTAL_CODE = 24;
-    /** Building key e.g. Low Library. */
+    /** Building key e.g. Lincoln Library. */
     public static final int BUILDING = 25;
     /** Apartment or suite key e.g. Apt 42. */
     public static final int APT = 26;
diff --git a/wifi/java/android/net/wifi/rtt/RangingRequest.java b/wifi/java/android/net/wifi/rtt/RangingRequest.java
index 339233b..70af03e 100644
--- a/wifi/java/android/net/wifi/rtt/RangingRequest.java
+++ b/wifi/java/android/net/wifi/rtt/RangingRequest.java
@@ -76,7 +76,7 @@
         dest.writeList(mRttPeers);
     }
 
-    public static final Creator<RangingRequest> CREATOR = new Creator<RangingRequest>() {
+    public static final @android.annotation.NonNull Creator<RangingRequest> CREATOR = new Creator<RangingRequest>() {
         @Override
         public RangingRequest[] newArray(int size) {
             return new RangingRequest[size];
diff --git a/wifi/java/android/net/wifi/rtt/RangingResult.java b/wifi/java/android/net/wifi/rtt/RangingResult.java
index b53b35c..a065bbc 100644
--- a/wifi/java/android/net/wifi/rtt/RangingResult.java
+++ b/wifi/java/android/net/wifi/rtt/RangingResult.java
@@ -245,8 +245,10 @@
     }
 
     /**
-     * @return The responder location represented as {@link ResponderLocation} which captures
-     * location information the responder is programmed to broadcast.
+     * @return The unverified responder location represented as {@link ResponderLocation} which
+     * captures location information the responder is programmed to broadcast. The responder
+     * location is referred to as unverified, because we are relying on the device/site
+     * administrator to correctly configure its location data.
      * <p>
      * Will return a {@code null} when the location information cannot be parsed.
      * <p>
@@ -254,10 +256,11 @@
      * exception.
      */
     @Nullable
-    public ResponderLocation getResponderLocation() {
+    public ResponderLocation getUnverifiedResponderLocation() {
         if (mStatus != STATUS_SUCCESS) {
             throw new IllegalStateException(
-                    "getResponderLocation(): invoked on an invalid result: getStatus()=" + mStatus);
+                    "getUnverifiedResponderLocation(): invoked on an invalid result: getStatus()="
+                            + mStatus);
         }
         return mResponderLocation;
     }
@@ -349,7 +352,7 @@
         dest.writeLong(mTimestamp);
     }
 
-    public static final Creator<RangingResult> CREATOR = new Creator<RangingResult>() {
+    public static final @android.annotation.NonNull Creator<RangingResult> CREATOR = new Creator<RangingResult>() {
         @Override
         public RangingResult[] newArray(int size) {
             return new RangingResult[size];
diff --git a/wifi/java/android/net/wifi/rtt/ResponderConfig.java b/wifi/java/android/net/wifi/rtt/ResponderConfig.java
index 166af6c..e6ae483 100644
--- a/wifi/java/android/net/wifi/rtt/ResponderConfig.java
+++ b/wifi/java/android/net/wifi/rtt/ResponderConfig.java
@@ -406,7 +406,7 @@
         dest.writeInt(preamble);
     }
 
-    public static final Creator<ResponderConfig> CREATOR = new Creator<ResponderConfig>() {
+    public static final @android.annotation.NonNull Creator<ResponderConfig> CREATOR = new Creator<ResponderConfig>() {
         @Override
         public ResponderConfig[] newArray(int size) {
             return new ResponderConfig[size];
diff --git a/wifi/java/android/net/wifi/rtt/ResponderLocation.java b/wifi/java/android/net/wifi/rtt/ResponderLocation.java
index 2912a67..37d5f0a 100644
--- a/wifi/java/android/net/wifi/rtt/ResponderLocation.java
+++ b/wifi/java/android/net/wifi/rtt/ResponderLocation.java
@@ -19,19 +19,25 @@
 import static java.lang.annotation.RetentionPolicy.SOURCE;
 
 import android.annotation.IntDef;
+import android.annotation.NonNull;
 import android.annotation.Nullable;
 import android.annotation.SystemApi;
 import android.location.Address;
+import android.location.Location;
 import android.net.MacAddress;
+import android.net.Uri;
 import android.net.wifi.rtt.CivicLocationKeys.CivicLocationKeysType;
 import android.os.Parcel;
 import android.os.Parcelable;
+import android.text.TextUtils;
+import android.util.SparseArray;
+import android.webkit.MimeTypeMap;
 
 import java.lang.annotation.Retention;
-import java.net.MalformedURLException;
-import java.net.URL;
+import java.nio.charset.StandardCharsets;
 import java.util.ArrayList;
 import java.util.Arrays;
+import java.util.Collections;
 import java.util.List;
 import java.util.Objects;
 
@@ -151,24 +157,8 @@
     /** Version of the LCI protocol is 1.0, the only defined protocol at this time. */
     public static final int LCI_VERSION_1 = 1;
 
-    /**
-     * Enumerates the flags contained in getLciFlags()
-     *
-     * @hide
-     */
-    @Retention(SOURCE)
-    @IntDef(flag = true, value = {LCI_FLAGS_MASK_REGLOC_AGREEMENT, LCI_FLAGS_MASK_REGLOC_DSE,
-        LCI_FLAGS_MASK_DEPENDENT_STA, LCI_FLAGS_MASK_VERSION})
-    public @interface LciFlagMasks {
-    }
-    /** Location agreement flag is obtained by ANDing this mask with the getLciFlags() value.*/
-    public static final int LCI_FLAGS_MASK_REGLOC_AGREEMENT = 0x10;
-    /** Location DSE flag is obtained by ANDing this mask with the getLciFlags() value.*/
-    public static final int LCI_FLAGS_MASK_REGLOC_DSE = 0x08;
-    /** Dependent station flag is obtained by ANDing this mask with the getLciFlags() value. */
-    public static final int LCI_FLAGS_MASK_DEPENDENT_STA = 0x04;
-    /** Version bits are obtained by ANDing this mask with the getLciFlags() value.*/
-    public static final int LCI_FLAGS_MASK_VERSION = 0x03;
+    /** Provider/Source of the location */
+    private static final String LOCATION_PROVIDER = "WiFi Access Point";
 
     // LCI Subelement Z constants
     private static final int[] SUBELEMENT_Z_BIT_FIELD_LENGTHS = {2, 14, 24, 8};
@@ -178,9 +168,9 @@
 
     // LCI Subelement Z fields indices
     private static final int SUBELEMENT_Z_LAT_EXPECTED_TO_MOVE_INDEX = 0;
-    private static final int SUBELEMENT_Z_STA_FLOOR_NUMBER_INDEX = 1;
-    private static final int SUBELEMENT_Z_STA_HEIGHT_ABOVE_FLOOR_INDEX = 2;
-    private static final int SUBELEMENT_Z_STA_HEIGHT_ABOVE_FLOOR_UNCERTAINTY_INDEX = 3;
+    private static final int SUBELEMENT_Z_FLOOR_NUMBER_INDEX = 1;
+    private static final int SUBELEMENT_Z_HEIGHT_ABOVE_FLOOR_INDEX = 2;
+    private static final int SUBELEMENT_Z_HEIGHT_ABOVE_FLOOR_UNCERTAINTY_INDEX = 3;
 
     // LCI Subelement Usage Rules constants
     private static final int SUBELEMENT_USAGE_MASK_RETRANSMIT = 0x01;
@@ -233,72 +223,27 @@
 
     // LCR Map Image Subelement field indexes.
     private static final int SUBELEMENT_IMAGE_MAP_TYPE_INDEX = 0;
-
-    /**
-     * The Map Type value specifies the image format type.
-     *
-     * @hide
-     */
-    @Retention(SOURCE)
-    @IntDef({
-            MAP_TYPE_URL_DEFINED,
-            MAP_TYPE_PNG,
-            MAP_TYPE_GIF,
-            MAP_TYPE_JPG,
-            MAP_TYPE_SVG,
-            MAP_TYPE_DXF,
-            MAP_TYPE_DWG,
-            MAP_TYPE_DWF,
-            MAP_TYPE_CAD,
-            MAP_TYPE_TIFF,
-            MAP_TYPE_GML,
-            MAP_TYPE_KML,
-            MAP_TYPE_BMP,
-            MAP_TYPE_PGM,
-            MAP_TYPE_PPM,
-            MAP_TYPE_XBM,
-            MAP_TYPE_XPM,
-            MAP_TYPE_ICO
-    })
-    public @interface MapImageType {
-    }
-
-    /** File type defined by the file suffix itself. */
-    public static final int MAP_TYPE_URL_DEFINED = 0;
-    /** File type is in PNG format. */
-    public static final int MAP_TYPE_PNG = 1;
-    /** File type is in GIF format. */
-    public static final int MAP_TYPE_GIF = 2;
-    /** File type is in JPG format. */
-    public static final int MAP_TYPE_JPG = 3;
-    /** File type is in SVG format. */
-    public static final int MAP_TYPE_SVG = 4;
-    /** File type is in DXF format. */
-    public static final int MAP_TYPE_DXF = 5;
-    /** File type is in DWG format. */
-    public static final int MAP_TYPE_DWG = 6;
-    /** File type is in DWF format. */
-    public static final int MAP_TYPE_DWF = 7;
-    /** File type is in CAD format. */
-    public static final int MAP_TYPE_CAD = 8;
-    /** File type is in TIFF format. */
-    public static final int MAP_TYPE_TIFF = 9;
-    /** File type is in GML format. */
-    public static final int MAP_TYPE_GML = 10;
-    /** File type is in KML format. */
-    public static final int MAP_TYPE_KML = 11;
-    /** File type is in BMP format. */
-    public static final int MAP_TYPE_BMP = 12;
-    /** File type is in PGM format. */
-    public static final int MAP_TYPE_PGM = 13;
-    /** File type is in PPM format. */
-    public static final int MAP_TYPE_PPM = 14;
-    /** File type is in XBM format. */
-    public static final int MAP_TYPE_XBM = 15;
-    /** File type is in XPM format. */
-    public static final int MAP_TYPE_XPM = 16;
-    /** File type is in ICO format. */
-    public static final int MAP_TYPE_ICO = 17;
+    private static final int MAP_TYPE_URL_DEFINED = 0;
+    private static final String[] SUPPORTED_IMAGE_FILE_EXTENSIONS = {
+            "",
+            "png",
+            "gif",
+            "jpg",
+            "svg",
+            "dxf",
+            "dwg",
+            "dwf",
+            "cad",
+            "tif",
+            "gml",
+            "kml",
+            "bmp",
+            "pgm",
+            "ppm",
+            "xbm",
+            "xpm",
+            "ico"
+    };
 
     // General LCI and LCR state
     private final boolean mIsValid;
@@ -323,13 +268,16 @@
     private double mAltitudeUncertainty;
     private double mAltitude;
     private int mDatum;
-    private int mLciFlags;
+    private boolean mLciRegisteredLocationAgreement;
+    private boolean mLciRegisteredLocationDse;
+    private boolean mLciDependentStation;
+    private int mLciVersion;
 
     // LCI Subelement Z state
     private int mExpectedToMove;
-    private double mStaFloorNumber;
-    private double mStaHeightAboveFloorMeters;
-    private double mStaHeightAboveFloorUncertaintyMeters;
+    private double mFloorNumber;
+    private double mHeightAboveFloorMeters;
+    private double mHeightAboveFloorUncertaintyMeters;
 
     // LCI Subelement Usage Rights state
     private boolean mUsageRetransmit;
@@ -346,7 +294,7 @@
 
     // LCR Subelement Map Image state
     private int mMapImageType;
-    private URL mMapImageUrl;
+    private Uri mMapImageUri;
 
     /**
      * Constructor
@@ -360,7 +308,7 @@
         boolean isLciIeValid = false;
         boolean isLcrIeValid = false;
         setLciSubelementDefaults();
-        setZSubelementDefaults();
+        setZaxisSubelementDefaults();
         setUsageSubelementDefaults();
         setBssidListSubelementDefaults();
         setCivicLocationSubelementDefaults();
@@ -384,7 +332,7 @@
 
         if (!mIsValid) {
             setLciSubelementDefaults();
-            setZSubelementDefaults();
+            setZaxisSubelementDefaults();
             setCivicLocationSubelementDefaults();
             setMapImageSubelementDefaults();
         }
@@ -409,13 +357,16 @@
         mAltitudeUncertainty = in.readDouble();
         mAltitude = in.readDouble();
         mDatum = in.readInt();
-        mLciFlags = in.readInt();
+        mLciRegisteredLocationAgreement = in.readByte() != 0;
+        mLciRegisteredLocationDse = in.readByte() != 0;
+        mLciDependentStation = in.readByte() != 0;
+        mLciVersion = in.readInt();
 
         // LCI Subelement Z state
         mExpectedToMove = in.readInt();
-        mStaFloorNumber = in.readDouble();
-        mStaHeightAboveFloorMeters = in.readDouble();
-        mStaHeightAboveFloorUncertaintyMeters = in.readDouble();
+        mFloorNumber = in.readDouble();
+        mHeightAboveFloorMeters = in.readDouble();
+        mHeightAboveFloorUncertaintyMeters = in.readDouble();
 
         // LCI Usage Rights
         mUsageRetransmit = in.readByte() != 0;
@@ -432,14 +383,15 @@
 
         // LCR Subelement Map Image
         mMapImageType = in.readInt();
-        try {
-            mMapImageUrl = new URL(in.readString());
-        } catch (MalformedURLException e) {
-            mMapImageUrl = null;
+        String urlString = in.readString();
+        if (TextUtils.isEmpty(urlString)) {
+            mMapImageUri = null;
+        } else {
+            mMapImageUri = Uri.parse(urlString);
         }
     }
 
-    public static final Creator<ResponderLocation> CREATOR = new Creator<ResponderLocation>() {
+    public static final @android.annotation.NonNull Creator<ResponderLocation> CREATOR = new Creator<ResponderLocation>() {
         @Override
         public ResponderLocation createFromParcel(Parcel in) {
             return new ResponderLocation(in);
@@ -476,13 +428,16 @@
         parcel.writeDouble(mAltitudeUncertainty);
         parcel.writeDouble(mAltitude);
         parcel.writeInt(mDatum);
-        parcel.writeInt(mLciFlags);
+        parcel.writeByte((byte) (mLciRegisteredLocationAgreement ? 1 : 0));
+        parcel.writeByte((byte) (mLciRegisteredLocationDse ? 1 : 0));
+        parcel.writeByte((byte) (mLciDependentStation ? 1 : 0));
+        parcel.writeInt(mLciVersion);
 
         // LCI Subelement Z state
         parcel.writeInt(mExpectedToMove);
-        parcel.writeDouble(mStaFloorNumber);
-        parcel.writeDouble(mStaHeightAboveFloorMeters);
-        parcel.writeDouble(mStaHeightAboveFloorUncertaintyMeters);
+        parcel.writeDouble(mFloorNumber);
+        parcel.writeDouble(mHeightAboveFloorMeters);
+        parcel.writeDouble(mHeightAboveFloorUncertaintyMeters);
 
         // LCI Usage Rights
         parcel.writeByte((byte) (mUsageRetransmit ? 1 : 0));
@@ -499,8 +454,8 @@
 
         // LCR Subelement Map Image
         parcel.writeInt(mMapImageType);
-        if (mMapImageUrl != null) {
-            parcel.writeString(mMapImageUrl.toString());
+        if (mMapImageUri != null) {
+            parcel.writeString(mMapImageUri.toString());
         } else {
             parcel.writeString("");
         }
@@ -546,14 +501,14 @@
                 switch (subelement) {
                     case SUBELEMENT_LCI:
                         mIsLciValid = parseSubelementLci(subelementData);
-                        if (!mIsLciValid || (mLciFlags & LCI_FLAGS_MASK_VERSION) != LCI_VERSION_1) {
+                        if (!mIsLciValid || mLciVersion != LCI_VERSION_1) {
                             setLciSubelementDefaults();
                         }
                         break;
                     case SUBELEMENT_Z:
                         mIsZValid = parseSubelementZ(subelementData);
                         if (!mIsZValid) {
-                            setZSubelementDefaults();
+                            setZaxisSubelementDefaults();
                         }
                         break;
                     case SUBELEMENT_USAGE:
@@ -625,14 +580,13 @@
         mAltitude =
                 Math.scalb(subelementLciFields[SUBELEMENT_LCI_ALT_INDEX], -ALTITUDE_FRACTION_BITS);
         mDatum = (int) subelementLciFields[SUBELEMENT_LCI_DATUM_INDEX] & BYTE_MASK;
-        mLciFlags =
-                (int) subelementLciFields[SUBELEMENT_LCI_REGLOC_AGREEMENT_INDEX]
-                        * LCI_FLAGS_MASK_REGLOC_AGREEMENT
-                        | (int) subelementLciFields[SUBELEMENT_LCI_REGLOC_DSE_INDEX]
-                        * LCI_FLAGS_MASK_REGLOC_DSE
-                        | (int) subelementLciFields[SUBELEMENT_LCI_DEPENDENT_STA_INDEX]
-                        * LCI_FLAGS_MASK_DEPENDENT_STA
-                        | (int) subelementLciFields[SUBELEMENT_LCI_VERSION_INDEX];
+        mLciRegisteredLocationAgreement =
+                (subelementLciFields[SUBELEMENT_LCI_REGLOC_AGREEMENT_INDEX] == 1);
+        mLciRegisteredLocationDse =
+                (subelementLciFields[SUBELEMENT_LCI_REGLOC_DSE_INDEX] == 1);
+        mLciDependentStation =
+                (subelementLciFields[SUBELEMENT_LCI_DEPENDENT_STA_INDEX] == 1);
+        mLciVersion = (int) subelementLciFields[SUBELEMENT_LCI_VERSION_INDEX];
         return true;
     }
 
@@ -703,19 +657,18 @@
 
         mExpectedToMove =
                 (int) subelementZFields[SUBELEMENT_Z_LAT_EXPECTED_TO_MOVE_INDEX] & BYTE_MASK;
-
-        mStaFloorNumber = decodeZUnsignedToSignedValue(subelementZFields,
-                SUBELEMENT_Z_BIT_FIELD_LENGTHS, SUBELEMENT_Z_STA_FLOOR_NUMBER_INDEX,
+        mFloorNumber = decodeZUnsignedToSignedValue(subelementZFields,
+                SUBELEMENT_Z_BIT_FIELD_LENGTHS, SUBELEMENT_Z_FLOOR_NUMBER_INDEX,
                 Z_FLOOR_NUMBER_FRACTION_BITS);
 
-        mStaHeightAboveFloorMeters = decodeZUnsignedToSignedValue(subelementZFields,
-                SUBELEMENT_Z_BIT_FIELD_LENGTHS, SUBELEMENT_Z_STA_HEIGHT_ABOVE_FLOOR_INDEX,
+        mHeightAboveFloorMeters = decodeZUnsignedToSignedValue(subelementZFields,
+                SUBELEMENT_Z_BIT_FIELD_LENGTHS, SUBELEMENT_Z_HEIGHT_ABOVE_FLOOR_INDEX,
                 Z_FLOOR_HEIGHT_FRACTION_BITS);
 
         long zHeightUncertainty =
-                subelementZFields[SUBELEMENT_Z_STA_HEIGHT_ABOVE_FLOOR_UNCERTAINTY_INDEX];
+                subelementZFields[SUBELEMENT_Z_HEIGHT_ABOVE_FLOOR_UNCERTAINTY_INDEX];
         if (zHeightUncertainty > 0 && zHeightUncertainty < Z_MAX_HEIGHT_UNCERTAINTY_FACTOR) {
-            mStaHeightAboveFloorUncertaintyMeters =
+            mHeightAboveFloorUncertaintyMeters =
                     Math.pow(2, Z_FLOOR_HEIGHT_FRACTION_BITS - zHeightUncertainty - 1);
         } else {
             return false;
@@ -831,21 +784,38 @@
             return false;
         }
         int mapImageType = buffer[SUBELEMENT_IMAGE_MAP_TYPE_INDEX];
-        if (mapImageType < MAP_TYPE_URL_DEFINED || mapImageType > MAP_TYPE_DWG) {
+        int supportedTypesMax = SUPPORTED_IMAGE_FILE_EXTENSIONS.length - 1;
+        if (mapImageType < MAP_TYPE_URL_DEFINED || mapImageType > supportedTypesMax) {
             return false;
         }
         this.mMapImageType = mapImageType;
         byte[] urlBytes = Arrays.copyOfRange(buffer, 1, buffer.length);
-        try {
-            mMapImageUrl = new URL(new String(urlBytes));
-        } catch (MalformedURLException e) {
-            mMapImageUrl = null;
-            return false;
-        }
+        mMapImageUri = Uri.parse(new String(urlBytes, StandardCharsets.UTF_8));
         return true;
     }
 
     /**
+     * Convert an image type code to a Mime type
+     *
+     * @param imageTypeCode encoded as an integer
+     * @return the mime type of the image file
+     */
+    private String imageTypeToMime(int imageTypeCode, String imageUrl) {
+        int supportedExtensionsMax = SUPPORTED_IMAGE_FILE_EXTENSIONS.length - 1;
+        if ((imageTypeCode == 0 && imageUrl == null) || imageTypeCode > supportedExtensionsMax) {
+            return null;
+        }
+        MimeTypeMap mimeTypeMap = MimeTypeMap.getSingleton();
+        if (imageTypeCode == 0) {
+            return mimeTypeMap.getMimeTypeFromExtension(
+                    MimeTypeMap.getFileExtensionFromUrl(imageUrl));
+        } else {
+            return mimeTypeMap.getMimeTypeFromExtension(
+                    SUPPORTED_IMAGE_FILE_EXTENSIONS[imageTypeCode]);
+        }
+    }
+
+    /**
      * Converts a byte array containing fields of variable size, into an array of longs where the
      * field boundaries are defined in a constant int array passed as an argument.
      *
@@ -927,18 +897,21 @@
         mAltitudeUncertainty = UNCERTAINTY_UNDEFINED;
         mAltitude = 0;
         mDatum = DATUM_UNDEFINED;
-        mLciFlags = 0;
+        mLciRegisteredLocationAgreement = false;
+        mLciRegisteredLocationDse = false;
+        mLciDependentStation = false;
+        mLciVersion = 0;
     }
 
     /**
      * Sets the Z subelement fields to the default values when undefined.
      */
-    private void setZSubelementDefaults() {
+    private void setZaxisSubelementDefaults() {
         mIsZValid = false;
         mExpectedToMove = 0;
-        mStaFloorNumber = 0;
-        mStaHeightAboveFloorMeters = 0;
-        mStaHeightAboveFloorUncertaintyMeters = 0;
+        mFloorNumber = 0;
+        mHeightAboveFloorMeters = 0;
+        mHeightAboveFloorUncertaintyMeters = 0;
     }
 
     /**
@@ -976,7 +949,7 @@
     private void setMapImageSubelementDefaults() {
         mIsMapImageValid = false;
         mMapImageType = MAP_TYPE_URL_DEFINED;
-        mMapImageUrl = null;
+        mMapImageUri = null;
     }
 
     @Override
@@ -1003,12 +976,15 @@
                 && mAltitudeUncertainty == other.mAltitudeUncertainty
                 && mAltitude == other.mAltitude
                 && mDatum == other.mDatum
-                && mLciFlags == other.mLciFlags
+                && mLciRegisteredLocationAgreement == other.mLciRegisteredLocationAgreement
+                && mLciRegisteredLocationDse == other.mLciRegisteredLocationDse
+                && mLciDependentStation == other.mLciDependentStation
+                && mLciVersion == other.mLciVersion
                 && mExpectedToMove == other.mExpectedToMove
-                && mStaFloorNumber == other.mStaFloorNumber
-                && mStaHeightAboveFloorMeters == other.mStaHeightAboveFloorMeters
-                && mStaHeightAboveFloorUncertaintyMeters
-                        == other.mStaHeightAboveFloorUncertaintyMeters
+                && mFloorNumber == other.mFloorNumber
+                && mHeightAboveFloorMeters == other.mHeightAboveFloorMeters
+                && mHeightAboveFloorUncertaintyMeters
+                        == other.mHeightAboveFloorUncertaintyMeters
                 && mUsageRetransmit == other.mUsageRetransmit
                 && mUsageRetentionExpires == other.mUsageRetentionExpires
                 && mUsageExtraInfoOnAssociation == other.mUsageExtraInfoOnAssociation
@@ -1017,7 +993,7 @@
                 && mCivicLocationString.equals(other.mCivicLocationString)
                 && Objects.equals(mCivicLocation, other.mCivicLocation)
                 && mMapImageType == other.mMapImageType
-                && Objects.equals(mMapImageUrl, other.mMapImageUrl);
+                && Objects.equals(mMapImageUri, other.mMapImageUri);
     }
 
     @Override
@@ -1025,10 +1001,12 @@
         return Objects.hash(mIsValid, mIsLciValid, mIsZValid, mIsUsageValid, mIsBssidListValid,
                 mIsLocationCivicValid, mIsMapImageValid, mLatitudeUncertainty, mLatitude,
                 mLongitudeUncertainty, mLongitude, mAltitudeType, mAltitudeUncertainty, mAltitude,
-                mDatum, mLciFlags, mExpectedToMove, mStaFloorNumber, mStaHeightAboveFloorMeters,
-                mStaHeightAboveFloorUncertaintyMeters, mUsageRetransmit, mUsageRetentionExpires,
+                mDatum, mLciRegisteredLocationAgreement,
+                mLciRegisteredLocationDse, mLciDependentStation, mLciVersion,
+                mExpectedToMove, mFloorNumber, mHeightAboveFloorMeters,
+                mHeightAboveFloorUncertaintyMeters, mUsageRetransmit, mUsageRetentionExpires,
                 mUsageExtraInfoOnAssociation, mBssidList, mCivicLocationCountryCode,
-                mCivicLocationString, mCivicLocation, mMapImageType, mMapImageUrl);
+                mCivicLocationString, mCivicLocation, mMapImageType, mMapImageUri);
     }
 
     /**
@@ -1059,198 +1037,267 @@
 
     /**
      * @return the latitude uncertainty in degrees.
-     *
+     * <p>
      * Only valid if {@link #isLciSubelementValid()} returns true, or will throw an exception.
-     *
+     * </p>
      * <p> An unknown uncertainty is indicated by 0.</p>
      */
     public double getLatitudeUncertainty() {
         if (!mIsLciValid) {
             throw new IllegalStateException(
-                "getLatitudeUncertainty(): invoked on an invalid result: mIsLciValid = false)");
+                "getLatitudeUncertainty(): invoked on an invalid result: mIsLciValid = false.");
         }
         return mLatitudeUncertainty;
     }
 
     /**
      * @return the latitude in degrees
-     *
+     * <p>
      * Only valid if {@link #isLciSubelementValid()} returns true, or will throw an exception.
      */
     public double getLatitude() {
         if (!mIsLciValid) {
             throw new IllegalStateException(
-                "getLatitude(): invoked on an invalid result: mIsLciValid = false)");
+                "getLatitude(): invoked on an invalid result: mIsLciValid = false.");
         }
         return mLatitude;
     }
 
     /**
      * @return the Longitude uncertainty in degrees.
-     *
+     * <p>
      * Only valid if {@link #isLciSubelementValid()} returns true, or will throw an exception.
-     *
+     * </p>
      * <p> An unknown uncertainty is indicated by 0.</p>
      */
     public double getLongitudeUncertainty() {
         if (!mIsLciValid) {
             throw new IllegalStateException(
-                "getLongitudeUncertainty(): invoked on an invalid result: mIsLciValid = false)");
+                "getLongitudeUncertainty(): invoked on an invalid result: mIsLciValid = false.");
         }
         return mLongitudeUncertainty;
     }
 
     /**
      * @return the Longitude in degrees..
-     *
+     * <p>
      * Only valid if {@link #isLciSubelementValid()} returns true, or will throw an exception.
      */
     public double getLongitude() {
         if (!mIsLciValid) {
             throw new IllegalStateException(
-                "getLatitudeUncertainty(): invoked on an invalid result: mIsLciValid = false)");
+                "getLatitudeUncertainty(): invoked on an invalid result: mIsLciValid = false.");
         }
         return mLongitude;
     }
 
     /**
      * @return the Altitude type.
-     *
+     * <p>
      * Only valid if {@link #isLciSubelementValid()} returns true, or will throw an exception.
      */
     @AltitudeType
     public int getAltitudeType() {
         if (!mIsLciValid) {
             throw new IllegalStateException(
-                "getLatitudeUncertainty(): invoked on an invalid result: mIsLciValid = false)");
+                "getLatitudeUncertainty(): invoked on an invalid result: mIsLciValid = false.");
         }
         return mAltitudeType;
     }
 
     /**
      * @return the Altitude uncertainty in meters.
-     *
+     * <p>
      * Only valid if {@link #isLciSubelementValid()} returns true, or will throw an exception.
-     *
+     * </p>
      * <p>An unknown uncertainty is indicated by 0.</p>
      */
     public double getAltitudeUncertainty() {
         if (!mIsLciValid) {
             throw new IllegalStateException(
-                "getLatitudeUncertainty(): invoked on an invalid result: mIsLciValid = false)");
+                "getLatitudeUncertainty(): invoked on an invalid result: mIsLciValid = false.");
         }
         return mAltitudeUncertainty;
     }
 
     /**
      * @return the Altitude in units defined by the altitude type.
-     *
+     * <p>
      * Only valid if {@link #isLciSubelementValid()} returns true, or will throw an exception.
      */
     public double getAltitude() {
         if (!mIsLciValid) {
             throw new IllegalStateException(
-                "getAltitude(): invoked on an invalid result: mIsLciValid = false)");
+                "getAltitude(): invoked on an invalid result: mIsLciValid = false.");
         }
         return mAltitude;
     }
 
     /**
      * @return the Datum used for the LCI positioning information.
-     *
+     * <p>
      * Only valid if {@link #isLciSubelementValid()} returns true, or will throw an exception.
      */
     @DatumType
     public int getDatum() {
         if (!mIsLciValid) {
             throw new IllegalStateException(
-                "getDatum(): invoked on an invalid result: mIsLciValid = false)");
+                "getDatum(): invoked on an invalid result: mIsLciValid = false.");
         }
         return mDatum;
     }
 
     /**
-     * @return the LCI sub-element flags (5-bits).
-     *
+     * @return true if the station is operating within a national policy area or an international
+     * agreement area near a national border, otherwise false
+     * (see 802.11REVmc Section 11.12.3 - Registered STA Operation).
+     * <p>
      * Only valid if {@link #isLciSubelementValid()} returns true, or will throw an exception.
-     *
-     * <p>Note: The flags/version can be extracted by bitwise ANDing this value with the
-     * corresponding LCI_FLAGS_MASK_* .</p>
      */
-    public int getLciFlags() {
+    public boolean getRegisteredLocationAgreementIndication() {
         if (!mIsLciValid) {
             throw new IllegalStateException(
-                "getLciFlags(): invoked on an invalid result: mIsLciValid = false)");
+                "getRegisteredLocationAgreementIndication(): "
+                        + "invoked on an invalid result: mIsLciValid = false.");
         }
-        return mLciFlags;
+        return mLciRegisteredLocationAgreement;
+    }
+
+    /**
+     * @return true indicating this is an enabling station, enabling the operation of nearby STAs
+     * with Dynamic Station Enablement (DSE), otherwise false.
+     * (see 802.11REVmc Section 11.12.3 - Registered STA Operation).
+     * <p>
+     * Only valid if {@link #isLciSubelementValid()} returns true, or will throw an exception.
+     */
+    public boolean getRegisteredLocationDseIndication() {
+        if (!mIsLciValid) {
+            throw new IllegalStateException(
+                "getRegisteredLocationDseIndication(): "
+                    + "invoked on an invalid result: mIsLciValid = false.");
+        }
+        return mLciRegisteredLocationDse;
+    }
+
+    /**
+     * @return true indicating this is a dependent station that is operating with the enablement of
+     * an enabling station whose LCI is being reported, otherwise false.
+     * (see 802.11REVmc Section 11.12.3 - Registered STA Operation).
+     * <p>
+     * Only valid if {@link #isLciSubelementValid()} returns true, or will throw an exception.
+     */
+    public boolean getDependentStationIndication() {
+        if (!mIsLciValid) {
+            throw new IllegalStateException(
+                "getDependentStationIndication(): "
+                    + "invoked on an invalid result: mIsLciValid = false.");
+        }
+        return mLciDependentStation;
+    }
+
+    /**
+     * @return a value greater or equal to 1, indicating the current version number
+     * of the LCI protocol.
+     * <p>
+     * Only valid if {@link #isLciSubelementValid()} returns true, or will throw an exception.
+     */
+    public int getLciVersion() {
+        if (!mIsLciValid) {
+            throw new IllegalStateException(
+                "getLciVersion(): "
+                    + "invoked on an invalid result: mIsLciValid = false.");
+        }
+        return mLciVersion;
+    }
+
+    /**
+     * @return the LCI location represented as a {@link Location} object (best effort).
+     * <p>
+     * Only valid if {@link #isLciSubelementValid()} returns true, or will throw an exception.
+     */
+    @NonNull
+    public Location toLocation() {
+        if (!mIsLciValid) {
+            throw new IllegalStateException(
+                "toLocation(): "
+                    + "invoked on an invalid result: mIsLciValid = false.");
+        }
+        Location location = new Location(LOCATION_PROVIDER);
+        location.setLatitude(mLatitude);
+        location.setLongitude(mLongitude);
+        location.setAccuracy((float) (mLatitudeUncertainty + mLongitudeUncertainty) / 2);
+        location.setAltitude(mAltitude);
+        location.setVerticalAccuracyMeters((float) mAltitudeUncertainty);
+        location.setTime(System.currentTimeMillis());
+        return location;
     }
 
     /**
      * @return if the Z subelement (containing mobility, Floor, Height above floor) is valid.
      */
-    public boolean isZsubelementValid() {
+    public boolean isZaxisSubelementValid() {
         return mIsZValid;
     }
 
     /**
      * @return an integer representing the mobility of the responder.
-     *
-     * Only valid if {@link #isZsubelementValid()} returns true, or will throw an exception.
+     * <p>
+     * Only valid if {@link #isZaxisSubelementValid()} returns true, or will throw an exception.
      */
     @ExpectedToMoveType
     public int getExpectedToMove() {
         if (!mIsZValid) {
             throw new IllegalStateException(
-                "getExpectedToMove(): invoked on an invalid result: mIsZValid = false)");
+                "getExpectedToMove(): invoked on an invalid result: mIsZValid = false.");
         }
         return mExpectedToMove;
     }
 
     /**
-     * @return the Z sub element STA Floor Number.
-     *
-     * Only valid if {@link #isZsubelementValid()} returns true, or will throw an exception.
-     *
+     * @return the Z sub element Floor Number.
+     * <p>
+     * Only valid if {@link #isZaxisSubelementValid()} returns true, or will throw an exception.
+     * </p>
      * <p>Note: this number can be positive or negative, with value increments of +/- 1/16 of a
      * floor.</p>.
      */
-    public double getStaFloorNumber() {
+    public double getFloorNumber() {
         if (!mIsZValid) {
             throw new IllegalStateException(
-                "getStaFloorNumber(): invoked on an invalid result: mIsZValid = false)");
+                "getFloorNumber(): invoked on an invalid result: mIsZValid = false)");
         }
-        return mStaFloorNumber;
+        return mFloorNumber;
     }
 
     /**
-     * @return the Z subelement STA Height above the floor in meters.
-     *
-     * Only valid if {@link #isZsubelementValid()} returns true, or will throw an exception.
-     *
+     * @return the Z subelement Height above the floor in meters.
+     * <p>
+     * Only valid if {@link #isZaxisSubelementValid()} returns true, or will throw an exception.
+     * </p>
      * <p>This value can be positive or negative. </p>
      */
-    public double getStaHeightAboveFloorMeters() {
+    public double getHeightAboveFloorMeters() {
         if (!mIsZValid) {
             throw new IllegalStateException(
-                "getStaHeightAboveFloorMeters(): invoked on an invalid result: mIsZValid = false)");
+                "getHeightAboveFloorMeters(): invoked on an invalid result: mIsZValid = false)");
         }
-        return mStaHeightAboveFloorMeters;
+        return mHeightAboveFloorMeters;
     }
 
     /**
-     * @return the Z subelement STA Height above the floor uncertainty in meters.
-     *
-     * Only valid if {@link #isZsubelementValid()} returns true, or will throw an exception.
-     *
+     * @return the Z subelement Height above the floor uncertainty in meters.
+     * <p>
+     * Only valid if {@link #isZaxisSubelementValid()} returns true, or will throw an exception.
+     * </p>
      * <p>An unknown uncertainty is indicated by 0.</p>
      */
-    public double getStaHeightAboveFloorUncertaintyMeters() {
+    public double getHeightAboveFloorUncertaintyMeters() {
         if (!mIsZValid) {
             throw new IllegalStateException(
-                "getStaHeightAboveFloorUncertaintyMeters():"
+                "getHeightAboveFloorUncertaintyMeters():"
                     + "invoked on an invalid result: mIsZValid = false)");
         }
-        return mStaHeightAboveFloorUncertaintyMeters;
+        return mHeightAboveFloorUncertaintyMeters;
     }
 
     /**
@@ -1267,7 +1314,6 @@
      * @return true if location-data received should expire (and be deleted)
      * by the time provided in the getRelativeExpirationTimeHours() method.
      *
-     *
      * @hide
      */
     public boolean getRetentionExpiresIndication() {
@@ -1285,20 +1331,18 @@
     }
 
     /**
-     * @return the list of colocated BSSIDs at the responder.
+     * @return the Immutable list of colocated BSSIDs at the responder.
      *
      * <p> Will return an empty list when there are no bssids listed.
      */
     public List<MacAddress> getColocatedBssids() {
-        return mBssidList;
+        return Collections.unmodifiableList(mBssidList);
     }
 
     /**
      * @return the civic location represented as an {@link Address} object (best effort).
      *
-     * <p> Will return a {@code null} when there is no Civic Location define defined.
-     *
-     * @hide
+     * <p> Will return a {@code null} when there is no Civic Location defined.
      */
     @Nullable
     public Address toCivicLocationAddress() {
@@ -1309,6 +1353,22 @@
         }
     }
 
+    /**
+     * @return the civic location represented as a {@link SparseArray}
+     * <p>
+     * Valid keys to access the SparseArray can be found in {@code CivicLocationKeys}.
+     * </p>
+     * <p> Will return a {@code null} when there is no Civic Location defined.
+     *
+     */
+    @Nullable
+    public SparseArray toCivicLocationSparseArray() {
+        if (mCivicLocation != null && mCivicLocation.isValid()) {
+            return mCivicLocation.toSparseArray();
+        } else {
+            return null;
+        }
+    }
 
     /**
      * @return the civic location two upper-case ASCII character country code defined in ISO 3166.
@@ -1337,20 +1397,24 @@
     }
 
     /**
-     * @return the Map Image file type, referred to by getMapImageUrl(), encoded as an integer.
+     * @return the Map Image file Mime type, referred to by getMapImageUrl().
      */
-    @MapImageType
-    public int getMapImageType() {
-        return mMapImageType;
+    @Nullable
+    public String getMapImageMimeType() {
+        if (mMapImageUri == null) {
+            return null;
+        } else {
+            return imageTypeToMime(mMapImageType, mMapImageUri.toString());
+        }
     }
 
     /**
-     * @return a Url referencing a map-file showing the local floor plan.
+     * @return a URI referencing a map-file showing the local floor plan.
      *
-     * <p> Will return a {@code null} when there is no URL defined.
+     * <p> Will return a {@code null} when there is no URI defined.
      */
     @Nullable
-    public URL getMapImageUrl() {
-        return mMapImageUrl;
+    public Uri getMapImageUri() {
+        return mMapImageUri;
     }
 }
diff --git a/wifi/tests/src/android/net/wifi/WifiConfigurationTest.java b/wifi/tests/src/android/net/wifi/WifiConfigurationTest.java
index 449423f..d927052 100644
--- a/wifi/tests/src/android/net/wifi/WifiConfigurationTest.java
+++ b/wifi/tests/src/android/net/wifi/WifiConfigurationTest.java
@@ -293,4 +293,59 @@
         assertEquals(config.apChannel, restoredConfig.apChannel);
         assertEquals(config.hiddenSSID, restoredConfig.hiddenSSID);
     }
+
+
+    /**
+     * Verifies that getKeyIdForCredentials returns the expected string for Enterprise networks
+     * @throws Exception
+     */
+    @Test
+    public void testGetKeyIdForCredentials() throws Exception {
+        WifiConfiguration config = new WifiConfiguration();
+        final String mSsid = "TestAP";
+        config.SSID = mSsid;
+
+        // Test various combinations
+        // EAP with TLS
+        config.allowedKeyManagement.set(KeyMgmt.WPA_EAP);
+        config.enterpriseConfig.setEapMethod(WifiEnterpriseConfig.Eap.TLS);
+        config.enterpriseConfig.setPhase2Method(WifiEnterpriseConfig.Phase2.NONE);
+        String keyId = config.getKeyIdForCredentials(config);
+        assertEquals(keyId, mSsid + "_WPA_EAP_TLS_NULL");
+
+        // EAP with TTLS & MSCHAPv2
+        config.allowedKeyManagement.set(KeyMgmt.WPA_EAP);
+        config.enterpriseConfig.setEapMethod(WifiEnterpriseConfig.Eap.TTLS);
+        config.enterpriseConfig.setPhase2Method(WifiEnterpriseConfig.Phase2.MSCHAPV2);
+        keyId = config.getKeyIdForCredentials(config);
+        assertEquals(keyId, mSsid + "_WPA_EAP_TTLS_MSCHAPV2");
+
+        // Suite-B 192 with PWD & GTC
+        config.allowedKeyManagement.clear();
+        config.allowedKeyManagement.set(KeyMgmt.SUITE_B_192);
+        config.enterpriseConfig.setEapMethod(WifiEnterpriseConfig.Eap.PWD);
+        config.enterpriseConfig.setPhase2Method(WifiEnterpriseConfig.Phase2.GTC);
+        keyId = config.getKeyIdForCredentials(config);
+        assertEquals(keyId, mSsid + "_SUITE_B_192_PWD_GTC");
+
+        // IEEE8021X with SIM
+        config.allowedKeyManagement.clear();
+        config.allowedKeyManagement.set(KeyMgmt.IEEE8021X);
+        config.enterpriseConfig.setEapMethod(WifiEnterpriseConfig.Eap.SIM);
+        config.enterpriseConfig.setPhase2Method(WifiEnterpriseConfig.Phase2.NONE);
+        keyId = config.getKeyIdForCredentials(config);
+        assertEquals(keyId, mSsid + "_IEEE8021X_SIM_NULL");
+
+        // Try calling this method with non-Enterprise network, expect an exception
+        boolean exceptionThrown = false;
+        try {
+            config.allowedKeyManagement.clear();
+            config.allowedKeyManagement.set(KeyMgmt.WPA2_PSK);
+            config.preSharedKey = "TestPsk";
+            keyId = config.getKeyIdForCredentials(config);
+        } catch (IllegalStateException e) {
+            exceptionThrown = true;
+        }
+        assertTrue(exceptionThrown);
+    }
 }
diff --git a/wifi/tests/src/android/net/wifi/aware/WifiAwareManagerTest.java b/wifi/tests/src/android/net/wifi/aware/WifiAwareManagerTest.java
index 3cc96bf..657a338 100644
--- a/wifi/tests/src/android/net/wifi/aware/WifiAwareManagerTest.java
+++ b/wifi/tests/src/android/net/wifi/aware/WifiAwareManagerTest.java
@@ -958,9 +958,8 @@
         WifiAwareNetworkSpecifier ns =
                 (WifiAwareNetworkSpecifier) publishSession.getValue().createNetworkSpecifierOpen(
                         peerHandle);
-        WifiAwareNetworkSpecifier nsb = (WifiAwareNetworkSpecifier) new WifiAwareManager
-                .NetworkSpecifierBuilder().setDiscoverySession(publishSession.getValue())
-                .setPeerHandle(peerHandle).build();
+        WifiAwareNetworkSpecifier nsb = new WifiAwareNetworkSpecifier.Builder().setDiscoverySession(
+                publishSession.getValue()).setPeerHandle(peerHandle).build();
 
         // validate format
         collector.checkThat("role", WifiAwareManager.WIFI_AWARE_DATA_PATH_ROLE_RESPONDER,
@@ -980,9 +979,9 @@
         // (4) request an encrypted (PMK) network specifier from the session
         ns = (WifiAwareNetworkSpecifier) publishSession.getValue().createNetworkSpecifierPmk(
                 peerHandle, pmk);
-        nsb = (WifiAwareNetworkSpecifier) new WifiAwareManager.NetworkSpecifierBuilder()
-                .setDiscoverySession(publishSession.getValue()).setPeerHandle(peerHandle)
-                .setPmk(pmk).setPort(port).setTransportProtocol(transportProtocol).build();
+        nsb = new WifiAwareNetworkSpecifier.Builder().setDiscoverySession(
+                publishSession.getValue()).setPeerHandle(peerHandle).setPmk(pmk).setPort(
+                port).setTransportProtocol(transportProtocol).build();
 
         // validate format
         collector.checkThat("role", WifiAwareManager.WIFI_AWARE_DATA_PATH_ROLE_RESPONDER,
@@ -1006,10 +1005,9 @@
                 (WifiAwareNetworkSpecifier) publishSession.getValue()
                         .createNetworkSpecifierPassphrase(
                         peerHandle, passphrase);
-        nsb = (WifiAwareNetworkSpecifier) new WifiAwareManager.NetworkSpecifierBuilder()
-                .setDiscoverySession(publishSession.getValue()).setPeerHandle(peerHandle)
-                .setPskPassphrase(passphrase).setPort(port).setTransportProtocol(transportProtocol)
-                .build();
+        nsb = new WifiAwareNetworkSpecifier.Builder().setDiscoverySession(
+                publishSession.getValue()).setPeerHandle(peerHandle).setPskPassphrase(
+                passphrase).setPort(port).setTransportProtocol(transportProtocol).build();
 
         // validate format
         collector.checkThat("role", WifiAwareManager.WIFI_AWARE_DATA_PATH_ROLE_RESPONDER,
@@ -1257,14 +1255,14 @@
         // (3) create network specifier
         if (doPmk) {
             if (useBuilder) {
-                new WifiAwareManager.NetworkSpecifierBuilder().setDiscoverySession(
+                new WifiAwareNetworkSpecifier.Builder().setDiscoverySession(
                         publishSession.getValue()).setPeerHandle(peerHandle).setPmk(pmk).build();
             } else {
                 publishSession.getValue().createNetworkSpecifierPmk(peerHandle, pmk);
             }
         } else {
             if (useBuilder) {
-                new WifiAwareManager.NetworkSpecifierBuilder().setDiscoverySession(
+                new WifiAwareNetworkSpecifier.Builder().setDiscoverySession(
                         publishSession.getValue()).setPeerHandle(peerHandle).setPskPassphrase(
                         passphrase).build();
             } else {
@@ -1355,10 +1353,8 @@
 
         DiscoverySession publishSession = executeSessionStartup(true);
 
-        WifiAwareNetworkSpecifier nsb =
-                (WifiAwareNetworkSpecifier) new WifiAwareManager.NetworkSpecifierBuilder()
-                        .setDiscoverySession(publishSession).setPeerHandle(peerHandle)
-                        .setPmk(pmk).setPort(port).build();
+        WifiAwareNetworkSpecifier nsb = new WifiAwareNetworkSpecifier.Builder().setDiscoverySession(
+                publishSession).setPeerHandle(peerHandle).setPmk(pmk).setPort(port).build();
     }
 
     /**
@@ -1372,10 +1368,8 @@
 
         DiscoverySession publishSession = executeSessionStartup(true);
 
-        WifiAwareNetworkSpecifier nsb =
-                (WifiAwareNetworkSpecifier) new WifiAwareManager.NetworkSpecifierBuilder()
-                        .setDiscoverySession(publishSession).setPeerHandle(peerHandle)
-                        .setPort(port).build();
+        WifiAwareNetworkSpecifier nsb = new WifiAwareNetworkSpecifier.Builder().setDiscoverySession(
+                publishSession).setPeerHandle(peerHandle).setPort(port).build();
     }
 
     /**
@@ -1389,10 +1383,8 @@
 
         DiscoverySession subscribeSession = executeSessionStartup(false);
 
-        WifiAwareNetworkSpecifier nsb =
-                (WifiAwareNetworkSpecifier) new WifiAwareManager.NetworkSpecifierBuilder()
-                        .setDiscoverySession(subscribeSession).setPeerHandle(peerHandle)
-                        .setPort(port).build();
+        WifiAwareNetworkSpecifier nsb = new WifiAwareNetworkSpecifier.Builder().setDiscoverySession(
+                subscribeSession).setPeerHandle(peerHandle).setPort(port).build();
     }
 
     /**
@@ -1411,8 +1403,7 @@
         DiscoverySession publishSession = executeSessionStartup(true);
 
         try {
-            WifiAwareNetworkSpecifier nsb =
-                    (WifiAwareNetworkSpecifier) new WifiAwareManager.NetworkSpecifierBuilder()
+            WifiAwareNetworkSpecifier nsb = new WifiAwareNetworkSpecifier.Builder()
                             .setDiscoverySession(publishSession).setPeerHandle(peerHandle)
                             .setPmk(pmk).setTransportProtocol(tpNegative).build();
             assertTrue("No exception on negative transport protocol!", false);
@@ -1420,23 +1411,19 @@
             // nop - exception is correct!
         }
         try {
-            WifiAwareNetworkSpecifier nsb =
-                    (WifiAwareNetworkSpecifier) new WifiAwareManager.NetworkSpecifierBuilder()
+            WifiAwareNetworkSpecifier nsb = new WifiAwareNetworkSpecifier.Builder()
                             .setDiscoverySession(publishSession).setPeerHandle(peerHandle)
                             .setPmk(pmk).setTransportProtocol(tpTooLarge).build();
             assertTrue("No exception on >255 transport protocol!", false);
         } catch (IllegalArgumentException e) {
             // nop - exception is correct!
         }
-        WifiAwareNetworkSpecifier nsb =
-                (WifiAwareNetworkSpecifier) new WifiAwareManager.NetworkSpecifierBuilder()
+        WifiAwareNetworkSpecifier nsb = new WifiAwareNetworkSpecifier.Builder()
                         .setDiscoverySession(publishSession).setPeerHandle(peerHandle)
                         .setPmk(pmk).setTransportProtocol(tpSmallest).build();
-        nsb =
-                (WifiAwareNetworkSpecifier) new WifiAwareManager.NetworkSpecifierBuilder()
-                        .setDiscoverySession(
-                                publishSession).setPeerHandle(peerHandle).setPmk(
-                        pmk).setTransportProtocol(tpLargest).build();
+        nsb = new WifiAwareNetworkSpecifier.Builder().setDiscoverySession(
+                publishSession).setPeerHandle(peerHandle).setPmk(pmk).setTransportProtocol(
+                tpLargest).build();
     }
 
     /**
@@ -1450,8 +1437,7 @@
 
         DiscoverySession publishSession = executeSessionStartup(true);
 
-        WifiAwareNetworkSpecifier nsb =
-                (WifiAwareNetworkSpecifier) new WifiAwareManager.NetworkSpecifierBuilder()
+        WifiAwareNetworkSpecifier nsb = new WifiAwareNetworkSpecifier.Builder()
                         .setDiscoverySession(publishSession).setPeerHandle(peerHandle)
                         .setTransportProtocol(transportProtocol).build();
     }
@@ -1467,8 +1453,7 @@
 
         DiscoverySession subscribeSession = executeSessionStartup(false);
 
-        WifiAwareNetworkSpecifier nsb =
-                (WifiAwareNetworkSpecifier) new WifiAwareManager.NetworkSpecifierBuilder()
+        WifiAwareNetworkSpecifier nsb = new WifiAwareNetworkSpecifier.Builder()
                         .setDiscoverySession(subscribeSession).setPeerHandle(peerHandle)
                         .setTransportProtocol(transportProtocol).build();
     }
diff --git a/wifi/tests/src/android/net/wifi/p2p/WifiP2pConfigTest.java b/wifi/tests/src/android/net/wifi/p2p/WifiP2pConfigTest.java
index 560c88e..01a4c53 100644
--- a/wifi/tests/src/android/net/wifi/p2p/WifiP2pConfigTest.java
+++ b/wifi/tests/src/android/net/wifi/p2p/WifiP2pConfigTest.java
@@ -73,4 +73,44 @@
             fail("expected IllegalArgumentException");
         } catch (IllegalArgumentException e) { }
     }
+
+    /**
+     * Check passphrase setter
+     */
+    @Test
+    public void testBuilderInvalidPassphrase() throws Exception {
+        WifiP2pConfig.Builder b = new WifiP2pConfig.Builder();
+
+        // sunny case
+        try {
+            b.setPassphrase("abcd1234");
+        } catch (IllegalArgumentException e) {
+            fail("Unexpected IllegalArgumentException");
+        }
+
+        // null string.
+        try {
+            b.setPassphrase(null);
+            fail("should throw IllegalArgumentException");
+        } catch (IllegalArgumentException e) {
+            // expected exception.
+        }
+
+        // less than 8 characters.
+        try {
+            b.setPassphrase("12abcde");
+            fail("should throw IllegalArgumentException");
+        } catch (IllegalArgumentException e) {
+            // expected exception.
+        }
+
+        // more than 63 characters.
+        try {
+            b.setPassphrase(
+                    "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ1234567890+/");
+            fail("should throw IllegalArgumentException");
+        } catch (IllegalArgumentException e) {
+            // expected exception.
+        }
+    }
 }
diff --git a/wifi/tests/src/android/net/wifi/rtt/ResponderLocationTest.java b/wifi/tests/src/android/net/wifi/rtt/ResponderLocationTest.java
index 9efb642..47c30409 100644
--- a/wifi/tests/src/android/net/wifi/rtt/ResponderLocationTest.java
+++ b/wifi/tests/src/android/net/wifi/rtt/ResponderLocationTest.java
@@ -17,8 +17,10 @@
 package android.net.wifi.rtt;
 
 import android.location.Address;
+import android.location.Location;
 import android.net.MacAddress;
 import android.os.Parcel;
+import android.webkit.MimeTypeMap;
 
 import static junit.framework.Assert.assertEquals;
 import static junit.framework.Assert.assertFalse;
@@ -35,7 +37,7 @@
  */
 @RunWith(JUnit4.class)
 public class ResponderLocationTest {
-    private static final double LATLNG_TOLERANCE_DEGREES = 0.001;
+    private static final double LATLNG_TOLERANCE_DEGREES = 0.00001;
     private static final double ALT_TOLERANCE_METERS = 0.01;
     private static final double HEIGHT_TOLERANCE_METERS = 0.01;
     private static final int INDEX_ELEMENT_TYPE = 2;
@@ -170,7 +172,7 @@
     private static final byte[] sTestMapUrlSE = {
             (byte) 5, // Map URL Subelement
             (byte) 25,
-            (byte) ResponderLocation.MAP_TYPE_URL_DEFINED,
+            (byte) 0, // MAP_TYPE_URL_DEFINED
             (byte) 'h',
             (byte) 't',
             (byte) 't',
@@ -206,7 +208,7 @@
 
         boolean valid = responderLocation.isValid();
         boolean lciValid = responderLocation.isLciSubelementValid();
-        boolean zValid = responderLocation.isZsubelementValid();
+        boolean zValid = responderLocation.isZaxisSubelementValid();
 
         assertFalse(valid);
         assertFalse(lciValid);
@@ -222,7 +224,7 @@
 
         boolean valid = responderLocation.isValid();
         boolean lciValid = responderLocation.isLciSubelementValid();
-        boolean zValid = responderLocation.isZsubelementValid();
+        boolean zValid = responderLocation.isZaxisSubelementValid();
 
         assertFalse(valid);
         assertFalse(lciValid);
@@ -240,7 +242,7 @@
 
         boolean valid = responderLocation.isValid();
         boolean lciValid = responderLocation.isLciSubelementValid();
-        boolean zValid = responderLocation.isZsubelementValid();
+        boolean zValid = responderLocation.isZaxisSubelementValid();
 
         assertFalse(valid);
         assertFalse(lciValid);
@@ -258,7 +260,8 @@
 
         boolean valid = responderLocation.isValid();
         boolean lciValid = responderLocation.isLciSubelementValid();
-        boolean zValid = responderLocation.isZsubelementValid();
+        boolean zValid = responderLocation.isZaxisSubelementValid();
+        Location location = responderLocation.toLocation();
 
         assertTrue(valid);
         assertTrue(lciValid);
@@ -273,11 +276,20 @@
         assertEquals(64.0, responderLocation.getAltitudeUncertainty());
         assertEquals(11.2, responderLocation.getAltitude(), ALT_TOLERANCE_METERS);
         assertEquals(1, responderLocation.getDatum()); // WGS84
-        int lciFlags = responderLocation.getLciFlags();
-        assertEquals(0, lciFlags & ResponderLocation.LCI_FLAGS_MASK_REGLOC_AGREEMENT);
-        assertEquals(0, lciFlags & ResponderLocation.LCI_FLAGS_MASK_REGLOC_DSE);
-        assertEquals(0, lciFlags & ResponderLocation.LCI_FLAGS_MASK_DEPENDENT_STA);
-        assertEquals(1, lciFlags & ResponderLocation.LCI_FLAGS_MASK_VERSION);
+        assertEquals(false, responderLocation.getRegisteredLocationAgreementIndication());
+        assertEquals(false, responderLocation.getRegisteredLocationDseIndication());
+        assertEquals(false, responderLocation.getDependentStationIndication());
+        assertEquals(1, responderLocation.getLciVersion());
+
+        // Testing Location Object
+        assertEquals(-33.857009, location.getLatitude(),
+                LATLNG_TOLERANCE_DEGREES);
+        assertEquals(151.215200, location.getLongitude(),
+                LATLNG_TOLERANCE_DEGREES);
+        assertEquals((0.0009765625 + 0.0009765625) / 2, location.getAccuracy(),
+                LATLNG_TOLERANCE_DEGREES);
+        assertEquals(11.2, location.getAltitude(), ALT_TOLERANCE_METERS);
+        assertEquals(64.0, location.getVerticalAccuracyMeters(), ALT_TOLERANCE_METERS);
     }
 
     /**
@@ -292,7 +304,7 @@
 
         boolean valid = responderLocation.isValid();
         boolean lciValid = responderLocation.isLciSubelementValid();
-        boolean zValid = responderLocation.isZsubelementValid();
+        boolean zValid = responderLocation.isZaxisSubelementValid();
 
         assertFalse(valid);
         assertFalse(lciValid);
@@ -312,7 +324,7 @@
 
         boolean valid = responderLocation.isValid();
         boolean lciValid = responderLocation.isLciSubelementValid();
-        boolean zValid = responderLocation.isZsubelementValid();
+        boolean zValid = responderLocation.isZaxisSubelementValid();
 
         assertFalse(valid);
         assertFalse(lciValid);
@@ -332,7 +344,7 @@
 
         boolean valid = responderLocation.isValid();
         boolean lciValid = responderLocation.isLciSubelementValid();
-        boolean zValid = responderLocation.isZsubelementValid();
+        boolean zValid = responderLocation.isZaxisSubelementValid();
 
         assertFalse(valid);
         assertFalse(lciValid);
@@ -352,7 +364,7 @@
 
         boolean valid = responderLocation.isValid();
         boolean lciValid = responderLocation.isLciSubelementValid();
-        boolean zValid = responderLocation.isZsubelementValid();
+        boolean zValid = responderLocation.isZaxisSubelementValid();
 
         assertFalse(valid);
         assertFalse(lciValid);
@@ -370,12 +382,12 @@
                 new ResponderLocation(testBuffer, sTestLcrBufferHeader);
 
         boolean isValid = responderLocation.isValid();
-        boolean isZValid = responderLocation.isZsubelementValid();
+        boolean isZValid = responderLocation.isZaxisSubelementValid();
         boolean isLciValid = responderLocation.isLciSubelementValid();
-        double staFloorNumber = responderLocation.getStaFloorNumber();
-        double staHeightAboveFloorMeters = responderLocation.getStaHeightAboveFloorMeters();
+        double staFloorNumber = responderLocation.getFloorNumber();
+        double staHeightAboveFloorMeters = responderLocation.getHeightAboveFloorMeters();
         double staHeightAboveFloorUncertaintyMeters =
-                responderLocation.getStaHeightAboveFloorUncertaintyMeters();
+                responderLocation.getHeightAboveFloorUncertaintyMeters();
 
         assertTrue(isValid);
         assertTrue(isZValid);
@@ -496,20 +508,21 @@
      * Test that a URL can be extracted from a valid lcr buffer with a map image subelement.
      */
     @Test
-    public void testLcrCheckMapUrlIsValid() {
+    public void testLcrCheckMapUriIsValid() {
         byte[] testLciBuffer = concatenateArrays(sTestLciIeHeader, sTestLciSE);
         byte[] testLcrBuffer = concatenateArrays(sTestLcrBufferHeader, sTestMapUrlSE);
         ResponderLocation responderLocation = new ResponderLocation(testLciBuffer, testLcrBuffer);
 
         boolean valid = responderLocation.isValid();
-        int mapImageType = responderLocation.getMapImageType();
+        String mapImageMimeType = responderLocation.getMapImageMimeType();
         String urlString = "";
-        if (responderLocation.getMapImageUrl() != null) {
-            urlString = responderLocation.getMapImageUrl().toString();
+        if (responderLocation.getMapImageUri() != null) {
+            urlString = responderLocation.getMapImageUri().toString();
         }
 
         assertTrue(valid);
-        assertEquals(ResponderLocation.MAP_TYPE_URL_DEFINED, mapImageType);
+        MimeTypeMap mimeTypeMap = MimeTypeMap.getSingleton();
+        assertEquals(mimeTypeMap.getMimeTypeFromExtension("jpg"), mapImageMimeType);
         assertEquals("https://map.com/mall.jpg", urlString);
     }